User:Vghfr/EasyTemplates/EasyUITest.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Vghfr/EasyTemplates/EasyUITest. |
/*
* WARNING: THIS SCRIPT IS FOR DEVELOPMENT PURPOSES ONLY
*/
//$.getJSON('https://en.wikipedia.org/wiki/User:Vghfr/EasyTemplates/Templates.json?action=raw&ctype=application/json');
//Quick and dirty solution to storing UI elements, not at all efficient. Eventually this will all be stored in json and loaded from there.
let citPlainText = [
"Need more citations",
"Multiple issues (use in conjunction with other templates)",
"Citation check",
"Excessive citations",
"More medical citations needed",
"More science citations needed",
"Only one source",
"Original research",
"Heavily relies on primary research",
"Heavily relies on religious works as primary reasearch",
"Self published work",
"Source is closely related to the subject (possible COI)",
"Article is unreferenced",
"Sources are unreliable",
"The source is user generated, (ie, is not published by authors or formal publishers)",
"Citations are broken",
"Article uses bare URLs (Citations without any meaningful information)"
];
let citLength = citPlainText.length;
let step = 0;
/*function loadContent(){
while(step < citLength){
caveat.appendChild(document.createTextNode(citPlainText[step])+"<br>");
step++;
}
}*/
function selectionWindow(){
var body = document.getElementsByTagName('body')[0];
var windiv = document.createElement('div');
windiv.setAttribute('style','font-size:120%;position:fixed;top:0;left:0;width:50%;height:70%;border-style:solid;border:2px solid black;z-index:.5;background-color:#ffffff;padding:0px;margin:100px;display:block;overflow:auto; border: 2px solid red;border-radius: 5px;resize:both;');
windiv.setAttribute('id','selectionWindow');
var whead = document.createElement('h2');
whead.setAttribute('style','border-bottom:1px solid black;text-align:center;margin:0;');
var kill = document.createElement('a');
kill.setAttribute('style','float:right;font-size:66%');
kill.setAttribute('href','javascript:closeSelection();');
kill.appendChild(document.createTextNode('Close'));
whead.appendChild(kill);
whead.appendChild(document.createTextNode('Template Selection Dialog'));
var caveat = document.createElement('div');
caveat.setAttribute('style','text-align:center;margin:8px')
// caveat.appendChild(document.createTextNode(citPlainText[0])+"<br>");
while(step < citLength){
caveat.appendChild(document.createTextNode(citPlainText[step]));
caveat.appendChild(document.createElement('br'));
step++;
}
// caveat.appendChild();
windiv.appendChild(caveat);
windiv.appendChild(whead);
windiv.appendChild(caveat);
body.appendChild(windiv);
}
function closeSelection() {
var body = document.getElementsByTagName('body')[0];
body.removeChild(document.getElementById('selectionWindow'));
}
mw.util.addPortlet('p-easyTJSON', 'EasyTemplates (Test Version)', '#p-cactions');
mw.util.addPortletLink('p-easyTJSON', 'javascript:selectionWindow();', 'UITest','test');
/*$(document.getElementById('test').click( function ( event ) {
event.preventDefault();
selectionWindow();
} ));*/