Изменения

Перейти к: навигация, поиск

MediaWiki:Common.js

1300 байт добавлено, 13:59, 10 ноября 2018
Нет описания правки
/* jshint strict:false, browser:true */
$(function(){
window.resizeIframe = function (obj) {
obj.style.height = ($(obj.contentWindow.document.body).find('div').first()[0].scrollHeight) + 'px';
$(obj.contentWindow.document.body).find('a').each(function(){
$(this).attr('target', '_blank');
var href = $(this).attr('href');
href = href.replace(/^.*q=(.*?)&.*$/, "$1");
$(this).attr('href', href);
});
}
$('.docs_import_div').each(function(){
var container = $(this);
var id = container.attr('data-id');
container.html('<iframe class="docs_import_frame" style="width: 100%; border-width: 0px; overflow: hidden;" scrolling="no" id="someId"></iframe>');
var url = '/docs_import.php?id=' + id;
var html;
jQuery.ajax({
url: url,
success: function (result) {
html = result;
html = html.replace(/(<body)(.*?>)/, "$1 style=\"padding: 0px; margin: 0px; max-width: 100%;\" $2<style>#header, #footer {display: none; }</style><div>").replace(/(<\/body)(.*?>)/, "</div>$1$2")
var iframe = container.find('.docs_import_frame');
iframe[0].contentDocument.open();
iframe[0].contentDocument.write(html);
iframe[0].contentDocument.close();
setTimeout(function(){resizeIframe(iframe[0])}, 1);
$(iframe[0].contentWindow).on('resize', function(){resizeIframe(iframe[0])});
}
});
});
})
$(function() {
$('.rose').not('.JS_PROCESSED, .JS_IGNORE').addClass('JS_PROCESSED').each(function() {
$('body').append('<div class="css_connect css_connect__rose_double_resolution"></div>');
var scale = 21; //= cssConnectIsActive('rose_double_resolution') ? 2 : 1;
var wFinal = 300;
var hFinal = 300;

Навигация