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

declare dependency

This commit is contained in:
Luke Pulverenti 2015-12-05 10:34:10 -05:00
parent f6b71369e3
commit a1d3c595d0
38 changed files with 155 additions and 138 deletions

View file

@ -88,7 +88,9 @@
})).then(function (result) {
load(page, result.Items);
require(['paper-fab'], function() {
load(page, result.Items);
});
Dashboard.hideLoadingMsg();
});

View file

@ -27,7 +27,8 @@
}
var url = getUrl(name, culture);
var requestUrl = url + "?v=" + window.dashboardVersion;
var requestUrl = url + "?v=" + AppInfo.appVersion;
var xhr = new XMLHttpRequest();
xhr.open('GET', requestUrl, true);

View file

@ -1,96 +1,102 @@
(function () {
function getTimersHtml(timers) {
var html = '';
var index = '';
return new Promise(function (resolve, reject) {
for (var i = 0, length = timers.length; i < length; i++) {
require(['paper-fab'], function () {
var html = '';
var timer = timers[i];
var index = '';
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
for (var i = 0, length = timers.length; i < length; i++) {
if (startDateText != index) {
var timer = timers[i];
if (index) {
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
if (startDateText != index) {
if (index) {
html += '</div>';
html += '</div>';
}
html += '<div class="homePageSection">';
html += '<h1>' + startDateText + '</h1>';
html += '<div class="paperList">';
index = startDateText;
}
html += '<paper-icon-item>';
var program = timer.ProgramInfo || {};
var imgUrl;
if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: program.ImageTags.Primary,
type: "Primary"
});
}
if (imgUrl) {
html += '<paper-fab mini class="blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else if (program.IsKids) {
html += '<paper-fab mini style="background:#2196F3;" icon="person" item-icon></paper-fab>';
}
else if (program.IsSports) {
html += '<paper-fab mini style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
}
else if (program.IsMovie) {
html += '<paper-fab mini icon="movie" item-icon></paper-fab>';
}
else if (program.IsNews) {
html += '<paper-fab mini style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
}
else {
html += '<paper-fab mini class="blue" icon="live-tv" item-icon></paper-fab>';
}
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
html += '<div>';
html += timer.Name;
html += '</div>';
html += '<div secondary>';
html += LibraryBrowser.getDisplayTime(timer.StartDate);
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
html += '</div>';
html += '</a>';
html += '</paper-item-body>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
html += '</paper-icon-item>';
}
if (timers.length) {
html += '</div>';
html += '</div>';
}
html += '<div class="homePageSection">';
html += '<h1>' + startDateText + '</h1>';
html += '<div class="paperList">';
index = startDateText;
}
html += '<paper-icon-item>';
var program = timer.ProgramInfo || {};
var imgUrl;
if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: program.ImageTags.Primary,
type: "Primary"
});
}
if (imgUrl) {
html += '<paper-fab mini class="blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else if (program.IsKids) {
html += '<paper-fab mini style="background:#2196F3;" icon="person" item-icon></paper-fab>';
}
else if (program.IsSports) {
html += '<paper-fab mini style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
}
else if (program.IsMovie) {
html += '<paper-fab mini icon="movie" item-icon></paper-fab>';
}
else if (program.IsNews) {
html += '<paper-fab mini style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
}
else {
html += '<paper-fab mini class="blue" icon="live-tv" item-icon></paper-fab>';
}
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
html += '<div>';
html += timer.Name;
html += '</div>';
html += '<div secondary>';
html += LibraryBrowser.getDisplayTime(timer.StartDate);
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
html += '</div>';
html += '</a>';
html += '</paper-item-body>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
html += '</paper-icon-item>';
}
if (timers.length) {
html += '</div>';
html += '</div>';
}
return html;
resolve(html);
});
});
}
window.LiveTvHelpers = {

View file

@ -109,8 +109,9 @@
}).then(function (result) {
renderRecordingGroups(page, result.Items);
require(['paper-fab'], function () {
renderRecordingGroups(page, result.Items);
});
});
}

