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

update action sheet

This commit is contained in:
Luke Pulverenti 2015-06-30 13:21:20 -04:00
parent a81a127cc6
commit d1842ae4e3
24 changed files with 246 additions and 98 deletions

View file

@ -1,12 +1,12 @@
(function (globalScope) {
globalScope.AjaxApi = {
globalScope.HttpClient = {
param: function (params) {
return jQuery.param(params);
},
ajax: function (request) {
send: function (request) {
request.timeout = request.timeout || 30000;

View file

@ -1,12 +1,12 @@
(function (globalScope, angular) {
globalScope.AjaxApi = {
globalScope.HttpClient = {
param: function(params) {
return serialize(params);
},
ajax: function(options) {
send: function(options) {
var request = getAngularRequest(options),
defer = globalScope.DeferredBuilder.Deferred();
@ -91,7 +91,7 @@
for (var key in jParams) {
if (!paramMap[key]) {
// This parameter hasn't been implemented in the paramMap object
Logger.log('ERROR: ajax option property "' + key + '" not implemented by AjaxApi.');
Logger.log('ERROR: ajax option property "' + key + '" not implemented by HttpClient.');
continue;
}

View file

@ -115,7 +115,7 @@
name = name.split('&').join('-');
name = name.split('?').join('-');
var val = AjaxApi.param({ name: name });
var val = HttpClient.param({ name: name });
return val.substring(val.indexOf('=') + 1).replace("'", '%27');
};
@ -175,7 +175,7 @@
if (self.enableAutomaticNetworking === false || request.type != "GET") {
logger.log('Requesting url without automatic networking: ' + request.url);
return AjaxApi.ajax(request).fail(onRequestFail);
return HttpClient.send(request).fail(onRequestFail);
}
var deferred = DeferredBuilder.Deferred();
@ -218,7 +218,7 @@
var timeout = connectionMode == MediaBrowser.ConnectionMode.Local ? 5000 : 15000;
AjaxApi.ajax({
HttpClient.send({
type: "GET",
url: url + "/system/info/public",
@ -282,7 +282,7 @@
request.timeout = 15000;
AjaxApi.ajax(request).done(function (response) {
HttpClient.send(request).done(function (response) {
deferred.resolve(response, 0);
@ -356,7 +356,7 @@
url += name;
if (params) {
url += "?" + AjaxApi.param(params);
url += "?" + HttpClient.param(params);
}
return url;

View file

@ -85,7 +85,7 @@
logger.log('tryConnect url: ' + url);
return AjaxApi.ajax({
return HttpClient.send({
type: "GET",
url: url,
@ -378,7 +378,7 @@
var url = "https://connect.mediabrowser.tv/service/user?id=" + userId;
return AjaxApi.ajax({
return HttpClient.send({
type: "GET",
url: url,
dataType: "json",
@ -403,7 +403,7 @@
url += "/Connect/Exchange?format=json&ConnectUserId=" + credentials.ConnectUserId;
return AjaxApi.ajax({
return HttpClient.send({
type: "GET",
url: url,
dataType: "json",
@ -429,7 +429,7 @@
var url = MediaBrowser.ServerInfo.getServerAddress(server, connectionMode);
AjaxApi.ajax({
HttpClient.send({
type: "GET",
url: url + "/system/info",
@ -444,7 +444,7 @@
if (server.UserId) {
AjaxApi.ajax({
HttpClient.send({
type: "GET",
url: url + "/users/" + server.UserId,
@ -634,7 +634,7 @@
var url = "https://connect.mediabrowser.tv/service/servers?userId=" + credentials.ConnectUserId;
AjaxApi.ajax({
HttpClient.send({
type: "GET",
url: url,
dataType: "json",
@ -1083,7 +1083,7 @@
var md5 = self.getConnectPasswordHash(password);
AjaxApi.ajax({
HttpClient.send({
type: "POST",
url: "https://connect.mediabrowser.tv/service/user/authenticate",
data: {
@ -1146,7 +1146,7 @@
var md5 = self.getConnectPasswordHash(password);
AjaxApi.ajax({
HttpClient.send({
type: "POST",
url: "https://connect.mediabrowser.tv/service/register",
data: {
@ -1218,7 +1218,7 @@
var url = "https://connect.mediabrowser.tv/service/servers?userId=" + self.connectUserId() + "&status=Waiting";
return AjaxApi.ajax({
return HttpClient.send({
type: "GET",
url: url,
dataType: "json",
@ -1265,7 +1265,7 @@
var url = "https://connect.mediabrowser.tv/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId();
return AjaxApi.ajax({
return HttpClient.send({
type: "DELETE",
url: url,
headers: {
@ -1300,7 +1300,7 @@
var url = "https://connect.mediabrowser.tv/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId();
return AjaxApi.ajax({
return HttpClient.send({
type: "DELETE",
url: url,
headers: {
@ -1327,7 +1327,7 @@
var url = "https://connect.mediabrowser.tv/service/ServerAuthorizations/accept?serverId=" + serverId + "&userId=" + self.connectUserId();
return AjaxApi.ajax({
return HttpClient.send({
type: "GET",
url: url,
headers: {

View file

@ -25,14 +25,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/polymerelements/iron-meta",
"homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
},
"_source": "git://github.com/polymerelements/iron-meta.git",
"_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta"
"_originalSource": "PolymerElements/iron-meta"
}

View file

@ -34,7 +34,7 @@
"tag": "v1.0.7",
"commit": "c65f5ce6b898bb756fca35cedaa53c3e8011abeb"
},
"_source": "git://github.com/polymerelements/paper-styles.git",
"_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-styles"
"_originalSource": "PolymerElements/paper-styles"
}

View file

@ -37,8 +37,8 @@
return id.toString();
}
function initAjax() {
baseAjaxMethod = AjaxApi.ajax;
AjaxApi.ajax = sendRequest;
baseAjaxMethod = HttpClient.send;
HttpClient.send = sendRequest;
}
function sendRequest(request) {

View file

@ -1,28 +1,4 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../thirdparty/materialicons/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'), local('MaterialIcons-Regular'), url(../thirdparty/materialicons/MaterialIcons-Regular.woff2) format('woff2'), url(../thirdparty/materialicons/MaterialIcons-Regular.woff) format('woff'), url(../thirdparty/materialicons/MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
display: inline-block;
text-transform: none;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
/* cyrillic-ext */
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;

View file

@ -66,11 +66,12 @@
return o.ironIcon;
}).length;
html += '<paper-menu>';
for (var i = 0, length = options.items.length; i < length; i++) {
var option = options.items[i];
html += '<paper-button class="block menuButton ripple btnOption" data-id="' + option.id + '" style="margin:0;">';
html += '<paper-menu-item class="actionSheetMenuItem" data-id="' + option.id + '" style="display:block;">';
if (option.ironIcon) {
html += '<iron-icon icon="' + option.ironIcon + '"></iron-icon>';
@ -79,8 +80,9 @@
html += '<iron-icon></iron-icon>';
}
html += '<span>' + option.name + '</span>';
html += '</paper-button>';
html += '</paper-menu-item>';
}
html += '</paper-menu>';
if (isScrollable) {
html += '</paper-dialog-scrollable>';
@ -106,7 +108,7 @@
$(this).remove();
});
$('.btnOption', dlg).on('click', function () {
$('.actionSheetMenuItem', dlg).on('click', function () {
var selectedId = this.getAttribute('data-id');

View file

@ -122,10 +122,6 @@
return false;
}
if ($.browser.android && AppInfo.isNativeApp) {
return screen.availWidth >= 1200;
}
if ($.browser.mobile) {
return false;
}

View file

@ -108,6 +108,8 @@
$.when(promises).done(function () {
Dashboard.hideLoadingMsg();
LibraryBrowser.setLastRefreshed(page);
});
}
@ -117,7 +119,9 @@
var userId = Dashboard.getCurrentUserId();
if (LibraryBrowser.needsRefresh(page)) {
loadSections(page, userId);
}
});
})(jQuery, document);

View file

@ -3,7 +3,7 @@
var pageSizeKey = 'pagesize_v4';
return {
getDefaultPageSize: function(key, defaultValue) {
getDefaultPageSize: function (key, defaultValue) {
var saved = appStorage.getItem(key || pageSizeKey);
@ -21,13 +21,13 @@
return isChrome ? 200 : 100;
},
getDefaultItemsView: function(view, mobileView) {
getDefaultItemsView: function (view, mobileView) {
return $.browser.mobile ? mobileView : view;
},
loadSavedQueryValues: function(key, query) {
loadSavedQueryValues: function (key, query) {
var values = appStorage.getItem(key + '_' + Dashboard.getCurrentUserId());
@ -41,7 +41,7 @@
return query;
},
saveQueryValues: function(key, query) {
saveQueryValues: function (key, query) {
var values = {};
@ -59,7 +59,7 @@
}
},
saveViewSetting: function(key, value) {
saveViewSetting: function (key, value) {
try {
appStorage.setItem(key + '_' + Dashboard.getCurrentUserId() + '_view', value);
@ -68,7 +68,7 @@
}
},
getSavedViewSetting: function(key) {
getSavedViewSetting: function (key) {
var deferred = $.Deferred();
var val = appStorage.getItem(key + '_' + Dashboard.getCurrentUserId() + '_view');
@ -77,25 +77,39 @@
return deferred.promise();
},
needsRefresh: function(elem) {
needsRefresh: function (elem) {
var last = elem.getAttribute('data-lastrefresh') || '0';
var last = parseInt(elem.getAttribute('data-lastrefresh') || '0');
if (!last) {
return true;
}
if (NavHelper.isBack()) {
return false;
}
var now = new Date().getTime();
if ((now - parseInt(last)) < 90000) {
var cacheDuration = 300000;
if (!AppInfo.isNativeApp && ($.browser.ipad || $.browser.iphone || $.browser.android)) {
cacheDuration = 10000;
}
else if (!$.browser.mobile) {
cacheDuration = 60000;
}
if ((now - last) < cacheDuration) {
return false;
}
return true;
},
setLastRefreshed: function(elem) {
setLastRefreshed: function (elem) {
elem.setAttribute('data-lastrefresh', new Date().getTime());
elem.classList.add('hasrefreshtime');
},
getDateParamValue: function (date) {
@ -535,13 +549,6 @@
var href = LibraryBrowser.getHrefInternal(item, context);
if (context) {
if (context != 'livetv') {
href += href.indexOf('?') == -1 ? "?context=" : "&context=";
href += context;
}
}
if (context != 'livetv') {
if (topParentId == null && context != 'playlists') {
topParentId = LibraryMenu.getTopParentId();
@ -566,6 +573,8 @@
return item.url;
}
var contextSuffix = context ? ('&context=' + context) : '';
// Handle search hints
var id = item.Id || item.ItemId;
@ -632,48 +641,48 @@
return "livetvprogram.html?id=" + id;
}
if (item.Type == "Series") {
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Season") {
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "BoxSet") {
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "MusicAlbum") {
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "GameSystem") {
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Genre") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.Type == "MusicGenre") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.Type == "GameGenre") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Studio") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Person") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Recording") {
return "livetvrecording.html?id=" + id;
return "livetvrecording.html?id=" + id + contextSuffix;
}
if (item.Type == "MusicArtist") {
return "itembynamedetails.html?id=" + id;
return "itembynamedetails.html?id=" + id + contextSuffix;
}
if (item.IsFolder) {
return id ? "itemlist.html?parentId=" + id : "#";
}
return "itemdetails.html?id=" + id;
return "itemdetails.html?id=" + id + contextSuffix;
},
getImageUrl: function (item, type, index, options) {

View file

@ -115,7 +115,7 @@
var resumePosition = (item.UserData || {}).PlaybackPositionTicks || 0;
html += '<paper-icon-button icon="play-circle-filled" class="btnPlayItem" data-itemid="' + item.Id + '" data-itemtype="' + item.Type + '" data-isfolder="' + item.IsFolder + '" data-mediatype="' + item.MediaType + '" data-resumeposition="' + resumePosition + '"></paper-icon-button>';
html += '<paper-icon-button icon="play-circle-outline" class="btnPlayItem" data-itemid="' + item.Id + '" data-itemtype="' + item.Type + '" data-isfolder="' + item.IsFolder + '" data-mediatype="' + item.MediaType + '" data-resumeposition="' + resumePosition + '"></paper-icon-button>';
buttonCount++;
}
@ -1228,6 +1228,10 @@
$(apiClient).off('websocketmessage', onWebSocketMessage).on('websocketmessage', onWebSocketMessage);
}
function clearRefreshTimes() {
$('.hasrefreshtime').removeClass('hasrefreshtime').removeAttr('data-lastrefresh');
}
Dashboard.ready(function () {
if (window.ApiClient) {
@ -1237,6 +1241,9 @@
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
initializeApiClient(apiClient);
});
Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes);
Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes);
});
})(jQuery, document, window);

View file

@ -121,6 +121,7 @@
if (LibraryBrowser.needsRefresh(page)) {
query.UserId = Dashboard.getCurrentUserId();
LibraryBrowser.loadSavedQueryValues('movies', query);
query.Limit = query.Limit || LibraryBrowser.getDefaultPageSize();
reloadItems(page);
updateFilterControls(this);
}

View file

@ -89,6 +89,7 @@
renderRecordings($('#latestRecordings', page), result.Items);
LibraryBrowser.setLastRefreshed(page);
});
ApiClient.getLiveTvRecordingGroups({
@ -106,7 +107,9 @@
var page = this;
if (LibraryBrowser.needsRefresh(page)) {
reload(page);
}
});

View file

@ -97,6 +97,7 @@
renderTimers(page, result.Items);
LibraryBrowser.setLastRefreshed(page);
});
}
@ -120,7 +121,9 @@
var page = this;
if (LibraryBrowser.needsRefresh(page)) {
reload(page);
}
}).on('pageinit', "#liveTvSeriesTimersPage", function () {

View file

@ -104,6 +104,7 @@
renderTimers(page, result.Items);
LibraryBrowser.setLastRefreshed(page);
});
}
@ -111,7 +112,9 @@
var page = this;
if (LibraryBrowser.needsRefresh(page)) {
reload(page);
}
});
})(jQuery, document);

View file

@ -1844,6 +1844,7 @@ var AppInfo = {};
}
else if ($.browser.safari) {
Dashboard.importCss('themes/ios.css');
Dashboard.importCss('thirdparty/materialicons/style.css');
}
}

View file

@ -17,3 +17,6 @@
.ui-page-theme-b .visualCardBox {
background: rgba(56,56,56,.85);
}
.libraryViewNav a{
font-weight: 500;
}

View file

@ -110,6 +110,7 @@ See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for
<g id="games"><path d="M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l-3 3 3 3H22V9h-5.5z" /></g>
<g id="play-circle-filled"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z" /></g>
<g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z" /></g>
<g id="play-circle-outline"><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" /></g>
</defs>
</svg>
</iron-iconset-svg>

View file

@ -0,0 +1,23 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'), local('MaterialIcons-Regular'), url(MaterialIcons-Regular.woff2) format('woff2'), url(MaterialIcons-Regular.woff) format('woff'), url(MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
display: inline-block;
text-transform: none;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}

View file

@ -314,3 +314,40 @@ paper-fab.square {
paper-slider {
width: 100%;
}
paper-menu-item {
padding: .35em .5em;
}
paper-menu-item iron-icon {
margin-right: 1.5em;
}
.actionSheetMenuItem {
cursor: pointer;
}
.actionSheetMenuItem:hover {
background: #eee;
}
.scrollablePaperTabs paper-icon-button {
display: none !important;
}
/*.scrollablePaperTabs #tabsContainer {
text-align: center;
overflow-x: scroll;
-webkit-overflow-scrolling: touch;
overflow-y: hidden;
white-space: nowrap;
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
}
.scrollablePaperTabs #tabsContainer::-webkit-scrollbar {
height: 0 !important;
display: none;
}
.scrollablePaperTabs #tabsContent {
position: static !important;
}*/

View file

@ -16,4 +16,5 @@
<link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="bower_components/paper-slider/paper-slider.html">
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="thirdparty/emby-icons.html">

View file

@ -12057,6 +12057,8 @@ is separate from validation, and `allowed-pattern` does not affect how the input
</head><body><div hidden="" by-vulcanize=""><dom-module id="paper-material" assetpath="bower_components/paper-material/">
<style>
:host {
@ -17038,6 +17040,81 @@ paper-ripple {
* @event change
*/
</script>
<dom-module id="paper-menu" assetpath="bower_components/paper-menu/">
<style>
:host {
display: block;
padding: 8px 0;
background: var(--paper-menu-background-color, --primary-background-color);
color: var(--paper-menu-color, --primary-text-color);
@apply(--paper-menu);
}
/* need a wrapper element to make this higher specificity than the :host rule in paper-item */
.content > ::content > .iron-selected {
font-weight: bold;
@apply(--paper-menu-selected-item);
}
.content > ::content > [disabled] {
color: var(--paper-menu-disabled-color, --disabled-text-color);
}
.content > ::content > *:focus {
position: relative;
outline: 0;
@apply(--paper-menu-colored-focused-item);
}
.content > ::content > *:focus:after {
@apply(--layout-fit);
background: currentColor;
/* FIXME move to paper-styles for next widget */
opacity: 0.12;
content: '';
@apply(--paper-menu-colored-focused-item-after);
}
.content > ::content > *[colored]:focus:after {
opacity: 0.26;
}
</style>
<template>
<div class="content">
<content></content>
</div>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'paper-menu',
behaviors: [
Polymer.IronMenuBehavior
]
});
})();
</script>
<iron-iconset-svg name="icons" size="24">
<svg>
@ -17116,6 +17193,7 @@ paper-ripple {
<g id="games"><path d="M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l-3 3 3 3H22V9h-5.5z"></path></g>
<g id="play-circle-filled"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"></path></g>
<g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"></path></g>
<g id="play-circle-outline"><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
</defs>
</svg>
</iron-iconset-svg>