Index: trunk/phase3/js2/js2stopgap.js |
— | — | @@ -9459,51 +9459,60 @@ |
9460 | 9460 | * the JavaScript space. As such, if we get to the point of merging that stuff |
9461 | 9461 | * into the main branch this code will be uneeded and probably cause issues. |
9462 | 9462 | */ |
9463 | | -// Creates global message object if not already in existence |
9464 | | -if ( !gMsg ) var gMsg = {}; |
| 9463 | + |
9465 | 9464 | /** |
9466 | | - * Caches a list of messages for later retrieval |
9467 | | - * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 9465 | + * Mimics the no-conflict method used by the js2 stuff |
9468 | 9466 | */ |
9469 | | -function loadGM( msgSet ){ |
9470 | | - for ( var i in msgSet ){ |
9471 | | - gMsg[ i ] = msgSet[i]; |
9472 | | - } |
9473 | | -} |
| 9467 | +$j = jQuery.noConflict(); |
9474 | 9468 | /** |
9475 | | - * Retieves a message from the global message cache, performing on-the-fly |
9476 | | - * replacements using MediaWiki message syntax ($1, $2, etc.) |
9477 | | - * @param {String} key Name of message as it is in MediaWiki |
9478 | | - * @param {Array} args Array of replacement arguments |
| 9469 | + * Provides js2 compatible mw functions |
9479 | 9470 | */ |
9480 | | -function gM( key, args ) { |
9481 | | - var ms = ''; |
9482 | | - if ( key in gMsg ) { |
9483 | | - ms = gMsg[ key ]; |
9484 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
9485 | | - for ( var v in args ){ |
9486 | | - var rep = '\$'+ ( parseInt(v) + 1 ); |
9487 | | - ms = ms.replace( rep, args[v]); |
| 9471 | +if( !mw ){ |
| 9472 | + mw = { }; |
| 9473 | + /** |
| 9474 | + * Provides js2 compatible onload hook |
| 9475 | + * @param func Function to call when ready |
| 9476 | + */ |
| 9477 | + mw.addOnloadHook = function( func ) { |
| 9478 | + $j(document).ready( func ); |
| 9479 | + } |
| 9480 | + // Define a dummy mw.load function: |
| 9481 | + mw.load = function( callback) { callbcak() }; |
| 9482 | + |
| 9483 | + // Creates global message object if not already in existence |
| 9484 | + if ( !gMsg ) var gMsg = {}; |
| 9485 | + |
| 9486 | + /** |
| 9487 | + * Caches a list of messages for later retrieval |
| 9488 | + * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 9489 | + */ |
| 9490 | + mw.addMessages = function ( msgSet ){ |
| 9491 | + for ( var i in msgSet ){ |
| 9492 | + gMsg[ i ] = msgSet[i]; |
| 9493 | + } |
| 9494 | + } |
| 9495 | + /** |
| 9496 | + * Retieves a message from the global message cache, performing on-the-fly |
| 9497 | + * replacements using MediaWiki message syntax ($1, $2, etc.) |
| 9498 | + * @param {String} key Name of message as it is in MediaWiki |
| 9499 | + * @param {Array} args Array of replacement arguments |
| 9500 | + */ |
| 9501 | + function gM( key, args ) { |
| 9502 | + var ms = ''; |
| 9503 | + if ( key in gMsg ) { |
| 9504 | + ms = gMsg[ key ]; |
| 9505 | + if ( typeof args == 'object' || typeof args == 'array' ) { |
| 9506 | + for ( var v in args ){ |
| 9507 | + var rep = '\$'+ ( parseInt(v) + 1 ); |
| 9508 | + ms = ms.replace( rep, args[v]); |
| 9509 | + } |
| 9510 | + } else if ( typeof args =='string' || typeof args =='number' ) { |
| 9511 | + ms = ms.replace( /\$1/, args ); |
9488 | 9512 | } |
9489 | | - } else if ( typeof args =='string' || typeof args =='number' ) { |
9490 | | - ms = ms.replace( /\$1/, args ); |
| 9513 | + return ms; |
| 9514 | + } else { |
| 9515 | + return '[' + key + ']'; |
9491 | 9516 | } |
9492 | | - return ms; |
9493 | | - } else { |
9494 | | - return '[' + key + ']'; |
9495 | 9517 | } |
9496 | | -} |
9497 | | -/** |
9498 | | - * Mimics the no-conflict method used by the js2 stuff |
9499 | | - */ |
9500 | | -$j = jQuery.noConflict(); |
9501 | | -/** |
9502 | | - * Provides js2 compatible onload hook |
9503 | | - * @param func Function to call when ready |
9504 | | - */ |
9505 | | -function js2AddOnloadHook( func ) { |
9506 | | - $j(document).ready( func ); |
9507 | | -} |
9508 | | - |
9509 | | -// Define a dummy mvJsLoader.doLoad() function |
9510 | | -mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
\ No newline at end of file |
| 9518 | + |
| 9519 | +} |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1656,7 +1656,7 @@ |
1657 | 1657 | * Gets the currently selected text in the content |
1658 | 1658 | * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead |
1659 | 1659 | */ |
1660 | | - 'getSelection': function() { |
| 1660 | + 'textSelection': function() { |
1661 | 1661 | var retval; |
1662 | 1662 | if ( context.$iframe[0].contentWindow.getSelection ) { |
1663 | 1663 | retval = context.$iframe[0].contentWindow.getSelection(); |
— | — | @@ -1671,7 +1671,7 @@ |
1672 | 1672 | return retval; |
1673 | 1673 | }, |
1674 | 1674 | /** |
1675 | | - * Inserts text at the begining and end of a text selection, optionally inserting text at the caret when |
| 1675 | + * Inserts text at the beginning and end of a text selection, optionally inserting text at the caret when |
1676 | 1676 | * selection is empty. |
1677 | 1677 | * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead |
1678 | 1678 | */ |
— | — | @@ -1940,7 +1940,7 @@ |
1941 | 1941 | $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
1942 | 1942 | } |
1943 | 1943 | // Build out modules immediately |
1944 | | - mvJsLoader.doLoad( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
| 1944 | + mw.load( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
1945 | 1945 | for ( module in $.wikiEditor.modules.dialogs.modules ) { |
1946 | 1946 | var module = $.wikiEditor.modules.dialogs.modules[module]; |
1947 | 1947 | // Only create the dialog if it doesn't exist yet |
— | — | @@ -2940,7 +2940,7 @@ |
2941 | 2941 | fn : { |
2942 | 2942 | /** |
2943 | 2943 | * Creates a toolbar module within a wikiEditor |
2944 | | - * |
| 2944 | + * |
2945 | 2945 | * @param {Object} context Context object of editor to create module in |
2946 | 2946 | * @param {Object} config Configuration object to create module from |
2947 | 2947 | */ |
— | — | @@ -2956,7 +2956,7 @@ |
2957 | 2957 | }, |
2958 | 2958 | /** |
2959 | 2959 | * Performs an operation based on parameters |
2960 | | - * |
| 2960 | + * |
2961 | 2961 | * @param {Object} context |
2962 | 2962 | * @param {Object} action |
2963 | 2963 | * @param {Object} source |
— | — | @@ -2995,12 +2995,15 @@ |
2996 | 2996 | parts[part] = ( action.options[part] || '' ) |
2997 | 2997 | } |
2998 | 2998 | } |
2999 | | - if ( 'regex' in action.options && 'regexReplace' in action.options ) { |
| 2999 | + if ( 'periRegex' in action.options && 'periRegexReplace' in action.options ) { |
| 3000 | +<<<<<<< .mine |
| 3001 | + var selection = context.$textarea.textSelection(); |
| 3002 | +======= |
3000 | 3003 | var selection = context.$textarea.textSelection( 'getSelection' ); |
3001 | | - if ( selection != '' && selection.match( action.options.regex ) ) { |
3002 | | - parts.peri = selection.replace( action.options.regex, |
3003 | | - action.options.regexReplace ); |
3004 | | - parts.pre = parts.post = ''; |
| 3004 | +>>>>>>> .r58906 |
| 3005 | + if ( selection != '' ) { |
| 3006 | + parts.peri = selection.replace( action.options.periRegex, |
| 3007 | + action.options.periRegexReplace ); |
3005 | 3008 | } |
3006 | 3009 | } |
3007 | 3010 | context.$textarea.textSelection( 'encapsulateSelection', $.extend( action.options, |
— | — | @@ -3023,18 +3026,12 @@ |
3024 | 3027 | if ( label ) { |
3025 | 3028 | $group.append( '<div class="label">' + label + '</div>' ) |
3026 | 3029 | } |
3027 | | - |
3028 | | - var empty = true; |
3029 | 3030 | if ( 'tools' in group ) { |
3030 | 3031 | for ( tool in group.tools ) { |
3031 | | - var tool = $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ); |
3032 | | - if ( tool ) { |
3033 | | - empty = false; |
3034 | | - $group.append( tool ); |
3035 | | - } |
| 3032 | + $group.append( $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ) ); |
3036 | 3033 | } |
3037 | 3034 | } |
3038 | | - return empty ? null : $group; |
| 3035 | + return $group; |
3039 | 3036 | }, |
3040 | 3037 | buildTool : function( context, id, tool ) { |
3041 | 3038 | if ( 'filters' in tool ) { |
— | — | @@ -3047,7 +3044,10 @@ |
3048 | 3045 | var label = $.wikiEditor.autoMsg( tool, 'label' ); |
3049 | 3046 | switch ( tool.type ) { |
3050 | 3047 | case 'button': |
3051 | | - var src = $.wikiEditor.getIcon( tool.icon, $.wikiEditor.imgPath + 'toolbar/' ); |
| 3048 | + var src = tool.icon; |
| 3049 | + if ( src.indexOf( 'http://' ) !== 0 && src.indexOf( 'https://' ) !== 0 ) { |
| 3050 | + src = $.wikiEditor.imgPath + 'toolbar/' + src; |
| 3051 | + } |
3052 | 3052 | $button = $( '<img />' ).attr( { |
3053 | 3053 | 'src' : src, |
3054 | 3054 | 'width' : 22, |
— | — | @@ -3235,35 +3235,31 @@ |
3236 | 3236 | .bind( 'mouseup', function( e ) { |
3237 | 3237 | $(this).blur(); |
3238 | 3238 | } ) |
3239 | | - .bind( 'click', function( e ) { |
| 3239 | + .bind( 'mousedown', function( e ) { |
| 3240 | + // Only act when the primary mouse button was pressed |
| 3241 | + if ( e.button !== 0 ) { |
| 3242 | + return true; |
| 3243 | + } |
3240 | 3244 | var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
3241 | 3245 | var $section = |
3242 | 3246 | $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
3243 | 3247 | var show = $section.css( 'display' ) == 'none'; |
3244 | 3248 | $previousSections = $section.parent().find( '.section:visible' ); |
3245 | | - var dH = $previousSections.outerHeight(); |
3246 | 3249 | $previousSections.css( 'position', 'absolute' ); |
3247 | 3250 | $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
3248 | 3251 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
3249 | 3252 | $sections.css('overflow', 'hidden'); |
3250 | 3253 | if ( show ) { |
3251 | 3254 | $section.fadeIn( 'fast' ); |
3252 | | - dH = $section.outerHeight() - dH; |
3253 | | - if ( context.modules.$toc ) { |
3254 | | - context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2); |
3255 | | - } |
3256 | | - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
3257 | | - $(this).css('overflow', 'visible').css('height', 'auto'); |
| 3255 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
| 3256 | + $(this).css('overflow', 'visible').css('height', 'auto'); |
3258 | 3257 | } ); |
3259 | 3258 | $(this).addClass( 'current' ); |
3260 | 3259 | } else { |
3261 | 3260 | $sections.css('height', $section.outerHeight() ) |
3262 | | - .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
3263 | | - $(this).css('overflow', 'visible'); |
| 3261 | + .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
| 3262 | + $(this).css('overflow', 'visible'); |
3264 | 3263 | } ); |
3265 | | - if ( context.modules.$toc ) { |
3266 | | - context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2); |
3267 | | - } |
3268 | 3264 | } |
3269 | 3265 | // Click tracking |
3270 | 3266 | if($.trackAction != undefined){ |
— | — | @@ -3274,8 +3270,8 @@ |
3275 | 3271 | 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
3276 | 3272 | show ? $section.attr( 'rel' ) : null |
3277 | 3273 | ); |
3278 | | - return false; |
3279 | 3274 | } ) |
| 3275 | + .click( function() { return false; } ) |
3280 | 3276 | ); |
3281 | 3277 | }, |
3282 | 3278 | buildSection : function( context, id, section ) { |
— | — | @@ -3333,6 +3329,29 @@ |
3334 | 3330 | }, |
3335 | 3331 | build : function( context, config ) { |
3336 | 3332 | 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 | + } |
3337 | 3356 | var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar ); |
3338 | 3357 | context.modules.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) ); |
3339 | 3358 | var sectionQueue = []; |
— | — | @@ -3354,7 +3373,8 @@ |
3355 | 3374 | $.eachAsync( sectionQueue, { |
3356 | 3375 | 'bulk' : 0, |
3357 | 3376 | 'end' : function() { |
3358 | | - // HACK: Opera doesn't seem to want to redraw after these bits |
| 3377 | + // HACK: Opera doesn't seem to want to redraw after |
| 3378 | + // these bits |
3359 | 3379 | // are added to the DOM, so we can just FORCE it! |
3360 | 3380 | $( 'body' ).css( 'position', 'static' ); |
3361 | 3381 | $( 'body' ).css( 'position', 'relative' ); |
— | — | @@ -3363,14 +3383,7 @@ |
3364 | 3384 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
3365 | 3385 | var $section = s.$sections.find( '.section:visible' ); |
3366 | 3386 | if ( $section.size() ) { |
3367 | | - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) { |
3368 | | - if ( context.modules.$toc ) { |
3369 | | - context.modules.$toc.height( |
3370 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
3371 | | - .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight() |
3372 | | - ) |
3373 | | - } |
3374 | | - } ); |
| 3387 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
3375 | 3388 | } |
3376 | 3389 | } |
3377 | 3390 | } ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | event.preventDefault();}).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;},'getSelection':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.selection){retval=context.$iframe[0].contentWindow.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) |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | context.api.addModule(context,arguments[0]);else{var args=arguments;setTimeout(function(){context.api.addModule(context,args[0]);},2);}}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){if(context.fn.isSetup()) |
116 | 116 | context.api[call](context,arguments[0]==undefined?{}:arguments[0]);else{var args=arguments;setTimeout(function(){context.api[call](context,args[0]==undefined?{}:args[0]);},2);}}}} |
117 | 117 | 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];} |
118 | | -mvJsLoader.doLoad(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |
| 118 | +mw.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |
119 | 119 | 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) |
120 | 120 | 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);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
121 | 121 | 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'))- |
— | — | @@ -201,12 +201,15 @@ |
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('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='';}} |
| 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);}} |
206 | 208 | context.$textarea.textSelection('encapsulateSelection',$.extend(action.options,parts,{'replace':action.type=='replace'}));break;case'callback':if(typeof action.execute=='function'){action.execute(context);} |
207 | 209 | 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>')} |
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;});} |
| 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;});} |
211 | 214 | 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));}} |
212 | 215 | $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'));} |
213 | 216 | $.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)} |
— | — | @@ -220,13 +223,14 @@ |
221 | 224 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
222 | 225 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
223 | 226 | 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]}}};} |
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);}} |
| 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');});} |
226 | 229 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
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]));}} |
| 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]));}} |
228 | 231 | 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]));}} |
229 | 232 | $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;} |
230 | 233 | if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
231 | 234 | 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);} |
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 |
| 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 |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -346,7 +346,7 @@ |
347 | 347 | * Gets the currently selected text in the content |
348 | 348 | * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead |
349 | 349 | */ |
350 | | - 'getSelection': function() { |
| 350 | + 'textSelection': function() { |
351 | 351 | var retval; |
352 | 352 | if ( context.$iframe[0].contentWindow.getSelection ) { |
353 | 353 | retval = context.$iframe[0].contentWindow.getSelection(); |
— | — | @@ -361,7 +361,7 @@ |
362 | 362 | return retval; |
363 | 363 | }, |
364 | 364 | /** |
365 | | - * Inserts text at the begining and end of a text selection, optionally inserting text at the caret when |
| 365 | + * Inserts text at the beginning and end of a text selection, optionally inserting text at the caret when |
366 | 366 | * selection is empty. |
367 | 367 | * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead |
368 | 368 | */ |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
45 | 45 | } |
46 | 46 | // Build out modules immediately |
47 | | - mvJsLoader.doLoad( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
| 47 | + mw.load( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
48 | 48 | for ( module in $.wikiEditor.modules.dialogs.modules ) { |
49 | 49 | var module = $.wikiEditor.modules.dialogs.modules[module]; |
50 | 50 | // Only create the dialog if it doesn't exist yet |
Index: trunk/extensions/UsabilityInitiative/js/tests/wikiEditor.toolbar.js |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | 'post': 6 |
191 | 191 | } |
192 | 192 | }; |
193 | | -js2AddOnloadHook( function() { |
| 193 | +mw.addOnloadHook( function() { |
194 | 194 | var button = $j( '<button>Run wikiEditor Tests!</button>' ) |
195 | 195 | .css( { |
196 | 196 | 'position': 'fixed', |
Index: trunk/extensions/UsabilityInitiative/.project |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?xml version="1.0" encoding="UTF-8"?> |
| 3 | +<projectDescription> |
| 4 | + <name>UsabilityInitiative</name> |
| 5 | + <comment></comment> |
| 6 | + <projects> |
| 7 | + </projects> |
| 8 | + <buildSpec> |
| 9 | + <buildCommand> |
| 10 | + <name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name> |
| 11 | + <arguments> |
| 12 | + </arguments> |
| 13 | + </buildCommand> |
| 14 | + <buildCommand> |
| 15 | + <name>org.eclipse.php.core.ValidationManagerWrapper</name> |
| 16 | + <arguments> |
| 17 | + </arguments> |
| 18 | + </buildCommand> |
| 19 | + </buildSpec> |
| 20 | + <natures> |
| 21 | + <nature>org.eclipse.php.core.PHPNature</nature> |
| 22 | + </natures> |
| 23 | +</projectDescription> |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -707,4 +707,4 @@ |
708 | 708 | .wikiEditor-preview-contents{ |
709 | 709 | padding:1em; |
710 | 710 | background-color:white; |
711 | | -} |
| 711 | +} |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php |
— | — | @@ -7,23 +7,23 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | class SpecialOptIn extends SpecialPage { |
11 | | - |
| 11 | + |
12 | 12 | /* Members */ |
13 | | - |
| 13 | + |
14 | 14 | private $mOrigin = ''; |
15 | 15 | private $mOriginTitle = null; |
16 | 16 | private $mOriginQuery = ''; |
17 | 17 | private $mOriginLink = ''; |
18 | 18 | private $mOriginURL = ''; |
19 | | - |
| 19 | + |
20 | 20 | /* Static Functions */ |
21 | | - |
| 21 | + |
22 | 22 | public static function isOptedIn( $user ) { |
23 | 23 | global $wgOptInPrefs; |
24 | | - |
| 24 | + |
25 | 25 | if ( $user->isAnon() ) |
26 | 26 | return false; |
27 | | - |
| 27 | + |
28 | 28 | foreach ( $wgOptInPrefs as $pref => $value ) { |
29 | 29 | if ( $user->getOption( $pref ) != $value ) { |
30 | 30 | return false; |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | } |
33 | 33 | return true; |
34 | 34 | } |
35 | | - |
| 35 | + |
36 | 36 | public static function checkToken() { |
37 | 37 | global $wgRequest, $wgUser; |
38 | 38 | return $wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ); |
— | — | @@ -52,21 +52,21 @@ |
53 | 53 | } |
54 | 54 | $user->saveSettings(); |
55 | 55 | } |
56 | | - |
| 56 | + |
57 | 57 | /* Functions */ |
58 | | - |
| 58 | + |
59 | 59 | public function __construct() { |
60 | 60 | parent::__construct( 'OptIn' ); |
61 | 61 | wfLoadExtensionMessages( 'OptIn' ); |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | public function execute( $par ) { |
65 | 65 | global $wgRequest, $wgOut, $wgUser, $wgOptInSurvey; |
66 | 66 | global $wgOptInFeedBackSurvey, $wgOptInBrowserSurvey; |
67 | | - |
| 67 | + |
68 | 68 | $par = $wgRequest->getVal( 'from', $par ); |
69 | 69 | $this->mOriginTitle = Title::newFromText( $par ); |
70 | | - |
| 70 | + |
71 | 71 | // Verify that $this->mOriginTitle is not Special:Userlogout |
72 | 72 | if ( $this->mOriginTitle && $this->mOriginTitle->getNamespace() == NS_SPECIAL && |
73 | 73 | SpecialPage::resolveAlias( $this->mOriginTitle->getText() ) == 'Userlogout' ) { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | $this->mOriginQuery ); |
84 | 84 | } |
85 | 85 | $this->setHeaders(); |
86 | | - |
| 86 | + |
87 | 87 | if ( self::isOptedIn( $wgUser ) ) { |
88 | 88 | if ( $wgRequest->getVal( 'opt' ) == 'out' ) |
89 | 89 | // Just opted out |
— | — | @@ -106,22 +106,22 @@ |
107 | 107 | // About to opt in |
108 | 108 | $wgOut->setPageTitle( wfMsg( 'optin-title-optedout' ) ); |
109 | 109 | } |
110 | | - |
| 110 | + |
111 | 111 | if ( $wgRequest->getCheck( 'opt' ) && $wgUser->isLoggedIn() ) { |
112 | 112 | if ( $wgRequest->getVal( 'opt' ) === 'in' ) { |
113 | 113 | if ( self::checkToken() && !self::isOptedIn( $wgUser ) ) { |
114 | 114 | self::optIn( $wgUser ); |
115 | 115 | $wgOut->addWikiMsg( 'optin-success-in' ); |
116 | | - |
| 116 | + |
117 | 117 | global $wgJsMimeType, $wgOptInStyleVersion; |
118 | 118 | UsabilityInitiativeHooks::initialize(); |
119 | 119 | UsabilityInitiativeHooks::addScript( 'OptIn/OptIn.js', |
120 | 120 | $wgOptInStyleVersion ); |
121 | | - |
| 121 | + |
122 | 122 | $url = $this->getTitle()->getLinkUrl(); |
123 | 123 | $wgOut->addHTML( Xml::tags( 'script', |
124 | 124 | array( 'type' => $wgJsMimeType ), |
125 | | - 'js2AddOnloadHook( function() { $j.post( "' . $url . '", optInGetPOSTData() ); } );' |
| 125 | + 'mw.addOnloadHook( function() { $j.post( "' . $url . '", optInGetPOSTData() ); } );' |
126 | 126 | ) ); |
127 | 127 | } else if ( self::isOptedIn( $wgUser ) ) { |
128 | 128 | // User is already opted in but |
— | — | @@ -160,12 +160,12 @@ |
161 | 161 | $this->showForm( self::isOptedIn( $wgUser ) ? |
162 | 162 | 'out' : 'in' ); |
163 | 163 | } |
164 | | - |
| 164 | + |
165 | 165 | /* Private Functions */ |
166 | 166 | |
167 | 167 | private function showForm( $opt ) { |
168 | 168 | global $wgUser, $wgOut, $wgOptInSurvey, $wgOptInFeedBackSurvey; |
169 | | - |
| 169 | + |
170 | 170 | if ( $opt == 'out' ) { |
171 | 171 | $wgOut->addWikiMsg( 'optin-survey-intro' ); |
172 | 172 | if ( $this->mOriginTitle ) |
— | — | @@ -189,14 +189,14 @@ |
190 | 190 | $wgOut->addWikiMsg( 'optin-improvements' ); |
191 | 191 | } |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | function showOptInButtons() { |
195 | 195 | global $wgUser, $wgOut, $wgOptInStyleVersion; |
196 | | - |
| 196 | + |
197 | 197 | UsabilityInitiativeHooks::initialize(); |
198 | 198 | UsabilityInitiativeHooks::addStyle( 'OptIn/OptIn.css', |
199 | 199 | $wgOptInStyleVersion ); |
200 | | - |
| 200 | + |
201 | 201 | $query = array( |
202 | 202 | 'opt' => 'in', |
203 | 203 | 'from' => $this->mOrigin, |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | array( 'returnto' => $this->getTitle(), |
212 | 212 | 'returntoquery' => wfArrayToCGI( $query ) |
213 | 213 | ) ); |
214 | | - |
| 214 | + |
215 | 215 | $wgOut->addHTML( |
216 | 216 | Xml::tags( 'div', array( 'class' => 'optin-accept' ), |
217 | 217 | Xml::tags( 'div', array(), |
— | — | @@ -278,13 +278,13 @@ |
279 | 279 | |
280 | 280 | private function showSurvey( $survey, $submitMsg, $opt, $loadFromDB = false ) { |
281 | 281 | global $wgUser, $wgOut, $wgOptInStyleVersion; |
282 | | - |
| 282 | + |
283 | 283 | UsabilityInitiativeHooks::initialize(); |
284 | 284 | UsabilityInitiativeHooks::addScript( 'OptIn/OptIn.js', |
285 | 285 | $wgOptInStyleVersion ); |
286 | 286 | UsabilityInitiativeHooks::addStyle( 'OptIn/OptIn.css', |
287 | 287 | $wgOptInStyleVersion ); |
288 | | - |
| 288 | + |
289 | 289 | $loaded = array(); |
290 | 290 | if ( $loadFromDB ) { |
291 | 291 | $dbr = wfGetDb( DB_SLAVE ); |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | $row->ois_answer, $row->ois_answer_data |
301 | 301 | ); |
302 | 302 | } |
303 | | - |
| 303 | + |
304 | 304 | $query = array( 'from' => $this->mOrigin, |
305 | 305 | 'fromquery' => $this->mOriginQuery |
306 | 306 | ); |
— | — | @@ -541,7 +541,7 @@ |
542 | 542 | |
543 | 543 | private function saveSurvey( $survey, $type ) { |
544 | 544 | global $wgRequest, $wgUser; |
545 | | - |
| 545 | + |
546 | 546 | $dbw = wfGetDb( DB_MASTER ); |
547 | 547 | $now = $dbw->timestamp( wfTimestamp() ); |
548 | 548 | foreach ( $survey as $id => $question ) { |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.js |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | 'opt': 'browser' }; |
70 | 70 | } |
71 | 71 | |
72 | | -js2AddOnloadHook( function() { |
| 72 | +mw.addOnloadHook( function() { |
73 | 73 | $j( '.optin-other-select' ).parent().hide(); |
74 | 74 | $j( 'select.optin-need-other' ).change( function() { |
75 | 75 | if( $j(this).val() == 'other' ) |
Index: trunk/extensions/UsabilityInitiative/jsmin.c |
— | — | @@ -0,0 +1,275 @@ |
| 2 | +/* jsmin.c
|
| 3 | + 2008-08-03
|
| 4 | +
|
| 5 | +Copyright (c) 2002 Douglas Crockford (www.crockford.com)
|
| 6 | +
|
| 7 | +Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 8 | +this software and associated documentation files (the "Software"), to deal in
|
| 9 | +the Software without restriction, including without limitation the rights to
|
| 10 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
| 11 | +of the Software, and to permit persons to whom the Software is furnished to do
|
| 12 | +so, subject to the following conditions:
|
| 13 | +
|
| 14 | +The above copyright notice and this permission notice shall be included in all
|
| 15 | +copies or substantial portions of the Software.
|
| 16 | +
|
| 17 | +The Software shall be used for Good, not Evil.
|
| 18 | +
|
| 19 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 20 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 21 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 22 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 23 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 24 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 25 | +SOFTWARE.
|
| 26 | +*/
|
| 27 | +
|
| 28 | +#include <stdlib.h>
|
| 29 | +#include <stdio.h>
|
| 30 | +
|
| 31 | +static int theA;
|
| 32 | +static int theB;
|
| 33 | +static int theLookahead = EOF;
|
| 34 | +
|
| 35 | +
|
| 36 | +/* isAlphanum -- return true if the character is a letter, digit, underscore,
|
| 37 | + dollar sign, or non-ASCII character.
|
| 38 | +*/
|
| 39 | +
|
| 40 | +static int
|
| 41 | +isAlphanum(int c)
|
| 42 | +{
|
| 43 | + return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
|
| 44 | + (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '\\' ||
|
| 45 | + c > 126);
|
| 46 | +}
|
| 47 | +
|
| 48 | +
|
| 49 | +/* get -- return the next character from stdin. Watch out for lookahead. If
|
| 50 | + the character is a control character, translate it to a space or
|
| 51 | + linefeed.
|
| 52 | +*/
|
| 53 | +
|
| 54 | +static int
|
| 55 | +get()
|
| 56 | +{
|
| 57 | + int c = theLookahead;
|
| 58 | + theLookahead = EOF;
|
| 59 | + if (c == EOF) {
|
| 60 | + c = getc(stdin);
|
| 61 | + }
|
| 62 | + if (c >= ' ' || c == '\n' || c == EOF) {
|
| 63 | + return c;
|
| 64 | + }
|
| 65 | + if (c == '\r') {
|
| 66 | + return '\n';
|
| 67 | + }
|
| 68 | + return ' ';
|
| 69 | +}
|
| 70 | +
|
| 71 | +
|
| 72 | +/* peek -- get the next character without getting it.
|
| 73 | +*/
|
| 74 | +
|
| 75 | +static int
|
| 76 | +peek()
|
| 77 | +{
|
| 78 | + theLookahead = get();
|
| 79 | + return theLookahead;
|
| 80 | +}
|
| 81 | +
|
| 82 | +
|
| 83 | +/* next -- get the next character, excluding comments. peek() is used to see
|
| 84 | + if a '/' is followed by a '/' or '*'.
|
| 85 | +*/
|
| 86 | +
|
| 87 | +static int
|
| 88 | +next()
|
| 89 | +{
|
| 90 | + int c = get();
|
| 91 | + if (c == '/') {
|
| 92 | + switch (peek()) {
|
| 93 | + case '/':
|
| 94 | + for (;;) {
|
| 95 | + c = get();
|
| 96 | + if (c <= '\n') {
|
| 97 | + return c;
|
| 98 | + }
|
| 99 | + }
|
| 100 | + case '*':
|
| 101 | + get();
|
| 102 | + for (;;) {
|
| 103 | + switch (get()) {
|
| 104 | + case '*':
|
| 105 | + if (peek() == '/') {
|
| 106 | + get();
|
| 107 | + return ' ';
|
| 108 | + }
|
| 109 | + break;
|
| 110 | + case EOF:
|
| 111 | + fprintf(stderr, "Error: JSMIN Unterminated comment.\n");
|
| 112 | + exit(1);
|
| 113 | + }
|
| 114 | + }
|
| 115 | + default:
|
| 116 | + return c;
|
| 117 | + }
|
| 118 | + }
|
| 119 | + return c;
|
| 120 | +}
|
| 121 | +
|
| 122 | +
|
| 123 | +/* action -- do something! What you do is determined by the argument:
|
| 124 | + 1 Output A. Copy B to A. Get the next B.
|
| 125 | + 2 Copy B to A. Get the next B. (Delete A).
|
| 126 | + 3 Get the next B. (Delete B).
|
| 127 | + action treats a string as a single character. Wow!
|
| 128 | + action recognizes a regular expression if it is preceded by ( or , or =.
|
| 129 | +*/
|
| 130 | +
|
| 131 | +static void
|
| 132 | +action(int d)
|
| 133 | +{
|
| 134 | + switch (d) {
|
| 135 | + case 1:
|
| 136 | + putc(theA, stdout);
|
| 137 | + case 2:
|
| 138 | + theA = theB;
|
| 139 | + if (theA == '\'' || theA == '"') {
|
| 140 | + for (;;) {
|
| 141 | + putc(theA, stdout);
|
| 142 | + theA = get();
|
| 143 | + if (theA == theB) {
|
| 144 | + break;
|
| 145 | + }
|
| 146 | + if (theA == '\\') {
|
| 147 | + putc(theA, stdout);
|
| 148 | + theA = get();
|
| 149 | + }
|
| 150 | + if (theA == EOF) {
|
| 151 | + fprintf(stderr, "Error: JSMIN unterminated string literal.");
|
| 152 | + exit(1);
|
| 153 | + }
|
| 154 | + }
|
| 155 | + }
|
| 156 | + case 3:
|
| 157 | + theB = next();
|
| 158 | + if (theB == '/' && (theA == '(' || theA == ',' || theA == '=' ||
|
| 159 | + theA == ':' || theA == '[' || theA == '!' ||
|
| 160 | + theA == '&' || theA == '|' || theA == '?' ||
|
| 161 | + theA == '{' || theA == '}' || theA == ';' ||
|
| 162 | + theA == '\n')) {
|
| 163 | + putc(theA, stdout);
|
| 164 | + putc(theB, stdout);
|
| 165 | + for (;;) {
|
| 166 | + theA = get();
|
| 167 | + if (theA == '/') {
|
| 168 | + break;
|
| 169 | + }
|
| 170 | + if (theA =='\\') {
|
| 171 | + putc(theA, stdout);
|
| 172 | + theA = get();
|
| 173 | + }
|
| 174 | + if (theA == EOF) {
|
| 175 | + fprintf(stderr,
|
| 176 | +"Error: JSMIN unterminated Regular Expression literal.\n");
|
| 177 | + exit(1);
|
| 178 | + }
|
| 179 | + putc(theA, stdout);
|
| 180 | + }
|
| 181 | + theB = next();
|
| 182 | + }
|
| 183 | + }
|
| 184 | +}
|
| 185 | +
|
| 186 | +
|
| 187 | +/* jsmin -- Copy the input to the output, deleting the characters which are
|
| 188 | + insignificant to JavaScript. Comments will be removed. Tabs will be
|
| 189 | + replaced with spaces. Carriage returns will be replaced with linefeeds.
|
| 190 | + Most spaces and linefeeds will be removed.
|
| 191 | +*/
|
| 192 | +
|
| 193 | +static void
|
| 194 | +jsmin()
|
| 195 | +{
|
| 196 | + theA = '\n';
|
| 197 | + action(3);
|
| 198 | + while (theA != EOF) {
|
| 199 | + switch (theA) {
|
| 200 | + case ' ':
|
| 201 | + if (isAlphanum(theB)) {
|
| 202 | + action(1);
|
| 203 | + } else {
|
| 204 | + action(2);
|
| 205 | + }
|
| 206 | + break;
|
| 207 | + case '\n':
|
| 208 | + switch (theB) {
|
| 209 | + case '{':
|
| 210 | + case '[':
|
| 211 | + case '(':
|
| 212 | + case '+':
|
| 213 | + case '-':
|
| 214 | + action(1);
|
| 215 | + break;
|
| 216 | + case ' ':
|
| 217 | + action(3);
|
| 218 | + break;
|
| 219 | + default:
|
| 220 | + if (isAlphanum(theB)) {
|
| 221 | + action(1);
|
| 222 | + } else {
|
| 223 | + action(2);
|
| 224 | + }
|
| 225 | + }
|
| 226 | + break;
|
| 227 | + default:
|
| 228 | + switch (theB) {
|
| 229 | + case ' ':
|
| 230 | + if (isAlphanum(theA)) {
|
| 231 | + action(1);
|
| 232 | + break;
|
| 233 | + }
|
| 234 | + action(3);
|
| 235 | + break;
|
| 236 | + case '\n':
|
| 237 | + switch (theA) {
|
| 238 | + case '}':
|
| 239 | + case ']':
|
| 240 | + case ')':
|
| 241 | + case '+':
|
| 242 | + case '-':
|
| 243 | + case '"':
|
| 244 | + case '\'':
|
| 245 | + action(1);
|
| 246 | + break;
|
| 247 | + default:
|
| 248 | + if (isAlphanum(theA)) {
|
| 249 | + action(1);
|
| 250 | + } else {
|
| 251 | + action(3);
|
| 252 | + }
|
| 253 | + }
|
| 254 | + break;
|
| 255 | + default:
|
| 256 | + action(1);
|
| 257 | + break;
|
| 258 | + }
|
| 259 | + }
|
| 260 | + }
|
| 261 | +}
|
| 262 | +
|
| 263 | +
|
| 264 | +/* main -- Output any command line arguments as comments
|
| 265 | + and then minify the input.
|
| 266 | +*/
|
| 267 | +extern int
|
| 268 | +main(int argc, char* argv[])
|
| 269 | +{
|
| 270 | + int i;
|
| 271 | + for (i = 1; i < argc; i += 1) {
|
| 272 | + fprintf(stdout, "// %s\n", argv[i]);
|
| 273 | + }
|
| 274 | + jsmin();
|
| 275 | + return 0;
|
| 276 | +}
|
Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleTabs/CollapsibleTabs.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -js2AddOnloadHook( function() { |
| 2 | +mw.addOnloadHook( function() { |
3 | 3 | |
4 | 4 | var rtl = $j( 'body' ).is( '.rtl' ) ? true : false; |
5 | 5 | |
Index: trunk/extensions/UsabilityInitiative/Vector/Modules/EditWarning/EditWarning.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for EditWarning extension */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for editwarning |
6 | 6 | if ( !wgVectorPreferences || !( wgVectorPreferences.editwarning && wgVectorPreferences.editwarning.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | os_autoload_forms = []; |
8 | 8 | } |
9 | 9 | |
10 | | -js2AddOnloadHook( function() { |
| 10 | +mw.addOnloadHook( function() { |
11 | 11 | // Only use this function in conjuction with the Vector skin |
12 | 12 | if( skin != 'vector' ) { |
13 | 13 | return; |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -js2AddOnloadHook( function() { |
| 2 | +mw.addOnloadHook( function() { |
3 | 3 | |
4 | 4 | var rtl = $j( 'body' ).is( '.rtl' ) ? true : false; |
5 | 5 | |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | |
3 | | -js2AddOnloadHook(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') |
| 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 | 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;} |
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();} |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | Xml::tags( |
166 | 166 | 'script', |
167 | 167 | array( 'type' => $wgJsMimeType ), |
168 | | - 'loadGM({' . implode( ',', self::$messages ) . '});' |
| 168 | + 'mw.addMessages({' . implode( ',', self::$messages ) . '});' |
169 | 169 | ) |
170 | 170 | ); |
171 | 171 | } |
Index: trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.js |
— | — | @@ -512,6 +512,6 @@ |
513 | 513 | })(jQuery); |
514 | 514 | |
515 | 515 | // colorize the table on document.ready |
516 | | -js2AddOnloadHook( $j.colorizeTable ); |
517 | | -js2AddOnloadHook( $j.changeDataLinks ); |
518 | | -js2AddOnloadHook( $j.setUIControls ); |
\ No newline at end of file |
| 516 | +mw.addOnloadHook( $j.colorizeTable ); |
| 517 | +mw.addOnloadHook( $j.changeDataLinks ); |
| 518 | +mw.addOnloadHook( $j.setUIControls ); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Highlight module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for highlight |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.highlight && wgWikiEditorPreferences.highlight.enable ) ) { |
7 | 7 | return true; |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | }); |
14 | 14 | /* JavaScript for WikiEditor Preview module */ |
15 | 15 | |
16 | | -js2AddOnloadHook( function() { |
| 16 | +mw.addOnloadHook( function() { |
17 | 17 | // Check preferences for preview |
18 | 18 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.preview && wgWikiEditorPreferences.preview.enable ) ) { |
19 | 19 | return true; |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | }); |
26 | 26 | /* JavaScript for WikiEditor Publish module */ |
27 | 27 | |
28 | | -js2AddOnloadHook( function() { |
| 28 | +mw.addOnloadHook( function() { |
29 | 29 | // Check preferences for preview |
30 | 30 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.publish && wgWikiEditorPreferences.publish.enable ) ) { |
31 | 31 | return true; |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | }); |
38 | 38 | /* JavaScript for WikiEditor Toc module */ |
39 | 39 | |
40 | | -js2AddOnloadHook( function() { |
| 40 | +mw.addOnloadHook( function() { |
41 | 41 | // Check preferences for toolbar |
42 | 42 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.toc && wgWikiEditorPreferences.toc.enable ) ) { |
43 | 43 | return true; |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | }); |
50 | 50 | /* JavaScript for WikiEditor Toolbar module */ |
51 | 51 | |
52 | | -js2AddOnloadHook( function() { |
| 52 | +mw.addOnloadHook( function() { |
53 | 53 | // Check preferences for toolbar |
54 | 54 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.toolbar && wgWikiEditorPreferences.toolbar.enable ) ) { |
55 | 55 | return true; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | |
3 | | -js2AddOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.highlight&&wgWikiEditorPreferences.highlight.enable)){return true;} |
4 | | -if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','highlight');}});js2AddOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.preview&&wgWikiEditorPreferences.preview.enable)){return true;} |
5 | | -if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','preview');}});js2AddOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.publish&&wgWikiEditorPreferences.publish.enable)){return true;} |
6 | | -if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','publish');}});js2AddOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.toc&&wgWikiEditorPreferences.toc.enable)){return true;} |
7 | | -if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','toc');}});js2AddOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.toolbar&&wgWikiEditorPreferences.toolbar.enable)){return true;} |
| 3 | +mw.addOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.highlight&&wgWikiEditorPreferences.highlight.enable)){return true;} |
| 4 | +if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','highlight');}});mw.addOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.preview&&wgWikiEditorPreferences.preview.enable)){return true;} |
| 5 | +if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','preview');}});mw.addOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.publish&&wgWikiEditorPreferences.publish.enable)){return true;} |
| 6 | +if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','publish');}});mw.addOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.toc&&wgWikiEditorPreferences.toc.enable)){return true;} |
| 7 | +if($j.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','toc');}});mw.addOnloadHook(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.toolbar&&wgWikiEditorPreferences.toolbar.enable)){return true;} |
8 | 8 | if(wgWikiEditorPreferences.toolbar.dialogs){$j('#wpTextbox1').addClass('toolbar-dialogs');} |
9 | 9 | if($j.wikiEditor){$j('#toolbar').remove();$j('#wpTextbox1').wikiEditor('addModule',{'toolbar':{'main':{type:'toolbar',groups:{'format':{tools:{'bold':{labelMsg:'wikieditor-toolbar-tool-bold',type:'button',icon:{'default':'format-bold.png','en':'format-bold-B.png','de':'format-bold-F.png','fr':'format-bold-G.png','es':'format-bold-G.png','nl':'format-bold-V.png','pt':'format-bold-N.png','pt-br':'format-bold-N.png','pl':'format-bold-P.png'},action:{type:'encapsulate',options:{pre:"'''",periMsg:'wikieditor-toolbar-tool-bold-example',post:"'''"}}},'italic':{section:'main',group:'format',id:'italic',labelMsg:'wikieditor-toolbar-tool-italic',type:'button',icon:{'default':'format-italic.png','en':'format-italic-I.png','de':'format-italic-K.png','fr':'format-italic-I.png','es':'format-italic-C.png','nl':'format-italic-C.png','pt':'format-italic-I.png','pt-br':'format-italic-I.png','pl':'format-italic-K.png'},action:{type:'encapsulate',options:{pre:"''",periMsg:'wikieditor-toolbar-tool-italic-example',post:"''"}}}}},'insert':{tools:{'xlink':{labelMsg:'wikieditor-toolbar-tool-xlink',type:'button',icon:'insert-xlink.png',filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"[",periMsg:'wikieditor-toolbar-tool-xlink-example',post:"]"}}},'ilink':{labelMsg:'wikieditor-toolbar-tool-ilink',type:'button',icon:'insert-ilink.png',filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"[[",periMsg:'wikieditor-toolbar-tool-ilink-example',post:"]]"}}},'linkCGD':{labelMsg:'wikieditor-toolbar-tool-link',type:'button',icon:'insert-link.png',filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'insert-link'}},'file':{labelMsg:'wikieditor-toolbar-tool-file',type:'button',icon:'insert-file.png',action:{type:'encapsulate',options:{pre:"[[",preMsg:'wikieditor-toolbar-tool-file-pre',periMsg:'wikieditor-toolbar-tool-file-example',post:"]]"}}},'reference':{labelMsg:'wikieditor-toolbar-tool-reference',filters:['body.ns-subject'],type:'button',icon:'insert-reference.png',action:{type:'encapsulate',options:{pre:"<ref>",periMsg:'wikieditor-toolbar-tool-reference-example',post:"</ref>"}}},'signature':{labelMsg:'wikieditor-toolbar-tool-signature',filters:['body:not(.ns-0)'],type:'button',icon:'insert-signature.png',action:{type:'encapsulate',options:{post:"--~~~~"}}}}}}},'advanced':{labelMsg:'wikieditor-toolbar-section-advanced',type:'toolbar',groups:{'heading':{tools:{'heading':{labelMsg:'wikieditor-toolbar-tool-heading',type:'select',list:{'heading-2':{labelMsg:'wikieditor-toolbar-tool-heading-2',action:{type:'replace',options:{pre:'==',periMsg:'wikieditor-toolbar-tool-heading-example',post:'==',regex:/^(\s*)(={0,6})(.*?)\2(\s*)$/,regexReplace:"\$1==\$3==\$4"}}},'heading-3':{labelMsg:'wikieditor-toolbar-tool-heading-3',action:{type:'replace',options:{pre:'===',periMsg:'wikieditor-toolbar-tool-heading-example',post:'===',regex:/^(\s*)(={0,6})(.*?)\2(\s*)$/,regexReplace:"\$1===\$3===\$4"}}},'heading-4':{labelMsg:'wikieditor-toolbar-tool-heading-4',action:{type:'replace',options:{pre:'====',periMsg:'wikieditor-toolbar-tool-heading-example',post:'====',regex:/^(\s*)(={0,6})(.*?)\2(\s*)$/,regexReplace:"\$1====\$3====\$4"}}},'heading-5':{labelMsg:'wikieditor-toolbar-tool-heading-5',action:{type:'replace',options:{pre:'=====',periMsg:'wikieditor-toolbar-tool-heading-example',post:'=====',regex:/^(\s*)(={0,6})(.*?)\2(\s*)$/,regexReplace:"\$1=====\$3=====\$4"}}}}}}},'list':{labelMsg:'wikieditor-toolbar-group-list',tools:{'ulist':{labelMsg:'wikieditor-toolbar-tool-ulist',type:'button',icon:'format-ulist.png',action:{type:'encapsulate',options:{pre:"* ",periMsg:'wikieditor-toolbar-tool-ulist-example',post:"",ownline:true}}},'olist':{labelMsg:'wikieditor-toolbar-tool-olist',type:'button',icon:'format-olist.png',action:{type:'encapsulate',options:{pre:"# ",periMsg:'wikieditor-toolbar-tool-olist-example',post:"",ownline:true}}},'indent':{labelMsg:'wikieditor-toolbar-tool-indent',type:'button',icon:'format-indent.png',action:{type:'encapsulate',options:{pre:":",periMsg:'wikieditor-toolbar-tool-indent-example',post:"",ownline:true}}}}},'size':{labelMsg:'wikieditor-toolbar-group-size',tools:{'big':{labelMsg:'wikieditor-toolbar-tool-big',type:'button',icon:'format-big.png',action:{type:'encapsulate',options:{pre:"<big>",periMsg:'wikieditor-toolbar-tool-big-example',post:"</big>"}}},'small':{labelMsg:'wikieditor-toolbar-tool-small',type:'button',icon:'format-small.png',action:{type:'encapsulate',options:{pre:"<small>",periMsg:'wikieditor-toolbar-tool-small-example',post:"</small>"}}}}},'baseline':{labelMsg:'wikieditor-toolbar-group-baseline',tools:{'superscript':{labelMsg:'wikieditor-toolbar-tool-superscript',type:'button',icon:'format-superscript.png',action:{type:'encapsulate',options:{pre:"<sup>",periMsg:'wikieditor-toolbar-tool-superscript-example',post:"</sup>"}}},'subscript':{labelMsg:'wikieditor-toolbar-tool-subscript',type:'button',icon:'format-subscript.png',action:{type:'encapsulate',options:{pre:"<sub>",periMsg:'wikieditor-toolbar-tool-subscript-example',post:"</sub>"}}}}},'insert':{labelMsg:'wikieditor-toolbar-group-insert',tools:{'gallery':{labelMsg:'wikieditor-toolbar-tool-gallery',type:'button',icon:'insert-gallery.png',action:{type:'encapsulate',options:{pre:"<gallery>\n",periMsg:'wikieditor-toolbar-tool-gallery-example',post:"\n</gallery>",ownline:true}}},'tableCGD':{labelMsg:'wikieditor-toolbar-tool-table',type:'button',icon:'insert-table.png',filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'insert-table'}},'table':{labelMsg:'wikieditor-toolbar-tool-table',type:'button',icon:'insert-table.png',filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"{| class=\"wikitable\" border=\"1\"\n|",periMsg:'wikieditor-toolbar-tool-table-example-old',post:"\n|}",ownline:true}}},'newline':{labelMsg:'wikieditor-toolbar-tool-newline',type:'button',icon:'insert-newline.png',action:{type:'encapsulate',options:{pre:"<br />\n"}}}}},'search':{tools:{'replace':{labelMsg:'wikieditor-toolbar-tool-replace',type:'button',icon:'search-replace.png',filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'search-and-replace'}}}}}},'characters':{labelMsg:'wikieditor-toolbar-section-characters',type:'booklet',pages:{'latin':{'labelMsg':'wikieditor-toolbar-characters-page-latin','layout':'characters','characters':["\u00c1","\u00e1","\u00c0","\u00e0","\u00c2","\u00e2","\u00c4","\u00e4","\u00c3","\u00e3","\u01cd","\u01ce","\u0100","\u0101","\u0102","\u0103","\u0104","\u0105","\u00c5","\u00e5","\u0106","\u0107","\u0108","\u0109","\u00c7","\u00e7","\u010c","\u010d","\u010a","\u010b","\u0110","\u0111","\u010e","\u010f","\u00c9","\u00e9","\u00c8","\u00e8","\u00ca","\u00ea","\u00cb","\u00eb","\u011a","\u011b","\u0112","\u0113","\u0114","\u0115","\u0116","\u0117","\u0118","\u0119","\u011c","\u011d","\u0122","\u0123","\u011e","\u011f","\u0120","\u0121","\u0124","\u0125","\u0126","\u0127","\u00cd","\u00ed","\u00cc","\u00ec","\u00ce","\u00ee","\u00cf","\u00ef","\u0128","\u0129","\u01cf","\u01d0","\u012a","\u012b","\u012c","\u012d","\u0130","\u0131","\u012e","\u012f","\u0134","\u0135","\u0136","\u0137","\u0139","\u013a","\u013b","\u013c","\u013d","\u013e","\u0141","\u0142","\u013f","\u0140","\u0143","\u0144","\u00d1","\u00f1","\u0145","\u0146","\u0147","\u0148","\u00d3","\u00f3","\u00d2","\u00f2","\u00d4","\u00f4","\u00d6","\u00f6","\u00d5","\u00f5","\u01d1","\u01d2","\u014c","\u014d","\u014e","\u014f","\u01ea","\u01eb","\u0150","\u0151","\u0154","\u0155","\u0156","\u0157","\u0158","\u0159","\u015a","\u015b","\u015c","\u015d","\u015e","\u015f","\u0160","\u0161","\u0162","\u0163","\u0164","\u0165","\u00da","\u00fa","\u00d9","\u00f9","\u00db","\u00fb","\u00dc","\u00fc","\u0168","\u0169","\u016e","\u016f","\u01d3","\u01d4","\u016a","\u016b","\u01d6","\u01d8","\u01da","\u01dc","\u016c","\u016d","\u0172","\u0173","\u0170","\u0171","\u0174","\u0175","\u00dd","\u00fd","\u0176","\u0177","\u0178","\u00ff","\u0232","\u0233","\u0179","\u017a","\u017d","\u017e","\u017b","\u017c","\u00c6","\u00e6","\u01e2","\u01e3","\u00d8","\u00f8","\u0152","\u0153","\u00df","\u00f0","\u00de","\u00fe","\u018f","\u0259"]},'latinextended':{'labelMsg':'wikieditor-toolbar-characters-page-latinextended','layout':'characters','characters':["\u1e00","\u1e01","\u1e9a","\u1ea0","\u1ea1","\u1ea2","\u1ea3","\u1ea4","\u1ea5","\u1ea6","\u1ea7","\u1ea8","\u1ea9","\u1eaa","\u1eab","\u1eac","\u1ead","\u1eae","\u1eaf","\u1eb0","\u1eb1","\u1eb2","\u1eb3","\u1eb4","\u1eb5","\u1eb6","\u1eb7","\u1e02","\u1e03","\u1e04","\u1e05","\u1e06","\u1e07","\u1e08","\u1e09","\u1e0a","\u1e0b","\u1e0c","\u1e0d","\u1e0e","\u1e0f","\u1e10","\u1e11","\u1e12","\u1e13","\u1e14","\u1e15","\u1e16","\u1e17","\u1e18","\u1e19","\u1e1a","\u1e1b","\u1e1c","\u1e1d","\u1eb8","\u1eb9","\u1eba","\u1ebb","\u1ebc","\u1ebd","\u1ebe","\u1ebf","\u1ec0","\u1ec1","\u1ec2","\u1ec3","\u1ec4","\u1ec5","\u1ec6","\u1ec7","\u1e1e","\u1e1f","\u1e20","\u1e21","\u1e22","\u1e23","\u1e24","\u1e25","\u1e26","\u1e27","\u1e28","\u1e29","\u1e2a","\u1e2b","\u1e96","\u1e2c","\u1e2d","\u1e2e","\u1e2f","\u1ec8","\u1ec9","\u1eca","\u1ecb","\u1e30","\u1e31","\u1e32","\u1e33","\u1e34","\u1e35","\u1e36","\u1e37","\u1e38","\u1e39","\u1e3a","\u1e3b","\u1e3c","\u1e3d","\u1efa","\u1efb","\u1e3e","\u1e3f","\u1e40","\u1e41","\u1e42","\u1e43","\u1e44","\u1e45","\u1e46","\u1e47","\u1e48","\u1e49","\u1e4a","\u1e4b","\u1e4c","\u1e4d","\u1e4e","\u1e4f","\u1e50","\u1e51","\u1e52","\u1e53","\u1ecc","\u1ecd","\u1ece","\u1ecf","\u1ed0","\u1ed1","\u1ed2","\u1ed3","\u1ed4","\u1ed5","\u1ed6","\u1ed7","\u1ed8","\u1ed9","\u1eda","\u1edb","\u1edc","\u1edd","\u1ede","\u1edf","\u1ee0","\u1ee1","\u1ee2","\u1ee3","\u1e54","\u1e55","\u1e56","\u1e57","\u1e58","\u1e59","\u1e5a","\u1e5b","\u1e5c","\u1e5d","\u1e5e","\u1e5f","\u1e60","\u1e61","\u1e9b","\u1e62","\u1e63","\u1e64","\u1e65","\u1e66","\u1e67","\u1e68","\u1e69","\u1e9c","\u1e9d","\u1e6a","\u1e6b","\u1e6c","\u1e6d","\u1e6e","\u1e6f","\u1e70","\u1e71","\u1e97","\u1e72","\u1e73","\u1e74","\u1e75","\u1e76","\u1e77","\u1e78","\u1e79","\u1e7a","\u1e7b","\u1ee4","\u1ee5","\u1ee6","\u1ee7","\u1ee8","\u1ee9","\u1eea","\u1eeb","\u1eec","\u1eed","\u1eee","\u1eef","\u1ef0","\u1ef1","\u1e7c","\u1e7d","\u1e7e","\u1e7f","\u1efc","\u1efd","\u1e80","\u1e81","\u1e82","\u1e83","\u1e84","\u1e85","\u1e86","\u1e87","\u1e88","\u1e89","\u1e98","\u1e8a","\u1e8b","\u1e8c","\u1e8d","\u1e8e","\u1e8f","\u1e99","\u1ef2","\u1ef3","\u1ef4","\u1ef5","\u1ef6","\u1ef7","\u1ef8","\u1ef9","\u1efe","\u1eff","\u1e90","\u1e91","\u1e92","\u1e93","\u1e94","\u1e95","\u1e9e","\u1e9f"]},'ipa':{labelMsg:'wikieditor-toolbar-characters-page-ipa',layout:'characters',characters:["p","t\u032a","t","\u0288","c","k","q","\u02a1","\u0294","b","d\u032a","d","\u0256","\u025f","\u0261","\u0262","\u0253","\u0257","\u0284","\u0260","\u029b","t\u0361s","t\u0361\u0283","t\u0361\u0255","d\u0361z","d\u0361\u0292","d\u0361\u0291","\u0278","f","\u03b8","s","\u0283","\u0285","\u0286","\u0282","\u0255","\u00e7","\u0267","x","\u03c7","\u0127","\u029c","h","\u03b2","v","\u028d","\u00f0","z","\u0292","\u0293","\u0290","\u0291","\u029d","\u0263","\u0281","\u0295","\u0296","\u02a2","\u0266","\u026c","\u026e","m","m\u0329","\u0271","\u0271\u0329","\u0271\u030d","n\u032a","n\u032a\u030d","n","n\u0329","\u0273","\u0273\u0329","\u0272","\u0272\u0329","\u014b","\u014b\u030d","\u014b\u0329","\u0274","\u0274\u0329","\u0299","\u0299\u0329","r","r\u0329","\u0280","\u0280\u0329","\u027e","\u027d","\u027f","\u027a","l\u032a","l\u032a\u0329","l","l\u0329","\u026b","\u026b\u0329","\u026d","\u026d\u0329","\u028e","\u028e\u0329","\u029f","\u029f\u0329","w","\u0265","\u028b","\u0279","\u027b","j","\u0270","\u0298","\u01c2","\u01c0","!","\u01c1","\u02b0","\u02b1","\u02b7","\u02b8","\u02b2","\u02b3","\u207f","\u02e1","\u02b4","\u02b5","\u02e2","\u02e3","\u02e0","\u02b6","\u02e4","\u02c1","\u02c0","\u02bc","i","i\u032f","\u0129","y","y\u032f","\u1ef9","\u026a","\u026a\u032f","\u026a\u0303","\u028f","\u028f\u032f","\u028f\u0303","\u0268","\u0268\u032f","\u0268\u0303","\u0289","\u0289\u032f","\u0289\u0303","\u026f","\u026f\u032f","\u026f\u0303","u","u\u032f","\u0169","\u028a","\u028a\u032f","\u028a\u0303","e","e\u032f","\u1ebd","\u00f8","\u00f8\u032f","\u00f8\u0303","\u0258","\u0258\u032f","\u0258\u0303","\u0275","\u0275\u032f","\u0275\u0303","\u0264","\u0264\u032f","\u0264\u0303","o","o\u032f","\u00f5","\u025b","\u025b\u032f","\u025b\u0303","\u0153","\u0153\u032f","\u0153\u0303","\u025c","\u025c\u032f","\u025c\u0303","\u0259","\u0259\u032f","\u0259\u0303","\u025e","\u025e\u032f","\u025e\u0303","\u028c","\u028c\u032f","\u028c\u0303","\u0254","\u0254\u032f","\u0254\u0303","\u00e6","\u00e6\u032f","\u00e6\u0303","\u0276","\u0276\u032f","\u0276\u0303","a","a\u032f","\u00e3","\u0250","\u0250\u032f","\u0250\u0303","\u0251","\u0251\u032f","\u0251\u0303","\u0252","\u0252\u032f","\u0252\u0303","\u02c8","\u02cc","\u02d0","\u02d1","\u02d8",".","\u203f","|","\u2016"]},'symbols':{'labelMsg':'wikieditor-toolbar-characters-page-symbols','layout':'characters','characters':["~","|","\u00a1","\u00bf","\u2020","\u2021","\u2194","\u2191","\u2193","\u2022","\u00b6","#","\u00bd","\u2153","\u2154","\u00bc","\u00be","\u215b","\u215c","\u215d","\u215e","\u221e","\u2018","\u201c","\u2019","\u201d",{'label':"\u00ab\u00bb",'action':{'type':'encapsulate','options':{'pre':"\u00ab",'post':"\u00bb"}}},"\u00a4","\u20b3","\u0e3f","\u20b5","\u00a2","\u20a1","\u20a2","$","\u20ab","\u20af","\u20ac","\u20a0","\u20a3","\u0192","\u20b4","\u20ad","\u20a4","\u2133","\u20a5","\u20a6","\u2116","\u20a7","\u20b0","\u00a3","\u17db","\u20a8","\u20aa","\u09f3","\u20ae","\u20a9","\u00a5","\u2660","\u2663","\u2665","\u2666","m\u00b2","m\u00b3","\u2013","\u2014","\u2026","\u2018","\u201c","\u2019","\u201d","\u00b0","\u2033","\u2032","\u2248","\u2260","\u2264","\u2265","\u00b1","\u2212","\u00d7","\u00f7","\u2190","\u2192","\u00b7","\u00a7"]},'greek':{'labelMsg':'wikieditor-toolbar-characters-page-greek','layout':'characters','language':'hl','characters':["\u0391","\u0386","\u03b1","\u03ac","\u0392","\u03b2","\u0393","\u03b3","\u0394","\u03b4","\u0395","\u0388","\u03b5","\u03ad","\u0396","\u03b6","\u0397","\u0389","\u03b7","\u03ae","\u0398","\u03b8","\u0399","\u038a","\u03b9","\u03af","\u039a","\u03ba","\u039b","\u03bb","\u039c","\u03bc","\u039d","\u03bd","\u039e","\u03be","\u039f","\u038c","\u03bf","\u03cc","\u03a0","\u03c0","\u03a1","\u03c1","\u03a3","\u03c3","\u03c2","\u03a4","\u03c4","\u03a5","\u038e","\u03c5","\u03cd","\u03a6","\u03c6","\u03a7","\u03c7","\u03a8","\u03c8","\u03a9","\u038f","\u03c9","\u03ce"]},'cyrillic':{'labelMsg':'wikieditor-toolbar-characters-page-cyrillic','layout':'characters','characters':["\u0410","\u0430","\u04d8","\u04d9","\u0411","\u0431","\u0412","\u0432","\u0413","\u0433","\u0490","\u0491","\u0403","\u0453","\u0492","\u0493","\u0414","\u0434","\u0402","\u0452","\u0415","\u0435","\u0404","\u0454","\u0401","\u0451","\u0416","\u0436","\u0417","\u0437","\u0405","\u0455","\u0418","\u0438","\u0406","\u0456","\u0407","\u0457","\u0130","\u0419","\u0439","\u04e2","\u04e3","\u0408","\u0458","\u041a","\u043a","\u040c","\u045c","\u049a","\u049b","\u041b","\u043b","\u0409","\u0459","\u041c","\u043c","\u041d","\u043d","\u040a","\u045a","\u04a2","\u04a3","\u041e","\u043e","\u04e8","\u04e9","\u041f","\u043f","\u0420","\u0440","\u0421","\u0441","\u0422","\u0442","\u040b","\u045b","\u0423","\u0443","\u040e","\u045e","\u04ee","\u04ef","\u04b0","\u04b1","\u04ae","\u04af","\u0424","\u0444","\u0425","\u0445","\u04b2","\u04b3","\u04ba","\u04bb","\u0426","\u0446","\u0427","\u0447","\u04b6","\u04b7","\u040f","\u045f","\u0428","\u0448","\u0429","\u0449","\u042a","\u044a","\u042b","\u044b","\u042c","\u044c","\u042d","\u044d","\u042e","\u044e","\u042f","\u044f"]},'arabic':{'labelMsg':'wikieditor-toolbar-characters-page-arabic','layout':'characters','language':'ar','direction':'rtl','characters':["\u061b","\u061f","\u0621","\u0622","\u0623","\u0624","\u0625","\u0626","\u0627","\u0628","\u0629","\u062a","\u062b","\u062c","\u062d","\u062e","\u062f","\u0630","\u0631","\u0632","\u0633","\u0634","\u0635","\u0636","\u0637","\u0638","\u0639","\u063a","\u0641","\u0642","\u0643","\u0644","\u0645","\u0646","\u0647","\u0648","\u0649","\u064a","\u060c","\u067e","\u0686","\u0698","\u06af","\u06ad"]},'hebrew':{'labelMsg':'wikieditor-toolbar-characters-page-hebrew','layout':'characters','direction':'rtl','characters':["\u05d0","\u05d1","\u05d2","\u05d3","\u05d4","\u05d5","\u05d6","\u05d7","\u05d8","\u05d9","\u05db","\u05da","\u05dc","\u05de","\u05dd","\u05e0","\u05df","\u05e1","\u05e2","\u05e4","\u05e3","\u05e6","\u05e5","\u05e7","\u05e8","\u05e9","\u05ea","\u05f3","\u05f4","\u05f0","\u05f1","\u05f2","\u05d0","\u05d3","\u05d4","\u05d5","\u05d6","\u05d7","\u05d8","\u05d9","\u05da","\u05db","\u05dc","\u05dd","\u05de","\u05df","\u05e0","\u05e1","\u05e2","\u05e3","\u05e4","\u05be","\u05f3","\u05f4",["\u05b0\u25cc","\u05b0"],["\u05b1\u25cc","\u05b1"],["\u05b2\u25cc","\u05b2"],["\u05b3\u25cc","\u05b3"],["\u05b4\u25cc","\u05b4"],["\u05b5\u25cc","\u05b5"],["\u05b6\u25cc","\u05b6"],["\u05b7\u25cc","\u05b7"],["\u05b8\u25cc","\u05b8"],["\u05b9\u25cc","\u05b9"],["\u05bb\u25cc","\u05bb"],["\u05bc\u25cc","\u05bc"],["\u05c1\u25cc","\u05c1"],["\u05c2\u25cc","\u05c2"],["\u05c7\u25cc","\u05c7"],["\u0591\u25cc","\u0591"],["\u0592\u25cc","\u0592"],["\u0593\u25cc","\u0593"],["\u0594\u25cc","\u0594"],["\u0595\u25cc","\u0595"],["\u0596\u25cc","\u0596"],["\u0597\u25cc","\u0597"],["\u0598\u25cc","\u0598"],["\u0599\u25cc","\u0599"],["\u059a\u25cc","\u059a"],["\u059b\u25cc","\u059b"],["\u059c\u25cc","\u059c"],["\u059d\u25cc","\u059d"],["\u059e\u25cc","\u059e"],["\u059f\u25cc","\u059f"],["\u05a0\u25cc","\u05a0"],["\u05a1\u25cc","\u05a1"],["\u05a2\u25cc","\u05a2"],["\u05a3\u25cc","\u05a3"],["\u05a4\u25cc","\u05a4"],["\u05a5\u25cc","\u05a5"],["\u05a6\u25cc","\u05a6"],["\u05a7\u25cc","\u05a7"],["\u05a8\u25cc","\u05a8"],["\u05a9\u25cc","\u05a9"],["\u05aa\u25cc","\u05aa"],["\u05ab\u25cc","\u05ab"],["\u05ac\u25cc","\u05ac"],["\u05ad\u25cc","\u05ad"],["\u05ae\u25cc","\u05ae"],["\u05af\u25cc","\u05af"],["\u05bf\u25cc","\u05bf"],["\u05c0\u25cc","\u05c0"],["\u05c3\u25cc","\u05c3"]]},'telugu':{'labelMsg':'wikieditor-toolbar-characters-page-telugu','language':'te','layout':'characters','characters':["\u0c01","\u0c02","\u0c03","\u0c05","\u0c06","\u0c07","\u0c08","\u0c09","\u0c0a","\u0c0b","\u0c60","\u0c0c","\u0c61","\u0c0e","\u0c0f","\u0c10","\u0c12","\u0c13","\u0c14","\u0c15","\u0c16","\u0c17","\u0c18","\u0c19","\u0c1a","\u0c1b","\u0c1c","\u0c1d","\u0c1e","\u0c1f","\u0c20","\u0c21","\u0c22","\u0c23","\u0c24","\u0c25","\u0c26","\u0c27","\u0c28","\u0c2a","\u0c2b","\u0c2c","\u0c2d","\u0c2e","\u0c2f","\u0c30","\u0c31","\u0c32","\u0c33","\u0c35","\u0c36","\u0c37","\u0c38","\u0c39","\u0c3e","\u0c3f","\u0c40","\u0c41","\u0c42","\u0c43","\u0c44","\u0c46","\u0c47","\u0c48","\u0c4a","\u0c4b","\u0c4c","\u0c4d","\u0c62","\u0c63","\u0c58","\u0c59","\u0c66","\u0c67","\u0c68","\u0c69","\u0c6a","\u0c6b","\u0c6c","\u0c6d","\u0c6e","\u0c6f","\u0c3d","\u0c78","\u0c79","\u0c7a","\u0c7b","\u0c7c","\u0c7d","\u0c7e","\u0c7f"]},'sinhala':{'labelMsg':'wikieditor-toolbar-characters-page-sinhala','language':'si','layout':'characters','characters':["\u0d85","\u0d86","\u0d87","\u0d88","\u0d89","\u0d8a","\u0d8b","\u0d8c","\u0d8d","\u0d8e","\u0d8f","\u0d90","\u0d91","\u0d92","\u0d93","\u0d94","\u0d95","\u0d96","\u0d9a","\u0d9b","\u0d9c","\u0d9d","\u0d9e","\u0d9f","\u0da0","\u0da1","\u0da2","\u0da3","\u0da4","\u0da5","\u0da6","\u0da7","\u0da8","\u0da9","\u0daa","\u0dab","\u0dac","\u0dad","\u0dae","\u0daf","\u0db0","\u0db1","\u0db3","\u0db4","\u0db5","\u0db6","\u0db7","\u0db8","\u0db9","\u0dba","\u0dbb","\u0dbd","\u0dc0","\u0dc1","\u0dc2","\u0dc3","\u0dc4","\u0dc5","\u0dc6",["\u25cc\u0dcf","\u0dcf"],["\u25cc\u0dd0","\u0dd0"],["\u25cc\u0dd1","\u0dd1"],["\u25cc\u0dd2","\u0dd2"],["\u25cc\u0dd3","\u0dd3"],["\u25cc\u0dd4","\u0dd4"],["\u25cc\u0dd6","\u0dd6"],["\u25cc\u0dd8","\u0dd8"],["\u25cc\u0df2","\u0df2"],["\u25cc\u0ddf","\u0ddf"],["\u25cc\u0df3","\u0df3"],["\u25cc\u0dd9","\u0dd9"],["\u25cc\u0dda","\u0dda"],["\u25cc\u0ddc","\u0ddc"],["\u25cc\u0ddd","\u0ddd"],["\u25cc\u0dde","\u0dde"],["\u25cc\u0dca","\u0dca"]]},'gujarati':{'labelMsg':'wikieditor-toolbar-characters-page-gujarati','language':'gu','layout':'characters','characters':["\u0ad0","\u0a85","\u0a86","\u0a87","\u0a88","\u0a89","\u0a8a","\u0a8b","\u0ae0","\u0a8c","\u0ae1","\u0a8d","\u0a8f","\u0a90","\u0a91","\u0a93","\u0a94","\u0a95","\u0a96","\u0a97","\u0a98","\u0a99","\u0a9a","\u0a9b","\u0a9c","\u0a9d","\u0a9e","\u0a9f","\u0aa0","\u0aa1","\u0aa2","\u0aa3","\u0aa4","\u0aa5","\u0aa6","\u0aa7","\u0aa8","\u0aaa","\u0aab","\u0aac","\u0aad","\u0aae","\u0aaf","\u0ab0","\u0ab2","\u0ab5","\u0ab6","\u0ab7","\u0ab8","\u0ab9","\u0ab3","\u0abd",["\u25cc\u0abe","\u0abe"],["\u25cc\u0abf","\u0abf"],["\u25cc\u0ac0","\u0ac0"],["\u25cc\u0ac1","\u0ac1"],["\u25cc\u0ac2","\u0ac2"],["\u25cc\u0ac3","\u0ac3"],["\u25cc\u0ac4","\u0ac4"],["\u25cc\u0ae2","\u0ae2"],["\u25cc\u0ae3","\u0ae3"],["\u25cc\u0ac5","\u0ac5"],["\u25cc\u0ac7","\u0ac7"],["\u25cc\u0ac8","\u0ac8"],["\u25cc\u0ac9","\u0ac9"],["\u25cc\u0acb","\u0acb"],["\u25cc\u0acc","\u0acc"],["\u25cc\u0acd","\u0acd"]]}}},'help':{labelMsg:'wikieditor-toolbar-section-help',type:'booklet',pages:{'format':{labelMsg:'wikieditor-toolbar-help-page-format',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-italic-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-italic-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-italic-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-bold-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-bold-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-bold-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-result'}}]},'link':{labelMsg:'wikieditor-toolbar-help-page-link',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-ilink-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-ilink-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-ilink-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-xlink-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-xlink-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-xlink-result'}}]},'heading':{labelMsg:'wikieditor-toolbar-help-page-heading',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading1-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading1-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading1-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading2-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading2-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading2-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading3-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading3-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading3-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading4-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading4-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading4-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading5-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading5-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading5-result'}}]},'list':{labelMsg:'wikieditor-toolbar-help-page-list',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-ulist-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-ulist-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-ulist-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-olist-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-olist-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-olist-result'}}]},'file':{labelMsg:'wikieditor-toolbar-help-page-file',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-file-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-file-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-file-result'}}]},'reference':{labelMsg:'wikieditor-toolbar-help-page-reference',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-reference-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-reference-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-reference-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-rereference-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-rereference-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-rereference-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-result'}}]},'discussion':{labelMsg:'wikieditor-toolbar-help-page-discussion',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-signature-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-signature-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-signature-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-indent-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-indent-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-indent-result'}}]}}}},'dialogs':{'insert-link':{titleMsg:'wikieditor-toolbar-tool-link-title',id:'wikieditor-toolbar-link-dialog',html:'\ |
10 | 10 | <fieldset><table style="width: 100%;"><tr>\ |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Highlight/Highlight.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Highlight module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for highlight |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.highlight && wgWikiEditorPreferences.highlight.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Preview/Preview.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Preview module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for preview |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.preview && wgWikiEditorPreferences.preview.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Toolbar module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for toolbar |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.toolbar && wgWikiEditorPreferences.toolbar.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toc/Toc.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Toc module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for toolbar |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.toc && wgWikiEditorPreferences.toc.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Publish/Publish.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for WikiEditor Publish module */ |
3 | 3 | |
4 | | -js2AddOnloadHook( function() { |
| 4 | +mw.addOnloadHook( function() { |
5 | 5 | // Check preferences for preview |
6 | 6 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.publish && wgWikiEditorPreferences.publish.enable ) ) { |
7 | 7 | return true; |
Index: trunk/extensions/Translate/js/quickedit.js |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | } |
89 | 89 | |
90 | 90 | /* |
91 | | -mvJsLoader.doLoadDepMode([ |
| 91 | +mw.load([ |
92 | 92 | [ '$j.ui' |
93 | 93 | ],[ |
94 | 94 | '$j.ui.resizable', |
Index: trunk/extensions/Translate/js/js2stopgap.js |
— | — | @@ -9,9 +9,9 @@ |
10 | 10 | * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) |
11 | 11 | * Revision: 6246 |
12 | 12 | */ |
13 | | -( function() { |
| 13 | +(function(){ |
14 | 14 | |
15 | | -var |
| 15 | +var |
16 | 16 | // Will speed up references to window, and allows munging its name. |
17 | 17 | window = this, |
18 | 18 | // Will speed up references to undefined, and allows munging its name. |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | // (both of which we optimize for) |
32 | 32 | quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
33 | 33 | // Is it a simple selector |
34 | | - isSimple = / ^ .[ ^ :# \[\.,]*$/; |
| 34 | + isSimple = /^.[^:#\[\.,]*$/; |
35 | 35 | |
36 | 36 | jQuery.fn = jQuery.prototype = { |
37 | 37 | init: function( selector, context ) { |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | var match = quickExpr.exec( selector ); |
52 | 52 | |
53 | 53 | // Verify a match, and that no context was specified for #id |
54 | | - if ( match && ( match[1] || !context ) ) { |
| 54 | + if ( match && (match[1] || !context) ) { |
55 | 55 | |
56 | 56 | // HANDLE: $(html) -> $(array) |
57 | 57 | if ( match[1] ) |
— | — | @@ -88,9 +88,9 @@ |
89 | 89 | this.context = selector.context; |
90 | 90 | } |
91 | 91 | |
92 | | - return this.setArray( jQuery.isArray( selector ) ? |
| 92 | + return this.setArray(jQuery.isArray( selector ) ? |
93 | 93 | selector : |
94 | | - jQuery.makeArray( selector ) ); |
| 94 | + jQuery.makeArray(selector)); |
95 | 95 | }, |
96 | 96 | |
97 | 97 | // Start with an empty selector |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | ret.context = this.context; |
130 | 130 | |
131 | 131 | if ( name === "find" ) |
132 | | - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; |
| 132 | + ret.selector = this.selector + (this.selector ? " " : "") + selector; |
133 | 133 | else if ( name ) |
134 | 134 | ret.selector = this.selector + "." + name + "(" + selector + ")"; |
135 | 135 | |
— | — | @@ -174,12 +174,12 @@ |
175 | 175 | return this[0] && jQuery[ type || "attr" ]( this[0], name ); |
176 | 176 | |
177 | 177 | else { |
178 | | - options = { }; |
| 178 | + options = {}; |
179 | 179 | options[ name ] = value; |
180 | 180 | } |
181 | 181 | |
182 | 182 | // Check to see if we're setting style values |
183 | | - return this.each( function( i ) { |
| 183 | + return this.each(function(i){ |
184 | 184 | // Set all the styles |
185 | 185 | for ( name in options ) |
186 | 186 | jQuery.attr( |
— | — | @@ -188,30 +188,30 @@ |
189 | 189 | this, |
190 | 190 | name, jQuery.prop( this, options[ name ], type, i, name ) |
191 | 191 | ); |
192 | | - } ); |
| 192 | + }); |
193 | 193 | }, |
194 | 194 | |
195 | 195 | css: function( key, value ) { |
196 | 196 | // ignore negative width and height values |
197 | | - if ( ( key == 'width' || key == 'height' ) && parseFloat( value ) < 0 ) |
| 197 | + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
198 | 198 | value = undefined; |
199 | 199 | return this.attr( key, value, "curCSS" ); |
200 | 200 | }, |
201 | 201 | |
202 | 202 | text: function( text ) { |
203 | 203 | if ( typeof text !== "object" && text != null ) |
204 | | - return this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( text ) ); |
| 204 | + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
205 | 205 | |
206 | 206 | var ret = ""; |
207 | 207 | |
208 | | - jQuery.each( text || this, function() { |
209 | | - jQuery.each( this.childNodes, function() { |
| 208 | + jQuery.each( text || this, function(){ |
| 209 | + jQuery.each( this.childNodes, function(){ |
210 | 210 | if ( this.nodeType != 8 ) |
211 | 211 | ret += this.nodeType != 1 ? |
212 | 212 | this.nodeValue : |
213 | 213 | jQuery.fn.text( [ this ] ); |
214 | | - } ); |
215 | | - } ); |
| 214 | + }); |
| 215 | + }); |
216 | 216 | |
217 | 217 | return ret; |
218 | 218 | }, |
— | — | @@ -219,60 +219,60 @@ |
220 | 220 | wrapAll: function( html ) { |
221 | 221 | if ( this[0] ) { |
222 | 222 | // The elements to wrap the target around |
223 | | - var wrap = jQuery( html, this[0].ownerDocument ). clone (); |
| 223 | + var wrap = jQuery( html, this[0].ownerDocument ).clone(); |
224 | 224 | |
225 | 225 | if ( this[0].parentNode ) |
226 | 226 | wrap.insertBefore( this[0] ); |
227 | 227 | |
228 | | - wrap.map( function() { |
| 228 | + wrap.map(function(){ |
229 | 229 | var elem = this; |
230 | 230 | |
231 | 231 | while ( elem.firstChild ) |
232 | 232 | elem = elem.firstChild; |
233 | 233 | |
234 | 234 | return elem; |
235 | | - } ).append( this ); |
| 235 | + }).append(this); |
236 | 236 | } |
237 | 237 | |
238 | 238 | return this; |
239 | 239 | }, |
240 | 240 | |
241 | 241 | wrapInner: function( html ) { |
242 | | - return this.each( function() { |
| 242 | + return this.each(function(){ |
243 | 243 | jQuery( this ).contents().wrapAll( html ); |
244 | | - } ); |
| 244 | + }); |
245 | 245 | }, |
246 | 246 | |
247 | 247 | wrap: function( html ) { |
248 | | - return this.each( function() { |
| 248 | + return this.each(function(){ |
249 | 249 | jQuery( this ).wrapAll( html ); |
250 | | - } ); |
| 250 | + }); |
251 | 251 | }, |
252 | 252 | |
253 | 253 | append: function() { |
254 | | - return this.domManip( arguments, true, function( elem ) { |
255 | | - if ( this.nodeType == 1 ) |
| 254 | + return this.domManip(arguments, true, function(elem){ |
| 255 | + if (this.nodeType == 1) |
256 | 256 | this.appendChild( elem ); |
257 | | - } ); |
| 257 | + }); |
258 | 258 | }, |
259 | 259 | |
260 | 260 | prepend: function() { |
261 | | - return this.domManip( arguments, true, function( elem ) { |
262 | | - if ( this.nodeType == 1 ) |
| 261 | + return this.domManip(arguments, true, function(elem){ |
| 262 | + if (this.nodeType == 1) |
263 | 263 | this.insertBefore( elem, this.firstChild ); |
264 | | - } ); |
| 264 | + }); |
265 | 265 | }, |
266 | 266 | |
267 | 267 | before: function() { |
268 | | - return this.domManip( arguments, false, function( elem ) { |
| 268 | + return this.domManip(arguments, false, function(elem){ |
269 | 269 | this.parentNode.insertBefore( elem, this ); |
270 | | - } ); |
| 270 | + }); |
271 | 271 | }, |
272 | 272 | |
273 | 273 | after: function() { |
274 | | - return this.domManip( arguments, false, function( elem ) { |
| 274 | + return this.domManip(arguments, false, function(elem){ |
275 | 275 | this.parentNode.insertBefore( elem, this.nextSibling ); |
276 | | - } ); |
| 276 | + }); |
277 | 277 | }, |
278 | 278 | |
279 | 279 | end: function() { |
— | — | @@ -292,16 +292,16 @@ |
293 | 293 | jQuery.find( selector, this[0], ret ); |
294 | 294 | return ret; |
295 | 295 | } else { |
296 | | - return this.pushStack( jQuery.unique( jQuery.map( this, function( elem ) { |
| 296 | + return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ |
297 | 297 | return jQuery.find( selector, elem ); |
298 | | - } ) ), "find", selector ); |
| 298 | + })), "find", selector ); |
299 | 299 | } |
300 | 300 | }, |
301 | 301 | |
302 | | - clone : function( events ) { |
| 302 | + clone: function( events ) { |
303 | 303 | // Do the clone |
304 | | - var ret = this.map( function() { |
305 | | - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc( this ) ) { |
| 304 | + var ret = this.map(function(){ |
| 305 | + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
306 | 306 | // IE copies events bound via attachEvent when |
307 | 307 | // using cloneNode. Calling detachEvent on the |
308 | 308 | // clone will also remove the events from the orignal |
— | — | @@ -312,21 +312,21 @@ |
313 | 313 | // the name attribute on an input). |
314 | 314 | var html = this.outerHTML; |
315 | 315 | if ( !html ) { |
316 | | - var div = this.ownerDocument.createElement( "div" ); |
317 | | - div.appendChild( this.cloneNode( true ) ); |
| 316 | + var div = this.ownerDocument.createElement("div"); |
| 317 | + div.appendChild( this.cloneNode(true) ); |
318 | 318 | html = div.innerHTML; |
319 | 319 | } |
320 | 320 | |
321 | | - return jQuery.clean( [ html.replace( / jQuery\d+="(?:\d+|null)"/g, "" ).replace( /^\s*/, "" ) ] )[0]; |
| 321 | + return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; |
322 | 322 | } else |
323 | | - return this.cloneNode( true ); |
324 | | - } ); |
| 323 | + return this.cloneNode(true); |
| 324 | + }); |
325 | 325 | |
326 | 326 | // Copy the events from the original to the clone |
327 | 327 | if ( events === true ) { |
328 | | - var orig = this.find( "*" ).andSelf(), i = 0; |
| 328 | + var orig = this.find("*").andSelf(), i = 0; |
329 | 329 | |
330 | | - ret.find( "*" ).andSelf().each( function() { |
| 330 | + ret.find("*").andSelf().each(function(){ |
331 | 331 | if ( this.nodeName !== orig[i].nodeName ) |
332 | 332 | return; |
333 | 333 | |
— | — | @@ -339,7 +339,7 @@ |
340 | 340 | } |
341 | 341 | |
342 | 342 | i++; |
343 | | - } ); |
| 343 | + }); |
344 | 344 | } |
345 | 345 | |
346 | 346 | // Return the cloned set |
— | — | @@ -349,30 +349,30 @@ |
350 | 350 | filter: function( selector ) { |
351 | 351 | return this.pushStack( |
352 | 352 | jQuery.isFunction( selector ) && |
353 | | - jQuery.grep( this, function( elem, i ) { |
| 353 | + jQuery.grep(this, function(elem, i){ |
354 | 354 | return selector.call( elem, i ); |
355 | | - } ) || |
| 355 | + }) || |
356 | 356 | |
357 | | - jQuery.multiFilter( selector, jQuery.grep( this, function( elem ) { |
| 357 | + jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ |
358 | 358 | return elem.nodeType === 1; |
359 | | - } ) ), "filter", selector ); |
| 359 | + }) ), "filter", selector ); |
360 | 360 | }, |
361 | 361 | |
362 | 362 | closest: function( selector ) { |
363 | | - var pos = jQuery.expr.match.POS.test( selector ) ? jQuery( selector ) : null, |
| 363 | + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
364 | 364 | closer = 0; |
365 | 365 | |
366 | | - return this.map( function() { |
| 366 | + return this.map(function(){ |
367 | 367 | var cur = this; |
368 | 368 | while ( cur && cur.ownerDocument ) { |
369 | | - if ( pos ? pos.index( cur ) > - 1 : jQuery( cur ).is( selector ) ) { |
370 | | - jQuery.data( cur, "closest", closer ); |
| 369 | + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
| 370 | + jQuery.data(cur, "closest", closer); |
371 | 371 | return cur; |
372 | 372 | } |
373 | 373 | cur = cur.parentNode; |
374 | 374 | closer++; |
375 | 375 | } |
376 | | - } ); |
| 376 | + }); |
377 | 377 | }, |
378 | 378 | |
379 | 379 | not: function( selector ) { |
— | — | @@ -384,9 +384,9 @@ |
385 | 385 | selector = jQuery.multiFilter( selector, this ); |
386 | 386 | |
387 | 387 | var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
388 | | - return this.filter( function() { |
| 388 | + return this.filter(function() { |
389 | 389 | return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
390 | | - } ); |
| 390 | + }); |
391 | 391 | }, |
392 | 392 | |
393 | 393 | add: function( selector ) { |
— | — | @@ -395,7 +395,7 @@ |
396 | 396 | typeof selector === "string" ? |
397 | 397 | jQuery( selector ) : |
398 | 398 | jQuery.makeArray( selector ) |
399 | | - ) ) ); |
| 399 | + ))); |
400 | 400 | }, |
401 | 401 | |
402 | 402 | is: function( selector ) { |
— | — | @@ -407,12 +407,12 @@ |
408 | 408 | }, |
409 | 409 | |
410 | 410 | val: function( value ) { |
411 | | - if ( value === undefined ) { |
| 411 | + if ( value === undefined ) { |
412 | 412 | var elem = this[0]; |
413 | 413 | |
414 | 414 | if ( elem ) { |
415 | | - if ( jQuery.nodeName( elem, 'option' ) ) |
416 | | - return ( elem.attributes.value || { } ).specified ? elem.value : elem.text; |
| 415 | + if( jQuery.nodeName( elem, 'option' ) ) |
| 416 | + return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
417 | 417 | |
418 | 418 | // We need to handle select boxes special |
419 | 419 | if ( jQuery.nodeName( elem, "select" ) ) { |
— | — | @@ -431,7 +431,7 @@ |
432 | 432 | |
433 | 433 | if ( option.selected ) { |
434 | 434 | // Get the specifc value for the option |
435 | | - value = jQuery( option ).val(); |
| 435 | + value = jQuery(option).val(); |
436 | 436 | |
437 | 437 | // We don't need an array for one selects |
438 | 438 | if ( one ) |
— | — | @@ -442,11 +442,11 @@ |
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | | - return values; |
| 446 | + return values; |
447 | 447 | } |
448 | 448 | |
449 | 449 | // Everything else, we just grab the value |
450 | | - return ( elem.value || "" ).replace( /\r/g, "" ); |
| 450 | + return (elem.value || "").replace(/\r/g, ""); |
451 | 451 | |
452 | 452 | } |
453 | 453 | |
— | — | @@ -456,35 +456,35 @@ |
457 | 457 | if ( typeof value === "number" ) |
458 | 458 | value += ''; |
459 | 459 | |
460 | | - return this.each( function() { |
| 460 | + return this.each(function(){ |
461 | 461 | if ( this.nodeType != 1 ) |
462 | 462 | return; |
463 | 463 | |
464 | | - if ( jQuery.isArray( value ) && / radio | checkbox / .test( this.type ) ) |
465 | | - this.checked = ( jQuery.inArray( this.value, value ) >= 0 || |
466 | | - jQuery.inArray( this.name, value ) >= 0 ); |
| 464 | + if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) |
| 465 | + this.checked = (jQuery.inArray(this.value, value) >= 0 || |
| 466 | + jQuery.inArray(this.name, value) >= 0); |
467 | 467 | |
468 | 468 | else if ( jQuery.nodeName( this, "select" ) ) { |
469 | | - var values = jQuery.makeArray( value ); |
| 469 | + var values = jQuery.makeArray(value); |
470 | 470 | |
471 | | - jQuery( "option", this ).each( function() { |
472 | | - this.selected = ( jQuery.inArray( this.value, values ) >= 0 || |
473 | | - jQuery.inArray( this.text, values ) >= 0 ); |
474 | | - } ); |
| 471 | + jQuery( "option", this ).each(function(){ |
| 472 | + this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
| 473 | + jQuery.inArray( this.text, values ) >= 0); |
| 474 | + }); |
475 | 475 | |
476 | 476 | if ( !values.length ) |
477 | | - this.selectedIndex = - 1; |
| 477 | + this.selectedIndex = -1; |
478 | 478 | |
479 | 479 | } else |
480 | 480 | this.value = value; |
481 | | - } ); |
| 481 | + }); |
482 | 482 | }, |
483 | 483 | |
484 | 484 | html: function( value ) { |
485 | 485 | return value === undefined ? |
486 | | - ( this[0] ? |
487 | | - this[0].innerHTML.replace( / jQuery\d+="(?:\d+|null)"/g, "" ) : |
488 | | - null ) : |
| 486 | + (this[0] ? |
| 487 | + this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : |
| 488 | + null) : |
489 | 489 | this.empty().append( value ); |
490 | 490 | }, |
491 | 491 | |
— | — | @@ -493,18 +493,18 @@ |
494 | 494 | }, |
495 | 495 | |
496 | 496 | eq: function( i ) { |
497 | | - return this.slice( i, + i + 1 ); |
| 497 | + return this.slice( i, +i + 1 ); |
498 | 498 | }, |
499 | 499 | |
500 | 500 | slice: function() { |
501 | 501 | return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
502 | | - "slice", Array.prototype.slice.call( arguments ).join( "," ) ); |
| 502 | + "slice", Array.prototype.slice.call(arguments).join(",") ); |
503 | 503 | }, |
504 | 504 | |
505 | 505 | map: function( callback ) { |
506 | | - return this.pushStack( jQuery.map( this, function( elem, i ) { |
| 506 | + return this.pushStack( jQuery.map(this, function(elem, i){ |
507 | 507 | return callback.call( elem, i, elem ); |
508 | | - } ) ); |
| 508 | + })); |
509 | 509 | }, |
510 | 510 | |
511 | 511 | andSelf: function() { |
— | — | @@ -513,14 +513,14 @@ |
514 | 514 | |
515 | 515 | domManip: function( args, table, callback ) { |
516 | 516 | if ( this[0] ) { |
517 | | - var fragment = ( this[0].ownerDocument || this[0] ).createDocumentFragment(), |
518 | | - scripts = jQuery.clean( args, ( this[0].ownerDocument || this[0] ), fragment ), |
| 517 | + var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), |
| 518 | + scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), |
519 | 519 | first = fragment.firstChild; |
520 | 520 | |
521 | 521 | if ( first ) |
522 | 522 | for ( var i = 0, l = this.length; i < l; i++ ) |
523 | | - callback.call( root( this[i], first ), this.length > 1 || i > 0 ? |
524 | | - fragment.cloneNode( true ) : fragment ); |
| 523 | + callback.call( root(this[i], first), this.length > 1 || i > 0 ? |
| 524 | + fragment.cloneNode(true) : fragment ); |
525 | 525 | |
526 | 526 | if ( scripts ) |
527 | 527 | jQuery.each( scripts, evalScript ); |
— | — | @@ -529,9 +529,9 @@ |
530 | 530 | return this; |
531 | 531 | |
532 | 532 | function root( elem, cur ) { |
533 | | - return table && jQuery.nodeName( elem, "table" ) && jQuery.nodeName( cur, "tr" ) ? |
534 | | - ( elem.getElementsByTagName( "tbody" )[0] || |
535 | | - elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) ) : |
| 533 | + return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
| 534 | + (elem.getElementsByTagName("tbody")[0] || |
| 535 | + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
536 | 536 | elem; |
537 | 537 | } |
538 | 538 | } |
— | — | @@ -542,11 +542,11 @@ |
543 | 543 | |
544 | 544 | function evalScript( i, elem ) { |
545 | 545 | if ( elem.src ) |
546 | | - jQuery.ajax( { |
| 546 | + jQuery.ajax({ |
547 | 547 | url: elem.src, |
548 | 548 | async: false, |
549 | 549 | dataType: "script" |
550 | | - } ); |
| 550 | + }); |
551 | 551 | |
552 | 552 | else |
553 | 553 | jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
— | — | @@ -555,25 +555,25 @@ |
556 | 556 | elem.parentNode.removeChild( elem ); |
557 | 557 | } |
558 | 558 | |
559 | | -function now() { |
560 | | - return + new Date; |
| 559 | +function now(){ |
| 560 | + return +new Date; |
561 | 561 | } |
562 | 562 | |
563 | 563 | jQuery.extend = jQuery.fn.extend = function() { |
564 | 564 | // copy reference to target object |
565 | | - var target = arguments[0] || { }, i = 1, length = arguments.length, deep = false, options; |
| 565 | + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
566 | 566 | |
567 | 567 | // Handle a deep copy situation |
568 | 568 | if ( typeof target === "boolean" ) { |
569 | 569 | deep = target; |
570 | | - target = arguments[1] || { }; |
| 570 | + target = arguments[1] || {}; |
571 | 571 | // skip the boolean and the target |
572 | 572 | i = 2; |
573 | 573 | } |
574 | 574 | |
575 | 575 | // Handle case when target is a string or something (possible in deep copy) |
576 | | - if ( typeof target !== "object" && !jQuery.isFunction( target ) ) |
577 | | - target = { }; |
| 576 | + if ( typeof target !== "object" && !jQuery.isFunction(target) ) |
| 577 | + target = {}; |
578 | 578 | |
579 | 579 | // extend jQuery itself if only one argument is passed |
580 | 580 | if ( length == i ) { |
— | — | @@ -583,7 +583,7 @@ |
584 | 584 | |
585 | 585 | for ( ; i < length; i++ ) |
586 | 586 | // Only deal with non-null/undefined values |
587 | | - if ( ( options = arguments[ i ] ) != null ) |
| 587 | + if ( (options = arguments[ i ]) != null ) |
588 | 588 | // Extend the base object |
589 | 589 | for ( var name in options ) { |
590 | 590 | var src = target[ name ], copy = options[ name ]; |
— | — | @@ -594,7 +594,7 @@ |
595 | 595 | |
596 | 596 | // Recurse if we're merging object values |
597 | 597 | if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
598 | | - target[ name ] = jQuery.extend( deep, |
| 598 | + target[ name ] = jQuery.extend( deep, |
599 | 599 | // Never move original objects, clone them |
600 | 600 | src || ( copy.length != null ? [ ] : { } ) |
601 | 601 | , copy ); |
— | — | @@ -610,12 +610,12 @@ |
611 | 611 | }; |
612 | 612 | |
613 | 613 | // exclude the following css properties to add px |
614 | | -var exclude = / z - ? index | font - ? weight | opacity | zoom | line - ? height /i, |
| 614 | +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
615 | 615 | // cache defaultView |
616 | | - defaultView = document.defaultView || { }, |
| 616 | + defaultView = document.defaultView || {}, |
617 | 617 | toString = Object.prototype.toString; |
618 | 618 | |
619 | | -jQuery.extend( { |
| 619 | +jQuery.extend({ |
620 | 620 | noConflict: function( deep ) { |
621 | 621 | window.$ = _$; |
622 | 622 | |
— | — | @@ -629,11 +629,11 @@ |
630 | 630 | // Since version 1.3, DOM methods and functions like alert |
631 | 631 | // aren't supported. They return false on IE (#2968). |
632 | 632 | isFunction: function( obj ) { |
633 | | - return toString.call( obj ) === "[object Function]"; |
| 633 | + return toString.call(obj) === "[object Function]"; |
634 | 634 | }, |
635 | 635 | |
636 | 636 | isArray: function( obj ) { |
637 | | - return toString.call( obj ) === "[object Array]"; |
| 637 | + return toString.call(obj) === "[object Array]"; |
638 | 638 | }, |
639 | 639 | |
640 | 640 | // check if an element is in a (or is an) XML document |
— | — | @@ -644,11 +644,11 @@ |
645 | 645 | |
646 | 646 | // Evalulates a script in a global context |
647 | 647 | globalEval: function( data ) { |
648 | | - if ( data && /\S/.test( data ) ) { |
| 648 | + if ( data && /\S/.test(data) ) { |
649 | 649 | // Inspired by code by Andrea Giammarchi |
650 | 650 | // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
651 | | - var head = document.getElementsByTagName( "head" )[0] || document.documentElement, |
652 | | - script = document.createElement( "script" ); |
| 651 | + var head = document.getElementsByTagName("head")[0] || document.documentElement, |
| 652 | + script = document.createElement("script"); |
653 | 653 | |
654 | 654 | script.type = "text/javascript"; |
655 | 655 | if ( jQuery.support.scriptEval ) |
— | — | @@ -689,7 +689,7 @@ |
690 | 690 | break; |
691 | 691 | } else |
692 | 692 | for ( var value = object[0]; |
693 | | - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) { } |
| 693 | + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
694 | 694 | } |
695 | 695 | |
696 | 696 | return object; |
— | — | @@ -709,31 +709,31 @@ |
710 | 710 | className: { |
711 | 711 | // internal only, use addClass("class") |
712 | 712 | add: function( elem, classNames ) { |
713 | | - jQuery.each( ( classNames || "" ).split( /\s+/ ), function( i, className ) { |
| 713 | + jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
714 | 714 | if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
715 | | - elem.className += ( elem.className ? " " : "" ) + className; |
716 | | - } ); |
| 715 | + elem.className += (elem.className ? " " : "") + className; |
| 716 | + }); |
717 | 717 | }, |
718 | 718 | |
719 | 719 | // internal only, use removeClass("class") |
720 | 720 | remove: function( elem, classNames ) { |
721 | | - if ( elem.nodeType == 1 ) |
| 721 | + if (elem.nodeType == 1) |
722 | 722 | elem.className = classNames !== undefined ? |
723 | | - jQuery.grep( elem.className.split( /\s+/ ), function( className ) { |
| 723 | + jQuery.grep(elem.className.split(/\s+/), function(className){ |
724 | 724 | return !jQuery.className.has( classNames, className ); |
725 | | - } ).join( " " ) : |
| 725 | + }).join(" ") : |
726 | 726 | ""; |
727 | 727 | }, |
728 | 728 | |
729 | 729 | // internal only, use hasClass("class") |
730 | 730 | has: function( elem, className ) { |
731 | | - return elem && jQuery.inArray( className, ( elem.className || elem ).toString().split( /\s+/ ) ) > -1; |
| 731 | + return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
732 | 732 | } |
733 | 733 | }, |
734 | 734 | |
735 | 735 | // A method for quickly swapping in/out CSS properties to get correct calculations |
736 | 736 | swap: function( elem, options, callback ) { |
737 | | - var old = { }; |
| 737 | + var old = {}; |
738 | 738 | // Remember the old values, and insert the new ones |
739 | 739 | for ( var name in options ) { |
740 | 740 | old[ name ] = elem.style[ name ]; |
— | — | @@ -759,12 +759,12 @@ |
760 | 760 | |
761 | 761 | jQuery.each( which, function() { |
762 | 762 | if ( !extra ) |
763 | | - val -= parseFloat( jQuery.curCSS( elem, "padding" + this, true ) ) || 0; |
| 763 | + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
764 | 764 | if ( extra === "margin" ) |
765 | | - val += parseFloat( jQuery.curCSS( elem, "margin" + this, true ) ) || 0; |
| 765 | + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
766 | 766 | else |
767 | | - val -= parseFloat( jQuery.curCSS( elem, "border" + this + "Width", true ) ) || 0; |
768 | | - } ); |
| 767 | + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
| 768 | + }); |
769 | 769 | } |
770 | 770 | |
771 | 771 | if ( elem.offsetWidth !== 0 ) |
— | — | @@ -772,7 +772,7 @@ |
773 | 773 | else |
774 | 774 | jQuery.swap( elem, props, getWH ); |
775 | 775 | |
776 | | - return Math.max( 0, Math.round( val ) ); |
| 776 | + return Math.max(0, Math.round(val)); |
777 | 777 | } |
778 | 778 | |
779 | 779 | return jQuery.curCSS( elem, name, force ); |
— | — | @@ -791,7 +791,7 @@ |
792 | 792 | } |
793 | 793 | |
794 | 794 | // Make sure we're using the right name for getting the float value |
795 | | - if ( name.match( / float /i ) ) |
| 795 | + if ( name.match( /float/i ) ) |
796 | 796 | name = styleFloat; |
797 | 797 | |
798 | 798 | if ( !force && style && style[ name ] ) |
— | — | @@ -800,10 +800,10 @@ |
801 | 801 | else if ( defaultView.getComputedStyle ) { |
802 | 802 | |
803 | 803 | // Only "float" is needed here |
804 | | - if ( name.match( / float /i ) ) |
| 804 | + if ( name.match( /float/i ) ) |
805 | 805 | name = "float"; |
806 | 806 | |
807 | | - name = name.replace( / ( [A - Z] ) /g, "-$1" ).toLowerCase(); |
| 807 | + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
808 | 808 | |
809 | 809 | var computedStyle = defaultView.getComputedStyle( elem, null ); |
810 | 810 | |
— | — | @@ -815,9 +815,9 @@ |
816 | 816 | ret = "1"; |
817 | 817 | |
818 | 818 | } else if ( elem.currentStyle ) { |
819 | | - var camelCase = name.replace( /\-(\w)/g, function( all, letter ) { |
| 819 | + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
820 | 820 | return letter.toUpperCase(); |
821 | | - } ); |
| 821 | + }); |
822 | 822 | |
823 | 823 | ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
824 | 824 | |
— | — | @@ -9459,51 +9459,60 @@ |
9460 | 9460 | * the JavaScript space. As such, if we get to the point of merging that stuff |
9461 | 9461 | * into the main branch this code will be uneeded and probably cause issues. |
9462 | 9462 | */ |
9463 | | -// Creates global message object if not already in existence |
9464 | | -if ( !gMsg ) var gMsg = {}; |
| 9463 | + |
9465 | 9464 | /** |
9466 | | - * Caches a list of messages for later retrieval |
9467 | | - * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 9465 | + * Mimics the no-conflict method used by the js2 stuff |
9468 | 9466 | */ |
9469 | | -function loadGM( msgSet ){ |
9470 | | - for ( var i in msgSet ){ |
9471 | | - gMsg[ i ] = msgSet[i]; |
9472 | | - } |
9473 | | -} |
| 9467 | +$j = jQuery.noConflict(); |
9474 | 9468 | /** |
9475 | | - * Retieves a message from the global message cache, performing on-the-fly |
9476 | | - * replacements using MediaWiki message syntax ($1, $2, etc.) |
9477 | | - * @param {String} key Name of message as it is in MediaWiki |
9478 | | - * @param {Array} args Array of replacement arguments |
| 9469 | + * Provides js2 compatible mw functions |
9479 | 9470 | */ |
9480 | | -function gM( key, args ) { |
9481 | | - var ms = ''; |
9482 | | - if ( key in gMsg ) { |
9483 | | - ms = gMsg[ key ]; |
9484 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
9485 | | - for ( var v in args ){ |
9486 | | - var rep = '\$'+ ( parseInt(v) + 1 ); |
9487 | | - ms = ms.replace( rep, args[v]); |
| 9471 | +if( !mw ){ |
| 9472 | + mw = { }; |
| 9473 | + /** |
| 9474 | + * Provides js2 compatible onload hook |
| 9475 | + * @param func Function to call when ready |
| 9476 | + */ |
| 9477 | + mw.addOnloadHook = function( func ) { |
| 9478 | + $j(document).ready( func ); |
| 9479 | + } |
| 9480 | + // Define a dummy mw.load function: |
| 9481 | + mw.load = function( callback) { callbcak() }; |
| 9482 | + |
| 9483 | + // Creates global message object if not already in existence |
| 9484 | + if ( !gMsg ) var gMsg = {}; |
| 9485 | + |
| 9486 | + /** |
| 9487 | + * Caches a list of messages for later retrieval |
| 9488 | + * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 9489 | + */ |
| 9490 | + mw.addMessages = function ( msgSet ){ |
| 9491 | + for ( var i in msgSet ){ |
| 9492 | + gMsg[ i ] = msgSet[i]; |
| 9493 | + } |
| 9494 | + } |
| 9495 | + /** |
| 9496 | + * Retieves a message from the global message cache, performing on-the-fly |
| 9497 | + * replacements using MediaWiki message syntax ($1, $2, etc.) |
| 9498 | + * @param {String} key Name of message as it is in MediaWiki |
| 9499 | + * @param {Array} args Array of replacement arguments |
| 9500 | + */ |
| 9501 | + function gM( key, args ) { |
| 9502 | + var ms = ''; |
| 9503 | + if ( key in gMsg ) { |
| 9504 | + ms = gMsg[ key ]; |
| 9505 | + if ( typeof args == 'object' || typeof args == 'array' ) { |
| 9506 | + for ( var v in args ){ |
| 9507 | + var rep = '\$'+ ( parseInt(v) + 1 ); |
| 9508 | + ms = ms.replace( rep, args[v]); |
| 9509 | + } |
| 9510 | + } else if ( typeof args =='string' || typeof args =='number' ) { |
| 9511 | + ms = ms.replace( /\$1/, args ); |
9488 | 9512 | } |
9489 | | - } else if ( typeof args =='string' || typeof args =='number' ) { |
9490 | | - ms = ms.replace( /\$1/, args ); |
| 9513 | + return ms; |
| 9514 | + } else { |
| 9515 | + return '[' + key + ']'; |
9491 | 9516 | } |
9492 | | - return ms; |
9493 | | - } else { |
9494 | | - return '[' + key + ']'; |
9495 | 9517 | } |
9496 | | -} |
9497 | | -/** |
9498 | | - * Mimics the no-conflict method used by the js2 stuff |
9499 | | - */ |
9500 | | -$j = jQuery.noConflict(); |
9501 | | -/** |
9502 | | - * Provides js2 compatible onload hook |
9503 | | - * @param func Function to call when ready |
9504 | | - */ |
9505 | | -function js2AddOnloadHook( func ) { |
9506 | | - $j(document).ready( func ); |
9507 | | -} |
9508 | | - |
9509 | | -// Define a dummy mvJsLoader.doLoad() function |
9510 | | -mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
| 9518 | + |
| 9519 | +} |
\ No newline at end of file |
Index: trunk/extensions/WikiAtHome/WikiAtHome.js |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | //the core javascript file of the wiki@home extension |
3 | 3 | |
4 | 4 | //load msgs: |
5 | | -loadGM({ |
| 5 | +mw.addMessages({ |
6 | 6 | "wah-menu-jobs" : "Jobs", |
7 | 7 | "wah-menu-stats": "Stats", |
8 | 8 | "wah-menu-pref" : "Preferences", |
— | — | @@ -39,10 +39,10 @@ |
40 | 40 | 'jobsearch_delay' : ( wgClientSearchInterval ) ? wgClientSearchInterval: 60 |
41 | 41 | }; |
42 | 42 | |
43 | | -//js2AddOnloadHook ensures that the dom and core libraries are ready: |
44 | | -js2AddOnloadHook(function(){ |
| 43 | +//mw.addOnloadHook ensures that the dom and core libraries are ready: |
| 44 | +mw.addOnloadHook(function(){ |
45 | 45 | //set up the dependency load request: |
46 | | - var depReq = [ |
| 46 | + mw.load( [ |
47 | 47 | [ |
48 | 48 | 'mvBaseUploadInterface', |
49 | 49 | 'mvFirefoggRender', |
— | — | @@ -55,8 +55,7 @@ |
56 | 56 | '$j.ui.tabs', |
57 | 57 | '$j.cookie' |
58 | 58 | ] |
59 | | - ]; |
60 | | - mvJsLoader.doLoadDepMode( depReq, function(){ |
| 59 | + ], function(){ |
61 | 60 | WikiAtHome.init( wahConfig ); |
62 | 61 | }); |
63 | 62 | }); |
Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -1042,7 +1042,7 @@ |
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | |
1046 | | -js2AddOnloadHook( function() { |
| 1046 | +mw.addOnloadHook( function() { |
1047 | 1047 | // One-time setup for the full page |
1048 | 1048 | |
1049 | 1049 | // Update the new thread link |
Index: trunk/extensions/LiquidThreads/jquery/js2.combined.js |
— | — | @@ -0,0 +1,7875 @@ |
| 2 | +/*! |
| 3 | + * jQuery JavaScript Library v1.3.2 |
| 4 | + * http://jquery.com/ |
| 5 | + * |
| 6 | + * Copyright (c) 2009 John Resig |
| 7 | + * Dual licensed under the MIT and GPL licenses. |
| 8 | + * http://docs.jquery.com/License |
| 9 | + * |
| 10 | + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) |
| 11 | + * Revision: 6246 |
| 12 | + */ |
| 13 | +(function(){ |
| 14 | + |
| 15 | +var |
| 16 | + // Will speed up references to window, and allows munging its name. |
| 17 | + window = this, |
| 18 | + // Will speed up references to undefined, and allows munging its name. |
| 19 | + undefined, |
| 20 | + // Map over jQuery in case of overwrite |
| 21 | + _jQuery = window.jQuery, |
| 22 | + // Map over the $ in case of overwrite |
| 23 | + _$ = window.$, |
| 24 | + |
| 25 | + jQuery = window.jQuery = window.$ = function( selector, context ) { |
| 26 | + // The jQuery object is actually just the init constructor 'enhanced' |
| 27 | + return new jQuery.fn.init( selector, context ); |
| 28 | + }, |
| 29 | + |
| 30 | + // A simple way to check for HTML strings or ID strings |
| 31 | + // (both of which we optimize for) |
| 32 | + quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
| 33 | + // Is it a simple selector |
| 34 | + isSimple = /^.[^:#\[\.,]*$/; |
| 35 | + |
| 36 | +jQuery.fn = jQuery.prototype = { |
| 37 | + init: function( selector, context ) { |
| 38 | + // Make sure that a selection was provided |
| 39 | + selector = selector || document; |
| 40 | + |
| 41 | + // Handle $(DOMElement) |
| 42 | + if ( selector.nodeType ) { |
| 43 | + this[0] = selector; |
| 44 | + this.length = 1; |
| 45 | + this.context = selector; |
| 46 | + return this; |
| 47 | + } |
| 48 | + // Handle HTML strings |
| 49 | + if ( typeof selector === "string" ) { |
| 50 | + // Are we dealing with HTML string or an ID? |
| 51 | + var match = quickExpr.exec( selector ); |
| 52 | + |
| 53 | + // Verify a match, and that no context was specified for #id |
| 54 | + if ( match && (match[1] || !context) ) { |
| 55 | + |
| 56 | + // HANDLE: $(html) -> $(array) |
| 57 | + if ( match[1] ) |
| 58 | + selector = jQuery.clean( [ match[1] ], context ); |
| 59 | + |
| 60 | + // HANDLE: $("#id") |
| 61 | + else { |
| 62 | + var elem = document.getElementById( match[3] ); |
| 63 | + |
| 64 | + // Handle the case where IE and Opera return items |
| 65 | + // by name instead of ID |
| 66 | + if ( elem && elem.id != match[3] ) |
| 67 | + return jQuery().find( selector ); |
| 68 | + |
| 69 | + // Otherwise, we inject the element directly into the jQuery object |
| 70 | + var ret = jQuery( elem || [] ); |
| 71 | + ret.context = document; |
| 72 | + ret.selector = selector; |
| 73 | + return ret; |
| 74 | + } |
| 75 | + |
| 76 | + // HANDLE: $(expr, [context]) |
| 77 | + // (which is just equivalent to: $(content).find(expr) |
| 78 | + } else |
| 79 | + return jQuery( context ).find( selector ); |
| 80 | + |
| 81 | + // HANDLE: $(function) |
| 82 | + // Shortcut for document ready |
| 83 | + } else if ( jQuery.isFunction( selector ) ) |
| 84 | + return jQuery( document ).ready( selector ); |
| 85 | + |
| 86 | + // Make sure that old selector state is passed along |
| 87 | + if ( selector.selector && selector.context ) { |
| 88 | + this.selector = selector.selector; |
| 89 | + this.context = selector.context; |
| 90 | + } |
| 91 | + |
| 92 | + return this.setArray(jQuery.isArray( selector ) ? |
| 93 | + selector : |
| 94 | + jQuery.makeArray(selector)); |
| 95 | + }, |
| 96 | + |
| 97 | + // Start with an empty selector |
| 98 | + selector: "", |
| 99 | + |
| 100 | + // The current version of jQuery being used |
| 101 | + jquery: "1.3.2", |
| 102 | + |
| 103 | + // The number of elements contained in the matched element set |
| 104 | + size: function() { |
| 105 | + return this.length; |
| 106 | + }, |
| 107 | + |
| 108 | + // Get the Nth element in the matched element set OR |
| 109 | + // Get the whole matched element set as a clean array |
| 110 | + get: function( num ) { |
| 111 | + return num === undefined ? |
| 112 | + |
| 113 | + // Return a 'clean' array |
| 114 | + Array.prototype.slice.call( this ) : |
| 115 | + |
| 116 | + // Return just the object |
| 117 | + this[ num ]; |
| 118 | + }, |
| 119 | + |
| 120 | + // Take an array of elements and push it onto the stack |
| 121 | + // (returning the new matched element set) |
| 122 | + pushStack: function( elems, name, selector ) { |
| 123 | + // Build a new jQuery matched element set |
| 124 | + var ret = jQuery( elems ); |
| 125 | + |
| 126 | + // Add the old object onto the stack (as a reference) |
| 127 | + ret.prevObject = this; |
| 128 | + |
| 129 | + ret.context = this.context; |
| 130 | + |
| 131 | + if ( name === "find" ) |
| 132 | + ret.selector = this.selector + (this.selector ? " " : "") + selector; |
| 133 | + else if ( name ) |
| 134 | + ret.selector = this.selector + "." + name + "(" + selector + ")"; |
| 135 | + |
| 136 | + // Return the newly-formed element set |
| 137 | + return ret; |
| 138 | + }, |
| 139 | + |
| 140 | + // Force the current matched set of elements to become |
| 141 | + // the specified array of elements (destroying the stack in the process) |
| 142 | + // You should use pushStack() in order to do this, but maintain the stack |
| 143 | + setArray: function( elems ) { |
| 144 | + // Resetting the length to 0, then using the native Array push |
| 145 | + // is a super-fast way to populate an object with array-like properties |
| 146 | + this.length = 0; |
| 147 | + Array.prototype.push.apply( this, elems ); |
| 148 | + |
| 149 | + return this; |
| 150 | + }, |
| 151 | + |
| 152 | + // Execute a callback for every element in the matched set. |
| 153 | + // (You can seed the arguments with an array of args, but this is |
| 154 | + // only used internally.) |
| 155 | + each: function( callback, args ) { |
| 156 | + return jQuery.each( this, callback, args ); |
| 157 | + }, |
| 158 | + |
| 159 | + // Determine the position of an element within |
| 160 | + // the matched set of elements |
| 161 | + index: function( elem ) { |
| 162 | + // Locate the position of the desired element |
| 163 | + return jQuery.inArray( |
| 164 | + // If it receives a jQuery object, the first element is used |
| 165 | + elem && elem.jquery ? elem[0] : elem |
| 166 | + , this ); |
| 167 | + }, |
| 168 | + |
| 169 | + attr: function( name, value, type ) { |
| 170 | + var options = name; |
| 171 | + |
| 172 | + // Look for the case where we're accessing a style value |
| 173 | + if ( typeof name === "string" ) |
| 174 | + if ( value === undefined ) |
| 175 | + return this[0] && jQuery[ type || "attr" ]( this[0], name ); |
| 176 | + |
| 177 | + else { |
| 178 | + options = {}; |
| 179 | + options[ name ] = value; |
| 180 | + } |
| 181 | + |
| 182 | + // Check to see if we're setting style values |
| 183 | + return this.each(function(i){ |
| 184 | + // Set all the styles |
| 185 | + for ( name in options ) |
| 186 | + jQuery.attr( |
| 187 | + type ? |
| 188 | + this.style : |
| 189 | + this, |
| 190 | + name, jQuery.prop( this, options[ name ], type, i, name ) |
| 191 | + ); |
| 192 | + }); |
| 193 | + }, |
| 194 | + |
| 195 | + css: function( key, value ) { |
| 196 | + // ignore negative width and height values |
| 197 | + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
| 198 | + value = undefined; |
| 199 | + return this.attr( key, value, "curCSS" ); |
| 200 | + }, |
| 201 | + |
| 202 | + text: function( text ) { |
| 203 | + if ( typeof text !== "object" && text != null ) |
| 204 | + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
| 205 | + |
| 206 | + var ret = ""; |
| 207 | + |
| 208 | + jQuery.each( text || this, function(){ |
| 209 | + jQuery.each( this.childNodes, function(){ |
| 210 | + if ( this.nodeType != 8 ) |
| 211 | + ret += this.nodeType != 1 ? |
| 212 | + this.nodeValue : |
| 213 | + jQuery.fn.text( [ this ] ); |
| 214 | + }); |
| 215 | + }); |
| 216 | + |
| 217 | + return ret; |
| 218 | + }, |
| 219 | + |
| 220 | + wrapAll: function( html ) { |
| 221 | + if ( this[0] ) { |
| 222 | + // The elements to wrap the target around |
| 223 | + var wrap = jQuery( html, this[0].ownerDocument ).clone(); |
| 224 | + |
| 225 | + if ( this[0].parentNode ) |
| 226 | + wrap.insertBefore( this[0] ); |
| 227 | + |
| 228 | + wrap.map(function(){ |
| 229 | + var elem = this; |
| 230 | + |
| 231 | + while ( elem.firstChild ) |
| 232 | + elem = elem.firstChild; |
| 233 | + |
| 234 | + return elem; |
| 235 | + }).append(this); |
| 236 | + } |
| 237 | + |
| 238 | + return this; |
| 239 | + }, |
| 240 | + |
| 241 | + wrapInner: function( html ) { |
| 242 | + return this.each(function(){ |
| 243 | + jQuery( this ).contents().wrapAll( html ); |
| 244 | + }); |
| 245 | + }, |
| 246 | + |
| 247 | + wrap: function( html ) { |
| 248 | + return this.each(function(){ |
| 249 | + jQuery( this ).wrapAll( html ); |
| 250 | + }); |
| 251 | + }, |
| 252 | + |
| 253 | + append: function() { |
| 254 | + return this.domManip(arguments, true, function(elem){ |
| 255 | + if (this.nodeType == 1) |
| 256 | + this.appendChild( elem ); |
| 257 | + }); |
| 258 | + }, |
| 259 | + |
| 260 | + prepend: function() { |
| 261 | + return this.domManip(arguments, true, function(elem){ |
| 262 | + if (this.nodeType == 1) |
| 263 | + this.insertBefore( elem, this.firstChild ); |
| 264 | + }); |
| 265 | + }, |
| 266 | + |
| 267 | + before: function() { |
| 268 | + return this.domManip(arguments, false, function(elem){ |
| 269 | + this.parentNode.insertBefore( elem, this ); |
| 270 | + }); |
| 271 | + }, |
| 272 | + |
| 273 | + after: function() { |
| 274 | + return this.domManip(arguments, false, function(elem){ |
| 275 | + this.parentNode.insertBefore( elem, this.nextSibling ); |
| 276 | + }); |
| 277 | + }, |
| 278 | + |
| 279 | + end: function() { |
| 280 | + return this.prevObject || jQuery( [] ); |
| 281 | + }, |
| 282 | + |
| 283 | + // For internal use only. |
| 284 | + // Behaves like an Array's method, not like a jQuery method. |
| 285 | + push: [].push, |
| 286 | + sort: [].sort, |
| 287 | + splice: [].splice, |
| 288 | + |
| 289 | + find: function( selector ) { |
| 290 | + if ( this.length === 1 ) { |
| 291 | + var ret = this.pushStack( [], "find", selector ); |
| 292 | + ret.length = 0; |
| 293 | + jQuery.find( selector, this[0], ret ); |
| 294 | + return ret; |
| 295 | + } else { |
| 296 | + return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ |
| 297 | + return jQuery.find( selector, elem ); |
| 298 | + })), "find", selector ); |
| 299 | + } |
| 300 | + }, |
| 301 | + |
| 302 | + clone: function( events ) { |
| 303 | + // Do the clone |
| 304 | + var ret = this.map(function(){ |
| 305 | + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
| 306 | + // IE copies events bound via attachEvent when |
| 307 | + // using cloneNode. Calling detachEvent on the |
| 308 | + // clone will also remove the events from the orignal |
| 309 | + // In order to get around this, we use innerHTML. |
| 310 | + // Unfortunately, this means some modifications to |
| 311 | + // attributes in IE that are actually only stored |
| 312 | + // as properties will not be copied (such as the |
| 313 | + // the name attribute on an input). |
| 314 | + var html = this.outerHTML; |
| 315 | + if ( !html ) { |
| 316 | + var div = this.ownerDocument.createElement("div"); |
| 317 | + div.appendChild( this.cloneNode(true) ); |
| 318 | + html = div.innerHTML; |
| 319 | + } |
| 320 | + |
| 321 | + return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; |
| 322 | + } else |
| 323 | + return this.cloneNode(true); |
| 324 | + }); |
| 325 | + |
| 326 | + // Copy the events from the original to the clone |
| 327 | + if ( events === true ) { |
| 328 | + var orig = this.find("*").andSelf(), i = 0; |
| 329 | + |
| 330 | + ret.find("*").andSelf().each(function(){ |
| 331 | + if ( this.nodeName !== orig[i].nodeName ) |
| 332 | + return; |
| 333 | + |
| 334 | + var events = jQuery.data( orig[i], "events" ); |
| 335 | + |
| 336 | + for ( var type in events ) { |
| 337 | + for ( var handler in events[ type ] ) { |
| 338 | + jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
| 339 | + } |
| 340 | + } |
| 341 | + |
| 342 | + i++; |
| 343 | + }); |
| 344 | + } |
| 345 | + |
| 346 | + // Return the cloned set |
| 347 | + return ret; |
| 348 | + }, |
| 349 | + |
| 350 | + filter: function( selector ) { |
| 351 | + return this.pushStack( |
| 352 | + jQuery.isFunction( selector ) && |
| 353 | + jQuery.grep(this, function(elem, i){ |
| 354 | + return selector.call( elem, i ); |
| 355 | + }) || |
| 356 | + |
| 357 | + jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ |
| 358 | + return elem.nodeType === 1; |
| 359 | + }) ), "filter", selector ); |
| 360 | + }, |
| 361 | + |
| 362 | + closest: function( selector ) { |
| 363 | + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
| 364 | + closer = 0; |
| 365 | + |
| 366 | + return this.map(function(){ |
| 367 | + var cur = this; |
| 368 | + while ( cur && cur.ownerDocument ) { |
| 369 | + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
| 370 | + jQuery.data(cur, "closest", closer); |
| 371 | + return cur; |
| 372 | + } |
| 373 | + cur = cur.parentNode; |
| 374 | + closer++; |
| 375 | + } |
| 376 | + }); |
| 377 | + }, |
| 378 | + |
| 379 | + not: function( selector ) { |
| 380 | + if ( typeof selector === "string" ) |
| 381 | + // test special case where just one selector is passed in |
| 382 | + if ( isSimple.test( selector ) ) |
| 383 | + return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); |
| 384 | + else |
| 385 | + selector = jQuery.multiFilter( selector, this ); |
| 386 | + |
| 387 | + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
| 388 | + return this.filter(function() { |
| 389 | + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
| 390 | + }); |
| 391 | + }, |
| 392 | + |
| 393 | + add: function( selector ) { |
| 394 | + return this.pushStack( jQuery.unique( jQuery.merge( |
| 395 | + this.get(), |
| 396 | + typeof selector === "string" ? |
| 397 | + jQuery( selector ) : |
| 398 | + jQuery.makeArray( selector ) |
| 399 | + ))); |
| 400 | + }, |
| 401 | + |
| 402 | + is: function( selector ) { |
| 403 | + return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
| 404 | + }, |
| 405 | + |
| 406 | + hasClass: function( selector ) { |
| 407 | + return !!selector && this.is( "." + selector ); |
| 408 | + }, |
| 409 | + |
| 410 | + val: function( value ) { |
| 411 | + if ( value === undefined ) { |
| 412 | + var elem = this[0]; |
| 413 | + |
| 414 | + if ( elem ) { |
| 415 | + if( jQuery.nodeName( elem, 'option' ) ) |
| 416 | + return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
| 417 | + |
| 418 | + // We need to handle select boxes special |
| 419 | + if ( jQuery.nodeName( elem, "select" ) ) { |
| 420 | + var index = elem.selectedIndex, |
| 421 | + values = [], |
| 422 | + options = elem.options, |
| 423 | + one = elem.type == "select-one"; |
| 424 | + |
| 425 | + // Nothing was selected |
| 426 | + if ( index < 0 ) |
| 427 | + return null; |
| 428 | + |
| 429 | + // Loop through all the selected options |
| 430 | + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
| 431 | + var option = options[ i ]; |
| 432 | + |
| 433 | + if ( option.selected ) { |
| 434 | + // Get the specifc value for the option |
| 435 | + value = jQuery(option).val(); |
| 436 | + |
| 437 | + // We don't need an array for one selects |
| 438 | + if ( one ) |
| 439 | + return value; |
| 440 | + |
| 441 | + // Multi-Selects return an array |
| 442 | + values.push( value ); |
| 443 | + } |
| 444 | + } |
| 445 | + |
| 446 | + return values; |
| 447 | + } |
| 448 | + |
| 449 | + // Everything else, we just grab the value |
| 450 | + return (elem.value || "").replace(/\r/g, ""); |
| 451 | + |
| 452 | + } |
| 453 | + |
| 454 | + return undefined; |
| 455 | + } |
| 456 | + |
| 457 | + if ( typeof value === "number" ) |
| 458 | + value += ''; |
| 459 | + |
| 460 | + return this.each(function(){ |
| 461 | + if ( this.nodeType != 1 ) |
| 462 | + return; |
| 463 | + |
| 464 | + if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) |
| 465 | + this.checked = (jQuery.inArray(this.value, value) >= 0 || |
| 466 | + jQuery.inArray(this.name, value) >= 0); |
| 467 | + |
| 468 | + else if ( jQuery.nodeName( this, "select" ) ) { |
| 469 | + var values = jQuery.makeArray(value); |
| 470 | + |
| 471 | + jQuery( "option", this ).each(function(){ |
| 472 | + this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
| 473 | + jQuery.inArray( this.text, values ) >= 0); |
| 474 | + }); |
| 475 | + |
| 476 | + if ( !values.length ) |
| 477 | + this.selectedIndex = -1; |
| 478 | + |
| 479 | + } else |
| 480 | + this.value = value; |
| 481 | + }); |
| 482 | + }, |
| 483 | + |
| 484 | + html: function( value ) { |
| 485 | + return value === undefined ? |
| 486 | + (this[0] ? |
| 487 | + this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : |
| 488 | + null) : |
| 489 | + this.empty().append( value ); |
| 490 | + }, |
| 491 | + |
| 492 | + replaceWith: function( value ) { |
| 493 | + return this.after( value ).remove(); |
| 494 | + }, |
| 495 | + |
| 496 | + eq: function( i ) { |
| 497 | + return this.slice( i, +i + 1 ); |
| 498 | + }, |
| 499 | + |
| 500 | + slice: function() { |
| 501 | + return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
| 502 | + "slice", Array.prototype.slice.call(arguments).join(",") ); |
| 503 | + }, |
| 504 | + |
| 505 | + map: function( callback ) { |
| 506 | + return this.pushStack( jQuery.map(this, function(elem, i){ |
| 507 | + return callback.call( elem, i, elem ); |
| 508 | + })); |
| 509 | + }, |
| 510 | + |
| 511 | + andSelf: function() { |
| 512 | + return this.add( this.prevObject ); |
| 513 | + }, |
| 514 | + |
| 515 | + domManip: function( args, table, callback ) { |
| 516 | + if ( this[0] ) { |
| 517 | + var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), |
| 518 | + scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), |
| 519 | + first = fragment.firstChild; |
| 520 | + |
| 521 | + if ( first ) |
| 522 | + for ( var i = 0, l = this.length; i < l; i++ ) |
| 523 | + callback.call( root(this[i], first), this.length > 1 || i > 0 ? |
| 524 | + fragment.cloneNode(true) : fragment ); |
| 525 | + |
| 526 | + if ( scripts ) |
| 527 | + jQuery.each( scripts, evalScript ); |
| 528 | + } |
| 529 | + |
| 530 | + return this; |
| 531 | + |
| 532 | + function root( elem, cur ) { |
| 533 | + return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
| 534 | + (elem.getElementsByTagName("tbody")[0] || |
| 535 | + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
| 536 | + elem; |
| 537 | + } |
| 538 | + } |
| 539 | +}; |
| 540 | + |
| 541 | +// Give the init function the jQuery prototype for later instantiation |
| 542 | +jQuery.fn.init.prototype = jQuery.fn; |
| 543 | + |
| 544 | +function evalScript( i, elem ) { |
| 545 | + if ( elem.src ) |
| 546 | + jQuery.ajax({ |
| 547 | + url: elem.src, |
| 548 | + async: false, |
| 549 | + dataType: "script" |
| 550 | + }); |
| 551 | + |
| 552 | + else |
| 553 | + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
| 554 | + |
| 555 | + if ( elem.parentNode ) |
| 556 | + elem.parentNode.removeChild( elem ); |
| 557 | +} |
| 558 | + |
| 559 | +function now(){ |
| 560 | + return +new Date; |
| 561 | +} |
| 562 | + |
| 563 | +jQuery.extend = jQuery.fn.extend = function() { |
| 564 | + // copy reference to target object |
| 565 | + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
| 566 | + |
| 567 | + // Handle a deep copy situation |
| 568 | + if ( typeof target === "boolean" ) { |
| 569 | + deep = target; |
| 570 | + target = arguments[1] || {}; |
| 571 | + // skip the boolean and the target |
| 572 | + i = 2; |
| 573 | + } |
| 574 | + |
| 575 | + // Handle case when target is a string or something (possible in deep copy) |
| 576 | + if ( typeof target !== "object" && !jQuery.isFunction(target) ) |
| 577 | + target = {}; |
| 578 | + |
| 579 | + // extend jQuery itself if only one argument is passed |
| 580 | + if ( length == i ) { |
| 581 | + target = this; |
| 582 | + --i; |
| 583 | + } |
| 584 | + |
| 585 | + for ( ; i < length; i++ ) |
| 586 | + // Only deal with non-null/undefined values |
| 587 | + if ( (options = arguments[ i ]) != null ) |
| 588 | + // Extend the base object |
| 589 | + for ( var name in options ) { |
| 590 | + var src = target[ name ], copy = options[ name ]; |
| 591 | + |
| 592 | + // Prevent never-ending loop |
| 593 | + if ( target === copy ) |
| 594 | + continue; |
| 595 | + |
| 596 | + // Recurse if we're merging object values |
| 597 | + if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
| 598 | + target[ name ] = jQuery.extend( deep, |
| 599 | + // Never move original objects, clone them |
| 600 | + src || ( copy.length != null ? [ ] : { } ) |
| 601 | + , copy ); |
| 602 | + |
| 603 | + // Don't bring in undefined values |
| 604 | + else if ( copy !== undefined ) |
| 605 | + target[ name ] = copy; |
| 606 | + |
| 607 | + } |
| 608 | + |
| 609 | + // Return the modified object |
| 610 | + return target; |
| 611 | +}; |
| 612 | + |
| 613 | +// exclude the following css properties to add px |
| 614 | +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
| 615 | + // cache defaultView |
| 616 | + defaultView = document.defaultView || {}, |
| 617 | + toString = Object.prototype.toString; |
| 618 | + |
| 619 | +jQuery.extend({ |
| 620 | + noConflict: function( deep ) { |
| 621 | + window.$ = _$; |
| 622 | + |
| 623 | + if ( deep ) |
| 624 | + window.jQuery = _jQuery; |
| 625 | + |
| 626 | + return jQuery; |
| 627 | + }, |
| 628 | + |
| 629 | + // See test/unit/core.js for details concerning isFunction. |
| 630 | + // Since version 1.3, DOM methods and functions like alert |
| 631 | + // aren't supported. They return false on IE (#2968). |
| 632 | + isFunction: function( obj ) { |
| 633 | + return toString.call(obj) === "[object Function]"; |
| 634 | + }, |
| 635 | + |
| 636 | + isArray: function( obj ) { |
| 637 | + return toString.call(obj) === "[object Array]"; |
| 638 | + }, |
| 639 | + |
| 640 | + // check if an element is in a (or is an) XML document |
| 641 | + isXMLDoc: function( elem ) { |
| 642 | + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
| 643 | + !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); |
| 644 | + }, |
| 645 | + |
| 646 | + // Evalulates a script in a global context |
| 647 | + globalEval: function( data ) { |
| 648 | + if ( data && /\S/.test(data) ) { |
| 649 | + // Inspired by code by Andrea Giammarchi |
| 650 | + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
| 651 | + var head = document.getElementsByTagName("head")[0] || document.documentElement, |
| 652 | + script = document.createElement("script"); |
| 653 | + |
| 654 | + script.type = "text/javascript"; |
| 655 | + if ( jQuery.support.scriptEval ) |
| 656 | + script.appendChild( document.createTextNode( data ) ); |
| 657 | + else |
| 658 | + script.text = data; |
| 659 | + |
| 660 | + // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
| 661 | + // This arises when a base node is used (#2709). |
| 662 | + head.insertBefore( script, head.firstChild ); |
| 663 | + head.removeChild( script ); |
| 664 | + } |
| 665 | + }, |
| 666 | + |
| 667 | + nodeName: function( elem, name ) { |
| 668 | + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
| 669 | + }, |
| 670 | + |
| 671 | + // args is for internal usage only |
| 672 | + each: function( object, callback, args ) { |
| 673 | + var name, i = 0, length = object.length; |
| 674 | + |
| 675 | + if ( args ) { |
| 676 | + if ( length === undefined ) { |
| 677 | + for ( name in object ) |
| 678 | + if ( callback.apply( object[ name ], args ) === false ) |
| 679 | + break; |
| 680 | + } else |
| 681 | + for ( ; i < length; ) |
| 682 | + if ( callback.apply( object[ i++ ], args ) === false ) |
| 683 | + break; |
| 684 | + |
| 685 | + // A special, fast, case for the most common use of each |
| 686 | + } else { |
| 687 | + if ( length === undefined ) { |
| 688 | + for ( name in object ) |
| 689 | + if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
| 690 | + break; |
| 691 | + } else |
| 692 | + for ( var value = object[0]; |
| 693 | + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
| 694 | + } |
| 695 | + |
| 696 | + return object; |
| 697 | + }, |
| 698 | + |
| 699 | + prop: function( elem, value, type, i, name ) { |
| 700 | + // Handle executable functions |
| 701 | + if ( jQuery.isFunction( value ) ) |
| 702 | + value = value.call( elem, i ); |
| 703 | + |
| 704 | + // Handle passing in a number to a CSS property |
| 705 | + return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? |
| 706 | + value + "px" : |
| 707 | + value; |
| 708 | + }, |
| 709 | + |
| 710 | + className: { |
| 711 | + // internal only, use addClass("class") |
| 712 | + add: function( elem, classNames ) { |
| 713 | + jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
| 714 | + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
| 715 | + elem.className += (elem.className ? " " : "") + className; |
| 716 | + }); |
| 717 | + }, |
| 718 | + |
| 719 | + // internal only, use removeClass("class") |
| 720 | + remove: function( elem, classNames ) { |
| 721 | + if (elem.nodeType == 1) |
| 722 | + elem.className = classNames !== undefined ? |
| 723 | + jQuery.grep(elem.className.split(/\s+/), function(className){ |
| 724 | + return !jQuery.className.has( classNames, className ); |
| 725 | + }).join(" ") : |
| 726 | + ""; |
| 727 | + }, |
| 728 | + |
| 729 | + // internal only, use hasClass("class") |
| 730 | + has: function( elem, className ) { |
| 731 | + return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
| 732 | + } |
| 733 | + }, |
| 734 | + |
| 735 | + // A method for quickly swapping in/out CSS properties to get correct calculations |
| 736 | + swap: function( elem, options, callback ) { |
| 737 | + var old = {}; |
| 738 | + // Remember the old values, and insert the new ones |
| 739 | + for ( var name in options ) { |
| 740 | + old[ name ] = elem.style[ name ]; |
| 741 | + elem.style[ name ] = options[ name ]; |
| 742 | + } |
| 743 | + |
| 744 | + callback.call( elem ); |
| 745 | + |
| 746 | + // Revert the old values |
| 747 | + for ( var name in options ) |
| 748 | + elem.style[ name ] = old[ name ]; |
| 749 | + }, |
| 750 | + |
| 751 | + css: function( elem, name, force, extra ) { |
| 752 | + if ( name == "width" || name == "height" ) { |
| 753 | + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
| 754 | + |
| 755 | + function getWH() { |
| 756 | + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
| 757 | + |
| 758 | + if ( extra === "border" ) |
| 759 | + return; |
| 760 | + |
| 761 | + jQuery.each( which, function() { |
| 762 | + if ( !extra ) |
| 763 | + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
| 764 | + if ( extra === "margin" ) |
| 765 | + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
| 766 | + else |
| 767 | + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
| 768 | + }); |
| 769 | + } |
| 770 | + |
| 771 | + if ( elem.offsetWidth !== 0 ) |
| 772 | + getWH(); |
| 773 | + else |
| 774 | + jQuery.swap( elem, props, getWH ); |
| 775 | + |
| 776 | + return Math.max(0, Math.round(val)); |
| 777 | + } |
| 778 | + |
| 779 | + return jQuery.curCSS( elem, name, force ); |
| 780 | + }, |
| 781 | + |
| 782 | + curCSS: function( elem, name, force ) { |
| 783 | + var ret, style = elem.style; |
| 784 | + |
| 785 | + // We need to handle opacity special in IE |
| 786 | + if ( name == "opacity" && !jQuery.support.opacity ) { |
| 787 | + ret = jQuery.attr( style, "opacity" ); |
| 788 | + |
| 789 | + return ret == "" ? |
| 790 | + "1" : |
| 791 | + ret; |
| 792 | + } |
| 793 | + |
| 794 | + // Make sure we're using the right name for getting the float value |
| 795 | + if ( name.match( /float/i ) ) |
| 796 | + name = styleFloat; |
| 797 | + |
| 798 | + if ( !force && style && style[ name ] ) |
| 799 | + ret = style[ name ]; |
| 800 | + |
| 801 | + else if ( defaultView.getComputedStyle ) { |
| 802 | + |
| 803 | + // Only "float" is needed here |
| 804 | + if ( name.match( /float/i ) ) |
| 805 | + name = "float"; |
| 806 | + |
| 807 | + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
| 808 | + |
| 809 | + var computedStyle = defaultView.getComputedStyle( elem, null ); |
| 810 | + |
| 811 | + if ( computedStyle ) |
| 812 | + ret = computedStyle.getPropertyValue( name ); |
| 813 | + |
| 814 | + // We should always get a number back from opacity |
| 815 | + if ( name == "opacity" && ret == "" ) |
| 816 | + ret = "1"; |
| 817 | + |
| 818 | + } else if ( elem.currentStyle ) { |
| 819 | + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
| 820 | + return letter.toUpperCase(); |
| 821 | + }); |
| 822 | + |
| 823 | + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
| 824 | + |
| 825 | + // From the awesome hack by Dean Edwards |
| 826 | + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
| 827 | + |
| 828 | + // If we're not dealing with a regular pixel number |
| 829 | + // but a number that has a weird ending, we need to convert it to pixels |
| 830 | + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
| 831 | + // Remember the original values |
| 832 | + var left = style.left, rsLeft = elem.runtimeStyle.left; |
| 833 | + |
| 834 | + // Put in the new values to get a computed value out |
| 835 | + elem.runtimeStyle.left = elem.currentStyle.left; |
| 836 | + style.left = ret || 0; |
| 837 | + ret = style.pixelLeft + "px"; |
| 838 | + |
| 839 | + // Revert the changed values |
| 840 | + style.left = left; |
| 841 | + elem.runtimeStyle.left = rsLeft; |
| 842 | + } |
| 843 | + } |
| 844 | + |
| 845 | + return ret; |
| 846 | + }, |
| 847 | + |
| 848 | + clean: function( elems, context, fragment ) { |
| 849 | + context = context || document; |
| 850 | + |
| 851 | + // !context.createElement fails in IE with an error but returns typeof 'object' |
| 852 | + if ( typeof context.createElement === "undefined" ) |
| 853 | + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
| 854 | + |
| 855 | + // If a single string is passed in and it's a single tag |
| 856 | + // just do a createElement and skip the rest |
| 857 | + if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { |
| 858 | + var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); |
| 859 | + if ( match ) |
| 860 | + return [ context.createElement( match[1] ) ]; |
| 861 | + } |
| 862 | + |
| 863 | + var ret = [], scripts = [], div = context.createElement("div"); |
| 864 | + |
| 865 | + jQuery.each(elems, function(i, elem){ |
| 866 | + if ( typeof elem === "number" ) |
| 867 | + elem += ''; |
| 868 | + |
| 869 | + if ( !elem ) |
| 870 | + return; |
| 871 | + |
| 872 | + // Convert html string into DOM nodes |
| 873 | + if ( typeof elem === "string" ) { |
| 874 | + // Fix "XHTML"-style tags in all browsers |
| 875 | + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
| 876 | + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
| 877 | + all : |
| 878 | + front + "></" + tag + ">"; |
| 879 | + }); |
| 880 | + |
| 881 | + // Trim whitespace, otherwise indexOf won't work as expected |
| 882 | + var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); |
| 883 | + |
| 884 | + var wrap = |
| 885 | + // option or optgroup |
| 886 | + !tags.indexOf("<opt") && |
| 887 | + [ 1, "<select multiple='multiple'>", "</select>" ] || |
| 888 | + |
| 889 | + !tags.indexOf("<leg") && |
| 890 | + [ 1, "<fieldset>", "</fieldset>" ] || |
| 891 | + |
| 892 | + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
| 893 | + [ 1, "<table>", "</table>" ] || |
| 894 | + |
| 895 | + !tags.indexOf("<tr") && |
| 896 | + [ 2, "<table><tbody>", "</tbody></table>" ] || |
| 897 | + |
| 898 | + // <thead> matched above |
| 899 | + (!tags.indexOf("<td") || !tags.indexOf("<th")) && |
| 900 | + [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
| 901 | + |
| 902 | + !tags.indexOf("<col") && |
| 903 | + [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
| 904 | + |
| 905 | + // IE can't serialize <link> and <script> tags normally |
| 906 | + !jQuery.support.htmlSerialize && |
| 907 | + [ 1, "div<div>", "</div>" ] || |
| 908 | + |
| 909 | + [ 0, "", "" ]; |
| 910 | + |
| 911 | + // Go to html and back, then peel off extra wrappers |
| 912 | + div.innerHTML = wrap[1] + elem + wrap[2]; |
| 913 | + |
| 914 | + // Move to the right depth |
| 915 | + while ( wrap[0]-- ) |
| 916 | + div = div.lastChild; |
| 917 | + |
| 918 | + // Remove IE's autoinserted <tbody> from table fragments |
| 919 | + if ( !jQuery.support.tbody ) { |
| 920 | + |
| 921 | + // String was a <table>, *may* have spurious <tbody> |
| 922 | + var hasBody = /<tbody/i.test(elem), |
| 923 | + tbody = !tags.indexOf("<table") && !hasBody ? |
| 924 | + div.firstChild && div.firstChild.childNodes : |
| 925 | + |
| 926 | + // String was a bare <thead> or <tfoot> |
| 927 | + wrap[1] == "<table>" && !hasBody ? |
| 928 | + div.childNodes : |
| 929 | + []; |
| 930 | + |
| 931 | + for ( var j = tbody.length - 1; j >= 0 ; --j ) |
| 932 | + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
| 933 | + tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
| 934 | + |
| 935 | + } |
| 936 | + |
| 937 | + // IE completely kills leading whitespace when innerHTML is used |
| 938 | + if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) |
| 939 | + div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
| 940 | + |
| 941 | + elem = jQuery.makeArray( div.childNodes ); |
| 942 | + } |
| 943 | + |
| 944 | + if ( elem.nodeType ) |
| 945 | + ret.push( elem ); |
| 946 | + else |
| 947 | + ret = jQuery.merge( ret, elem ); |
| 948 | + |
| 949 | + }); |
| 950 | + |
| 951 | + if ( fragment ) { |
| 952 | + for ( var i = 0; ret[i]; i++ ) { |
| 953 | + if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
| 954 | + scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
| 955 | + } else { |
| 956 | + if ( ret[i].nodeType === 1 ) |
| 957 | + ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
| 958 | + fragment.appendChild( ret[i] ); |
| 959 | + } |
| 960 | + } |
| 961 | + |
| 962 | + return scripts; |
| 963 | + } |
| 964 | + |
| 965 | + return ret; |
| 966 | + }, |
| 967 | + |
| 968 | + attr: function( elem, name, value ) { |
| 969 | + // don't set attributes on text and comment nodes |
| 970 | + if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
| 971 | + return undefined; |
| 972 | + |
| 973 | + var notxml = !jQuery.isXMLDoc( elem ), |
| 974 | + // Whether we are setting (or getting) |
| 975 | + set = value !== undefined; |
| 976 | + |
| 977 | + // Try to normalize/fix the name |
| 978 | + name = notxml && jQuery.props[ name ] || name; |
| 979 | + |
| 980 | + // Only do all the following if this is a node (faster for style) |
| 981 | + // IE elem.getAttribute passes even for style |
| 982 | + if ( elem.tagName ) { |
| 983 | + |
| 984 | + // These attributes require special treatment |
| 985 | + var special = /href|src|style/.test( name ); |
| 986 | + |
| 987 | + // Safari mis-reports the default selected property of a hidden option |
| 988 | + // Accessing the parent's selectedIndex property fixes it |
| 989 | + if ( name == "selected" && elem.parentNode ) |
| 990 | + elem.parentNode.selectedIndex; |
| 991 | + |
| 992 | + // If applicable, access the attribute via the DOM 0 way |
| 993 | + if ( name in elem && notxml && !special ) { |
| 994 | + if ( set ){ |
| 995 | + // We can't allow the type property to be changed (since it causes problems in IE) |
| 996 | + if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) |
| 997 | + throw "type property can't be changed"; |
| 998 | + |
| 999 | + elem[ name ] = value; |
| 1000 | + } |
| 1001 | + |
| 1002 | + // browsers index elements by id/name on forms, give priority to attributes. |
| 1003 | + if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
| 1004 | + return elem.getAttributeNode( name ).nodeValue; |
| 1005 | + |
| 1006 | + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
| 1007 | + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
| 1008 | + if ( name == "tabIndex" ) { |
| 1009 | + var attributeNode = elem.getAttributeNode( "tabIndex" ); |
| 1010 | + return attributeNode && attributeNode.specified |
| 1011 | + ? attributeNode.value |
| 1012 | + : elem.nodeName.match(/(button|input|object|select|textarea)/i) |
| 1013 | + ? 0 |
| 1014 | + : elem.nodeName.match(/^(a|area)$/i) && elem.href |
| 1015 | + ? 0 |
| 1016 | + : undefined; |
| 1017 | + } |
| 1018 | + |
| 1019 | + return elem[ name ]; |
| 1020 | + } |
| 1021 | + |
| 1022 | + if ( !jQuery.support.style && notxml && name == "style" ) |
| 1023 | + return jQuery.attr( elem.style, "cssText", value ); |
| 1024 | + |
| 1025 | + if ( set ) |
| 1026 | + // convert the value to a string (all browsers do this but IE) see #1070 |
| 1027 | + elem.setAttribute( name, "" + value ); |
| 1028 | + |
| 1029 | + var attr = !jQuery.support.hrefNormalized && notxml && special |
| 1030 | + // Some attributes require a special call on IE |
| 1031 | + ? elem.getAttribute( name, 2 ) |
| 1032 | + : elem.getAttribute( name ); |
| 1033 | + |
| 1034 | + // Non-existent attributes return null, we normalize to undefined |
| 1035 | + return attr === null ? undefined : attr; |
| 1036 | + } |
| 1037 | + |
| 1038 | + // elem is actually elem.style ... set the style |
| 1039 | + |
| 1040 | + // IE uses filters for opacity |
| 1041 | + if ( !jQuery.support.opacity && name == "opacity" ) { |
| 1042 | + if ( set ) { |
| 1043 | + // IE has trouble with opacity if it does not have layout |
| 1044 | + // Force it by setting the zoom level |
| 1045 | + elem.zoom = 1; |
| 1046 | + |
| 1047 | + // Set the alpha filter to set the opacity |
| 1048 | + elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
| 1049 | + (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
| 1050 | + } |
| 1051 | + |
| 1052 | + return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? |
| 1053 | + (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
| 1054 | + ""; |
| 1055 | + } |
| 1056 | + |
| 1057 | + name = name.replace(/-([a-z])/ig, function(all, letter){ |
| 1058 | + return letter.toUpperCase(); |
| 1059 | + }); |
| 1060 | + |
| 1061 | + if ( set ) |
| 1062 | + elem[ name ] = value; |
| 1063 | + |
| 1064 | + return elem[ name ]; |
| 1065 | + }, |
| 1066 | + |
| 1067 | + trim: function( text ) { |
| 1068 | + return (text || "").replace( /^\s+|\s+$/g, "" ); |
| 1069 | + }, |
| 1070 | + |
| 1071 | + makeArray: function( array ) { |
| 1072 | + var ret = []; |
| 1073 | + |
| 1074 | + if( array != null ){ |
| 1075 | + var i = array.length; |
| 1076 | + // The window, strings (and functions) also have 'length' |
| 1077 | + if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) |
| 1078 | + ret[0] = array; |
| 1079 | + else |
| 1080 | + while( i ) |
| 1081 | + ret[--i] = array[i]; |
| 1082 | + } |
| 1083 | + |
| 1084 | + return ret; |
| 1085 | + }, |
| 1086 | + |
| 1087 | + inArray: function( elem, array ) { |
| 1088 | + for ( var i = 0, length = array.length; i < length; i++ ) |
| 1089 | + // Use === because on IE, window == document |
| 1090 | + if ( array[ i ] === elem ) |
| 1091 | + return i; |
| 1092 | + |
| 1093 | + return -1; |
| 1094 | + }, |
| 1095 | + |
| 1096 | + merge: function( first, second ) { |
| 1097 | + // We have to loop this way because IE & Opera overwrite the length |
| 1098 | + // expando of getElementsByTagName |
| 1099 | + var i = 0, elem, pos = first.length; |
| 1100 | + // Also, we need to make sure that the correct elements are being returned |
| 1101 | + // (IE returns comment nodes in a '*' query) |
| 1102 | + if ( !jQuery.support.getAll ) { |
| 1103 | + while ( (elem = second[ i++ ]) != null ) |
| 1104 | + if ( elem.nodeType != 8 ) |
| 1105 | + first[ pos++ ] = elem; |
| 1106 | + |
| 1107 | + } else |
| 1108 | + while ( (elem = second[ i++ ]) != null ) |
| 1109 | + first[ pos++ ] = elem; |
| 1110 | + |
| 1111 | + return first; |
| 1112 | + }, |
| 1113 | + |
| 1114 | + unique: function( array ) { |
| 1115 | + var ret = [], done = {}; |
| 1116 | + |
| 1117 | + try { |
| 1118 | + |
| 1119 | + for ( var i = 0, length = array.length; i < length; i++ ) { |
| 1120 | + var id = jQuery.data( array[ i ] ); |
| 1121 | + |
| 1122 | + if ( !done[ id ] ) { |
| 1123 | + done[ id ] = true; |
| 1124 | + ret.push( array[ i ] ); |
| 1125 | + } |
| 1126 | + } |
| 1127 | + |
| 1128 | + } catch( e ) { |
| 1129 | + ret = array; |
| 1130 | + } |
| 1131 | + |
| 1132 | + return ret; |
| 1133 | + }, |
| 1134 | + |
| 1135 | + grep: function( elems, callback, inv ) { |
| 1136 | + var ret = []; |
| 1137 | + |
| 1138 | + // Go through the array, only saving the items |
| 1139 | + // that pass the validator function |
| 1140 | + for ( var i = 0, length = elems.length; i < length; i++ ) |
| 1141 | + if ( !inv != !callback( elems[ i ], i ) ) |
| 1142 | + ret.push( elems[ i ] ); |
| 1143 | + |
| 1144 | + return ret; |
| 1145 | + }, |
| 1146 | + |
| 1147 | + map: function( elems, callback ) { |
| 1148 | + var ret = []; |
| 1149 | + |
| 1150 | + // Go through the array, translating each of the items to their |
| 1151 | + // new value (or values). |
| 1152 | + for ( var i = 0, length = elems.length; i < length; i++ ) { |
| 1153 | + var value = callback( elems[ i ], i ); |
| 1154 | + |
| 1155 | + if ( value != null ) |
| 1156 | + ret[ ret.length ] = value; |
| 1157 | + } |
| 1158 | + |
| 1159 | + return ret.concat.apply( [], ret ); |
| 1160 | + } |
| 1161 | +}); |
| 1162 | + |
| 1163 | +// Use of jQuery.browser is deprecated. |
| 1164 | +// It's included for backwards compatibility and plugins, |
| 1165 | +// although they should work to migrate away. |
| 1166 | + |
| 1167 | +var userAgent = navigator.userAgent.toLowerCase(); |
| 1168 | + |
| 1169 | +// Figure out what browser is being used |
| 1170 | +jQuery.browser = { |
| 1171 | + version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
| 1172 | + safari: /webkit/.test( userAgent ), |
| 1173 | + opera: /opera/.test( userAgent ), |
| 1174 | + msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
| 1175 | + mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
| 1176 | +}; |
| 1177 | + |
| 1178 | +jQuery.each({ |
| 1179 | + parent: function(elem){return elem.parentNode;}, |
| 1180 | + parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
| 1181 | + next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
| 1182 | + prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
| 1183 | + nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
| 1184 | + prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
| 1185 | + siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
| 1186 | + children: function(elem){return jQuery.sibling(elem.firstChild);}, |
| 1187 | + contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
| 1188 | +}, function(name, fn){ |
| 1189 | + jQuery.fn[ name ] = function( selector ) { |
| 1190 | + var ret = jQuery.map( this, fn ); |
| 1191 | + |
| 1192 | + if ( selector && typeof selector == "string" ) |
| 1193 | + ret = jQuery.multiFilter( selector, ret ); |
| 1194 | + |
| 1195 | + return this.pushStack( jQuery.unique( ret ), name, selector ); |
| 1196 | + }; |
| 1197 | +}); |
| 1198 | + |
| 1199 | +jQuery.each({ |
| 1200 | + appendTo: "append", |
| 1201 | + prependTo: "prepend", |
| 1202 | + insertBefore: "before", |
| 1203 | + insertAfter: "after", |
| 1204 | + replaceAll: "replaceWith" |
| 1205 | +}, function(name, original){ |
| 1206 | + jQuery.fn[ name ] = function( selector ) { |
| 1207 | + var ret = [], insert = jQuery( selector ); |
| 1208 | + |
| 1209 | + for ( var i = 0, l = insert.length; i < l; i++ ) { |
| 1210 | + var elems = (i > 0 ? this.clone(true) : this).get(); |
| 1211 | + jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
| 1212 | + ret = ret.concat( elems ); |
| 1213 | + } |
| 1214 | + |
| 1215 | + return this.pushStack( ret, name, selector ); |
| 1216 | + }; |
| 1217 | +}); |
| 1218 | + |
| 1219 | +jQuery.each({ |
| 1220 | + removeAttr: function( name ) { |
| 1221 | + jQuery.attr( this, name, "" ); |
| 1222 | + if (this.nodeType == 1) |
| 1223 | + this.removeAttribute( name ); |
| 1224 | + }, |
| 1225 | + |
| 1226 | + addClass: function( classNames ) { |
| 1227 | + jQuery.className.add( this, classNames ); |
| 1228 | + }, |
| 1229 | + |
| 1230 | + removeClass: function( classNames ) { |
| 1231 | + jQuery.className.remove( this, classNames ); |
| 1232 | + }, |
| 1233 | + |
| 1234 | + toggleClass: function( classNames, state ) { |
| 1235 | + if( typeof state !== "boolean" ) |
| 1236 | + state = !jQuery.className.has( this, classNames ); |
| 1237 | + jQuery.className[ state ? "add" : "remove" ]( this, classNames ); |
| 1238 | + }, |
| 1239 | + |
| 1240 | + remove: function( selector ) { |
| 1241 | + if ( !selector || jQuery.filter( selector, [ this ] ).length ) { |
| 1242 | + // Prevent memory leaks |
| 1243 | + jQuery( "*", this ).add([this]).each(function(){ |
| 1244 | + jQuery.event.remove(this); |
| 1245 | + jQuery.removeData(this); |
| 1246 | + }); |
| 1247 | + if (this.parentNode) |
| 1248 | + this.parentNode.removeChild( this ); |
| 1249 | + } |
| 1250 | + }, |
| 1251 | + |
| 1252 | + empty: function() { |
| 1253 | + // Remove element nodes and prevent memory leaks |
| 1254 | + jQuery(this).children().remove(); |
| 1255 | + |
| 1256 | + // Remove any remaining nodes |
| 1257 | + while ( this.firstChild ) |
| 1258 | + this.removeChild( this.firstChild ); |
| 1259 | + } |
| 1260 | +}, function(name, fn){ |
| 1261 | + jQuery.fn[ name ] = function(){ |
| 1262 | + return this.each( fn, arguments ); |
| 1263 | + }; |
| 1264 | +}); |
| 1265 | + |
| 1266 | +// Helper function used by the dimensions and offset modules |
| 1267 | +function num(elem, prop) { |
| 1268 | + return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; |
| 1269 | +} |
| 1270 | +var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
| 1271 | + |
| 1272 | +jQuery.extend({ |
| 1273 | + cache: {}, |
| 1274 | + |
| 1275 | + data: function( elem, name, data ) { |
| 1276 | + elem = elem == window ? |
| 1277 | + windowData : |
| 1278 | + elem; |
| 1279 | + |
| 1280 | + var id = elem[ expando ]; |
| 1281 | + |
| 1282 | + // Compute a unique ID for the element |
| 1283 | + if ( !id ) |
| 1284 | + id = elem[ expando ] = ++uuid; |
| 1285 | + |
| 1286 | + // Only generate the data cache if we're |
| 1287 | + // trying to access or manipulate it |
| 1288 | + if ( name && !jQuery.cache[ id ] ) |
| 1289 | + jQuery.cache[ id ] = {}; |
| 1290 | + |
| 1291 | + // Prevent overriding the named cache with undefined values |
| 1292 | + if ( data !== undefined ) |
| 1293 | + jQuery.cache[ id ][ name ] = data; |
| 1294 | + |
| 1295 | + // Return the named cache data, or the ID for the element |
| 1296 | + return name ? |
| 1297 | + jQuery.cache[ id ][ name ] : |
| 1298 | + id; |
| 1299 | + }, |
| 1300 | + |
| 1301 | + removeData: function( elem, name ) { |
| 1302 | + elem = elem == window ? |
| 1303 | + windowData : |
| 1304 | + elem; |
| 1305 | + |
| 1306 | + var id = elem[ expando ]; |
| 1307 | + |
| 1308 | + // If we want to remove a specific section of the element's data |
| 1309 | + if ( name ) { |
| 1310 | + if ( jQuery.cache[ id ] ) { |
| 1311 | + // Remove the section of cache data |
| 1312 | + delete jQuery.cache[ id ][ name ]; |
| 1313 | + |
| 1314 | + // If we've removed all the data, remove the element's cache |
| 1315 | + name = ""; |
| 1316 | + |
| 1317 | + for ( name in jQuery.cache[ id ] ) |
| 1318 | + break; |
| 1319 | + |
| 1320 | + if ( !name ) |
| 1321 | + jQuery.removeData( elem ); |
| 1322 | + } |
| 1323 | + |
| 1324 | + // Otherwise, we want to remove all of the element's data |
| 1325 | + } else { |
| 1326 | + // Clean up the element expando |
| 1327 | + try { |
| 1328 | + delete elem[ expando ]; |
| 1329 | + } catch(e){ |
| 1330 | + // IE has trouble directly removing the expando |
| 1331 | + // but it's ok with using removeAttribute |
| 1332 | + if ( elem.removeAttribute ) |
| 1333 | + elem.removeAttribute( expando ); |
| 1334 | + } |
| 1335 | + |
| 1336 | + // Completely remove the data cache |
| 1337 | + delete jQuery.cache[ id ]; |
| 1338 | + } |
| 1339 | + }, |
| 1340 | + queue: function( elem, type, data ) { |
| 1341 | + if ( elem ){ |
| 1342 | + |
| 1343 | + type = (type || "fx") + "queue"; |
| 1344 | + |
| 1345 | + var q = jQuery.data( elem, type ); |
| 1346 | + |
| 1347 | + if ( !q || jQuery.isArray(data) ) |
| 1348 | + q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
| 1349 | + else if( data ) |
| 1350 | + q.push( data ); |
| 1351 | + |
| 1352 | + } |
| 1353 | + return q; |
| 1354 | + }, |
| 1355 | + |
| 1356 | + dequeue: function( elem, type ){ |
| 1357 | + var queue = jQuery.queue( elem, type ), |
| 1358 | + fn = queue.shift(); |
| 1359 | + |
| 1360 | + if( !type || type === "fx" ) |
| 1361 | + fn = queue[0]; |
| 1362 | + |
| 1363 | + if( fn !== undefined ) |
| 1364 | + fn.call(elem); |
| 1365 | + } |
| 1366 | +}); |
| 1367 | + |
| 1368 | +jQuery.fn.extend({ |
| 1369 | + data: function( key, value ){ |
| 1370 | + var parts = key.split("."); |
| 1371 | + parts[1] = parts[1] ? "." + parts[1] : ""; |
| 1372 | + |
| 1373 | + if ( value === undefined ) { |
| 1374 | + var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
| 1375 | + |
| 1376 | + if ( data === undefined && this.length ) |
| 1377 | + data = jQuery.data( this[0], key ); |
| 1378 | + |
| 1379 | + return data === undefined && parts[1] ? |
| 1380 | + this.data( parts[0] ) : |
| 1381 | + data; |
| 1382 | + } else |
| 1383 | + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ |
| 1384 | + jQuery.data( this, key, value ); |
| 1385 | + }); |
| 1386 | + }, |
| 1387 | + |
| 1388 | + removeData: function( key ){ |
| 1389 | + return this.each(function(){ |
| 1390 | + jQuery.removeData( this, key ); |
| 1391 | + }); |
| 1392 | + }, |
| 1393 | + queue: function(type, data){ |
| 1394 | + if ( typeof type !== "string" ) { |
| 1395 | + data = type; |
| 1396 | + type = "fx"; |
| 1397 | + } |
| 1398 | + |
| 1399 | + if ( data === undefined ) |
| 1400 | + return jQuery.queue( this[0], type ); |
| 1401 | + |
| 1402 | + return this.each(function(){ |
| 1403 | + var queue = jQuery.queue( this, type, data ); |
| 1404 | + |
| 1405 | + if( type == "fx" && queue.length == 1 ) |
| 1406 | + queue[0].call(this); |
| 1407 | + }); |
| 1408 | + }, |
| 1409 | + dequeue: function(type){ |
| 1410 | + return this.each(function(){ |
| 1411 | + jQuery.dequeue( this, type ); |
| 1412 | + }); |
| 1413 | + } |
| 1414 | +});/*! |
| 1415 | + * Sizzle CSS Selector Engine - v0.9.3 |
| 1416 | + * Copyright 2009, The Dojo Foundation |
| 1417 | + * Released under the MIT, BSD, and GPL Licenses. |
| 1418 | + * More information: http://sizzlejs.com/ |
| 1419 | + */ |
| 1420 | +(function(){ |
| 1421 | + |
| 1422 | +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
| 1423 | + done = 0, |
| 1424 | + toString = Object.prototype.toString; |
| 1425 | + |
| 1426 | +var Sizzle = function(selector, context, results, seed) { |
| 1427 | + results = results || []; |
| 1428 | + context = context || document; |
| 1429 | + |
| 1430 | + if ( context.nodeType !== 1 && context.nodeType !== 9 ) |
| 1431 | + return []; |
| 1432 | + |
| 1433 | + if ( !selector || typeof selector !== "string" ) { |
| 1434 | + return results; |
| 1435 | + } |
| 1436 | + |
| 1437 | + var parts = [], m, set, checkSet, check, mode, extra, prune = true; |
| 1438 | + |
| 1439 | + // Reset the position of the chunker regexp (start from head) |
| 1440 | + chunker.lastIndex = 0; |
| 1441 | + |
| 1442 | + while ( (m = chunker.exec(selector)) !== null ) { |
| 1443 | + parts.push( m[1] ); |
| 1444 | + |
| 1445 | + if ( m[2] ) { |
| 1446 | + extra = RegExp.rightContext; |
| 1447 | + break; |
| 1448 | + } |
| 1449 | + } |
| 1450 | + |
| 1451 | + if ( parts.length > 1 && origPOS.exec( selector ) ) { |
| 1452 | + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
| 1453 | + set = posProcess( parts[0] + parts[1], context ); |
| 1454 | + } else { |
| 1455 | + set = Expr.relative[ parts[0] ] ? |
| 1456 | + [ context ] : |
| 1457 | + Sizzle( parts.shift(), context ); |
| 1458 | + |
| 1459 | + while ( parts.length ) { |
| 1460 | + selector = parts.shift(); |
| 1461 | + |
| 1462 | + if ( Expr.relative[ selector ] ) |
| 1463 | + selector += parts.shift(); |
| 1464 | + |
| 1465 | + set = posProcess( selector, set ); |
| 1466 | + } |
| 1467 | + } |
| 1468 | + } else { |
| 1469 | + var ret = seed ? |
| 1470 | + { expr: parts.pop(), set: makeArray(seed) } : |
| 1471 | + Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) ); |
| 1472 | + set = Sizzle.filter( ret.expr, ret.set ); |
| 1473 | + |
| 1474 | + if ( parts.length > 0 ) { |
| 1475 | + checkSet = makeArray(set); |
| 1476 | + } else { |
| 1477 | + prune = false; |
| 1478 | + } |
| 1479 | + |
| 1480 | + while ( parts.length ) { |
| 1481 | + var cur = parts.pop(), pop = cur; |
| 1482 | + |
| 1483 | + if ( !Expr.relative[ cur ] ) { |
| 1484 | + cur = ""; |
| 1485 | + } else { |
| 1486 | + pop = parts.pop(); |
| 1487 | + } |
| 1488 | + |
| 1489 | + if ( pop == null ) { |
| 1490 | + pop = context; |
| 1491 | + } |
| 1492 | + |
| 1493 | + Expr.relative[ cur ]( checkSet, pop, isXML(context) ); |
| 1494 | + } |
| 1495 | + } |
| 1496 | + |
| 1497 | + if ( !checkSet ) { |
| 1498 | + checkSet = set; |
| 1499 | + } |
| 1500 | + |
| 1501 | + if ( !checkSet ) { |
| 1502 | + throw "Syntax error, unrecognized expression: " + (cur || selector); |
| 1503 | + } |
| 1504 | + |
| 1505 | + if ( toString.call(checkSet) === "[object Array]" ) { |
| 1506 | + if ( !prune ) { |
| 1507 | + results.push.apply( results, checkSet ); |
| 1508 | + } else if ( context.nodeType === 1 ) { |
| 1509 | + for ( var i = 0; checkSet[i] != null; i++ ) { |
| 1510 | + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
| 1511 | + results.push( set[i] ); |
| 1512 | + } |
| 1513 | + } |
| 1514 | + } else { |
| 1515 | + for ( var i = 0; checkSet[i] != null; i++ ) { |
| 1516 | + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
| 1517 | + results.push( set[i] ); |
| 1518 | + } |
| 1519 | + } |
| 1520 | + } |
| 1521 | + } else { |
| 1522 | + makeArray( checkSet, results ); |
| 1523 | + } |
| 1524 | + |
| 1525 | + if ( extra ) { |
| 1526 | + Sizzle( extra, context, results, seed ); |
| 1527 | + |
| 1528 | + if ( sortOrder ) { |
| 1529 | + hasDuplicate = false; |
| 1530 | + results.sort(sortOrder); |
| 1531 | + |
| 1532 | + if ( hasDuplicate ) { |
| 1533 | + for ( var i = 1; i < results.length; i++ ) { |
| 1534 | + if ( results[i] === results[i-1] ) { |
| 1535 | + results.splice(i--, 1); |
| 1536 | + } |
| 1537 | + } |
| 1538 | + } |
| 1539 | + } |
| 1540 | + } |
| 1541 | + |
| 1542 | + return results; |
| 1543 | +}; |
| 1544 | + |
| 1545 | +Sizzle.matches = function(expr, set){ |
| 1546 | + return Sizzle(expr, null, null, set); |
| 1547 | +}; |
| 1548 | + |
| 1549 | +Sizzle.find = function(expr, context, isXML){ |
| 1550 | + var set, match; |
| 1551 | + |
| 1552 | + if ( !expr ) { |
| 1553 | + return []; |
| 1554 | + } |
| 1555 | + |
| 1556 | + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
| 1557 | + var type = Expr.order[i], match; |
| 1558 | + |
| 1559 | + if ( (match = Expr.match[ type ].exec( expr )) ) { |
| 1560 | + var left = RegExp.leftContext; |
| 1561 | + |
| 1562 | + if ( left.substr( left.length - 1 ) !== "\\" ) { |
| 1563 | + match[1] = (match[1] || "").replace(/\\/g, ""); |
| 1564 | + set = Expr.find[ type ]( match, context, isXML ); |
| 1565 | + if ( set != null ) { |
| 1566 | + expr = expr.replace( Expr.match[ type ], "" ); |
| 1567 | + break; |
| 1568 | + } |
| 1569 | + } |
| 1570 | + } |
| 1571 | + } |
| 1572 | + |
| 1573 | + if ( !set ) { |
| 1574 | + set = context.getElementsByTagName("*"); |
| 1575 | + } |
| 1576 | + |
| 1577 | + return {set: set, expr: expr}; |
| 1578 | +}; |
| 1579 | + |
| 1580 | +Sizzle.filter = function(expr, set, inplace, not){ |
| 1581 | + var old = expr, result = [], curLoop = set, match, anyFound, |
| 1582 | + isXMLFilter = set && set[0] && isXML(set[0]); |
| 1583 | + |
| 1584 | + while ( expr && set.length ) { |
| 1585 | + for ( var type in Expr.filter ) { |
| 1586 | + if ( (match = Expr.match[ type ].exec( expr )) != null ) { |
| 1587 | + var filter = Expr.filter[ type ], found, item; |
| 1588 | + anyFound = false; |
| 1589 | + |
| 1590 | + if ( curLoop == result ) { |
| 1591 | + result = []; |
| 1592 | + } |
| 1593 | + |
| 1594 | + if ( Expr.preFilter[ type ] ) { |
| 1595 | + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
| 1596 | + |
| 1597 | + if ( !match ) { |
| 1598 | + anyFound = found = true; |
| 1599 | + } else if ( match === true ) { |
| 1600 | + continue; |
| 1601 | + } |
| 1602 | + } |
| 1603 | + |
| 1604 | + if ( match ) { |
| 1605 | + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
| 1606 | + if ( item ) { |
| 1607 | + found = filter( item, match, i, curLoop ); |
| 1608 | + var pass = not ^ !!found; |
| 1609 | + |
| 1610 | + if ( inplace && found != null ) { |
| 1611 | + if ( pass ) { |
| 1612 | + anyFound = true; |
| 1613 | + } else { |
| 1614 | + curLoop[i] = false; |
| 1615 | + } |
| 1616 | + } else if ( pass ) { |
| 1617 | + result.push( item ); |
| 1618 | + anyFound = true; |
| 1619 | + } |
| 1620 | + } |
| 1621 | + } |
| 1622 | + } |
| 1623 | + |
| 1624 | + if ( found !== undefined ) { |
| 1625 | + if ( !inplace ) { |
| 1626 | + curLoop = result; |
| 1627 | + } |
| 1628 | + |
| 1629 | + expr = expr.replace( Expr.match[ type ], "" ); |
| 1630 | + |
| 1631 | + if ( !anyFound ) { |
| 1632 | + return []; |
| 1633 | + } |
| 1634 | + |
| 1635 | + break; |
| 1636 | + } |
| 1637 | + } |
| 1638 | + } |
| 1639 | + |
| 1640 | + // Improper expression |
| 1641 | + if ( expr == old ) { |
| 1642 | + if ( anyFound == null ) { |
| 1643 | + throw "Syntax error, unrecognized expression: " + expr; |
| 1644 | + } else { |
| 1645 | + break; |
| 1646 | + } |
| 1647 | + } |
| 1648 | + |
| 1649 | + old = expr; |
| 1650 | + } |
| 1651 | + |
| 1652 | + return curLoop; |
| 1653 | +}; |
| 1654 | + |
| 1655 | +var Expr = Sizzle.selectors = { |
| 1656 | + order: [ "ID", "NAME", "TAG" ], |
| 1657 | + match: { |
| 1658 | + ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
| 1659 | + CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
| 1660 | + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, |
| 1661 | + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
| 1662 | + TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, |
| 1663 | + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
| 1664 | + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
| 1665 | + PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ |
| 1666 | + }, |
| 1667 | + attrMap: { |
| 1668 | + "class": "className", |
| 1669 | + "for": "htmlFor" |
| 1670 | + }, |
| 1671 | + attrHandle: { |
| 1672 | + href: function(elem){ |
| 1673 | + return elem.getAttribute("href"); |
| 1674 | + } |
| 1675 | + }, |
| 1676 | + relative: { |
| 1677 | + "+": function(checkSet, part, isXML){ |
| 1678 | + var isPartStr = typeof part === "string", |
| 1679 | + isTag = isPartStr && !/\W/.test(part), |
| 1680 | + isPartStrNotTag = isPartStr && !isTag; |
| 1681 | + |
| 1682 | + if ( isTag && !isXML ) { |
| 1683 | + part = part.toUpperCase(); |
| 1684 | + } |
| 1685 | + |
| 1686 | + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
| 1687 | + if ( (elem = checkSet[i]) ) { |
| 1688 | + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
| 1689 | + |
| 1690 | + checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? |
| 1691 | + elem || false : |
| 1692 | + elem === part; |
| 1693 | + } |
| 1694 | + } |
| 1695 | + |
| 1696 | + if ( isPartStrNotTag ) { |
| 1697 | + Sizzle.filter( part, checkSet, true ); |
| 1698 | + } |
| 1699 | + }, |
| 1700 | + ">": function(checkSet, part, isXML){ |
| 1701 | + var isPartStr = typeof part === "string"; |
| 1702 | + |
| 1703 | + if ( isPartStr && !/\W/.test(part) ) { |
| 1704 | + part = isXML ? part : part.toUpperCase(); |
| 1705 | + |
| 1706 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 1707 | + var elem = checkSet[i]; |
| 1708 | + if ( elem ) { |
| 1709 | + var parent = elem.parentNode; |
| 1710 | + checkSet[i] = parent.nodeName === part ? parent : false; |
| 1711 | + } |
| 1712 | + } |
| 1713 | + } else { |
| 1714 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 1715 | + var elem = checkSet[i]; |
| 1716 | + if ( elem ) { |
| 1717 | + checkSet[i] = isPartStr ? |
| 1718 | + elem.parentNode : |
| 1719 | + elem.parentNode === part; |
| 1720 | + } |
| 1721 | + } |
| 1722 | + |
| 1723 | + if ( isPartStr ) { |
| 1724 | + Sizzle.filter( part, checkSet, true ); |
| 1725 | + } |
| 1726 | + } |
| 1727 | + }, |
| 1728 | + "": function(checkSet, part, isXML){ |
| 1729 | + var doneName = done++, checkFn = dirCheck; |
| 1730 | + |
| 1731 | + if ( !part.match(/\W/) ) { |
| 1732 | + var nodeCheck = part = isXML ? part : part.toUpperCase(); |
| 1733 | + checkFn = dirNodeCheck; |
| 1734 | + } |
| 1735 | + |
| 1736 | + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
| 1737 | + }, |
| 1738 | + "~": function(checkSet, part, isXML){ |
| 1739 | + var doneName = done++, checkFn = dirCheck; |
| 1740 | + |
| 1741 | + if ( typeof part === "string" && !part.match(/\W/) ) { |
| 1742 | + var nodeCheck = part = isXML ? part : part.toUpperCase(); |
| 1743 | + checkFn = dirNodeCheck; |
| 1744 | + } |
| 1745 | + |
| 1746 | + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
| 1747 | + } |
| 1748 | + }, |
| 1749 | + find: { |
| 1750 | + ID: function(match, context, isXML){ |
| 1751 | + if ( typeof context.getElementById !== "undefined" && !isXML ) { |
| 1752 | + var m = context.getElementById(match[1]); |
| 1753 | + return m ? [m] : []; |
| 1754 | + } |
| 1755 | + }, |
| 1756 | + NAME: function(match, context, isXML){ |
| 1757 | + if ( typeof context.getElementsByName !== "undefined" ) { |
| 1758 | + var ret = [], results = context.getElementsByName(match[1]); |
| 1759 | + |
| 1760 | + for ( var i = 0, l = results.length; i < l; i++ ) { |
| 1761 | + if ( results[i].getAttribute("name") === match[1] ) { |
| 1762 | + ret.push( results[i] ); |
| 1763 | + } |
| 1764 | + } |
| 1765 | + |
| 1766 | + return ret.length === 0 ? null : ret; |
| 1767 | + } |
| 1768 | + }, |
| 1769 | + TAG: function(match, context){ |
| 1770 | + return context.getElementsByTagName(match[1]); |
| 1771 | + } |
| 1772 | + }, |
| 1773 | + preFilter: { |
| 1774 | + CLASS: function(match, curLoop, inplace, result, not, isXML){ |
| 1775 | + match = " " + match[1].replace(/\\/g, "") + " "; |
| 1776 | + |
| 1777 | + if ( isXML ) { |
| 1778 | + return match; |
| 1779 | + } |
| 1780 | + |
| 1781 | + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
| 1782 | + if ( elem ) { |
| 1783 | + if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { |
| 1784 | + if ( !inplace ) |
| 1785 | + result.push( elem ); |
| 1786 | + } else if ( inplace ) { |
| 1787 | + curLoop[i] = false; |
| 1788 | + } |
| 1789 | + } |
| 1790 | + } |
| 1791 | + |
| 1792 | + return false; |
| 1793 | + }, |
| 1794 | + ID: function(match){ |
| 1795 | + return match[1].replace(/\\/g, ""); |
| 1796 | + }, |
| 1797 | + TAG: function(match, curLoop){ |
| 1798 | + for ( var i = 0; curLoop[i] === false; i++ ){} |
| 1799 | + return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); |
| 1800 | + }, |
| 1801 | + CHILD: function(match){ |
| 1802 | + if ( match[1] == "nth" ) { |
| 1803 | + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
| 1804 | + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
| 1805 | + match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || |
| 1806 | + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
| 1807 | + |
| 1808 | + // calculate the numbers (first)n+(last) including if they are negative |
| 1809 | + match[2] = (test[1] + (test[2] || 1)) - 0; |
| 1810 | + match[3] = test[3] - 0; |
| 1811 | + } |
| 1812 | + |
| 1813 | + // TODO: Move to normal caching system |
| 1814 | + match[0] = done++; |
| 1815 | + |
| 1816 | + return match; |
| 1817 | + }, |
| 1818 | + ATTR: function(match, curLoop, inplace, result, not, isXML){ |
| 1819 | + var name = match[1].replace(/\\/g, ""); |
| 1820 | + |
| 1821 | + if ( !isXML && Expr.attrMap[name] ) { |
| 1822 | + match[1] = Expr.attrMap[name]; |
| 1823 | + } |
| 1824 | + |
| 1825 | + if ( match[2] === "~=" ) { |
| 1826 | + match[4] = " " + match[4] + " "; |
| 1827 | + } |
| 1828 | + |
| 1829 | + return match; |
| 1830 | + }, |
| 1831 | + PSEUDO: function(match, curLoop, inplace, result, not){ |
| 1832 | + if ( match[1] === "not" ) { |
| 1833 | + // If we're dealing with a complex expression, or a simple one |
| 1834 | + if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { |
| 1835 | + match[3] = Sizzle(match[3], null, null, curLoop); |
| 1836 | + } else { |
| 1837 | + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
| 1838 | + if ( !inplace ) { |
| 1839 | + result.push.apply( result, ret ); |
| 1840 | + } |
| 1841 | + return false; |
| 1842 | + } |
| 1843 | + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
| 1844 | + return true; |
| 1845 | + } |
| 1846 | + |
| 1847 | + return match; |
| 1848 | + }, |
| 1849 | + POS: function(match){ |
| 1850 | + match.unshift( true ); |
| 1851 | + return match; |
| 1852 | + } |
| 1853 | + }, |
| 1854 | + filters: { |
| 1855 | + enabled: function(elem){ |
| 1856 | + return elem.disabled === false && elem.type !== "hidden"; |
| 1857 | + }, |
| 1858 | + disabled: function(elem){ |
| 1859 | + return elem.disabled === true; |
| 1860 | + }, |
| 1861 | + checked: function(elem){ |
| 1862 | + return elem.checked === true; |
| 1863 | + }, |
| 1864 | + selected: function(elem){ |
| 1865 | + // Accessing this property makes selected-by-default |
| 1866 | + // options in Safari work properly |
| 1867 | + elem.parentNode.selectedIndex; |
| 1868 | + return elem.selected === true; |
| 1869 | + }, |
| 1870 | + parent: function(elem){ |
| 1871 | + return !!elem.firstChild; |
| 1872 | + }, |
| 1873 | + empty: function(elem){ |
| 1874 | + return !elem.firstChild; |
| 1875 | + }, |
| 1876 | + has: function(elem, i, match){ |
| 1877 | + return !!Sizzle( match[3], elem ).length; |
| 1878 | + }, |
| 1879 | + header: function(elem){ |
| 1880 | + return /h\d/i.test( elem.nodeName ); |
| 1881 | + }, |
| 1882 | + text: function(elem){ |
| 1883 | + return "text" === elem.type; |
| 1884 | + }, |
| 1885 | + radio: function(elem){ |
| 1886 | + return "radio" === elem.type; |
| 1887 | + }, |
| 1888 | + checkbox: function(elem){ |
| 1889 | + return "checkbox" === elem.type; |
| 1890 | + }, |
| 1891 | + file: function(elem){ |
| 1892 | + return "file" === elem.type; |
| 1893 | + }, |
| 1894 | + password: function(elem){ |
| 1895 | + return "password" === elem.type; |
| 1896 | + }, |
| 1897 | + submit: function(elem){ |
| 1898 | + return "submit" === elem.type; |
| 1899 | + }, |
| 1900 | + image: function(elem){ |
| 1901 | + return "image" === elem.type; |
| 1902 | + }, |
| 1903 | + reset: function(elem){ |
| 1904 | + return "reset" === elem.type; |
| 1905 | + }, |
| 1906 | + button: function(elem){ |
| 1907 | + return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; |
| 1908 | + }, |
| 1909 | + input: function(elem){ |
| 1910 | + return /input|select|textarea|button/i.test(elem.nodeName); |
| 1911 | + } |
| 1912 | + }, |
| 1913 | + setFilters: { |
| 1914 | + first: function(elem, i){ |
| 1915 | + return i === 0; |
| 1916 | + }, |
| 1917 | + last: function(elem, i, match, array){ |
| 1918 | + return i === array.length - 1; |
| 1919 | + }, |
| 1920 | + even: function(elem, i){ |
| 1921 | + return i % 2 === 0; |
| 1922 | + }, |
| 1923 | + odd: function(elem, i){ |
| 1924 | + return i % 2 === 1; |
| 1925 | + }, |
| 1926 | + lt: function(elem, i, match){ |
| 1927 | + return i < match[3] - 0; |
| 1928 | + }, |
| 1929 | + gt: function(elem, i, match){ |
| 1930 | + return i > match[3] - 0; |
| 1931 | + }, |
| 1932 | + nth: function(elem, i, match){ |
| 1933 | + return match[3] - 0 == i; |
| 1934 | + }, |
| 1935 | + eq: function(elem, i, match){ |
| 1936 | + return match[3] - 0 == i; |
| 1937 | + } |
| 1938 | + }, |
| 1939 | + filter: { |
| 1940 | + PSEUDO: function(elem, match, i, array){ |
| 1941 | + var name = match[1], filter = Expr.filters[ name ]; |
| 1942 | + |
| 1943 | + if ( filter ) { |
| 1944 | + return filter( elem, i, match, array ); |
| 1945 | + } else if ( name === "contains" ) { |
| 1946 | + return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; |
| 1947 | + } else if ( name === "not" ) { |
| 1948 | + var not = match[3]; |
| 1949 | + |
| 1950 | + for ( var i = 0, l = not.length; i < l; i++ ) { |
| 1951 | + if ( not[i] === elem ) { |
| 1952 | + return false; |
| 1953 | + } |
| 1954 | + } |
| 1955 | + |
| 1956 | + return true; |
| 1957 | + } |
| 1958 | + }, |
| 1959 | + CHILD: function(elem, match){ |
| 1960 | + var type = match[1], node = elem; |
| 1961 | + switch (type) { |
| 1962 | + case 'only': |
| 1963 | + case 'first': |
| 1964 | + while (node = node.previousSibling) { |
| 1965 | + if ( node.nodeType === 1 ) return false; |
| 1966 | + } |
| 1967 | + if ( type == 'first') return true; |
| 1968 | + node = elem; |
| 1969 | + case 'last': |
| 1970 | + while (node = node.nextSibling) { |
| 1971 | + if ( node.nodeType === 1 ) return false; |
| 1972 | + } |
| 1973 | + return true; |
| 1974 | + case 'nth': |
| 1975 | + var first = match[2], last = match[3]; |
| 1976 | + |
| 1977 | + if ( first == 1 && last == 0 ) { |
| 1978 | + return true; |
| 1979 | + } |
| 1980 | + |
| 1981 | + var doneName = match[0], |
| 1982 | + parent = elem.parentNode; |
| 1983 | + |
| 1984 | + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
| 1985 | + var count = 0; |
| 1986 | + for ( node = parent.firstChild; node; node = node.nextSibling ) { |
| 1987 | + if ( node.nodeType === 1 ) { |
| 1988 | + node.nodeIndex = ++count; |
| 1989 | + } |
| 1990 | + } |
| 1991 | + parent.sizcache = doneName; |
| 1992 | + } |
| 1993 | + |
| 1994 | + var diff = elem.nodeIndex - last; |
| 1995 | + if ( first == 0 ) { |
| 1996 | + return diff == 0; |
| 1997 | + } else { |
| 1998 | + return ( diff % first == 0 && diff / first >= 0 ); |
| 1999 | + } |
| 2000 | + } |
| 2001 | + }, |
| 2002 | + ID: function(elem, match){ |
| 2003 | + return elem.nodeType === 1 && elem.getAttribute("id") === match; |
| 2004 | + }, |
| 2005 | + TAG: function(elem, match){ |
| 2006 | + return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; |
| 2007 | + }, |
| 2008 | + CLASS: function(elem, match){ |
| 2009 | + return (" " + (elem.className || elem.getAttribute("class")) + " ") |
| 2010 | + .indexOf( match ) > -1; |
| 2011 | + }, |
| 2012 | + ATTR: function(elem, match){ |
| 2013 | + var name = match[1], |
| 2014 | + result = Expr.attrHandle[ name ] ? |
| 2015 | + Expr.attrHandle[ name ]( elem ) : |
| 2016 | + elem[ name ] != null ? |
| 2017 | + elem[ name ] : |
| 2018 | + elem.getAttribute( name ), |
| 2019 | + value = result + "", |
| 2020 | + type = match[2], |
| 2021 | + check = match[4]; |
| 2022 | + |
| 2023 | + return result == null ? |
| 2024 | + type === "!=" : |
| 2025 | + type === "=" ? |
| 2026 | + value === check : |
| 2027 | + type === "*=" ? |
| 2028 | + value.indexOf(check) >= 0 : |
| 2029 | + type === "~=" ? |
| 2030 | + (" " + value + " ").indexOf(check) >= 0 : |
| 2031 | + !check ? |
| 2032 | + value && result !== false : |
| 2033 | + type === "!=" ? |
| 2034 | + value != check : |
| 2035 | + type === "^=" ? |
| 2036 | + value.indexOf(check) === 0 : |
| 2037 | + type === "$=" ? |
| 2038 | + value.substr(value.length - check.length) === check : |
| 2039 | + type === "|=" ? |
| 2040 | + value === check || value.substr(0, check.length + 1) === check + "-" : |
| 2041 | + false; |
| 2042 | + }, |
| 2043 | + POS: function(elem, match, i, array){ |
| 2044 | + var name = match[2], filter = Expr.setFilters[ name ]; |
| 2045 | + |
| 2046 | + if ( filter ) { |
| 2047 | + return filter( elem, i, match, array ); |
| 2048 | + } |
| 2049 | + } |
| 2050 | + } |
| 2051 | +}; |
| 2052 | + |
| 2053 | +var origPOS = Expr.match.POS; |
| 2054 | + |
| 2055 | +for ( var type in Expr.match ) { |
| 2056 | + Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
| 2057 | +} |
| 2058 | + |
| 2059 | +var makeArray = function(array, results) { |
| 2060 | + array = Array.prototype.slice.call( array ); |
| 2061 | + |
| 2062 | + if ( results ) { |
| 2063 | + results.push.apply( results, array ); |
| 2064 | + return results; |
| 2065 | + } |
| 2066 | + |
| 2067 | + return array; |
| 2068 | +}; |
| 2069 | + |
| 2070 | +// Perform a simple check to determine if the browser is capable of |
| 2071 | +// converting a NodeList to an array using builtin methods. |
| 2072 | +try { |
| 2073 | + Array.prototype.slice.call( document.documentElement.childNodes ); |
| 2074 | + |
| 2075 | +// Provide a fallback method if it does not work |
| 2076 | +} catch(e){ |
| 2077 | + makeArray = function(array, results) { |
| 2078 | + var ret = results || []; |
| 2079 | + |
| 2080 | + if ( toString.call(array) === "[object Array]" ) { |
| 2081 | + Array.prototype.push.apply( ret, array ); |
| 2082 | + } else { |
| 2083 | + if ( typeof array.length === "number" ) { |
| 2084 | + for ( var i = 0, l = array.length; i < l; i++ ) { |
| 2085 | + ret.push( array[i] ); |
| 2086 | + } |
| 2087 | + } else { |
| 2088 | + for ( var i = 0; array[i]; i++ ) { |
| 2089 | + ret.push( array[i] ); |
| 2090 | + } |
| 2091 | + } |
| 2092 | + } |
| 2093 | + |
| 2094 | + return ret; |
| 2095 | + }; |
| 2096 | +} |
| 2097 | + |
| 2098 | +var sortOrder; |
| 2099 | + |
| 2100 | +if ( document.documentElement.compareDocumentPosition ) { |
| 2101 | + sortOrder = function( a, b ) { |
| 2102 | + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
| 2103 | + if ( ret === 0 ) { |
| 2104 | + hasDuplicate = true; |
| 2105 | + } |
| 2106 | + return ret; |
| 2107 | + }; |
| 2108 | +} else if ( "sourceIndex" in document.documentElement ) { |
| 2109 | + sortOrder = function( a, b ) { |
| 2110 | + var ret = a.sourceIndex - b.sourceIndex; |
| 2111 | + if ( ret === 0 ) { |
| 2112 | + hasDuplicate = true; |
| 2113 | + } |
| 2114 | + return ret; |
| 2115 | + }; |
| 2116 | +} else if ( document.createRange ) { |
| 2117 | + sortOrder = function( a, b ) { |
| 2118 | + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
| 2119 | + aRange.selectNode(a); |
| 2120 | + aRange.collapse(true); |
| 2121 | + bRange.selectNode(b); |
| 2122 | + bRange.collapse(true); |
| 2123 | + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
| 2124 | + if ( ret === 0 ) { |
| 2125 | + hasDuplicate = true; |
| 2126 | + } |
| 2127 | + return ret; |
| 2128 | + }; |
| 2129 | +} |
| 2130 | + |
| 2131 | +// Check to see if the browser returns elements by name when |
| 2132 | +// querying by getElementById (and provide a workaround) |
| 2133 | +(function(){ |
| 2134 | + // We're going to inject a fake input element with a specified name |
| 2135 | + var form = document.createElement("form"), |
| 2136 | + id = "script" + (new Date).getTime(); |
| 2137 | + form.innerHTML = "<input name='" + id + "'/>"; |
| 2138 | + |
| 2139 | + // Inject it into the root element, check its status, and remove it quickly |
| 2140 | + var root = document.documentElement; |
| 2141 | + root.insertBefore( form, root.firstChild ); |
| 2142 | + |
| 2143 | + // The workaround has to do additional checks after a getElementById |
| 2144 | + // Which slows things down for other browsers (hence the branching) |
| 2145 | + if ( !!document.getElementById( id ) ) { |
| 2146 | + Expr.find.ID = function(match, context, isXML){ |
| 2147 | + if ( typeof context.getElementById !== "undefined" && !isXML ) { |
| 2148 | + var m = context.getElementById(match[1]); |
| 2149 | + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
| 2150 | + } |
| 2151 | + }; |
| 2152 | + |
| 2153 | + Expr.filter.ID = function(elem, match){ |
| 2154 | + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
| 2155 | + return elem.nodeType === 1 && node && node.nodeValue === match; |
| 2156 | + }; |
| 2157 | + } |
| 2158 | + |
| 2159 | + root.removeChild( form ); |
| 2160 | +})(); |
| 2161 | + |
| 2162 | +(function(){ |
| 2163 | + // Check to see if the browser returns only elements |
| 2164 | + // when doing getElementsByTagName("*") |
| 2165 | + |
| 2166 | + // Create a fake element |
| 2167 | + var div = document.createElement("div"); |
| 2168 | + div.appendChild( document.createComment("") ); |
| 2169 | + |
| 2170 | + // Make sure no comments are found |
| 2171 | + if ( div.getElementsByTagName("*").length > 0 ) { |
| 2172 | + Expr.find.TAG = function(match, context){ |
| 2173 | + var results = context.getElementsByTagName(match[1]); |
| 2174 | + |
| 2175 | + // Filter out possible comments |
| 2176 | + if ( match[1] === "*" ) { |
| 2177 | + var tmp = []; |
| 2178 | + |
| 2179 | + for ( var i = 0; results[i]; i++ ) { |
| 2180 | + if ( results[i].nodeType === 1 ) { |
| 2181 | + tmp.push( results[i] ); |
| 2182 | + } |
| 2183 | + } |
| 2184 | + |
| 2185 | + results = tmp; |
| 2186 | + } |
| 2187 | + |
| 2188 | + return results; |
| 2189 | + }; |
| 2190 | + } |
| 2191 | + |
| 2192 | + // Check to see if an attribute returns normalized href attributes |
| 2193 | + div.innerHTML = "<a href='#'></a>"; |
| 2194 | + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
| 2195 | + div.firstChild.getAttribute("href") !== "#" ) { |
| 2196 | + Expr.attrHandle.href = function(elem){ |
| 2197 | + return elem.getAttribute("href", 2); |
| 2198 | + }; |
| 2199 | + } |
| 2200 | +})(); |
| 2201 | + |
| 2202 | +if ( document.querySelectorAll ) (function(){ |
| 2203 | + var oldSizzle = Sizzle, div = document.createElement("div"); |
| 2204 | + div.innerHTML = "<p class='TEST'></p>"; |
| 2205 | + |
| 2206 | + // Safari can't handle uppercase or unicode characters when |
| 2207 | + // in quirks mode. |
| 2208 | + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
| 2209 | + return; |
| 2210 | + } |
| 2211 | + |
| 2212 | + Sizzle = function(query, context, extra, seed){ |
| 2213 | + context = context || document; |
| 2214 | + |
| 2215 | + // Only use querySelectorAll on non-XML documents |
| 2216 | + // (ID selectors don't work in non-HTML documents) |
| 2217 | + if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
| 2218 | + try { |
| 2219 | + return makeArray( context.querySelectorAll(query), extra ); |
| 2220 | + } catch(e){} |
| 2221 | + } |
| 2222 | + |
| 2223 | + return oldSizzle(query, context, extra, seed); |
| 2224 | + }; |
| 2225 | + |
| 2226 | + Sizzle.find = oldSizzle.find; |
| 2227 | + Sizzle.filter = oldSizzle.filter; |
| 2228 | + Sizzle.selectors = oldSizzle.selectors; |
| 2229 | + Sizzle.matches = oldSizzle.matches; |
| 2230 | +})(); |
| 2231 | + |
| 2232 | +if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ |
| 2233 | + var div = document.createElement("div"); |
| 2234 | + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
| 2235 | + |
| 2236 | + // Opera can't find a second classname (in 9.6) |
| 2237 | + if ( div.getElementsByClassName("e").length === 0 ) |
| 2238 | + return; |
| 2239 | + |
| 2240 | + // Safari caches class attributes, doesn't catch changes (in 3.2) |
| 2241 | + div.lastChild.className = "e"; |
| 2242 | + |
| 2243 | + if ( div.getElementsByClassName("e").length === 1 ) |
| 2244 | + return; |
| 2245 | + |
| 2246 | + Expr.order.splice(1, 0, "CLASS"); |
| 2247 | + Expr.find.CLASS = function(match, context, isXML) { |
| 2248 | + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
| 2249 | + return context.getElementsByClassName(match[1]); |
| 2250 | + } |
| 2251 | + }; |
| 2252 | +})(); |
| 2253 | + |
| 2254 | +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
| 2255 | + var sibDir = dir == "previousSibling" && !isXML; |
| 2256 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 2257 | + var elem = checkSet[i]; |
| 2258 | + if ( elem ) { |
| 2259 | + if ( sibDir && elem.nodeType === 1 ){ |
| 2260 | + elem.sizcache = doneName; |
| 2261 | + elem.sizset = i; |
| 2262 | + } |
| 2263 | + elem = elem[dir]; |
| 2264 | + var match = false; |
| 2265 | + |
| 2266 | + while ( elem ) { |
| 2267 | + if ( elem.sizcache === doneName ) { |
| 2268 | + match = checkSet[elem.sizset]; |
| 2269 | + break; |
| 2270 | + } |
| 2271 | + |
| 2272 | + if ( elem.nodeType === 1 && !isXML ){ |
| 2273 | + elem.sizcache = doneName; |
| 2274 | + elem.sizset = i; |
| 2275 | + } |
| 2276 | + |
| 2277 | + if ( elem.nodeName === cur ) { |
| 2278 | + match = elem; |
| 2279 | + break; |
| 2280 | + } |
| 2281 | + |
| 2282 | + elem = elem[dir]; |
| 2283 | + } |
| 2284 | + |
| 2285 | + checkSet[i] = match; |
| 2286 | + } |
| 2287 | + } |
| 2288 | +} |
| 2289 | + |
| 2290 | +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
| 2291 | + var sibDir = dir == "previousSibling" && !isXML; |
| 2292 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 2293 | + var elem = checkSet[i]; |
| 2294 | + if ( elem ) { |
| 2295 | + if ( sibDir && elem.nodeType === 1 ) { |
| 2296 | + elem.sizcache = doneName; |
| 2297 | + elem.sizset = i; |
| 2298 | + } |
| 2299 | + elem = elem[dir]; |
| 2300 | + var match = false; |
| 2301 | + |
| 2302 | + while ( elem ) { |
| 2303 | + if ( elem.sizcache === doneName ) { |
| 2304 | + match = checkSet[elem.sizset]; |
| 2305 | + break; |
| 2306 | + } |
| 2307 | + |
| 2308 | + if ( elem.nodeType === 1 ) { |
| 2309 | + if ( !isXML ) { |
| 2310 | + elem.sizcache = doneName; |
| 2311 | + elem.sizset = i; |
| 2312 | + } |
| 2313 | + if ( typeof cur !== "string" ) { |
| 2314 | + if ( elem === cur ) { |
| 2315 | + match = true; |
| 2316 | + break; |
| 2317 | + } |
| 2318 | + |
| 2319 | + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
| 2320 | + match = elem; |
| 2321 | + break; |
| 2322 | + } |
| 2323 | + } |
| 2324 | + |
| 2325 | + elem = elem[dir]; |
| 2326 | + } |
| 2327 | + |
| 2328 | + checkSet[i] = match; |
| 2329 | + } |
| 2330 | + } |
| 2331 | +} |
| 2332 | + |
| 2333 | +var contains = document.compareDocumentPosition ? function(a, b){ |
| 2334 | + return a.compareDocumentPosition(b) & 16; |
| 2335 | +} : function(a, b){ |
| 2336 | + return a !== b && (a.contains ? a.contains(b) : true); |
| 2337 | +}; |
| 2338 | + |
| 2339 | +var isXML = function(elem){ |
| 2340 | + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
| 2341 | + !!elem.ownerDocument && isXML( elem.ownerDocument ); |
| 2342 | +}; |
| 2343 | + |
| 2344 | +var posProcess = function(selector, context){ |
| 2345 | + var tmpSet = [], later = "", match, |
| 2346 | + root = context.nodeType ? [context] : context; |
| 2347 | + |
| 2348 | + // Position selectors must be done after the filter |
| 2349 | + // And so must :not(positional) so we move all PSEUDOs to the end |
| 2350 | + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
| 2351 | + later += match[0]; |
| 2352 | + selector = selector.replace( Expr.match.PSEUDO, "" ); |
| 2353 | + } |
| 2354 | + |
| 2355 | + selector = Expr.relative[selector] ? selector + "*" : selector; |
| 2356 | + |
| 2357 | + for ( var i = 0, l = root.length; i < l; i++ ) { |
| 2358 | + Sizzle( selector, root[i], tmpSet ); |
| 2359 | + } |
| 2360 | + |
| 2361 | + return Sizzle.filter( later, tmpSet ); |
| 2362 | +}; |
| 2363 | + |
| 2364 | +// EXPOSE |
| 2365 | +jQuery.find = Sizzle; |
| 2366 | +jQuery.filter = Sizzle.filter; |
| 2367 | +jQuery.expr = Sizzle.selectors; |
| 2368 | +jQuery.expr[":"] = jQuery.expr.filters; |
| 2369 | + |
| 2370 | +Sizzle.selectors.filters.hidden = function(elem){ |
| 2371 | + return elem.offsetWidth === 0 || elem.offsetHeight === 0; |
| 2372 | +}; |
| 2373 | + |
| 2374 | +Sizzle.selectors.filters.visible = function(elem){ |
| 2375 | + return elem.offsetWidth > 0 || elem.offsetHeight > 0; |
| 2376 | +}; |
| 2377 | + |
| 2378 | +Sizzle.selectors.filters.animated = function(elem){ |
| 2379 | + return jQuery.grep(jQuery.timers, function(fn){ |
| 2380 | + return elem === fn.elem; |
| 2381 | + }).length; |
| 2382 | +}; |
| 2383 | + |
| 2384 | +jQuery.multiFilter = function( expr, elems, not ) { |
| 2385 | + if ( not ) { |
| 2386 | + expr = ":not(" + expr + ")"; |
| 2387 | + } |
| 2388 | + |
| 2389 | + return Sizzle.matches(expr, elems); |
| 2390 | +}; |
| 2391 | + |
| 2392 | +jQuery.dir = function( elem, dir ){ |
| 2393 | + var matched = [], cur = elem[dir]; |
| 2394 | + while ( cur && cur != document ) { |
| 2395 | + if ( cur.nodeType == 1 ) |
| 2396 | + matched.push( cur ); |
| 2397 | + cur = cur[dir]; |
| 2398 | + } |
| 2399 | + return matched; |
| 2400 | +}; |
| 2401 | + |
| 2402 | +jQuery.nth = function(cur, result, dir, elem){ |
| 2403 | + result = result || 1; |
| 2404 | + var num = 0; |
| 2405 | + |
| 2406 | + for ( ; cur; cur = cur[dir] ) |
| 2407 | + if ( cur.nodeType == 1 && ++num == result ) |
| 2408 | + break; |
| 2409 | + |
| 2410 | + return cur; |
| 2411 | +}; |
| 2412 | + |
| 2413 | +jQuery.sibling = function(n, elem){ |
| 2414 | + var r = []; |
| 2415 | + |
| 2416 | + for ( ; n; n = n.nextSibling ) { |
| 2417 | + if ( n.nodeType == 1 && n != elem ) |
| 2418 | + r.push( n ); |
| 2419 | + } |
| 2420 | + |
| 2421 | + return r; |
| 2422 | +}; |
| 2423 | + |
| 2424 | +return; |
| 2425 | + |
| 2426 | +window.Sizzle = Sizzle; |
| 2427 | + |
| 2428 | +})(); |
| 2429 | +/* |
| 2430 | + * A number of helper functions used for managing events. |
| 2431 | + * Many of the ideas behind this code originated from |
| 2432 | + * Dean Edwards' addEvent library. |
| 2433 | + */ |
| 2434 | +jQuery.event = { |
| 2435 | + |
| 2436 | + // Bind an event to an element |
| 2437 | + // Original by Dean Edwards |
| 2438 | + add: function(elem, types, handler, data) { |
| 2439 | + if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
| 2440 | + return; |
| 2441 | + |
| 2442 | + // For whatever reason, IE has trouble passing the window object |
| 2443 | + // around, causing it to be cloned in the process |
| 2444 | + if ( elem.setInterval && elem != window ) |
| 2445 | + elem = window; |
| 2446 | + |
| 2447 | + // Make sure that the function being executed has a unique ID |
| 2448 | + if ( !handler.guid ) |
| 2449 | + handler.guid = this.guid++; |
| 2450 | + |
| 2451 | + // if data is passed, bind to handler |
| 2452 | + if ( data !== undefined ) { |
| 2453 | + // Create temporary function pointer to original handler |
| 2454 | + var fn = handler; |
| 2455 | + |
| 2456 | + // Create unique handler function, wrapped around original handler |
| 2457 | + handler = this.proxy( fn ); |
| 2458 | + |
| 2459 | + // Store data in unique handler |
| 2460 | + handler.data = data; |
| 2461 | + } |
| 2462 | + |
| 2463 | + // Init the element's event structure |
| 2464 | + var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), |
| 2465 | + handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ |
| 2466 | + // Handle the second event of a trigger and when |
| 2467 | + // an event is called after a page has unloaded |
| 2468 | + return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
| 2469 | + jQuery.event.handle.apply(arguments.callee.elem, arguments) : |
| 2470 | + undefined; |
| 2471 | + }); |
| 2472 | + // Add elem as a property of the handle function |
| 2473 | + // This is to prevent a memory leak with non-native |
| 2474 | + // event in IE. |
| 2475 | + handle.elem = elem; |
| 2476 | + |
| 2477 | + // Handle multiple events separated by a space |
| 2478 | + // jQuery(...).bind("mouseover mouseout", fn); |
| 2479 | + jQuery.each(types.split(/\s+/), function(index, type) { |
| 2480 | + // Namespaced event handlers |
| 2481 | + var namespaces = type.split("."); |
| 2482 | + type = namespaces.shift(); |
| 2483 | + handler.type = namespaces.slice().sort().join("."); |
| 2484 | + |
| 2485 | + // Get the current list of functions bound to this event |
| 2486 | + var handlers = events[type]; |
| 2487 | + |
| 2488 | + if ( jQuery.event.specialAll[type] ) |
| 2489 | + jQuery.event.specialAll[type].setup.call(elem, data, namespaces); |
| 2490 | + |
| 2491 | + // Init the event handler queue |
| 2492 | + if (!handlers) { |
| 2493 | + handlers = events[type] = {}; |
| 2494 | + |
| 2495 | + // Check for a special event handler |
| 2496 | + // Only use addEventListener/attachEvent if the special |
| 2497 | + // events handler returns false |
| 2498 | + if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) { |
| 2499 | + // Bind the global event handler to the element |
| 2500 | + if (elem.addEventListener) |
| 2501 | + elem.addEventListener(type, handle, false); |
| 2502 | + else if (elem.attachEvent) |
| 2503 | + elem.attachEvent("on" + type, handle); |
| 2504 | + } |
| 2505 | + } |
| 2506 | + |
| 2507 | + // Add the function to the element's handler list |
| 2508 | + handlers[handler.guid] = handler; |
| 2509 | + |
| 2510 | + // Keep track of which events have been used, for global triggering |
| 2511 | + jQuery.event.global[type] = true; |
| 2512 | + }); |
| 2513 | + |
| 2514 | + // Nullify elem to prevent memory leaks in IE |
| 2515 | + elem = null; |
| 2516 | + }, |
| 2517 | + |
| 2518 | + guid: 1, |
| 2519 | + global: {}, |
| 2520 | + |
| 2521 | + // Detach an event or set of events from an element |
| 2522 | + remove: function(elem, types, handler) { |
| 2523 | + // don't do events on text and comment nodes |
| 2524 | + if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
| 2525 | + return; |
| 2526 | + |
| 2527 | + var events = jQuery.data(elem, "events"), ret, index; |
| 2528 | + |
| 2529 | + if ( events ) { |
| 2530 | + // Unbind all events for the element |
| 2531 | + if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") ) |
| 2532 | + for ( var type in events ) |
| 2533 | + this.remove( elem, type + (types || "") ); |
| 2534 | + else { |
| 2535 | + // types is actually an event object here |
| 2536 | + if ( types.type ) { |
| 2537 | + handler = types.handler; |
| 2538 | + types = types.type; |
| 2539 | + } |
| 2540 | + |
| 2541 | + // Handle multiple events seperated by a space |
| 2542 | + // jQuery(...).unbind("mouseover mouseout", fn); |
| 2543 | + jQuery.each(types.split(/\s+/), function(index, type){ |
| 2544 | + // Namespaced event handlers |
| 2545 | + var namespaces = type.split("."); |
| 2546 | + type = namespaces.shift(); |
| 2547 | + var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
| 2548 | + |
| 2549 | + if ( events[type] ) { |
| 2550 | + // remove the given handler for the given type |
| 2551 | + if ( handler ) |
| 2552 | + delete events[type][handler.guid]; |
| 2553 | + |
| 2554 | + // remove all handlers for the given type |
| 2555 | + else |
| 2556 | + for ( var handle in events[type] ) |
| 2557 | + // Handle the removal of namespaced events |
| 2558 | + if ( namespace.test(events[type][handle].type) ) |
| 2559 | + delete events[type][handle]; |
| 2560 | + |
| 2561 | + if ( jQuery.event.specialAll[type] ) |
| 2562 | + jQuery.event.specialAll[type].teardown.call(elem, namespaces); |
| 2563 | + |
| 2564 | + // remove generic event handler if no more handlers exist |
| 2565 | + for ( ret in events[type] ) break; |
| 2566 | + if ( !ret ) { |
| 2567 | + if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) { |
| 2568 | + if (elem.removeEventListener) |
| 2569 | + elem.removeEventListener(type, jQuery.data(elem, "handle"), false); |
| 2570 | + else if (elem.detachEvent) |
| 2571 | + elem.detachEvent("on" + type, jQuery.data(elem, "handle")); |
| 2572 | + } |
| 2573 | + ret = null; |
| 2574 | + delete events[type]; |
| 2575 | + } |
| 2576 | + } |
| 2577 | + }); |
| 2578 | + } |
| 2579 | + |
| 2580 | + // Remove the expando if it's no longer used |
| 2581 | + for ( ret in events ) break; |
| 2582 | + if ( !ret ) { |
| 2583 | + var handle = jQuery.data( elem, "handle" ); |
| 2584 | + if ( handle ) handle.elem = null; |
| 2585 | + jQuery.removeData( elem, "events" ); |
| 2586 | + jQuery.removeData( elem, "handle" ); |
| 2587 | + } |
| 2588 | + } |
| 2589 | + }, |
| 2590 | + |
| 2591 | + // bubbling is internal |
| 2592 | + trigger: function( event, data, elem, bubbling ) { |
| 2593 | + // Event object or event type |
| 2594 | + var type = event.type || event; |
| 2595 | + |
| 2596 | + if( !bubbling ){ |
| 2597 | + event = typeof event === "object" ? |
| 2598 | + // jQuery.Event object |
| 2599 | + event[expando] ? event : |
| 2600 | + // Object literal |
| 2601 | + jQuery.extend( jQuery.Event(type), event ) : |
| 2602 | + // Just the event type (string) |
| 2603 | + jQuery.Event(type); |
| 2604 | + |
| 2605 | + if ( type.indexOf("!") >= 0 ) { |
| 2606 | + event.type = type = type.slice(0, -1); |
| 2607 | + event.exclusive = true; |
| 2608 | + } |
| 2609 | + |
| 2610 | + // Handle a global trigger |
| 2611 | + if ( !elem ) { |
| 2612 | + // Don't bubble custom events when global (to avoid too much overhead) |
| 2613 | + event.stopPropagation(); |
| 2614 | + // Only trigger if we've ever bound an event for it |
| 2615 | + if ( this.global[type] ) |
| 2616 | + jQuery.each( jQuery.cache, function(){ |
| 2617 | + if ( this.events && this.events[type] ) |
| 2618 | + jQuery.event.trigger( event, data, this.handle.elem ); |
| 2619 | + }); |
| 2620 | + } |
| 2621 | + |
| 2622 | + // Handle triggering a single element |
| 2623 | + |
| 2624 | + // don't do events on text and comment nodes |
| 2625 | + if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) |
| 2626 | + return undefined; |
| 2627 | + |
| 2628 | + // Clean up in case it is reused |
| 2629 | + event.result = undefined; |
| 2630 | + event.target = elem; |
| 2631 | + |
| 2632 | + // Clone the incoming data, if any |
| 2633 | + data = jQuery.makeArray(data); |
| 2634 | + data.unshift( event ); |
| 2635 | + } |
| 2636 | + |
| 2637 | + event.currentTarget = elem; |
| 2638 | + |
| 2639 | + // Trigger the event, it is assumed that "handle" is a function |
| 2640 | + var handle = jQuery.data(elem, "handle"); |
| 2641 | + if ( handle ) |
| 2642 | + handle.apply( elem, data ); |
| 2643 | + |
| 2644 | + // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) |
| 2645 | + if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) |
| 2646 | + event.result = false; |
| 2647 | + |
| 2648 | + // Trigger the native events (except for clicks on links) |
| 2649 | + if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { |
| 2650 | + this.triggered = true; |
| 2651 | + try { |
| 2652 | + elem[ type ](); |
| 2653 | + // prevent IE from throwing an error for some hidden elements |
| 2654 | + } catch (e) {} |
| 2655 | + } |
| 2656 | + |
| 2657 | + this.triggered = false; |
| 2658 | + |
| 2659 | + if ( !event.isPropagationStopped() ) { |
| 2660 | + var parent = elem.parentNode || elem.ownerDocument; |
| 2661 | + if ( parent ) |
| 2662 | + jQuery.event.trigger(event, data, parent, true); |
| 2663 | + } |
| 2664 | + }, |
| 2665 | + |
| 2666 | + handle: function(event) { |
| 2667 | + // returned undefined or false |
| 2668 | + var all, handlers; |
| 2669 | + |
| 2670 | + event = arguments[0] = jQuery.event.fix( event || window.event ); |
| 2671 | + event.currentTarget = this; |
| 2672 | + |
| 2673 | + // Namespaced event handlers |
| 2674 | + var namespaces = event.type.split("."); |
| 2675 | + event.type = namespaces.shift(); |
| 2676 | + |
| 2677 | + // Cache this now, all = true means, any handler |
| 2678 | + all = !namespaces.length && !event.exclusive; |
| 2679 | + |
| 2680 | + var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
| 2681 | + |
| 2682 | + handlers = ( jQuery.data(this, "events") || {} )[event.type]; |
| 2683 | + |
| 2684 | + for ( var j in handlers ) { |
| 2685 | + var handler = handlers[j]; |
| 2686 | + |
| 2687 | + // Filter the functions by class |
| 2688 | + if ( all || namespace.test(handler.type) ) { |
| 2689 | + // Pass in a reference to the handler function itself |
| 2690 | + // So that we can later remove it |
| 2691 | + event.handler = handler; |
| 2692 | + event.data = handler.data; |
| 2693 | + |
| 2694 | + var ret = handler.apply(this, arguments); |
| 2695 | + |
| 2696 | + if( ret !== undefined ){ |
| 2697 | + event.result = ret; |
| 2698 | + if ( ret === false ) { |
| 2699 | + event.preventDefault(); |
| 2700 | + event.stopPropagation(); |
| 2701 | + } |
| 2702 | + } |
| 2703 | + |
| 2704 | + if( event.isImmediatePropagationStopped() ) |
| 2705 | + break; |
| 2706 | + |
| 2707 | + } |
| 2708 | + } |
| 2709 | + }, |
| 2710 | + |
| 2711 | + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
| 2712 | + |
| 2713 | + fix: function(event) { |
| 2714 | + if ( event[expando] ) |
| 2715 | + return event; |
| 2716 | + |
| 2717 | + // store a copy of the original event object |
| 2718 | + // and "clone" to set read-only properties |
| 2719 | + var originalEvent = event; |
| 2720 | + event = jQuery.Event( originalEvent ); |
| 2721 | + |
| 2722 | + for ( var i = this.props.length, prop; i; ){ |
| 2723 | + prop = this.props[ --i ]; |
| 2724 | + event[ prop ] = originalEvent[ prop ]; |
| 2725 | + } |
| 2726 | + |
| 2727 | + // Fix target property, if necessary |
| 2728 | + if ( !event.target ) |
| 2729 | + event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
| 2730 | + |
| 2731 | + // check if target is a textnode (safari) |
| 2732 | + if ( event.target.nodeType == 3 ) |
| 2733 | + event.target = event.target.parentNode; |
| 2734 | + |
| 2735 | + // Add relatedTarget, if necessary |
| 2736 | + if ( !event.relatedTarget && event.fromElement ) |
| 2737 | + event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; |
| 2738 | + |
| 2739 | + // Calculate pageX/Y if missing and clientX/Y available |
| 2740 | + if ( event.pageX == null && event.clientX != null ) { |
| 2741 | + var doc = document.documentElement, body = document.body; |
| 2742 | + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); |
| 2743 | + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); |
| 2744 | + } |
| 2745 | + |
| 2746 | + // Add which for key events |
| 2747 | + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) |
| 2748 | + event.which = event.charCode || event.keyCode; |
| 2749 | + |
| 2750 | + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
| 2751 | + if ( !event.metaKey && event.ctrlKey ) |
| 2752 | + event.metaKey = event.ctrlKey; |
| 2753 | + |
| 2754 | + // Add which for click: 1 == left; 2 == middle; 3 == right |
| 2755 | + // Note: button is not normalized, so don't use it |
| 2756 | + if ( !event.which && event.button ) |
| 2757 | + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
| 2758 | + |
| 2759 | + return event; |
| 2760 | + }, |
| 2761 | + |
| 2762 | + proxy: function( fn, proxy ){ |
| 2763 | + proxy = proxy || function(){ return fn.apply(this, arguments); }; |
| 2764 | + // Set the guid of unique handler to the same of original handler, so it can be removed |
| 2765 | + proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; |
| 2766 | + // So proxy can be declared as an argument |
| 2767 | + return proxy; |
| 2768 | + }, |
| 2769 | + |
| 2770 | + special: { |
| 2771 | + ready: { |
| 2772 | + // Make sure the ready event is setup |
| 2773 | + setup: bindReady, |
| 2774 | + teardown: function() {} |
| 2775 | + } |
| 2776 | + }, |
| 2777 | + |
| 2778 | + specialAll: { |
| 2779 | + live: { |
| 2780 | + setup: function( selector, namespaces ){ |
| 2781 | + jQuery.event.add( this, namespaces[0], liveHandler ); |
| 2782 | + }, |
| 2783 | + teardown: function( namespaces ){ |
| 2784 | + if ( namespaces.length ) { |
| 2785 | + var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); |
| 2786 | + |
| 2787 | + jQuery.each( (jQuery.data(this, "events").live || {}), function(){ |
| 2788 | + if ( name.test(this.type) ) |
| 2789 | + remove++; |
| 2790 | + }); |
| 2791 | + |
| 2792 | + if ( remove < 1 ) |
| 2793 | + jQuery.event.remove( this, namespaces[0], liveHandler ); |
| 2794 | + } |
| 2795 | + } |
| 2796 | + } |
| 2797 | + } |
| 2798 | +}; |
| 2799 | + |
| 2800 | +jQuery.Event = function( src ){ |
| 2801 | + // Allow instantiation without the 'new' keyword |
| 2802 | + if( !this.preventDefault ) |
| 2803 | + return new jQuery.Event(src); |
| 2804 | + |
| 2805 | + // Event object |
| 2806 | + if( src && src.type ){ |
| 2807 | + this.originalEvent = src; |
| 2808 | + this.type = src.type; |
| 2809 | + // Event type |
| 2810 | + }else |
| 2811 | + this.type = src; |
| 2812 | + |
| 2813 | + // timeStamp is buggy for some events on Firefox(#3843) |
| 2814 | + // So we won't rely on the native value |
| 2815 | + this.timeStamp = now(); |
| 2816 | + |
| 2817 | + // Mark it as fixed |
| 2818 | + this[expando] = true; |
| 2819 | +}; |
| 2820 | + |
| 2821 | +function returnFalse(){ |
| 2822 | + return false; |
| 2823 | +} |
| 2824 | +function returnTrue(){ |
| 2825 | + return true; |
| 2826 | +} |
| 2827 | + |
| 2828 | +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
| 2829 | +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
| 2830 | +jQuery.Event.prototype = { |
| 2831 | + preventDefault: function() { |
| 2832 | + this.isDefaultPrevented = returnTrue; |
| 2833 | + |
| 2834 | + var e = this.originalEvent; |
| 2835 | + if( !e ) |
| 2836 | + return; |
| 2837 | + // if preventDefault exists run it on the original event |
| 2838 | + if (e.preventDefault) |
| 2839 | + e.preventDefault(); |
| 2840 | + // otherwise set the returnValue property of the original event to false (IE) |
| 2841 | + e.returnValue = false; |
| 2842 | + }, |
| 2843 | + stopPropagation: function() { |
| 2844 | + this.isPropagationStopped = returnTrue; |
| 2845 | + |
| 2846 | + var e = this.originalEvent; |
| 2847 | + if( !e ) |
| 2848 | + return; |
| 2849 | + // if stopPropagation exists run it on the original event |
| 2850 | + if (e.stopPropagation) |
| 2851 | + e.stopPropagation(); |
| 2852 | + // otherwise set the cancelBubble property of the original event to true (IE) |
| 2853 | + e.cancelBubble = true; |
| 2854 | + }, |
| 2855 | + stopImmediatePropagation:function(){ |
| 2856 | + this.isImmediatePropagationStopped = returnTrue; |
| 2857 | + this.stopPropagation(); |
| 2858 | + }, |
| 2859 | + isDefaultPrevented: returnFalse, |
| 2860 | + isPropagationStopped: returnFalse, |
| 2861 | + isImmediatePropagationStopped: returnFalse |
| 2862 | +}; |
| 2863 | +// Checks if an event happened on an element within another element |
| 2864 | +// Used in jQuery.event.special.mouseenter and mouseleave handlers |
| 2865 | +var withinElement = function(event) { |
| 2866 | + // Check if mouse(over|out) are still within the same parent element |
| 2867 | + var parent = event.relatedTarget; |
| 2868 | + // Traverse up the tree |
| 2869 | + while ( parent && parent != this ) |
| 2870 | + try { parent = parent.parentNode; } |
| 2871 | + catch(e) { parent = this; } |
| 2872 | + |
| 2873 | + if( parent != this ){ |
| 2874 | + // set the correct event type |
| 2875 | + event.type = event.data; |
| 2876 | + // handle event if we actually just moused on to a non sub-element |
| 2877 | + jQuery.event.handle.apply( this, arguments ); |
| 2878 | + } |
| 2879 | +}; |
| 2880 | + |
| 2881 | +jQuery.each({ |
| 2882 | + mouseover: 'mouseenter', |
| 2883 | + mouseout: 'mouseleave' |
| 2884 | +}, function( orig, fix ){ |
| 2885 | + jQuery.event.special[ fix ] = { |
| 2886 | + setup: function(){ |
| 2887 | + jQuery.event.add( this, orig, withinElement, fix ); |
| 2888 | + }, |
| 2889 | + teardown: function(){ |
| 2890 | + jQuery.event.remove( this, orig, withinElement ); |
| 2891 | + } |
| 2892 | + }; |
| 2893 | +}); |
| 2894 | + |
| 2895 | +jQuery.fn.extend({ |
| 2896 | + bind: function( type, data, fn ) { |
| 2897 | + return type == "unload" ? this.one(type, data, fn) : this.each(function(){ |
| 2898 | + jQuery.event.add( this, type, fn || data, fn && data ); |
| 2899 | + }); |
| 2900 | + }, |
| 2901 | + |
| 2902 | + one: function( type, data, fn ) { |
| 2903 | + var one = jQuery.event.proxy( fn || data, function(event) { |
| 2904 | + jQuery(this).unbind(event, one); |
| 2905 | + return (fn || data).apply( this, arguments ); |
| 2906 | + }); |
| 2907 | + return this.each(function(){ |
| 2908 | + jQuery.event.add( this, type, one, fn && data); |
| 2909 | + }); |
| 2910 | + }, |
| 2911 | + |
| 2912 | + unbind: function( type, fn ) { |
| 2913 | + return this.each(function(){ |
| 2914 | + jQuery.event.remove( this, type, fn ); |
| 2915 | + }); |
| 2916 | + }, |
| 2917 | + |
| 2918 | + trigger: function( type, data ) { |
| 2919 | + return this.each(function(){ |
| 2920 | + jQuery.event.trigger( type, data, this ); |
| 2921 | + }); |
| 2922 | + }, |
| 2923 | + |
| 2924 | + triggerHandler: function( type, data ) { |
| 2925 | + if( this[0] ){ |
| 2926 | + var event = jQuery.Event(type); |
| 2927 | + event.preventDefault(); |
| 2928 | + event.stopPropagation(); |
| 2929 | + jQuery.event.trigger( event, data, this[0] ); |
| 2930 | + return event.result; |
| 2931 | + } |
| 2932 | + }, |
| 2933 | + |
| 2934 | + toggle: function( fn ) { |
| 2935 | + // Save reference to arguments for access in closure |
| 2936 | + var args = arguments, i = 1; |
| 2937 | + |
| 2938 | + // link all the functions, so any of them can unbind this click handler |
| 2939 | + while( i < args.length ) |
| 2940 | + jQuery.event.proxy( fn, args[i++] ); |
| 2941 | + |
| 2942 | + return this.click( jQuery.event.proxy( fn, function(event) { |
| 2943 | + // Figure out which function to execute |
| 2944 | + this.lastToggle = ( this.lastToggle || 0 ) % i; |
| 2945 | + |
| 2946 | + // Make sure that clicks stop |
| 2947 | + event.preventDefault(); |
| 2948 | + |
| 2949 | + // and execute the function |
| 2950 | + return args[ this.lastToggle++ ].apply( this, arguments ) || false; |
| 2951 | + })); |
| 2952 | + }, |
| 2953 | + |
| 2954 | + hover: function(fnOver, fnOut) { |
| 2955 | + return this.mouseenter(fnOver).mouseleave(fnOut); |
| 2956 | + }, |
| 2957 | + |
| 2958 | + ready: function(fn) { |
| 2959 | + // Attach the listeners |
| 2960 | + bindReady(); |
| 2961 | + |
| 2962 | + // If the DOM is already ready |
| 2963 | + if ( jQuery.isReady ) |
| 2964 | + // Execute the function immediately |
| 2965 | + fn.call( document, jQuery ); |
| 2966 | + |
| 2967 | + // Otherwise, remember the function for later |
| 2968 | + else |
| 2969 | + // Add the function to the wait list |
| 2970 | + jQuery.readyList.push( fn ); |
| 2971 | + |
| 2972 | + return this; |
| 2973 | + }, |
| 2974 | + |
| 2975 | + live: function( type, fn ){ |
| 2976 | + var proxy = jQuery.event.proxy( fn ); |
| 2977 | + proxy.guid += this.selector + type; |
| 2978 | + |
| 2979 | + jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy ); |
| 2980 | + |
| 2981 | + return this; |
| 2982 | + }, |
| 2983 | + |
| 2984 | + die: function( type, fn ){ |
| 2985 | + jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); |
| 2986 | + return this; |
| 2987 | + } |
| 2988 | +}); |
| 2989 | + |
| 2990 | +function liveHandler( event ){ |
| 2991 | + var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"), |
| 2992 | + stop = true, |
| 2993 | + elems = []; |
| 2994 | + |
| 2995 | + jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){ |
| 2996 | + if ( check.test(fn.type) ) { |
| 2997 | + var elem = jQuery(event.target).closest(fn.data)[0]; |
| 2998 | + if ( elem ) |
| 2999 | + elems.push({ elem: elem, fn: fn }); |
| 3000 | + } |
| 3001 | + }); |
| 3002 | + |
| 3003 | + elems.sort(function(a,b) { |
| 3004 | + return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest"); |
| 3005 | + }); |
| 3006 | + |
| 3007 | + jQuery.each(elems, function(){ |
| 3008 | + if ( this.fn.call(this.elem, event, this.fn.data) === false ) |
| 3009 | + return (stop = false); |
| 3010 | + }); |
| 3011 | + |
| 3012 | + return stop; |
| 3013 | +} |
| 3014 | + |
| 3015 | +function liveConvert(type, selector){ |
| 3016 | + return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); |
| 3017 | +} |
| 3018 | + |
| 3019 | +jQuery.extend({ |
| 3020 | + isReady: false, |
| 3021 | + readyList: [], |
| 3022 | + // Handle when the DOM is ready |
| 3023 | + ready: function() { |
| 3024 | + // Make sure that the DOM is not already loaded |
| 3025 | + if ( !jQuery.isReady ) { |
| 3026 | + // Remember that the DOM is ready |
| 3027 | + jQuery.isReady = true; |
| 3028 | + |
| 3029 | + // If there are functions bound, to execute |
| 3030 | + if ( jQuery.readyList ) { |
| 3031 | + // Execute all of them |
| 3032 | + jQuery.each( jQuery.readyList, function(){ |
| 3033 | + this.call( document, jQuery ); |
| 3034 | + }); |
| 3035 | + |
| 3036 | + // Reset the list of functions |
| 3037 | + jQuery.readyList = null; |
| 3038 | + } |
| 3039 | + |
| 3040 | + // Trigger any bound ready events |
| 3041 | + jQuery(document).triggerHandler("ready"); |
| 3042 | + } |
| 3043 | + } |
| 3044 | +}); |
| 3045 | + |
| 3046 | +var readyBound = false; |
| 3047 | + |
| 3048 | +function bindReady(){ |
| 3049 | + if ( readyBound ) return; |
| 3050 | + readyBound = true; |
| 3051 | + |
| 3052 | + // Mozilla, Opera and webkit nightlies currently support this event |
| 3053 | + if ( document.addEventListener ) { |
| 3054 | + // Use the handy event callback |
| 3055 | + document.addEventListener( "DOMContentLoaded", function(){ |
| 3056 | + document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); |
| 3057 | + jQuery.ready(); |
| 3058 | + }, false ); |
| 3059 | + |
| 3060 | + // If IE event model is used |
| 3061 | + } else if ( document.attachEvent ) { |
| 3062 | + // ensure firing before onload, |
| 3063 | + // maybe late but safe also for iframes |
| 3064 | + document.attachEvent("onreadystatechange", function(){ |
| 3065 | + if ( document.readyState === "complete" ) { |
| 3066 | + document.detachEvent( "onreadystatechange", arguments.callee ); |
| 3067 | + jQuery.ready(); |
| 3068 | + } |
| 3069 | + }); |
| 3070 | + |
| 3071 | + // If IE and not an iframe |
| 3072 | + // continually check to see if the document is ready |
| 3073 | + if ( document.documentElement.doScroll && window == window.top ) (function(){ |
| 3074 | + if ( jQuery.isReady ) return; |
| 3075 | + |
| 3076 | + try { |
| 3077 | + // If IE is used, use the trick by Diego Perini |
| 3078 | + // http://javascript.nwbox.com/IEContentLoaded/ |
| 3079 | + document.documentElement.doScroll("left"); |
| 3080 | + } catch( error ) { |
| 3081 | + setTimeout( arguments.callee, 0 ); |
| 3082 | + return; |
| 3083 | + } |
| 3084 | + |
| 3085 | + // and execute any waiting functions |
| 3086 | + jQuery.ready(); |
| 3087 | + })(); |
| 3088 | + } |
| 3089 | + |
| 3090 | + // A fallback to window.onload, that will always work |
| 3091 | + jQuery.event.add( window, "load", jQuery.ready ); |
| 3092 | +} |
| 3093 | + |
| 3094 | +jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
| 3095 | + "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + |
| 3096 | + "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ |
| 3097 | + |
| 3098 | + // Handle event binding |
| 3099 | + jQuery.fn[name] = function(fn){ |
| 3100 | + return fn ? this.bind(name, fn) : this.trigger(name); |
| 3101 | + }; |
| 3102 | +}); |
| 3103 | + |
| 3104 | +// Prevent memory leaks in IE |
| 3105 | +// And prevent errors on refresh with events like mouseover in other browsers |
| 3106 | +// Window isn't included so as not to unbind existing unload events |
| 3107 | +jQuery( window ).bind( 'unload', function(){ |
| 3108 | + for ( var id in jQuery.cache ) |
| 3109 | + // Skip the window |
| 3110 | + if ( id != 1 && jQuery.cache[ id ].handle ) |
| 3111 | + jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
| 3112 | +}); |
| 3113 | +(function(){ |
| 3114 | + |
| 3115 | + jQuery.support = {}; |
| 3116 | + |
| 3117 | + var root = document.documentElement, |
| 3118 | + script = document.createElement("script"), |
| 3119 | + div = document.createElement("div"), |
| 3120 | + id = "script" + (new Date).getTime(); |
| 3121 | + |
| 3122 | + div.style.display = "none"; |
| 3123 | + div.innerHTML = ' <link/><table></table><a href="https://www.mediawiki.org/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>'; |
| 3124 | + |
| 3125 | + var all = div.getElementsByTagName("*"), |
| 3126 | + a = div.getElementsByTagName("a")[0]; |
| 3127 | + |
| 3128 | + // Can't get basic test support |
| 3129 | + if ( !all || !all.length || !a ) { |
| 3130 | + return; |
| 3131 | + } |
| 3132 | + |
| 3133 | + jQuery.support = { |
| 3134 | + // IE strips leading whitespace when .innerHTML is used |
| 3135 | + leadingWhitespace: div.firstChild.nodeType == 3, |
| 3136 | + |
| 3137 | + // Make sure that tbody elements aren't automatically inserted |
| 3138 | + // IE will insert them into empty tables |
| 3139 | + tbody: !div.getElementsByTagName("tbody").length, |
| 3140 | + |
| 3141 | + // Make sure that you can get all elements in an <object> element |
| 3142 | + // IE 7 always returns no results |
| 3143 | + objectAll: !!div.getElementsByTagName("object")[0] |
| 3144 | + .getElementsByTagName("*").length, |
| 3145 | + |
| 3146 | + // Make sure that link elements get serialized correctly by innerHTML |
| 3147 | + // This requires a wrapper element in IE |
| 3148 | + htmlSerialize: !!div.getElementsByTagName("link").length, |
| 3149 | + |
| 3150 | + // Get the style information from getAttribute |
| 3151 | + // (IE uses .cssText insted) |
| 3152 | + style: /red/.test( a.getAttribute("style") ), |
| 3153 | + |
| 3154 | + // Make sure that URLs aren't manipulated |
| 3155 | + // (IE normalizes it by default) |
| 3156 | + hrefNormalized: a.getAttribute("href") === "/a", |
| 3157 | + |
| 3158 | + // Make sure that element opacity exists |
| 3159 | + // (IE uses filter instead) |
| 3160 | + opacity: a.style.opacity === "0.5", |
| 3161 | + |
| 3162 | + // Verify style float existence |
| 3163 | + // (IE uses styleFloat instead of cssFloat) |
| 3164 | + cssFloat: !!a.style.cssFloat, |
| 3165 | + |
| 3166 | + // Will be defined later |
| 3167 | + scriptEval: false, |
| 3168 | + noCloneEvent: true, |
| 3169 | + boxModel: null |
| 3170 | + }; |
| 3171 | + |
| 3172 | + script.type = "text/javascript"; |
| 3173 | + try { |
| 3174 | + script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
| 3175 | + } catch(e){} |
| 3176 | + |
| 3177 | + root.insertBefore( script, root.firstChild ); |
| 3178 | + |
| 3179 | + // Make sure that the execution of code works by injecting a script |
| 3180 | + // tag with appendChild/createTextNode |
| 3181 | + // (IE doesn't support this, fails, and uses .text instead) |
| 3182 | + if ( window[ id ] ) { |
| 3183 | + jQuery.support.scriptEval = true; |
| 3184 | + delete window[ id ]; |
| 3185 | + } |
| 3186 | + |
| 3187 | + root.removeChild( script ); |
| 3188 | + |
| 3189 | + if ( div.attachEvent && div.fireEvent ) { |
| 3190 | + div.attachEvent("onclick", function(){ |
| 3191 | + // Cloning a node shouldn't copy over any |
| 3192 | + // bound event handlers (IE does this) |
| 3193 | + jQuery.support.noCloneEvent = false; |
| 3194 | + div.detachEvent("onclick", arguments.callee); |
| 3195 | + }); |
| 3196 | + div.cloneNode(true).fireEvent("onclick"); |
| 3197 | + } |
| 3198 | + |
| 3199 | + // Figure out if the W3C box model works as expected |
| 3200 | + // document.body must exist before we can do this |
| 3201 | + jQuery(function(){ |
| 3202 | + var div = document.createElement("div"); |
| 3203 | + div.style.width = div.style.paddingLeft = "1px"; |
| 3204 | + |
| 3205 | + document.body.appendChild( div ); |
| 3206 | + jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
| 3207 | + document.body.removeChild( div ).style.display = 'none'; |
| 3208 | + }); |
| 3209 | +})(); |
| 3210 | + |
| 3211 | +var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; |
| 3212 | + |
| 3213 | +jQuery.props = { |
| 3214 | + "for": "htmlFor", |
| 3215 | + "class": "className", |
| 3216 | + "float": styleFloat, |
| 3217 | + cssFloat: styleFloat, |
| 3218 | + styleFloat: styleFloat, |
| 3219 | + readonly: "readOnly", |
| 3220 | + maxlength: "maxLength", |
| 3221 | + cellspacing: "cellSpacing", |
| 3222 | + rowspan: "rowSpan", |
| 3223 | + tabindex: "tabIndex" |
| 3224 | +}; |
| 3225 | +jQuery.fn.extend({ |
| 3226 | + // Keep a copy of the old load |
| 3227 | + _load: jQuery.fn.load, |
| 3228 | + |
| 3229 | + load: function( url, params, callback ) { |
| 3230 | + if ( typeof url !== "string" ) |
| 3231 | + return this._load( url ); |
| 3232 | + |
| 3233 | + var off = url.indexOf(" "); |
| 3234 | + if ( off >= 0 ) { |
| 3235 | + var selector = url.slice(off, url.length); |
| 3236 | + url = url.slice(0, off); |
| 3237 | + } |
| 3238 | + |
| 3239 | + // Default to a GET request |
| 3240 | + var type = "GET"; |
| 3241 | + |
| 3242 | + // If the second parameter was provided |
| 3243 | + if ( params ) |
| 3244 | + // If it's a function |
| 3245 | + if ( jQuery.isFunction( params ) ) { |
| 3246 | + // We assume that it's the callback |
| 3247 | + callback = params; |
| 3248 | + params = null; |
| 3249 | + |
| 3250 | + // Otherwise, build a param string |
| 3251 | + } else if( typeof params === "object" ) { |
| 3252 | + params = jQuery.param( params ); |
| 3253 | + type = "POST"; |
| 3254 | + } |
| 3255 | + |
| 3256 | + var self = this; |
| 3257 | + |
| 3258 | + // Request the remote document |
| 3259 | + jQuery.ajax({ |
| 3260 | + url: url, |
| 3261 | + type: type, |
| 3262 | + dataType: "html", |
| 3263 | + data: params, |
| 3264 | + complete: function(res, status){ |
| 3265 | + // If successful, inject the HTML into all the matched elements |
| 3266 | + if ( status == "success" || status == "notmodified" ) |
| 3267 | + // See if a selector was specified |
| 3268 | + self.html( selector ? |
| 3269 | + // Create a dummy div to hold the results |
| 3270 | + jQuery("<div/>") |
| 3271 | + // inject the contents of the document in, removing the scripts |
| 3272 | + // to avoid any 'Permission Denied' errors in IE |
| 3273 | + .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
| 3274 | + |
| 3275 | + // Locate the specified elements |
| 3276 | + .find(selector) : |
| 3277 | + |
| 3278 | + // If not, just inject the full result |
| 3279 | + res.responseText ); |
| 3280 | + |
| 3281 | + if( callback ) |
| 3282 | + self.each( callback, [res.responseText, status, res] ); |
| 3283 | + } |
| 3284 | + }); |
| 3285 | + return this; |
| 3286 | + }, |
| 3287 | + |
| 3288 | + serialize: function() { |
| 3289 | + return jQuery.param(this.serializeArray()); |
| 3290 | + }, |
| 3291 | + serializeArray: function() { |
| 3292 | + return this.map(function(){ |
| 3293 | + return this.elements ? jQuery.makeArray(this.elements) : this; |
| 3294 | + }) |
| 3295 | + .filter(function(){ |
| 3296 | + return this.name && !this.disabled && |
| 3297 | + (this.checked || /select|textarea/i.test(this.nodeName) || |
| 3298 | + /text|hidden|password|search/i.test(this.type)); |
| 3299 | + }) |
| 3300 | + .map(function(i, elem){ |
| 3301 | + var val = jQuery(this).val(); |
| 3302 | + return val == null ? null : |
| 3303 | + jQuery.isArray(val) ? |
| 3304 | + jQuery.map( val, function(val, i){ |
| 3305 | + return {name: elem.name, value: val}; |
| 3306 | + }) : |
| 3307 | + {name: elem.name, value: val}; |
| 3308 | + }).get(); |
| 3309 | + } |
| 3310 | +}); |
| 3311 | + |
| 3312 | +// Attach a bunch of functions for handling common AJAX events |
| 3313 | +jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ |
| 3314 | + jQuery.fn[o] = function(f){ |
| 3315 | + return this.bind(o, f); |
| 3316 | + }; |
| 3317 | +}); |
| 3318 | + |
| 3319 | +var jsc = now(); |
| 3320 | + |
| 3321 | +jQuery.extend({ |
| 3322 | + |
| 3323 | + get: function( url, data, callback, type ) { |
| 3324 | + // shift arguments if data argument was ommited |
| 3325 | + if ( jQuery.isFunction( data ) ) { |
| 3326 | + callback = data; |
| 3327 | + data = null; |
| 3328 | + } |
| 3329 | + |
| 3330 | + return jQuery.ajax({ |
| 3331 | + type: "GET", |
| 3332 | + url: url, |
| 3333 | + data: data, |
| 3334 | + success: callback, |
| 3335 | + dataType: type |
| 3336 | + }); |
| 3337 | + }, |
| 3338 | + |
| 3339 | + getScript: function( url, callback ) { |
| 3340 | + return jQuery.get(url, null, callback, "script"); |
| 3341 | + }, |
| 3342 | + |
| 3343 | + getJSON: function( url, data, callback ) { |
| 3344 | + return jQuery.get(url, data, callback, "json"); |
| 3345 | + }, |
| 3346 | + |
| 3347 | + post: function( url, data, callback, type ) { |
| 3348 | + if ( jQuery.isFunction( data ) ) { |
| 3349 | + callback = data; |
| 3350 | + data = {}; |
| 3351 | + } |
| 3352 | + |
| 3353 | + return jQuery.ajax({ |
| 3354 | + type: "POST", |
| 3355 | + url: url, |
| 3356 | + data: data, |
| 3357 | + success: callback, |
| 3358 | + dataType: type |
| 3359 | + }); |
| 3360 | + }, |
| 3361 | + |
| 3362 | + ajaxSetup: function( settings ) { |
| 3363 | + jQuery.extend( jQuery.ajaxSettings, settings ); |
| 3364 | + }, |
| 3365 | + |
| 3366 | + ajaxSettings: { |
| 3367 | + url: location.href, |
| 3368 | + global: true, |
| 3369 | + type: "GET", |
| 3370 | + contentType: "application/x-www-form-urlencoded", |
| 3371 | + processData: true, |
| 3372 | + async: true, |
| 3373 | + /* |
| 3374 | + timeout: 0, |
| 3375 | + data: null, |
| 3376 | + username: null, |
| 3377 | + password: null, |
| 3378 | + */ |
| 3379 | + // Create the request object; Microsoft failed to properly |
| 3380 | + // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
| 3381 | + // This function can be overriden by calling jQuery.ajaxSetup |
| 3382 | + xhr:function(){ |
| 3383 | + return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
| 3384 | + }, |
| 3385 | + accepts: { |
| 3386 | + xml: "application/xml, text/xml", |
| 3387 | + html: "text/html", |
| 3388 | + script: "text/javascript, application/javascript", |
| 3389 | + json: "application/json, text/javascript", |
| 3390 | + text: "text/plain", |
| 3391 | + _default: "*/*" |
| 3392 | + } |
| 3393 | + }, |
| 3394 | + |
| 3395 | + // Last-Modified header cache for next request |
| 3396 | + lastModified: {}, |
| 3397 | + |
| 3398 | + ajax: function( s ) { |
| 3399 | + // Extend the settings, but re-extend 's' so that it can be |
| 3400 | + // checked again later (in the test suite, specifically) |
| 3401 | + s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
| 3402 | + |
| 3403 | + var jsonp, jsre = /=\?(&|$)/g, status, data, |
| 3404 | + type = s.type.toUpperCase(); |
| 3405 | + |
| 3406 | + // convert data if not already a string |
| 3407 | + if ( s.data && s.processData && typeof s.data !== "string" ) |
| 3408 | + s.data = jQuery.param(s.data); |
| 3409 | + |
| 3410 | + // Handle JSONP Parameter Callbacks |
| 3411 | + if ( s.dataType == "jsonp" ) { |
| 3412 | + if ( type == "GET" ) { |
| 3413 | + if ( !s.url.match(jsre) ) |
| 3414 | + s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
| 3415 | + } else if ( !s.data || !s.data.match(jsre) ) |
| 3416 | + s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
| 3417 | + s.dataType = "json"; |
| 3418 | + } |
| 3419 | + |
| 3420 | + // Build temporary JSONP function |
| 3421 | + if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
| 3422 | + jsonp = "jsonp" + jsc++; |
| 3423 | + |
| 3424 | + // Replace the =? sequence both in the query string and the data |
| 3425 | + if ( s.data ) |
| 3426 | + s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
| 3427 | + s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
| 3428 | + |
| 3429 | + // We need to make sure |
| 3430 | + // that a JSONP style response is executed properly |
| 3431 | + s.dataType = "script"; |
| 3432 | + |
| 3433 | + // Handle JSONP-style loading |
| 3434 | + window[ jsonp ] = function(tmp){ |
| 3435 | + data = tmp; |
| 3436 | + success(); |
| 3437 | + complete(); |
| 3438 | + // Garbage collect |
| 3439 | + window[ jsonp ] = undefined; |
| 3440 | + try{ delete window[ jsonp ]; } catch(e){} |
| 3441 | + if ( head ) |
| 3442 | + head.removeChild( script ); |
| 3443 | + }; |
| 3444 | + } |
| 3445 | + |
| 3446 | + if ( s.dataType == "script" && s.cache == null ) |
| 3447 | + s.cache = false; |
| 3448 | + |
| 3449 | + if ( s.cache === false && type == "GET" ) { |
| 3450 | + var ts = now(); |
| 3451 | + // try replacing _= if it is there |
| 3452 | + var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); |
| 3453 | + // if nothing was replaced, add timestamp to the end |
| 3454 | + s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); |
| 3455 | + } |
| 3456 | + |
| 3457 | + // If data is available, append data to url for get requests |
| 3458 | + if ( s.data && type == "GET" ) { |
| 3459 | + s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
| 3460 | + |
| 3461 | + // IE likes to send both get and post data, prevent this |
| 3462 | + s.data = null; |
| 3463 | + } |
| 3464 | + |
| 3465 | + // Watch for a new set of requests |
| 3466 | + if ( s.global && ! jQuery.active++ ) |
| 3467 | + jQuery.event.trigger( "ajaxStart" ); |
| 3468 | + |
| 3469 | + // Matches an absolute URL, and saves the domain |
| 3470 | + var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url ); |
| 3471 | + |
| 3472 | + // If we're requesting a remote document |
| 3473 | + // and trying to load JSON or Script with a GET |
| 3474 | + if ( s.dataType == "script" && type == "GET" && parts |
| 3475 | + && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){ |
| 3476 | + |
| 3477 | + var head = document.getElementsByTagName("head")[0]; |
| 3478 | + var script = document.createElement("script"); |
| 3479 | + script.src = s.url; |
| 3480 | + if (s.scriptCharset) |
| 3481 | + script.charset = s.scriptCharset; |
| 3482 | + |
| 3483 | + // Handle Script loading |
| 3484 | + if ( !jsonp ) { |
| 3485 | + var done = false; |
| 3486 | + |
| 3487 | + // Attach handlers for all browsers |
| 3488 | + script.onload = script.onreadystatechange = function(){ |
| 3489 | + if ( !done && (!this.readyState || |
| 3490 | + this.readyState == "loaded" || this.readyState == "complete") ) { |
| 3491 | + done = true; |
| 3492 | + success(); |
| 3493 | + complete(); |
| 3494 | + |
| 3495 | + // Handle memory leak in IE |
| 3496 | + script.onload = script.onreadystatechange = null; |
| 3497 | + head.removeChild( script ); |
| 3498 | + } |
| 3499 | + }; |
| 3500 | + } |
| 3501 | + |
| 3502 | + head.appendChild(script); |
| 3503 | + |
| 3504 | + // We handle everything using the script element injection |
| 3505 | + return undefined; |
| 3506 | + } |
| 3507 | + |
| 3508 | + var requestDone = false; |
| 3509 | + |
| 3510 | + // Create the request object |
| 3511 | + var xhr = s.xhr(); |
| 3512 | + |
| 3513 | + // Open the socket |
| 3514 | + // Passing null username, generates a login popup on Opera (#2865) |
| 3515 | + if( s.username ) |
| 3516 | + xhr.open(type, s.url, s.async, s.username, s.password); |
| 3517 | + else |
| 3518 | + xhr.open(type, s.url, s.async); |
| 3519 | + |
| 3520 | + // Need an extra try/catch for cross domain requests in Firefox 3 |
| 3521 | + try { |
| 3522 | + // Set the correct header, if data is being sent |
| 3523 | + if ( s.data ) |
| 3524 | + xhr.setRequestHeader("Content-Type", s.contentType); |
| 3525 | + |
| 3526 | + // Set the If-Modified-Since header, if ifModified mode. |
| 3527 | + if ( s.ifModified ) |
| 3528 | + xhr.setRequestHeader("If-Modified-Since", |
| 3529 | + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
| 3530 | + |
| 3531 | + // Set header so the called script knows that it's an XMLHttpRequest |
| 3532 | + xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
| 3533 | + |
| 3534 | + // Set the Accepts header for the server, depending on the dataType |
| 3535 | + xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
| 3536 | + s.accepts[ s.dataType ] + ", */*" : |
| 3537 | + s.accepts._default ); |
| 3538 | + } catch(e){} |
| 3539 | + |
| 3540 | + // Allow custom headers/mimetypes and early abort |
| 3541 | + if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { |
| 3542 | + // Handle the global AJAX counter |
| 3543 | + if ( s.global && ! --jQuery.active ) |
| 3544 | + jQuery.event.trigger( "ajaxStop" ); |
| 3545 | + // close opended socket |
| 3546 | + xhr.abort(); |
| 3547 | + return false; |
| 3548 | + } |
| 3549 | + |
| 3550 | + if ( s.global ) |
| 3551 | + jQuery.event.trigger("ajaxSend", [xhr, s]); |
| 3552 | + |
| 3553 | + // Wait for a response to come back |
| 3554 | + var onreadystatechange = function(isTimeout){ |
| 3555 | + // The request was aborted, clear the interval and decrement jQuery.active |
| 3556 | + if (xhr.readyState == 0) { |
| 3557 | + if (ival) { |
| 3558 | + // clear poll interval |
| 3559 | + clearInterval(ival); |
| 3560 | + ival = null; |
| 3561 | + // Handle the global AJAX counter |
| 3562 | + if ( s.global && ! --jQuery.active ) |
| 3563 | + jQuery.event.trigger( "ajaxStop" ); |
| 3564 | + } |
| 3565 | + // The transfer is complete and the data is available, or the request timed out |
| 3566 | + } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { |
| 3567 | + requestDone = true; |
| 3568 | + |
| 3569 | + // clear poll interval |
| 3570 | + if (ival) { |
| 3571 | + clearInterval(ival); |
| 3572 | + ival = null; |
| 3573 | + } |
| 3574 | + |
| 3575 | + status = isTimeout == "timeout" ? "timeout" : |
| 3576 | + !jQuery.httpSuccess( xhr ) ? "error" : |
| 3577 | + s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : |
| 3578 | + "success"; |
| 3579 | + |
| 3580 | + if ( status == "success" ) { |
| 3581 | + // Watch for, and catch, XML document parse errors |
| 3582 | + try { |
| 3583 | + // process the data (runs the xml through httpData regardless of callback) |
| 3584 | + data = jQuery.httpData( xhr, s.dataType, s ); |
| 3585 | + } catch(e) { |
| 3586 | + status = "parsererror"; |
| 3587 | + } |
| 3588 | + } |
| 3589 | + |
| 3590 | + // Make sure that the request was successful or notmodified |
| 3591 | + if ( status == "success" ) { |
| 3592 | + // Cache Last-Modified header, if ifModified mode. |
| 3593 | + var modRes; |
| 3594 | + try { |
| 3595 | + modRes = xhr.getResponseHeader("Last-Modified"); |
| 3596 | + } catch(e) {} // swallow exception thrown by FF if header is not available |
| 3597 | + |
| 3598 | + if ( s.ifModified && modRes ) |
| 3599 | + jQuery.lastModified[s.url] = modRes; |
| 3600 | + |
| 3601 | + // JSONP handles its own success callback |
| 3602 | + if ( !jsonp ) |
| 3603 | + success(); |
| 3604 | + } else |
| 3605 | + jQuery.handleError(s, xhr, status); |
| 3606 | + |
| 3607 | + // Fire the complete handlers |
| 3608 | + complete(); |
| 3609 | + |
| 3610 | + if ( isTimeout ) |
| 3611 | + xhr.abort(); |
| 3612 | + |
| 3613 | + // Stop memory leaks |
| 3614 | + if ( s.async ) |
| 3615 | + xhr = null; |
| 3616 | + } |
| 3617 | + }; |
| 3618 | + |
| 3619 | + if ( s.async ) { |
| 3620 | + // don't attach the handler to the request, just poll it instead |
| 3621 | + var ival = setInterval(onreadystatechange, 13); |
| 3622 | + |
| 3623 | + // Timeout checker |
| 3624 | + if ( s.timeout > 0 ) |
| 3625 | + setTimeout(function(){ |
| 3626 | + // Check to see if the request is still happening |
| 3627 | + if ( xhr && !requestDone ) |
| 3628 | + onreadystatechange( "timeout" ); |
| 3629 | + }, s.timeout); |
| 3630 | + } |
| 3631 | + |
| 3632 | + // Send the data |
| 3633 | + try { |
| 3634 | + xhr.send(s.data); |
| 3635 | + } catch(e) { |
| 3636 | + jQuery.handleError(s, xhr, null, e); |
| 3637 | + } |
| 3638 | + |
| 3639 | + // firefox 1.5 doesn't fire statechange for sync requests |
| 3640 | + if ( !s.async ) |
| 3641 | + onreadystatechange(); |
| 3642 | + |
| 3643 | + function success(){ |
| 3644 | + // If a local callback was specified, fire it and pass it the data |
| 3645 | + if ( s.success ) |
| 3646 | + s.success( data, status ); |
| 3647 | + |
| 3648 | + // Fire the global callback |
| 3649 | + if ( s.global ) |
| 3650 | + jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); |
| 3651 | + } |
| 3652 | + |
| 3653 | + function complete(){ |
| 3654 | + // Process result |
| 3655 | + if ( s.complete ) |
| 3656 | + s.complete(xhr, status); |
| 3657 | + |
| 3658 | + // The request was completed |
| 3659 | + if ( s.global ) |
| 3660 | + jQuery.event.trigger( "ajaxComplete", [xhr, s] ); |
| 3661 | + |
| 3662 | + // Handle the global AJAX counter |
| 3663 | + if ( s.global && ! --jQuery.active ) |
| 3664 | + jQuery.event.trigger( "ajaxStop" ); |
| 3665 | + } |
| 3666 | + |
| 3667 | + // return XMLHttpRequest to allow aborting the request etc. |
| 3668 | + return xhr; |
| 3669 | + }, |
| 3670 | + |
| 3671 | + handleError: function( s, xhr, status, e ) { |
| 3672 | + // If a local callback was specified, fire it |
| 3673 | + if ( s.error ) s.error( xhr, status, e ); |
| 3674 | + |
| 3675 | + // Fire the global callback |
| 3676 | + if ( s.global ) |
| 3677 | + jQuery.event.trigger( "ajaxError", [xhr, s, e] ); |
| 3678 | + }, |
| 3679 | + |
| 3680 | + // Counter for holding the number of active queries |
| 3681 | + active: 0, |
| 3682 | + |
| 3683 | + // Determines if an XMLHttpRequest was successful or not |
| 3684 | + httpSuccess: function( xhr ) { |
| 3685 | + try { |
| 3686 | + // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
| 3687 | + return !xhr.status && location.protocol == "file:" || |
| 3688 | + ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; |
| 3689 | + } catch(e){} |
| 3690 | + return false; |
| 3691 | + }, |
| 3692 | + |
| 3693 | + // Determines if an XMLHttpRequest returns NotModified |
| 3694 | + httpNotModified: function( xhr, url ) { |
| 3695 | + try { |
| 3696 | + var xhrRes = xhr.getResponseHeader("Last-Modified"); |
| 3697 | + |
| 3698 | + // Firefox always returns 200. check Last-Modified date |
| 3699 | + return xhr.status == 304 || xhrRes == jQuery.lastModified[url]; |
| 3700 | + } catch(e){} |
| 3701 | + return false; |
| 3702 | + }, |
| 3703 | + |
| 3704 | + httpData: function( xhr, type, s ) { |
| 3705 | + var ct = xhr.getResponseHeader("content-type"), |
| 3706 | + xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, |
| 3707 | + data = xml ? xhr.responseXML : xhr.responseText; |
| 3708 | + |
| 3709 | + if ( xml && data.documentElement.tagName == "parsererror" ) |
| 3710 | + throw "parsererror"; |
| 3711 | + |
| 3712 | + // Allow a pre-filtering function to sanitize the response |
| 3713 | + // s != null is checked to keep backwards compatibility |
| 3714 | + if( s && s.dataFilter ) |
| 3715 | + data = s.dataFilter( data, type ); |
| 3716 | + |
| 3717 | + // The filter can actually parse the response |
| 3718 | + if( typeof data === "string" ){ |
| 3719 | + |
| 3720 | + // If the type is "script", eval it in global context |
| 3721 | + if ( type == "script" ) |
| 3722 | + jQuery.globalEval( data ); |
| 3723 | + |
| 3724 | + // Get the JavaScript object, if JSON is used. |
| 3725 | + if ( type == "json" ) |
| 3726 | + data = window["eval"]("(" + data + ")"); |
| 3727 | + } |
| 3728 | + |
| 3729 | + return data; |
| 3730 | + }, |
| 3731 | + |
| 3732 | + // Serialize an array of form elements or a set of |
| 3733 | + // key/values into a query string |
| 3734 | + param: function( a ) { |
| 3735 | + var s = [ ]; |
| 3736 | + |
| 3737 | + function add( key, value ){ |
| 3738 | + s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); |
| 3739 | + }; |
| 3740 | + |
| 3741 | + // If an array was passed in, assume that it is an array |
| 3742 | + // of form elements |
| 3743 | + if ( jQuery.isArray(a) || a.jquery ) |
| 3744 | + // Serialize the form elements |
| 3745 | + jQuery.each( a, function(){ |
| 3746 | + add( this.name, this.value ); |
| 3747 | + }); |
| 3748 | + |
| 3749 | + // Otherwise, assume that it's an object of key/value pairs |
| 3750 | + else |
| 3751 | + // Serialize the key/values |
| 3752 | + for ( var j in a ) |
| 3753 | + // If the value is an array then the key names need to be repeated |
| 3754 | + if ( jQuery.isArray(a[j]) ) |
| 3755 | + jQuery.each( a[j], function(){ |
| 3756 | + add( j, this ); |
| 3757 | + }); |
| 3758 | + else |
| 3759 | + add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); |
| 3760 | + |
| 3761 | + // Return the resulting serialization |
| 3762 | + return s.join("&").replace(/%20/g, "+"); |
| 3763 | + } |
| 3764 | + |
| 3765 | +}); |
| 3766 | +var elemdisplay = {}, |
| 3767 | + timerId, |
| 3768 | + fxAttrs = [ |
| 3769 | + // height animations |
| 3770 | + [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
| 3771 | + // width animations |
| 3772 | + [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
| 3773 | + // opacity animations |
| 3774 | + [ "opacity" ] |
| 3775 | + ]; |
| 3776 | + |
| 3777 | +function genFx( type, num ){ |
| 3778 | + var obj = {}; |
| 3779 | + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){ |
| 3780 | + obj[ this ] = type; |
| 3781 | + }); |
| 3782 | + return obj; |
| 3783 | +} |
| 3784 | + |
| 3785 | +jQuery.fn.extend({ |
| 3786 | + show: function(speed,callback){ |
| 3787 | + if ( speed ) { |
| 3788 | + return this.animate( genFx("show", 3), speed, callback); |
| 3789 | + } else { |
| 3790 | + for ( var i = 0, l = this.length; i < l; i++ ){ |
| 3791 | + var old = jQuery.data(this[i], "olddisplay"); |
| 3792 | + |
| 3793 | + this[i].style.display = old || ""; |
| 3794 | + |
| 3795 | + if ( jQuery.css(this[i], "display") === "none" ) { |
| 3796 | + var tagName = this[i].tagName, display; |
| 3797 | + |
| 3798 | + if ( elemdisplay[ tagName ] ) { |
| 3799 | + display = elemdisplay[ tagName ]; |
| 3800 | + } else { |
| 3801 | + var elem = jQuery("<" + tagName + " />").appendTo("body"); |
| 3802 | + |
| 3803 | + display = elem.css("display"); |
| 3804 | + if ( display === "none" ) |
| 3805 | + display = "block"; |
| 3806 | + |
| 3807 | + elem.remove(); |
| 3808 | + |
| 3809 | + elemdisplay[ tagName ] = display; |
| 3810 | + } |
| 3811 | + |
| 3812 | + jQuery.data(this[i], "olddisplay", display); |
| 3813 | + } |
| 3814 | + } |
| 3815 | + |
| 3816 | + // Set the display of the elements in a second loop |
| 3817 | + // to avoid the constant reflow |
| 3818 | + for ( var i = 0, l = this.length; i < l; i++ ){ |
| 3819 | + this[i].style.display = jQuery.data(this[i], "olddisplay") || ""; |
| 3820 | + } |
| 3821 | + |
| 3822 | + return this; |
| 3823 | + } |
| 3824 | + }, |
| 3825 | + |
| 3826 | + hide: function(speed,callback){ |
| 3827 | + if ( speed ) { |
| 3828 | + return this.animate( genFx("hide", 3), speed, callback); |
| 3829 | + } else { |
| 3830 | + for ( var i = 0, l = this.length; i < l; i++ ){ |
| 3831 | + var old = jQuery.data(this[i], "olddisplay"); |
| 3832 | + if ( !old && old !== "none" ) |
| 3833 | + jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); |
| 3834 | + } |
| 3835 | + |
| 3836 | + // Set the display of the elements in a second loop |
| 3837 | + // to avoid the constant reflow |
| 3838 | + for ( var i = 0, l = this.length; i < l; i++ ){ |
| 3839 | + this[i].style.display = "none"; |
| 3840 | + } |
| 3841 | + |
| 3842 | + return this; |
| 3843 | + } |
| 3844 | + }, |
| 3845 | + |
| 3846 | + // Save the old toggle function |
| 3847 | + _toggle: jQuery.fn.toggle, |
| 3848 | + |
| 3849 | + toggle: function( fn, fn2 ){ |
| 3850 | + var bool = typeof fn === "boolean"; |
| 3851 | + |
| 3852 | + return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
| 3853 | + this._toggle.apply( this, arguments ) : |
| 3854 | + fn == null || bool ? |
| 3855 | + this.each(function(){ |
| 3856 | + var state = bool ? fn : jQuery(this).is(":hidden"); |
| 3857 | + jQuery(this)[ state ? "show" : "hide" ](); |
| 3858 | + }) : |
| 3859 | + this.animate(genFx("toggle", 3), fn, fn2); |
| 3860 | + }, |
| 3861 | + |
| 3862 | + fadeTo: function(speed,to,callback){ |
| 3863 | + return this.animate({opacity: to}, speed, callback); |
| 3864 | + }, |
| 3865 | + |
| 3866 | + animate: function( prop, speed, easing, callback ) { |
| 3867 | + var optall = jQuery.speed(speed, easing, callback); |
| 3868 | + |
| 3869 | + return this[ optall.queue === false ? "each" : "queue" ](function(){ |
| 3870 | + |
| 3871 | + var opt = jQuery.extend({}, optall), p, |
| 3872 | + hidden = this.nodeType == 1 && jQuery(this).is(":hidden"), |
| 3873 | + self = this; |
| 3874 | + |
| 3875 | + for ( p in prop ) { |
| 3876 | + if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
| 3877 | + return opt.complete.call(this); |
| 3878 | + |
| 3879 | + if ( ( p == "height" || p == "width" ) && this.style ) { |
| 3880 | + // Store display property |
| 3881 | + opt.display = jQuery.css(this, "display"); |
| 3882 | + |
| 3883 | + // Make sure that nothing sneaks out |
| 3884 | + opt.overflow = this.style.overflow; |
| 3885 | + } |
| 3886 | + } |
| 3887 | + |
| 3888 | + if ( opt.overflow != null ) |
| 3889 | + this.style.overflow = "hidden"; |
| 3890 | + |
| 3891 | + opt.curAnim = jQuery.extend({}, prop); |
| 3892 | + |
| 3893 | + jQuery.each( prop, function(name, val){ |
| 3894 | + var e = new jQuery.fx( self, opt, name ); |
| 3895 | + |
| 3896 | + if ( /toggle|show|hide/.test(val) ) |
| 3897 | + e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
| 3898 | + else { |
| 3899 | + var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
| 3900 | + start = e.cur(true) || 0; |
| 3901 | + |
| 3902 | + if ( parts ) { |
| 3903 | + var end = parseFloat(parts[2]), |
| 3904 | + unit = parts[3] || "px"; |
| 3905 | + |
| 3906 | + // We need to compute starting value |
| 3907 | + if ( unit != "px" ) { |
| 3908 | + self.style[ name ] = (end || 1) + unit; |
| 3909 | + start = ((end || 1) / e.cur(true)) * start; |
| 3910 | + self.style[ name ] = start + unit; |
| 3911 | + } |
| 3912 | + |
| 3913 | + // If a +=/-= token was provided, we're doing a relative animation |
| 3914 | + if ( parts[1] ) |
| 3915 | + end = ((parts[1] == "-=" ? -1 : 1) * end) + start; |
| 3916 | + |
| 3917 | + e.custom( start, end, unit ); |
| 3918 | + } else |
| 3919 | + e.custom( start, val, "" ); |
| 3920 | + } |
| 3921 | + }); |
| 3922 | + |
| 3923 | + // For JS strict compliance |
| 3924 | + return true; |
| 3925 | + }); |
| 3926 | + }, |
| 3927 | + |
| 3928 | + stop: function(clearQueue, gotoEnd){ |
| 3929 | + var timers = jQuery.timers; |
| 3930 | + |
| 3931 | + if (clearQueue) |
| 3932 | + this.queue([]); |
| 3933 | + |
| 3934 | + this.each(function(){ |
| 3935 | + // go in reverse order so anything added to the queue during the loop is ignored |
| 3936 | + for ( var i = timers.length - 1; i >= 0; i-- ) |
| 3937 | + if ( timers[i].elem == this ) { |
| 3938 | + if (gotoEnd) |
| 3939 | + // force the next step to be the last |
| 3940 | + timers[i](true); |
| 3941 | + timers.splice(i, 1); |
| 3942 | + } |
| 3943 | + }); |
| 3944 | + |
| 3945 | + // start the next in the queue if the last step wasn't forced |
| 3946 | + if (!gotoEnd) |
| 3947 | + this.dequeue(); |
| 3948 | + |
| 3949 | + return this; |
| 3950 | + } |
| 3951 | + |
| 3952 | +}); |
| 3953 | + |
| 3954 | +// Generate shortcuts for custom animations |
| 3955 | +jQuery.each({ |
| 3956 | + slideDown: genFx("show", 1), |
| 3957 | + slideUp: genFx("hide", 1), |
| 3958 | + slideToggle: genFx("toggle", 1), |
| 3959 | + fadeIn: { opacity: "show" }, |
| 3960 | + fadeOut: { opacity: "hide" } |
| 3961 | +}, function( name, props ){ |
| 3962 | + jQuery.fn[ name ] = function( speed, callback ){ |
| 3963 | + return this.animate( props, speed, callback ); |
| 3964 | + }; |
| 3965 | +}); |
| 3966 | + |
| 3967 | +jQuery.extend({ |
| 3968 | + |
| 3969 | + speed: function(speed, easing, fn) { |
| 3970 | + var opt = typeof speed === "object" ? speed : { |
| 3971 | + complete: fn || !fn && easing || |
| 3972 | + jQuery.isFunction( speed ) && speed, |
| 3973 | + duration: speed, |
| 3974 | + easing: fn && easing || easing && !jQuery.isFunction(easing) && easing |
| 3975 | + }; |
| 3976 | + |
| 3977 | + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
| 3978 | + jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; |
| 3979 | + |
| 3980 | + // Queueing |
| 3981 | + opt.old = opt.complete; |
| 3982 | + opt.complete = function(){ |
| 3983 | + if ( opt.queue !== false ) |
| 3984 | + jQuery(this).dequeue(); |
| 3985 | + if ( jQuery.isFunction( opt.old ) ) |
| 3986 | + opt.old.call( this ); |
| 3987 | + }; |
| 3988 | + |
| 3989 | + return opt; |
| 3990 | + }, |
| 3991 | + |
| 3992 | + easing: { |
| 3993 | + linear: function( p, n, firstNum, diff ) { |
| 3994 | + return firstNum + diff * p; |
| 3995 | + }, |
| 3996 | + swing: function( p, n, firstNum, diff ) { |
| 3997 | + return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
| 3998 | + } |
| 3999 | + }, |
| 4000 | + |
| 4001 | + timers: [], |
| 4002 | + |
| 4003 | + fx: function( elem, options, prop ){ |
| 4004 | + this.options = options; |
| 4005 | + this.elem = elem; |
| 4006 | + this.prop = prop; |
| 4007 | + |
| 4008 | + if ( !options.orig ) |
| 4009 | + options.orig = {}; |
| 4010 | + } |
| 4011 | + |
| 4012 | +}); |
| 4013 | + |
| 4014 | +jQuery.fx.prototype = { |
| 4015 | + |
| 4016 | + // Simple function for setting a style value |
| 4017 | + update: function(){ |
| 4018 | + if ( this.options.step ) |
| 4019 | + this.options.step.call( this.elem, this.now, this ); |
| 4020 | + |
| 4021 | + (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
| 4022 | + |
| 4023 | + // Set display property to block for height/width animations |
| 4024 | + if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style ) |
| 4025 | + this.elem.style.display = "block"; |
| 4026 | + }, |
| 4027 | + |
| 4028 | + // Get the current size |
| 4029 | + cur: function(force){ |
| 4030 | + if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) |
| 4031 | + return this.elem[ this.prop ]; |
| 4032 | + |
| 4033 | + var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
| 4034 | + return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
| 4035 | + }, |
| 4036 | + |
| 4037 | + // Start an animation from one number to another |
| 4038 | + custom: function(from, to, unit){ |
| 4039 | + this.startTime = now(); |
| 4040 | + this.start = from; |
| 4041 | + this.end = to; |
| 4042 | + this.unit = unit || this.unit || "px"; |
| 4043 | + this.now = this.start; |
| 4044 | + this.pos = this.state = 0; |
| 4045 | + |
| 4046 | + var self = this; |
| 4047 | + function t(gotoEnd){ |
| 4048 | + return self.step(gotoEnd); |
| 4049 | + } |
| 4050 | + |
| 4051 | + t.elem = this.elem; |
| 4052 | + |
| 4053 | + if ( t() && jQuery.timers.push(t) && !timerId ) { |
| 4054 | + timerId = setInterval(function(){ |
| 4055 | + var timers = jQuery.timers; |
| 4056 | + |
| 4057 | + for ( var i = 0; i < timers.length; i++ ) |
| 4058 | + if ( !timers[i]() ) |
| 4059 | + timers.splice(i--, 1); |
| 4060 | + |
| 4061 | + if ( !timers.length ) { |
| 4062 | + clearInterval( timerId ); |
| 4063 | + timerId = undefined; |
| 4064 | + } |
| 4065 | + }, 13); |
| 4066 | + } |
| 4067 | + }, |
| 4068 | + |
| 4069 | + // Simple 'show' function |
| 4070 | + show: function(){ |
| 4071 | + // Remember where we started, so that we can go back to it later |
| 4072 | + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
| 4073 | + this.options.show = true; |
| 4074 | + |
| 4075 | + // Begin the animation |
| 4076 | + // Make sure that we start at a small width/height to avoid any |
| 4077 | + // flash of content |
| 4078 | + this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur()); |
| 4079 | + |
| 4080 | + // Start by showing the element |
| 4081 | + jQuery(this.elem).show(); |
| 4082 | + }, |
| 4083 | + |
| 4084 | + // Simple 'hide' function |
| 4085 | + hide: function(){ |
| 4086 | + // Remember where we started, so that we can go back to it later |
| 4087 | + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
| 4088 | + this.options.hide = true; |
| 4089 | + |
| 4090 | + // Begin the animation |
| 4091 | + this.custom(this.cur(), 0); |
| 4092 | + }, |
| 4093 | + |
| 4094 | + // Each step of an animation |
| 4095 | + step: function(gotoEnd){ |
| 4096 | + var t = now(); |
| 4097 | + |
| 4098 | + if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
| 4099 | + this.now = this.end; |
| 4100 | + this.pos = this.state = 1; |
| 4101 | + this.update(); |
| 4102 | + |
| 4103 | + this.options.curAnim[ this.prop ] = true; |
| 4104 | + |
| 4105 | + var done = true; |
| 4106 | + for ( var i in this.options.curAnim ) |
| 4107 | + if ( this.options.curAnim[i] !== true ) |
| 4108 | + done = false; |
| 4109 | + |
| 4110 | + if ( done ) { |
| 4111 | + if ( this.options.display != null ) { |
| 4112 | + // Reset the overflow |
| 4113 | + this.elem.style.overflow = this.options.overflow; |
| 4114 | + |
| 4115 | + // Reset the display |
| 4116 | + this.elem.style.display = this.options.display; |
| 4117 | + if ( jQuery.css(this.elem, "display") == "none" ) |
| 4118 | + this.elem.style.display = "block"; |
| 4119 | + } |
| 4120 | + |
| 4121 | + // Hide the element if the "hide" operation was done |
| 4122 | + if ( this.options.hide ) |
| 4123 | + jQuery(this.elem).hide(); |
| 4124 | + |
| 4125 | + // Reset the properties, if the item has been hidden or shown |
| 4126 | + if ( this.options.hide || this.options.show ) |
| 4127 | + for ( var p in this.options.curAnim ) |
| 4128 | + jQuery.attr(this.elem.style, p, this.options.orig[p]); |
| 4129 | + |
| 4130 | + // Execute the complete function |
| 4131 | + this.options.complete.call( this.elem ); |
| 4132 | + } |
| 4133 | + |
| 4134 | + return false; |
| 4135 | + } else { |
| 4136 | + var n = t - this.startTime; |
| 4137 | + this.state = n / this.options.duration; |
| 4138 | + |
| 4139 | + // Perform the easing function, defaults to swing |
| 4140 | + this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); |
| 4141 | + this.now = this.start + ((this.end - this.start) * this.pos); |
| 4142 | + |
| 4143 | + // Perform the next step of the animation |
| 4144 | + this.update(); |
| 4145 | + } |
| 4146 | + |
| 4147 | + return true; |
| 4148 | + } |
| 4149 | + |
| 4150 | +}; |
| 4151 | + |
| 4152 | +jQuery.extend( jQuery.fx, { |
| 4153 | + speeds:{ |
| 4154 | + slow: 600, |
| 4155 | + fast: 200, |
| 4156 | + // Default speed |
| 4157 | + _default: 400 |
| 4158 | + }, |
| 4159 | + step: { |
| 4160 | + |
| 4161 | + opacity: function(fx){ |
| 4162 | + jQuery.attr(fx.elem.style, "opacity", fx.now); |
| 4163 | + }, |
| 4164 | + |
| 4165 | + _default: function(fx){ |
| 4166 | + if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) |
| 4167 | + fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
| 4168 | + else |
| 4169 | + fx.elem[ fx.prop ] = fx.now; |
| 4170 | + } |
| 4171 | + } |
| 4172 | +}); |
| 4173 | +if ( document.documentElement["getBoundingClientRect"] ) |
| 4174 | + jQuery.fn.offset = function() { |
| 4175 | + if ( !this[0] ) return { top: 0, left: 0 }; |
| 4176 | + if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); |
| 4177 | + var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement, |
| 4178 | + clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, |
| 4179 | + top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
| 4180 | + left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
| 4181 | + return { top: top, left: left }; |
| 4182 | + }; |
| 4183 | +else |
| 4184 | + jQuery.fn.offset = function() { |
| 4185 | + if ( !this[0] ) return { top: 0, left: 0 }; |
| 4186 | + if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); |
| 4187 | + jQuery.offset.initialized || jQuery.offset.initialize(); |
| 4188 | + |
| 4189 | + var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem, |
| 4190 | + doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, |
| 4191 | + body = doc.body, defaultView = doc.defaultView, |
| 4192 | + prevComputedStyle = defaultView.getComputedStyle(elem, null), |
| 4193 | + top = elem.offsetTop, left = elem.offsetLeft; |
| 4194 | + |
| 4195 | + while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
| 4196 | + computedStyle = defaultView.getComputedStyle(elem, null); |
| 4197 | + top -= elem.scrollTop, left -= elem.scrollLeft; |
| 4198 | + if ( elem === offsetParent ) { |
| 4199 | + top += elem.offsetTop, left += elem.offsetLeft; |
| 4200 | + if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) |
| 4201 | + top += parseInt( computedStyle.borderTopWidth, 10) || 0, |
| 4202 | + left += parseInt( computedStyle.borderLeftWidth, 10) || 0; |
| 4203 | + prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; |
| 4204 | + } |
| 4205 | + if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) |
| 4206 | + top += parseInt( computedStyle.borderTopWidth, 10) || 0, |
| 4207 | + left += parseInt( computedStyle.borderLeftWidth, 10) || 0; |
| 4208 | + prevComputedStyle = computedStyle; |
| 4209 | + } |
| 4210 | + |
| 4211 | + if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) |
| 4212 | + top += body.offsetTop, |
| 4213 | + left += body.offsetLeft; |
| 4214 | + |
| 4215 | + if ( prevComputedStyle.position === "fixed" ) |
| 4216 | + top += Math.max(docElem.scrollTop, body.scrollTop), |
| 4217 | + left += Math.max(docElem.scrollLeft, body.scrollLeft); |
| 4218 | + |
| 4219 | + return { top: top, left: left }; |
| 4220 | + }; |
| 4221 | + |
| 4222 | +jQuery.offset = { |
| 4223 | + initialize: function() { |
| 4224 | + if ( this.initialized ) return; |
| 4225 | + var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop, |
| 4226 | + html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>'; |
| 4227 | + |
| 4228 | + rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' }; |
| 4229 | + for ( prop in rules ) container.style[prop] = rules[prop]; |
| 4230 | + |
| 4231 | + container.innerHTML = html; |
| 4232 | + body.insertBefore(container, body.firstChild); |
| 4233 | + innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild; |
| 4234 | + |
| 4235 | + this.doesNotAddBorder = (checkDiv.offsetTop !== 5); |
| 4236 | + this.doesAddBorderForTableAndCells = (td.offsetTop === 5); |
| 4237 | + |
| 4238 | + innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; |
| 4239 | + this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
| 4240 | + |
| 4241 | + body.style.marginTop = '1px'; |
| 4242 | + this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0); |
| 4243 | + body.style.marginTop = bodyMarginTop; |
| 4244 | + |
| 4245 | + body.removeChild(container); |
| 4246 | + this.initialized = true; |
| 4247 | + }, |
| 4248 | + |
| 4249 | + bodyOffset: function(body) { |
| 4250 | + jQuery.offset.initialized || jQuery.offset.initialize(); |
| 4251 | + var top = body.offsetTop, left = body.offsetLeft; |
| 4252 | + if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) |
| 4253 | + top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0, |
| 4254 | + left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0; |
| 4255 | + return { top: top, left: left }; |
| 4256 | + } |
| 4257 | +}; |
| 4258 | + |
| 4259 | + |
| 4260 | +jQuery.fn.extend({ |
| 4261 | + position: function() { |
| 4262 | + var left = 0, top = 0, results; |
| 4263 | + |
| 4264 | + if ( this[0] ) { |
| 4265 | + // Get *real* offsetParent |
| 4266 | + var offsetParent = this.offsetParent(), |
| 4267 | + |
| 4268 | + // Get correct offsets |
| 4269 | + offset = this.offset(), |
| 4270 | + parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); |
| 4271 | + |
| 4272 | + // Subtract element margins |
| 4273 | + // note: when an element has margin: auto the offsetLeft and marginLeft |
| 4274 | + // are the same in Safari causing offset.left to incorrectly be 0 |
| 4275 | + offset.top -= num( this, 'marginTop' ); |
| 4276 | + offset.left -= num( this, 'marginLeft' ); |
| 4277 | + |
| 4278 | + // Add offsetParent borders |
| 4279 | + parentOffset.top += num( offsetParent, 'borderTopWidth' ); |
| 4280 | + parentOffset.left += num( offsetParent, 'borderLeftWidth' ); |
| 4281 | + |
| 4282 | + // Subtract the two offsets |
| 4283 | + results = { |
| 4284 | + top: offset.top - parentOffset.top, |
| 4285 | + left: offset.left - parentOffset.left |
| 4286 | + }; |
| 4287 | + } |
| 4288 | + |
| 4289 | + return results; |
| 4290 | + }, |
| 4291 | + |
| 4292 | + offsetParent: function() { |
| 4293 | + var offsetParent = this[0].offsetParent || document.body; |
| 4294 | + while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) |
| 4295 | + offsetParent = offsetParent.offsetParent; |
| 4296 | + return jQuery(offsetParent); |
| 4297 | + } |
| 4298 | +}); |
| 4299 | + |
| 4300 | + |
| 4301 | +// Create scrollLeft and scrollTop methods |
| 4302 | +jQuery.each( ['Left', 'Top'], function(i, name) { |
| 4303 | + var method = 'scroll' + name; |
| 4304 | + |
| 4305 | + jQuery.fn[ method ] = function(val) { |
| 4306 | + if (!this[0]) return null; |
| 4307 | + |
| 4308 | + return val !== undefined ? |
| 4309 | + |
| 4310 | + // Set the scroll offset |
| 4311 | + this.each(function() { |
| 4312 | + this == window || this == document ? |
| 4313 | + window.scrollTo( |
| 4314 | + !i ? val : jQuery(window).scrollLeft(), |
| 4315 | + i ? val : jQuery(window).scrollTop() |
| 4316 | + ) : |
| 4317 | + this[ method ] = val; |
| 4318 | + }) : |
| 4319 | + |
| 4320 | + // Return the scroll offset |
| 4321 | + this[0] == window || this[0] == document ? |
| 4322 | + self[ i ? 'pageYOffset' : 'pageXOffset' ] || |
| 4323 | + jQuery.boxModel && document.documentElement[ method ] || |
| 4324 | + document.body[ method ] : |
| 4325 | + this[0][ method ]; |
| 4326 | + }; |
| 4327 | +}); |
| 4328 | +// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
| 4329 | +jQuery.each([ "Height", "Width" ], function(i, name){ |
| 4330 | + |
| 4331 | + var tl = i ? "Left" : "Top", // top or left |
| 4332 | + br = i ? "Right" : "Bottom", // bottom or right |
| 4333 | + lower = name.toLowerCase(); |
| 4334 | + |
| 4335 | + // innerHeight and innerWidth |
| 4336 | + jQuery.fn["inner" + name] = function(){ |
| 4337 | + return this[0] ? |
| 4338 | + jQuery.css( this[0], lower, false, "padding" ) : |
| 4339 | + null; |
| 4340 | + }; |
| 4341 | + |
| 4342 | + // outerHeight and outerWidth |
| 4343 | + jQuery.fn["outer" + name] = function(margin) { |
| 4344 | + return this[0] ? |
| 4345 | + jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : |
| 4346 | + null; |
| 4347 | + }; |
| 4348 | + |
| 4349 | + var type = name.toLowerCase(); |
| 4350 | + |
| 4351 | + jQuery.fn[ type ] = function( size ) { |
| 4352 | + // Get window width or height |
| 4353 | + return this[0] == window ? |
| 4354 | + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
| 4355 | + document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || |
| 4356 | + document.body[ "client" + name ] : |
| 4357 | + |
| 4358 | + // Get document width or height |
| 4359 | + this[0] == document ? |
| 4360 | + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
| 4361 | + Math.max( |
| 4362 | + document.documentElement["client" + name], |
| 4363 | + document.body["scroll" + name], document.documentElement["scroll" + name], |
| 4364 | + document.body["offset" + name], document.documentElement["offset" + name] |
| 4365 | + ) : |
| 4366 | + |
| 4367 | + // Get or set width or height on the element |
| 4368 | + size === undefined ? |
| 4369 | + // Get width or height on the element |
| 4370 | + (this.length ? jQuery.css( this[0], type ) : null) : |
| 4371 | + |
| 4372 | + // Set the width or height on the element (default to pixels if value is unitless) |
| 4373 | + this.css( type, typeof size === "string" ? size : size + "px" ); |
| 4374 | + }; |
| 4375 | + |
| 4376 | +}); |
| 4377 | +})(); |
| 4378 | +/* |
| 4379 | + * jQuery UI 1.7.2 |
| 4380 | + * |
| 4381 | + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
| 4382 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 4383 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 4384 | + * |
| 4385 | + * http://docs.jquery.com/UI |
| 4386 | + */ |
| 4387 | +;jQuery.ui || (function($) { |
| 4388 | + |
| 4389 | +var _remove = $.fn.remove, |
| 4390 | + isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); |
| 4391 | + |
| 4392 | +//Helper functions and ui object |
| 4393 | +$.ui = { |
| 4394 | + version: "1.7.2", |
| 4395 | + |
| 4396 | + // $.ui.plugin is deprecated. Use the proxy pattern instead. |
| 4397 | + plugin: { |
| 4398 | + add: function(module, option, set) { |
| 4399 | + var proto = $.ui[module].prototype; |
| 4400 | + for(var i in set) { |
| 4401 | + proto.plugins[i] = proto.plugins[i] || []; |
| 4402 | + proto.plugins[i].push([option, set[i]]); |
| 4403 | + } |
| 4404 | + }, |
| 4405 | + call: function(instance, name, args) { |
| 4406 | + var set = instance.plugins[name]; |
| 4407 | + if(!set || !instance.element[0].parentNode) { return; } |
| 4408 | + |
| 4409 | + for (var i = 0; i < set.length; i++) { |
| 4410 | + if (instance.options[set[i][0]]) { |
| 4411 | + set[i][1].apply(instance.element, args); |
| 4412 | + } |
| 4413 | + } |
| 4414 | + } |
| 4415 | + }, |
| 4416 | + |
| 4417 | + contains: function(a, b) { |
| 4418 | + return document.compareDocumentPosition |
| 4419 | + ? a.compareDocumentPosition(b) & 16 |
| 4420 | + : a !== b && a.contains(b); |
| 4421 | + }, |
| 4422 | + |
| 4423 | + hasScroll: function(el, a) { |
| 4424 | + |
| 4425 | + //If overflow is hidden, the element might have extra content, but the user wants to hide it |
| 4426 | + if ($(el).css('overflow') == 'hidden') { return false; } |
| 4427 | + |
| 4428 | + var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', |
| 4429 | + has = false; |
| 4430 | + |
| 4431 | + if (el[scroll] > 0) { return true; } |
| 4432 | + |
| 4433 | + // TODO: determine which cases actually cause this to happen |
| 4434 | + // if the element doesn't have the scroll set, see if it's possible to |
| 4435 | + // set the scroll |
| 4436 | + el[scroll] = 1; |
| 4437 | + has = (el[scroll] > 0); |
| 4438 | + el[scroll] = 0; |
| 4439 | + return has; |
| 4440 | + }, |
| 4441 | + |
| 4442 | + isOverAxis: function(x, reference, size) { |
| 4443 | + //Determines when x coordinate is over "b" element axis |
| 4444 | + return (x > reference) && (x < (reference + size)); |
| 4445 | + }, |
| 4446 | + |
| 4447 | + isOver: function(y, x, top, left, height, width) { |
| 4448 | + //Determines when x, y coordinates is over "b" element |
| 4449 | + return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); |
| 4450 | + }, |
| 4451 | + |
| 4452 | + keyCode: { |
| 4453 | + BACKSPACE: 8, |
| 4454 | + CAPS_LOCK: 20, |
| 4455 | + COMMA: 188, |
| 4456 | + CONTROL: 17, |
| 4457 | + DELETE: 46, |
| 4458 | + DOWN: 40, |
| 4459 | + END: 35, |
| 4460 | + ENTER: 13, |
| 4461 | + ESCAPE: 27, |
| 4462 | + HOME: 36, |
| 4463 | + INSERT: 45, |
| 4464 | + LEFT: 37, |
| 4465 | + NUMPAD_ADD: 107, |
| 4466 | + NUMPAD_DECIMAL: 110, |
| 4467 | + NUMPAD_DIVIDE: 111, |
| 4468 | + NUMPAD_ENTER: 108, |
| 4469 | + NUMPAD_MULTIPLY: 106, |
| 4470 | + NUMPAD_SUBTRACT: 109, |
| 4471 | + PAGE_DOWN: 34, |
| 4472 | + PAGE_UP: 33, |
| 4473 | + PERIOD: 190, |
| 4474 | + RIGHT: 39, |
| 4475 | + SHIFT: 16, |
| 4476 | + SPACE: 32, |
| 4477 | + TAB: 9, |
| 4478 | + UP: 38 |
| 4479 | + } |
| 4480 | +}; |
| 4481 | + |
| 4482 | +// WAI-ARIA normalization |
| 4483 | +if (isFF2) { |
| 4484 | + var attr = $.attr, |
| 4485 | + removeAttr = $.fn.removeAttr, |
| 4486 | + ariaNS = "http://www.w3.org/2005/07/aaa", |
| 4487 | + ariaState = /^aria-/, |
| 4488 | + ariaRole = /^wairole:/; |
| 4489 | + |
| 4490 | + $.attr = function(elem, name, value) { |
| 4491 | + var set = value !== undefined; |
| 4492 | + |
| 4493 | + return (name == 'role' |
| 4494 | + ? (set |
| 4495 | + ? attr.call(this, elem, name, "wairole:" + value) |
| 4496 | + : (attr.apply(this, arguments) || "").replace(ariaRole, "")) |
| 4497 | + : (ariaState.test(name) |
| 4498 | + ? (set |
| 4499 | + ? elem.setAttributeNS(ariaNS, |
| 4500 | + name.replace(ariaState, "aaa:"), value) |
| 4501 | + : attr.call(this, elem, name.replace(ariaState, "aaa:"))) |
| 4502 | + : attr.apply(this, arguments))); |
| 4503 | + }; |
| 4504 | + |
| 4505 | + $.fn.removeAttr = function(name) { |
| 4506 | + return (ariaState.test(name) |
| 4507 | + ? this.each(function() { |
| 4508 | + this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); |
| 4509 | + }) : removeAttr.call(this, name)); |
| 4510 | + }; |
| 4511 | +} |
| 4512 | + |
| 4513 | +//jQuery plugins |
| 4514 | +$.fn.extend({ |
| 4515 | + remove: function() { |
| 4516 | + // Safari has a native remove event which actually removes DOM elements, |
| 4517 | + // so we have to use triggerHandler instead of trigger (#3037). |
| 4518 | + $("*", this).add(this).each(function() { |
| 4519 | + $(this).triggerHandler("remove"); |
| 4520 | + }); |
| 4521 | + return _remove.apply(this, arguments ); |
| 4522 | + }, |
| 4523 | + |
| 4524 | + enableSelection: function() { |
| 4525 | + return this |
| 4526 | + .attr('unselectable', 'off') |
| 4527 | + .css('MozUserSelect', '') |
| 4528 | + .unbind('selectstart.ui'); |
| 4529 | + }, |
| 4530 | + |
| 4531 | + disableSelection: function() { |
| 4532 | + return this |
| 4533 | + .attr('unselectable', 'on') |
| 4534 | + .css('MozUserSelect', 'none') |
| 4535 | + .bind('selectstart.ui', function() { return false; }); |
| 4536 | + }, |
| 4537 | + |
| 4538 | + scrollParent: function() { |
| 4539 | + var scrollParent; |
| 4540 | + if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { |
| 4541 | + scrollParent = this.parents().filter(function() { |
| 4542 | + return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); |
| 4543 | + }).eq(0); |
| 4544 | + } else { |
| 4545 | + scrollParent = this.parents().filter(function() { |
| 4546 | + return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); |
| 4547 | + }).eq(0); |
| 4548 | + } |
| 4549 | + |
| 4550 | + return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; |
| 4551 | + } |
| 4552 | +}); |
| 4553 | + |
| 4554 | + |
| 4555 | +//Additional selectors |
| 4556 | +$.extend($.expr[':'], { |
| 4557 | + data: function(elem, i, match) { |
| 4558 | + return !!$.data(elem, match[3]); |
| 4559 | + }, |
| 4560 | + |
| 4561 | + focusable: function(element) { |
| 4562 | + var nodeName = element.nodeName.toLowerCase(), |
| 4563 | + tabIndex = $.attr(element, 'tabindex'); |
| 4564 | + return (/input|select|textarea|button|object/.test(nodeName) |
| 4565 | + ? !element.disabled |
| 4566 | + : 'a' == nodeName || 'area' == nodeName |
| 4567 | + ? element.href || !isNaN(tabIndex) |
| 4568 | + : !isNaN(tabIndex)) |
| 4569 | + // the element and all of its ancestors must be visible |
| 4570 | + // the browser may report that the area is hidden |
| 4571 | + && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; |
| 4572 | + }, |
| 4573 | + |
| 4574 | + tabbable: function(element) { |
| 4575 | + var tabIndex = $.attr(element, 'tabindex'); |
| 4576 | + return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); |
| 4577 | + } |
| 4578 | +}); |
| 4579 | + |
| 4580 | + |
| 4581 | +// $.widget is a factory to create jQuery plugins |
| 4582 | +// taking some boilerplate code out of the plugin code |
| 4583 | +function getter(namespace, plugin, method, args) { |
| 4584 | + function getMethods(type) { |
| 4585 | + var methods = $[namespace][plugin][type] || []; |
| 4586 | + return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); |
| 4587 | + } |
| 4588 | + |
| 4589 | + var methods = getMethods('getter'); |
| 4590 | + if (args.length == 1 && typeof args[0] == 'string') { |
| 4591 | + methods = methods.concat(getMethods('getterSetter')); |
| 4592 | + } |
| 4593 | + return ($.inArray(method, methods) != -1); |
| 4594 | +} |
| 4595 | + |
| 4596 | +$.widget = function(name, prototype) { |
| 4597 | + var namespace = name.split(".")[0]; |
| 4598 | + name = name.split(".")[1]; |
| 4599 | + |
| 4600 | + // create plugin method |
| 4601 | + $.fn[name] = function(options) { |
| 4602 | + var isMethodCall = (typeof options == 'string'), |
| 4603 | + args = Array.prototype.slice.call(arguments, 1); |
| 4604 | + |
| 4605 | + // prevent calls to internal methods |
| 4606 | + if (isMethodCall && options.substring(0, 1) == '_') { |
| 4607 | + return this; |
| 4608 | + } |
| 4609 | + |
| 4610 | + // handle getter methods |
| 4611 | + if (isMethodCall && getter(namespace, name, options, args)) { |
| 4612 | + var instance = $.data(this[0], name); |
| 4613 | + return (instance ? instance[options].apply(instance, args) |
| 4614 | + : undefined); |
| 4615 | + } |
| 4616 | + |
| 4617 | + // handle initialization and non-getter methods |
| 4618 | + return this.each(function() { |
| 4619 | + var instance = $.data(this, name); |
| 4620 | + |
| 4621 | + // constructor |
| 4622 | + (!instance && !isMethodCall && |
| 4623 | + $.data(this, name, new $[namespace][name](this, options))._init()); |
| 4624 | + |
| 4625 | + // method call |
| 4626 | + (instance && isMethodCall && $.isFunction(instance[options]) && |
| 4627 | + instance[options].apply(instance, args)); |
| 4628 | + }); |
| 4629 | + }; |
| 4630 | + |
| 4631 | + // create widget constructor |
| 4632 | + $[namespace] = $[namespace] || {}; |
| 4633 | + $[namespace][name] = function(element, options) { |
| 4634 | + var self = this; |
| 4635 | + |
| 4636 | + this.namespace = namespace; |
| 4637 | + this.widgetName = name; |
| 4638 | + this.widgetEventPrefix = $[namespace][name].eventPrefix || name; |
| 4639 | + this.widgetBaseClass = namespace + '-' + name; |
| 4640 | + |
| 4641 | + this.options = $.extend({}, |
| 4642 | + $.widget.defaults, |
| 4643 | + $[namespace][name].defaults, |
| 4644 | + $.metadata && $.metadata.get(element)[name], |
| 4645 | + options); |
| 4646 | + |
| 4647 | + this.element = $(element) |
| 4648 | + .bind('setData.' + name, function(event, key, value) { |
| 4649 | + if (event.target == element) { |
| 4650 | + return self._setData(key, value); |
| 4651 | + } |
| 4652 | + }) |
| 4653 | + .bind('getData.' + name, function(event, key) { |
| 4654 | + if (event.target == element) { |
| 4655 | + return self._getData(key); |
| 4656 | + } |
| 4657 | + }) |
| 4658 | + .bind('remove', function() { |
| 4659 | + return self.destroy(); |
| 4660 | + }); |
| 4661 | + }; |
| 4662 | + |
| 4663 | + // add widget prototype |
| 4664 | + $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); |
| 4665 | + |
| 4666 | + // TODO: merge getter and getterSetter properties from widget prototype |
| 4667 | + // and plugin prototype |
| 4668 | + $[namespace][name].getterSetter = 'option'; |
| 4669 | +}; |
| 4670 | + |
| 4671 | +$.widget.prototype = { |
| 4672 | + _init: function() {}, |
| 4673 | + destroy: function() { |
| 4674 | + this.element.removeData(this.widgetName) |
| 4675 | + .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') |
| 4676 | + .removeAttr('aria-disabled'); |
| 4677 | + }, |
| 4678 | + |
| 4679 | + option: function(key, value) { |
| 4680 | + var options = key, |
| 4681 | + self = this; |
| 4682 | + |
| 4683 | + if (typeof key == "string") { |
| 4684 | + if (value === undefined) { |
| 4685 | + return this._getData(key); |
| 4686 | + } |
| 4687 | + options = {}; |
| 4688 | + options[key] = value; |
| 4689 | + } |
| 4690 | + |
| 4691 | + $.each(options, function(key, value) { |
| 4692 | + self._setData(key, value); |
| 4693 | + }); |
| 4694 | + }, |
| 4695 | + _getData: function(key) { |
| 4696 | + return this.options[key]; |
| 4697 | + }, |
| 4698 | + _setData: function(key, value) { |
| 4699 | + this.options[key] = value; |
| 4700 | + |
| 4701 | + if (key == 'disabled') { |
| 4702 | + this.element |
| 4703 | + [value ? 'addClass' : 'removeClass']( |
| 4704 | + this.widgetBaseClass + '-disabled' + ' ' + |
| 4705 | + this.namespace + '-state-disabled') |
| 4706 | + .attr("aria-disabled", value); |
| 4707 | + } |
| 4708 | + }, |
| 4709 | + |
| 4710 | + enable: function() { |
| 4711 | + this._setData('disabled', false); |
| 4712 | + }, |
| 4713 | + disable: function() { |
| 4714 | + this._setData('disabled', true); |
| 4715 | + }, |
| 4716 | + |
| 4717 | + _trigger: function(type, event, data) { |
| 4718 | + var callback = this.options[type], |
| 4719 | + eventName = (type == this.widgetEventPrefix |
| 4720 | + ? type : this.widgetEventPrefix + type); |
| 4721 | + |
| 4722 | + event = $.Event(event); |
| 4723 | + event.type = eventName; |
| 4724 | + |
| 4725 | + // copy original event properties over to the new event |
| 4726 | + // this would happen if we could call $.event.fix instead of $.Event |
| 4727 | + // but we don't have a way to force an event to be fixed multiple times |
| 4728 | + if (event.originalEvent) { |
| 4729 | + for (var i = $.event.props.length, prop; i;) { |
| 4730 | + prop = $.event.props[--i]; |
| 4731 | + event[prop] = event.originalEvent[prop]; |
| 4732 | + } |
| 4733 | + } |
| 4734 | + |
| 4735 | + this.element.trigger(event, data); |
| 4736 | + |
| 4737 | + return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false |
| 4738 | + || event.isDefaultPrevented()); |
| 4739 | + } |
| 4740 | +}; |
| 4741 | + |
| 4742 | +$.widget.defaults = { |
| 4743 | + disabled: false |
| 4744 | +}; |
| 4745 | + |
| 4746 | + |
| 4747 | +/** Mouse Interaction Plugin **/ |
| 4748 | + |
| 4749 | +$.ui.mouse = { |
| 4750 | + _mouseInit: function() { |
| 4751 | + var self = this; |
| 4752 | + |
| 4753 | + this.element |
| 4754 | + .bind('mousedown.'+this.widgetName, function(event) { |
| 4755 | + return self._mouseDown(event); |
| 4756 | + }) |
| 4757 | + .bind('click.'+this.widgetName, function(event) { |
| 4758 | + if(self._preventClickEvent) { |
| 4759 | + self._preventClickEvent = false; |
| 4760 | + event.stopImmediatePropagation(); |
| 4761 | + return false; |
| 4762 | + } |
| 4763 | + }); |
| 4764 | + |
| 4765 | + // Prevent text selection in IE |
| 4766 | + if ($.browser.msie) { |
| 4767 | + this._mouseUnselectable = this.element.attr('unselectable'); |
| 4768 | + this.element.attr('unselectable', 'on'); |
| 4769 | + } |
| 4770 | + |
| 4771 | + this.started = false; |
| 4772 | + }, |
| 4773 | + |
| 4774 | + // TODO: make sure destroying one instance of mouse doesn't mess with |
| 4775 | + // other instances of mouse |
| 4776 | + _mouseDestroy: function() { |
| 4777 | + this.element.unbind('.'+this.widgetName); |
| 4778 | + |
| 4779 | + // Restore text selection in IE |
| 4780 | + ($.browser.msie |
| 4781 | + && this.element.attr('unselectable', this._mouseUnselectable)); |
| 4782 | + }, |
| 4783 | + |
| 4784 | + _mouseDown: function(event) { |
| 4785 | + // don't let more than one widget handle mouseStart |
| 4786 | + // TODO: figure out why we have to use originalEvent |
| 4787 | + event.originalEvent = event.originalEvent || {}; |
| 4788 | + if (event.originalEvent.mouseHandled) { return; } |
| 4789 | + |
| 4790 | + // we may have missed mouseup (out of window) |
| 4791 | + (this._mouseStarted && this._mouseUp(event)); |
| 4792 | + |
| 4793 | + this._mouseDownEvent = event; |
| 4794 | + |
| 4795 | + var self = this, |
| 4796 | + btnIsLeft = (event.which == 1), |
| 4797 | + elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); |
| 4798 | + if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { |
| 4799 | + return true; |
| 4800 | + } |
| 4801 | + |
| 4802 | + this.mouseDelayMet = !this.options.delay; |
| 4803 | + if (!this.mouseDelayMet) { |
| 4804 | + this._mouseDelayTimer = setTimeout(function() { |
| 4805 | + self.mouseDelayMet = true; |
| 4806 | + }, this.options.delay); |
| 4807 | + } |
| 4808 | + |
| 4809 | + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { |
| 4810 | + this._mouseStarted = (this._mouseStart(event) !== false); |
| 4811 | + if (!this._mouseStarted) { |
| 4812 | + event.preventDefault(); |
| 4813 | + return true; |
| 4814 | + } |
| 4815 | + } |
| 4816 | + |
| 4817 | + // these delegates are required to keep context |
| 4818 | + this._mouseMoveDelegate = function(event) { |
| 4819 | + return self._mouseMove(event); |
| 4820 | + }; |
| 4821 | + this._mouseUpDelegate = function(event) { |
| 4822 | + return self._mouseUp(event); |
| 4823 | + }; |
| 4824 | + $(document) |
| 4825 | + .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
| 4826 | + .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
| 4827 | + |
| 4828 | + // preventDefault() is used to prevent the selection of text here - |
| 4829 | + // however, in Safari, this causes select boxes not to be selectable |
| 4830 | + // anymore, so this fix is needed |
| 4831 | + ($.browser.safari || event.preventDefault()); |
| 4832 | + |
| 4833 | + event.originalEvent.mouseHandled = true; |
| 4834 | + return true; |
| 4835 | + }, |
| 4836 | + |
| 4837 | + _mouseMove: function(event) { |
| 4838 | + // IE mouseup check - mouseup happened when mouse was out of window |
| 4839 | + if ($.browser.msie && !event.button) { |
| 4840 | + return this._mouseUp(event); |
| 4841 | + } |
| 4842 | + |
| 4843 | + if (this._mouseStarted) { |
| 4844 | + this._mouseDrag(event); |
| 4845 | + return event.preventDefault(); |
| 4846 | + } |
| 4847 | + |
| 4848 | + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { |
| 4849 | + this._mouseStarted = |
| 4850 | + (this._mouseStart(this._mouseDownEvent, event) !== false); |
| 4851 | + (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); |
| 4852 | + } |
| 4853 | + |
| 4854 | + return !this._mouseStarted; |
| 4855 | + }, |
| 4856 | + |
| 4857 | + _mouseUp: function(event) { |
| 4858 | + $(document) |
| 4859 | + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
| 4860 | + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
| 4861 | + |
| 4862 | + if (this._mouseStarted) { |
| 4863 | + this._mouseStarted = false; |
| 4864 | + this._preventClickEvent = (event.target == this._mouseDownEvent.target); |
| 4865 | + this._mouseStop(event); |
| 4866 | + } |
| 4867 | + |
| 4868 | + return false; |
| 4869 | + }, |
| 4870 | + |
| 4871 | + _mouseDistanceMet: function(event) { |
| 4872 | + return (Math.max( |
| 4873 | + Math.abs(this._mouseDownEvent.pageX - event.pageX), |
| 4874 | + Math.abs(this._mouseDownEvent.pageY - event.pageY) |
| 4875 | + ) >= this.options.distance |
| 4876 | + ); |
| 4877 | + }, |
| 4878 | + |
| 4879 | + _mouseDelayMet: function(event) { |
| 4880 | + return this.mouseDelayMet; |
| 4881 | + }, |
| 4882 | + |
| 4883 | + // These are placeholder methods, to be overriden by extending plugin |
| 4884 | + _mouseStart: function(event) {}, |
| 4885 | + _mouseDrag: function(event) {}, |
| 4886 | + _mouseStop: function(event) {}, |
| 4887 | + _mouseCapture: function(event) { return true; } |
| 4888 | +}; |
| 4889 | + |
| 4890 | +$.ui.mouse.defaults = { |
| 4891 | + cancel: null, |
| 4892 | + distance: 1, |
| 4893 | + delay: 0 |
| 4894 | +}; |
| 4895 | + |
| 4896 | +})(jQuery); |
| 4897 | +/* |
| 4898 | + * jQuery UI Draggable 1.7.2 |
| 4899 | + * |
| 4900 | + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
| 4901 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 4902 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 4903 | + * |
| 4904 | + * http://docs.jquery.com/UI/Draggables |
| 4905 | + * |
| 4906 | + * Depends: |
| 4907 | + * ui.core.js |
| 4908 | + */ |
| 4909 | +(function($) { |
| 4910 | + |
| 4911 | +$.widget("ui.draggable", $.extend({}, $.ui.mouse, { |
| 4912 | + |
| 4913 | + _init: function() { |
| 4914 | + |
| 4915 | + if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) |
| 4916 | + this.element[0].style.position = 'relative'; |
| 4917 | + |
| 4918 | + (this.options.addClasses && this.element.addClass("ui-draggable")); |
| 4919 | + (this.options.disabled && this.element.addClass("ui-draggable-disabled")); |
| 4920 | + |
| 4921 | + this._mouseInit(); |
| 4922 | + |
| 4923 | + }, |
| 4924 | + |
| 4925 | + destroy: function() { |
| 4926 | + if(!this.element.data('draggable')) return; |
| 4927 | + this.element |
| 4928 | + .removeData("draggable") |
| 4929 | + .unbind(".draggable") |
| 4930 | + .removeClass("ui-draggable" |
| 4931 | + + " ui-draggable-dragging" |
| 4932 | + + " ui-draggable-disabled"); |
| 4933 | + this._mouseDestroy(); |
| 4934 | + }, |
| 4935 | + |
| 4936 | + _mouseCapture: function(event) { |
| 4937 | + |
| 4938 | + var o = this.options; |
| 4939 | + |
| 4940 | + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) |
| 4941 | + return false; |
| 4942 | + |
| 4943 | + //Quit if we're not on a valid handle |
| 4944 | + this.handle = this._getHandle(event); |
| 4945 | + if (!this.handle) |
| 4946 | + return false; |
| 4947 | + |
| 4948 | + return true; |
| 4949 | + |
| 4950 | + }, |
| 4951 | + |
| 4952 | + _mouseStart: function(event) { |
| 4953 | + |
| 4954 | + var o = this.options; |
| 4955 | + |
| 4956 | + //Create and append the visible helper |
| 4957 | + this.helper = this._createHelper(event); |
| 4958 | + |
| 4959 | + //Cache the helper size |
| 4960 | + this._cacheHelperProportions(); |
| 4961 | + |
| 4962 | + //If ddmanager is used for droppables, set the global draggable |
| 4963 | + if($.ui.ddmanager) |
| 4964 | + $.ui.ddmanager.current = this; |
| 4965 | + |
| 4966 | + /* |
| 4967 | + * - Position generation - |
| 4968 | + * This block generates everything position related - it's the core of draggables. |
| 4969 | + */ |
| 4970 | + |
| 4971 | + //Cache the margins of the original element |
| 4972 | + this._cacheMargins(); |
| 4973 | + |
| 4974 | + //Store the helper's css position |
| 4975 | + this.cssPosition = this.helper.css("position"); |
| 4976 | + this.scrollParent = this.helper.scrollParent(); |
| 4977 | + |
| 4978 | + //The element's absolute position on the page minus margins |
| 4979 | + this.offset = this.element.offset(); |
| 4980 | + this.offset = { |
| 4981 | + top: this.offset.top - this.margins.top, |
| 4982 | + left: this.offset.left - this.margins.left |
| 4983 | + }; |
| 4984 | + |
| 4985 | + $.extend(this.offset, { |
| 4986 | + click: { //Where the click happened, relative to the element |
| 4987 | + left: event.pageX - this.offset.left, |
| 4988 | + top: event.pageY - this.offset.top |
| 4989 | + }, |
| 4990 | + parent: this._getParentOffset(), |
| 4991 | + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper |
| 4992 | + }); |
| 4993 | + |
| 4994 | + //Generate the original position |
| 4995 | + this.originalPosition = this._generatePosition(event); |
| 4996 | + this.originalPageX = event.pageX; |
| 4997 | + this.originalPageY = event.pageY; |
| 4998 | + |
| 4999 | + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied |
| 5000 | + if(o.cursorAt) |
| 5001 | + this._adjustOffsetFromHelper(o.cursorAt); |
| 5002 | + |
| 5003 | + //Set a containment if given in the options |
| 5004 | + if(o.containment) |
| 5005 | + this._setContainment(); |
| 5006 | + |
| 5007 | + //Call plugins and callbacks |
| 5008 | + this._trigger("start", event); |
| 5009 | + |
| 5010 | + //Recache the helper size |
| 5011 | + this._cacheHelperProportions(); |
| 5012 | + |
| 5013 | + //Prepare the droppable offsets |
| 5014 | + if ($.ui.ddmanager && !o.dropBehaviour) |
| 5015 | + $.ui.ddmanager.prepareOffsets(this, event); |
| 5016 | + |
| 5017 | + this.helper.addClass("ui-draggable-dragging"); |
| 5018 | + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position |
| 5019 | + return true; |
| 5020 | + }, |
| 5021 | + |
| 5022 | + _mouseDrag: function(event, noPropagation) { |
| 5023 | + |
| 5024 | + //Compute the helpers position |
| 5025 | + this.position = this._generatePosition(event); |
| 5026 | + this.positionAbs = this._convertPositionTo("absolute"); |
| 5027 | + |
| 5028 | + //Call plugins and callbacks and use the resulting position if something is returned |
| 5029 | + if (!noPropagation) { |
| 5030 | + var ui = this._uiHash(); |
| 5031 | + this._trigger('drag', event, ui); |
| 5032 | + this.position = ui.position; |
| 5033 | + } |
| 5034 | + |
| 5035 | + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; |
| 5036 | + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; |
| 5037 | + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); |
| 5038 | + |
| 5039 | + return false; |
| 5040 | + }, |
| 5041 | + |
| 5042 | + _mouseStop: function(event) { |
| 5043 | + |
| 5044 | + //If we are using droppables, inform the manager about the drop |
| 5045 | + var dropped = false; |
| 5046 | + if ($.ui.ddmanager && !this.options.dropBehaviour) |
| 5047 | + dropped = $.ui.ddmanager.drop(this, event); |
| 5048 | + |
| 5049 | + //if a drop comes from outside (a sortable) |
| 5050 | + if(this.dropped) { |
| 5051 | + dropped = this.dropped; |
| 5052 | + this.dropped = false; |
| 5053 | + } |
| 5054 | + |
| 5055 | + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { |
| 5056 | + var self = this; |
| 5057 | + $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { |
| 5058 | + self._trigger("stop", event); |
| 5059 | + self._clear(); |
| 5060 | + }); |
| 5061 | + } else { |
| 5062 | + this._trigger("stop", event); |
| 5063 | + this._clear(); |
| 5064 | + } |
| 5065 | + |
| 5066 | + return false; |
| 5067 | + }, |
| 5068 | + |
| 5069 | + _getHandle: function(event) { |
| 5070 | + |
| 5071 | + var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; |
| 5072 | + $(this.options.handle, this.element) |
| 5073 | + .find("*") |
| 5074 | + .andSelf() |
| 5075 | + .each(function() { |
| 5076 | + if(this == event.target) handle = true; |
| 5077 | + }); |
| 5078 | + |
| 5079 | + return handle; |
| 5080 | + |
| 5081 | + }, |
| 5082 | + |
| 5083 | + _createHelper: function(event) { |
| 5084 | + |
| 5085 | + var o = this.options; |
| 5086 | + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element); |
| 5087 | + |
| 5088 | + if(!helper.parents('body').length) |
| 5089 | + helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); |
| 5090 | + |
| 5091 | + if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) |
| 5092 | + helper.css("position", "absolute"); |
| 5093 | + |
| 5094 | + return helper; |
| 5095 | + |
| 5096 | + }, |
| 5097 | + |
| 5098 | + _adjustOffsetFromHelper: function(obj) { |
| 5099 | + if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left; |
| 5100 | + if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; |
| 5101 | + if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top; |
| 5102 | + if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; |
| 5103 | + }, |
| 5104 | + |
| 5105 | + _getParentOffset: function() { |
| 5106 | + |
| 5107 | + //Get the offsetParent and cache its position |
| 5108 | + this.offsetParent = this.helper.offsetParent(); |
| 5109 | + var po = this.offsetParent.offset(); |
| 5110 | + |
| 5111 | + // This is a special case where we need to modify a offset calculated on start, since the following happened: |
| 5112 | + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent |
| 5113 | + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that |
| 5114 | + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag |
| 5115 | + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { |
| 5116 | + po.left += this.scrollParent.scrollLeft(); |
| 5117 | + po.top += this.scrollParent.scrollTop(); |
| 5118 | + } |
| 5119 | + |
| 5120 | + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information |
| 5121 | + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix |
| 5122 | + po = { top: 0, left: 0 }; |
| 5123 | + |
| 5124 | + return { |
| 5125 | + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), |
| 5126 | + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) |
| 5127 | + }; |
| 5128 | + |
| 5129 | + }, |
| 5130 | + |
| 5131 | + _getRelativeOffset: function() { |
| 5132 | + |
| 5133 | + if(this.cssPosition == "relative") { |
| 5134 | + var p = this.element.position(); |
| 5135 | + return { |
| 5136 | + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), |
| 5137 | + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() |
| 5138 | + }; |
| 5139 | + } else { |
| 5140 | + return { top: 0, left: 0 }; |
| 5141 | + } |
| 5142 | + |
| 5143 | + }, |
| 5144 | + |
| 5145 | + _cacheMargins: function() { |
| 5146 | + this.margins = { |
| 5147 | + left: (parseInt(this.element.css("marginLeft"),10) || 0), |
| 5148 | + top: (parseInt(this.element.css("marginTop"),10) || 0) |
| 5149 | + }; |
| 5150 | + }, |
| 5151 | + |
| 5152 | + _cacheHelperProportions: function() { |
| 5153 | + this.helperProportions = { |
| 5154 | + width: this.helper.outerWidth(), |
| 5155 | + height: this.helper.outerHeight() |
| 5156 | + }; |
| 5157 | + }, |
| 5158 | + |
| 5159 | + _setContainment: function() { |
| 5160 | + |
| 5161 | + var o = this.options; |
| 5162 | + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; |
| 5163 | + if(o.containment == 'document' || o.containment == 'window') this.containment = [ |
| 5164 | + 0 - this.offset.relative.left - this.offset.parent.left, |
| 5165 | + 0 - this.offset.relative.top - this.offset.parent.top, |
| 5166 | + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, |
| 5167 | + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top |
| 5168 | + ]; |
| 5169 | + |
| 5170 | + if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { |
| 5171 | + var ce = $(o.containment)[0]; if(!ce) return; |
| 5172 | + var co = $(o.containment).offset(); |
| 5173 | + var over = ($(ce).css("overflow") != 'hidden'); |
| 5174 | + |
| 5175 | + this.containment = [ |
| 5176 | + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, |
| 5177 | + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, |
| 5178 | + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, |
| 5179 | + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top |
| 5180 | + ]; |
| 5181 | + } else if(o.containment.constructor == Array) { |
| 5182 | + this.containment = o.containment; |
| 5183 | + } |
| 5184 | + |
| 5185 | + }, |
| 5186 | + |
| 5187 | + _convertPositionTo: function(d, pos) { |
| 5188 | + |
| 5189 | + if(!pos) pos = this.position; |
| 5190 | + var mod = d == "absolute" ? 1 : -1; |
| 5191 | + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
| 5192 | + |
| 5193 | + return { |
| 5194 | + top: ( |
| 5195 | + pos.top // The absolute mouse position |
| 5196 | + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
| 5197 | + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) |
| 5198 | + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) |
| 5199 | + ), |
| 5200 | + left: ( |
| 5201 | + pos.left // The absolute mouse position |
| 5202 | + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
| 5203 | + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) |
| 5204 | + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) |
| 5205 | + ) |
| 5206 | + }; |
| 5207 | + |
| 5208 | + }, |
| 5209 | + |
| 5210 | + _generatePosition: function(event) { |
| 5211 | + |
| 5212 | + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
| 5213 | + |
| 5214 | + // This is another very weird special case that only happens for relative elements: |
| 5215 | + // 1. If the css position is relative |
| 5216 | + // 2. and the scroll parent is the document or similar to the offset parent |
| 5217 | + // we have to refresh the relative offset during the scroll so there are no jumps |
| 5218 | + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { |
| 5219 | + this.offset.relative = this._getRelativeOffset(); |
| 5220 | + } |
| 5221 | + |
| 5222 | + var pageX = event.pageX; |
| 5223 | + var pageY = event.pageY; |
| 5224 | + |
| 5225 | + /* |
| 5226 | + * - Position constraining - |
| 5227 | + * Constrain the position to a mix of grid, containment. |
| 5228 | + */ |
| 5229 | + |
| 5230 | + if(this.originalPosition) { //If we are not dragging yet, we won't check for options |
| 5231 | + |
| 5232 | + if(this.containment) { |
| 5233 | + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; |
| 5234 | + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; |
| 5235 | + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; |
| 5236 | + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; |
| 5237 | + } |
| 5238 | + |
| 5239 | + if(o.grid) { |
| 5240 | + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; |
| 5241 | + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; |
| 5242 | + |
| 5243 | + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; |
| 5244 | + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; |
| 5245 | + } |
| 5246 | + |
| 5247 | + } |
| 5248 | + |
| 5249 | + return { |
| 5250 | + top: ( |
| 5251 | + pageY // The absolute mouse position |
| 5252 | + - this.offset.click.top // Click offset (relative to the element) |
| 5253 | + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent |
| 5254 | + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) |
| 5255 | + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) |
| 5256 | + ), |
| 5257 | + left: ( |
| 5258 | + pageX // The absolute mouse position |
| 5259 | + - this.offset.click.left // Click offset (relative to the element) |
| 5260 | + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent |
| 5261 | + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) |
| 5262 | + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) |
| 5263 | + ) |
| 5264 | + }; |
| 5265 | + |
| 5266 | + }, |
| 5267 | + |
| 5268 | + _clear: function() { |
| 5269 | + this.helper.removeClass("ui-draggable-dragging"); |
| 5270 | + if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); |
| 5271 | + //if($.ui.ddmanager) $.ui.ddmanager.current = null; |
| 5272 | + this.helper = null; |
| 5273 | + this.cancelHelperRemoval = false; |
| 5274 | + }, |
| 5275 | + |
| 5276 | + // From now on bulk stuff - mainly helpers |
| 5277 | + |
| 5278 | + _trigger: function(type, event, ui) { |
| 5279 | + ui = ui || this._uiHash(); |
| 5280 | + $.ui.plugin.call(this, type, [event, ui]); |
| 5281 | + if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins |
| 5282 | + return $.widget.prototype._trigger.call(this, type, event, ui); |
| 5283 | + }, |
| 5284 | + |
| 5285 | + plugins: {}, |
| 5286 | + |
| 5287 | + _uiHash: function(event) { |
| 5288 | + return { |
| 5289 | + helper: this.helper, |
| 5290 | + position: this.position, |
| 5291 | + absolutePosition: this.positionAbs, //deprecated |
| 5292 | + offset: this.positionAbs |
| 5293 | + }; |
| 5294 | + } |
| 5295 | + |
| 5296 | +})); |
| 5297 | + |
| 5298 | +$.extend($.ui.draggable, { |
| 5299 | + version: "1.7.2", |
| 5300 | + eventPrefix: "drag", |
| 5301 | + defaults: { |
| 5302 | + addClasses: true, |
| 5303 | + appendTo: "parent", |
| 5304 | + axis: false, |
| 5305 | + cancel: ":input,option", |
| 5306 | + connectToSortable: false, |
| 5307 | + containment: false, |
| 5308 | + cursor: "auto", |
| 5309 | + cursorAt: false, |
| 5310 | + delay: 0, |
| 5311 | + distance: 1, |
| 5312 | + grid: false, |
| 5313 | + handle: false, |
| 5314 | + helper: "original", |
| 5315 | + iframeFix: false, |
| 5316 | + opacity: false, |
| 5317 | + refreshPositions: false, |
| 5318 | + revert: false, |
| 5319 | + revertDuration: 500, |
| 5320 | + scope: "default", |
| 5321 | + scroll: true, |
| 5322 | + scrollSensitivity: 20, |
| 5323 | + scrollSpeed: 20, |
| 5324 | + snap: false, |
| 5325 | + snapMode: "both", |
| 5326 | + snapTolerance: 20, |
| 5327 | + stack: false, |
| 5328 | + zIndex: false |
| 5329 | + } |
| 5330 | +}); |
| 5331 | + |
| 5332 | +$.ui.plugin.add("draggable", "connectToSortable", { |
| 5333 | + start: function(event, ui) { |
| 5334 | + |
| 5335 | + var inst = $(this).data("draggable"), o = inst.options, |
| 5336 | + uiSortable = $.extend({}, ui, { item: inst.element }); |
| 5337 | + inst.sortables = []; |
| 5338 | + $(o.connectToSortable).each(function() { |
| 5339 | + var sortable = $.data(this, 'sortable'); |
| 5340 | + if (sortable && !sortable.options.disabled) { |
| 5341 | + inst.sortables.push({ |
| 5342 | + instance: sortable, |
| 5343 | + shouldRevert: sortable.options.revert |
| 5344 | + }); |
| 5345 | + sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache |
| 5346 | + sortable._trigger("activate", event, uiSortable); |
| 5347 | + } |
| 5348 | + }); |
| 5349 | + |
| 5350 | + }, |
| 5351 | + stop: function(event, ui) { |
| 5352 | + |
| 5353 | + //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper |
| 5354 | + var inst = $(this).data("draggable"), |
| 5355 | + uiSortable = $.extend({}, ui, { item: inst.element }); |
| 5356 | + |
| 5357 | + $.each(inst.sortables, function() { |
| 5358 | + if(this.instance.isOver) { |
| 5359 | + |
| 5360 | + this.instance.isOver = 0; |
| 5361 | + |
| 5362 | + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance |
| 5363 | + this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) |
| 5364 | + |
| 5365 | + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' |
| 5366 | + if(this.shouldRevert) this.instance.options.revert = true; |
| 5367 | + |
| 5368 | + //Trigger the stop of the sortable |
| 5369 | + this.instance._mouseStop(event); |
| 5370 | + |
| 5371 | + this.instance.options.helper = this.instance.options._helper; |
| 5372 | + |
| 5373 | + //If the helper has been the original item, restore properties in the sortable |
| 5374 | + if(inst.options.helper == 'original') |
| 5375 | + this.instance.currentItem.css({ top: 'auto', left: 'auto' }); |
| 5376 | + |
| 5377 | + } else { |
| 5378 | + this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance |
| 5379 | + this.instance._trigger("deactivate", event, uiSortable); |
| 5380 | + } |
| 5381 | + |
| 5382 | + }); |
| 5383 | + |
| 5384 | + }, |
| 5385 | + drag: function(event, ui) { |
| 5386 | + |
| 5387 | + var inst = $(this).data("draggable"), self = this; |
| 5388 | + |
| 5389 | + var checkPos = function(o) { |
| 5390 | + var dyClick = this.offset.click.top, dxClick = this.offset.click.left; |
| 5391 | + var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; |
| 5392 | + var itemHeight = o.height, itemWidth = o.width; |
| 5393 | + var itemTop = o.top, itemLeft = o.left; |
| 5394 | + |
| 5395 | + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); |
| 5396 | + }; |
| 5397 | + |
| 5398 | + $.each(inst.sortables, function(i) { |
| 5399 | + |
| 5400 | + //Copy over some variables to allow calling the sortable's native _intersectsWith |
| 5401 | + this.instance.positionAbs = inst.positionAbs; |
| 5402 | + this.instance.helperProportions = inst.helperProportions; |
| 5403 | + this.instance.offset.click = inst.offset.click; |
| 5404 | + |
| 5405 | + if(this.instance._intersectsWith(this.instance.containerCache)) { |
| 5406 | + |
| 5407 | + //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once |
| 5408 | + if(!this.instance.isOver) { |
| 5409 | + |
| 5410 | + this.instance.isOver = 1; |
| 5411 | + //Now we fake the start of dragging for the sortable instance, |
| 5412 | + //by cloning the list group item, appending it to the sortable and using it as inst.currentItem |
| 5413 | + //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) |
| 5414 | + this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true); |
| 5415 | + this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it |
| 5416 | + this.instance.options.helper = function() { return ui.helper[0]; }; |
| 5417 | + |
| 5418 | + event.target = this.instance.currentItem[0]; |
| 5419 | + this.instance._mouseCapture(event, true); |
| 5420 | + this.instance._mouseStart(event, true, true); |
| 5421 | + |
| 5422 | + //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes |
| 5423 | + this.instance.offset.click.top = inst.offset.click.top; |
| 5424 | + this.instance.offset.click.left = inst.offset.click.left; |
| 5425 | + this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; |
| 5426 | + this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; |
| 5427 | + |
| 5428 | + inst._trigger("toSortable", event); |
| 5429 | + inst.dropped = this.instance.element; //draggable revert needs that |
| 5430 | + //hack so receive/update callbacks work (mostly) |
| 5431 | + inst.currentItem = inst.element; |
| 5432 | + this.instance.fromOutside = inst; |
| 5433 | + |
| 5434 | + } |
| 5435 | + |
| 5436 | + //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable |
| 5437 | + if(this.instance.currentItem) this.instance._mouseDrag(event); |
| 5438 | + |
| 5439 | + } else { |
| 5440 | + |
| 5441 | + //If it doesn't intersect with the sortable, and it intersected before, |
| 5442 | + //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval |
| 5443 | + if(this.instance.isOver) { |
| 5444 | + |
| 5445 | + this.instance.isOver = 0; |
| 5446 | + this.instance.cancelHelperRemoval = true; |
| 5447 | + |
| 5448 | + //Prevent reverting on this forced stop |
| 5449 | + this.instance.options.revert = false; |
| 5450 | + |
| 5451 | + // The out event needs to be triggered independently |
| 5452 | + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); |
| 5453 | + |
| 5454 | + this.instance._mouseStop(event, true); |
| 5455 | + this.instance.options.helper = this.instance.options._helper; |
| 5456 | + |
| 5457 | + //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size |
| 5458 | + this.instance.currentItem.remove(); |
| 5459 | + if(this.instance.placeholder) this.instance.placeholder.remove(); |
| 5460 | + |
| 5461 | + inst._trigger("fromSortable", event); |
| 5462 | + inst.dropped = false; //draggable revert needs that |
| 5463 | + } |
| 5464 | + |
| 5465 | + }; |
| 5466 | + |
| 5467 | + }); |
| 5468 | + |
| 5469 | + } |
| 5470 | +}); |
| 5471 | + |
| 5472 | +$.ui.plugin.add("draggable", "cursor", { |
| 5473 | + start: function(event, ui) { |
| 5474 | + var t = $('body'), o = $(this).data('draggable').options; |
| 5475 | + if (t.css("cursor")) o._cursor = t.css("cursor"); |
| 5476 | + t.css("cursor", o.cursor); |
| 5477 | + }, |
| 5478 | + stop: function(event, ui) { |
| 5479 | + var o = $(this).data('draggable').options; |
| 5480 | + if (o._cursor) $('body').css("cursor", o._cursor); |
| 5481 | + } |
| 5482 | +}); |
| 5483 | + |
| 5484 | +$.ui.plugin.add("draggable", "iframeFix", { |
| 5485 | + start: function(event, ui) { |
| 5486 | + var o = $(this).data('draggable').options; |
| 5487 | + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { |
| 5488 | + $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') |
| 5489 | + .css({ |
| 5490 | + width: this.offsetWidth+"px", height: this.offsetHeight+"px", |
| 5491 | + position: "absolute", opacity: "0.001", zIndex: 1000 |
| 5492 | + }) |
| 5493 | + .css($(this).offset()) |
| 5494 | + .appendTo("body"); |
| 5495 | + }); |
| 5496 | + }, |
| 5497 | + stop: function(event, ui) { |
| 5498 | + $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers |
| 5499 | + } |
| 5500 | +}); |
| 5501 | + |
| 5502 | +$.ui.plugin.add("draggable", "opacity", { |
| 5503 | + start: function(event, ui) { |
| 5504 | + var t = $(ui.helper), o = $(this).data('draggable').options; |
| 5505 | + if(t.css("opacity")) o._opacity = t.css("opacity"); |
| 5506 | + t.css('opacity', o.opacity); |
| 5507 | + }, |
| 5508 | + stop: function(event, ui) { |
| 5509 | + var o = $(this).data('draggable').options; |
| 5510 | + if(o._opacity) $(ui.helper).css('opacity', o._opacity); |
| 5511 | + } |
| 5512 | +}); |
| 5513 | + |
| 5514 | +$.ui.plugin.add("draggable", "scroll", { |
| 5515 | + start: function(event, ui) { |
| 5516 | + var i = $(this).data("draggable"); |
| 5517 | + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); |
| 5518 | + }, |
| 5519 | + drag: function(event, ui) { |
| 5520 | + |
| 5521 | + var i = $(this).data("draggable"), o = i.options, scrolled = false; |
| 5522 | + |
| 5523 | + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { |
| 5524 | + |
| 5525 | + if(!o.axis || o.axis != 'x') { |
| 5526 | + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) |
| 5527 | + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; |
| 5528 | + else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) |
| 5529 | + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; |
| 5530 | + } |
| 5531 | + |
| 5532 | + if(!o.axis || o.axis != 'y') { |
| 5533 | + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) |
| 5534 | + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; |
| 5535 | + else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) |
| 5536 | + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; |
| 5537 | + } |
| 5538 | + |
| 5539 | + } else { |
| 5540 | + |
| 5541 | + if(!o.axis || o.axis != 'x') { |
| 5542 | + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) |
| 5543 | + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); |
| 5544 | + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) |
| 5545 | + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); |
| 5546 | + } |
| 5547 | + |
| 5548 | + if(!o.axis || o.axis != 'y') { |
| 5549 | + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) |
| 5550 | + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); |
| 5551 | + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) |
| 5552 | + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); |
| 5553 | + } |
| 5554 | + |
| 5555 | + } |
| 5556 | + |
| 5557 | + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) |
| 5558 | + $.ui.ddmanager.prepareOffsets(i, event); |
| 5559 | + |
| 5560 | + } |
| 5561 | +}); |
| 5562 | + |
| 5563 | +$.ui.plugin.add("draggable", "snap", { |
| 5564 | + start: function(event, ui) { |
| 5565 | + |
| 5566 | + var i = $(this).data("draggable"), o = i.options; |
| 5567 | + i.snapElements = []; |
| 5568 | + |
| 5569 | + $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { |
| 5570 | + var $t = $(this); var $o = $t.offset(); |
| 5571 | + if(this != i.element[0]) i.snapElements.push({ |
| 5572 | + item: this, |
| 5573 | + width: $t.outerWidth(), height: $t.outerHeight(), |
| 5574 | + top: $o.top, left: $o.left |
| 5575 | + }); |
| 5576 | + }); |
| 5577 | + |
| 5578 | + }, |
| 5579 | + drag: function(event, ui) { |
| 5580 | + |
| 5581 | + var inst = $(this).data("draggable"), o = inst.options; |
| 5582 | + var d = o.snapTolerance; |
| 5583 | + |
| 5584 | + var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, |
| 5585 | + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; |
| 5586 | + |
| 5587 | + for (var i = inst.snapElements.length - 1; i >= 0; i--){ |
| 5588 | + |
| 5589 | + var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, |
| 5590 | + t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; |
| 5591 | + |
| 5592 | + //Yes, I know, this is insane ;) |
| 5593 | + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { |
| 5594 | + if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); |
| 5595 | + inst.snapElements[i].snapping = false; |
| 5596 | + continue; |
| 5597 | + } |
| 5598 | + |
| 5599 | + if(o.snapMode != 'inner') { |
| 5600 | + var ts = Math.abs(t - y2) <= d; |
| 5601 | + var bs = Math.abs(b - y1) <= d; |
| 5602 | + var ls = Math.abs(l - x2) <= d; |
| 5603 | + var rs = Math.abs(r - x1) <= d; |
| 5604 | + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; |
| 5605 | + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; |
| 5606 | + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; |
| 5607 | + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; |
| 5608 | + } |
| 5609 | + |
| 5610 | + var first = (ts || bs || ls || rs); |
| 5611 | + |
| 5612 | + if(o.snapMode != 'outer') { |
| 5613 | + var ts = Math.abs(t - y1) <= d; |
| 5614 | + var bs = Math.abs(b - y2) <= d; |
| 5615 | + var ls = Math.abs(l - x1) <= d; |
| 5616 | + var rs = Math.abs(r - x2) <= d; |
| 5617 | + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; |
| 5618 | + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; |
| 5619 | + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; |
| 5620 | + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; |
| 5621 | + } |
| 5622 | + |
| 5623 | + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) |
| 5624 | + (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); |
| 5625 | + inst.snapElements[i].snapping = (ts || bs || ls || rs || first); |
| 5626 | + |
| 5627 | + }; |
| 5628 | + |
| 5629 | + } |
| 5630 | +}); |
| 5631 | + |
| 5632 | +$.ui.plugin.add("draggable", "stack", { |
| 5633 | + start: function(event, ui) { |
| 5634 | + |
| 5635 | + var o = $(this).data("draggable").options; |
| 5636 | + |
| 5637 | + var group = $.makeArray($(o.stack.group)).sort(function(a,b) { |
| 5638 | + return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min); |
| 5639 | + }); |
| 5640 | + |
| 5641 | + $(group).each(function(i) { |
| 5642 | + this.style.zIndex = o.stack.min + i; |
| 5643 | + }); |
| 5644 | + |
| 5645 | + this[0].style.zIndex = o.stack.min + group.length; |
| 5646 | + |
| 5647 | + } |
| 5648 | +}); |
| 5649 | + |
| 5650 | +$.ui.plugin.add("draggable", "zIndex", { |
| 5651 | + start: function(event, ui) { |
| 5652 | + var t = $(ui.helper), o = $(this).data("draggable").options; |
| 5653 | + if(t.css("zIndex")) o._zIndex = t.css("zIndex"); |
| 5654 | + t.css('zIndex', o.zIndex); |
| 5655 | + }, |
| 5656 | + stop: function(event, ui) { |
| 5657 | + var o = $(this).data("draggable").options; |
| 5658 | + if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); |
| 5659 | + } |
| 5660 | +}); |
| 5661 | + |
| 5662 | +})(jQuery); |
| 5663 | +/* |
| 5664 | + * jQuery UI Resizable 1.7.2 |
| 5665 | + * |
| 5666 | + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
| 5667 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 5668 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 5669 | + * |
| 5670 | + * http://docs.jquery.com/UI/Resizables |
| 5671 | + * |
| 5672 | + * Depends: |
| 5673 | + * ui.core.js |
| 5674 | + */ |
| 5675 | +(function($) { |
| 5676 | + |
| 5677 | +$.widget("ui.resizable", $.extend({}, $.ui.mouse, { |
| 5678 | + |
| 5679 | + _init: function() { |
| 5680 | + |
| 5681 | + var self = this, o = this.options; |
| 5682 | + this.element.addClass("ui-resizable"); |
| 5683 | + |
| 5684 | + $.extend(this, { |
| 5685 | + _aspectRatio: !!(o.aspectRatio), |
| 5686 | + aspectRatio: o.aspectRatio, |
| 5687 | + originalElement: this.element, |
| 5688 | + _proportionallyResizeElements: [], |
| 5689 | + _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null |
| 5690 | + }); |
| 5691 | + |
| 5692 | + //Wrap the element if it cannot hold child nodes |
| 5693 | + if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { |
| 5694 | + |
| 5695 | + //Opera fix for relative positioning |
| 5696 | + if (/relative/.test(this.element.css('position')) && $.browser.opera) |
| 5697 | + this.element.css({ position: 'relative', top: 'auto', left: 'auto' }); |
| 5698 | + |
| 5699 | + //Create a wrapper element and set the wrapper to the new current internal element |
| 5700 | + this.element.wrap( |
| 5701 | + $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ |
| 5702 | + position: this.element.css('position'), |
| 5703 | + width: this.element.outerWidth(), |
| 5704 | + height: this.element.outerHeight(), |
| 5705 | + top: this.element.css('top'), |
| 5706 | + left: this.element.css('left') |
| 5707 | + }) |
| 5708 | + ); |
| 5709 | + |
| 5710 | + //Overwrite the original this.element |
| 5711 | + this.element = this.element.parent().data( |
| 5712 | + "resizable", this.element.data('resizable') |
| 5713 | + ); |
| 5714 | + |
| 5715 | + this.elementIsWrapper = true; |
| 5716 | + |
| 5717 | + //Move margins to the wrapper |
| 5718 | + this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); |
| 5719 | + this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); |
| 5720 | + |
| 5721 | + //Prevent Safari textarea resize |
| 5722 | + this.originalResizeStyle = this.originalElement.css('resize'); |
| 5723 | + this.originalElement.css('resize', 'none'); |
| 5724 | + |
| 5725 | + //Push the actual element to our proportionallyResize internal array |
| 5726 | + this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); |
| 5727 | + |
| 5728 | + // avoid IE jump (hard set the margin) |
| 5729 | + this.originalElement.css({ margin: this.originalElement.css('margin') }); |
| 5730 | + |
| 5731 | + // fix handlers offset |
| 5732 | + this._proportionallyResize(); |
| 5733 | + |
| 5734 | + } |
| 5735 | + |
| 5736 | + this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); |
| 5737 | + if(this.handles.constructor == String) { |
| 5738 | + |
| 5739 | + if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; |
| 5740 | + var n = this.handles.split(","); this.handles = {}; |
| 5741 | + |
| 5742 | + for(var i = 0; i < n.length; i++) { |
| 5743 | + |
| 5744 | + var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; |
| 5745 | + var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); |
| 5746 | + |
| 5747 | + // increase zIndex of sw, se, ne, nw axis |
| 5748 | + //TODO : this modifies original option |
| 5749 | + if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex }); |
| 5750 | + |
| 5751 | + //TODO : What's going on here? |
| 5752 | + if ('se' == handle) { |
| 5753 | + axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); |
| 5754 | + }; |
| 5755 | + |
| 5756 | + //Insert into internal handles object and append to element |
| 5757 | + this.handles[handle] = '.ui-resizable-'+handle; |
| 5758 | + this.element.append(axis); |
| 5759 | + } |
| 5760 | + |
| 5761 | + } |
| 5762 | + |
| 5763 | + this._renderAxis = function(target) { |
| 5764 | + |
| 5765 | + target = target || this.element; |
| 5766 | + |
| 5767 | + for(var i in this.handles) { |
| 5768 | + |
| 5769 | + if(this.handles[i].constructor == String) |
| 5770 | + this.handles[i] = $(this.handles[i], this.element).show(); |
| 5771 | + |
| 5772 | + //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) |
| 5773 | + if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { |
| 5774 | + |
| 5775 | + var axis = $(this.handles[i], this.element), padWrapper = 0; |
| 5776 | + |
| 5777 | + //Checking the correct pad and border |
| 5778 | + padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); |
| 5779 | + |
| 5780 | + //The padding type i have to apply... |
| 5781 | + var padPos = [ 'padding', |
| 5782 | + /ne|nw|n/.test(i) ? 'Top' : |
| 5783 | + /se|sw|s/.test(i) ? 'Bottom' : |
| 5784 | + /^e$/.test(i) ? 'Right' : 'Left' ].join(""); |
| 5785 | + |
| 5786 | + target.css(padPos, padWrapper); |
| 5787 | + |
| 5788 | + this._proportionallyResize(); |
| 5789 | + |
| 5790 | + } |
| 5791 | + |
| 5792 | + //TODO: What's that good for? There's not anything to be executed left |
| 5793 | + if(!$(this.handles[i]).length) |
| 5794 | + continue; |
| 5795 | + |
| 5796 | + } |
| 5797 | + }; |
| 5798 | + |
| 5799 | + //TODO: make renderAxis a prototype function |
| 5800 | + this._renderAxis(this.element); |
| 5801 | + |
| 5802 | + this._handles = $('.ui-resizable-handle', this.element) |
| 5803 | + .disableSelection(); |
| 5804 | + |
| 5805 | + //Matching axis name |
| 5806 | + this._handles.mouseover(function() { |
| 5807 | + if (!self.resizing) { |
| 5808 | + if (this.className) |
| 5809 | + var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); |
| 5810 | + //Axis, default = se |
| 5811 | + self.axis = axis && axis[1] ? axis[1] : 'se'; |
| 5812 | + } |
| 5813 | + }); |
| 5814 | + |
| 5815 | + //If we want to auto hide the elements |
| 5816 | + if (o.autoHide) { |
| 5817 | + this._handles.hide(); |
| 5818 | + $(this.element) |
| 5819 | + .addClass("ui-resizable-autohide") |
| 5820 | + .hover(function() { |
| 5821 | + $(this).removeClass("ui-resizable-autohide"); |
| 5822 | + self._handles.show(); |
| 5823 | + }, |
| 5824 | + function(){ |
| 5825 | + if (!self.resizing) { |
| 5826 | + $(this).addClass("ui-resizable-autohide"); |
| 5827 | + self._handles.hide(); |
| 5828 | + } |
| 5829 | + }); |
| 5830 | + } |
| 5831 | + |
| 5832 | + //Initialize the mouse interaction |
| 5833 | + this._mouseInit(); |
| 5834 | + |
| 5835 | + }, |
| 5836 | + |
| 5837 | + destroy: function() { |
| 5838 | + |
| 5839 | + this._mouseDestroy(); |
| 5840 | + |
| 5841 | + var _destroy = function(exp) { |
| 5842 | + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") |
| 5843 | + .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); |
| 5844 | + }; |
| 5845 | + |
| 5846 | + //TODO: Unwrap at same DOM position |
| 5847 | + if (this.elementIsWrapper) { |
| 5848 | + _destroy(this.element); |
| 5849 | + var wrapper = this.element; |
| 5850 | + wrapper.parent().append( |
| 5851 | + this.originalElement.css({ |
| 5852 | + position: wrapper.css('position'), |
| 5853 | + width: wrapper.outerWidth(), |
| 5854 | + height: wrapper.outerHeight(), |
| 5855 | + top: wrapper.css('top'), |
| 5856 | + left: wrapper.css('left') |
| 5857 | + }) |
| 5858 | + ).end().remove(); |
| 5859 | + } |
| 5860 | + |
| 5861 | + this.originalElement.css('resize', this.originalResizeStyle); |
| 5862 | + _destroy(this.originalElement); |
| 5863 | + |
| 5864 | + }, |
| 5865 | + |
| 5866 | + _mouseCapture: function(event) { |
| 5867 | + |
| 5868 | + var handle = false; |
| 5869 | + for(var i in this.handles) { |
| 5870 | + if($(this.handles[i])[0] == event.target) handle = true; |
| 5871 | + } |
| 5872 | + |
| 5873 | + return this.options.disabled || !!handle; |
| 5874 | + |
| 5875 | + }, |
| 5876 | + |
| 5877 | + _mouseStart: function(event) { |
| 5878 | + |
| 5879 | + var o = this.options, iniPos = this.element.position(), el = this.element; |
| 5880 | + |
| 5881 | + this.resizing = true; |
| 5882 | + this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; |
| 5883 | + |
| 5884 | + // bugfix for http://dev.jquery.com/ticket/1749 |
| 5885 | + if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { |
| 5886 | + el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); |
| 5887 | + } |
| 5888 | + |
| 5889 | + //Opera fixing relative position |
| 5890 | + if ($.browser.opera && (/relative/).test(el.css('position'))) |
| 5891 | + el.css({ position: 'relative', top: 'auto', left: 'auto' }); |
| 5892 | + |
| 5893 | + this._renderProxy(); |
| 5894 | + |
| 5895 | + var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); |
| 5896 | + |
| 5897 | + if (o.containment) { |
| 5898 | + curleft += $(o.containment).scrollLeft() || 0; |
| 5899 | + curtop += $(o.containment).scrollTop() || 0; |
| 5900 | + } |
| 5901 | + |
| 5902 | + //Store needed variables |
| 5903 | + this.offset = this.helper.offset(); |
| 5904 | + this.position = { left: curleft, top: curtop }; |
| 5905 | + this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; |
| 5906 | + this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; |
| 5907 | + this.originalPosition = { left: curleft, top: curtop }; |
| 5908 | + this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; |
| 5909 | + this.originalMousePosition = { left: event.pageX, top: event.pageY }; |
| 5910 | + |
| 5911 | + //Aspect Ratio |
| 5912 | + this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); |
| 5913 | + |
| 5914 | + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); |
| 5915 | + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); |
| 5916 | + |
| 5917 | + el.addClass("ui-resizable-resizing"); |
| 5918 | + this._propagate("start", event); |
| 5919 | + return true; |
| 5920 | + }, |
| 5921 | + |
| 5922 | + _mouseDrag: function(event) { |
| 5923 | + |
| 5924 | + //Increase performance, avoid regex |
| 5925 | + var el = this.helper, o = this.options, props = {}, |
| 5926 | + self = this, smp = this.originalMousePosition, a = this.axis; |
| 5927 | + |
| 5928 | + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; |
| 5929 | + var trigger = this._change[a]; |
| 5930 | + if (!trigger) return false; |
| 5931 | + |
| 5932 | + // Calculate the attrs that will be change |
| 5933 | + var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; |
| 5934 | + |
| 5935 | + if (this._aspectRatio || event.shiftKey) |
| 5936 | + data = this._updateRatio(data, event); |
| 5937 | + |
| 5938 | + data = this._respectSize(data, event); |
| 5939 | + |
| 5940 | + // plugins callbacks need to be called first |
| 5941 | + this._propagate("resize", event); |
| 5942 | + |
| 5943 | + el.css({ |
| 5944 | + top: this.position.top + "px", left: this.position.left + "px", |
| 5945 | + width: this.size.width + "px", height: this.size.height + "px" |
| 5946 | + }); |
| 5947 | + |
| 5948 | + if (!this._helper && this._proportionallyResizeElements.length) |
| 5949 | + this._proportionallyResize(); |
| 5950 | + |
| 5951 | + this._updateCache(data); |
| 5952 | + |
| 5953 | + // calling the user callback at the end |
| 5954 | + this._trigger('resize', event, this.ui()); |
| 5955 | + |
| 5956 | + return false; |
| 5957 | + }, |
| 5958 | + |
| 5959 | + _mouseStop: function(event) { |
| 5960 | + |
| 5961 | + this.resizing = false; |
| 5962 | + var o = this.options, self = this; |
| 5963 | + |
| 5964 | + if(this._helper) { |
| 5965 | + var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), |
| 5966 | + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, |
| 5967 | + soffsetw = ista ? 0 : self.sizeDiff.width; |
| 5968 | + |
| 5969 | + var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, |
| 5970 | + left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, |
| 5971 | + top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; |
| 5972 | + |
| 5973 | + if (!o.animate) |
| 5974 | + this.element.css($.extend(s, { top: top, left: left })); |
| 5975 | + |
| 5976 | + self.helper.height(self.size.height); |
| 5977 | + self.helper.width(self.size.width); |
| 5978 | + |
| 5979 | + if (this._helper && !o.animate) this._proportionallyResize(); |
| 5980 | + } |
| 5981 | + |
| 5982 | + $('body').css('cursor', 'auto'); |
| 5983 | + |
| 5984 | + this.element.removeClass("ui-resizable-resizing"); |
| 5985 | + |
| 5986 | + this._propagate("stop", event); |
| 5987 | + |
| 5988 | + if (this._helper) this.helper.remove(); |
| 5989 | + return false; |
| 5990 | + |
| 5991 | + }, |
| 5992 | + |
| 5993 | + _updateCache: function(data) { |
| 5994 | + var o = this.options; |
| 5995 | + this.offset = this.helper.offset(); |
| 5996 | + if (isNumber(data.left)) this.position.left = data.left; |
| 5997 | + if (isNumber(data.top)) this.position.top = data.top; |
| 5998 | + if (isNumber(data.height)) this.size.height = data.height; |
| 5999 | + if (isNumber(data.width)) this.size.width = data.width; |
| 6000 | + }, |
| 6001 | + |
| 6002 | + _updateRatio: function(data, event) { |
| 6003 | + |
| 6004 | + var o = this.options, cpos = this.position, csize = this.size, a = this.axis; |
| 6005 | + |
| 6006 | + if (data.height) data.width = (csize.height * this.aspectRatio); |
| 6007 | + else if (data.width) data.height = (csize.width / this.aspectRatio); |
| 6008 | + |
| 6009 | + if (a == 'sw') { |
| 6010 | + data.left = cpos.left + (csize.width - data.width); |
| 6011 | + data.top = null; |
| 6012 | + } |
| 6013 | + if (a == 'nw') { |
| 6014 | + data.top = cpos.top + (csize.height - data.height); |
| 6015 | + data.left = cpos.left + (csize.width - data.width); |
| 6016 | + } |
| 6017 | + |
| 6018 | + return data; |
| 6019 | + }, |
| 6020 | + |
| 6021 | + _respectSize: function(data, event) { |
| 6022 | + |
| 6023 | + var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, |
| 6024 | + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), |
| 6025 | + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); |
| 6026 | + |
| 6027 | + if (isminw) data.width = o.minWidth; |
| 6028 | + if (isminh) data.height = o.minHeight; |
| 6029 | + if (ismaxw) data.width = o.maxWidth; |
| 6030 | + if (ismaxh) data.height = o.maxHeight; |
| 6031 | + |
| 6032 | + var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; |
| 6033 | + var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); |
| 6034 | + |
| 6035 | + if (isminw && cw) data.left = dw - o.minWidth; |
| 6036 | + if (ismaxw && cw) data.left = dw - o.maxWidth; |
| 6037 | + if (isminh && ch) data.top = dh - o.minHeight; |
| 6038 | + if (ismaxh && ch) data.top = dh - o.maxHeight; |
| 6039 | + |
| 6040 | + // fixing jump error on top/left - bug #2330 |
| 6041 | + var isNotwh = !data.width && !data.height; |
| 6042 | + if (isNotwh && !data.left && data.top) data.top = null; |
| 6043 | + else if (isNotwh && !data.top && data.left) data.left = null; |
| 6044 | + |
| 6045 | + return data; |
| 6046 | + }, |
| 6047 | + |
| 6048 | + _proportionallyResize: function() { |
| 6049 | + |
| 6050 | + var o = this.options; |
| 6051 | + if (!this._proportionallyResizeElements.length) return; |
| 6052 | + var element = this.helper || this.element; |
| 6053 | + |
| 6054 | + for (var i=0; i < this._proportionallyResizeElements.length; i++) { |
| 6055 | + |
| 6056 | + var prel = this._proportionallyResizeElements[i]; |
| 6057 | + |
| 6058 | + if (!this.borderDif) { |
| 6059 | + var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], |
| 6060 | + p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; |
| 6061 | + |
| 6062 | + this.borderDif = $.map(b, function(v, i) { |
| 6063 | + var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; |
| 6064 | + return border + padding; |
| 6065 | + }); |
| 6066 | + } |
| 6067 | + |
| 6068 | + if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) |
| 6069 | + continue; |
| 6070 | + |
| 6071 | + prel.css({ |
| 6072 | + height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, |
| 6073 | + width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 |
| 6074 | + }); |
| 6075 | + |
| 6076 | + }; |
| 6077 | + |
| 6078 | + }, |
| 6079 | + |
| 6080 | + _renderProxy: function() { |
| 6081 | + |
| 6082 | + var el = this.element, o = this.options; |
| 6083 | + this.elementOffset = el.offset(); |
| 6084 | + |
| 6085 | + if(this._helper) { |
| 6086 | + |
| 6087 | + this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); |
| 6088 | + |
| 6089 | + // fix ie6 offset TODO: This seems broken |
| 6090 | + var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), |
| 6091 | + pxyoffset = ( ie6 ? 2 : -1 ); |
| 6092 | + |
| 6093 | + this.helper.addClass(this._helper).css({ |
| 6094 | + width: this.element.outerWidth() + pxyoffset, |
| 6095 | + height: this.element.outerHeight() + pxyoffset, |
| 6096 | + position: 'absolute', |
| 6097 | + left: this.elementOffset.left - ie6offset +'px', |
| 6098 | + top: this.elementOffset.top - ie6offset +'px', |
| 6099 | + zIndex: ++o.zIndex //TODO: Don't modify option |
| 6100 | + }); |
| 6101 | + |
| 6102 | + this.helper |
| 6103 | + .appendTo("body") |
| 6104 | + .disableSelection(); |
| 6105 | + |
| 6106 | + } else { |
| 6107 | + this.helper = this.element; |
| 6108 | + } |
| 6109 | + |
| 6110 | + }, |
| 6111 | + |
| 6112 | + _change: { |
| 6113 | + e: function(event, dx, dy) { |
| 6114 | + return { width: this.originalSize.width + dx }; |
| 6115 | + }, |
| 6116 | + w: function(event, dx, dy) { |
| 6117 | + var o = this.options, cs = this.originalSize, sp = this.originalPosition; |
| 6118 | + return { left: sp.left + dx, width: cs.width - dx }; |
| 6119 | + }, |
| 6120 | + n: function(event, dx, dy) { |
| 6121 | + var o = this.options, cs = this.originalSize, sp = this.originalPosition; |
| 6122 | + return { top: sp.top + dy, height: cs.height - dy }; |
| 6123 | + }, |
| 6124 | + s: function(event, dx, dy) { |
| 6125 | + return { height: this.originalSize.height + dy }; |
| 6126 | + }, |
| 6127 | + se: function(event, dx, dy) { |
| 6128 | + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); |
| 6129 | + }, |
| 6130 | + sw: function(event, dx, dy) { |
| 6131 | + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); |
| 6132 | + }, |
| 6133 | + ne: function(event, dx, dy) { |
| 6134 | + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); |
| 6135 | + }, |
| 6136 | + nw: function(event, dx, dy) { |
| 6137 | + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); |
| 6138 | + } |
| 6139 | + }, |
| 6140 | + |
| 6141 | + _propagate: function(n, event) { |
| 6142 | + $.ui.plugin.call(this, n, [event, this.ui()]); |
| 6143 | + (n != "resize" && this._trigger(n, event, this.ui())); |
| 6144 | + }, |
| 6145 | + |
| 6146 | + plugins: {}, |
| 6147 | + |
| 6148 | + ui: function() { |
| 6149 | + return { |
| 6150 | + originalElement: this.originalElement, |
| 6151 | + element: this.element, |
| 6152 | + helper: this.helper, |
| 6153 | + position: this.position, |
| 6154 | + size: this.size, |
| 6155 | + originalSize: this.originalSize, |
| 6156 | + originalPosition: this.originalPosition |
| 6157 | + }; |
| 6158 | + } |
| 6159 | + |
| 6160 | +})); |
| 6161 | + |
| 6162 | +$.extend($.ui.resizable, { |
| 6163 | + version: "1.7.2", |
| 6164 | + eventPrefix: "resize", |
| 6165 | + defaults: { |
| 6166 | + alsoResize: false, |
| 6167 | + animate: false, |
| 6168 | + animateDuration: "slow", |
| 6169 | + animateEasing: "swing", |
| 6170 | + aspectRatio: false, |
| 6171 | + autoHide: false, |
| 6172 | + cancel: ":input,option", |
| 6173 | + containment: false, |
| 6174 | + delay: 0, |
| 6175 | + distance: 1, |
| 6176 | + ghost: false, |
| 6177 | + grid: false, |
| 6178 | + handles: "e,s,se", |
| 6179 | + helper: false, |
| 6180 | + maxHeight: null, |
| 6181 | + maxWidth: null, |
| 6182 | + minHeight: 10, |
| 6183 | + minWidth: 10, |
| 6184 | + zIndex: 1000 |
| 6185 | + } |
| 6186 | +}); |
| 6187 | + |
| 6188 | +/* |
| 6189 | + * Resizable Extensions |
| 6190 | + */ |
| 6191 | + |
| 6192 | +$.ui.plugin.add("resizable", "alsoResize", { |
| 6193 | + |
| 6194 | + start: function(event, ui) { |
| 6195 | + |
| 6196 | + var self = $(this).data("resizable"), o = self.options; |
| 6197 | + |
| 6198 | + _store = function(exp) { |
| 6199 | + $(exp).each(function() { |
| 6200 | + $(this).data("resizable-alsoresize", { |
| 6201 | + width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10), |
| 6202 | + left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) |
| 6203 | + }); |
| 6204 | + }); |
| 6205 | + }; |
| 6206 | + |
| 6207 | + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { |
| 6208 | + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } |
| 6209 | + else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } |
| 6210 | + }else{ |
| 6211 | + _store(o.alsoResize); |
| 6212 | + } |
| 6213 | + }, |
| 6214 | + |
| 6215 | + resize: function(event, ui){ |
| 6216 | + var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; |
| 6217 | + |
| 6218 | + var delta = { |
| 6219 | + height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, |
| 6220 | + top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 |
| 6221 | + }, |
| 6222 | + |
| 6223 | + _alsoResize = function(exp, c) { |
| 6224 | + $(exp).each(function() { |
| 6225 | + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; |
| 6226 | + |
| 6227 | + $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { |
| 6228 | + var sum = (start[prop]||0) + (delta[prop]||0); |
| 6229 | + if (sum && sum >= 0) |
| 6230 | + style[prop] = sum || null; |
| 6231 | + }); |
| 6232 | + |
| 6233 | + //Opera fixing relative position |
| 6234 | + if (/relative/.test(el.css('position')) && $.browser.opera) { |
| 6235 | + self._revertToRelativePosition = true; |
| 6236 | + el.css({ position: 'absolute', top: 'auto', left: 'auto' }); |
| 6237 | + } |
| 6238 | + |
| 6239 | + el.css(style); |
| 6240 | + }); |
| 6241 | + }; |
| 6242 | + |
| 6243 | + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { |
| 6244 | + $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); |
| 6245 | + }else{ |
| 6246 | + _alsoResize(o.alsoResize); |
| 6247 | + } |
| 6248 | + }, |
| 6249 | + |
| 6250 | + stop: function(event, ui){ |
| 6251 | + var self = $(this).data("resizable"); |
| 6252 | + |
| 6253 | + //Opera fixing relative position |
| 6254 | + if (self._revertToRelativePosition && $.browser.opera) { |
| 6255 | + self._revertToRelativePosition = false; |
| 6256 | + el.css({ position: 'relative' }); |
| 6257 | + } |
| 6258 | + |
| 6259 | + $(this).removeData("resizable-alsoresize-start"); |
| 6260 | + } |
| 6261 | +}); |
| 6262 | + |
| 6263 | +$.ui.plugin.add("resizable", "animate", { |
| 6264 | + |
| 6265 | + stop: function(event, ui) { |
| 6266 | + var self = $(this).data("resizable"), o = self.options; |
| 6267 | + |
| 6268 | + var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), |
| 6269 | + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, |
| 6270 | + soffsetw = ista ? 0 : self.sizeDiff.width; |
| 6271 | + |
| 6272 | + var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, |
| 6273 | + left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, |
| 6274 | + top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; |
| 6275 | + |
| 6276 | + self.element.animate( |
| 6277 | + $.extend(style, top && left ? { top: top, left: left } : {}), { |
| 6278 | + duration: o.animateDuration, |
| 6279 | + easing: o.animateEasing, |
| 6280 | + step: function() { |
| 6281 | + |
| 6282 | + var data = { |
| 6283 | + width: parseInt(self.element.css('width'), 10), |
| 6284 | + height: parseInt(self.element.css('height'), 10), |
| 6285 | + top: parseInt(self.element.css('top'), 10), |
| 6286 | + left: parseInt(self.element.css('left'), 10) |
| 6287 | + }; |
| 6288 | + |
| 6289 | + if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); |
| 6290 | + |
| 6291 | + // propagating resize, and updating values for each animation step |
| 6292 | + self._updateCache(data); |
| 6293 | + self._propagate("resize", event); |
| 6294 | + |
| 6295 | + } |
| 6296 | + } |
| 6297 | + ); |
| 6298 | + } |
| 6299 | + |
| 6300 | +}); |
| 6301 | + |
| 6302 | +$.ui.plugin.add("resizable", "containment", { |
| 6303 | + |
| 6304 | + start: function(event, ui) { |
| 6305 | + var self = $(this).data("resizable"), o = self.options, el = self.element; |
| 6306 | + var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; |
| 6307 | + if (!ce) return; |
| 6308 | + |
| 6309 | + self.containerElement = $(ce); |
| 6310 | + |
| 6311 | + if (/document/.test(oc) || oc == document) { |
| 6312 | + self.containerOffset = { left: 0, top: 0 }; |
| 6313 | + self.containerPosition = { left: 0, top: 0 }; |
| 6314 | + |
| 6315 | + self.parentData = { |
| 6316 | + element: $(document), left: 0, top: 0, |
| 6317 | + width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight |
| 6318 | + }; |
| 6319 | + } |
| 6320 | + |
| 6321 | + // i'm a node, so compute top, left, right, bottom |
| 6322 | + else { |
| 6323 | + var element = $(ce), p = []; |
| 6324 | + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); |
| 6325 | + |
| 6326 | + self.containerOffset = element.offset(); |
| 6327 | + self.containerPosition = element.position(); |
| 6328 | + self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; |
| 6329 | + |
| 6330 | + var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, |
| 6331 | + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); |
| 6332 | + |
| 6333 | + self.parentData = { |
| 6334 | + element: ce, left: co.left, top: co.top, width: width, height: height |
| 6335 | + }; |
| 6336 | + } |
| 6337 | + }, |
| 6338 | + |
| 6339 | + resize: function(event, ui) { |
| 6340 | + var self = $(this).data("resizable"), o = self.options, |
| 6341 | + ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, |
| 6342 | + pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; |
| 6343 | + |
| 6344 | + if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; |
| 6345 | + |
| 6346 | + if (cp.left < (self._helper ? co.left : 0)) { |
| 6347 | + self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); |
| 6348 | + if (pRatio) self.size.height = self.size.width / o.aspectRatio; |
| 6349 | + self.position.left = o.helper ? co.left : 0; |
| 6350 | + } |
| 6351 | + |
| 6352 | + if (cp.top < (self._helper ? co.top : 0)) { |
| 6353 | + self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); |
| 6354 | + if (pRatio) self.size.width = self.size.height * o.aspectRatio; |
| 6355 | + self.position.top = self._helper ? co.top : 0; |
| 6356 | + } |
| 6357 | + |
| 6358 | + self.offset.left = self.parentData.left+self.position.left; |
| 6359 | + self.offset.top = self.parentData.top+self.position.top; |
| 6360 | + |
| 6361 | + var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), |
| 6362 | + hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); |
| 6363 | + |
| 6364 | + var isParent = self.containerElement.get(0) == self.element.parent().get(0), |
| 6365 | + isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); |
| 6366 | + |
| 6367 | + if(isParent && isOffsetRelative) woset -= self.parentData.left; |
| 6368 | + |
| 6369 | + if (woset + self.size.width >= self.parentData.width) { |
| 6370 | + self.size.width = self.parentData.width - woset; |
| 6371 | + if (pRatio) self.size.height = self.size.width / self.aspectRatio; |
| 6372 | + } |
| 6373 | + |
| 6374 | + if (hoset + self.size.height >= self.parentData.height) { |
| 6375 | + self.size.height = self.parentData.height - hoset; |
| 6376 | + if (pRatio) self.size.width = self.size.height * self.aspectRatio; |
| 6377 | + } |
| 6378 | + }, |
| 6379 | + |
| 6380 | + stop: function(event, ui){ |
| 6381 | + var self = $(this).data("resizable"), o = self.options, cp = self.position, |
| 6382 | + co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; |
| 6383 | + |
| 6384 | + var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; |
| 6385 | + |
| 6386 | + if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) |
| 6387 | + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); |
| 6388 | + |
| 6389 | + if (self._helper && !o.animate && (/static/).test(ce.css('position'))) |
| 6390 | + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); |
| 6391 | + |
| 6392 | + } |
| 6393 | +}); |
| 6394 | + |
| 6395 | +$.ui.plugin.add("resizable", "ghost", { |
| 6396 | + |
| 6397 | + start: function(event, ui) { |
| 6398 | + |
| 6399 | + var self = $(this).data("resizable"), o = self.options, cs = self.size; |
| 6400 | + |
| 6401 | + self.ghost = self.originalElement.clone(); |
| 6402 | + self.ghost |
| 6403 | + .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) |
| 6404 | + .addClass('ui-resizable-ghost') |
| 6405 | + .addClass(typeof o.ghost == 'string' ? o.ghost : ''); |
| 6406 | + |
| 6407 | + self.ghost.appendTo(self.helper); |
| 6408 | + |
| 6409 | + }, |
| 6410 | + |
| 6411 | + resize: function(event, ui){ |
| 6412 | + var self = $(this).data("resizable"), o = self.options; |
| 6413 | + if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); |
| 6414 | + }, |
| 6415 | + |
| 6416 | + stop: function(event, ui){ |
| 6417 | + var self = $(this).data("resizable"), o = self.options; |
| 6418 | + if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); |
| 6419 | + } |
| 6420 | + |
| 6421 | +}); |
| 6422 | + |
| 6423 | +$.ui.plugin.add("resizable", "grid", { |
| 6424 | + |
| 6425 | + resize: function(event, ui) { |
| 6426 | + var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; |
| 6427 | + o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; |
| 6428 | + var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); |
| 6429 | + |
| 6430 | + if (/^(se|s|e)$/.test(a)) { |
| 6431 | + self.size.width = os.width + ox; |
| 6432 | + self.size.height = os.height + oy; |
| 6433 | + } |
| 6434 | + else if (/^(ne)$/.test(a)) { |
| 6435 | + self.size.width = os.width + ox; |
| 6436 | + self.size.height = os.height + oy; |
| 6437 | + self.position.top = op.top - oy; |
| 6438 | + } |
| 6439 | + else if (/^(sw)$/.test(a)) { |
| 6440 | + self.size.width = os.width + ox; |
| 6441 | + self.size.height = os.height + oy; |
| 6442 | + self.position.left = op.left - ox; |
| 6443 | + } |
| 6444 | + else { |
| 6445 | + self.size.width = os.width + ox; |
| 6446 | + self.size.height = os.height + oy; |
| 6447 | + self.position.top = op.top - oy; |
| 6448 | + self.position.left = op.left - ox; |
| 6449 | + } |
| 6450 | + } |
| 6451 | + |
| 6452 | +}); |
| 6453 | + |
| 6454 | +var num = function(v) { |
| 6455 | + return parseInt(v, 10) || 0; |
| 6456 | +}; |
| 6457 | + |
| 6458 | +var isNumber = function(value) { |
| 6459 | + return !isNaN(parseInt(value, 10)); |
| 6460 | +}; |
| 6461 | + |
| 6462 | +})(jQuery); |
| 6463 | +/* |
| 6464 | + * jQuery UI Dialog 1.7.2 |
| 6465 | + * |
| 6466 | + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
| 6467 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 6468 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 6469 | + * |
| 6470 | + * http://docs.jquery.com/UI/Dialog |
| 6471 | + * |
| 6472 | + * Depends: |
| 6473 | + * ui.core.js |
| 6474 | + * ui.draggable.js |
| 6475 | + * ui.resizable.js |
| 6476 | + */ |
| 6477 | +(function($) { |
| 6478 | + |
| 6479 | +var setDataSwitch = { |
| 6480 | + dragStart: "start.draggable", |
| 6481 | + drag: "drag.draggable", |
| 6482 | + dragStop: "stop.draggable", |
| 6483 | + maxHeight: "maxHeight.resizable", |
| 6484 | + minHeight: "minHeight.resizable", |
| 6485 | + maxWidth: "maxWidth.resizable", |
| 6486 | + minWidth: "minWidth.resizable", |
| 6487 | + resizeStart: "start.resizable", |
| 6488 | + resize: "drag.resizable", |
| 6489 | + resizeStop: "stop.resizable" |
| 6490 | + }, |
| 6491 | + |
| 6492 | + uiDialogClasses = |
| 6493 | + 'ui-dialog ' + |
| 6494 | + 'ui-widget ' + |
| 6495 | + 'ui-widget-content ' + |
| 6496 | + 'ui-corner-all '; |
| 6497 | + |
| 6498 | +$.widget("ui.dialog", { |
| 6499 | + |
| 6500 | + _init: function() { |
| 6501 | + this.originalTitle = this.element.attr('title'); |
| 6502 | + |
| 6503 | + var self = this, |
| 6504 | + options = this.options, |
| 6505 | + |
| 6506 | + title = options.title || this.originalTitle || ' ', |
| 6507 | + titleId = $.ui.dialog.getTitleId(this.element), |
| 6508 | + |
| 6509 | + uiDialog = (this.uiDialog = $('<div/>')) |
| 6510 | + .appendTo(document.body) |
| 6511 | + .hide() |
| 6512 | + .addClass(uiDialogClasses + options.dialogClass) |
| 6513 | + .css({ |
| 6514 | + position: 'absolute', |
| 6515 | + overflow: 'hidden', |
| 6516 | + zIndex: options.zIndex |
| 6517 | + }) |
| 6518 | + // setting tabIndex makes the div focusable |
| 6519 | + // setting outline to 0 prevents a border on focus in Mozilla |
| 6520 | + .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { |
| 6521 | + (options.closeOnEscape && event.keyCode |
| 6522 | + && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event)); |
| 6523 | + }) |
| 6524 | + .attr({ |
| 6525 | + role: 'dialog', |
| 6526 | + 'aria-labelledby': titleId |
| 6527 | + }) |
| 6528 | + .mousedown(function(event) { |
| 6529 | + self.moveToTop(false, event); |
| 6530 | + }), |
| 6531 | + |
| 6532 | + uiDialogContent = this.element |
| 6533 | + .show() |
| 6534 | + .removeAttr('title') |
| 6535 | + .addClass( |
| 6536 | + 'ui-dialog-content ' + |
| 6537 | + 'ui-widget-content') |
| 6538 | + .appendTo(uiDialog), |
| 6539 | + |
| 6540 | + uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>')) |
| 6541 | + .addClass( |
| 6542 | + 'ui-dialog-titlebar ' + |
| 6543 | + 'ui-widget-header ' + |
| 6544 | + 'ui-corner-all ' + |
| 6545 | + 'ui-helper-clearfix' |
| 6546 | + ) |
| 6547 | + .prependTo(uiDialog), |
| 6548 | + |
| 6549 | + uiDialogTitlebarClose = $('<a href="#"/>') |
| 6550 | + .addClass( |
| 6551 | + 'ui-dialog-titlebar-close ' + |
| 6552 | + 'ui-corner-all' |
| 6553 | + ) |
| 6554 | + .attr('role', 'button') |
| 6555 | + .hover( |
| 6556 | + function() { |
| 6557 | + uiDialogTitlebarClose.addClass('ui-state-hover'); |
| 6558 | + }, |
| 6559 | + function() { |
| 6560 | + uiDialogTitlebarClose.removeClass('ui-state-hover'); |
| 6561 | + } |
| 6562 | + ) |
| 6563 | + .focus(function() { |
| 6564 | + uiDialogTitlebarClose.addClass('ui-state-focus'); |
| 6565 | + }) |
| 6566 | + .blur(function() { |
| 6567 | + uiDialogTitlebarClose.removeClass('ui-state-focus'); |
| 6568 | + }) |
| 6569 | + .mousedown(function(ev) { |
| 6570 | + ev.stopPropagation(); |
| 6571 | + }) |
| 6572 | + .click(function(event) { |
| 6573 | + self.close(event); |
| 6574 | + return false; |
| 6575 | + }) |
| 6576 | + .appendTo(uiDialogTitlebar), |
| 6577 | + |
| 6578 | + uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>')) |
| 6579 | + .addClass( |
| 6580 | + 'ui-icon ' + |
| 6581 | + 'ui-icon-closethick' |
| 6582 | + ) |
| 6583 | + .text(options.closeText) |
| 6584 | + .appendTo(uiDialogTitlebarClose), |
| 6585 | + |
| 6586 | + uiDialogTitle = $('<span/>') |
| 6587 | + .addClass('ui-dialog-title') |
| 6588 | + .attr('id', titleId) |
| 6589 | + .html(title) |
| 6590 | + .prependTo(uiDialogTitlebar); |
| 6591 | + |
| 6592 | + uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); |
| 6593 | + |
| 6594 | + (options.draggable && $.fn.draggable && this._makeDraggable()); |
| 6595 | + (options.resizable && $.fn.resizable && this._makeResizable()); |
| 6596 | + |
| 6597 | + this._createButtons(options.buttons); |
| 6598 | + this._isOpen = false; |
| 6599 | + |
| 6600 | + (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); |
| 6601 | + (options.autoOpen && this.open()); |
| 6602 | + |
| 6603 | + }, |
| 6604 | + |
| 6605 | + destroy: function() { |
| 6606 | + (this.overlay && this.overlay.destroy()); |
| 6607 | + this.uiDialog.hide(); |
| 6608 | + this.element |
| 6609 | + .unbind('.dialog') |
| 6610 | + .removeData('dialog') |
| 6611 | + .removeClass('ui-dialog-content ui-widget-content') |
| 6612 | + .hide().appendTo('body'); |
| 6613 | + this.uiDialog.remove(); |
| 6614 | + |
| 6615 | + (this.originalTitle && this.element.attr('title', this.originalTitle)); |
| 6616 | + }, |
| 6617 | + |
| 6618 | + close: function(event) { |
| 6619 | + var self = this; |
| 6620 | + |
| 6621 | + if (false === self._trigger('beforeclose', event)) { |
| 6622 | + return; |
| 6623 | + } |
| 6624 | + |
| 6625 | + (self.overlay && self.overlay.destroy()); |
| 6626 | + self.uiDialog.unbind('keypress.ui-dialog'); |
| 6627 | + |
| 6628 | + (self.options.hide |
| 6629 | + ? self.uiDialog.hide(self.options.hide, function() { |
| 6630 | + self._trigger('close', event); |
| 6631 | + }) |
| 6632 | + : self.uiDialog.hide() && self._trigger('close', event)); |
| 6633 | + |
| 6634 | + $.ui.dialog.overlay.resize(); |
| 6635 | + |
| 6636 | + self._isOpen = false; |
| 6637 | + |
| 6638 | + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) |
| 6639 | + if (self.options.modal) { |
| 6640 | + var maxZ = 0; |
| 6641 | + $('.ui-dialog').each(function() { |
| 6642 | + if (this != self.uiDialog[0]) { |
| 6643 | + maxZ = Math.max(maxZ, $(this).css('z-index')); |
| 6644 | + } |
| 6645 | + }); |
| 6646 | + $.ui.dialog.maxZ = maxZ; |
| 6647 | + } |
| 6648 | + }, |
| 6649 | + |
| 6650 | + isOpen: function() { |
| 6651 | + return this._isOpen; |
| 6652 | + }, |
| 6653 | + |
| 6654 | + // the force parameter allows us to move modal dialogs to their correct |
| 6655 | + // position on open |
| 6656 | + moveToTop: function(force, event) { |
| 6657 | + |
| 6658 | + if ((this.options.modal && !force) |
| 6659 | + || (!this.options.stack && !this.options.modal)) { |
| 6660 | + return this._trigger('focus', event); |
| 6661 | + } |
| 6662 | + |
| 6663 | + if (this.options.zIndex > $.ui.dialog.maxZ) { |
| 6664 | + $.ui.dialog.maxZ = this.options.zIndex; |
| 6665 | + } |
| 6666 | + (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ)); |
| 6667 | + |
| 6668 | + //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. |
| 6669 | + // http://ui.jquery.com/bugs/ticket/3193 |
| 6670 | + var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; |
| 6671 | + this.uiDialog.css('z-index', ++$.ui.dialog.maxZ); |
| 6672 | + this.element.attr(saveScroll); |
| 6673 | + this._trigger('focus', event); |
| 6674 | + }, |
| 6675 | + |
| 6676 | + open: function() { |
| 6677 | + if (this._isOpen) { return; } |
| 6678 | + |
| 6679 | + var options = this.options, |
| 6680 | + uiDialog = this.uiDialog; |
| 6681 | + |
| 6682 | + this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null; |
| 6683 | + (uiDialog.next().length && uiDialog.appendTo('body')); |
| 6684 | + this._size(); |
| 6685 | + this._position(options.position); |
| 6686 | + uiDialog.show(options.show); |
| 6687 | + this.moveToTop(true); |
| 6688 | + |
| 6689 | + // prevent tabbing out of modal dialogs |
| 6690 | + (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) { |
| 6691 | + if (event.keyCode != $.ui.keyCode.TAB) { |
| 6692 | + return; |
| 6693 | + } |
| 6694 | + |
| 6695 | + var tabbables = $(':tabbable', this), |
| 6696 | + first = tabbables.filter(':first')[0], |
| 6697 | + last = tabbables.filter(':last')[0]; |
| 6698 | + |
| 6699 | + if (event.target == last && !event.shiftKey) { |
| 6700 | + setTimeout(function() { |
| 6701 | + first.focus(); |
| 6702 | + }, 1); |
| 6703 | + } else if (event.target == first && event.shiftKey) { |
| 6704 | + setTimeout(function() { |
| 6705 | + last.focus(); |
| 6706 | + }, 1); |
| 6707 | + } |
| 6708 | + })); |
| 6709 | + |
| 6710 | + // set focus to the first tabbable element in the content area or the first button |
| 6711 | + // if there are no tabbable elements, set focus on the dialog itself |
| 6712 | + $([]) |
| 6713 | + .add(uiDialog.find('.ui-dialog-content :tabbable:first')) |
| 6714 | + .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) |
| 6715 | + .add(uiDialog) |
| 6716 | + .filter(':first') |
| 6717 | + .focus(); |
| 6718 | + |
| 6719 | + this._trigger('open'); |
| 6720 | + this._isOpen = true; |
| 6721 | + }, |
| 6722 | + |
| 6723 | + _createButtons: function(buttons) { |
| 6724 | + var self = this, |
| 6725 | + hasButtons = false, |
| 6726 | + uiDialogButtonPane = $('<div></div>') |
| 6727 | + .addClass( |
| 6728 | + 'ui-dialog-buttonpane ' + |
| 6729 | + 'ui-widget-content ' + |
| 6730 | + 'ui-helper-clearfix' |
| 6731 | + ); |
| 6732 | + |
| 6733 | + // if we already have a button pane, remove it |
| 6734 | + this.uiDialog.find('.ui-dialog-buttonpane').remove(); |
| 6735 | + |
| 6736 | + (typeof buttons == 'object' && buttons !== null && |
| 6737 | + $.each(buttons, function() { return !(hasButtons = true); })); |
| 6738 | + if (hasButtons) { |
| 6739 | + $.each(buttons, function(name, fn) { |
| 6740 | + $('<button type="button"></button>') |
| 6741 | + .addClass( |
| 6742 | + 'ui-state-default ' + |
| 6743 | + 'ui-corner-all' |
| 6744 | + ) |
| 6745 | + .text(name) |
| 6746 | + .click(function() { fn.apply(self.element[0], arguments); }) |
| 6747 | + .hover( |
| 6748 | + function() { |
| 6749 | + $(this).addClass('ui-state-hover'); |
| 6750 | + }, |
| 6751 | + function() { |
| 6752 | + $(this).removeClass('ui-state-hover'); |
| 6753 | + } |
| 6754 | + ) |
| 6755 | + .focus(function() { |
| 6756 | + $(this).addClass('ui-state-focus'); |
| 6757 | + }) |
| 6758 | + .blur(function() { |
| 6759 | + $(this).removeClass('ui-state-focus'); |
| 6760 | + }) |
| 6761 | + .appendTo(uiDialogButtonPane); |
| 6762 | + }); |
| 6763 | + uiDialogButtonPane.appendTo(this.uiDialog); |
| 6764 | + } |
| 6765 | + }, |
| 6766 | + |
| 6767 | + _makeDraggable: function() { |
| 6768 | + var self = this, |
| 6769 | + options = this.options, |
| 6770 | + heightBeforeDrag; |
| 6771 | + |
| 6772 | + this.uiDialog.draggable({ |
| 6773 | + cancel: '.ui-dialog-content', |
| 6774 | + handle: '.ui-dialog-titlebar', |
| 6775 | + containment: 'document', |
| 6776 | + start: function() { |
| 6777 | + heightBeforeDrag = options.height; |
| 6778 | + $(this).height($(this).height()).addClass("ui-dialog-dragging"); |
| 6779 | + (options.dragStart && options.dragStart.apply(self.element[0], arguments)); |
| 6780 | + }, |
| 6781 | + drag: function() { |
| 6782 | + (options.drag && options.drag.apply(self.element[0], arguments)); |
| 6783 | + }, |
| 6784 | + stop: function() { |
| 6785 | + $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); |
| 6786 | + (options.dragStop && options.dragStop.apply(self.element[0], arguments)); |
| 6787 | + $.ui.dialog.overlay.resize(); |
| 6788 | + } |
| 6789 | + }); |
| 6790 | + }, |
| 6791 | + |
| 6792 | + _makeResizable: function(handles) { |
| 6793 | + handles = (handles === undefined ? this.options.resizable : handles); |
| 6794 | + var self = this, |
| 6795 | + options = this.options, |
| 6796 | + resizeHandles = typeof handles == 'string' |
| 6797 | + ? handles |
| 6798 | + : 'n,e,s,w,se,sw,ne,nw'; |
| 6799 | + |
| 6800 | + this.uiDialog.resizable({ |
| 6801 | + cancel: '.ui-dialog-content', |
| 6802 | + alsoResize: this.element, |
| 6803 | + maxWidth: options.maxWidth, |
| 6804 | + maxHeight: options.maxHeight, |
| 6805 | + minWidth: options.minWidth, |
| 6806 | + minHeight: options.minHeight, |
| 6807 | + start: function() { |
| 6808 | + $(this).addClass("ui-dialog-resizing"); |
| 6809 | + (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); |
| 6810 | + }, |
| 6811 | + resize: function() { |
| 6812 | + (options.resize && options.resize.apply(self.element[0], arguments)); |
| 6813 | + }, |
| 6814 | + handles: resizeHandles, |
| 6815 | + stop: function() { |
| 6816 | + $(this).removeClass("ui-dialog-resizing"); |
| 6817 | + options.height = $(this).height(); |
| 6818 | + options.width = $(this).width(); |
| 6819 | + (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); |
| 6820 | + $.ui.dialog.overlay.resize(); |
| 6821 | + } |
| 6822 | + }) |
| 6823 | + .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); |
| 6824 | + }, |
| 6825 | + |
| 6826 | + _position: function(pos) { |
| 6827 | + var wnd = $(window), doc = $(document), |
| 6828 | + pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), |
| 6829 | + minTop = pTop; |
| 6830 | + |
| 6831 | + if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { |
| 6832 | + pos = [ |
| 6833 | + pos == 'right' || pos == 'left' ? pos : 'center', |
| 6834 | + pos == 'top' || pos == 'bottom' ? pos : 'middle' |
| 6835 | + ]; |
| 6836 | + } |
| 6837 | + if (pos.constructor != Array) { |
| 6838 | + pos = ['center', 'middle']; |
| 6839 | + } |
| 6840 | + if (pos[0].constructor == Number) { |
| 6841 | + pLeft += pos[0]; |
| 6842 | + } else { |
| 6843 | + switch (pos[0]) { |
| 6844 | + case 'left': |
| 6845 | + pLeft += 0; |
| 6846 | + break; |
| 6847 | + case 'right': |
| 6848 | + pLeft += wnd.width() - this.uiDialog.outerWidth(); |
| 6849 | + break; |
| 6850 | + default: |
| 6851 | + case 'center': |
| 6852 | + pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; |
| 6853 | + } |
| 6854 | + } |
| 6855 | + if (pos[1].constructor == Number) { |
| 6856 | + pTop += pos[1]; |
| 6857 | + } else { |
| 6858 | + switch (pos[1]) { |
| 6859 | + case 'top': |
| 6860 | + pTop += 0; |
| 6861 | + break; |
| 6862 | + case 'bottom': |
| 6863 | + pTop += wnd.height() - this.uiDialog.outerHeight(); |
| 6864 | + break; |
| 6865 | + default: |
| 6866 | + case 'middle': |
| 6867 | + pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2; |
| 6868 | + } |
| 6869 | + } |
| 6870 | + |
| 6871 | + // prevent the dialog from being too high (make sure the titlebar |
| 6872 | + // is accessible) |
| 6873 | + pTop = Math.max(pTop, minTop); |
| 6874 | + this.uiDialog.css({top: pTop, left: pLeft}); |
| 6875 | + }, |
| 6876 | + |
| 6877 | + _setData: function(key, value){ |
| 6878 | + (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); |
| 6879 | + switch (key) { |
| 6880 | + case "buttons": |
| 6881 | + this._createButtons(value); |
| 6882 | + break; |
| 6883 | + case "closeText": |
| 6884 | + this.uiDialogTitlebarCloseText.text(value); |
| 6885 | + break; |
| 6886 | + case "dialogClass": |
| 6887 | + this.uiDialog |
| 6888 | + .removeClass(this.options.dialogClass) |
| 6889 | + .addClass(uiDialogClasses + value); |
| 6890 | + break; |
| 6891 | + case "draggable": |
| 6892 | + (value |
| 6893 | + ? this._makeDraggable() |
| 6894 | + : this.uiDialog.draggable('destroy')); |
| 6895 | + break; |
| 6896 | + case "height": |
| 6897 | + this.uiDialog.height(value); |
| 6898 | + break; |
| 6899 | + case "position": |
| 6900 | + this._position(value); |
| 6901 | + break; |
| 6902 | + case "resizable": |
| 6903 | + var uiDialog = this.uiDialog, |
| 6904 | + isResizable = this.uiDialog.is(':data(resizable)'); |
| 6905 | + |
| 6906 | + // currently resizable, becoming non-resizable |
| 6907 | + (isResizable && !value && uiDialog.resizable('destroy')); |
| 6908 | + |
| 6909 | + // currently resizable, changing handles |
| 6910 | + (isResizable && typeof value == 'string' && |
| 6911 | + uiDialog.resizable('option', 'handles', value)); |
| 6912 | + |
| 6913 | + // currently non-resizable, becoming resizable |
| 6914 | + (isResizable || this._makeResizable(value)); |
| 6915 | + break; |
| 6916 | + case "title": |
| 6917 | + $(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' '); |
| 6918 | + break; |
| 6919 | + case "width": |
| 6920 | + this.uiDialog.width(value); |
| 6921 | + break; |
| 6922 | + } |
| 6923 | + |
| 6924 | + $.widget.prototype._setData.apply(this, arguments); |
| 6925 | + }, |
| 6926 | + |
| 6927 | + _size: function() { |
| 6928 | + /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content |
| 6929 | + * divs will both have width and height set, so we need to reset them |
| 6930 | + */ |
| 6931 | + var options = this.options; |
| 6932 | + |
| 6933 | + // reset content sizing |
| 6934 | + this.element.css({ |
| 6935 | + height: 0, |
| 6936 | + minHeight: 0, |
| 6937 | + width: 'auto' |
| 6938 | + }); |
| 6939 | + |
| 6940 | + // reset wrapper sizing |
| 6941 | + // determine the height of all the non-content elements |
| 6942 | + var nonContentHeight = this.uiDialog.css({ |
| 6943 | + height: 'auto', |
| 6944 | + width: options.width |
| 6945 | + }) |
| 6946 | + .height(); |
| 6947 | + |
| 6948 | + this.element |
| 6949 | + .css({ |
| 6950 | + minHeight: Math.max(options.minHeight - nonContentHeight, 0), |
| 6951 | + height: options.height == 'auto' |
| 6952 | + ? 'auto' |
| 6953 | + : Math.max(options.height - nonContentHeight, 0) |
| 6954 | + }); |
| 6955 | + } |
| 6956 | +}); |
| 6957 | + |
| 6958 | +$.extend($.ui.dialog, { |
| 6959 | + version: "1.7.2", |
| 6960 | + defaults: { |
| 6961 | + autoOpen: true, |
| 6962 | + bgiframe: false, |
| 6963 | + buttons: {}, |
| 6964 | + closeOnEscape: true, |
| 6965 | + closeText: 'close', |
| 6966 | + dialogClass: '', |
| 6967 | + draggable: true, |
| 6968 | + hide: null, |
| 6969 | + height: 'auto', |
| 6970 | + maxHeight: false, |
| 6971 | + maxWidth: false, |
| 6972 | + minHeight: 150, |
| 6973 | + minWidth: 150, |
| 6974 | + modal: false, |
| 6975 | + position: 'center', |
| 6976 | + resizable: true, |
| 6977 | + show: null, |
| 6978 | + stack: true, |
| 6979 | + title: '', |
| 6980 | + width: 300, |
| 6981 | + zIndex: 1000 |
| 6982 | + }, |
| 6983 | + |
| 6984 | + getter: 'isOpen', |
| 6985 | + |
| 6986 | + uuid: 0, |
| 6987 | + maxZ: 0, |
| 6988 | + |
| 6989 | + getTitleId: function($el) { |
| 6990 | + return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); |
| 6991 | + }, |
| 6992 | + |
| 6993 | + overlay: function(dialog) { |
| 6994 | + this.$el = $.ui.dialog.overlay.create(dialog); |
| 6995 | + } |
| 6996 | +}); |
| 6997 | + |
| 6998 | +$.extend($.ui.dialog.overlay, { |
| 6999 | + instances: [], |
| 7000 | + maxZ: 0, |
| 7001 | + events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), |
| 7002 | + function(event) { return event + '.dialog-overlay'; }).join(' '), |
| 7003 | + create: function(dialog) { |
| 7004 | + if (this.instances.length === 0) { |
| 7005 | + // prevent use of anchors and inputs |
| 7006 | + // we use a setTimeout in case the overlay is created from an |
| 7007 | + // event that we're going to be cancelling (see #2804) |
| 7008 | + setTimeout(function() { |
| 7009 | + // handle $(el).dialog().dialog('close') (see #4065) |
| 7010 | + if ($.ui.dialog.overlay.instances.length) { |
| 7011 | + $(document).bind($.ui.dialog.overlay.events, function(event) { |
| 7012 | + var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0; |
| 7013 | + return (dialogZ > $.ui.dialog.overlay.maxZ); |
| 7014 | + }); |
| 7015 | + } |
| 7016 | + }, 1); |
| 7017 | + |
| 7018 | + // allow closing by pressing the escape key |
| 7019 | + $(document).bind('keydown.dialog-overlay', function(event) { |
| 7020 | + (dialog.options.closeOnEscape && event.keyCode |
| 7021 | + && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event)); |
| 7022 | + }); |
| 7023 | + |
| 7024 | + // handle window resize |
| 7025 | + $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); |
| 7026 | + } |
| 7027 | + |
| 7028 | + var $el = $('<div></div>').appendTo(document.body) |
| 7029 | + .addClass('ui-widget-overlay').css({ |
| 7030 | + width: this.width(), |
| 7031 | + height: this.height() |
| 7032 | + }); |
| 7033 | + |
| 7034 | + (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); |
| 7035 | + |
| 7036 | + this.instances.push($el); |
| 7037 | + return $el; |
| 7038 | + }, |
| 7039 | + |
| 7040 | + destroy: function($el) { |
| 7041 | + this.instances.splice($.inArray(this.instances, $el), 1); |
| 7042 | + |
| 7043 | + if (this.instances.length === 0) { |
| 7044 | + $([document, window]).unbind('.dialog-overlay'); |
| 7045 | + } |
| 7046 | + |
| 7047 | + $el.remove(); |
| 7048 | + |
| 7049 | + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) |
| 7050 | + var maxZ = 0; |
| 7051 | + $.each(this.instances, function() { |
| 7052 | + maxZ = Math.max(maxZ, this.css('z-index')); |
| 7053 | + }); |
| 7054 | + this.maxZ = maxZ; |
| 7055 | + }, |
| 7056 | + |
| 7057 | + height: function() { |
| 7058 | + // handle IE 6 |
| 7059 | + if ($.browser.msie && $.browser.version < 7) { |
| 7060 | + var scrollHeight = Math.max( |
| 7061 | + document.documentElement.scrollHeight, |
| 7062 | + document.body.scrollHeight |
| 7063 | + ); |
| 7064 | + var offsetHeight = Math.max( |
| 7065 | + document.documentElement.offsetHeight, |
| 7066 | + document.body.offsetHeight |
| 7067 | + ); |
| 7068 | + |
| 7069 | + if (scrollHeight < offsetHeight) { |
| 7070 | + return $(window).height() + 'px'; |
| 7071 | + } else { |
| 7072 | + return scrollHeight + 'px'; |
| 7073 | + } |
| 7074 | + // handle "good" browsers |
| 7075 | + } else { |
| 7076 | + return $(document).height() + 'px'; |
| 7077 | + } |
| 7078 | + }, |
| 7079 | + |
| 7080 | + width: function() { |
| 7081 | + // handle IE 6 |
| 7082 | + if ($.browser.msie && $.browser.version < 7) { |
| 7083 | + var scrollWidth = Math.max( |
| 7084 | + document.documentElement.scrollWidth, |
| 7085 | + document.body.scrollWidth |
| 7086 | + ); |
| 7087 | + var offsetWidth = Math.max( |
| 7088 | + document.documentElement.offsetWidth, |
| 7089 | + document.body.offsetWidth |
| 7090 | + ); |
| 7091 | + |
| 7092 | + if (scrollWidth < offsetWidth) { |
| 7093 | + return $(window).width() + 'px'; |
| 7094 | + } else { |
| 7095 | + return scrollWidth + 'px'; |
| 7096 | + } |
| 7097 | + // handle "good" browsers |
| 7098 | + } else { |
| 7099 | + return $(document).width() + 'px'; |
| 7100 | + } |
| 7101 | + }, |
| 7102 | + |
| 7103 | + resize: function() { |
| 7104 | + /* If the dialog is draggable and the user drags it past the |
| 7105 | + * right edge of the window, the document becomes wider so we |
| 7106 | + * need to stretch the overlay. If the user then drags the |
| 7107 | + * dialog back to the left, the document will become narrower, |
| 7108 | + * so we need to shrink the overlay to the appropriate size. |
| 7109 | + * This is handled by shrinking the overlay before setting it |
| 7110 | + * to the full document size. |
| 7111 | + */ |
| 7112 | + var $overlays = $([]); |
| 7113 | + $.each($.ui.dialog.overlay.instances, function() { |
| 7114 | + $overlays = $overlays.add(this); |
| 7115 | + }); |
| 7116 | + |
| 7117 | + $overlays.css({ |
| 7118 | + width: 0, |
| 7119 | + height: 0 |
| 7120 | + }).css({ |
| 7121 | + width: $.ui.dialog.overlay.width(), |
| 7122 | + height: $.ui.dialog.overlay.height() |
| 7123 | + }); |
| 7124 | + } |
| 7125 | +}); |
| 7126 | + |
| 7127 | +$.extend($.ui.dialog.overlay.prototype, { |
| 7128 | + destroy: function() { |
| 7129 | + $.ui.dialog.overlay.destroy(this.$el); |
| 7130 | + } |
| 7131 | +}); |
| 7132 | + |
| 7133 | +})(jQuery); |
| 7134 | +/* |
| 7135 | + * jQuery UI Tabs 1.7.2 |
| 7136 | + * |
| 7137 | + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
| 7138 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 7139 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 7140 | + * |
| 7141 | + * http://docs.jquery.com/UI/Tabs |
| 7142 | + * |
| 7143 | + * Depends: |
| 7144 | + * ui.core.js |
| 7145 | + */ |
| 7146 | +(function($) { |
| 7147 | + |
| 7148 | +$.widget("ui.tabs", { |
| 7149 | + |
| 7150 | + _init: function() { |
| 7151 | + if (this.options.deselectable !== undefined) { |
| 7152 | + this.options.collapsible = this.options.deselectable; |
| 7153 | + } |
| 7154 | + this._tabify(true); |
| 7155 | + }, |
| 7156 | + |
| 7157 | + _setData: function(key, value) { |
| 7158 | + if (key == 'selected') { |
| 7159 | + if (this.options.collapsible && value == this.options.selected) { |
| 7160 | + return; |
| 7161 | + } |
| 7162 | + this.select(value); |
| 7163 | + } |
| 7164 | + else { |
| 7165 | + this.options[key] = value; |
| 7166 | + if (key == 'deselectable') { |
| 7167 | + this.options.collapsible = value; |
| 7168 | + } |
| 7169 | + this._tabify(); |
| 7170 | + } |
| 7171 | + }, |
| 7172 | + |
| 7173 | + _tabId: function(a) { |
| 7174 | + return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || |
| 7175 | + this.options.idPrefix + $.data(a); |
| 7176 | + }, |
| 7177 | + |
| 7178 | + _sanitizeSelector: function(hash) { |
| 7179 | + return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" |
| 7180 | + }, |
| 7181 | + |
| 7182 | + _cookie: function() { |
| 7183 | + var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0])); |
| 7184 | + return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); |
| 7185 | + }, |
| 7186 | + |
| 7187 | + _ui: function(tab, panel) { |
| 7188 | + return { |
| 7189 | + tab: tab, |
| 7190 | + panel: panel, |
| 7191 | + index: this.anchors.index(tab) |
| 7192 | + }; |
| 7193 | + }, |
| 7194 | + |
| 7195 | + _cleanup: function() { |
| 7196 | + // restore all former loading tabs labels |
| 7197 | + this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') |
| 7198 | + .find('span:data(label.tabs)') |
| 7199 | + .each(function() { |
| 7200 | + var el = $(this); |
| 7201 | + el.html(el.data('label.tabs')).removeData('label.tabs'); |
| 7202 | + }); |
| 7203 | + }, |
| 7204 | + |
| 7205 | + _tabify: function(init) { |
| 7206 | + |
| 7207 | + this.list = this.element.children('ul:first'); |
| 7208 | + this.lis = $('li:has(a[href])', this.list); |
| 7209 | + this.anchors = this.lis.map(function() { return $('a', this)[0]; }); |
| 7210 | + this.panels = $([]); |
| 7211 | + |
| 7212 | + var self = this, o = this.options; |
| 7213 | + |
| 7214 | + var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash |
| 7215 | + this.anchors.each(function(i, a) { |
| 7216 | + var href = $(a).attr('href'); |
| 7217 | + |
| 7218 | + // For dynamically created HTML that contains a hash as href IE < 8 expands |
| 7219 | + // such href to the full page url with hash and then misinterprets tab as ajax. |
| 7220 | + // Same consideration applies for an added tab with a fragment identifier |
| 7221 | + // since a[href=#fragment-identifier] does unexpectedly not match. |
| 7222 | + // Thus normalize href attribute... |
| 7223 | + var hrefBase = href.split('#')[0], baseEl; |
| 7224 | + if (hrefBase && (hrefBase === location.toString().split('#')[0] || |
| 7225 | + (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { |
| 7226 | + href = a.hash; |
| 7227 | + a.href = href; |
| 7228 | + } |
| 7229 | + |
| 7230 | + // inline tab |
| 7231 | + if (fragmentId.test(href)) { |
| 7232 | + self.panels = self.panels.add(self._sanitizeSelector(href)); |
| 7233 | + } |
| 7234 | + |
| 7235 | + // remote tab |
| 7236 | + else if (href != '#') { // prevent loading the page itself if href is just "#" |
| 7237 | + $.data(a, 'href.tabs', href); // required for restore on destroy |
| 7238 | + |
| 7239 | + // TODO until #3808 is fixed strip fragment identifier from url |
| 7240 | + // (IE fails to load from such url) |
| 7241 | + $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data |
| 7242 | + |
| 7243 | + var id = self._tabId(a); |
| 7244 | + a.href = '#' + id; |
| 7245 | + var $panel = $('#' + id); |
| 7246 | + if (!$panel.length) { |
| 7247 | + $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') |
| 7248 | + .insertAfter(self.panels[i - 1] || self.list); |
| 7249 | + $panel.data('destroy.tabs', true); |
| 7250 | + } |
| 7251 | + self.panels = self.panels.add($panel); |
| 7252 | + } |
| 7253 | + |
| 7254 | + // invalid tab href |
| 7255 | + else { |
| 7256 | + o.disabled.push(i); |
| 7257 | + } |
| 7258 | + }); |
| 7259 | + |
| 7260 | + // initialization from scratch |
| 7261 | + if (init) { |
| 7262 | + |
| 7263 | + // attach necessary classes for styling |
| 7264 | + this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); |
| 7265 | + this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
| 7266 | + this.lis.addClass('ui-state-default ui-corner-top'); |
| 7267 | + this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); |
| 7268 | + |
| 7269 | + // Selected tab |
| 7270 | + // use "selected" option or try to retrieve: |
| 7271 | + // 1. from fragment identifier in url |
| 7272 | + // 2. from cookie |
| 7273 | + // 3. from selected class attribute on <li> |
| 7274 | + if (o.selected === undefined) { |
| 7275 | + if (location.hash) { |
| 7276 | + this.anchors.each(function(i, a) { |
| 7277 | + if (a.hash == location.hash) { |
| 7278 | + o.selected = i; |
| 7279 | + return false; // break |
| 7280 | + } |
| 7281 | + }); |
| 7282 | + } |
| 7283 | + if (typeof o.selected != 'number' && o.cookie) { |
| 7284 | + o.selected = parseInt(self._cookie(), 10); |
| 7285 | + } |
| 7286 | + if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { |
| 7287 | + o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
| 7288 | + } |
| 7289 | + o.selected = o.selected || 0; |
| 7290 | + } |
| 7291 | + else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release |
| 7292 | + o.selected = -1; |
| 7293 | + } |
| 7294 | + |
| 7295 | + // sanity check - default to first tab... |
| 7296 | + o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; |
| 7297 | + |
| 7298 | + // Take disabling tabs via class attribute from HTML |
| 7299 | + // into account and update option properly. |
| 7300 | + // A selected tab cannot become disabled. |
| 7301 | + o.disabled = $.unique(o.disabled.concat( |
| 7302 | + $.map(this.lis.filter('.ui-state-disabled'), |
| 7303 | + function(n, i) { return self.lis.index(n); } ) |
| 7304 | + )).sort(); |
| 7305 | + |
| 7306 | + if ($.inArray(o.selected, o.disabled) != -1) { |
| 7307 | + o.disabled.splice($.inArray(o.selected, o.disabled), 1); |
| 7308 | + } |
| 7309 | + |
| 7310 | + // highlight selected tab |
| 7311 | + this.panels.addClass('ui-tabs-hide'); |
| 7312 | + this.lis.removeClass('ui-tabs-selected ui-state-active'); |
| 7313 | + if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list |
| 7314 | + this.panels.eq(o.selected).removeClass('ui-tabs-hide'); |
| 7315 | + this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); |
| 7316 | + |
| 7317 | + // seems to be expected behavior that the show callback is fired |
| 7318 | + self.element.queue("tabs", function() { |
| 7319 | + self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); |
| 7320 | + }); |
| 7321 | + |
| 7322 | + this.load(o.selected); |
| 7323 | + } |
| 7324 | + |
| 7325 | + // clean up to avoid memory leaks in certain versions of IE 6 |
| 7326 | + $(window).bind('unload', function() { |
| 7327 | + self.lis.add(self.anchors).unbind('.tabs'); |
| 7328 | + self.lis = self.anchors = self.panels = null; |
| 7329 | + }); |
| 7330 | + |
| 7331 | + } |
| 7332 | + // update selected after add/remove |
| 7333 | + else { |
| 7334 | + o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
| 7335 | + } |
| 7336 | + |
| 7337 | + // update collapsible |
| 7338 | + this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); |
| 7339 | + |
| 7340 | + // set or update cookie after init and add/remove respectively |
| 7341 | + if (o.cookie) { |
| 7342 | + this._cookie(o.selected, o.cookie); |
| 7343 | + } |
| 7344 | + |
| 7345 | + // disable tabs |
| 7346 | + for (var i = 0, li; (li = this.lis[i]); i++) { |
| 7347 | + $(li)[$.inArray(i, o.disabled) != -1 && |
| 7348 | + !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); |
| 7349 | + } |
| 7350 | + |
| 7351 | + // reset cache if switching from cached to not cached |
| 7352 | + if (o.cache === false) { |
| 7353 | + this.anchors.removeData('cache.tabs'); |
| 7354 | + } |
| 7355 | + |
| 7356 | + // remove all handlers before, tabify may run on existing tabs after add or option change |
| 7357 | + this.lis.add(this.anchors).unbind('.tabs'); |
| 7358 | + |
| 7359 | + if (o.event != 'mouseover') { |
| 7360 | + var addState = function(state, el) { |
| 7361 | + if (el.is(':not(.ui-state-disabled)')) { |
| 7362 | + el.addClass('ui-state-' + state); |
| 7363 | + } |
| 7364 | + }; |
| 7365 | + var removeState = function(state, el) { |
| 7366 | + el.removeClass('ui-state-' + state); |
| 7367 | + }; |
| 7368 | + this.lis.bind('mouseover.tabs', function() { |
| 7369 | + addState('hover', $(this)); |
| 7370 | + }); |
| 7371 | + this.lis.bind('mouseout.tabs', function() { |
| 7372 | + removeState('hover', $(this)); |
| 7373 | + }); |
| 7374 | + this.anchors.bind('focus.tabs', function() { |
| 7375 | + addState('focus', $(this).closest('li')); |
| 7376 | + }); |
| 7377 | + this.anchors.bind('blur.tabs', function() { |
| 7378 | + removeState('focus', $(this).closest('li')); |
| 7379 | + }); |
| 7380 | + } |
| 7381 | + |
| 7382 | + // set up animations |
| 7383 | + var hideFx, showFx; |
| 7384 | + if (o.fx) { |
| 7385 | + if ($.isArray(o.fx)) { |
| 7386 | + hideFx = o.fx[0]; |
| 7387 | + showFx = o.fx[1]; |
| 7388 | + } |
| 7389 | + else { |
| 7390 | + hideFx = showFx = o.fx; |
| 7391 | + } |
| 7392 | + } |
| 7393 | + |
| 7394 | + // Reset certain styles left over from animation |
| 7395 | + // and prevent IE's ClearType bug... |
| 7396 | + function resetStyle($el, fx) { |
| 7397 | + $el.css({ display: '' }); |
| 7398 | + if ($.browser.msie && fx.opacity) { |
| 7399 | + $el[0].style.removeAttribute('filter'); |
| 7400 | + } |
| 7401 | + } |
| 7402 | + |
| 7403 | + // Show a tab... |
| 7404 | + var showTab = showFx ? |
| 7405 | + function(clicked, $show) { |
| 7406 | + $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); |
| 7407 | + $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way |
| 7408 | + .animate(showFx, showFx.duration || 'normal', function() { |
| 7409 | + resetStyle($show, showFx); |
| 7410 | + self._trigger('show', null, self._ui(clicked, $show[0])); |
| 7411 | + }); |
| 7412 | + } : |
| 7413 | + function(clicked, $show) { |
| 7414 | + $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); |
| 7415 | + $show.removeClass('ui-tabs-hide'); |
| 7416 | + self._trigger('show', null, self._ui(clicked, $show[0])); |
| 7417 | + }; |
| 7418 | + |
| 7419 | + // Hide a tab, $show is optional... |
| 7420 | + var hideTab = hideFx ? |
| 7421 | + function(clicked, $hide) { |
| 7422 | + $hide.animate(hideFx, hideFx.duration || 'normal', function() { |
| 7423 | + self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); |
| 7424 | + $hide.addClass('ui-tabs-hide'); |
| 7425 | + resetStyle($hide, hideFx); |
| 7426 | + self.element.dequeue("tabs"); |
| 7427 | + }); |
| 7428 | + } : |
| 7429 | + function(clicked, $hide, $show) { |
| 7430 | + self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); |
| 7431 | + $hide.addClass('ui-tabs-hide'); |
| 7432 | + self.element.dequeue("tabs"); |
| 7433 | + }; |
| 7434 | + |
| 7435 | + // attach tab event handler, unbind to avoid duplicates from former tabifying... |
| 7436 | + this.anchors.bind(o.event + '.tabs', function() { |
| 7437 | + var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), |
| 7438 | + $show = $(self._sanitizeSelector(this.hash)); |
| 7439 | + |
| 7440 | + // If tab is already selected and not collapsible or tab disabled or |
| 7441 | + // or is already loading or click callback returns false stop here. |
| 7442 | + // Check if click handler returns false last so that it is not executed |
| 7443 | + // for a disabled or loading tab! |
| 7444 | + if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || |
| 7445 | + $li.hasClass('ui-state-disabled') || |
| 7446 | + $li.hasClass('ui-state-processing') || |
| 7447 | + self._trigger('select', null, self._ui(this, $show[0])) === false) { |
| 7448 | + this.blur(); |
| 7449 | + return false; |
| 7450 | + } |
| 7451 | + |
| 7452 | + o.selected = self.anchors.index(this); |
| 7453 | + |
| 7454 | + self.abort(); |
| 7455 | + |
| 7456 | + // if tab may be closed |
| 7457 | + if (o.collapsible) { |
| 7458 | + if ($li.hasClass('ui-tabs-selected')) { |
| 7459 | + o.selected = -1; |
| 7460 | + |
| 7461 | + if (o.cookie) { |
| 7462 | + self._cookie(o.selected, o.cookie); |
| 7463 | + } |
| 7464 | + |
| 7465 | + self.element.queue("tabs", function() { |
| 7466 | + hideTab(el, $hide); |
| 7467 | + }).dequeue("tabs"); |
| 7468 | + |
| 7469 | + this.blur(); |
| 7470 | + return false; |
| 7471 | + } |
| 7472 | + else if (!$hide.length) { |
| 7473 | + if (o.cookie) { |
| 7474 | + self._cookie(o.selected, o.cookie); |
| 7475 | + } |
| 7476 | + |
| 7477 | + self.element.queue("tabs", function() { |
| 7478 | + showTab(el, $show); |
| 7479 | + }); |
| 7480 | + |
| 7481 | + self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 |
| 7482 | + |
| 7483 | + this.blur(); |
| 7484 | + return false; |
| 7485 | + } |
| 7486 | + } |
| 7487 | + |
| 7488 | + if (o.cookie) { |
| 7489 | + self._cookie(o.selected, o.cookie); |
| 7490 | + } |
| 7491 | + |
| 7492 | + // show new tab |
| 7493 | + if ($show.length) { |
| 7494 | + if ($hide.length) { |
| 7495 | + self.element.queue("tabs", function() { |
| 7496 | + hideTab(el, $hide); |
| 7497 | + }); |
| 7498 | + } |
| 7499 | + self.element.queue("tabs", function() { |
| 7500 | + showTab(el, $show); |
| 7501 | + }); |
| 7502 | + |
| 7503 | + self.load(self.anchors.index(this)); |
| 7504 | + } |
| 7505 | + else { |
| 7506 | + throw 'jQuery UI Tabs: Mismatching fragment identifier.'; |
| 7507 | + } |
| 7508 | + |
| 7509 | + // Prevent IE from keeping other link focussed when using the back button |
| 7510 | + // and remove dotted border from clicked link. This is controlled via CSS |
| 7511 | + // in modern browsers; blur() removes focus from address bar in Firefox |
| 7512 | + // which can become a usability and annoying problem with tabs('rotate'). |
| 7513 | + if ($.browser.msie) { |
| 7514 | + this.blur(); |
| 7515 | + } |
| 7516 | + |
| 7517 | + }); |
| 7518 | + |
| 7519 | + // disable click in any case |
| 7520 | + this.anchors.bind('click.tabs', function(){return false;}); |
| 7521 | + |
| 7522 | + }, |
| 7523 | + |
| 7524 | + destroy: function() { |
| 7525 | + var o = this.options; |
| 7526 | + |
| 7527 | + this.abort(); |
| 7528 | + |
| 7529 | + this.element.unbind('.tabs') |
| 7530 | + .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') |
| 7531 | + .removeData('tabs'); |
| 7532 | + |
| 7533 | + this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
| 7534 | + |
| 7535 | + this.anchors.each(function() { |
| 7536 | + var href = $.data(this, 'href.tabs'); |
| 7537 | + if (href) { |
| 7538 | + this.href = href; |
| 7539 | + } |
| 7540 | + var $this = $(this).unbind('.tabs'); |
| 7541 | + $.each(['href', 'load', 'cache'], function(i, prefix) { |
| 7542 | + $this.removeData(prefix + '.tabs'); |
| 7543 | + }); |
| 7544 | + }); |
| 7545 | + |
| 7546 | + this.lis.unbind('.tabs').add(this.panels).each(function() { |
| 7547 | + if ($.data(this, 'destroy.tabs')) { |
| 7548 | + $(this).remove(); |
| 7549 | + } |
| 7550 | + else { |
| 7551 | + $(this).removeClass([ |
| 7552 | + 'ui-state-default', |
| 7553 | + 'ui-corner-top', |
| 7554 | + 'ui-tabs-selected', |
| 7555 | + 'ui-state-active', |
| 7556 | + 'ui-state-hover', |
| 7557 | + 'ui-state-focus', |
| 7558 | + 'ui-state-disabled', |
| 7559 | + 'ui-tabs-panel', |
| 7560 | + 'ui-widget-content', |
| 7561 | + 'ui-corner-bottom', |
| 7562 | + 'ui-tabs-hide' |
| 7563 | + ].join(' ')); |
| 7564 | + } |
| 7565 | + }); |
| 7566 | + |
| 7567 | + if (o.cookie) { |
| 7568 | + this._cookie(null, o.cookie); |
| 7569 | + } |
| 7570 | + }, |
| 7571 | + |
| 7572 | + add: function(url, label, index) { |
| 7573 | + if (index === undefined) { |
| 7574 | + index = this.anchors.length; // append by default |
| 7575 | + } |
| 7576 | + |
| 7577 | + var self = this, o = this.options, |
| 7578 | + $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), |
| 7579 | + id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); |
| 7580 | + |
| 7581 | + $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); |
| 7582 | + |
| 7583 | + // try to find an existing element before creating a new one |
| 7584 | + var $panel = $('#' + id); |
| 7585 | + if (!$panel.length) { |
| 7586 | + $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); |
| 7587 | + } |
| 7588 | + $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); |
| 7589 | + |
| 7590 | + if (index >= this.lis.length) { |
| 7591 | + $li.appendTo(this.list); |
| 7592 | + $panel.appendTo(this.list[0].parentNode); |
| 7593 | + } |
| 7594 | + else { |
| 7595 | + $li.insertBefore(this.lis[index]); |
| 7596 | + $panel.insertBefore(this.panels[index]); |
| 7597 | + } |
| 7598 | + |
| 7599 | + o.disabled = $.map(o.disabled, |
| 7600 | + function(n, i) { return n >= index ? ++n : n; }); |
| 7601 | + |
| 7602 | + this._tabify(); |
| 7603 | + |
| 7604 | + if (this.anchors.length == 1) { // after tabify |
| 7605 | + $li.addClass('ui-tabs-selected ui-state-active'); |
| 7606 | + $panel.removeClass('ui-tabs-hide'); |
| 7607 | + this.element.queue("tabs", function() { |
| 7608 | + self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); |
| 7609 | + }); |
| 7610 | + |
| 7611 | + this.load(0); |
| 7612 | + } |
| 7613 | + |
| 7614 | + // callback |
| 7615 | + this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); |
| 7616 | + }, |
| 7617 | + |
| 7618 | + remove: function(index) { |
| 7619 | + var o = this.options, $li = this.lis.eq(index).remove(), |
| 7620 | + $panel = this.panels.eq(index).remove(); |
| 7621 | + |
| 7622 | + // If selected tab was removed focus tab to the right or |
| 7623 | + // in case the last tab was removed the tab to the left. |
| 7624 | + if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { |
| 7625 | + this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); |
| 7626 | + } |
| 7627 | + |
| 7628 | + o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), |
| 7629 | + function(n, i) { return n >= index ? --n : n; }); |
| 7630 | + |
| 7631 | + this._tabify(); |
| 7632 | + |
| 7633 | + // callback |
| 7634 | + this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); |
| 7635 | + }, |
| 7636 | + |
| 7637 | + enable: function(index) { |
| 7638 | + var o = this.options; |
| 7639 | + if ($.inArray(index, o.disabled) == -1) { |
| 7640 | + return; |
| 7641 | + } |
| 7642 | + |
| 7643 | + this.lis.eq(index).removeClass('ui-state-disabled'); |
| 7644 | + o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); |
| 7645 | + |
| 7646 | + // callback |
| 7647 | + this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); |
| 7648 | + }, |
| 7649 | + |
| 7650 | + disable: function(index) { |
| 7651 | + var self = this, o = this.options; |
| 7652 | + if (index != o.selected) { // cannot disable already selected tab |
| 7653 | + this.lis.eq(index).addClass('ui-state-disabled'); |
| 7654 | + |
| 7655 | + o.disabled.push(index); |
| 7656 | + o.disabled.sort(); |
| 7657 | + |
| 7658 | + // callback |
| 7659 | + this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); |
| 7660 | + } |
| 7661 | + }, |
| 7662 | + |
| 7663 | + select: function(index) { |
| 7664 | + if (typeof index == 'string') { |
| 7665 | + index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); |
| 7666 | + } |
| 7667 | + else if (index === null) { // usage of null is deprecated, TODO remove in next release |
| 7668 | + index = -1; |
| 7669 | + } |
| 7670 | + if (index == -1 && this.options.collapsible) { |
| 7671 | + index = this.options.selected; |
| 7672 | + } |
| 7673 | + |
| 7674 | + this.anchors.eq(index).trigger(this.options.event + '.tabs'); |
| 7675 | + }, |
| 7676 | + |
| 7677 | + load: function(index) { |
| 7678 | + var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); |
| 7679 | + |
| 7680 | + this.abort(); |
| 7681 | + |
| 7682 | + // not remote or from cache |
| 7683 | + if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { |
| 7684 | + this.element.dequeue("tabs"); |
| 7685 | + return; |
| 7686 | + } |
| 7687 | + |
| 7688 | + // load remote from here on |
| 7689 | + this.lis.eq(index).addClass('ui-state-processing'); |
| 7690 | + |
| 7691 | + if (o.spinner) { |
| 7692 | + var span = $('span', a); |
| 7693 | + span.data('label.tabs', span.html()).html(o.spinner); |
| 7694 | + } |
| 7695 | + |
| 7696 | + this.xhr = $.ajax($.extend({}, o.ajaxOptions, { |
| 7697 | + url: url, |
| 7698 | + success: function(r, s) { |
| 7699 | + $(self._sanitizeSelector(a.hash)).html(r); |
| 7700 | + |
| 7701 | + // take care of tab labels |
| 7702 | + self._cleanup(); |
| 7703 | + |
| 7704 | + if (o.cache) { |
| 7705 | + $.data(a, 'cache.tabs', true); // if loaded once do not load them again |
| 7706 | + } |
| 7707 | + |
| 7708 | + // callbacks |
| 7709 | + self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); |
| 7710 | + try { |
| 7711 | + o.ajaxOptions.success(r, s); |
| 7712 | + } |
| 7713 | + catch (e) {} |
| 7714 | + |
| 7715 | + // last, so that load event is fired before show... |
| 7716 | + self.element.dequeue("tabs"); |
| 7717 | + } |
| 7718 | + })); |
| 7719 | + }, |
| 7720 | + |
| 7721 | + abort: function() { |
| 7722 | + // stop possibly running animations |
| 7723 | + this.element.queue([]); |
| 7724 | + this.panels.stop(false, true); |
| 7725 | + |
| 7726 | + // terminate pending requests from other tabs |
| 7727 | + if (this.xhr) { |
| 7728 | + this.xhr.abort(); |
| 7729 | + delete this.xhr; |
| 7730 | + } |
| 7731 | + |
| 7732 | + // take care of tab labels |
| 7733 | + this._cleanup(); |
| 7734 | + |
| 7735 | + }, |
| 7736 | + |
| 7737 | + url: function(index, url) { |
| 7738 | + this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); |
| 7739 | + }, |
| 7740 | + |
| 7741 | + length: function() { |
| 7742 | + return this.anchors.length; |
| 7743 | + } |
| 7744 | + |
| 7745 | +}); |
| 7746 | + |
| 7747 | +$.extend($.ui.tabs, { |
| 7748 | + version: '1.7.2', |
| 7749 | + getter: 'length', |
| 7750 | + defaults: { |
| 7751 | + ajaxOptions: null, |
| 7752 | + cache: false, |
| 7753 | + cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } |
| 7754 | + collapsible: false, |
| 7755 | + disabled: [], |
| 7756 | + event: 'click', |
| 7757 | + fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } |
| 7758 | + idPrefix: 'ui-tabs-', |
| 7759 | + panelTemplate: '<div></div>', |
| 7760 | + spinner: '<em>Loading…</em>', |
| 7761 | + tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>' |
| 7762 | + } |
| 7763 | +}); |
| 7764 | + |
| 7765 | +/* |
| 7766 | + * Tabs Extensions |
| 7767 | + */ |
| 7768 | + |
| 7769 | +/* |
| 7770 | + * Rotate |
| 7771 | + */ |
| 7772 | +$.extend($.ui.tabs.prototype, { |
| 7773 | + rotation: null, |
| 7774 | + rotate: function(ms, continuing) { |
| 7775 | + |
| 7776 | + var self = this, o = this.options; |
| 7777 | + |
| 7778 | + var rotate = self._rotate || (self._rotate = function(e) { |
| 7779 | + clearTimeout(self.rotation); |
| 7780 | + self.rotation = setTimeout(function() { |
| 7781 | + var t = o.selected; |
| 7782 | + self.select( ++t < self.anchors.length ? t : 0 ); |
| 7783 | + }, ms); |
| 7784 | + |
| 7785 | + if (e) { |
| 7786 | + e.stopPropagation(); |
| 7787 | + } |
| 7788 | + }); |
| 7789 | + |
| 7790 | + var stop = self._unrotate || (self._unrotate = !continuing ? |
| 7791 | + function(e) { |
| 7792 | + if (e.clientX) { // in case of a true click |
| 7793 | + self.rotate(null); |
| 7794 | + } |
| 7795 | + } : |
| 7796 | + function(e) { |
| 7797 | + t = o.selected; |
| 7798 | + rotate(); |
| 7799 | + }); |
| 7800 | + |
| 7801 | + // start rotation |
| 7802 | + if (ms) { |
| 7803 | + this.element.bind('tabsshow', rotate); |
| 7804 | + this.anchors.bind(o.event + '.tabs', stop); |
| 7805 | + rotate(); |
| 7806 | + } |
| 7807 | + // stop rotation |
| 7808 | + else { |
| 7809 | + clearTimeout(self.rotation); |
| 7810 | + this.element.unbind('tabsshow', rotate); |
| 7811 | + this.anchors.unbind(o.event + '.tabs', stop); |
| 7812 | + delete this._rotate; |
| 7813 | + delete this._unrotate; |
| 7814 | + } |
| 7815 | + } |
| 7816 | +}); |
| 7817 | + |
| 7818 | +})(jQuery); |
| 7819 | +/* JavaScript for MediaWIki JS2 */ |
| 7820 | + |
| 7821 | +/** |
| 7822 | + * This is designed to be directly compatible with (and is essentially taken |
| 7823 | + * directly from) the mv_embed code for bringing internationalized messages into |
| 7824 | + * the JavaScript space. As such, if we get to the point of merging that stuff |
| 7825 | + * into the main branch this code will be uneeded and probably cause issues. |
| 7826 | + */ |
| 7827 | +// Creates global message object if not already in existence |
| 7828 | +if ( !gMsg ) var gMsg = {}; |
| 7829 | +if( ! mw ) var mw = { }; |
| 7830 | + |
| 7831 | +/** |
| 7832 | + * Caches a list of messages for later retrieval |
| 7833 | + * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 7834 | + */ |
| 7835 | +if( ! mw.addMessages ){ |
| 7836 | + mw.addMessages = function( msgSet ){ |
| 7837 | + for ( var i in msgSet ){ |
| 7838 | + gMsg[ i ] = msgSet[i]; |
| 7839 | + } |
| 7840 | + } |
| 7841 | +} |
| 7842 | + |
| 7843 | +/** |
| 7844 | + * Retieves a message from the global message cache, performing on-the-fly |
| 7845 | + * replacements using MediaWiki message syntax ($1, $2, etc.) |
| 7846 | + * @param {String} key Name of message as it is in MediaWiki |
| 7847 | + * @param {Array} args Array of replacement arguments |
| 7848 | + */ |
| 7849 | +function gM( key, args ) { |
| 7850 | + var ms = ''; |
| 7851 | + if ( key in gMsg ) { |
| 7852 | + ms = gMsg[ key ]; |
| 7853 | + if ( typeof args == 'object' || typeof args == 'array' ) { |
| 7854 | + for ( var v in args ){ |
| 7855 | + var rep = '\$'+ ( parseInt(v) + 1 ); |
| 7856 | + ms = ms.replace( rep, args[v]); |
| 7857 | + } |
| 7858 | + } else if ( typeof args =='string' || typeof args =='number' ) { |
| 7859 | + ms = ms.replace( /\$1/, args ); |
| 7860 | + } |
| 7861 | + return ms; |
| 7862 | + } else { |
| 7863 | + return '[' + key + ']'; |
| 7864 | + } |
| 7865 | +} |
| 7866 | +/** |
| 7867 | + * Mimics the no-conflict method used by the js2 stuff |
| 7868 | + */ |
| 7869 | +$j = jQuery.noConflict(); |
| 7870 | +/** |
| 7871 | + * Provides js2 compatible onload hook |
| 7872 | + * @param func Function to call when ready |
| 7873 | + */ |
| 7874 | +function mw.addOnloadHook( func ) { |
| 7875 | + $j(document).ready( func ); |
| 7876 | +} |
\ No newline at end of file |
Index: branches/js2-work/phase3/js2/js2stopgap.js |
— | — | @@ -9510,4 +9510,4 @@ |
9511 | 9511 | } |
9512 | 9512 | |
9513 | 9513 | // Define a dummy mw.load() function |
9514 | | -mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
| 9514 | +mw.load = function ( callback ) { callback() } |
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js |
— | — | @@ -1966,14 +1966,6 @@ |
1967 | 1967 | |
1968 | 1968 | |
1969 | 1969 | /* |
1970 | | -* js2AddOnloadHook depreciated use mw.addOnloadHook instead |
1971 | | -*/ |
1972 | | -function js2AddOnloadHook( func ) { |
1973 | | - mw.addOnloadHook( func ); |
1974 | | -} |
1975 | | - |
1976 | | - |
1977 | | -/* |
1978 | 1970 | * Store all the mwEmbed jQuery-specific bindings |
1979 | 1971 | * (set up after jQuery is available). |
1980 | 1972 | * |
Index: branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | | - function getInlineLoadGMFromClass( $class ){ |
| 460 | + function getInlineMesgFromClass( $class ){ |
461 | 461 | $jsmsg = $this->getMsgKeysFromClass( $class ); |
462 | 462 | if( $jsmsg ){ |
463 | 463 | self::getMsgKeys ( $jsmsg ); |