Answer the question
In order to leave comments, you need to log in
Why doesn't this code work in IE?
Why doesn't this code work in IE?
All code
jQuery().ready(function () {
alert('test');
document.addEventListener('copy', function (e) {
e.preventDefault();
var selection = window.getSelection().toString();
var escaped = selection + ' Узнать больше: ' + document.location.href;
if (window.clipboardData) {// IE
window.clipboardData.setData('Text', escaped);
} else if (e.clipboardData) {
e.clipboardData.setData('text/plain', escaped);
}
});
});
//типа класс догрузки и массштабирования ленты новостей (всех 3х)
class NewsLoader {
constructor($container, $instance = undefined) {
var that = this;
this.$container = $container;
this.$instance = $instance != undefined ? $instance : $container.siblings('div').eq(0);
this.next_news = function ($data_container) {
$data_container.attr('data-downloaded', 1);
var action = $data_container.attr('data-action');
var news_count = $data_container.attr('data-count');
var news_count_delta = $data_container.attr('data-count-delta');
var data = {
action: action,
news_count: news_count,
news_count_delta: news_count_delta,
news_expert_category: $data_container.attr('data-expert-category'),
news_category: $data_container.attr('data-category')
};
jQuery.post(myajax.url, data, function (response) {
$data_container.append(response);
$data_container.attr('data-count', parseInt(news_count) + parseInt(news_count_delta));
$data_container.attr('data-downloaded', 0);
});
};
this.start = function () {
$(document).ready(function () {
if (that.$container.length > 0 && that.$instance.length > 0) {
var $data_container = that.$container.find(".data_container");
var is_mobile = $data_container.attr('data-is-mobile');
if ($data_container.length > 0 && !is_mobile) {
that.next_news($data_container);
$data_container.scroll(function (event) {
var st = $(this).scrollTop();
var pheight = that.$instance.height() - 104;
if (pheight < 600)
pheight = 600;
var phalf = pheight / 2;
var h = $(this).get(0).scrollHeight;
var is_downloaded = $data_container.attr('data-downloaded');
if (((h - st - pheight) < phalf) && (is_downloaded == 0)) {
that.next_news($data_container);
}
});
$(window).load(function () {
$data_container.height(that.$instance.height() - 104);
if ($(window).width() < 640) {
$data_container.height($(window).height() - $data_container.offset().top - 20);
}
});
$(window).resize(function () {
$data_container.height(that.$instance.height() - 104);
if ($(window).width() < 640) {
$data_container.height($(window).height() - $data_container.offset().top - 20);
}
});
}
}
});
};
this.start();
}
}
$(document).ready(function () {
var $tabswidget = $('#news3_block .scroll-pane');
if ($tabswidget.length > 0 && !$tabswidget.attr('data-is-mobile')) {
$tabswidget.height('950px');
$tabswidget.scroll(function (event) {
});
}
});
class NewsLoader {
constructor($container, $instance = undefined) {
var that = this;
this.$container = $container;
this.$instance = $instance != undefined ? $instance : $container.siblings('div').eq(0);
this.next_news = function ($data_container) {
$data_container.attr('data-downloaded', 1);
var action = $data_container.attr('data-action');
var news_count = $data_container.attr('data-count');
var news_count_delta = $data_container.attr('data-count-delta');
var data = {
action: action,
news_count: news_count,
news_count_delta: news_count_delta,
news_expert_category: $data_container.attr('data-expert-category'),
news_category: $data_container.attr('data-category')
};
jQuery.post(myajax.url, data, function (response) {
$data_container.append(response);
$data_container.attr('data-count', parseInt(news_count) + parseInt(news_count_delta));
$data_container.attr('data-downloaded', 0);
});
};
this.start = function () {
$(document).ready(function () {
if (that.$container.length > 0 && that.$instance.length > 0) {
var $data_container = that.$container.find(".data_container");
var is_mobile = $data_container.attr('data-is-mobile');
if ($data_container.length > 0 && !is_mobile) {
that.next_news($data_container);
$data_container.scroll(function (event) {
var st = $(this).scrollTop();
var pheight = that.$instance.height() - 104;
if (pheight < 600)
pheight = 600;
var phalf = pheight / 2;
var h = $(this).get(0).scrollHeight;
var is_downloaded = $data_container.attr('data-downloaded');
if (((h - st - pheight) < phalf) && (is_downloaded == 0)) {
that.next_news($data_container);
}
});
$(window).load(function () {
$data_container.height(that.$instance.height() - 104);
if ($(window).width() < 640) {
$data_container.height($(window).height() - $data_container.offset().top - 20);
}
});
$(window).resize(function () {
$data_container.height(that.$instance.height() - 104);
if ($(window).width() < 640) {
$data_container.height($(window).height() - $data_container.offset().top - 20);
}
});
}
}
});
};
this.start();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question