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

update listviews

This commit is contained in:
Luke Pulverenti 2016-07-16 01:05:40 -04:00
parent 3197c48232
commit 1032fa887e
54 changed files with 2271 additions and 376 deletions

View file

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.80", "version": "1.4.81",
"_release": "1.4.80", "_release": "1.4.81",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.80", "tag": "1.4.81",
"commit": "a959ba5d3e78c15e700002a399450365bc6b9328" "commit": "77ba771ece78a8beb9262d7ac296175df6c052b2"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0", "_target": "^1.2.0",

View file

@ -12,14 +12,19 @@ button.listItem {
} }
.listItem { .listItem {
margin: 0;
display: block; display: block;
align-items: center; align-items: center;
text-align: left; text-align: left;
padding: 0 1em !important; padding: .25em .5em .25em 1em !important;
line-height: 170%; line-height: 170%;
border-bottom: 1px solid #2a2a2a; border-bottom: 1px solid #2a2a2a;
} }
div.listItem {
cursor: pointer;
}
.listItem.largeImage { .listItem.largeImage {
padding: 1em 0 1em 1em; padding: 1em 0 1em 1em;
} }
@ -56,9 +61,8 @@ button.listItem {
padding-bottom: 0; padding-bottom: 0;
} }
.listItemBody h3 { .listItemBody h2, .listItemBody h3 {
margin: 0; margin: 0;
font-weight: normal;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -80,6 +84,8 @@ button.listItem {
.listItemImage { .listItemImage {
width: 7.4vh; width: 7.4vh;
height: 7.4vh; height: 7.4vh;
min-width: 40px;
min-height: 40px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain; background-size: contain;
flex-shrink: 0; flex-shrink: 0;
@ -140,13 +146,32 @@ button.listItem {
align-items: center; align-items: center;
} }
.layout-tv .listItemMediaInfo {
margin: .5em 0;
}
.listItemMediaInfo > * { .listItemMediaInfo > * {
display: inline-block; display: inline-block;
} }
.listGroupHeader {
margin: 2em 0 1em;
}
.listGroupHeader.first {
margin-top: 0;
}
@supports (display: flex) { @supports (display: flex) {
.listItem, .listItemBody, .listItemMediaInfo { .listItem, .listItemBody, .listItemMediaInfo {
display: flex; display: flex;
} }
} }
@media all and (max-width: 800px) {
.listItem .endsAt, .listItem .criticRating {
display: none !important;
}
}

View file

@ -1,10 +1,10 @@
define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'userdataButtons', 'css!./listview'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, userdataButtons) { define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'globalize', 'userdataButtons', 'css!./listview'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, globalize, userdataButtons) {
function getIndex(item, options) { function getIndex(item, options) {
if (options.index == 'disc') { if (options.index == 'disc') {
return item.ParentIndexNumber == null ? '' : Globalize.translate('sharedcomponents#ValueDiscNumber', item.ParentIndexNumber); return item.ParentIndexNumber == null ? '' : globalize.translate('sharedcomponents#ValueDiscNumber', item.ParentIndexNumber);
} }
var sortBy = (options.sortBy || '').toLowerCase(); var sortBy = (options.sortBy || '').toLowerCase();
@ -122,32 +122,36 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var clickEntireItem = layoutManager.tv ? true : false; var clickEntireItem = layoutManager.tv ? true : false;
var outerTagName = clickEntireItem ? 'button' : 'div'; var outerTagName = clickEntireItem ? 'button' : 'div';
return items.map(function (item) { var outerHtml = '';
outerHtml += items.map(function (item) {
var html = ''; var html = '';
//if (options.showIndex !== false) { if (options.showIndex) {
// var itemGroupTitle = LibraryBrowser.getListViewIndex(item, options); var itemGroupTitle = getIndex(item, options);
// if (itemGroupTitle != groupTitle) { if (itemGroupTitle != groupTitle) {
// outerHtml += '</div>'; if (html) {
html += '</div>';
}
// if (index == 0) { if (index == 0) {
// html += '<h1>'; html += '<h1 class="listGroupHeader first">';
// } }
// else { else {
// html += '<h1 style="margin-top:2em;">'; html += '<h1 class="listGroupHeader">';
// } }
// html += itemGroupTitle; html += itemGroupTitle;
// html += '</h1>'; html += '</h1>';
// html += '<div class="paperList itemsListview">'; html += '<div>';
// groupTitle = itemGroupTitle; groupTitle = itemGroupTitle;
// } }
//} }
var cssClass = "itemAction listItem"; var cssClass = "itemAction listItem";
@ -165,7 +169,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (imgUrl) { if (imgUrl) {
html += '<div class="listItemImage lazy" data-src="' + imgUrl + '" item-icon>'; html += '<div class="listItemImage lazy" data-src="' + imgUrl + '" item-icon>';
} else { } else {
html += '<div class="listItemImage" item-icon>'; html += '<div class="listItemImage">';
} }
var indicatorsHtml = ''; var indicatorsHtml = '';
@ -219,16 +223,18 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
for (var i = 0, textLinesLength = textlines.length; i < textLinesLength; i++) { for (var i = 0, textLinesLength = textlines.length; i < textLinesLength; i++) {
if (i == 0 && isLargeStyle) { if (i == 0 && isLargeStyle) {
html += '<h2 class="listItemTitle">'; html += '<h2>';
} }
else if (i == 0) { else if (i == 0) {
html += '<div>'; html += '<h3>';
} else { } else {
html += '<div class="secondary">'; html += '<div class="secondary">';
} }
html += textlines[i] || '&nbsp;'; html += textlines[i] || '&nbsp;';
if (i == 0 && isLargeStyle) { if (i == 0 && isLargeStyle) {
html += '</h2>'; html += '</h2>';
} else if (i == 0) {
html += '</h3>';
} else { } else {
html += '</div>'; html += '</div>';
} }
@ -249,7 +255,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (!clickEntireItem) { if (!clickEntireItem) {
html += '<button is="paper-icon-button-light" class="listviewMenuButton autoSize"><i class="md-icon">&#xE5D4;</i></button>'; html += '<button is="paper-icon-button-light" class="listviewMenuButton autoSize"><i class="md-icon">&#xE5D4;</i></button>';
html += '<span class="listViewUserDataButtons">'; html += '<span class="listViewUserDataButtons">';
html += userdataButtons.getIconsHtml(item); html += userdataButtons.getIconsHtml(item, false);
html += '</span>'; html += '</span>';
} }
@ -263,6 +269,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return html; return html;
}).join(''); }).join('');
return outerHtml;
} }
return { return {

View file

@ -24,17 +24,17 @@ i.mediaInfoItem {
.starRatingContainer i { .starRatingContainer i {
color: #CB272A; color: #CB272A;
width: 3vh; width: auto !important;
height: 3vh; height: auto !important;
font-size: 3vh; font-size: 120%;
} }
.mediaInfoItem.criticRating { .mediaInfoItem.criticRating {
padding-left: 3.15vh; padding-left: 1.5em;
background-position: left center; background-position: left center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: auto 2.6vh; background-size: auto 1.2em;
min-height: 2.6vh; min-height: 1.2em;
display: flex; display: flex;
align-items: center; align-items: center;
} }
@ -69,9 +69,3 @@ i.mediaInfoItem {
height: 4vh; height: 4vh;
font-size: 4vh; font-size: 4vh;
} }
.layout-tv .starRatingContainer i {
width: 3.4vh;
height: 3.4vh;
font-size: 3.4vh;
}

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ButtonTryAgain": "Try Again", "ButtonTryAgain": "Try Again",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Special - {0}", "ValueSpecialEpisodeName": "Special - {0}",
"Share": "Del", "Share": "Del",
"ServerUpdateNeeded": "Denne Emby server b\u00f8r opdateres. For at downloade den nyeste version bes\u00f8g venligst {0}", "ServerUpdateNeeded": "Denne Emby server b\u00f8r opdateres. For at downloade den nyeste version bes\u00f8g venligst {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ButtonTryAgain": "Try Again", "ButtonTryAgain": "Try Again",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Special - {0}", "ValueSpecialEpisodeName": "Special - {0}",
"Share": "Teilen", "Share": "Teilen",
"ServerUpdateNeeded": "Dieser Emby Server sollte aktualisiert werden. Um die neueste Version zu laden, besuche bitte {0}", "ServerUpdateNeeded": "Dieser Emby Server sollte aktualisiert werden. Um die neueste Version zu laden, besuche bitte {0}",

View file

@ -92,5 +92,11 @@
"HeaderYouSaid": "You Said...", "HeaderYouSaid": "You Said...",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ValueDiscNumber": "Disc {0}",
"Unrated": "Unrated",
"Favorite": "Favorite",
"Like": "Like",
"Dislike": "Dislike",
"Played": "Played",
"RefreshDialogHelp": "Metadata is refreshed based on settings and internet services that are enabled in the Emby Server dashboard." "RefreshDialogHelp": "Metadata is refreshed based on settings and internet services that are enabled in the Emby Server dashboard."
} }

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "Si ha negado el acceso por voz a la aplicaci\u00f3n necesitara reconfigurar antes de intentarlo de nuevo.", "MessageIfYouBlockedVoice": "Si ha negado el acceso por voz a la aplicaci\u00f3n necesitara reconfigurar antes de intentarlo de nuevo.",
"ButtonTryAgain": "Intentar de Nuevo", "ButtonTryAgain": "Intentar de Nuevo",
"MessageWeDidntRecognizeCommand": "Lo sentimos, no reconocimos ese comando.", "MessageWeDidntRecognizeCommand": "Lo sentimos, no reconocimos ese comando.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Especial - {0}", "ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Compartir", "Share": "Compartir",
"ServerUpdateNeeded": "Este Servidor Emby necesita ser actualizado. Para descargar la ultima versi\u00f3n, por favor visite {0}", "ServerUpdateNeeded": "Este Servidor Emby necesita ser actualizado. Para descargar la ultima versi\u00f3n, por favor visite {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "\u0415\u0433\u0435\u0440 \u049b\u043e\u043b\u0434\u0430\u043d\u0431\u0430\u0493\u0430 \u0434\u0430\u0443\u044b\u0441\u0442\u044b\u049b \u049b\u0430\u0442\u044b\u043d\u0430\u0443\u044b\u04a3\u044b\u0437 \u0431\u0430\u0441 \u0442\u0430\u0440\u0442\u044b\u043b\u0441\u0430, \u049b\u0430\u0439\u0442\u0430 \u04d9\u0440\u0435\u043a\u0435\u0442\u0442\u0435\u043d\u0443\u0456\u04a3\u0456\u0437\u0434\u0435\u043d \u0430\u043b\u0434\u044b\u043d\u0430\u043d \u049b\u0430\u0439\u0442\u0430 \u0442\u0435\u04a3\u0448\u0435\u0443\u0456\u04a3\u0456\u0437 \u049b\u0430\u0436\u0435\u0442 \u0431\u043e\u043b\u0430\u0434\u044b.", "MessageIfYouBlockedVoice": "\u0415\u0433\u0435\u0440 \u049b\u043e\u043b\u0434\u0430\u043d\u0431\u0430\u0493\u0430 \u0434\u0430\u0443\u044b\u0441\u0442\u044b\u049b \u049b\u0430\u0442\u044b\u043d\u0430\u0443\u044b\u04a3\u044b\u0437 \u0431\u0430\u0441 \u0442\u0430\u0440\u0442\u044b\u043b\u0441\u0430, \u049b\u0430\u0439\u0442\u0430 \u04d9\u0440\u0435\u043a\u0435\u0442\u0442\u0435\u043d\u0443\u0456\u04a3\u0456\u0437\u0434\u0435\u043d \u0430\u043b\u0434\u044b\u043d\u0430\u043d \u049b\u0430\u0439\u0442\u0430 \u0442\u0435\u04a3\u0448\u0435\u0443\u0456\u04a3\u0456\u0437 \u049b\u0430\u0436\u0435\u0442 \u0431\u043e\u043b\u0430\u0434\u044b.",
"ButtonTryAgain": "\u04d8\u0440\u0435\u043a\u0435\u0442\u0442\u0456 \u049b\u0430\u0439\u0442\u0430\u043b\u0430\u0443", "ButtonTryAgain": "\u04d8\u0440\u0435\u043a\u0435\u0442\u0442\u0456 \u049b\u0430\u0439\u0442\u0430\u043b\u0430\u0443",
"MessageWeDidntRecognizeCommand": "\u041e\u0441\u044b\u043d\u0434\u0430\u0439 \u043f\u04d9\u0440\u043c\u0435\u043d\u0434\u0456 \u0442\u0430\u043d\u044b\u043f \u0430\u0439\u044b\u0440\u043c\u0430\u0434\u044b\u049b.", "MessageWeDidntRecognizeCommand": "\u041e\u0441\u044b\u043d\u0434\u0430\u0439 \u043f\u04d9\u0440\u043c\u0435\u043d\u0434\u0456 \u0442\u0430\u043d\u044b\u043f \u0430\u0439\u044b\u0440\u043c\u0430\u0434\u044b\u049b.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "\u0410\u0440\u043d\u0430\u0439\u044b - {0}", "ValueSpecialEpisodeName": "\u0410\u0440\u043d\u0430\u0439\u044b - {0}",
"Share": "\u041e\u0440\u0442\u0430\u049b\u0442\u0430\u0441\u0443", "Share": "\u041e\u0440\u0442\u0430\u049b\u0442\u0430\u0441\u0443",
"ServerUpdateNeeded": "\u041e\u0441\u044b Emby Server \u0436\u0430\u04a3\u0430\u0440\u0442\u044b\u043b\u0443\u044b \u049b\u0430\u0436\u0435\u0442. \u0421\u043e\u04a3\u0493\u044b \u043d\u04b1\u0441\u049b\u0430\u0441\u044b\u043d \u0436\u04af\u043a\u0442\u0435\u043f \u0430\u043b\u0443 \u04af\u0448\u0456\u043d, {0} \u043a\u0456\u0440\u0456\u04a3\u0456\u0437", "ServerUpdateNeeded": "\u041e\u0441\u044b Emby Server \u0436\u0430\u04a3\u0430\u0440\u0442\u044b\u043b\u0443\u044b \u049b\u0430\u0436\u0435\u0442. \u0421\u043e\u04a3\u0493\u044b \u043d\u04b1\u0441\u049b\u0430\u0441\u044b\u043d \u0436\u04af\u043a\u0442\u0435\u043f \u0430\u043b\u0443 \u04af\u0448\u0456\u043d, {0} \u043a\u0456\u0440\u0456\u04a3\u0456\u0437",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ButtonTryAgain": "Try Again", "ButtonTryAgain": "Try Again",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Spesial - {0}", "ValueSpecialEpisodeName": "Spesial - {0}",
"Share": "Del", "Share": "Del",
"ServerUpdateNeeded": "Denne Emby serveren trenger en oppdatering. For \u00e5 laste ned nyeste versjon, vennligst bes\u00f8k: {0}", "ServerUpdateNeeded": "Denne Emby serveren trenger en oppdatering. For \u00e5 laste ned nyeste versjon, vennligst bes\u00f8k: {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "Als u spraak toegang uitgeschakeld heeft moet u dit opnieuw configureren voordat u verder gaat.", "MessageIfYouBlockedVoice": "Als u spraak toegang uitgeschakeld heeft moet u dit opnieuw configureren voordat u verder gaat.",
"ButtonTryAgain": "Probeer opnieuw", "ButtonTryAgain": "Probeer opnieuw",
"MessageWeDidntRecognizeCommand": "Sorry, dat commando herkennen we niet.", "MessageWeDidntRecognizeCommand": "Sorry, dat commando herkennen we niet.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Speciaal - {0}", "ValueSpecialEpisodeName": "Speciaal - {0}",
"Share": "Delen", "Share": "Delen",
"ServerUpdateNeeded": "Deze Emby Server moet worden bijgewerkt. Om de laatste versie te downloaden, gaat u naar {0}", "ServerUpdateNeeded": "Deze Emby Server moet worden bijgewerkt. Om de laatste versie te downloaden, gaat u naar {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ButtonTryAgain": "Try Again", "ButtonTryAgain": "Try Again",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Especial - {0}", "ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Compartilhar", "Share": "Compartilhar",
"ServerUpdateNeeded": "Este servidor Emby precisa ser atualizado. Para baixar a \u00faltima vers\u00e3o, por favor visite {0}", "ServerUpdateNeeded": "Este servidor Emby precisa ser atualizado. Para baixar a \u00faltima vers\u00e3o, por favor visite {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.", "MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ButtonTryAgain": "Try Again", "ButtonTryAgain": "Try Again",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.", "MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Especial - {0}", "ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Partilhar", "Share": "Partilhar",
"ServerUpdateNeeded": "Este Servidor Emby precisa ser atualizado. Para fazer download da vers\u00e3o mais recente, por favor visite {0}", "ServerUpdateNeeded": "Este Servidor Emby precisa ser atualizado. Para fazer download da vers\u00e3o mais recente, por favor visite {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "\u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043f\u0435\u0440\u0435\u0434 \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u043e\u0439 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430.", "MessageIfYouBlockedVoice": "\u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043f\u0435\u0440\u0435\u0434 \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u043e\u0439 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430.",
"ButtonTryAgain": "\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0443", "ButtonTryAgain": "\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0443",
"MessageWeDidntRecognizeCommand": "\u0414\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0430.", "MessageWeDidntRecognizeCommand": "\u0414\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0430.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "\u0421\u043f\u0435\u0446\u044d\u043f\u0438\u0437\u043e\u0434 - {0}", "ValueSpecialEpisodeName": "\u0421\u043f\u0435\u0446\u044d\u043f\u0438\u0437\u043e\u0434 - {0}",
"Share": "\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f", "Share": "\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f",
"ServerUpdateNeeded": "\u0414\u0430\u043d\u043d\u044b\u0439 Emby Server \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 {0}", "ServerUpdateNeeded": "\u0414\u0430\u043d\u043d\u044b\u0439 Emby Server \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 {0}",

View file

@ -5,6 +5,12 @@
"MessageIfYouBlockedVoice": "Om du nekade tillg\u00e5ng f\u00f6r r\u00f6st\u00e5tkomst till appen s\u00e5 beh\u00f6ver du konfigurera om innan du f\u00f6rs\u00f6ker igen.", "MessageIfYouBlockedVoice": "Om du nekade tillg\u00e5ng f\u00f6r r\u00f6st\u00e5tkomst till appen s\u00e5 beh\u00f6ver du konfigurera om innan du f\u00f6rs\u00f6ker igen.",
"ButtonTryAgain": "F\u00f6rs\u00f6k igen", "ButtonTryAgain": "F\u00f6rs\u00f6k igen",
"MessageWeDidntRecognizeCommand": "Ledsen, men vi k\u00e4nner inte igen det kommandot.", "MessageWeDidntRecognizeCommand": "Ledsen, men vi k\u00e4nner inte igen det kommandot.",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Specialavsnitt - {0}", "ValueSpecialEpisodeName": "Specialavsnitt - {0}",
"Share": "Dela", "Share": "Dela",
"ServerUpdateNeeded": "Den h\u00e4r Emby servern beh\u00f6ver uppdateras. F\u00f6r att ladda ner senaste versionen, g\u00e5 till {0}", "ServerUpdateNeeded": "Den h\u00e4r Emby servern beh\u00f6ver uppdateras. F\u00f6r att ladda ner senaste versionen, g\u00e5 till {0}",

View file

@ -0,0 +1,102 @@
{
"NoItemsFound": "\u7121\u9805\u76ee",
"HeaderSaySomethingLike": "\u8aaa\u9ede\u6771\u897f\uff0c\u50cf\u662f...",
"HeaderYouSaid": "\u60a8\u662f\u6307...",
"MessageIfYouBlockedVoice": "\u5982\u679c\u60a8\u62d2\u7d55\u7a0b\u5f0f\u4f7f\u7528\u8a9e\u97f3\u8fa8\u8b58\uff0c\u60a8\u5c07\u9700\u8981\u5728\u91cd\u8a66\u4e4b\u524d\u518d\u6b21\u8a2d\u5b9a",
"ButtonTryAgain": "\u91cd\u8a66",
"MessageWeDidntRecognizeCommand": "\u5f88\u62b1\u6b49\uff0c\u6211\u5011\u7121\u6cd5\u8fa8\u8b58\u6b64\u6307\u4ee4",
"ValueDiscNumber": "Disc {0}",
"Favorite": "Favorite",
"Unrated": "Unrated",
"Played": "Played",
"Like": "Like",
"Dislike": "Dislike",
"ValueSpecialEpisodeName": "Special - {0}",
"Share": "\u5206\u4eab",
"ServerUpdateNeeded": "\u6b64Emby\u4f3a\u670d\u5668\u9700\u8981\u66f4\u65b0\uff0c\u8acb\u81f3{0}\u53d6\u5f97\u6700\u65b0\u7248\u672c",
"LiveTvGuideRequiresUnlock": "\u96fb\u8996\u6307\u5357\u76ee\u524d\u53ea\u9650\u65bc{0}\u500b\u983b\u9053\u3002\u9ede\u9078\u300c\u89e3\u9396\u300d\u4ee5\u4e86\u89e3\u5982\u4f55\u7372\u5f97\u66f4\u5b8c\u6574\u7684\u9ad4\u9a57",
"AttributeNew": "New",
"AttributePremiere": "\u9996\u64ad",
"AttributeLive": "\u6b63\u5728\u64ad\u653e",
"TrackCount": "{0}\u500b\u66f2\u76ee",
"ItemCount": "{0}\u500b\u9805\u76ee",
"ValueSeriesYearToPresent": "{0}-Present",
"ReleaseYearValue": "\u63a8\u51fa\u65e5\u671f\uff1a{0}",
"OriginalAirDateValue": "\u539f\u59cb\u64ad\u51fa\u65e5\u671f\uff1a{0}",
"EndsAtValue": "\u5b8c\u7d50\u65bc{0}",
"OptionSundayShort": "\u65e5",
"OptionMondayShort": "\u4e00",
"OptionTuesdayShort": "\u4e8c",
"OptionWednesdayShort": "\u4e09",
"OptionThursdayShort": "\u56db",
"OptionFridayShort": "\u4e94",
"OptionSaturdayShort": "\u516d",
"HeaderSelectDate": "\u9078\u64c7\u65e5\u671f",
"ButtonOk": "\u78ba\u5b9a",
"ButtonCancel": "\u53d6\u6d88",
"ButtonGotIt": "\u6211\u77e5\u9053\u4e86",
"RecordingCancelled": "\u5df2\u53d6\u6d88\u6392\u7a0b\u9304\u88fd",
"RecordingScheduled": "\u5df2\u6392\u7a0b\u9304\u88fd",
"SeriesRecordingScheduled": "\u5df2\u6392\u7a0b\u9304\u88fd\u6574\u500b\u7cfb\u5217",
"HeaderNewRecording": "\u65b0\u9304\u88fd",
"Sunday": "\u661f\u671f\u65e5",
"Monday": "\u661f\u671f\u4e00",
"Tuesday": "\u661f\u671f\u4e8c",
"Wednesday": "\u661f\u671f\u4e09",
"Thursday": "\u661f\u671f\u56db",
"Friday": "\u661f\u671f\u4e94",
"Saturday": "\u661f\u671f\u516d",
"Days": "\u65e5",
"RecordSeries": "\u9304\u88fd\u6574\u500b\u7cfb\u5217",
"LabelPrePaddingMinutes": "\u63d0\u524d\u958b\u59cb\u5206\u9418\u6578\uff1a",
"LabelPostPaddingMinutes": "\u5ef6\u5f8c\u7d50\u675f\u5206\u9418\u6578\uff1a",
"RecordOnAllChannels": "\u5728\u6240\u6709\u983b\u9053\u9304\u88fd",
"RecordAnytime": "\u5728\u4efb\u4f55\u6642\u9593\u9304\u88fd",
"RecordOnlyNewEpisodes": "\u53ea\u9304\u88fd\u65b0\u96c6\u6578",
"HeaderBecomeProjectSupporter": "\u53d6\u5f97Emby\u8c6a\u83ef\u7248",
"HeaderEnjoyDayTrial": "\u514d\u8cbb\u8a66\u752814\u5929",
"MessageActiveSubscriptionRequiredSeriesRecordings": "\u8981\u4f7f\u7528\u81ea\u52d5\u9304\u88fd\u7cfb\u5217\u7684\u529f\u80fd\uff0c\u9700\u8981\u6709\u6548\u7684Emby\u8c6a\u83ef\u7248\u8a02\u95b1",
"OptionConvertRecordingsToStreamingFormat": "\u81ea\u52d5\u5c07\u9304\u88fd\u5167\u5bb9\u8f49\u63db\u6210\u9069\u7528\u65bc\u4e32\u6d41\u7684\u683c\u5f0f",
"OptionConvertRecordingsToStreamingFormatHelp": "\u9304\u88fd\u7684\u5167\u5bb9\u5c07\u6703\u8f49\u63db\u6210MP4\uff0c\u4ee5\u4fbf\u66f4\u5bb9\u6613\u5730\u5728\u60a8\u7684\u88dd\u7f6e\u4e0a\u64ad\u653e",
"FeatureRequiresEmbyPremiere": "\u6b64\u529f\u80fd\u9700\u8981\u6709\u6548\u7684Emby\u8c6a\u83ef\u7248\u8a02\u95b1",
"Record": "\u9304\u88fd",
"Save": "\u5132\u5b58",
"Edit": "\u7de8\u8f2f",
"Download": "\u4e0b\u8f09",
"Advanced": "\u9032\u968e",
"Delete": "\u522a\u9664",
"HeaderDeleteItem": "\u522a\u9664\u9805\u76ee",
"ConfirmDeleteItem": "\u522a\u9664\u6b64\u9805\u76ee\u6642\uff0c\u4e5f\u6703\u4e00\u4f75\u5f9e\u6a94\u6848\u7cfb\u7d71\u53ca\u5a92\u9ad4\u6ac3\u4e2d\u522a\u9664\u3002\u78ba\u5b9a\u8981\u522a\u9664\u55ce\uff1f",
"Refresh": "\u91cd\u65b0\u6574\u7406",
"RefreshQueued": "Refresh queued.",
"AddToCollection": "\u65b0\u589e\u5230\u6536\u85cf\u6ac3",
"NewCollection": "\u65b0\u6536\u85cf\u6ac3",
"LabelCollection": "\u6536\u85cf\u6ac3\uff1a",
"Help": "\u8aaa\u660e",
"NewCollectionHelp": "\u6536\u85cf\u6ac3\u8b93\u60a8\u80fd\u5920\u5efa\u7acb\u500b\u4eba\u5316\u7684\u5f71\u97f3\u53ca\u5176\u4ed6\u5a92\u9ad4\u7684\u5206\u985e",
"SearchForCollectionInternetMetadata": "\u5728\u7db2\u8def\u4e0a\u641c\u5c0b\u76f8\u95dc\u7684\u5c01\u9762\u5716\u53ca\u8a73\u7d30\u8cc7\u6599",
"LabelName": "\u540d\u7a31\uff1a",
"NewCollectionNameExample": "\u4f8b\u5982\uff1a\u661f\u969b\u5927\u6230\u7e3d\u532f",
"MessageItemsAdded": "\u5df2\u65b0\u589e\u9805\u76ee",
"OptionNew": "\u65b0\u589e...",
"LabelPlaylist": "\u64ad\u653e\u6e05\u55ae\uff1a",
"AddToPlaylist": "\u65b0\u589e\u5230\u64ad\u653e\u6e05\u55ae",
"Subtitles": "\u5b57\u5e55",
"SearchForSubtitles": "\u641c\u5c0b\u5b57\u5e55",
"LabelLanguage": "\u8a9e\u8a00\uff1a",
"Search": "\u641c\u5c0b",
"NoSubtitleSearchResultsFound": "\u7121\u7d50\u679c",
"File": "\u6a94\u6848",
"MessageAreYouSureDeleteSubtitles": "\u60a8\u771f\u7684\u8981\u522a\u9664\u9019\u500b\u5b57\u5e55\u6a94\u55ce\uff1f",
"ConfirmDeletion": "\u78ba\u5b9a\u522a\u9664",
"MySubtitles": "\u6211\u7684\u5b57\u5e55",
"MessageDownloadQueued": "\u9700\u8981\u4e0b\u8f09",
"EditSubtitles": "\u7de8\u8f2f\u5b57\u5e55",
"UnlockGuide": "\u89e3\u9396\u65b9\u5f0f",
"RefreshMetadata": "\u66f4\u65b0\u8a73\u7d30\u8cc7\u6599",
"ReplaceExistingImages": "\u53d6\u4ee3\u73fe\u6709\u5716\u7247",
"ReplaceAllMetadata": "\u53d6\u4ee3\u6240\u6709\u8a73\u7d30\u8cc7\u6599",
"SearchForMissingMetadata": "\u641c\u5c0b\u907a\u5931\u7684\u8a73\u7d30\u8cc7\u6599",
"LabelRefreshMode": "\u66f4\u65b0\u6a21\u5f0f\uff1a",
"RefreshDialogHelp": "\u8a73\u7d30\u8cc7\u6599\u7684\u66f4\u65b0\u65b9\u5f0f\u6703\u4f9d\u64daEmby\u7684\u8a2d\u5b9a\u53ca\u5df2\u7d93\u555f\u7528\u7684\u7db2\u8def\u670d\u52d9\u4f86\u9032\u884c"
}

View file

@ -0,0 +1,8 @@
.btnUserData {
color: #aaa;
}
.btnUserDataOn, .btnUserDataOn i {
color: #cc3333 !important;
}

View file

@ -1,4 +1,4 @@
define(['connectionManager', 'globalize', 'paper-icon-button-light', 'material-icons', 'emby-button'], function (connectionManager, globalize) { define(['connectionManager', 'globalize', 'paper-icon-button-light', 'material-icons', 'emby-button', 'css!./userdatabuttons'], function (connectionManager, globalize) {
function getUserDataButtonHtml(method, itemId, iconCssClass, icon, tooltip, style) { function getUserDataButtonHtml(method, itemId, iconCssClass, icon, tooltip, style) {

View file

@ -0,0 +1,49 @@
{
"name": "iron-location",
"version": "0.8.5",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"routing"
],
"main": [
"iron-location.html",
"iron-query-params.html"
],
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/iron-location",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
"paper-input": "polymerelements/paper-input#^1.0.0",
"paper-slider": "polymerelements/paper-slider#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
},
"_release": "0.8.5",
"_resolution": {
"type": "version",
"tag": "v0.8.5",
"commit": "d7c5a9c991bf5e94094c16e94eb34e2eb30db4b0"
},
"_source": "git://github.com/PolymerElements/iron-location.git",
"_target": "^0.8.0",
"_originalSource": "PolymerElements/iron-location"
}

View file

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/iron-location/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/lebawa/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View file

@ -0,0 +1 @@
bower_components

View file

@ -0,0 +1,23 @@
language: node_js
sudo: required
node_js: stable
addons:
firefox: '46.0'
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
sauce_connect: true
before_script:
- npm install -g bower polylint web-component-tester
- bower install
- polylint
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
env:
global:
- secure: GQ+cUlta7BWa8Gq4YXrBStPzwRpHT2QG79T4pbDTz2Zs1RvT0GYQaEUksPQnsNCwnTF8ondXhUfMxHcC/r8p7YTCt2hSJSsKkx0lMertsjbKW38ZG28liaAN8msYGb9hnTs4qxhpVEX1pZtOI13RKBU85dw+jKbtxKDX/jVrMn42XCMhEmTeLxM4z8dW5nBu6LW6F3nwABQIUfdc/3OeIYG+2n+84zkXIsX1BFeejq28E6fYJAoMJgqfugLPgPu4IEVCWZJwYl2SgdXwxAcJ2auPph5GJ3DLd0fRRD1TZ94/u0A+eJcQ0OPiPu8hLpQNXOkCgAnO5jkpTCDERNQnB4nY8VfZeZdf1RLAB4VmxzOAbJwJcnqGrh89H6RhKKXyhcuFCgFACYfkzncBCs+co5KwVcwLq88cDOUbnmo3DlwQWpkfusvKy/ZrMrFrX1zycJWN4u8rDsIH4ELasSQh/J3OIa9l2mKfL/OEvqCmpv/ZLGlOVSvNLpr4U7vTVdZBP6C9rtwVXX7VzrClttiidHfoxztAMrNh2GBMjNH9n3FuWMoA/OSoxQGc7RreTsuzdniw3iJYUHIeG08R9bqRtSVA71AlQrbqUaHR+WM7rf7GUx6xG0uDop5vH0RDkE0Nld1W8XuVhHQUg3y3fd4AHJAQVmM7Zsfa3AY1gSr3hV0=
- secure: He0JAbtg9jFzuEBRHQdFWHJ33uueY/9Hxq4NB5PCAI1Z9ebIiTs73ofdNy6e+ftBqlQnBuhoKLfIpuD8Qj2kSdLHQvg1s6ojvNDmAvau1ZINCJRgOSKbGC0TvCVx9rT9Kqc83eqKvKDzr/rcpaIArgMYJzBrSG0D2Kn4luUQnWkKfo1knn17ytJFCvzqQvPWZTIZ6beJ7MRKXRU093a4wYMsKIxQHH65T4Ypj+RBsgv6Xnidjb8qZbNsEwaeOwExfsh30WUo/hSygRi2CP3KSRSc/vsMgSrGpFghZpnhjeDJAGTiDzCTxpJkAkHXereJT4agsWErcgSrRTaxi5G6f18o56pRS+I61BC5DuGGwSL7hOHWSC8pGzkwVFyz31MB2ll0HO3iQHMmcSjY37+G7toEP/vJ/UHm6SZoQq36HGJea7Ycv/2mk4HAHcVEDxhYG42bXXflxevFeqAkVUI7SxSaQpQuZF76/4th4uKFmAHPvRVj5yx8OWil9Lt6cG8DIEZaxXdJVueGgiODmmul7lAd5osO/1UCg4CTy1OnmuSJj7ax9LBa6YY2+3uvnBfE7fNUVKmVmVhlLsF0QAdj0LaFoSU0eQFWdReYqBxEvc4gOT3AtEpaAvfZnL11Q6wVyI7kCHhTHrltA4WENPOSA2u7W//WsQfHX3gRdpIVIVI=
dist: trusty

View file

@ -0,0 +1,77 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
You can however override the jsbin link with one that's customized to this
specific element:
jsbin=https://jsbin.com/lebawa/edit?html,output
-->
# Polymer Elements
## Guide for Contributors
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
### Filing Issues
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
1. **Who will use the feature?** _“As someone filling out a form…”_
2. **When will they use the feature?** _“When I enter an invalid value…”_
3. **What is the users goal?** _“I want to be visually notified that the value needs to be corrected…”_
**If you are filing an issue to report a bug**, please provide:
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
```markdown
The `paper-foo` element causes the page to turn pink when clicked.
## Expected outcome
The page stays the same color.
## Actual outcome
The page turns pink.
## Steps to reproduce
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/lebawa/edit?html,output](https://jsbin.com/lebawa/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
### Submitting Pull Requests
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, fixes #40
```
2. **A succinct description of the design** used to fix any related issues. For example:
```markdown
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
```
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so dont be afraid to ask us if you need help with that!

View file

@ -0,0 +1,40 @@
{
"name": "iron-location",
"version": "0.8.5",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"routing"
],
"main": [
"iron-location.html",
"iron-query-params.html"
],
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/iron-location",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
"paper-input": "polymerelements/paper-input#^1.0.0",
"paper-slider": "polymerelements/paper-slider#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
}
}

View file

@ -0,0 +1,126 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-location.html">
<link rel="import" href="../../paper-styles/typography.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="import" href="../../paper-slider/paper-slider.html">
<link rel="import" href="../../iron-demo-helpers/url-bar.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
</head>
<body>
<url-bar></url-bar>
<dom-module id="iron-location-demo">
<template>
<style>
div.inputs {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 100px;
}
h3 {
padding: 0;
margin: 0;
}
.inputs, .history_entries {
@apply(--layout-vertical);
@apply(--layout-flex);
padding: 20px;
max-width: 500px;
}
.container {
@apply(--layout-horizontal);
}
</style>
<iron-location path="{{path}}" hash="{{hash}}" query="{{query}}"
dwell-time="{{dwellTime}}">
</iron-location>
<div class="container">
<div class="inputs">
<h3>URL</h3>
<paper-input label="path" value="{{path}}" always-float-label>
</paper-input>
<paper-input label="hash" value="{{hash}}" always-float-label>
</paper-input>
<paper-input label='query' value='{{query}}' always-float-label>
</paper-input>
</div>
<div class="history_entries">
<h3>Dwell Time</h3>
<p>
iron-location won't add extraneous entries to the browser's history
when changes come in quick succession.
</p>
<p>
A new history entry will only be added if iron-location stays in
the same state longer than dwellTime.
</p>
<div>
<label>History added: </label>
{{historyElementsAdded}} entries
</div>
<div>
<label>Dwell time:</label>
{{inSeconds(dwellTime)}}s
</div>
<paper-slider min="-1" max="5000" value="2000" step="100"
immediate-value="{{dwellTime}}">
</paper-slider>
</div>
</div>
</template>
<script>
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'iron-location-demo',
properties: {
historyElementsAdded: {
type: Number
}
},
observers: [
'checkHistorySize(path, hash, query, startingHistoryLength)'
],
ready: function() {
this.startingHistoryLength = window.history.length;
},
checkHistorySize: function() {
this.historyElementsAdded =
window.history.length - this.startingHistoryLength;
},
inSeconds: function(dwellTime) {
if (dwellTime === -1) {
return -1;
}
return (Math.round(dwellTime / 100) / 10)
}
});
});
</script>
</dom-module>
<iron-location-demo></iron-location-demo>
</body>
</html>

View file

@ -0,0 +1,119 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-query-params</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-query-params.html">
<link rel="import" href="../../paper-styles/classes/typography.html">
<link rel="import" href="../../iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
</head>
<body>
<dom-module id='iron-query-params-demo'>
<template>
<style>
div.inputs {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 100px;
}
span.seconds {
}
[layout] {
@apply(--layout);
}
[layout][horizontal] {
@apply(--layout-horizontal);
}
[layout][horizontal] > div {
padding: 20px;
max-width: 500px;
}
[layout][vertical] {
@apply(--layout-vertical);
}
[layout][flex] {
@apply(--layout-flex);
}
h3 {
padding: 0;
margin: 0;
}
</style>
<iron-query-params
params-string='{{paramString}}' params-object='{{params}}'>
</iron-query-params>
<div layout horizontal>
<div layout vertical flex class='inputs'>
<paper-input label='params as string'
value='{{paramString}}' always-float-label>
</paper-input>
<paper-input label='params as object' value='{{paramsString}}'
invalid='{{paramsInvalid}}'
error-message='Should be legal JSON'
always-float-label>
</paper-input>
</div>
</div>
</template>
<script>
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'iron-query-params-demo',
properties: {
paramsString: {
observer: 'paramsStringChanged'
},
params: {
observer: 'paramsChanged'
},
paramsInvalid: {
value: false,
},
},
paramsStringChanged: function() {
if (this.ignore) {
return;
}
this.ignore = true;
try {
this.params = JSON.parse(this.paramsString);
this.paramsInvalid = false;
} catch(_) {
this.paramsInvalid = true;
}
this.ignore = false;
},
paramsChanged: function() {
if (this.ignore) {
return;
}
this.ignore = true;
this.paramsString = JSON.stringify(this.params);
this.paramsInvalid = false;
this.ignore = false;
}
});
});
</script>
</dom-module>
<iron-query-params-demo></iron-query-params-demo>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View file

@ -0,0 +1,330 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<!--
The `iron-location` element manages binding to and from the current URL.
iron-location is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-location as we continue work
on higher level elements, and as such iron-location may undergo breaking
changes.
#### Properties
When the URL is: `/search?query=583#details` iron-location's properties will be:
- path: `'/search'`
- query: `'query=583'`
- hash: `'details'`
These bindings are bidirectional. Modifying them will in turn modify the URL.
iron-location is only active while it is attached to the document.
#### Links
While iron-location is active in the document it will intercept clicks on links
within your site, updating the URL pushing the updated URL out through the
databinding system. iron-location only intercepts clicks with the intent to
open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine.
You can customize this behavior with the `urlSpaceRegex`.
#### Dwell Time
iron-location protects against accidental history spamming by only adding
entries to the user's history if the URL stays unchanged for `dwellTime`
milliseconds.
@demo demo/index.html
-->
<script>
'use strict';
Polymer({
is: 'iron-location',
properties: {
/**
* The pathname component of the URL.
*/
path: {
type: String,
notify: true,
value: function() {
return window.location.pathname;
}
},
/**
* The query string portion of the URL.
*/
query: {
type: String,
notify: true,
value: function() {
return window.location.search.slice(1);
}
},
/**
* The hash component of the URL.
*/
hash: {
type: String,
notify: true,
value: function() {
return window.location.hash.slice(1);
}
},
/**
* If the user was on a URL for less than `dwellTime` milliseconds, it
* won't be added to the browser's history, but instead will be replaced
* by the next entry.
*
* This is to prevent large numbers of entries from clogging up the user's
* browser history. Disable by setting to a negative number.
*/
dwellTime: {
type: Number,
value: 2000
},
/**
* A regexp that defines the set of URLs that should be considered part
* of this web app.
*
* Clicking on a link that matches this regex won't result in a full page
* navigation, but will instead just update the URL state in place.
*
* This regexp is given everything after the origin in an absolute
* URL. So to match just URLs that start with /search/ do:
* url-space-regex="^/search/"
*
* @type {string|RegExp}
*/
urlSpaceRegex: {
type: String,
value: ''
},
/**
* urlSpaceRegex, but coerced into a regexp.
*
* @type {RegExp}
*/
_urlSpaceRegExp: {
computed: '_makeRegExp(urlSpaceRegex)'
},
_lastChangedAt: {
type: Number
},
_initialized: {
type: Boolean,
value: false
}
},
hostAttributes: {
hidden: true
},
observers: [
'_updateUrl(path, query, hash)'
],
attached: function() {
this.listen(window, 'hashchange', '_hashChanged');
this.listen(window, 'location-changed', '_urlChanged');
this.listen(window, 'popstate', '_urlChanged');
this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
// Give a 200ms grace period to make initial redirects without any
// additions to the user's history.
this._lastChangedAt = window.performance.now() - (this.dwellTime - 200);
this._initialized = true;
this._urlChanged();
},
detached: function() {
this.unlisten(window, 'hashchange', '_hashChanged');
this.unlisten(window, 'location-changed', '_urlChanged');
this.unlisten(window, 'popstate', '_urlChanged');
this.unlisten(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
this._initialized = false;
},
_hashChanged: function() {
this.hash = window.location.hash.substring(1);
},
_urlChanged: function() {
// We want to extract all info out of the updated URL before we
// try to write anything back into it.
//
// i.e. without _dontUpdateUrl we'd overwrite the new path with the old
// one when we set this.hash. Likewise for query.
this._dontUpdateUrl = true;
this._hashChanged();
this.path = window.location.pathname;
this.query = window.location.search.substring(1);
this._dontUpdateUrl = false;
this._updateUrl();
},
_getUrl: function() {
var url = this.path;
var query = this.query;
if (query) {
url += '?' + query;
}
if (this.hash) {
url += '#' + this.hash;
}
return url;
},
_updateUrl: function() {
if (this._dontUpdateUrl || !this._initialized) {
return;
}
var newUrl = this._getUrl();
var currentUrl = (
window.location.pathname +
window.location.search +
window.location.hash
);
if (newUrl == currentUrl) {
// nothing to do, the URL didn't change
return;
}
// Need to use a full URL in case the containing page has a base URI.
var fullNewUrl = new URL(
newUrl, window.location.protocol + '//' + window.location.host).href;
var now = window.performance.now();
var shouldReplace =
this._lastChangedAt + this.dwellTime > now;
this._lastChangedAt = now;
if (shouldReplace) {
window.history.replaceState({}, '', fullNewUrl);
} else {
window.history.pushState({}, '', fullNewUrl);
}
this.fire('location-changed', {}, {node: window});
},
/**
* A necessary evil so that links work as expected. Does its best to
* bail out early if possible.
*
* @param {MouseEvent} event .
*/
_globalOnClick: function(event) {
// If another event handler has stopped this event then there's nothing
// for us to do. This can happen e.g. when there are multiple
// iron-location elements in a page.
if (event.defaultPrevented) {
return;
}
var href = this._getSameOriginLinkHref(event);
if (!href) {
return;
}
event.preventDefault();
// If the navigation is to the current page we shouldn't add a history
// entry or fire a change event.
if (href === window.location.href) {
return;
}
window.history.pushState({}, '', href);
this.fire('location-changed', {}, {node: window});
},
/**
* Returns the absolute URL of the link (if any) that this click event
* is clicking on, if we can and should override the resulting full
* page navigation. Returns null otherwise.
*
* @param {MouseEvent} event .
* @return {string?} .
*/
_getSameOriginLinkHref: function(event) {
// We only care about left-clicks.
if (event.button !== 0) {
return null;
}
// We don't want modified clicks, where the intent is to open the page
// in a new tab.
if (event.metaKey || event.ctrlKey) {
return null;
}
var eventPath = Polymer.dom(event).path;
var anchor = null;
for (var i = 0; i < eventPath.length; i++) {
var element = eventPath[i];
if (element.tagName === 'A' && element.href) {
anchor = element;
break;
}
}
// If there's no link there's nothing to do.
if (!anchor) {
return null;
}
// Target blank is a new tab, don't intercept.
if (anchor.target === '_blank') {
return null;
}
// If the link is for an existing parent frame, don't intercept.
if ((anchor.target === '_top' ||
anchor.target === '_parent') &&
window.top !== window) {
return null;
}
var href = anchor.href;
// It only makes sense for us to intercept same-origin navigations.
// pushState/replaceState don't work with cross-origin links.
var url;
if (document.baseURI != null) {
url = new URL(href, /** @type {string} */(document.baseURI));
} else {
url = new URL(href);
}
var origin;
// IE Polyfill
if (window.location.origin) {
origin = window.location.origin;
} else {
origin = window.location.protocol + '//' + window.location.hostname;
if (window.location.port) {
origin += ':' + window.location.port;
}
}
if (url.origin !== origin) {
return null;
}
var normalizedHref = url.pathname + url.search + url.hash;
// If we've been configured not to handle this url... don't handle it!
if (this._urlSpaceRegExp &&
!this._urlSpaceRegExp.test(normalizedHref)) {
return null;
}
// Need to use a full URL in case the containing page has a base URI.
var fullNormalizedHref = new URL(
normalizedHref, window.location.href).href;
return fullNormalizedHref;
},
_makeRegExp: function(urlSpaceRegex) {
return RegExp(urlSpaceRegex);
}
});
</script>

View file

@ -0,0 +1,83 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<script>
'use strict';
Polymer({
is: 'iron-query-params',
properties: {
paramsString: {
type: String,
notify: true,
observer: 'paramsStringChanged',
},
paramsObject: {
type: Object,
notify: true,
value: function() {
return {};
}
},
_dontReact: {
type: Boolean,
value: false
}
},
hostAttributes: {
hidden: true
},
observers: [
'paramsObjectChanged(paramsObject.*)'
],
paramsStringChanged: function() {
this._dontReact = true;
this.paramsObject = this._decodeParams(this.paramsString);
this._dontReact = false;
},
paramsObjectChanged: function() {
if (this._dontReact) {
return;
}
this.paramsString = this._encodeParams(this.paramsObject);
},
_encodeParams: function(params) {
var encodedParams = [];
for (var key in params) {
var value = params[key];
if (value === '') {
encodedParams.push(encodeURIComponent(key));
} else if (value) {
encodedParams.push(
encodeURIComponent(key) +
'=' +
encodeURIComponent(value.toString())
);
}
}
return encodedParams.join('&');
},
_decodeParams: function(paramString) {
var params = {};
var paramList = (paramString || '').split('&');
for (var i = 0; i < paramList.length; i++) {
var param = paramList[i].split('=');
if (param[0]) {
params[decodeURIComponent(param[0])] =
decodeURIComponent(param[1] || '');
}
}
return params;
}
});
</script>

View file

@ -0,0 +1,26 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'iron-location.html',
'iron-query-params.html',
'initialization-tests.html'
]);
</script>
</body>
</html>

View file

@ -0,0 +1,277 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel='import' href='../iron-location.html'>
<link rel='import' href='../../polymer/polymer.html'>
<script>
Polymer({
is: 'default-value',
properties: {
val: {
type: String,
notify: true,
value: 'default-value'
}
},
});
Polymer({
is: 'on-attached',
properties: {
val: {
type: String,
notify: true,
value: 'on-attached-default-value'
}
},
attached: function() {
if (this.val === 'on-attached-default-value') {
this.val = 'on-attached';
}
}
});
Polymer({
is: 'on-ready',
properties: {
val: {
type: String,
notify: true,
value: 'on-ready-default-value'
}
},
ready: function() {
this.val = 'on-ready';
}
});
Polymer({
is: 'on-timeout',
properties: {
val: {
type: String,
notify: true,
value: 'on-timeout-default-value'
}
},
attached: function() {
setTimeout(function() {
this.val = 'on-timeout';
}.bind(this), 10);
}
})
</script>
<dom-module id='default-before'>
<template>
<default-value value='{{val}}'></default-value>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'default-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-before'>
<template>
<on-attached val='{{val}}'></on-attached>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'attached-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-before'>
<template>
<on-ready val='{{val}}'></on-ready>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'ready-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-before'>
<template>
<on-timeout val='{{val}}'></on-timeout>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'timeout-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<default-value value='{{val}}'></default-value>
</template>
<script>Polymer({is: 'default-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-attached val='{{val}}'></on-attached>
</template>
<script>Polymer({is: 'attached-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-ready val='{{val}}'></on-ready>
</template>
<script>Polymer({is: 'ready-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-timeout val='{{val}}'></on-timeout>
</template>
<script>Polymer({is: 'timeout-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-below'>
<template>
<iron-location query='{{val}}'>
<default-value value='{{val}}'></default-value>
</iron-location>
</template>
<script>Polymer({is: 'default-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-below'>
<template>
<iron-location query='{{val}}'>
<on-attached val='{{val}}'></on-attached>
</iron-location>
</template>
<script>Polymer({is: 'attached-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-below'>
<template>
<iron-location query='{{val}}'>
<on-ready val='{{val}}'></on-ready>
</iron-location>
</template>
<script>Polymer({is: 'ready-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-below'>
<template>
<iron-location query='{{val}}'>
<on-timeout val='{{val}}'></on-timeout>
</iron-location>
</template>
<script>Polymer({is: 'timeout-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-above'>
<template>
<default-value value='{{val}}'>
<iron-location query='{{val}}'></iron-location>
</default-value>
</template>
<script>Polymer({is: 'default-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-above'>
<template>
<on-attached val='{{val}}'>
<iron-location query='{{val}}'>
</iron-location>
</on-attached>
</template>
<script>Polymer({is: 'attached-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-above'>
<template>
<on-ready val='{{val}}'>
<iron-location query='{{val}}'>
</iron-location>
</on-ready>
</template>
<script>Polymer({is: 'ready-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-above'>
<template>
<on-timeout val='{{val}}'>
<iron-location query='{{val}}'></iron-location>
</on-timeout>
</template>
<script>Polymer({is: 'timeout-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'default-container',
properties: {val: {type: String, value: 'default-container-val'}}
});
</script>
</dom-module>
<dom-module id='attached-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'attached-container',
properties: {val: {type: String, value: 'container-attached-default-val'}},
attached: function() {
if (this.val === 'container-attached-default-val') {
this.val = 'attached-container-val';
}
}
});
</script>
</dom-module>
<dom-module id='ready-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'ready-container', properties: {val: {type: String}},
ready: function() {
this.val = 'ready-container-val';
}
});
</script>
</dom-module>
<dom-module id='timeout-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({
is: 'timeout-container',
properties: {
val: {
type: String,
notify: true
}
},
attached: function() {
setTimeout(function() {
this.val = 'on-timeout';
}.bind(this), 10);
}
});</script>
</dom-module>

View file

@ -0,0 +1,61 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Base source for injecting into an iframe for tests</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<link rel='import' href='./initialization-cases.html'>
</head>
<body>
<script>
window.addEventListener("message", messageReceived, false);
window.addEventListener('WebComponentsReady', function() {
window.parent.postMessage({
'type': 'ready'
}, '*');
});
var appendBodyReceived = false;
function messageReceived(msg) {
if (!msg.data) {
console.error('got invalid msg?');
}
// the parent can (at any time) ask for our URL.
if (msg.data.type === 'urlQuery') {
msg.source.postMessage({
'type': 'urlQueryResponse',
'href': window.location.href,
'pathname': window.location.pathname,
'hash': window.location.hash,
'search': window.location.search
}, '*');
} else if (msg.data.type === 'appendBody') {
if (appendBodyReceived) {
throw new Error('should only receive at most one appendBody call');
}
var element = document.createElement(msg.data.tagName);
document.body.appendChild(element);
appendBodyReceived = true;
}
}
window.addEventListener('error', function(e) {
window.parent.postMessage({
'type': 'error',
'error': e.message
}, '*');
});
</script>
</body>
</html>

View file

@ -0,0 +1,145 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-location.html">
</head>
<body>
<script>
'use strict';
function getIframe() {
return new Promise(function(resolve, reject) {
var iframe = document.createElement('iframe');
var result = getMessageMatching(iframe, function(message) {
return message.type === 'ready';
});
iframe.src = './initialization-iframe.html';
document.body.appendChild(iframe);
iframe.addEventListener('error', reject);
result.then(function() {resolve(iframe)}, reject);
});
}
function onMessage(iframe, callback) {
var f = function(event) {
if (event.source === iframe.contentWindow) {
callback(event.data);
}
};
window.addEventListener('message', f, false);
return function() {
window.removeEventListener('message', f);
}
}
function getMessageMatching(iframe, predicate) {
var revoke = function() {};
var result = new Promise(function(resolve, reject) {
revoke = onMessage(iframe, function(message) {
if (predicate(message)) {
resolve(message);
}
});
});
result.then(revoke, revoke);
return result;
}
function getUrl(iframe) {
var result = getMessageMatching(iframe, function(message) {
return message.type === 'urlQueryResponse';
})
var revoke = function() {};
var result = new Promise(function(resolve, reject) {
revoke = onMessage(iframe, resolve);
});
result.then(revoke, revoke);
iframe.contentWindow.postMessage({type: 'urlQuery'}, '*');
return result;
}
function timePasses(ms) {
return new Promise(function(resolve) {
window.setTimeout(function() {
resolve();
}, ms);
});
}
suite('<iron-location>\'s initialization', function() {
var iframe;
var error;
setup(function() {
return getIframe().then(function(i) {
iframe = i;
function isError(m) {return m.type === 'error'}
getMessageMatching(iframe, isError).then(function(m) {
error = m.error;
});
});
});
teardown(function() {
if (iframe) {
document.body.removeChild(iframe);
}
var e = error;
iframe = null;
error = null;
if (e) {
throw new Error('Error message from contained iframe: ' + e);
}
});
var cases = [
'default-before', 'attached-before', 'ready-before',
'default-after', 'attached-after', 'ready-after',
'default-below', 'attached-below', 'ready-below',
'default-above', 'attached-above', 'ready-above',
'default-container', 'attached-container', 'ready-container'
];
cases.forEach(function(caseName) {
test('the url takes priority in ' + caseName + ' initialization', function() {
return getUrl(iframe).then(function(url) {
expect(url.search).to.be.eq('');
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
return timePasses(10).then(function() {return getUrl(iframe)});
}).then(function(url) {
expect(url.search).to.be.eq('');
});
});
});
var expectedFailureCases = ['timeout-before', 'timeout-after', 'timeout-below', 'timeout-above', 'timeout-container'];
expectedFailureCases.forEach(function(caseName) {
test('the url does not take priority in ' + caseName + ' initialization', function() {
return getUrl(iframe).then(function(url) {
expect(url.search).to.be.eq('');
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
return timePasses(60).then(function() {return getUrl(iframe)});
}).then(function(url) {
expect(url.search).to.be.eq('?on-timeout');
});
});
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,369 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../iron-location.html">
<link rel="import" href="./redirection.html">
</head>
<body>
<test-fixture id='Solo'>
<template>
<iron-location></iron-location>
</template>
</test-fixture>
<test-fixture id='Together'>
<template>
<div>
<iron-location id='one'></iron-location>
<iron-location id='two'></iron-location>
</div>
</template>
</test-fixture>
<test-fixture id='RedirectHash'>
<template>
<redirect-hash></redirect-hash>
</template>
</test-fixture>
<test-fixture id='RedirectPath'>
<template>
<redirect-path></redirect-path>
</template>
</test-fixture>
<test-fixture id='RedirectQuery'>
<template>
<redirect-query></redirect-query>
</template>
</test-fixture>
<script>
'use strict';
function timePasses(ms) {
return new Promise(function(resolve) {
window.setTimeout(function() {
resolve();
}, ms);
});
}
function makeAbsoluteUrl(path) {
return window.location.protocol + '//' + window.location.host + path;
}
// A window.history.replaceState wrapper that's smart about baseURI.
function replaceState(path) {
window.history.replaceState({}, '', makeAbsoluteUrl(path));
}
/**
* We run the iron location tests with a couple different page configurations
* (e.g. with and withoug a base URI), so we define the test set as a function
* that we call in each of these configurations.
*/
function ironLocationTests() {
suite('when used solo', function() {
var urlElem;
setup(function() {
urlElem = fixture('Solo');
});
test('basic functionality with #hash urls', function() {
// Initialized to the window location's hash.
expect(window.location.hash).to.be.equal(urlElem.hash);
// Changing the urlElem's hash changes the URL
urlElem.hash = '/lol/ok';
expect(window.location.hash).to.be.equal('#/lol/ok');
// Changing the hash via normal means changes the urlElem.
var anchor = document.createElement('a');
var base =
window.location.protocol + '//' + window.location.host +
window.location.pathname;
anchor.href = base + '#/wat';
document.body.appendChild(anchor);
anchor.click();
// In IE10 it appears that the hashchange event is asynchronous.
return timePasses(10).then(function() {
expect(urlElem.hash).to.be.equal('/wat');
});
});
test('basic functionality with paths', function() {
// Initialized to the window location's path.
expect(window.location.pathname).to.be.equal(urlElem.path);
// Changing the urlElem's path changes the URL
urlElem.path = '/foo/bar';
expect(window.location.pathname).to.be.equal('/foo/bar');
// Changing the path and sending a custom event on the window changes
// the urlElem.
replaceState('/baz');
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.path).to.be.equal('/baz');
});
test('assigning to a relative path URL', function() {
urlElem.path = '/foo/bar';
expect(window.location.pathname).to.be.equal('/foo/bar');
// A relative path is treated as an absolute one, just with a
// missing leading slash.
urlElem.path = 'baz';
expect(window.location.pathname).to.be.equal('/baz');
});
test('basic functionality with ?key=value params', function() {
// Initialized to the window location's params.
expect(urlElem.query).to.be.eq('');
// Changing location.search and sending a custom event on the window
// changes the urlElem.
replaceState('/?greeting=hello&target=world');
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.query).to.be.equal('greeting=hello&target=world');
// Changing the urlElem's query changes the URL.
urlElem.query = 'greeting=hello&target=world&another=key';
expect(window.location.search).to.be.equal(
'?greeting=hello&target=world&another=key');
});
});
suite('does not spam the user\'s history', function() {
var replaceStateCalls, pushStateCalls;
var nativeReplaceState, nativePushState;
setup(function() {
replaceStateCalls = pushStateCalls = 0;
nativeReplaceState = window.history.replaceState;
nativePushState = window.history.pushState;
window.history.replaceState = function() {
replaceStateCalls++;
};
window.history.pushState = function() {
pushStateCalls++;
};
});
teardown(function() {
window.history.replaceState = nativeReplaceState;
window.history.pushState = nativePushState;
});
test('when a change happens immediately after ' +
'the iron-location is attached', function() {
var ironLocation = fixture('Solo');
expect(pushStateCalls).to.be.equal(0);
expect(replaceStateCalls).to.be.equal(0);
ironLocation.path = '/foo';
expect(replaceStateCalls).to.be.equal(1);
expect(pushStateCalls).to.be.equal(0);
});
suite('when intercepting links', function() {
/**
* Clicks the given link while an iron-location element with the given
* urlSpaceRegex is in the same document. Returns whether the
* iron-location prevented the default behavior of the click.
*
* No matter what, it prevents the default behavior of the click itself
* to ensure that no navigation occurs (as that would interrupt
* running and reporting these tests!)
*/
function isClickCaptured(anchor, urlSpaceRegex) {
var defaultWasPrevented;
function handler(event) {
expect(event.target).to.be.eq(anchor);
defaultWasPrevented = event.defaultPrevented;
event.preventDefault();
expect(event.defaultPrevented).to.be.eq(true);
}
window.addEventListener('click', handler);
var ironLocation = fixture('Solo');
if (urlSpaceRegex != null) {
ironLocation.urlSpaceRegex = urlSpaceRegex;
}
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
window.removeEventListener('click', handler);
return defaultWasPrevented;
}
test('simple link to / is intercepted', function() {
var anchor = document.createElement('a');
if (document.baseURI !== window.location.href) {
anchor.href = makeAbsoluteUrl('/');
} else {
anchor.href = '/';
}
expect(isClickCaptured(anchor)).to.be.eq(true);
expect(pushStateCalls).to.be.equal(1);
});
test('link that matches url space is intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/foo');
expect(isClickCaptured(anchor, '/fo+')).to.be.eq(true);
expect(pushStateCalls).to.be.equal(1);
});
test('link that doesn\'t match url space isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/bar');
expect(isClickCaptured(anchor, '/fo+')).to.be.eq(false);
expect(pushStateCalls).to.be.equal(0);
});
test('link to another domain isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = 'http://example.com/';
expect(isClickCaptured(anchor)).to.be.eq(false);
expect(pushStateCalls).to.be.equal(0);
});
test('a link with target=_blank isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/');
anchor.target = '_blank';
expect(isClickCaptured(anchor)).to.be.eq(false);
expect(pushStateCalls).to.be.equal(0);
});
test('a link with an href to the ' +
'current page shouldn\'t add to history.', function() {
var anchor = document.createElement('a');
anchor.href = window.location.href;
// The click is captured, but it doesn't add to history.
expect(isClickCaptured(anchor)).to.be.equal(true);
expect(pushStateCalls).to.be.equal(0);
});
test('a click that has already been defaultPrevented ' +
'shouldn\'t result in a navigation', function() {
fixture('Solo');
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/');
anchor.addEventListener('click', function(event) {
event.preventDefault();
});
document.body.appendChild(anchor);
var originalPushState = window.history.pushState;
var count = 0;
window.history.pushState = function() {
count++;
}
anchor.click();
window.history.pushState = originalPushState;
expect(count).to.be.equal(0);
})
});
});
suite('when used with other iron-location elements', function() {
var otherUrlElem;
var urlElem;
setup(function() {
var elems = fixture('Together');
urlElem = elems.querySelector('#one');
otherUrlElem = elems.querySelector('#two');
});
function assertHaveSameUrls(urlElemOne, urlElemTwo) {
expect(urlElemOne.path).to.be.equal(urlElemTwo.path);
expect(urlElemOne.hash).to.be.equal(urlElemTwo.hash);
expect(urlElemOne.query).to.be.equal(urlElemTwo.query);
}
test('coordinate their changes (by firing events on window)', function() {
assertHaveSameUrls(urlElem, otherUrlElem);
urlElem.path = '/a/b/c';
assertHaveSameUrls(urlElem, otherUrlElem);
otherUrlElem.query = 'alsdkjflaksjfd=alksjfdlkajsdfl';
assertHaveSameUrls(urlElem, otherUrlElem);
urlElem.hash = 'lkjljifosjkldfjlksjfldsjf';
assertHaveSameUrls(urlElem, otherUrlElem);
});
});
suite('supports doing synchronous redirection', function() {
test('of the hash portion of the URL', function() {
expect(window.location.hash).to.be.equal('');
var redirector = fixture('RedirectHash');
expect(window.location.hash).to.be.equal('#redirectedTo');
expect(redirector.hash).to.be.equal('redirectedTo');
redirector.hash = 'newHash';
expect(window.location.hash).to.be.equal('#redirectedTo');
expect(redirector.hash).to.be.equal('redirectedTo');
});
test('of the path portion of the URL', function() {
expect(window.location.pathname).to.not.be.equal('/redirectedTo');
var redirector = fixture('RedirectPath');
expect(window.location.pathname).to.be.equal('/redirectedTo');
expect(redirector.path).to.be.equal('/redirectedTo');
redirector.path = '/newPath';
expect(window.location.pathname).to.be.equal('/redirectedTo');
expect(redirector.path).to.be.equal('/redirectedTo');
});
test('of the query portion of the URL', function() {
expect(window.location.search).to.be.equal('');
var redirector = fixture('RedirectQuery');
expect(window.location.search).to.be.equal('?redirectedTo');
expect(redirector.query).to.be.equal('redirectedTo');
redirector.query = 'newQuery';
expect(window.location.search).to.be.equal('?redirectedTo');
expect(redirector.query).to.be.equal('redirectedTo');
});
});
}
suite('<iron-location>', function () {
var initialUrl;
setup(function() {
initialUrl = window.location.href;
});
teardown(function(){
window.history.replaceState({}, '', initialUrl);
});
ironLocationTests();
suite('with a base URI', function() {
var baseElem;
setup(function() {
expect(document.baseURI).to.be.equal(window.location.href);
baseElem = document.createElement('base');
var href = 'https://example.com/i/dont/exist/obviously'
baseElem.href = href;
document.head.appendChild(baseElem);
expect(document.baseURI).to.be.equal(href);
});
teardown(function() {
document.head.removeChild(baseElem);
});
ironLocationTests();
});
});
</script>
</body>

View file

@ -0,0 +1,96 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../iron-query-params.html">
</head>
<body>
<test-fixture id="BasicQueryParams">
<template>
<iron-query-params></iron-query-params>
</template>
</test-fixture>
<script>
'use strict';
suite('<iron-query-params>', function () {
var paramsElem;
setup(function() {
paramsElem = fixture('BasicQueryParams');
});
test('basic functionality with ?key=value params', function() {
// Check initialization
expect(paramsElem.paramsString).to.be.eq('');
expect(paramsElem.paramsObject).to.deep.eq({});
// Check the mapping from paramsString to paramsObject.
paramsElem.paramsString = 'greeting=hello&target=world';
expect(paramsElem.paramsObject).to.deep.equal(
{greeting: 'hello', target: 'world'});
// Check the mapping from paramsObject back to paramsString.
paramsElem.set('paramsObject.another', 'key');
expect(paramsElem.paramsString).to.be.equal(
'greeting=hello&target=world&another=key');
});
test('encoding of params', function() {
var mappings = [
{
string: 'a=b',
object: {'a': 'b'}
},
{
string: 'debug&ok',
object: {'debug': '', 'ok': ''}
},
{
string: 'monster%20kid%3A=%F0%9F%98%BF',
object: {'monster kid:': '😿'}
},
{
string: 'yes%2C%20ok%3F%20what%20is%20up%20with%20%CB%9Athiiis%CB%9A=%E2%98%83',
object: {'yes, ok? what is up with ˚thiiis˚': '☃'}
},
];
mappings.forEach(function(mapping) {
// Clear
paramsElem.paramsObject = {};
expect(paramsElem.paramsString).to.be.equal('');
// Test going from string to object
paramsElem.paramsString = mapping.string;
expect(paramsElem.paramsObject).to.deep.equal(mapping.object);
// Clear again.
paramsElem.paramsObject = {};
expect(paramsElem.paramsString).to.be.equal('');
// Test going from object to string
paramsElem.paramsObject = mapping.object;
expect(paramsElem.paramsString).to.be.equal(mapping.string);
});
});
});
</script>
</body>

View file

@ -0,0 +1,68 @@
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<dom-module id='redirect-hash'>
<template>
<iron-location hash='{{hash}}'></iron-location>
</template>
<script>
Polymer({
is: 'redirect-hash',
properties: {
hash: {
value: '',
observer: 'hashChanged'
}
},
hashChanged: function(hash) {
this.hash = 'redirectedTo';
}
});
</script>
</dom-module>
<dom-module id='redirect-path'>
<template>
<iron-location path='{{path}}'></iron-location>
</template>
<script>
Polymer({
is: 'redirect-path',
properties: {
path: {
value: '',
observer: 'pathChanged'
}
},
pathChanged: function(path) {
this.path = '/redirectedTo';
}
});
</script>
</dom-module>
<dom-module id='redirect-query'>
<template>
<iron-location query='{{query}}'></iron-location>
</template>
<script>
Polymer({
is: 'redirect-query',
properties: {
query: {
value: '',
observer: 'queryChanged'
}
},
queryChanged: function(query) {
this.query = 'redirectedTo';
}
});
</script>
</dom-module>

View file

@ -1,4 +1,4 @@
define(['browser', 'datetime', 'libraryBrowser'], function (browser, datetime, libraryBrowser) { define(['browser', 'datetime', 'libraryBrowser', 'listView'], function (browser, datetime, libraryBrowser, listView) {
function showSlideshowMenu(context) { function showSlideshowMenu(context) {
require(['scripts/slideshow'], function () { require(['scripts/slideshow'], function () {
@ -403,7 +403,7 @@
//}).then(function (result) { //}).then(function (result) {
// html += LibraryBrowser.getListViewHtml({ // html += listView.getListViewHtml({
// items: result.Items, // items: result.Items,
// smallIcon: true // smallIcon: true
// }); // });
@ -411,7 +411,7 @@
// page(".playlist").html(html).lazyChildren(); // page(".playlist").html(html).lazyChildren();
//}); //});
html += libraryBrowser.getListViewHtml({ html += listView.getListViewHtml({
items: MediaController.playlist(), items: MediaController.playlist(),
smallIcon: true smallIcon: true
}); });

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'jQuery'], function (events, libraryBrowser, imageLoader, $) { define(['events', 'libraryBrowser', 'imageLoader', 'listView'], function (events, libraryBrowser, imageLoader, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -76,7 +76,7 @@
if (viewStyle == "List") { if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
sortBy: query.SortBy sortBy: query.SortBy
}); });
@ -107,17 +107,31 @@
}); });
} }
$('.paging', tabContent).html(pagingHtml); var i, length;
var elems = tabContent.querySelectorAll('.paging');
for (i = 0, length = elems.length; i < length; i++) {
elems[i].innerHTML = pagingHtml;
}
$('.btnNextPage', tabContent).on('click', function () { function onNextPageClick() {
query.StartIndex += query.Limit; query.StartIndex += query.Limit;
reloadItems(tabContent); reloadItems(tabContent);
}); }
$('.btnPreviousPage', tabContent).on('click', function () { function onPreviousPageClick() {
query.StartIndex -= query.Limit; query.StartIndex -= query.Limit;
reloadItems(tabContent); reloadItems(tabContent);
}); }
elems = tabContent.querySelectorAll('.btnNextPage');
for (i = 0, length = elems.length; i < length; i++) {
elems[i].addEventListener('click', onNextPageClick);
}
elems = tabContent.querySelectorAll('.btnPreviousPage');
for (i = 0, length = elems.length; i < length; i++) {
elems[i].addEventListener('click', onPreviousPageClick);
}
var itemsContainer = tabContent.querySelector('.itemsContainer'); var itemsContainer = tabContent.querySelector('.itemsContainer');
itemsContainer.innerHTML = html; itemsContainer.innerHTML = html;

View file

@ -1,4 +1,4 @@
define(['jQuery'], function ($) { define(['jQuery', 'listView'], function ($, listView) {
var data = {}; var data = {};
@ -66,7 +66,7 @@ define(['jQuery'], function ($) {
if (view == "List") { if (view == "List") {
html = LibraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'games', context: 'games',
sortBy: query.SortBy sortBy: query.SortBy

View file

@ -1,4 +1,4 @@
define([], function () { define(['listView'], function (listView) {
function renderItems(page, item) { function renderItems(page, item) {
@ -218,7 +218,7 @@
Limit: 30 Limit: 30
}, { }, {
playFromHere: true, playFromHere: true,
defaultAction: 'playallfromhere', action: 'playallfromhere',
smallIcon: true smallIcon: true
}); });
break; break;
@ -248,7 +248,7 @@
listOptions.items = result.Items; listOptions.items = result.Items;
if (type == 'Audio') { if (type == 'Audio') {
html = LibraryBrowser.getListViewHtml(listOptions); html = listView.getListViewHtml(listOptions);
} else { } else {
html = LibraryBrowser.getPosterViewHtml(listOptions); html = LibraryBrowser.getPosterViewHtml(listOptions);
} }

View file

@ -1,4 +1,4 @@
define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'scrollStyles'], function (layoutManager, datetime, mediaInfo, backdrop) { define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'scrollStyles'], function (layoutManager, datetime, mediaInfo, backdrop, listView) {
var currentItem; var currentItem;
@ -931,14 +931,14 @@
if (item.Type == "MusicAlbum") { if (item.Type == "MusicAlbum") {
html = LibraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
smallIcon: true, smallIcon: true,
showIndex: true, showIndex: true,
index: 'disc', index: 'disc',
showIndexNumber: true, showIndexNumber: true,
playFromHere: true, playFromHere: true,
defaultAction: 'playallfromhere', action: 'playallfromhere',
lazy: true lazy: true
}); });
@ -1315,9 +1315,9 @@
page.querySelector('#themeSongsCollapsible').classList.remove('hide'); page.querySelector('#themeSongsCollapsible').classList.remove('hide');
var html = LibraryBrowser.getListViewHtml({ var html = listView.getListViewHtml({
items: items, items: result.Items,
smallIcon: true sortBy: query.SortBy
}); });
page.querySelector('#themeSongsContent').innerHTML = html; page.querySelector('#themeSongsContent').innerHTML = html;

View file

@ -1,4 +1,4 @@
define(['libraryBrowser', 'alphaPicker'], function (libraryBrowser, alphaPicker) { define(['libraryBrowser', 'alphaPicker', 'listView'], function (libraryBrowser, alphaPicker, listView) {
return function (view, params) { return function (view, params) {
@ -114,7 +114,7 @@
} }
else if (viewStyle == "List") { else if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
sortBy: query.SortBy sortBy: query.SortBy
}); });

View file

@ -1192,75 +1192,6 @@
}, },
getListViewIndex: function (item, options) {
if (options.index == 'disc') {
return item.ParentIndexNumber == null ? '' : Globalize.translate('ValueDiscNumber', item.ParentIndexNumber);
}
var sortBy = (options.sortBy || '').toLowerCase();
var code, name;
if (sortBy.indexOf('sortname') == 0) {
if (item.Type == 'Episode') return '';
// SortName
name = (item.SortName || item.Name || '?')[0].toUpperCase();
code = name.charCodeAt(0);
if (code < 65 || code > 90) {
return '#';
}
return name.toUpperCase();
}
if (sortBy.indexOf('officialrating') == 0) {
return item.OfficialRating || Globalize.translate('HeaderUnrated');
}
if (sortBy.indexOf('communityrating') == 0) {
if (item.CommunityRating == null) {
return Globalize.translate('HeaderUnrated');
}
return Math.floor(item.CommunityRating);
}
if (sortBy.indexOf('criticrating') == 0) {
if (item.CriticRating == null) {
return Globalize.translate('HeaderUnrated');
}
return Math.floor(item.CriticRating);
}
if (sortBy.indexOf('metascore') == 0) {
if (item.Metascore == null) {
return Globalize.translate('HeaderUnrated');
}
return Math.floor(item.Metascore);
}
if (sortBy.indexOf('albumartist') == 0) {
// SortName
if (!item.AlbumArtist) return '';
name = item.AlbumArtist[0].toUpperCase();
code = name.charCodeAt(0);
if (code < 65 || code > 90) {
return '#';
}
return name.toUpperCase();
}
return '';
},
getUserDataCssClass: function (key) { getUserDataCssClass: function (key) {
if (!key) return ''; if (!key) return '';
@ -1268,208 +1199,6 @@
return 'libraryItemUserData' + key.replace(new RegExp(' ', 'g'), ''); return 'libraryItemUserData' + key.replace(new RegExp(' ', 'g'), '');
}, },
getListViewHtml: function (options) {
require(['listViewStyle', 'material-icons']);
var outerHtml = "";
if (options.title) {
outerHtml += '<h1>';
outerHtml += options.title;
outerHtml += '</h1>';
}
outerHtml += '<div class="paperList itemsListview">';
var index = 0;
var groupTitle = '';
outerHtml += options.items.map(function (item) {
var html = '';
if (options.showIndex !== false) {
var itemGroupTitle = LibraryBrowser.getListViewIndex(item, options);
if (itemGroupTitle != groupTitle) {
outerHtml += '</div>';
if (index == 0) {
html += '<h1>';
}
else {
html += '<h1 style="margin-top:2em;">';
}
html += itemGroupTitle;
html += '</h1>';
html += '<div class="paperList itemsListview">';
groupTitle = itemGroupTitle;
}
}
var dataAttributes = LibraryBrowser.getItemDataAttributes(item, options, index);
var cssClass = 'listItem';
var href = LibraryBrowser.getHref(item, options.context);
html += '<div class="' + cssClass + '"' + dataAttributes + ' data-itemid="' + item.Id + '" data-playlistitemid="' + (item.PlaylistItemId || '') + '" data-href="' + href + '" data-icon="false">';
var imgUrl;
var downloadWidth = options.smallIcon ? 70 : 80;
// Scaling 400w episode images to 80 doesn't turn out very well
var minScale = item.Type == 'Episode' || item.Type == 'Game' || options.smallIcon ? 2 : 1.5;
if (item.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxWidth: downloadWidth,
tag: item.ImageTags.Primary,
type: "Primary",
index: 0,
minScale: minScale
});
}
else if (item.AlbumId && item.AlbumPrimaryImageTag) {
imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary",
maxWidth: downloadWidth,
tag: item.AlbumPrimaryImageTag,
minScale: minScale
});
}
else if (item.SeriesId && item.SeriesPrimaryImageTag) {
imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, {
type: "Primary",
maxWidth: downloadWidth,
tag: item.SeriesPrimaryImageTag,
minScale: minScale
});
}
else if (item.ParentPrimaryImageTag) {
imgUrl = ApiClient.getScaledImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary",
maxWidth: downloadWidth,
tag: item.ParentPrimaryImageTag,
minScale: minScale
});
}
if (imgUrl) {
if (options.smallIcon) {
html += '<div class="listItemImage lazy small" data-src="' + imgUrl + '" item-icon></div>';
} else {
html += '<div class="listItemImage lazy" data-src="' + imgUrl + '" item-icon></div>';
}
} else {
if (options.smallIcon) {
html += '<div class="listItemImage small" item-icon></div>';
} else {
html += '<div class="listItemImage" item-icon></div>';
}
}
var textlines = [];
if (item.Type == 'Episode') {
textlines.push(item.SeriesName || '&nbsp;');
} else if (item.Type == 'MusicAlbum') {
textlines.push(item.AlbumArtist || '&nbsp;');
}
var displayName = itemHelper.getDisplayName(item);
if (options.showIndexNumber && item.IndexNumber != null) {
displayName = item.IndexNumber + ". " + displayName;
}
textlines.push(displayName);
if (item.Type == 'Audio') {
textlines.push(item.ArtistItems.map(function (a) {
return a.Name;
}).join(', ') || '&nbsp;');
}
if (item.Type == 'Game') {
textlines.push(item.GameSystem || '&nbsp;');
}
else if (item.Type == 'MusicGenre') {
textlines.push('&nbsp;');
}
else if (item.Type == 'MusicArtist') {
textlines.push('&nbsp;');
}
else if (item.Type == 'TvChannel') {
if (item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
}
}
else {
textlines.push('<div class="itemMiscInfo">' + mediaInfo.getPrimaryMediaInfoHtml(item, {
endsAt: false
}) + '</div>');
}
var defaultAction = options.defaultAction;
if (defaultAction == 'play' || defaultAction == 'playallfromhere') {
if (item.PlayAccess != 'Full') {
defaultAction = null;
}
}
var bodyCssClass = 'mediaItem clearLink listItemBody';
if (textlines.length > 2) {
bodyCssClass += ' three-line';
} else {
bodyCssClass += ' two-line';
}
var defaultActionAttribute = defaultAction ? (' data-action="' + defaultAction + '" class="itemWithAction ' + bodyCssClass + '"') : ' class="' + bodyCssClass + '"';
html += '<a' + defaultActionAttribute + ' href="' + href + '">';
for (var i = 0, textLinesLength = textlines.length; i < textLinesLength; i++) {
if (i == 0) {
html += '<div>';
} else {
html += '<div class="secondary">';
}
html += textlines[i] || '&nbsp;';
html += '</div>';
}
html += '</a>';
html += '<button is="paper-icon-button-light" class="listviewMenuButton autoSize"><i class="md-icon">' + AppInfo.moreIcon.replace('-', '_') + '</i></button>';
html += '<span class="listViewUserDataButtons">';
html += LibraryBrowser.getUserDataIconsHtml(item);
html += '</span>';
html += '</div>';
index++;
return html;
}).join('');
outerHtml += '</div>';
return outerHtml;
},
getItemDataAttributesList: function (item, options, index) { getItemDataAttributesList: function (item, options, index) {
var atts = []; var atts = [];

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -108,7 +108,7 @@
} }
else if (viewStyle == "List") { else if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'movies', context: 'movies',
sortBy: query.SortBy sortBy: query.SortBy

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -109,7 +109,7 @@
} }
else if (viewStyle == "List") { else if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'movies', context: 'movies',
sortBy: query.SortBy sortBy: query.SortBy

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -108,7 +108,7 @@
} }
else if (viewStyle == "List") { else if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'movies', context: 'movies',
sortBy: query.SortBy sortBy: query.SortBy

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -75,7 +75,7 @@
if (viewStyle == "List") { if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'music', context: 'music',
sortBy: query.SortBy sortBy: query.SortBy

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -77,9 +77,8 @@
if (viewStyle == "List") { if (viewStyle == "List") {
html = LibraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'music',
sortBy: query.SortBy sortBy: query.SortBy
}); });
} }

View file

@ -1,4 +1,4 @@
define(['appStorage', 'jQuery'], function (appStorage, $) { define(['appStorage', 'jQuery', 'listView'], function (appStorage, $, listView) {
var data = {}; var data = {};
function getPageData() { function getPageData() {
@ -60,15 +60,14 @@
if (view == "List") { if (view == "List") {
html = LibraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
sortBy: query.SortBy, sortBy: query.SortBy,
showIndex: false, showIndex: false,
showRemoveFromPlaylist: true, showRemoveFromPlaylist: true,
playFromHere: true, playFromHere: true,
defaultAction: 'playallfromhere', action: 'playallfromhere',
smallIcon: true smallIcon: true
}); });
} }

View file

@ -1,4 +1,4 @@
define([], function () { define(['listView'], function (listView) {
var data = {}; var data = {};
function getPageData() { function getPageData() {
@ -80,7 +80,7 @@
if (view == "List") { if (view == "List") {
html = LibraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
sortBy: query.SortBy sortBy: query.SortBy
}); });

View file

@ -1,4 +1,4 @@
define(['libraryBrowser'], function (libraryBrowser) { define(['libraryBrowser', 'listView'], function (libraryBrowser, listView) {
return function (view, params) { return function (view, params) {
@ -127,10 +127,10 @@
if (query.IncludeItemTypes == "Audio") { if (query.IncludeItemTypes == "Audio") {
html = '<div style="max-width:1000px;margin:auto;">' + libraryBrowser.getListViewHtml({ html = '<div style="max-width:1000px;margin:auto;">' + listView.getListViewHtml({
items: result.Items, items: result.Items,
playFromHere: true, playFromHere: true,
defaultAction: 'playallfromhere', action: 'playallfromhere',
smallIcon: true smallIcon: true
}) + '</div>'; }) + '</div>';

View file

@ -1934,8 +1934,10 @@ var AppInfo = {};
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']); define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
define("fingerprintjs2", [bowerPath + '/fingerprintjs2/fingerprint2'], returnFirstDependency); define("fingerprintjs2", [bowerPath + '/fingerprintjs2/fingerprint2'], returnFirstDependency);
define("clearButtonStyle", ['css!' + embyWebComponentsBowerPath + '/clearbutton']); define("clearButtonStyle", ['css!' + embyWebComponentsBowerPath + '/clearbutton']);
define("userdataButtons", [embyWebComponentsBowerPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency);
define("listView", [embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency); define("listView", [embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency);
define("listViewStyle", ['css!' + embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency); define("listViewStyle", ['css!' + embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency);
define("indicators", [embyWebComponentsBowerPath + "/indicators/indicators"], returnFirstDependency);
if ('registerElement' in document && 'content' in document.createElement('template')) { if ('registerElement' in document && 'content' in document.createElement('template')) {
define('webcomponentsjs', []); define('webcomponentsjs', []);

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader'], function (events, libraryBrowser, imageLoader) { define(['events', 'libraryBrowser', 'imageLoader', 'listView'], function (events, libraryBrowser, imageLoader, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -68,10 +68,9 @@
filterButton: false filterButton: false
}); });
var html = LibraryBrowser.getListViewHtml({ var html = listView.getListViewHtml({
items: result.Items, items: result.Items,
showIndex: true, action: 'playallfromhere',
defaultAction: 'play',
smallIcon: true smallIcon: true
}); });

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker'], function (events, libraryBrowser, imageLoader, alphaPicker) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -109,7 +109,7 @@
} }
else if (viewStyle == "List") { else if (viewStyle == "List") {
html = libraryBrowser.getListViewHtml({ html = listView.getListViewHtml({
items: result.Items, items: result.Items,
context: 'tv', context: 'tv',
sortBy: query.SortBy sortBy: query.SortBy