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' => 164 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 40 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 41 ), |
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' => 52 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 53 ), |
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' => 327 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 328 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 327 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 328 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -204,8 +204,7 @@ |
205 | 205 | var $template = $wrapper.parent( '.wikiEditor-template' ); |
206 | 206 | $template.find( '.wikiEditor-template-name' ) |
207 | 207 | .click( function() { $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); return false; } ) |
208 | | - .mousedown( function() { return false; } ) |
209 | | - .data("keydownHandler", function(){console.log("CARLOS!");}); |
| 208 | + .mousedown( function() { return false; } ); |
210 | 209 | $template.find( '.wikiEditor-template-expand' ) |
211 | 210 | .click( function() { $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); return false; } ) |
212 | 211 | .mousedown( function() { return false; } ); |
— | — | @@ -581,10 +580,6 @@ |
582 | 581 | } |
583 | 582 | }; |
584 | 583 | |
585 | | - //not collapsing "small" templates |
586 | | - if ( wikitext.length < 20 ) { |
587 | | - collapsible = false; |
588 | | - } |
589 | 584 | // Whitespace* {{ whitespace* nonwhitespace: |
590 | 585 | if ( wikitext.match( /\s*{{\s*\S*:/ ) ) { |
591 | 586 | collapsible = false; // is a parser function |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -176,30 +176,9 @@ |
177 | 177 | // Traverse the iframe DOM, inserting markers where they're needed. |
178 | 178 | // Store visited markers here so we know which markers should be removed |
179 | 179 | var visited = [], v = 0; |
180 | | - var purgeStarts = false; |
181 | | - var cBreak = false; |
182 | 180 | for ( var i = 0; i < markers.length; i++ ) { |
183 | 181 | // We want to isolate each marker, so we may need to split textNodes |
184 | 182 | // if a marker starts or ends halfway one. |
185 | | - if(!purgeStarts && ( (markers[i].start + "," + markers[i].type) in context.modules.highlight.markersOldStarts) ){ |
186 | | - //start same |
187 | | - oldStarts[markers[i].start+","+markers[i].type] = true; |
188 | | - if(division == 'realchange'){ |
189 | | - cBreak = true; //already existed, offsets fine |
190 | | - } |
191 | | - } |
192 | | - else{ |
193 | | - //only do this once |
194 | | - if(!purgeStarts){ |
195 | | - context.modules.highlight.markersOldStarts = oldStarts; |
196 | | - purgeStarts = true; |
197 | | - if(division == 'realchange'){ |
198 | | - cBreak = true; //user is currently typing in something whose begin exists |
199 | | - } |
200 | | - } |
201 | | - context.modules.highlight.markersOldStarts[markers[i].start+","+markers[i].type] = true; |
202 | | - } |
203 | | - |
204 | 183 | var start = markers[i].start; |
205 | 184 | var s = context.fn.getOffset( start ); |
206 | 185 | if ( !s ) { |
— | — | @@ -369,7 +348,7 @@ |
370 | 349 | var ca1 = startNode, ca2 = endNode; |
371 | 350 | if ( ca1 && ca2 && ca1.parentNode ) { |
372 | 351 | var anchor = markers[i].getAnchor( ca1, ca2 ); |
373 | | - if ( !anchor && !cBreak ) { //cBreak prevents a new span from being created which stops cursor jumps |
| 352 | + if ( !anchor ) { |
374 | 353 | var commonAncestor = ca1.parentNode; |
375 | 354 | if ( markers[i].anchor == 'wrap') { |
376 | 355 | // We have to store things like .parentNode and .nextSibling because |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8708,30 +8708,9 @@ |
8709 | 8709 | // Traverse the iframe DOM, inserting markers where they're needed. |
8710 | 8710 | // Store visited markers here so we know which markers should be removed |
8711 | 8711 | var visited = [], v = 0; |
8712 | | - var purgeStarts = false; |
8713 | | - var cBreak = false; |
8714 | 8712 | for ( var i = 0; i < markers.length; i++ ) { |
8715 | 8713 | // We want to isolate each marker, so we may need to split textNodes |
8716 | 8714 | // if a marker starts or ends halfway one. |
8717 | | - if(!purgeStarts && ( (markers[i].start + "," + markers[i].type) in context.modules.highlight.markersOldStarts) ){ |
8718 | | - //start same |
8719 | | - oldStarts[markers[i].start+","+markers[i].type] = true; |
8720 | | - if(division == 'realchange'){ |
8721 | | - cBreak = true; //already existed, offsets fine |
8722 | | - } |
8723 | | - } |
8724 | | - else{ |
8725 | | - //only do this once |
8726 | | - if(!purgeStarts){ |
8727 | | - context.modules.highlight.markersOldStarts = oldStarts; |
8728 | | - purgeStarts = true; |
8729 | | - if(division == 'realchange'){ |
8730 | | - cBreak = true; //user is currently typing in something whose begin exists |
8731 | | - } |
8732 | | - } |
8733 | | - context.modules.highlight.markersOldStarts[markers[i].start+","+markers[i].type] = true; |
8734 | | - } |
8735 | | - |
8736 | 8715 | var start = markers[i].start; |
8737 | 8716 | var s = context.fn.getOffset( start ); |
8738 | 8717 | if ( !s ) { |
— | — | @@ -8901,7 +8880,7 @@ |
8902 | 8881 | var ca1 = startNode, ca2 = endNode; |
8903 | 8882 | if ( ca1 && ca2 && ca1.parentNode ) { |
8904 | 8883 | var anchor = markers[i].getAnchor( ca1, ca2 ); |
8905 | | - if ( !anchor && !cBreak ) { //cBreak prevents a new span from being created which stops cursor jumps |
| 8884 | + if ( !anchor ) { |
8906 | 8885 | var commonAncestor = ca1.parentNode; |
8907 | 8886 | if ( markers[i].anchor == 'wrap') { |
8908 | 8887 | // We have to store things like .parentNode and .nextSibling because |
— | — | @@ -9478,8 +9457,7 @@ |
9479 | 9458 | var $template = $wrapper.parent( '.wikiEditor-template' ); |
9480 | 9459 | $template.find( '.wikiEditor-template-name' ) |
9481 | 9460 | .click( function() { $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); return false; } ) |
9482 | | - .mousedown( function() { return false; } ) |
9483 | | - .data("keydownHandler", function(){console.log("CARLOS!");}); |
| 9461 | + .mousedown( function() { return false; } ); |
9484 | 9462 | $template.find( '.wikiEditor-template-expand' ) |
9485 | 9463 | .click( function() { $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); return false; } ) |
9486 | 9464 | .mousedown( function() { return false; } ); |
— | — | @@ -9855,10 +9833,6 @@ |
9856 | 9834 | } |
9857 | 9835 | }; |
9858 | 9836 | |
9859 | | - //not collapsing "small" templates |
9860 | | - if ( wikitext.length < 20 ) { |
9861 | | - collapsible = false; |
9862 | | - } |
9863 | 9837 | // Whitespace* {{ whitespace* nonwhitespace: |
9864 | 9838 | if ( wikitext.match( /\s*{{\s*\S*:/ ) ) { |
9865 | 9839 | collapsible = false; // is a parser function |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -592,10 +592,7 @@ |
593 | 593 | 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+',';} |
594 | 594 | if(context.modules.highlight.markersStr==markersStr){return;} |
595 | 595 | context.modules.highlight.markersStr=markersStr;var oldStarts=[];if(!context.modules.highlight.markersOldStarts){context.modules.highlight.markersOldStarts=[];} |
596 | | -var visited=[],v=0;var purgeStarts=false;var cBreak=false;for(var i=0;i<markers.length;i++){if(!purgeStarts&&((markers[i].start+","+markers[i].type)in context.modules.highlight.markersOldStarts)){oldStarts[markers[i].start+","+markers[i].type]=true;if(division=='realchange'){cBreak=true;}} |
597 | | -else{if(!purgeStarts){context.modules.highlight.markersOldStarts=oldStarts;purgeStarts=true;if(division=='realchange'){cBreak=true;}} |
598 | | -context.modules.highlight.markersOldStarts[markers[i].start+","+markers[i].type]=true;} |
599 | | -var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
| 596 | +var visited=[],v=0;for(var i=0;i<markers.length;i++){var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
600 | 597 | var startNode=s.node;var startDepth=s.depth;while(startNode.nodeName=='BR'||s.offset==startNode.nodeValue.length){start++;s=context.fn.getOffset(start);startNode=s.node;startDepth=s.depth;} |
601 | 598 | if(s.offset>0&&s.node.nodeName=='#text'){var newStartNode=startNode.splitText(s.offset<s.node.nodeValue.length?s.offset:s.node.nodeValue.length-1);var oldStartNode=startNode;startNode=newStartNode;var subtracted=s.offset;var oldLength=s.length;var oldDepth=s.depth;var j,o;for(j=start-subtracted;j<start;j++){if(j in context.offsets){o=context.offsets[j];o.node=oldStartNode;o.length=subtracted;}} |
602 | 599 | for(j=start;j<start-subtracted+oldLength;j++){if(j in context.offsets){o=context.offsets[j];o.node=newStartNode;o.offset-=subtracted;o.length-=subtracted;o.lastTextNode=oldStartNode;o.lastTextNodeDepth=oldDepth;}}} |
— | — | @@ -609,7 +606,7 @@ |
610 | 607 | oldParent.parentNode.removeChild(oldParent);} |
611 | 608 | lastP=t.inP;} |
612 | 609 | context.fn.purgeOffsets();} |
613 | | -var ca1=startNode,ca2=endNode;if(ca1&&ca2&&ca1.parentNode){var anchor=markers[i].getAnchor(ca1,ca2);if(!anchor&&!cBreak){var commonAncestor=ca1.parentNode;if(markers[i].anchor=='wrap'){var newNode=ca1.ownerDocument.createElement('span');var nextNode=ca2.nextSibling;var n=ca1;while(n!=nextNode){var ns=n.nextSibling;newNode.appendChild(n);n=ns;} |
| 610 | +var ca1=startNode,ca2=endNode;if(ca1&&ca2&&ca1.parentNode){var anchor=markers[i].getAnchor(ca1,ca2);if(!anchor){var commonAncestor=ca1.parentNode;if(markers[i].anchor=='wrap'){var newNode=ca1.ownerDocument.createElement('span');var nextNode=ca2.nextSibling;var n=ca1;while(n!=nextNode){var ns=n.nextSibling;newNode.appendChild(n);n=ns;} |
614 | 611 | if(nextNode){commonAncestor.insertBefore(newNode,nextNode);}else{commonAncestor.appendChild(newNode);} |
615 | 612 | anchor=newNode;}else if(markers[i].anchor=='tag'){anchor=commonAncestor;} |
616 | 613 | $(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);markers[i].onSkip(anchor);} |
— | — | @@ -650,7 +647,7 @@ |
651 | 648 | 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;}}} |
652 | 649 | 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;} |
653 | 650 | var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if($(node).parent().hasClass('wikiEditor-template')){var $name=$(node).parent().children('.wikiEditor-template-name');if($name.text()!=model.getName()){$name.text(model.getName());}} |
654 | | -if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){var $evtElem=event.jQueryNode;if($evtElem){if($evtElem.hasClass('wikiEditor-template-name')){switch(event.which){case 37:case 38:case 39:case 40:return true;default:return false;}}else if($evtElem.hasClass('wikiEditor-template-text')){switch(event.which){case 13:context.fn.encapsulateSelection({'pre':'\n','peri':'','post':''});return false;default:return true;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed');var $templateName=$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).prependTo($template);var $templateExpand=$('<span />').addClass('wikiEditor-template-expand wikiEditor-noinclude').prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').appendTo($templateName);},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},bindTemplateEvents:function($wrapper){var $template=$wrapper.parent('.wikiEditor-template');$template.find('.wikiEditor-template-name').click(function(){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);return false;}).mousedown(function(){return false;}).data("keydownHandler",function(){console.log("CARLOS!");});$template.find('.wikiEditor-template-expand').click(function(){$.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor($wrapper);return false;}).mousedown(function(){return false;});$template.find('.wikiEditor-template-dialog').click(function(){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);return false;}).mousedown(function(){return false;});},toggleWikiTextEditor:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');context.fn.purgeOffsets();$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed').find('.wikiEditor-template-text').toggleClass('wikiEditor-nodisplay');},createDialog:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\ |
| 651 | +if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){var $evtElem=event.jQueryNode;if($evtElem){if($evtElem.hasClass('wikiEditor-template-name')){switch(event.which){case 37:case 38:case 39:case 40:return true;default:return false;}}else if($evtElem.hasClass('wikiEditor-template-text')){switch(event.which){case 13:context.fn.encapsulateSelection({'pre':'\n','peri':'','post':''});return false;default:return true;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed');var $templateName=$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).prependTo($template);var $templateExpand=$('<span />').addClass('wikiEditor-template-expand wikiEditor-noinclude').prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').appendTo($templateName);},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},bindTemplateEvents:function($wrapper){var $template=$wrapper.parent('.wikiEditor-template');$template.find('.wikiEditor-template-name').click(function(){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);return false;}).mousedown(function(){return false;});$template.find('.wikiEditor-template-expand').click(function(){$.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor($wrapper);return false;}).mousedown(function(){return false;});$template.find('.wikiEditor-template-dialog').click(function(){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);return false;}).mousedown(function(){return false;});},toggleWikiTextEditor:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');context.fn.purgeOffsets();$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed').find('.wikiEditor-template-text').toggleClass('wikiEditor-nodisplay');},createDialog:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\ |
655 | 652 | <fieldset>\ |
656 | 653 | <div class="wikiEditor-template-dialog-title" />\ |
657 | 654 | <div class="wikiEditor-template-dialog-fields" />\ |
— | — | @@ -671,8 +668,7 @@ |
672 | 669 | this.getOriginalText=function(){return wikitext;};this.getText=function(){newText="";for(i=0;i<ranges.length;i++){if(typeof ranges[i].newVal=='undefined'){newText+=wikitext.substring(ranges[i].begin,ranges[i].end);}else{newText+=ranges[i].newVal;}} |
673 | 670 | return newText;};this.isCollapsible=function(){return collapsible;} |
674 | 671 | this.updateRanges=function(){var adjustment=0;for(var i=0;i<ranges.length;i++){ranges[i].begin+=adjustment;if(typeof ranges[i].adjust!='undefined'){adjustment+=ranges[i].adjust();delete ranges[i].adjust;} |
675 | | -ranges[i].end+=adjustment;}};if(wikitext.length<20){collapsible=false;} |
676 | | -if(wikitext.match(/\s*{{\s*\S*:/)){collapsible=false;} |
| 672 | +ranges[i].end+=adjustment;}};if(wikitext.match(/\s*{{\s*\S*:/)){collapsible=false;} |
677 | 673 | var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);if(endBraces){sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+ |
678 | 674 | sanatizedStr.substring(endBraces.index+2);} |
679 | 675 | while(sanatizedStr.indexOf('<!')!=-1){startIndex=sanatizedStr.indexOf('<!');endIndex=sanatizedStr.indexOf('-->')+3;if(endIndex<3){break;} |