1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
<?php
/**
* Definition of OOjs UI ResourceLoader modules.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
// WARNING: OOjs-UI is NOT TESTED with older browsers and is likely to break
// if loaded in browsers that don't support ES5
return call_user_func( function () {
$themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
// We only use the theme names for file names, and they are lowercase
$themes = array_map( 'strtolower', $themes );
$themes['default'] = 'mediawiki';
$modules = array();
$modules['oojs-ui'] = array(
'scripts' => array(
'resources/lib/oojs-ui/oojs-ui.js',
),
'skinScripts' => array_combine(
array_keys( $themes ),
array_map( function ( $theme ) {
// TODO Allow extensions to specify this path somehow
return "resources/lib/oojs-ui/oojs-ui-$theme.js";
}, array_values( $themes ) )
),
'dependencies' => array(
'es5-shim',
'oojs',
'oojs-ui.styles',
'oojs-ui.styles.icons',
'oojs-ui.styles.indicators',
'oojs-ui.styles.textures',
),
'messages' => array(
'ooui-dialog-message-accept',
'ooui-dialog-message-reject',
'ooui-dialog-process-continue',
'ooui-dialog-process-dismiss',
'ooui-dialog-process-error',
'ooui-dialog-process-retry',
'ooui-outline-control-move-down',
'ooui-outline-control-move-up',
'ooui-outline-control-remove',
'ooui-selectfile-button-select',
'ooui-selectfile-dragdrop-placeholder',
'ooui-selectfile-not-supported',
'ooui-selectfile-placeholder',
'ooui-toolbar-more',
'ooui-toolgroup-collapse',
'ooui-toolgroup-expand',
),
'targets' => array( 'desktop', 'mobile' ),
);
$modules['oojs-ui.styles'] = array(
'position' => 'top',
'styles' => 'resources/src/oojs-ui-local.css', // HACK, see inside the file
'skinStyles' => array_combine(
array_keys( $themes ),
array_map( function ( $theme ) {
// TODO Allow extensions to specify this path somehow
return "resources/lib/oojs-ui/oojs-ui-$theme-noimages.css";
}, array_values( $themes ) )
),
'targets' => array( 'desktop', 'mobile' ),
);
$imageSets = array(
// Comments for greppability
'icons', // oojs-ui.styles.icons
'indicators', // oojs-ui.styles.indicators
'textures', // oojs-ui.styles.textures
'icons-accessibility', // oojs-ui.styles.icons-accessibility
'icons-alerts', // oojs-ui.styles.icons-alerts
'icons-content', // oojs-ui.styles.icons-content
'icons-editing-advanced', // oojs-ui.styles.icons-editing-advanced
'icons-editing-core', // oojs-ui.styles.icons-editing-core
'icons-editing-list', // oojs-ui.styles.icons-editing-list
'icons-editing-styling', // oojs-ui.styles.icons-editing-styling
'icons-interactions', // oojs-ui.styles.icons-interactions
'icons-layout', // oojs-ui.styles.icons-layout
'icons-location', // oojs-ui.styles.icons-location
'icons-media', // oojs-ui.styles.icons-media
'icons-moderation', // oojs-ui.styles.icons-moderation
'icons-movement', // oojs-ui.styles.icons-movement
'icons-user', // oojs-ui.styles.icons-user
'icons-wikimedia', // oojs-ui.styles.icons-wikimedia
);
$rootPath = 'resources/lib/oojs-ui/themes';
foreach ( $imageSets as $name ) {
$module = array(
'position' => 'top',
'class' => 'ResourceLoaderOOUIImageModule',
'name' => $name,
'rootPath' => $rootPath,
);
if ( substr( $name, 0, 5 ) === 'icons' ) {
$module['selectorWithoutVariant'] = '.oo-ui-icon-{name}, .mw-ui-icon-{name}:before';
$module['selectorWithVariant'] = '
.oo-ui-image-{variant}.oo-ui-icon-{name}, .mw-ui-icon-{name}-{variant}:before,
/* Hack for Flow, see T110051 */
.mw-ui-hovericon:hover .mw-ui-icon-{name}-{variant}-hover:before,
.mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
}
$modules["oojs-ui.styles.$name"] = $module;
}
return $modules;
} );
|