Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * Msg text is inherited from embedVideo (we should move it here (although can't load ctrlBuilder without parent EmbedVideo obj) |
7 | 7 | / |
8 | 8 | |
9 | | -/** |
| 9 | +/** |
10 | 10 | * base ctrlBuilder object |
11 | 11 | * @param the embedVideo element we are targeting |
12 | 12 | */ |
— | — | @@ -13,104 +13,104 @@ |
14 | 14 | return this.init( embedObj ); |
15 | 15 | }; |
16 | 16 | |
17 | | -/* |
| 17 | +/* |
18 | 18 | * controlsBuilder prototype: |
19 | 19 | */ |
20 | 20 | ctrlBuilder.prototype = { |
21 | 21 | init:function( embedObj, opt ){ |
22 | | - this.embedObj = embedObj; |
23 | | - |
| 22 | + this.embedObj = embedObj; |
| 23 | + |
24 | 24 | //check for skin overrides for ctrlBuilder |
25 | 25 | if( _global[ embedObj.skin_name + 'Config'] ) |
26 | 26 | $j.extend(this, _global[ embedObj.skin_name + 'Config']); |
27 | | - |
| 27 | + |
28 | 28 | }, |
29 | 29 | pClass:'videoPlayer', |
30 | 30 | height:29, |
31 | 31 | supports:{ |
32 | | - 'options':true, |
33 | | - 'borders':true |
34 | | - }, |
35 | | - getControls:function(){ |
| 32 | + 'options':true, |
| 33 | + 'borders':true |
| 34 | + }, |
| 35 | + getControls:function(){ |
36 | 36 | //set up local pointer to the embedObj |
37 | 37 | var embedObj = this.embedObj; |
38 | 38 | //set up loadl ctrlBuilder ref |
39 | 39 | var _this = this; |
40 | | - |
41 | | - js_log('f:controlsBuilder:: opt:' + this.options); |
| 40 | + |
| 41 | + js_log('f:controlsBuilder:: opt:' + this.options); |
42 | 42 | this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id; |
43 | 43 | this.available_width = embedObj.playerPixelWidth(); |
44 | 44 | //make pointer to the embedObj |
45 | 45 | this.embedObj =embedObj; |
46 | | - var _this = this; |
47 | | - for(var i in embedObj.supports){ |
| 46 | + var _this = this; |
| 47 | + for(var i in embedObj.supports){ |
48 | 48 | _this.supports[i] = embedObj.supports[i]; |
49 | 49 | }; |
50 | | - |
51 | | - //special case vars: |
52 | | - if( ( embedObj.roe || |
53 | | - (embedObj.media_element.timedTextSources && |
54 | | - embedObj.media_element.timedTextSources() ) |
| 50 | + |
| 51 | + //special case vars: |
| 52 | + if( ( embedObj.roe || |
| 53 | + (embedObj.media_element.timedTextSources && |
| 54 | + embedObj.media_element.timedTextSources() ) |
55 | 55 | ) && embedObj.show_meta_link ) |
56 | | - this.supports['closed_captions']=true; |
57 | | - |
58 | | - |
| 56 | + this.supports['closed_captions']=true; |
| 57 | + |
| 58 | + |
59 | 59 | //append options to body (if not already there) |
60 | 60 | if($j('#mv_vid_options_' + this.id).length==0) |
61 | | - $j('body').append( this.components['mv_embedded_options'].o( this ) ); |
62 | | - |
63 | | - var o=''; |
| 61 | + $j('body').append( this.components['mv_embedded_options'].o( this ) ); |
| 62 | + |
| 63 | + var o=''; |
64 | 64 | for( var i in this.components ){ |
65 | 65 | if( this.supports[i] ){ |
66 | 66 | if( this.available_width > this.components[i].w ){ |
67 | 67 | //special case with playhead don't add unless we have 60px |
68 | 68 | if( i == 'play_head' && this.available_width < 60 ) |
69 | | - continue; |
| 69 | + continue; |
70 | 70 | o+=this.components[i].o( this ); |
71 | 71 | this.available_width -= this.components[i].w; |
72 | 72 | }else{ |
73 | 73 | js_log('not enough space for control component:' + i); |
74 | 74 | } |
75 | 75 | } |
76 | | - } |
| 76 | + } |
77 | 77 | return o; |
78 | 78 | }, |
79 | 79 | /* |
80 | 80 | * addControlHooks |
81 | 81 | * to be run once controls are attached to the dom |
82 | 82 | */ |
83 | | - addControlHooks:function(){ |
| 83 | + addControlHooks:function(){ |
84 | 84 | //set up local pointer to the embedObj |
85 | | - var embedObj = this.embedObj; |
86 | | - var _this = this; |
87 | | - //add in drag/seek hooks: |
| 85 | + var embedObj = this.embedObj; |
| 86 | + var _this = this; |
| 87 | + //add in drag/seek hooks: |
88 | 88 | if(!embedObj.base_seeker_slider_offset && $j('#mv_seeker_slider_'+embedObj.id).get(0)) |
89 | | - embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft; |
90 | | - |
| 89 | + embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft; |
| 90 | + |
91 | 91 | //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " + |
92 | 92 | // 'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset); |
93 | | - |
94 | | - //add play hook: |
| 93 | + |
| 94 | + //add play hook: |
95 | 95 | $j('#mv_play_pause_button_' + embedObj.id ).unbind().btnBind().click(function(){ |
96 | 96 | $j('#' + embedObj.id).get(0).play(); |
97 | | - }) |
98 | | - |
99 | | - //do play-btn-large binding: |
| 97 | + }) |
| 98 | + |
| 99 | + //do play-btn-large binding: |
100 | 100 | $j('#' + embedObj.id + ' .play-btn-large' ).unbind().btnBind().click(function(){ |
101 | 101 | $j('#' + embedObj.id).get(0).play(); |
102 | | - }); |
103 | | - |
| 102 | + }); |
| 103 | + |
104 | 104 | //add recommend firefox if non-native playback: |
105 | | - if( embedObj.doNativeWarningCheck() ){ |
| 105 | + if( embedObj.doNativeWarningCheck() ){ |
106 | 106 | $j('#dc_'+ embedObj.id).hover( |
107 | | - function(){ |
| 107 | + function(){ |
108 | 108 | if($j('#gnp_' + embedObj.id).length==0){ |
109 | 109 | $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' + |
110 | 110 | 'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;">' + |
111 | | - gM('mwe-for_best_experience') + |
112 | | - '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' + |
113 | | - gM('mwe-do_not_warn_again') + |
114 | | - '</div>'); |
| 111 | + gM('mwe-for_best_experience') + |
| 112 | + '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' + |
| 113 | + gM('mwe-do_not_warn_again') + |
| 114 | + '</div>'); |
115 | 115 | $j('#ffwarn_'+embedObj.id).click(function(){ |
116 | 116 | if( $j(this).is(':checked') ){ |
117 | 117 | //set up a cookie for 7 days: |
— | — | @@ -122,9 +122,9 @@ |
123 | 123 | _global['adismissNativeWarn'] = false; |
124 | 124 | $j.cookie('dismissNativeWarn', false); |
125 | 125 | } |
126 | | - |
127 | | - }); |
128 | | - } |
| 126 | + |
| 127 | + }); |
| 128 | + } |
129 | 129 | if( ($j.cookie('dismissNativeWarn') !== true) && |
130 | 130 | _global['dismissNativeWarn'] === false ){ |
131 | 131 | $j('#gnp_' + embedObj.id).fadeIn('slow'); |
— | — | @@ -135,27 +135,27 @@ |
136 | 136 | } |
137 | 137 | ); |
138 | 138 | } |
139 | | - |
140 | | - if( $j.browser.msie && $j.browser.version <= 6){ |
| 139 | + |
| 140 | + if( $j.browser.msie && $j.browser.version <= 6){ |
141 | 141 | $j( embedObj.id + ' .play-btn-large' ).pngFix(); |
142 | 142 | } |
143 | | - |
144 | | - |
| 143 | + |
| 144 | + |
145 | 145 | //captions binding: |
146 | 146 | $j('#timed_text_' + embedObj.id).unbind().btnBind().click(function(){ |
147 | 147 | $j('#' + embedObj.id).get(0).showTextInterface(); |
148 | 148 | }); |
149 | | - |
150 | | - //options binding: |
| 149 | + |
| 150 | + //options binding: |
151 | 151 | $j('#options_button_' + embedObj.id).unbind().btnBind().click(function(){ |
152 | 152 | $j('#' +embedObj.id).get(0).doOptionsHTML(); |
153 | 153 | }); |
154 | | - |
155 | | - //fullscreen binding: |
| 154 | + |
| 155 | + //fullscreen binding: |
156 | 156 | $j('#fullscreen_'+embedObj.id).unbind().btnBind().click(function(){ |
157 | 157 | $j('#' +embedObj.id).get(0).fullscreen(); |
158 | | - }); |
159 | | - |
| 158 | + }); |
| 159 | + |
160 | 160 | js_log(" should add slider binding: " + $j('#mv_play_head_'+embedObj.id).length) ; |
161 | 161 | $j('#mv_play_head_'+embedObj.id).slider({ |
162 | 162 | range: "min", |
— | — | @@ -168,42 +168,42 @@ |
169 | 169 | $j(id + ' .play-btn-large').fadeOut('fast'); |
170 | 170 | //if playlist always start at 0 |
171 | 171 | embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0: |
172 | | - npt2seconds(embedObj.getTimeReq().split('/')[0]); |
| 172 | + npt2seconds(embedObj.getTimeReq().split('/')[0]); |
173 | 173 | }, |
174 | | - slide: function(event, ui) { |
175 | | - var perc = ui.value/1000; |
176 | | - embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec); |
| 174 | + slide: function(event, ui) { |
| 175 | + var perc = ui.value/1000; |
| 176 | + embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec); |
177 | 177 | //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time); |
178 | | - embedObj.setStatus( gM('mwe-seek_to')+' '+embedObj.jump_time ); |
179 | | - //update the thumbnail / frame |
| 178 | + embedObj.setStatus( gM('mwe-seek_to')+' '+embedObj.jump_time ); |
| 179 | + //update the thumbnail / frame |
180 | 180 | if(embedObj.isPlaying==false){ |
181 | 181 | embedObj.updateThumbPerc( perc ); |
182 | 182 | } |
183 | 183 | }, |
184 | 184 | change:function(event, ui){ |
185 | | - //only run the onChange event if done by a user slide: |
| 185 | + //only run the onChange event if done by a user slide: |
186 | 186 | if(embedObj.userSlide){ |
187 | 187 | embedObj.userSlide=false; |
188 | 188 | embedObj.seeking=true; |
189 | 189 | //stop the monitor timer (if we can) |
190 | | - if(embedObj.stopMonitor) |
191 | | - embedObj.stopMonitor(); |
192 | | - |
193 | | - var perc = ui.value/1000; |
194 | | - //set seek time (in case we have to do a url seek) |
195 | | - embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true ); |
196 | | - js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec); |
| 190 | + if(embedObj.stopMonitor) |
| 191 | + embedObj.stopMonitor(); |
| 192 | + |
| 193 | + var perc = ui.value/1000; |
| 194 | + //set seek time (in case we have to do a url seek) |
| 195 | + embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true ); |
| 196 | + js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec); |
197 | 197 | embedObj.doSeek(perc); |
198 | 198 | } |
199 | | - } |
| 199 | + } |
200 | 200 | }); |
201 | | - //up the z-index of the default status indicator: |
| 201 | + //up the z-index of the default status indicator: |
202 | 202 | $j('#mv_play_head_'+embedObj.id + ' .ui-slider-handle').css('z-index', 4); |
203 | 203 | $j('#mv_play_head_'+embedObj.id + ' .ui-slider-range').addClass('ui-corner-all').css('z-index', 2); |
204 | | - //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter) |
| 204 | + //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter) |
205 | 205 | $j('#mv_play_head_'+embedObj.id).append( this.getMvBufferHtml() ); |
206 | | - |
207 | | - //videoOptions: |
| 206 | + |
| 207 | + //videoOptions: |
208 | 208 | $j('#mv_vid_options_' + this.id + ' .vo_selection').click(function(){ |
209 | 209 | embedObj.selectPlaybackMethod(); |
210 | 210 | $j('#mv_vid_options_' + embedObj.id).hide(); |
— | — | @@ -213,73 +213,73 @@ |
214 | 214 | embedObj.showVideoDownload(); |
215 | 215 | $j('#mv_vid_options_'+embedObj.id).hide(); |
216 | 216 | return false; |
217 | | - }) |
| 217 | + }) |
218 | 218 | $j('#mv_vid_options_'+ctrlBuilder.id+' .vo_showcode').click(function(){ |
219 | 219 | embedObj.showEmbedCode(); |
220 | 220 | $j('#mv_vid_options_'+embedObj.id).hide(); |
221 | 221 | return false; |
222 | | - }); |
223 | | - |
| 222 | + }); |
| 223 | + |
224 | 224 | //volume binding: |
225 | 225 | var hoverOverDelay=false; |
226 | 226 | $j('#volume_control_'+embedObj.id).unbind().btnBind().click(function(){ |
227 | 227 | $j('#' +embedObj.id).get(0).toggleMute(); |
228 | 228 | }).hover( |
229 | | - function(){ |
| 229 | + function(){ |
230 | 230 | $j('#vol_container_' + embedObj.id).addClass('vol_container_top'); |
231 | 231 | //set to "below" if playing and embedType != native |
232 | 232 | if(embedObj && embedObj.isPlaying && embedObj.isPlaying() && !embedObj.supports['overlays']){ |
233 | 233 | $j('#vol_container_' + embedObj.id).removeClass('vol_container_top').addClass('vol_container_below'); |
234 | 234 | } |
235 | | - |
| 235 | + |
236 | 236 | $j('#vol_container_' + embedObj.id).fadeIn('fast'); |
237 | 237 | hoverOverDelay = true; |
238 | 238 | }, |
239 | | - function(){ |
240 | | - hoverOverDelay= false; |
| 239 | + function(){ |
| 240 | + hoverOverDelay= false; |
241 | 241 | setTimeout(function doHideVolume(){ |
242 | 242 | if(!hoverOverDelay){ |
243 | 243 | $j('#vol_container_' + embedObj.id).fadeOut('fast'); |
244 | 244 | } |
245 | | - }, 500); |
| 245 | + }, 500); |
246 | 246 | } |
247 | 247 | ); |
248 | 248 | //Volumen Slider |
249 | 249 | $j('#volume_bar_'+embedObj.id).slider({ |
250 | | - orientation: "vertical", |
| 250 | + orientation: "vertical", |
251 | 251 | range: "min", |
252 | 252 | value: 80, |
253 | 253 | min: 0, |
254 | | - max: 100, |
255 | | - slide: function(event, ui) { |
256 | | - var perc = ui.value/100; |
| 254 | + max: 100, |
| 255 | + slide: function(event, ui) { |
| 256 | + var perc = ui.value/100; |
257 | 257 | //js_log('update volume:' + perc); |
258 | | - embedObj.updateVolumen(perc); |
| 258 | + embedObj.updateVolumen(perc); |
259 | 259 | }, |
260 | 260 | change:function(event, ui){ |
261 | | - var perc = ui.value/100; |
| 261 | + var perc = ui.value/100; |
262 | 262 | if (perc==0) { |
263 | | - $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off'); |
264 | | - }else{ |
| 263 | + $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off'); |
| 264 | + }else{ |
265 | 265 | $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on'); |
266 | 266 | } |
267 | | - //only run the onChange event if done by a user slide: |
| 267 | + //only run the onChange event if done by a user slide: |
268 | 268 | if(embedObj.userSlide){ |
269 | 269 | embedObj.userSlide=false; |
270 | | - embedObj.seeking=true; |
271 | | - var perc = ui.value/100; |
272 | | - embedObj.updateVolumen(perc); |
| 270 | + embedObj.seeking=true; |
| 271 | + var perc = ui.value/100; |
| 272 | + embedObj.updateVolumen(perc); |
273 | 273 | } |
274 | | - } |
275 | | - }); |
276 | | - |
277 | | - }, |
| 274 | + } |
| 275 | + }); |
| 276 | + |
| 277 | + }, |
278 | 278 | getMvBufferHtml:function(){ |
279 | 279 | return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' + |
280 | 280 | 'ui-state-highlight ui-corner-all '+ |
281 | 281 | 'mv_buffer" style="width:0px;height:100%;z-index:1;top:0px" />'; |
282 | 282 | }, |
283 | | - getComponent:function( component ) { |
| 283 | + getComponent:function( component ) { |
284 | 284 | if( this.components[ component ] ){ |
285 | 285 | return this.components[ component ].o( this ); |
286 | 286 | }else{ |
— | — | @@ -287,7 +287,7 @@ |
288 | 288 | } |
289 | 289 | }, |
290 | 290 | /* |
291 | | - * components take in the embedObj and return some html for the given component. |
| 291 | + * components take in the embedObj and return some html for the given component. |
292 | 292 | * components can be overwritten by skin javascript |
293 | 293 | */ |
294 | 294 | components:{ |
— | — | @@ -300,8 +300,8 @@ |
301 | 301 | 'play-btn-large':{ |
302 | 302 | 'w' : 130, |
303 | 303 | 'h' : 96, |
304 | | - 'o':function( ctrlObj ){ |
305 | | - //get dynamic position for big play button (@@todo maybe use margin:auto ? ) |
| 304 | + 'o':function( ctrlObj ){ |
| 305 | + //get dynamic position for big play button (@@todo maybe use margin:auto ? ) |
306 | 306 | return $j('<div/>').attr({ |
307 | 307 | 'title' : gM('mwe-play_clip'), |
308 | 308 | 'class' : "ui-state-default play-btn-large", |
— | — | @@ -310,8 +310,8 @@ |
311 | 311 | 'left' : ((ctrlObj.embedObj.playerPixelWidth() - this.w)/2), |
312 | 312 | 'top' : ((ctrlObj.embedObj.playerPixelHeight() - this.h)/2) |
313 | 313 | }) |
314 | | - //quick and dirty way to get at jquery html (might be a short cut I am missing?) |
315 | | - .wrap('<div/>').parent().html(); |
| 314 | + //quick and dirty way to get at jquery html (might be a short cut I am missing?) |
| 315 | + .wrap('<div/>').parent().html(); |
316 | 316 | } |
317 | 317 | }, |
318 | 318 | 'mv_embedded_options':{ |
— | — | @@ -327,14 +327,14 @@ |
328 | 328 | '<p class="short_match vo_selection"><a href="#"><span>'+gM('mwe-chose_player')+'</span></a></p>'+ |
329 | 329 | '<p class="short_match vo_download"><a href="#"><span>'+gM('mwe-download')+'</span></a></p>'+ |
330 | 330 | '<p class="short_match vo_showcode"><a href="#"><span>'+gM('mwe-share')+'</span></a></p>'; |
331 | | - |
332 | | - //link to the stream page if we are not already there: |
| 331 | + |
| 332 | + //link to the stream page if we are not already there: |
333 | 333 | if( ctrlObj.embedObj.roe && typeof mv_stream_interface == 'undefined' ) |
334 | 334 | o+='<p class="short_match"><a href="javascript:$j(\'#'+ctrlObj.id+'\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>'; |
335 | | - |
336 | | - o+='</div>'+ |
337 | | - '</div><!--videoOptionsInner-->' + |
338 | | - '<div class="videoOptionsBot"></div>' + |
| 335 | + |
| 336 | + o+='</div>'+ |
| 337 | + '</div><!--videoOptionsInner-->' + |
| 338 | + '<div class="videoOptionsBot"></div>' + |
339 | 339 | '</div><!--videoOptions-->'; |
340 | 340 | return o; |
341 | 341 | } |
— | — | @@ -348,7 +348,7 @@ |
349 | 349 | 'options':{ |
350 | 350 | 'w':26, |
351 | 351 | 'o':function( ctrlObj ){ |
352 | | - return '<div title="'+ gM('mwe-player_options') + '" id="options_button_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-wrench"></span></div>'; |
| 352 | + return '<div title="'+ gM('mwe-player_options') + '" id="options_button_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-wrench"></span></div>'; |
353 | 353 | } |
354 | 354 | }, |
355 | 355 | 'pause':{ |
— | — | @@ -361,7 +361,7 @@ |
362 | 362 | 'w':23, |
363 | 363 | 'o':function( ctrlObj ){ |
364 | 364 | return '<div title="' + gM('mwe-closed_captions') + '" id="timed_text_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-comment"></span></div>' |
365 | | - } |
| 365 | + } |
366 | 366 | }, |
367 | 367 | 'volume_control':{ |
368 | 368 | 'w':23, |
— | — | @@ -371,7 +371,7 @@ |
372 | 372 | '<div style="position:absolute;display:none;" id="vol_container_'+ctrlObj.id+'" class="vol_container ui-corner-all">' + |
373 | 373 | '<div class="volume_bar" id="volume_bar_' + ctrlObj.id + '"></div>' + |
374 | 374 | '</div>'+ |
375 | | - '</div>'; |
| 375 | + '</div>'; |
376 | 376 | } |
377 | 377 | }, |
378 | 378 | 'time_display':{ |
— | — | @@ -381,10 +381,10 @@ |
382 | 382 | } |
383 | 383 | }, |
384 | 384 | 'play_head':{ |
385 | | - 'w':0, //special case (takes up remaining space) |
| 385 | + 'w':0, //special case (takes up remaining space) |
386 | 386 | 'o':function( ctrlObj ){ |
387 | 387 | return '<div class="play_head" id="mv_play_head_' + ctrlObj.id + '" style="width: ' + ( ctrlObj.available_width - 30 ) + 'px;"></div>'; |
388 | 388 | } |
389 | | - } |
390 | | - } |
| 389 | + } |
| 390 | + } |
391 | 391 | }; |
Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -19,12 +19,12 @@ |
20 | 20 | if( MV_EMBED_VERSION ){ |
21 | 21 | MV_DO_INIT=false; |
22 | 22 | } |
23 | | -// Used to grab fresh copies of scripts. |
| 23 | +// Used to grab fresh copies of scripts. |
24 | 24 | var MV_EMBED_VERSION = '1.0r20'; |
25 | 25 | |
26 | 26 | /* |
27 | 27 | * Configuration variables should be set by extending mwConfigOptions |
28 | | - * here is the default config: |
| 28 | + * here is the default config: |
29 | 29 | */ |
30 | 30 | var mwDefaultConfig = { |
31 | 31 | 'skin_name': 'mvpcf', |
— | — | @@ -70,10 +70,10 @@ |
71 | 71 | // For use when mv_embed with script-loader is in the root MediaWiki path |
72 | 72 | var mediaWiki_mvEmbed_path = 'js2/mwEmbed/'; |
73 | 73 | |
74 | | -var _global = this; // Global obj (depreciate use window) |
| 74 | +var _global = this; // Global obj (depreciate use window) |
75 | 75 | |
76 | 76 | /* |
77 | | -* setup the empty global $mw object |
| 77 | +* setup the empty global $mw object |
78 | 78 | * will ensure all our functions are properly namespaced |
79 | 79 | */ |
80 | 80 | if(!window['$mw']){ |
— | — | @@ -94,35 +94,35 @@ |
95 | 95 | * wrap the global $mw object here: |
96 | 96 | * |
97 | 97 | * Any global functions/classes that are not jQuery plugins should make |
98 | | -* there way into the $mw namespace |
| 98 | +* there way into the $mw namespace |
99 | 99 | */ |
100 | 100 | (function( $ ) { |
101 | 101 | /* |
102 | 102 | * Language classes $mw.lang |
103 | | - * |
| 103 | + * |
104 | 104 | * Localized Language support attempts to mirror the functionality of Language.php in MediaWiki |
105 | 105 | * It contains methods for loading and transforming msg text |
106 | | - * |
| 106 | + * |
107 | 107 | */ |
108 | 108 | $.lang = {}; |
109 | 109 | /** |
110 | 110 | * Setup the lang object |
111 | 111 | */ |
112 | 112 | var gMsg = {}; |
113 | | - var gRuleSet = {}; |
114 | | - |
| 113 | + var gRuleSet = {}; |
| 114 | + |
115 | 115 | /** |
116 | 116 | * loadGM function |
117 | | - * Loads a set of json messages into the lng object. |
| 117 | + * Loads a set of json messages into the lng object. |
118 | 118 | * |
119 | | - * @param json msgSet The set of msgs to be loaded |
| 119 | + * @param json msgSet The set of msgs to be loaded |
120 | 120 | */ |
121 | 121 | $.lang.loadGM = function( msgSet ){ |
122 | 122 | for( var i in msgSet ) { |
123 | 123 | gMsg[ i ] = msgSet[i]; |
124 | 124 | } |
125 | 125 | }, |
126 | | - |
| 126 | + |
127 | 127 | /** |
128 | 128 | * loadRS function |
129 | 129 | * Loads a ruleset by given template key ie PLURAL : { //ruleSetObj } |
— | — | @@ -134,55 +134,55 @@ |
135 | 135 | gRuleSet[ i ] = ruleSet[ i ]; |
136 | 136 | } |
137 | 137 | } |
138 | | - |
| 138 | + |
139 | 139 | /** |
140 | 140 | * Returns a transformed msg string |
141 | 141 | * |
142 | 142 | * it take a msg key and array of replacement values of form |
143 | | - * $1, $2 and does relevant msgkey transformation returning |
144 | | - * the user msg. |
| 143 | + * $1, $2 and does relevant msgkey transformation returning |
| 144 | + * the user msg. |
145 | 145 | * |
146 | 146 | * @param string key The msg key as set by loadGm |
147 | 147 | * @param [mixed] args An array of replacement strings |
148 | | - * @return string |
| 148 | + * @return string |
149 | 149 | */ |
150 | | - $.lang.gM = function( key , args ) { |
| 150 | + $.lang.gM = function( key , args ) { |
151 | 151 | if(! gMsg[ key ]) |
152 | 152 | return '<' + key + '>';// Missing key placeholder |
153 | | - |
| 153 | + |
154 | 154 | //swap in the arg values |
155 | | - var ms = $.lang.gMsgSwap( key, args) ; |
156 | | - |
| 155 | + var ms = $.lang.gMsgSwap( key, args) ; |
| 156 | + |
157 | 157 | //a quick check to see if we need to send the msg via the 'parser' |
158 | 158 | //(we can add more detailed check once we support more wiki syntax) |
159 | 159 | if(ms.indexOf('{{')==-1){ |
160 | 160 | return ms; |
161 | 161 | //return ms; |
162 | 162 | } |
163 | | - |
164 | | - //make sure we have the lagMagic setup: |
| 163 | + |
| 164 | + //make sure we have the lagMagic setup: |
165 | 165 | $.lang.magicSetup(); |
166 | | - //send the msg key through the parser |
| 166 | + //send the msg key through the parser |
167 | 167 | pObj = $.parser.pNew( ms ); |
168 | 168 | //return the transformed msg |
169 | | - return pObj.getHTML(); |
| 169 | + return pObj.getHTML(); |
170 | 170 | } |
171 | 171 | /** |
172 | 172 | * gMsgSwap |
173 | | - * |
| 173 | + * |
174 | 174 | * @param string key The msg key as set by loadGm |
175 | 175 | * @param [mixed] args An array or string to be replaced |
176 | | - * @return string |
| 176 | + * @return string |
177 | 177 | */ |
178 | 178 | $.lang.gMsgSwap = function( key , args ){ |
179 | 179 | if(! gMsg[ key ]) |
180 | 180 | return '<' + key + '>';// Missing key placeholder |
181 | 181 | //get the messege string: |
182 | 182 | var ms = gMsg[ key ]; |
183 | | - |
184 | | - //replace values |
| 183 | + |
| 184 | + //replace values |
185 | 185 | if( typeof args == 'object' || typeof args == 'array' ) { |
186 | | - for( var v in args ) { |
| 186 | + for( var v in args ) { |
187 | 187 | // Message test replace arguments start at 1 instead of zero: |
188 | 188 | var rep = new RegExp('\\$'+ ( parseInt(v) + 1 ), 'g'); |
189 | 189 | ms = ms.replace( rep, args[v] ); |
— | — | @@ -192,70 +192,70 @@ |
193 | 193 | } |
194 | 194 | return ms; |
195 | 195 | } |
196 | | - |
| 196 | + |
197 | 197 | /** |
198 | 198 | * gMsgNoTrans |
199 | | - * |
| 199 | + * |
200 | 200 | * @returns string The msg key without transforming it |
201 | 201 | */ |
202 | 202 | $.lang.gMsgNoTrans = function( key ){ |
203 | 203 | if( gMsg[ key ] ) |
204 | 204 | return gMsg[ key ] |
205 | | - |
| 205 | + |
206 | 206 | // Missing key placeholder |
207 | 207 | return '<' + key + '>'; |
208 | 208 | } |
209 | 209 | /** |
210 | | - * Add Supported Magic Words to parser |
| 210 | + * Add Supported Magic Words to parser |
211 | 211 | */ |
212 | 212 | //set the setupflag to false: |
213 | | - $.lang.doneSetup=false; |
| 213 | + $.lang.doneSetup=false; |
214 | 214 | $.lang.magicSetup = function(){ |
215 | 215 | if(!$.lang.doneSetup){ |
216 | 216 | $.parser.addMagic ( { |
217 | 217 | 'PLURAL' : $.lang.procPLURAL |
218 | 218 | }) |
219 | | - |
| 219 | + |
220 | 220 | $.lang.doneSetup = true; |
221 | 221 | } |
222 | | - |
| 222 | + |
223 | 223 | } |
224 | 224 | /** |
225 | 225 | * Process the PLURAL special language template key: |
226 | 226 | */ |
227 | 227 | $.lang.procPLURAL = function( tObj ){ |
228 | | - //setup shortcuts |
| 228 | + //setup shortcuts |
229 | 229 | // (gRuleSet is loaded from script-loader to contains local ruleset) |
230 | | - var rs = gRuleSet['PLURAL']; |
231 | | - |
| 230 | + var rs = gRuleSet['PLURAL']; |
| 231 | + |
232 | 232 | /* |
233 | 233 | * Plural matchRuleTest |
234 | 234 | */ |
235 | 235 | function matchRuleTest(cRule, val){ |
236 | 236 | js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); |
237 | | - |
| 237 | + |
238 | 238 | function checkValue(compare, val){ |
239 | 239 | if(typeof compare == 'string'){ |
240 | | - range = compare.split('-'); |
| 240 | + range = compare.split('-'); |
241 | 241 | if( range.length >= 1 ){ |
242 | 242 | if( val >= range[0] && val <= range[1] ) |
243 | | - return true; |
| 243 | + return true; |
244 | 244 | } |
245 | 245 | } |
246 | 246 | //else do a direct compare |
247 | 247 | if(compare == val){ |
248 | | - return true; |
| 248 | + return true; |
249 | 249 | } |
250 | 250 | return false; |
251 | | - } |
| 251 | + } |
252 | 252 | //check for simple cRule type: |
253 | | - if( typeof cRule == 'number'){ |
254 | | - return ( parseInt( val ) == parseInt( cRule) ); |
| 253 | + if( typeof cRule == 'number'){ |
| 254 | + return ( parseInt( val ) == parseInt( cRule) ); |
255 | 255 | }else if( typeof cRule == 'object' ){ |
256 | | - var cmatch = {}; |
| 256 | + var cmatch = {}; |
257 | 257 | //if a list we need to match all for rule match |
258 | 258 | for(var i in cRule){ |
259 | | - var cr = cRule[i]; |
| 259 | + var cr = cRule[i]; |
260 | 260 | //set cr type |
261 | 261 | var crType = ''; |
262 | 262 | for( var j in cr ){ |
— | — | @@ -264,9 +264,9 @@ |
265 | 265 | } |
266 | 266 | switch(crType){ |
267 | 267 | case 'mod': |
268 | | - if( cr ['is'] ){ |
| 268 | + if( cr ['is'] ){ |
269 | 269 | if( checkValue( val % cr['mod'], cr ['is'] ) ) |
270 | | - cmatch[i] = true; |
| 270 | + cmatch[i] = true; |
271 | 271 | }else if( cr['not']){ |
272 | 272 | if( ! checkValue( val % cr['mod'], cr ['not'] ) ) |
273 | 273 | cmatch[i] = true; |
— | — | @@ -274,46 +274,46 @@ |
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | | - //check all the matches (taking into consideration "or" order) |
279 | | - for(var i in cRule){ |
| 278 | + //check all the matches (taking into consideration "or" order) |
| 279 | + for(var i in cRule){ |
280 | 280 | if( ! cmatch[i] ) |
281 | | - return false; |
| 281 | + return false; |
282 | 282 | } |
283 | 283 | return true; |
284 | | - |
| 284 | + |
285 | 285 | } |
286 | 286 | } |
287 | 287 | /** |
288 | 288 | * Maps a given rule Index to template params: |
289 | | - * |
| 289 | + * |
290 | 290 | * if index is out of range return last param |
291 | | - * @param |
292 | | - */ |
293 | | - function getTempParamFromRuleInx(tObj, ruleInx ){ |
| 291 | + * @param |
| 292 | + */ |
| 293 | + function getTempParamFromRuleInx(tObj, ruleInx ){ |
294 | 294 | //js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length ); |
295 | 295 | if( ruleInx >= tObj.param.length ) |
296 | 296 | return tObj.param[ tObj.param.length -1 ]; |
297 | 297 | //else return the requested index: |
298 | 298 | return tObj.param[ ruleInx ]; |
299 | | - } |
| 299 | + } |
300 | 300 | var rCount=0 |
301 | | - //run the actual rule lookup: |
| 301 | + //run the actual rule lookup: |
302 | 302 | for(var ruleInx in rs){ |
303 | | - cRule = rs[ruleInx]; |
| 303 | + cRule = rs[ruleInx]; |
304 | 304 | if( matchRuleTest( cRule, tObj.arg ) ){ |
305 | | - js_log("matched rule: " + ruleInx ); |
306 | | - return getTempParamFromRuleInx(tObj, rCount ); |
| 305 | + js_log("matched rule: " + ruleInx ); |
| 306 | + return getTempParamFromRuleInx(tObj, rCount ); |
307 | 307 | } |
308 | 308 | rCount ++; |
309 | | - } |
| 309 | + } |
310 | 310 | js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] ); |
311 | | - //return the last /"other" template param |
312 | | - return tObj.param [ tObj.param.length -1 ]; |
313 | | - } |
314 | | - |
| 311 | + //return the last /"other" template param |
| 312 | + return tObj.param [ tObj.param.length -1 ]; |
| 313 | + } |
| 314 | + |
315 | 315 | /** |
316 | 316 | * gMsgLoadRemote loads remote msg strings |
317 | | - * |
| 317 | + * |
318 | 318 | * @param mixed msgSet the set of msg to load remotely |
319 | 319 | * @param function callback the callback to issue once string is ready |
320 | 320 | */ |
— | — | @@ -327,7 +327,7 @@ |
328 | 328 | ammessages += msgSet; |
329 | 329 | } |
330 | 330 | if( ammessages == '' ) { |
331 | | - js_log( 'gMsgLoadRemote: no message set requested' ); |
| 331 | + js_log( 'gMsgLoadRemote: no message set requested' ); |
332 | 332 | return false; |
333 | 333 | } |
334 | 334 | do_api_req({ |
— | — | @@ -382,95 +382,95 @@ |
383 | 383 | //@@todo we need a formatNum and we need to request some special packaged info to deal with that case. |
384 | 384 | return gM( msg , size ); |
385 | 385 | }; |
386 | | - |
387 | | - |
| 386 | + |
| 387 | + |
388 | 388 | /** |
389 | 389 | * MediaWiki wikitext "Parser" |
390 | 390 | * |
391 | | - * This is not feature complete but we need a way to get at template properties |
392 | | - * |
393 | | - * |
| 391 | + * This is not feature complete but we need a way to get at template properties |
| 392 | + * |
| 393 | + * |
394 | 394 | * @param wikiText the wikitext to be parsed |
395 | | - * @return parserObj returns a parser object that has methods for getting at |
396 | | - * things you would want |
397 | | - */ |
| 395 | + * @return parserObj returns a parser object that has methods for getting at |
| 396 | + * things you would want |
| 397 | + */ |
398 | 398 | $.parser = {}; |
399 | 399 | var pMagicSet = {}; |
400 | 400 | /** |
401 | | - * parser addMagic |
402 | | - * |
| 401 | + * parser addMagic |
| 402 | + * |
403 | 403 | * lets you add a set of magic keys and associated callback funcions |
404 | | - * callback: @param ( Object Template ) |
| 404 | + * callback: @param ( Object Template ) |
405 | 405 | * callback: @return the transformed template output |
406 | | - * |
| 406 | + * |
407 | 407 | * @param object magicSet key:callback |
408 | 408 | */ |
409 | 409 | $.parser.addMagic = function( magicSet ){ |
410 | 410 | for(var i in magicSet) |
411 | 411 | pMagicSet[ i ] = magicSet[i]; |
412 | 412 | } |
413 | | - |
| 413 | + |
414 | 414 | //actual parse call (returns parser object) |
415 | 415 | $.parser.pNew = function( wikiText, opt ){ |
416 | 416 | var parseObj = function( wikiText, opt){ |
417 | 417 | return this.init( wikiText, opt ) |
418 | | - } |
| 418 | + } |
419 | 419 | parseObj.prototype = { |
420 | 420 | //the wikiText "DOM"... stores the parsed wikiText structure |
421 | 421 | //wtDOM : {}, (not yet supported ) |
422 | | - |
423 | | - pOut : '', //the parser output string container |
| 422 | + |
| 423 | + pOut : '', //the parser output string container |
424 | 424 | init :function( wikiText ){ |
425 | | - this.wikiText = wikiText; |
| 425 | + this.wikiText = wikiText; |
426 | 426 | }, |
427 | 427 | updateText : function( wikiText ){ |
428 | 428 | this.wikiText = wikiText; |
429 | | - //invalidate the output (will force a reparse) |
430 | | - this.pOut = ''; |
| 429 | + //invalidate the output (will force a reparse) |
| 430 | + this.pOut = ''; |
431 | 431 | }, |
432 | | - parse : function(){ |
| 432 | + parse : function(){ |
433 | 433 | this.pObj = {}; |
434 | 434 | this.pObj.tmpl = new Array(); |
435 | | - |
436 | | - //refrences for swap key |
| 435 | + |
| 436 | + //refrences for swap key |
437 | 437 | this.pObj.tmpl_text = new Array(); |
438 | | - this.pObj.tmpl_key = new Array(); |
439 | | - this.pObj.tmpl_ns = '' ; // wikiText with place-holder |
440 | | - |
| 438 | + this.pObj.tmpl_key = new Array(); |
| 439 | + this.pObj.tmpl_ns = '' ; // wikiText with place-holder |
| 440 | + |
441 | 441 | //get templates losly based on Magnus_Manske/tmpl.js code: |
442 | 442 | var tcnt = 0 ; |
443 | | - var ts = '' ; |
| 443 | + var ts = '' ; |
444 | 444 | var curt = 0 ; |
445 | | - var schar = 0; |
446 | | - |
447 | | - |
| 445 | + var schar = 0; |
| 446 | + |
| 447 | + |
448 | 448 | //build out nested template holders: |
449 | 449 | var depth = 0; |
450 | | - var tKey = 0; |
451 | | - var ns = ''; |
452 | | - |
| 450 | + var tKey = 0; |
| 451 | + var ns = ''; |
| 452 | + |
453 | 453 | /* |
454 | 454 | * quickly recursive / parse out templates with top down recurse decent |
455 | | - */ |
456 | | - |
| 455 | + */ |
| 456 | + |
457 | 457 | // ~ probably a better algorithm out there / should mirror php parser flow ~ |
458 | | - // ... but I am having fun with recursion so here it is... |
459 | | - function rdpp ( txt ){ |
| 458 | + // ... but I am having fun with recursion so here it is... |
| 459 | + function rdpp ( txt ){ |
460 | 460 | var node = {}; |
461 | 461 | //if we should output node text |
462 | | - var ont = true; |
463 | | - //inspect each char |
464 | | - for(var a=0; a < txt.length; a++){ |
| 462 | + var ont = true; |
| 463 | + //inspect each char |
| 464 | + for(var a=0; a < txt.length; a++){ |
465 | 465 | if( txt[a] == '{' && txt[a+1] == '{' ){ |
466 | 466 | a=a+2; |
467 | | - node['p'] = node; |
| 467 | + node['p'] = node; |
468 | 468 | if(!node['c']) |
469 | 469 | node['c'] = new Array(); |
470 | | - |
471 | | - node['c'].push( rdpp( txt.substr( a ) ) ); |
472 | | - ont=true; |
| 470 | + |
| 471 | + node['c'].push( rdpp( txt.substr( a ) ) ); |
| 472 | + ont=true; |
473 | 473 | }else if( txt[a] == '}' && txt[a+1] == '}'){ |
474 | | - if( !node['p'] ){ |
| 474 | + if( !node['p'] ){ |
475 | 475 | return node; |
476 | 476 | } |
477 | 477 | node = node['p']; |
— | — | @@ -484,37 +484,37 @@ |
485 | 485 | node['t']+=txt[a]; |
486 | 486 | } |
487 | 487 | return node; |
488 | | - } |
| 488 | + } |
489 | 489 | /** |
490 | 490 | * parse template text as template name and named params |
491 | 491 | */ |
492 | 492 | function parseTmplTxt( ts ){ |
493 | 493 | var tObj = {}; |
494 | | - //Get template name: |
| 494 | + //Get template name: |
495 | 495 | tname = ts.split('\|').shift() ; |
496 | | - tname = tname.split('\{').shift() ; |
497 | | - tname = tname.replace( /^\s+|\s+$/g, "" ); //trim |
498 | | - |
499 | | - //check for arguments: |
500 | | - if( tname.split(':').length == 1 ){ |
| 496 | + tname = tname.split('\{').shift() ; |
| 497 | + tname = tname.replace( /^\s+|\s+$/g, "" ); //trim |
| 498 | + |
| 499 | + //check for arguments: |
| 500 | + if( tname.split(':').length == 1 ){ |
501 | 501 | tObj["name"] = tname; |
502 | 502 | }else{ |
503 | 503 | tObj["name"] = tname.split(':').shift(); |
504 | 504 | tObj["arg"] = tname.split(':').pop(); |
505 | 505 | } |
506 | | - |
507 | | - js_log("TNAME::" + tObj["arg"] + ' from:: ' + ts); |
508 | | - |
| 506 | + |
| 507 | + js_log("TNAME::" + tObj["arg"] + ' from:: ' + ts); |
| 508 | + |
509 | 509 | var pSet = ts.split('\|'); |
510 | | - pSet.splice(0,1); |
511 | | - if( pSet.length ){ |
| 510 | + pSet.splice(0,1); |
| 511 | + if( pSet.length ){ |
512 | 512 | tObj.param = new Array(); |
513 | 513 | for(var pInx in pSet){ |
514 | 514 | var tStr = pSet[ pInx ]; |
515 | 515 | for(var b=0 ; b < tStr.length ; b++){ |
516 | 516 | if(tStr[b] == '=' && b>0 && b<tStr.length && tStr[b-1]!='\\'){ |
517 | 517 | //named param |
518 | | - tObj.param[ tStr.split('=').shift() ] = tStr.split('=').pop(); |
| 518 | + tObj.param[ tStr.split('=').shift() ] = tStr.split('=').pop(); |
519 | 519 | }else{ |
520 | 520 | //indexed param |
521 | 521 | tObj.param[ pInx ] = tStr; |
— | — | @@ -527,84 +527,84 @@ |
528 | 528 | function getMagicTxtFromTempNode( node ){ |
529 | 529 | node.tObj = parseTmplTxt ( node.t ); |
530 | 530 | //do magic swap if templet key found in pMagicSet |
531 | | - if( node.tObj.name in pMagicSet){ |
532 | | - var nt = pMagicSet[ node.tObj.name ]( node.tObj ); |
| 531 | + if( node.tObj.name in pMagicSet){ |
| 532 | + var nt = pMagicSet[ node.tObj.name ]( node.tObj ); |
533 | 533 | return nt; |
534 | 534 | }else{ |
535 | 535 | //don't swap just return text |
536 | 536 | return node.t; |
537 | | - } |
| 537 | + } |
538 | 538 | } |
539 | 539 | /** |
540 | 540 | * recurse_magic_swap |
541 | | - * |
542 | | - * go last child first swap upward: (could probably be integrated above somehow) |
543 | | - */ |
544 | | - var pNode = null; |
545 | | - function recurse_magic_swap( node ){ |
| 541 | + * |
| 542 | + * go last child first swap upward: (could probably be integrated above somehow) |
| 543 | + */ |
| 544 | + var pNode = null; |
| 545 | + function recurse_magic_swap( node ){ |
546 | 546 | if( !pNode ) |
547 | | - pNode = node; |
548 | | - |
549 | | - if( node['c'] ){ |
550 | | - //swap all the kids: |
551 | | - for(var i in node['c']){ |
552 | | - var nt = recurse_magic_swap( node['c'][i] ); |
| 547 | + pNode = node; |
| 548 | + |
| 549 | + if( node['c'] ){ |
| 550 | + //swap all the kids: |
| 551 | + for(var i in node['c']){ |
| 552 | + var nt = recurse_magic_swap( node['c'][i] ); |
553 | 553 | //swap it into current |
554 | | - if( node.t ){ |
555 | | - node.t = node.t.replace( node['c'][i].t, nt); |
556 | | - } |
| 554 | + if( node.t ){ |
| 555 | + node.t = node.t.replace( node['c'][i].t, nt); |
| 556 | + } |
557 | 557 | //swap into parent |
558 | | - pNode.t = pNode.t.replace( node['c'][i].t, nt); |
| 558 | + pNode.t = pNode.t.replace( node['c'][i].t, nt); |
559 | 559 | } |
560 | | - //do the current node: |
561 | | - var nt = getMagicTxtFromTempNode( node ); |
562 | | - pNode.t = pNode.t.replace(node.t , nt); |
563 | | - //run the swap for the outer most node |
| 560 | + //do the current node: |
| 561 | + var nt = getMagicTxtFromTempNode( node ); |
| 562 | + pNode.t = pNode.t.replace(node.t , nt); |
| 563 | + //run the swap for the outer most node |
564 | 564 | return node.t; |
565 | | - }else{ |
566 | | - //node.t = getMagicFromTempObj( node.t ) |
| 565 | + }else{ |
| 566 | + //node.t = getMagicFromTempObj( node.t ) |
567 | 567 | return getMagicTxtFromTempNode( node ); |
568 | 568 | } |
569 | | - } |
570 | | - //get text node system: |
571 | | - var node = rdpp ( this.wikiText ); |
572 | | - //debugger; |
573 | | - //parse out stuff: |
574 | | - |
575 | | - this.pOut = recurse_magic_swap( node); |
576 | | - |
| 569 | + } |
| 570 | + //get text node system: |
| 571 | + var node = rdpp ( this.wikiText ); |
| 572 | + //debugger; |
| 573 | + //parse out stuff: |
| 574 | + |
| 575 | + this.pOut = recurse_magic_swap( node); |
| 576 | + |
577 | 577 | }, |
578 | 578 | /** |
579 | 579 | * Returns the transformed wikitext |
580 | | - * |
581 | | - * Build output from swapable index |
582 | | - * (all transforms must be expanded in parse stage and linerarly rebuilt) |
583 | | - * Alternativly we could build output using a placeholder & replace system |
| 580 | + * |
| 581 | + * Build output from swapable index |
| 582 | + * (all transforms must be expanded in parse stage and linerarly rebuilt) |
| 583 | + * Alternativly we could build output using a placeholder & replace system |
584 | 584 | * (this lets us be slightly more slopty with ordering and indexes, but probably slower) |
585 | | - * |
586 | | - * Ideal: we build a 'wiki DOM' |
| 585 | + * |
| 586 | + * Ideal: we build a 'wiki DOM' |
587 | 587 | * When editing you update the data structure directly |
588 | | - * Then in output time you just go DOM->html-ish output without re-parsing anything |
| 588 | + * Then in output time you just go DOM->html-ish output without re-parsing anything |
589 | 589 | */ |
590 | 590 | getHTML : function(){ |
591 | 591 | //wikiText updates should invalidate pOut |
592 | 592 | if( this.pOut == ''){ |
593 | 593 | this.parse(); |
594 | 594 | } |
595 | | - return this.pOut; |
| 595 | + return this.pOut; |
596 | 596 | } |
597 | 597 | }; |
598 | 598 | //return the parserObj |
599 | 599 | return new parseObj( wikiText, opt) ; |
600 | | - } |
601 | | - |
| 600 | + } |
| 601 | + |
602 | 602 | })(window.$mw); |
603 | | -//setup legacy global shortcuts: |
| 603 | +//setup legacy global shortcuts: |
604 | 604 | var loadGM = $mw.lang.loadGM; |
605 | 605 | var loadRS = $mw.lang.loadRS; |
606 | 606 | var gM = $mw.lang.gM; |
607 | 607 | |
608 | | -//if some no-js2 script defined and loaded gMsg in global space: |
| 608 | +//if some no-js2 script defined and loaded gMsg in global space: |
609 | 609 | if( _global['gMsg'] ){ |
610 | 610 | loadGM( _global['gMsg'] ); |
611 | 611 | } |
— | — | @@ -838,11 +838,11 @@ |
839 | 839 | coma = ','; |
840 | 840 | } |
841 | 841 | } |
842 | | - //Build the url to the scriptServer striping its request paramaters: |
| 842 | + //Build the url to the scriptServer striping its request paramaters: |
843 | 843 | var puri = parseUri( getMvEmbedURL() ); |
844 | 844 | if( ( getMvEmbedURL().indexOf('://') != -1 ) |
845 | 845 | && puri.host != parseUri( document.URL ).host ) |
846 | | - { |
| 846 | + { |
847 | 847 | var scriptPath = puri.protocol + '://' + puri.authority + puri.path; |
848 | 848 | }else{ |
849 | 849 | var scriptPath = puri.path; |
— | — | @@ -870,10 +870,10 @@ |
871 | 871 | this.callbacks.push( callback ); |
872 | 872 | } |
873 | 873 | if( this.checkLoading() ) { |
874 | | - //@@todo we should check the <script> Element .onLoad property to |
875 | | - //make sure its just not a very slow connection or we can run the callback |
876 | | - //(even though the class is not loaded) |
877 | | - |
| 874 | + //@@todo we should check the <script> Element .onLoad property to |
| 875 | + //make sure its just not a very slow connection or we can run the callback |
| 876 | + //(even though the class is not loaded) |
| 877 | + |
878 | 878 | if( this.load_time++ > 4000 ){ // Time out after ~80 seconds |
879 | 879 | js_log( gM('mwe-error_load_lib', [mvGetClassPath(this.missing_path), this.missing_path]) ); |
880 | 880 | this.load_error = true; |
— | — | @@ -952,7 +952,7 @@ |
953 | 953 | cur_path = (cur_path == '') ? cur_path + objPath[p] : cur_path + '.' + objPath[p]; |
954 | 954 | eval( 'var ptest = typeof ( '+ cur_path + ' ); '); |
955 | 955 | if( ptest == 'undefined' ) { |
956 | | - this.missing_path = cur_path; |
| 956 | + this.missing_path = cur_path; |
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | } |
— | — | @@ -966,39 +966,39 @@ |
967 | 967 | //js_log( 'jQueryCheck::' ); |
968 | 968 | // Skip stuff if $j is already loaded: |
969 | 969 | if( _global['$j'] && callback ) |
970 | | - callback(); |
| 970 | + callback(); |
971 | 971 | var _this = this; |
972 | 972 | // Load jQuery |
973 | 973 | _this.doLoad([ |
974 | 974 | 'window.jQuery' |
975 | 975 | ], function() { |
976 | | - //only do the $j setup once: |
| 976 | + //only do the $j setup once: |
977 | 977 | if(!_global['$j']){ |
978 | 978 | _global['$j'] = jQuery.noConflict(); |
979 | 979 | } |
980 | 980 | if( _this.jQuerySetupFlag == false){ |
981 | 981 | js_log('setup mv_embed jQuery bindings'); |
982 | | - //setup our global settings using the (jQuery helper) |
983 | | - mwConfig = $j.extend( mwDefaultConfig, mwConfig); |
984 | | - |
| 982 | + //setup our global settings using the (jQuery helper) |
| 983 | + mwConfig = $j.extend( mwDefaultConfig, mwConfig); |
| 984 | + |
985 | 985 | // Set up the skin path |
986 | 986 | _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' +mwConfig['jui_skin'] + '/'; |
987 | 987 | _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/images/'; |
988 | 988 | _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg'; |
989 | | - |
990 | | - //setup skin dependent dependencies |
991 | | - lcCssPath({'embedVideo' : 'skins/' + mwConfig['skin_name'] + '/playerSkin.css'}); |
992 | | - |
| 989 | + |
| 990 | + //setup skin dependent dependencies |
| 991 | + lcCssPath({'embedVideo' : 'skins/' + mwConfig['skin_name'] + '/playerSkin.css'}); |
| 992 | + |
993 | 993 | // Make sure the skin/style sheets are always available: |
994 | 994 | loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
995 | 995 | loadExternalCss( mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/styles.css' ); |
996 | | - |
| 996 | + |
997 | 997 | // Set up AJAX to not send dynamic URLs for loading scripts (we control that with |
998 | 998 | // the scriptLoader) |
999 | 999 | $j.ajaxSetup({ |
1000 | 1000 | cache: true |
1001 | 1001 | }); |
1002 | | - |
| 1002 | + |
1003 | 1003 | js_log( 'jQuery loaded into $j' ); |
1004 | 1004 | // Set up mvEmbed jQuery bindings and config based dependencies |
1005 | 1005 | mv_jqueryBindings(); |
— | — | @@ -1012,32 +1012,32 @@ |
1013 | 1013 | }, |
1014 | 1014 | embedVideoCheck:function( callback ) { |
1015 | 1015 | var _this = this; |
1016 | | - js_log( 'embedVideoCheck:' ); |
| 1016 | + js_log( 'embedVideoCheck:' ); |
1017 | 1017 | // Make sure we have jQuery |
1018 | 1018 | _this.jQueryCheck( function() { |
1019 | 1019 | //set class videonojs to hidden |
1020 | 1020 | $j('.videonojs').html( gM('mwe-loading_txt') ); |
1021 | | - //Set up the embed video player class request: (include the skin js as well) |
| 1021 | + //Set up the embed video player class request: (include the skin js as well) |
1022 | 1022 | var depReq = [ |
1023 | 1023 | [ |
1024 | 1024 | '$j.ui', |
1025 | 1025 | 'embedVideo', |
1026 | 1026 | 'ctrlBuilder', |
1027 | | - '$j.cookie' |
| 1027 | + '$j.cookie' |
1028 | 1028 | ], |
1029 | 1029 | [ |
1030 | 1030 | '$j.ui.slider' |
1031 | 1031 | ] |
1032 | | - ]; |
1033 | | - //add skin if set: |
| 1032 | + ]; |
| 1033 | + //add skin if set: |
1034 | 1034 | if( mwConfig['skin_name'] ) |
1035 | 1035 | depReq[0].push( mwConfig['skin_name'] + 'Config' ); |
1036 | | - |
| 1036 | + |
1037 | 1037 | // Add PNG fix if needed: |
1038 | 1038 | if( $j.browser.msie || $j.browser.version < 7 ) |
1039 | 1039 | depReq[0].push( '$j.fn.pngFix' ); |
1040 | | - |
1041 | | - //load the video libs: |
| 1040 | + |
| 1041 | + //load the video libs: |
1042 | 1042 | _this.doLoadDepMode( depReq, function() { |
1043 | 1043 | embedTypes.init(); |
1044 | 1044 | callback(); |
— | — | @@ -1052,7 +1052,7 @@ |
1053 | 1053 | // unless js2AddOnloadHook was used or there is video on the page. |
1054 | 1054 | runQueuedFunctions: function() { |
1055 | 1055 | var _this = this; |
1056 | | - this.doneReadyEvents = true; |
| 1056 | + this.doneReadyEvents = true; |
1057 | 1057 | this.jQueryCheck( function() { |
1058 | 1058 | _this.runReadyEvents(); |
1059 | 1059 | }); |
— | — | @@ -1114,7 +1114,7 @@ |
1115 | 1115 | //} |
1116 | 1116 | } |
1117 | 1117 | //js2AddOnloadHook: ensure jQuery and the DOM are ready |
1118 | | -function js2AddOnloadHook( func ) { |
| 1118 | +function js2AddOnloadHook( func ) { |
1119 | 1119 | // If we have already run the DOM-ready function, just run the function directly: |
1120 | 1120 | if( mvJsLoader.doneReadyEvents ) { |
1121 | 1121 | // Make sure jQuery is there: |
— | — | @@ -1154,7 +1154,7 @@ |
1155 | 1155 | */ |
1156 | 1156 | function mv_write_modal( content, speed ) { |
1157 | 1157 | $j( '#modalbox,#mv_overlay' ).remove(); |
1158 | | - $j( 'body' ).append( |
| 1158 | + $j( 'body' ).append( |
1159 | 1159 | '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;' + |
1160 | 1160 | 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">' + |
1161 | 1161 | content + |
— | — | @@ -1218,7 +1218,7 @@ |
1219 | 1219 | // Issue a request to get the CSS file (if not already included): |
1220 | 1220 | loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
1221 | 1221 | loadExternalCss( mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/mv_sequence.css' ); |
1222 | | - // Make sure we have the required mv_embed libs (they are not loaded when no video |
| 1222 | + // Make sure we have the required mv_embed libs (they are not loaded when no video |
1223 | 1223 | // element is on the page) |
1224 | 1224 | mvJsLoader.embedVideoCheck( function() { |
1225 | 1225 | // Load the playlist object and then the jQuery UI stuff: |
— | — | @@ -1243,7 +1243,7 @@ |
1244 | 1244 | ] |
1245 | 1245 | ], function() { |
1246 | 1246 | js_log( 'calling new mvSequencer' ); |
1247 | | - // Initialise the sequence object (it will take over from there) |
| 1247 | + // Initialise the sequence object (it will take over from there) |
1248 | 1248 | // No more than one mvSeq obj for now: |
1249 | 1249 | if( !_global['mvSeq'] ) { |
1250 | 1250 | _global['mvSeq'] = new mvSequencer( iObj ); |
— | — | @@ -1264,12 +1264,12 @@ |
1265 | 1265 | loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
1266 | 1266 | loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name'] + '/styles.css' ); |
1267 | 1267 | |
1268 | | - // Check if we already have Firefogg loaded (the call just updates the element's |
| 1268 | + // Check if we already have Firefogg loaded (the call just updates the element's |
1269 | 1269 | // properties) |
1270 | 1270 | var sElm = $j( this.selector ).get( 0 ); |
1271 | 1271 | if( sElm['firefogg'] ) { |
1272 | 1272 | if( sElm['firefogg'] == 'loading' ) { |
1273 | | - js_log( "Error: called firefogg operations on Firefogg selector that is " + |
| 1273 | + js_log( "Error: called firefogg operations on Firefogg selector that is " + |
1274 | 1274 | "not done loading" ); |
1275 | 1275 | return false; |
1276 | 1276 | } |
— | — | @@ -1310,7 +1310,7 @@ |
1311 | 1311 | // Make sure we have everything loaded that we need: |
1312 | 1312 | mvJsLoader.doLoadDepMode( loadSet, function() { |
1313 | 1313 | js_log( 'firefogg libs loaded. target select:' + iObj.selector ); |
1314 | | - // Select interface provider based on whether we want to include the |
| 1314 | + // Select interface provider based on whether we want to include the |
1315 | 1315 | // encoder interface or not |
1316 | 1316 | if( iObj.encoder_interface ) { |
1317 | 1317 | var myFogg = new mvAdvFirefogg( iObj ); |
— | — | @@ -1371,15 +1371,15 @@ |
1372 | 1372 | var href = (opt.href) ? opt.href : '#'; |
1373 | 1373 | var target_attr = (opt.target) ? ' target="' + opt.target + '" ' : ''; |
1374 | 1374 | var style_attr = (opt.style) ? ' style="' + opt.style + '" ' : ''; |
1375 | | - return '<a href="' + href + '" ' + target_attr + style_attr + |
| 1375 | + return '<a href="' + href + '" ' + target_attr + style_attr + |
1376 | 1376 | ' class="ui-state-default ui-corner-all ui-icon_link ' + |
1377 | 1377 | className + '"><span class="ui-icon ui-icon-' + iconId + '" />' + |
1378 | 1378 | '<span class="btnText">'+ msg +'<span></a>'; |
1379 | 1379 | } |
1380 | 1380 | // Shortcut to bind hover state |
1381 | | - $.fn.btnBind = function() { |
| 1381 | + $.fn.btnBind = function() { |
1382 | 1382 | $j( this ).hover( |
1383 | | - function() { |
| 1383 | + function() { |
1384 | 1384 | $j( this ).addClass( 'ui-state-hover' ); |
1385 | 1385 | }, |
1386 | 1386 | function() { |
— | — | @@ -1390,28 +1390,28 @@ |
1391 | 1391 | } |
1392 | 1392 | /** |
1393 | 1393 | * addLoaderDialog |
1394 | | - * small helper for putting a loading dialog box on top of everything |
| 1394 | + * small helper for putting a loading dialog box on top of everything |
1395 | 1395 | * (helps block for request that |
1396 | | - * |
| 1396 | + * |
1397 | 1397 | * @param msg text text of the loader msg |
1398 | 1398 | */ |
1399 | | - $.addLoaderDialog = function( msg_txt ){ |
| 1399 | + $.addLoaderDialog = function( msg_txt ){ |
1400 | 1400 | if( $('#mwe_tmp_loader').length != 0 ) |
1401 | 1401 | $('#mwe_tmp_loader').remove(); |
1402 | | - |
1403 | | - $('body').append('<div id="mwe_tmp_loader" title="' + msg_txt + '" >' + |
1404 | | - gM('mwe-checking-resource') + '<br>' + |
| 1402 | + |
| 1403 | + $('body').append('<div id="mwe_tmp_loader" title="' + msg_txt + '" >' + |
| 1404 | + gM('mwe-checking-resource') + '<br>' + |
1405 | 1405 | mv_get_loading_img() + |
1406 | 1406 | '</div>'); |
1407 | | - |
| 1407 | + |
1408 | 1408 | mvJsLoader.doLoadDepMode([ |
1409 | | - [ |
| 1409 | + [ |
1410 | 1410 | '$j.ui' |
1411 | 1411 | ], |
1412 | 1412 | [ |
1413 | 1413 | '$j.ui.dialog' |
1414 | 1414 | ] |
1415 | | - ], function() { |
| 1415 | + ], function() { |
1416 | 1416 | $('#mwe_tmp_loader').dialog({ |
1417 | 1417 | bgiframe: true, |
1418 | 1418 | height: 140, |
— | — | @@ -1649,7 +1649,7 @@ |
1650 | 1650 | } else { |
1651 | 1651 | // Get data via DOM injection with callback |
1652 | 1652 | global_req_cb.push( callback ); |
1653 | | - // Prepend json_ to feed_format if not already requesting json format (metavid specific) |
| 1653 | + // Prepend json_ to feed_format if not already requesting json format (metavid specific) |
1654 | 1654 | if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 ) |
1655 | 1655 | req_url = req_url.replace( /feed_format=/, 'feed_format=json_' ); |
1656 | 1656 | loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) ); |
— | — | @@ -1803,7 +1803,7 @@ |
1804 | 1804 | mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mv_embed.js' ) ); |
1805 | 1805 | } else if( mv_embed_url.indexOf( 'mwScriptLoader.php' ) !== -1 ) { |
1806 | 1806 | // Script loader is in the root of MediaWiki, so include the default mv_embed extension path |
1807 | | - mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mwScriptLoader.php' ) ) |
| 1807 | + mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mwScriptLoader.php' ) ) |
1808 | 1808 | + mediaWiki_mvEmbed_path; |
1809 | 1809 | } else { |
1810 | 1810 | mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'jsScriptLoader.php' ) ); |
Index: trunk/phase3/js2/remoteMwEmbed.js |
— | — | @@ -2,19 +2,19 @@ |
3 | 3 | * this file exposes some of the functionality of mwEmbed to wikis |
4 | 4 | * that do not yet have js2 enabled |
5 | 5 | */ |
6 | | - |
| 6 | + |
7 | 7 | var urlparts = getRemoteEmbedPath(); |
8 | 8 | var mwEmbedHostPath = urlparts[0]; |
9 | 9 | var reqAguments = urlparts[1]; |
10 | 10 | |
11 | | -addOnloadHook( function(){ |
| 11 | +addOnloadHook( function(){ |
12 | 12 | //only do rewrites if MV_EMBED / js2 is "off" |
13 | 13 | if( typeof MV_EMBED_VERSION == 'undefined' ) { |
14 | 14 | doPageSpecificRewrite(); |
15 | 15 | } |
16 | 16 | }); |
17 | 17 | |
18 | | -function doPageSpecificRewrite() { |
| 18 | +function doPageSpecificRewrite() { |
19 | 19 | // Add media wizard |
20 | 20 | if( wgAction == 'edit' || wgAction == 'submit' ) { |
21 | 21 | load_mv_embed( function() { |
— | — | @@ -23,23 +23,23 @@ |
24 | 24 | } |
25 | 25 | |
26 | 26 | // Firefogg integration |
27 | | - if( wgPageName == "Special:Upload" ){ |
| 27 | + if( wgPageName == "Special:Upload" ){ |
28 | 28 | load_mv_embed( function() { |
29 | 29 | importScriptURI( mwEmbedHostPath + '/uploadPage.js' + reqAguments ); |
30 | 30 | } ); |
31 | | - } |
32 | | - |
| 31 | + } |
| 32 | + |
33 | 33 | // OggHandler rewrite for view pages: |
34 | 34 | var vidIdList = []; |
35 | 35 | var divs = document.getElementsByTagName( 'div' ); |
36 | 36 | for( var i = 0; i < divs.length; i++ ) { |
37 | 37 | if( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) { |
38 | | - vidIdList.push( divs[i].getAttribute( "id" ) ); |
| 38 | + vidIdList.push( divs[i].getAttribute( "id" ) ); |
39 | 39 | } |
40 | | - } |
| 40 | + } |
41 | 41 | if( vidIdList.length > 0 ) { |
42 | 42 | load_mv_embed( function() { |
43 | | - mvJsLoader.embedVideoCheck( function() { |
| 43 | + mvJsLoader.embedVideoCheck( function() { |
44 | 44 | // Do utility rewrite of OggHandler content: |
45 | 45 | rewrite_for_OggHandler( vidIdList ); |
46 | 46 | } ); |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | // will be deprecated in favor of updates to OggHandler |
51 | 51 | function rewrite_for_OggHandler( vidIdList ){ |
52 | 52 | for( var i = 0; i < vidIdList.length; i++ ) { |
53 | | - var vidId = vidIdList[i]; |
| 53 | + var vidId = vidIdList[i]; |
54 | 54 | // Grab the thumbnail and src of the video |
55 | 55 | var pimg = $j( '#' + vidId + ' img' ); |
56 | 56 | var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" '; |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | // Parsed values: |
71 | 71 | var src = ''; |
72 | 72 | var duration = ''; |
73 | | - |
| 73 | + |
74 | 74 | var re = new RegExp( /videoUrl(":?\s*)*([^&]*)/ ); |
75 | 75 | src = re.exec( $j( '#'+vidId).html() )[2]; |
76 | 76 | |
— | — | @@ -80,8 +80,8 @@ |
81 | 81 | offset = re.exec( $j( '#'+vidId).html() )[2]; |
82 | 82 | var offset_attr = offset ? 'startOffset="' + offset + '"' : ''; |
83 | 83 | |
84 | | - // Rewrite that video id (do async calls to avoid locking) |
85 | | - if( src ) { |
| 84 | + // Rewrite that video id (do async calls to avoid locking) |
| 85 | + if( src ) { |
86 | 86 | // Replace the top div with the mv_embed based player: |
87 | 87 | var vid_html = '<video id="vid_' + i +'" '+ |
88 | 88 | 'src="' + src + '" ' + |
— | — | @@ -91,13 +91,13 @@ |
92 | 92 | 'duration="' + duration + '" ' + |
93 | 93 | 'style="width:' + pwidth + 'px;height:' + |
94 | 94 | pheight + 'px;"></video>'; |
95 | | - //set the video tag inner html and update the height |
| 95 | + //set the video tag inner html and update the height |
96 | 96 | $j( '#' + vidId ).html( vid_html ) |
97 | 97 | .css('height', pheight + 30); |
98 | | - |
| 98 | + |
99 | 99 | } |
100 | | - |
101 | | - rewrite_by_id( 'vid_' + i ); |
| 100 | + |
| 101 | + rewrite_by_id( 'vid_' + i ); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
Index: trunk/phase3/js2/editPage.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | 3 | * JS2-style replacement for MediaWiki edit.js |
4 | | - * (right now it just supports the toolbar) |
| 4 | + * (right now it just supports the toolbar) |
5 | 5 | */ |
6 | 6 | |
7 | | -// Setup configuration vars (if not set already) |
| 7 | +// Setup configuration vars (if not set already) |
8 | 8 | if( !mwAddMediaConfig ) |
9 | 9 | var mwAddMediaConfig = {}; |
10 | 10 | |
— | — | @@ -15,28 +15,28 @@ |
16 | 16 | 'default_query': wgTitle, |
17 | 17 | 'target_title': wgPageName, |
18 | 18 | // Here we can setup the content provider overrides |
19 | | - 'enabled_cps':['wiki_commons'], |
| 19 | + 'enabled_cps':['wiki_commons'], |
20 | 20 | // The local wiki API URL: |
21 | 21 | 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' |
22 | 22 | }; |
23 | | - |
24 | 23 | |
| 24 | + |
25 | 25 | js2AddOnloadHook( function() { |
26 | 26 | var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig ); |
27 | 27 | // kind of tricky, it would be nice to use run on ready "loader" call here |
28 | 28 | if( typeof $j.wikiEditor != 'undefined' ) { |
29 | | - setTimeout( function() { |
| 29 | + setTimeout( function() { |
30 | 30 | $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz( |
31 | 31 | amwConf |
32 | 32 | ); |
33 | 33 | }, 100 ); |
34 | 34 | } |
35 | | - //add to the old-toolbar all the time: |
| 35 | + //add to the old-toolbar all the time: |
36 | 36 | if( $j('#btn-add-media-wiz').length == 0 ){ |
37 | 37 | $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' + |
38 | 38 | mv_skin_img_path + 'Button_add_media.png">' ); |
39 | 39 | $j( '#btn-add-media-wiz' ).addMediaWiz( |
40 | 40 | amwConf |
41 | 41 | ); |
42 | | - } |
| 42 | + } |
43 | 43 | }); |