User:小躍/common.js: Difference between revisions
< User:小躍
Content deleted Content added
m Fix |
m +match |
||
Line 5: | Line 5: | ||
name:'Vote:Keep', |
name:'Vote:Keep', |
||
script: function(editor) { |
script: function(editor) { |
||
if($('#wpTextBox1').val().match(new RegExp('<!--Place votes ABOVE this line-->','i'))){ |
|||
⚫ | |||
}else{ |
|||
⚫ | |||
} |
|||
editor |
editor |
||
⚫ | |||
.appendEditSummary('Vote Keep using Pathoschild.TemplateScript') |
.appendEditSummary('Vote Keep using Pathoschild.TemplateScript') |
||
.options({ minor: true}) |
.options({ minor: true}) |
||
Line 15: | Line 20: | ||
name:'Say:Thanks', |
name:'Say:Thanks', |
||
script: function(editor) { |
script: function(editor) { |
||
if($('#wpTextBox1').val().match(new RegExp('<!--Place votes ABOVE this line-->','i'))){ |
|||
editor.replace(new RegExp('<!--Place votes ABOVE','i'),'*Thanks for your Stewards work. --~~'+'~~\n<!--Place votes ABOVE'); |
|||
}else{ |
|||
editor.replace(new RegExp('<section end','i'),'*Thanks for your Stewards work. --~~'+'~~\n<section end'); |
|||
} |
|||
editor |
editor |
||
⚫ | |||
.appendEditSummary('Say Thanks using Pathoschild.TemplateScript') |
.appendEditSummary('Say Thanks using Pathoschild.TemplateScript') |
||
.options({ minor: true}) |
.options({ minor: true}) |
Revision as of 08:55, 12 February 2018
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
if(mw.config.get('wgPageName').match(/Stewards\/Confirm\/[2][0-9][0-9][0-9]\//)&&$.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1){
pathoschild.TemplateScript.add([
{
name:'Vote:Keep',
script: function(editor) {
if($('#wpTextBox1').val().match(new RegExp('<!--Place votes ABOVE this line-->','i'))){
editor.replace(new RegExp('<!--Place votes ABOVE','i'),'*{{'+'k'+'}}--~~'+'~~\n<!--Place votes ABOVE');
}else{
editor.replace(new RegExp('<section end','i'),'*{{'+'k'+'}}--~~'+'~~\n<section end');
}
editor
.appendEditSummary('Vote Keep using Pathoschild.TemplateScript')
.options({ minor: true})
.clickDiff();
}
},
{
name:'Say:Thanks',
script: function(editor) {
if($('#wpTextBox1').val().match(new RegExp('<!--Place votes ABOVE this line-->','i'))){
editor.replace(new RegExp('<!--Place votes ABOVE','i'),'*Thanks for your Stewards work. --~~'+'~~\n<!--Place votes ABOVE');
}else{
editor.replace(new RegExp('<section end','i'),'*Thanks for your Stewards work. --~~'+'~~\n<section end');
}
editor
.appendEditSummary('Say Thanks using Pathoschild.TemplateScript')
.options({ minor: true})
.clickDiff();
}
}
]);
}
});//PT. end