Index: branches/RL2/extensions/Gadgets/Gadgets.php |
— | — | @@ -144,16 +144,39 @@ |
145 | 145 | 'remoteExtPath' => 'Gadgets/modules' |
146 | 146 | ); |
147 | 147 | $wgResourceModules += array( |
148 | | - // Also loaded in if javascript disabled |
149 | | - 'ext.gadgets.prejs' => $gadResourceTemplate + array( |
150 | | - 'styles' => 'ext.gadgets.prejs.css', |
| 148 | + // Styling for elements outputted by PHP |
| 149 | + 'ext.gadgets.specialgadgets.prejs' => $gadResourceTemplate + array( |
| 150 | + 'styles' => 'ext.gadgets.specialgadgets.prejs.css', |
151 | 151 | 'position' => 'top', |
152 | 152 | ), |
| 153 | + // Initializes mw.gadgets object |
| 154 | + 'ext.gadgets.init' => $gadResourceTemplate + array( |
| 155 | + 'scripts' => 'ext.gadgets.init.js', |
| 156 | + 'position' => 'top', |
| 157 | + ), |
| 158 | + // Adds tabs to Special:Gadgets |
| 159 | + 'ext.gadgets.specialgadgets.tabs' => $gadResourceTemplate + array( |
| 160 | + 'scripts' => 'ext.gadgets.specialgadgets.tabs.js', |
| 161 | + 'messages' => array( |
| 162 | + 'gadgets-gadget-create', |
| 163 | + 'gadgets-gadget-create-tooltip', |
| 164 | + ), |
| 165 | + 'dependencies' => array( |
| 166 | + 'ext.gadgets.init', |
| 167 | + 'mediawiki.util', |
| 168 | + ), |
| 169 | + 'position' => 'top', |
| 170 | + ), |
153 | 171 | // Method to interact with API |
154 | 172 | 'ext.gadgets.api' => $gadResourceTemplate + array( |
155 | 173 | 'scripts' => 'ext.gadgets.api.js', |
156 | 174 | // Can't depend on user.tokens yet due to a bug in ResourceLoader (bug 30914) |
157 | | - 'dependencies' => array( 'mediawiki.util', 'mediawiki.Title'/*, 'user.tokens'*/ ), |
| 175 | + 'dependencies' => array( |
| 176 | + 'ext.gadgets.init', |
| 177 | + 'mediawiki.Title', |
| 178 | + 'mediawiki.util', |
| 179 | + #'user.tokens', |
| 180 | + ), |
158 | 181 | ), |
159 | 182 | // jQuery plugin |
160 | 183 | 'jquery.createPropCloud' => $gadResourceTemplate + array( |
— | — | @@ -164,6 +187,7 @@ |
165 | 188 | 'scripts' => 'ext.gadgets.gadgetmanager.js', |
166 | 189 | 'styles' => 'ext.gadgets.gadgetmanager.css', |
167 | 190 | 'dependencies' => array( |
| 191 | + 'ext.gadgets.init', |
168 | 192 | 'ext.gadgets.api', |
169 | 193 | 'jquery.localize', |
170 | 194 | 'jquery.ui.autocomplete', |
— | — | @@ -174,8 +198,6 @@ |
175 | 199 | 'jquery.spinner', |
176 | 200 | ), |
177 | 201 | 'messages' => array( |
178 | | - 'gadgets-gadget-create', |
179 | | - 'gadgets-gadget-create-tooltip', |
180 | 202 | 'gadgetmanager-editor-title-editing', |
181 | 203 | 'gadgetmanager-editor-title-creating', |
182 | 204 | 'gadgetmanager-editor-prop-remove', |
Index: branches/RL2/extensions/Gadgets/SpecialGadgets.php |
— | — | @@ -32,7 +32,8 @@ |
33 | 33 | public function execute( $par ) { |
34 | 34 | $this->par = $par; |
35 | 35 | $out = $this->getOutput(); |
36 | | - $out->addModuleStyles( 'ext.gadgets.prejs' ); |
| 36 | + $out->addModuleStyles( 'ext.gadgets.specialgadgets.prejs' ); |
| 37 | + $out->addModules( 'ext.gadgets.specialgadgets.tabs' ); |
37 | 38 | |
38 | 39 | // Map title parts to query string |
39 | 40 | if ( is_string( $par ) ) { |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.prejs.css |
— | — | @@ -1,65 +0,0 @@ |
2 | | -/* Gadget list */ |
3 | | -.mw-gadgets-list { |
4 | | - width: 100%; |
5 | | - border-bottom: 1px solid #ccc; |
6 | | -} |
7 | | - |
8 | | -.mw-gadgets-gadget { |
9 | | - overflow: hidden; |
10 | | - position: relative; |
11 | | - padding: 0.5em; |
12 | | - border: 1px solid #ccc; |
13 | | - border-bottom: 0; |
14 | | -} |
15 | | - |
16 | | -.mw-gadgets-gadget:hover { |
17 | | - background: #f9f9ff; |
18 | | -} |
19 | | - |
20 | | -.mw-gadgets-title { |
21 | | - font-weight: bold; |
22 | | - min-height: 1.6em; |
23 | | -} |
24 | | - |
25 | | -/* Tool links */ |
26 | | - |
27 | | -.mw-gadgets-messagelink { |
28 | | - font-size: 75%; |
29 | | - font-weight: normal; |
30 | | -} |
31 | | - |
32 | | -.mw-gadgets-messagelink a { |
33 | | - padding-left: 18px; |
34 | | - /* @embed */ |
35 | | - background-image: url(images/edit-faded.png); |
36 | | - background-position: left top; |
37 | | - background-repeat: no-repeat; |
38 | | -} |
39 | | - |
40 | | -.mw-gadgets-messagelink a:hover { |
41 | | - /* @embed */ |
42 | | - background-image: url(images/edit.png); |
43 | | -} |
44 | | - |
45 | | -.mw-gadgets-gadgetlinks { |
46 | | - position: absolute; |
47 | | - top: 0; |
48 | | - right: 0; |
49 | | - height: 1.6em; |
50 | | - padding: 9px; |
51 | | - font-size: 75%; |
52 | | - font-weight: normal; |
53 | | -} |
54 | | - |
55 | | -.mw-gadgets-gadgetlinks { |
56 | | - float: right; |
57 | | -} |
58 | | - |
59 | | -.mw-gadgets-gadgetlinks a { |
60 | | - margin: 0 9px; |
61 | | -} |
62 | | - |
63 | | -/* Export */ |
64 | | -.mw-gadgets-exportform fieldset { |
65 | | - max-width: 50%; |
66 | | -} |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.api.js |
— | — | @@ -117,13 +117,7 @@ |
118 | 118 | |
119 | 119 | /* Public functions */ |
120 | 120 | |
121 | | - mw.gadgets = { |
122 | | - /** |
123 | | - * @todo: Add something derived from $wgGadgetRepositories to gadgetsConf |
124 | | - * ... + repos: { local: { apiScript: .. }, awesomeRepo: { .. }, .. } |
125 | | - */ |
126 | | - conf: mw.config.get( 'gadgetsConf' ), |
127 | | - api: { |
| 121 | + mw.gadgets.api = { |
128 | 122 | /** |
129 | 123 | * Get the gadget blobs for all gadgets from all repositories. |
130 | 124 | * |
— | — | @@ -385,6 +379,5 @@ |
386 | 380 | gadgetCategoryCache = {}; |
387 | 381 | return true; |
388 | 382 | } |
389 | | - } |
390 | 383 | }; |
391 | 384 | })( jQuery ); |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.specialgadgets.prejs.css |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +/* Gadget list */ |
| 3 | +.mw-gadgets-list { |
| 4 | + width: 100%; |
| 5 | + border-bottom: 1px solid #ccc; |
| 6 | +} |
| 7 | + |
| 8 | +.mw-gadgets-gadget { |
| 9 | + overflow: hidden; |
| 10 | + position: relative; |
| 11 | + padding: 0.5em; |
| 12 | + border: 1px solid #ccc; |
| 13 | + border-bottom: 0; |
| 14 | +} |
| 15 | + |
| 16 | +.mw-gadgets-gadget:hover { |
| 17 | + background: #f9f9ff; |
| 18 | +} |
| 19 | + |
| 20 | +.mw-gadgets-title { |
| 21 | + font-weight: bold; |
| 22 | + min-height: 1.6em; |
| 23 | +} |
| 24 | + |
| 25 | +/* Tool links */ |
| 26 | + |
| 27 | +.mw-gadgets-messagelink { |
| 28 | + font-size: 75%; |
| 29 | + font-weight: normal; |
| 30 | +} |
| 31 | + |
| 32 | +.mw-gadgets-messagelink a { |
| 33 | + padding-left: 18px; |
| 34 | + /* @embed */ |
| 35 | + background-image: url(images/edit-faded.png); |
| 36 | + background-position: left top; |
| 37 | + background-repeat: no-repeat; |
| 38 | +} |
| 39 | + |
| 40 | +.mw-gadgets-messagelink a:hover { |
| 41 | + /* @embed */ |
| 42 | + background-image: url(images/edit.png); |
| 43 | +} |
| 44 | + |
| 45 | +.mw-gadgets-gadgetlinks { |
| 46 | + position: absolute; |
| 47 | + top: 0; |
| 48 | + right: 0; |
| 49 | + height: 1.6em; |
| 50 | + padding: 9px; |
| 51 | + font-size: 75%; |
| 52 | + font-weight: normal; |
| 53 | +} |
| 54 | + |
| 55 | +.mw-gadgets-gadgetlinks { |
| 56 | + float: right; |
| 57 | +} |
| 58 | + |
| 59 | +.mw-gadgets-gadgetlinks a { |
| 60 | + margin: 0 9px; |
| 61 | +} |
| 62 | + |
| 63 | +/* Export */ |
| 64 | +.mw-gadgets-exportform fieldset { |
| 65 | + max-width: 50%; |
| 66 | +} |
Property changes on: branches/RL2/extensions/Gadgets/modules/ext.gadgets.specialgadgets.prejs.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 67 | + native |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.init.js |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +/** |
| 3 | + * Initialize the mw.gadgets object |
| 4 | + */ |
| 5 | +(function() { |
| 6 | + |
| 7 | + mw.gadgets = { |
| 8 | + /** |
| 9 | + * @todo: Add something derived from $wgGadgetRepositories to gadgetsConf |
| 10 | + * ... + repos: { local: { apiScript: .. }, awesomeRepo: { .. }, .. } |
| 11 | + */ |
| 12 | + conf: mw.config.get( 'gadgetsConf' ) |
| 13 | + }; |
| 14 | + |
| 15 | +})(); |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js |
— | — | @@ -194,23 +194,6 @@ |
195 | 195 | e.stopPropagation(); |
196 | 196 | }); |
197 | 197 | |
198 | | - if ( ga.conf.userIsAllowed['gadgets-definition-create'] ) { |
199 | | - var createTab = mw.util.addPortletLink( |
200 | | - // Not all skins use the new separated tabs yet, |
201 | | - // Fall back to the general 'p-cactions'. |
202 | | - $( '#p-views' ).length ? 'p-views' : 'p-cactions', |
203 | | - '#', |
204 | | - mw.msg( 'gadgets-gadget-create' ), |
205 | | - 'ca-create', // Use whatever core has for pages ? Or use gadget-create ? |
206 | | - mw.msg( 'gadgets-gadget-create-tooltip' ), |
207 | | - 'e' // Same as core for ca-edit |
208 | | - ); |
209 | | - $( createTab ).click( function( e ) { |
210 | | - e.preventDefault(); |
211 | | - ga.ui.startGadgetManager( 'create' ); |
212 | | - } ); |
213 | | - } |
214 | | - |
215 | 198 | }, |
216 | 199 | |
217 | 200 | /** |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.specialgadgets.tabs.js |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +/** |
| 3 | + * JavaScript for Special:Gadgets |
| 4 | + * |
| 5 | + * @author Timo Tijhof |
| 6 | + */ |
| 7 | + |
| 8 | +jQuery( document ).ready( function( $ ) { |
| 9 | + |
| 10 | + var ga = mw.gadgets; |
| 11 | + |
| 12 | + if ( ga.conf.userIsAllowed['gadgets-definition-create'] ) { |
| 13 | + var createTab = mw.util.addPortletLink( |
| 14 | + // Not all skins use the new separated tabs yet, |
| 15 | + // Fall back to the general 'p-cactions'. |
| 16 | + $( '#p-views' ).length ? 'p-views' : 'p-cactions', |
| 17 | + '#', |
| 18 | + mw.msg( 'gadgets-gadget-create' ), |
| 19 | + 'ca-create', // Use whatever core has for pages ? Or use gadget-create ? |
| 20 | + mw.msg( 'gadgets-gadget-create-tooltip' ), |
| 21 | + 'e' // Same as core for ca-edit |
| 22 | + ); |
| 23 | + $( createTab ).click( function( e ) { |
| 24 | + e.preventDefault(); |
| 25 | + ga.ui.startGadgetManager( 'create' ); |
| 26 | + } ); |
| 27 | + } |
| 28 | + |
| 29 | +}); |