tweaks/fixes for popup search link

* use a less specific category if the inline search wasn't used yet
* set a href in html to prevent transitions during init
This commit is contained in:
tophf 2020-11-05 22:45:22 +03:00
parent 635fc705f9
commit aac0f476b2
2 changed files with 5 additions and 3 deletions

View File

@ -222,7 +222,8 @@
</div>
<div class="main-controls">
<div id="find-styles">
<a id="find-styles-link" i18n-text="findStyles" i18n-title="findStylesForSite"></a>
<a id="find-styles-link" i18n-text="findStyles" i18n-title="findStylesForSite"
href="https://to.be.replaced.on.click/" target="_blank"></a>
<span id="find-styles-inline-group">
<label i18n-title="findStylesInlineTooltip">
<input id="popup.findStylesInline" class="checker" type="checkbox">

View File

@ -44,8 +44,6 @@ window.addEventListener('showStyles:done', () => {
let totalPages = 1;
let ready;
calcCategory();
const $class = sel => (sel instanceof Node ? sel : $(sel)).classList;
const show = sel => $class(sel).remove('hidden');
const hide = sel => $class(sel).add('hidden');
@ -54,6 +52,8 @@ window.addEventListener('showStyles:done', () => {
href: URLS.usoArchive,
onclick(event) {
if (!prefs.get('popup.findStylesInline') || dom.container) {
// use a less specific category if the inline search wasn't used yet
if (!category) calcCategory({retry: 1});
this.search = new URLSearchParams({category, search: $('#search-query').value});
handleEvent.openURLandHide.call(this, event);
return;
@ -62,6 +62,7 @@ window.addEventListener('showStyles:done', () => {
this.textContent = this.title;
this.title = '';
init();
calcCategory();
ready = start();
},
});