animate now playing bar

This commit is contained in:
Luke Pulverenti 2015-11-30 00:33:29 -05:00
parent 4a80f8d99b
commit 7dd1eedf26
21 changed files with 3722 additions and 6204 deletions

View File

@ -30,6 +30,6 @@
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
},
"_source": "git://github.com/desandro/eventie.git",
"_target": "~1.0.3",
"_target": "^1",
"_originalSource": "eventie"
}

View File

@ -32,14 +32,14 @@
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/paper-ripple",
"homepage": "https://github.com/PolymerElements/paper-ripple",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
},
"_source": "git://github.com/polymerelements/paper-ripple.git",
"_source": "git://github.com/PolymerElements/paper-ripple.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-ripple"
"_originalSource": "PolymerElements/paper-ripple"
}

View File

@ -0,0 +1,80 @@
define(function () {
var requireCss = {};
requireCss.normalize = function (name, normalize) {
if (name.substr(name.length - 4, 4) == '.css')
name = name.substr(0, name.length - 4);
return normalize(name);
}
var importedCss = [];
function isLoaded(url) {
return importedCss.indexOf(url) != -1;
}
function removeFromLoadHistory(url) {
url = url.toLowerCase();
importedCss = importedCss.filter(function (c) {
return url.indexOf(c.toLowerCase()) == -1;
});
}
requireCss.load = function (cssId, req, load, config) {
// Somehow if the url starts with /css, require will get all screwed up since this extension is also called css
cssId = cssId.replace('js/requirecss', 'css');
var url = cssId + '.css';
var packageName = '';
// TODO: handle any value before the #
if (url.indexOf('theme#') != -1) {
url = url.replace('theme#', '');
packageName = 'theme';
}
if (url.indexOf('http') != 0 && url.indexOf('file:') != 0) {
url = config.baseUrl + url;
}
if (!isLoaded(url)) {
importedCss.push(url);
var link = document.createElement('link');
if (packageName) {
link.setAttribute('data-package', packageName);
}
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.onload = load;
link.setAttribute('href', url + "?" + config.urlArgs);
document.head.appendChild(link);
} else {
load();
}
}
window.requireCss = {
unloadPackage: function (packageName) {
// Todo: unload css here
var stylesheets = document.head.querySelectorAll("link[data-package='" + packageName + "']");
for (var i = 0, length = stylesheets.length; i < length; i++) {
var stylesheet = stylesheets[i];
Logger.log('Unloading stylesheet: ' + stylesheet.href);
stylesheet.parentNode.removeChild(stylesheet);
removeFromLoadHistory(stylesheet.href);
}
}
};
return requireCss;
});

View File

@ -64,7 +64,9 @@
background-color: rgba(26,26,26,.94);
border-top: 1px solid #444;
text-align: center;
/*box-shadow: 0 0 8px rgba(255,255,255,.4);*/
display: flex;
flex-direction: row;
align-items: center;
}
.hiddenNowPlayingBar .nowPlayingBar {
@ -91,10 +93,6 @@
}
.nowPlayingBarInfoContainer {
vertical-align: middle;
position: absolute;
left: 0;
bottom: 0;
}
.nowPlayingImage {
@ -166,9 +164,11 @@
vertical-align: middle;
text-align: center;
margin-top: 12px;
position: relative;
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
z-index: 2;
position: absolute;
left: 0;
right: 0;
}
.nowPlayingBarPositionContainer {
@ -210,10 +210,8 @@
}
.nowPlayingBarRight {
position: absolute;
bottom: 12px;
right: 10px;
vertical-align: middle;
position: relative;
margin: 0 1em 0 auto;
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
z-index: 2;
}
@ -255,18 +253,14 @@
.nowPlayingBar .playlistButton {
display: none !important;
}
.nowPlayingBarRight {
bottom: 18px;
}
}
@media all and (max-width: 800px) {
.nowPlayingBarCurrentTime {
padding-left: 0;
top: 12px;
right: 130px;
top: 22px;
right: 140px;
position: absolute;
}
@ -274,10 +268,6 @@
display: none !important;
}
.nowPlayingBarRight {
bottom: 10px;
}
.nowPlayingBar, .nowPlayingImage img {
height: 70px;
}

View File

@ -6,18 +6,16 @@
// positionTo
// showCancel
// title
var id = 'dlg' + new Date().getTime();
var html = '';
var style = "";
var windowHeight = $(window).height();
var pos;
// If the window height is under a certain amount, don't bother trying to position
// based on an element.
if (options.positionTo && windowHeight >= 540) {
var pos = $(options.positionTo).offset();
pos = $(options.positionTo).offset();
pos.top += $(options.positionTo).innerHeight() / 2;
pos.left += $(options.positionTo).innerWidth() / 2;
@ -41,12 +39,8 @@
// Do some boundary checking
pos.top = Math.max(pos.top, 0);
pos.left = Math.max(pos.left, 0);
style += 'position:fixed;top:' + pos.top + 'px;left:' + pos.left + 'px';
}
html += '<paper-dialog id="' + id + '" with-backdrop style="' + style + '">';
if (options.title) {
html += '<h2>';
html += options.title;
@ -93,57 +87,62 @@
html += '</div>';
}
html += '</paper-dialog>';
var dlg = document.createElement('paper-dialog');
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.innerHTML = html;
$(document.body).append(html);
if (pos) {
dlg.style.position = 'fixed';
dlg.style.left = pos.left + 'px';
dlg.style.top = pos.top + 'px';
}
document.body.appendChild(dlg);
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
if (browserInfo.chrome) {
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
}
setTimeout(function () {
var dlg = document.getElementById(id);
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
if (browserInfo.chrome) {
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
}
dlg.open();
}, 10);
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', function () {
$(this).remove();
});
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function () {
dlg.parentNode.removeChild(dlg);
});
// Seeing an issue in some non-chrome browsers where this is requiring a double click
var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown';
// Seeing an issue in some non-chrome browsers where this is requiring a double click
var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown';
$('.actionSheetMenuItem', dlg).on(eventName, function () {
$('.actionSheetMenuItem', dlg).on(eventName, function () {
var selectedId = this.getAttribute('data-id');
var selectedId = this.getAttribute('data-id');
// Add a delay here to allow the click animation to finish, for nice effect
setTimeout(function () {
// Add a delay here to allow the click animation to finish, for nice effect
setTimeout(function () {
dlg.close();
dlg.close();
if (options.callback) {
options.callback(selectedId);
}
if (options.callback) {
options.callback(selectedId);
}
}, 100);
});
}, 100);
}, 100);
});
}
window.ActionSheetElement = {

View File

@ -849,9 +849,6 @@
});
}
requirejs(["thirdparty/cast_sender"], function () {
initializeChromecast();
});
requirejs(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"], initializeChromecast);
})(window, window.chrome, console);

