1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update player selection dialog

This commit is contained in:
Luke Pulverenti 2015-08-30 13:26:30 -04:00
parent f0f5c26a2c
commit c80c66b498
10 changed files with 258 additions and 296 deletions

View file

@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-meta", "homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
}, },
"_source": "git://github.com/polymerelements/iron-meta.git", "_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta" "_originalSource": "PolymerElements/iron-meta"
} }

View file

@ -282,7 +282,8 @@
"SetAudioStreamIndex", "SetAudioStreamIndex",
"SetSubtitleStreamIndex", "SetSubtitleStreamIndex",
"DisplayContent", "DisplayContent",
"SetRepeatMode" "SetRepeatMode",
"EndSession"
]; ];
return target; return target;
@ -664,6 +665,17 @@
} }
}; };
self.endSession = function () {
if (currentDevice) {
currentDevice.disconnect();
}
cleanupSession();
currentDevice = null;
currentDeviceId = null;
};
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) { $(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
if (newTarget.id != currentDeviceId) { if (newTarget.id != currentDeviceId) {
@ -675,7 +687,6 @@
cleanupSession(); cleanupSession();
currentDevice = null; currentDevice = null;
currentDeviceId = null; currentDeviceId = null;
self.lastPlayerData = {};
} }
} }
}); });

View file

