Functions
getFavicon()
Retrieves the current favicon URL of the document.
Example:
const faviconUrl = cloak.getFavicon();
console.log(faviconUrl); // Outputs the current favicon URL
setFavicon(url)
Sets the favicon of the document to the provided URL.
Example:
cloak.setFavicon("https://example.com/new-favicon.ico");
getTitle()
Returns the current title of the document.
Example:
const title = cloak.getTitle();
console.log(title); // Outputs the current document title
setTitle(title)
Sets the title of the document to the provided string.
Example:
cloak.setTitle("New Document Title");
setCloak(title, url)
Sets both the title and favicon of the document and saves them in
localStorage
.
Example:
cloak.setCloak("My Awesome Page", "https://example.com/favicon.ico");
aboutBlank(url, newUrl)
Opens the current tab in an about:blank
iframe. If no
URL is provided, it defaults to
https://www.google.com/search?q=how+many+seconds+in+a+day
.
Example:
cloak.aboutBlank("https://wikipedia.org");
// or you can change the cloaked tab url
cloak.aboutBlank("https://wikipedia.org", "https://lunaar.org");
reset()
Resets the cloak to the default document title.
Example:
// Refreshes the page by default
cloak.reset();
// You can also provide a boolean to prevent refreshing
cloak.reset(false);
getCloak()
Retrieves the active cloak from localStorage
and
returns the title and icon in an array format.
Example:
const [title, icon] = getCloak(); // Returns [title, icon]
console.log(title); // Access the title
console.log(icon); // Access the icon
Note: The getCloak()
function will return an array with
the title and icon. Ensure you handle both values correctly.