jQuery.fn.extend({ disableSelection : function() { this.each(function() { this.onselectstart = function() { return false; }; this.oncontextmenu = function() { return false; }; this.unselectable = "on"; jQuery(this).css('-moz-user-select', 'none'); }); } }); var $j = jQuery.noConflict(); /* Document onLoad */ $j(document).bind("ready", function (event) { $j("#mwc-right-menu a").each(function (element) { $j(this).bind("click", function(event) { event.preventDefault(); var item = $j(this); load_page(item.attr("rel"), "#mwc-right-container", "#mwc-right-preload", ".ja-tab-panels-top"); set_active_page(item); return false; }); }); $j("#mwc-comment-last-menu a").each(function (element) { $j(this).bind("click", function(event) { event.preventDefault(); var item = $j(this); load_page2(item.attr("rel"), "#mwc-comment-last-container", "#mwc-comment-last-preload", ".ja-tab-panels-top"); set_active_page3(item); return false; }); }); $j("#mwc-comment-top-menu a").each(function (element) { $j(this).bind("click", function(event) { event.preventDefault(); var item = $j(this); load_page2(item.attr("rel"), "#mwc-comment-top-container", "#mwc-comment-top-preload", ".ja-tab-panels-top"); set_active_page4(item); return false; }); }); $j("#mwc-hp-sa-menu a").each(function (element) { $j(this).bind("click", function(event) { event.preventDefault(); var item = $j(this); load_page2(item.attr("rel"), "#mwc-data-container2", "#mwc-preload-container2"); set_active_page2(item); return false; }); }); $j("#btn-comment-rules-toggle").bind("click", function(event) { event.preventDefault(); $j("#comment-rules").toggle(); return false; }); $j("#btn-comment-clear").bind("click", function(event) { event.preventDefault(); clearCommentForm(); return false; }); $j(".comment-detail").live("mouseover", function(event) { event.preventDefault(); $j(this).children(".comment-rate").hide(); $j(this).children(".comment-rate-menu").show(); return false; }); $j(".comment-detail").live("mouseout", function(event) { event.preventDefault(); $j(this).children(".comment-rate-menu").hide(); $j(this).children(".comment-rate").show(); return false; }); $j("#frm-comment").submit(function() { var el_output = $j("#comment-add-result"); var el_preload = $j("#comment-add-preload"); // TinyMCE hack: submit textarea tinyMCE.triggerSave(); $j.ajax({ type: "POST", cache: false, url: "http://www.ipoint.cz/mwc/comment_add.php", data: $j("#frm-comment").serialize(), dataType: "html", success: function (data) { if(data.length > 0) { $j(el_output).html(data); var h = $j(el_output).height() + 40; $j(el_output).fadeIn("slow"); } }, error: function (xhr, err) { $j(el_output).html('
Error: ' + xhr.status + '
'); var h = $j(el_output).height() + 40; $j(el_output).fadeIn("slow"); } }); $j(el_preload).ajaxStart(function () { $j(this).css("background", "#ffffff url('http://www.ipoint.cz/mwc/img/preload.gif') no-repeat 0 4px"); $j(this).css("background-color", "transparent"); $j(this).html("Nahrávam data..."); }); $j(el_preload).ajaxStop(function () { $j(this).css("background-image", "none"); $j(this).css("background-color", "transparent"); $j(this).html(""); }); return false; }); $j("#btn-comment-toggle").bind("click", function(event) { event.preventDefault(); if ($j("#comment-add").is(":hidden")) { $j("#comment-add").slideDown("slow"); $j("#btn-comment-toggle").html("Zavřít komentář"); $j.scrollTo("#comment-add", 800); } else { $j("#comment-add").hide(); $j("#btn-comment-toggle").html("Nový komentář"); clearCommentForm(); } return false; }); $j("#btn-comment-toggle").css("cursor", "pointer"); }); /* Clear comment form */ function clearCommentForm() { $j("#comment-add .inputbox").each(function (element) { $j(this).val(''); }); $j("#parent_id").val(''); // TinyMCE hack: clear textarea tinyMCE.getInstanceById('comment').setContent(''); $j("#comment-add-result").html(''); reloadCaptcha(); } /* Right panel */ function set_active_page(page) { $j("#mwc-right-menu a").each(function (element) { $j(this).css({color: "#999999", textDecoration: "none"}); }); page.css({color: "#DA251D", textDecoration: "underline"}); } /* SA panel */ function set_active_page2(page) { $j("#mwc-hp-sa-menu li").each(function (element) { $j(this).removeClass('active'); }); page.parent().addClass('active'); } /* Comment panel */ function set_active_page3(page) { $j("#mwc-comment-last-menu a").each(function (element) { $j(this).css({color: "#999999", textDecoration: "none"}); }); page.css({color: "#DA251D", textDecoration: "underline"}); } /* Comment panel */ function set_active_page4(page) { $j("#mwc-comment-top-menu a").each(function (element) { $j(this).css({color: "#999999", textDecoration: "none"}); }); page.css({color: "#DA251D", textDecoration: "underline"}); } function load_page(page_url, el_output, el_preload, el_parent_div) { /* $j.ajaxSetup({ 'beforeSend' : function(xhr) { xhr.overrideMimeType('text/html; charset=UTF-8'); } }); */ $j.ajax({ type: "post", url: "http://www.ipoint.cz/mwc/" + page_url, dataType: "html", success: function (data) { if(data.length > 0) { $j(el_output).html(data); var h = $j(el_output).height() + 40; $j(el_parent_div).css("height", h + "px"); $j(el_output).fadeIn("slow"); } }, error: function (xhr, err) { $j(el_output).html('
Error: ' + xhr.status + '
'); var h = $j(el_output).height() + 40; $j(el_parent_div).css("height", h + "px"); $j(el_output).fadeIn("slow"); } }); $j(el_preload).ajaxStart(function () { $j(this).css("background", "#ffffff url('http://www.ipoint.cz/mwc/img/preload.gif') no-repeat left center"); $j(this).css("background-color", "transparent"); $j(this).html("Nahrávam data..."); }); $j(el_preload).ajaxStop(function () { $j(this).css("background-image", "none"); $j(this).css("background-color", "transparent"); $j(this).html(""); }); } function load_page2(page_url, el_output, el_preload) { $j.ajax({ type: "post", cache: false, url: "http://www.ipoint.cz/mwc/" + page_url, dataType: "html", success: function (data) { if(data.length > 0) { $j(el_output).html(data); $j(el_output).fadeIn("slow"); } }, error: function (xhr, err) { $j(el_output).html('
Error: ' + xhr.status + '
'); $j(el_output).fadeIn("slow"); } }); $j(el_preload).ajaxStart(function () { $j(this).css("background", "#ffffff url('http://www.ipoint.cz/mwc/img/preload.gif') no-repeat left center"); $j(this).css("background-color", "transparent"); $j(this).html("Nahrávam data..."); }); $j(el_preload).ajaxStop(function () { $j(this).css("background-image", "none"); $j(this).css("background-color", "transparent"); $j(this).html(""); }); } var replacements = [ [/^(\d{1})(\-|\/|\.)(\d{1})\2(\d{4})$/, "$40$30$1"], [/^(\d{1})(\-|\/|\.)(\d{2})\2(\d{4})$/, "$4$30$1"], [/^(\d{2})(\-|\/|\.)(\d{1})\2(\d{4})$/, "$40$3$1"], [/^(\d{2})(\-|\/|\.)(\d{2})\2(\d{4})$/, "$4$3$1"] ]; String.prototype.multiReplace = function (replacements) { var str = this, i; for (i = 0; i < replacements.length; i++) { str = str.replace(replacements[i][0], replacements[i][1]); } return str; }; function checkDate(date) { var date_format = /^(\d{1,2})(\-|\/|\.)(\d{1,2})\2(\d{4})$/; return date_format.test(date); } function checkYear(date) { var date_format = /^(\d{4})$/; return date_format.test(date); } function print(url){ url = url.replace(/\/zpravy\//g, "print/"); var w = window.open(url, "prnt", "width=800, height=600, status=1, scrollbars=1, tollbar=0, resizable=1"); //location.href = url; return false; } function ratePositive(id_comment) { rateComment(id_comment, 1); return false; } function rateNegative(id_comment) { rateComment(id_comment, -1); return false; } function rateComment(id_comment, rating) { load_page2("comment_rate.php?id=" + id_comment + "&rating=" + rating, "#comment-rate-menu-" + id_comment, ".mwc-preload-container"); return false; } function showComments(ent_id, limit, offset) { if (limit == 0) limit = 10; load_page2("comments.php?ent_id=" + ent_id + "&limit=" + limit + "&offset=" + offset, "#comment-panel", ".mwc-preload-container"); $j.scrollTo("div.comment-navi:eq(0)"); return false; } function reportComment(id_comment) { load_page2("comment_report.php?id=" + id_comment, "#comment-rate-menu-" + id_comment, ".mwc-preload-container"); return false; } function removeComment(id_comment) { load_page2("comment_remove.php?id=" + id_comment, "#comment-rate-menu-" + id_comment, ".mwc-preload-container"); return false; } function replyComment(id_comment, title) { if ($j("#comment-add").is(":hidden")) { $j("#comment-add").slideDown("slow"); $j("#btn-comment-toggle").val("Zavřít komentář"); } $j("#parent_id").val(id_comment); $j("#title").val(title); $j.scrollTo("#comment-add", 800); return false; } function postComment() { if ($j("#comment-add").is(":hidden")) { $j("#comment-add").slideDown("slow"); $j("#btn-comment-toggle").val("Zavřít komentář"); } $j("#parent_id").val(""); $j("#title").val(""); $j.scrollTo("#comment-add", 800); return false; } function addThread(name) { load_page2("diskuze_add.php?name=" + $j('#thread_name').val(), "#thread-container", ".mwc-preload-container"); return false; } function removeThread(id_thread) { load_page2("diskuze_remove.php?id=" + id_thread, "#thread-container", ".mwc-preload-container"); return false; } function reloadCaptcha() { d = new Date(); $j("#captcha-image").attr("src", "/mwc/captcha.php?" + d.getTime()); $j("#token").val(""); }