Alwaysup script

Add quck filter feature to AlwaysUp

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==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)));

})();