Permalink
Browse files

protect: adjust regex at RFPP to look for section after the one we wa…

…nt to post to
  • Loading branch information...
MusikAnimal committed Jan 18, 2016
1 parent 554664b commit 6b02198e90cd4e84ab55cd2644d904b0932e6914
Showing with 4 additions and 3 deletions.
  1. +4 −3 modules/twinkleprotect.js
@@ -1403,12 +1403,13 @@ Twinkle.protect.callbacks = {
var reg;
if ( increase ) {
reg = /(\n==\s*Current requests for increase in protection level\s*==\s*\n\s*\{\{[^\}\}]+\}\}\s*\n)([\s\S]*?)\s*(\n==[^=])/;
reg = /(\n==\s*Current requests for reduction in protection level\s*==)/;
} else {
reg = /(\n==\s*Current requests for reduction in protection level\s*==\s*\n\s*\{\{[^\}\}]+\}\}\s*\n)([\s\S]*?)\s*(\n==[^=])/;
reg = /(\n==\s*Current requests for edits to a protected page\s*==)/;
}
var originalTextLength = text.length;
text = text.replace( reg, "$1$2\n\n" + newtag + "\n$3");
text = text.replace( reg, "\n" + newtag + "\n$1");
if (text.length === originalTextLength)
{
var linknode = document.createElement('a');

0 comments on commit 6b02198

Please sign in to comment.