User:QwerpQwertus/!/Auto
|
Welcome to my Userscripts! I'm currently writing an RFF Helper script which would assist editors in responding to Requests for feedback by notifying the user, and giving some suggestions. I only just learned basic Javascript from online touritals, so I'd appreciate help developing it. Thanks! |
I'll have it up tomorrow - I've got to merge the different parts. :)
function popupdo() { popupdo=window.open('','RFF Helper By QwerpQwertus',"location=0,status=0,scrollbars=1,height=400,width=500"); popupdo.moveTo(150,250); var tmp =popupdo.document; tmp.write('<html><head><title>RFF Helper By QwerpQwertus</title></head><body>'); tmp.write('<hr><center><p><font size="5" face="Courier" color="Dark Brown">Welcome to </font><font size="5" face="Arial" color="Orange"><i>Qwerp</i></font><font size="5" face="Lucinda Handwriting" color="Blue">Qwertus</font> <font size="5" face="Skia" color="Green">RFF Helper</font></p></center><hr>'); tmp.write(''); tmp.write(''); tmp.write(''); tmp.write('</body></html>'); tmp.close(); } function notifyedit() { document.editform.wpTextbox1.value=document.editform.wpTextbox1.value + "{" + "{"+"template-choice"+"}}\n\n"; document.editform.submit(); } addOnloadHook( function () { if (wgPageName=Wikipedia:Requests_for_feedback) { addPortletLink( 'p-cactions', "Javascript: popupdo()", "Rff Notify", "rff-help", "Asses, respond, and notify", ""); var keepwork =document.editform.wpTextbox1.value; } } ); function backwork { popupdo=window.open('','Thanks for using RFF Helper',"location=0,status=0,scrollbars=1,height=400,width=500"); popupdo.moveTo(150,250); var tmp =popupdo.document; tmp.write('<html><head><title>RFF Helper By QwerpQwertus</title></head><body>'); tmp.write('<hr><center><p><font size="5" face="Courier" color="Dark Brown">Thanks for using </font><font size="5" face="Arial" color="Orange"><i>Qwerp</i></font><font size="5" face="Lucinda Handwriting" color="Blue">Qwertus"s</font> <font size="5" face="Skia" color="Green">RFF Helper</font></p><hr><a href="http://en.wikipedia.org/w/index.php?action=edit§ion=new&title=User+talk%3AQwerpQwertus">Commemnts or Suggestions?</a></center>'); tmp.write('<a href="Javascript:keepwork">Return to what you were doing (if you were editing, your progress was kept.</a>'); tmp.write(''); tmp.write(''); tmp.write('</body></html>'); tmp.close(); }
function getCookie(Wikiepdia RFF Help Preference Cookie){
if (document.cookie.length > 0) { begin = document.cookie.indexOf(Wikiepdia RFF Help Preference Cookie+"="); if (begin != -1) { begin += Wikiepdia RFF Help Preference Cookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null;}
function setCookie(Wikiepdia RFF Help Preference Cookie, value, expiredays) { var ExpireDate = new Date(); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = Wikiepdia RFF Help Preference Cookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());}
function delCookie (Wikiepdia RFF Help Preference Cookie) {
if (getCookie(Wikiepdia RFF Help Preference Cookie)) { document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }}
function DoTheCookieStuff() { Preference=getCookie('Preference'); if (Preference!=null)
{alert('Hi - your prefered searchengine is '+Preference)}// Since this is a samplepage you are not taken to the prefered page. // If the script should actually take the user to the preferred page you should replace the above line // with a line like this: {window.location="http://"+Preference} else {alert('Hi - I do not know which searcengine you prefer.');} }
function getCookie(NameOfCookie){
if (document.cookie.length > 0) { begin = document.cookie.indexOf(NameOfCookie+"="); if (begin != -1) { begin += NameOfCookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null;}
function setCookie(NameOfCookie, value, expiredays) { var ExpireDate = new Date(); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());}
function delCookie (NameOfCookie) {
if (getCookie(NameOfCookie)) { document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }}
function DoTheCookieStuff(LastChangeDate) { dt=new Date(); year=dt.getYear(); if (year<=9) {year="0"+year}; month=dt.getMonth()+1; if (month<=9) {month="0"+month}; date=dt.getDate(); if (date<=9) {date="0"+date}; ThisDate=year+month+date;
LastVisitDate=getCookie('LastVisitDate'); if (LastVisitDate!=null)
{ if (LastVisitDate<LastChangeDate) {if (confirm('This page was updated since your last visit on '+LastVisitDate+ '\n Would you like to go to the update-page and see whats new?')) {window.location="updates.htm"} }else {alert('This page has not been updated since your last visit on '+LastVisitDate)} setCookie('LastVisitDate',ThisDate,365) }else {alert('Hi - this is your first visit to my page.');setCookie('LastVisitDate',ThisDate,365)} } </script>
<title>NetKontoret - School - JavaScript - Samplepage - Cookies</title> </head>
<body onLoad="DoTheCookieStuff(19981201)">
function notify() {" alert(" Your chosen template will be written in the edit box. Please preview the page before saving. You don't need to add your signature, it will be done for you. "); link="http://en.wikipedia.org/wiki/User_talk:++ask-user++§ion=new&preload=User:QwerpQwertus/rffhelp.js/Template++notifypref++"; MyWindow=window.open('link','Requests For Feedback Helper By QwerpQwertus','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=300'); return false;" }
// Specify what to do is an article name isn't given. // Write function "ask-article-null" which shows an alert about not giving an article name and asks whether they want to go back or continue. function ask-article-null() { if (confirm("You did not specify the article name. Click ok to continue anyways or cancel to go back and specify it.")) {notify()} else{ask-article()}; }
function ask-section-null() { if (confirm("You did not specify the section name. Click ok to continue anyways or cancel to go back and specify it.")) {notify()} else{ask-article()}; }
function ask-user-null() { if (confirm("You did not specify the user name. Click ok to continue anyways or cancel to go back and specify it.")) {notify()} else{ask-article()}; }
function ask-article() { // Ask what the name of the article is. Store it to "ask-article" ask-article=prompt("Please enter the exact name of the article.","Enter the exact name of the article or a redirect to it."); } function ask-section() { // Ask what the name of the section is. Store it to "ask-section" ask-section=prompt("Please enter the name of the section in which it is requested exactly how it appears on screen.","Enter the exact name of the section by copying it from the page, not the url."); } function ask-user() { // Ask what the name of the requesting user is. Store it to "ask-user" ask-user=prompt("Please enter the name of the user requesting feedback.","Enter your name here"); }
// Ask the user information when called. function ask() { ask-article() ask-section() ask-user() }
// Alert the user that they are responsible. alert("You are responsible for any actions you take using this userscript. It is still undergoing development, so be advised that this may mess stuff up - check if it worked correctly after each time you use it.");
ask()if (ask-article==null) {"ask-article-null()"} else {notify()}; if (ask-section==null) {"ask-section-null()"} else {notify()}; if (ask-user==null) {"ask-user-null()"} else {notify()};