Revision as of 00:09, 9 August 2016 view sourceNQ (talk | contribs)Extended confirmed users, Pending changes reviewers, Rollbackers6,648 edits User:Gary/link_intermediate_revisions.js← Previous edit |
Revision as of 00:38, 9 August 2016 view source NQ (talk | contribs)Extended confirmed users, Pending changes reviewers, Rollbackers6,648 edits changesNext edit → |
Line 1: |
Line 1: |
|
function createDiffMultiLink() |
|
function createDiffMultiLink() |
|
{ |
|
{ |
|
if (!mw.util.getParamValue('diff') || !mw.util.getParamValue('oldid')) return false; |
|
if (!mw.util.getParamValue('oldid')) return false; |
|
$.get(mw.config.get('wgScriptPath') + '/api.php', { action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'timestamp', rvstartid: mw.util.getParamValue('diff'), rvendid: mw.util.getParamValue('oldid'), rvlimit: '5000', format: 'json', indexpageids: 1 }, diffMultiCallback); |
|
$.get(mw.config.get('wgScriptPath') + '/api.php', { action: 'query', prop: 'revisions', titles: mw.config.get('wgPageName'), rvprop: 'timestamp', rvstartid: mw.config.get('wgRevisionId'), rvendid: mw.util.getParamValue('oldid'), rvlimit: '5000', format: 'json', indexpageids: 1 }, diffMultiCallback); |
|
} |
|
} |
|
|
|
|
Line 15: |
Line 15: |
|
{ |
|
{ |
|
if (!response || !response || response == -1) return false; |
|
if (!response || !response || response == -1) return false; |
|
|
|
|
|
|
|
var diffMulti = $('#bodyContent .diff-multi').eq(0); |
|
|
if (!diffMulti.length) return false; |
|
|
|
|
|
var pageId = response; |
|
var pageId = response; |
|
var page = response; |
|
var page = response; |
|
var revisions = page; |
|
var revisions = page; |
|
if (!revisions) return false; |
|
if (!revisions) return false; |
|
|
|
|
|
|
|
var oldid = new Date(revisions); |
|
|
oldid = oldid.getUTCFullYear().toString() + twoDigitPadding(oldid.getUTCMonth() + 1).toString() + oldid.getUTCDate().toString() + twoDigitPadding(oldid.getUTCHours() + 1).toString() + twoDigitPadding(oldid.getUTCMinutes() + 1).toString() + twoDigitPadding(oldid.getUTCSeconds() + 1).toString(); |
|
|
var diff = new Date(revisions); |
|
var diff = new Date(revisions); |
|
diff = diff.getUTCFullYear().toString() + twoDigitPadding(diff.getUTCMonth() + 1).toString() + diff.getUTCDate().toString() + twoDigitPadding(diff.getUTCHours() + 1).toString() + twoDigitPadding(diff.getUTCMinutes() + 1).toString() + twoDigitPadding(diff.getUTCSeconds() + 1).toString(); |
|
diff = diff.getUTCFullYear().toString() + twoDigitPadding(diff.getUTCMonth() + 1).toString() + twoDigitPadding(diff.getUTCDate()).toString() + twoDigitPadding(diff.getUTCHours()).toString() + twoDigitPadding(diff.getUTCMinutes() + 1).toString() + twoDigitPadding(diff.getUTCSeconds()).toString(); |
|
⚫ |
mw.util.addPortletLink('p-tb', mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName') + '&action=history&offset=' + diff, "(Diff History)"); |
|
|
|
⚫ |
var a = $('<a href="' + mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName') + '&action=history&offset=' + diff + '&limit=' + revisions.length + '"></a>').append(diffMulti.contents().eq(0)); |
|
|
diffMulti.prepend(a); |
|
|
} |
|
} |
|
|
|
|