Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -73,19 +73,19 @@ |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 173 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 47 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 48 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 21 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 64 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 65 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 347 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 348 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 347 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 348 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -39,6 +39,9 @@ |
40 | 40 | |
41 | 41 | mark: function( context, event ) { |
42 | 42 | // Get references to the markers and tokens from the current context |
| 43 | + if(context.modules.highlight.currentScope == "realchange"){ |
| 44 | + return; //do nothing on realchange |
| 45 | + } |
43 | 46 | var markers = context.modules.highlight.markers; |
44 | 47 | var tokenArray = context.modules.highlight.tokenArray; |
45 | 48 | // Collect matching level 0 template call boundaries from the tokenArray |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | * ; Definition |
40 | 40 | * : Definition |
41 | 41 | */ |
| 42 | + $.wikiEditor.modules.highlight.currentScope = event.data.scope; |
42 | 43 | if ( event.data.scope == 'realchange' ) { |
43 | 44 | $.wikiEditor.modules.highlight.fn.scan( context, "" ); |
44 | 45 | $.wikiEditor.modules.highlight.fn.mark( context, "realchange", "" ); |
— | — | @@ -45,6 +46,7 @@ |
46 | 47 | }, |
47 | 48 | ready: function( context, event ) { |
48 | 49 | // Highlight stuff for the first time |
| 50 | + $.wikiEditor.modules.highlight.currentScope = "ready"; |
49 | 51 | $.wikiEditor.modules.highlight.fn.scan( context, "" ); |
50 | 52 | $.wikiEditor.modules.highlight.fn.mark( context, "", "" ); |
51 | 53 | } |
— | — | @@ -150,11 +152,19 @@ |
151 | 153 | // FIXME: What do division and tokens do? |
152 | 154 | // TODO: Document the scan() and mark() APIs somewhere |
153 | 155 | mark: function( context, division, tokens ) { |
| 156 | + |
154 | 157 | // Reset markers |
155 | | - |
156 | | - var markers = context.modules.highlight.markers = []; |
| 158 | + var markers = []; |
| 159 | + if(context.modules.highlight.markers && division !=""){ |
| 160 | + for(var i = 0; i < markers.length; i++){ |
| 161 | + if(context.modules.highlight.markers[i].skipDivision == division){ |
| 162 | + markers.push(context.modules.highlight.markers[i]); |
| 163 | + } |
| 164 | + } |
| 165 | + } |
| 166 | + context.modules.highlight.markers = markers; |
| 167 | + |
157 | 168 | // Get all markers |
158 | | - |
159 | 169 | context.fn.trigger( 'mark' ); |
160 | 170 | markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
161 | 171 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8573,6 +8573,7 @@ |
8574 | 8574 | * ; Definition |
8575 | 8575 | * : Definition |
8576 | 8576 | */ |
| 8577 | + $.wikiEditor.modules.highlight.currentScope = event.data.scope; |
8577 | 8578 | if ( event.data.scope == 'realchange' ) { |
8578 | 8579 | $.wikiEditor.modules.highlight.fn.scan( context, "" ); |
8579 | 8580 | $.wikiEditor.modules.highlight.fn.mark( context, "realchange", "" ); |
— | — | @@ -8580,6 +8581,7 @@ |
8581 | 8582 | }, |
8582 | 8583 | ready: function( context, event ) { |
8583 | 8584 | // Highlight stuff for the first time |
| 8585 | + $.wikiEditor.modules.highlight.currentScope = "ready"; |
8584 | 8586 | $.wikiEditor.modules.highlight.fn.scan( context, "" ); |
8585 | 8587 | $.wikiEditor.modules.highlight.fn.mark( context, "", "" ); |
8586 | 8588 | } |
— | — | @@ -8685,11 +8687,19 @@ |
8686 | 8688 | // FIXME: What do division and tokens do? |
8687 | 8689 | // TODO: Document the scan() and mark() APIs somewhere |
8688 | 8690 | mark: function( context, division, tokens ) { |
| 8691 | + |
8689 | 8692 | // Reset markers |
8690 | | - |
8691 | | - var markers = context.modules.highlight.markers = []; |
| 8693 | + var markers = []; |
| 8694 | + if(context.modules.highlight.markers && division !=""){ |
| 8695 | + for(var i = 0; i < markers.length; i++){ |
| 8696 | + if(context.modules.highlight.markers[i].skipDivision == division){ |
| 8697 | + markers.push(context.modules.highlight.markers[i]); |
| 8698 | + } |
| 8699 | + } |
| 8700 | + } |
| 8701 | + context.modules.highlight.markers = markers; |
| 8702 | + |
8692 | 8703 | // Get all markers |
8693 | | - |
8694 | 8704 | context.fn.trigger( 'mark' ); |
8695 | 8705 | markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
8696 | 8706 | |
— | — | @@ -9253,6 +9263,9 @@ |
9254 | 9264 | |
9255 | 9265 | mark: function( context, event ) { |
9256 | 9266 | // Get references to the markers and tokens from the current context |
| 9267 | + if(context.modules.highlight.currentScope == "realchange"){ |
| 9268 | + return; //do nothing on realchange |
| 9269 | + } |
9257 | 9270 | var markers = context.modules.highlight.markers; |
9258 | 9271 | var tokenArray = context.modules.highlight.tokenArray; |
9259 | 9272 | // Collect matching level 0 template call boundaries from the tokenArray |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -584,11 +584,12 @@ |
585 | 585 | configuration.newButtons[mw.usability.getMsg(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);});} |
586 | 586 | dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
587 | 587 | maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);}}});},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);} |
588 | | -$(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={'req':['iframe'],cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"realchange","");}},ready:function(context,event){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},fn:{create:function(context,config){context.modules.highlight.markersStr='';},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;} |
| 588 | +$(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={'req':['iframe'],cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){$.wikiEditor.modules.highlight.currentScope=event.data.scope;if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"realchange","");}},ready:function(context,event){$.wikiEditor.modules.highlight.currentScope="ready";$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},fn:{create:function(context,config){context.modules.highlight.markersStr='';},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;} |
589 | 589 | var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(module in context.modules){if(module in $.wikiEditor.modules&&'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;} |
590 | 590 | 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;} |
591 | 591 | 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);}}}} |
592 | | -tokenArray.sort(function(a,b){return a.offset-b.offset||a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},mark:function(context,division,tokens){var markers=context.modules.highlight.markers=[];context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} |
| 592 | +tokenArray.sort(function(a,b){return a.offset-b.offset||a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},mark:function(context,division,tokens){var markers=[];if(context.modules.highlight.markers&&division!=""){for(var i=0;i<markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}} |
| 593 | +context.modules.highlight.markers=markers;context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} |
593 | 594 | if(context.modules.highlight.markersStr==markersStr){return;} |
594 | 595 | context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){if(typeof markers[i].skipDivision!=='undefined'&&(division==markers[i].skipDivision)){continue;} |
595 | 596 | var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
— | — | @@ -642,7 +643,8 @@ |
643 | 644 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
644 | 645 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
645 | 646 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
646 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'nameMappings':{"Infobox skyscraper":"building_name","Infobox settlement":"official_name"},'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;} |
| 647 | +$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'nameMappings':{"Infobox skyscraper":"building_name","Infobox settlement":"official_name"},'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if(context.modules.highlight.currentScope=="realchange"){return;} |
| 648 | +var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;} |
647 | 649 | if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length-1&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}} |
648 | 650 | if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',afterWrap:function(node){var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if(model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}else{$(node).addClass('wikiEditor-template-text');}},beforeUnwrap:function(node){if($(node).parent().hasClass('wikiEditor-template')){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}},onSkip:function(node){if($(node).html()==$(node).data('oldHTML')){return;} |
649 | 651 | var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if($(node).parent().hasClass('wikiEditor-template')){var $label=$(node).parent().find('.wikiEditor-template-label');var displayName=$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model);if($label.text()!=displayName){$label.text(displayName);}} |