The string to copy.
A promise that resolves when the clipboard has been updated.
Returns the current URL.
The current URL.
Detects whether the page is being viewed on a mobile device or a desktop.
'Mobile' or 'Desktop'
Detects the preferred language of the current user.
The default language to use if none is found.
The language preferred by the user or the default language if none is found.
Gets the protocol being used on the current page.
Gets the currently selected text.
The currently selected text.
Creates an object containing the parameters of the current URL.
The URL to parse.
An object containing the parameters of the current URL.
Makes a DELETE request to the passed URL.
URL to send the DELETE request to.
Callback to handle the response.
Callback to handle an error.
Makes a GET
request to the passed URL.
The URL to make the request to.
The callback to invoke when the request completes
The callback to invoke if the request fails
Makes a POST
request to the passed URL.
URL to send the request to.
Data to send.
Callback to invoke when the request completes.
Callback to invoke when an error occurs.
Makes a PUT
request to the passed URL.
The URL to make the request to.
The data to send as the request body.
The callback to invoke when the request completes.
The callback to invoke when an error occurs.
Redirects the page to HTTPS if it's currently in HTTP.
Checks if localStorage
is enabled.
Checks if sessionStorage
is enabled.
Checks if the user color scheme preference is dark
.
true
if the user color scheme preference is dark
.
Checks if the user color scheme preference is light
.
true
if the user color scheme preference is light
.
Redirects to a specified URL.
The URL to redirect to.
Whether to attempt to create a link to the URL.
Runs a function in a separate thread by using a Web Worker, allowing long running functions to not block the UI.
The function to run.
A promise which resolves to the return value of the function.
Device supports touch events
boolean
Creates a hash for a value using the SHA-256 algorithm. Returns a promise.
The value to hash.
A promise that resolves to the hash of the value.
Adds a class to an HTML element.
The element to add the class to.
The class to add.
The element with the class added.
Attaches an event listener to all the provided targets.
The targets to add the event listener to.
The type of event.
The listener.
The options.
Adds multiple event listeners with the same handler to an element.
Element to add listeners to.
Types of events to add.
Event listener.
Event listener options.
Adds the provided styles to the given HTML element.
The element to add styles to.
The styles to add.
Converts the given array elements into <li>
tags and appends them to the list of the given id.
The array of elements to be converted.
The id of the list to which the elements should be appended.
Checks if the bottom of the page is visible.
Copies a string to the clipboard. Only works as a result of user action (i.e. inside a click event listener).
The string to copy.
Creates an element from a string (without appending it to the document). If the given string contains multiple elements, only the first one will be returned.
The string to create the element from.
The created element, only the first one will be returned.
Checks if the parent
element contains the child
element.
The parent element.
The child element.
true
if the parent
element contains the child
element, otherwise false
.
Checks if the given element is focused.
Element to check.
True if the element is focused.
Checks if the element specified is visible in the viewport.
Element to check.
Omit the second argument to determine if the element is entirely visible, or specify true to determine if it is partially visible.
True if the element is visible in the viewport.
Finds the anchor node closest to the given node
, if any.
The node to search from.
The anchor node if found, or null
if not.
Finds the closest matching node starting at the given node
.
Starting node
Selector to match
Closest node or null
Encodes a set of form elements as an object
.
The form element
An object representing the form values.
Opens or closes an element in fullscreen mode.
The mode to open the element in.
The element to open in fullscreen mode.
Returns all the ancestors of an element from the document root to the given element.
The element to get the ancestors of.
The ancestors of the element.
Returns an array of HTML elements whose width is larger than that of the viewport's.
Fetches all images from within an element and puts them into an array.
Element to search for images.
Whether to include duplicate images or not.
An array of all images in the element.
Finds all the ancestors of an element up until the element matched by the specified selector.
Element to start from
Stop at this element
The matched elements
Returns the scroll position of the current page.
Optional element to measure.
The scroll position of the current page.
Returns an array containing all the siblings of the given element.
The element to get all the siblings from.
An array of all the element's siblings.
Retrieves the value of a CSS rule for the specified element.
The element to get the style for.
The name of the CSS rule.
The value of the CSS rule.
Finds the distance from a given element to the top of the document.
Element to find the distance from.
The distance from the top of the document to the element.
Checks if the given element has the specified class.
The element to check.
The class to check for.
true
if the element has the class, false
otherwise.
Hides all the elements specified.
The elements to hide.
Injects the given CSS code into the current document
The CSS code to inject
The created style element
Inserts an HTML string after the end of the specified element.
The element to insert the string after.
The HTML string to insert.
The element.
Inserts an HTML string before the start of the specified element.
The element to insert the string before.
The HTML string to insert.
The element.
Checks if the browser tab of the page is focused.
True if the browser tab is focused, false otherwise.
Adds an event listener to an element that will only run the callback the first time the event is triggered.
The element to add the event listener to.
The event to listen for.
The callback to run when the event is triggered.
Adds an event listener to an element that will only run the callback the first time the event is triggered.
The element to add the event listener to.
The event to listen for.
The callback to run when the event is triggered.
Converts a NodeList
to an array.
the NodeList
to convert
an array of Node
s
Creates a new MutationObserver
and runs the provided callback for each mutation on the specified element.
Element to observe.
Callback to run for each mutation.
Options for the observer.
The new MutationObserver
instance.
Removes an event listener from an element.
The element to remove the event listener from.
The event name.
Removes an event listener from an element.
The element to remove the event listener from.
The event name.
Adds an event listener to an element with the ability to use event delegation.
The element to add the event listener to.
The event to listen for.
The function to run when the event is triggered.
The options to use when binding the event listener.
The function to remove the event listener from the element.
Adds an event listener to an element with the ability to use event delegation.
The element to add the event listener to.
The event to listen for.
The function to run when the event is triggered.
The options to use when binding the event listener.
The function to remove the event listener from the element.
Runs the callback whenever the user clicks outside of the specified element.
The element to listen to for clicks.
The callback to call when the user clicks.
Prefixes a CSS property based on the current browser.
The unprefixed property name.
The prefixed property name.
Removes a class from an HTML element.
The HTML element.
The name of the class to remove.
Removes an element from the DOM.
The element to remove.
The element that was removed.
Detaches an event listener from all the provided targets.
The targets from which to remove the event listener.
The type of event.
The listener.
The options.
Renders the given DOM tree in the specified DOM element.
The DOM element to render into.
Smooth-scrolls to the top of the page.
Encodes a set of form elements as a query string.
The form elements to serialize.
A query string representing the form.
Sets the value of a CSS rule for the specified HTML element.
The element to set the style for.
The name of the CSS rule.
The value to set the rule to.
Shows all the elements specified.
The elements to show.
Smoothly scrolls the element on which it's called into the visible area of the browser window.
The element to scroll into the visible area of the browser window.
Toggles a class for an HTML element.
The target element.
The class to toggle.
The element.
Triggers a specific event on a given element, optionally passing custom data.
Element to trigger the event on.
Name of the event to trigger.
Optional data to pass as detail
to the event.
true
if the event was successfully triggered.
Generates a UUID in a browser.
返回字符串的长度(以字节为单位)
要计算的字符串
字符串的长度(以字节为单位)
Takes a number and returns it in the specified currency formatting.
the number to format
the currency to use
the language format to use
the formatted currency string
Copies a string to the clipboard, returning a promise that resolves when the clipboard's contents have been updated.
0.1.5