mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
3.0.5666.4
This commit is contained in:
parent
5f32167765
commit
4e815ceaf0
4 changed files with 137 additions and 76 deletions
26
dashboard-ui/cordova/searchmenu.js
vendored
Normal file
26
dashboard-ui/cordova/searchmenu.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
function searchMenu() {
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.show = function () {
|
||||||
|
|
||||||
|
cordova.searchbar.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.hide = function () {
|
||||||
|
|
||||||
|
cordova.searchbar.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('searchEvent', function (data) {
|
||||||
|
|
||||||
|
Events.trigger(self, 'change', [data.text || '']);
|
||||||
|
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.SearchMenu = new searchMenu();
|
||||||
|
|
||||||
|
})();
|
|
@ -61,7 +61,6 @@
|
||||||
self.showSearchPanel = function () {
|
self.showSearchPanel = function () {
|
||||||
|
|
||||||
showSearchMenu();
|
showSearchMenu();
|
||||||
$('.headerSearchInput').focus();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
window.Search = new search();
|
window.Search = new search();
|
||||||
|
@ -179,96 +178,34 @@
|
||||||
|
|
||||||
function bindSearchEvents() {
|
function bindSearchEvents() {
|
||||||
|
|
||||||
$('.headerSearchInput').on("keyup", function (e) {
|
require(['searchmenu'], function () {
|
||||||
|
Events.on(SearchMenu, 'closed', closeSearchResults);
|
||||||
|
Events.on(SearchMenu, 'change', function (e, value) {
|
||||||
|
|
||||||
// Down key
|
onHeaderSearchChange(value);
|
||||||
if (e.keyCode == 40) {
|
});
|
||||||
|
|
||||||
//var first = $('.card', panel)[0];
|
|
||||||
|
|
||||||
//if (first) {
|
|
||||||
// first.focus();
|
|
||||||
//}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
onHeaderSearchChange(this.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}).on("search", function (e) {
|
|
||||||
|
|
||||||
if (!this.value) {
|
|
||||||
|
|
||||||
onHeaderSearchChange('');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.btnCloseSearch').on('click', closeSearchOverlay);
|
|
||||||
|
|
||||||
$('.viewMenuSearchForm').on('submit', function () {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeSearchOverlay() {
|
function closeSearchResults() {
|
||||||
$('.headerSearchInput').val('');
|
|
||||||
onHeaderSearchChange('');
|
onHeaderSearchChange('');
|
||||||
hideSearchMenu();
|
hideSearchMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSearchMenu() {
|
function showSearchMenu() {
|
||||||
|
require(['searchmenu'], function () {
|
||||||
require(["jquery", "velocity"], function ($, Velocity) {
|
SearchMenu.show();
|
||||||
|
|
||||||
$('.btnCloseSearch').hide();
|
|
||||||
var elem = $('.viewMenuSearch')
|
|
||||||
.css({ left: '100%' })
|
|
||||||
.removeClass('hide')[0];
|
|
||||||
|
|
||||||
Velocity.animate(elem, { "left": "0px" },
|
|
||||||
{
|
|
||||||
complete: function () {
|
|
||||||
$('.headerSearchInput').focus();
|
|
||||||
$('.btnCloseSearch').show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSearchMenu() {
|
function hideSearchMenu() {
|
||||||
|
require(['searchmenu'], function () {
|
||||||
var viewMenuSearch = document.querySelector('.viewMenuSearch');
|
SearchMenu.hide();
|
||||||
|
});
|
||||||
if (!viewMenuSearch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!viewMenuSearch.classList.contains('hide')) {
|
|
||||||
require(["jquery", "velocity"], function ($, Velocity) {
|
|
||||||
|
|
||||||
$('.btnCloseSearch').hide();
|
|
||||||
viewMenuSearch.style.left = '0';
|
|
||||||
|
|
||||||
Velocity.animate(viewMenuSearch, { "left": "100%" },
|
|
||||||
{
|
|
||||||
complete: function () {
|
|
||||||
$('.viewMenuSearch').visible(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pagebeforehide', ".libraryPage", function () {
|
$(document).on('pagecontainerbeforehide', closeSearchResults);
|
||||||
|
|
||||||
$('#txtSearch', this).val('');
|
|
||||||
$('#searchHints', this).empty();
|
|
||||||
|
|
||||||
}).on('pagecontainerbeforehide', closeSearchOverlay);
|
|
||||||
|
|
||||||
$(document).on('headercreated', function () {
|
$(document).on('headercreated', function () {
|
||||||
|
|
||||||
|
|
92
dashboard-ui/scripts/searchmenu.js
Normal file
92
dashboard-ui/scripts/searchmenu.js
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
function searchMenu() {
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.show = function () {
|
||||||
|
|
||||||
|
$('.headerSearchInput').val('');
|
||||||
|
|
||||||
|
require(["jquery", "velocity"], function ($, Velocity) {
|
||||||
|
|
||||||
|
$('.btnCloseSearch').hide();
|
||||||
|
var elem = $('.viewMenuSearch')
|
||||||
|
.css({ left: '100%' })
|
||||||
|
.removeClass('hide')[0];
|
||||||
|
|
||||||
|
Velocity.animate(elem, { "left": "0px" },
|
||||||
|
{
|
||||||
|
complete: function () {
|
||||||
|
$('.headerSearchInput').focus();
|
||||||
|
$('.btnCloseSearch').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
self.hide = function () {
|
||||||
|
|
||||||
|
var viewMenuSearch = document.querySelector('.viewMenuSearch');
|
||||||
|
|
||||||
|
if (!viewMenuSearch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!viewMenuSearch.classList.contains('hide')) {
|
||||||
|
require(["jquery", "velocity"], function ($, Velocity) {
|
||||||
|
|
||||||
|
$('.btnCloseSearch').hide();
|
||||||
|
viewMenuSearch.style.left = '0';
|
||||||
|
|
||||||
|
Velocity.animate(viewMenuSearch, { "left": "100%" },
|
||||||
|
{
|
||||||
|
complete: function () {
|
||||||
|
$('.viewMenuSearch').visible(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$('.viewMenuSearchForm').on('submit', function () {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btnCloseSearch').on('click', function () {
|
||||||
|
Events.trigger(self, 'closed');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.headerSearchInput').on("keyup", function (e) {
|
||||||
|
|
||||||
|
// Down key
|
||||||
|
if (e.keyCode == 40) {
|
||||||
|
|
||||||
|
//var first = $('.card', panel)[0];
|
||||||
|
|
||||||
|
//if (first) {
|
||||||
|
// first.focus();
|
||||||
|
//}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Events.trigger(self, 'change', [this.value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}).on("search", function (e) {
|
||||||
|
|
||||||
|
if (!this.value) {
|
||||||
|
|
||||||
|
Events.trigger(self, 'change', ['']);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
window.SearchMenu = new searchMenu();
|
||||||
|
|
||||||
|
})();
|
|
@ -2014,6 +2014,12 @@ var AppInfo = {};
|
||||||
define("sharingwidget", ["scripts/sharingwidget"]);
|
define("sharingwidget", ["scripts/sharingwidget"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Dashboard.isRunningInCordova() && $.browser.safari) {
|
||||||
|
define("searchmenu", ["cordova/searchmenu"]);
|
||||||
|
} else {
|
||||||
|
define("searchmenu", ["scripts/searchmenu"]);
|
||||||
|
}
|
||||||
|
|
||||||
$.extend(AppInfo, Dashboard.getAppInfo(appName, deviceId, deviceName));
|
$.extend(AppInfo, Dashboard.getAppInfo(appName, deviceId, deviceName));
|
||||||
|
|
||||||
$(document).on('WebComponentsReady', function () {
|
$(document).on('WebComponentsReady', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue