Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -73,7 +73,7 @@ |
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' => 155 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 34 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 35 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 94 ), |
— | — | @@ -82,10 +82,10 @@ |
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' => 291 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 292 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 291 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 292 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | // FIXME: $( node ).data( 'display' ) doesn't exist any more |
77 | 77 | //$( node ).data( 'display' ).remove(); |
78 | 78 | }, |
79 | | - onSkip: function() { }, // TODO update template info |
| 79 | + onSkip: function() { }, |
80 | 80 | getAnchor: function( ca1, ca2 ) { |
81 | 81 | // FIXME: Relies on the current <span> structure that is likely to die |
82 | 82 | return $( ca1.parentNode ).is( 'span.wikiEditor-template-text' ) ? |
— | — | @@ -226,54 +226,55 @@ |
227 | 227 | }; |
228 | 228 | |
229 | 229 | |
230 | | - function createDialog( $templateDiv ){ |
231 | | - var $wikitext = $templateDiv.children('.wikiEditor-template-text'); |
| 230 | + function createDialog( $templateDiv ) { |
| 231 | + var $wikitext = $templateDiv.children( '.wikiEditor-template-text' ); |
232 | 232 | //TODO: check if template model has been changed |
233 | 233 | var templateModel = new $.wikiEditor.modules.templateEditor.fn.model( $wikitext.text() ); |
234 | | - $templateDiv.data('model', templateModel); |
235 | | - var $dialog = $("<div></div>"); |
236 | | - var $title = |
237 | | - $("<div>" + templateModel.getName() + "</div>").addClass('wikiEditor-template-dialog-title'); |
238 | | - var $table = $("<table></table>") |
239 | | - .addClass('wikiEditor-template-dialog-table') |
240 | | - .appendTo($dialog); |
| 234 | + $templateDiv.data( 'model', templateModel ); |
| 235 | + var $dialog = $( '<div />' ); |
| 236 | + var $title = $(' <div />' ) |
| 237 | + .text( templateModel.getName() ) |
| 238 | + .addClass( 'wikiEditor-template-dialog-title' ); |
| 239 | + var $table = $( '<table />' ) |
| 240 | + .addClass( 'wikiEditor-template-dialog-table' ) |
| 241 | + .appendTo( $dialog ); |
241 | 242 | var allInitialParams = templateModel.getAllInitialParams(); |
242 | | - for( var paramIndex in allInitialParams ){ |
| 243 | + for ( var paramIndex in allInitialParams ) { |
243 | 244 | var param = allInitialParams[paramIndex]; |
244 | | - if(typeof param.name == 'undefined'){continue;} //param 0 is the name |
245 | | - var $paramRow = $("<tr></tr>") |
246 | | - .addClass('wikiEditor-template-dialog-row'); |
247 | | - var $paramName = $("<td></td>") |
248 | | - .addClass('wikiEditor-template-dialog-name') |
249 | | - .text( param.name ); |
250 | | - var $paramVal = $("<td></td>") |
251 | | - .addClass('wikiEditor-template-dialog-value'); |
252 | | - var $paramInput =$("<input></input>") |
253 | | - .data('name', param.name) |
254 | | - .val( templateModel.getValue(param.name) ); |
255 | | - $paramVal.append($paramInput); |
256 | | - $paramRow.append($paramName).append($paramVal); |
257 | | - $table.append($paramRow); |
| 245 | + if ( typeof param.name == 'undefined' ) { |
| 246 | + //param 0 is the name |
| 247 | + continue; |
| 248 | + } |
| 249 | + var $paramRow = $( '<tr />' ) |
| 250 | + .addClass( 'wikiEditor-template-dialog-row' ); |
| 251 | + var $paramName = $( '<td />' ) |
| 252 | + .addClass( 'wikiEditor-template-dialog-name' ) |
| 253 | + .text( param.name ); |
| 254 | + var $paramVal = $( '<td />' ) |
| 255 | + .addClass( 'wikiEditor-template-dialog-value' ); |
| 256 | + var $paramInput = $( '<input />' ) |
| 257 | + .data( 'name', param.name ) |
| 258 | + .val( templateModel.getValue( param.name ) ); |
| 259 | + $paramVal.append( $paramInput ); |
| 260 | + $paramRow.append( $paramName ).append( $paramVal ); |
| 261 | + $table.append( $paramRow ); |
258 | 262 | } |
259 | 263 | //click handler for values |
260 | | - $("<button></button>").click(function(){ |
261 | | - $('.wikiEditor-template-dialog-value input').each( function(){ |
| 264 | + $( '<button />' ).click( function() { |
| 265 | + $( '.wikiEditor-template-dialog-value input' ).each( function(){ |
262 | 266 | templateModel.setValue( $(this).data('name'), $(this).val() ); |
263 | 267 | }); |
264 | 268 | //keep text consistent |
265 | 269 | $wikitext.text( templateModel.getText() ); |
266 | 270 | |
267 | | - $dialog.dialog('close'); |
| 271 | + $dialog.dialog( 'close' ); |
268 | 272 | |
269 | | - }).text("OK").appendTo($dialog); |
| 273 | + }).text( 'OK' ).appendTo( $dialog ); // FIXME: Internationalize 'OK' |
270 | 274 | $dialog.dialog(); //opens dialog |
271 | 275 | return false; |
272 | 276 | }; |
273 | 277 | |
274 | | - |
275 | | - |
276 | | - |
277 | | - function toggleWikiText( ) { |
| 278 | + function toggleWikiText() { |
278 | 279 | var $template = $( this ).closest( '.wikiEditor-template' ); |
279 | 280 | $template |
280 | 281 | .toggleClass( 'wikiEditor-template-collapsed' ) |
— | — | @@ -282,14 +283,13 @@ |
283 | 284 | .toggleClass( 'wikiEditor-nodisplay' ); |
284 | 285 | |
285 | 286 | //if we just collapsed this |
286 | | - if( $template.hasClass('wikiEditor-template-collapsed') ) { |
| 287 | + if ( $template.hasClass( 'wikiEditor-template-collapsed' ) ) { |
287 | 288 | var model = new $.wikiEditor.modules.templateEditor.fn.model( |
288 | 289 | $template.children( '.wikiEditor-template-text' ).text() |
289 | 290 | ); |
290 | 291 | $template.data( 'model' , model ); |
291 | 292 | $template.children( '.wikiEditor-template-name' ).text( model.getName() ); |
292 | | - } |
293 | | - else{ //else we just expanded this |
| 293 | + } else{ //else we just expanded this |
294 | 294 | $template.children( '.wikiEditor-template-text' ).children('.wikiEditor-template-inner-text').text( |
295 | 295 | $template.data('model') |
296 | 296 | .getText() |
— | — | @@ -301,21 +301,19 @@ |
302 | 302 | return false; |
303 | 303 | } |
304 | 304 | |
305 | | - function noEdit() { |
306 | | - return false; |
307 | | - } |
308 | | - |
| 305 | + function noEdit() { |
| 306 | + return false; |
| 307 | + } |
309 | 308 | }); |
310 | 309 | |
311 | 310 | }, |
312 | 311 | |
313 | | - |
314 | 312 | /** |
315 | 313 | * Gets templateInfo node from templateInfo extension, if it exists |
316 | 314 | */ |
317 | | - getTemplateInfo: function ( templateName ){ |
| 315 | + getTemplateInfo: function ( templateName ) { |
318 | 316 | var templateInfo = ''; |
319 | | - //API call here |
| 317 | + // TODO: API call here |
320 | 318 | return $( templateInfo ); |
321 | 319 | }, |
322 | 320 | |
— | — | @@ -503,7 +501,7 @@ |
504 | 502 | }; |
505 | 503 | |
506 | 504 | //not collapsing "small" templates |
507 | | - if( wikitext.length < 20 ){ |
| 505 | + if ( wikitext.length < 20 ) { |
508 | 506 | collapsible = false; |
509 | 507 | } |
510 | 508 | // Whitespace* {{ whitespace* nonwhitespace: |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -199,7 +199,9 @@ |
200 | 200 | // Split off the prefix |
201 | 201 | // This leaves the prefix in the current node and puts |
202 | 202 | // the rest in a new node which is our start node |
203 | | - startNode = startNode.splitText( s.offset ); |
| 203 | + startNode = startNode.splitText( s.offset < s.node.nodeValue.length ? |
| 204 | + s.offset : s.node.nodeValue.length - 1 |
| 205 | + ); |
204 | 206 | // This also invalidates cached offset objects |
205 | 207 | context.fn.purgeOffsets(); // TODO: Optimize better, get end offset object earlier |
206 | 208 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8524,7 +8524,9 @@ |
8525 | 8525 | // Split off the prefix |
8526 | 8526 | // This leaves the prefix in the current node and puts |
8527 | 8527 | // the rest in a new node which is our start node |
8528 | | - startNode = startNode.splitText( s.offset ); |
| 8528 | + startNode = startNode.splitText( s.offset < s.node.nodeValue.length ? |
| 8529 | + s.offset : s.node.nodeValue.length - 1 |
| 8530 | + ); |
8529 | 8531 | // This also invalidates cached offset objects |
8530 | 8532 | context.fn.purgeOffsets(); // TODO: Optimize better, get end offset object earlier |
8531 | 8533 | } |
— | — | @@ -9056,7 +9058,7 @@ |
9057 | 9059 | // FIXME: $( node ).data( 'display' ) doesn't exist any more |
9058 | 9060 | //$( node ).data( 'display' ).remove(); |
9059 | 9061 | }, |
9060 | | - onSkip: function() { }, // TODO update template info |
| 9062 | + onSkip: function() { }, |
9061 | 9063 | getAnchor: function( ca1, ca2 ) { |
9062 | 9064 | // FIXME: Relies on the current <span> structure that is likely to die |
9063 | 9065 | return $( ca1.parentNode ).is( 'span.wikiEditor-template-text' ) ? |
— | — | @@ -9207,54 +9209,55 @@ |
9208 | 9210 | }; |
9209 | 9211 | |
9210 | 9212 | |
9211 | | - function createDialog( $templateDiv ){ |
9212 | | - var $wikitext = $templateDiv.children('.wikiEditor-template-text'); |
| 9213 | + function createDialog( $templateDiv ) { |
| 9214 | + var $wikitext = $templateDiv.children( '.wikiEditor-template-text' ); |
9213 | 9215 | //TODO: check if template model has been changed |
9214 | 9216 | var templateModel = new $.wikiEditor.modules.templateEditor.fn.model( $wikitext.text() ); |
9215 | | - $templateDiv.data('model', templateModel); |
9216 | | - var $dialog = $("<div></div>"); |
9217 | | - var $title = |
9218 | | - $("<div>" + templateModel.getName() + "</div>").addClass('wikiEditor-template-dialog-title'); |
9219 | | - var $table = $("<table></table>") |
9220 | | - .addClass('wikiEditor-template-dialog-table') |
9221 | | - .appendTo($dialog); |
| 9217 | + $templateDiv.data( 'model', templateModel ); |
| 9218 | + var $dialog = $( '<div />' ); |
| 9219 | + var $title = $(' <div />' ) |
| 9220 | + .text( templateModel.getName() ) |
| 9221 | + .addClass( 'wikiEditor-template-dialog-title' ); |
| 9222 | + var $table = $( '<table />' ) |
| 9223 | + .addClass( 'wikiEditor-template-dialog-table' ) |
| 9224 | + .appendTo( $dialog ); |
9222 | 9225 | var allInitialParams = templateModel.getAllInitialParams(); |
9223 | | - for( var paramIndex in allInitialParams ){ |
| 9226 | + for ( var paramIndex in allInitialParams ) { |
9224 | 9227 | var param = allInitialParams[paramIndex]; |
9225 | | - if(typeof param.name == 'undefined'){continue;} //param 0 is the name |
9226 | | - var $paramRow = $("<tr></tr>") |
9227 | | - .addClass('wikiEditor-template-dialog-row'); |
9228 | | - var $paramName = $("<td></td>") |
9229 | | - .addClass('wikiEditor-template-dialog-name') |
9230 | | - .text( param.name ); |
9231 | | - var $paramVal = $("<td></td>") |
9232 | | - .addClass('wikiEditor-template-dialog-value'); |
9233 | | - var $paramInput =$("<input></input>") |
9234 | | - .data('name', param.name) |
9235 | | - .val( templateModel.getValue(param.name) ); |
9236 | | - $paramVal.append($paramInput); |
9237 | | - $paramRow.append($paramName).append($paramVal); |
9238 | | - $table.append($paramRow); |
| 9228 | + if ( typeof param.name == 'undefined' ) { |
| 9229 | + //param 0 is the name |
| 9230 | + continue; |
| 9231 | + } |
| 9232 | + var $paramRow = $( '<tr />' ) |
| 9233 | + .addClass( 'wikiEditor-template-dialog-row' ); |
| 9234 | + var $paramName = $( '<td />' ) |
| 9235 | + .addClass( 'wikiEditor-template-dialog-name' ) |
| 9236 | + .text( param.name ); |
| 9237 | + var $paramVal = $( '<td />' ) |
| 9238 | + .addClass( 'wikiEditor-template-dialog-value' ); |
| 9239 | + var $paramInput = $( '<input />' ) |
| 9240 | + .data( 'name', param.name ) |
| 9241 | + .val( templateModel.getValue( param.name ) ); |
| 9242 | + $paramVal.append( $paramInput ); |
| 9243 | + $paramRow.append( $paramName ).append( $paramVal ); |
| 9244 | + $table.append( $paramRow ); |
9239 | 9245 | } |
9240 | 9246 | //click handler for values |
9241 | | - $("<button></button>").click(function(){ |
9242 | | - $('.wikiEditor-template-dialog-value input').each( function(){ |
| 9247 | + $( '<button />' ).click( function() { |
| 9248 | + $( '.wikiEditor-template-dialog-value input' ).each( function(){ |
9243 | 9249 | templateModel.setValue( $(this).data('name'), $(this).val() ); |
9244 | 9250 | }); |
9245 | 9251 | //keep text consistent |
9246 | 9252 | $wikitext.text( templateModel.getText() ); |
9247 | 9253 | |
9248 | | - $dialog.dialog('close'); |
| 9254 | + $dialog.dialog( 'close' ); |
9249 | 9255 | |
9250 | | - }).text("OK").appendTo($dialog); |
| 9256 | + }).text( 'OK' ).appendTo( $dialog ); // FIXME: Internationalize 'OK' |
9251 | 9257 | $dialog.dialog(); //opens dialog |
9252 | 9258 | return false; |
9253 | 9259 | }; |
9254 | 9260 | |
9255 | | - |
9256 | | - |
9257 | | - |
9258 | | - function toggleWikiText( ) { |
| 9261 | + function toggleWikiText() { |
9259 | 9262 | var $template = $( this ).closest( '.wikiEditor-template' ); |
9260 | 9263 | $template |
9261 | 9264 | .toggleClass( 'wikiEditor-template-collapsed' ) |
— | — | @@ -9263,14 +9266,13 @@ |
9264 | 9267 | .toggleClass( 'wikiEditor-nodisplay' ); |
9265 | 9268 | |
9266 | 9269 | //if we just collapsed this |
9267 | | - if( $template.hasClass('wikiEditor-template-collapsed') ) { |
| 9270 | + if ( $template.hasClass( 'wikiEditor-template-collapsed' ) ) { |
9268 | 9271 | var model = new $.wikiEditor.modules.templateEditor.fn.model( |
9269 | 9272 | $template.children( '.wikiEditor-template-text' ).text() |
9270 | 9273 | ); |
9271 | 9274 | $template.data( 'model' , model ); |
9272 | 9275 | $template.children( '.wikiEditor-template-name' ).text( model.getName() ); |
9273 | | - } |
9274 | | - else{ //else we just expanded this |
| 9276 | + } else{ //else we just expanded this |
9275 | 9277 | $template.children( '.wikiEditor-template-text' ).children('.wikiEditor-template-inner-text').text( |
9276 | 9278 | $template.data('model') |
9277 | 9279 | .getText() |
— | — | @@ -9282,21 +9284,19 @@ |
9283 | 9285 | return false; |
9284 | 9286 | } |
9285 | 9287 | |
9286 | | - function noEdit() { |
9287 | | - return false; |
9288 | | - } |
9289 | | - |
| 9288 | + function noEdit() { |
| 9289 | + return false; |
| 9290 | + } |
9290 | 9291 | }); |
9291 | 9292 | |
9292 | 9293 | }, |
9293 | 9294 | |
9294 | | - |
9295 | 9295 | /** |
9296 | 9296 | * Gets templateInfo node from templateInfo extension, if it exists |
9297 | 9297 | */ |
9298 | | - getTemplateInfo: function ( templateName ){ |
| 9298 | + getTemplateInfo: function ( templateName ) { |
9299 | 9299 | var templateInfo = ''; |
9300 | | - //API call here |
| 9300 | + // TODO: API call here |
9301 | 9301 | return $( templateInfo ); |
9302 | 9302 | }, |
9303 | 9303 | |
— | — | @@ -9484,7 +9484,7 @@ |
9485 | 9485 | }; |
9486 | 9486 | |
9487 | 9487 | //not collapsing "small" templates |
9488 | | - if( wikitext.length < 20 ){ |
| 9488 | + if ( wikitext.length < 20 ) { |
9489 | 9489 | collapsible = false; |
9490 | 9490 | } |
9491 | 9491 | // Whitespace* {{ whitespace* nonwhitespace: |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -581,7 +581,7 @@ |
582 | 582 | if(context.modules.highlight.markersStr==markersStr){return;} |
583 | 583 | context.modules.highlight.markersStr=markersStr;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;} |
584 | 584 | 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;} |
585 | | -if(s.offset>0&&s.node.nodeName=='#text'){startNode=startNode.splitText(s.offset);context.fn.purgeOffsets();} |
| 585 | +if(s.offset>0&&s.node.nodeName=='#text'){startNode=startNode.splitText(s.offset<s.node.nodeValue.length?s.offset:s.node.nodeValue.length-1);context.fn.purgeOffsets();} |
586 | 586 | if(markers[i].splitPs&&startNode.parentNode.nodeName=='P'){var startP=startNode.ownerDocument.createElement('p');while(startNode.parentNode.firstChild!=startNode){startP.appendChild(startNode.parentNode.firstChild);} |
587 | 587 | if(startP.firstChild){startNode.parentNode.insertBefore(startP,startNode);}} |
588 | 588 | var end=markers[i].end;var e=context.fn.getOffset(end);if(!e){continue;} |
— | — | @@ -635,10 +635,9 @@ |
636 | 636 | var model=$(this).data('marker').model;var context=$(this).data('marker').context;if(!model.isCollapsible()){return;} |
637 | 637 | var $template=$(this).wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed').data('model',model);var $templateName=$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(toggleWikiTextEditor).prependTo($template);var $templateExpand=$('<span />').addClass('wikiEditor-template-expand wikiEditor-noinclude').append('<img src="'+$.wikiEditor.imgPath+'/templateEditor/expand.png" width="12" height="16" />').append('<img src="'+$.wikiEditor.imgPath+'/templateEditor/collapse.png" width="12" height="16" style="display:none;" />').mousedown(toggleWikiTextEditor).prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').append('<img src="'+$.wikiEditor.imgPath+'/templateEditor/dialog-collapsed.png" width="22" height="16" />').append('<img src="'+$.wikiEditor.imgPath+'/templateEditor/dialog-expanded.png" width="22" height="16" style="display:none;" />').mousedown(function(){createDialog($template);return false;}).insertAfter($templateName);$(this).data('setupDone',true);function toggleWikiTextEditor(){context.fn.refreshOffsets();var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed').find('img').each(function(){$(this).toggle();});var $wikitext=$template.children('.wikiEditor-template-text');$wikitext.toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
638 | 638 | else{$wikitext.text($template.data('model').getText());} |
639 | | -return false;};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 createDialog($templateDiv){var $wikitext=$templateDiv.children('.wikiEditor-template-text');var templateModel=new $.wikiEditor.modules.templateEditor.fn.model($wikitext.text());$templateDiv.data('model',templateModel);var $dialog=$("<div></div>");var $title=$("<div>"+templateModel.getName()+"</div>").addClass('wikiEditor-template-dialog-title');var $table=$("<table></table>").addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
640 | | -var $paramRow=$("<tr></tr>").addClass('wikiEditor-template-dialog-row');var $paramName=$("<td></td>").addClass('wikiEditor-template-dialog-name').text(param.name);var $paramVal=$("<td></td>").addClass('wikiEditor-template-dialog-value');var $paramInput=$("<input></input>").data('name',param.name).val(templateModel.getValue(param.name));$paramVal.append($paramInput);$paramRow.append($paramName).append($paramVal);$table.append($paramRow);} |
641 | | -$("<button></button>").click(function(){$('.wikiEditor-template-dialog-value input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$wikitext.text(templateModel.getText());$dialog.dialog('close');}).text("OK").appendTo($dialog);$dialog.dialog();return false;};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');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
642 | | -else{$template.children('.wikiEditor-template-text').children('.wikiEditor-template-inner-text').text($template.data('model').getText().replace(/\{\{/,'').replace(/\}\}$/,''));} |
| 639 | +return false;};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 createDialog($templateDiv){var $wikitext=$templateDiv.children('.wikiEditor-template-text');var templateModel=new $.wikiEditor.modules.templateEditor.fn.model($wikitext.text());$templateDiv.data('model',templateModel);var $dialog=$('<div />');var $title=$(' <div />').text(templateModel.getName()).addClass('wikiEditor-template-dialog-title');var $table=$('<table />').addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
| 640 | +var $paramRow=$('<tr />').addClass('wikiEditor-template-dialog-row');var $paramName=$('<td />').addClass('wikiEditor-template-dialog-name').text(param.name);var $paramVal=$('<td />').addClass('wikiEditor-template-dialog-value');var $paramInput=$('<input />').data('name',param.name).val(templateModel.getValue(param.name));$paramVal.append($paramInput);$paramRow.append($paramName).append($paramVal);$table.append($paramRow);} |
| 641 | +$('<button />').click(function(){$('.wikiEditor-template-dialog-value input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$wikitext.text(templateModel.getText());$dialog.dialog('close');}).text('OK').appendTo($dialog);$dialog.dialog();return false;};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');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());}else{$template.children('.wikiEditor-template-text').children('.wikiEditor-template-inner-text').text($template.data('model').getText().replace(/\{\{/,'').replace(/\}\}$/,''));} |
643 | 642 | return false;} |
644 | 643 | function noEdit(){return false;}});},getTemplateInfo:function(templateName){var templateInfo='';return $(templateInfo);},model:function(wikitext){var collapsible=true;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;} |
645 | 644 | function Range(begin,end){this.begin=begin;this.end=end;} |