מדיה ויקי:Gadget-HotCat.js: הבדלים בין גרסאות בדף
Support for the "Prompt me when entering a blank edit summary" user preference |
Major/minor edit flag handling |
||
| שורה 24: | שורה 24: | ||
size configurable; minor bug fixes. | size configurable; minor bug fixes. | ||
V2.4: Oct 2010: [[User:TheDJ]] & [[User:Lupo]]: switch to not enable on upload form, ability to | V2.4: Oct 2010: [[User:TheDJ]] & [[User:Lupo]]: switch to not enable on upload form, ability to | ||
load translations from the Commons. | load translations from the Commons. Major/minor edit flag configurable; and fix a minor | ||
bug with the "Warn upon empty edit summary" user preference. | |||
License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0) | License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0) | ||
| שורה 158: | שורה 159: | ||
// MediaWiki:Gadget-HotCat.js/local_defaults if you hotlink to the Commons-version, to ensure it is set even | // MediaWiki:Gadget-HotCat.js/local_defaults if you hotlink to the Commons-version, to ensure it is set even | ||
// if that API query should fail for some strange reason. | // if that API query should fail for some strange reason. | ||
,upload_disabled : false | |||
// If upload_disabled is true, HotCat will not be used on the Upload form. | |||
// Stuff changeable by users: | // Stuff changeable by users: | ||
| שורה 165: | שורה 168: | ||
// If true, HotCat will never automatically submit changes. HotCat will only open an edit page with | // If true, HotCat will never automatically submit changes. HotCat will only open an edit page with | ||
// the changes; users must always save explicitly. | // the changes; users must always save explicitly. | ||
,suggest_delay : 100 | ,suggest_delay : 100 | ||
// Time, in milliseconds, that HotCat waits after a keystroke before making a request to the | // Time, in milliseconds, that HotCat waits after a keystroke before making a request to the | ||
| שורה 180: | שורה 181: | ||
,list_size : 5 | ,list_size : 5 | ||
// Default list size | // Default list size | ||
,single_minor : true | |||
// If true, single category changes are marked as minor edits. If false, they're not. | |||
}; | }; | ||
| שורה 454: | שורה 457: | ||
addOnloadHook (function () { | addOnloadHook (function () { | ||
if (!document.editform || !document.editform.wpTextbox1) return; | if (!document.editform || !document.editform.wpTextbox1) return; | ||
var isMajor = param ('hotcat_major') == '1'; | |||
var comment = param ('hotcat_comment') || ""; | var comment = param ('hotcat_comment') || ""; | ||
var cat_key = param ('hotcat_sortkey'); | var cat_key = param ('hotcat_sortkey'); | ||
| שורה 461: | שורה 465: | ||
if (result.summary && result.summary.length > 0) | if (result.summary && result.summary.length > 0) | ||
document.editform.wpSummary.value = HotCat.messages.prefix + result.summary.join ('; ') + comment + HotCat.messages.using; | document.editform.wpSummary.value = HotCat.messages.prefix + result.summary.join ('; ') + comment + HotCat.messages.using; | ||
document.editform.wpMinoredit.checked = | if (document.editform.wpMinoredit.checked) { | ||
// User must have "Mark all edits minor" enabled (or some other script set it...) URL param overrides | |||
// default setting. | |||
if (isMajor) document.editform.wpMinoredit.checked = false; | |||
} else { | |||
// Minor unless URL parameter present (for legacy compatibility: previously, all single-category changes | |||
// were always minor). | |||
document.editform.wpMinoredit.checked = !isMajor; | |||
} | |||
if (result.error) alert (result.error); | if (result.error) alert (result.error); | ||
if (do_commit) { | if (do_commit) { | ||
| שורה 672: | שורה 684: | ||
if (result.summary && result.summary.length > 0) | if (result.summary && result.summary.length > 0) | ||
commitForm.wpSummary.value = HotCat.messages.prefix + result.summary.join ('; ') + HotCat.messages.using; | commitForm.wpSummary.value = HotCat.messages.prefix + result.summary.join ('; ') + HotCat.messages.using; | ||
commitForm.wpMinoredit.checked = | commitForm.wpMinoredit.checked = HotCat.single_minor || minorEdits; | ||
} else if (changes > 1) { | } else if (changes > 1) { | ||
var summary = []; | var summary = []; | ||
| שורה 1,495: | שורה 1,507: | ||
if (this.originalCategory.length > 0) | if (this.originalCategory.length > 0) | ||
url += '&hotcat_removecat=' + encodeURIComponent (this.originalCategory); | url += '&hotcat_removecat=' + encodeURIComponent (this.originalCategory); | ||
if (comment) url = | if (comment) url += '&hotcat_comment=' + encodeURIComponent (comment); | ||
if (this.noCommit || HotCat.no_autocommit) url = url + '& | if (this.noCommit || HotCat.no_autocommit) url += '&hotcat_nocommit=1'; | ||
if (!HotCat.single_minor) url += '&hotcat_major=1'; | |||
document.location = url; | document.location = url; | ||
} | } | ||
| שורה 1,538: | שורה 1,551: | ||
+ '&action=edit'; | + '&action=edit'; | ||
if (noCommit || HotCat.no_autocommit) editlk += '&hotcat_nocommit=1'; | if (noCommit || HotCat.no_autocommit) editlk += '&hotcat_nocommit=1'; | ||
if (!HotCat.single_minor) editlk += '&hotcat_major=1'; | |||
document.location = | document.location = | ||
editlk + '&hotcat_removecat=' + encodeURIComponent (this.originalCategory); | editlk + '&hotcat_removecat=' + encodeURIComponent (this.originalCategory); | ||
| שורה 2,033: | שורה 2,047: | ||
? JSconfig.keys['HotCatFixedSuggestions'] | ? JSconfig.keys['HotCatFixedSuggestions'] | ||
: HotCat.fixed_search | : HotCat.fixed_search | ||
) | |||
); | |||
HotCat.single_minor = | |||
(typeof (hotcat_single_changes_are_minor) != 'undefined' | |||
? !!hotcat_single_changes_are_minor | |||
: (typeof (JSconfig) != 'undefined' && typeof (JSconfig.keys['HotCatMinorSingleChanges']) != 'undefined' | |||
? JSconfig.keys['HotCatMinorSingleChanges'] | |||
: HotCat.single_minor | |||
) | ) | ||
); | ); | ||