Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 55 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 9 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 13 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 14 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 131 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 132 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 131 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 132 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -3086,8 +3086,10 @@ |
3087 | 3087 | var sanatizedStr = wikitext.replace( /{{/, " " ); |
3088 | 3088 | // Replace end |
3089 | 3089 | endBraces = sanatizedStr.match( /}}\s*$/ ); |
3090 | | - sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
3091 | | - sanatizedStr.substring( endBraces.index + 2 ); |
| 3090 | + if ( endBraces ) { |
| 3091 | + sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
| 3092 | + sanatizedStr.substring( endBraces.index + 2 ); |
| 3093 | + } |
3092 | 3094 | // Match the open braces we just found with equivalent closing braces note, works for any level of braces |
3093 | 3095 | while ( sanatizedStr.indexOf( '{{' ) != -1 ) { |
3094 | 3096 | startIndex = sanatizedStr.indexOf( '{{' ) + 1; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -194,8 +194,9 @@ |
195 | 195 | return retVal;};this.getName=function(){if(typeof ranges[templateNameIndex].newVal=='undefined'){return wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}else{return ranges[templateNameIndex].newVal;}};this.setName=function(name){ranges[templateNameIndex].newVal=name;};this.setValue=function(name,value){return getSetValue(name,value,false);};this.getValue=function(name){return getSetValue(name,null,false);};this.getOriginalValue=function(name){return getSetValue(name,null,true);};this.getAllParamNames=function(){return paramsByName;};this.getAllInitialParams=function(){return params;} |
196 | 196 | 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;}} |
197 | 197 | return newText;};if(wikitext.match(/\s*{{\s*\S*:/)){} |
198 | | -var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+ |
199 | | -sanatizedStr.substring(endBraces.index+2);while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while(openBraces>0){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;} |
| 198 | +var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);if(endBraces){sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+ |
| 199 | +sanatizedStr.substring(endBraces.index+2);} |
| 200 | +while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while(openBraces>0){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;} |
200 | 201 | sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[{}|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);} |
201 | 202 | var ranges=[];var params=[];var templateNameIndex=0;var doneParsing=false;oldDivider=0;divider=sanatizedStr.indexOf('|',oldDivider);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;} |
202 | 203 | nameMatch=wikitext.substring(0,divider).match(/[^{\s]+/);if(nameMatch!=undefined){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);} |