Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | array( |
160 | 160 | 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', |
161 | 161 | 'class' => 'j.wikiEditor.modules.highlight', |
162 | | - 'version' => 13 |
| 162 | + 'version' => 14 |
163 | 163 | ), |
164 | 164 | array( |
165 | 165 | 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html |
— | — | @@ -94,11 +94,11 @@ |
95 | 95 | } |
96 | 96 | var context = window.parent.jQuery.wikiEditor.instances[get( 'instance' )].data( 'wikiEditor-context' ); |
97 | 97 | $j( document ) |
98 | | - .bind( "keyup mouseup paste cut", function( event ) { |
99 | | - context.fn.trigger( "change", event ); |
| 98 | + .bind( 'keyup mouseup paste cut', function( event ) { |
| 99 | + context.fn.trigger( 'change', event ); |
100 | 100 | } ) |
101 | | - .delayedBind( 250, "keydown keypress keyup mousedown mouseup cut paste", function( event ) { |
102 | | - context.fn.trigger( "delayedChange", event ); |
| 101 | + .delayedBind( 250, 'keyup mouseup paste cut', function( event ) { |
| 102 | + context.fn.trigger( 'delayedChange', event ); |
103 | 103 | } ); |
104 | 104 | } ); |
105 | 105 | </script> |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -267,26 +267,12 @@ |
268 | 268 | * processing of events which did not actually change the content of the iframe. |
269 | 269 | */ |
270 | 270 | 'change': function( event ) { |
271 | | - // Event filtering |
272 | | - switch ( event.type ) { |
273 | | - // We are looking for characters being inserted and deleted one at a time here, and keyp happens after a |
274 | | - // key has already been pressed and proceesed - it also works the same on all browsers |
275 | | - case 'keyup': |
276 | | - // TODO: Test if something was deleted, because if nothing was deleted, we can go with a less |
277 | | - // resource intensive character level event scope - like: "event.data.scope = 'character'" |
278 | | - event.data.scope = 'division'; |
279 | | - break; |
280 | | - // Here we are looking for the user dragging and dropping content around or cutting and pasting |
281 | | - case 'mouseup': |
282 | | - case 'paste': |
283 | | - case 'cut': |
284 | | - // TODO: Verify our suspicion that something really did change |
285 | | - event.data.scope = 'division'; |
286 | | - break; |
287 | | - // When nothing of interest happened, we can go ahead and move on - nothing to see here |
288 | | - default: break; |
289 | | - } |
| 271 | + event.data.scope = 'division'; |
290 | 272 | return true; |
| 273 | + }, |
| 274 | + 'delayedChange': function( event ) { |
| 275 | + // Redirect - since we want the same functionality |
| 276 | + return context.evt.change( event ); |
291 | 277 | } |
292 | 278 | }; |
293 | 279 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | */ |
14 | 14 | evt: { |
15 | 15 | delayedChange: function( context, event ) { |
| 16 | + console.log( event.data.scope ); |
16 | 17 | /* |
17 | 18 | * Triggered on any of the following events, with the intent on detecting if something was added, deleted or |
18 | 19 | * replaced due to user action. |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6629,26 +6629,12 @@ |
6630 | 6630 | * processing of events which did not actually change the content of the iframe. |
6631 | 6631 | */ |
6632 | 6632 | 'change': function( event ) { |
6633 | | - // Event filtering |
6634 | | - switch ( event.type ) { |
6635 | | - // We are looking for characters being inserted and deleted one at a time here, and keyp happens after a |
6636 | | - // key has already been pressed and proceesed - it also works the same on all browsers |
6637 | | - case 'keyup': |
6638 | | - // TODO: Test if something was deleted, because if nothing was deleted, we can go with a less |
6639 | | - // resource intensive character level event scope - like: "event.data.scope = 'character'" |
6640 | | - event.data.scope = 'division'; |
6641 | | - break; |
6642 | | - // Here we are looking for the user dragging and dropping content around or cutting and pasting |
6643 | | - case 'mouseup': |
6644 | | - case 'paste': |
6645 | | - case 'cut': |
6646 | | - // TODO: Verify our suspicion that something really did change |
6647 | | - event.data.scope = 'division'; |
6648 | | - break; |
6649 | | - // When nothing of interest happened, we can go ahead and move on - nothing to see here |
6650 | | - default: break; |
6651 | | - } |
| 6633 | + event.data.scope = 'division'; |
6652 | 6634 | return true; |
| 6635 | + }, |
| 6636 | + 'delayedChange': function( event ) { |
| 6637 | + // Redirect - since we want the same functionality |
| 6638 | + return context.evt.change( event ); |
6653 | 6639 | } |
6654 | 6640 | }; |
6655 | 6641 | |
— | — | @@ -7299,6 +7285,7 @@ |
7300 | 7286 | */ |
7301 | 7287 | evt: { |
7302 | 7288 | delayedChange: function( context, event ) { |
| 7289 | + console.log( event.data.scope ); |
7303 | 7290 | /* |
7304 | 7291 | * Triggered on any of the following events, with the intent on detecting if something was added, deleted or |
7305 | 7292 | * replaced due to user action. |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -434,8 +434,7 @@ |
435 | 435 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
436 | 436 | var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
437 | 437 | for(module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}} |
438 | | -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){switch(event.type){case'keyup':event.data.scope='division';break;case'mouseup':case'paste':case'cut':event.data.scope='division';break;default:break;} |
439 | | -return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
| 438 | +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';return true;},'delayedChange':function(event){return context.evt.change(event);}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
440 | 439 | if(typeof event.data=='undefined'){event.data={};} |
441 | 440 | if(name in context.evt){if(!context.evt[name](event)){return false;}} |
442 | 441 | for(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);} |
— | — | @@ -475,7 +474,7 @@ |
476 | 475 | configuration.newButtons[gM(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});} |
477 | 476 | var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
478 | 477 | maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);} |
479 | | -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){if(event.data.scope=='division'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},ready:function(context,event){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){function Token(offset,label,tokenStart,match){this.offset=offset;this.label=label;this.tokenStart=tokenStart;this.match=match;} |
| 478 | +$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){console.log(event.data.scope);if(event.data.scope=='division'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},ready:function(context,event){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){function Token(offset,label,tokenStart,match){this.offset=offset;this.label=label;this.tokenStart=tokenStart;this.match=match;} |
480 | 479 | var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(module in $.wikiEditor.modules){if('exp'in $.wikiEditor.modules[module]){for(var i=0;i<$.wikiEditor.modules[module].exp.length;i++){var regex=$.wikiEditor.modules[module].exp[i].regex;var label=$.wikiEditor.modules[module].exp[i].label;var markAfter=false;if(typeof $.wikiEditor.modules[module].exp[i].markAfter!='undefined'){markAfter=true;} |
481 | 480 | match=text.match(regex);var oldOffset=0;while(match!=null){var markOffset=0;var tokenStart=match.index+oldOffset+markOffset;if(markAfter){markOffset+=match[0].length;} |
482 | 481 | tokenArray.push(new Token(match.index+oldOffset+markOffset,label,tokenStart,match));oldOffset+=match.index+match[0].length;newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}} |