אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Gadget-wikibugs-patrol-clone.js"

פון המכלול
קפיצה לניווט קפיצה לחיפוש
(געשאַפן בלאַט מיט 'var p_n = mw.config.get('wgPageName'); var pn = p_n.replace(/_/, ' '); if ( p_n.match(/^המכלול:תיקון_תקלדות_בקליק$/) || p_n.match(/^המכלול:תיקון_תקלדות_בקליק\/[0-9]+$/) ) { $(function(){ function reloadNotify(msg) { mw.notify(msg).done(function(){ window.location.reload(); }); } function removeSection(section, basetimestamp, starttimestamp, summ) { var api = new mw.Api(), pagename = this.curPage; api....')
 
(קודם?)
 
(7 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן)
שורה 2: שורה 2:
var pn = p_n.replace(/_/, ' ');
var pn = p_n.replace(/_/, ' ');


if ( p_n.match(/^המכלול:תיקון_תקלדות_בקליק$/) || p_n.match(/^המכלול:תיקון_תקלדות_בקליק\/[0-9]+$/) ) {
if (p_n.match(/^המכלול:תיקון_סופרים$/) || p_n.match(/^המכלול:תיקון_סופרים\/[0-9]+$/)) {
$(function(){
    $(function () {
function reloadNotify(msg) {
        function reloadNotify(msg) {
mw.notify(msg).done(function(){ window.location.reload(); });
            mw.notify(msg).done(function () { window.location.reload(); });
}
        }


function removeSection(section, basetimestamp, starttimestamp, summ) {
        function removeSection(section, basetimestamp, starttimestamp, summ) {
var api = new mw.Api(), pagename = this.curPage;
            var api = new mw.Api(), pagename = this.curPage;
api.postWithToken('csrf', {
            api.postWithToken('csrf', {
action: 'edit',
                action: 'edit',
title: pn,
                title: pn,
summary: summ,
                summary: summ,
minor: 1,
                minor: 1,
basetimestamp: basetimestamp,
                basetimestamp: basetimestamp,
starttimestamp: starttimestamp,
                starttimestamp: starttimestamp,
text: '',
                text: '',
section: section
                section: section
}).done(function(d) {
            }).done(function (d) {
if (d && d.edit && d.edit.result == 'Success') {
                if (d && d.edit && d.edit.result == 'Success') {
mw.notify('הוסר, יעודכן ברענון');
                    mw.notify('הוסר, יעודכן ברענון');
}
                }
});
            });
}
        }
function removeSection2(section, basetimestamp, starttimestamp, summ) {
        function removeSection2(section, basetimestamp, starttimestamp, summ) {
var api = new mw.Api(), pagename = this.curPage;
            var api = new mw.Api(), pagename = this.curPage;
api.postWithToken('csrf', {
            api.postWithToken('csrf', {
action: 'edit',
                action: 'edit',
title: pn,
                title: pn,
summary: summ,
                summary: summ,
minor: 1,
                minor: 1,
basetimestamp: basetimestamp,
                basetimestamp: basetimestamp,
starttimestamp: starttimestamp,
                starttimestamp: starttimestamp,
text: '',
                text: '',
section: section
                section: section
}).done(function(d) {
            }).done(function (d) {
if (d && d.edit && d.edit.result == 'Success') {
                if (d && d.edit && d.edit.result == 'Success') {
reloadNotify('הוסר');
                    reloadNotify('הוסר');
}
                }
});
            });
}
        }
function removeSectionAfterCorrection(section, basetimestamp, starttimestamp, summ) {
        function removeSectionAfterCorrection(section, basetimestamp, starttimestamp, summ) {
var api = new mw.Api(), pagename = this.curPage;
            var api = new mw.Api(), pagename = this.curPage;
api.postWithToken('csrf', {
            api.postWithToken('csrf', {
action: 'edit',
                action: 'edit',
title: pn,
                title: pn,
summary: summ,
                summary: summ,
minor: 1,
                minor: 1,
basetimestamp: basetimestamp,
                basetimestamp: basetimestamp,
starttimestamp: starttimestamp,
                starttimestamp: starttimestamp,
text: '',
                text: '',
section: section
                section: section
}).done(function(d) {
            }).done(function (d) {
if (d && d.edit && d.edit.result == 'Success') {
                if (d && d.edit && d.edit.result == 'Success') {
}
                }
});
            });
}
        }
function removeSectionAfterCorrection2(section, basetimestamp, starttimestamp, summ) {
        function removeSectionAfterCorrection2(section, basetimestamp, starttimestamp, summ) {
var api = new mw.Api(), pagename = this.curPage;
            var api = new mw.Api(), pagename = this.curPage;
api.postWithToken('csrf', {
            api.postWithToken('csrf', {
action: 'edit',
                action: 'edit',
title: pn,
                title: pn,
summary: summ,
                summary: summ,
minor: 1,
                minor: 1,
basetimestamp: basetimestamp,
                basetimestamp: basetimestamp,
starttimestamp: starttimestamp,
                starttimestamp: starttimestamp,
text: '',
                text: '',
section: section
                section: section
}).done(function(d) {
            }).done(function (d) {
if (d && d.edit && d.edit.result == 'Success') {
                if (d && d.edit && d.edit.result == 'Success') {
}
                }
});
            });
}
        }


function archiveToTalk(articleName, sectionTitle, content) {
        function archiveToTalk(articleName, sectionTitle, content) {
var talkPage = new mw.Title(articleName).getTalkPage(),
            var talkPage = new mw.Title(articleName).getTalkPage(),
newContent = content.replace(/== .+? ==\n+/, '').replace(/\{\{\/מצב\|.+?\}\}/, '');
                newContent = content.replace(/== .+? ==\n+/, '').replace(/\{\{\/מצב\|.+?\}\}/, '');
return new mw.Api().post({action: 'edit', minor: 1, title: talkPage.getPrefixedText(), summary: 'העברת חשד לתקלדה מ[[המכלול:תיקון תקלדות בקליק]]', token: mw.user.tokens.get('csrfToken'), section: 'new', sectiontitle: sectionTitle, text: ':דיווח מהדף [[המכלול:דיווח על תקלדות]]\n' + newContent}).then(function(d){ mw.notify($('<a>', {href: talkPage.getUrl(), target: '_blank'}).text('אורכב בהצלחה')); });
            return new mw.Api().post({ action: 'edit', minor: 1, title: talkPage.getPrefixedText(), summary: 'העברת חשד לתקלדה מ[[המכלול:תיקון תקלדות בקליק]]', token: mw.user.tokens.get('csrfToken'), section: 'new', sectiontitle: sectionTitle, text: ':דיווח מהדף [[המכלול:דיווח על תקלדות]]\n' + newContent }).then(function (d) { mw.notify($('<a>', { href: talkPage.getUrl(), target: '_blank' }).text('אורכב בהצלחה')); });
}
        }
function saveChangereload(articleName, content,suspect,correction) {
        function saveChangereload(articleName, content, suspect, correction) {
return new mw.Api().post({
            return new mw.Api().post({
action: 'edit',  
                action: 'edit',
minor: 1,  
                minor: 1,
title: articleName,  
                title: articleName,
summary: suspect+'->'+correction+' - [[המכלול:תיקון תקלדות בקליק|תיקון תקלדה בקליק]]',
                summary: suspect + '->' + correction + ' - [[המכלול:תיקון סופרים|תיקון סופרים]]',
token: mw.user.tokens.get('csrfToken'),  
                token: mw.user.tokens.get('csrfToken'),
text: content,
                text: content,
tags: 'תקלדה-בקליק'
                tags: 'תיקון סופרים'
}).done(function(d){
            }).done(function (d) {
reloadNotify($('<a>', {href: 'https://he.wikipedia.org/w/index.php?title='+articleName+'&diff=curr&oldid=prev', target: '_blank'}).text('תוקן! לחץ להשוואת גרסאות'));
                reloadNotify($('<a>', { href: 'https://yi.hamichlol.org.il/w/index.php?title=' + articleName + '&diff=curr&oldid=prev', target: '_blank' }).text('פארראכטן! לחץ להשוואת גרסאות'));
});
            });
}
        }
function saveChangenoreload(articleName, content,suspect,correction) {
        function saveChangenoreload(articleName, content, suspect, correction) {
return new mw.Api().post({
            return new mw.Api().post({
action: 'edit',  
                action: 'edit',
minor: 1,  
                minor: 1,
title: articleName,  
                title: articleName,
summary: suspect+'->'+correction+' - [[המכלול:תיקון תקלדות בקליק|תיקון תקלדה בקליק]]',
                summary: suspect + '->' + correction + ' - [[המכלול:תיקון סופרים|תיקון סופרים]]',
token: mw.user.tokens.get('csrfToken'),  
                token: mw.user.tokens.get('csrfToken'),
text: content,
                text: content,
tags: 'תקלדה-בקליק'
                tags: 'תיקון סופרים'
}).done(function(d){
            }).done(function (d) {
mw.notify($('<a>', {href: 'https://he.wikipedia.org/w/index.php?title='+articleName+'&diff=curr&oldid=prev', target: '_blank'}).text('תוקן! לחץ להשוואת גרסאות'));
                mw.notify($('<a>', { href: 'https://yi.hamichlol.org.il/w/index.php?title=' + articleName + '&diff=curr&oldid=prev', target: '_blank' }).text('פארראכטן! לחץ להשוואת גרסאות'));
});
            });
}
        }
function saveChange(e) {
        function saveChange(e) {
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
api = new mw.Api();
                api = new mw.Api();
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
for(var rv in data.query.pages)
{
var sectionText = data.query.pages[rv].revisions[0]['*'],
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
} else {
if (sectionText.indexOf('{{#lst:')!=-1) {
removeSection(sectionNum, basetimestamp ,data.curtimestamp, '/* '+ articleName +' */ ארכוב');
} else {
var articleText='undefined',newArticleText='undefined',suspect='undefined',correction='wow',approvedCorrection='wow',oldcontext='wwowo',newcontext='undefined';
suspect=sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
correction=sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
oldcontext=sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
newcontext=oldcontext.replace(suspect,correction);
if(newcontext===oldcontext){alert('המילה לא נמצאה בהקשר');return;}
approvedCorrection=prompt('ההקשר:\n'+oldcontext+'\n'+suspect+' יוחלף ב:',suspect);
if(approvedCorrection===null||approvedCorrection===suspect)return;
newcontext=oldcontext.replace(suspect,approvedCorrection);
var api = new mw.Api();
api.get({action: 'query',prop:'revisions',titles: articleName,rvprop:'content',curtimestamp:1
}).done(function(d) {for(var rv in d.query.pages)
{articleText=d.query.pages[rv].revisions[0]["*"];
newArticleText=articleText.replace(oldcontext,newcontext);
if(newArticleText===articleText){
alert('ההקשר לא נמצא בערך');
removeSection(sectionNum, basetimestamp ,data.curtimestamp,suspect+' לא נמצא')
return;}
saveChangenoreload(articleName,newArticleText,suspect,approvedCorrection)
if(newArticleText!=articleText)removeSectionAfterCorrection(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+approvedCorrection+' תוקן!');
if(newArticleText===articleText)removeSectionAfterCorrection(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+approvedCorrection+' לא תוקן!');
}})
}
}


}
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
});
                for (var rv in data.query.pages) {
e.preventDefault();
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
}
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
function saveChange2(e) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
                    } else {
sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
                        if (sectionText.indexOf('{{#lst:') != -1) {
api = new mw.Api();
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, '/* ' + articleName + ' */ ארכוב');
                        } else {
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', approvedCorrection = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
for(var rv in data.query.pages)
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
{
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
var sectionText = data.query.pages[rv].revisions[0]['*'],
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                            newcontext = oldcontext.replace(suspect, correction);
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                            approvedCorrection = prompt('דער קאנטעקסט:\n' + oldcontext + '\n' + suspect + ' וועט ווערן געטוישט צו:', suspect);
} else {
                            if (approvedCorrection === null || approvedCorrection === suspect) return;
if (sectionText.indexOf('{{#lst:')!=-1) {
                            newcontext = oldcontext.replace(suspect, approvedCorrection);
removeSection(sectionNum, basetimestamp ,data.curtimestamp, '/* '+ articleName +' */ ארכוב');
                            var api = new mw.Api();
} else {
                            api.get({
var articleText='undefined',newArticleText='undefined',suspect='undefined',correction='wow',oldcontext='wwowo',newcontext='undefined';
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
suspect=sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            }).done(function (d) {
correction=sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                                for (var rv in d.query.pages) {
oldcontext=sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                                    articleText = d.query.pages[rv].revisions[0]["*"];
newcontext=oldcontext.replace(suspect,correction);
                                    newArticleText = articleText.replace(oldcontext, newcontext);
if(newcontext===oldcontext){alert('המילה לא נמצאה בהקשר');return;}
                                    if (newArticleText === articleText) {
var api = new mw.Api();
                                        alert('דער קאנטעקסט לא נמצא בערך');
api.get({action: 'query',prop:'revisions',titles: articleName,rvprop:'content',curtimestamp:1
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
}).done(function(d) {for(var rv in d.query.pages)
                                        return;
{articleText=d.query.pages[rv].revisions[0]["*"];
                                    }
newArticleText=articleText.replace(oldcontext,newcontext);
                                    saveChangenoreload(articleName, newArticleText, suspect, approvedCorrection)
if(newArticleText===articleText){alert('ההקשר לא נמצא בערך');
                                    if (newArticleText != articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + approvedCorrection + ' פארראכטן!');
removeSection(sectionNum, basetimestamp ,data.curtimestamp,suspect+' לא נמצא')
                                    if (newArticleText === articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + approvedCorrection + ' נישט פארראכטן!');
return;}
                                }
saveChangereload(articleName,newArticleText,suspect,correction)
                            })
if(newArticleText!=articleText)removeSectionAfterCorrection(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+correction+' תוקן!');
                        }
if(newArticleText===articleText)removeSectionAfterCorrection(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+correction+' לא תוקן!');
                    }
}})
}
}


}
                }
});
            });
e.preventDefault();
            e.preventDefault();
}
        }
function saveChange3(e) {
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
api = new mw.Api();
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
for(var rv in data.query.pages)
{
var sectionText = data.query.pages[rv].revisions[0]['*'],
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
} else {
if (sectionText.indexOf('{{#lst:')!=-1) {
removeSection(sectionNum, basetimestamp ,data.curtimestamp, suspect+' לא תוקן');
} else {
var articleText='undefined',newArticleText='undefined',suspect='undefined',correction='wow',oldcontext='wwowo',newcontext='undefined';
suspect=sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
correction=sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
oldcontext=sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
newcontext=oldcontext.replace(suspect,correction);
if(newcontext===oldcontext){alert('המילה לא נמצאה בהקשר');return;}
var api = new mw.Api();
api.get({action: 'query',prop:'revisions',titles: articleName,rvprop:'content',curtimestamp:1
}).done(function(d) {for(var rv in d.query.pages)
{articleText=d.query.pages[rv].revisions[0]["*"];
newArticleText=articleText.replace(oldcontext,newcontext);
if(newArticleText===articleText){alert('ההקשר לא נמצא בערך');
removeSection(sectionNum, basetimestamp ,data.curtimestamp,suspect+' לא נמצא')
return;}
saveChangenoreload(articleName,newArticleText,suspect,correction)
if(newArticleText!=articleText)removeSectionAfterCorrection2(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+correction+' תוקן!');
if(newArticleText===articleText)removeSectionAfterCorrection2(sectionNum, basetimestamp ,data.curtimestamp,suspect+'->'+correction+' לא תוקן!');
}})
}
}


}
        function saveChange2(e) {
});
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
e.preventDefault();
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
}
                api = new mw.Api();
