User:Theleekycauldron/Scripts/PSHAW/dependencies/Prep.js: Difference between revisions

Content deleted Content added
test
Restored revision 1303816471 by Theleekycauldron (talk): Test over
 
(6 intermediate revisions by the same user not shown)
Line 26:
prep.loadHooks();
prep.loadFiles();
prep.loadDYKbotdo();
}
return prep
Line 38 ⟶ 39:
for (let c in creditstext){
creditstext[c] = new Credit(creditstext[c]);
creditstext[c].used = creditstext[c].articleuser == "ExampleEditor";
}
for (var h=0; h<hooktext.length; h++){
let hook = new Hook(h,hooktext[h].slice(2),[])
this.hooks.push(hook)
console.log(hook)
if (hook.articles.length > 0){
console.log(hook)
for (let credit of creditstext){
if (credit.used){
continue;
}
console.log(credit)
console.log(hook.articles.includes(credit.article))
if (hook.articles.includes(credit.article)){
console.log("match!")
Line 74 ⟶ 79:
let filetext = this.content.match(/\{\{main page image\/DYK.*?}}/g);
this.file = new File(filetext[0])
}
loadDYKbotdo(){
let botdotext = this.content.match(/\{\{DYKbotdo\|(.*)\}\}/)
if (botdotext != null) {
this.botdo = botdotext[1]
} else {
if (this.title.includes("/Queue/")){
this.botdo = "~~~"
} else {
this.botdo = null
}
}
}
Line 108 ⟶ 126:
assemble(){
let res = []
res.push(`${this.title.includes("Queue")?"{{DYKbotdo|~~~"+this.botdo+"}}":""}
<noinclude>{{Did you know/Clear/header}}
==Hooks==
Line 142 ⟶ 160:
res.push(credit.content)
}
}
for (let credit of this.lost_credits){
res.push(credit.content)
}
res.push(`</div>