Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,20 +72,20 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 174 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 50 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 175 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 51 ), |
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' => 66 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 67 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 4 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 351 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 352 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 351 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 352 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -15,14 +15,14 @@ |
16 | 16 | 'browsers': { |
17 | 17 | // Left-to-right languages |
18 | 18 | 'ltr': { |
19 | | - 'msie': [['>=', 8]], |
| 19 | + 'msie': false, |
20 | 20 | 'firefox': [['>=', 3]], |
21 | 21 | 'opera': [['>=', 10]], |
22 | 22 | 'safari': [['>=', 4]] |
23 | 23 | }, |
24 | 24 | // Right-to-left languages |
25 | 25 | 'rtl': { |
26 | | - 'msie': [['>=', 8]], |
| 26 | + 'msie': false, |
27 | 27 | 'firefox': [['>=', 3]], |
28 | 28 | 'opera': [['>=', 10]], |
29 | 29 | 'safari': [['>=', 4]] |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -381,7 +381,10 @@ |
382 | 382 | context.oldHTML = newHTML; |
383 | 383 | event.data.scope = 'realchange'; |
384 | 384 | } |
385 | | - |
| 385 | + // Never let the body be totally empty |
| 386 | + if ( context.$content.children().length == 0 ) { |
| 387 | + context.$content.append( '<p></p>' ); |
| 388 | + } |
386 | 389 | return true; |
387 | 390 | }, |
388 | 391 | 'delayedChange': function( event ) { |
— | — | @@ -390,17 +393,15 @@ |
391 | 394 | if ( context.oldDelayedHTML != newHTML ) { |
392 | 395 | context.oldDelayedHTML = newHTML; |
393 | 396 | event.data.scope = 'realchange'; |
394 | | - |
395 | | - //surround by <p> if it does not already have it |
| 397 | + // Surround by <p> if it does not already have it |
396 | 398 | var cursorPos = context.fn.getCaretPosition(); |
397 | 399 | var t = context.fn.getOffset( cursorPos[0] ); |
398 | | - if ( t.node.nodeName == '#text' && t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
| 400 | + if ( t && t.node.nodeName == '#text' && t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
399 | 401 | $( t.node ).wrap( "<p></p>" ); |
400 | 402 | context.fn.purgeOffsets(); |
401 | 403 | context.fn.setSelection( { start: cursorPos[0], end: cursorPos[1] } ); |
402 | 404 | } |
403 | | - } |
404 | | - |
| 405 | + } |
405 | 406 | context.fn.updateHistory( event.data.scope == 'realchange' ); |
406 | 407 | return true; |
407 | 408 | }, |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | |
159 | 159 | // Recycle markers that will be skipped in this run |
160 | 160 | if ( context.modules.highlight.markers && division != '' ) { |
161 | | - for ( var i = 0; i < context.modules.markers.length; i++ ) { |
| 161 | + for ( var i = 0; i < context.modules.highlight.markers.length; i++ ) { |
162 | 162 | if ( context.modules.highlight.markers[i].skipDivision == division ) { |
163 | 163 | markers.push( context.modules.highlight.markers[i] ); |
164 | 164 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6924,7 +6924,10 @@ |
6925 | 6925 | context.oldHTML = newHTML; |
6926 | 6926 | event.data.scope = 'realchange'; |
6927 | 6927 | } |
6928 | | - |
| 6928 | + // Never let the body be totally empty |
| 6929 | + if ( context.$content.children().length == 0 ) { |
| 6930 | + context.$content.append( '<p></p>' ); |
| 6931 | + } |
6929 | 6932 | return true; |
6930 | 6933 | }, |
6931 | 6934 | 'delayedChange': function( event ) { |
— | — | @@ -6933,17 +6936,15 @@ |
6934 | 6937 | if ( context.oldDelayedHTML != newHTML ) { |
6935 | 6938 | context.oldDelayedHTML = newHTML; |
6936 | 6939 | event.data.scope = 'realchange'; |
6937 | | - |
6938 | | - //surround by <p> if it does not already have it |
| 6940 | + // Surround by <p> if it does not already have it |
6939 | 6941 | var cursorPos = context.fn.getCaretPosition(); |
6940 | 6942 | var t = context.fn.getOffset( cursorPos[0] ); |
6941 | | - if ( t.node.nodeName == '#text' && t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
| 6943 | + if ( t && t.node.nodeName == '#text' && t.node.parentNode.nodeName.toLowerCase() == 'body' ) { |
6942 | 6944 | $( t.node ).wrap( "<p></p>" ); |
6943 | 6945 | context.fn.purgeOffsets(); |
6944 | 6946 | context.fn.setSelection( { start: cursorPos[0], end: cursorPos[1] } ); |
6945 | 6947 | } |
6946 | | - } |
6947 | | - |
| 6948 | + } |
6948 | 6949 | context.fn.updateHistory( event.data.scope == 'realchange' ); |
6949 | 6950 | return true; |
6950 | 6951 | }, |
— | — | @@ -8693,7 +8694,7 @@ |
8694 | 8695 | |
8695 | 8696 | // Recycle markers that will be skipped in this run |
8696 | 8697 | if ( context.modules.highlight.markers && division != '' ) { |
8697 | | - for ( var i = 0; i < context.modules.markers.length; i++ ) { |
| 8698 | + for ( var i = 0; i < context.modules.highlight.markers.length; i++ ) { |
8698 | 8699 | if ( context.modules.highlight.markers[i].skipDivision == division ) { |
8699 | 8700 | markers.push( context.modules.highlight.markers[i] ); |
8700 | 8701 | } |
— | — | @@ -9300,14 +9301,14 @@ |
9301 | 9302 | 'browsers': { |
9302 | 9303 | // Left-to-right languages |
9303 | 9304 | 'ltr': { |
9304 | | - 'msie': [['>=', 8]], |
| 9305 | + 'msie': false, |
9305 | 9306 | 'firefox': [['>=', 3]], |
9306 | 9307 | 'opera': [['>=', 10]], |
9307 | 9308 | 'safari': [['>=', 4]] |
9308 | 9309 | }, |
9309 | 9310 | // Right-to-left languages |
9310 | 9311 | 'rtl': { |
9311 | | - 'msie': [['>=', 8]], |
| 9312 | + 'msie': false, |
9312 | 9313 | 'firefox': [['>=', 3]], |
9313 | 9314 | 'opera': [['>=', 10]], |
9314 | 9315 | 'safari': [['>=', 4]] |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -461,7 +461,8 @@ |
462 | 462 | break;case 86:if(event.ctrlKey){context.evt.paste(event);} |
463 | 463 | break;} |
464 | 464 | return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';} |
465 | | -return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(t.node.nodeName=='#text'&&t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("<p></p>");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}} |
| 465 | +if(context.$content.children().length==0){context.$content.append('<p></p>');} |
| 466 | +return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(t&&t.node.nodeName=='#text'&&t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("<p></p>");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}} |
466 | 467 | context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('<p></p>'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();var oldLength=context.fn.getContents().length;context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');} |
467 | 468 | setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();context.$content.find('*').each(function(){if($(this).children().length==0&&this.childNodes.length>0){$(this).text($(this).text());}});var t=context.fn.traverser(context.$content);while(t){if(t.node.nodeName=='#text'){if(t.node.nodeValue==='\n'){$('<p><br></p>').insertAfter($(t.node));var oldNode=t.node;t=t.next();$(oldNode).remove();continue;} |
468 | 469 | else if((t.node.nodeValue.indexOf('\n')!=1||t.node.nodeValue.indexOf('\r')!=-1)){t.node.nodeValue=t.node.nodeValue.replace(/\r|\n/g,' ');}} |
— | — | @@ -587,7 +588,7 @@ |
588 | 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;} |
589 | 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;} |
590 | 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);}}}} |
591 | | -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<context.modules.markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}} |
| 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<context.modules.highlight.markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}} |
592 | 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;} |
— | — | @@ -644,7 +645,7 @@ |
645 | 646 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
646 | 647 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
647 | 648 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
648 | | -$('#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;} |
| 649 | +$('#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':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if(context.modules.highlight.currentScope=='realchange'){return;} |
649 | 650 | 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++;} |
650 | 651 | 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;}}} |
651 | 652 | 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;} |