User:AndyZ/monobook.js/footnotehelper.js

// //create array refA, whose contents are the parameter names for var refA = new Array refA[0]='last' refA[1]='first' refA[2]='authorlink' refA[3]='date' refA[4]='url' refA[5]='title' refA[6]='format' refA[7]='work' refA[8]='pages' refA[9]='publisher' refA[10]='language' refA[11]='accessdate'

//function generates the footnote function createFootnote{ for(i=0;i<12;i++){ //for loop that runs through each text box and sees if there is content if(document.getElementById("t"+i).value!=""){ document.refForm.refOutput.value+="|"+refA[i]+"="+document.getElementById("t"+i).value } } //ending braces document.refForm.refOutput.value+="\}\} " }

//create array refB, whose contents are the parameter names for var refB = new Array refB[0]='last' refB[1]='first' refB[2]='authorlink' refB[3]='year' refB[4]='url' refB[5]='title' refB[6]='id' refB[7]='location' refB[8]='pages' refB[9]='publisher' refB[10]='language' refB[11]='accessdate' refB[12]= 'chapter'

//function generates the footnote function createFootnote2{ if(document.refFormB.refOutput.value!=" " }

//hides refWindow layer, shows button for maxing function hide1{ document.getElementById('refWindow').style.visibility="hidden" document.getElementById('tab1').style.visibility="hidden" document.getElementById('tab2').style.visibility="hidden" document.getElementById('maxbutton').style.visibility="visible" }

//shows refWindow layer, hides button for maxing function show1{ document.getElementById('refWindow').style.visibility="visible" document.getElementById('tab1').style.visibility="visible" document.getElementById('tab2').style.visibility="visible" document.getElementById('maxbutton').style.visibility="hidden" //mode1="web"

//tab appearances change: document.getElementById('tab1').style.background="#ff5555" document.getElementById('tab2').style.background="#55ff55" document.getElementById('tab1').style.borderBottom="0px solid #000000" document.getElementById('tab1').style.zIndex="21" document.getElementById('tab2').style.zIndex="19" document.getElementById('tab2').style.borderBottom="1px solid #000000" }

//hides refWindow2 layer, shows button for maxing function hide2{ document.getElementById('refWindow2').style.visibility="hidden" document.getElementById('tab1').style.visibility="hidden" document.getElementById('tab2').style.visibility="hidden" document.getElementById('maxbutton2').style.visibility="visible" }

//shows refWindow2 layer, hides button for maxing function show2{ document.getElementById('refWindow2').style.visibility="visible" document.getElementById('refWindow').style.visibility="hidden" document.getElementById('tab1').style.visibility="visible" document.getElementById('tab2').style.visibility="visible" document.getElementById('maxbutton').style.visibility="hidden" //mode1="book"

//tab appearances change: document.getElementById('tab1').style.background="#55ff55" document.getElementById('tab2').style.background="#ff5555" document.getElementById('tab2').style.borderBottom="0px solid #000000" document.getElementById('tab2').style.zIndex="21" document.getElementById('tab1').style.zIndex="19" document.getElementById('tab1').style.borderBottom="1px solid #000000" }

//to show the correct window function show3(theType){ if(theType.substring(0,3)=="web"){ document.getElementById('refWindow').style.visibility="visible" document.getElementById('tab1').style.visibility="visible" document.getElementById('tab2').style.visibility="visible" document.getElementById('maxbutton').style.visibility="hidden" } if(theType.substring(0,4)=="book"){ document.getElementById('refWindow').style.visibility="visible" document.getElementById('tab1').style.visibility="visible" document.getElementById('tab2').style.visibility="visible" document.getElementById('maxbutton2').style.visibility="hidden" } }

//to hide only window, not tabs function hide3(theP){ if(theP=="web"){document.getElementById('refWindow').style.visibility="hidden"} if(theP=="book"){document.getElementById('refWindow2').style.visibility="hidden"} }

//creates pop-up windows function popWindow(theThing){ if(theThing!="help"){theContent="  "+theThing+"  "} else{theContent="  "+theThing+"  "}

if(theThing=="last") {theContent+="Last name of author"} if(theThing=="first") {theContent+="First name of author"} if(theThing=="authorlink") {theContent+="Wikilink to appropriate Wikipedia article (no brackets)"} if(theThing=="date") {theContent+="Date of access (please wikilink). Can be in ISO 8601 YYYY-MM-DD format or other formats."} if(theThing=="url") {theContent+="URL of web reference"} if(theThing=="title") {theContent+="Title of web page"} if(theThing=="format") {theContent+="Format (pdf, doc, etc.). If it is not included, it is assumed that it is HTML."} if(theThing=="work") {theContent+="If the site is part of a larger work, provide name of larger work"} if(theThing=="pages") {theContent+="The page numbers used"} if(theThing=="publisher") {theContent+="Publisher, if there is one"} if(theThing=="language") {theContent+="Language the page is in"} if(theThing=="accessdate") {theContent+="The date of access in ISO 8601 YYYY-MM-DD format (do not wikilink)"} if(theThing=="help"){ theContent+=" Help " theContent+=" What are references and footnotes?  References are the sources used in the creation of articles. Per WP:NOT, no articles should contain no original research. All articles should be sourced to guarantee that the articles are accurate. References are located in a single section at the end of an article; footnotes are dispersed throughout the articles, and upon clicking them it drags the reader to the source used." theContent+=" Do I need footnotes?  Preferably, yes. WP:WIAFA requires them for all featured articles; to establish the accuracy of articles, however, all articles should have them." theContent+=" How I created a footnote?  That is what this is for. All it actually does is simplify the process of flicking between pages to find the parameters of Template:Cite web and other relevant templates; if you know all of the parameters by heart, there really is not much point to this.  At the bottom of the page, under a ==Notes== section (below the ==See also==, but above the ==External links== per WP:GTL), add: <references/ > (use div tags with the class set equal to 'references-small' around this preferably).  In the text, add the footnotes created by the JS script where the inline citations are required. Just copy them from the text area and paste them in the relevant part of the article." theContent+=" Can I make more than one footnote point to the same information?  Yes, use < ref name=THENAME>footnote information< /ref> for each footnote that you wish to point to the same information." theContent+=" What relevant Wikipedia: namespace guidelines are there?  WP:FOOTNOTE, WP:CITE, and WP:V are relevant guidelines." theContent+=" Can you repeat that all again?  Uhh... no ;)." } theContent+="  "

winName = window.open("http://en.wikipedia.org/","Help") winName.document.write(theContent) winName.document.close }

//creates pop-up windows function popWindow2(theThing){ if(theThing!="help"){theContent="  "+theThing+"  "} else{theContent="  "+theThing+"  <body onload='resizeTo(800,800)'>"}

