Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 

















User:Awesome Aasim/xfdvote.js: Difference between revisions

















User page
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
User contributions
User logs
View user groups
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Help
 

From Wikipedia, the free encyclopedia
 

< User:Awesome Aasim

Browse history interactively
 Previous edit
Content deleted Content added
No edit summary
No edit summary
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:

// <nowiki>

// <nowiki>

$(document).ready(function() {

// AFD code follows

if ((mw.config.get("wgPageName").includes("Wikipedia:Articles_for_deletion") || mw.config.get("wgPageName").includes("Wikipedia:Files_for_discussion") || mw.config.get("wgPageName").includes("Wikipedia:Miscellany_for_deletion") || mw.config.get("wgPageName").includes("Wikipedia:Categories_for_discussion") || mw.config.get("wgPageName") == "Wikipedia:Redirects_for_discussion" || mw.config.get("wgPageName") == "Wikipedia:Templates_for_discussion" || mw.config.get("wgPageName") == "User:Awesome_Aasim/xfdvote") && sessionStorage.getItem("xfdvotedismissed") != 1 && localStorage.getItem("xfdvotedismissed") != 1) {

var afd = {};

$("#siteNotice").append('<div id="xfdvoteinstructions"><table style="border: 1px solid #80bfff; background-color: #cce6ff;padding-left:.5em;padding-right:.5em;"><tbody><tr><td rowspan="2" style="vertical-align:top;padding-bottom:2px;"><img alt="XfD Partipciation Tool Installed" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/25px-OOjs_UI_icon_information-progressive.svg.png" decoding="async" width="25" height="25" srcset="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/38px-OOjs_UI_icon_information-progressive.svg.png 1.5x, https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/50px-OOjs_UI_icon_information-progressive.svg.png 2x" data-file-width="512" data-file-height="512"></td><td style="vertical-align: middle;"><small>The <b>XFD Partipciation tool</b> is installed. To use the tool, go to the page which has been nominated for deletion, click on the appropriate !vote button and follow the prompts on screen. (For redirects for discussion, you go to the page where the nomination is listed.)</small></td><td id="xfdvoteokbutton1"></td><td id="xfdvoteokbutton2"></td></tr></tbody></table></div>');

$(document).ready(function () {

$('<button class="mw-ui-button">OK</button>').click(function() {

afd.$obj = $(".mbox-afd").eq(0); //only add to first AFD tag in case of duplicate tags

sessionStorage.setItem("xfdvotedismissed", 1);

afd.target = $(afd.$obj).find("b a").eq(1).attr("title");

$("#xfdvoteinstructions").remove();

afd.vote = function (vote) {

}).appendTo("#xfdvoteokbutton1");

$('<div id="afd-dialog"></div>').append('<p>Enter your argument below. AFD votes are weighted based on the strength of arguments, not based on number of votes. Cite relevant policies and guidelines where needed. See <a href="/wiki/Wikipedia:Polling_is_not_a_substitute_for_discussion">this page</a> for more information.</p><input id="afd-vote-reason" placeholder="' + ((vote.toLowerCase() == "comment") ? 'Comment' : 'Reason to ' + vote.toLowerCase()) + '" size="70">').dialog({

$('<button class="mw-ui-button">Don\'t show this again</button>').click(function() {

buttons: [

localStorage.setItem("xfdvotedismissed", 1);

{

$("#xfdvoteinstructions").remove();

text: "Proceed",

}).appendTo("#xfdvoteokbutton2");

click: function () {

}

var comment = $("#afd-vote-reason").val();

if (vote.toLowerCase() == "comment" && comment.length == 0) {

alert("Please add a comment.")

} else {

$(".ui-button").eq(0).parent().prepend('<div class="mw-spinner mw-spinner-small mw-spinner-inline" title="..." id="mw-spinner-refresh-spinner"><div class="mw-spinner-container"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>');

$(".ui-button").prop("disabled", true).addClass("ui-state-disabled");

$("#afd-vote-reason").prop("disabled", true);

$.get(mw.config.get("wgScriptPath") + "/api.php", {

action: "query",

format: "json",

meta: "tokens",

type: "csrf"

}).done(function (result) {

if (result.error) {

mw.notify($('<span class="error">' + result.error.info + '</span>'));

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

$("#afd-vote-reason").prop("disabled", false);

} else {

var token = result.query.tokens.csrftoken;

$.get(mw.config.get("wgScriptPath") + "/api.php", {

action: "parse",

prop: "wikitext",

format: "json",

page: afd.target

}).done(function (result) {

if (result.error) {

mw.notify($('<span class="error">' + result.error.info + '</span>'));

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

$("#afd-vote-reason").prop("disabled", false);

} else {

var wikitext = result.parse.wikitext["*"];

if (wikitext.includes('<div class="boilerplate afd vfd xfd-closed"')) {

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$("#afd-dialog").dialog("destroy").remove();

$('<table class="plainlinks plainlinks ombox ombox-content" role="presentation"><tbody><tr><td class="mbox-image"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/40px-OOjs_UI_icon_clear-destructive.svg.png" decoding="async" width="40" height="40" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/60px-OOjs_UI_icon_clear-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/80px-OOjs_UI_icon_clear-destructive.svg.png 2x" data-file-width="20" data-file-height="20"></td><td class="mbox-text"><b>The AFD discussion appears to have been closed.</b><br><p>Please visit the AFD page to double-check.</p></td></tr></tbody></table>').dialog({

buttons: [{

text: "Visit AFD page",

click: function () {

window.location.href = "/wiki/" + afd.target;

}

},

{

text: "OK",

click: function () {

$(this).dialog('destroy').remove();

}

}],

closeOnEscape: false,

modal: true,

title: "AFD Discussion Closed",

width: (0.50 * window.outerWidth > 300) ? 0.50 * window.outerWidth : 300

})

} else if (wikitext.includes("<!--Vote cast using XFD voting tool by " + mw.config.get("wgUserName") + " -->") && vote.toLowerCase() != "comment") {

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$("#afd-dialog").dialog("destroy").remove();

$('<table class="plainlinks plainlinks ombox ombox-content" role="presentation"><tbody><tr><td class="mbox-image"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/40px-OOjs_UI_icon_clear-destructive.svg.png" decoding="async" width="40" height="40" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/60px-OOjs_UI_icon_clear-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/3/33/OOjs_UI_icon_clear-destructive.svg/80px-OOjs_UI_icon_clear-destructive.svg.png 2x" data-file-width="20" data-file-height="20"></td><td class="mbox-text"><b>You\'ve already voted.</b> Please modify your existing vote on the AFD page rather than casting a new vote. If you have struck out your vote, please make sure to remove the "&lt;!--Vote cast using XFD voting tool by ' + mw.config.get("wgUserName") + ' -->" code before trying again.</p></td></tr></tbody></table>').dialog({

buttons: [{

text: "Visit AFD page",

click: function () {

window.location.href = "/wiki/" + afd.target;

}

},

{

text: "OK",

click: function () {

$(this).dialog('destroy').remove();

}

}],

closeOnEscape: false,

modal: true,

title: "You've already voted",

width: (0.50 * window.outerWidth > 300) ? 0.50 * window.outerWidth : 300

})

} else {

$.post(mw.config.get("wgScriptPath") + "/api.php", {

action: "edit",

format: "json",

appendtext: "\n* '''" + vote + "'''" + (comment ? ": " + comment : "") + " ~~~~" + ((vote.toLowerCase() != "comment") ? " <!--Vote cast using XFD voting tool by " + mw.config.get("wgUserName") + " -->" : ""),

summary: ((vote.toLowerCase() == "comment") ? "Comment" : "Vote to " + vote.toLowerCase()) + " via [[User:Awesome Aasim/xfdvote|XFD voting tool]]",

title: afd.target,

nocreate: 1,

token: token

}).done(function (result) {

if (result.error) {

mw.notify($('<span class="error">' + result.error.info + '</span>'));

$("#afd-vote-reason").prop("disabled", false);

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

} else {

window.location.href = "/wiki/" + afd.target;

}

}).fail(function () {

$("#afd-vote-reason").prop("disabled", false);

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

});

}

}

}).fail(function () {

$("#afd-vote-reason").prop("disabled", false);

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

});

}

}).fail(function () {

$("#afd-vote-reason").prop("disabled", false);

$(".ui-button").prop("disabled", false).removeClass("ui-state-disabled");

$(".mw-spinner").remove();

});

}

}

},

{

text: "Cancel",

click: function () {

$(this).dialog("destroy").remove();

$(".mw-spinner").remove();

}

}

],

closeOnEscape: false,

modal: true,

title: (vote.toLowerCase() == "comment" ? "Comment on the nomination of " : "Vote to " + vote.toLowerCase()) + " \"" + mw.config.get("wgPageName") + "\"",

width: (0.50 * window.outerWidth > 300) ? 0.50 * window.outerWidth : 300

})

}

afd.$keep = $('<button class="mw-ui-button mw-ui-progressive" id="afd-vote-keep">Vote to keep</button>');

afd.$keep.click(function (e) {

e.preventDefault();

afd.vote("Keep");

}).css({ "margin-right": "5px", "margin-left": "1px" });

afd.$delete = $('<button class="mw-ui-button mw-ui-destructive" id="afd-vote-delete">Vote to delete</button>');

afd.$delete.click(function (e) {

e.preventDefault();

afd.vote("Delete");

}).css({ "margin-right": "5px", "margin-left": "1px" });

afd.$merge = $('<button class="mw-ui-button" id="afd-vote-merge">Vote to merge</button>');

afd.$merge.click(function (e) {

e.preventDefault();

var target = prompt("Please enter a proposed target to merge this article with: ");

afd.vote("Merge with " + (target ? target : "some other article"));

}).css({ "margin-right": "5px", "margin-left": "1px" });

afd.$redirect = $('<button class="mw-ui-button" id="afd-vote-redirect">Vote to redirect</button>');

afd.$redirect.click(function (e) {

e.preventDefault();

var target = prompt("Please enter a proposed target to redirect this article to: ");

afd.vote("Redirect to " + (target ? target : "some other article"));

}).css({ "margin-right": "5px", "margin-left": "1px" });

afd.$comment = $('<button class="mw-ui-button" id="afd-vote-comment">Leave a comment</button>');

afd.$comment.click(function (e) {

e.preventDefault();

afd.vote("Comment");

}).css({ "margin-right": "5px", "margin-left": "1px" });

afd.$obj.find("tr .mbox-text").append('<hr>Deletion discussion actions:<div id="afd-vote-buttons"></div>');

$("#afd-vote-buttons").append(afd.$keep).append(afd.$delete).append(afd.$merge).append(afd.$redirect).append(afd.$comment);

});

});

mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/afd.js?action=raw&ctype=text/javascript");

// End of AfD code

mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/mfd.js?action=raw&ctype=text/javascript");

mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/rfd.js?action=raw&ctype=text/javascript");

//mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/cfd.js?action=raw&ctype=text/javascript");

mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/ffd.js?action=raw&ctype=text/javascript");

mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/tfd.js?action=raw&ctype=text/javascript");

// </nowiki>

// </nowiki>


Latest revision as of 01:08, 12 September 2023

// <nowiki>
$(document).ready(function() {
 if ((mw.config.get("wgPageName").includes("Wikipedia:Articles_for_deletion") || mw.config.get("wgPageName").includes("Wikipedia:Files_for_discussion") || mw.config.get("wgPageName").includes("Wikipedia:Miscellany_for_deletion") || mw.config.get("wgPageName").includes("Wikipedia:Categories_for_discussion") || mw.config.get("wgPageName") == "Wikipedia:Redirects_for_discussion" || mw.config.get("wgPageName") == "Wikipedia:Templates_for_discussion" || mw.config.get("wgPageName") == "User:Awesome_Aasim/xfdvote") && sessionStorage.getItem("xfdvotedismissed") != 1 && localStorage.getItem("xfdvotedismissed") != 1) {
  $("#siteNotice").append('<div id="xfdvoteinstructions"><table style="border: 1px solid #80bfff; background-color: #cce6ff;padding-left:.5em;padding-right:.5em;"><tbody><tr><td rowspan="2" style="vertical-align:top;padding-bottom:2px;"><img alt="XfD Partipciation Tool Installed" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/25px-OOjs_UI_icon_information-progressive.svg.png" decoding="async" width="25" height="25" srcset="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/38px-OOjs_UI_icon_information-progressive.svg.png 1.5x, https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/50px-OOjs_UI_icon_information-progressive.svg.png 2x" data-file-width="512" data-file-height="512"></td><td style="vertical-align: middle;"><small>The <b>XFD Partipciation tool</b> is installed. To use the tool, go to the page which has been nominated for deletion, click on the appropriate !vote button and follow the prompts on screen.  (For redirects for discussion, you go to the page where the nomination is listed.)</small></td><td id="xfdvoteokbutton1"></td><td id="xfdvoteokbutton2"></td></tr></tbody></table></div>');
  $('<button class="mw-ui-button">OK</button>').click(function() {
   sessionStorage.setItem("xfdvotedismissed", 1);
   $("#xfdvoteinstructions").remove();
  }).appendTo("#xfdvoteokbutton1");
  $('<button class="mw-ui-button">Don\'t show this again</button>').click(function() {
   localStorage.setItem("xfdvotedismissed", 1);
   $("#xfdvoteinstructions").remove();
  }).appendTo("#xfdvoteokbutton2");
 }
});
mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/afd.js?action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/mfd.js?action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/rfd.js?action=raw&ctype=text/javascript");
//mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/cfd.js?action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/ffd.js?action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/wiki/User:Awesome_Aasim/xfdvote.js/tfd.js?action=raw&ctype=text/javascript");
// </nowiki>

Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Awesome_Aasim/xfdvote.js&oldid=1174986197"





This page was last edited on 12 September 2023, at 01:08 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki