var wd = {}; wd.anii = gsap; wd.string_to_object = function() { let a = arguments[0].split(","); let o = {}; $.each(a, function(i, v) { let e = v.split(":"); if (e[1].indexOf("%") > -1) { o[e[0].trim()] = e[1]; return; } o[e[0].trim()] = isNaN(parseFloat(e[1])) ? e[1].trim() : parseFloat(e[1]); }); wd.log(o); return o; }; wd.log = function(msg) { wd.is(function() { console.log(msg); }); }; wd.am = function() { let a = arguments[0].split(";"); wd.anii[a[0]](a[1], wd.string_to_object(a[2])); }; wd.ani = {}; wd.ani.to = function() { wd.anii.to(arguments[0], wd.string_to_object(arguments[1])); } wd.ani.from = function() { wd.anii.from(arguments[0], wd.string_to_object(arguments[1])); } wd.ani.set = function() { wd.anii.set(arguments[0], wd.string_to_object(arguments[1])); } wd.window = { width: $(window).width(), height: $(window).height() }; wd.mo = function() { if (wd.window.width < 768) { arguments[0](); } }; wd.pc = function() { if (wd.window.width > 769) { arguments[0](); } }; wd.dom = function() { let tag = null; if (!arguments.length) { tag = "div"; } if (arguments.length == 1) { tag = arguments[0]; } if (arguments.length == 2) { tag = arguments[1]; } let dom = $(document.createElement(tag)); if (arguments.lenght == 2) { arguments[0].append(dom); } return dom; }; wd.join_html = function() { let a = arguments[0]; let b = arguments[1] || "span"; let c = $.map(a.split(""), function(v, i) { return "<" + b + ">" + v + ""; }); return c.join(""); }; wd.find_id = function() { return $("[id*='" + arguments[0] + "']"); }; wd.break_line = function() { $("[wd-break-line]").not(".wd-done").each(function() { $(this).addClass("wd-done"); $(this).html("

" + $(this).html().replace(/\n/g, "

") + "

"); }); }; wd.img_hover = function() { $("[wd-hover-effect]").not(".wd-done").each(function() { $(this).addClass("wd-done"); $(this).hover(function() { wd.ani.to(this, "scale:1.05"); }, function() { wd.ani.to(this, "scale:1"); }); }); }; wd.clear_space = function() { $("[wd-clear-space]").not(".wd-done").each(function() { $(this).addClass("wd-done"); let text = $(this).text().replace(/\s*/g, ""); $(this).text(text); }); }; wd.wrap = function() { $("[wd-wrap]").not(".wd-done").each(function() { $(this).addClass("wd-done"); if ($(this).parent().hasClass($(this).attr("wd-wrap"))) { return; } $(this).parent().children().filter("[wd-wrap]").wrapAll($("
").addClass($(this).attr("wd-wrap"))); }); }; wd.icon = function() { $("[wd-icon]").not(".wd-done").each(function() { $(this).addClass("wd-done"); let a = $(this).attr("wd-icon"); a = a.replace("-", "_"); if (wd.svg[a]) { $(this).prepend(wd.svg[a]); } }); }; wd.block = function() { let html = "

璇峰厛纭鐢佃剳绔鏋�

鎵嬫満绔€傞厤鍦ㄧ數鑴戠妗嗘灦纭畾鍚�2-3涓伐浣滄棩瀹屾垚

"; if (arguments.length && arguments[0]) { html = arguments[0]; } $("a").attr("href", "javascript:;"); wd.body.addClass("wd-shield-mo").append(html).find(".wd-no-mo-tip").children().prepend(wd.svg.block_phone); } wd.loop = function() { let a; let task = arguments[0]; let handle = function(r) { a = task(); if (a && a.sign) { r(a.data || ""); return true; } }; return new Promise(function(r, s) { let l = function() { if (handle(r)) { return; } requestAnimationFrame(l); }; requestAnimationFrame(l); }); }; wd.check = function() { if (location.host.indexOf("yun300") > -1 && location.host.match(/\d/g).join("").indexOf($(".wd-logo").attr("data-id")) < 0) { return false; } return true; } wd.common = function() { wd.is(function() { $(".w_grid-000, .w_grid-001, .w_grid-002, .w_grid-003").find(" > div").each(function() { $(this).attr("data-wd-selector", "#" + $(this).parent().attr("id") + " > .w_grid"); $(this).find(" > .p_gridbox").each(function(i) { $(this).attr("data-wd-selector", "#" + $(this).parent().parent().attr("id") + " > .w_grid > " + ".p_gridbox:nth-child(" + (i + 1) + ")"); $(this).find("> .p_gridCell").each(function(j) { $(this).attr("data-wd-selector", "#" + $(this).parent().parent().parent().attr("id") + " > .w_grid > " + ".p_gridbox:nth-child(" + (i + 1) + ") > .p_gridCell:nth-child(" + (j + 1) + ")"); }); }); }); }); if ($("#" + wd.index_id).length) { if (wd.index) { wd.index(); } wd.body.addClass("wd wd-index"); } else { if (wd.sub) { wd.sub(); } wd.body.addClass("wd wd-sub"); } } wd.right_float = function(config) { var right = $("
").addClass("wd-right-float"); var email = $("
").addClass("wd-item email").append('' + wd.svg.email + '').append("
" + config.email + "
"); var phone = $("
").addClass("wd-item phone").append('' + wd.svg.phone + '').append("
" + config.tel + "
"); var message = $("
").addClass("wd-item message").append('' + wd.svg.message + '').append("
" + config.message.text + "
"); var top = $("
").addClass("wd-item top").append('' + wd.svg.back_top + ''); right.append(email).append(phone).append(message).append(top); right.find(".wd-item").find("a").filter("[href!='javascript']").each(function() { let href = $(this).attr("href"); $(this).next().each(function() { $(this).html("" + $(this).text() + ""); }); }); wd.body.append(right); right.find(".wd-item").last().click(function() { $("html,body").animate({ scrollTop: 0 }, 1000); }); wd.timeout(function() { right.addClass("wd-show"); }, 500); }; wd.timeout = function() { let a = arguments[0]; let time = arguments[1]; return setTimeout(function() { a(); }, time); }; wd.no_ani = function() { $(arguments[0]).addClass("wd-no-scroll-animation"); }; wd.interval = function() { let a = arguments[0]; let time = arguments[1]; return setInterval(function() { a(); }, time); }; wd.hide = function() { $(arguments[0]).attr("wd-hide", ""); }; wd.is = function(callback) { if (localStorage.getItem("wd")) { callback(); } }; wd.nav_current = function() { let nav = $(wd.nav_selector); if (nav.length) { $("[wd-nav-index]").last().each(function() { let index = $(this).attr("wd-nav-index"); nav.eq(index - 1).addClass("wd-current"); }); } }; wd.auto = function() { wd.nav_current(); wd.break_line(); wd.clear_space(); wd.wrap(); wd.icon(); wd.img_hover(); }; wd.swiper = function(fn) { $("[wd-swiper]").each(function() { let self = $(this); self.addClass("wd-db"); let config = { slidesPerView: parseInt(self.attr("data-view") || 1), spaceBetween: parseInt(self.attr("data-right") || 0), loop: self.attr("data-loop") || true }; if (self.attr("data-autoplay")) { config.autoplay = { delay: parseInt(self.attr("data-autoplay")), disableOnInteraction: false }; } if (self.find(".swiper-pagination").length) { config.pagination = { el: self.find(".swiper-pagination").get(0), type: 'bullets', clickable: true }; } let mo = self.attr("data-view-mo"); if (mo) { config.breakpoints = { 240: { slidesPerView: mo }, 768: { slidesPerView: parseInt(self.attr("data-view") || 1), spaceBetween: parseInt(self.attr("data-right") || 0), } } } new Swiper(this, config); }); }; wd.svg = { close: '', nav_trigger: '', block_phone: '', email: '', phone: '', message: '', back_top: '', profile: '', culture: '', partner: '', contact: '', more_1: '' }; wd.scroll_animation = function(selectors, type) { if (!wd.body.hasClass("wd-scroll-animation-init")) { $("div[id^='w_common_text-'], .w_fimg-000, .w_fbtn-001, .w_ficon-001, .w_fline-001, .w_fimgbox-001, .w_fline-001, div[class*='c_portalResProduct_detail'], .c_portalResMessage_form-01001, .c_portalResEbizads_banner-01001 .bannerTitle, .c_portalResEbizads_banner-01001 .summry, .c_portalResProduct_list-01001001 .PhotoList_k1 li, .c_portalResnav_main-01001 .top-nav, .c_portalResIntro_detail-01001, .c_portalResNews_list-01001 .newList, .c_portalResNews_detail-01001 .p_header, .c_portalResNews_detail-01001 .p_dataSource, .c_portalResNews_detail-01001 .p_articles, .c_portalResNews_detail-01001 .p_PrevAndNext, .c_portalResProduct_list-01001, .c_portalResNews_list-01001 .p_articles, .c_portalResEmploy_list-01001 .jobList, .c_portalResProduct_list-01001 .p_Product, .c_portalResBreadcrumb_nav-01001, .c_portalResMessage_form-01001005, .c_portalResnav_main-01001007 .navLi, .wd-title h2, .wd-title p, .wd-title b, .wd-title a.wd-more, .footer .wd-top img, .footer .wd-top p, .footer .wd-top .wd-right .wd-item, .footer .wd-top .wd-right .wd-item div, .footer .wd-top .wd-right .wd-item p, .footer .wd-bottom, .footer .wd-bottom .wd-left, .footer .wd-bottom .wd-right, .c_portalResProduct_list-01001004 .proLi, .c_portalResSeoTag_list-02001, .c_portalResSeoTag_detail-01001, .wd-sub-news-list .wd-item, .p_OccupyBox, .c_portalResPublic_codeContainer-01001003 .about-num, .c_portalResPublic_codeContainer-01001003 .about-num li, .wd-sub-more-title h2, .wd-sub-more-title .line, .wd-sub-more-title p, .c_portalResPublic_codeContainer-01001").addClass("wd-scroll-animation"); wd.body.addClass("wd-scroll-animation-init"); let num = 0; $(window).scroll(function() { num = 0; }); function ani(a, t) { var top = a.offset().top; if (top < (wd.window.height + t - 100)) { a.addClass("wd-scroll-in"); wd.timeout(function() { a.addClass("wd-scrolled"); }, 200 + num * 100); num++; } } function handle() { let t = $(window).scrollTop(); let body_height = wd.body.height(); $(".wd-scroll-animation:not(.wd-scroll-in)").each(function() { ani($(this), t); }); if (wd.window.height + t + 200 >= body_height) { $(".wd-scroll-animation:not(.wd-scroll-in)").each(function() { $(this).addClass("wd-scroll-in").addClass("wd-scrolled"); }); } requestAnimationFrame(handle); } requestAnimationFrame(handle); } $(selectors).addClass("wd-scroll-animation").each(function() { if (type) { $(this).addClass(type) } }); return wd.scroll_animation; }; wd.init = function() { if (!wd.check()) { return; } if (isFrontEnv()) { if (wd.all) { wd.all(); } wd.common(); wd.auto(); } else { wd.body.addClass("wd-make"); } wd.body.addClass("wd-show"); }; wd.start = function() { $(function() { wd.body = $("body"); wd.init(); $(window).load(function() { wd.loop(function() { $("[lazy-src]").each(function() { $(this).attr("src", $(this).attr("lazy-src")).removeAttr("lazy-src"); }); }); }); }); };