Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 96 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 97 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 213 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 214 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 213 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 214 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -207,7 +207,12 @@ |
208 | 208 | // Same for delayedChange() |
209 | 209 | 'oldDelayedHTML': null, |
210 | 210 | // Saved selection state for IE |
211 | | - 'savedSelection': null |
| 211 | + 'savedSelection': null, |
| 212 | + // Stack of states in { html: [string] } form |
| 213 | + 'history': [], |
| 214 | + 'historyPosition': -1, |
| 215 | + // Key states |
| 216 | + 'keys': { 'control': false } |
212 | 217 | }; |
213 | 218 | |
214 | 219 | /* |
— | — | @@ -268,6 +273,27 @@ |
269 | 274 | * function is to both classify the scope of changes as 'division' or 'character' and to prevent further |
270 | 275 | * processing of events which did not actually change the content of the iframe. |
271 | 276 | */ |
| 277 | + 'keydown': function( event ) { |
| 278 | + switch ( event.which ) { |
| 279 | + case 17: // ctrl |
| 280 | + case 224: // command |
| 281 | + context.keys.control = true; |
| 282 | + break; |
| 283 | + case 90: // z |
| 284 | + if ( context.keys.control && context.history.length ) { |
| 285 | + context.historyPosition = Math.min( context.historyPosition - 1, -1 ); |
| 286 | + if ( context.history.length + context.historyPosition >= 0 ) { |
| 287 | + // Undo |
| 288 | + context.$content.html( |
| 289 | + context.history[context.history.length + context.historyPosition].html |
| 290 | + ); |
| 291 | + } |
| 292 | + return false; |
| 293 | + } |
| 294 | + break; |
| 295 | + } |
| 296 | + return true; |
| 297 | + }, |
272 | 298 | 'change': function( event ) { |
273 | 299 | event.data.scope = 'division'; |
274 | 300 | var newHTML = context.$content.html(); |
— | — | @@ -275,7 +301,15 @@ |
276 | 302 | context.fn.purgeOffsets(); |
277 | 303 | context.oldHTML = newHTML; |
278 | 304 | event.data.scope = 'realchange'; |
| 305 | + context.historyPosition = -1; |
279 | 306 | } |
| 307 | + switch ( event.which ) { |
| 308 | + case 17: // ctrl |
| 309 | + case 224: // command |
| 310 | + context.keys.control = false; |
| 311 | + break; |
| 312 | + } |
| 313 | + // FIXME: Are we deleting a <p> with one keystroke? if so, either remove preceding <br> or merge <p>s |
280 | 314 | return true; |
281 | 315 | }, |
282 | 316 | 'delayedChange': function( event ) { |
— | — | @@ -285,6 +319,13 @@ |
286 | 320 | context.fn.purgeOffsets(); |
287 | 321 | context.oldDelayedHTML = newHTML; |
288 | 322 | event.data.scope = 'realchange'; |
| 323 | + // Save in the history |
| 324 | + //console.log( 'save-state' ); |
| 325 | + context.history.push( { 'html': newHTML } ); |
| 326 | + // Keep the history under control |
| 327 | + while ( context.history.length > 10 ) { |
| 328 | + context.history.shift(); |
| 329 | + } |
289 | 330 | } |
290 | 331 | return true; |
291 | 332 | } |
— | — | @@ -321,6 +362,7 @@ |
322 | 363 | $.wikiEditor.modules[module].evt[name]( context, event ); |
323 | 364 | } |
324 | 365 | } |
| 366 | + return true; |
325 | 367 | }, |
326 | 368 | /** |
327 | 369 | * Adds a button to the UI |
— | — | @@ -1123,6 +1165,8 @@ |
1124 | 1166 | .replace( /&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g, '<span class="wikiEditor-tab"></span>' ); |
1125 | 1167 | context.$content.html( html ); |
1126 | 1168 | context.oldHTML = html; |
| 1169 | + // FIXME: This needs to be merged somehow with the oldHTML thing |
| 1170 | + context.history.push( { 'html': html } ); |
1127 | 1171 | |
1128 | 1172 | // Reflect direction of parent frame into child |
1129 | 1173 | if ( $( 'body' ).is( '.rtl' ) ) { |
— | — | @@ -1136,8 +1180,11 @@ |
1137 | 1181 | context.fn.trigger( 'ready' ); |
1138 | 1182 | // Setup event handling on the iframe |
1139 | 1183 | $( context.$iframe[0].contentWindow.document ) |
| 1184 | + .bind( 'keydown', function( event ) { |
| 1185 | + return context.fn.trigger( 'keydown', event ); |
| 1186 | + } ) |
1140 | 1187 | .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) { |
1141 | | - context.fn.trigger( 'change', event ); |
| 1188 | + return context.fn.trigger( 'change', event ); |
1142 | 1189 | } ) |
1143 | 1190 | .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) { |
1144 | 1191 | context.fn.trigger( 'delayedChange', event ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6640,7 +6640,12 @@ |
6641 | 6641 | // Same for delayedChange() |
6642 | 6642 | 'oldDelayedHTML': null, |
6643 | 6643 | // Saved selection state for IE |
6644 | | - 'savedSelection': null |
| 6644 | + 'savedSelection': null, |
| 6645 | + // Stack of states in { html: [string] } form |
| 6646 | + 'history': [], |
| 6647 | + 'historyPosition': -1, |
| 6648 | + // Key states |
| 6649 | + 'keys': { 'control': false } |
6645 | 6650 | }; |
6646 | 6651 | |
6647 | 6652 | /* |
— | — | @@ -6701,6 +6706,27 @@ |
6702 | 6707 | * function is to both classify the scope of changes as 'division' or 'character' and to prevent further |
6703 | 6708 | * processing of events which did not actually change the content of the iframe. |
6704 | 6709 | */ |
| 6710 | + 'keydown': function( event ) { |
| 6711 | + switch ( event.which ) { |
| 6712 | + case 17: // ctrl |
| 6713 | + case 224: // command |
| 6714 | + context.keys.control = true; |
| 6715 | + break; |
| 6716 | + case 90: // z |
| 6717 | + if ( context.keys.control && context.history.length ) { |
| 6718 | + context.historyPosition = Math.min( context.historyPosition - 1, -1 ); |
| 6719 | + if ( context.history.length + context.historyPosition >= 0 ) { |
| 6720 | + // Undo |
| 6721 | + context.$content.html( |
| 6722 | + context.history[context.history.length + context.historyPosition].html |
| 6723 | + ); |
| 6724 | + } |
| 6725 | + return false; |
| 6726 | + } |
| 6727 | + break; |
| 6728 | + } |
| 6729 | + return true; |
| 6730 | + }, |
6705 | 6731 | 'change': function( event ) { |
6706 | 6732 | event.data.scope = 'division'; |
6707 | 6733 | var newHTML = context.$content.html(); |
— | — | @@ -6708,7 +6734,15 @@ |
6709 | 6735 | context.fn.purgeOffsets(); |
6710 | 6736 | context.oldHTML = newHTML; |
6711 | 6737 | event.data.scope = 'realchange'; |
| 6738 | + context.historyPosition = -1; |
6712 | 6739 | } |
| 6740 | + switch ( event.which ) { |
| 6741 | + case 17: // ctrl |
| 6742 | + case 224: // command |
| 6743 | + context.keys.control = false; |
| 6744 | + break; |
| 6745 | + } |
| 6746 | + // FIXME: Are we deleting a <p> with one keystroke? if so, either remove preceding <br> or merge <p>s |
6713 | 6747 | return true; |
6714 | 6748 | }, |
6715 | 6749 | 'delayedChange': function( event ) { |
— | — | @@ -6718,6 +6752,13 @@ |
6719 | 6753 | context.fn.purgeOffsets(); |
6720 | 6754 | context.oldDelayedHTML = newHTML; |
6721 | 6755 | event.data.scope = 'realchange'; |
| 6756 | + // Save in the history |
| 6757 | + //console.log( 'save-state' ); |
| 6758 | + context.history.push( { 'html': newHTML } ); |
| 6759 | + // Keep the history under control |
| 6760 | + while ( context.history.length > 10 ) { |
| 6761 | + context.history.shift(); |
| 6762 | + } |
6722 | 6763 | } |
6723 | 6764 | return true; |
6724 | 6765 | } |
— | — | @@ -6754,6 +6795,7 @@ |
6755 | 6796 | $.wikiEditor.modules[module].evt[name]( context, event ); |
6756 | 6797 | } |
6757 | 6798 | } |
| 6799 | + return true; |
6758 | 6800 | }, |
6759 | 6801 | /** |
6760 | 6802 | * Adds a button to the UI |
— | — | @@ -7556,6 +7598,8 @@ |
7557 | 7599 | .replace( /&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g, '<span class="wikiEditor-tab"></span>' ); |
7558 | 7600 | context.$content.html( html ); |
7559 | 7601 | context.oldHTML = html; |
| 7602 | + // FIXME: This needs to be merged somehow with the oldHTML thing |
| 7603 | + context.history.push( { 'html': html } ); |
7560 | 7604 | |
7561 | 7605 | // Reflect direction of parent frame into child |
7562 | 7606 | if ( $( 'body' ).is( '.rtl' ) ) { |
— | — | @@ -7569,8 +7613,11 @@ |
7570 | 7614 | context.fn.trigger( 'ready' ); |
7571 | 7615 | // Setup event handling on the iframe |
7572 | 7616 | $( context.$iframe[0].contentWindow.document ) |
| 7617 | + .bind( 'keydown', function( event ) { |
| 7618 | + return context.fn.trigger( 'keydown', event ); |
| 7619 | + } ) |
7573 | 7620 | .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) { |
7574 | | - context.fn.trigger( 'change', event ); |
| 7621 | + return context.fn.trigger( 'change', event ); |
7575 | 7622 | } ) |
7576 | 7623 | .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) { |
7577 | 7624 | context.fn.trigger( 'delayedChange', event ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -442,14 +442,19 @@ |
443 | 443 | return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
444 | 444 | if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;} |
445 | 445 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
446 | | -var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'savedSelection':null};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
| 446 | +var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'savedSelection':null,'history':[],'historyPosition':-1,'keys':{'control':false}};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
447 | 447 | for(var module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}} |
448 | | -if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';} |
449 | | -return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';} |
| 448 | +if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 17:case 224:context.keys.control=true;break;case 90:if(context.keys.control&&context.history.length){context.historyPosition=Math.min(context.historyPosition-1,-1);if(context.history.length+context.historyPosition>=0){context.$content.html(context.history[context.history.length+context.historyPosition].html);} |
| 449 | +return false;} |
| 450 | +break;} |
| 451 | +return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';context.historyPosition=-1;} |
| 452 | +switch(event.which){case 17:case 224:context.keys.control=false;break;} |
| 453 | +return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';context.history.push({'html':newHTML});while(context.history.length>10){context.history.shift();}} |
450 | 454 | return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
451 | 455 | if(typeof event.data=='undefined'){event.data={};} |
452 | 456 | if(name in context.evt){if(!context.evt[name](event)){return false;}} |
453 | | -for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
| 457 | +for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}} |
| 458 | +return true;},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
454 | 459 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
455 | 460 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
456 | 461 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];} |
— | — | @@ -512,8 +517,8 @@ |
513 | 518 | context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}} |
514 | 519 | context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/ /g,'&nbsp;').replace(/\<br\>/g,'<br>').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'<span class="wikiEditor-tab"></span>');if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g," ");}else{html=html.replace(/(^|\n) /g,"$1 ");} |
515 | 520 | html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');} |
516 | | -html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&nbsp;/g,' ').replace(/<p>/g,'<p>').replace(/<\/p>/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/<span class="wikiEditor-tab"><\/span>/g,'<span class="wikiEditor-tab"></span>').replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;br&gt;/g,'<br>').replace(/&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g,'<span class="wikiEditor-tab"></span>');context.$content.html(html);context.oldHTML=html;if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
517 | | -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};} |
| 521 | +html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&nbsp;/g,' ').replace(/<p>/g,'<p>').replace(/<\/p>/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/<span class="wikiEditor-tab"><\/span>/g,'<span class="wikiEditor-tab"></span>').replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;br&gt;/g,'<br>').replace(/&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g,'<span class="wikiEditor-tab"></span>');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
| 522 | +context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('keyup mouseup paste cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};} |
518 | 523 | var args=$.makeArray(arguments);if(args.length>0){var call=args.shift();if(call in context.api){context.api[call](context,typeof args[0]=='undefined'?{}:args[0]);}} |
519 | 524 | return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,data){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} |
520 | 525 | mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |