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

Merge pull request #1455 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-02-14 16:15:23 -05:00
commit 0266db07b3
20 changed files with 378 additions and 1550 deletions

View file

@ -12,7 +12,6 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabActivityLog}</a>
<a href="autoorganizetv.html" data-role="button">${TabTV}</a>
<a href="autoorganizesmart.html" data-role="button">${TabSmartMatches}</a>
</div>
<div style="margin: -25px 0 1em; text-align: right;">

View file

@ -11,7 +11,6 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="autoorganizelog.html" data-role="button">${TabActivityLog}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabTV}</a>
<a href="autoorganizesmart.html" data-role="button">${TabSmartMatches}</a>
</div>
<form class="libraryFileOrganizerForm">

View file

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="channelItemsPage" data-role="page" class="page libraryPage channelsPage noSecondaryNavPage" data-contextname="${HeaderChannels}" data-require="jqmpanel,scripts/channelitems,paper-checkbox" data-backbutton="true" data-menubutton="false">
<div id="channelItemsPage" data-role="page" class="page libraryPage channelsPage noSecondaryNavPage" data-contextname="${HeaderChannels}" data-require="scripts/channelitems,paper-checkbox" data-backbutton="true" data-menubutton="false">
<div data-role="content">
<div class="viewSettings">
@ -14,29 +14,6 @@
</div>
<div id="items" class="itemsContainer paddedItemsContainer" style="text-align:center;"></div>
</div>
<div data-role="panel" class="viewPanel" data-theme="b" data-position="right" data-display="overlay" data-position-fixed="true">
<div class="ui-panel-inner">
<form>
<div class="filterControls">
<h1>
${HeaderFilters}
</h1>
<div class="paperCheckboxList">
<paper-checkbox class="chkStandardFilter" data-filter="IsPlayed">${OptionPlayed}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsUnPlayed">${OptionUnplayed}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsResumable">${OptionResumable}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsFavorite">${OptionFavorite}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="Likes">${OptionLikes}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="Dislikes">${OptionDislikes}</paper-checkbox>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>

View file

@ -22,8 +22,8 @@
<paper-input id="txtEndingEpisode" type="number" pattern="[0-9]*" min="0" label="${LabelEndingEpisodeNumber}"></paper-input>
<div class="fieldDescription">${LabelEndingEpisodeNumberHelp}</div>
</div>
<br />
<div>
<div class="hide">
<br />
<paper-checkbox type="checkbox" id="chkRememberCorrection">${OptionRememberOrganizeCorrection}</paper-checkbox>
</div>
<br />

View file

@ -0,0 +1,85 @@
define(['paperdialoghelper', 'events', 'paper-checkbox'], function (paperDialogHelper, events) {
function updateFilterControls(context, query) {
$('.chkStandardFilter', context).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
});
}
function triggerChange(instance) {
events.trigger(instance, 'filterchange');
}
function bindEvents(instance, context, query) {
$('.chkStandardFilter', context).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
triggerChange(instance);
});
}
return function (options) {
var self = this;
self.show = function () {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/filterdialog/filterdialog.template.html', true);
xhr.onload = function (e) {
var template = this.response;
var dlg = paperDialogHelper.createDialog({
removeOnClose: true,
modal: false,
enableHistory: false,
entryAnimationDuration: 160,
exitAnimationDuration: 200
});
dlg.classList.add('ui-body-b');
dlg.classList.add('background-theme-b');
dlg.classList.add('formDialog');
var html = '';
html += Globalize.translateDocument(template);
dlg.innerHTML = html;
document.body.appendChild(dlg);
paperDialogHelper.open(dlg);
dlg.addEventListener('iron-overlay-closed', resolve);
updateFilterControls(dlg, options.query);
bindEvents(self, dlg, options.query);
}
xhr.send();
});
};
};
});

View file

@ -0,0 +1,14 @@
<div style="margin: 0;padding:1.5em 2em;">
<h1>
${HeaderFilters}
</h1>
<div class="paperCheckboxList">
<paper-checkbox class="chkStandardFilter" data-filter="IsPlayed">${OptionPlayed}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsUnPlayed">${OptionUnplayed}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsResumable">${OptionResumable}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="IsFavorite">${OptionFavorite}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="Likes">${OptionLikes}</paper-checkbox>
<paper-checkbox class="chkStandardFilter" data-filter="Dislikes">${OptionDislikes}</paper-checkbox>
</div>
</div>

View file

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="gameGenresPage" data-role="page" class="page libraryPage listPage" data-require="jqmcheckbox,jqmcontrolgroup,jqmpanel,scripts/gamegenrepage">
<div id="gameGenresPage" data-role="page" class="page libraryPage listPage" data-require="scripts/gamegenrepage">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="gamesrecommended.html">${TabSuggestions}</a>
<a href="games.html">${TabGames}</a>
@ -20,41 +20,6 @@
<div id="items" class="itemsContainer"></div>
</div>
<div data-role="panel" class="viewPanel" data-theme="a" data-position="right" data-display="overlay" data-position-fixed="true">
<form>
<div data-role="controlgroup" data-type="horizontal" data-mini="true" class="viewPanelTabs">
<a href="#" data-role="button" class="viewTabButton" data-tab="tabView">${TabView}</a>
<a href="#" data-role="button" class="viewTabButton" data-tab="tabFilter">${TabFilter}</a>
</div>
<div class="tabView viewTab">
<div>
<label for="selectPageSize">${LabelPageSize}</label>
<select id="selectPageSize" class="selectPageSize"></select>
</div>
</div>
<div class="tabFilter viewTab">
<fieldset data-role="controlgroup">
<legend>
${HeaderFilters}
</legend>
<input class="chkStandardFilter" type="checkbox" name="chkIsFavorite" id="chkIsFavorite" data-filter="IsFavorite" data-mini="true">
<label for="chkIsFavorite">${OptionFavorite}</label>
<input class="chkStandardFilter" type="checkbox" name="chkLikes" id="chkLikes" data-filter="Likes" data-mini="true">
<label for="chkLikes">${OptionLikes}</label>
<input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-filter="Dislikes" data-mini="true">
<label for="chkDislikes">${OptionDislikes}</label>
</fieldset>
</div>
</form>
</div>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="gameStudiosPage" data-role="page" class="page libraryPage listPage" data-require="jqmcheckbox,jqmcontrolgroup,jqmpanel,scripts/gamestudiospage">
<div id="gameStudiosPage" data-role="page" class="page libraryPage listPage" data-require="jqmcontrolgroup,scripts/gamestudiospage">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="gamesrecommended.html">${TabSuggestions}</a>
<a href="games.html">${TabGames}</a>
@ -19,41 +19,6 @@
</div>
<div id="items" class="itemsContainer"></div>
</div>
<div data-role="panel" class="viewPanel" data-theme="a" data-position="right" data-display="overlay" data-position-fixed="true">
<form>
<div data-role="controlgroup" data-type="horizontal" data-mini="true" class="viewPanelTabs">
<a href="#" data-role="button" class="viewTabButton" data-tab="tabView">${TabView}</a>
<a href="#" data-role="button" class="viewTabButton" data-tab="tabFilter">${TabFilter}</a>
</div>
<div class="tabView viewTab">
<div>
<label for="selectPageSize">${LabelPageSize}</label>
<select id="selectPageSize" class="selectPageSize"></select>
</div>
</div>
<div class="tabFilter viewTab">
<fieldset data-role="controlgroup">
<legend>
${HeaderFilters}
</legend>
<input class="chkStandardFilter" type="checkbox" name="chkIsFavorite" id="chkIsFavorite" data-filter="IsFavorite" data-mini="true">
<label for="chkIsFavorite">${OptionFavorite}</label>
<input class="chkStandardFilter" type="checkbox" name="chkLikes" id="chkLikes" data-filter="Likes" data-mini="true">
<label for="chkLikes">${OptionLikes}</label>
<input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-filter="Dislikes" data-mini="true">
<label for="chkDislikes">${OptionDislikes}</label>
</fieldset>
</div>
</form>
</div>
</div>
</body>
</html>

View file

@ -61,28 +61,29 @@
</paper-icon-item>
</a>
</div>
<div class="userSection hide">
<div>
<br />
<h1 class="headerUser"></h1>
<div class="paperList">
<a href="selectserver.html" class="clearLink">
<a href="selectserver.html" class="clearLink selectServer hide">
<paper-icon-item>
<paper-fab mini icon="wifi" style="background-color: #444;" item-icon></paper-fab>
<paper-item-body two-line>
<div>${HeaderSelectServer}</div>
</paper-item-body>
</paper-icon-item>
<paper-icon-item class="btnLogout">
<paper-fab mini icon="lock" style="background-color: #444;" item-icon></paper-fab>
<paper-item-body two-line>
<div>${ButtonSignOut}</div>
</paper-item-body>
</paper-icon-item>
</a>
<paper-icon-item class="btnLogout">
<paper-fab mini icon="lock" style="background-color: #444;" item-icon></paper-fab>
<paper-item-body two-line>
<div>${ButtonSignOut}</div>
</paper-item-body>
</paper-icon-item>
</div>
</div>
<div class="adminSection hide">
<br />
<h1>${HeaderAdmin}</h1>
<div class="paperList">
<a href="dashboard.html" class="clearLink">

View file

@ -274,9 +274,9 @@
Dashboard.showLoadingMsg();
var page = $(this).parents('#addPluginPage');
var page = $(this).parents('#addPluginPage')[0];
$('#btnInstall', page).buttonEnabled(false);
page.querySelector('#btnInstall').disabled = true;
var name = getParameterByName('name');
var guid = getParameterByName('guid');

View file

@ -103,11 +103,10 @@
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
viewButton: true,
showLimit: false,
updatePageSizeSetting: false,
viewIcon: 'filter-list',
sortButton: true
sortButton: true,
filterButton: true
});
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
@ -140,6 +139,10 @@
reloadItems(page);
});
$('.btnFilter', page).on('click', function () {
showFilterMenu(page);
});
// On callback make sure to set StartIndex = 0
$('.btnSort', page).on('click', function () {
showSortMenu(page);
@ -153,6 +156,22 @@
});
}
function showFilterMenu(page) {
require(['components/filterdialog/filterdialog'], function (filterDialogFactory) {
var filterDialog = new filterDialogFactory({
query: getQuery()
});
Events.on(filterDialog, 'filterchange', function () {
reloadItems(page);
});
filterDialog.show();
});
}
function showSortMenu(page) {
var sortFields = getPageData().sortFields;
@ -213,15 +232,6 @@
function updateFilterControls(page) {
var query = getQuery();
$('.chkStandardFilter', page).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
});
$('.alphabetPicker', page).alphaValue(query.NameStartsWith);
}
@ -229,24 +239,6 @@
var page = this;
$('.chkStandardFilter', this).on('change', function () {
var query = getQuery();
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
reloadItems(page);
});
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
var query = getQuery();

View file

@ -30,12 +30,9 @@
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
viewButton: true,
showLimit: false
}));
updateFilterControls(page);
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
@ -66,39 +63,7 @@
});
}
function updateFilterControls(page) {
$('#selectPageSize', page).val(query.Limit);
}
$(document).on('pageinit', "#gameGenresPage", function () {
var page = this;
$('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
reloadItems(page);
});
$('#selectPageSize', page).on('change', function () {
query.Limit = parseInt(this.value);
query.StartIndex = 0;
reloadItems(page);
});
}).on('pagebeforeshow', "#gameGenresPage", function () {
$(document).on('pagebeforeshow', "#gameGenresPage", function () {
query.ParentId = LibraryMenu.getTopParentId();
@ -113,8 +78,6 @@
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
reloadItems(this);
updateFilterControls(this);
});
})(jQuery, document);

View file

@ -31,12 +31,9 @@
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
viewButton: true,
showLimit: false
}));
updateFilterControls(page);
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
@ -45,7 +42,6 @@
showItemCounts: true,
centerText: true,
lazy: true
});
var elem = page.querySelector('#items');
@ -68,39 +64,7 @@
});
}
function updateFilterControls(page) {
$('#selectPageSize', page).val(query.Limit);
}
$(document).on('pageinit', "#gameStudiosPage", function () {
var page = this;
$('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
reloadItems(page);
});
$('#selectPageSize', page).on('change', function () {
query.Limit = parseInt(this.value);
query.StartIndex = 0;
reloadItems(page);
});
}).on('pagebeforeshow', "#gameStudiosPage", function () {
$(document).on('pagebeforeshow', "#gameStudiosPage", function () {
query.ParentId = LibraryMenu.getTopParentId();
@ -115,8 +79,6 @@
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
reloadItems(this);
updateFilterControls(this);
});
})(jQuery, document);

View file

@ -2821,7 +2821,7 @@
html += '</span>';
}
if (showControls || options.viewButton || options.sortButton || options.addLayoutButton) {
if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) {
html += '<div style="display:inline-block;margin-left:10px;">';
@ -2849,6 +2849,11 @@
html += '<paper-icon-button title="' + title + '" icon="' + (options.viewIcon || AppInfo.moreIcon) + '" onclick="LibraryBrowser.openViewPanel(this, \'' + viewPanelClass + '\');"></paper-icon-button>';
}
if (options.filterButton) {
html += '<paper-icon-button class="btnFilter" title="' + Globalize.translate('ButtonFilter') + '" icon="filter-list"></paper-icon-button>';
}
html += '</div>';
if (showControls && options.showLimit) {

View file

@ -652,143 +652,142 @@
self.createStreamInfo = function (type, item, mediaSource, startPosition) {
var deferred = $.Deferred();
return new Promise(function (resolve, reject) {
var mediaUrl;
var contentType;
var startTimeTicksOffset = 0;
var mediaUrl;
var contentType;
var startTimeTicksOffset = 0;
var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0;
var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : '';
var playMethod = 'Transcode';
var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0;
var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : '';
var playMethod = 'Transcode';
if (type == 'Video') {
if (type == 'Video') {
contentType = 'video/' + mediaSource.Container;
contentType = 'video/' + mediaSource.Container;
if (mediaSource.enableDirectPlay) {
mediaUrl = mediaSource.Path;
if (mediaSource.enableDirectPlay) {
mediaUrl = mediaSource.Path;
playMethod = 'DirectPlay';
playMethod = 'DirectPlay';
} else {
} else {
if (mediaSource.SupportsDirectStream) {
if (mediaSource.SupportsDirectStream) {
var directOptions = {
Static: true,
mediaSourceId: mediaSource.Id,
deviceId: ApiClient.deviceId(),
api_key: ApiClient.accessToken()
};
var directOptions = {
Static: true,
mediaSourceId: mediaSource.Id,
deviceId: ApiClient.deviceId(),
api_key: ApiClient.accessToken()
};
if (mediaSource.LiveStreamId) {
directOptions.LiveStreamId = mediaSource.LiveStreamId;
}
mediaUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.' + mediaSource.Container, directOptions);
mediaUrl += seekParam;
playMethod = 'DirectStream';
} else if (mediaSource.SupportsTranscoding) {
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
if (mediaSource.TranscodingSubProtocol == 'hls') {
mediaUrl += seekParam;
contentType = 'application/x-mpegURL';
} else {
// Reports of stuttering with h264 stream copy in IE
if (mediaUrl.indexOf('.mkv') == -1) {
mediaUrl += '&EnableAutoStreamCopy=false';
if (mediaSource.LiveStreamId) {
directOptions.LiveStreamId = mediaSource.LiveStreamId;
}
startTimeTicksOffset = startPosition || 0;
contentType = 'video/' + mediaSource.TranscodingContainer;
mediaUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.' + mediaSource.Container, directOptions);
mediaUrl += seekParam;
playMethod = 'DirectStream';
} else if (mediaSource.SupportsTranscoding) {
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
if (mediaSource.TranscodingSubProtocol == 'hls') {
mediaUrl += seekParam;
contentType = 'application/x-mpegURL';
} else {
// Reports of stuttering with h264 stream copy in IE
if (mediaUrl.indexOf('.mkv') == -1) {
mediaUrl += '&EnableAutoStreamCopy=false';
}
startTimeTicksOffset = startPosition || 0;
contentType = 'video/' + mediaSource.TranscodingContainer;
}
}
}
}
} else {
contentType = 'audio/' + mediaSource.Container;
if (mediaSource.enableDirectPlay) {
mediaUrl = mediaSource.Path;
playMethod = 'DirectPlay';
} else {
var isDirectStream = mediaSource.SupportsDirectStream;
contentType = 'audio/' + mediaSource.Container;
if (isDirectStream) {
if (mediaSource.enableDirectPlay) {
var outputContainer = (mediaSource.Container || '').toLowerCase();
mediaUrl = mediaSource.Path;
var directOptions = {
Static: true,
mediaSourceId: mediaSource.Id,
deviceId: ApiClient.deviceId(),
api_key: ApiClient.accessToken()
};
playMethod = 'DirectPlay';
if (mediaSource.LiveStreamId) {
directOptions.LiveStreamId = mediaSource.LiveStreamId;
}
} else {
mediaUrl = ApiClient.getUrl('Audio/' + item.Id + '/stream.' + outputContainer, directOptions);
mediaUrl += seekParam;
var isDirectStream = mediaSource.SupportsDirectStream;
playMethod = 'DirectStream';
if (isDirectStream) {
} else if (mediaSource.SupportsTranscoding) {
var outputContainer = (mediaSource.Container || '').toLowerCase();
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
var directOptions = {
Static: true,
mediaSourceId: mediaSource.Id,
deviceId: ApiClient.deviceId(),
api_key: ApiClient.accessToken()
};
if (mediaSource.TranscodingSubProtocol == 'hls') {
if (mediaSource.LiveStreamId) {
directOptions.LiveStreamId = mediaSource.LiveStreamId;
}
mediaUrl = ApiClient.getUrl('Audio/' + item.Id + '/stream.' + outputContainer, directOptions);
mediaUrl += seekParam;
contentType = 'application/x-mpegURL';
} else {
startTimeTicksOffset = startPosition || 0;
contentType = 'audio/' + mediaSource.TranscodingContainer;
playMethod = 'DirectStream';
} else if (mediaSource.SupportsTranscoding) {
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
if (mediaSource.TranscodingSubProtocol == 'hls') {
mediaUrl += seekParam;
contentType = 'application/x-mpegURL';
} else {
startTimeTicksOffset = startPosition || 0;
contentType = 'audio/' + mediaSource.TranscodingContainer;
}
}
}
}
}
var resultInfo = {
url: mediaUrl,
mimeType: contentType,
startTimeTicksOffset: startTimeTicksOffset,
startPositionInSeekParam: startPositionInSeekParam,
playMethod: playMethod
};
var resultInfo = {
url: mediaUrl,
mimeType: contentType,
startTimeTicksOffset: startTimeTicksOffset,
startPositionInSeekParam: startPositionInSeekParam,
playMethod: playMethod
};
if (playMethod == 'DirectPlay' && mediaSource.Protocol == 'File') {
if (playMethod == 'DirectPlay' && mediaSource.Protocol == 'File') {
require(['localassetmanager'], function () {
require(['localassetmanager'], function () {
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
resultInfo.url = path;
console.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
deferred.resolveWith(null, [resultInfo]);
resultInfo.url = path;
console.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
resolve(resultInfo);
});
});
});
}
else {
deferred.resolveWith(null, [resultInfo]);
}
return deferred.promise();
}
else {
resolve(resultInfo);
}
});
};
self.lastBitrateDetections = {};

View file

@ -38,10 +38,10 @@ pageIdOn('pageshow', 'myPreferencesMenuPage', function () {
}
});
if (AppInfo.isNativeApp && browserInfo.safari) {
page.querySelector('.userSection').classList.remove('hide');
if (Dashboard.isConnectMode()) {
page.querySelector('.selectServer').classList.remove('hide');
} else {
page.querySelector('.userSection').classList.add('hide');
page.querySelector('.selectServer').classList.add('hide');
}
});

View file

@ -704,36 +704,7 @@ var Dashboard = {
showUserFlyout: function () {
require(['jqmpanel'], function () {
var html = '<div data-role="panel" data-position="right" data-display="overlay" id="userFlyout" data-position-fixed="true" data-theme="a">';
html += '<h3 class="userHeader">';
html += '</h3>';
html += '<form>';
html += '<p class="preferencesContainer"></p>';
html += '<p><button data-mini="true" type="button" onclick="Dashboard.logout();" data-icon="lock">' + Globalize.translate('ButtonSignOut') + '</button></p>';
html += '</form>';
html += '</div>';
$(document.body).append(html);
var userFlyout = document.querySelector('#userFlyout');
ImageLoader.lazyChildren(userFlyout);
$(userFlyout).panel({}).panel("open").on("panelclose", function () {
$(this).off("panelclose").remove();
});
ConnectionManager.user(window.ApiClient).then(function (user) {
Dashboard.updateUserFlyout(userFlyout, user);
});
});
Dashboard.navigate('mypreferencesmenu.html?userId=' + ApiClient.getCurrentUserId());
},
updateUserFlyout: function (elem, user) {
@ -1971,6 +1942,7 @@ var AppInfo = {};
define("jstree", [bowerPath + "/jstree/dist/jstree.min", "css!thirdparty/jstree/themes/default/style.min.css"]);
define('jqm', ['thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.js']);
define("jqmbase", ['css!thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.theme.css']);
define("jqmicons", ['jqmbase', 'css!thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.icons.css']);
define("jqmtable", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.table", 'css!thirdparty/jquerymobile-1.4.5/jqm.table.css']);
@ -2141,8 +2113,6 @@ var AppInfo = {};
deps.push('scripts/mediacontroller');
deps.push('scripts/globalize');
deps.push('jQuery');
deps.push('paper-drawer-panel');
require(deps, function (events) {
@ -2196,26 +2166,14 @@ var AppInfo = {};
MediaBrowser[i] = connectionManagerExports[i];
}
// TODO: This needs to be deprecated, but it's used heavily
$.fn.checked = function (value) {
if (value === true || value === false) {
// Set the value of the checkbox
return $(this).each(function () {
this.checked = value;
});
} else {
// Return check state
return this.length && this[0].checked;
}
};
var promises = [];
deps = [];
deps.push('scripts/mediaplayer');
deps.push('emby-icons');
deps.push('paper-icon-button');
deps.push('paper-button');
deps.push('thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.js');
deps.push('jQuery');
promises.push(getRequirePromise(deps));
promises.push(Globalize.ensure());
@ -2255,6 +2213,19 @@ var AppInfo = {};
require(depends, function () {
// TODO: This needs to be deprecated, but it's used heavily
$.fn.checked = function (value) {
if (value === true || value === false) {
// Set the value of the checkbox
return $(this).each(function () {
this.checked = value;
});
} else {
// Return check state
return this.length && this[0].checked;
}
};
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
onAppReady();
@ -2316,6 +2287,7 @@ var AppInfo = {};
deps.push('scripts/backdrops');
deps.push('scripts/librarymenu');
deps.push('scripts/librarybrowser');
deps.push('jqm');
deps.push('css!css/card.css');

View file

@ -1,528 +1,5 @@
(function () {
define(['jqmwidget'], function () {
if (jQuery.widget) {
return;
}
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function ($, undefined) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function (elems) {
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
try {
$(elem).triggerHandler("remove");
// http://bugs.jquery.com/ticket/8235
} catch (e) { }
}
_cleanData(elems);
};
$.widget = function (name, base, prototype) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split(".")[0];
name = name.split(".")[1];
fullName = namespace + "-" + name;
if (!prototype) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[":"][fullName.toLowerCase()] = function (elem) {
return !!$.data(elem, fullName);
};
$[namespace] = $[namespace] || {};
existingConstructor = $[namespace][name];
constructor = $[namespace][name] = function (options, element) {
// allow instantiation without "new" keyword
if (!this._createWidget) {
return new constructor(options, element);
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if (arguments.length) {
this._createWidget(options, element);
}
};
// extend with the existing constructor to carry over any static properties
$.extend(constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend({}, prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend({}, basePrototype.options);
$.each(prototype, function (prop, value) {
if (!$.isFunction(value)) {
proxiedPrototype[prop] = value;
return;
}
proxiedPrototype[prop] = (function () {
var _super = function () {
return base.prototype[prop].apply(this, arguments);
},
_superApply = function (args) {
return base.prototype[prop].apply(this, args);
};
return function () {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply(this, arguments);
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend(basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if (existingConstructor) {
$.each(existingConstructor._childConstructors, function (i, child) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push(constructor);
}
$.widget.bridge(name, constructor);
return constructor;
};
$.widget.extend = function (target) {
var input = slice.call(arguments, 1),
inputIndex = 0,
inputLength = input.length,
key,
value;
for (; inputIndex < inputLength; inputIndex++) {
for (key in input[inputIndex]) {
value = input[inputIndex][key];
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
// Clone objects
if ($.isPlainObject(value)) {
target[key] = $.isPlainObject(target[key]) ?
$.widget.extend({}, target[key], value) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend({}, value);
// Copy everything else by reference
} else {
target[key] = value;
}
}
}
}
return target;
};
$.widget.bridge = function (name, object) {
var fullName = object.prototype.widgetFullName || name;
$.fn[name] = function (options) {
var isMethodCall = typeof options === "string",
args = slice.call(arguments, 1),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply(null, [options].concat(args)) :
options;
if (isMethodCall) {
this.each(function () {
var methodValue,
instance = $.data(this, fullName);
if (options === "instance") {
returnValue = instance;
return false;
}
if (!instance) {
return $.error("cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'");
}
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
return $.error("no such method '" + options + "' for " + name + " widget instance");
}
methodValue = instance[options].apply(instance, args);
if (methodValue !== instance && methodValue !== undefined) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}
});
} else {
this.each(function () {
var instance = $.data(this, fullName);
if (instance) {
instance.option(options || {})._init();
} else {
$.data(this, fullName, new object(options, this));
}
});
}
return returnValue;
};
};
$.Widget = function ( /* options, element */) { };
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function (options, element) {
element = $(element || this.defaultElement || this)[0];
this.element = $(element);
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend({},
this.options,
this._getCreateOptions(),
options);
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if (element !== this) {
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (event) {
if (event.target === element) {
this.destroy();
}
}
});
this.document = $(element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element);
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
}
this._create();
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function () {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind(this.eventNamespace)
.removeData(this.widgetFullName)
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData($.camelCase(this.widgetFullName));
this.widget()
.unbind(this.eventNamespace)
.removeAttr("aria-disabled")
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled");
// clean up events and states
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
},
_destroy: $.noop,
widget: function () {
return this.element;
},
option: function (key, value) {
var options = key,
parts,
curOption,
i;
if (arguments.length === 0) {
// don't return a reference to the internal hash
return $.widget.extend({}, this.options);
}
if (typeof key === "string") {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split(".");
key = parts.shift();
if (parts.length) {
curOption = options[key] = $.widget.extend({}, this.options[key]);
for (i = 0; i < parts.length - 1; i++) {
curOption[parts[i]] = curOption[parts[i]] || {};
curOption = curOption[parts[i]];
}
key = parts.pop();
if (value === undefined) {
return curOption[key] === undefined ? null : curOption[key];
}
curOption[key] = value;
} else {
if (value === undefined) {
return this.options[key] === undefined ? null : this.options[key];
}
options[key] = value;
}
}
this._setOptions(options);
return this;
},
_setOptions: function (options) {
var key;
for (key in options) {
this._setOption(key, options[key]);
}
return this;
},
_setOption: function (key, value) {
this.options[key] = value;
if (key === "disabled") {
this.widget()
.toggleClass(this.widgetFullName + "-disabled", !!value);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
}
return this;
},
enable: function () {
return this._setOptions({ disabled: false });
},
disable: function () {
return this._setOptions({ disabled: true });
},
_on: function (suppressDisabledCheck, element, handlers) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if (typeof suppressDisabledCheck !== "boolean") {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if (!handlers) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $(element);
this.bindings = this.bindings.add(element);
}
$.each(handlers, function (event, handler) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if (!suppressDisabledCheck &&
(instance.options.disabled === true ||
$(this).hasClass("ui-state-disabled"))) {
return;
}
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
// copy the guid so direct unbinding works
if (typeof handler !== "string") {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match(/^(\w+)\s*(.*)$/),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if (selector) {
delegateElement.delegate(selector, eventName, handlerProxy);
} else {
element.bind(eventName, handlerProxy);
}
});
},
_off: function (element, eventName) {
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
element.unbind(eventName).undelegate(eventName);
},
_trigger: function (type, event, data) {
var prop, orig,
callback = this.options[type];
data = data || {};
event = $.Event(event);
event.type = (type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[0];
// copy original event properties over to the new event
orig = event.originalEvent;
if (orig) {
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
}
this.element[0].dispatchEvent(new CustomEvent(event.type, {
bubbles: true,
detail: {
data: data,
originalEvent: event
}
}));
//this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[0], [event].concat(data)) === false ||
event.isDefaultPrevented());
}
};
})(jQuery);
(function ($, undefined) {
$.extend($.Widget.prototype, {
_getCreateOptions: function () {
var option, value,
elem = this.element[0],
options = {};
//
if (!this.element.data("defaults")) {
for (option in this.options) {
value = this.element.data(option);
if (value != null) {
options[option] = value;
}
}
}
return options;
}
});
})(jQuery);
(function ($, undefined) {
var originalWidget = $.widget
$.widget = (function (orig) {
return function () {
var constructor = orig.apply(this, arguments),
name = constructor.prototype.widgetName;
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
$.mobile.widgets[name] = constructor;
return constructor;
};
})($.widget);
// Make sure $.widget still has bridge and extend methods
$.extend($.widget, originalWidget);
})(jQuery);
})();
(function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
@ -557,10 +34,6 @@
});
})(jQuery, this);
(function ($, undefined) {
/*!
* jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
@ -1181,9 +654,6 @@
}, $.mobile.behaviors.formReset));
})(jQuery);
(function ($, undefined) {
$.widget("mobile.rangeslider", $.extend({
options: {
@ -1441,11 +911,6 @@
}, $.mobile.behaviors.formReset));
})(jQuery);
(function ($, undefined) {
var popup;
function getPopup() {
@ -1559,4 +1024,4 @@
}
});
})(jQuery);
});

View file

@ -1,528 +1,5 @@
(function () {
define(['jqmwidget'], function () {
if (jQuery.widget) {
return;
}
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function ($, undefined) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function (elems) {
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
try {
$(elem).triggerHandler("remove");
// http://bugs.jquery.com/ticket/8235
} catch (e) { }
}
_cleanData(elems);
};
$.widget = function (name, base, prototype) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split(".")[0];
name = name.split(".")[1];
fullName = namespace + "-" + name;
if (!prototype) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[":"][fullName.toLowerCase()] = function (elem) {
return !!$.data(elem, fullName);
};
$[namespace] = $[namespace] || {};
existingConstructor = $[namespace][name];
constructor = $[namespace][name] = function (options, element) {
// allow instantiation without "new" keyword
if (!this._createWidget) {
return new constructor(options, element);
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if (arguments.length) {
this._createWidget(options, element);
}
};
// extend with the existing constructor to carry over any static properties
$.extend(constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend({}, prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend({}, basePrototype.options);
$.each(prototype, function (prop, value) {
if (!$.isFunction(value)) {
proxiedPrototype[prop] = value;
return;
}
proxiedPrototype[prop] = (function () {
var _super = function () {
return base.prototype[prop].apply(this, arguments);
},
_superApply = function (args) {
return base.prototype[prop].apply(this, args);
};
return function () {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply(this, arguments);
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend(basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if (existingConstructor) {
$.each(existingConstructor._childConstructors, function (i, child) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push(constructor);
}
$.widget.bridge(name, constructor);
return constructor;
};
$.widget.extend = function (target) {
var input = slice.call(arguments, 1),
inputIndex = 0,
inputLength = input.length,
key,
value;
for (; inputIndex < inputLength; inputIndex++) {
for (key in input[inputIndex]) {
value = input[inputIndex][key];
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
// Clone objects
if ($.isPlainObject(value)) {
target[key] = $.isPlainObject(target[key]) ?
$.widget.extend({}, target[key], value) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend({}, value);
// Copy everything else by reference
} else {
target[key] = value;
}
}
}
}
return target;
};
$.widget.bridge = function (name, object) {
var fullName = object.prototype.widgetFullName || name;
$.fn[name] = function (options) {
var isMethodCall = typeof options === "string",
args = slice.call(arguments, 1),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply(null, [options].concat(args)) :
options;
if (isMethodCall) {
this.each(function () {
var methodValue,
instance = $.data(this, fullName);
if (options === "instance") {
returnValue = instance;
return false;
}
if (!instance) {
return $.error("cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'");
}
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
return $.error("no such method '" + options + "' for " + name + " widget instance");
}
methodValue = instance[options].apply(instance, args);
if (methodValue !== instance && methodValue !== undefined) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}
});
} else {
this.each(function () {
var instance = $.data(this, fullName);
if (instance) {
instance.option(options || {})._init();
} else {
$.data(this, fullName, new object(options, this));
}
});
}
return returnValue;
};
};
$.Widget = function ( /* options, element */) { };
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function (options, element) {
element = $(element || this.defaultElement || this)[0];
this.element = $(element);
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend({},
this.options,
this._getCreateOptions(),
options);
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if (element !== this) {
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (event) {
if (event.target === element) {
this.destroy();
}
}
});
this.document = $(element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element);
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
}
this._create();
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function () {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind(this.eventNamespace)
.removeData(this.widgetFullName)
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData($.camelCase(this.widgetFullName));
this.widget()
.unbind(this.eventNamespace)
.removeAttr("aria-disabled")
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled");
// clean up events and states
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
},
_destroy: $.noop,
widget: function () {
return this.element;
},
option: function (key, value) {
var options = key,
parts,
curOption,
i;
if (arguments.length === 0) {
// don't return a reference to the internal hash
return $.widget.extend({}, this.options);
}
if (typeof key === "string") {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split(".");
key = parts.shift();
if (parts.length) {
curOption = options[key] = $.widget.extend({}, this.options[key]);
for (i = 0; i < parts.length - 1; i++) {
curOption[parts[i]] = curOption[parts[i]] || {};
curOption = curOption[parts[i]];
}
key = parts.pop();
if (value === undefined) {
return curOption[key] === undefined ? null : curOption[key];
}
curOption[key] = value;
} else {
if (value === undefined) {
return this.options[key] === undefined ? null : this.options[key];
}
options[key] = value;
}
}
this._setOptions(options);
return this;
},
_setOptions: function (options) {
var key;
for (key in options) {
this._setOption(key, options[key]);
}
return this;
},
_setOption: function (key, value) {
this.options[key] = value;
if (key === "disabled") {
this.widget()
.toggleClass(this.widgetFullName + "-disabled", !!value);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
}
return this;
},
enable: function () {
return this._setOptions({ disabled: false });
},
disable: function () {
return this._setOptions({ disabled: true });
},
_on: function (suppressDisabledCheck, element, handlers) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if (typeof suppressDisabledCheck !== "boolean") {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if (!handlers) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $(element);
this.bindings = this.bindings.add(element);
}
$.each(handlers, function (event, handler) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if (!suppressDisabledCheck &&
(instance.options.disabled === true ||
$(this).hasClass("ui-state-disabled"))) {
return;
}
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
// copy the guid so direct unbinding works
if (typeof handler !== "string") {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match(/^(\w+)\s*(.*)$/),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if (selector) {
delegateElement.delegate(selector, eventName, handlerProxy);
} else {
element.bind(eventName, handlerProxy);
}
});
},
_off: function (element, eventName) {
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
element.unbind(eventName).undelegate(eventName);
},
_trigger: function (type, event, data) {
var prop, orig,
callback = this.options[type];
data = data || {};
event = $.Event(event);
event.type = (type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[0];
// copy original event properties over to the new event
orig = event.originalEvent;
if (orig) {
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
}
this.element[0].dispatchEvent(new CustomEvent(event.type, {
bubbles: true,
detail: {
data: data,
originalEvent: event
}
}));
//this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[0], [event].concat(data)) === false ||
event.isDefaultPrevented());
}
};
})(jQuery);
(function ($, undefined) {
$.extend($.Widget.prototype, {
_getCreateOptions: function () {
var option, value,
elem = this.element[0],
options = {};
//
if (!this.element.data("defaults")) {
for (option in this.options) {
value = this.element.data(option);
if (value != null) {
options[option] = value;
}
}
}
return options;
}
});
})(jQuery);
(function ($, undefined) {
var originalWidget = $.widget
$.widget = (function (orig) {
return function () {
var constructor = orig.apply(this, arguments),
name = constructor.prototype.widgetName;
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
$.mobile.widgets[name] = constructor;
return constructor;
};
})($.widget);
// Make sure $.widget still has bridge and extend methods
$.extend($.widget, originalWidget);
})(jQuery);
})();
(function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
@ -557,165 +34,158 @@
});
})(jQuery, this);
(function ($, undefined) {
$.widget("mobile.table", {
options: {
enhanced: false
},
$.widget("mobile.table", {
options: {
enhanced: false
},
_create: function () {
if (!this.options.enhanced) {
this.element.addClass("ui-table");
}
_create: function () {
if (!this.options.enhanced) {
this.element.addClass("ui-table");
}
// extend here, assign on refresh > _setHeaders
$.extend(this, {
// extend here, assign on refresh > _setHeaders
$.extend(this, {
// Expose headers and allHeaders properties on the widget
// headers references the THs within the first TR in the table
headers: undefined,
// Expose headers and allHeaders properties on the widget
// headers references the THs within the first TR in the table
headers: undefined,
// allHeaders references headers, plus all THs in the thead, which may
// include several rows, or not
allHeaders: undefined
});
// allHeaders references headers, plus all THs in the thead, which may
// include several rows, or not
allHeaders: undefined
});
this._refresh(true);
},
this._refresh(true);
},
_setHeaders: function () {
var trs = this.element.find("thead tr");
_setHeaders: function () {
var trs = this.element.find("thead tr");
this.headers = this.element.find("tr:eq(0)").children();
this.allHeaders = this.headers.add(trs.children());
},
this.headers = this.element.find("tr:eq(0)").children();
this.allHeaders = this.headers.add(trs.children());
},
refresh: function () {
this._refresh();
},
refresh: function () {
this._refresh();
},
rebuild: $.noop,
rebuild: $.noop,
_refresh: function ( /* create */) {
var table = this.element,
_refresh: function ( /* create */) {
var table = this.element,
trs = table.find("thead tr");
// updating headers on refresh (fixes #5880)
this._setHeaders();
// updating headers on refresh (fixes #5880)
this._setHeaders();
// Iterate over the trs
trs.each(function () {
var columnCount = 0;
// Iterate over the trs
trs.each(function () {
var columnCount = 0;
// Iterate over the children of the tr
$(this).children().each(function () {
var span = parseInt(this.getAttribute("colspan"), 10),
// Iterate over the children of the tr
$(this).children().each(function () {
var span = parseInt(this.getAttribute("colspan"), 10),
selector = ":nth-child(" + (columnCount + 1) + ")",
j;
this.setAttribute("data-colstart", columnCount + 1);
this.setAttribute("data-colstart", columnCount + 1);
if (span) {
for (j = 0; j < span - 1; j++) {
columnCount++;
selector += ", :nth-child(" + (columnCount + 1) + ")";
}
}
if (span) {
for (j = 0; j < span - 1; j++) {
columnCount++;
selector += ", :nth-child(" + (columnCount + 1) + ")";
}
}
// Store "cells" data on header as a reference to all cells in the
// same column as this TH
$(this).data("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector));
// Store "cells" data on header as a reference to all cells in the
// same column as this TH
$(this).data("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector));
columnCount++;
});
});
}
});
})(jQuery);
columnCount++;
});
});
}
});
(function ($, undefined) {
$.widget("mobile.table", $.mobile.table, {
options: {
mode: "reflow"
},
$.widget("mobile.table", $.mobile.table, {
options: {
mode: "reflow"
},
_create: function () {
this._super();
_create: function () {
this._super();
// If it's not reflow mode, return here.
if (this.options.mode !== "reflow") {
return;
}
// If it's not reflow mode, return here.
if (this.options.mode !== "reflow") {
return;
}
if (!this.options.enhanced) {
this.element.addClass("ui-table-reflow");
if (!this.options.enhanced) {
this.element.addClass("ui-table-reflow");
this._updateReflow();
}
},
this._updateReflow();
}
},
rebuild: function () {
this._super();
rebuild: function () {
this._super();
if (this.options.mode === "reflow") {
this._refresh(false);
}
},
if (this.options.mode === "reflow") {
this._refresh(false);
}
},
_refresh: function (create) {
this._super(create);
if (!create && this.options.mode === "reflow") {
this._updateReflow();
}
},
_refresh: function (create) {
this._super(create);
if (!create && this.options.mode === "reflow") {
this._updateReflow();
}
},
_updateReflow: function () {
var table = this,
_updateReflow: function () {
var table = this,
opts = this.options;
// get headers in reverse order so that top-level headers are appended last
$(table.allHeaders.get().reverse()).each(function () {
var cells = $(this).data("cells"),
// get headers in reverse order so that top-level headers are appended last
$(table.allHeaders.get().reverse()).each(function () {
var cells = $(this).data("cells"),
colstart = $.mobile.getAttribute(this, "colstart"),
hierarchyClass = cells.not(this).filter("thead th").length && " ui-table-cell-label-top",
contents = $(this).clone().contents(),
iteration, filter;
if (contents.length > 0) {
if (contents.length > 0) {
if (hierarchyClass) {
iteration = parseInt(this.getAttribute("colspan"), 10);
filter = "";
if (hierarchyClass) {
iteration = parseInt(this.getAttribute("colspan"), 10);
filter = "";
if (iteration) {
filter = "td:nth-child(" + iteration + "n + " + (colstart) + ")";
}
if (iteration) {
filter = "td:nth-child(" + iteration + "n + " + (colstart) + ")";
}
table._addLabels(cells.filter(filter),
table._addLabels(cells.filter(filter),
"ui-table-cell-label" + hierarchyClass, contents);
} else {
table._addLabels(cells, "ui-table-cell-label", contents);
}
} else {
table._addLabels(cells, "ui-table-cell-label", contents);
}
}
});
},
}
});
},
_addLabels: function (cells, label, contents) {
if (contents.length === 1 && contents[0].nodeName.toLowerCase() === "abbr") {
contents = contents.eq(0).attr("title");
}
// .not fixes #6006
cells
_addLabels: function (cells, label, contents) {
if (contents.length === 1 && contents[0].nodeName.toLowerCase() === "abbr") {
contents = contents.eq(0).attr("title");
}
// .not fixes #6006
cells
.not(":has(b." + label + ")")
.prepend($("<b class='" + label + "'></b>").append(contents));
}
});
}
});
})(jQuery);
});

View file

@ -1,8 +1,4 @@
(function () {
if (jQuery.widget) {
return;
}
define(['jqm'], function () {
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
@ -498,7 +494,7 @@
(function ($, undefined) {
var originalWidget = $.widget
var originalWidget = $.widget;
$.widget = (function (orig) {
return function () {
@ -519,5 +515,4 @@
})(jQuery);
})();
});