Site Notice
hello, world
User:机智的小鱼君/common.js
From Project-EPB Commons
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
mw.loader.load('https://common.wjghj.cn/js/InPageEdit-advance');
/**
quickDiff({
fromrev: '984',
torev: '1167'
});
**/
function quickDiff(param) {
if ($('[href*="mediawiki.diff.styles"]').length < 1) {
mw.loader.load(mw.config.get('wgScriptPath') + '/load.php?modules=mediawiki.legacy.shared|mediawiki.diff.styles&only=styles', 'text/css');
}
var date = new Date(),
timestamp = date.getTime(); // 缓存时间戳
ssi_modal.show({
fixedHeight: true,
fitScreen: true,
className: 'in-page-edit quick-diff timestamp-' + timestamp,
sizeClass: 'large',
title: '<span class="pageName">正在加载差异……</span>',
content: '<div class="diffArea"><div class="ipe-progress" style="width:100%"><div class="progress-bar"></div></div></div>'
});
$('.in-page-edit.quick-diff .ipe-progress').css('margin-top', $('.in-page-edit.quick-diff .ipe-progress').parent().parent().height() / 2);
if (param === undefined) param = {};
param.action = 'compare';
param.prop = 'diff|diffsize|rel|ids|title|user|comment|parsedcomment|size';
param.format = 'json';
new mw.Api().get(param).then(function (data) {
var diffTable = data.compare['*'];
var toTitle = data.compare.totitle;
$('.quick-diff .pageName').html('比较差异:<u>' + toTitle + '</u>');
$('.quick-diff .diffArea').html(
'<table class="diff diffTable">' +
'<colgroup>' +
'<col class="diff-marker">' +
'<col class="diff-content">' +
'<col class="diff-marker">' +
'<col class="diff-content">' +
'</colgroup>' +
'<tbody>' +
'<tr class="diff-title">' +
'<td colspan="2" class="diff-otitle">diff-otitle placeholder</td>' +
'<td colspan="2" class="diff-ntitle">diff-ntitle placeholder</td>' +
'</tr>' +
diffTable +
'</tbody>' +
'</table>'
);
}).fail(function () {
$('.diffArea').html('Fail');
});
}