الفرق بين المراجعتين لصفحة: «ميدياويكي:Gadget-ajaxdiff.js»
dfghjk>Admin ط (۱ نسخه واردشده) |
ط (مراجعة واحدة) |
(لا فرق)
|
المراجعة الحالية بتاريخ ١٨:١٥، ٢ أغسطس ٢٠٢٣
(function(mw, $){
$('body').append('<div id="ajaxdiff"><div id="closeDiffAjax">[× بستن]</div><div id="diffAjaxBody"></div></div>');
$('.mw-changeslist li > a:first-child').each(function(){
if ($(this).text() == 'تفاوت') {
$('<a href="#" class="ajaxdifflink">*</a>').insertAfter($(this));
}
});
$(document).on('click', '.ajaxdifflink', function(e){
var difflink = $(this).prev('a');
$.ajax({
url: difflink.attr('href') + '&diffonly=yes',
method: 'GET',
success: function(diffajax){
$('#diffAjaxBody').html($(diffajax).filter('#content').html());
$('#ajaxdiff').fadeIn();
}
});
e.preventDefault();
return false;
});
$("#closeDiffAjax").click(function(){
$('#ajaxdiff').fadeOut();
})
mw.util.addCSS(
"#ajaxdiff {position: fixed;margin: 0 auto; right: 0; left: 0; top: 50px; width: 70%; display: none; background: #ffffff; border: 5px solid #36c; border-radius: 10px; max-height: 400px; overflow-x: hidden; overflow-y: scroll; font-size: 95%;}" +
"#ajaxdiff .firstHeading {background: #fc3; border-radius: 10px;}" +
"#closeDiffAjax {display: inline-block; margin: 5px 4px; color: #ff2f00; font-weight: bold; cursor: pointer; position: fixed; top: 26px;}" +
".ajaxdifflink {font-size: 20px; line-height: 20px; color: #7d42cc; font-weight: bold; margin-right: 5px;}" +
"#ajaxdiff .diffchange{line-height:25px}" +
"#ajaxdiff table.diff{border:none;border-spacing:4px;margin:0;width:100%;table-layout:fixed}" +
"#ajaxdiff table.diff td{padding:0.33em 0.5em}" +
"#ajaxdiff table.diff td.diff-marker{padding:0.25em}" +
"#ajaxdiff table.diff col.diff-marker{width:2%}" +
"#ajaxdiff table.diff col.diff-content{width:48%}" +
"#ajaxdiff table.diff td div{word-wrap:break-word}" +
"#ajaxdiff td.diff-otitle, #ajaxdiff td.diff-ntitle{text-align:center}" +
"#ajaxdiff td.diff-lineno{font-weight:bold}" +
"#ajaxdiff td.diff-marker{text-align:left;font-weight:bold;font-size:1.25em;line-height:1.2}" +
"#ajaxdiff td.diff-addedline, #ajaxdiff td.diff-deletedline, #ajaxdiff td.diff-context{font-size:88%;line-height:1.6;vertical-align:top;white-space:-moz-pre-wrap;white-space:pre-wrap;border-style:solid;border-width:1px 4px 1px 1px;border-radius:0.33em}" +
"#ajaxdiff td.diff-addedline{border-color:#a3d3ff}" +
"#ajaxdiff td.diff-deletedline{border-color:#ffe49c}" +
"#ajaxdiff td.diff-context{background:#f9f9f9;border-color:#e6e6e6;color:#333}" +
"#ajaxdiff .diffchange{font-weight:bold;text-decoration:none}" +
"#ajaxdiff td.diff-addedline .diffchange, #ajaxdiff td.diff-deletedline .diffchange{border-radius:0.33em;padding:0.25em 0}" +
"#ajaxdiff td.diff-addedline .diffchange{background:#d8ecff}" +
"#ajaxdiff td.diff-deletedline .diffchange{background:#feeec8}" +
"#ajaxdiff .diff-currentversion-title, #ajaxdiff .diff{direction:rtl;unicode-bidi:embed}" +
"#ajaxdiff .diff-contentalign-right td{direction:rtl;unicode-bidi:embed}" +
"#ajaxdiff .diff-contentalign-left td{direction:ltr;unicode-bidi:embed}" +
"#ajaxdiff .diff-multi, #ajaxdiff .diff-otitle, #ajaxdiff .diff-ntitle, #ajaxdiff .diff-lineno{direction:rtl !important;unicode-bidi:embed}"
);
}(mediaWiki, jQuery));