返回首頁 

Greasy Fork is available in English.

TSLibrary - Generic

A resource JS library file providing common useful functions to be used by other scripts

Устаревшая версия за 23.04.2019. Перейдите к последней версии.

Этот скрипт недоступен для установки пользователем. Он является библиотекой, которая подключается к другим скриптам мета-ключом // @require https://update.greasyfork.org/scripts/19968/691965/TSLibrary%20-%20Generic.js

Автор
TimidScript
Версия
1.0.24
Создано
25.05.2016
Обновлено
23.04.2019
Размер
18,5 КБ
Лицензия
https://github.com/TimidScript/UserScripts/blob/master/license.txt

Sample useful functionality that are used in some of my scripts. Some of the functions listed below. Look inside script for details.

TSL object is a copy of TimidScriptLibraryTSL = TimidScriptLibrary

NOTE: If doc parameter is undefined it uses the current document.

Document Functions

Add CSS styles/JS Script to document header. Document can be left empty.TSL.addStyle(id, CSS, doc)TSL.addScript(id, text, doc)

Returns the thickness of the scrollbarTSL.getScrollBarThickness()

Node Functions

Node className functions. All three functions can handle multiple class names separated by spacesTSL.addClass(node, name)TSL.removeClass(node, name)TSL.hasClass(node, name)

Remove node from document. Accepts id or node objectTSL.removeNode(node, doc)

Creates document element. Default doc value is the document.TSL.createElement(tag, attributes, doc)

Creates document element using html code. Default doc value is the document.TSL.createElementHTML(html, doc)

Checks if mouse event is within an elements client areaTSL.isMouseEventInClientArea(event, element)

Gets the position of the element within the documentTSL.getAbsolutePosition(element)

String & Regex Functions

String padding (prototype)String.lpad(chr, Total_length)String.rpad(chr, Total_length)

Replace NTFS illegal characters alternativesTSL.replaceNTFSIllegals(str)TSL.ALTNTFSChars = [[">", ">"],["<", "<"],[":", ":"],['"', """],["/", "/"],["\\", "\"],["?", "?"],["*", "*"]];

Escape regexp stringTSL.escapeRegExp(str)