diff --git a/dashboard-ui/css/search.css b/dashboard-ui/css/search.css deleted file mode 100644 index 368d570e06..0000000000 --- a/dashboard-ui/css/search.css +++ /dev/null @@ -1,193 +0,0 @@ -.searchHints { - margin-top: 1em; -} - -.searchHint { - display: block; - text-decoration: none; - color: #fff; - border-bottom: 1px solid #444; -} - - .searchHint:hover { - background-color: #444; - } - - .searchHint:focus { - background-color: #444; - } - -.searchHintImage { - display: inline-block; - width: 20%; - vertical-align: middle; - margin: 4px 0; -} - -.searchHintContent { - vertical-align: top; - display: inline-block; - width: 80%; -} - -.searchHintName { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - color: #fff; - font-weight: normal !important; -} - -.searchHintSecondaryText { - color: #fff; - margin-top: 3px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - font-weight: 300; -} - -.searchHintContentInner { - padding: 2px 5px; -} - -@-moz-keyframes spinPulse { - 0% { - -moz-transform: rotate(160deg); - opacity: 0; - box-shadow: 0 0 1px #2187e7; - } - - 50% { - -moz-transform: rotate(145deg); - opacity: 1; - } - - 100% { - -moz-transform: rotate(-320deg); - opacity: 0; - } -} - -@-moz-keyframes spinoffPulse { - 0% { - -moz-transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(360deg); - } -} - -@-webkit-keyframes spinPulse { - 0% { - -webkit-transform: rotate(160deg); - opacity: 0; - box-shadow: 0 0 1px #2187e7; - } - - 50% { - -webkit-transform: rotate(145deg); - opacity: 1; - } - - 100% { - -webkit-transform: rotate(-320deg); - opacity: 0; - } -} - -@-webkit-keyframes spinoffPulse { - 0% { - -webkit-transform: rotate(0deg); - } - - 100% { - -webkit-transform: rotate(360deg); - } -} - -.headerSearchInput { - margin: 0 !important; - background: #222 !important; - border: 0 !important; - color: #eee !important; - border-radius: 0 !important; - padding: 7px 0 6px 0 !important; - text-indent: 10px !important; - font-family: inherit; - outline: none; - vertical-align: middle; - width: 85% !important; - display: inline-block !important; - height: 100%!important; -} - -.viewMenuSearch { - position: fixed; - top: 0; - left: 0%; - right: 0; - background: #000000; - z-index: 1000; -} - -@media all and (min-width: 600px) { - .headerSearchInput { - width: 90% !important; - } -} - -@media all and (min-width: 800px) { - .headerSearchInput { - width: 93% !important; - } -} - -@media all and (min-width: 1200px) { - .headerSearchInput { - width: 96% !important; - } -} - -.viewMenuSearch:not(.hide) { - display: inline-block; -} - -.viewMenuSearchForm { - max-width: none; - padding: 5px; -} - -.searchResultsOverlay { - position: fixed; - top: 50px; - left: 0; - right: 0; - bottom: 0; - z-index: 1000; - border: 0 !important; -} - -.searchResultsContainer { - padding: .5em; -} - -@media all and (min-width: 800px) { - .searchResultsContainer { - padding-left: 1em; - padding-right: 1em; - } -} - -@media all and (min-height: 800px) { - .searchResultsContainer { - padding-top: 1em; - padding-bottom: 1em; - } -} - -.btnCloseSearch { - padding-top: 0; - padding-bottom: 0; -} diff --git a/dashboard-ui/devices/ios/ios.css b/dashboard-ui/devices/ios/ios.css index 26eb494f1e..733b87cb74 100644 --- a/dashboard-ui/devices/ios/ios.css +++ b/dashboard-ui/devices/ios/ios.css @@ -135,10 +135,6 @@ h1, h1 a { border-radius: 10px; } -.viewMenuSearch { - background: #1c1c1c; -} - .bottomFab { bottom: 120px !important; } diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index 6f3c5e910e..81bde53b17 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -24,13 +24,7 @@ html += ''; if (AppInfo.enableSearchInTopMenu) { - html += ''; - html += '
'; + html += ''; } html += ''; @@ -175,6 +169,10 @@ }); } + function showSearch() { + Dashboard.navigate('search.html'); + } + function onHeaderUserButtonClick(e) { Dashboard.showUserFlyout(e.target); } @@ -252,6 +250,11 @@ headerVoiceButton.addEventListener('click', showVoice); } + var headerSearchButton = document.querySelector('.headerSearchButton'); + if (headerSearchButton) { + headerSearchButton.addEventListener('click', showSearch); + } + var headerUserButton = document.querySelector('.headerUserButton'); if (headerUserButton) { headerUserButton.addEventListener('click', onHeaderUserButtonClick); diff --git a/dashboard-ui/scripts/search.js b/dashboard-ui/scripts/search.js deleted file mode 100644 index f086e990cc..0000000000 --- a/dashboard-ui/scripts/search.js +++ /dev/null @@ -1,266 +0,0 @@ -define(['libraryBrowser', 'events', 'scrollStyles', 'scripts/librarymenu'], function (libraryBrowser, events) { - - var searchHintTimeout; - - function clearSearchHintTimeout() { - - if (searchHintTimeout) { - - clearTimeout(searchHintTimeout); - searchHintTimeout = null; - } - } - - function getAdditionalTextLines(hint) { - - if (hint.Type == "Audio") { - - return [[hint.AlbumArtist, hint.Album].join(" - ")]; - - } - else if (hint.Type == "MusicAlbum") { - - return [hint.AlbumArtist]; - - } - else if (hint.Type == "MusicArtist") { - - return [Globalize.translate('LabelArtist')]; - - } - else if (hint.Type == "Movie") { - - return [Globalize.translate('LabelMovie')]; - - } - else if (hint.Type == "MusicVideo") { - - return [Globalize.translate('LabelMusicVideo')]; - } - else if (hint.Type == "Episode") { - - return [Globalize.translate('LabelEpisode')]; - - } - else if (hint.Type == "Series") { - - return [Globalize.translate('Series')]; - } - else if (hint.Type == "BoxSet") { - - return [Globalize.translate('LabelCollection')]; - } - else if (hint.ChannelName) { - - return [hint.ChannelName]; - } - - return [hint.Type]; - } - - function search() { - - var self = this; - - self.showSearchPanel = function () { - - showSearchMenu(); - }; - } - window.Search = new search(); - - function renderSearchResultsInOverlay(elem, hints) { - - // Massage the objects to look like regular items - hints = hints.map(function (i) { - - i.Id = i.ItemId; - i.ImageTags = {}; - i.UserData = {}; - - if (i.PrimaryImageTag) { - i.ImageTags.Primary = i.PrimaryImageTag; - } - return i; - }); - - var html = libraryBrowser.getPosterViewHtml({ - items: hints, - shape: "auto", - lazy: true, - overlayText: false, - showTitle: true, - centerImage: true, - centerText: true, - textLines: getAdditionalTextLines, - overlayPlayButton: true - }); - - var itemsContainer = elem.querySelector('.itemsContainer'); - itemsContainer.innerHTML = html; - ImageLoader.lazyChildren(itemsContainer); - } - - function requestSearchHintsForOverlay(elem, searchTerm) { - - var currentTimeout = searchHintTimeout; - Dashboard.showLoadingMsg(); - - ApiClient.getSearchHints({ - - userId: Dashboard.getCurrentUserId(), - searchTerm: (searchTerm || '').trim(), - limit: 30 - - }).then(function (result) { - - if (currentTimeout == searchHintTimeout) { - renderSearchResultsInOverlay(elem, result.SearchHints); - } - - Dashboard.hideLoadingMsg(); - }, function () { - Dashboard.hideLoadingMsg(); - }); - } - - function updateSearchOverlay(elem, searchTerm) { - - if (!searchTerm) { - - var itemsContainer = elem.querySelector('.itemsContainer'); - if (itemsContainer) { - itemsContainer.innerHTML = ''; - } - clearSearchHintTimeout(); - return; - } - - clearSearchHintTimeout(); - - searchHintTimeout = setTimeout(function () { - - requestSearchHintsForOverlay(elem, searchTerm); - - }, 300); - } - - function getSearchOverlay(createIfNeeded) { - - var elem = document.querySelector('.searchResultsOverlay'); - - if (createIfNeeded && !elem) { - - var div = document.createElement('div'); - div.className = 'searchResultsOverlay ui-body-b smoothScrollY background-theme-b'; - - div.innerHTML = '