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

add requirejs

This commit is contained in:
Luke Pulverenti 2015-05-08 23:48:43 -04:00
parent 03ca18cf4f
commit 4e71751d0f
20 changed files with 379 additions and 520 deletions

View file

@ -1460,6 +1460,20 @@ var Dashboard = {
deviceName: deviceName,
deviceId: deviceId
};
},
loadSwipebox: function() {
var deferred = DeferredBuilder.Deferred();
require([
'thirdparty/swipebox-master/js/jquery.swipebox.min',
'css!thirdparty/swipebox-master/css/swipebox.min'
], function () {
deferred.resolve();
});
return deferred.promise();
}
};
@ -1583,12 +1597,16 @@ var AppInfo = {};
function initFastClick() {
FastClick.attach(document.body);
requirejs(["thirdparty/fastclick"], function (FastClick) {
// Have to work around this issue of fast click breaking the panel dismiss
$(document.body).on('touchstart', '.ui-panel-dismiss', function () {
$(this).trigger('click');
FastClick.attach(document.body);
// Have to work around this issue of fast click breaking the panel dismiss
$(document.body).on('touchstart', '.ui-panel-dismiss', function () {
$(this).trigger('click');
});
});
}
function onReady() {
@ -1725,10 +1743,17 @@ var AppInfo = {};
var apiClient = ConnectionManager.currentApiClient();
// Close the connection gracefully when possible
if (apiClient && apiClient.isWebSocketOpen() && !MediaPlayer.isPlaying()) {
if (apiClient && apiClient.isWebSocketOpen()) {
console.log('Sending close web socket command');
apiClient.closeWebSocket();
var localActivePlayers = MediaController.getPlayers().filter(function (p) {
return p.isLocalPlayer && p.isPlaying();
});
if (!localActivePlayers.length) {
console.log('Sending close web socket command');
apiClient.closeWebSocket();
}
}
});
@ -1741,6 +1766,19 @@ var AppInfo = {};
});
}
requirejs.config({
map: {
'*': {
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
}
}
});
// Required since jQuery is loaded before requireJs
define('jquery', [], function () {
return jQuery;
});
setAppInfo();
createConnectionManager();