Skip to content

Instantly share code, notes, and snippets.

@LatinSuD
Last active January 23, 2025 09:47
Show Gist options
  • Select an option

  • Save LatinSuD/b86280e571ce7fb22b0e2808a0c99ab0 to your computer and use it in GitHub Desktop.

Select an option

Save LatinSuD/b86280e571ce7fb22b0e2808a0c99ab0 to your computer and use it in GitHub Desktop.

Revisions

  1. LatinSuD revised this gist Jan 23, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ Please edit the "@match" line above to match your URL

    if (b2) {

    b2.value=location.href.replace(/[^?]*\?search=/,"")
    b2.value = new URLSearchParams(window.location.search).get('search');
    console.log("Lanzando busqueda " + b2.value)
    b2.dispatchEvent(new KeyboardEvent('input',{'key':'a'}));
    clearInterval(inter);
  2. LatinSuD created this gist Sep 9, 2021.
    41 changes: 41 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    // ==UserScript==
    // @name Wiki.js Search
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @match https://mydomain.com/?search=*
    // @grant none
    // @run-at document-idle
    // ==/UserScript==

    /*****

    Please edit the "@match" line above to match your URL

    *****/

    (function() {
    'use strict';
    function querySelectorIncludesText (selector, text){
    return Array.from(document.querySelectorAll(selector))
    .find(el => el.textContent.includes(text));
    }

    var inter=setInterval(function() {
    var b=querySelectorIncludesText('LABEL','Buscar...');
    if (b) {
    var b2=document.getElementById(b.getAttribute('for'))

    if (b2) {

    b2.value=location.href.replace(/[^?]*\?search=/,"")
    console.log("Lanzando busqueda " + b2.value)
    b2.dispatchEvent(new KeyboardEvent('input',{'key':'a'}));
    clearInterval(inter);
    }
    }

    }, 50)

    })();