Search Bar on Palettes Panel

Adds a search bar to the palettes panel.

安裝腳本?
作者推薦腳本

您可能也會喜歡 Bypass Stencil Sticker's Size Limit

安裝腳本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Search Bar on Palettes Panel
// @namespace    Vholran.SearchBarOnPalettesPanel
// @version      1.0.2
// @description  Adds a search bar to the palettes panel.
// @author       Vholran (https://greasyfork.org/en/users/841616)
// @match        https://*.drawaria.online/*
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @icon         https://www.google.com/s2/favicons?domain=drawaria.online
// @grant        none
// ==/UserScript==

(($, undefined) => {
    $(() => {
        $('#palettechooser').find('.modal-body').before(`
  <div style="display: flex; flex-wrap: wrap;">
    <input id="searchPalettes" class="form-control" placeholder="Search Palettes" style="flex-grow: 1; font-size: calc(100% + 0.15rem); margin: 0.95rem; padding: 1.3rem 1rem; width: 0;" type="text">
  </div>
`);

        $('body').on('input', '#searchPalettes', e => {
            const searchValue = e.target.value.toLowerCase();
            $('#palettechooser-list').children().hide();
            $('.palettechooser-rowname').filter((index, element) => {
                return $(element).text().toLowerCase().includes(searchValue);
            }).parent().show();
        });
        $('body').on('click', '.palettechooser-row', () => {
            if($('.selmode-palettechooser-list').length){
                $('.drawcontrols-button.drawcontrols-color.drawcontrols-arrow').click();
                $('.pcr-app').removeClass('visible');
            }
        });
    });
})(window.jQuery.noConflict(true));