מדיה ויקי:Gadget-wikibugs-patrol.js – הבדלי גרסאות
חלוקת קונטרסים (שיחה | תרומות) מויקיפדיה: https://he.wikipedia.org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Gadget-wikibugs-patrol.js |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
if ( mw.config.get('wgPageName') === 'חב"דפדיה:דיווח_על_טעויות' ) { | if ( mw.config.get('wgPageName') === 'חב\"דפדיה:דיווח_על_טעויות' ) { | ||
$(function(){ | $(function(){ | ||
function reloadNotify(msg) { | function reloadNotify(msg) { | ||
| שורה 8: | שורה 8: | ||
api.postWithToken('csrf', { | api.postWithToken('csrf', { | ||
action: 'edit', | action: 'edit', | ||
title: 'חב"דפדיה:דיווח על טעויות', | title: 'חב\"דפדיה:דיווח על טעויות', | ||
summary: summ, | summary: summ, | ||
minor: 1, | minor: 1, | ||
| שורה 25: | שורה 25: | ||
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('אורכב בהצלחה')); }); | ||
} | } | ||
| שורה 31: | שורה 31: | ||
var summ = prompt('כותרת הדיווח:', 'דיווח שאורכב ב-{{ס:'+'#זמןמ:d xg Y}}'); | var summ = prompt('כותרת הדיווח:', 'דיווח שאורכב ב-{{ס:'+'#זמןמ:d xg Y}}'); | ||
if(summ === null) return; | if(summ === null) return; | ||
var articleName = $(this).parents(' | |||
var articleName = $(this).parents('.mw-heading2').find('h2 a:first').prop('title').replace(' (הדף אינו קיים)', ''), | |||
sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1], | sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[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){ | 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) | for(var rv in data.query.pages) | ||
| שורה 58: | שורה 58: | ||
var summ = prompt('תקציר עריכה למחיקת הדיווח:'); | var summ = prompt('תקציר עריכה למחיקת הדיווח:'); | ||
if(summ === null) return; | if(summ === null) return; | ||
var articleName = $(this).parents(' | var articleName = $(this).parents('.mw-heading2').find('h2 a:first').prop('title').replace(' (הדף אינו קיים)', ''), | ||
sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1], | sectionNum = $(this).parent().find('a').attr('href').match(/section=(.*)/)[1], | ||
api = new mw.Api(); | api = new mw.Api(); | ||
| שורה 76: | שורה 76: | ||
} | } | ||
$(' | $('.mw-heading2').each(function() | ||
{ | { | ||
var archive = $('<a>ארכוב</a>').attr({href:'#'}).css({'font-size':'small', 'margin-right':'20px'}).click(archiveReport), | var archive = $('<a>ארכוב</a>').attr({href:'#'}).css({'font-size':'small', 'margin-right':'20px'}).click(archiveReport), | ||