Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,20 +72,20 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.namespaceSelect.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' => 119 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 120 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 48 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ), |
80 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 81 ), |
| 80 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 82 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 10 ), |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 17 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 239 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 240 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 239 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 240 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -1,7 +1,25 @@ |
2 | 2 | /* TemplateEditor module for wikiEditor */ |
3 | 3 | ( function( $ ) { $.wikiEditor.modules.templateEditor = { |
4 | | - |
5 | 4 | /** |
| 5 | + * Compatability map |
| 6 | + */ |
| 7 | +'browsers': { |
| 8 | + // Left-to-right languages |
| 9 | + 'ltr': { |
| 10 | + 'msie': [['>=', 8]], |
| 11 | + 'firefox': [['>=', 3]], |
| 12 | + 'opera': [['>=', 10]], |
| 13 | + 'safari': [['>=', 4]] |
| 14 | + }, |
| 15 | + // Right-to-left languages |
| 16 | + 'rtl': { |
| 17 | + 'msie': [['>=', 8]], |
| 18 | + 'firefox': [['>=', 3]], |
| 19 | + 'opera': [['>=', 10]], |
| 20 | + 'safari': [['>=', 4]] |
| 21 | + } |
| 22 | +}, |
| 23 | +/** |
6 | 24 | * Event handlers |
7 | 25 | */ |
8 | 26 | evt: { |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html |
— | — | @@ -27,6 +27,9 @@ |
28 | 28 | white-space: -o-pre-wrap; /* Opera 7 */ |
29 | 29 | word-wrap: break-word; /* Internet Explorer 5.5+ */ |
30 | 30 | } |
| 31 | + body.pasting { |
| 32 | + white-space: normal; |
| 33 | + } |
31 | 34 | p { |
32 | 35 | margin: 0; |
33 | 36 | padding: 0; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -77,18 +77,21 @@ |
78 | 78 | * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more |
79 | 79 | * "open-web" way to go. |
80 | 80 | */ |
81 | | - 'isSupported': function() { |
| 81 | + 'isSupported': function( module ) { |
| 82 | + var map = module && typeof $.wikiEditor.modules[module].browsers ? |
| 83 | + $.wikiEditor.modules[module].browsers : |
| 84 | + $.wikiEditor.browsers; |
82 | 85 | // Check for and make use of a cached return value |
83 | 86 | if ( typeof $.wikiEditor.supported != 'undefined' ) { |
84 | 87 | return $.wikiEditor.supported; |
85 | 88 | } |
86 | 89 | // Check if we have any compatiblity information on-hand for the current browser |
87 | | - if ( !( $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
| 90 | + if ( !( $.browser.name in map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
88 | 91 | // Assume good faith :) |
89 | 92 | return $.wikiEditor.supported = true; |
90 | 93 | } |
91 | 94 | // Check over each browser condition to determine if we are running in a compatible client |
92 | | - var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
| 95 | + var browser = map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
93 | 96 | for ( var condition in browser ) { |
94 | 97 | var op = browser[condition][0]; |
95 | 98 | var val = browser[condition][1]; |
— | — | @@ -369,6 +372,7 @@ |
370 | 373 | }, |
371 | 374 | 'paste': function( event ) { |
372 | 375 | context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' ); |
| 376 | + context.$content.addClass( 'pasting' ); |
373 | 377 | setTimeout( function() { |
374 | 378 | var $selection = context.$content.find( ':not(.wikiEditor)' ); |
375 | 379 | while ( $selection.length && $selection.length > 0 ) { |
— | — | @@ -387,6 +391,10 @@ |
388 | 392 | } |
389 | 393 | $selection = context.$content.find( ':not(.wikiEditor)' ); |
390 | 394 | } |
| 395 | + context.$content.find( '.wikiEditor' ).removeClass( 'wikiEditor' ); |
| 396 | + // Remove newlines from everything |
| 397 | + context.$content.html( context.$content.html().replace( /\n/g, '' ) ); |
| 398 | + context.$content.removeClass( 'pasting' ); |
391 | 399 | }, 0 ); |
392 | 400 | return true; |
393 | 401 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6510,18 +6510,21 @@ |
6511 | 6511 | * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more |
6512 | 6512 | * "open-web" way to go. |
6513 | 6513 | */ |
6514 | | - 'isSupported': function() { |
| 6514 | + 'isSupported': function( module ) { |
| 6515 | + var map = module && typeof $.wikiEditor.modules[module].browsers ? |
| 6516 | + $.wikiEditor.modules[module].browsers : |
| 6517 | + $.wikiEditor.browsers; |
6515 | 6518 | // Check for and make use of a cached return value |
6516 | 6519 | if ( typeof $.wikiEditor.supported != 'undefined' ) { |
6517 | 6520 | return $.wikiEditor.supported; |
6518 | 6521 | } |
6519 | 6522 | // Check if we have any compatiblity information on-hand for the current browser |
6520 | | - if ( !( $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
| 6523 | + if ( !( $.browser.name in map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
6521 | 6524 | // Assume good faith :) |
6522 | 6525 | return $.wikiEditor.supported = true; |
6523 | 6526 | } |
6524 | 6527 | // Check over each browser condition to determine if we are running in a compatible client |
6525 | | - var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
| 6528 | + var browser = map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
6526 | 6529 | for ( var condition in browser ) { |
6527 | 6530 | var op = browser[condition][0]; |
6528 | 6531 | var val = browser[condition][1]; |
— | — | @@ -6802,6 +6805,7 @@ |
6803 | 6806 | }, |
6804 | 6807 | 'paste': function( event ) { |
6805 | 6808 | context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' ); |
| 6809 | + context.$content.addClass( 'pasting' ); |
6806 | 6810 | setTimeout( function() { |
6807 | 6811 | var $selection = context.$content.find( ':not(.wikiEditor)' ); |
6808 | 6812 | while ( $selection.length && $selection.length > 0 ) { |
— | — | @@ -6820,6 +6824,10 @@ |
6821 | 6825 | } |
6822 | 6826 | $selection = context.$content.find( ':not(.wikiEditor)' ); |
6823 | 6827 | } |
| 6828 | + context.$content.find( '.wikiEditor' ).removeClass( 'wikiEditor' ); |
| 6829 | + // Remove newlines from everything |
| 6830 | + context.$content.html( context.$content.html().replace( /\n/g, '' ) ); |
| 6831 | + context.$content.removeClass( 'pasting' ); |
6824 | 6832 | }, 0 ); |
6825 | 6833 | return true; |
6826 | 6834 | } |
— | — | @@ -8704,8 +8712,26 @@ |
8705 | 8713 | }; } )( jQuery ); |
8706 | 8714 | /* TemplateEditor module for wikiEditor */ |
8707 | 8715 | ( function( $ ) { $.wikiEditor.modules.templateEditor = { |
8708 | | - |
8709 | 8716 | /** |
| 8717 | + * Compatability map |
| 8718 | + */ |
| 8719 | +'browsers': { |
| 8720 | + // Left-to-right languages |
| 8721 | + 'ltr': { |
| 8722 | + 'msie': [['>=', 8]], |
| 8723 | + 'firefox': [['>=', 3]], |
| 8724 | + 'opera': [['>=', 10]], |
| 8725 | + 'safari': [['>=', 4]] |
| 8726 | + }, |
| 8727 | + // Right-to-left languages |
| 8728 | + 'rtl': { |
| 8729 | + 'msie': [['>=', 8]], |
| 8730 | + 'firefox': [['>=', 3]], |
| 8731 | + 'opera': [['>=', 10]], |
| 8732 | + 'safari': [['>=', 4]] |
| 8733 | + } |
| 8734 | +}, |
| 8735 | +/** |
8710 | 8736 | * Event handlers |
8711 | 8737 | */ |
8712 | 8738 | evt: { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -436,9 +436,9 @@ |
437 | 437 | options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;} |
438 | 438 | var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;} |
439 | 439 | retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();} |
440 | | -return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(){if(typeof $.wikiEditor.supported!='undefined'){return $.wikiEditor.supported;} |
441 | | -if(!($.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return $.wikiEditor.supported=true;} |
442 | | -var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}} |
| 440 | +return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){var map=module&&typeof $.wikiEditor.modules[module].browsers?$.wikiEditor.modules[module].browsers:$.wikiEditor.browsers;if(typeof $.wikiEditor.supported!='undefined'){return $.wikiEditor.supported;} |
| 441 | +if(!($.browser.name in map[$('body').is('.rtl')?'rtl':'ltr'])){return $.wikiEditor.supported=true;} |
| 442 | +var browser=map[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}} |
443 | 443 | return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
444 | 444 | if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;} |
445 | 445 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
— | — | @@ -455,9 +455,10 @@ |
456 | 456 | switch(event.which){case 8:break;} |
457 | 457 | return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';if(newHTML!==context.history[context.history.length+context.historyPosition].html){context.historyPosition=-1;} |
458 | 458 | context.history.push({'html':newHTML});while(context.history.length>10){context.history.shift();}} |
459 | | -return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');setTimeout(function(){var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();} |
| 459 | +return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');context.$content.addClass('pasting');setTimeout(function(){var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();} |
460 | 460 | if($currentElement.is('br')){$currentElement.addClass('wikiEditor');}else{$('<p></p>').text($currentElement.text()).addClass('wikiEditor').insertAfter($currentElement);$currentElement.remove();} |
461 | | -$selection=context.$content.find(':not(.wikiEditor)');}},0);return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
| 461 | +$selection=context.$content.find(':not(.wikiEditor)');} |
| 462 | +context.$content.find('.wikiEditor').removeClass('wikiEditor');context.$content.html(context.$content.html().replace(/\n/g,''));context.$content.removeClass('pasting');},0);return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
462 | 463 | if(typeof event.data=='undefined'){event.data={};} |
463 | 464 | if(name in context.evt){if(!context.evt[name](event)){return false;}} |
464 | 465 | for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}} |
— | — | @@ -609,7 +610,7 @@ |
610 | 611 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
611 | 612 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
612 | 613 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
613 | | -$('#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++;} |
| 614 | +$('#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={'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},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++;} |
614 | 615 | 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;}}} |
615 | 616 | if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},onSkip:function(){},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-template-text')&&$(ca1.parentNode.previousSibling).is('ul.wikiEditor-template-modes')&&ca1.parentNode.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;} |
616 | 617 | var model=new $.wikiEditor.modules.templateEditor.fn.model($(this).text());if(!model.isCollapsible()){return;} |