var userAgent = navigator.userAgent || navigator.vendor || window.opera; userAgent = userAgent.toLowerCase(); function isIOS () { var isios = (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) ? true : false var ismac = userAgent.indexOf("mac") > - 1 // console.log("mac " + ismac) return isios || ismac } function ischrome () { var res = userAgent.indexOf("chrome") > - 1 console.log("chrome " + res) return res; } function isiPhone () { var isios = userAgent.match(/iPhone/i) ? true : false return isios } //var isios = isIOS(); $(function () { // if (isios) { // $('body').addClass("ios"); // } setTimeout(function () { $(".root.homeroot").css("opacity", 1); }, 200); //resetEngDate(); }) function newsitemEvent () { // var imgid = 1; $(".news-item").each(function (index, obj) { var that = this; var h = $(this).height(); var w = $(this).width(); if ($(this).hasClass("pic")) { var dataid = $(this).attr("id"); var img = new Image(); var imgsrc = $(this).find(".news-img .circle").attr("data-image"); img.src = $(this).find(".news-img .circle").attr("data-image"); img.id = dataid; $(this).find(".news-img").find(".circle").css("background-image", "url(" + imgsrc + ")"); img.h = h; img.w = w; img.onload = function () { var d1 = img.height / img.width; var d2 = img.h / img.w; $("#" + img.id).find(".news-img").attr("data-w", img.width); $("#" + img.id).find(".news-img").attr("data-h", img.height); if (img.height > img.width) { if (d2 > d1) { $("#" + img.id).find(".news-img").find(".circle").css("background-size", img.width * img.h / img.height + "px " + img.h + "px"); } else { $("#" + img.id).find(".news-img").find(".circle").css("background-size", img.w + "px " + img.w * img.height / img.width + "px"); } } else { $("#" + img.id).find(".news-img").find(".circle").css("background-size", img.width * img.h / img.height + "px " + img.h + "px"); } } img.onerror = function () { $("#" + img.id).removeClass("pic").addClass("nopic") } //imgid++; // $(that).find(".news-img").css("height", h + "px"); $(that).find(".news-img").find(".circle").mouseover(function () { $(this).addClass("on"); $(this).parent().addClass("on"); }); $(that).mouseleave(function () { if (!$(this).find(".news-thumb-btn").hasClass("on")) { $(this).find(".news-img").find(".circle").removeClass("on"); $(this).find(".news-img").removeClass("on") } }) } //$(obj).find(".news-thumb").css("top", "100%"); $(obj).find(".news-thumb-btn").click(function () { if ($(this).hasClass("on")) { $(obj).find(".news-thumb").css("top", "100%"); $(this).removeClass("on") } else { $(this).addClass("on") $(obj).find(".news-thumb").css("top", 0); } return false }) $(obj).find(".news-thumb").scroll(function () { var st = $(this).scrollTop(); var sh = $(this)[0].scrollHeight; if (st + h + 10 >= sh) { $(this).addClass("bounceUpAni") } else if (st < 2) { $(this).addClass("bounceDownAni") } else { $(this).removeClass("bounceUpAni") $(this).removeClass("bounceDownAni") } }) }) } var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] function resetEngDate () { if ($("body").hasClass("eng")) { $(".time,.date").each(function () { var val = $.trim($(this).text()); var datelen = val.length;  if ( val.indexOf(",") > -1) { if (datelen > 0 && datelen < 12 ) { var resetval = val.substring(0, 3) + " 0" + val.substring(4) $(this).text(resetval) } } }) $(".month").each(function () { var m = parseInt($(this).text()); $(this).text(months[m - 1]); }) } } function clearContent () { $(".content .left p").removeAttr("class"); $(".content .left span").removeAttr("style").removeAttr("class"); $(".detail div,.detail p,.detail span,.detail h1,.detail h2,.detail h3,.detail h4,.detail h5,.detail h6,.detail a").each(function () { if ($(this).css("font-size")) $(this).css("font-size", "initial"); if ($(this).css("font-family")) $(this).css("font-family", "none"); if ($(this).css("line-height")) $(this).css("line-height", "unset"); if ($(this).css("font-weight")) $(this).css("font-weight", "initial"); }); $("#m-content .content img").each(function () { if ($(this).attr("src").indexOf("fileTypeImages/") == -1) { $(this).css("width", "100%"); $(this).css("height", "auto"); $(this).css("display", "block"); } }); if($(".content").length > 0) { var hv = $(".content").html().replaceAll("", "").replaceAll("", ""); $(".content").html(hv); } }