Alwaysup script

Add quck filter feature to AlwaysUp

Verze ze dne 07. 06. 2018. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Alwaysup script
// @version      1.0.1
// @description  Add quck filter feature to AlwaysUp
// @author       Dmitry K
// @namespace    http://versonix.com
// @include     /^https?://.*?:8585/application.*$/
// @require      https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/UserScript==

(function() {
    'use strict';
    // add quicksort
    $('<td align=right><label>Quick Filter: <input type=text placeholder=Filter... list=quickFilterList id=quickFilter><button id=quickFilterReset>x</button><datalist id=quickFilterList></datalist></label></td>').appendTo($("body>p>table[border=1] table[cellpadding=4] tr"));
    const mainTable = $("body>p>table[border=1] table[cellpadding=6] tr:gt(0)");
    let dataList = $("#quickFilterList");
    $("#quickFilter")
    .val(localStorage.getItem("quickFilter"))
    .on('input', (e) => {
        localStorage.setItem("quickFilter", e.target.value);
        let filter = e.target.value.toLowerCase();
        mainTable.each(
            (i, e) => {
                let el = $(e);
                el.toggle(el.text().toLowerCase().indexOf(filter) >= 0);
            }
        )
    })
    .trigger("input").focus().select();
    $("#quickFilterReset").on("click", e => $("#quickFilter").val("").trigger("input"))
    let words = new Set(mainTable.text().split(/[\W+\s]+/).map(word=>word.toLowerCase()).filter(word => word.length>2 && /^[a-zA-Z]/.test(word)).sort()).forEach(word => dataList.append($('<option></option>').attr("value", word)));

})();