-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.js
28 lines (26 loc) · 1.22 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if (typeof window.toolbar !== "undefined") {
let PAGE_TITLE = JSINFO.id.replace(JSINFO.namespace,"").replaceAll("_"," ");
if (PAGE_TITLE.startsWith(":")) {
PAGE_TITLE = PAGE_TITLE.replace(":","");
}
const date = new Date();
let CURRENT_DATE = date.toISOString().split("T")[0];
let CURRENTDATE = CURRENT_DATE.replaceAll("-","");
let CURRENT_DATE_UNDERSCORE = CURRENT_DATE.replaceAll("-","_");
let CURRENT_DATE_DASH = CURRENT_DATE.replaceAll("-","/");
let CURRENT_DATE_LOCALE = date.toLocaleDateString();
for(but of toolbar) {
if(but.id && but.id.startsWith("Snippeter")) {
for(snippets of but.list){
let text_content = snippets.open;
text_content = text_content.replace("<PAGE_TITLE>",PAGE_TITLE);
text_content = text_content.replaceAll("<CURRENT_DATE>",CURRENT_DATE);
text_content = text_content.replaceAll("<CURRENTDATE>",CURRENTDATE);
text_content = text_content.replaceAll("<CURRENT_DATE_UNDERSCORE>",CURRENT_DATE_UNDERSCORE);
text_content = text_content.replaceAll("<CURRENT_DATE_DASH>",CURRENT_DATE_DASH);
text_content = text_content.replaceAll("<CURRENT_DATE_LOCALE>",CURRENT_DATE_LOCALE);
snippets.open = text_content;
}
}
}
}