r63409 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63408‎ | r63409 | r63410 >
Date:19:37, 8 March 2010
Author:tparscal
Status:ok
Tags:
Comment:
Made changes to how template capsules are rendered and interacted with. Switched to using the click handler for actual clicking while retaining a mousedown handler with return false to prevent dragging and such. Made lots of improvments to the quality of the image assets as well.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/collapse.png (modified) (history)
  • /trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/dialog-collapsed.png (modified) (history)
  • /trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/dialog-expanded.png (modified) (history)
  • /trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/expand.png (modified) (history)
  • /trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/name-bg.png (modified) (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.html (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -78,14 +78,14 @@
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 36 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 37 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 305 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 306 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 305 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 306 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/expand.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/collapse.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/dialog-collapsed.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/dialog-expanded.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/name-bg.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -158,28 +158,30 @@
159159 var $templateName = $( '<span />' )
160160 .addClass( 'wikiEditor-template-name wikiEditor-noinclude' )
161161 .text( model.getName() )
162 - .mousedown( toggleWikiTextEditor )
 162+ .click( function() { createDialog( $template ); return false; } )
 163+ .mousedown( function() { return false; } )
163164 .prependTo( $template );
164165
165166 var $templateExpand = $( '<span />' )
166167 .addClass( 'wikiEditor-template-expand wikiEditor-noinclude' )
167 - .mousedown( toggleWikiTextEditor )
 168+ .click( toggleWikiTextEditor )
 169+ .mousedown( function() { return false; } )
168170 .prependTo( $template );
169171
170172 var $templateDialog = $( '<span />' )
171173 .addClass( 'wikiEditor-template-dialog wikiEditor-noinclude' )
172 - .mousedown( function() { createDialog( $template ); return false; } )
 174+ .click( function() { createDialog( $template ); return false; } )
 175+ .mousedown( function() { return false; } )
173176 .insertAfter( $templateName );
174 -
 177+
175178 function toggleWikiTextEditor() {
176179 context.fn.purgeOffsets();
177 - var $template = $( this ).closest( '.wikiEditor-template' );
178 - $template
 180+ $(this)
 181+ .closest( '.wikiEditor-template' )
179182 .toggleClass( 'wikiEditor-template-expanded' )
180 - .toggleClass( 'wikiEditor-template-collapsed' );
181 -
182 - var $wikitext = $template.children( '.wikiEditor-template-text' );
183 - $wikitext.toggleClass( 'wikiEditor-nodisplay' );
 183+ .toggleClass( 'wikiEditor-template-collapsed' )
 184+ .find( '.wikiEditor-template-text' )
 185+ .toggleClass( 'wikiEditor-nodisplay' );
184186 return false;
185187 };
186188
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html
@@ -49,30 +49,39 @@
5050 margin: 0 2px;
5151 }
5252 .wikiEditor-template-name {
 53+ cursor: pointer;
 54+ display: inline-block;
 55+ height: 16px;
5356 background: url( '../../images/wikiEditor/templateEditor/name-bg.png' ) 0 0 repeat-x #e8e8e8;
54 - color:#333333;
55 - font-family: Helvetica, sans-serif;
 57+ color: #333333;
 58+ font-family: sans-serif;
 59+ text-decoration: none;
 60+ overflow: hidden;
 61+ line-height: 16px;
 62+ padding-left: 0.33em;
5663 font-size: 12px;
57 - padding-left:4px;
58 - padding-right: 9px;
59 - padding-top: 1px;
60 - display: inline;
61 - text-decoration:none;
62 - border:1px solid #d9d9d9;
63 - border-right: none;
64 - cursor: pointer;
6564 }
66 - .wikiEditor-template-expand{
 65+ .wikiEditor-template-expand {
6766 cursor: pointer;
 67+ display: inline-block;
 68+ height: 16px;
 69+ width: 13px;
 70+ background-position: 50%; /*FF3*/
 71+ /*
6872 padding-left: 6px;
6973 padding-right: 6px;
70 - background-position: 50%; /*FF3*/
 74+ */
7175 }
72 - .wikiEditor-template-dialog{
 76+ .wikiEditor-template-dialog {
7377 cursor: pointer;
 78+ display: inline-block;
 79+ height: 16px;
 80+ width: 22px;
 81+ background-position: 50%; /*FF3*/
 82+ /*
7483 padding-left: 11px;
7584 padding-right: 11px;
76 - background-position: 50%; /*FF3*/
 85+ */
7786 }
7887 .wikiEditor-template-expanded .wikiEditor-template-expand {
7988 background-image: url(../../images/wikiEditor/templateEditor/collapse.png);
@@ -115,11 +124,12 @@
116125 display: inline;
117126 }
118127 .wikiEditor-template .wikiEditor-template-text {
 128+ margin-top: -8px;
 129+ display: block;
119130 background: #f3f3f3;
120 - margin-top: -4px;
121 - border: solid 1px #d9d9d9;
122 - padding-left: 4px;
123 - display: block;
 131+ border-top: solid 1px #cccccc;
 132+ border-bottom: solid 1px #cccccc;
 133+ padding: 0.5em 4px;
124134 }
125135 .wikiEditor-template-end, .wikiEditor-template-start {
126136 color: blue;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -9260,28 +9260,30 @@
92619261 var $templateName = $( '<span />' )
92629262 .addClass( 'wikiEditor-template-name wikiEditor-noinclude' )
92639263 .text( model.getName() )
9264 - .mousedown( toggleWikiTextEditor )
 9264+ .click( function() { createDialog( $template ); return false; } )
 9265+ .mousedown( function() { return false; } )
92659266 .prependTo( $template );
92669267
92679268 var $templateExpand = $( '<span />' )
92689269 .addClass( 'wikiEditor-template-expand wikiEditor-noinclude' )
9269 - .mousedown( toggleWikiTextEditor )
 9270+ .click( toggleWikiTextEditor )
 9271+ .mousedown( function() { return false; } )
92709272 .prependTo( $template );
92719273
92729274 var $templateDialog = $( '<span />' )
92739275 .addClass( 'wikiEditor-template-dialog wikiEditor-noinclude' )
9274 - .mousedown( function() { createDialog( $template ); return false; } )
 9276+ .click( function() { createDialog( $template ); return false; } )
 9277+ .mousedown( function() { return false; } )
92759278 .insertAfter( $templateName );
9276 -
 9279+
92779280 function toggleWikiTextEditor() {
92789281 context.fn.purgeOffsets();
9279 - var $template = $( this ).closest( '.wikiEditor-template' );
9280 - $template
 9282+ $(this)
 9283+ .closest( '.wikiEditor-template' )
92819284 .toggleClass( 'wikiEditor-template-expanded' )
9282 - .toggleClass( 'wikiEditor-template-collapsed' );
9283 -
9284 - var $wikitext = $template.children( '.wikiEditor-template-text' );
9285 - $wikitext.toggleClass( 'wikiEditor-nodisplay' );
 9285+ .toggleClass( 'wikiEditor-template-collapsed' )
 9286+ .find( '.wikiEditor-template-text' )
 9287+ .toggleClass( 'wikiEditor-nodisplay' );
92869288 return false;
92879289 };
92889290
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -640,7 +640,7 @@
641641 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;}}}
642642 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));}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;}
643643 var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if($(node).parent().hasClass('wikiEditor-template')){var $name=$(node).parent().children('.wikiEditor-template-name');if($name.text()!=model.getName()){$name.text(model.getName());}}
644 -if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context});}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={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed');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').mousedown(toggleWikiTextEditor).prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').mousedown(function(){createDialog($template);return false;}).insertAfter($templateName);function toggleWikiTextEditor(){context.fn.purgeOffsets();var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $wikitext=$template.children('.wikiEditor-template-text');$wikitext.toggleClass('wikiEditor-nodisplay');return false;};var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\
 644+if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context});}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={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed');var $templateName=$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).click(function(){createDialog($template);return false;}).mousedown(function(){return false;}).prependTo($template);var $templateExpand=$('<span />').addClass('wikiEditor-template-expand wikiEditor-noinclude').click(toggleWikiTextEditor).mousedown(function(){return false;}).prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').click(function(){createDialog($template);return false;}).mousedown(function(){return false;}).insertAfter($templateName);function toggleWikiTextEditor(){context.fn.purgeOffsets();$(this).closest('.wikiEditor-template').toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed').find('.wikiEditor-template-text').toggleClass('wikiEditor-nodisplay');return false;};var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\
645645 <fieldset>\
646646 <div class="wikiEditor-template-dialog-title" />\
647647 <div class="wikiEditor-template-dialog-fields" />\

Status & tagging log