View File

@ -2793,6 +2793,24 @@
dlg.entryAnimation = 'fade-in-animation';
dlg.exitAnimation = 'fade-out-animation';
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
if (browserInfo.chrome) {
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
}
var html = '';
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height

View File

@ -24,24 +24,28 @@
function slideDown(elem, iterations) {
var keyframes = [
{ height: '100%', offset: 0 },
{ height: '0', display: 'none', offset: 1 }];
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function() {
elem.style.display = 'none';
};
requestAnimationFrame(function () {
var keyframes = [
{ height: '100%', offset: 0 },
{ height: '0', display: 'none', offset: 1 }];
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () {
elem.style.display = 'none';
};
});
}
function slideUp(elem, iterations) {
elem.style.display = 'block';
requestAnimationFrame(function () {
elem.style.display = 'block';
var keyframes = [
{ height: '0', offset: 0 },
{ height: '100%', offset: 1 }];
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
return elem.animate(keyframes, timing);
var keyframes = [
{ height: '0', offset: 0 },
{ height: '100%', offset: 1 }];
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing);
});
}
function getOverlayHtml(item, currentUser, card, commands) {

View File

@ -690,10 +690,8 @@
function ensureVideoPlayerElements() {
Dashboard.importCss('css/mediaplayer-video.css');
// TODO: remove dependency on this file
Dashboard.importCss('css/nowplayingbar.css');
// TODO: remove dependency on nowplayingbar
require(['css!/css/nowplayingbar.css', 'css!/css/mediaplayer-video.css']);
var html = '<div id="mediaPlayer" style="display: none;">';

View File

@ -20,8 +20,7 @@
var html = '';
// add return false because on iOS clicking the bar often ends up clicking the content underneath.
html += '<div class="nowPlayingBar" style="display:none;">';
html += '<div class="nowPlayingBar hide">';
html += '<div class="nowPlayingBarPositionContainer">';
html += '<paper-slider pin step=".1" min="0" max="100" value="0" class="nowPlayingBarPositionSlider"></paper-slider>';
@ -71,6 +70,58 @@
return html;
}
var isSlidUp;
var height;
function getHeight(elem) {
if (!height) {
height = elem.offsetHeight;
}
return height + 'px';
return '80px';
}
function slideDown(elem) {
if (!isSlidUp) {
return;
}
isSlidUp = false;
requestAnimationFrame(function () {
var keyframes = [
{ height: getHeight(elem), offset: 0 },
{ height: '0', display: 'none', offset: 1 }];
var timing = { duration: 200, iterations: 1, fill: 'both', easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () {
elem.classList.add('hide');
};
});
}
function slideUp(elem) {
if (isSlidUp) {
return;
}
isSlidUp = true;
requestAnimationFrame(function () {
elem.classList.remove('hide');
var keyframes = [
{ height: '0', offset: 0 },
{ height: getHeight(elem), offset: 1 }];
var timing = { duration: 200, iterations: 1, fill: 'both', easing: 'ease-out' };
elem.animate(keyframes, timing);
});
}
function bindEvents(elem) {
currentTimeElement = $('.nowPlayingBarCurrentTime', elem);
@ -193,26 +244,36 @@
}, 300);
}
var nowPlayingBarElement;
function getNowPlayingBar() {
var elem = document.querySelector('.nowPlayingBar');
return new Promise(function (resolve, reject) {
if (elem) {
return elem;
}
if (nowPlayingBarElement) {
resolve(nowPlayingBarElement);
return;
}
Dashboard.importCss('css/nowplayingbar.css');
require(['css!/css/nowplayingbar.css'], function () {
elem = $(getNowPlayingBarHtml()).appendTo(document.body)[0];
nowPlayingBarElement = document.querySelector('.nowPlayingBar');
if ((browserInfo.safari || !AppInfo.isNativeApp) && browserInfo.mobile) {
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
elem.classList.add('noMediaProgress');
}
if (nowPlayingBarElement) {
resolve(nowPlayingBarElement);
return;
}
bindEvents(elem);
nowPlayingBarElement = $(getNowPlayingBarHtml()).appendTo(document.body)[0];
return elem;
if ((browserInfo.safari || !AppInfo.isNativeApp) && browserInfo.mobile) {
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
nowPlayingBarElement.classList.add('noMediaProgress');
}
bindEvents(nowPlayingBarElement);
resolve(nowPlayingBarElement);
});
});
}
function showButton(button) {
@ -227,13 +288,25 @@
function updatePlayerState(event, state) {
if (state.NowPlayingItem) {
showNowPlayingBar();
} else {
if (!state.NowPlayingItem) {
hideNowPlayingBar();
return;
}
if (nowPlayingBarElement) {
updatePlayerStateInternal(event, state);
return;
}
getNowPlayingBar().then(function () {
updatePlayerStateInternal(event, state);
});
}
function updatePlayerStateInternal(event, state) {
showNowPlayingBar();
if (event.type == 'positionchange') {
// Try to avoid hammering the document with changes
var now = new Date().getTime();
@ -246,10 +319,6 @@
lastPlayerState = state;
if (!muteButton) {
getNowPlayingBar();
}
var playerInfo = MediaController.getPlayerInfo();
var playState = state.PlayState || {};
@ -306,10 +375,6 @@
playerInfo = playerInfo || MediaController.getPlayerInfo();
if (!muteButton) {
getNowPlayingBar();
}
var playState = state.PlayState || {};
var supportedCommands = playerInfo.supportedCommands;
@ -478,9 +543,7 @@
function showNowPlayingBar() {
var nowPlayingBar = getNowPlayingBar();
$(nowPlayingBar).show();
getNowPlayingBar().then(slideUp);
}
function hideNowPlayingBar() {
@ -491,7 +554,7 @@
// Don't call getNowPlayingBar here because we don't want to end up creating it just to hide it
var elem = document.getElementsByClassName('nowPlayingBar')[0];
if (elem) {
elem.style.display = 'none';
slideDown(elem);
}
}
@ -538,7 +601,9 @@
var player = this;
player.getPlayerState().then(function (state) {
Promise.all([player.getPlayerState(), getNowPlayingBar()]).then(function (responses) {
var state = responses[0];
if (player.isDefaultPlayer && state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
return;

View File

@ -132,7 +132,7 @@
document.body.appendChild(dlg);
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function(e) {
dlg.addEventListener('iron-overlay-closed', function (e) {
appStorage.setItem(supporterPlaybackKey, new Date().getTime());
dlg.parentNode.removeChild(dlg);
deferred.resolve();
@ -168,11 +168,15 @@
Dashboard.alert({
message: Globalize.translate('HeaderSyncRequiresSupporterMembership') + '<br/><p><a href="http://emby.media/premiere" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></p>',
title: Globalize.translate('HeaderSync')
title: Globalize.translate('HeaderSync'),
callback: function () {
deferred.reject();
}
});
}, function () {
deferred.reject();
Dashboard.hideLoadingMsg();
Dashboard.alert({

View File

@ -1906,6 +1906,11 @@ var AppInfo = {};
}
requirejs.config({
map: {
'*': {
'css': 'components/requirecss'
}
},
urlArgs: urlArgs,
paths: paths
@ -2004,6 +2009,10 @@ var AppInfo = {};
return {};
});
define("jqmwidget", ["thirdparty/jquerymobile-1.4.5/jqm.widget"], function () {
return {};
});
define("jqmslider", ["thirdparty/jquerymobile-1.4.5/jqm.slider"], function () {
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.slider.css');
return {};
@ -2029,16 +2038,9 @@ var AppInfo = {};
return {};
});
define("jqmcheckbox", ["jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.checkbox"], function () {
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.checkbox.css');
return {};
});
define("jqmcheckbox", ["jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.checkbox", 'css!thirdparty/jquerymobile-1.4.5/jqm.checkbox.css']);
define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel"], function () {
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.panel.css');
return {};
});
define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel", 'css!thirdparty/jquerymobile-1.4.5/jqm.panel.css']);
define("hammer", ["bower_components/hammerjs/hammer.min"], function (Hammer) {
return Hammer;

View File

@ -2,7 +2,7 @@
var currentDialogOptions;
function submitJob(panel, userId, syncOptions, form) {
function submitJob(dlg, userId, syncOptions, form) {
if (!userId) {
throw new Error('userId cannot be null');
@ -51,7 +51,7 @@
}).then(function () {
panel.panel('close');
PaperDialogHelper.close(dlg);
$(window.SyncManager).trigger('jobsubmit');
Dashboard.alert(Globalize.translate('MessageSyncJobCreated'));
});
@ -196,7 +196,7 @@
function showSyncMenu(options) {
requirejs(["scripts/registrationservices", "jqmcollapsible", "jqmpanel"], function () {
requirejs(["scripts/registrationservices"], function () {
RegistrationServices.validateFeature('sync').then(function () {
showSyncMenuInternal(options);
});
@ -205,64 +205,81 @@
function showSyncMenuInternal(options) {
var userId = Dashboard.getCurrentUserId();
require(['components/paperdialoghelper'], function () {
var dialogOptionsQuery = {
UserId: userId,
ItemIds: (options.items || []).map(function (i) {
return i.Id || i;
}).join(','),
var userId = Dashboard.getCurrentUserId();
ParentId: options.ParentId,
Category: options.Category
};
var dialogOptionsQuery = {
UserId: userId,
ItemIds: (options.items || []).map(function (i) {
return i.Id || i;
}).join(','),
ApiClient.getJSON(ApiClient.getUrl('Sync/Options', dialogOptionsQuery)).then(function (dialogOptions) {
ParentId: options.ParentId,
Category: options.Category
};
currentDialogOptions = dialogOptions;
ApiClient.getJSON(ApiClient.getUrl('Sync/Options', dialogOptionsQuery)).then(function (dialogOptions) {
var html = '<div data-role="panel" data-position="right" data-display="overlay" class="syncPanel" data-position-fixed="true" data-theme="a">';
currentDialogOptions = dialogOptions;
html += '<div>';
var dlg = PaperDialogHelper.createDialog({
size: 'small',
theme: 'a'
});
html += '<form class="formSubmitSyncRequest">';
var html = '';
html += '<h2 class="dialogHeader">';
html += '<paper-fab icon="arrow-back" mini class="btnCancel"></paper-fab>';
html += '</h2>';
html += '<div style="margin:1em 0 1.5em;">';
html += '<h1 style="margin: 0;display:inline-block;vertical-align:middle;">' + Globalize.translate('SyncMedia') + '</h1>';
html += '<div>';
html += '<a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank" class="clearLink" style="margin-top:0;display:inline-block;vertical-align:middle;margin-left:1em;"><paper-button raised class="secondary mini"><iron-icon icon="info"></iron-icon><span>' + Globalize.translate('ButtonHelp') + '</span></paper-button></a>';
html += '</div>';
html += '<form class="formSubmitSyncRequest" style="margin: auto;">';
html += '<div class="formFields"></div>';
html += '<div style="margin:1em 0 1.5em;">';
html += '<h1 style="margin: 0;display:inline-block;vertical-align:middle;">' + Globalize.translate('SyncMedia') + '</h1>';
html += '<p>';
html += '<button type="submit" data-role="none" class="clearButton"><paper-button raised class="submit block"><iron-icon icon="sync"></iron-icon><span>' + Globalize.translate('ButtonSync') + '</span></paper-button></button>';
html += '</p>';
html += '<a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank" class="clearLink" style="margin-top:0;display:inline-block;vertical-align:middle;margin-left:1em;"><paper-button raised class="secondary mini"><iron-icon icon="info"></iron-icon><span>' + Globalize.translate('ButtonHelp') + '</span></paper-button></a>';
html += '</div>';
html += '</form>';
html += '</div>';
html += '</div>';
html += '<div class="formFields"></div>';
$(document.body).append(html);
html += '<p>';
html += '<button type="submit" data-role="none" class="clearButton"><paper-button raised class="submit block"><iron-icon icon="sync"></iron-icon><span>' + Globalize.translate('ButtonSync') + '</span></paper-button></button>';
html += '</p>';
var elem = $('.syncPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
$(this).off("panelclose").remove();
html += '</form>';
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function (e) {
dlg.parentNode.removeChild(dlg);
});
PaperDialogHelper.openWithHash(dlg, 'syncjob');
$('form', dlg).on('submit', function () {
submitJob(dlg, userId, options, this);
return false;
});
$('.btnCancel').on('click', function () {
PaperDialogHelper.close(dlg);
});
renderForm({
elem: $('.formFields', dlg),
dialogOptions: dialogOptions,
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery)
});
});
$('form', elem).on('submit', function () {
submitJob(elem, userId, options, this);
return false;
});
renderForm({
elem: $('.formFields', elem),
dialogOptions: dialogOptions,
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery)
});
});
require(['jqmicons']);
}
function getTargetDialogOptionsFn(query) {

View File

@ -1,57 +0,0 @@
(function () {
// This script produces errors in older versions of safari
if ((navigator.userAgent || '').toLowerCase().indexOf('chrome') == -1) {
return;
}
var chrome = window.chrome || {};
chrome.cast = chrome.cast || {};
chrome.cast.media = chrome.cast.media || {};
chrome.cast.ApiBootstrap_ = function () {
};
chrome.cast.ApiBootstrap_.EXTENSION_IDS = ["boadgeojelhgndaghljhdicfkmllpafd", "dliochdbjfkdbacpmhlcpmleaejidimm", "hfaagokkkhdbgiakmmlclaapfelnkoah", "fmfcbgogabcbclcofgocippekhfcmgfj", "enhhojjnijigcajfphajepfemndkmdlo"];
chrome.cast.ApiBootstrap_.findInstalledExtension_ = function (callback) {
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(0, callback);
};
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_ = function (index, callback) {
index == chrome.cast.ApiBootstrap_.EXTENSION_IDS.length ? callback(null) : chrome.cast.ApiBootstrap_.isExtensionInstalled_(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index], function (installed) {
installed ? callback(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index]) : chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(index + 1, callback);
});
};
chrome.cast.ApiBootstrap_.getCastSenderUrl_ = function (extensionId) {
return "chrome-extension://" + extensionId + "/cast_sender.js";
};
chrome.cast.ApiBootstrap_.isExtensionInstalled_ = function (extensionId, callback) {
var xmlhttp = new XMLHttpRequest;
xmlhttp.onreadystatechange = function () {
4 == xmlhttp.readyState && 200 == xmlhttp.status && callback(!0);
};
xmlhttp.onerror = function () {
callback(!1);
};
try {
// Throws an error in other browsers
xmlhttp.open("GET", chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId), !0);
xmlhttp.send();
} catch (ex) {
}
};
chrome.cast.ApiBootstrap_.findInstalledExtension_(function (extensionId) {
if (extensionId) {
console.log("Found cast extension: " + extensionId);
chrome.cast.extensionId = extensionId;
var apiScript = document.createElement("script");
apiScript.src = chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId);
(document.head || document.documentElement).appendChild(apiScript);
} else {
var msg = "No cast extension found";
console.log(msg);
var callback = window.__onGCastApiAvailable;
callback && "function" == typeof callback && callback(!1, msg);
}
});
})();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,766 +1,246 @@
(function () {
define(['jqmwidget'], function () {
if (jQuery.widget) {
return;
}
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function ($, undefined) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function (elems) {
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
try {
$(elem).triggerHandler("remove");
// http://bugs.jquery.com/ticket/8235
} catch (e) { }
}
_cleanData(elems);
};
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
function noHiddenClass(elements) {
var index,
length = elements.length,
result = [];
$.widget = function (name, base, prototype) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split(".")[0];
name = name.split(".")[1];
fullName = namespace + "-" + name;
if (!prototype) {
prototype = base;
base = $.Widget;
for (index = 0; index < length; index++) {
if (!elements[index].className.match(uiScreenHiddenRegex)) {
result.push(elements[index]);
}
}
// create selector for plugin
$.expr[":"][fullName.toLowerCase()] = function (elem) {
return !!$.data(elem, fullName);
};
return $(result);
}
$[namespace] = $[namespace] || {};
existingConstructor = $[namespace][name];
constructor = $[namespace][name] = function (options, element) {
// allow instantiation without "new" keyword
if (!this._createWidget) {
return new constructor(options, element);
}
$.mobile.behaviors.addFirstLastClasses = {
_getVisibles: function ($els, create) {
var visibles;
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if (arguments.length) {
this._createWidget(options, element);
}
};
// extend with the existing constructor to carry over any static properties
$.extend(constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend({}, prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend({}, basePrototype.options);
$.each(prototype, function (prop, value) {
if (!$.isFunction(value)) {
proxiedPrototype[prop] = value;
return;
}
proxiedPrototype[prop] = (function () {
var _super = function () {
return base.prototype[prop].apply(this, arguments);
},
_superApply = function (args) {
return base.prototype[prop].apply(this, args);
};
return function () {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply(this, arguments);
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend(basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if (existingConstructor) {
$.each(existingConstructor._childConstructors, function (i, child) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push(constructor);
}
$.widget.bridge(name, constructor);
return constructor;
};
$.widget.extend = function (target) {
var input = slice.call(arguments, 1),
inputIndex = 0,
inputLength = input.length,
key,
value;
for (; inputIndex < inputLength; inputIndex++) {
for (key in input[inputIndex]) {
value = input[inputIndex][key];
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
// Clone objects
if ($.isPlainObject(value)) {
target[key] = $.isPlainObject(target[key]) ?
$.widget.extend({}, target[key], value) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend({}, value);
// Copy everything else by reference
} else {
target[key] = value;
}
if (create) {
visibles = noHiddenClass($els);
} else {
visibles = $els.filter(":visible");
if (visibles.length === 0) {
visibles = noHiddenClass($els);
}
}
return visibles;
},
_addFirstLastClasses: function ($els, $visibles, create) {
$els.removeClass("ui-first-child ui-last-child");
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
if (!create) {
this.element.trigger("updatelayout");
}
},
_removeFirstLastClasses: function ($els) {
$els.removeClass("ui-first-child ui-last-child");
}
return target;
};
$.widget.bridge = function (name, object) {
})(jQuery);
var fullName = object.prototype.widgetFullName || name;
$.fn[name] = function (options) {
var isMethodCall = typeof options === "string",
args = slice.call(arguments, 1),
returnValue = this;
(function ($, undefined) {
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply(null, [options].concat(args)) :
options;
function keepNativeSelector() {
var keepNative = $.trim("[data-role='none']"),
globalValue = $.trim($.mobile.keepNative),
optionValue = $.trim("[data-role='none']"),
if (isMethodCall) {
this.each(function () {
var methodValue,
instance = $.data(this, fullName);
if (options === "instance") {
returnValue = instance;
return false;
}
if (!instance) {
return $.error("cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'");
}
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
return $.error("no such method '" + options + "' for " + name + " widget instance");
}
methodValue = instance[options].apply(instance, args);
if (methodValue !== instance && methodValue !== undefined) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}
});
// Check if $.mobile.keepNative has changed from the factory default
newDefault = "",
// If $.mobile.keepNative has not changed, use options.keepNativeDefault
oldDefault = (newDefault === "" ? optionValue : "");
// Concatenate keepNative selectors from all sources where the value has
// changed or, if nothing has changed, return the default
return ((keepNative ? [keepNative] : [])
.concat(newDefault ? [newDefault] : [])
.concat(oldDefault ? [oldDefault] : [])
.join(", "));
}
$.widget("mobile.controlgroup", $.extend({
options: {
enhanced: false,
theme: null,
shadow: false,
corners: true,
excludeInvisible: true,
type: "vertical",
mini: false
},
_create: function () {
var elem = this.element,
opts = this.options,
keepNative = keepNativeSelector();
// Run buttonmarkup
if ($.fn.buttonMarkup) {
this.element
.find($.fn.buttonMarkup.initSelector)
.not(keepNative)
.buttonMarkup();
}
// Enhance child widgets
$.each(this._childWidgets, $.proxy(function (number, widgetName) {
if ($.mobile[widgetName]) {
this.element
.find($.mobile[widgetName].initSelector)
.not(keepNative)[widgetName]();
}
}, this));
$.extend(this, {
_ui: null,
_initialRefresh: true
});
if (opts.enhanced) {
this._ui = {
groupLegend: elem.children(".ui-controlgroup-label").children(),
childWrapper: elem.children(".ui-controlgroup-controls")
};
} else {
this.each(function () {
var instance = $.data(this, fullName);
if (instance) {
instance.option(options || {})._init();
} else {
$.data(this, fullName, new object(options, this));
}
});
this._ui = this._enhance();
}
},
_childWidgets: ["checkboxradio", "selectmenu", "button"],
_themeClassFromOption: function (value) {
return (value ? (value === "none" ? "" : "ui-group-theme-" + value) : "");
},
_enhance: function () {
var elem = this.element,
opts = this.options,
ui = {
groupLegend: elem.children("legend"),
childWrapper: elem
.addClass("ui-controlgroup " +
"ui-controlgroup-" +
(opts.type === "horizontal" ? "horizontal" : "vertical") + " " +
this._themeClassFromOption(opts.theme) + " " +
(opts.corners ? "ui-corner-all " : "") +
(opts.mini ? "ui-mini " : ""))
.wrapInner("<div " +
"class='ui-controlgroup-controls " +
(opts.shadow === true ? "ui-shadow" : "") + "'></div>")
.children()
};
if (ui.groupLegend.length > 0) {
$("<div role='heading' class='ui-controlgroup-label'></div>")
.append(ui.groupLegend)
.prependTo(elem);
}
return ui;
},
_init: function () {
this.refresh();
},
_setOptions: function (options) {
var callRefresh, returnValue,
elem = this.element;
// Must have one of horizontal or vertical
if (options.type !== undefined) {
elem
.removeClass("ui-controlgroup-horizontal ui-controlgroup-vertical")
.addClass("ui-controlgroup-" + (options.type === "horizontal" ? "horizontal" : "vertical"));
callRefresh = true;
}
if (options.theme !== undefined) {
elem
.removeClass(this._themeClassFromOption(this.options.theme))
.addClass(this._themeClassFromOption(options.theme));
}
if (options.corners !== undefined) {
elem.toggleClass("ui-corner-all", options.corners);
}
if (options.mini !== undefined) {
elem.toggleClass("ui-mini", options.mini);
}
if (options.shadow !== undefined) {
this._ui.childWrapper.toggleClass("ui-shadow", options.shadow);
}
if (options.excludeInvisible !== undefined) {
this.options.excludeInvisible = options.excludeInvisible;
callRefresh = true;
}
returnValue = this._super(options);
if (callRefresh) {
this.refresh();
}
return returnValue;
};
};
$.Widget = function ( /* options, element */) { };
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function (options, element) {
element = $(element || this.defaultElement || this)[0];
this.element = $(element);
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend({},
this.options,
this._getCreateOptions(),
options);
this.bindings = $();
this.hoverable = $();
this.focusable = $();
container: function () {
return this._ui.childWrapper;
},
if (element !== this) {
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (event) {
if (event.target === element) {
this.destroy();
}
}
});
this.document = $(element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element);
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
refresh: function () {
var $el = this.container(),
els = $el.find(".ui-btn").not(".ui-slider-handle"),
create = this._initialRefresh;
if ($.mobile.checkboxradio) {
$el.find(":mobile-checkboxradio").checkboxradio("refresh");
}
this._addFirstLastClasses(els,
this.options.excludeInvisible ? this._getVisibles(els, create) : els,
create);
this._initialRefresh = false;
},
// Caveat: If the legend is not the first child of the controlgroup at enhance
// time, it will be after _destroy().
_destroy: function () {
var ui, buttons,
opts = this.options;
if (opts.enhanced) {
return this;
}
this._create();
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
ui = this._ui;
buttons = this.element
.removeClass("ui-controlgroup " +
"ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " +
this._themeClassFromOption(opts.theme))
.find(".ui-btn")
.not(".ui-slider-handle");
destroy: function () {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind(this.eventNamespace)
.removeData(this.widgetFullName)
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData($.camelCase(this.widgetFullName));
this.widget()
.unbind(this.eventNamespace)
.removeAttr("aria-disabled")
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled");
this._removeFirstLastClasses(buttons);
// clean up events and states
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
},
_destroy: $.noop,
widget: function () {
return this.element;
},
option: function (key, value) {
var options = key,
parts,
curOption,
i;
if (arguments.length === 0) {
// don't return a reference to the internal hash
return $.widget.extend({}, this.options);
}
if (typeof key === "string") {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split(".");
key = parts.shift();
if (parts.length) {
curOption = options[key] = $.widget.extend({}, this.options[key]);
for (i = 0; i < parts.length - 1; i++) {
curOption[parts[i]] = curOption[parts[i]] || {};
curOption = curOption[parts[i]];
}
key = parts.pop();
if (value === undefined) {
return curOption[key] === undefined ? null : curOption[key];
}
curOption[key] = value;
} else {
if (value === undefined) {
return this.options[key] === undefined ? null : this.options[key];
}
options[key] = value;
}
}
this._setOptions(options);
return this;
},
_setOptions: function (options) {
var key;
for (key in options) {
this._setOption(key, options[key]);
}
return this;
},
_setOption: function (key, value) {
this.options[key] = value;
if (key === "disabled") {
this.widget()
.toggleClass(this.widgetFullName + "-disabled", !!value);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
}
return this;
},
enable: function () {
return this._setOptions({ disabled: false });
},
disable: function () {
return this._setOptions({ disabled: true });
},
_on: function (suppressDisabledCheck, element, handlers) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if (typeof suppressDisabledCheck !== "boolean") {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if (!handlers) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $(element);
this.bindings = this.bindings.add(element);
}
$.each(handlers, function (event, handler) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if (!suppressDisabledCheck &&
(instance.options.disabled === true ||
$(this).hasClass("ui-state-disabled"))) {
return;
}
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
// copy the guid so direct unbinding works
if (typeof handler !== "string") {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match(/^(\w+)\s*(.*)$/),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if (selector) {
delegateElement.delegate(selector, eventName, handlerProxy);
} else {
element.bind(eventName, handlerProxy);
}
});
},
_off: function (element, eventName) {
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
element.unbind(eventName).undelegate(eventName);
},
_trigger: function (type, event, data) {
var prop, orig,
callback = this.options[type];
data = data || {};
event = $.Event(event);
event.type = (type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[0];
// copy original event properties over to the new event
orig = event.originalEvent;
if (orig) {
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
}
this.element[0].dispatchEvent(new CustomEvent(event.type, {
bubbles: true,
detail: {
data: data,
originalEvent: event
}
}));
//this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[0], [event].concat(data)) === false ||
event.isDefaultPrevented());
ui.groupLegend.unwrap();
ui.childWrapper.children().unwrap();
}
};
}, $.mobile.behaviors.addFirstLastClasses));
})(jQuery);
(function ($, undefined) {
$.extend($.Widget.prototype, {
_getCreateOptions: function () {
var option, value,
elem = this.element[0],
options = {};
//
if (!this.element.data("defaults")) {
for (option in this.options) {
value = this.element.data(option);
if (value != null) {
options[option] = value;
}
}
}
return options;
}
});
})(jQuery);
(function ($, undefined) {
var originalWidget = $.widget
$.widget = (function (orig) {
return function () {
var constructor = orig.apply(this, arguments),
name = constructor.prototype.widgetName;
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
$.mobile.widgets[name] = constructor;
return constructor;
};
})($.widget);
// Make sure $.widget still has bridge and extend methods
$.extend($.widget, originalWidget);
})(jQuery);
})();
(function ($, undefined) {
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
function noHiddenClass(elements) {
var index,
length = elements.length,
result = [];
for (index = 0; index < length; index++) {
if (!elements[index].className.match(uiScreenHiddenRegex)) {
result.push(elements[index]);
}
}
return $(result);
}
$.mobile.behaviors.addFirstLastClasses = {
_getVisibles: function ($els, create) {
var visibles;
if (create) {
visibles = noHiddenClass($els);
} else {
visibles = $els.filter(":visible");
if (visibles.length === 0) {
visibles = noHiddenClass($els);
}
}
return visibles;
},
_addFirstLastClasses: function ($els, $visibles, create) {
$els.removeClass("ui-first-child ui-last-child");
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
if (!create) {
this.element.trigger("updatelayout");
}
},
_removeFirstLastClasses: function ($els) {
$els.removeClass("ui-first-child ui-last-child");
}
};
})(jQuery);
(function ($, undefined) {
function keepNativeSelector() {
var keepNative = $.trim("[data-role='none']"),
globalValue = $.trim($.mobile.keepNative),
optionValue = $.trim("[data-role='none']"),
// Check if $.mobile.keepNative has changed from the factory default
newDefault = "",
// If $.mobile.keepNative has not changed, use options.keepNativeDefault
oldDefault = (newDefault === "" ? optionValue : "");
// Concatenate keepNative selectors from all sources where the value has
// changed or, if nothing has changed, return the default
return ((keepNative ? [keepNative] : [])
.concat(newDefault ? [newDefault] : [])
.concat(oldDefault ? [oldDefault] : [])
.join(", "));
}
$.widget("mobile.controlgroup", $.extend({
options: {
enhanced: false,
theme: null,
shadow: false,
corners: true,
excludeInvisible: true,
type: "vertical",
mini: false
},
_create: function () {
var elem = this.element,
opts = this.options,
keepNative = keepNativeSelector();
// Run buttonmarkup
if ($.fn.buttonMarkup) {
this.element
.find($.fn.buttonMarkup.initSelector)
.not(keepNative)
.buttonMarkup();
}
// Enhance child widgets
$.each(this._childWidgets, $.proxy(function (number, widgetName) {
if ($.mobile[widgetName]) {
this.element
.find($.mobile[widgetName].initSelector)
.not(keepNative)[widgetName]();
}
}, this));
$.extend(this, {
_ui: null,
_initialRefresh: true
});
if (opts.enhanced) {
this._ui = {
groupLegend: elem.children(".ui-controlgroup-label").children(),
childWrapper: elem.children(".ui-controlgroup-controls")
};
} else {
this._ui = this._enhance();
}
},
_childWidgets: ["checkboxradio", "selectmenu", "button"],
_themeClassFromOption: function (value) {
return (value ? (value === "none" ? "" : "ui-group-theme-" + value) : "");
},
_enhance: function () {
var elem = this.element,
opts = this.options,
ui = {
groupLegend: elem.children("legend"),
childWrapper: elem
.addClass("ui-controlgroup " +
"ui-controlgroup-" +
(opts.type === "horizontal" ? "horizontal" : "vertical") + " " +
this._themeClassFromOption(opts.theme) + " " +
(opts.corners ? "ui-corner-all " : "") +
(opts.mini ? "ui-mini " : ""))
.wrapInner("<div " +
"class='ui-controlgroup-controls " +
(opts.shadow === true ? "ui-shadow" : "") + "'></div>")
.children()
};
if (ui.groupLegend.length > 0) {
$("<div role='heading' class='ui-controlgroup-label'></div>")
.append(ui.groupLegend)
.prependTo(elem);
}
return ui;
},
_init: function () {
this.refresh();
},
_setOptions: function (options) {
var callRefresh, returnValue,
elem = this.element;
// Must have one of horizontal or vertical
if (options.type !== undefined) {
elem
.removeClass("ui-controlgroup-horizontal ui-controlgroup-vertical")
.addClass("ui-controlgroup-" + (options.type === "horizontal" ? "horizontal" : "vertical"));
callRefresh = true;
}
if (options.theme !== undefined) {
elem
.removeClass(this._themeClassFromOption(this.options.theme))
.addClass(this._themeClassFromOption(options.theme));
}
if (options.corners !== undefined) {
elem.toggleClass("ui-corner-all", options.corners);
}
if (options.mini !== undefined) {
elem.toggleClass("ui-mini", options.mini);
}
if (options.shadow !== undefined) {
this._ui.childWrapper.toggleClass("ui-shadow", options.shadow);
}
if (options.excludeInvisible !== undefined) {
this.options.excludeInvisible = options.excludeInvisible;
callRefresh = true;
}
returnValue = this._super(options);
if (callRefresh) {
this.refresh();
}
return returnValue;
},
container: function () {
return this._ui.childWrapper;
},
refresh: function () {
var $el = this.container(),
els = $el.find(".ui-btn").not(".ui-slider-handle"),
create = this._initialRefresh;
if ($.mobile.checkboxradio) {
$el.find(":mobile-checkboxradio").checkboxradio("refresh");
}
this._addFirstLastClasses(els,
this.options.excludeInvisible ? this._getVisibles(els, create) : els,
create);
this._initialRefresh = false;
},
// Caveat: If the legend is not the first child of the controlgroup at enhance
// time, it will be after _destroy().
_destroy: function () {
var ui, buttons,
opts = this.options;
if (opts.enhanced) {
return this;
}
ui = this._ui;
buttons = this.element
.removeClass("ui-controlgroup " +
"ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " +
this._themeClassFromOption(opts.theme))
.find(".ui-btn")
.not(".ui-slider-handle");
this._removeFirstLastClasses(buttons);
ui.groupLegend.unwrap();
ui.childWrapper.children().unwrap();
}
}, $.mobile.behaviors.addFirstLastClasses));
})(jQuery);
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,523 @@
(function () {
if (jQuery.widget) {
return;
}
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function ($, undefined) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function (elems) {
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
try {
$(elem).triggerHandler("remove");
// http://bugs.jquery.com/ticket/8235
} catch (e) { }
}
_cleanData(elems);
};
$.widget = function (name, base, prototype) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split(".")[0];
name = name.split(".")[1];
fullName = namespace + "-" + name;
if (!prototype) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[":"][fullName.toLowerCase()] = function (elem) {
return !!$.data(elem, fullName);
};
$[namespace] = $[namespace] || {};
existingConstructor = $[namespace][name];
constructor = $[namespace][name] = function (options, element) {
// allow instantiation without "new" keyword
if (!this._createWidget) {
return new constructor(options, element);
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if (arguments.length) {
this._createWidget(options, element);
}
};
// extend with the existing constructor to carry over any static properties
$.extend(constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend({}, prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend({}, basePrototype.options);
$.each(prototype, function (prop, value) {
if (!$.isFunction(value)) {
proxiedPrototype[prop] = value;
return;
}
proxiedPrototype[prop] = (function () {
var _super = function () {
return base.prototype[prop].apply(this, arguments);
},
_superApply = function (args) {
return base.prototype[prop].apply(this, args);
};
return function () {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply(this, arguments);
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend(basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if (existingConstructor) {
$.each(existingConstructor._childConstructors, function (i, child) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push(constructor);
}
$.widget.bridge(name, constructor);
return constructor;
};
$.widget.extend = function (target) {
var input = slice.call(arguments, 1),
inputIndex = 0,
inputLength = input.length,
key,
value;
for (; inputIndex < inputLength; inputIndex++) {
for (key in input[inputIndex]) {
value = input[inputIndex][key];
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
// Clone objects
if ($.isPlainObject(value)) {
target[key] = $.isPlainObject(target[key]) ?
$.widget.extend({}, target[key], value) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend({}, value);
// Copy everything else by reference
} else {
target[key] = value;
}
}
}
}
return target;
};
$.widget.bridge = function (name, object) {
var fullName = object.prototype.widgetFullName || name;
$.fn[name] = function (options) {
var isMethodCall = typeof options === "string",
args = slice.call(arguments, 1),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply(null, [options].concat(args)) :
options;
if (isMethodCall) {
this.each(function () {
var methodValue,
instance = $.data(this, fullName);
if (options === "instance") {
returnValue = instance;
return false;
}
if (!instance) {
return $.error("cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'");
}
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
return $.error("no such method '" + options + "' for " + name + " widget instance");
}
methodValue = instance[options].apply(instance, args);
if (methodValue !== instance && methodValue !== undefined) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}
});
} else {
this.each(function () {
var instance = $.data(this, fullName);
if (instance) {
instance.option(options || {})._init();
} else {
$.data(this, fullName, new object(options, this));
}
});
}
return returnValue;
};
};
$.Widget = function ( /* options, element */) { };
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function (options, element) {
element = $(element || this.defaultElement || this)[0];
this.element = $(element);
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend({},
this.options,
this._getCreateOptions(),
options);
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if (element !== this) {
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (event) {
if (event.target === element) {
this.destroy();
}
}
});
this.document = $(element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element);
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
}
this._create();
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function () {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind(this.eventNamespace)
.removeData(this.widgetFullName)
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData($.camelCase(this.widgetFullName));
this.widget()
.unbind(this.eventNamespace)
.removeAttr("aria-disabled")
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled");
// clean up events and states
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
},
_destroy: $.noop,
widget: function () {
return this.element;
},
option: function (key, value) {
var options = key,
parts,
curOption,
i;
if (arguments.length === 0) {
// don't return a reference to the internal hash
return $.widget.extend({}, this.options);
}
if (typeof key === "string") {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split(".");
key = parts.shift();
if (parts.length) {
curOption = options[key] = $.widget.extend({}, this.options[key]);
for (i = 0; i < parts.length - 1; i++) {
curOption[parts[i]] = curOption[parts[i]] || {};
curOption = curOption[parts[i]];
}
key = parts.pop();
if (value === undefined) {
return curOption[key] === undefined ? null : curOption[key];
}
curOption[key] = value;
} else {
if (value === undefined) {
return this.options[key] === undefined ? null : this.options[key];
}
options[key] = value;
}
}
this._setOptions(options);
return this;
},
_setOptions: function (options) {
var key;
for (key in options) {
this._setOption(key, options[key]);
}
return this;
},
_setOption: function (key, value) {
this.options[key] = value;
if (key === "disabled") {
this.widget()
.toggleClass(this.widgetFullName + "-disabled", !!value);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
}
return this;
},
enable: function () {
return this._setOptions({ disabled: false });
},
disable: function () {
return this._setOptions({ disabled: true });
},
_on: function (suppressDisabledCheck, element, handlers) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if (typeof suppressDisabledCheck !== "boolean") {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if (!handlers) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $(element);
this.bindings = this.bindings.add(element);
}
$.each(handlers, function (event, handler) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if (!suppressDisabledCheck &&
(instance.options.disabled === true ||
$(this).hasClass("ui-state-disabled"))) {
return;
}
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
// copy the guid so direct unbinding works
if (typeof handler !== "string") {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match(/^(\w+)\s*(.*)$/),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if (selector) {
delegateElement.delegate(selector, eventName, handlerProxy);
} else {
element.bind(eventName, handlerProxy);
}
});
},
_off: function (element, eventName) {
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
element.unbind(eventName).undelegate(eventName);
},
_trigger: function (type, event, data) {
var prop, orig,
callback = this.options[type];
data = data || {};
event = $.Event(event);
event.type = (type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[0];
// copy original event properties over to the new event
orig = event.originalEvent;
if (orig) {
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
}
this.element[0].dispatchEvent(new CustomEvent(event.type, {
bubbles: true,
detail: {
data: data,
originalEvent: event
}
}));
//this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[0], [event].concat(data)) === false ||
event.isDefaultPrevented());
}
};
})(jQuery);
(function ($, undefined) {
$.extend($.Widget.prototype, {
_getCreateOptions: function () {
var option, value,
elem = this.element[0],
options = {};
//
if (!this.element.data("defaults")) {
for (option in this.options) {
value = this.element.data(option);
if (value != null) {
options[option] = value;
}
}
}
return options;
}
});
})(jQuery);
(function ($, undefined) {
var originalWidget = $.widget
$.widget = (function (orig) {
return function () {
var constructor = orig.apply(this, arguments),
name = constructor.prototype.widgetName;
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
$.mobile.widgets[name] = constructor;
return constructor;
};
})($.widget);
// Make sure $.widget still has bridge and extend methods
$.extend($.widget, originalWidget);
})(jQuery);
})();