function archiveReport(e) {
var summ = 'חשד לתקלדה';
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
api = new mw.Api();
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
for(var rv in data.query.pages)
{
var sectionText = data.query.pages[rv].revisions[0]['*'],
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
} else {
if (sectionText.indexOf('{{#lst:')!=-1) {
removeSection(sectionNum, basetimestamp ,data.curtimestamp, suspect+' לא תוקן');
} else {
archiveToTalk(articleName, summ, sectionText).done(function(){removeSection(sectionNum, basetimestamp ,data.curtimestamp, suspect+' לא תוקן'); });
}
}


}
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
});
                for (var rv in data.query.pages) {
e.preventDefault();
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
}
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, '/* ' + articleName + ' */ ארכוב');
                        } else {
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                            newcontext = oldcontext.replace(suspect, correction);
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
                            var api = new mw.Api();
                            api.get({
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
                            }).done(function (d) {
                                for (var rv in d.query.pages) {
                                    articleText = d.query.pages[rv].revisions[0]["*"];
                                    newArticleText = articleText.replace(oldcontext, newcontext);
                                    if (newArticleText === articleText) {
                                        alert('דער קאנטעקסט לא נמצא בערך');
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
                                        return;
                                    }
                                    saveChangereload(articleName, newArticleText, suspect, correction)
                                    if (newArticleText != articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' פארראכטן!');
                                    if (newArticleText === articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' נישט פארראכטן!');
                                }
                            })
                        }
                    }


function removeReport(e) {
                }
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
            });
sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
            e.preventDefault();
api = new mw.Api();
        }
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
        function saveChange3(e) {
for(var rv in data.query.pages)
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
{
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
var sectionText = data.query.pages[rv].revisions[0]['*'],
                api = new mw.Api();
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
} else {
var suspect=sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
removeSection(sectionNum, basetimestamp ,data.curtimestamp, suspect+' לא תוקן');
}
}
});
e.preventDefault();
}
function removeReport2(e) {
var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (הדף אינו קיים)', ''),
sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
api = new mw.Api();
api.get( {action:'query',prop:'revisions',titles:mw.config.get('wgPageName'), rvprop:'content|timestamp',rvsection:sectionNum, curtimestamp: 1}).done(function(data){
for(var rv in data.query.pages)
{
var sectionText = data.query.pages[rv].revisions[0]['*'],
basetimestamp = data.query.pages[rv].revisions[0].timestamp;
if ((sectionText.indexOf('== [['+articleName+']] ==') !== 0) && (sectionText.indexOf('== [[:'+articleName+']] ==') !== 0)) {
reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
} else {
var suspect=sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
removeSection2(sectionNum, basetimestamp ,data.curtimestamp, suspect+' לא תוקן');
}
}
});
e.preventDefault();
}


            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                        } else {
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                            newcontext = oldcontext.replace(suspect, correction);
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
                            var api = new mw.Api();
                            api.get({
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
                            }).done(function (d) {
                                for (var rv in d.query.pages) {
                                    articleText = d.query.pages[rv].revisions[0]["*"];
                                    newArticleText = articleText.replace(oldcontext, newcontext);
                                    if (newArticleText === articleText) {
                                        alert('דער קאנטעקסט לא נמצא בערך');
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
                                        return;
                                    }
                                    saveChangenoreload(articleName, newArticleText, suspect, correction)
                                    if (newArticleText != articleText) removeSectionAfterCorrection2(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' פארראכטן!');
                                    if (newArticleText === articleText) removeSectionAfterCorrection2(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' נישט פארראכטן!');
                                }
                            })
                        }
                    }


$('h2').each(function()
                }
{
            });
var archive = $('<a>לבדיקה</a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(archiveReport),
            e.preventDefault();
    removeReportBtn = $('<a>הסר-</a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(removeReport),
        }
    removeReportBtn2 = $('<a>הסר</a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(removeReport2),
 
    saveChangeBtn = $('<a>טפל<a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(saveChange),
        function archiveReport(e) {
    saveChangeBtn2 = $('<a>החלף<a>').attr({href:'#'}).css({'font-size':'large'}).click(saveChange2),
            var summ = 'חשד לתקלדה';
    saveChangeBtn3 = $('<a>החלף-<a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(saveChange3);
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
$(this).find('.mw-editsection').append(['<br><br>',removeReportBtn,saveChangeBtn,saveChangeBtn3,saveChangeBtn2,removeReportBtn2,archive]);
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
});
                api = new mw.Api();
});
 
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                        } else {
                            archiveToTalk(articleName, summ, sectionText).done(function () { removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן'); });
                        }
                    }
 
                }
            });
            e.preventDefault();
        }
 
        function removeReport(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
                api = new mw.Api();
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        var suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                    }
                }
            });
            e.preventDefault();
        }
 
        function removeReport2(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
                api = new mw.Api();
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        var suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                        removeSection2(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                    }
                }
            });
            e.preventDefault();
        }
 
 
        $('h2').each(function () {
            var archive = $('<a>לבדיקה</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(archiveReport),
                removeReportBtn = $('<a>אראפנעמען-</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(removeReport),
                removeReportBtn2 = $('<a>אראפנעמען</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(removeReport2),
                saveChangeBtn = $('<a>באהאנדלט<a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(saveChange),
                saveChangeBtn2 = $('<a>טוישט<a>').attr({ href: '#' }).click(saveChange2),
                saveChangeBtn3 = $('<a>טוישט-<a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(saveChange3);
            $(this).find('.mw-editsection').append([removeReportBtn, saveChangeBtn, saveChangeBtn3, saveChangeBtn2, removeReportBtn2, archive]);
        });
    });
}
}

יעצטיגע רעוויזיע זינט 22:33, 22 יאנואר 2024

var p_n = mw.config.get('wgPageName');
var pn = p_n.replace(/_/, ' ');

if (p_n.match(/^המכלול:תיקון_סופרים$/) || p_n.match(/^המכלול:תיקון_סופרים\/[0-9]+$/)) {
    $(function () {
        function reloadNotify(msg) {
            mw.notify(msg).done(function () { window.location.reload(); });
        }

        function removeSection(section, basetimestamp, starttimestamp, summ) {
            var api = new mw.Api(), pagename = this.curPage;
            api.postWithToken('csrf', {
                action: 'edit',
                title: pn,
                summary: summ,
                minor: 1,
                basetimestamp: basetimestamp,
                starttimestamp: starttimestamp,
                text: '',
                section: section
            }).done(function (d) {
                if (d && d.edit && d.edit.result == 'Success') {
                    mw.notify('הוסר, יעודכן ברענון');
                }
            });
        }
        function removeSection2(section, basetimestamp, starttimestamp, summ) {
            var api = new mw.Api(), pagename = this.curPage;
            api.postWithToken('csrf', {
                action: 'edit',
                title: pn,
                summary: summ,
                minor: 1,
                basetimestamp: basetimestamp,
                starttimestamp: starttimestamp,
                text: '',
                section: section
            }).done(function (d) {
                if (d && d.edit && d.edit.result == 'Success') {
                    reloadNotify('הוסר');
                }
            });
        }
        function removeSectionAfterCorrection(section, basetimestamp, starttimestamp, summ) {
            var api = new mw.Api(), pagename = this.curPage;
            api.postWithToken('csrf', {
                action: 'edit',
                title: pn,
                summary: summ,
                minor: 1,
                basetimestamp: basetimestamp,
                starttimestamp: starttimestamp,
                text: '',
                section: section
            }).done(function (d) {
                if (d && d.edit && d.edit.result == 'Success') {
                }
            });
        }
        function removeSectionAfterCorrection2(section, basetimestamp, starttimestamp, summ) {
            var api = new mw.Api(), pagename = this.curPage;
            api.postWithToken('csrf', {
                action: 'edit',
                title: pn,
                summary: summ,
                minor: 1,
                basetimestamp: basetimestamp,
                starttimestamp: starttimestamp,
                text: '',
                section: section
            }).done(function (d) {
                if (d && d.edit && d.edit.result == 'Success') {
                }
            });
        }

        function archiveToTalk(articleName, sectionTitle, content) {
            var talkPage = new mw.Title(articleName).getTalkPage(),
                newContent = content.replace(/== .+? ==\n+/, '').replace(/\{\{\/מצב\|.+?\}\}/, '');
            return new mw.Api().post({ action: 'edit', minor: 1, title: talkPage.getPrefixedText(), summary: 'העברת חשד לתקלדה מ[[המכלול:תיקון תקלדות בקליק]]', token: mw.user.tokens.get('csrfToken'), section: 'new', sectiontitle: sectionTitle, text: ':דיווח מהדף [[המכלול:דיווח על תקלדות]]\n' + newContent }).then(function (d) { mw.notify($('<a>', { href: talkPage.getUrl(), target: '_blank' }).text('אורכב בהצלחה')); });
        }
        function saveChangereload(articleName, content, suspect, correction) {
            return new mw.Api().post({
                action: 'edit',
                minor: 1,
                title: articleName,
                summary: suspect + '->' + correction + ' - [[המכלול:תיקון סופרים|תיקון סופרים]]',
                token: mw.user.tokens.get('csrfToken'),
                text: content,
                tags: 'תיקון סופרים'
            }).done(function (d) {
                reloadNotify($('<a>', { href: 'https://yi.hamichlol.org.il/w/index.php?title=' + articleName + '&diff=curr&oldid=prev', target: '_blank' }).text('פארראכטן! לחץ להשוואת גרסאות'));
            });
        }
        function saveChangenoreload(articleName, content, suspect, correction) {
            return new mw.Api().post({
                action: 'edit',
                minor: 1,
                title: articleName,
                summary: suspect + '->' + correction + ' - [[המכלול:תיקון סופרים|תיקון סופרים]]',
                token: mw.user.tokens.get('csrfToken'),
                text: content,
                tags: 'תיקון סופרים'
            }).done(function (d) {
                mw.notify($('<a>', { href: 'https://yi.hamichlol.org.il/w/index.php?title=' + articleName + '&diff=curr&oldid=prev', target: '_blank' }).text('פארראכטן! לחץ להשוואת גרסאות'));
            });
        }
        function saveChange(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
                api = new mw.Api();

            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, '/* ' + articleName + ' */ ארכוב');
                        } else {
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', approvedCorrection = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                            newcontext = oldcontext.replace(suspect, correction);
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
                            approvedCorrection = prompt('דער קאנטעקסט:\n' + oldcontext + '\n' + suspect + ' וועט ווערן געטוישט צו:', suspect);
                            if (approvedCorrection === null || approvedCorrection === suspect) return;
                            newcontext = oldcontext.replace(suspect, approvedCorrection);
                            var api = new mw.Api();
                            api.get({
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
                            }).done(function (d) {
                                for (var rv in d.query.pages) {
                                    articleText = d.query.pages[rv].revisions[0]["*"];
                                    newArticleText = articleText.replace(oldcontext, newcontext);
                                    if (newArticleText === articleText) {
                                        alert('דער קאנטעקסט לא נמצא בערך');
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
                                        return;
                                    }
                                    saveChangenoreload(articleName, newArticleText, suspect, approvedCorrection)
                                    if (newArticleText != articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + approvedCorrection + ' פארראכטן!');
                                    if (newArticleText === articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + approvedCorrection + ' נישט פארראכטן!');
                                }
                            })
                        }
                    }

                }
            });
            e.preventDefault();
        }

        function saveChange2(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
                api = new mw.Api();

            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, '/* ' + articleName + ' */ ארכוב');
                        } else {
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                            newcontext = oldcontext.replace(suspect, correction);
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
                            var api = new mw.Api();
                            api.get({
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
                            }).done(function (d) {
                                for (var rv in d.query.pages) {
                                    articleText = d.query.pages[rv].revisions[0]["*"];
                                    newArticleText = articleText.replace(oldcontext, newcontext);
                                    if (newArticleText === articleText) {
                                        alert('דער קאנטעקסט לא נמצא בערך');
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
                                        return;
                                    }
                                    saveChangereload(articleName, newArticleText, suspect, correction)
                                    if (newArticleText != articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' פארראכטן!');
                                    if (newArticleText === articleText) removeSectionAfterCorrection(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' נישט פארראכטן!');
                                }
                            })
                        }
                    }

                }
            });
            e.preventDefault();
        }
        function saveChange3(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=([0-9]+)/)[1],
                api = new mw.Api();

            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                        } else {
                            var articleText = 'undefined', newArticleText = 'undefined', suspect = 'undefined', correction = 'wow', oldcontext = 'wwowo', newcontext = 'undefined';
                            suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                            correction = sectionText.replace(/.*\n.*?>(.*)?\?.*\n.*\n.*/, "$1");
                            oldcontext = sectionText.replace(/.*\n.*\n.*? (.*) .*\n.*/, "$1");
                            newcontext = oldcontext.replace(suspect, correction);
                            if (newcontext === oldcontext) { alert('המילה לא נמצאה בהקשר'); return; }
                            var api = new mw.Api();
                            api.get({
                                action: 'query', prop: 'revisions', titles: articleName, rvprop: 'content', curtimestamp: 1
                            }).done(function (d) {
                                for (var rv in d.query.pages) {
                                    articleText = d.query.pages[rv].revisions[0]["*"];
                                    newArticleText = articleText.replace(oldcontext, newcontext);
                                    if (newArticleText === articleText) {
                                        alert('דער קאנטעקסט לא נמצא בערך');
                                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' לא נמצא')
                                        return;
                                    }
                                    saveChangenoreload(articleName, newArticleText, suspect, correction)
                                    if (newArticleText != articleText) removeSectionAfterCorrection2(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' פארראכטן!');
                                    if (newArticleText === articleText) removeSectionAfterCorrection2(sectionNum, basetimestamp, data.curtimestamp, suspect + '->' + correction + ' נישט פארראכטן!');
                                }
                            })
                        }
                    }

                }
            });
            e.preventDefault();
        }

        function archiveReport(e) {
            var summ = 'חשד לתקלדה';
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
                api = new mw.Api();

            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        if (sectionText.indexOf('{{#lst:') != -1) {
                            removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                        } else {
                            archiveToTalk(articleName, summ, sectionText).done(function () { removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן'); });
                        }
                    }

                }
            });
            e.preventDefault();
        }

        function removeReport(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
                api = new mw.Api();
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        var suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                        removeSection(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                    }
                }
            });
            e.preventDefault();
        }

        function removeReport2(e) {
            var articleName = $(this).parents('h2').find('.mw-headline').text().replace(' (בלאַט עקזיסטירט נאכנישט)', ''),
                sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1],
                api = new mw.Api();
            api.get({ action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'content|timestamp', rvsection: sectionNum, curtimestamp: 1 }).done(function (data) {
                for (var rv in data.query.pages) {
                    var sectionText = data.query.pages[rv].revisions[0]['*'],
                        basetimestamp = data.query.pages[rv].revisions[0].timestamp;
                    if ((sectionText.indexOf('== [[' + articleName + ']] ==') !== 0) && (sectionText.indexOf('== [[:' + articleName + ']] ==') !== 0)) {
                        reloadNotify('הפסקה אינה קיימת עוד במקומה. מרענן את הדף');
                    } else {
                        var suspect = sectionText.replace(/.*\n.*?(.*)?\->.*\n.*\n.*/, "$1");
                        removeSection2(sectionNum, basetimestamp, data.curtimestamp, suspect + ' נישט פארראכטן');
                    }
                }
            });
            e.preventDefault();
        }


        $('h2').each(function () {
            var archive = $('<a>לבדיקה</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(archiveReport),
                removeReportBtn = $('<a>אראפנעמען-</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(removeReport),
                removeReportBtn2 = $('<a>אראפנעמען</a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(removeReport2),
                saveChangeBtn = $('<a>באהאנדלט<a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(saveChange),
                saveChangeBtn2 = $('<a>טוישט<a>').attr({ href: '#' }).click(saveChange2),
                saveChangeBtn3 = $('<a>טוישט-<a>').attr({ href: '#' }).css({ 'margin-right': '20px' }).click(saveChange3);
            $(this).find('.mw-editsection').append([removeReportBtn, saveChangeBtn, saveChangeBtn3, saveChangeBtn2, removeReportBtn2, archive]);
        });
    });
}