User:Vghfr/EasyTemplates/EasyUITest.js

/* //$.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.
 * WARNING: THIS SCRIPT IS FOR DEVELOPMENT PURPOSES ONLY

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])+" "); 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])+" "); 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; } ));*/