Permalink
Browse files

Release new version

This release includes new button styling, speed improvements, an
"article creator" option for submit and mark as draft, CSD logging for
G13 nominations, a "postpone G13 speedy deletion" button, and lots of
bug fixes.
  • Loading branch information...
theopolisme committed Aug 29, 2013
1 parent 7377ae1 commit cd26d7c483b787a54555e5348065f8c05b214374
Showing with 714 additions and 521 deletions.
  1. +7 −6 README.md
  2. +8 −0 STYLE_GUIDE.md
  3. +79 −0 src/MediaWiki:Gadget-afchelper.css
  4. +1 −1 src/MediaWiki:Gadget-afchelper.js
  5. +11 −3 src/core.js
  6. +20 −14 src/ffu.js
  7. +588 −494 src/submissions.js
  8. +0 −3 tests/submissionsyntax.wiki
View
@@ -1,6 +1,6 @@
Yet another Articles for creation helper script
========
This is a script created to make reviewing Wikipedia article and redirect submissions easier. The full documentation is available on [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script#Documentation).
This is a script created to make reviewing Wikipedia AfC submissions, files for upload, AfC submissions missing a template, and redirect submissions easier. The full documentation is available on [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script#Documentation).
## Contributing
If you wish to contribute, that's great! Just fork the repository, make your changes in the `develop` branch, and then create a pull request. Frequent contributors can request to be added to the WPAFC organization on GitHub for the ability to commit directly to the repository, sans pull request.
@@ -9,15 +9,16 @@ If you wish to contribute, that's great! Just fork the repository, make your cha
Developers are highly encouraged to test their modifications before committing. Rather than test on the live wiki, you can use [test.wikipedia.org](http://test.wikipedia.org/wiki/Main_Page) and not be afraid of blowing anything up.
On the English Wikipedia, several different scripts mirror different branches.
* MediaWiki:Gadget-afchelper.js – mirrors the `master` branch
* MediaWiki:Gadget-afchelper-beta.js – mirrors the `beta` branch
* [User:Theo's Little Bot/afch/afchelper.js](https://en.wikipedia.org/w/index.php?title=User:Theo%27s_Little_Bot/afch/afchelper.js) – mirrors the `develop` branch (auto-updates every 10 minutes)
* [MediaWiki:Gadget-afchelper.js](https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-afchelper.js) – for stable releases, mirrors the `master` branch
* [MediaWiki:Gadget-afchelper-beta.js](https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-afchelper-beta.js) – for testing by the general public, mirrors the `beta` branch
* **your page here** – if you'd like for a feature branch to be copied to a specific page on-wiki, just create a new issue
To import a script, add it to [your common.js page](http://en.wikipedia.org/wiki/Special:MyPage/common.js) (example is for the beta script):
To import a script, add it to [your common.js page](http://en.wikipedia.org/wiki/Special:MyPage/common.js) (example is for the `develop` script):
importScript('MediaWiki:Gadget-afchelper-beta.js'); // AFCH beta script [[MediaWiki:Gadget-afchelper-beta.js]]
importScript("User:Theo's Little Bot/afch/afchelper.js"); // AFCH script development [[User:Theo's Little Bot/afch]]
The only exception to this is for the `master` script, for which you just need to check the box next to "Yet Another AFC Helper Script" in [your preferences](http://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-gadgets).
The only exception to this is for the `master` script: to use it, you just need to check the box next to "Yet Another AFC Helper Script" in [your preferences](http://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-gadgets).
## License
The script is licensed under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License) and the [GNU Free Documentation License](http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License).
View
@@ -0,0 +1,8 @@
Style Guide
========
## CSS
If vendor specific CSS rules are added, please add as many as possible.
### Other stuff
Buttons and links prompting the user for more information should include ellipsis (HTML code `…`).
@@ -0,0 +1,79 @@
/* Stylesheet should be located at [[MediaWiki:Gadget-afchelper.css]] */
.notice {
color: red;
}
span.notice {
font-size: 120%;
}
div#afcHelper_betanotice {
font-style: italic;
}
.afcHelper_button {
background-repeat: repeat-x;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
display: inline-block;
padding: 2px 5px;
font-size: 13px;
line-height: 18px;
text-align: center;
vertical-align: middle;
cursor: pointer;
border-width: 1px;
border-style: solid;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
border-radius: 4px 4px 4px 4px;
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset, 0px 1px 2px rgba(0, 0, 0, 0.05);
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: normal;
margin: 0px;
margin-right: 2px;
}
.afcHelper_button:active {
border: 1px solid #aaa;
border-bottom: 1px solid #888;
-moz-box-shadow: inset 0 0 3px 3px #888;
-webkit-box-shadow: inset 0 0 3px 3px#888;
box-shadow: inset 0 0 3px 3px #888;
}
#afcHelper_accept_button {
background-color: #adfcad;
background-image: -moz-linear-gradient(center top, #B8FFB8, #A7F3A7);
}
#afcHelper_decline_button, .afcHelper_button.decline {
background-color: #ffcdd5;
}
#afcHelper_comment_button, .afcHelper_button.comment {
background-color: #f3eba3;
}
#afcHelper_submit_button {
background-color: #66ccff;
}
#afcHelper_draft_button {
background-color: #4aa02c;
}
#afcHelper_unmark_button, #afcHelper_mark_button, .afcHelper_button.mark {
background-color: #b1dae8;
}
#afcHelper_cleanup_button {
background-color: #d2d3cc;
}
#afcHelper_g13_button {
background-color: #ff3333;
}
@@ -5,7 +5,7 @@
// Development: <https://github.com/WikiProject-Articles-for-creation/afch>
////////////////////////////////////////////
//<nowiki>
if ((wgPageName.indexOf('Wikipedia:Articles_for_creation') !== -1) || (wgPageName.indexOf('Wikipedia_talk:Articles_for_creation') !== -1) || (wgPageName.indexOf('Wikipedia:Files_for_upload') !== -1) || (wgPageName.indexOf('User:*') !== -1)) {
if ((wgPageName.indexOf('Wikipedia:Articles_for_creation') !== -1) || (wgPageName.indexOf('Wikipedia_talk:Articles_for_creation') !== -1) || (wgPageName.indexOf('Wikipedia:Files_for_upload') !== -1) || (wgPageName.indexOf('User:') !== -1)) {
var afchelper_baseurl = mw.config.get('wgServer') + '/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-afchelper.js';
importScriptURI(afchelper_baseurl + '/core.js');
}
View
@@ -8,18 +8,26 @@ var afcHelper_advert = ' ([[WP:AFCH|AFCH]])';
var pagetext = '';
var usertalkpage = '';
// CSS stylesheet
importStylesheetURI( mw.config.get( 'wgServer' ) + '/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-afchelper.css');
if (wgPageName.indexOf('Wikipedia:Articles_for_creation/Redirects') !== -1) {
importScriptURI(afchelper_baseurl + '/redirects.js');
} else if (wgPageName.indexOf('Wikipedia:Files_for_upload') !== -1) {
importScriptURI(afchelper_baseurl + '/ffu.js');
} else if ((wgPageName.indexOf('Wikipedia:Articles_for_creation/') !== -1)
|| (wgPageName.indexOf('Wikipedia_talk:Articles_for_creation/') !== -1)
|| (wgPageName.indexOf('User:') !== -1)
|| (wgPageName.indexOf('User_talk:') !== -1)
){
importScriptURI(afchelper_baseurl + '/submissions.js');
}
// This enables the beta notice for all uses except the official gadget
if (afchelper_baseurl.indexOf('MediaWiki:Gadget-afchelper.js') == -1)
BETA = true;
else
BETA = false;
function afcHelper_generateSelect(title, options, onchange) {
var text = '<select name="' + title + '" id="' + title + '" ';
if (onchange !== null) text += 'onchange = "' + onchange + '" ';
@@ -99,10 +107,10 @@ function afcHelper_editPage(title, newtext, summary, createonly) {
if (response['edit']['result'] === "Success") {
document.getElementById('afcHelper_edit' + escape(title)).innerHTML = 'Saved <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a>';
} else {
document.getElementById('afcHelper_edit' + escape(title)).innerHTML = '<div style="color:red"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></div>. Error info:' + response['error']['code'] + ' : ' + response['error']['info'];
document.getElementById('afcHelper_edit' + escape(title)).innerHTML = '<div class="notice"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></div>. Error info:' + response['error']['code'] + ' : ' + response['error']['info'];
}
} catch (err) {
document.getElementById('afcHelper_edit' + escape(title)).innerHTML = '<div style="color:red"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></div>';
document.getElementById('afcHelper_edit' + escape(title)).innerHTML = '<div class="notice"><b>Edit failed on <a href="' + wgArticlePath.replace("$1", encodeURI(title)) + '" title="' + title + '">' + title + '</a></b></div>';
}
$("#afcHelper_AJAX_finished_" + func_id).css("display", '');
delete req;
View
@@ -213,7 +213,7 @@ function afcHelper_ffu_onActionChange(id) {
value: 'nourl'
}]) + '<br/><label for="afcHelper_ffu_comment_' + id + '">Additional comment: </label>' + '<input type="text" id="afcHelper_ffu_comment_' + id + '" name="afcHelper_ffu_comment_' + id + '"/>' + '<br/><label for="afcHelper_ffu_notify_' + id + '">Notify requestor: </label>' + '<input type="checkbox" id="afcHelper_ffu_notify_' + id + '" name="afcHelper_ffu_notify_' + id + '" checked="checked" />';
} else if (selectValue == 'comment') {
extra.innerHTML = '<label for="afcHelper_ffu_prefmtcomment_' + id + '">Placing a comment: </label>' + afcHelper_generateSelect('afcHelper_ffu_prefmtcomment_' + id, [{
extra.innerHTML = '<label for="afcHelper_ffu_prefmtcomment_' + id + '">Adding a comment: </label>' + afcHelper_generateSelect('afcHelper_ffu_prefmtcomment_' + id, [{
label: 'No license',
value: 'license'
}, {
@@ -289,14 +289,20 @@ function afcHelper_ffu_performActions() {
// todo list: if more files in one request were handled, only notify once (would require change in structure of program)
if ((sub_m.action != 'none') && (sub_m.notify == true)) {
// assuming the first User/IP is the requester
var requestinguser = /\[\[(User[_ ]talk:|User:|Special:Contributions\/)([^\||\]\]]*)([^\]]*?)\]\]/i.exec(text)[2];
var userpagetext = afcHelper_getPageText('User talk:' + requestinguser, true);
if (sub_m.action == 'decline') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|decline\}\} \~\~\~\~\n';
else if (sub_m.action == 'comment') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|comment\}\} \~\~\~\~\n';
else if (sub_m.action == 'hold') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|h\}\} \~\~\~\~\n';
else if (sub_m.action == 'accept') if (sub_m.to === '') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu|comment\}\} \~\~\~\~\n';
else userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|file=' + sub_m.to + '\}\} \~\~\~\~\n';
afcHelper_editPage('User talk:' + requestinguser, userpagetext, 'Notifying user about [[WP:FFU|FFU]] request', false);
match = /\[\[(?:User[_ ]talk:|User:|Special:Contributions\/)([^\||\]\]]*)([^\]]*?)\]\]/i.exec(text)
// only notify if we can find a user to notify
if (match) {
var requestinguser = match[1];
var userpagetext = afcHelper_getPageText('User talk:' + requestinguser, true);
if (sub_m.action == 'decline') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|decline\}\} \~\~\~\~\n';
else if (sub_m.action == 'comment') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|comment\}\} \~\~\~\~\n';
else if (sub_m.action == 'hold') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|h\}\} \~\~\~\~\n';
else if (sub_m.action == 'accept') if (sub_m.to === '') userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu|comment\}\} \~\~\~\~\n';
else userpagetext += '\n== Your request at \[\[WP:FFU|Files for upload\]\] ==\n\{\{subst:ffu talk|file=' + sub_m.to + '\}\} \~\~\~\~\n';
afcHelper_editPage('User talk:' + requestinguser, userpagetext, 'Notifying user about [[WP:FFU|FFU]] request', false);
} else {
document.getElementById('afcHelper_status').innerHTML += '<li>Unable to notify user for ' + sub.title + ': Could not find a username to notify!</li>';
}
}
if (sub_m.action == 'accept') {
// create local file description talkpage
@@ -334,15 +340,15 @@ function afcHelper_ffu_performActions() {
totaldecline++;
} else if (sub_m.action == 'comment') {
if ((sub_m.prefmtcomment != '') && (sub_m.prefmtcomment != 'custom')) {
if (sub_m.comment == '') text += '\n\{\{subst:ffu|' + sub_m.prefmtcomment + '\}\} \~\~\~\~\n';
else text += '\n\{\{subst:ffu|' + sub_m.prefmtcomment + '\}\} ' + sub_m.comment + ' \~\~\~\~\n';
if (sub_m.comment == '') text += '\n:\{\{subst:ffu|' + sub_m.prefmtcomment + '\}\} \~\~\~\~\n';
else text += '\n:\{\{subst:ffu|' + sub_m.prefmtcomment + '\}\} ' + sub_m.comment + ' \~\~\~\~\n';
} else if (sub_m.comment != '') {
text += '\n\{\{subst:ffu|c\}\} ' + sub_m.comment + ' \~\~\~\~\n';
text += '\n:\{\{subst:ffu|c\}\} ' + sub_m.comment + ' \~\~\~\~\n';
}
totalcomment++;
} else if (sub_m.action == 'hold') {
if (sub_m.comment == '') text += '\n\{\{subst:ffu|' + sub_m.holdrat + '\}\} \~\~\~\~\n';
else text += '\n\{\{subst:ffu|' + sub_m.holdrat + '\}\} ' + sub_m.comment + ' \~\~\~\~\n';
if (sub_m.comment == '') text += '\n:\{\{subst:ffu|' + sub_m.holdrat + '\}\} \~\~\~\~\n';
else text += '\n:\{\{subst:ffu|' + sub_m.holdrat + '\}\} ' + sub_m.comment + ' \~\~\~\~\n';
totalcomment++; // a "hold" is basically equal to a comment
}
pagetext = pagetext.substring(0, startindex) + text + pagetext.substring(endindex);
Oops, something went wrong.

0 comments on commit cd26d7c

Please sign in to comment.