mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
trim core scripts
This commit is contained in:
parent
d7fb3af903
commit
6acc4bf69d
13 changed files with 267 additions and 454 deletions
|
@ -30,6 +30,6 @@
|
||||||
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
|
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/desandro/eventie.git",
|
"_source": "git://github.com/desandro/eventie.git",
|
||||||
"_target": "^1",
|
"_target": "~1.0.3",
|
||||||
"_originalSource": "eventie"
|
"_originalSource": "eventie"
|
||||||
}
|
}
|
|
@ -36,7 +36,7 @@
|
||||||
"tag": "v1.0.8",
|
"tag": "v1.0.8",
|
||||||
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff"
|
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
"_source": "git://github.com/polymerelements/iron-selector.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "PolymerElements/iron-selector"
|
"_originalSource": "polymerelements/iron-selector"
|
||||||
}
|
}
|
103
dashboard-ui/cordova/android/androidcredentials.js
vendored
103
dashboard-ui/cordova/android/androidcredentials.js
vendored
|
@ -26,109 +26,6 @@
|
||||||
var capabilities = ConnectionManager.capabilities();
|
var capabilities = ConnectionManager.capabilities();
|
||||||
|
|
||||||
ApiClientBridge.init(AppInfo.appName, AppInfo.appVersion, AppInfo.deviceId, AppInfo.deviceName, JSON.stringify(capabilities));
|
ApiClientBridge.init(AppInfo.appName, AppInfo.appVersion, AppInfo.deviceId, AppInfo.deviceName, JSON.stringify(capabilities));
|
||||||
|
|
||||||
//initAjax();
|
|
||||||
}
|
|
||||||
|
|
||||||
var baseAjaxMethod;
|
|
||||||
var currentId = 0;
|
|
||||||
function getNewRequestId() {
|
|
||||||
var id = currentId++;
|
|
||||||
return id.toString();
|
|
||||||
}
|
|
||||||
function initAjax() {
|
|
||||||
baseAjaxMethod = HttpClient.send;
|
|
||||||
HttpClient.send = sendRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendRequest(request) {
|
|
||||||
|
|
||||||
// For now, we can only handle json responses
|
|
||||||
if (request.dataType) {
|
|
||||||
if (request.dataType != 'json') {
|
|
||||||
return baseAjaxMethod(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.data) {
|
|
||||||
// For now, we can only handle request bodies that are strings
|
|
||||||
if (typeof (request.data) != 'string') {
|
|
||||||
return baseAjaxMethod(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
|
||||||
|
|
||||||
var id = getNewRequestId();
|
|
||||||
|
|
||||||
request.headers = request.headers || {};
|
|
||||||
|
|
||||||
if (request.dataType == 'json') {
|
|
||||||
request.headers.accept = 'application/json';
|
|
||||||
}
|
|
||||||
|
|
||||||
var method = request.type || "GET";
|
|
||||||
|
|
||||||
var javaRequest = {
|
|
||||||
Method: method,
|
|
||||||
Url: request.url,
|
|
||||||
RequestHeaders: request.headers
|
|
||||||
};
|
|
||||||
|
|
||||||
if (request.timeout) {
|
|
||||||
javaRequest.Timeout = request.timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.data) {
|
|
||||||
javaRequest.RequestContent = request.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.contentType) {
|
|
||||||
javaRequest.RequestContentType = request.contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Logger.log("Sending request: " + JSON.stringify(javaRequest));
|
|
||||||
|
|
||||||
ApiClientBridge.sendRequest(JSON.stringify(javaRequest), request.dataType, id);
|
|
||||||
|
|
||||||
Events.on(AndroidAjax, 'response' + id, function (e, isSuccess, response) {
|
|
||||||
|
|
||||||
Events.off(AndroidAjax, 'response' + id);
|
|
||||||
|
|
||||||
if (isSuccess) {
|
|
||||||
|
|
||||||
if (response) {
|
|
||||||
deferred.resolveWith(null, [response]);
|
|
||||||
} else {
|
|
||||||
deferred.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
// Need to mimic the jquery ajax error response
|
|
||||||
deferred.rejectWith(request, [getErrorResponse(response)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return deferred.promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getErrorResponse(response) {
|
|
||||||
|
|
||||||
var error = {};
|
|
||||||
|
|
||||||
if (response.StatusCode) {
|
|
||||||
error.status = response.StatusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
error.ResponseHeaders = response.ResponseHeaders || {};
|
|
||||||
|
|
||||||
error.getResponseHeader = function (name) {
|
|
||||||
return error.ResponseHeaders[name];
|
|
||||||
};
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDownloadSpeed(bytes, url) {
|
function getDownloadSpeed(bytes, url) {
|
||||||
|
|
|
@ -54,6 +54,14 @@
|
||||||
|
|
||||||
/* Now playing bar */
|
/* Now playing bar */
|
||||||
.nowPlayingBar {
|
.nowPlayingBar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
/* Above everything, except for the video player and popup overlays */
|
||||||
|
z-index: 1097;
|
||||||
|
color: #fff;
|
||||||
|
background-color: rgba(26,26,26,.94);
|
||||||
border-top: 1px solid #444;
|
border-top: 1px solid #444;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/*box-shadow: 0 0 8px rgba(255,255,255,.4);*/
|
/*box-shadow: 0 0 8px rgba(255,255,255,.4);*/
|
||||||
|
|
|
@ -1340,18 +1340,15 @@
|
||||||
$('.hasrefreshtime').removeClass('hasrefreshtime').removeAttr('data-lastrefresh');
|
$('.hasrefreshtime').removeClass('hasrefreshtime').removeAttr('data-lastrefresh');
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
if (window.ApiClient) {
|
||||||
|
initializeApiClient(window.ApiClient);
|
||||||
|
}
|
||||||
|
|
||||||
if (window.ApiClient) {
|
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||||
initializeApiClient(window.ApiClient);
|
initializeApiClient(apiClient);
|
||||||
}
|
|
||||||
|
|
||||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
|
||||||
initializeApiClient(apiClient);
|
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes);
|
|
||||||
Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes);
|
||||||
|
Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes);
|
||||||
|
|
||||||
})(jQuery, document, window);
|
})(jQuery, document, window);
|
|
@ -133,13 +133,7 @@
|
||||||
var mainDrawerButton = document.querySelector('.mainDrawerButton');
|
var mainDrawerButton = document.querySelector('.mainDrawerButton');
|
||||||
|
|
||||||
if (mainDrawerButton) {
|
if (mainDrawerButton) {
|
||||||
if (AppInfo.isTouchPreferred || $.browser.mobile) {
|
mainDrawerButton.addEventListener('click', openMainDrawer);
|
||||||
|
|
||||||
mainDrawerButton.addEventListener('click', openMainDrawer);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$(mainDrawerButton).createHoverTouch().on('hovertouch', openMainDrawer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var headerBackButton = document.querySelector('.headerBackButton');
|
var headerBackButton = document.querySelector('.headerBackButton');
|
||||||
|
@ -312,7 +306,6 @@
|
||||||
var userHeader = drawer.querySelector('.userheader');
|
var userHeader = drawer.querySelector('.userheader');
|
||||||
|
|
||||||
userHeader.innerHTML = html;
|
userHeader.innerHTML = html;
|
||||||
|
|
||||||
ImageLoader.fillImages(userHeader.getElementsByClassName('lazy'));
|
ImageLoader.fillImages(userHeader.getElementsByClassName('lazy'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,10 +334,6 @@
|
||||||
drawer.querySelector('.dashboardDrawerContent').innerHTML = html;
|
drawer.querySelector('.dashboardDrawerContent').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(string, find, replace) {
|
|
||||||
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshBottomUserInfoInDrawer(user, drawer) {
|
function refreshBottomUserInfoInDrawer(user, drawer) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
@ -582,7 +571,7 @@
|
||||||
} else {
|
} else {
|
||||||
Dashboard.navigate(link.href);
|
Dashboard.navigate(link.href);
|
||||||
}
|
}
|
||||||
}, 400);
|
}, 350);
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +588,7 @@
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Dashboard.logout();
|
Dashboard.logout();
|
||||||
}, 400);
|
}, 350);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -807,7 +796,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageClassOn('pagebeforeshow', 'page', function () {
|
pageClassOn('pageinit', 'page', function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
@ -815,7 +804,7 @@
|
||||||
requiresDashboardDrawerRefresh = true;
|
requiresDashboardDrawerRefresh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageBeforeShowDocumentReady(page);
|
onPageBeforeShow(page);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -823,20 +812,15 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
onPageShowDocumentReady(page);
|
if (!NavHelper.isBack()) {
|
||||||
|
// Scroll back up so in case vertical scroll was messed with
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
updateTabLinks(page);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//pageClassOn('pagebeforehide', 'page', function () {
|
function onPageBeforeShow(page) {
|
||||||
|
|
||||||
// var headroomEnabled = document.querySelectorAll('.headroomEnabled');
|
|
||||||
// for (var i = 0, length = headroomEnabled.length; i < length; i++) {
|
|
||||||
// headroomEnabled[i].classList.add('headroomDisabled');
|
|
||||||
// }
|
|
||||||
|
|
||||||
//});
|
|
||||||
|
|
||||||
function onPageBeforeShowDocumentReady(page) {
|
|
||||||
|
|
||||||
buildViewMenuBar(page);
|
buildViewMenuBar(page);
|
||||||
|
|
||||||
|
@ -934,15 +918,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPageShowDocumentReady(page) {
|
|
||||||
|
|
||||||
if (!NavHelper.isBack()) {
|
|
||||||
// Scroll back up so in case vertical scroll was messed with
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
}
|
|
||||||
updateTabLinks(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
function initHeadRoom(elem) {
|
function initHeadRoom(elem) {
|
||||||
|
|
||||||
if (!AppInfo.enableHeadRoom) {
|
if (!AppInfo.enableHeadRoom) {
|
||||||
|
@ -1006,59 +981,6 @@
|
||||||
|
|
||||||
})(window, document, jQuery, window.devicePixelRatio);
|
})(window, document, jQuery, window.devicePixelRatio);
|
||||||
|
|
||||||
$.fn.createHoverTouch = function () {
|
|
||||||
|
|
||||||
var preventHover = false;
|
|
||||||
var timerId;
|
|
||||||
|
|
||||||
function startTimer(elem) {
|
|
||||||
|
|
||||||
stopTimer();
|
|
||||||
|
|
||||||
timerId = setTimeout(function () {
|
|
||||||
|
|
||||||
Events.trigger(elem, 'hovertouch');
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopTimer(elem) {
|
|
||||||
|
|
||||||
if (timerId) {
|
|
||||||
clearTimeout(timerId);
|
|
||||||
timerId = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $(this).on('mouseenter', function () {
|
|
||||||
|
|
||||||
if (preventHover === true) {
|
|
||||||
preventHover = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
startTimer(this);
|
|
||||||
|
|
||||||
}).on('mouseleave', function () {
|
|
||||||
|
|
||||||
stopTimer(this);
|
|
||||||
|
|
||||||
}).on('touchstart', function () {
|
|
||||||
|
|
||||||
preventHover = true;
|
|
||||||
|
|
||||||
}).on('click', function () {
|
|
||||||
|
|
||||||
preventHover = true;
|
|
||||||
|
|
||||||
if (preventHover) {
|
|
||||||
Events.trigger(this, 'hovertouch');
|
|
||||||
stopTimer(this);
|
|
||||||
preventHover = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
var isCurrentNavBack = false;
|
var isCurrentNavBack = false;
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
|
|
||||||
self.resetEnhancements = function () {
|
self.resetEnhancements = function () {
|
||||||
|
|
||||||
|
if (!initComplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fadeOut(document.querySelector('#mediaPlayer'));
|
fadeOut(document.querySelector('#mediaPlayer'));
|
||||||
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
|
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
|
||||||
$('.hiddenOnIdle').removeClass("inactive");
|
$('.hiddenOnIdle').removeClass("inactive");
|
||||||
|
@ -676,6 +680,9 @@
|
||||||
|
|
||||||
Dashboard.importCss('css/mediaplayer-video.css');
|
Dashboard.importCss('css/mediaplayer-video.css');
|
||||||
|
|
||||||
|
// TODO: remove dependency on this file
|
||||||
|
Dashboard.importCss('css/nowplayingbar.css');
|
||||||
|
|
||||||
var html = '<div id="mediaPlayer" style="display: none;">';
|
var html = '<div id="mediaPlayer" style="display: none;">';
|
||||||
|
|
||||||
html += '<div class="videoBackdrop">';
|
html += '<div class="videoBackdrop">';
|
||||||
|
@ -749,8 +756,15 @@
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
var initComplete;
|
||||||
|
|
||||||
|
function initVideoElements() {
|
||||||
|
|
||||||
|
if (initComplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
initComplete = true;
|
||||||
ensureVideoPlayerElements();
|
ensureVideoPlayerElements();
|
||||||
|
|
||||||
var parent = $("#mediaPlayer");
|
var parent = $("#mediaPlayer");
|
||||||
|
@ -783,7 +797,7 @@
|
||||||
updateVolumeButtons(vol);
|
updateVolumeButtons(vol);
|
||||||
self.setVolume(vol);
|
self.setVolume(vol);
|
||||||
})[0];
|
})[0];
|
||||||
});
|
}
|
||||||
|
|
||||||
var idleHandlerTimeout;
|
var idleHandlerTimeout;
|
||||||
function idleHandler() {
|
function idleHandler() {
|
||||||
|
@ -924,13 +938,17 @@
|
||||||
// Replace audio version
|
// Replace audio version
|
||||||
self.cleanup = function (mediaRenderer) {
|
self.cleanup = function (mediaRenderer) {
|
||||||
|
|
||||||
currentTimeElement.html('--:--');
|
if (currentTimeElement) {
|
||||||
|
currentTimeElement.html('--:--');
|
||||||
|
}
|
||||||
|
|
||||||
unbindEventsForPlayback(mediaRenderer);
|
unbindEventsForPlayback(mediaRenderer);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.playVideo = function (item, mediaSource, startPosition, callback) {
|
self.playVideo = function (item, mediaSource, startPosition, callback) {
|
||||||
|
|
||||||
|
initVideoElements();
|
||||||
|
|
||||||
requirejs(['videorenderer'], function () {
|
requirejs(['videorenderer'], function () {
|
||||||
|
|
||||||
self.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
self.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
||||||
|
@ -1127,6 +1145,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updatePlaylistUi = function () {
|
self.updatePlaylistUi = function () {
|
||||||
|
|
||||||
|
if (!initComplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var index = self.currentPlaylistIndex(null);
|
var index = self.currentPlaylistIndex(null);
|
||||||
var length = self.playlist.length;
|
var length = self.playlist.length;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
var targets = [{
|
var targets = [{
|
||||||
name: Globalize.translate('MyDevice'),
|
name: Globalize.translate('MyDevice'),
|
||||||
id: ConnectionManager.deviceId(),
|
id: AppInfo.deviceId,
|
||||||
playerName: self.name,
|
playerName: self.name,
|
||||||
playableMediaTypes: ['Audio', 'Video'],
|
playableMediaTypes: ['Audio', 'Video'],
|
||||||
isLocalPlayer: true,
|
isLocalPlayer: true,
|
||||||
|
@ -1049,7 +1049,7 @@
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
|
||||||
self.lastBitrateDetect = 0;
|
self.lastBitrateDetections = {};
|
||||||
|
|
||||||
self.playInternal = function (item, startPosition, callback) {
|
self.playInternal = function (item, startPosition, callback) {
|
||||||
|
|
||||||
|
@ -1071,14 +1071,16 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - self.lastBitrateDetect) > 300000) {
|
var bitrateDetectionKey = ApiClient.serverAddress();
|
||||||
|
|
||||||
|
if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - (self.lastBitrateDetections[bitrateDetectionKey] || 0)) > 300000) {
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
ApiClient.detectBitrate().done(function (bitrate) {
|
ApiClient.detectBitrate().done(function (bitrate) {
|
||||||
|
|
||||||
Logger.log('Max bitrate auto detected to ' + bitrate);
|
Logger.log('Max bitrate auto detected to ' + bitrate);
|
||||||
self.lastBitrateDetect = new Date().getTime();
|
self.lastBitrateDetections[bitrateDetectionKey] = new Date().getTime();
|
||||||
AppSettings.maxStreamingBitrate(bitrate);
|
AppSettings.maxStreamingBitrate(bitrate);
|
||||||
|
|
||||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||||
|
@ -1997,17 +1999,8 @@
|
||||||
|
|
||||||
window.MediaPlayer = new mediaPlayer();
|
window.MediaPlayer = new mediaPlayer();
|
||||||
|
|
||||||
function onConnectionChange() {
|
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||||
window.MediaPlayer.lastBitrateDetect = 0;
|
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
|
||||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
|
||||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'localusersignedin', onConnectionChange);
|
|
||||||
Events.on(ConnectionManager, 'localusersignedout', onConnectionChange);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
})(document, setTimeout, clearTimeout, screen, $, setInterval, window);
|
})(document, setTimeout, clearTimeout, screen, $, setInterval, window);
|
|
@ -184,29 +184,24 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
if (window.ApiClient) {
|
||||||
|
initializeApiClient(window.ApiClient);
|
||||||
|
}
|
||||||
|
|
||||||
if (window.ApiClient) {
|
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||||
initializeApiClient(window.ApiClient);
|
initializeApiClient(apiClient);
|
||||||
}
|
});
|
||||||
|
|
||||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
Events.on(ConnectionManager, 'localusersignedin', function () {
|
||||||
initializeApiClient(apiClient);
|
needsRefresh = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'localusersignedin', function () {
|
Events.on(ConnectionManager, 'localusersignedout', function () {
|
||||||
needsRefresh = true;
|
needsRefresh = true;
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'localusersignedout', function () {
|
|
||||||
needsRefresh = true;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
pageClassOn('pageshow', "type-interior", function () {
|
pageClassOn('pageshow', "type-interior", function () {
|
||||||
|
|
||||||
var page = $(this);
|
|
||||||
|
|
||||||
if (needsRefresh) {
|
if (needsRefresh) {
|
||||||
Notifications.updateNotificationCount();
|
Notifications.updateNotificationCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,9 @@
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
elem = $(getNowPlayingBarHtml()).insertBefore('#footerNotifications')[0];
|
Dashboard.importCss('css/nowplayingbar.css');
|
||||||
|
|
||||||
|
elem = $(getNowPlayingBarHtml()).appendTo(document.body)[0];
|
||||||
|
|
||||||
if (($.browser.safari || !AppInfo.isNativeApp) && $.browser.mobile) {
|
if (($.browser.safari || !AppInfo.isNativeApp) && $.browser.mobile) {
|
||||||
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
||||||
|
@ -563,14 +565,11 @@
|
||||||
.on('positionchange', onStateChanged);
|
.on('positionchange', onStateChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
Events.on(MediaController, 'playerchange', function () {
|
||||||
|
|
||||||
Events.on(MediaController, 'playerchange', function () {
|
|
||||||
|
|
||||||
bindToPlayer(MediaController.getCurrentPlayer());
|
|
||||||
});
|
|
||||||
|
|
||||||
bindToPlayer(MediaController.getCurrentPlayer());
|
bindToPlayer(MediaController.getCurrentPlayer());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bindToPlayer(MediaController.getCurrentPlayer());
|
||||||
|
|
||||||
})(window, document, jQuery, setTimeout, clearTimeout);
|
})(window, document, jQuery, setTimeout, clearTimeout);
|
|
@ -387,15 +387,12 @@
|
||||||
$(apiClient).on("websocketmessage", onWebSocketMessageReceived).on("websocketopen", onWebSocketConnectionChange);
|
$(apiClient).on("websocketmessage", onWebSocketMessageReceived).on("websocketopen", onWebSocketConnectionChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.ready(function () {
|
if (window.ApiClient) {
|
||||||
|
initializeApiClient(window.ApiClient);
|
||||||
|
}
|
||||||
|
|
||||||
if (window.ApiClient) {
|
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||||
initializeApiClient(window.ApiClient);
|
initializeApiClient(apiClient);
|
||||||
}
|
|
||||||
|
|
||||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
|
||||||
initializeApiClient(apiClient);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(window, document, jQuery);
|
})(window, document, jQuery);
|
|
@ -435,6 +435,17 @@ var Dashboard = {
|
||||||
|
|
||||||
options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random());
|
options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random());
|
||||||
|
|
||||||
|
if (!$(".footer").length) {
|
||||||
|
|
||||||
|
var footerHtml = '<div id="footer" class="footer" data-theme="b" class="ui-bar-b">';
|
||||||
|
|
||||||
|
footerHtml += '<div id="footerNotifications"></div>';
|
||||||
|
footerHtml += '</div>';
|
||||||
|
|
||||||
|
$(document.body).append(footerHtml);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var footer = $(".footer").css("top", "initial").show();
|
var footer = $(".footer").css("top", "initial").show();
|
||||||
|
|
||||||
var parentElem = $('#footerNotifications', footer);
|
var parentElem = $('#footerNotifications', footer);
|
||||||
|
@ -1688,12 +1699,7 @@ var Dashboard = {
|
||||||
|
|
||||||
ready: function (fn) {
|
ready: function (fn) {
|
||||||
|
|
||||||
if (Dashboard.initPromiseDone) {
|
Dashboard.initPromise.then(fn);
|
||||||
fn();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.initPromise.done(fn);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadExternalPlayer: function () {
|
loadExternalPlayer: function () {
|
||||||
|
@ -1884,36 +1890,36 @@ var AppInfo = {};
|
||||||
initializeApiClient(newApiClient);
|
initializeApiClient(newApiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
if (Dashboard.isConnectMode()) {
|
if (Dashboard.isConnectMode()) {
|
||||||
|
|
||||||
var server = ConnectionManager.getLastUsedServer();
|
var server = ConnectionManager.getLastUsedServer();
|
||||||
|
|
||||||
if (!Dashboard.isServerlessPage()) {
|
if (!Dashboard.isServerlessPage()) {
|
||||||
|
|
||||||
if (server && server.UserId && server.AccessToken) {
|
if (server && server.UserId && server.AccessToken) {
|
||||||
ConnectionManager.connectToServer(server).done(function (result) {
|
ConnectionManager.connectToServer(server).done(function (result) {
|
||||||
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
||||||
window.ApiClient = result.ApiClient;
|
window.ApiClient = result.ApiClient;
|
||||||
}
|
}
|
||||||
deferred.resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
return deferred.promise();
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
resolve();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
|
||||||
|
apiClient.enableAutomaticNetworking = false;
|
||||||
|
ConnectionManager.addApiClient(apiClient);
|
||||||
|
Dashboard.importCss(apiClient.getUrl('Branding/Css'));
|
||||||
|
window.ApiClient = apiClient;
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
deferred.resolve();
|
});
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
var apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
|
|
||||||
apiClient.enableAutomaticNetworking = false;
|
|
||||||
ConnectionManager.addApiClient(apiClient);
|
|
||||||
Dashboard.importCss(apiClient.getUrl('Branding/Css'));
|
|
||||||
window.ApiClient = apiClient;
|
|
||||||
deferred.resolve();
|
|
||||||
}
|
|
||||||
return deferred.promise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFastClick() {
|
function initFastClick() {
|
||||||
|
@ -2004,82 +2010,6 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocumentReady() {
|
|
||||||
|
|
||||||
if ($.browser.msie) {
|
|
||||||
require(['devices/ie/ie']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do these now to prevent a flash of content
|
|
||||||
if (AppInfo.isNativeApp && $.browser.android) {
|
|
||||||
Dashboard.importCss('devices/android/android.css');
|
|
||||||
} else if (AppInfo.isNativeApp && $.browser.safari) {
|
|
||||||
Dashboard.importCss('devices/ios/ios.css');
|
|
||||||
} else if (!$.browser.android) {
|
|
||||||
Dashboard.importCss('devices/android/android.css');
|
|
||||||
}
|
|
||||||
|
|
||||||
loadTheme();
|
|
||||||
|
|
||||||
if ($.browser.safari && $.browser.mobile) {
|
|
||||||
initFastClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
var footerHtml = '<div id="footer" class="footer" data-theme="b" class="ui-bar-b">';
|
|
||||||
|
|
||||||
footerHtml += '<div id="footerNotifications"></div>';
|
|
||||||
footerHtml += '</div>';
|
|
||||||
|
|
||||||
$(document.body).append(footerHtml);
|
|
||||||
|
|
||||||
window.addEventListener("beforeunload", function () {
|
|
||||||
|
|
||||||
var apiClient = window.ApiClient;
|
|
||||||
|
|
||||||
// Close the connection gracefully when possible
|
|
||||||
if (apiClient && apiClient.isWebSocketOpen()) {
|
|
||||||
|
|
||||||
var localActivePlayers = MediaController.getPlayers().filter(function (p) {
|
|
||||||
|
|
||||||
return p.isLocalPlayer && p.isPlaying();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!localActivePlayers.length) {
|
|
||||||
Logger.log('Sending close web socket command');
|
|
||||||
apiClient.closeWebSocket();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova()) {
|
|
||||||
require(['cordova/connectsdk', 'scripts/registrationservices', 'cordova/back']);
|
|
||||||
|
|
||||||
if ($.browser.android) {
|
|
||||||
require(['cordova/android/androidcredentials', 'cordova/android/immersive', 'cordova/android/mediasession']);
|
|
||||||
} else {
|
|
||||||
require(['cordova/volume']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($.browser.safari) {
|
|
||||||
require(['cordova/ios/orientation']);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ($.browser.chrome) {
|
|
||||||
require(['scripts/chromecast']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AppInfo.enableNowPlayingBar) {
|
|
||||||
require(['scripts/nowplayingbar']);
|
|
||||||
Dashboard.importCss('css/nowplayingbar.css');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (navigator.splashscreen) {
|
|
||||||
navigator.splashscreen.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initRequire() {
|
function initRequire() {
|
||||||
|
|
||||||
var urlArgs = "v=" + window.dashboardVersion;
|
var urlArgs = "v=" + window.dashboardVersion;
|
||||||
|
@ -2115,7 +2045,7 @@ var AppInfo = {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(deferred, capabilities, appName, appVersion, deviceId, deviceName) {
|
function init(promiseResolve, capabilities, appName, appVersion, deviceId, deviceName) {
|
||||||
|
|
||||||
// Required since jQuery is loaded before requireJs
|
// Required since jQuery is loaded before requireJs
|
||||||
define('jquery', [], function () {
|
define('jquery', [], function () {
|
||||||
|
@ -2290,11 +2220,11 @@ var AppInfo = {};
|
||||||
loadImageCache();
|
loadImageCache();
|
||||||
$.extend(AppInfo, Dashboard.getAppInfo(appName, appVersion, deviceId, deviceName));
|
$.extend(AppInfo, Dashboard.getAppInfo(appName, appVersion, deviceId, deviceName));
|
||||||
|
|
||||||
initAfterDependencies(deferred, capabilities);
|
initAfterDependencies(promiseResolve, capabilities);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initAfterDependencies(deferred, capabilities) {
|
function initAfterDependencies(promiseResolve, capabilities) {
|
||||||
|
|
||||||
var drawer = document.querySelector('.mainDrawerPanel');
|
var drawer = document.querySelector('.mainDrawerPanel');
|
||||||
drawer.classList.remove('mainDrawerPanelPreInit');
|
drawer.classList.remove('mainDrawerPanelPreInit');
|
||||||
|
@ -2314,10 +2244,11 @@ var AppInfo = {};
|
||||||
var deps = [];
|
var deps = [];
|
||||||
|
|
||||||
if (AppInfo.isNativeApp && $.browser.android) {
|
if (AppInfo.isNativeApp && $.browser.android) {
|
||||||
deps.push('cordova/android/logging');
|
require(['cordova/android/logging']);
|
||||||
}
|
}
|
||||||
|
|
||||||
deps.push('appstorage');
|
deps.push('appstorage');
|
||||||
|
deps.push('scripts/mediaplayer');
|
||||||
|
|
||||||
require(deps, function () {
|
require(deps, function () {
|
||||||
|
|
||||||
|
@ -2342,64 +2273,98 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
|
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
|
||||||
createConnectionManager(capabilities).done(function () { onConnectionManagerCreated(deferred); });
|
|
||||||
|
|
||||||
//$(document.body).append('<div style="background:#00ACC1;position:fixed;z-index:999999;top:1px;left:1px;width:800px;height:450px;display:flex;align-items:center;justify-content:center;"><iron-icon icon="ondemand-video" style="width:320px;height:320px;color:#fff;"></iron-icon></div>');
|
var connectionManagerPromise = createConnectionManager(capabilities);
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConnectionManagerCreated(deferred) {
|
Promise.all([Globalize.ensure(), connectionManagerPromise]).then(function () {
|
||||||
|
|
||||||
Globalize.ensure().then(function () {
|
document.title = Globalize.translateDocument(document.title, 'html');
|
||||||
document.title = Globalize.translateDocument(document.title, 'html');
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
var mainDrawerPanelContent = document.querySelector('.mainDrawerPanelContent');
|
var mainDrawerPanelContent = document.querySelector('.mainDrawerPanelContent');
|
||||||
|
|
||||||
if (mainDrawerPanelContent) {
|
if (mainDrawerPanelContent) {
|
||||||
|
|
||||||
var newHtml = mainDrawerPanelContent.innerHTML.substring(4);
|
var newHtml = mainDrawerPanelContent.innerHTML.substring(4);
|
||||||
newHtml = newHtml.substring(0, newHtml.length - 3);
|
newHtml = newHtml.substring(0, newHtml.length - 3);
|
||||||
|
|
||||||
var srch = 'data-require=';
|
var srch = 'data-require=';
|
||||||
var index = newHtml.indexOf(srch);
|
var index = newHtml.indexOf(srch);
|
||||||
var depends;
|
var depends;
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
||||||
var requireAttribute = newHtml.substring(index + srch.length + 1);
|
var requireAttribute = newHtml.substring(index + srch.length + 1);
|
||||||
|
|
||||||
requireAttribute = requireAttribute.substring(0, requireAttribute.indexOf('"'));
|
requireAttribute = requireAttribute.substring(0, requireAttribute.indexOf('"'));
|
||||||
depends = requireAttribute.split(',');
|
depends = requireAttribute.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
depends = depends || [];
|
||||||
|
|
||||||
|
if (newHtml.indexOf('type-interior') != -1) {
|
||||||
|
depends.push('jqmpopup');
|
||||||
|
depends.push('jqmlistview');
|
||||||
|
depends.push('jqmcollapsible');
|
||||||
|
depends.push('jqmcontrolgroup');
|
||||||
|
depends.push('jqmcheckbox');
|
||||||
|
}
|
||||||
|
|
||||||
|
require(depends, function () {
|
||||||
|
|
||||||
|
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
|
||||||
|
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
|
||||||
|
onAppReady(promiseResolve);
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
depends = depends || [];
|
onAppReady(promiseResolve);
|
||||||
|
});
|
||||||
if (newHtml.indexOf('type-interior') != -1) {
|
|
||||||
depends.push('jqmpopup');
|
|
||||||
depends.push('jqmlistview');
|
|
||||||
depends.push('jqmcollapsible');
|
|
||||||
depends.push('jqmcontrolgroup');
|
|
||||||
depends.push('jqmcheckbox');
|
|
||||||
}
|
|
||||||
|
|
||||||
require(depends, function () {
|
|
||||||
|
|
||||||
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
|
|
||||||
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
|
|
||||||
onAppReady(deferred);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
onAppReady(deferred);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppReady(deferred) {
|
function onAppReady(promiseResolve) {
|
||||||
onDocumentReady();
|
|
||||||
|
if ($.browser.msie) {
|
||||||
|
require(['devices/ie/ie']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do these now to prevent a flash of content
|
||||||
|
if (AppInfo.isNativeApp && $.browser.android) {
|
||||||
|
Dashboard.importCss('devices/android/android.css');
|
||||||
|
} else if (AppInfo.isNativeApp && $.browser.safari) {
|
||||||
|
Dashboard.importCss('devices/ios/ios.css');
|
||||||
|
} else if (!$.browser.android) {
|
||||||
|
Dashboard.importCss('devices/android/android.css');
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTheme();
|
||||||
|
|
||||||
|
if ($.browser.safari && $.browser.mobile) {
|
||||||
|
initFastClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Dashboard.isRunningInCordova()) {
|
||||||
|
require(['cordova/connectsdk', 'scripts/registrationservices', 'cordova/back']);
|
||||||
|
|
||||||
|
if ($.browser.android) {
|
||||||
|
require(['cordova/android/androidcredentials', 'cordova/android/immersive', 'cordova/android/mediasession']);
|
||||||
|
} else {
|
||||||
|
require(['cordova/volume']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.browser.safari) {
|
||||||
|
require(['cordova/ios/orientation']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if ($.browser.chrome) {
|
||||||
|
require(['scripts/chromecast']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var deps = [];
|
var deps = [];
|
||||||
|
|
||||||
|
@ -2412,13 +2377,24 @@ var AppInfo = {};
|
||||||
deps.push('cordova/ios/tabbar');
|
deps.push('cordova/ios/tabbar');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deps.push('scripts/remotecontrol');
|
||||||
|
deps.push('scripts/search');
|
||||||
|
deps.push('scripts/librarylist');
|
||||||
|
deps.push('scripts/notifications');
|
||||||
|
|
||||||
require(deps, function () {
|
require(deps, function () {
|
||||||
|
|
||||||
Dashboard.initPromiseDone = true;
|
|
||||||
$.mobile.initializePage();
|
$.mobile.initializePage();
|
||||||
deferred.resolve();
|
promiseResolve();
|
||||||
|
require(['scripts/mediaplayer-video']);
|
||||||
});
|
});
|
||||||
//require(['localsync']);
|
|
||||||
|
if (AppInfo.enableNowPlayingBar) {
|
||||||
|
require(['scripts/nowplayingbar']);
|
||||||
|
}
|
||||||
|
|
||||||
|
require(['scripts/alphapicker']);
|
||||||
|
require(['scripts/thememediaplayer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadImageCache() {
|
function loadImageCache() {
|
||||||
|
@ -2461,33 +2437,33 @@ var AppInfo = {};
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var initDeferred = $.Deferred();
|
Dashboard.initPromise = new Promise(function (resolve, reject) {
|
||||||
Dashboard.initPromise = initDeferred.promise();
|
|
||||||
|
|
||||||
setAppInfo();
|
setAppInfo();
|
||||||
setDocumentClasses();
|
setDocumentClasses();
|
||||||
|
|
||||||
function onWebComponentsReady() {
|
function onWebComponentsReady() {
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
initCordova(initDeferred);
|
initCordova(resolve);
|
||||||
} else {
|
} else {
|
||||||
init(initDeferred, Dashboard.capabilities());
|
init(resolve, Dashboard.capabilities());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
initRequire();
|
initRequire();
|
||||||
|
|
||||||
if ('registerElement' in document && 'content' in document.createElement('template')) {
|
if ('registerElement' in document && 'content' in document.createElement('template')) {
|
||||||
onWebComponentsReady();
|
onWebComponentsReady();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
document.addEventListener('WebComponentsReady', function () {
|
document.addEventListener('WebComponentsReady', function () {
|
||||||
|
|
||||||
var delay = $.browser.mobile ? 500 : 300;
|
var delay = $.browser.mobile ? 500 : 300;
|
||||||
setTimeout(onWebComponentsReady, delay);
|
setTimeout(onWebComponentsReady, delay);
|
||||||
});
|
});
|
||||||
require(['bower_components/webcomponentsjs/webcomponents-lite.min.js']);
|
require(['bower_components/webcomponentsjs/webcomponents-lite.min.js']);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -2612,4 +2588,23 @@ pageClassOn('pageshow', "page", function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("beforeunload", function () {
|
||||||
|
|
||||||
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
|
// Close the connection gracefully when possible
|
||||||
|
if (apiClient && apiClient.isWebSocketOpen()) {
|
||||||
|
|
||||||
|
var localActivePlayers = MediaController.getPlayers().filter(function (p) {
|
||||||
|
|
||||||
|
return p.isLocalPlayer && p.isPlaying();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!localActivePlayers.length) {
|
||||||
|
Logger.log('Sending close web socket command');
|
||||||
|
apiClient.closeWebSocket();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Dashboard.jQueryMobileInit();
|
Dashboard.jQueryMobileInit();
|
|
@ -2365,11 +2365,7 @@
|
||||||
|
|
||||||
var link = parentWithTag(event.target, 'A');
|
var link = parentWithTag(event.target, 'A');
|
||||||
|
|
||||||
var $link = $(link),
|
var $link = $(link);
|
||||||
|
|
||||||
baseUrl, href,
|
|
||||||
useDefaultUrlHandling, isExternal,
|
|
||||||
reverse, role;
|
|
||||||
|
|
||||||
// If there is no link associated with the click or its not a left
|
// If there is no link associated with the click or its not a left
|
||||||
// click we want to ignore the click
|
// click we want to ignore the click
|
||||||
|
@ -2385,10 +2381,10 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
baseUrl = $.mobile.getClosestBaseUrl(link);
|
var baseUrl = $.mobile.getClosestBaseUrl(link);
|
||||||
|
|
||||||
//get href, if defined, otherwise default to empty hash
|
//get href, if defined, otherwise default to empty hash
|
||||||
href = $.mobile.path.makeUrlAbsolute(link.getAttribute("href") || "#", baseUrl);
|
var href = $.mobile.path.makeUrlAbsolute(link.getAttribute("href") || "#", baseUrl);
|
||||||
|
|
||||||
// XXX_jblas: Ideally links to application pages should be specified as
|
// XXX_jblas: Ideally links to application pages should be specified as
|
||||||
// an url to the application document with a hash that is either
|
// an url to the application document with a hash that is either
|
||||||
|
@ -2417,25 +2413,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should we handle this link, or let the browser deal with it?
|
// Should we handle this link, or let the browser deal with it?
|
||||||
useDefaultUrlHandling = link.getAttribute("rel") == "external" || link.getAttribute("data-ajax") == "false" || link.getAttribute('target');
|
|
||||||
|
|
||||||
//check for protocol or rel and its not an embedded page
|
//check for protocol or rel and its not an embedded page
|
||||||
//TODO overlap in logic from isExternal, rel=external check should be
|
//TODO overlap in logic from isExternal, rel=external check should be
|
||||||
// moved into more comprehensive isExternalLink
|
// moved into more comprehensive isExternalLink
|
||||||
isExternal = useDefaultUrlHandling || ($.mobile.path.isExternal(href));
|
if (link.getAttribute("rel") == "external" || link.getAttribute("data-ajax") == "false" || link.getAttribute('target') || ($.mobile.path.isExternal(href))) {
|
||||||
|
|
||||||
if (isExternal) {
|
|
||||||
//use default click handling
|
//use default click handling
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//use ajax
|
//use ajax
|
||||||
reverse = $link.data("direction") === "reverse" ||
|
var reverse = $link.data("direction") === "reverse";
|
||||||
// deprecated - remove by 1.0
|
|
||||||
$link.data("back");
|
|
||||||
|
|
||||||
//this may need to be more specific as we use data-rel more
|
//this may need to be more specific as we use data-rel more
|
||||||
role = link.getAttribute("data-rel") || undefined;
|
var role = link.getAttribute("data-rel") || undefined;
|
||||||
|
|
||||||
$.mobile.changePage(href, { reverse: reverse, role: role, link: $link });
|
$.mobile.changePage(href, { reverse: reverse, role: role, link: $link });
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -2493,24 +2483,21 @@
|
||||||
initializePage: function () {
|
initializePage: function () {
|
||||||
// find present pages
|
// find present pages
|
||||||
var path = $.mobile.path,
|
var path = $.mobile.path,
|
||||||
$pages = $(document.querySelectorAll("div[data-role='page']")),
|
firstPage = document.querySelector("div[data-role='page']"),
|
||||||
hash = path.stripHash(path.stripQueryParams(path.parseLocation().hash)),
|
hash = path.stripHash(path.stripQueryParams(path.parseLocation().hash)),
|
||||||
theLocation = $.mobile.path.parseLocation(),
|
theLocation = $.mobile.path.parseLocation(),
|
||||||
hashPage = hash ? document.getElementById(hash) : undefined;
|
hashPage = hash ? document.getElementById(hash) : undefined;
|
||||||
|
|
||||||
// add dialogs, set data-url attrs
|
// add dialogs, set data-url attrs
|
||||||
$pages.each(function () {
|
if (firstPage) {
|
||||||
var $this = $(this);
|
|
||||||
|
|
||||||
// unless the data url is already set set it to the pathname
|
// unless the data url is already set set it to the pathname
|
||||||
if (!$this[0].getAttribute("data-url")) {
|
if (!firstPage.getAttribute("data-url")) {
|
||||||
$this.attr("data-url", $this.attr("id") ||
|
firstPage.setAttribute("data-url", firstPage.getAttribute("id") || path.convertUrlToDataUrl(theLocation.pathname + theLocation.search));
|
||||||
path.convertUrlToDataUrl(theLocation.pathname + theLocation.search));
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
// define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback)
|
// define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback)
|
||||||
$.mobile.firstPage = $pages.first();
|
$.mobile.firstPage = $(firstPage);
|
||||||
|
|
||||||
// define page container
|
// define page container
|
||||||
$.mobile.pageContainer = $.mobile.firstPage
|
$.mobile.pageContainer = $.mobile.firstPage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue