User:Writ Keeper/Scripts/afcDialog.js
$(document).ready(function(){
afcDialogButtonText = "Make a selection";
if($("#afcSubmissionButton").length > 0)
{
$("#afcSubmissionButton").first().append('<div id="afcDialog" style="display:none;"><h2>Wait! Have you included <a href="/wiki/Wikipedia:CITE">citations</a> to independent, <a href="/wiki/Wikipedia:RS">reliable</a> sources in your article?</h2><input type="radio" id="afcOptionA" name="afcOptions"><b>A.</b> No, I forgot. I\'ll submit my page later.<br><input type="radio" id="afcOptionB" name="afcOptions"><b>B.</b> No. What are citations? How do I add them?<br><input type="radio" id="afcOptionC" name="afcOptions"><b>C.</b> No. There aren\'t any; I\'m writing about a subject that is new and/or not well known.<br><input type="radio" id="afcOptionD" name="afcOptions"><b>D.</b> No. I looked, but I am a new editor and need some help to find them.<br><input type="radio" id="afcOptionE" name="afcOptions"><b>E.</b> No, because this is a disambiguation page, template, or redirect, not an article.<br><input type="radio" id="afcOptionF" name="afcOptions"><b>F.</b> Yes, I have included citations to reliable sources in my article.<br></div>');
$("#afcOptionA").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Never mind");afcDialogButtonText ="Never mind";});
$("#afcOptionB").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Get help");afcDialogButtonText ="Get help";});
$("#afcOptionC").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Get help");afcDialogButtonText ="Get help";});
$("#afcOptionD").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Get help");afcDialogButtonText ="Get help";});
$("#afcOptionE").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Submit");afcDialogButtonText ="Submit";});
$("#afcOptionF").click(function(){$('div[aria-labelledby="ui-dialog-title-afcDialog"] .ui-button-text').first().text("Submit");afcDialogButtonText ="Submit";});
$("#afcSubmissionButton, #afcSubmissionButton > a").click(function(){
$( "#afcDialog" ).dialog(
{ buttons: [
{ text: afcDialogButtonText , click: function() {
var checkedInput = $('input[name=afcOptions]:checked');
var apiPath = mw.config.get('wgScriptPath') + "/api.php";
if(checkedInput.length > 0)
{
switch(checkedInput.attr("id"))
{
case "afcOptionB":
var catData={action:"query", prop:"categories", clcategories: "Category:Articles not submitted at AfC", pageids: mw.config.get( 'wgArticleId' ), format: "json"};
$.post(apiPath, catData, function(response)
{
if(typeof response.query.pages[wgArticleId].categories == "undefined")
{
var data = {action: "edit", title: mw.config.get( 'wgPageName' ), summary: "Article not submitted, automatically adding category", minor: "true", appendtext: "\n\n[[:Category:Articles not submitted at AfC]]", token: mw.user.tokens.get( 'csrfToken' )};
$.post(apiPath, data, function(){window.open(mw.util.getUrl("WP:Referencing for beginners"), "_self");});
}
else
{
window.open(mw.util.getUrl("WP:Referencing for beginners"), "_self");
}
});
break;
case "afcOptionC":
var catData={action:"query", prop:"categories", clcategories: "Category:Articles not submitted at AfC", pageids: mw.config.get( 'wgArticleId' ), format: "json"};
$.post(apiPath, catData, function(response)
{
if(typeof response.query.pages[wgArticleId].categories == "undefined")
{
var data = {action: "edit", title: mw.config.get( 'wgPageName' ), summary: "\nArticle not submitted, automatically adding category", minor: "true", appendtext: "\n\n[[:Category:Articles not submitted at AfC]]", token: mw.user.tokens.get( 'csrfToken' )};
$.post(apiPath, data, function(){window.open(mw.util.getUrl("WP:42"), "_self");});
}
else
{
window.open(mw.util.getUrl("WP:42"), "_self");
}
});
break;
case "afcOptionD":
var catData={action:"query", prop:"categories", clcategories: "Category:Articles not submitted at AfC", pageids: mw.config.get( 'wgArticleId' ), format: "json"};
$.post(apiPath, catData, function(response)
{
if(typeof response.query.pages[wgArticleId].categories == "undefined")
{
var data = {action: "edit", title: mw.config.get( 'wgPageName' ), summary: "\nArticle not submitted, automatically adding category", minor: "true", appendtext: "\n\n[[:Category:Articles not submitted at AfC]]", token: mw.user.tokens.get( 'csrfToken' )};
$.post(apiPath, data, function(){window.open(mw.util.getUrl("WP:Teahouse/Questions"), "_self");});
}
else
{
window.open(mw.util.getUrl("WP:Teahouse/Questions"), "_self");
}
});
break;
case "afcOptionE":
case "afcOptionF":
window.open(mw.config.get("wgScript") + "?title="+ mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) +"&action=edit§ion=new&preload=Template:AFC_submission/Subst&editintro=Template:AFC_submission/Subst/Editintro", "_self");
break;
case "afcOptionA":
default:
alert("Your article has not been submitted.");
$( this ).dialog( "close" );
break;
}
}
return false;
} },
{ text: "Cancel", click: function() {
$( this ).dialog( "close" );
return false;
} }
],
minWidth:500
}
);
return false;
});
}
});
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.