<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12" height="12" viewBox="0, 0, 12, 12">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px"
+ height="12px" viewBox="0 0 12 12">
<g id="deprecated" opacity="0.75">
- <path d="M6,12 C2.686,12 -0,9.314 -0,6 C-0,2.686 2.686,-0 6,-0 C9.314,-0 12,2.686 12,6 C12,9.314 9.314,12 6,12 z M5,7 L7,7 L7,2 L5,2 z M5,10 L7,10 L7,8 L5,8 z" fill="#000000"/>
+ <path d="M6,12 C2.686,12 -0,9.314 -0,6 C-0,2.686 2.686,-0 6,-0 C9.314,-0 12,2.686 12,6 C12,9.314 9.314,12 6,12 z M5,7 L7,7 L7,2 L5,2 z M5,10 L7,10 L7,8 L5,8 z"/>
</g>
<defs/>
</svg>
/*!
- * OOjs UI v0.1.0-pre (c5ae888f67)
+ * OOjs UI v0.1.0-pre (7a0e222a75)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: Wed Jun 11 2014 18:10:09 GMT-0700 (PDT)
+ * Date: Wed Jun 18 2014 16:19:15 GMT-0700 (PDT)
*/
( function ( OO ) {
// Configuration initialization
config = config || {};
- var anim = {},
+ var rel, anim = {},
callback = typeof config.complete === 'function' && config.complete,
sc = this.getClosestScrollableContainer( el, config.direction ),
$sc = $( sc ),
eld = this.getDimensions( el ),
scd = this.getDimensions( sc ),
+ $win = $( this.getWindow( el ) );
+
+ // Compute the distances between the edges of el and the edges of the scroll viewport
+ if ( $sc.is( 'body' ) ) {
+ // If the scrollable container is the <body> this is easy
+ rel = {
+ 'top': eld.rect.top,
+ 'bottom': $win.innerHeight() - eld.rect.bottom,
+ 'left': eld.rect.left,
+ 'right': $win.innerWidth() - eld.rect.right
+ };
+ } else {
+ // Otherwise, we have to subtract el's coordinates from sc's coordinates
rel = {
'top': eld.rect.top - ( scd.rect.top + scd.borders.top ),
'bottom': scd.rect.bottom - scd.borders.bottom - scd.scrollbar.bottom - eld.rect.bottom,
'left': eld.rect.left - ( scd.rect.left + scd.borders.left ),
'right': scd.rect.right - scd.borders.right - scd.scrollbar.right - eld.rect.right
};
+ }
if ( !config.direction || config.direction === 'y' ) {
if ( rel.top < 0 ) {
/**
* Bind a handler for an event on this.$element
*
+ * @deprecated Use jQuery#on instead.
* @param {string} event
* @param {Function} callback
*/
/**
* Unbind a handler bound with #offDOMEvent
*
+ * @deprecated Use jQuery#off instead.
* @param {string} event
* @param {Function} callback
*/
};
( function () {
- // Static
-
- // jQuery 1.8.3 has a bug with handling focusin/focusout events inside iframes.
- // Firefox doesn't support focusin/focusout at all, so we listen for 'focus'/'blur' on the
- // document, and simulate a 'focusin'/'focusout' event on the target element and make
- // it bubble from there.
- //
- // - http://jsfiddle.net/sw3hr/
- // - http://bugs.jquery.com/ticket/14180
- // - https://github.com/jquery/jquery/commit/1cecf64e5aa4153
- function specialEvent( simulatedName, realName ) {
- function handler( e ) {
- jQuery.event.simulate(
- simulatedName,
- e.target,
- jQuery.event.fix( e ),
- /* bubble = */ true
- );
- }
-
- return {
- setup: function () {
- var doc = this.ownerDocument || this,
- attaches = $.data( doc, 'ooui-' + simulatedName + '-attaches' );
- if ( !attaches ) {
- doc.addEventListener( realName, handler, true );
- }
- $.data( doc, 'ooui-' + simulatedName + '-attaches', ( attaches || 0 ) + 1 );
- },
- teardown: function () {
- var doc = this.ownerDocument || this,
- attaches = $.data( doc, 'ooui-' + simulatedName + '-attaches' ) - 1;
- if ( !attaches ) {
- doc.removeEventListener( realName, handler, true );
- $.removeData( doc, 'ooui-' + simulatedName + '-attaches' );
- } else {
- $.data( doc, 'ooui-' + simulatedName + '-attaches', attaches );
- }
- }
- };
- }
-
- var hasOwn = Object.prototype.hasOwnProperty,
- specialEvents = {
- focusin: specialEvent( 'focusin', 'focus' ),
- focusout: specialEvent( 'focusout', 'blur' )
- };
-
/**
* Bind a handler for an event on a DOM element.
*
- * Uses jQuery internally for everything except for events which are
- * known to have issues in the browser or in jQuery. This method
- * should become obsolete eventually.
+ * Used to be for working around a jQuery bug (jqbug.com/14180),
+ * but obsolete as of jQuery 1.11.0.
*
* @static
+ * @deprecated Use jQuery#on instead.
* @param {HTMLElement|jQuery} el DOM element
* @param {string} event Event to bind
* @param {Function} callback Callback to call when the event fires
*/
OO.ui.Element.onDOMEvent = function ( el, event, callback ) {
- var orig;
-
- if ( hasOwn.call( specialEvents, event ) ) {
- // Replace jQuery's override with our own
- orig = $.event.special[event];
- $.event.special[event] = specialEvents[event];
-
- $( el ).on( event, callback );
-
- // Restore
- $.event.special[event] = orig;
- } else {
- $( el ).on( event, callback );
- }
+ $( el ).on( event, callback );
};
/**
* Unbind a handler bound with #static-method-onDOMEvent.
*
+ * @deprecated Use jQuery#off instead.
* @static
* @param {HTMLElement|jQuery} el DOM element
* @param {string} event Event to unbind
* @param {Function} [callback] Callback to unbind
*/
OO.ui.Element.offDOMEvent = function ( el, event, callback ) {
- var orig;
- if ( hasOwn.call( specialEvents, event ) ) {
- // Replace jQuery's override with our own
- orig = $.event.special[event];
- $.event.special[event] = specialEvents[event];
-
- $( el ).off( event, callback );
-
- // Restore
- $.event.special[event] = orig;
- } else {
- $( el ).off( event, callback );
- }
+ $( el ).off( event, callback );
};
}() );
/**
// Open the window
this.opening = $.Deferred();
+
+ // So we can restore focus on closing
+ this.$prevFocus = $( document.activeElement );
+
this.frame.load().done( OO.ui.bind( function () {
this.$element.show();
this.visible = true;
this.opened.resolve();
}
this.$element.hide();
+ // Restore focus to whatever was focused before opening
+ if ( this.$prevFocus ) {
+ this.$prevFocus.focus();
+ this.$prevFocus = undefined;
+ }
this.visible = false;
this.closing.resolve();
// Now that we are totally done closing, it's safe to allow opening
this.$element.on( 'mousedown', false );
// Initialization
- this.$element.addClass( 'oo-ui-dialog' );
+ this.$element.addClass( 'oo-ui-dialog' ).attr( 'role', 'dialog' );
this.setSize( config.size );
};