diff --git a/public/js/app.js b/public/js/app.js index 4afc82e7..d9564533 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1 +1 @@ -function _createForOfIteratorHelper(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n.5;var o=this.colorGrid[e.toUpperCase()];this.updateCursor(o),this.setTexts(),this.setBackgrounds(),n||this.emitEvent("change",[e,t.hue,t.sat,t.lum])}},c.setTexts=function(){if(this.setTextElems)for(var t=0;t0&&s.attr("value",o)}$(".message-container").length&&setTimeout((function(){$(".message-container").fadeOut()}),3500),void 0!==document.hidden?(t="hidden",e="visibilitychange"):void 0!==document.msHidden?(t="msHidden",e="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange");var r=[],a=[],h=$(".livestats-container");h.length>0&&(void 0===document.addEventListener||void 0===t?console.log("This browser does not support visibilityChange"):document.addEventListener(e,(function(){document[t]?function(){var t,e=_createForOfIteratorHelper(r);try{for(e.s();!(t=e.n()).done;){var n=t.value;window.clearTimeout(n)}}catch(t){e.e(t)}finally{e.f()}}():function(){var t,e=_createForOfIteratorHelper(a);try{for(e.s();!(t=e.n()).done;)(0,t.value)()}catch(t){e.e(t)}finally{e.f()}}()}),!1),h.each((function(t){var e=$(this).data("id"),i=1==$(this).data("dataonly")?2e4:1e3,o=$(this),s=5e3,h=function a(){$.ajax({url:n+"get_stats/"+e,dataType:"json",success:function(t){o.html(t.html),"active"==t.status?s=i:s<3e4&&(s+=2e3)},complete:function(e){e.status>299||(r[t]=window.setTimeout(a,s))}})};a[t]=h,h()}))),$("#upload").change((function(){!function(t){if(t.files&&t.files[0]){var e=new FileReader;e.onload=function(t){$("#appimage img").attr("src",t.target.result)},e.readAsDataURL(t.files[0])}}(this)})),$("#sortable").sortable({stop:function(t,e){var i=$("#sortable").sortable("toArray",{attribute:"data-id"});$.post(n+"order",{order:i})}}),$("#sortable").sortable("disable"),$("#main").on("mouseenter","#sortable.ui-sortable-disabled .item",(function(){$(this).siblings(".tooltip").addClass("active"),$(".refresh",this).addClass("active")})).on("mouseleave",".item",(function(){$(this).siblings(".tooltip").removeClass("active"),$(".refresh",this).removeClass("active")})),$("#config-buttons").on("mouseenter","a",(function(){$(".tooltip",this).addClass("active")})).on("mouseleave","a",(function(){$(".tooltip",this).removeClass("active")})),$(".searchform > form").on("submit",(function(t){"tiles"===$("#search-container select[name=provider]").val()&&t.preventDefault()})),$("#search-container").on("input","input[name=q]",(function(){var t=this.value,e=$("#sortable").children(".item-container");"tiles"===$("#search-container select[name=provider]").val()&&t.length>0?(e.hide(),e.filter((function(){return $(this).data("name").toLowerCase().includes(t.toLowerCase())})).show()):e.show()})).on("change","select[name=provider]",(function(){var t=$("#sortable").children(".item-container");if("tiles"===$(this).val()){$("#search-container button").hide();var e=$("#search-container input[name=q]").val();e.length>0?(t.hide(),t.filter((function(){return $(this).data("name").toLowerCase().includes(e.toLowerCase())})).show()):t.show()}else $("#search-container button").show(),t.show()})),$("#app").on("click","#config-button",(function(t){t.preventDefault();var e=$("#app"),n=e.hasClass("header");e.toggleClass("header"),n?($(".add-item").hide(),$(".item-edit").hide(),$("#app").removeClass("sidebar"),$("#sortable .tooltip").css("display",""),$("#sortable").sortable("disable")):($("#sortable .tooltip").css("display","none"),$("#sortable").sortable("enable"),setTimeout((function(){$(".add-item").fadeIn(),$(".item-edit").fadeIn()}),350))})).on("click","#add-item, #pin-item",(function(t){t.preventDefault();var e=$("#app");e.hasClass("sidebar");e.toggleClass("sidebar")})).on("click",".close-sidenav",(function(t){t.preventDefault(),$("#app").removeClass("sidebar")})).on("click","#test_config",(function(t){t.preventDefault();var e=$("#create input[name=url]").val(),i=$('#sapconfig input[name="config[override_url]"]').val();i.length&&""!=i&&(e=i);var s={};s.url=e,$(".config-item").each((function(t){var e=$(this).data("config");s[e]=$(this).val()})),s.id=$("form[data-item-id]").data("item-id"),s.password&&s.password===o&&(s.password=""),$.post(n+"test_config",{data:s},(function(t){alert(t)}))})),$("#pinlist").on("click","a",(function(t){t.preventDefault();var e=$(this),i=e.data("id"),o=e.data("tag");$.get(n+"items/pintoggle/"+i+"/true/"+o,(function(t){var n=$(t).filter("#sortable").html();$("#sortable").html(n),e.toggleClass("active")}))})),$("#itemform").on("submit",(function(t){var e=$('input[name="config[password]"]').first();e.length>0&&e.attr("value")===o&&e.attr("value","")}))}));var focusSearch=function(t){var e=document.querySelector('input[name="q"]');e&&(t.preventDefault(),e.focus())},openFirstNonHiddenItem=function(t){if(t.target===document.querySelector('input[name="q"]')){var e=document.querySelector('#sortable section.item-container:not([style="display: none;"]) a');"href"in e&&(t.preventDefault(),window.open(e.href))}},KEY_BINDINGS={"/":focusSearch,Enter:openFirstNonHiddenItem};document.addEventListener("keydown",(function(t){try{t.key in KEY_BINDINGS&&KEY_BINDINGS[t.key](t)}catch(t){}})); +function _createForOfIteratorHelper(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n.5;var o=this.colorGrid[e.toUpperCase()];this.updateCursor(o),this.setTexts(),this.setBackgrounds(),n||this.emitEvent("change",[e,t.hue,t.sat,t.lum])}},c.setTexts=function(){if(this.setTextElems)for(var t=0;t0&&s.attr("value",o)}$(".message-container").length&&setTimeout((function(){$(".message-container").fadeOut()}),3500),void 0!==document.hidden?(t="hidden",e="visibilitychange"):void 0!==document.msHidden?(t="msHidden",e="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange");var r=[],a=[],h=$(".livestats-container");h.length>0&&(void 0===document.addEventListener||void 0===t?console.log("This browser does not support visibilityChange"):document.addEventListener(e,(function(){document[t]?function(){var t,e=_createForOfIteratorHelper(r);try{for(e.s();!(t=e.n()).done;){var n=t.value;window.clearTimeout(n)}}catch(t){e.e(t)}finally{e.f()}}():function(){var t,e=_createForOfIteratorHelper(a);try{for(e.s();!(t=e.n()).done;)(0,t.value)()}catch(t){e.e(t)}finally{e.f()}}()}),!1),h.each((function(t){var e=$(this).data("id"),i=1==$(this).data("dataonly")?2e4:1e3,o=$(this),s=5e3,h=function a(){$.ajax({url:n+"get_stats/"+e,dataType:"json",success:function(t){o.html(t.html),"active"==t.status?s=i:s<3e4&&(s+=2e3)},complete:function(e){e.status>299||(r[t]=window.setTimeout(a,s))}})};a[t]=h,h()}))),$("#upload").change((function(){!function(t){if(t.files&&t.files[0]){var e=new FileReader;e.onload=function(t){$("#appimage img").attr("src",t.target.result)},e.readAsDataURL(t.files[0])}}(this)})),$("#sortable").sortable({stop:function(t,e){var i=$("#sortable").sortable("toArray",{attribute:"data-id"});$.post(n+"order",{order:i})}}),$("#sortable").sortable("disable"),$("#main").on("mouseenter","#sortable.ui-sortable-disabled .item",(function(){$(this).siblings(".tooltip").addClass("active"),$(".refresh",this).addClass("active")})).on("mouseleave",".item",(function(){$(this).siblings(".tooltip").removeClass("active"),$(".refresh",this).removeClass("active")})),$("#config-buttons").on("mouseenter","a",(function(){$(".tooltip",this).addClass("active")})).on("mouseleave","a",(function(){$(".tooltip",this).removeClass("active")})),$(".searchform > form").on("submit",(function(t){"tiles"===$("#search-container select[name=provider]").val()&&t.preventDefault()})),$("#search-container").on("input","input[name=q]",(function(){var t=this.value,e=$("#sortable").children(".item-container");"tiles"===$("#search-container select[name=provider]").val()&&t.length>0?(e.hide(),e.filter((function(){return $(this).data("name").toLowerCase().includes(t.toLowerCase())})).show()):e.show()})).on("change","select[name=provider]",(function(){var t=$("#sortable").children(".item-container");if("tiles"===$(this).val()){$("#search-container button").hide();var e=$("#search-container input[name=q]").val();e.length>0?(t.hide(),t.filter((function(){return $(this).data("name").toLowerCase().includes(e.toLowerCase())})).show()):t.show()}else $("#search-container button").show(),t.show()})),$("#app").on("click","#config-button",(function(t){t.preventDefault();var e=$("#app"),n=e.hasClass("header");e.toggleClass("header"),n?($(".add-item").hide(),$(".item-edit").hide(),$("#app").removeClass("sidebar"),$("#sortable .tooltip").css("display",""),$("#sortable").sortable("disable")):($("#sortable .tooltip").css("display","none"),$("#sortable").sortable("enable"),setTimeout((function(){$(".add-item").fadeIn(),$(".item-edit").fadeIn()}),350))})).on("click","#add-item, #pin-item",(function(t){t.preventDefault();var e=$("#app");e.hasClass("sidebar");e.toggleClass("sidebar")})).on("click",".close-sidenav",(function(t){t.preventDefault(),$("#app").removeClass("sidebar")})).on("click","#test_config",(function(t){t.preventDefault();var e=$("#create input[name=url]").val(),i=$('#sapconfig input[name="config[override_url]"]').val();i.length&&""!=i&&(e=i);var s={};s.url=e,$(".config-item").each((function(t){var e=$(this).data("config");s[e]=$(this).val()})),s.id=$("form[data-item-id]").data("item-id"),s.password&&s.password===o&&(s.password=""),$.post(n+"test_config",{data:s},(function(t){alert(t)}))})),$("#pinlist").on("click","a",(function(t){t.preventDefault();var e=$(this),i=e.data("id"),o=e.data("tag");$.get(n+"items/pintoggle/"+i+"/true/"+o,(function(t){var n=$(t).filter("#sortable").html();$("#sortable").html(n),e.toggleClass("active")}))})),$("#itemform").on("submit",(function(t){var e=$('input[name="config[password]"]').first();e.length>0&&e.attr("value")===o&&e.attr("value","")}))}));var focusSearch=function(t){var e=document.querySelector('input[name="q"]');e&&(t.preventDefault(),e.focus())},openFirstNonHiddenItem=function(t){if(t.target===document.querySelector('input[name="q"]')&&"tiles"===document.querySelector("#search-container select[name=provider]").value){var e=document.querySelector('#sortable section.item-container:not([style="display: none;"]) a');"href"in e&&(t.preventDefault(),window.open(e.href))}},KEY_BINDINGS={"/":focusSearch,Enter:openFirstNonHiddenItem};document.addEventListener("keydown",(function(t){try{t.key in KEY_BINDINGS&&KEY_BINDINGS[t.key](t)}catch(t){}})); diff --git a/public/mix-manifest.json b/public/mix-manifest.json index ee0caa05..e35cdb69 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { "/css/app.css": "/css/app.css?id=9a25947db63214edd4e6f459200dfa62", - "/js/app.js": "/js/app.js?id=6d4db31cf508e4b9c767ec2710c256ff" + "/js/app.js": "/js/app.js?id=b71fe417971ee1aaaaa84e3824221126" } diff --git a/resources/assets/js/keyBindings.js b/resources/assets/js/keyBindings.js index 1e8f29b6..a8afe6ad 100644 --- a/resources/assets/js/keyBindings.js +++ b/resources/assets/js/keyBindings.js @@ -11,6 +11,10 @@ const openFirstNonHiddenItem = event => { return; } + if (document.querySelector('#search-container select[name=provider]').value !== 'tiles') { + return; + } + const item = document.querySelector('#sortable section.item-container:not([style="display: none;"]) a'); if ('href' in item) { @@ -30,6 +34,5 @@ document.addEventListener('keydown', function (event) { KEY_BINDINGS[event.key](event); } } catch (e) { - } }); \ No newline at end of file