@ -421,6 +421,10 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
margin-top: 0 !important; margin-top: 0 !important;
} }
.backdropPage .noBackdrop {
background-color: transparent;
}
.itemBackdropContent { .itemBackdropContent {
position: absolute; position: absolute;
bottom: 0; bottom: 0;

View file

@ -705,7 +705,8 @@
"SetAudioStreamIndex", "SetAudioStreamIndex",
"SetSubtitleStreamIndex", "SetSubtitleStreamIndex",
"DisplayContent", "DisplayContent",
"SetRepeatMode"] "SetRepeatMode",
"EndSession"]
}; };
}; };
@ -778,6 +779,11 @@
}); });
}; };
self.endSession = function () {
castPlayer.stopApp();
};
self.volumeUp = function () { self.volumeUp = function () {
castPlayer.sendMessage({ castPlayer.sendMessage({

View file

@ -68,10 +68,13 @@
renderDetails(page, item, context); renderDetails(page, item, context);
var hasBackdrop = LibraryBrowser.renderDetailPageBackdrop(page, item); var hasBackdrop = LibraryBrowser.renderDetailPageBackdrop(page, item);
//$('#itemBackdrop', page).addClass('noBackdrop').css('background-image', 'none');
//Backdrops.setBackdrops(page, [item]);
// For these types, make the backdrop a little smaller so that the items are more quickly accessible // For these types, make the backdrop a little smaller so that the items are more quickly accessible
if (item.Type == "Season" || item.Type == "MusicArtist" || item.Type == "MusicAlbum" || item.Type == "Series" || item.Type == "Playlist" || item.Type == "BoxSet") { if (item.Type == 'MusicArtist' || item.Type == "MusicAlbum" || item.Type == "Playlist" || item.Type == "BoxSet" || item.Type == "Audio") {
$('#itemBackdrop', page).addClass('noBackdrop').css('background-image', 'none');
Backdrops.setBackdrops(page, [item]);
}
else if (item.Type == "Season" || item.Type == "Series") {
page.querySelector('#itemBackdrop').classList.add('smallBackdrop'); page.querySelector('#itemBackdrop').classList.add('smallBackdrop');
} else { } else {
page.querySelector('#itemBackdrop').classList.remove('smallBackdrop'); page.querySelector('#itemBackdrop').classList.remove('smallBackdrop');
@ -411,7 +414,7 @@
var topOverview = page.querySelector('.topOverview'); var topOverview = page.querySelector('.topOverview');
var bottomOverview = page.querySelector('.bottomOverview'); var bottomOverview = page.querySelector('.bottomOverview');
var seasonOnBottom = screen.availHeight < 600 || screen.availWidth < 600; var seasonOnBottom = screen.availHeight < 800 || screen.availWidth < 600;
if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom) || (item.Type == 'Series' && seasonOnBottom)) { if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom) || (item.Type == 'Series' && seasonOnBottom)) {
LibraryBrowser.renderOverview([bottomOverview], item); LibraryBrowser.renderOverview([bottomOverview], item);
@ -647,14 +650,20 @@
return; return;
} }
var shape = item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? "detailPageSquare" : "detailPagePortrait";
var screenWidth = $(window).width(); var screenWidth = $(window).width();
var screenHeight = $(window).height();
var options = { var options = {
userId: Dashboard.getCurrentUserId(), userId: Dashboard.getCurrentUserId(),
limit: screenWidth > 800 ? 5 : 4, limit: screenWidth > 800 && shape == "detailPagePortrait" ? 5 : 4,
fields: "PrimaryImageAspectRatio,UserData,SyncInfo" fields: "PrimaryImageAspectRatio,UserData,SyncInfo"
}; };
if (screenWidth >= 800 && screenHeight >= 1000) {
options.limit *= 2;
}
ApiClient.getSimilarItems(item.Id, options).done(function (result) { ApiClient.getSimilarItems(item.Id, options).done(function (result) {
if (!result.Items.length) { if (!result.Items.length) {
@ -669,7 +678,7 @@
var html = LibraryBrowser.getPosterViewHtml({ var html = LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
shape: item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? "detailPageSquare" : "detailPagePortrait", shape: shape,
showParentTitle: item.Type == "MusicAlbum", showParentTitle: item.Type == "MusicAlbum",
centerText: true, centerText: true,
showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist", showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist",

View file

@ -64,119 +64,110 @@
}); });
} }
function getTargetsHtml(targets) { function showPlayerSelection() {
var playerInfo = MediaController.getPlayerInfo(); var playerInfo = MediaController.getPlayerInfo();
if (!playerInfo.isLocalPlayer) {
showActivePlayerMenu(playerInfo);
return;
}
Dashboard.showModalLoadingMsg();
MediaController.getTargets().done(function (targets) {
var menuItems = targets.map(function (t) {
var name = t.name;
if (t.appName && t.appName != t.name) {
name += " - " + t.appName;
}
return {
name: name,
id: t.id,
ironIcon: 'tablet-android'
};
});
require(['actionsheet'], function () {
Dashboard.hideModalLoadingMsg();
ActionSheetElement.show({
title: Globalize.translate('HeaderSelectPlayer'),
items: menuItems,
callback: function (id) {
var target = targets.filter(function (t) {
return t.id == id;
})[0];
MediaController.trySetActivePlayer(target.playerName, target);
mirrorIfEnabled();
}
});
});
});
}
function showActivePlayerMenu(playerInfo) {
var id = 'dlg' + new Date().getTime();
var html = ''; var html = '';
html += '<form>';
html += '<h3>' + Globalize.translate('HeaderSelectPlayer') + '</h3>'; var style = "";
html += '<fieldset data-role="controlgroup" data-mini="true">';
var checkedHtml; html += '<paper-dialog id="' + id + '" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop style="' + style + '">';
for (var i = 0, length = targets.length; i < length; i++) { html += '<h2>';
html += (playerInfo.deviceName || playerInfo.name);
html += '</h2>';
var target = targets[i]; html += '<div style="padding:0 2em;">';
var id = 'radioPlayerTarget' + i; if (playerInfo.supportedCommands.indexOf('DisplayContent') != -1) {
var isChecked = target.id == playerInfo.id; html += '<div>';
checkedHtml = isChecked ? ' checked="checked"' : ''; var checkedHtml = MediaController.enableDisplayMirroring() ? ' checked' : '';
html += '<paper-checkbox class="chkMirror"' + checkedHtml + '>' + Globalize.translate('OptionEnableDisplayMirroring') + '</paper-checkbox>';
var mirror = (!target.isLocalPlayer && target.supportedCommands.indexOf('DisplayContent') != -1) ? 'true' : 'false'; html += '</div>';
html += '<input type="radio" class="radioSelectPlayerTarget" name="radioSelectPlayerTarget" data-mirror="' + mirror + '" data-commands="' + target.supportedCommands.join(',') + '" data-mediatypes="' + target.playableMediaTypes.join(',') + '" data-playername="' + target.playerName + '" data-targetid="' + target.id + '" data-targetname="' + target.name + '" data-devicename="' + (target.deviceName || '') + '" id="' + id + '" value="' + target.id + '"' + checkedHtml + '>';
html += '<label for="' + id + '" style="font-weight:normal;">' + target.name;
if (target.appName && target.appName != target.name) {
html += '<br/><span>' + target.appName + '</span>';
} }
html += '</label>';
}
html += '</fieldset>';
html += '<p class="fieldDescription">' + Globalize.translate('LabelAllPlaysSentToPlayer') + '</p>';
checkedHtml = MediaController.enableDisplayMirroring() ? ' checked="checked"' : '';
html += '<div style="margin-top:1.5em;" class="fldMirrorMode"><label for="chkEnableMirrorMode">' + Globalize.translate('OptionEnableDisplayMirroring') + '</label><input type="checkbox" class="chkEnableMirrorMode" id="chkEnableMirrorMode" data-mini="true"' + checkedHtml + ' /></div>';
html += '</form>';
return html;
}
function showPlayerSelection() {
var promise = MediaController.getTargets();
var html = '<div data-role="panel" data-position="right" data-display="overlay" data-position-fixed="true" id="playerSelectionPanel" data-theme="a">';
html += '<div class="players"></div>';
html += '<br/>';
html += '<p><a href="nowplaying.html" class="clearLink"><paper-button raised class="block"><iron-icon icon="tablet-android"></iron-icon><span>' + Globalize.translate('ButtonRemoteControl') + '</span></paper-button></a></p>';
html += '</div>'; html += '</div>';
html += '<div class="buttons">';
html += '<paper-button onclick="Dashboard.navigate(\'nowplaying.html\');" dialog-dismiss>' + Globalize.translate('ButtonRemoteControl') + '</paper-button>';
html += '<paper-button dialog-dismiss onclick="MediaController.disconnectFromPlayer();">' + Globalize.translate('ButtonDisconnect') + '</paper-button>';
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>';
html += '</div>';
html += '</paper-dialog>';
$(document.body).append(html); $(document.body).append(html);
require(['jqmicons']); setTimeout(function () {
var elem = $('#playerSelectionPanel').panel({}).trigger('create').panel("open").on("panelclose", function () { var dlg = document.getElementById(id);
$(this).off("panelclose").remove(); $('.chkMirror', dlg).on('change', onMirrorChange);
dlg.open();
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', function () {
$(this).remove();
}); });
promise.done(function (targets) { }, 100);
}
$('.players', elem).html(getTargetsHtml(targets)).trigger('create'); function onMirrorChange() {
$('.chkEnableMirrorMode', elem).on('change', function () {
MediaController.enableDisplayMirroring(this.checked); MediaController.enableDisplayMirroring(this.checked);
});
$('.radioSelectPlayerTarget', elem).off('change').on('change', function () {
var supportsMirror = this.getAttribute('data-mirror') == 'true';
if (supportsMirror) {
$('.fldMirrorMode', elem).show();
} else {
$('.fldMirrorMode', elem).hide();
}
var playerName = this.getAttribute('data-playername');
var targetId = this.getAttribute('data-targetid');
var targetName = this.getAttribute('data-targetname');
var deviceName = this.getAttribute('data-deviceName');
var playableMediaTypes = this.getAttribute('data-mediatypes').split(',');
var supportedCommands = this.getAttribute('data-commands').split(',');
MediaController.trySetActivePlayer(playerName, {
id: targetId,
name: targetName,
playableMediaTypes: playableMediaTypes,
supportedCommands: supportedCommands,
deviceName: deviceName
});
mirrorIfEnabled();
});
if ($('.radioSelectPlayerTarget:checked', elem)[0].getAttribute('data-mirror') == 'true') {
$('.fldMirrorMode', elem).show();
} else {
$('.fldMirrorMode', elem).hide();
}
});
} }
function bindKeys(controller) { function bindKeys(controller) {
@ -369,6 +360,36 @@
} }
}; };
self.disconnectFromPlayer = function () {
var playerInfo = self.getPlayerInfo();
if (playerInfo.supportedCommands.indexOf('EndSession') != -1) {
var options = {
callback: function (result) {
if (result == 0) {
MediaController.getCurrentPlayer().endSession();
}
if (result != 2) {
self.setDefaultPlayerActive();
}
},
message: Globalize.translate('ConfirmEndPlayerSession'),
title: Globalize.translate('HeaderDisconnectFromPlayer'),
buttons: [Globalize.translate('ButtonYes'), Globalize.translate('ButtonNo'), Globalize.translate('ButtonCancel')]
};
Dashboard.dialog(options);
} else {
self.setDefaultPlayerActive();
}
};
self.getPlayers = function () { self.getPlayers = function () {
return players; return players;
}; };

View file

@ -20,7 +20,6 @@ $.support.cors = true;
$(document).one('click', WebNotifications.requestPermission); $(document).one('click', WebNotifications.requestPermission);
var Dashboard = { var Dashboard = {
jQueryMobileInit: function () { jQueryMobileInit: function () {
// Page // Page
@ -244,8 +243,7 @@ var Dashboard = {
if (document.createStyleSheet) { if (document.createStyleSheet) {
document.createStyleSheet(url); document.createStyleSheet(url);
} } else {
else {
var link = document.createElement('link'); var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet'); link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css'); link.setAttribute('type', 'text/css');
@ -599,6 +597,75 @@ var Dashboard = {
} }
}, },
dialog: function (options) {
var title = options.title;
var message = options.message;
var buttons = options.buttons;
var callback = options.callback;
// Cordova
if (navigator.notification && navigator.notification.confirm && message.indexOf('<') == -1) {
navigator.notification.confirm(message, function (index) {
callback(index);
}, title, buttons.join(','));
} else {
Dashboard.dialogInternal(message, title, buttons, callback);
}
},
dialogInternal: function (message, title, buttons, callback) {
var id = 'paperdlg' + new Date().getTime();
var html = '<paper-dialog id="' + id + '" role="alertdialog" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop>';
html += '<h2>' + title + '</h2>';
html += '<div>' + message + '</div>';
html += '<div class="buttons">';
var index = 0;
html += buttons.map(function (b) {
var dataIndex = ' data-index="' + index + '"';
index++;
return '<paper-button class="dialogButton"' + dataIndex + ' dialog-dismiss>' + b + '</paper-button>';
}).join('');
html += '</div>';
html += '</paper-dialog>';
$(document.body).append(html);
// This timeout is obviously messy but it's unclear how to determine when the webcomponent is ready for use
// element onload never fires
setTimeout(function () {
var dlg = document.getElementById(id);
$('.dialogButton', dlg).on('click', function () {
if (callback) {
callback(parseInt(this.getAttribute('data-index')));
}
});
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', function (e) {
this.parentNode.removeChild(this);
});
dlg.open();
}, 300);
},
confirm: function (message, title, callback) { confirm: function (message, title, callback) {
// Cordova // Cordova
@ -619,8 +686,6 @@ var Dashboard = {
confirmInternal: function (message, title, showCancel, callback) { confirmInternal: function (message, title, showCancel, callback) {
require(['paperbuttonstyle'], function () {
var id = 'paperdlg' + new Date().getTime(); var id = 'paperdlg' + new Date().getTime();
var html = '<paper-dialog id="' + id + '" role="alertdialog" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop>'; var html = '<paper-dialog id="' + id + '" role="alertdialog" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop>';
@ -628,12 +693,12 @@ var Dashboard = {
html += '<div>' + message + '</div>'; html += '<div>' + message + '</div>';
html += '<div class="buttons">'; html += '<div class="buttons">';
html += '<paper-button class="btnConfirm" dialog-confirm autofocus>' + Globalize.translate('ButtonOk') + '</paper-button>';
if (showCancel) { if (showCancel) {
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>'; html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>';
} }
html += '<paper-button class="btnConfirm" dialog-confirm autofocus>' + Globalize.translate('ButtonOk') + '</paper-button>';
html += '</div>'; html += '</div>';
html += '</paper-dialog>'; html += '</paper-dialog>';
@ -658,7 +723,6 @@ var Dashboard = {
dlg.open(); dlg.open();
}, 300); }, 300);
});
}, },
refreshSystemInfoFromServer: function () { refreshSystemInfoFromServer: function () {

View file

@ -860,5 +860,10 @@
"OptionBudget": "Budget", "OptionBudget": "Budget",
"ForAdditionalLiveTvOptions": "For additional Live TV providers, click on the External Services tab to see the available options.", "ForAdditionalLiveTvOptions": "For additional Live TV providers, click on the External Services tab to see the available options.",
"ButtonGuide": "Guide", "ButtonGuide": "Guide",
"ButtonRecordedTv": "Recorded TV" "ButtonRecordedTv": "Recorded TV",
"HeaderDisconnectFromPlayer": "Disconnect from Player",
"ConfirmEndPlayerSession": "Would you like to shutdown the app on the remote device?",
"ButtonDisconnect": "Disconnect",
"ButtonYes": "Yes",
"ButtonNo": "No"
} }

View file

@ -421,7 +421,7 @@
"ButtonScenes": "Scenes", "ButtonScenes": "Scenes",
"ButtonQuality": "Quality", "ButtonQuality": "Quality",
"HeaderNotifications": "Notifications", "HeaderNotifications": "Notifications",
"HeaderSelectPlayer": "Select Player:", "HeaderSelectPlayer": "Select Player",
"ButtonSelect": "Select", "ButtonSelect": "Select",
"ButtonNew": "New", "ButtonNew": "New",
"MessageInternetExplorerWebm": "For best results with Internet Explorer please install the WebM playback plugin.", "MessageInternetExplorerWebm": "For best results with Internet Explorer please install the WebM playback plugin.",
@ -860,6 +860,7 @@
"OptionDatePlayed": "Date Played", "OptionDatePlayed": "Date Played",
"OptionDateAdded": "Date Added", "OptionDateAdded": "Date Added",
"OptionPlayCount": "Play Count", "OptionPlayCount": "Play Count",
"ButtonDisconnect": "Disconnect",
"ButtonSort": "Sort", "ButtonSort": "Sort",
"ButtonMenu": "Menu", "ButtonMenu": "Menu",
"ButtonFilter": "Filter", "ButtonFilter": "Filter",
@ -870,5 +871,9 @@
"OptionBudget": "Budget", "OptionBudget": "Budget",
"ForAdditionalLiveTvOptions": "For additional Live TV providers, click on the External Services tab to see the available options.", "ForAdditionalLiveTvOptions": "For additional Live TV providers, click on the External Services tab to see the available options.",
"ButtonGuide": "Guide", "ButtonGuide": "Guide",
"ButtonRecordedTv": "Recorded TV" "ButtonRecordedTv": "Recorded TV",
"HeaderDisconnectFromPlayer": "Disconnect from Player",
"ConfirmEndPlayerSession": "Would you like to shutdown the app on the remote device?",
"ButtonYes": "Yes",
"ButtonNo": "No"
} }

View file

@ -307,96 +307,6 @@
timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay ); timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
}; };
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
window.attachEvent && !window.addEventListener && !supports_onhashchange && (function(){
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
// when running in "IE7 compatibility" mode.
var iframe,
iframe_src;
// When the event is bound and polling starts in IE 6/7, create a hidden
// Iframe for history handling.
self.start = function(){
if ( !iframe ) {
iframe_src = $.fn[ str_hashchange ].src;
iframe_src = iframe_src && iframe_src + get_fragment();
// Create hidden Iframe. Attempt to make Iframe as hidden as possible
// by using techniques from http://www.paciellogroup.com/blog/?p=604.
iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
// When Iframe has completely loaded, initialize the history and
// start polling.
.one( 'load', function(){
iframe_src || history_set( get_fragment() );
poll();
})
// Load Iframe src if specified, otherwise nothing.
.attr( 'src', iframe_src || 'javascript:0' )
// Append Iframe after the end of the body to prevent unnecessary
// initial page scrolling (yes, this works).
.insertAfter( 'body' )[0].contentWindow;
// Whenever `document.title` changes, update the Iframe's title to
// prettify the back/next history menu entries. Since IE sometimes
// errors with "Unspecified error" the very first time this is set
// (yes, very useful) wrap this with a try/catch block.
doc.onpropertychange = function(){
try {
if ( event.propertyName === 'title' ) {
iframe.document.title = doc.title;
}
} catch(e) {}
};
}
};
// Override the "stop" method since an IE6/7 Iframe was created. Even
// if there are no longer any bound event handlers, the polling loop
// is still necessary for back/next to work at all!
self.stop = fn_retval;
// Get history by looking at the hidden Iframe's location.hash.
history_get = function() {
return get_fragment( iframe.location.href );
};
// Set a new history item by opening and then closing the Iframe
// document, *then* setting its location.hash. If document.domain has
// been set, update that as well.
history_set = function( hash, history_hash ) {
var iframe_doc = iframe.document,
domain = $.fn[ str_hashchange ].domain;
if ( hash !== history_hash ) {
// Update Iframe with any initial `document.title` that might be set.
iframe_doc.title = doc.title;
// Opening the Iframe's document after it has been closed is what
// actually adds a history entry.
iframe_doc.open();
// Set document.domain for the Iframe document as well, if necessary.
domain && iframe_doc.write( '\x3cscript>document.domain="' + domain + '"\x3c/script>' );
iframe_doc.close();
// Update the Iframe's hash, for great justice.
iframe.location.hash = hash;
}
};
})();
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return self; return self;
})(); })();
@ -747,79 +657,6 @@ $.extend( $.expr[ ":" ], {
} }
}); });
// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};
function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}
$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}
return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};
$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}
return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}
// support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
$.fn.removeData = (function( removeData ) {
return function( key ) {
if ( arguments.length ) {
return removeData.call( this, $.camelCase( key ) );
} else {
return removeData.call( this );
}
};
})( $.fn.removeData );
}
// deprecated // deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );