הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
if ( mw.config.get('wgPageName') === 'משתמש:Uziel302/typos' ) { $(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: 'משתמש:Uziel302/typos', 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: 'משתמש:Uziel302/typos', 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: 'משתמש:Uziel302/typos', 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 removeSectionAfterCorrection2(section, basetimestamp, starttimestamp, summ) { var api = new mw.Api(), pagename = this.curPage; api.postWithToken('csrf', { action: 'edit', title: 'משתמש:Uziel302/typos', 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 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: 'העברת חשד לתקלדה מ[[משתמש:Uziel302/typos]]', token: mw.user.tokens.get('editToken'), section: 'new', sectiontitle: sectionTitle, text: ':דיווח מהדף [[משתמש:Uziel302/typos]]\n' + newContent}).then(function(d){ mw.notify($('<a>', {href: talkPage.getUrl(), target: '_blank'}).text('אורכב בהצלחה')); }); } function saveChange1(articleName, content,suspect,correction) { return new mw.Api().post({ action: 'edit', minor: 1, title: articleName, summary: suspect+'->'+correction+' - [[משתמש:Uziel302/typos|תיקון תקלדה בקליק]]', token: mw.user.tokens.get('editToken'), text: content }).done(function(d){ mw.notify(suspect+'->'+correction+' תוקן בהצלחה'); }); } function saveChange(e) { var articleName = $(this).parents('h2').find('a:first').prop('title').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, '/* '+ 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) {removeSection(sectionNum, basetimestamp ,data.curtimestamp,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('ההקשר לא נמצא בערך');return;} saveChange1(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('a:first').prop('title').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, '/* '+ 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('ההקשר לא נמצא בערך');return;} saveChange1(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('a:first').prop('title').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, '/* '+ 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('ההקשר לא נמצא בערך');return;} saveChange1(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('a:first').prop('title').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, '/* '+ articleName +' */ ארכוב'); } else { archiveToTalk(articleName, summ, sectionText).done(function(){removeSection(sectionNum, basetimestamp ,data.curtimestamp, '/* '+ articleName +' */ ארכוב'); }); } } } }); e.preventDefault(); } function removeReport(e) { var articleName = $(this).parents('h2').find('a:first').prop('title').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('a:first').prop('title').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({'font-size':'large', 'margin-right':'20px'}).click(archiveReport), 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); saveChangeBtn2 = $('<a>החלף<a>').attr({href:'#'}).css({'font-size':'large'}).click(saveChange2); saveChangeBtn3 = $('<a>החלף-<a>').attr({href:'#'}).css({'font-size':'large', 'margin-right':'20px'}).click(saveChange3); $(this).find('.mw-editsection').append(['<br><br>',saveChangeBtn2,saveChangeBtn,saveChangeBtn3,archive,removeReportBtn,removeReportBtn2]); }); }); }