GoodsugaGeneralLibrary

A handy library to work with site automation

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GoodsugaGeneralLibrary
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  A handy library to work with site automation
// @author       Goodsuga
// @match        https://www.tampermonkey.net/
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @grant        none
// ==/UserScript==


function TypeTextIntoInputField(querry, value)
{
    $(querry).focus().click();
    $(querry).val(value);
    $(querry).keydown();
    $(querry).keyup();
}

function ClickElement(querry)
{
    $(querry).click();
}

function SetStorage(item, value)
{
    window.localStorage.setItem(item, value);
}

function GetStorage(item)
{
    return window.localStorage.getItem(item);
}

function CompareStorage(item, compareToValue, isTypeImportant)
{
    if(isTypeImportant) {
        return window.localStorage.getItem(item) === compareToValue; }
    else {
        return window.localStorage.getItem(item) == compareToValue; }
}

function NavigateToUrl(url)
{
    window.location.href = url;
}

function ForceReloadPage()
{
    window.location.reload(true);
}





(function() {
    'use strict';

    // Your code here...
})();