מדיה ויקי:Gadget-QuickRCDiff.js: הבדלים בין גרסאות בדף

אין תקציר עריכה
מ 25 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-QuickRCDiff.js יובאו
 
(12 גרסאות ביניים של 4 משתמשים אינן מוצגות)
שורה 1: שורה 1:
/*
if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'),['Watchlist','Recentchanges'])!=-1) (function(){
check recentchanges/watchlist diffs directly without navigation to other pages.
var lastRequset, $diffDialog, $diffContent, patrolBtn, thanksBtn, diffId, diffTitle;
Written by: [[User:ערן]]
 
*/
function qRcDiffHandler(content){
$(function(){
mw.loader.load(['jquery.spinner', 'mediawiki.diff.styles']);
if($.inArray(mw.config.get('wgCanonicalSpecialPageName'),['Watchlist','Recentchanges'])==-1) return;
$('.mw-changeslist-edit', content).not('qRcDiff').addClass('qRcDiff').click(function(e) {
mw.loader.load(['mediawiki.action.history.diff','jquery.spinner']);
if (e.target !== this || ! $(this).find('a:contains(היסטוריה)').length) { return; }
var lastRequset, $diffDialog, $diffContent, patrolBtn, diffId, diffTitle;
$('.mw-line-even,.mw-line-odd').click(function(e) {
if (e.target !== this || ! $(this).children('a:contains(היסטוריה)').length) { return; }
//initalizations
//initalizations
if (!$diffContent) $diffContent = $('<div>');
if (!$diffContent) $diffContent = $('<div>');
שורה 24: שורה 20:
}
}
var api = new mw.Api();
var api = new mw.Api();
api.post({
api.postWithToken('patrol', {
action:'patrol',
action:'patrol',
revid: diffId,
revid: diffId
token: mw.user.tokens.get('patrolToken')
}).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).css('background','#ffd480');
$(self).addClass('changeslist-entry-active');
if(lastRequset){
if(lastRequset){
$(lastRequset).css('background','#eee');
$(lastRequset).addClass('changeslist-entry-visited');
$(lastRequset).removeClass('changeslist-entry-active');
}
}
lastRequset = self;
lastRequset = self;
שורה 121: שורה 137:
});
});
});
});
});
}
 
mw.hook( 'wikipage.content' ).add(qRcDiffHandler);
})();