method to universally write current tab
This commit is contained in:
parent
c112c0bfcf
commit
ca1b5e152c
1 changed files with 27 additions and 0 deletions
27
scripts/data/pointer.js
Normal file
27
scripts/data/pointer.js
Normal 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};
|
Loading…
Add table
Add a link
Reference in a new issue