From 2836dadf1a398c0763ae2556fe3d30f7bb3dcba6 Mon Sep 17 00:00:00 2001 From: Attila Kerekes Date: Wed, 23 Nov 2022 18:14:31 +0100 Subject: [PATCH] fix: Disable saerch submit when tile search is active --- public/js/app.js | 2 +- public/mix-manifest.json | 2 +- resources/assets/js/app.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 2c635664..4fc72149 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1 +1 @@ -function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return-1==i.indexOf(e)&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return-1!=i&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=0,o=n[i];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),o=n[i+=r?0:1]}return this}},t}),function(t,e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(n){return e(t,n)}):"object"==("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e(t,require("ev-emitter")):t.Unipointer=e(t,t.EvEmitter)}(window,function(t,e){function n(){}var i=n.prototype=Object.create(e.prototype);i.bindStartEvent=function(t){this._bindStartEvent(t,!0)},i.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},i._bindStartEvent=function(e,n){var i=(n=void 0===n||!!n)?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?e[i]("pointerdown",this):t.navigator.msPointerEnabled?e[i]("MSPointerDown",this):(e[i]("mousedown",this),e[i]("touchstart",this))},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.getTouch=function(t){for(var e=0;e.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])}},h.setTexts=function(){if(this.setTextElems)for(var t=0;t0&&o.attr("value","*****")}$(".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 s=[],r=[],a=$(".livestats-container");a.length>0&&(void 0===document.addEventListener||void 0===t?console.log("This browser does not support visibilityChange"):document.addEventListener(e,function(){document[t]?function(){for(var t=0,e=s;t299||(s[t]=window.setTimeout(r,a))}})};r[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")}),$("#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 o={};o.url=e,$(".config-item").each(function(t){var e=$(this).data("config");o[e]=$(this).val()}),o.id=$("form[data-item-id]").data("item-id"),o.password&&"*****"===o.password&&(o.password=""),$.post(n+"test_config",{data:o},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")&&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 _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return-1==i.indexOf(e)&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return-1!=i&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=0,o=n[i];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),o=n[i+=r?0:1]}return this}},t}),function(t,e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(n){return e(t,n)}):"object"==("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e(t,require("ev-emitter")):t.Unipointer=e(t,t.EvEmitter)}(window,function(t,e){function n(){}var i=n.prototype=Object.create(e.prototype);i.bindStartEvent=function(t){this._bindStartEvent(t,!0)},i.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},i._bindStartEvent=function(e,n){var i=(n=void 0===n||!!n)?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?e[i]("pointerdown",this):t.navigator.msPointerEnabled?e[i]("MSPointerDown",this):(e[i]("mousedown",this),e[i]("touchstart",this))},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.getTouch=function(t){for(var e=0;e.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])}},h.setTexts=function(){if(this.setTextElems)for(var t=0;t0&&o.attr("value","*****")}$(".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 s=[],r=[],a=$(".livestats-container");a.length>0&&(void 0===document.addEventListener||void 0===t?console.log("This browser does not support visibilityChange"):document.addEventListener(e,function(){document[t]?function(){for(var t=0,e=s;t299||(s[t]=window.setTimeout(r,a))}})};r[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 o={};o.url=e,$(".config-item").each(function(t){var e=$(this).data("config");o[e]=$(this).val()}),o.id=$("form[data-item-id]").data("item-id"),o.password&&"*****"===o.password&&(o.password=""),$.post(n+"test_config",{data:o},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")&&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){}}); diff --git a/public/mix-manifest.json b/public/mix-manifest.json index ccea868f..06d6ca05 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { "/css/app.css": "/css/app.css?id=cdbee4d3b17bce4786a2", - "/js/app.js": "/js/app.js?id=c15b7d6018358ee45de9" + "/js/app.js": "/js/app.js?id=bf17db5adf00db2c59ef" } diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 8841b25f..5c97b618 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -158,6 +158,11 @@ $.when( $.ready ).then(function() { $('.tooltip', this).removeClass('active'); }) + $('.searchform > form').on('submit', function (event) { + if ($('#search-container select[name=provider]').val() === 'tiles') { + event.preventDefault(); + } + }); $('#search-container').on('input', 'input[name=q]', function () { const search = this.value