מדיה ויקי:Gadget-QuickRCDiff.js: הבדלים בין גרסאות בדף
אין תקציר עריכה |
מ 25 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-QuickRCDiff.js יובאו |
||
| (12 גרסאות ביניים של 4 משתמשים אינן מוצגות) | |||
| שורה 1: | שורה 1: | ||
if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'),['Watchlist','Recentchanges'])!=-1) (function(){ | |||
var lastRequset, $diffDialog, $diffContent, patrolBtn, thanksBtn, diffId, diffTitle; | |||
function qRcDiffHandler(content){ | |||
mw.loader.load(['jquery.spinner', 'mediawiki.diff.styles']); | |||
$('.mw-changeslist-edit', content).not('qRcDiff').addClass('qRcDiff').click(function(e) { | |||
mw.loader.load([' | if (e.target !== this || ! $(this).find('a:contains(היסטוריה)').length) { return; } | ||
$('.mw- | |||
if (e.target !== this || ! $(this). | |||
//initalizations | //initalizations | ||
if (!$diffContent) $diffContent = $('<div>'); | if (!$diffContent) $diffContent = $('<div>'); | ||
| שורה 24: | שורה 20: | ||
} | } | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api. | api.postWithToken('patrol', { | ||
action:'patrol', | action:'patrol', | ||
revid: diffId | revid: diffId | ||
}).done(function(data){ | }).done(function(data){ | ||
if (data && data.patrol) { | if (data && data.patrol) { | ||
| שורה 37: | שורה 32: | ||
mw.notify('שגיאה:' + desc); | mw.notify('שגיאה:' + desc); | ||
} | } | ||
}); | |||
}, | |||
'♥': | |||
function(){ | |||
if (!diffId){ | |||
return;//nothing to do | |||
} | |||
var api = new mw.Api(); | |||
api.postWithToken('csrf', { | |||
action:'thank', | |||
source: 'diff', | |||
rev: diffId | |||
}).done(function(data){ | |||
mw.notify('תודה נשלחה לעורך'); | |||
}); | }); | ||
} | } | ||
| שורה 52: | שורה 61: | ||
top: 'auto' | top: 'auto' | ||
}); | }); | ||
patrolBtn = $(":button:contains('!')"); | patrolBtn = $(":button:contains('!')").prop('title', 'סימון כבדוק'), | ||
thanksBtn = $(":button:contains('♥')").prop('title', 'תודה'); | |||
} | } | ||
var self = this, | var self = this, | ||
diffHref = $(this).find('a[href*=oldid]').prop('href'), | diffHref = $(this).find('a[href*=oldid]') | ||
.filter(function(){ | |||
return !$(this) | |||
.hasClass('WLM-icon'); // WLM collision fix | |||
}) | |||
.prop('href'), | |||
unpatrolled = $(this).find('.unpatrolled').length; | unpatrolled = $(this).find('.unpatrolled').length; | ||
diffTitle = $(this).find('.mw-changeslist-title').text(); | diffTitle = $(this).find('.mw-changeslist-title').text(); | ||
| שורה 84: | שורה 99: | ||
{ | { | ||
if (unpatrolled) patrolBtn.show(); | if (unpatrolled) patrolBtn.show(); | ||
$(self). | $(self).addClass('changeslist-entry-active'); | ||
if(lastRequset){ | if(lastRequset){ | ||
$(lastRequset).addClass('changeslist-entry-visited'); | |||
$(lastRequset).removeClass('changeslist-entry-active'); | |||
} | } | ||
lastRequset = self; | lastRequset = self; | ||
| שורה 121: | שורה 137: | ||
}); | }); | ||
}); | }); | ||
}); | } | ||
mw.hook( 'wikipage.content' ).add(qRcDiffHandler); | |||
})(); | |||