if(theThing=="last") {theContent+="Last name of author"} if(theThing=="first") {theContent+="First name of author"} if(theThing=="authorlink") {theContent+="Wikilink to appropriate Wikipedia article (no brackets)"} if(theThing=="date") {theContent+="Date of publication (do not wikilink). Should be in ISO 8601 YYYY-MM-DD format."} if(theThing=="url") {theContent+="URL of book, it is online"} if(theThing=="title") {theContent+="Title of book"} if(theThing=="id") {theContent+="Id, as in ISBN number."} if(theThing=="location") {theContent+="Place of publication"} if(theThing=="pages") {theContent+="The page numbers used"} if(theThing=="publisher") {theContent+="Publisher, if there is one"} if(theThing=="language") {theContent+="Language the book is in"} if(theThing=="accessdate") {theContent+="The date of access in ISO 8601 YYYY-MM-DD format (do not wikilink)"} if(theThing=="help"){ theContent+=" Help " theContent+="What are references and footnotes? References are the sources used in the creation of articles. Per <a href='http://en.wikipedia.org/wiki/WP:NOT'>WP:NOT</a>, no articles should contain <a href='http://en.wikipedia.org/wiki/WP:NOR'>no original research</a>. All articles should be sourced to guarantee that the articles are accurate. References are located in a single section at the end of an article; footnotes are dispersed throughout the articles, and upon clicking them it drags the reader to the source used." theContent+=" Do I need footnotes?  Preferably, yes. <a href='http://en.wikipedia.org/wiki/WP:WIAFA'>WP:WIAFA</a> requires them for all featured articles; to establish the accuracy of articles, however, all articles should have them." theContent+=" How I created a footnote?  That is what this is for. All it actually does is simplify the process of flicking between pages to find the parameters of Template:Cite web and other relevant templates; if you know all of the parameters by heart, there really is not much point to this.  At the bottom of the page, under a ==Notes== section (below the ==See also==, but above the ==External links== per WP:GTL), add: <<font style='background:yellow'>references/ > (use div tags with the class set equal to 'references-small' around this preferably).  In the text, add the footnotes created by the JS script where the inline citations are required. Just copy them from the text area and paste them in the relevant part of the article." theContent+=" Can I make more than one footnote point to the same information?  Yes, use < ref name=THENAME>footnote information< /ref> for each footnote that you wish to point to the same information." theContent+=" What relevant Wikipedia: namespace guidelines are there?  <a href='http://en.wikipedia.org/wiki/WP:FOOTNOTE'>WP:FOOTNOTE</a>, <a href='http://en.wikipedia.org/wiki/WP:CITE'>WP:CITE</a>, and <a href='http://en.wikipedia.org/wiki/WP:V'>WP:V</a> are relevant guidelines." theContent+=" Can you repeat that all again?  Uhh... no ;)." } theContent+="  "

winName = window.open("http://en.wikipedia.org/","Help") winName.document.write(theContent) winName.document.close }

//mode1 variable indicates if web or book window is open; web or book //mode1="web"

var web_var = "web" var book_var = "book"

//function switch1 will switch tabs for a book citation instead of web and vice-versa function switch1(theType){ if(theType=="book"){ hide3(web_var); show2; //mode1="book" } if(theType=="web"){ hide3(book_var); show1; //mode1="web" } }

//generates the layer with the text boxes document.write('<div name="web" id="tab1" style="position:absolute; margin-top:32px; margin-left:50px; height:5px; z-index:21; visibility:hidden; background:#ff5555; border:1px solid #222222; border-bottom:0px solid #222222" onclick="switch1(this.name)">Web <div name="book" id="tab2" style="position:absolute; margin-top:32px; margin-left:87px; height:5px; z-index:19; visibility:hidden; background:#55ff55; border:1px solid #222222" onclick="switch1(this.name)">Book ' +'<span id="refWindow" style="position:absolute; top=100; left=100; visibility:hidden; z-index:20; background:#f0f0ff; width:40%; height:30%; margin:50px; border:1px solid #000000">' +'<span valign="right" style="color:red" onclick="hide1">X Click on the descriptions at the right of the text boxes for their definitions.' +'<form name="refForm">'	+'<input type="button" name="refMaker" value="Create footnote" onclick="createFootnote">' +'<input type="reset" name="reset" value="Reset"> ' +'<input id="t0" type="text" name="last" value=""> <span onclick="popWindow(refA[0])">Last name ' +'<input id="t1" type="text" name="first" value=""> <span onclick="popWindow(refA[1])">First name ' +'<input id="t2" type="text" name="authorlink" value=""> <span onclick="popWindow(refA[2])">Link to author ' +'<input id="t3" type="text" name="date" value=""> <span onclick="popWindow(refA[3])">Date ' +'<input id="t4" type="text" name="url" value=""> <span onclick="popWindow(refA[4])">URL* ' +'<input id="t5" type="text" name="title" value=""> <span onclick="popWindow(refA[5])">Title* ' +'<input id="t6" type="text" name="format" value=""> <span onclick="popWindow(refA[6])">Format ' +'<input id="t7" type="text" name="work" value=""> <span onclick="popWindow(refA[7])">Work ' +'<input id="t8" type="text" name="pages" value=""> <span onclick="popWindow(refA[8])">Pages ' +'<input id="t9" type="text" name="publisher" value=""> <span onclick="popWindow(refA[9])">Publisher ' +'<input id="t10" type="text" name="language" value=""> <span onclick="popWindow(refA[10])">Language ' +'<input id="t11" type="text" name="accessdate" value=""> <span onclick="popWindow(refA[11])">Date of access* ' +' * denotes that the parameter is required ' +'<input type="button" name="help" id="theHelpbutton" value="Help" onclick="popWindow(this.name)"> ' +'<textarea name="refOutput" cols="50" rows="5"> {{cite web ' +' '       +'<span id="maxbutton" style="position:absolute; left=0; top=0; visibility:hidden; z-index=19; background:yellow; height=20px; margin-top:120px; margin-left:5px"><span name="web_max_button" onclick="show3(this.name)">[restore]  ')

