Notice: Undefined offset: 1 in /home/plusensd/steelhammer.com.ua/route.php on line 89
$(function() {
$("#delete-news-item").click(function(){
var news_id = $("body.admin .news-content[news-id]").attr("news-id");
if (confirm("Удалить эту новость?")) {
post("news", "news-titles_control", { remove_news_id: news_id }, function() {
location.href = "/";
location.reload();
});
}
});
$("body.manager .news [news-id]").each(function() {
if (this.initialized) return; this.initialized = true;
/*
$(this).dblclick(function() {
if (confirm("Удалить эту новость?")) {
post("news", "news-titles_control", { remove_news_id: $(this).attr("news-id") }, function() {
location.reload();
});
}
});*/
$(".photo", this).on("dropbox", function() {
var $this = $(this);
var imageData = $this.data("dropbox")[0];
var backgroundImage = $this.css("background-image");
$this.css("background-image", "url('" + imageData + "')");
setTimeout(function() {
if (confirm("Сохранить новую картинку для новости?")) {
post("news", "news-titles_control", { photo: imageData, news_id: $this.parents("[news-id]").attr("news-id") });
} else {
$this.css("background-image", backgroundImage);
}
}, 100);
}).dblclick(function(e) {
e.stopPropagation();
var $this = $(this);
if ($this.css("background-image").indexOf("/news-default.png") == -1) {
if (confirm("Установить стандартную картинку для новости?")) {
post("news", "news-titles_control", { remove_photo_news_id: $this.parents("[news-id]").attr("news-id") }, function() {
$this.css("background-image", "url('/_common/img/news-default.png')");
});
}
}
});
});
$("body").on("click", "div[news-id]", function(){
var id = $(this).attr("news-id");
location.href = "/news/news-item/"+id;
});
});