GoodsugaGeneralLibrary

A handy library to work with site automation

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

You will need to install an extension such as Tampermonkey 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.

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

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

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         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...
})();