r60702 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60701‎ | r60702 | r60703 >
Date:23:12, 5 January 2010
Author:tparscal
Status:resolved (Comments)
Tags:
Comment:
Moved styles for iframe from external styles into the HTML file we use for the iframe.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.highlight.css (deleted) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -73,7 +73,7 @@
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 42 ),
77 - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 11 ),
 77+ array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 12 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 40 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 55 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 132 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 133 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 132 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 133 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.highlight.css
@@ -1,38 +0,0 @@
2 -/* CSS for highlight module. Note that this CSS is loaded in the iframe,
3 - * not in the main document. For that reason, it's also not in the combined and
4 - * minified files.
5 - *
6 - * When you edit this please update the style version in js/plugins/jquery.wikiEditor.highlight.js
7 - */
8 -
9 -/* Wikitext that's folded away and shouldn't be displayed */
10 -.wikiEditor-nodisplay {
11 - display: none;
12 -}
13 -
14 -/* A collapsed template */
15 -.wikiEditor-template-collapsed {
16 - background-color:#DDEEFF;
17 - border:1px outset #DDEEFF;
18 - color:#333333;
19 - cursor:pointer;
20 - display:inline;
21 - padding:0 0.25em;
22 - text-decoration:none;
23 -}
24 -
25 -/* An expanded template */
26 -.wikiEditor-template-expanded {
27 - background:#DDEEFF none repeat scroll 0 0;
28 - border:1px inset #DDEEFF;
29 - color:black;
30 - cursor:pointer;
31 - display:inline;
32 - padding:0 0.25em;
33 -}
34 -
35 -/* == Header == */
36 -.wikiEditor-toc-header { /* TODO: move parsing to highlight module and rename this */
37 - display: inline;
38 - font-weight: bold;
39 -}
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html
@@ -3,6 +3,46 @@
44 <head>
55 <title>WikiEditor</title>
66 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 7+ <style>
 8+ /* CSS for highlight module. Note that this CSS is loaded in the iframe,
 9+ * not in the main document. For that reason, it's also not in the combined and
 10+ * minified files.
 11+ *
 12+ * When you edit this please update the style version in js/plugins/jquery.wikiEditor.highlight.js
 13+ */
 14+
 15+ /* Wikitext that's folded away and shouldn't be displayed */
 16+ .wikiEditor-nodisplay {
 17+ display: none;
 18+ }
 19+
 20+ /* A collapsed template */
 21+ .wikiEditor-template-collapsed {
 22+ background-color:#DDEEFF;
 23+ border:1px outset #DDEEFF;
 24+ color:#333333;
 25+ cursor:pointer;
 26+ display:inline;
 27+ padding:0 0.25em;
 28+ text-decoration:none;
 29+ }
 30+
 31+ /* An expanded template */
 32+ .wikiEditor-template-expanded {
 33+ background:#DDEEFF none repeat scroll 0 0;
 34+ border:1px inset #DDEEFF;
 35+ color:black;
 36+ cursor:pointer;
 37+ display:inline;
 38+ padding:0 0.25em;
 39+ }
 40+
 41+ /* == Header == */
 42+ .wikiEditor-toc-header { /* TODO: move parsing to highlight module and rename this */
 43+ display: inline;
 44+ font-weight: bold;
 45+ }
 46+ </style>
747 <script type="text/javascript">
848 parent.inherit( window )( function() {
949 function get( name ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js
@@ -40,6 +40,7 @@
4141 }
4242 },
4343 ready: function( context, event ) {
 44+ /*
4445 // Add our CSS to the iframe
4546 // Style version for wikiEditor.highlight.css is here
4647 // FIXME: That's not ideal
@@ -49,6 +50,7 @@
5051 'href': wgScriptPath + '/extensions/UsabilityInitiative/css/wikiEditor.highlight.css?' +
5152 $.wikiEditor.modules.highlight.cfg.styleVersion,
5253 } ) );
 54+ */
5355 // Highlight stuff for the first time
5456 $.wikiEditor.modules.highlight.fn.scan( context, "" );
5557 $.wikiEditor.modules.highlight.fn.mark( context, "", "" );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2216,6 +2216,7 @@
22172217 }
22182218 },
22192219 ready: function( context, event ) {
 2220+ /*
22202221 // Add our CSS to the iframe
22212222 // Style version for wikiEditor.highlight.css is here
22222223 // FIXME: That's not ideal
@@ -2225,6 +2226,7 @@
22262227 'href': wgScriptPath + '/extensions/UsabilityInitiative/css/wikiEditor.highlight.css?' +
22272228 $.wikiEditor.modules.highlight.cfg.styleVersion,
22282229 } ) );
 2230+ */
22292231 // Highlight stuff for the first time
22302232 $.wikiEditor.modules.highlight.fn.scan( context, "" );
22312233 $.wikiEditor.modules.highlight.fn.mark( context, "", "" );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -126,8 +126,7 @@
127127 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);});}
128128 var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
129129 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);}
130 -$(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){context.$content.parent().find('head').append($j('<link />').attr({'rel':'stylesheet','type':'text/css','href':wgScriptPath+'/extensions/UsabilityInitiative/css/wikiEditor.highlight.css?'+
131 -$.wikiEditor.modules.highlight.cfg.styleVersion,}));$.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;}
 130+$(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){$.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;}
132131 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;}
133132 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;}
134133 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);}}}}

Comments

#Comment by Catrope (talk | contribs)   11:52, 6 January 2010
+		 * When you edit this please update the style version in js/plugins/jquery.wikiEditor.highlight.js

No need for that anymore, because the iframe HTML and CSS is not cached at all due to the &ts= parameter we're passing.

+		/*
 		// Add our CSS to the iframe
 		// Style version for wikiEditor.highlight.css is here
 		// FIXME: That's not ideal
@@ -49,6 +50,7 @@
 			'href': wgScriptPath + '/extensions/UsabilityInitiative/css/wikiEditor.highlight.css?' +
 				$.wikiEditor.modules.highlight.cfg.styleVersion,
 		} ) );
+		*/

Also means this can be removed.

#Comment by Tim Starling (talk | contribs)   06:02, 20 January 2010

Marking fixme due to unanswered comment above.

#Comment by Catrope (talk | contribs)   07:49, 20 January 2010

Both were resolved in the meantime; don't know the exact revs.

Status & tagging log