
adam at svn
May 25, 2010, 11:53 AM
Post #1 of 1
(71 views)
Permalink
|
|
SVN: [66889] trunk/extensions/UsabilityInitiative
|
|
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66889 Revision: 66889 Author: adam Date: 2010-05-25 18:53:35 +0000 (Tue, 25 May 2010) Log Message: ----------- Followup to r66854 - adding the files to the makefile and recombining Modified Paths: -------------- trunk/extensions/UsabilityInitiative/Makefile trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js trunk/extensions/UsabilityInitiative/css/combined.css trunk/extensions/UsabilityInitiative/css/combined.min.css trunk/extensions/UsabilityInitiative/js/plugins.combined.js trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js Modified: trunk/extensions/UsabilityInitiative/Makefile =================================================================== --- trunk/extensions/UsabilityInitiative/Makefile 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/Makefile 2010-05-25 18:53:35 UTC (rev 66889) @@ -5,6 +5,7 @@ CSS := \ css/suggestions.css\ css/vector.collapsibleNav.css\ + css/vector.expandableSearch.css\ css/wikiEditor.css\ css/wikiEditor.dialogs.css\ css/wikiEditor.toc.css\ @@ -26,6 +27,7 @@ js/plugins/jquery.color.js\ js/plugins/jquery.cookie.js\ js/plugins/jquery.delayedBind.js\ + js/plugins/jquery.expandableField.js\ js/plugins/jquery.suggestions.js\ js/plugins/jquery.textSelection.js\ js/plugins/jquery.wikiEditor.js\ @@ -50,6 +52,7 @@ Vector/Modules/CollapsibleNav/CollapsibleNav.js\ Vector/Modules/CollapsibleTabs/CollapsibleTabs.js\ Vector/Modules/EditWarning/EditWarning.js\ + Vector/Modules/ExpandableSearch/ExpandableSearch.js\ Vector/Modules/FooterCleanup/FooterCleanup.js\ Vector/Modules/SimpleSearch/SimpleSearch.js Modified: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js =================================================================== --- trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js 2010-05-25 18:53:35 UTC (rev 66889) @@ -188,6 +188,49 @@ }); //Global storage of fallback for onbeforeunload hook var fallbackWindowOnBeforeUnload = null; +/* JavaScript for ExpandableSearch extension */ +$j( document ).ready( function() { + + // Only use this function in conjuction with the Vector skin + if( !wgVectorEnabledModules.expandablesearch || skin != 'vector' ) { + return true; + } + $j( '#searchInput' ) + .expandableField( { + 'beforeExpand': function( context ) { + // animate the containers border + $j( this ) + .parent() + .animate( { + 'borderTopColor': '#a0d8ff', + 'borderLeftColor': '#a0d8ff', + 'borderRightColor': '#a0d8ff', + 'borderBottomColor': '#a0d8ff' }, 'fast' ); + }, + 'beforeCondense': function( context ) { + // animate the containers border + $j( this ) + .parent() + .animate( { + 'borderTopColor': '#aaaaaa', + 'borderLeftColor': '#aaaaaa', + 'borderRightColor': '#aaaaaa', + 'borderBottomColor': '#aaaaaa' }, 'fast' ); + }, + 'afterExpand': function( context ) { + //trigger the collapsible tabs resize handler + if ( typeof $j.collapsibleTabs != 'undefined' ){ + $j.collapsibleTabs.handleResize(); + } + }, + 'afterCondense': function( context ) { + //trigger the collapsible tabs resize handler + if ( typeof $j.collapsibleTabs != 'undefined' ){ + $j.collapsibleTabs.handleResize(); + } + } + } ); +}); /* Prototype code to demonstrate proposed edit page footer cleanups */ /* First draft and will be changing greatly */ Modified: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js =================================================================== --- trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js 2010-05-25 18:53:35 UTC (rev 66889) @@ -9,7 +9,8 @@ $j('#wpTextbox1, #wpSummary').each(function(){$j(this).data('origtext',$j(this).val());});fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){var fallbackResult=undefined;if(fallbackWindowOnBeforeUnload){fallbackResult=fallbackWindowOnBeforeUnload();} if(fallbackResult!==undefined){return fallbackResult;} if(wgAction=='submit'||$j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()){return mw.usability.getMsg('vector-editwarning-warning');}} -$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;$j(document).ready(function(){if(!wgVectorEnabledModules.footercleanup){return true;} +$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;$j(document).ready(function(){if(!wgVectorEnabledModules.expandablesearch||skin!='vector'){return true;} +$j('#searchInput').expandableField({'beforeExpand':function(context){$j(this).parent().animate({'borderTopColor':'#a0d8ff','borderLeftColor':'#a0d8ff','borderRightColor':'#a0d8ff','borderBottomColor':'#a0d8ff'},'fast');},'beforeCondense':function(context){$j(this).parent().animate({'borderTopColor':'#aaaaaa','borderLeftColor':'#aaaaaa','borderRightColor':'#aaaaaa','borderBottomColor':'#aaaaaa'},'fast');},'afterExpand':function(context){if(typeof $j.collapsibleTabs!='undefined'){$j.collapsibleTabs.handleResize();}},'afterCondense':function(context){if(typeof $j.collapsibleTabs!='undefined'){$j.collapsibleTabs.handleResize();}}});});$j(document).ready(function(){if(!wgVectorEnabledModules.footercleanup){return true;} $j('#editpage-copywarn').add('.editOptions').wrapAll('<div id="editpage-bottom"></div>');$j('#wpSummary').data('hint',$j('#wpSummaryLabel span small').remove().text().replace(/\)|\(/g,'')).change(function(){if($j(this).val().length==0){$j(this).addClass('inline-hint').val($j(this).data('hint'));}else{$j(this).removeClass('inline-hint');}}).focus(function(){if($j(this).val()==$j(this).data('hint')){$j(this).removeClass('inline-hint').val("");}}).blur(function(){$j(this).trigger('change');}).trigger('change');$j('#wpSummary').add('.editCheckboxes').wrapAll('<div id="editpage-summary-fields"></div>');$j('#editpage-specialchars').remove();var transclusionCount=$j('.templatesUsed ul li').size();$j('.templatesUsed ul').wrap('<div id="transclusions-list" class="collapsible-list collapsed"></div>').parent().prepend('<label>This page contains <a href="http://en.wikipedia.org/wiki/transclusion">transclusions</a> of <strong>' +transclusionCount +'</strong> other pages.</label>');$j('.mw-templatesUsedExplanation').remove();$j('.collapsible-list label').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('ul').slideToggle('fast');return false;}).trigger('click');$j('#wpPreview, #wpDiff, .editHelp, #editpage-specialchars').remove();$j('#mw-editform-cancel').remove().appendTo('.editButtons');});if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];} Modified: trunk/extensions/UsabilityInitiative/css/combined.css =================================================================== --- trunk/extensions/UsabilityInitiative/css/combined.css 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/css/combined.css 2010-05-25 18:53:35 UTC (rev 66889) @@ -127,6 +127,16 @@ #panel.collapsible-nav #p-navigation h5 { display: none; } +.expandableField { + display: block; + float: left; +} +#simpleSearch { + overflow: auto; +} +div#simpleSearch button#searchButton { + margin: 0.4em 0 0 0; +} /* wikiEditor plugin */ /* This ID (#editform) could change in MediaWiki */ Modified: trunk/extensions/UsabilityInitiative/css/combined.min.css =================================================================== --- trunk/extensions/UsabilityInitiative/css/combined.min.css 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/css/combined.min.css 2010-05-25 18:53:35 UTC (rev 66889) @@ -125,6 +125,16 @@ #panel.collapsible-nav #p-navigation h5{ display:none; } +.expandableField{ +display:block; +float:left; +} +#simpleSearch{ +overflow:auto; +} +div#simpleSearch button#searchButton{ +margin:0.4em 0 0 0; +} form#editform{ margin:0; padding:0; Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-05-25 18:53:35 UTC (rev 66889) @@ -5759,6 +5759,133 @@ } ); } )( jQuery ); /** + * This plugin provides functionallity to expand a text box on focus to double it's current width + * + * Usage: + * + * Set options: + * $('#textbox').expandableField( { option1: value1, option2: value2 } ); + * $('#textbox').expandableField( option, value ); + * Get option: + * value = $('#textbox').expandableField( option ); + * Initialize: + * $('#textbox').expandableField(); + * + * Options: + * + */ +( function( $ ) { + +$.expandableField = { + /** + * Expand the field, make the callback + */ + expandField: function( e, context ) { + context.config.beforeExpand.call( context.data.$field, context ); + context.data.$field + .animate( { 'width': context.data.expandedWidth }, 'fast', function() { + context.config.afterExpand.call( this, context ); + } ); + }, + /** + * Condense the field, make the callback + */ + condenseField: function( e, context ) { + context.config.beforeCondense.call( context.data.$field, context ); + context.data.$field + .animate( { 'width': context.data.condensedWidth }, 'fast', function() { + context.config.afterCondense.call( this, context ); + } ); + }, + /** + * Sets the value of a property, and updates the widget accordingly + * @param {String} property Name of property + * @param {Mixed} value Value to set property with + */ + configure: function( context, property, value ) { + // Validate creation using fallback values + switch( property ) { + default: + context.config[property] = value; + break; + } + } + +}; +$.fn.expandableField = function() { + + // Multi-context fields + var returnValue = null; + var args = arguments; + + $( this ).each( function() { + + /* Construction / Loading */ + + var context = $( this ).data( 'expandableField-context' ); + if ( context == null ) { + context = { + config: { + // callback function for before collapse + 'beforeCondense': function( context ) {}, + // callback function for before expand + 'beforeExpand': function( context ) {}, + // callback function for after collapse + 'afterCondense': function( context ) {}, + // callback function for after expand + 'afterExpand': function( context ) {}, + } + }; + } + + /* API */ + // Handle various calling styles + if ( args.length > 0 ) { + if ( typeof args[0] == 'object' ) { + // Apply set of properties + for ( var key in args[0] ) { + $.expandableField.configure( context, key, args[0][key] ); + } + } else if ( typeof args[0] == 'string' ) { + if ( args.length > 1 ) { + // Set property values + $.expandableField.configure( context, args[0], args[1] ); + } else if ( returnValue == null ) { + // Get property values, but don't give access to internal data - returns only the first + returnValue = ( args[0] in context.config ? undefined : context.config[args[0]] ); + } + } + } + + /* Initialization */ + + if ( typeof context.data == 'undefined' ) { + context.data = { + // The width of the field in it's condensed state + 'condensedWidth': $( this ).width(), + // The width of the field in it's expanded state + 'expandedWidth': $( this ).width() * 2, + // Reference to the field + '$field': $( this ) + }; + + $( this ) + .addClass( 'expandableField' ) + .focus( function( e ) { + $.expandableField.expandField( e, context ); + } ) + .delayedBind( 250, 'blur', function( e ) { + $.expandableField.condenseField( e, context ); + } ); + } + // Store the context for next time + $( this ).data( 'expandableField-context', context ); + } ); + return returnValue !== null ? returnValue : $(this); +}; + +} )( jQuery ); +/** * This plugin provides a generic way to add suggestions to a text box. * * Usage: Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2010-05-25 18:49:56 UTC (rev 66888) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2010-05-25 18:53:35 UTC (rev 66889) @@ -391,7 +391,10 @@ $.fn.extend({delayedBind:function(timeout,event,data,callback){var encEvent=encodeEvent(event);return this.each(function(){var that=this;if(!($(this).data('_delayedBindBound-'+encEvent+'-'+timeout))){$(this).data('_delayedBindBound-'+encEvent+'-'+timeout,true);$(this).bind(event,function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined') clearTimeout(timerID);timerID=setTimeout(function(){$(that).trigger('_delayedBind-'+encEvent+'-'+timeout);},timeout);$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout,timerID);});} $(this).bind('_delayedBind-'+encEvent+'-'+timeout,data,callback);});},delayedBindCancel:function(timeout,event){var encEvent=encodeEvent(event);return this.each(function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined') -clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.suggestions={cancel:function(context){if(context.data.timerID!=null){clearTimeout(context.data.timerID);} +clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.expandableField={expandField:function(e,context){context.config.beforeExpand.call(context.data.$field,context);context.data.$field.animate({'width':context.data.expandedWidth},'fast',function(){context.config.afterExpand.call(this,context);});},condenseField:function(e,context){context.config.beforeCondense.call(context.data.$field,context);context.data.$field.animate({'width':context.data.condensedWidth},'fast',function(){context.config.afterCondense.call(this,context);});},configure:function(context,property,value){switch(property){default:context.config[property]=value;break;}}};$.fn.expandableField=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('expandableField-context');if(context==null){context={config:{'beforeCondense':function(context){},'beforeExpand':function(context){},'afterCondense':function(context){},'afterExpand':function(context){},}};} +if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.expandableField.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.expandableField.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} +if(typeof context.data=='undefined'){context.data={'condensedWidth':$(this).width(),'expandedWidth':$(this).width()*2,'$field':$(this)};$(this).addClass('expandableField').focus(function(e){$.expandableField.expandField(e,context);}).delayedBind(250,'blur',function(e){$.expandableField.condenseField(e,context);});} +$(this).data('expandableField-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.suggestions={cancel:function(context){if(context.data.timerID!=null){clearTimeout(context.data.timerID);} if(typeof context.config.cancel=='function'){context.config.cancel.call(context.data.$textbox);}},restore:function(context){context.data.$textbox.val(context.data.prevText);},update:function(context,delayed){function maybeFetch(){if(context.data.$textbox.val()!==context.data.prevText){context.data.prevText=context.data.$textbox.val();if(typeof context.config.fetch=='function'){context.config.fetch.call(context.data.$textbox,context.data.$textbox.val());}}} if(context.data.timerID!=null){clearTimeout(context.data.timerID);} if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS [at] lists https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|