document.write('<span id="refWindow2" style="position:absolute; top=100; left=100; visibility:hidden; z-index:20; background:#f0f0ff; width:40%; height:30%; margin:50px; border:1px solid #000000">' +'<span valign="right" style="color:red" onclick="hide2">X Click on the descriptions at the right of the text boxes for their definitions.' +'<form name="refFormB">'	+'<input type="button" name="refMaker" value="Create footnote" onclick="createFootnote2">'	+'<input type="reset" name="reset" value="Reset"> '	+'<input id="b0" type="text" name="last" value=""> <span onclick="popWindow2(refB[0])">Last name  '	+'<input id="b1" type="text" name="first" value=""> <span onclick="popWindow2(refB[1])">First name  '	+'<input id="b2" type="text" name="authorlink" value=""> <span onclick="popWindow2(refB[2])">Link to author  '	+'<input id="b3" type="text" name="year" value=""> <span onclick="popWindow2(refB[3])">Year of publication  ' +'<input id="b4" type="text" name="url" value=""> <span onclick="popWindow2(refB[4])">URL ' +'<input id="b5" type="text" name="title" value=""> <span onclick="popWindow2(refB[5])">Title* ' +'<input id="b6" type="text" name="id" value=""> <span onclick="popWindow2(refB[6])">ISBN # ' +'<input id="b7" type="text" name="location" value=""> <span onclick="popWindow2(refB[7])">Location of publication ' +'<input id="b8" type="text" name="pages" value=""> <span onclick="popWindow2(refB[8])">Last name ' +'<input id="b9" type="text" name="publisher" value=""> <span onclick="popWindow2(refB[9])">Publisher ' +'<input id="b10" type="text" name="language" value=""> <span onclick="popWindow2(refB[10])">Language ' +'<input id="b11" type="text" name="accessdate" value=""> <span onclick="popWindow2(refB[11])">Date of access ' +'<input id="b12" type="text" name="accessdate" value=""> <span onclick="popWindow2(refB[12])">Chapter ' +' * denotes that the parameter is required ' +'<input type="button" name="help" id="theHelpbutton" value="Help" onclick="popWindow2(this.name)"> ' +'<textarea name="refOutput" cols="50" rows="5"> {{cite book ' +' '       +'<span id="maxbutton2" style="position:absolute; left=0; top=0; visibility:hidden; z-index=19; background:yellow; height=20px; margin-top:120px; margin-left:5px"><span name="book_max_button" onclick="show3(this.name)">[restore]  ')

//function addOnloadHook to allow the creation of a new tab in editing mode. //It can also be called upon by javascript:show1 document.write('<script type="text/javascript" src="'             + 'http://en.wikipedia.org/w/index.php?title='              + 'User:Omegatron/monobook.js/addlink.js'             + '&action=raw&ctype=text/javascript&dontcountme=s"> ');

addOnloadHook(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:show1', 'footnote creater', 'ca-datefixer', 'Quick help with footnotes', , );    } });

//