method to universally write current tab

This commit is contained in:
buzz-lightsnack-2007 2024-05-02 11:01:00 +08:00
parent c112c0bfcf
commit ca1b5e152c

27
scripts/data/pointer.js Normal file
View file

@ -0,0 +1,27 @@
/* pointer.js
Change the currently selected data to be viewed by the popup.
*/
import {global} from "/scripts/secretariat.js";
class pointer {
/*
Select a URL to view.
*/
static select(URL) {
const clean = (URL) => {
// Remove the protocol from the URL.
return((URL.replace(/(^\w+:|^)\/\//, ``).split(`?`))[0]);
}
try {
URL = (!URL) ? window.location.href : ((URL && (typeof URL).includes(`str`)) ? clean(URL) : null);
} catch(err) {}
// Get the last edited site.
return(global.write([`last`, `URL`], this.URL, -1));
}
}
export {pointer as default};