http://www.mediawiki.org/wiki/Special:Code/MediaWiki/61605
Revision: 61605 Author: catrope Date: 2010-01-27 20:54:04 +0000 (Wed, 27 Jan 2010) Log Message: ----------- wmf-deployment: UsabilityInitiative_alpha: Merge to trunk state Modified Paths: -------------- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/UsabilityInitiative.hooks.php branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.i18n.php branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.js branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.js branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.min.js Property Changed: ---------------- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.cookie.js branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.textSelection.js Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha ___________________________________________________________________ Added: svn:mergeinfo + /branches/REL1_15/phase3/extensions/UsabilityInitiative_alpha:51646 /trunk/extensions/UsabilityInitiative:61584-61604 /trunk/extensions/UsabilityInitiative_alpha:56207,56209,56296,56333,56355 /trunk/phase3/extensions/UsabilityInitiative_alpha:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816 Modified: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/UsabilityInitiative.hooks.php =================================================================== --- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/UsabilityInitiative.hooks.php 2010-01-27 20:48:56 UTC (rev 61604) +++ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/UsabilityInitiative.hooks.php 2010-01-27 20:54:04 UTC (rev 61605) @@ -72,7 +72,7 @@ array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 26 ), - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 76 ), + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 77 ), array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 25 ), array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ), array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ), @@ -82,10 +82,10 @@ array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), ), 'combined' => array( - array( 'src' => 'js/plugins.combined.js', 'version' => 188 ), + array( 'src' => 'js/plugins.combined.js', 'version' => 189 ), ), 'minified' => array( - array( 'src' => 'js/plugins.combined.min.js', 'version' => 188 ), + array( 'src' => 'js/plugins.combined.min.js', 'version' => 189 ), ), ), ); Modified: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.i18n.php =================================================================== --- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.i18n.php 2010-01-27 20:48:56 UTC (rev 61604) +++ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.i18n.php 2010-01-27 20:54:04 UTC (rev 61605) @@ -4154,6 +4154,7 @@ /** Basque (Euskara) * @author An13sa + * @author Inorbez * @author Kobazulo * @author Theklan */ @@ -4192,7 +4193,7 @@ 'wikieditor-toolbar-tool-file-example' => 'Adibidea.jpg', 'wikieditor-toolbar-tool-reference' => 'Erreferentzia', 'wikieditor-toolbar-tool-reference-example' => 'Txertatu testu oina hemen', - 'wikieditor-toolbar-tool-signature' => 'SInadura data eta orduarekin', + 'wikieditor-toolbar-tool-signature' => 'Sinadura data eta orduarekin', 'wikieditor-toolbar-section-advanced' => 'Aurreratua', 'wikieditor-toolbar-tool-heading' => 'Izenburua', 'wikieditor-toolbar-tool-heading-1' => '1. Maila', @@ -7993,9 +7994,10 @@ /** Cornish (Kernowek) * @author Kernoweger + * @author Kw-Moon */ $messages['kw'] = array( - 'wikieditor-toolbar-tool-link-cancel' => 'Hedhy', + 'wikieditor-toolbar-tool-link-cancel' => 'Hedhi', 'wikieditor-toolbar-help-page-discussion' => 'Dadhelva', ); Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.cookie.js ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:61584-61604 Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.textSelection.js ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:61584-61604 Modified: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.js =================================================================== --- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.js 2010-01-27 20:48:56 UTC (rev 61604) +++ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.js 2010-01-27 20:54:04 UTC (rev 61605) @@ -369,6 +369,8 @@ .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces .replace( /\<p[^\>]*\>/gi, "\n" ) // IE uses </p><p> for user-inserted line breaks .replace( /\<\/p[^\>]*\>/gi, "" ) + .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks + .replace( /\<\/div[^\>]*\>/gi, "" ) + '</pre>' ); // Get rid of the noincludes when getting text $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } ); @@ -920,7 +922,8 @@ context.$content = $( context.$iframe[0].contentWindow.document.body ); // If we just do "context.$content.text( context.$textarea.val() )", Internet Explorer will strip out the // whitespace charcters, specifically "\n" - so we must manually encode the text and append it - var html = context.$textarea.val().replace( /\</g, '<' ).replace( /\>/g, '>' ); + // TODO: Refactor this into a textToHtml() function + var html = context.$textarea.val(); // We must do some extra processing on IE to avoid dirty diffs, specifically IE will collapse leading spaces if ( $.browser.msie ) { // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm @@ -934,7 +937,14 @@ } html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' ); } - context.$content.html( html.replace( /\r?\n/g, '<br />' ) ); + // Use a dummy div to escape all entities + // This'll also escape <br>, <span> and , so we unescape those after + html = $( '<div />' ).text( html.replace( /\r?\n/g, '<br>' ) ).html() + .replace( /&nbsp;/g, ' ' ) + .replace( /<br>/g, '<br>' ) + .replace( /<span class="wikiEditor-tab"><\/span>/g, '<span class="wikiEditor-tab"></span>' ); + context.$content.html( html ); + // Reflect direction of parent frame into child if ( $( 'body' ).is( '.rtl' ) ) { context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' ); Modified: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.js =================================================================== --- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.js 2010-01-27 20:48:56 UTC (rev 61604) +++ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.js 2010-01-27 20:54:04 UTC (rev 61605) @@ -6793,6 +6793,8 @@ .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces .replace( /\<p[^\>]*\>/gi, "\n" ) // IE uses </p><p> for user-inserted line breaks .replace( /\<\/p[^\>]*\>/gi, "" ) + .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </p><p> for user-inserted line breaks + .replace( /\<\/div[^\>]*\>/gi, "" ) + '</pre>' ); // Get rid of the noincludes when getting text $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } ); @@ -7344,7 +7346,8 @@ context.$content = $( context.$iframe[0].contentWindow.document.body ); // If we just do "context.$content.text( context.$textarea.val() )", Internet Explorer will strip out the // whitespace charcters, specifically "\n" - so we must manually encode the text and append it - var html = context.$textarea.val().replace( /\</g, '<' ).replace( /\>/g, '>' ); + // TODO: Refactor this into a textToHtml() function + var html = context.$textarea.val(); // We must do some extra processing on IE to avoid dirty diffs, specifically IE will collapse leading spaces if ( $.browser.msie ) { // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm @@ -7358,7 +7361,14 @@ } html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' ); } - context.$content.html( html.replace( /\r?\n/g, '<br />' ) ); + // Use a dummy div to escape all entities + // This'll also escape <br>, <span> and , so we unescape those after + html = $( '<div />' ).text( html.replace( /\r?\n/g, '<br>' ) ).html() + .replace( /&nbsp;/g, ' ' ) + .replace( /<br>/g, '<br>' ) + .replace( /<span class="wikiEditor-tab"><\/span>/g, '<span class="wikiEditor-tab"></span>' ); + context.$content.html( html ); + // Reflect direction of parent frame into child if ( $( 'body' ).is( '.rtl' ) ) { context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' ); Modified: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.min.js =================================================================== --- branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.min.js 2010-01-27 20:48:56 UTC (rev 61604) +++ branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.min.js 2010-01-27 20:54:04 UTC (rev 61605) @@ -449,7 +449,7 @@ event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){var $pre=$('<pre>'+ -html.replace(/\r?\n/g,"").replace(/\<br[^\>]*\>/gi,"\n").replace(/ /g," ").replace(/\<p[^\>]*\>/gi,"\n").replace(/\<\/p[^\>]*\>/gi,"") +html.replace(/\r?\n/g,"").replace(/\<br[^\>]*\>/gi,"\n").replace(/ /g," ").replace(/\<p[^\>]*\>/gi,"\n").replace(/\<\/p[^\>]*\>/gi,"").replace(/\<div[^\>]*\>/gi,"\n").replace(/\<\/div[^\>]*\>/gi,"") +'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t")});return $pre.text();},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(retval.toString){retval=retval.toString();} return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';} @@ -494,9 +494,9 @@ var nextPos=t.node.nodeName=='#text'?pos+t.node.nodeValue.length:pos+1;var nextT=t.next();var leavingP=t.inP&&nextT&&!nextT.inP;context.offsets[pos]={'node':t.node,'offset':0,'length':nextPos-pos+(leavingP?1:0),'depth':t.depth,'lastTextNode':lastTextNode,'lastTextNodeDepth':lastTextNodeDepth};if(leavingP){context.offsets[nextPos]={'node':t.node,'offset':nextPos-pos,'length':nextPos-pos+1,'depth':t.depth,'lastTextNode':lastTextNode,'lastTextNodeDepth':lastTextNodeDepth};} pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;} t=nextT;}}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event)});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'src':wgScriptPath+'/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}} -context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/\</g,'<').replace(/\>/g,'>');if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g," ");}else{html=html.replace(/(^|\n) /g,"$1 ");} +context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val();if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g," ");}else{html=html.replace(/(^|\n) /g,"$1 ");} html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');} -context.$content.html(html.replace(/\r?\n/g,'<br />'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} +html=$('<div />').text(html.replace(/\r?\n/g,'<br>')).html().replace(/&nbsp;/g,' ').replace(/<br>/g,'<br>').replace(/<span class="wikiEditor-tab"><\/span>/g,'<span class="wikiEditor-tab"></span>');context.$content.html(html);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));return context.fallbackWindowOnBeforeUnload?context.fallbackWindowOnBeforeUnload():null;}} arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,typeof arguments[0]=='undefined'?{}:arguments[0]);}} return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,data){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs