mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
minify resources
This commit is contained in:
parent
8a6884abef
commit
661eeac16e
201 changed files with 203 additions and 52376 deletions
|
@ -1,114 +1 @@
|
|||
define(['dialogHelper', 'datetime', 'emby-select', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, datetime) {
|
||||
'use strict';
|
||||
|
||||
function getDisplayTime(hours) {
|
||||
|
||||
var minutes = 0;
|
||||
|
||||
var pct = hours % 1;
|
||||
|
||||
if (pct) {
|
||||
minutes = parseInt(pct * 60);
|
||||
}
|
||||
|
||||
return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0));
|
||||
}
|
||||
|
||||
function populateHours(context) {
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var i = 0; i < 24; i++) {
|
||||
|
||||
html += '<option value="' + i + '">' + getDisplayTime(i) + '</option>';
|
||||
}
|
||||
|
||||
html += '<option value="24">' + getDisplayTime(0) + '</option>';
|
||||
|
||||
context.querySelector('#selectStart').innerHTML = html;
|
||||
context.querySelector('#selectEnd').innerHTML = html;
|
||||
}
|
||||
|
||||
function loadSchedule(context, schedule) {
|
||||
|
||||
context.querySelector('#selectDay').value = schedule.DayOfWeek || 'Sunday';
|
||||
context.querySelector('#selectStart').value = schedule.StartHour || 0;
|
||||
context.querySelector('#selectEnd').value = schedule.EndHour || 0;
|
||||
}
|
||||
|
||||
function submitSchedule(context, options) {
|
||||
|
||||
var updatedSchedule = {
|
||||
DayOfWeek: context.querySelector('#selectDay').value,
|
||||
StartHour: context.querySelector('#selectStart').value,
|
||||
EndHour: context.querySelector('#selectEnd').value
|
||||
};
|
||||
|
||||
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) {
|
||||
|
||||
alert(Globalize.translate('ErrorMessageStartHourGreaterThanEnd'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
context.submitted = true;
|
||||
options.schedule = Object.assign(options.schedule, updatedSchedule);
|
||||
dialogHelper.close(context);
|
||||
}
|
||||
|
||||
return {
|
||||
show: function (options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/accessschedule/accessschedule.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
size: 'small'
|
||||
});
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += Globalize.translateDocument(template);
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
populateHours(dlg);
|
||||
loadSchedule(dlg, options.schedule);
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (dlg.submitted) {
|
||||
resolve(options.schedule);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
submitSchedule(dlg, options);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","datetime","emby-select","paper-icon-button-light","formDialogStyle"],function(dialogHelper,datetime){"use strict";function getDisplayTime(hours){var minutes=0,pct=hours%1;return pct&&(minutes=parseInt(60*pct)),datetime.getDisplayTime(new Date(2e3,1,1,hours,minutes,0,0))}function populateHours(context){for(var html="",i=0;i<24;i++)html+='<option value="'+i+'">'+getDisplayTime(i)+"</option>";html+='<option value="24">'+getDisplayTime(0)+"</option>",context.querySelector("#selectStart").innerHTML=html,context.querySelector("#selectEnd").innerHTML=html}function loadSchedule(context,schedule){context.querySelector("#selectDay").value=schedule.DayOfWeek||"Sunday",context.querySelector("#selectStart").value=schedule.StartHour||0,context.querySelector("#selectEnd").value=schedule.EndHour||0}function submitSchedule(context,options){var updatedSchedule={DayOfWeek:context.querySelector("#selectDay").value,StartHour:context.querySelector("#selectStart").value,EndHour:context.querySelector("#selectEnd").value};return parseFloat(updatedSchedule.StartHour)>=parseFloat(updatedSchedule.EndHour)?void alert(Globalize.translate("ErrorMessageStartHourGreaterThanEnd")):(context.submitted=!0,options.schedule=Object.assign(options.schedule,updatedSchedule),void dialogHelper.close(context))}return{show:function(options){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/accessschedule/accessschedule.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,populateHours(dlg),loadSchedule(dlg,options.schedule),dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve(options.schedule):reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return submitSchedule(dlg,options),e.preventDefault(),!1})},xhr.send()})}}});
|
|
@ -1,20 +1 @@
|
|||
.appfooter {
|
||||
background: #1c1c1c;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
bottom: 0;
|
||||
transition: transform 180ms linear;
|
||||
contain: layout style;
|
||||
}
|
||||
|
||||
.appfooter-blurred {
|
||||
background: rgba(28,28,28,.92);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
.appfooter.headroom--unpinned {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
.appfooter{background:#1c1c1c;position:fixed;left:0;right:0;z-index:1;bottom:0;-webkit-transition:-webkit-transform 180ms linear;-o-transition:transform 180ms linear;transition:transform 180ms linear;contain:layout style}.appfooter-blurred{background:rgba(28,28,28,.92);-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px)}.appfooter.headroom--unpinned{-webkit-transform:translateY(100%);transform:translateY(100%)}
|
|
@ -1,61 +1 @@
|
|||
define(['browser', 'css!./appfooter'], function (browser) {
|
||||
'use strict';
|
||||
|
||||
function render(options) {
|
||||
|
||||
var elem = document.createElement('div');
|
||||
|
||||
elem.classList.add('appfooter');
|
||||
|
||||
if (browser.safari) {
|
||||
elem.classList.add('appfooter-blurred');
|
||||
}
|
||||
|
||||
document.body.appendChild(elem);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function initHeadRoom(instance, elem) {
|
||||
|
||||
require(["headroom-window"], function (headroom) {
|
||||
|
||||
self.headroom = headroom;
|
||||
headroom.add(elem);
|
||||
});
|
||||
}
|
||||
|
||||
function appFooter(options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.element = render(options);
|
||||
|
||||
self.add = function (elem) {
|
||||
self.element.appendChild(elem);
|
||||
};
|
||||
|
||||
self.insert = function (elem) {
|
||||
if (typeof elem === 'string') {
|
||||
self.element.insertAdjacentHTML('afterbegin', elem);
|
||||
} else {
|
||||
self.element.insertBefore(elem, self.element.firstChild);
|
||||
}
|
||||
};
|
||||
|
||||
initHeadRoom(self, self.element);
|
||||
}
|
||||
|
||||
appFooter.prototype.destroy = function () {
|
||||
var self = this;
|
||||
|
||||
if (self.headroom) {
|
||||
self.headroom.remove(self.element);
|
||||
self.headroom = null;
|
||||
}
|
||||
|
||||
self.element = null;
|
||||
};
|
||||
|
||||
return appFooter;
|
||||
});
|
||||
define(["browser","css!./appfooter"],function(browser){"use strict";function render(options){var elem=document.createElement("div");return elem.classList.add("appfooter"),browser.safari&&elem.classList.add("appfooter-blurred"),document.body.appendChild(elem),elem}function initHeadRoom(instance,elem){require(["headroom-window"],function(headroom){self.headroom=headroom,headroom.add(elem)})}function appFooter(options){var self=this;self.element=render(options),self.add=function(elem){self.element.appendChild(elem)},self.insert=function(elem){"string"==typeof elem?self.element.insertAdjacentHTML("afterbegin",elem):self.element.insertBefore(elem,self.element.firstChild)},initHeadRoom(self,self.element)}return appFooter.prototype.destroy=function(){var self=this;self.headroom&&(self.headroom.remove(self.element),self.headroom=null),self.element=null},appFooter});
|
|
@ -1,245 +1 @@
|
|||
define(['appStorage', 'browser'], function (appStorage, browser) {
|
||||
'use strict';
|
||||
|
||||
function getDeviceProfile() {
|
||||
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
function getCapabilities() {
|
||||
|
||||
var caps = {
|
||||
PlayableMediaTypes: ['Audio', 'Video'],
|
||||
|
||||
SupportsPersistentIdentifier: false,
|
||||
DeviceProfile: getDeviceProfile()
|
||||
};
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
function generateDeviceId() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(["cryptojs-sha1"], function () {
|
||||
|
||||
var keys = [];
|
||||
keys.push(navigator.userAgent);
|
||||
keys.push(new Date().getTime());
|
||||
|
||||
resolve(CryptoJS.SHA1(keys.join('|')).toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getDeviceId() {
|
||||
var key = '_deviceId2';
|
||||
var deviceId = appStorage.getItem(key);
|
||||
|
||||
if (deviceId) {
|
||||
return Promise.resolve(deviceId);
|
||||
} else {
|
||||
return generateDeviceId().then(function (deviceId) {
|
||||
appStorage.setItem(key, deviceId);
|
||||
return deviceId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getDeviceName() {
|
||||
var deviceName;
|
||||
|
||||
if (browser.tizen) {
|
||||
deviceName = "Samsung Smart TV";
|
||||
} else if (browser.web0S) {
|
||||
deviceName = "LG Smart TV";
|
||||
} else if (browser.operaTv) {
|
||||
deviceName = "Opera TV";
|
||||
} else if (browser.xboxOne) {
|
||||
deviceName = "Xbox One";
|
||||
} else if (browser.ps4) {
|
||||
deviceName = "Sony PS4";
|
||||
} else if (browser.chrome) {
|
||||
deviceName = "Chrome";
|
||||
} else if (browser.edge) {
|
||||
deviceName = "Edge";
|
||||
} else if (browser.firefox) {
|
||||
deviceName = "Firefox";
|
||||
} else if (browser.msie) {
|
||||
deviceName = "Internet Explorer";
|
||||
} else {
|
||||
deviceName = "Web Browser";
|
||||
}
|
||||
|
||||
if (browser.version) {
|
||||
deviceName += " " + browser.version;
|
||||
}
|
||||
|
||||
if (browser.ipad) {
|
||||
deviceName += " Ipad";
|
||||
} else if (browser.iphone) {
|
||||
deviceName += " Iphone";
|
||||
} else if (browser.android) {
|
||||
deviceName += " Android";
|
||||
}
|
||||
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
function supportsVoiceInput() {
|
||||
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return window.SpeechRecognition ||
|
||||
window.webkitSpeechRecognition ||
|
||||
window.mozSpeechRecognition ||
|
||||
window.oSpeechRecognition ||
|
||||
window.msSpeechRecognition;
|
||||
}
|
||||
|
||||
function supportsFullscreen() {
|
||||
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
};
|
||||
|
||||
var element = document.documentElement;
|
||||
|
||||
return element.requestFullscreen ||
|
||||
element.mozRequestFullScreen ||
|
||||
element.webkitRequestFullscreen ||
|
||||
element.msRequestFullscreen;
|
||||
}
|
||||
|
||||
function getSyncProfile() {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['browserdeviceprofile', 'qualityoptions', 'appSettings'], function (profileBuilder, qualityoptions, appSettings) {
|
||||
|
||||
var profile = profileBuilder();
|
||||
|
||||
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
||||
|
||||
resolve(profile);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var supportedFeatures = function () {
|
||||
|
||||
var features = [
|
||||
'filedownload',
|
||||
'sharing',
|
||||
'externalpremium'
|
||||
];
|
||||
|
||||
if (browser.operaTv || browser.tizen || browser.web0s) {
|
||||
features.push('exit');
|
||||
} else {
|
||||
features.push('exitmenu');
|
||||
}
|
||||
|
||||
if (!browser.operaTv) {
|
||||
features.push('externallinks');
|
||||
}
|
||||
|
||||
if (supportsVoiceInput()) {
|
||||
features.push('voiceinput');
|
||||
}
|
||||
|
||||
if (!browser.mobile || browser.edgeUwp) {
|
||||
features.push('htmlaudioautoplay');
|
||||
features.push('htmlvideoautoplay');
|
||||
}
|
||||
|
||||
if (window.SyncRegistered) {
|
||||
//features.push('sync');
|
||||
}
|
||||
|
||||
if (supportsFullscreen()) {
|
||||
features.push('fullscreenchange');
|
||||
}
|
||||
|
||||
if (browser.chrome || (browser.edge && !browser.slow)) {
|
||||
features.push('imageanalysis');
|
||||
}
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
features.push('multiserver');
|
||||
}
|
||||
|
||||
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
||||
features.push('physicalvolumecontrol');
|
||||
}
|
||||
|
||||
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||
features.push('remotecontrol');
|
||||
}
|
||||
|
||||
return features;
|
||||
}();
|
||||
|
||||
var appInfo;
|
||||
var version = window.dashboardVersion || '3.0';
|
||||
|
||||
return {
|
||||
getWindowState: function () {
|
||||
return document.windowState || 'Normal';
|
||||
},
|
||||
setWindowState: function (state) {
|
||||
alert('setWindowState is not supported and should not be called');
|
||||
},
|
||||
exit: function () {
|
||||
|
||||
if (browser.tizen) {
|
||||
try {
|
||||
tizen.application.getCurrentApplication().exit();
|
||||
} catch (err) {
|
||||
console.log('error closing application: ' + err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
supports: function (command) {
|
||||
|
||||
return supportedFeatures.indexOf(command.toLowerCase()) != -1;
|
||||
},
|
||||
unlockedFeatures: function () {
|
||||
|
||||
var features = [];
|
||||
|
||||
features.push('playback');
|
||||
features.push('livetv');
|
||||
|
||||
return features;
|
||||
},
|
||||
appInfo: function () {
|
||||
|
||||
if (appInfo) {
|
||||
return Promise.resolve(appInfo);
|
||||
}
|
||||
|
||||
return getDeviceId().then(function (deviceId) {
|
||||
|
||||
appInfo = {
|
||||
deviceId: deviceId,
|
||||
deviceName: getDeviceName(),
|
||||
appName: 'Emby Mobile',
|
||||
appVersion: version
|
||||
};
|
||||
|
||||
return appInfo;
|
||||
});
|
||||
},
|
||||
capabilities: getCapabilities,
|
||||
preferVisualCards: browser.android || browser.chrome,
|
||||
moreIcon: browser.safari || browser.edge ? 'dots-horiz' : 'dots-vert',
|
||||
getSyncProfile: getSyncProfile
|
||||
};
|
||||
});
|
||||
define(["appStorage","browser"],function(appStorage,browser){"use strict";function getDeviceProfile(){return null}function getCapabilities(){var caps={PlayableMediaTypes:["Audio","Video"],SupportsPersistentIdentifier:!1,DeviceProfile:getDeviceProfile()};return caps}function generateDeviceId(){return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){var keys=[];keys.push(navigator.userAgent),keys.push((new Date).getTime()),resolve(CryptoJS.SHA1(keys.join("|")).toString())})})}function getDeviceId(){var key="_deviceId2",deviceId=appStorage.getItem(key);return deviceId?Promise.resolve(deviceId):generateDeviceId().then(function(deviceId){return appStorage.setItem(key,deviceId),deviceId})}function getDeviceName(){var deviceName;return deviceName=browser.tizen?"Samsung Smart TV":browser.web0S?"LG Smart TV":browser.operaTv?"Opera TV":browser.xboxOne?"Xbox One":browser.ps4?"Sony PS4":browser.chrome?"Chrome":browser.edge?"Edge":browser.firefox?"Firefox":browser.msie?"Internet Explorer":"Web Browser",browser.version&&(deviceName+=" "+browser.version),browser.ipad?deviceName+=" Ipad":browser.iphone?deviceName+=" Iphone":browser.android&&(deviceName+=" Android"),deviceName}function supportsVoiceInput(){return!browser.tv&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.oSpeechRecognition||window.msSpeechRecognition)}function supportsFullscreen(){if(browser.tv)return!1;var element=document.documentElement;return element.requestFullscreen||element.mozRequestFullScreen||element.webkitRequestFullscreen||element.msRequestFullscreen}function getSyncProfile(){return new Promise(function(resolve,reject){require(["browserdeviceprofile","qualityoptions","appSettings"],function(profileBuilder,qualityoptions,appSettings){var profile=profileBuilder();profile.MaxStaticMusicBitrate=appSettings.maxStaticMusicBitrate(),resolve(profile)})})}var appInfo,supportedFeatures=function(){var features=["filedownload","sharing","externalpremium"];return browser.operaTv||browser.tizen||browser.web0s?features.push("exit"):features.push("exitmenu"),browser.operaTv||features.push("externallinks"),supportsVoiceInput()&&features.push("voiceinput"),browser.mobile&&!browser.edgeUwp||(features.push("htmlaudioautoplay"),features.push("htmlvideoautoplay")),window.SyncRegistered,supportsFullscreen()&&features.push("fullscreenchange"),(browser.chrome||browser.edge&&!browser.slow)&&features.push("imageanalysis"),Dashboard.isConnectMode()&&features.push("multiserver"),(browser.tv||browser.xboxOne||browser.ps4||browser.mobile)&&features.push("physicalvolumecontrol"),browser.tv||browser.xboxOne||browser.ps4||features.push("remotecontrol"),features}(),version=window.dashboardVersion||"3.0";return{getWindowState:function(){return document.windowState||"Normal"},setWindowState:function(state){alert("setWindowState is not supported and should not be called")},exit:function(){if(browser.tizen)try{tizen.application.getCurrentApplication().exit()}catch(err){console.log("error closing application: "+err)}else window.close()},supports:function(command){return supportedFeatures.indexOf(command.toLowerCase())!=-1},unlockedFeatures:function(){var features=[];return features.push("playback"),features.push("livetv"),features},appInfo:function(){return appInfo?Promise.resolve(appInfo):getDeviceId().then(function(deviceId){return appInfo={deviceId:deviceId,deviceName:getDeviceName(),appName:"Emby Mobile",appVersion:version}})},capabilities:getCapabilities,preferVisualCards:browser.android||browser.chrome,moreIcon:browser.safari||browser.edge?"dots-horiz":"dots-vert",getSyncProfile:getSyncProfile}});
|
|
@ -1,50 +1 @@
|
|||
define(['itemHelper'], function (itemHelper) {
|
||||
'use strict';
|
||||
|
||||
function initSyncButtons(view) {
|
||||
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient || !apiClient.getCurrentUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
|
||||
var item = {
|
||||
SupportsSync: true
|
||||
};
|
||||
|
||||
var categorySyncButtons = view.querySelectorAll('.categorySyncButton');
|
||||
for (var i = 0, length = categorySyncButtons.length; i < length; i++) {
|
||||
categorySyncButtons[i].addEventListener('click', onCategorySyncButtonClick);
|
||||
if (itemHelper.canSync(user, item)) {
|
||||
categorySyncButtons[i].classList.remove('hide');
|
||||
} else {
|
||||
categorySyncButtons[i].classList.add('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onCategorySyncButtonClick(e) {
|
||||
|
||||
var button = this;
|
||||
var category = button.getAttribute('data-category');
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
require(['syncDialog'], function (syncDialog) {
|
||||
syncDialog.showMenu({
|
||||
ParentId: parentId,
|
||||
Category: category,
|
||||
serverId: ApiClient.serverId()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
init: function (view) {
|
||||
initSyncButtons(view);
|
||||
}
|
||||
};
|
||||
});
|
||||
define(["itemHelper"],function(itemHelper){"use strict";function initSyncButtons(view){var apiClient=window.ApiClient;apiClient&&apiClient.getCurrentUserId()&&apiClient.getCurrentUser().then(function(user){for(var item={SupportsSync:!0},categorySyncButtons=view.querySelectorAll(".categorySyncButton"),i=0,length=categorySyncButtons.length;i<length;i++)categorySyncButtons[i].addEventListener("click",onCategorySyncButtonClick),itemHelper.canSync(user,item)?categorySyncButtons[i].classList.remove("hide"):categorySyncButtons[i].classList.add("hide")})}function onCategorySyncButtonClick(e){var button=this,category=button.getAttribute("data-category"),parentId=LibraryMenu.getTopParentId();require(["syncDialog"],function(syncDialog){syncDialog.showMenu({ParentId:parentId,Category:category,serverId:ApiClient.serverId()})})}return{init:function(view){initSyncButtons(view)}}});
|
|
@ -1,200 +1 @@
|
|||
define(['dialogHelper', 'loading', 'connectionManager', 'globalize', 'actionsheet', 'emby-input', 'paper-icon-button-light', 'emby-button', 'listViewStyle', 'material-icons', 'formDialogStyle'],
|
||||
function (dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
var currentMappingOptions;
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
while (!elem.classList || !elem.classList.contains(className)) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function mapChannel(button, tunerChannelNumber, providerChannelNumber) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var providerId = options.providerId;
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
apiClient.ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
||||
data: {
|
||||
providerId: providerId,
|
||||
tunerChannelNumber: tunerChannelNumber,
|
||||
providerChannelNumber: providerChannelNumber
|
||||
},
|
||||
dataType: 'json'
|
||||
|
||||
}).then(function (mapping) {
|
||||
|
||||
var listItem = parentWithClass(button, 'listItem');
|
||||
|
||||
button.setAttribute('data-providernumber', mapping.ProviderChannelNumber);
|
||||
listItem.querySelector('.secondary').innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function onChannelsElementClick(e) {
|
||||
|
||||
var btnMap = parentWithClass(e.target, 'btnMap');
|
||||
|
||||
if (!btnMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tunerChannelNumber = btnMap.getAttribute('data-number');
|
||||
var providerChannelNumber = btnMap.getAttribute('data-providernumber');
|
||||
|
||||
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
||||
|
||||
return {
|
||||
name: m.Name,
|
||||
id: m.Id,
|
||||
selected: m.Id.toLowerCase() == providerChannelNumber.toLowerCase()
|
||||
};
|
||||
});
|
||||
|
||||
actionsheet.show({
|
||||
positionTo: btnMap,
|
||||
items: menuItems
|
||||
|
||||
}).then(function (newChannelNumber) {
|
||||
mapChannel(btnMap, tunerChannelNumber, newChannelNumber);
|
||||
});
|
||||
}
|
||||
|
||||
function getChannelMappingOptions(serverId, providerId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
||||
providerId: providerId
|
||||
}));
|
||||
}
|
||||
|
||||
function getMappingSecondaryName(mapping, providerName) {
|
||||
|
||||
return (mapping.ProviderChannelNumber || '') + ' ' + (mapping.ProviderChannelName || '') + ' - ' + providerName;
|
||||
}
|
||||
|
||||
function getTunerChannelHtml(channel, providerName) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="listItem">';
|
||||
|
||||
html += '<i class="md-icon listItemIcon">dvr</i>';
|
||||
|
||||
html += '<div class="listItemBody two-line">';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
html += channel.Name;
|
||||
html += '</h3>';
|
||||
|
||||
html += '<div class="secondary listItemBodyText">';
|
||||
if (channel.ProviderChannelNumber || channel.ProviderChannelName) {
|
||||
html += getMappingSecondaryName(channel, providerName);
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
html += '<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-number="' + channel.Number + '" data-providernumber="' + channel.ProviderChannelNumber + '"><i class="md-icon">mode_edit</i></button>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function getEditorHtml() {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="formDialogContent">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||
html += '<form style="margin:auto;">';
|
||||
|
||||
html += '<h1>' + globalize.translate('HeaderChannels') + '</h1>';
|
||||
|
||||
html += '<div class="channels paperList">';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function initEditor(dlg, options) {
|
||||
|
||||
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
||||
|
||||
currentMappingOptions = result;
|
||||
|
||||
var channelsElement = dlg.querySelector('.channels');
|
||||
|
||||
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
||||
return getTunerChannelHtml(channel, result.ProviderName);
|
||||
}).join('');
|
||||
|
||||
channelsElement.addEventListener('click', onChannelsElementClick);
|
||||
});
|
||||
}
|
||||
|
||||
self.show = function () {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
||||
dialogOptions.size = 'small';
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
|
||||
var html = '';
|
||||
var title = globalize.translate('MapChannels');
|
||||
|
||||
html += '<div class="formDialogHeader">';
|
||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>';
|
||||
html += '<h3 class="formDialogHeaderTitle">';
|
||||
html += title;
|
||||
html += '</h3>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
html += getEditorHtml();
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
initEditor(dlg, options);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
dlg.addEventListener('close', resolve);
|
||||
dialogHelper.open(dlg);
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","loading","connectionManager","globalize","actionsheet","emby-input","paper-icon-button-light","emby-button","listViewStyle","material-icons","formDialogStyle"],function(dialogHelper,loading,connectionManager,globalize,actionsheet){"use strict";return function(options){function parentWithClass(elem,className){for(;!elem.classList||!elem.classList.contains(className);)if(elem=elem.parentNode,!elem)return null;return elem}function mapChannel(button,tunerChannelNumber,providerChannelNumber){loading.show();var providerId=options.providerId,apiClient=connectionManager.getApiClient(options.serverId);apiClient.ajax({type:"POST",url:ApiClient.getUrl("LiveTv/ChannelMappings"),data:{providerId:providerId,tunerChannelNumber:tunerChannelNumber,providerChannelNumber:providerChannelNumber},dataType:"json"}).then(function(mapping){var listItem=parentWithClass(button,"listItem");button.setAttribute("data-providernumber",mapping.ProviderChannelNumber),listItem.querySelector(".secondary").innerHTML=getMappingSecondaryName(mapping,currentMappingOptions.ProviderName),loading.hide()})}function onChannelsElementClick(e){var btnMap=parentWithClass(e.target,"btnMap");if(btnMap){var tunerChannelNumber=btnMap.getAttribute("data-number"),providerChannelNumber=btnMap.getAttribute("data-providernumber"),menuItems=currentMappingOptions.ProviderChannels.map(function(m){return{name:m.Name,id:m.Id,selected:m.Id.toLowerCase()==providerChannelNumber.toLowerCase()}});actionsheet.show({positionTo:btnMap,items:menuItems}).then(function(newChannelNumber){mapChannel(btnMap,tunerChannelNumber,newChannelNumber)})}}function getChannelMappingOptions(serverId,providerId){var apiClient=connectionManager.getApiClient(serverId);return apiClient.getJSON(apiClient.getUrl("LiveTv/ChannelMappingOptions",{providerId:providerId}))}function getMappingSecondaryName(mapping,providerName){return(mapping.ProviderChannelNumber||"")+" "+(mapping.ProviderChannelName||"")+" - "+providerName}function getTunerChannelHtml(channel,providerName){var html="";return html+='<div class="listItem">',html+='<i class="md-icon listItemIcon">dvr</i>',html+='<div class="listItemBody two-line">',html+='<h3 class="listItemBodyText">',html+=channel.Name,html+="</h3>",html+='<div class="secondary listItemBodyText">',(channel.ProviderChannelNumber||channel.ProviderChannelName)&&(html+=getMappingSecondaryName(channel,providerName)),html+="</div>",html+="</div>",html+='<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-number="'+channel.Number+'" data-providernumber="'+channel.ProviderChannelNumber+'"><i class="md-icon">mode_edit</i></button>',html+="</div>"}function getEditorHtml(){var html="";return html+='<div class="formDialogContent">',html+='<div class="dialogContentInner dialog-content-centered">',html+='<form style="margin:auto;">',html+="<h1>"+globalize.translate("HeaderChannels")+"</h1>",html+='<div class="channels paperList">',html+="</div>",html+="</form>",html+="</div>",html+="</div>"}function initEditor(dlg,options){getChannelMappingOptions(options.serverId,options.providerId).then(function(result){currentMappingOptions=result;var channelsElement=dlg.querySelector(".channels");channelsElement.innerHTML=result.TunerChannels.map(function(channel){return getTunerChannelHtml(channel,result.ProviderName)}).join(""),channelsElement.addEventListener("click",onChannelsElementClick)})}var currentMappingOptions,self=this;self.show=function(){var dialogOptions={removeOnClose:!0};dialogOptions.size="small";var dlg=dialogHelper.createDialog(dialogOptions);dlg.classList.add("formDialog"),dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a");var html="",title=globalize.translate("MapChannels");return html+='<div class="formDialogHeader">',html+='<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="md-icon"></i></button>',html+='<h3 class="formDialogHeaderTitle">',html+=title,html+="</h3>",html+="</div>",html+=getEditorHtml(),dlg.innerHTML=html,initEditor(dlg,options),dlg.querySelector(".btnCancel").addEventListener("click",function(){dialogHelper.close(dlg)}),new Promise(function(resolve,reject){dlg.addEventListener("close",resolve),dialogHelper.open(dlg)})}}});
|
|
@ -1,234 +1 @@
|
|||
define(['events'], function (events) {
|
||||
'use strict';
|
||||
|
||||
// LinkParser
|
||||
//
|
||||
// https://github.com/ravisorg/LinkParser
|
||||
//
|
||||
// Locate and extract almost any URL within a string. Handles protocol-less domains, IPv4 and
|
||||
// IPv6, unrecognised TLDs, and more.
|
||||
//
|
||||
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
// http://creativecommons.org/licenses/by-sa/4.0/
|
||||
(function () {
|
||||
|
||||
// Original URL regex from the Android android.text.util.Linkify function, found here:
|
||||
// http://stackoverflow.com/a/19696443
|
||||
//
|
||||
// However there were problems with it, most probably related to the fact it was
|
||||
// written in 2007, and it's been highly modified.
|
||||
//
|
||||
// 1) I didn't like the fact that it was tied to specific TLDs, since new ones
|
||||
// are being added all the time it wouldn't be reasonable to expect developer to
|
||||
// be continually updating their regular expressions.
|
||||
//
|
||||
// 2) It didn't allow unicode characters in the domains which are now allowed in
|
||||
// many languages, (including some IDN TLDs). Again these are constantly being
|
||||
// added to and it doesn't seem reasonable to hard-code them. Note this ended up
|
||||
// not being possible in standard JS due to the way it handles multibyte strings.
|
||||
// It is possible using XRegExp, however a big performance hit results. Disabled
|
||||
// for now.
|
||||
//
|
||||
// 3) It didn't allow for IPv6 hostnames
|
||||
// IPv6 regex from http://stackoverflow.com/a/17871737
|
||||
//
|
||||
// 4) It was very poorly commented
|
||||
//
|
||||
// 5) It wasn't as smart as it could have been about what should be part of a
|
||||
// URL and what should be part of human language.
|
||||
|
||||
var protocols = "(?:(?:http|https|rtsp|ftp):\\/\\/)";
|
||||
var credentials = "(?:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,64}" // username (1-64 normal or url escaped characters)
|
||||
+ "(?:\\:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,25})?" // followed by optional password (: + 1-25 normal or url escaped characters)
|
||||
+ "\\@)";
|
||||
|
||||
// IPv6 Regex http://forums.intermapper.com/viewtopic.php?t=452
|
||||
// by Dartware, LLC is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
|
||||
// http://intermapper.com/
|
||||
var ipv6 = "("
|
||||
+ "(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
||||
+ "|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
||||
+ "|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
||||
+ ")(%.+)?";
|
||||
|
||||
var ipv4 = "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\."
|
||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\."
|
||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\."
|
||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])";
|
||||
|
||||
// This would have been a lot cleaner if JS RegExp supported conditionals...
|
||||
var linkRegExpString =
|
||||
|
||||
// begin match for protocol / username / password / host
|
||||
"(?:"
|
||||
|
||||
// ============================
|
||||
// If we have a recognized protocol at the beginning of the URL, we're
|
||||
// more relaxed about what we accept, because we assume the user wants
|
||||
// this to be a URL, and we're not accidentally matching human language
|
||||
+ protocols + "?"
|
||||
|
||||
// optional username:password@
|
||||
+ credentials + "?"
|
||||
|
||||
// IP address (both v4 and v6)
|
||||
+ "(?:"
|
||||
|
||||
// IPv6
|
||||
+ ipv6
|
||||
|
||||
// IPv4
|
||||
+ "|" + ipv4
|
||||
|
||||
+ ")"
|
||||
|
||||
// end match for protocol / username / password / host
|
||||
+ ")"
|
||||
|
||||
// optional port number
|
||||
+ "(?:\\:\\d{1,5})?"
|
||||
|
||||
// plus optional path and query params (no unicode allowed here?)
|
||||
+ "(?:"
|
||||
+ "\\/(?:"
|
||||
// some characters we'll accept because it's unlikely human language
|
||||
// would use them after a URL unless they were part of the url
|
||||
+ "(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])"
|
||||
+ "|(?:\\%[a-f0-9]{2})"
|
||||
// some characters are much more likely to be used AFTER a url and
|
||||
// were not intended to be included in the url itself. Mostly end
|
||||
// of sentence type things. It's also likely that the URL would
|
||||
// still work if any of these characters were missing from the end
|
||||
// because we parsed it incorrectly. For these characters to be accepted
|
||||
// they must be followed by another character that we're reasonably
|
||||
// sure is part of the url
|
||||
+ "|(?:[\\;\\?\\:\\.\\!\\'\\(\\)\\,\\=]+(?=(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2})))"
|
||||
+ ")*"
|
||||
+ "|\\b|\$"
|
||||
+ ")";
|
||||
|
||||
// regex = XRegExp(regex,'gi');
|
||||
var linkRegExp = RegExp(linkRegExpString, 'gi');
|
||||
|
||||
var protocolRegExp = RegExp('^' + protocols, 'i');
|
||||
|
||||
// if url doesn't begin with a known protocol, add http by default
|
||||
function ensureProtocol(url) {
|
||||
if (!url.match(protocolRegExp)) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
// look for links in the text
|
||||
var LinkParser = {
|
||||
|
||||
parse: function (text) {
|
||||
var links = [];
|
||||
var match;
|
||||
|
||||
while (match = linkRegExp.exec(text)) {
|
||||
// console.log(matches);
|
||||
var txt = match[0];
|
||||
var pos = match['index'];
|
||||
var len = txt.length;
|
||||
var url = ensureProtocol(text);
|
||||
links.push({ 'pos': pos, 'text': txt, 'len': len, 'url': url });
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
window.LinkParser = LinkParser;
|
||||
})();
|
||||
|
||||
var cache = {};
|
||||
|
||||
function getEndpointInfo(apiClient) {
|
||||
|
||||
return apiClient.getJSON(apiClient.getUrl('System/Endpoint'));
|
||||
}
|
||||
|
||||
function isValidIpAddress(address) {
|
||||
|
||||
var links = LinkParser.parse(address);
|
||||
|
||||
return links.length == 1;
|
||||
}
|
||||
|
||||
function isLocalIpAddress(address) {
|
||||
|
||||
address = address.toLowerCase();
|
||||
|
||||
if (address.indexOf('127.0.0.1') != -1) {
|
||||
return true;
|
||||
}
|
||||
if (address.indexOf('localhost') != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getServerAddress(apiClient) {
|
||||
|
||||
var serverAddress = apiClient.serverAddress();
|
||||
|
||||
if (isValidIpAddress(serverAddress) && !isLocalIpAddress(serverAddress)) {
|
||||
return Promise.resolve(serverAddress);
|
||||
}
|
||||
|
||||
var cachedValue = getCachedValue(serverAddress);
|
||||
if (cachedValue) {
|
||||
return Promise.resolve(cachedValue);
|
||||
}
|
||||
|
||||
return apiClient.getJSON(apiClient.getUrl('System/Endpoint')).then(function (endpoint) {
|
||||
if (endpoint.IsInNetwork) {
|
||||
return apiClient.getPublicSystemInfo().then(function (info) {
|
||||
addToCache(serverAddress, info.LocalAddress);
|
||||
return info.LocalAddress;
|
||||
});
|
||||
} else {
|
||||
addToCache(serverAddress, serverAddress);
|
||||
return serverAddress;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearCache() {
|
||||
cache = {};
|
||||
}
|
||||
|
||||
function addToCache(key, value) {
|
||||
cache[key] = {
|
||||
value: value,
|
||||
time: new Date().getTime()
|
||||
};
|
||||
}
|
||||
|
||||
function getCachedValue(key) {
|
||||
|
||||
var obj = cache[key];
|
||||
|
||||
if (obj && (new Date().getTime() - obj.time) < 180000) {
|
||||
return obj.value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
events.on(ConnectionManager, 'localusersignedin', clearCache);
|
||||
events.on(ConnectionManager, 'localusersignedout', clearCache);
|
||||
|
||||
return {
|
||||
getServerAddress: getServerAddress
|
||||
};
|
||||
});
|
||||
define(["events"],function(events){"use strict";function isValidIpAddress(address){var links=LinkParser.parse(address);return 1==links.length}function isLocalIpAddress(address){return address=address.toLowerCase(),address.indexOf("127.0.0.1")!=-1||address.indexOf("localhost")!=-1}function getServerAddress(apiClient){var serverAddress=apiClient.serverAddress();if(isValidIpAddress(serverAddress)&&!isLocalIpAddress(serverAddress))return Promise.resolve(serverAddress);var cachedValue=getCachedValue(serverAddress);return cachedValue?Promise.resolve(cachedValue):apiClient.getJSON(apiClient.getUrl("System/Endpoint")).then(function(endpoint){return endpoint.IsInNetwork?apiClient.getPublicSystemInfo().then(function(info){return addToCache(serverAddress,info.LocalAddress),info.LocalAddress}):(addToCache(serverAddress,serverAddress),serverAddress)})}function clearCache(){cache={}}function addToCache(key,value){cache[key]={value:value,time:(new Date).getTime()}}function getCachedValue(key){var obj=cache[key];return obj&&(new Date).getTime()-obj.time<18e4?obj.value:null}!function(){function ensureProtocol(url){return url.match(protocolRegExp)||(url="http://"+url),url}var protocols="(?:(?:http|https|rtsp|ftp):\\/\\/)",credentials="(?:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,64}(?:\\:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,25})?\\@)",ipv6="((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?",ipv4="(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])",linkRegExpString="(?:"+protocols+"?"+credentials+"?(?:"+ipv6+"|"+ipv4+"))(?:\\:\\d{1,5})?(?:\\/(?:(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2})|(?:[\\;\\?\\:\\.\\!\\'\\(\\)\\,\\=]+(?=(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2}))))*|\\b|$)",linkRegExp=RegExp(linkRegExpString,"gi"),protocolRegExp=RegExp("^"+protocols,"i"),LinkParser={parse:function(text){for(var match,links=[];match=linkRegExp.exec(text);){var txt=match[0],pos=match.index,len=txt.length,url=ensureProtocol(text);links.push({pos:pos,text:txt,len:len,url:url})}return links}};window.LinkParser=LinkParser}();var cache={};return events.on(ConnectionManager,"localusersignedin",clearCache),events.on(ConnectionManager,"localusersignedout",clearCache),{getServerAddress:getServerAddress}});
|
|
@ -1,16 +1 @@
|
|||
#ulDirectoryPickerList a {
|
||||
padding-top: .4em;
|
||||
padding-bottom: .4em;
|
||||
}
|
||||
|
||||
.lblDirectoryPickerPath {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directoryPickerHeadline {
|
||||
color: #000;
|
||||
background: #fff3a5;
|
||||
padding: 1em;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
#ulDirectoryPickerList a{padding-top:.4em;padding-bottom:.4em}.lblDirectoryPickerPath{white-space:nowrap}.directoryPickerHeadline{color:#000;background:#fff3a5;padding:1em;-webkit-border-radius:5px;border-radius:5px;margin-bottom:1.5em}
|
File diff suppressed because one or more lines are too long
|
@ -1,44 +1 @@
|
|||
.dockedtabs-tabs {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
padding: .5em 0;
|
||||
/* Override size from librarymenu */
|
||||
font-size: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.dockedtabs-tab-button {
|
||||
flex-grow: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-transform: none !important;
|
||||
font-size: 12.4px !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
text-align: center;
|
||||
border-color: transparent !important;
|
||||
border-width: 0 !important;
|
||||
}
|
||||
|
||||
.dockedtabs-tab-button {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dockedtabs-tab-button-noflex {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dockedtabs-tab-button, .dockedtabs-tab-button-foreground {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
.dockedtabs-tab-button-icon {
|
||||
margin-bottom: .25em;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
@media all and (max-width: 800px) {
|
||||
.dockedtab-midsize {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
.dockedtabs-tabs{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;display:-webkit-box;display:-webkit-flex;display:flex;padding:.5em 0;font-size:inherit;font-size:13px}.dockedtabs-tab-button{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;text-transform:none!important;font-size:12.4px!important;padding:0!important;margin:0!important;text-align:center;border-color:transparent!important;border-width:0!important;display:-webkit-box;display:-webkit-flex;display:flex}.dockedtabs-tab-button-noflex{display:block}.dockedtabs-tab-button,.dockedtabs-tab-button-foreground{font-weight:400!important}.dockedtabs-tab-button-icon{margin-bottom:.25em;font-size:22px}@media all and (max-width:800px){.dockedtab-midsize{display:none!important}}
|
File diff suppressed because one or more lines are too long
|
@ -1,175 +1 @@
|
|||
define(['libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoader', 'scrollStyles', 'emby-itemscontainer'], function (libraryBrowser, cardBuilder, dom, appHost, imageLoader) {
|
||||
'use strict';
|
||||
|
||||
function enableScrollX() {
|
||||
return browserInfo.mobile;
|
||||
}
|
||||
|
||||
function getThumbShape() {
|
||||
return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
|
||||
}
|
||||
|
||||
function getPosterShape() {
|
||||
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||
}
|
||||
|
||||
function getSquareShape() {
|
||||
return enableScrollX() ? 'overflowSquare' : 'square';
|
||||
}
|
||||
|
||||
function getSections() {
|
||||
|
||||
return [
|
||||
{ name: 'HeaderFavoriteMovies', types: "Movie", id: "favoriteMovies", shape: getPosterShape(), showTitle: false, overlayPlayButton: true },
|
||||
{ name: 'HeaderFavoriteShows', types: "Series", id: "favoriteShows", shape: getPosterShape(), showTitle: false, overlayPlayButton: true },
|
||||
{ name: 'HeaderFavoriteEpisodes', types: "Episode", id: "favoriteEpisode", shape: getThumbShape(), preferThumb: false, showTitle: true, showParentTitle: true, overlayPlayButton: true, overlayText: false, centerText: true },
|
||||
{ name: 'HeaderFavoriteGames', types: "Game", id: "favoriteGames", shape: getSquareShape(), preferThumb: false, showTitle: true },
|
||||
{ name: 'HeaderFavoriteArtists', types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true },
|
||||
{ name: 'HeaderFavoriteAlbums', types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true },
|
||||
{ name: 'HeaderFavoriteSongs', types: "Audio", id: "favoriteSongs", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, action: 'instantmix' }
|
||||
];
|
||||
}
|
||||
|
||||
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
||||
|
||||
var screenWidth = dom.getWindowSize().innerWidth;
|
||||
var options = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
Filters: "IsFavorite",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
||||
CollapseBoxSetItems: false,
|
||||
ExcludeLocationTypes: "Virtual",
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
|
||||
if (topParentId) {
|
||||
options.ParentId = topParentId;
|
||||
}
|
||||
|
||||
if (!isSingleSection) {
|
||||
options.Limit = screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6);
|
||||
|
||||
if (enableScrollX()) {
|
||||
options.Limit = 20;
|
||||
}
|
||||
}
|
||||
|
||||
var promise;
|
||||
if (section.types == 'MusicArtist') {
|
||||
promise = ApiClient.getArtists(userId, options);
|
||||
} else {
|
||||
|
||||
options.IncludeItemTypes = section.types;
|
||||
promise = ApiClient.getItems(userId, options);
|
||||
}
|
||||
|
||||
return promise.then(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
html += '<div>';
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="listHeader">' + Globalize.translate(section.name) + '</h1>';
|
||||
|
||||
if (options.Limit && result.Items.length >= options.Limit) {
|
||||
var href = "secondaryitems.html?type=" + section.types + "&filters=IsFavorite";
|
||||
|
||||
html += '<a class="clearLink" href="' + href + '" style="margin-left:2em;"><button is="emby-button" type="button" class="raised more mini">' + Globalize.translate('ButtonMore') + '</button></a>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
if (enableScrollX()) {
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer hiddenScrollX">';
|
||||
} else {
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap">';
|
||||
}
|
||||
|
||||
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
||||
var cardLayout = (appHost.preferVisualCards || supportsImageAnalysis) && section.showTitle;
|
||||
|
||||
html += cardBuilder.getCardsHtml(result.Items, {
|
||||
preferThumb: section.preferThumb,
|
||||
shape: section.shape,
|
||||
centerText: section.centerText && !cardLayout,
|
||||
overlayText: section.overlayText !== false,
|
||||
showTitle: section.showTitle,
|
||||
showParentTitle: section.showParentTitle,
|
||||
scalable: true,
|
||||
overlayPlayButton: section.overlayPlayButton,
|
||||
overlayMoreButton: section.overlayMoreButton && !cardLayout,
|
||||
action: section.action,
|
||||
allowBottomPadding: !enableScrollX(),
|
||||
cardLayout: cardLayout,
|
||||
vibrant: supportsImageAnalysis && cardLayout
|
||||
});
|
||||
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
elem.innerHTML = html;
|
||||
imageLoader.lazyChildren(elem);
|
||||
});
|
||||
}
|
||||
|
||||
function loadSections(page, userId, topParentId, types) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var sections = getSections();
|
||||
|
||||
var sectionid = getParameterByName('sectionid');
|
||||
|
||||
if (sectionid) {
|
||||
sections = sections.filter(function (s) {
|
||||
|
||||
return s.id == sectionid;
|
||||
});
|
||||
}
|
||||
|
||||
if (types) {
|
||||
sections = sections.filter(function (s) {
|
||||
|
||||
return types.indexOf(s.id) != -1;
|
||||
});
|
||||
}
|
||||
|
||||
var i, length;
|
||||
|
||||
var elem = page.querySelector('.favoriteSections');
|
||||
|
||||
if (!elem.innerHTML) {
|
||||
var html = '';
|
||||
for (i = 0, length = sections.length; i < length; i++) {
|
||||
|
||||
html += '<div class="homePageSection section' + sections[i].id + '"></div>';
|
||||
}
|
||||
|
||||
elem.innerHTML = html;
|
||||
}
|
||||
|
||||
var promises = [];
|
||||
|
||||
for (i = 0, length = sections.length; i < length; i++) {
|
||||
|
||||
var section = sections[i];
|
||||
|
||||
elem = page.querySelector('.section' + section.id);
|
||||
|
||||
promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1));
|
||||
}
|
||||
|
||||
Promise.all(promises).then(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
render: loadSections
|
||||
};
|
||||
|
||||
});
|
||||
define(["libraryBrowser","cardBuilder","dom","apphost","imageLoader","scrollStyles","emby-itemscontainer"],function(libraryBrowser,cardBuilder,dom,appHost,imageLoader){"use strict";function enableScrollX(){return browserInfo.mobile}function getThumbShape(){return enableScrollX()?"overflowBackdrop":"backdrop"}function getPosterShape(){return enableScrollX()?"overflowPortrait":"portrait"}function getSquareShape(){return enableScrollX()?"overflowSquare":"square"}function getSections(){return[{name:"HeaderFavoriteMovies",types:"Movie",id:"favoriteMovies",shape:getPosterShape(),showTitle:!1,overlayPlayButton:!0},{name:"HeaderFavoriteShows",types:"Series",id:"favoriteShows",shape:getPosterShape(),showTitle:!1,overlayPlayButton:!0},{name:"HeaderFavoriteEpisodes",types:"Episode",id:"favoriteEpisode",shape:getThumbShape(),preferThumb:!1,showTitle:!0,showParentTitle:!0,overlayPlayButton:!0,overlayText:!1,centerText:!0},{name:"HeaderFavoriteGames",types:"Game",id:"favoriteGames",shape:getSquareShape(),preferThumb:!1,showTitle:!0},{name:"HeaderFavoriteArtists",types:"MusicArtist",id:"favoriteArtists",shape:getSquareShape(),preferThumb:!1,showTitle:!0,overlayText:!1,showParentTitle:!0,centerText:!0,overlayPlayButton:!0},{name:"HeaderFavoriteAlbums",types:"MusicAlbum",id:"favoriteAlbums",shape:getSquareShape(),preferThumb:!1,showTitle:!0,overlayText:!1,showParentTitle:!0,centerText:!0,overlayPlayButton:!0},{name:"HeaderFavoriteSongs",types:"Audio",id:"favoriteSongs",shape:getSquareShape(),preferThumb:!1,showTitle:!0,overlayText:!1,showParentTitle:!0,centerText:!0,overlayMoreButton:!0,action:"instantmix"}]}function loadSection(elem,userId,topParentId,section,isSingleSection){var screenWidth=dom.getWindowSize().innerWidth,options={SortBy:"SortName",SortOrder:"Ascending",Filters:"IsFavorite",Recursive:!0,Fields:"PrimaryImageAspectRatio,BasicSyncInfo",CollapseBoxSetItems:!1,ExcludeLocationTypes:"Virtual",EnableTotalRecordCount:!1};topParentId&&(options.ParentId=topParentId),isSingleSection||(options.Limit=screenWidth>=1920?10:screenWidth>=1440?8:6,enableScrollX()&&(options.Limit=20));var promise;return"MusicArtist"==section.types?promise=ApiClient.getArtists(userId,options):(options.IncludeItemTypes=section.types,promise=ApiClient.getItems(userId,options)),promise.then(function(result){var html="";if(result.Items.length){if(html+="<div>",html+='<h1 style="display:inline-block; vertical-align:middle;" class="listHeader">'+Globalize.translate(section.name)+"</h1>",options.Limit&&result.Items.length>=options.Limit){var href="secondaryitems.html?type="+section.types+"&filters=IsFavorite";html+='<a class="clearLink" href="'+href+'" style="margin-left:2em;"><button is="emby-button" type="button" class="raised more mini">'+Globalize.translate("ButtonMore")+"</button></a>"}html+="</div>",html+=enableScrollX()?'<div is="emby-itemscontainer" class="itemsContainer hiddenScrollX">':'<div is="emby-itemscontainer" class="itemsContainer vertical-wrap">';var supportsImageAnalysis=appHost.supports("imageanalysis"),cardLayout=(appHost.preferVisualCards||supportsImageAnalysis)&§ion.showTitle;html+=cardBuilder.getCardsHtml(result.Items,{preferThumb:section.preferThumb,shape:section.shape,centerText:section.centerText&&!cardLayout,overlayText:section.overlayText!==!1,showTitle:section.showTitle,showParentTitle:section.showParentTitle,scalable:!0,overlayPlayButton:section.overlayPlayButton,overlayMoreButton:section.overlayMoreButton&&!cardLayout,action:section.action,allowBottomPadding:!enableScrollX(),cardLayout:cardLayout,vibrant:supportsImageAnalysis&&cardLayout}),html+="</div>"}elem.innerHTML=html,imageLoader.lazyChildren(elem)})}function loadSections(page,userId,topParentId,types){Dashboard.showLoadingMsg();var sections=getSections(),sectionid=getParameterByName("sectionid");sectionid&&(sections=sections.filter(function(s){return s.id==sectionid})),types&&(sections=sections.filter(function(s){return types.indexOf(s.id)!=-1}));var i,length,elem=page.querySelector(".favoriteSections");if(!elem.innerHTML){var html="";for(i=0,length=sections.length;i<length;i++)html+='<div class="homePageSection section'+sections[i].id+'"></div>';elem.innerHTML=html}var promises=[];for(i=0,length=sections.length;i<length;i++){var section=sections[i];elem=page.querySelector(".section"+section.id),promises.push(loadSection(elem,userId,topParentId,section,1==sections.length))}Promise.all(promises).then(function(){Dashboard.hideLoadingMsg()})}return{render:loadSections}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,38 +1 @@
|
|||
.dynamicFilterDialog {
|
||||
position: fixed !important;
|
||||
top: 5% !important;
|
||||
bottom: 5% !important;
|
||||
margin-top: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
max-height: none !important;
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
@media all and (min-height: 600px) {
|
||||
|
||||
.dynamicFilterDialog {
|
||||
top: 10% !important;
|
||||
bottom: 10% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 400px) {
|
||||
|
||||
.dynamicFilterDialog {
|
||||
width: auto;
|
||||
left: 10vw !important;
|
||||
right: 10vw !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 400px) {
|
||||
|
||||
.dynamicFilterDialog {
|
||||
width: 300px;
|
||||
margin-left: -150px !important;
|
||||
left: 50% !important;
|
||||
}
|
||||
}
|
||||
.dynamicFilterDialog{position:fixed!important;top:5%!important;bottom:5%!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;-webkit-border-radius:0!important;border-radius:0!important;max-height:none!important;max-width:none!important}@media all and (min-height:600px){.dynamicFilterDialog{top:10%!important;bottom:10%!important}}@media all and (max-width:400px){.dynamicFilterDialog{width:auto;left:10vw!important;right:10vw!important;margin-left:0!important}}@media all and (min-width:400px){.dynamicFilterDialog{width:300px;margin-left:-150px!important;left:50%!important}}
|
|
@ -1,54 +1 @@
|
|||
define(['dom'], function (dom) {
|
||||
'use strict';
|
||||
|
||||
function onGroupedCardClick(e, card) {
|
||||
|
||||
var itemId = card.getAttribute('data-id');
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
var playedIndicator = card.querySelector('.playedIndicator');
|
||||
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||
|
||||
var options = {
|
||||
|
||||
Limit: parseInt(playedIndicatorHtml || '10'),
|
||||
Fields: "PrimaryImageAspectRatio,DateCreated",
|
||||
ParentId: itemId,
|
||||
GroupItems: false
|
||||
};
|
||||
|
||||
var actionableParent = dom.parentWithTag(e.target, ['A', 'BUTTON', 'INPUT']);
|
||||
|
||||
if (actionableParent && !actionableParent.classList.contains('cardContent')) {
|
||||
return;
|
||||
}
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||
|
||||
if (items.length == 1) {
|
||||
Dashboard.navigate(LibraryBrowser.getHref(items[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
var url = 'itemdetails.html?id=' + itemId;
|
||||
|
||||
Dashboard.navigate(url);
|
||||
});
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function onItemsContainerClick(e) {
|
||||
var groupedCard = dom.parentWithClass(e.target, 'groupedCard');
|
||||
|
||||
if (groupedCard) {
|
||||
onGroupedCardClick(e, groupedCard);
|
||||
}
|
||||
}
|
||||
return {
|
||||
onItemsContainerClick: onItemsContainerClick
|
||||
};
|
||||
});
|
||||
define(["dom"],function(dom){"use strict";function onGroupedCardClick(e,card){var itemId=card.getAttribute("data-id"),userId=Dashboard.getCurrentUserId(),playedIndicator=card.querySelector(".playedIndicator"),playedIndicatorHtml=playedIndicator?playedIndicator.innerHTML:null,options={Limit:parseInt(playedIndicatorHtml||"10"),Fields:"PrimaryImageAspectRatio,DateCreated",ParentId:itemId,GroupItems:!1},actionableParent=dom.parentWithTag(e.target,["A","BUTTON","INPUT"]);if(!actionableParent||actionableParent.classList.contains("cardContent"))return ApiClient.getJSON(ApiClient.getUrl("Users/"+userId+"/Items/Latest",options)).then(function(items){if(1==items.length)return void Dashboard.navigate(LibraryBrowser.getHref(items[0]));var url="itemdetails.html?id="+itemId;Dashboard.navigate(url)}),e.stopPropagation(),e.preventDefault(),!1}function onItemsContainerClick(e){var groupedCard=dom.parentWithClass(e.target,"groupedCard");groupedCard&&onGroupedCardClick(e,groupedCard)}return{onItemsContainerClick:onItemsContainerClick}});
|
|
@ -1,66 +1 @@
|
|||
define(['dialogHelper', 'connectHelper', 'emby-input', 'emby-button', 'emby-collapse', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, connectHelper) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/guestinviter/connectlink.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
size: 'small'
|
||||
});
|
||||
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += Globalize.translateDocument(template);
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (dlg.submitted) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
ApiClient.getCurrentUser().then(function (user) {
|
||||
|
||||
connectHelper.updateUserLink(ApiClient, user, dlg.querySelector('#txtConnectUsername').value).then(function () {
|
||||
dialogHelper.close(dlg);
|
||||
}, function () {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","connectHelper","emby-input","emby-button","emby-collapse","paper-icon-button-light","formDialogStyle"],function(dialogHelper,connectHelper){"use strict";return{show:function(){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/guestinviter/connectlink.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a"),dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve():reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return ApiClient.getCurrentUser().then(function(user){connectHelper.updateUserLink(ApiClient,user,dlg.querySelector("#txtConnectUsername").value).then(function(){dialogHelper.close(dlg)},function(){dialogHelper.close(dlg)})}),e.preventDefault(),!1})},xhr.send()})}}});
|
|
@ -1,115 +1 @@
|
|||
define(['dialogHelper', 'jQuery', 'emby-input', 'emby-button', 'emby-checkbox', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, $) {
|
||||
'use strict';
|
||||
|
||||
function renderLibrarySharingList(context, result) {
|
||||
|
||||
var folderHtml = '';
|
||||
|
||||
folderHtml += result.Items.map(function (i) {
|
||||
|
||||
var currentHtml = '';
|
||||
|
||||
var isChecked = true;
|
||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
|
||||
currentHtml += '<label><input is="emby-checkbox" class="chkShareFolder" type="checkbox" data-folderid="' + i.Id + '"' + checkedHtml + '/><span>' + i.Name + '</span></label>';
|
||||
return currentHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
context.querySelector('.librarySharingList').innerHTML = folderHtml;
|
||||
}
|
||||
|
||||
function inviteUser(dlg) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var shareExcludes = $(".chkShareFolder", dlg).get().filter(function (i) {
|
||||
|
||||
return i.checked;
|
||||
|
||||
}).map(function (i) {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
require(['connectHelper'], function (connectHelper) {
|
||||
|
||||
connectHelper.inviteGuest({
|
||||
apiClient: ApiClient,
|
||||
guestOptions: {
|
||||
|
||||
ConnectUsername: dlg.querySelector('#txtConnectUsername').value,
|
||||
EnabledLibraries: shareExcludes.join(','),
|
||||
SendingUserId: Dashboard.getCurrentUserId(),
|
||||
EnableLiveTv: false
|
||||
}
|
||||
}).then(function() {
|
||||
|
||||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/guestinviter/guestinviter.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
size: 'small'
|
||||
});
|
||||
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += Globalize.translateDocument(template);
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (dlg.submitted) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
inviteUser(dlg);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })).then(function (result) {
|
||||
|
||||
renderLibrarySharingList(dlg, result);
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","jQuery","emby-input","emby-button","emby-checkbox","paper-icon-button-light","formDialogStyle"],function(dialogHelper,$){"use strict";function renderLibrarySharingList(context,result){var folderHtml="";folderHtml+=result.Items.map(function(i){var currentHtml="",isChecked=!0,checkedHtml=isChecked?' checked="checked"':"";return currentHtml+='<label><input is="emby-checkbox" class="chkShareFolder" type="checkbox" data-folderid="'+i.Id+'"'+checkedHtml+"/><span>"+i.Name+"</span></label>"}).join(""),context.querySelector(".librarySharingList").innerHTML=folderHtml}function inviteUser(dlg){Dashboard.showLoadingMsg();var shareExcludes=$(".chkShareFolder",dlg).get().filter(function(i){return i.checked}).map(function(i){return i.getAttribute("data-folderid")});require(["connectHelper"],function(connectHelper){connectHelper.inviteGuest({apiClient:ApiClient,guestOptions:{ConnectUsername:dlg.querySelector("#txtConnectUsername").value,EnabledLibraries:shareExcludes.join(","),SendingUserId:Dashboard.getCurrentUserId(),EnableLiveTv:!1}}).then(function(){dlg.submitted=!0,dialogHelper.close(dlg)})})}return{show:function(){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET","components/guestinviter/guestinviter.template.html",!0),xhr.onload=function(e){var template=this.response,dlg=dialogHelper.createDialog({removeOnClose:!0,size:"small"});dlg.classList.add("ui-body-a"),dlg.classList.add("background-theme-a"),dlg.classList.add("formDialog");var html="";html+=Globalize.translateDocument(template),dlg.innerHTML=html,dialogHelper.open(dlg),dlg.addEventListener("close",function(){dlg.submitted?resolve():reject()}),dlg.querySelector(".btnCancel").addEventListener("click",function(e){dialogHelper.close(dlg)}),dlg.querySelector("form").addEventListener("submit",function(e){return inviteUser(dlg),e.preventDefault(),!1}),ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders",{IsHidden:!1})).then(function(result){renderLibrarySharingList(dlg,result)})},xhr.send()})}}});
|
|
@ -1,65 +1 @@
|
|||
define(['datetime'], function (datetime) {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Javascript Humane Dates
|
||||
* Copyright (c) 2008 Dean Landolt (deanlandolt.com)
|
||||
* Re-write by Zach Leatherman (zachleat.com)
|
||||
*
|
||||
* Adopted from the John Resig's pretty.js
|
||||
* at http://ejohn.org/blog/javascript-pretty-date
|
||||
* and henrah's proposed modification
|
||||
* at http://ejohn.org/blog/javascript-pretty-date/#comment-297458
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
function humane_date(date_str) {
|
||||
var time_formats = [[90, 'a minute'], // 60*1.5
|
||||
[3600, 'minutes', 60], // 60*60, 60
|
||||
[5400, 'an hour'], // 60*60*1.5
|
||||
[86400, 'hours', 3600], // 60*60*24, 60*60
|
||||
[129600, 'a day'], // 60*60*24*1.5
|
||||
[604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
||||
[907200, 'a week'], // 60*60*24*7*1.5
|
||||
[2628000, 'weeks', 604800], // 60*60*24*(365/12), 60*60*24*7
|
||||
[3942000, 'a month'], // 60*60*24*(365/12)*1.5
|
||||
[31536000, 'months', 2628000], // 60*60*24*365, 60*60*24*(365/12)
|
||||
[47304000, 'a year'], // 60*60*24*365*1.5
|
||||
[3153600000, 'years', 31536000] // 60*60*24*365*100, 60*60*24*365
|
||||
];
|
||||
|
||||
var dt = new Date;
|
||||
var date = datetime.parseISO8601Date(date_str, true);
|
||||
|
||||
var seconds = ((dt - date) / 1000);
|
||||
var token = ' ago';
|
||||
var i = 0;
|
||||
var format;
|
||||
|
||||
if (seconds < 0) {
|
||||
seconds = Math.abs(seconds);
|
||||
//token = '';
|
||||
}
|
||||
|
||||
while (format = time_formats[i++]) {
|
||||
if (seconds < format[0]) {
|
||||
if (format.length == 2) {
|
||||
return format[1] + token;
|
||||
} else {
|
||||
return Math.round(seconds / format[2]) + ' ' + format[1] + token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overflow for centuries
|
||||
if (seconds > 4730400000)
|
||||
return Math.round(seconds / 4730400000) + ' centuries' + token;
|
||||
|
||||
return date_str;
|
||||
}
|
||||
|
||||
window.humane_date = humane_date;
|
||||
|
||||
return humane_date;
|
||||
});
|
||||
define(["datetime"],function(datetime){"use strict";function humane_date(date_str){var format,time_formats=[[90,"a minute"],[3600,"minutes",60],[5400,"an hour"],[86400,"hours",3600],[129600,"a day"],[604800,"days",86400],[907200,"a week"],[2628e3,"weeks",604800],[3942e3,"a month"],[31536e3,"months",2628e3],[47304e3,"a year"],[31536e5,"years",31536e3]],dt=new Date,date=datetime.parseISO8601Date(date_str,!0),seconds=(dt-date)/1e3,token=" ago",i=0;for(seconds<0&&(seconds=Math.abs(seconds));format=time_formats[i++];)if(seconds<format[0])return 2==format.length?format[1]+token:Math.round(seconds/format[2])+" "+format[1]+token;return seconds>47304e5?Math.round(seconds/47304e5)+" centuries"+token:date_str}return window.humane_date=humane_date,humane_date});
|
|
@ -1,74 +1 @@
|
|||
define(['apphost', 'globalize', 'shell'], function (appHost, globalize, shell) {
|
||||
'use strict';
|
||||
|
||||
function getProductInfo(feature) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function showExternalPremiereInfo() {
|
||||
shell.openUrl('https://emby.media/premiere');
|
||||
}
|
||||
|
||||
function beginPurchase(feature, email) {
|
||||
showExternalPremiereInfo();
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
function restorePurchase(id) {
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
function getSubscriptionOptions() {
|
||||
|
||||
var options = [];
|
||||
|
||||
options.push({
|
||||
id: 'embypremiere',
|
||||
title: globalize.translate('sharedcomponents#HeaderBecomeProjectSupporter'),
|
||||
requiresEmail: false
|
||||
});
|
||||
|
||||
return Promise.resolve(options);
|
||||
}
|
||||
|
||||
function isUnlockedByDefault(feature, options) {
|
||||
|
||||
var autoUnlockedFeatures = appHost.unlockedFeatures ? appHost.unlockedFeatures() : [];
|
||||
if (autoUnlockedFeatures.indexOf(feature) != -1) {
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
function getAdminFeatureName(feature) {
|
||||
|
||||
return feature;
|
||||
}
|
||||
|
||||
function getRestoreButtonText() {
|
||||
return globalize.translate('sharedcomponents#ButtonAlreadyPaid');
|
||||
}
|
||||
|
||||
function getPeriodicMessageIntervalMs(feature) {
|
||||
|
||||
if (feature === 'playback') {
|
||||
return 43200000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return {
|
||||
getProductInfo: getProductInfo,
|
||||
beginPurchase: beginPurchase,
|
||||
restorePurchase: restorePurchase,
|
||||
getSubscriptionOptions: getSubscriptionOptions,
|
||||
isUnlockedByDefault: isUnlockedByDefault,
|
||||
getAdminFeatureName: getAdminFeatureName,
|
||||
getRestoreButtonText: getRestoreButtonText,
|
||||
getPeriodicMessageIntervalMs: getPeriodicMessageIntervalMs
|
||||
};
|
||||
|
||||
});
|
||||
define(["apphost","globalize","shell"],function(appHost,globalize,shell){"use strict";function getProductInfo(feature){return null}function showExternalPremiereInfo(){shell.openUrl("https://emby.media/premiere")}function beginPurchase(feature,email){return showExternalPremiereInfo(),Promise.reject()}function restorePurchase(id){return Promise.reject()}function getSubscriptionOptions(){var options=[];return options.push({id:"embypremiere",title:globalize.translate("sharedcomponents#HeaderBecomeProjectSupporter"),requiresEmail:!1}),Promise.resolve(options)}function isUnlockedByDefault(feature,options){var autoUnlockedFeatures=appHost.unlockedFeatures?appHost.unlockedFeatures():[];return autoUnlockedFeatures.indexOf(feature)!=-1?Promise.resolve():Promise.reject()}function getAdminFeatureName(feature){return feature}function getRestoreButtonText(){return globalize.translate("sharedcomponents#ButtonAlreadyPaid")}function getPeriodicMessageIntervalMs(feature){return"playback"===feature?432e5:0}return{getProductInfo:getProductInfo,beginPurchase:beginPurchase,restorePurchase:restorePurchase,getSubscriptionOptions:getSubscriptionOptions,isUnlockedByDefault:isUnlockedByDefault,getAdminFeatureName:getAdminFeatureName,getRestoreButtonText:getRestoreButtonText,getPeriodicMessageIntervalMs:getPeriodicMessageIntervalMs}});
|
File diff suppressed because one or more lines are too long
|
@ -1,200 +1 @@
|
|||
define(['dialogHelper', 'jQuery', 'emby-button', 'emby-select'], function (dialogHelper, $) {
|
||||
'use strict';
|
||||
|
||||
var currentItemId;
|
||||
var currentFile;
|
||||
var currentDeferred;
|
||||
var hasChanges = false;
|
||||
|
||||
function onFileReaderError(evt) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
switch (evt.target.error.code) {
|
||||
case evt.target.error.NOT_FOUND_ERR:
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('MessageFileNotFound'));
|
||||
});
|
||||
break;
|
||||
case evt.target.error.ABORT_ERR:
|
||||
break; // noop
|
||||
default:
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('MessageFileReadError'));
|
||||
});
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
function setFiles(page, files) {
|
||||
|
||||
var file = files[0];
|
||||
|
||||
if (!file || !file.type.match('image.*')) {
|
||||
$('#imageOutput', page).html('');
|
||||
$('#fldUpload', page).hide();
|
||||
currentFile = null;
|
||||
return;
|
||||
}
|
||||
|
||||
currentFile = file;
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onerror = onFileReaderError;
|
||||
reader.onloadstart = function () {
|
||||
$('#fldUpload', page).hide();
|
||||
};
|
||||
reader.onabort = function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
console.log('File read cancelled');
|
||||
};
|
||||
|
||||
// Closure to capture the file information.
|
||||
reader.onload = (function (theFile) {
|
||||
return function (e) {
|
||||
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:300px;max-height:100px;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
|
||||
$('#imageOutput', page).html(html);
|
||||
$('#fldUpload', page).show();
|
||||
};
|
||||
})(file);
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
function processImageChangeResult(page) {
|
||||
|
||||
hasChanges = true;
|
||||
history.back();
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
||||
var file = currentFile;
|
||||
|
||||
if (!file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") {
|
||||
return false;
|
||||
}
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var page = $(this).parents('.dialog');
|
||||
|
||||
var imageType = $('#selectImageType', page).val();
|
||||
|
||||
ApiClient.uploadItemImage(currentItemId, imageType, file).then(function () {
|
||||
|
||||
$('#uploadImage', page).val('').trigger('change');
|
||||
Dashboard.hideLoadingMsg();
|
||||
processImageChangeResult(page);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function initEditor(page) {
|
||||
|
||||
$('form', page).off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
$('#uploadImage', page).on("change", function () {
|
||||
setFiles(page, this.files);
|
||||
});
|
||||
|
||||
$("#imageDropZone", page).on('dragover', function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
e.originalEvent.dataTransfer.dropEffect = 'Copy';
|
||||
|
||||
return false;
|
||||
|
||||
}).on('drop', function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
setFiles(page, e.originalEvent.dataTransfer.files);
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function showEditor(itemId, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/imageuploader/imageuploader.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var template = this.response;
|
||||
currentItemId = itemId;
|
||||
|
||||
var dlg = dialogHelper.createDialog({
|
||||
size: 'fullscreen-border'
|
||||
});
|
||||
|
||||
var theme = options.theme || 'b';
|
||||
|
||||
dlg.classList.add('ui-body-' + theme);
|
||||
dlg.classList.add('background-theme-' + theme);
|
||||
|
||||
var html = '';
|
||||
html += '<h2 class="dialogHeader">';
|
||||
html += '<button type="button" is="emby-button" icon="arrow-back" class="fab mini btnCloseDialog autoSize" tabindex="-1"><i class="md-icon"></i></button>';
|
||||
html += '<div style="display:inline-block;margin-left:.6em;vertical-align:middle;">' + Globalize.translate('HeaderUploadImage') + '</div>';
|
||||
html += '</h2>';
|
||||
|
||||
html += '<div class="editorContent" style="padding:0 1em;">';
|
||||
html += Globalize.translateDocument(template);
|
||||
html += '</div>';
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
$(dlg).on('close', onDialogClosed);
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
var editorContent = dlg.querySelector('.editorContent');
|
||||
initEditor(editorContent);
|
||||
|
||||
$('#selectImageType', dlg).val(options.imageType || 'Primary');
|
||||
|
||||
$('.btnCloseDialog', dlg).on('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function onDialogClosed() {
|
||||
|
||||
$(this).remove();
|
||||
Dashboard.hideLoadingMsg();
|
||||
currentDeferred.resolveWith(null, [hasChanges]);
|
||||
}
|
||||
|
||||
return {
|
||||
show: function (itemId, options) {
|
||||
|
||||
var deferred = jQuery.Deferred();
|
||||
|
||||
currentDeferred = deferred;
|
||||
hasChanges = false;
|
||||
|
||||
showEditor(itemId, options);
|
||||
return deferred.promise();
|
||||
}
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","jQuery","emby-button","emby-select"],function(dialogHelper,$){"use strict";function onFileReaderError(evt){switch(Dashboard.hideLoadingMsg(),evt.target.error.code){case evt.target.error.NOT_FOUND_ERR:require(["toast"],function(toast){toast(Globalize.translate("MessageFileNotFound"))});break;case evt.target.error.ABORT_ERR:break;default:require(["toast"],function(toast){toast(Globalize.translate("MessageFileReadError"))})}}function setFiles(page,files){var file=files[0];if(!file||!file.type.match("image.*"))return $("#imageOutput",page).html(""),$("#fldUpload",page).hide(),void(currentFile=null);currentFile=file;var reader=new FileReader;reader.onerror=onFileReaderError,reader.onloadstart=function(){$("#fldUpload",page).hide()},reader.onabort=function(){Dashboard.hideLoadingMsg(),console.log("File read cancelled")},reader.onload=function(theFile){return function(e){var html=['<img style="max-width:300px;max-height:100px;" src="',e.target.result,'" title="',escape(theFile.name),'"/>'].join("");$("#imageOutput",page).html(html),$("#fldUpload",page).show()}}(file),reader.readAsDataURL(file)}function processImageChangeResult(page){hasChanges=!0,history.back()}function onSubmit(){var file=currentFile;if(!file)return!1;if("image/png"!=file.type&&"image/jpeg"!=file.type&&"image/jpeg"!=file.type)return!1;Dashboard.showLoadingMsg();var page=$(this).parents(".dialog"),imageType=$("#selectImageType",page).val();return ApiClient.uploadItemImage(currentItemId,imageType,file).then(function(){$("#uploadImage",page).val("").trigger("change"),Dashboard.hideLoadingMsg(),processImageChangeResult(page)}),!1}function initEditor(page){$("form",page).off("submit",onSubmit).on("submit",onSubmit),$("#uploadImage",page).on("change",function(){setFiles(page,this.files)}),$("#imageDropZone",page).on("dragover",function(e){return e.preventDefault(),e.originalEvent.dataTransfer.dropEffect="Copy",!1}).on("drop",function(e){return e.preventDefault(),setFiles(page,e.originalEvent.dataTransfer.files),!1})}function showEditor(itemId,options){options=options||{};var xhr=new XMLHttpRequest;xhr.open("GET","components/imageuploader/imageuploader.template.html",!0),xhr.onload=function(e){var template=this.response;currentItemId=itemId;var dlg=dialogHelper.createDialog({size:"fullscreen-border"}),theme=options.theme||"b";dlg.classList.add("ui-body-"+theme),dlg.classList.add("background-theme-"+theme);var html="";html+='<h2 class="dialogHeader">',html+='<button type="button" is="emby-button" icon="arrow-back" class="fab mini btnCloseDialog autoSize" tabindex="-1"><i class="md-icon"></i></button>',html+='<div style="display:inline-block;margin-left:.6em;vertical-align:middle;">'+Globalize.translate("HeaderUploadImage")+"</div>",html+="</h2>",html+='<div class="editorContent" style="padding:0 1em;">',html+=Globalize.translateDocument(template),html+="</div>",dlg.innerHTML=html,$(dlg).on("close",onDialogClosed),dialogHelper.open(dlg);var editorContent=dlg.querySelector(".editorContent");initEditor(editorContent),$("#selectImageType",dlg).val(options.imageType||"Primary"),$(".btnCloseDialog",dlg).on("click",function(){dialogHelper.close(dlg)})},xhr.send()}function onDialogClosed(){$(this).remove(),Dashboard.hideLoadingMsg(),currentDeferred.resolveWith(null,[hasChanges])}var currentItemId,currentFile,currentDeferred,hasChanges=!1;return{show:function(itemId,options){var deferred=jQuery.Deferred();return currentDeferred=deferred,hasChanges=!1,showEditor(itemId,options),deferred.promise()}}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,45 +1 @@
|
|||
.touch-menu-la {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #FFF;
|
||||
will-change: transform;
|
||||
contain: layout style;
|
||||
display: flex;
|
||||
transition: transform ease-out 60ms, left ease-out 260ms;
|
||||
z-index: 1099;
|
||||
}
|
||||
|
||||
.touch-menu-la.open {
|
||||
box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.touch-menu-la.transition {
|
||||
/*transition: transform 0.3s ease-out;*/
|
||||
transition: transform ease-out 260ms, left ease-out 260ms;
|
||||
/*transition: -webkit-transform ease-in-out 0.3s, width ease-in-out 0.3s, visibility 0.3s;
|
||||
transition: transform ease-in-out 0.3s, width ease-in-out 0.3s, visibility 0.3s;*/
|
||||
}
|
||||
|
||||
.scrollContainer {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.tmla-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #000;
|
||||
opacity: 0.0;
|
||||
z-index: 1098;
|
||||
transition: opacity ease-in-out 0.38s, visibility ease-in-out 0.38s;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.tmla-mask.backdrop {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
.tmla-mask,.touch-menu-la{position:fixed;top:0;bottom:0}.touch-menu-la{background-color:#FFF;will-change:transform;contain:layout style;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-transition:-webkit-transform ease-out 60ms,left ease-out 260ms;-o-transition:transform ease-out 60ms,left ease-out 260ms;transition:transform ease-out 60ms,left ease-out 260ms;z-index:1099}.touch-menu-la.open{-webkit-box-shadow:2px 0 12px rgba(0,0,0,.4);box-shadow:2px 0 12px rgba(0,0,0,.4)}.touch-menu-la.transition{-webkit-transition:-webkit-transform ease-out 260ms,left ease-out 260ms;-o-transition:transform ease-out 260ms,left ease-out 260ms;transition:transform ease-out 260ms,left ease-out 260ms}.scrollContainer{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.tmla-mask{left:0;right:0;background-color:#000;opacity:0;z-index:1098;-webkit-transition:opacity ease-in-out .38s,visibility ease-in-out .38s;-o-transition:opacity ease-in-out .38s,visibility ease-in-out .38s;transition:opacity ease-in-out .38s,visibility ease-in-out .38s;background-color:rgba(0,0,0,.3);visibility:hidden}.tmla-mask.backdrop{visibility:visible;opacity:1}
|
|
@ -1,305 +1 @@
|
|||
define(['browser', 'css!./navdrawer', 'scrollStyles'], function (browser) {
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
var self,
|
||||
defaults,
|
||||
mask,
|
||||
maskHammer,
|
||||
menuHammer,
|
||||
newPos = 0,
|
||||
currentPos = 0,
|
||||
startPoint = 0,
|
||||
countStart = 0,
|
||||
velocity = 0.0;
|
||||
|
||||
options.target.classList.add('transition');
|
||||
var draggingX;
|
||||
var draggingY;
|
||||
|
||||
var scrollContainer = options.target.querySelector('.scrollContainer');
|
||||
scrollContainer.classList.add('smoothScrollY');
|
||||
|
||||
var TouchMenuLA = function () {
|
||||
self = this;
|
||||
|
||||
defaults = {
|
||||
width: 260,
|
||||
handleSize: 30,
|
||||
disableMask: false,
|
||||
maxMaskOpacity: 0.5
|
||||
};
|
||||
|
||||
this.isVisible = false;
|
||||
|
||||
this.initialize();
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.initElements = function (Hammer) {
|
||||
options.target.classList.add('touch-menu-la');
|
||||
options.target.style.width = options.width + 'px';
|
||||
options.target.style.left = -options.width + 'px';
|
||||
|
||||
if (!options.disableMask) {
|
||||
mask = document.createElement('div');
|
||||
mask.className = 'tmla-mask';
|
||||
document.body.appendChild(mask);
|
||||
|
||||
if (Hammer) {
|
||||
maskHammer = new Hammer(mask, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function onPanStart(ev) {
|
||||
options.target.classList.remove('transition');
|
||||
options.target.classList.add('open');
|
||||
velocity = Math.abs(ev.velocity);
|
||||
}
|
||||
|
||||
function onPanMove(ev) {
|
||||
velocity = Math.abs(ev.velocity);
|
||||
// Depending on the deltas, choose X or Y
|
||||
|
||||
var isOpen = self.visible;
|
||||
|
||||
// If it's already open, then treat any right-swipe as vertical pan
|
||||
if (isOpen && !draggingX && ev.deltaX > 0) {
|
||||
draggingY = true;
|
||||
}
|
||||
|
||||
if (!draggingX && !draggingY && (!isOpen || Math.abs(ev.deltaX) >= 10)) {
|
||||
draggingX = true;
|
||||
scrollContainer.addEventListener('scroll', disableEvent);
|
||||
self.showMask();
|
||||
|
||||
} else if (!draggingY) {
|
||||
draggingY = true;
|
||||
}
|
||||
|
||||
if (draggingX) {
|
||||
newPos = currentPos + ev.deltaX;
|
||||
self.changeMenuPos();
|
||||
}
|
||||
}
|
||||
|
||||
function onPanEnd(ev) {
|
||||
options.target.classList.add('transition');
|
||||
scrollContainer.removeEventListener('scroll', disableEvent);
|
||||
draggingX = false;
|
||||
draggingY = false;
|
||||
currentPos = ev.deltaX;
|
||||
self.checkMenuState(ev.deltaX, ev.deltaY);
|
||||
}
|
||||
|
||||
function initEdgeSwipe(Hammer) {
|
||||
if (options.disableEdgeSwipe) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
require(['hammer-main'], initEdgeSwipeInternal);
|
||||
}
|
||||
|
||||
function initEdgeSwipeInternal(edgeHammer) {
|
||||
var isPeeking = false;
|
||||
|
||||
edgeHammer.on('panstart panmove', function (ev) {
|
||||
|
||||
if (isPeeking) {
|
||||
onPanMove(ev);
|
||||
} else {
|
||||
var srcEvent = ev.srcEvent;
|
||||
var clientX = srcEvent.clientX;
|
||||
if (!clientX) {
|
||||
var touches = srcEvent.touches;
|
||||
if (touches && touches.length) {
|
||||
clientX = touches[0].clientX;
|
||||
}
|
||||
}
|
||||
if (clientX <= options.handleSize) {
|
||||
isPeeking = true;
|
||||
onPanStart(ev);
|
||||
}
|
||||
}
|
||||
});
|
||||
edgeHammer.on('panend pancancel', function (ev) {
|
||||
if (isPeeking) {
|
||||
isPeeking = false;
|
||||
onPanEnd(ev);
|
||||
}
|
||||
});
|
||||
|
||||
self.edgeHammer = edgeHammer;
|
||||
}
|
||||
|
||||
function disableEvent(e) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
TouchMenuLA.prototype.touchStartMenu = function () {
|
||||
|
||||
menuHammer.on('panstart', function (ev) {
|
||||
onPanStart(ev);
|
||||
});
|
||||
menuHammer.on('panmove', function (ev) {
|
||||
onPanMove(ev);
|
||||
});
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.animateToPosition = function (pos) {
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
if (pos) {
|
||||
options.target.style.transform = 'translate3d(' + pos + 'px, 0, 0)';
|
||||
} else {
|
||||
options.target.style.transform = 'none';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.changeMenuPos = function () {
|
||||
if (newPos <= options.width) {
|
||||
this.animateToPosition(newPos);
|
||||
}
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.touchEndMenu = function () {
|
||||
menuHammer.on('panend pancancel', onPanEnd);
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.clickMaskClose = function () {
|
||||
mask.addEventListener('click', function () {
|
||||
self.close();
|
||||
});
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.checkMenuState = function (deltaX, deltaY) {
|
||||
if (velocity >= 1.0) {
|
||||
if (deltaX >= -80 || Math.abs(deltaY) >= 70) {
|
||||
self.open();
|
||||
} else {
|
||||
self.close();
|
||||
}
|
||||
} else {
|
||||
if (newPos >= 100) {
|
||||
self.open();
|
||||
} else {
|
||||
self.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.open = function () {
|
||||
this.animateToPosition(options.width);
|
||||
|
||||
currentPos = options.width;
|
||||
this.isVisible = true;
|
||||
options.target.classList.add('open');
|
||||
|
||||
self.showMask();
|
||||
self.invoke(options.onChange);
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.close = function () {
|
||||
this.animateToPosition(0);
|
||||
currentPos = 0;
|
||||
self.isVisible = false;
|
||||
options.target.classList.remove('open');
|
||||
|
||||
self.hideMask();
|
||||
self.invoke(options.onChange);
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.toggle = function () {
|
||||
if (self.isVisible) {
|
||||
self.close();
|
||||
} else {
|
||||
self.open();
|
||||
}
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.eventStartMask = function () {
|
||||
maskHammer.on('panstart panmove', function (ev) {
|
||||
if (ev.center.x <= options.width && self.isVisible) {
|
||||
countStart++;
|
||||
|
||||
if (countStart == 1) {
|
||||
startPoint = ev.deltaX;
|
||||
}
|
||||
|
||||
if (ev.deltaX < 0) {
|
||||
draggingX = true;
|
||||
newPos = (ev.deltaX - startPoint) + options.width;
|
||||
self.changeMenuPos();
|
||||
velocity = Math.abs(ev.velocity);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.eventEndMask = function () {
|
||||
maskHammer.on('panend pancancel', function (ev) {
|
||||
self.checkMenuState(ev.deltaX);
|
||||
countStart = 0;
|
||||
});
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.showMask = function () {
|
||||
|
||||
mask.classList.add('backdrop');
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.hideMask = function () {
|
||||
|
||||
mask.classList.remove('backdrop');
|
||||
};
|
||||
|
||||
TouchMenuLA.prototype.invoke = function (fn) {
|
||||
if (fn) {
|
||||
fn.apply(self);
|
||||
}
|
||||
};
|
||||
|
||||
function initWithHammer(Hammer) {
|
||||
|
||||
if (Hammer) {
|
||||
menuHammer = Hammer(options.target, null);
|
||||
}
|
||||
|
||||
self.initElements(Hammer);
|
||||
|
||||
if (Hammer) {
|
||||
self.touchStartMenu();
|
||||
self.touchEndMenu();
|
||||
self.eventStartMask();
|
||||
self.eventEndMask();
|
||||
initEdgeSwipe(Hammer);
|
||||
}
|
||||
|
||||
if (!options.disableMask) {
|
||||
self.clickMaskClose();
|
||||
}
|
||||
}
|
||||
|
||||
TouchMenuLA.prototype.initialize = function () {
|
||||
|
||||
options = Object.assign(defaults, options || {});
|
||||
|
||||
// Not ready yet
|
||||
if (browser.edge) {
|
||||
options.disableEdgeSwipe = true;
|
||||
}
|
||||
|
||||
if (browser.touch) {
|
||||
require(['hammer'], initWithHammer);
|
||||
} else {
|
||||
initWithHammer();
|
||||
}
|
||||
};
|
||||
|
||||
return new TouchMenuLA();
|
||||
};
|
||||
});
|
||||
define(["browser","css!./navdrawer","scrollStyles"],function(browser){"use strict";return function(options){function onPanStart(ev){options.target.classList.remove("transition"),options.target.classList.add("open"),velocity=Math.abs(ev.velocity)}function onPanMove(ev){velocity=Math.abs(ev.velocity);var isOpen=self.visible;isOpen&&!draggingX&&ev.deltaX>0&&(draggingY=!0),draggingX||draggingY||isOpen&&!(Math.abs(ev.deltaX)>=10)?draggingY||(draggingY=!0):(draggingX=!0,scrollContainer.addEventListener("scroll",disableEvent),self.showMask()),draggingX&&(newPos=currentPos+ev.deltaX,self.changeMenuPos())}function onPanEnd(ev){options.target.classList.add("transition"),scrollContainer.removeEventListener("scroll",disableEvent),draggingX=!1,draggingY=!1,currentPos=ev.deltaX,self.checkMenuState(ev.deltaX,ev.deltaY)}function initEdgeSwipe(Hammer){options.disableEdgeSwipe}function disableEvent(e){e.preventDefault(),e.stopPropagation()}function initWithHammer(Hammer){Hammer&&(menuHammer=Hammer(options.target,null)),self.initElements(Hammer),Hammer&&(self.touchStartMenu(),self.touchEndMenu(),self.eventStartMask(),self.eventEndMask(),initEdgeSwipe(Hammer)),options.disableMask||self.clickMaskClose()}var self,defaults,mask,maskHammer,menuHammer,newPos=0,currentPos=0,startPoint=0,countStart=0,velocity=0;options.target.classList.add("transition");var draggingX,draggingY,scrollContainer=options.target.querySelector(".scrollContainer");scrollContainer.classList.add("smoothScrollY");var TouchMenuLA=function(){self=this,defaults={width:260,handleSize:30,disableMask:!1,maxMaskOpacity:.5},this.isVisible=!1,this.initialize()};return TouchMenuLA.prototype.initElements=function(Hammer){options.target.classList.add("touch-menu-la"),options.target.style.width=options.width+"px",options.target.style.left=-options.width+"px",options.disableMask||(mask=document.createElement("div"),mask.className="tmla-mask",document.body.appendChild(mask),Hammer&&(maskHammer=new Hammer(mask,null)))},TouchMenuLA.prototype.touchStartMenu=function(){menuHammer.on("panstart",function(ev){onPanStart(ev)}),menuHammer.on("panmove",function(ev){onPanMove(ev)})},TouchMenuLA.prototype.animateToPosition=function(pos){requestAnimationFrame(function(){pos?options.target.style.transform="translate3d("+pos+"px, 0, 0)":options.target.style.transform="none"})},TouchMenuLA.prototype.changeMenuPos=function(){newPos<=options.width&&this.animateToPosition(newPos)},TouchMenuLA.prototype.touchEndMenu=function(){menuHammer.on("panend pancancel",onPanEnd)},TouchMenuLA.prototype.clickMaskClose=function(){mask.addEventListener("click",function(){self.close()})},TouchMenuLA.prototype.checkMenuState=function(deltaX,deltaY){velocity>=1?deltaX>=-80||Math.abs(deltaY)>=70?self.open():self.close():newPos>=100?self.open():self.close()},TouchMenuLA.prototype.open=function(){this.animateToPosition(options.width),currentPos=options.width,this.isVisible=!0,options.target.classList.add("open"),self.showMask(),self.invoke(options.onChange)},TouchMenuLA.prototype.close=function(){this.animateToPosition(0),currentPos=0,self.isVisible=!1,options.target.classList.remove("open"),self.hideMask(),self.invoke(options.onChange)},TouchMenuLA.prototype.toggle=function(){self.isVisible?self.close():self.open()},TouchMenuLA.prototype.eventStartMask=function(){maskHammer.on("panstart panmove",function(ev){ev.center.x<=options.width&&self.isVisible&&(countStart++,1==countStart&&(startPoint=ev.deltaX),ev.deltaX<0&&(draggingX=!0,newPos=ev.deltaX-startPoint+options.width,self.changeMenuPos(),velocity=Math.abs(ev.velocity)))})},TouchMenuLA.prototype.eventEndMask=function(){maskHammer.on("panend pancancel",function(ev){self.checkMenuState(ev.deltaX),countStart=0})},TouchMenuLA.prototype.showMask=function(){mask.classList.add("backdrop")},TouchMenuLA.prototype.hideMask=function(){mask.classList.remove("backdrop")},TouchMenuLA.prototype.invoke=function(fn){fn&&fn.apply(self)},TouchMenuLA.prototype.initialize=function(){options=Object.assign(defaults,options||{}),browser.edge&&(options.disableEdgeSwipe=!0),browser.touch?require(["hammer"],initWithHammer):initWithHammer()},new TouchMenuLA}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue