Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | } ); |
79 | 79 | } );/* JavaScript for EditWarning extension */ |
80 | 80 | |
81 | | -js2AddOnloadHook( function() { |
| 81 | +mw.addOnloadHook( function() { |
82 | 82 | // Check preferences for editwarning |
83 | 83 | if ( !wgVectorPreferences || !( wgVectorPreferences.editwarning && wgVectorPreferences.editwarning.enable ) ) { |
84 | 84 | return true; |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | os_autoload_forms = []; |
129 | 129 | } |
130 | 130 | |
131 | | -js2AddOnloadHook( function() { |
| 131 | +mw.addOnloadHook( function() { |
132 | 132 | // Only use this function in conjuction with the Vector skin |
133 | 133 | if( skin != 'vector' ) { |
134 | 134 | return; |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,10 +1,10 @@ |
2 | 2 | |
3 | 3 | mw.addOnloadHook(function(){var rtl=$j('body').is('.rtl')?true:false;$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=true;var data=$moving.data('collapsibleTabsSettings');var target=$moving.data('collapsibleTabsSettings').collapsedContainer;$moving.css("position","relative").css((rtl?'left':'right'),0).animate({width:'1px'},"normal",function(){$j(this).hide();$j('<span class="placeholder" style="display:none;"></span>').insertAfter(this);$j(this).remove().prependTo(target).data('collapsibleTabsSettings',data);$j(this).attr('style','display:list-item;');$j($j(ele).data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=true;var data=$moving.data('collapsibleTabsSettings');var $target=$j($moving.data('collapsibleTabsSettings').expandedContainer).find('span.placeholder:first');var expandedWidth=$moving.data('collapsibleTabsSettings').expandedWidth;$moving.css("position","relative").css((rtl?'right':'left'),0).css('width','1px');$target.replaceWith($moving.remove().css('width','1px').data('collapsibleTabsSettings',data).animate({width:expandedWidth+"px"},"normal",function(){$j(this).attr('style','display:block;');$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none') |
4 | 4 | $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet").find('h5').css('width','1px').animate({'width':'26px'},390);}).bind("beforeTabExpand",function(){if($j('#p-cactions li').length==1) |
5 | | -$j("#p-cactions h5").animate({'width':'1px'},370,function(){$j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");});}).collapsibleTabs({expandCondition:function(eleWidth){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width()+1)<($j('#left-navigation').position().left-eleWidth);}else{return($j('#left-navigation').position().left+$j('#left-navigation').width()+1)<($j('#right-navigation').position().left-eleWidth);}},collapseCondition:function(){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width())>$j('#left-navigation').position().left;}else{return($j('#left-navigation').position().left+$j('#left-navigation').width())>$j('#right-navigation').position().left;}}});});js2AddOnloadHook(function(){if(!wgVectorPreferences||!(wgVectorPreferences.editwarning&&wgVectorPreferences.editwarning.enable)){return true;} |
| 5 | +$j("#p-cactions h5").animate({'width':'1px'},370,function(){$j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");});}).collapsibleTabs({expandCondition:function(eleWidth){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width()+1)<($j('#left-navigation').position().left-eleWidth);}else{return($j('#left-navigation').position().left+$j('#left-navigation').width()+1)<($j('#right-navigation').position().left-eleWidth);}},collapseCondition:function(){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width())>$j('#left-navigation').position().left;}else{return($j('#left-navigation').position().left+$j('#left-navigation').width())>$j('#right-navigation').position().left;}}});});mw.addOnloadHook(function(){if(!wgVectorPreferences||!(wgVectorPreferences.editwarning&&wgVectorPreferences.editwarning.enable)){return true;} |
6 | 6 | $j('#wpTextbox1, #wpSummary').each(function(){$j(this).data('origtext',$j(this).val());});fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){var fallbackResult=null;if(fallbackWindowOnBeforeUnload){fallbackResult=fallbackWindowOnBeforeUnload();} |
7 | 7 | if(fallbackResult!==null){return fallbackResult;} |
8 | 8 | if(wgAction=='submit'||$j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()){return gM('vector-editwarning-warning');}} |
9 | 9 | $j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;if(typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];} |
10 | | -js2AddOnloadHook(function(){if(skin!='vector'){return;} |
| 10 | +mw.addOnloadHook(function(){if(skin!='vector'){return;} |
11 | 11 | $j('div#simpleSearch > input#searchInput').each(function(){$j('<label></label>').text(gM('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').show();}}).focus(function(){$j(this).parent().find('label').hide();}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').show();}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){var perfectMatch=false;$j(this).closest('.suggestions').find('.suggestions-results div').each(function(){if($j(this).data('text')==query){perfectMatch=true;}});if(perfectMatch){if($j(this).children().size()==0){$j(this).show();$label=$j('<div />').addClass('special-label').text(gM('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipse();}else{$j(this).find('.special-query').empty().text(query).autoEllipse();}}else{$j(this).hide();$j(this).empty();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});}); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -70,19 +70,19 @@ |
71 | 71 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
72 | 72 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ), |
74 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 26 ), |
| 74 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 27 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 34 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
78 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 45 ), |
| 78 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 46 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 4 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ), |
81 | 81 | ), |
82 | 82 | 'combined' => array( |
83 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 95 ), |
| 83 | + array( 'src' => 'js/plugins.combined.js', 'version' => 96 ), |
84 | 84 | ), |
85 | 85 | 'minified' => array( |
86 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 95 ), |
| 86 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 96 ), |
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -325,12 +325,12 @@ |
326 | 326 | var p = this; |
327 | 327 | while( !p.previousSibling ) |
328 | 328 | p = p.parentNode; |
329 | | - var prev = p.previousSibling; |
| 329 | + var prev = p ? p.previousSibling : null; |
330 | 330 | |
331 | 331 | p = this; |
332 | 332 | while ( p && !p.nextSibling ) |
333 | 333 | p = p.parentNode; |
334 | | - var next = p.nextSibling; |
| 334 | + var next = p ? p.nextSibling : null; |
335 | 335 | |
336 | 336 | // Edge case: there are more equals signs, |
337 | 337 | // but they're not all in the <div>. Eat them. |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -275,6 +275,7 @@ |
276 | 276 | options.init( context ); |
277 | 277 | } |
278 | 278 | event.preventDefault(); |
| 279 | + return false; |
279 | 280 | } ) |
280 | 281 | .text( $.wikiEditor.autoMsg( options, 'title' ) ) |
281 | 282 | ) |
— | — | @@ -334,6 +335,7 @@ |
335 | 336 | 'getContents': function() { |
336 | 337 | // We use .html() instead of .text() so HTML entities are handled right |
337 | 338 | // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead |
| 339 | + |
338 | 340 | return $( '<div />' ) |
339 | 341 | .html( context.$content.html().replace( /\<br\>/g, "\n" ) ) |
340 | 342 | .text(); |
— | — | @@ -350,8 +352,8 @@ |
351 | 353 | var retval; |
352 | 354 | if ( context.$iframe[0].contentWindow.getSelection ) { |
353 | 355 | retval = context.$iframe[0].contentWindow.getSelection(); |
354 | | - } else if ( context.$iframe[0].contentWindow.selection ) { // should come last; Opera! |
355 | | - retval = context.$iframe[0].contentWindow.selection.createRange(); |
| 356 | + } else if ( context.$iframe[0].contentWindow.document.selection ) { // should come last; Opera! |
| 357 | + retval = context.$iframe[0].contentWindow.document.selection.createRange(); |
356 | 358 | } |
357 | 359 | if ( retval.text ) { |
358 | 360 | retval = retval.text; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1585,6 +1585,7 @@ |
1586 | 1586 | options.init( context ); |
1587 | 1587 | } |
1588 | 1588 | event.preventDefault(); |
| 1589 | + return false; |
1589 | 1590 | } ) |
1590 | 1591 | .text( $.wikiEditor.autoMsg( options, 'title' ) ) |
1591 | 1592 | ) |
— | — | @@ -1644,6 +1645,7 @@ |
1645 | 1646 | 'getContents': function() { |
1646 | 1647 | // We use .html() instead of .text() so HTML entities are handled right |
1647 | 1648 | // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead |
| 1649 | + |
1648 | 1650 | return $( '<div />' ) |
1649 | 1651 | .html( context.$content.html().replace( /\<br\>/g, "\n" ) ) |
1650 | 1652 | .text(); |
— | — | @@ -1660,8 +1662,8 @@ |
1661 | 1663 | var retval; |
1662 | 1664 | if ( context.$iframe[0].contentWindow.getSelection ) { |
1663 | 1665 | retval = context.$iframe[0].contentWindow.getSelection(); |
1664 | | - } else if ( context.$iframe[0].contentWindow.selection ) { // should come last; Opera! |
1665 | | - retval = context.$iframe[0].contentWindow.selection.createRange(); |
| 1666 | + } else if ( context.$iframe[0].contentWindow.document.selection ) { // should come last; Opera! |
| 1667 | + retval = context.$iframe[0].contentWindow.document.selection.createRange(); |
1666 | 1668 | } |
1667 | 1669 | if ( retval.text ) { |
1668 | 1670 | retval = retval.text; |
— | — | @@ -2661,12 +2663,12 @@ |
2662 | 2664 | var p = this; |
2663 | 2665 | while( !p.previousSibling ) |
2664 | 2666 | p = p.parentNode; |
2665 | | - var prev = p.previousSibling; |
| 2667 | + var prev = p ? p.previousSibling : null; |
2666 | 2668 | |
2667 | 2669 | p = this; |
2668 | 2670 | while ( p && !p.nextSibling ) |
2669 | 2671 | p = p.parentNode; |
2670 | | - var next = p.nextSibling; |
| 2672 | + var next = p ? p.nextSibling : null; |
2671 | 2673 | |
2672 | 2674 | // Edge case: there are more equals signs, |
2673 | 2675 | // but they're not all in the <div>. Eat them. |
— | — | @@ -2940,7 +2942,7 @@ |
2941 | 2943 | fn : { |
2942 | 2944 | /** |
2943 | 2945 | * Creates a toolbar module within a wikiEditor |
2944 | | - * |
| 2946 | + * |
2945 | 2947 | * @param {Object} context Context object of editor to create module in |
2946 | 2948 | * @param {Object} config Configuration object to create module from |
2947 | 2949 | */ |
— | — | @@ -2956,7 +2958,7 @@ |
2957 | 2959 | }, |
2958 | 2960 | /** |
2959 | 2961 | * Performs an operation based on parameters |
2960 | | - * |
| 2962 | + * |
2961 | 2963 | * @param {Object} context |
2962 | 2964 | * @param {Object} action |
2963 | 2965 | * @param {Object} source |
— | — | @@ -2995,15 +2997,12 @@ |
2996 | 2998 | parts[part] = ( action.options[part] || '' ) |
2997 | 2999 | } |
2998 | 3000 | } |
2999 | | - if ( 'periRegex' in action.options && 'periRegexReplace' in action.options ) { |
3000 | | -<<<<<<< .mine |
3001 | | - var selection = context.$textarea.textSelection(); |
3002 | | -======= |
| 3001 | + if ( 'regex' in action.options && 'regexReplace' in action.options ) { |
3003 | 3002 | var selection = context.$textarea.textSelection( 'getSelection' ); |
3004 | | ->>>>>>> .r58906 |
3005 | | - if ( selection != '' ) { |
3006 | | - parts.peri = selection.replace( action.options.periRegex, |
3007 | | - action.options.periRegexReplace ); |
| 3003 | + if ( selection != '' && selection.match( action.options.regex ) ) { |
| 3004 | + parts.peri = selection.replace( action.options.regex, |
| 3005 | + action.options.regexReplace ); |
| 3006 | + parts.pre = parts.post = ''; |
3008 | 3007 | } |
3009 | 3008 | } |
3010 | 3009 | context.$textarea.textSelection( 'encapsulateSelection', $.extend( action.options, |
— | — | @@ -3026,12 +3025,18 @@ |
3027 | 3026 | if ( label ) { |
3028 | 3027 | $group.append( '<div class="label">' + label + '</div>' ) |
3029 | 3028 | } |
| 3029 | + |
| 3030 | + var empty = true; |
3030 | 3031 | if ( 'tools' in group ) { |
3031 | 3032 | for ( tool in group.tools ) { |
3032 | | - $group.append( $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ) ); |
| 3033 | + var tool = $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ); |
| 3034 | + if ( tool ) { |
| 3035 | + empty = false; |
| 3036 | + $group.append( tool ); |
| 3037 | + } |
3033 | 3038 | } |
3034 | 3039 | } |
3035 | | - return $group; |
| 3040 | + return empty ? null : $group; |
3036 | 3041 | }, |
3037 | 3042 | buildTool : function( context, id, tool ) { |
3038 | 3043 | if ( 'filters' in tool ) { |
— | — | @@ -3044,10 +3049,7 @@ |
3045 | 3050 | var label = $.wikiEditor.autoMsg( tool, 'label' ); |
3046 | 3051 | switch ( tool.type ) { |
3047 | 3052 | case 'button': |
3048 | | - var src = tool.icon; |
3049 | | - if ( src.indexOf( 'http://' ) !== 0 && src.indexOf( 'https://' ) !== 0 ) { |
3050 | | - src = $.wikiEditor.imgPath + 'toolbar/' + src; |
3051 | | - } |
| 3053 | + var src = $.wikiEditor.getIcon( tool.icon, $.wikiEditor.imgPath + 'toolbar/' ); |
3052 | 3054 | $button = $( '<img />' ).attr( { |
3053 | 3055 | 'src' : src, |
3054 | 3056 | 'width' : 22, |
— | — | @@ -3235,31 +3237,35 @@ |
3236 | 3238 | .bind( 'mouseup', function( e ) { |
3237 | 3239 | $(this).blur(); |
3238 | 3240 | } ) |
3239 | | - .bind( 'mousedown', function( e ) { |
3240 | | - // Only act when the primary mouse button was pressed |
3241 | | - if ( e.button !== 0 ) { |
3242 | | - return true; |
3243 | | - } |
| 3241 | + .bind( 'click', function( e ) { |
3244 | 3242 | var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
3245 | 3243 | var $section = |
3246 | 3244 | $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
3247 | 3245 | var show = $section.css( 'display' ) == 'none'; |
3248 | 3246 | $previousSections = $section.parent().find( '.section:visible' ); |
| 3247 | + var dH = $previousSections.outerHeight(); |
3249 | 3248 | $previousSections.css( 'position', 'absolute' ); |
3250 | 3249 | $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
3251 | 3250 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
3252 | 3251 | $sections.css('overflow', 'hidden'); |
3253 | 3252 | if ( show ) { |
3254 | 3253 | $section.fadeIn( 'fast' ); |
3255 | | - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
3256 | | - $(this).css('overflow', 'visible').css('height', 'auto'); |
| 3254 | + dH = $section.outerHeight() - dH; |
| 3255 | + if ( context.modules.$toc ) { |
| 3256 | + context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2); |
| 3257 | + } |
| 3258 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
| 3259 | + $(this).css('overflow', 'visible').css('height', 'auto'); |
3257 | 3260 | } ); |
3258 | 3261 | $(this).addClass( 'current' ); |
3259 | 3262 | } else { |
3260 | 3263 | $sections.css('height', $section.outerHeight() ) |
3261 | | - .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
3262 | | - $(this).css('overflow', 'visible'); |
| 3264 | + .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
| 3265 | + $(this).css('overflow', 'visible'); |
3263 | 3266 | } ); |
| 3267 | + if ( context.modules.$toc ) { |
| 3268 | + context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2); |
| 3269 | + } |
3264 | 3270 | } |
3265 | 3271 | // Click tracking |
3266 | 3272 | if($.trackAction != undefined){ |
— | — | @@ -3270,8 +3276,8 @@ |
3271 | 3277 | 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
3272 | 3278 | show ? $section.attr( 'rel' ) : null |
3273 | 3279 | ); |
| 3280 | + return false; |
3274 | 3281 | } ) |
3275 | | - .click( function() { return false; } ) |
3276 | 3282 | ); |
3277 | 3283 | }, |
3278 | 3284 | buildSection : function( context, id, section ) { |
— | — | @@ -3329,29 +3335,6 @@ |
3330 | 3336 | }, |
3331 | 3337 | build : function( context, config ) { |
3332 | 3338 | var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.$toolbar ); |
3333 | | - if( wgNavigableTOCCollapseEnable ) { |
3334 | | - // placeholder for drag control creation code |
3335 | | - $dragControl = $( '<div />' ).addClass( 'tab' ).attr( 'id', 'wikiEditor-ui-toc-resize-grip' ) |
3336 | | - .append( '<a href="#" title="Drag to resize"></a>' ) |
3337 | | - .bind( 'mousedown', function() { |
3338 | | - $( '#wikiEditor-ui-toc' ) |
3339 | | - .data( 'openWidth', $( '#wikiEditor-ui-toc' ).width() ); |
3340 | | - $() |
3341 | | - .bind( 'mousemove', {'context': context}, $.wikiEditor.modules.toc.fn.drag ) |
3342 | | - .bind( 'mouseup', {'context': context}, $.wikiEditor.modules.toc.fn.stopDrag ); |
3343 | | - $(context.$iframe[0].contentWindow.document) |
3344 | | - .bind( 'mousemove', {'context': context}, function( e ){ |
3345 | | - parent.top.$j().trigger("mousemove", e.pageX); |
3346 | | - return false; |
3347 | | - } ) |
3348 | | - .bind( 'mouseup', {'context': context}, function( e ){ |
3349 | | - parent.top.$j().trigger("mouseup"); |
3350 | | - return false; |
3351 | | - }); |
3352 | | - return false; |
3353 | | - }); |
3354 | | - context.modules.$toolbar.append( $dragControl ); |
3355 | | - } |
3356 | 3339 | var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar ); |
3357 | 3340 | context.modules.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) ); |
3358 | 3341 | var sectionQueue = []; |
— | — | @@ -3373,8 +3356,7 @@ |
3374 | 3357 | $.eachAsync( sectionQueue, { |
3375 | 3358 | 'bulk' : 0, |
3376 | 3359 | 'end' : function() { |
3377 | | - // HACK: Opera doesn't seem to want to redraw after |
3378 | | - // these bits |
| 3360 | + // HACK: Opera doesn't seem to want to redraw after these bits |
3379 | 3361 | // are added to the DOM, so we can just FORCE it! |
3380 | 3362 | $( 'body' ).css( 'position', 'static' ); |
3381 | 3363 | $( 'body' ).css( 'position', 'relative' ); |
— | — | @@ -3383,7 +3365,14 @@ |
3384 | 3366 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
3385 | 3367 | var $section = s.$sections.find( '.section:visible' ); |
3386 | 3368 | if ( $section.size() ) { |
3387 | | - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
| 3369 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) { |
| 3370 | + if ( context.modules.$toc ) { |
| 3371 | + context.modules.$toc.height( |
| 3372 | + context.$ui.find( '.wikiEditor-ui-left' ) |
| 3373 | + .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight() |
| 3374 | + ) |
| 3375 | + } |
| 3376 | + } ); |
3388 | 3377 | } |
3389 | 3378 | } |
3390 | 3379 | } ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | context.evt={'change':function(event){switch(event.type){case'keypress':if(false){}else{} |
95 | 95 | break;case'mousedown':if(false){}else{} |
96 | 96 | break;default:break;}}};context.fn={'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
97 | | -event.preventDefault();}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
| 97 | +event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
98 | 98 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
99 | 99 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){var contentHTML=$('<div />').text(context.$textarea.val()).html();context.$iframe[0].contentWindow.document.open();context.$iframe[0].contentWindow.document.write('<html><head><title>wikiEditor</title><script>var context = window.parent.jQuery.wikiEditor.instances['+context.instance+'].data( "wikiEditor-context" ); window.parent.jQuery( document ).bind( "keydown keypress keyup mousedown mouseup cut paste", { "context": context }, context.evt.change );</script></head><body style="margin:0;padding:0;width:100%;height:100%;white-space:pre-wrap;font-family:monospace">'+contentHTML+'</body></html>');context.$iframe[0].contentWindow.document.close();context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
100 | | -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'textSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.selection){retval=context.$iframe[0].contentWindow.selection.createRange();} |
| 100 | +context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'textSelection':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();} |
101 | 101 | if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();} |
102 | 102 | return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');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+=' ';} |
103 | 103 | var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0) |
— | — | @@ -164,8 +164,8 @@ |
165 | 165 | initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}} |
166 | 166 | var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;} |
167 | 167 | var text=this.nodeValue;var p=this;while(!p.previousSibling) |
168 | | -p=p.parentNode;var prev=p.previousSibling;p=this;while(p&&!p.nextSibling) |
169 | | -p=p.parentNode;var next=p.nextSibling;if(prev&&prev.nodeName=='#text'){var prevText=prev.nodeValue;while(prevText.substr(-1)=='='){prevText=prevText.substr(0,prevText.length-1);text='='+text;} |
| 168 | +p=p.parentNode;var prev=p?p.previousSibling:null;p=this;while(p&&!p.nextSibling) |
| 169 | +p=p.parentNode;var next=p?p.nextSibling:null;if(prev&&prev.nodeName=='#text'){var prevText=prev.nodeValue;while(prevText.substr(-1)=='='){prevText=prevText.substr(0,prevText.length-1);text='='+text;} |
170 | 170 | prev.nodeValue=prevText;} |
171 | 171 | var next=this.nextSibling;if(next&&next.nodeName=='#text'){var nextText=next.nodeValue;while(nextText.substr(0,1)=='='){nextText=nextText.substr(1);text=text+'=';} |
172 | 172 | next.nodeValue=nextText;} |
— | — | @@ -201,15 +201,12 @@ |
202 | 202 | step=step.parent();} |
203 | 203 | rels.reverse();var id=rels.join('.');$.trackAction(id);} |
204 | 204 | switch(action.type){case'replace':case'encapsulate':var parts={'pre':'','peri':'','post':''};for(part in parts){if(part+'Msg'in action.options){parts[part]=gM(action.options[part+'Msg'],(action.options[part]||null));}else{parts[part]=(action.options[part]||'')}} |
205 | | -if('periRegex'in action.options&&'periRegexReplace'in action.options){<<<<<<<.mine |
206 | | -var selection=context.$textarea.textSelection();=======var selection=context.$textarea.textSelection('getSelection');>>>>>>>.r58906 |
207 | | -if(selection!=''){parts.peri=selection.replace(action.options.periRegex,action.options.periRegexReplace);}} |
| 205 | +if('regex'in action.options&&'regexReplace'in action.options){var selection=context.$textarea.textSelection('getSelection');if(selection!=''&&selection.match(action.options.regex)){parts.peri=selection.replace(action.options.regex,action.options.regexReplace);parts.pre=parts.post='';}} |
208 | 206 | context.$textarea.textSelection('encapsulateSelection',$.extend(action.options,parts,{'replace':action.type=='replace'}));break;case'callback':if(typeof action.execute=='function'){action.execute(context);} |
209 | 207 | break;case'dialog':context.$textarea.wikiEditor('openDialog',action.module);break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div />').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.autoMsg(group,'label');if(label){$group.append('<div class="label">'+label+'</div>')} |
210 | | -if('tools'in group){for(tool in group.tools){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]));}} |
211 | | -return $group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}} |
212 | | -var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.imgPath+'toolbar/'+src;} |
213 | | -$button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});} |
| 208 | +var empty=true;if('tools'in group){for(tool in group.tools){var tool=$.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]);if(tool){empty=false;$group.append(tool);}}} |
| 209 | +return empty?null:$group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}} |
| 210 | +var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=$.wikiEditor.getIcon(tool.icon,$.wikiEditor.imgPath+'toolbar/');$button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});} |
214 | 211 | return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'}).click(function(){var $options=$(this).find('.options');$options.animate({'opacity':'toggle'},'fast');});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));}).text(optionLabel).addClass('option').attr('rel',option));}} |
215 | 212 | $select.append($('<div />').addClass('menu').append($options));$select.append($('<div />').addClass('label').text(label));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).bind('mousedown',function(){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));} |
216 | 213 | $.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));});},buildPage:function(context,id,page){var $page=$('<div />').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var html='<table cellpadding=0 cellspacing=0 '+'border=0 width="100%" class="table table-"'+id+'">';if('headings'in page){html+=$.wikiEditor.modules.toolbar.fn.buildHeading(context,page.headings)} |
— | — | @@ -223,14 +220,13 @@ |
224 | 221 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
225 | 222 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
226 | 223 | html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};} |
227 | | -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('mousedown',function(e){if(e.button!==0){return true;} |
228 | | -var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});} |
| 224 | +if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('click',function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');var dH=$previousSections.outerHeight();$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');dH=$section.outerHeight()-dH;if(context.modules.$toc){context.modules.$toc.animate({'height':"+="+dH},$section.outerHeight()*2);} |
| 225 | +$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});if(context.modules.$toc){context.modules.$toc.animate({'height':"-="+$section.outerHeight()},$section.outerHeight()*2);}} |
229 | 226 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
230 | | -$.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);}).click(function(){return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
| 227 | +$.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
231 | 228 | break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}} |
232 | 229 | $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;} |
233 | 230 | if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
234 | 231 | return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);} |
235 | | -$pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);if(wgNavigableTOCCollapseEnable){$dragControl=$('<div />').addClass('tab').attr('id','wikiEditor-ui-toc-resize-grip').append('<a href="#" title="Drag to resize"></a>').bind('mousedown',function(){$('#wikiEditor-ui-toc').data('openWidth',$('#wikiEditor-ui-toc').width());$().bind('mousemove',{'context':context},$.wikiEditor.modules.toc.fn.drag).bind('mouseup',{'context':context},$.wikiEditor.modules.toc.fn.stopDrag);$(context.$iframe[0].contentWindow.document).bind('mousemove',{'context':context},function(e){parent.top.$j().trigger("mousemove",e.pageX);return false;}).bind('mouseup',{'context':context},function(e){parent.top.$j().trigger("mouseup");return false;});return false;});context.modules.$toolbar.append($dragControl);} |
236 | | -var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
237 | | -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2);}}});}}};})(jQuery); |
\ No newline at end of file |
| 232 | +$pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
| 233 | +$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){if(context.modules.$toc){context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').outerHeight()-context.$ui.find('.tab-toc').outerHeight())}});}}});}}};})(jQuery); |
\ No newline at end of file |