Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | array( 'src' => 'css/wikiEditor.css', 'version' => 7 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 10 ), |
26 | 26 | array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ), |
| 27 | + array( 'src' => 'css/wikiEditor.templateEditor.css', 'version' => 1 ), |
27 | 28 | array( 'src' => 'css/wikiEditor.toc.css', 'version' => 25 ), |
28 | 29 | array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 8 ), |
29 | 30 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/wiki-text.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/wiki-text.png |
___________________________________________________________________ |
Name: svn:mime-type |
30 | 31 | + application/octet-stream |
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.dialogs.css |
— | — | @@ -22,6 +22,13 @@ |
23 | 23 | padding: 2px 1px; |
24 | 24 | } |
25 | 25 | |
| 26 | + |
| 27 | +.ui-dialog .ui-dialog-titlebar { |
| 28 | + padding: 0.75em 20px !important; |
| 29 | +} |
| 30 | +.ui-widget table td { |
| 31 | + padding: 0 !important; |
| 32 | +} |
26 | 33 | .ui-dialog .ui-dialog-buttonpane button.disabled { |
27 | 34 | color: #7f7f7f; |
28 | 35 | background: #f2f2f2; |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -231,6 +231,13 @@ |
232 | 232 | padding: 2px 1px; |
233 | 233 | } |
234 | 234 | |
| 235 | + |
| 236 | +.ui-dialog .ui-dialog-titlebar { |
| 237 | + padding: 0.75em 20px !important; |
| 238 | +} |
| 239 | +.ui-widget table td { |
| 240 | + padding: 0 !important; |
| 241 | +} |
235 | 242 | .ui-dialog .ui-dialog-buttonpane button.disabled { |
236 | 243 | color: #7f7f7f; |
237 | 244 | background: #f2f2f2; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -216,6 +216,12 @@ |
217 | 217 | border:2px solid red; |
218 | 218 | padding:2px 1px; |
219 | 219 | } |
| 220 | +.ui-dialog .ui-dialog-titlebar{ |
| 221 | +padding:0.75em 20px !important; |
| 222 | +} |
| 223 | +.ui-widget table td{ |
| 224 | +padding:0 !important; |
| 225 | +} |
220 | 226 | .ui-dialog .ui-dialog-buttonpane button.disabled{ |
221 | 227 | color:#7f7f7f; |
222 | 228 | background:#f2f2f2; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -65,6 +65,11 @@ |
66 | 66 | { 'regex': /}}/, 'label': "TEMPLATE_END", 'markAfter': true } |
67 | 67 | ], |
68 | 68 | /** |
| 69 | + * Configuration |
| 70 | + */ |
| 71 | +cfg: { |
| 72 | +}, |
| 73 | +/** |
69 | 74 | * Internally used functions |
70 | 75 | */ |
71 | 76 | fn: { |
— | — | @@ -83,17 +88,40 @@ |
84 | 89 | // We have a model, so all this init stuff has already happened |
85 | 90 | return; |
86 | 91 | } |
87 | | - // Hide this |
88 | | - $(this).addClass( 'wikiEditor-nodisplay wikiEditor-template' ); |
89 | 92 | // Build a model for this |
90 | | - $(this).data( 'model' , new $.wikiEditor.modules.templateEditor.fn.model( $(this).text() ) ); |
91 | | - var model = $(this).data( 'model' ); |
| 93 | + var model = new $.wikiEditor.modules.templateEditor.fn.model( $( this ).text() ); |
| 94 | + var $template = $( this ) |
| 95 | + .wrap( '<div class="wikiEditor-template"></div>' ) |
| 96 | + .addClass( 'wikiEditor-template-text wikiEditor-nodisplay' ) |
| 97 | + .html( |
| 98 | + // Wrap the start and end of the wikitext in spans so we can bind events to them |
| 99 | + $( this ).html() |
| 100 | + .replace( /\{\{/, '<span class="wikiEditor-template-start">{{</span>' ) |
| 101 | + .replace( /\}\}/, '<span class="wikiEditor-template-end">}}</span>' ) ) |
| 102 | + .parent() |
| 103 | + .addClass( 'wikiEditor-template-collapsed' ) |
| 104 | + .data( 'model', model ); |
| 105 | + $( '<span />' ) |
| 106 | + .addClass( 'wikiEditor-template-name wikiEditor-noinclude' ) |
| 107 | + .text( model.getName() ) |
| 108 | + .mousedown( noEdit ) |
| 109 | + .prependTo( $template ); |
| 110 | + $template.find( '.wikiEditor-template-end, .wikiEditor-template-start' ).mousedown( toggleWikiText ); |
| 111 | + $( '<ul />' ) |
| 112 | + .addClass( 'wikiEditor-template-modes wikiEditor-noinclude' ) |
| 113 | + .append( $( '<li />' ) |
| 114 | + .addClass( 'wikiEditor-template-action-wikiText' ) |
| 115 | + .append( $( '<img />' ).attr( 'src', |
| 116 | + $.wikiEditor.imgPath + 'templateEditor/' + 'wiki-text.png' ) ) |
| 117 | + .mousedown( toggleWikiText ) ) |
| 118 | + .insertAfter( $template.find( '.wikiEditor-template-name' ) ); |
92 | 119 | // Expand |
93 | 120 | function expandTemplate( $displayDiv ) { |
94 | 121 | // Housekeeping |
95 | 122 | $displayDiv.removeClass( 'wikiEditor-template-collapsed' ); |
96 | 123 | $displayDiv.addClass( 'wikiEditor-template-expanded' ); |
97 | | - |
| 124 | + // remove mousedown hander from the entire thing |
| 125 | + $displayDiv.unbind( 'mousedown' ); |
98 | 126 | //$displayDiv.text( model.getText() ); |
99 | 127 | $keyValueTable = $( '<table />' ) |
100 | 128 | .appendTo( $displayDiv ); |
— | — | @@ -122,23 +150,23 @@ |
123 | 151 | $displayDiv.removeClass( 'wikiEditor-template-expanded' ); |
124 | 152 | $displayDiv.text( model.getName() ); |
125 | 153 | }; |
126 | | - // Build the collapsed version of this template |
127 | | - var $visibleDiv = $( "<div />" ).addClass( 'wikiEditor-noinclude' ); |
128 | | - // Let these two know about each other |
129 | | - $(this).data( 'display', $visibleDiv ); |
130 | | - $visibleDiv.data( 'wikitext', $(this) ); |
131 | | - $(this).after( $visibleDiv ); |
132 | | - // Add click handler |
133 | | - $visibleDiv.mousedown( function() { |
134 | | - // Is collapsed, switch to expand |
135 | | - if ( $(this).hasClass( 'wikiEditor-template-collapsed' ) ) { |
136 | | - expandTemplate( $(this) ); |
137 | | - } else { |
138 | | - collapseTemplate( $(this) ); |
139 | | - } |
140 | | - }); |
141 | | - collapseTemplate( $visibleDiv ); |
| 154 | + function toggleWikiText( ) { |
| 155 | + var $template = $( this ).closest( '.wikiEditor-template' ); |
| 156 | + $template |
| 157 | + .toggleClass( 'wikiEditor-template-collapsed' ) |
| 158 | + .toggleClass( 'wikiEditor-template-expanded' ) |
| 159 | + .children( '.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes' ) |
| 160 | + .toggleClass( 'wikiEditor-nodisplay' ); |
| 161 | + return false; |
| 162 | + } |
| 163 | + function noEdit() { |
| 164 | + return false; |
| 165 | + } |
142 | 166 | }); |
| 167 | + |
| 168 | + function toggleWikiText ( context, template ) { |
| 169 | + |
| 170 | + } |
143 | 171 | }, |
144 | 172 | |
145 | 173 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | |
15 | 15 | /* Wikitext that's folded away and shouldn't be displayed */ |
16 | 16 | .wikiEditor-nodisplay { |
17 | | - display: none; |
| 17 | + display: none !important; |
18 | 18 | } |
19 | 19 | |
20 | 20 | /* A collapsed template */ |
— | — | @@ -21,19 +21,36 @@ |
22 | 22 | background-color:#DDEEFF; |
23 | 23 | border:1px outset #DDEEFF; |
24 | 24 | color:#333333; |
25 | | - cursor:pointer; |
26 | | - display:inline; |
27 | | - padding:0 0.25em; |
| 25 | + padding:0 0 0 0.25em; |
| 26 | + display: inline; |
| 27 | + margin:0 0.25em; |
28 | 28 | text-decoration:none; |
29 | 29 | } |
30 | | - |
| 30 | + ul.wikiEditor-template-modes, |
| 31 | + ul.wikiEditor-template-modes li { |
| 32 | + display: inline; |
| 33 | + list-style: none; |
| 34 | + margin: 0; |
| 35 | + padding: 0; |
| 36 | + } |
| 37 | + ul.wikiEditor-template-modes { |
| 38 | + padding: 0 0 0 0.15em; |
| 39 | + } |
| 40 | + ul.wikiEditor-template-modes li { |
| 41 | + border-left: 1px solid #79848e; |
| 42 | + margin: 0 1px; |
| 43 | + cursor: pointer; |
| 44 | + } |
| 45 | + ul.wikiEditor-template-modes li img { |
| 46 | + vertical-align: middle; |
| 47 | + cursor: pointer !important; |
| 48 | + } |
31 | 49 | /* An expanded template */ |
32 | 50 | .wikiEditor-template-expanded { |
33 | 51 | background:#DDEEFF none repeat scroll 0 0; |
34 | 52 | border:1px inset #DDEEFF; |
35 | 53 | color:black; |
36 | | - cursor:pointer; |
37 | | - display:inline; |
| 54 | + margin:3px; |
38 | 55 | padding:0 0.25em; |
39 | 56 | } |
40 | 57 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * Configuration |
7 | 7 | */ |
8 | 8 | cfg: { |
9 | | - 'styleVersion': 2 |
| 9 | + 'styleVersion': 3 |
10 | 10 | }, |
11 | 11 | /** |
12 | 12 | * Internally used event handlers |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -7241,7 +7241,7 @@ |
7242 | 7242 | * Configuration |
7243 | 7243 | */ |
7244 | 7244 | cfg: { |
7245 | | - 'styleVersion': 2 |
| 7245 | + 'styleVersion': 3 |
7246 | 7246 | }, |
7247 | 7247 | /** |
7248 | 7248 | * Internally used event handlers |
— | — | @@ -7903,6 +7903,11 @@ |
7904 | 7904 | { 'regex': /}}/, 'label': "TEMPLATE_END", 'markAfter': true } |
7905 | 7905 | ], |
7906 | 7906 | /** |
| 7907 | + * Configuration |
| 7908 | + */ |
| 7909 | +cfg: { |
| 7910 | +}, |
| 7911 | +/** |
7907 | 7912 | * Internally used functions |
7908 | 7913 | */ |
7909 | 7914 | fn: { |
— | — | @@ -7921,17 +7926,40 @@ |
7922 | 7927 | // We have a model, so all this init stuff has already happened |
7923 | 7928 | return; |
7924 | 7929 | } |
7925 | | - // Hide this |
7926 | | - $(this).addClass( 'wikiEditor-nodisplay wikiEditor-template' ); |
7927 | 7930 | // Build a model for this |
7928 | | - $(this).data( 'model' , new $.wikiEditor.modules.templateEditor.fn.model( $(this).text() ) ); |
7929 | | - var model = $(this).data( 'model' ); |
| 7931 | + var model = new $.wikiEditor.modules.templateEditor.fn.model( $( this ).text() ); |
| 7932 | + var $template = $( this ) |
| 7933 | + .wrap( '<div class="wikiEditor-template"></div>' ) |
| 7934 | + .addClass( 'wikiEditor-template-text wikiEditor-nodisplay' ) |
| 7935 | + .html( |
| 7936 | + // Wrap the start and end of the wikitext in spans so we can bind events to them |
| 7937 | + $( this ).html() |
| 7938 | + .replace( /\{\{/, '<span class="wikiEditor-template-start">{{</span>' ) |
| 7939 | + .replace( /\}\}/, '<span class="wikiEditor-template-end">}}</span>' ) ) |
| 7940 | + .parent() |
| 7941 | + .addClass( 'wikiEditor-template-collapsed' ) |
| 7942 | + .data( 'model', model ); |
| 7943 | + $( '<span />' ) |
| 7944 | + .addClass( 'wikiEditor-template-name wikiEditor-noinclude' ) |
| 7945 | + .text( model.getName() ) |
| 7946 | + .mousedown( noEdit ) |
| 7947 | + .prependTo( $template ); |
| 7948 | + $template.find( '.wikiEditor-template-end, .wikiEditor-template-start' ).mousedown( toggleWikiText ); |
| 7949 | + $( '<ul />' ) |
| 7950 | + .addClass( 'wikiEditor-template-modes wikiEditor-noinclude' ) |
| 7951 | + .append( $( '<li />' ) |
| 7952 | + .addClass( 'wikiEditor-template-action-wikiText' ) |
| 7953 | + .append( $( '<img />' ).attr( 'src', |
| 7954 | + $.wikiEditor.imgPath + 'templateEditor/' + 'wiki-text.png' ) ) |
| 7955 | + .mousedown( toggleWikiText ) ) |
| 7956 | + .insertAfter( $template.find( '.wikiEditor-template-name' ) ); |
7930 | 7957 | // Expand |
7931 | 7958 | function expandTemplate( $displayDiv ) { |
7932 | 7959 | // Housekeeping |
7933 | 7960 | $displayDiv.removeClass( 'wikiEditor-template-collapsed' ); |
7934 | 7961 | $displayDiv.addClass( 'wikiEditor-template-expanded' ); |
7935 | | - |
| 7962 | + // remove mousedown hander from the entire thing |
| 7963 | + $displayDiv.unbind( 'mousedown' ); |
7936 | 7964 | //$displayDiv.text( model.getText() ); |
7937 | 7965 | $keyValueTable = $( '<table />' ) |
7938 | 7966 | .appendTo( $displayDiv ); |
— | — | @@ -7960,23 +7988,23 @@ |
7961 | 7989 | $displayDiv.removeClass( 'wikiEditor-template-expanded' ); |
7962 | 7990 | $displayDiv.text( model.getName() ); |
7963 | 7991 | }; |
7964 | | - // Build the collapsed version of this template |
7965 | | - var $visibleDiv = $( "<div />" ).addClass( 'wikiEditor-noinclude' ); |
7966 | | - // Let these two know about each other |
7967 | | - $(this).data( 'display', $visibleDiv ); |
7968 | | - $visibleDiv.data( 'wikitext', $(this) ); |
7969 | | - $(this).after( $visibleDiv ); |
7970 | | - // Add click handler |
7971 | | - $visibleDiv.mousedown( function() { |
7972 | | - // Is collapsed, switch to expand |
7973 | | - if ( $(this).hasClass( 'wikiEditor-template-collapsed' ) ) { |
7974 | | - expandTemplate( $(this) ); |
7975 | | - } else { |
7976 | | - collapseTemplate( $(this) ); |
7977 | | - } |
7978 | | - }); |
7979 | | - collapseTemplate( $visibleDiv ); |
| 7992 | + function toggleWikiText( ) { |
| 7993 | + var $template = $( this ).closest( '.wikiEditor-template' ); |
| 7994 | + $template |
| 7995 | + .toggleClass( 'wikiEditor-template-collapsed' ) |
| 7996 | + .toggleClass( 'wikiEditor-template-expanded' ) |
| 7997 | + .children( '.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes' ) |
| 7998 | + .toggleClass( 'wikiEditor-nodisplay' ); |
| 7999 | + return false; |
| 8000 | + } |
| 8001 | + function noEdit() { |
| 8002 | + return false; |
| 8003 | + } |
7980 | 8004 | }); |
| 8005 | + |
| 8006 | + function toggleWikiText ( context, template ) { |
| 8007 | + |
| 8008 | + } |
7981 | 8009 | }, |
7982 | 8010 | |
7983 | 8011 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -470,7 +470,7 @@ |
471 | 471 | 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);});} |
472 | 472 | var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
473 | 473 | 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);} |
474 | | -$(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':2},evt:{delayedChange:function(context,event){if(event.data.scope=='none'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},ready:function(context,event){if($.browser.msie&&$.browser.version>=8){if(!this.isSecondRun){this.isSecondRun=true;return;}} |
| 474 | +$(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=='none'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}},ready:function(context,event){if($.browser.msie&&$.browser.version>=8){if(!this.isSecondRun){this.isSecondRun=true;return;}} |
475 | 475 | $.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;} |
476 | 476 | 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;} |
477 | 477 | 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;} |
— | — | @@ -527,8 +527,9 @@ |
528 | 528 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
529 | 529 | $('#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={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++;} |
530 | 530 | 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;}}} |
531 | | -if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},getWrapper:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-template')&&ca1.previousSibling==null&&ca1.nextSibling==null?ca1.parentNode:null;}});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],fn:{create:function(context,config){context.modules.templateEditor={};},stylize:function(wrappedTemplate){$(wrappedTemplate).each(function(){if(typeof $(this).data('model')!='undefined'){return;} |
532 | | -$(this).addClass('wikiEditor-nodisplay wikiEditor-template');$(this).data('model',new $.wikiEditor.modules.templateEditor.fn.model($(this).text()));var model=$(this).data('model');function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};var $visibleDiv=$("<div />").addClass('wikiEditor-noinclude');$(this).data('display',$visibleDiv);$visibleDiv.data('wikitext',$(this));$(this).after($visibleDiv);$visibleDiv.mousedown(function(){if($(this).hasClass('wikiEditor-template-collapsed')){expandTemplate($(this));}else{collapseTemplate($(this));}});collapseTemplate($visibleDiv);});},getTemplateInfo:function(templateName){var templateInfo='';return $(templateInfo);},model:function(wikitext){function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;} |
| 531 | +if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},getWrapper:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-template')&&ca1.previousSibling==null&&ca1.nextSibling==null?ca1.parentNode:null;}});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},stylize:function(wrappedTemplate){$(wrappedTemplate).each(function(){if(typeof $(this).data('model')!='undefined'){return;} |
| 532 | +var model=new $.wikiEditor.modules.templateEditor.fn.model($(this).text());var $template=$(this).wrap('<div class="wikiEditor-template"></div>').addClass('wikiEditor-template-text wikiEditor-nodisplay').html($(this).html().replace(/\{\{/,'<span class="wikiEditor-template-start">{{</span>').replace(/\}\}/,'<span class="wikiEditor-template-end">}}</span>')).parent().addClass('wikiEditor-template-collapsed').data('model',model);$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(noEdit).prependTo($template);$template.find('.wikiEditor-template-end, .wikiEditor-template-start').mousedown(toggleWikiText);$('<ul />').addClass('wikiEditor-template-modes wikiEditor-noinclude').append($('<li />').addClass('wikiEditor-template-action-wikiText').append($('<img />').attr('src',$.wikiEditor.imgPath+'templateEditor/'+'wiki-text.png')).mousedown(toggleWikiText)).insertAfter($template.find('.wikiEditor-template-name'));function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.unbind('mousedown');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};function toggleWikiText(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-collapsed').toggleClass('wikiEditor-template-expanded').children('.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes').toggleClass('wikiEditor-nodisplay');return false;} |
| 533 | +function noEdit(){return false;}});function toggleWikiText(context,template){}},getTemplateInfo:function(templateName){var templateInfo='';return $(templateInfo);},model:function(wikitext){function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;} |
533 | 534 | function Range(begin,end){this.begin=begin;this.end=end;} |
534 | 535 | function getSetValue(name,value,original){var valueRange;var rangeIndex;var retVal;if(isNaN(name)){if(typeof paramsByName[name]=='undefined'){return"";} |
535 | 536 | rangeIndex=paramsByName[name];}else{rangeIndex=parseInt(name);} |