View file

@ -141,15 +141,15 @@
var timers = result.Items;
var html = LiveTvHelpers.getTimersHtml(timers);
LiveTvHelpers.getTimersHtml(timers).then(function(html) {
var elem = $('.scheduleTab', page).html(html);
var elem = $('.scheduleTab', page).html(html);
$('.btnDeleteTimer', elem).on('click', function () {
$('.btnDeleteTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
deleteTimer(page, id);
});
});
}

View file

@ -104,7 +104,9 @@
ApiClient.getLiveTvSeriesTimers(query).then(function (result) {
renderTimers(page, result.Items);
require(['paper-fab'], function() {
renderTimers(page, result.Items);
});
LibraryBrowser.setLastRefreshed(page);
});

View file

@ -21,18 +21,18 @@
function renderTimers(page, timers) {
var html = LiveTvHelpers.getTimersHtml(timers);
LiveTvHelpers.getTimersHtml(timers).then(function (html) {
var elem = $('#items', page).html(html);
var elem = $('#items', page).html(html);
$('.btnDeleteTimer', elem).on('click', function () {
$('.btnDeleteTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
});
deleteTimer(page, id);
Dashboard.hideLoadingMsg();
});
Dashboard.hideLoadingMsg();
}
function reload(page) {

View file

@ -108,7 +108,7 @@
});
}
require(['humanedate'], function() {
require(['humanedate', 'paper-fab'], function () {
for (var i = 0, length = list.length; i < length; i++) {
var notification = list[i];

View file

@ -66,7 +66,9 @@
var page = this;
reload(page);
require(['paper-fab'], function () {
reload(page);
});
});
})(jQuery, window);

View file

@ -97,7 +97,7 @@
function showPlaybackOverlay(deferred) {
require(['components/paperdialoghelper'], function () {
require(['components/paperdialoghelper', 'paper-fab'], function () {
var dlg = PaperDialogHelper.createDialog({});

View file

@ -279,7 +279,10 @@
Dashboard.showLoadingMsg();
startInterval();
reloadList(page);
require(['paper-fab', 'paper-progress'], function () {
reloadList(page);
});
$(ApiClient).on("websocketmessage", onWebSocketMessage).on("websocketopen", onWebSocketConnectionOpen);

View file

@ -185,7 +185,7 @@ var Dashboard = {
importCss: function (url) {
var originalUrl = url;
url += "?v=" + window.dashboardVersion;
url += "?v=" + AppInfo.appVersion;
if (!Dashboard.importedCss) {
Dashboard.importedCss = [];
@ -1826,6 +1826,7 @@ var AppInfo = {};
define("scale-up-animation", ["html!bower_components/neon-animation/animations/scale-up-animation.html"]);
define("paper-dialog", ["html!bower_components/paper-dialog/paper-dialog.html"]);
define("paper-fab", ["html!bower_components/paper-fab/paper-fab.html"]);
define("paper-progress", ["html!bower_components/paper-progress/paper-progress.html"]);
define("paper-input", ["html!bower_components/paper-input/paper-input.html"]);
define("paper-icon-item", ["html!bower_components/paper-item/paper-icon-item.html"]);
define("paper-item-body", ["html!bower_components/paper-item/paper-item-body.html"]);
@ -2005,7 +2006,6 @@ var AppInfo = {};
deps.push('paper-icon-button');
// TODO: These need to be removed
deps.push('paper-fab');
deps.push('paper-icon-item');
deps.push('paper-item-body');

View file

@ -212,7 +212,7 @@
function showSyncMenuInternal(options) {
require(['components/paperdialoghelper'], function () {
require(['components/paperdialoghelper', 'paper-fab'], function () {
var userId = Dashboard.getCurrentUserId();