function numberFormat(e) { return e > 999 ? (e / 1e3).toFixed(1) + "k" : e } function escapeRegExp(e) { return e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") } function replaceAll(e, t, a) { return e.replace(new RegExp(escapeRegExp(t), "g"), a) } function getParameterByName(e) { e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var t = new RegExp("[\\?&]" + e + "=([^]*)"), a = t.exec(location.search); return null == a ? "" : decodeURIComponent(a[1].replace(/\+/g, " ")) } function setCookie(e, t, a) { var r = new Date; r.setTime(r.getTime() + 24 * a * 60 * 60 * 1e3); var n = "expires=" + r.toUTCString(); document.cookie = e + "=" + t + "; " + n } function getCookie(e) { for (var t = e + "=", a = document.cookie.split(";"), r = 0; r < a.length; r++) { for (var n = a[r]; " " == n.charAt(0);) n = n.substring(1); if (-1 != n.indexOf(t)) return n.substring(t.length, n.length) } return "" } function writetoauthor() { $(".writertoauthor").on("click", function() { $(".mailtweet").show() }), $(".closebtn").on("click", function() { $(".mailtweet").hide() }), $(".email").on("click", function() { $(".wrapperdj, .boxdj").show() }), $(".close").on("click", function() { $(".wrapperdj, .boxdj, .mailtweet").hide() }) } function maxCount(e) { var t = 140; $("#textarea_feedback").html(t + " characters remaining"), $("#tweetmsg").keyup(function() { var e = $("#tweetmsg").val().length, a = t - e; $("#textarea_feedback").html(a + " characters remaining") }) } function validateWriterToAuthor() { var e = document.writertoa; return "" == e.name.value ? (alert("Please enter your name"), !1) : e.name.value.length < 3 ? (alert("Your name should contain atleast 4 characters."), !1) : "" == e.email.value ? (alert("Please enter your email"), !1) : "no" == validate_email_new(e.email.value) ? (alert("Please enter a valid email"), !1) : e.email.value.length < 5 ? (alert("Your email should contain atleast 5 characters."), !1) : "" == e.subject.value ? (alert("Please enter a subject"), !1) : "" == e.message.value ? (alert("Please enter a message"), !1) : e.message.value.length < 10 ? (alert("Your message should contain atleast 10 characters."), !1) : !0 } function sharingIcon() { $(".share-icon").on("click", function() { $(this).hide(), $(this).next("ul").show(), $(".social-wigd ul").on("mouseleave", function() { $(".social-wigd ul").hide(), $(".share-icon").show() }) }) } function searchtopic(e) { var t = document.getElementById(e); if ("" == t.value.trim()) { $('.showsearch').css('display', 'block'); $('#search_form').hide(); return false; alert("Please enter text to search."); }!1; if ("" != t.value && "" != t.value) { for (var a = t.value, r = "", n = "-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ", i = 0; i < a.length; i++) - 1 == n.indexOf(a.charAt(i)) || (r += " " == a.charAt(i) ? "-" : a.charAt(i)); "" != r && (r = r.toLowerCase()), t.value = r } return window.location.href = SITE_URL_ABS + "topic/" + t.value + "/", !1 } function searchtopicadv() { var e = document.getElementById("searchtopicadvance"); if ("" == e.value) return alert("Please enter text to search."), !1; if ("" != e.value) { for (var t = e.value, a = "", r = "-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ", n = 0; n < t.length; n++) - 1 == r.indexOf(t.charAt(n)) || (a += " " == t.charAt(n) ? "-" : t.charAt(n)); "" != a && (a = a.toLowerCase()), e.value = a } if (getstart = "0", "" != $("#startdate").val() && (getstartdate = $("#startdate").val()), "" != $("#enddate").val() && (getenddate = $("#enddate").val()), "" == $("#searchtopicadvance").val()) return alert("Please enter keyword to search"), !1; getkeyword = $("#searchtopicadvance").val(), getsearch_by = $("#search_by").val(), getsearch_type = $("input[name=search_type]:checked").val(); try { window.history.pushState({ pageTitle: getkeyword }, getkeyword, site_base_url + "topic/" + e.value + "/") } catch (i) {} return $("#story_container").html(""), running = "no", getpage = "search", $(".user #trow").html('0 result for "' + getkeyword + '"'), getNextStoryList(), !1 } function editProfile() { var e = document.profile; return "" == e.social_name.value ? (alert("Please enter your name"), !1) : e.social_name.value.length < 4 ? (alert("Your message should contain atleast 4 characters."), !1) : void 0 } function validate_post() { if ("" == $("input[name=title]").val() || "Header" == $("input[name=title]").val()) return $("input[name=title]").addClass("error"), !1; if ($("input[name=title]").removeClass("error"), "" == $("input[name=short_description]").val() || "Sub Header" == $("input[name=short_description]").val()) return $("input[name=short_description]").addClass("error"), !1; if ($("input[name=short_description]").removeClass("error"), "" == $("input[name=category_id]").val()) return $(".dropdowndt").addClass("error"), !1; $(".dropdowndt").removeClass("error"); var e = tinyMCE.getContent("full_description"); if ("" == e) return $(".mce-tinymce").addClass("error"), !1; if ($(".mce-tinymce").removeClass("error"), "" == $("input[name=id]").val()) { if ("" == $("#header_image").val() && "" == $("#header_image_url").val()) return $(".cover-pic,#header_image,#header_image_url").addClass("error"), !1; $(".cover-pic,#header_image,#header_image_url").removeClass("error") } return "" == $("input[name=header_image_caption]").val() ? ($("input[name=header_image_caption]").addClass("error"), !1) : void $("input[name=header_image_caption]").removeClass("error") } function validate_email_new(e) { return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e) ? "yes" : "no" } function validateContactL() { var e = document.contactus; return "" == e.message.value ? (alert("Please enter a message"), !1) : e.message.value.length < 10 ? (alert("Your message should contain atleast 10 characters."), !1) : void 0 } function validateContactWL() { var e = document.contactus; return "" == e.email.value ? (alert("Please enter your email"), !1) : "no" == validate_email_new(e.email.value) ? (alert("Please enter a valid email"), !1) : e.email.value.length < 5 ? (alert("Your email should contain atleast 5 characters."), !1) : "" == e.name.value ? (alert("Please enter your name"), !1) : e.name.value.length < 3 ? (alert("Your name should contain atleast 4 characters."), !1) : "" == e.message.value ? (alert("Please enter a message"), !1) : e.message.value.length < 10 ? (alert("Your message should contain atleast 10 characters."), !1) : !0 } "function" != typeof String.prototype.trim && (String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, "") }); var getstart = 1, getpage = "", getid = "", gettype = "", getuser = "", getstartdate = getenddate = getkeyword = getsearch_type = getsearch_by = "", winwidth = "", w_height = "", w_heigh = "", w_width = ""; $(document).ready(function(e) { function t() { "b" == h ? (d -= 1, $(".st_belt ul").animate({ top: "+=" + c }), 1 == d && (h = "f")) : ($(".st_belt ul").animate({ top: "-=" + c }), d += 1, d == s && (h = "b")) } navigator.userAgent.toLowerCase().match("ipad") && ($(".header-inside").attr("style", "display:block!important;"), $(".mobile-logo").attr("style", "display:none!important;")), $("#mobile-nav").click(function() { $(".main-navigation").slideToggle("slow") }); try { $("img.lazyimg").each(function() { try { var e = $(this).attr("datasrc"); $(this).attr("src", e) } catch (t) {} }) } catch (a) {} sharingIcon(), maxCount(140), writetoauthor(), $("body").prepend('
'), /* $(".new_story").click(function() { $(".wrapper").height($(document).height()), $(".wrapper").show(), $(".twsignin").show(), $(".twsignin").css("left", w_width + 50) }), $(".close_twsignin").click(function() { $(".twsignin").hide(), $(".wrapper").hide() }), */ $(".showsearch").click(function() { $(this).css('display', 'none'), $("#search_form").css({ float: "left", display: "block" }), ga("send", "event", "SEARCH_BUTTON", "click", "OPEN", 1, { nonInteraction: 1 }) }), $("input[name=cancel]").click(function() { $("textarea[name=social_description]").val($("p.user_description").html()), $(".editprooff").hide(10), $(".editproon").show(10), $("#social_name").attr("disabled", "disabled").css({ border: "none" }) }); var r = $(".belt li").length, n = $(".belt li").length / 5, i = $(".belt li").innerWidth(), o = $(".belt li").width(), l = (i + 25) * r; $(".belt").css("width", l), $(".shprevarrow").css("opacity", "0.5"), Math.round(n), counter = 1, $(".shprevarrow").click(function() { 1 == counter ? $(".shprevarrow").css("opacity", "0.5") : ($(".belt").animate({ left: "+=" + o }), counter -= 1, $(".shnextarrow").css("opacity", "1")); try { ga("send", "event", "TRENDING_NEXT_PREV", "click", "NEXT", 1, { nonInteraction: 1 }) } catch (e) {} }), $(".shnextarrow").click(function() { counter >= r + 3 ? $(".shnextarrow").css("opacity", "0.5") : ($(".belt").animate({ left: "-=" + o }), counter += 1, $(".shprevarrow").css("opacity", "1")); try { ga("send", "event", "TRENDING_NEXT_PREV", "click", "PREVIOUS", 1, { nonInteraction: 1 }) } catch (e) {} }), winwidth = $(window).width(), w_height = $(document).height(), w_heigh = $(document).height(), w_width = $(window).width(), w_width -= 350, w_width /= 2, $(".wrapper").click(function() { $(".wrapper,.savewrapper, .comment-box, .share-box,.outerdiv,.rrcomment-box,.prwrapper,.prcomment-box,.twsignin").hide() }), $(".dropdowndt img.flag").addClass("flagvisibility"), $(".dropdowndt dt a").click(function() { $(".dropdowndt dd ul").toggle() }), $(".dropdowndt dd ul li a").click(function() { var e = $(this).html(), t = $(this).attr("value"); $(".dropdowndt dd ul li").removeClass("active"), $(this).parent("li").addClass("active"), $(".dropdowndt dt a span").attr("value", t).html(e), $("#category_id").val(t), $(".dropdowndt dd ul").hide() }), $(document).bind("click", function(e) { var t = $(e.target); t.parents().hasClass("dropdowndt") || $(".dropdowndt dd ul").hide() }), $("#flagSwitcher").click(function() { $(".dropdowndt img.flag").toggleClass("flagvisibility") }), $(".p-share").click(function() { $(".comment-box").css("left", w_width) }), $(".header").focus(function() { "Header" == $(this).val() && $(this).val("") }), $(".header").blur(function() { "" == $(this).val() && $(this).val("Header") }), $(".subheader").focus(function() { "Sub Header" == $(this).val() && $(this).val("") }), $(".subheader").blur(function() { "" == $(this).val() && $(this).val("Sub Header") }), $(".cover-pic").click(function() { $(".wrapper").show(100), $(".outerdiv").show(100) }), $("#upload").addClass("border"), $("#library").click(function() { $(this).addClass("border"), $("#upload").removeClass("border"), $(".library").show(), $(".upload").hide() }), $("#upload").click(function() { $(this).addClass("border"), $("#library").removeClass("border"), $(".upload").show(), $(".library").hide() }), $(".img_select").click(function() { $(".wrapper").hide(100), $(".outerdiv").hide(100) }), $("#search").click(function() { $(this).css("background", "url(http://media2.intoday.in/indiatoday/dailyo/plus.jpg) no-repeat 0"), $("div.txt").toggleClass("txt"), $("#search-box").slideToggle() }), $("#author-story li a").click(function() { $("#author-story li a").removeClass("by-active"), $(this).addClass("by-active"), $("#search_by").val($(this).attr("val")) }); var s = $(".st_belt ul li").length, c = $(".st_belt ul li").height(), d = 1; $("#top_highlight .st_belt").css("height", c), $("#top_highlight .st_belt ul li").css("height", c); var u = setInterval(t, 6e3), h = "f"; $(".st_belt").mouseenter(function() { clearInterval(u) }), $(".st_belt").mouseleave(function() { u = setInterval(t, 6e3) }), $(".edit-btn").click(function() { $(".editproon,#socilname").hide(10), $(".editprooff").show(10), $("#social_name").show(10).removeAttr("disabled").css({ border: "1px solid #000" }) }) }), $(window).scroll(function() { var e = ($("body").height(), $(window).scrollTop()); e > 160 ? ($(".menues").css({ position: "fixed", left: "0", top: "0", width: "100%", "z-index": "9999", "border-bottom": "1px solid rgb(136, 136, 136)", "box-shadow": "0px 0px 5px rgb(0, 0, 0)" }), $(".menu-inner ul li .nav-icon").css("color", "#2B2F31"), $("nav ul li a").addClass("nav_padding"), $(".home-icon").css("display", "none"), $(".app").css("display", "block")) : ($(".menues").css({ position: "relative", top: "0", "box-shadow": "none" }), $(".menu-inner ul li .nav-icon").css("color", "#ffc20f"), $("nav ul li a").addClass("nav_padding"), $(".home-icon").css("display", "block"), $(".app").css("display", "none")) }), $(document).ready(function() { $(window).scroll(function() { var e = $(window).scrollTop(); e > 450 ? $(".prev-storynav, .next-storynav").fadeIn("slow") : $(".prev-storynav, .next-storynav").fadeOut("fast") }) });