1/*! 2 * ScriptName: common.js 3 * Version: 3.0.8 4 * 5 * FoodConnection 6 * http://foodconnection.jp/ 7 * http://foodconnection.vn/ 8 * 9 */ 10 11 12 13/* 14 * Catch errors 15 * 16 */ 17 18window.onerror = function(message, url, line, column, error) { 19 if (message.indexOf("Script error.") > -1) return; 20 21 if ($("html").hasClass("fc-debugger")) { 22 var uid = md5(message + url + line + column), 23 filename = url, 24 consoleHTML = "", 25 msg = "", 26 total = 0, 27 $blkConsole = $("#fc-console .console-main > .console-block:first-child[data-uid='" + uid + "']"); 28 29 consoleHTML += '<div id="fc-console">'; 30 consoleHTML += '<div class="console-title">FC Console</div>'; 31 consoleHTML += '<div class="console-clear">Clear</div>'; 32 consoleHTML += '<div class="console-main">'; 33 consoleHTML += '</div>'; 34 consoleHTML += '</div>'; 35 36 if ($("#fc-console").length < 1) $("body").append(consoleHTML); 37 38 if (typeof url !== "undefined") { 39 var fname = url.replace("\\", "/"); // correct slashes 40 if (fname.lastIndexOf("/")) fname = fname.substr(fname.lastIndexOf("/") + 1); 41 filename = fname.substr(0, fname.lastIndexOf(".")) + "." + fname.substr(fname.lastIndexOf(".") + 1); 42 if (filename.length < 3) filename = url; 43 } 44 45 msg += '<div class="console-block" data-uid="' + uid + '" data-count="1">'; 46 msg += '<div class="console-message">' + message + '</div>'; 47 msg += '<div class="console-stacktrace">'; 48 msg += '<div class="console-file">Script: <a href="' + url + '" target="_blank">' + filename + '</a></div>'; 49 msg += '<div class="console-line">Line: <strong>' + line + '</strong></div>'; 50 msg += '<div class="console-column">Column: <strong>' + column + '</strong></div>'; 51 msg += '</div>'; 52 msg += '<div class="console-error">' + error + '</div>'; 53 msg += '</div>'; 54 55 if ($blkConsole.length > 0) { 56 var count = $blkConsole.attr("data-count"); 57 if (count !== undefined && !isNaN(count) && Number(count) >= 0) { 58 count = Number(count); 59 count++; 60 61 $blkConsole.attr("data-count", count); 62 } else $blkConsole.attr("data-count", 1); 63 } else $("#fc-console .console-main").prepend(msg); 64 65 $("#fc-console .console-main > .console-block").each(function() { 66 var count = $(this).attr("data-count"); 67 if (count !== undefined && !isNaN(count) && Number(count) >= 0) total += Number(count); 68 else total++; 69 }); 70 71 $("#fc-console .console-title").attr("data-total", total); 72 } 73}; 74 75 76 77 78 79/* 80 * Switch fonts to Noto Serif 81 * 82 */ 83 84if ("ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) { // remove all :hover stylesheets 85 try { // prevent exception on browsers not supporting DOM styleSheets properly 86 for (var si in document.styleSheets) { 87 var styleSheet = document.styleSheets[si]; 88 89 if (!styleSheet.rules) continue; 90 91 for (var ri = styleSheet.rules.length - 1; ri >= 0; ri--) { 92 if (!styleSheet.rules[ri].cssText || !styleSheet.rules[ri].style || !styleSheet.rules[ri].style.fontFamily) continue; 93 94 var fontFamily = styleSheet.rules[ri].style.fontFamily; 95 if (/^\s*(游ææ|Yu-?Mincho|ãã©ã®ãææ|Hiragino[\s|-]*Mincho|(MS|ï¼ï¼³)[\s|-]*ææ)/i.test(fontFamily)) { 96 // styleSheet.rules[ri].style.fontFamily = fontFamily.replace(fontFamily, "'Noto Serif JP', " + fontFamily); 97 $(styleSheet.rules[ri].selectorText).css("font-family", "'Noto Serif JP', " + fontFamily); 98 } 99 } 100 } 101 } catch (ex) {} 102} 103 104 105+ 106 107function($) { 108 "use strict"; 109 var transitionEnd = function() { 110 var el = document.createElement("fcvndev"); 111 112 var transitionEndEventNames = { 113 transition: "transitionend", 114 OTransition: "oTransitionEnd", 115 MozTransition: "transitionend", 116 WebkitTransition: "webkitTransitionEnd" 117 }; 118 119 for (var name in transitionEndEventNames) { 120 if (el.style[name] !== undefined) { 121 return { 122 end: transitionEndEventNames[name] 123 }; 124 } 125 } 126 127 return false;
128 }, 129 animationEnd = function() { 130 var el = document.createElement("fcvndev"); 131 132 var animationEndEventNames = { 133 animation: "animationend", 134 OAnimation: "oAnimationEnd", 135 MozAnimation: "animationend", 136 WebkitAnimation: "webkitAnimationEnd" 137 }; 138 139 for (var name in animationEndEventNames) { 140 if (el.style[name] !== undefined) { 141 return { 142 end: animationEndEventNames[name] 143 }; 144 } 145 } 146 147 return false; 148 }; 149 150 $(function() { 151 $.support.transition = transitionEnd(); 152 153 $.support.animation = animationEnd(); 154 }); 155}(jQuery); 156 157$(document).ready(function() { 158 var UA = navigator.userAgent; 159 if (UA.indexOf("iPhone") < 0 && UA.indexOf("Android") < 0) $(".telhref").contents().unwrap(); // remove link [tel] on desktop 160 161 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) $("html.mobile-no-animate").addClass("noanimated"); // to remove transition 162 else $("html.mobile-no-animate").removeClass("noanimated"); 163 164 // fix bg parallax on mobile 165 if (isMobile.any()) $(".bg-parallax").css("background-attachment", "inherit"); 166 else $(".bg-parallax").css("background-attachment", ""); 167 168 /* 169 if ((UA.indexOf("iPad") > -1) || (UA.indexOf("iPhone") > -1) || (UA.indexOf("iPod") > -1)) { // iOS 170 window.onpageshow = function(e) { 171 if (e.persisted || window.performance && window.performance.navigation.type == 2) window.location.reload(); // go back by hit back button 172 }; 173 } 174 */ 175 176 177 178 // forcing a page to reload when the back button is clicked 179 window.onpageshow = function(event) { 180 if (event.persisted && $("body").hasClass("reload-on-back")) window.location.reload(); 181 }; 182 /* 183 if(navigator.userAgent.match(/Trident\/7\./)) { 184 $('body').on("mousewheel", function () { 185 event.preventDefault(); 186 var wd = event.wheelDelta; 187 var csp = window.pageYOffset; 188 window.scrollTo(0, csp - wd); 189 }); 190 } 191 */ 192 var clipboardData = new ClipboardJS(".copy", { 193 // container: $(".copy").get(0), 194 text: function(trigger) { 195 var _text_ = "{TITLE} {URL}", 196 _viewport_ = $("meta[name='viewport']").last().attr("content"); 197 198 if ($(trigger).attr("data-copy") && $(trigger).attr("data-copy").length > 0) _text_ = $(trigger).attr("data-copy"); 199 200 // if (_viewport_ && /(?:user-scalable\s*=\s*yes)/i.test(_viewport_)) $("meta[name='viewport']").last().attr("content", _viewport_.replace(/(?:user-scalable\s*=\s*yes)/i, "user-scalable=no")); // disabled zoom 201 if (_viewport_) { // disabled zoom 202 var _vpt_ = _viewport_.replace(/(?:user-scalable\s*=\s*yes)/i, "user-scalable=no"), 203 _spt_ = _vpt_.split(","), 204 _arr_ = []; 205 206 for (var i in _spt_) { 207 if (!/initial-scale/i.test(_spt_[i])) _arr_.push(_spt_[i].trim()); 208 } 209 _arr_.push("initial-scale=1"); 210 211 $("meta[name='viewport']").last().attr("content", _arr_.join(", ")); // disabled zoom 212 } 213 214 if ($(trigger).attr("data-replace-text")) $(trigger).html($(trigger).attr("data-replace-text")); 215 else if ($(trigger).attr("data-replace-image")) { 216 var _imgReplace_ = $(trigger).attr("data-replace-image"); 217 218 if ($(trigger).children("picture").length > 0) { 219 $(trigger).children("picture").addClass("copy-change"); 220 $(trigger).children("picture").children().each(function() { 221 if ($(this).prop("tagName").toLowerCase() == "img") $(this).attr("src", _imgReplace_).removeClass("btn"); 222 else if ($(this).prop("tagName").toLowerCase() == "source") $(this).attr("srcset", $(this).attr("src-replace") ? $(this).attr("src-replace") : _imgReplace_); 223 }); 224 } else if ($(trigger).children("img").length > 0) { 225 if ($(trigger).children("img").hasClass("btn")) { 226 $(trigger).children("img").addClass("copy-change"); 227 228 _imgReplace_ = 229 _imgReplace_ 230 .replace(/^(.*?)(_on)?\.(.*?)$/, "$1_on.$3"); 231 } 232 233 $(trigger).children("img").attr("src", _imgReplace_); 234 } else $(trigger).html('<img src="' + _imgReplace_ + '" />'); 235 } 236 237 $(trigger).addClass("copied"); 238 239 if (_viewport_) $("meta[name='viewport']").last().attr("content", _viewport_); // enabled zoom 240 241 _text_ = _text_.replace("{TITLE}", document.title).replace("{URL}", location.href); 242 243 return _text_; 244 } 245 }); 246 247 clipboardData 248 .on("success", function() { 249 var offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft, 250 offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop; 251 252 // firefox jump - fixed 253 window.scroll(offsetX, offsetY); // started 254 255 setTimeout(function() { // step 1 256 window.scroll(offsetX, offsetY); 257 }, 20); 258 259 setTimeout(function() { // step 2 260 window.scroll(offsetX, offsetY); 261 }, 15); 262 263 setTimeout(function() { // step 3 264 window.scroll(offsetX, offsetY); 265 }, 10); 266 267 setTimeout(function() { // step 4 268 window.scroll(offsetX, offsetY); 269 }, 5); 270 271 setTimeout(function() { // step 5 272 window.scroll(offsetX, offsetY); 273 }, 0); 274 275 window.scroll(offsetX, offsetY); // final 276 }) 277 .on("error", function() {}); 278 279 $("body") 280 .on("click", "#fc-console .console-title", function() { 281 $(this).parents("#fc-console").toggleClass("active"); 282 }) 283 .on("click", "#fc-console .console-clear", function() { 284 $("#fc-console").removeClass("active"); 285 $("#fc-console .console-main").empty(); 286 $("#fc-console .console-title").removeAttr("data-total"); 287 }) 288 .on("click", ".copy", function(e) { 289 e.preventDefault(); 290 291 $(this).removeAttr("data-clipboard-text"); 292 }) 293 .on("click", ".hamburger", function(e) { 294 e.preventDefault(); 295 296 if ($(this).hasClass("is-active")) { 297 $("body").removeClass("nav--opened"); 298 $(this).removeClass("is-active"); 299 } else { 300 $("body").addClass("nav--opened"); 301 $(this).addClass("is-active"); 302 } 303 }); 304 305 // BEGIN: slide fading 306 if ($(".slide-fade").length > 0) { 307 $(".slide-fade").each(function() { 308 var $this = $(this), 309 __idx__ = $(".slide-fade").index($this), 310 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 311 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000, 312 $delay = typeof $this.attr("data-delay") != "undefined" ? parseInt($this.attr("data-delay")) : false;
313 314 if ($timer < $duration) $timer = $duration * 2; 315 316 if (!$this.children(".active").length > 0) { 317 $this.children().hide(); 318 $this.children().eq(0).show().addClass("active"); 319 320 if ($this.siblings(".slide-page").length > 0) $this.siblings(".slide-page").children().eq(0).addClass("active"); 321 } else { 322 if ($this.siblings(".slide-page").length > 0) $this.siblings(".slide-page").children().eq($this.children(".active").index()).addClass("active"); 323 } 324 325 if ($(this).siblings(".slide-page").length > 0) { 326 $(this).siblings(".slide-page").children().each(function(i) { 327 $(this).attr("data", i); 328 }); 329 } 330 331 if (!$(this).hasClass("stop")) { 332 // $slideFadeTimer[__idx__] = setInterval(function() { 333 // slideFade($this, $duration); 334 // }, $timer); 335 336 $(this).parents(".slideParent").addClass("move-start").attr("data", $this.children(".active").index()); 337 338 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 339 $slideFadeTimer[__idx__] = setTimeout(function() { 340 slideFade($this, $duration); 341 }, $delay ? $delay : $timer); 342 } 343 }); 344 345 /* 346 * TODO: 347 * --- removeClass/addClass 348 * .move-next 349 * .move-prev 350 * .move-first 351 * .move-last 352 * 353 */ 354 355 $("body").on("click", ".slide-btn > .slide-next", function() { 356 var $btn = $(this), 357 $this = $btn.parent().siblings(".slide-fade"), 358 __idx__ = $(".slide-fade").index($this), 359 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 360 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000; 361 362 if ($timer < $duration) $timer = $duration * 2; 363 364 if (!$btn.hasClass("clicked") && !$this.hasClass("stop")) { 365 // if ($slideFadeTimer[__idx__]) clearInterval($slideFadeTimer[__idx__]); 366 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 367 368 $btn.addClass("clicked"); 369 370 $this.children(".active").stop().fadeOut($duration, function() { 371 $(this).removeClass("active").removeAttr("style").hide(); 372 }); 373 374 if ($this.children(".active").next().length) { 375 $this.children(".active").next().stop().fadeIn($duration, function() { 376 $(this).addClass("active").removeAttr("style").show(); 377 $btn.removeClass("clicked"); 378 379 // $slideFadeTimer[__idx__] = setInterval(function() { 380 $slideFadeTimer[__idx__] = setTimeout(function() { 381 $this.siblings(".slide-btn").children(".slide-next").click(); 382 }, $timer); 383 }); 384 } else { 385 if (!$this.hasClass("once")) { 386 $this.children().eq(0).stop().fadeIn($duration, function() { 387 $(this).addClass("active").removeAttr("style").show(); 388 $btn.removeClass("clicked"); 389 390 // $slideFadeTimer[__idx__] = setInterval(function() { 391 $slideFadeTimer[__idx__] = setTimeout(function() { 392 $this.siblings(".slide-btn").children(".slide-next").click(); 393 }, $timer); 394 }); 395 } 396 } 397 } 398 }); 399 $("body").on("click", ".slide-btn > .slide-prev", function() { 400 var $btn = $(this), 401 $this = $btn.parent().siblings(".slide-fade"), 402 __idx__ = $(".slide-fade").index($this), 403 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 404 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000; 405 406 if ($timer < $duration) $timer = $duration * 2; 407 408 if (!$btn.hasClass("clicked") && !$this.hasClass("stop")) { 409 // if ($slideFadeTimer[__idx__]) clearInterval($slideFadeTimer[__idx__]); 410 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 411 412 $btn.addClass("clicked"); 413 414 $this.children(".active").stop().fadeOut($duration, function() { 415 $(this).removeClass("active").removeAttr("style").hide(); 416 }); 417 418 if ($this.children(".active").prev().length) { 419 $this.children(".active").prev().stop().fadeIn($duration, function() { 420 $(this).addClass("active").removeAttr("style").show(); 421 $btn.removeClass("clicked"); 422 423 // $slideFadeTimer[__idx__] = setInterval(function() { 424 $slideFadeTimer[__idx__] = setTimeout(function() { 425 $this.siblings(".slide-btn").children(".slide-next").
425click(); 426 }, $timer); 427 }); 428 } else { 429 $this.children().last().stop().fadeIn($duration, function() { 430 $(this).addClass("active").removeAttr("style").show(); 431 $btn.removeClass("clicked"); 432 433 // $slideFadeTimer[__idx__] = setInterval(function() { 434 $slideFadeTimer[__idx__] = setTimeout(function() { 435 $this.siblings(".slide-btn").children(".slide-next").click(); 436 }, $timer); 437 }); 438 } 439 } 440 }); 441 442 $("body").on("click", ".slide-page > *", function() { 443 var $page = $(this).parent(), 444 $idx = $(this).index(), 445 $this = $(this).parents(".slideParent").length ? $(this).parents(".slideParent").find(".slide-fade") : $(this).siblings(".slide-fade"), 446 __idx__ = $(".slide-fade").index($this), 447 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 448 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000; 449 450 if ($timer < $duration) $timer = $duration * 2; 451 452 if ($this.length) { 453 if (!$page.hasClass("clicked") && !$this.hasClass("stop")) { 454 if ($(this).siblings(".active").length > 0) { 455 var idxOld = parseInt($(this).siblings(".active").attr("data")), 456 idxNew = parseInt($(this).attr("data")), 457 beside = idxOld - idxNew === 1 || idxNew - idxOld === 1; 458 459 $(this).parents(".slideParent").removeClass("move-start move-next move-prev move-first move-last"); 460 461 if (idxNew > idxOld) { 462 $(this).parents(".slideParent").addClass("move-next").attr("data", idxNew); 463 464 if ($(this).is(":last-child")) $(this).parents(".slideParent").addClass("move-last"); 465 } else { 466 $(this).parents(".slideParent").addClass("move-prev").attr("data", idxNew); 467 468 if ($(this).is(":first-child")) $(this).parents(".slideParent").addClass("move-first"); 469 } 470 } 471 472 if ($this.children().eq($idx).length > 0) { 473 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 474 475 $this.siblings(".slide-page").children(".active").removeClass("active"); 476 $(this).addClass("active"); 477 478 $page.addClass("clicked"); 479 480 $this.children(".active").stop().fadeOut($duration, function() { 481 $(this).removeClass("active").removeAttr("style").hide(); 482 }); 483 484 $this.children().eq($idx).stop().fadeIn($duration, function() { 485 $(this).addClass("active").removeAttr("style").show(); 486 $page.removeClass("clicked"); 487 488 // $slideFadeTimer[__idx__] = setInterval(function() { 489 // slideFade($this, $duration); 490 // }, $timer); 491 492 $slideFadeTimer[__idx__] = setTimeout(function() { 493 slideFade($this, $duration); 494 }, $timer); 495 }); 496 } else console.info("Slide not found"); 497 } 498 } else console.info(".slideParent or .slide-fade not found!"); 499 }); 500 } 501 // BEGIN: slide fading 502 503 // navigation animate 504 if ($(".nav-animate").length) { 505 $(".nav-animate").each(function() { 506 var $timerNav, 507 $navNull = $(this).hasClass("nav-null"), 508 $navWidth = $(this).find("li").first().outerWidth(), 509 $navPosX = $navNull ? 0 : $(this).find("li").first().position().left, 510 // $navML = 0, 511 $navMR = 0; 512 513 if ($(this).find("li.active").length) { 514 $navWidth = $(this).find("li.active").outerWidth(), 515 $navPosX = $(this).find("li.active").position().left; 516 517 // $navML = $(this).find("li.active").next().length ? parseInt($(this).find("li.active").next().css("margin-left"), 10), 518 $navMR = $(this).find("li.active").prev().length ? parseInt($(this).find("li.active").prev().css("margin-right"), 10) : 0; 519 } else { 520 if (!$navNull) $(this).find("li").first().addClass("active"); 521 522 // $navML = parseInt($(this).find("li").first().css("margin-left"), 10), 523 // $navMR = parseInt($(this).find("li").first().css("margin-right"), 10); 524 } 525 526 $navWidth += $navMR; 527 $navPosX -= $navMR; 528 529 $(this).children("span").css({ 530 width: $navWidth, 531 left: $navPosX 532 }); 533 534 if ($navNull) $(this).children("span").css("opacity", 0); 535 536 $(this).find("li").mouseover(function() {
537 var $navW = $(this).outerWidth(), 538 $navX = $(this).position().left, 539 // $nML = $(this).next().length ? parseInt($(this).next().css("margin-left"), 10), 540 $nMR = $(this).prev().length ? parseInt($(this).prev().css("margin-right"), 10) : 0; 541 542 if ($navNull) { 543 clearTimeout($timerNav); 544 545 $navPosX = $navX - $nMR; 546 547 $(this).parents(".nav-animate").children("span").css("opacity", 1); 548 console.log($navPosX); 549 } 550 551 $(this).parents(".nav-animate").children("span").stop().animate({ 552 width: $navW + $nMR, 553 left: $navX - $nMR 554 }, "fast"); 555 }).mouseleave(function() { 556 var $span = $(this).parents(".nav-animate").children("span"); 557 558 if ($navNull) { 559 clearTimeout($timerNav); 560 $timerNav = setTimeout(function() { 561 console.log($navPosX); 562 $span.stop().fadeOut(100, function() { 563 $(this).removeAttr("style").css({ 564 opacity: 0, 565 width: $navWidth, 566 left: $navPosX 567 }) 568 }); 569 }, 500); 570 } else { 571 $span.stop().animate({ 572 width: $navWidth, 573 left: $navPosX 574 }, "fast"); 575 } 576 }); 577 }); 578 } 579 580 581 // BEGIN: toggle 582 if ($(".toggle").length > 0) { 583 $("body").on("click", ".toggle-link", function() { 584 var $toggleDuration = 500, 585 $toggleElm = $(this).parents(".toggle").first(); 586 587 if (typeof $toggleElm.attr("data-duration") != "undefined") { 588 if ($.inArray($toggleElm.attr("data-duration"), ["slow", "normal", "fast"]) >= 0) $toggleDuration = $toggleElm.attr("data-duration"); 589 else $toggleDuration = parseInt($toggleElm.attr("data-duration")); 590 } 591 592 if ($(this).parents(".single").length > 0) { 593 $(this).parents(".single").find(".toggle-main").stop().slideUp($toggleDuration, function() { 594 $(this).removeAttr("style"); 595 $(this).parents(".toggle").first().removeClass("active"); 596 }); 597 } 598 599 if ($(this).parents(".toggle").first().hasClass("active")) { 600 $(this).siblings(".toggle-main").stop().slideUp($toggleDuration, function() { 601 $(this).removeAttr("style"); 602 $(this).parents(".toggle").first().removeClass("active"); 603 }); 604 } else { 605 $(this).siblings(".toggle-main").stop().slideDown($toggleDuration, function() { 606 $(this).removeAttr("style"); 607 $(this).parents(".toggle").first().addClass("active"); 608 609 // if ($(this).find("[class*=heightLine]").length) heightLine(); 610 611 $(window).trigger("resize"); 612 }); 613 614 if ($(this).siblings(".toggle-main").find("[class*=heightLine]").length) heightLine(); 615 } 616 }); 617 } 618 // END: toggle 619 620 // BEGIN: tabs - switch 621 if ($(".tabs-switch").length) { 622 $(".tabs-switch").each(function() { 623 var $tabsSwitch = $(this), 624 $tabLink = $tabsSwitch.find(".tab-link"), 625 $tabContent = $tabsSwitch.find(".tab-content"); 626 627 $tabLink.children().each(function() { 628 if ($(this).find("img").length > 0 && $(this).find("img").hasClass("btn")) { 629 $(this).data("src", $(this).find("img").attr("src")); 630 631 $(this).find("img").attr("src").match(/^(.*)(\.{1}.*)/g); 632 $(this).data("active", RegExp.$1 + "_on" + RegExp.$2); 633 } 634 }); 635 636 $tabContent.children().hide(); 637 638 if (!$tabsSwitch.hasClass("stop")) { 639 $tabLink.each(function() { 640 // TODO: active by [data-active] 641 var hash = window.location.hash || location.hash; 642 if (hash) { 643 if ($(this).children("[data-tab-anchor='" + hash + "']").length) $(this).children("[data-tab-anchor='" + hash + "']").addClass("active"); 644 else $(this).children().first().addClass("active"); 645 } else if (!$(this).children(".active").length) $(this).children().first().addClass("active"); 646 647 $(this).children(".active").find("img").attr("src", $(this).children(".active").data("active")).removeClass("btn"); 648 }); 649 650 if ($tabLink.children(".active").hasClass("all")) $tabContent.children().show(); 651 else $tabContent.children().eq($tabLink.children(".active").index()).show(); 652 } 653 654 if ($(".bx-wrapper").length > 0) $(window).trigger("resize"); 655 }); 656 657 $("body").on("click", ".tabs-switch-close", function() { 658 var $content = $(this).parents(".tab-content").first(), 659 $switch = $(this).parents(".tabs-switch").first(); 660 661 if ($content.length > 0 && $switch.length > 0) { 662 var $tabMode = $.inArray($switch.attr("data"), ["fade", "slide", "block"]) >= 0 ? $switch.attr("data") : "block", 663 $tabDuration = $switch.attr("data-duration") ? parseInt($switch.attr("data-duration")) : 300; 664 665 if ($tabMode == "fade") $content.children().stop().fadeOut($tabDuration); 666 else if ($tabMode == "slide") $content.children().stop().slideUp($tabDuration); 667 else $content.children().stop().hide($tabDuration); 668 } 669 }); 670 671 $("body").on("click", ".tab-link .tab-item, .tab-link > *", function() { 672 var $itemMode = $(this).hasClass("tab-item"), 673 $this = $itemMode ? $(this, ".tab-item") : $(this), 674 $idxAll = $this.parents(".tab-link").first().children(".all").length > 0 ? $this.parents(".tab-link").first().children(".all").index() : false, 675 $idx = $itemMode ? $this.parents(".tab-link").first().find(".tab-item").index($this) : $this.parents(".tab-link").first().children().index($this), 676 $act = $itemMode ? $this.parents(".tab-link").first().find(".tab-item.active") : $this.parents(".tab-link").first().children(".active"), 677 $tabMode = $.inArray($this.parents(".tabs-switch").first().attr("data"), ["fade", "slide", "block"]) >= 0 ? $this.parents(".tabs-switch").first().attr("data") : "block", 678 $tabDuration = $this.parents(".tabs-switch").first().attr("data-duration") ? parseInt($this.parents(".tabs-switch").first().attr("data-duration")) : 300, 679 $tabContent = $this.parents(".tabs-switch").first().children(".tab-content"), 680 $tabIdx = $this.attr("data-active") ? $this.attr("data-active") : false, 681 $autoScroll = $.inArray($this.parents(".tabs-switch").first().attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 682 $itself = $.inArray($this.parents(".tabs-switch").first().attr("data-toggle"), ["true", "on", "enable", "enabled", "1"]) >= 0 && $this.hasClass("active") ? true : false, 683 $itHide = $tabContent.children().eq($idx).is(":hidden"); 684 685 if ($tabIdx) { 686 $this.parents(".tabs-switch").first().find(".tab-link").each(function() { 687 var $tabBtn = $itemMode ? $(this).find(".tab-item[data-active='" + $tabIdx + "']") : $(this).children("[data-active='" + $tabIdx + "']"), 688 $elmActive = $itemMode ? $(this).find(".tab-item.active") : $(this).children(".active"); 689 690 $elmActive.find("img").attr("src", $elmActive.data("src")); 691 $elmActive.removeClass("active"); 692 693 if ($itself) { 694 if ($itHide) $tabBtn.addClass("active"); 695 else $tabBtn.removeClass("active"); 696 } else $tabBtn.addClass("active"); 697 698 // if (!$tabBtn.find("img").hasClass("active")) $tabBtn.find("img").attr("src", $tabBtn.data("active")); 699 if ($tabBtn.find("img").hasClass("btn")) $tabBtn.find("img").attr("src", $tabBtn.data("active")).removeClass("btn"); 700 }); 701 } else { 702 if (/^(.*?)_on\.(.*?)$/.test($act.find("img").attr("src"))) $act.find("img").addClass("btn"); 703 704 $act.find("img").attr("src", $act.data("src")); 705 $act.removeClass("active"); 706 707 if ($itself) { 708 if ($itHide) $this.addClass("active"); 709 else $this.removeClass("active"); 710 } else $this.addClass("active"); 711 712 // if (!$this.find("img").hasClass("active")) $this.find("img").attr("src", $this.data("active")); 713 if ($this.find("img").hasClass("btn")) $this.find("img").attr("src", $this.data("active")).removeClass("btn"); 714 } 715 716 if (!$this.parents(".tab-link").first().hasClass("clicked")) { 717 $this.parents(".tab-link").first().addClass("clicked"); 718 719 if ($this.hasClass("all")) { 720 if ($tabMode == "fade") { 721 $tabContent.children().stop().fadeIn($tabDuration, function() { 722 $(this).removeAttr("style").show(); 723 724 if ($(this).find("[class*=heightLine]").length) heightLine(); 725 726 if ($this.children("a").length) $this.children("a").click(); 727 728 $tabContent.css({ 729 minHeight: "" 730 }); 731 732 $(window).trigger("resize"); 733 734 $this.parents(".tab-link").first().removeClass("clicked"); 735 }); 736 } else if ($tabMode == "slide") { 737 $tabContent.children().slideDown($tabDuration, function() { 738 $(this).removeAttr("style").show(); 739 740 if ($(this).find("[class*=heightLine]").length) heightLine(); 741 742 if ($this.children("a").length) $this.children("a").click(); 743 744 $(window).trigger("resize"); 745 746 $this.parents(".tab-link").first().removeClass("clicked"); 747 }); 748 } else { 749 $tabDuration = $(this).parents(".tabs-switch").first().attr("data-duration") ? parseInt($(this).parents(".tabs-switch").first().attr("data-duration")) : 0; 750 751 $tabContent.children().stop().show($tabDuration, function() { 752 $(this).removeAttr("style").show(); 753 754 if ($(this).find("[class*=heightLine]").length) heightLine(); 755 756 if ($this.children("a").length) $this.children("a").click(); 757 758 $(window).trigger("resize"); 759 760 $this.parents(".tab-link").first().removeClass("clicked"); 761 }); 762 } 763 } else { 764 if ($idxAll !== false && $idxAll >= 0 && $idx >= $idxAll) $idx -= 1; 765 766 if ($tabMode == "fade") { 767 if ($itself) { 768 $tabContent.children().eq($idx).stop().fadeToggle($tabDuration, function() { 769 if ($itHide) $(this).removeAttr("style").show(); 770 else $(this).removeAttr("style").hide(); 771 772 if ($(this).find("[class*=heightLine]").length) heightLine(); 773 774 if ($this.children("a").length) $this.children("a").click(); 775 776 $tabContent.css({ 777 minHeight: "" 778 }); 779 780 $(window).trigger("resize"); 781 782 $this.parents(".tab-link").first().removeClass("clicked"); 783 }); 784 } else { 785 $tabContent.css({ 786 minHeight: $tabContent.outerHeight() 787 }); 788 789 $tabContent.children().stop().fadeOut($tabDuration, function() { 790 $(this).removeAttr("style").hide(); 791 }); 792 $tabContent.children().eq($idx).stop().delay($tabDuration).fadeIn($tabDuration, function() { 793 $(this).removeAttr("style").show(); 794 795 if ($(this).find("[class*=heightLine]").length) heightLine(); 796 797 if ($this.children("a").length) $this.children("a").click(); 798 799 $tabContent.css({ 800 minHeight: "" 801 }); 802 803 $(window).trigger("resize"); 804 805 $this.parents(".tab-link").first().removeClass("clicked"); 806 }); 807 } 808 } else if ($tabMode == "slide") { 809 if ($itself) { 810 $tabContent.children().eq($idx).stop().slideToggle($tabDuration, function() { 811 if ($itHide) $(this).removeAttr("style").show(); 812 else $(this).removeAttr("style").hide(); 813 814 if ($(this).find("[class*=heightLine]").length) heightLine(); 815 816 if ($this.children("a").length) $this.children("a").click(); 817 818 $(window).trigger("resize"); 819 820 $this.parents(".tab-link").first().removeClass("clicked"); 821 }); 822 } else { 823 $tabContent.children().stop().slideUp($tabDuration, function() { 824 $(this).removeAttr("style").hide(); 825 }).siblings().eq($idx).stop().slideDown($tabDuration, function() { 826 $(this).removeAttr("style").show(); 827 828 if ($(this).find("[class*=heightLine]").length) heightLine(); 829 830 if ($this.children("a").length) $this.children("a").click(); 831 832 $(window).trigger("resize"); 833 834 $this.parents(".tab-link").first().removeClass("clicked"); 835 }); 836 } 837 } else { 838 $tabDuration = $this.parents(".tabs-switch").first().attr("data-duration") ? parseInt($this.parents(".tabs-switch").first().attr("data-duration")) : 0; 839 840 if ($itself) { 841 $tabContent.children().eq($idx).stop().toggle($tabDuration, function() { 842 if ($itHide) $(this).removeAttr("style").show(); 843 else $(this).removeAttr("style").hide(); 844 845 if ($(this).find("[class*=heightLine]").length) heightLine(); 846 847 if ($this.children("a").length) $this.children("a").click(); 848 849 $(window).trigger("resize"); 850 851 $this.parents(".tab-link").first().removeClass("clicked"); 852 }); 853 } else { 854 $tabContent.children().stop().hide($tabDuration, function() { 855 $(this).removeAttr("style").hide(); 856 $(this).removeClass("active"); 857 }).siblings().eq($idx).stop().show($tabDuration, function() { 858 $(this).removeAttr("style").show(); 859 $(this).addClass("active"); 860 861 if ($(this).f
861ind("[class*=heightLine]").length) heightLine(); 862 863 if ($this.children("a").length) $this.children("a").click(); 864 865 $(window).trigger("resize"); 866 867 $this.parents(".tab-link").first().removeClass("clicked"); 868 }); 869 } 870 } 871 } 872 873 setTimeout(function() { 874 $this.parents(".tab-link").first().removeClass("clicked"); 875 }, $tabDuration); 876 877 if ($(".slick-slider").length > 0) { 878 $(window).trigger("resize"); 879 } 880 881 if ($(".bx-wrapper").length > 0) { 882 setTimeout(function() { 883 $(window).trigger("resize"); 884 }, 1); 885 } 886 887 if ($autoScroll) { 888 var $offsetY = $tabContent.offset().top, 889 $navOffset = 0; 890 891 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 892 893 if ($(".nav-target").length) { 894 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 895 896 $("html, body").stop().animate({ 897 scrollTop: $offsetY - $navOffset + 1 898 }, 500); 899 } else { 900 $("html, body").stop().animate({ 901 scrollTop: $offsetY - $navOffset + 1 902 }, 500); 903 } 904 } 905 } 906 }); 907 } 908 // END: tabs - switch 909 910 // BEGIN: gmap 911 if (typeof gmap === "object" && isObjectVar(gmap)) { 912 var _dialogs_ = [], 913 _dialogsOpen_ = true; 914 915 function init() { 916 var errorsMap = { 917 mapDiv: false, 918 latLong: false 919 }, 920 objData = {}; // single || multiMap || multiPoint 921 922 923 // checking 924 if (typeof gmap.maps != "undefined" && Object.keys(gmap.maps).length > 0) { // multi map 925 if (typeof gmap.maps[0] == "undefined") { // associative array 926 if (typeof gmap.maps.mapDiv == "undefined" || gmap.maps.mapDiv == "") errorsMap.mapDiv = 1; 927 else if ((typeof gmap.maps.latitude == "undefined" && typeof gmap.maps.latitude != "number") || (typeof gmap.maps.longitude == "undefined" && typeof gmap.maps.longitude != "number")) errorsMap.latLong = 1; 928 } else { // object 929 for (var s in gmap.maps) { // loop 930 if (typeof gmap.maps[s].mapDiv == "undefined" || gmap.maps[s].mapDiv == "") { 931 errorsMap.mapDiv = 2; 932 break; 933 } else if ((typeof gmap.maps[s].latitude == "undefined" && typeof gmap.maps[s].latitude != "number") || (typeof gmap.maps[s].longitude == "undefined" && typeof gmap.maps[s].longitude != "number")) { 934 errorsMap.latLong = 2; 935 break; 936 } 937 } 938 } 939 } else { // single map 940 if (typeof gmap.mapDiv == "undefined" || gmap.mapDiv == "") errorsMap.mapDiv = 3; 941 else if ((typeof gmap.latitude == "undefined" && typeof gmap.latitude != "number") || (typeof gmap.longitude == "undefined" || typeof gmap.longitude != "number")) errorsMap.latLong = 3; 942 } 943 944 945 if (errorsMap.mapDiv || errorsMap.latLong) { 946 console.info("ERROR", errorsMap); 947 return false; 948 } else { 949 // if () 950 var init = initMap(gmap); 951 // console.log(init); 952 } 953 954 /* 955 * initialize 956 * 957 */ 958 959 function initMap(data) { 960 var dataMap = { 961 mapDiv: false, 962 latitude: false, 963 longitude: false, 964 965 center: false, 966 967 zoom: 17, 968 minZoom: 2, 969 zoomControl: true, 970 disableDoubleClickZoom: true, 971 mapTypeControl: true, 972 scaleControl: true, 973 scrollwheel: false, 974 panControl: true, 975 streetViewControl: true, 976 draggable: true, 977 overviewMapControl: true, 978 979 styles: false, 980 style: false, 981 982 name: false,
983 desc: false, 984 tel: false, 985 email: false, 986 987 url: false, 988 logo: false, 989 size: false, 990 scale: false, 991 origin: false, 992 anchor: false, 993 optimized: false, 994 995 clickable: false, 996 hover: false, 997 html: false, 998 999 multi: false 1000 }; 1001 1002 // BEGIN: configs default 1003 if (typeof data.zoom != "undefined" && typeof data.zoom == "number") dataMap.zoom = data.zoom; 1004 if (typeof data.minZoom != "undefined" && typeof data.minZoom == "number") dataMap.minZoom = data.minZoom; 1005 if (typeof data.zoomControl != "undefined" && typeof data.zoomControl == "boolean") dataMap.zoomControl = data.zoomControl; 1006 if (typeof data.disableDoubleClickZoom != "undefined" && typeof data.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = data.disableDoubleClickZoom; 1007 if (typeof data.mapTypeControl != "undefined" && typeof data.mapTypeControl == "boolean") dataMap.mapTypeControl = data.mapTypeControl; 1008 if (typeof data.scaleControl != "undefined" && typeof data.scaleControl == "boolean") dataMap.scaleControl = data.scaleControl; 1009 if (typeof data.scrollwheel != "undefined" && typeof data.scrollwheel == "boolean") dataMap.scrollwheel = data.scrollwheel; 1010 if (typeof data.panControl != "undefined" && typeof data.panControl == "boolean") dataMap.panControl = data.panControl; 1011 if (typeof data.streetViewControl != "undefined" && typeof data.streetViewControl == "boolean") dataMap.streetViewControl = data.streetViewControl; 1012 if (typeof data.draggable != "undefined" && typeof data.draggable == "boolean") dataMap.draggable = data.draggable; 1013 if (typeof data.overviewMapControl != "undefined" && typeof data.overviewMapControl == "boolean") dataMap.overviewMapControl = data.overviewMapControl; 1014 1015 if (typeof data.name != "undefined" && data.name != "") dataMap.name = data.name; 1016 if (typeof data.desc != "undefined" && data.desc != "") dataMap.desc = data.desc; 1017 if (typeof data.tel != "undefined" && data.tel != "") dataMap.tel = data.tel; 1018 if (typeof data.email != "undefined" && data.email != "") dataMap.email = data.email; 1019 if (typeof data.url != "undefined" && data.url != "") dataMap.url = data.url; 1020 if (typeof data.logo != "undefined" && data.logo != "") dataMap.logo = data.logo; 1021 if (typeof data.size != "undefined" && typeof data.size.width != "undefined" && data.size.width != "") dataMap.sizeWidth = data.size.width; 1022 if (typeof data.size != "undefined" && typeof data.size.height != "undefined" && data.size.height != "") dataMap.sizeHeight = data.size.height; 1023 if (typeof data.scale != "undefined" && typeof data.scale.width != "undefined" && data.scale.width != "") dataMap.scaleWidth = data.scale.width; 1024 if (typeof data.scale != "undefined" && typeof data.scale.height != "undefined" && data.scale.height != "") dataMap.scaleHeight = data.scale.height; 1025 if (typeof data.origin != "undefined" && typeof data.origin.x != "undefined" && data.origin.x != "") dataMap.originX = data.origin.x; 1026 if (typeof data.origin != "undefined" && typeof data.origin.y != "undefined" && data.origin.y != "") dataMap.originY = data.origin.y; 1027 if (typeof data.anchor != "undefined" && typeof data.anchor.x != "undefined" && data.anchor.x != "") dataMap.anchorX = data.anchor.x; 1028 if (typeof data.anchor != "undefined" && typeof data.anchor.y != "undefined" && data.anchor.y != "") dataMap.anchorY = data.anchor.y; 1029 if (typeof data.optimized != "undefined" && data.optimized != "") dataMap.optimized = data.optimized; 1030 1031 if (typeof data.clickable != "undefined" && data.clickable != "") dataMap.clickable = data.clickable; 1032 if (typeof data.html != "undefined" && data.html != "") dataMap.html = data.html; 1033 if (typeof data.hover != "undefined" && typeof data.hover == "boolean") dataMap.hover = data.hover; 1034 1035 if (typeof data.multi != "undefined" && Object.keys(data.multi).length > 0) dataMap.multi = data.multi; 1036 1037 if (typeof data.styles != "undefined") dataMap.styles = data.styles; 1038 else if (typeof data.style != "undefined") { 1039 dataMap.style = {}; 1040 if (typeof data.style.hue != "undefined") dataMap.style.hue = data.style.hue; 1041 if (typeof data.style.gamma != "undefined") dataMap.style.gamma = data.style.gamma; 1042 if (typeof data.style.lightness != "undefined") dataMap.style.lightness = data.style.lightness; 1043 if (typeof data.style.saturation != "undefined") dataMap.style.saturation = data.style.saturation; 1044 } 1045 // END: configs default 1046 1047 dataMap.mapDiv = data.mapDiv; 1048 dataMap.latitude = data.latitude; 1049 dataMap.longitude = data.longitude; 1050 1051 if (typeof data.maps != "undefined" && Object.keys(data.maps).length > 0) { // multi map 1052 var objMap = {}; 1053 if (typeof data.maps[0] == "undefined") objMap[0] = data.maps; // object 1054 else objMap = data.maps; // array 1055 1056 for (var g in objMap) { // loop 1057 var obj = objMap[g]; 1058 1059 // BEGIN: override configs 1060 if (typeof obj.zoom != "undefined" && typeof obj.zoom == "number") dataMap.zoom = obj.zoom; 1061 if (typeof obj.minZoom != "undefined" && typeof obj.minZoom == "number") dataMap.minZ
1061oom = obj.minZoom; 1062 if (typeof obj.zoomControl != "undefined" && typeof obj.zoomControl == "boolean") dataMap.zoomControl = obj.zoomControl; 1063 if (typeof obj.disableDoubleClickZoom != "undefined" && typeof obj.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = obj.disableDoubleClickZoom; 1064 if (typeof obj.mapTypeControl != "undefined" && typeof obj.mapTypeControl == "boolean") dataMap.mapTypeControl = obj.mapTypeControl; 1065 if (typeof obj.scaleControl != "undefined" && typeof obj.scaleControl == "boolean") dataMap.scaleControl = obj.scaleControl; 1066 if (typeof obj.scrollwheel != "undefined" && typeof obj.scrollwheel == "boolean") dataMap.scrollwheel = obj.scrollwheel; 1067 if (typeof obj.panControl != "undefined" && typeof obj.panControl == "boolean") dataMap.panControl = obj.panControl; 1068 if (typeof obj.streetViewControl != "undefined" && typeof obj.streetViewControl == "boolean") dataMap.streetViewControl = obj.streetViewControl; 1069 if (typeof obj.draggable != "undefined" && typeof obj.draggable == "boolean") dataMap.draggable = obj.draggable; 1070 if (typeof obj.overviewMapControl != "undefined" && typeof obj.overviewMapControl == "boolean") dataMap.overviewMapControl = obj.overviewMapControl; 1071 1072 if (typeof obj.styles != "undefined") dataMap.styles = obj.styles; 1073 else if (typeof obj.style != "undefined") { 1074 dataMap.style = {}; 1075 if (typeof obj.style.hue != "undefined") dataMap.style.hue = obj.style.hue; 1076 if (typeof obj.style.gamma != "undefined") dataMap.style.gamma = obj.style.gamma; 1077 if (typeof obj.style.lightness != "undefined") dataMap.style.lightness = obj.style.lightness; 1078 if (typeof obj.style.saturation != "undefined") dataMap.style.saturation = obj.style.saturation; 1079 } 1080 1081 if (typeof obj.name != "undefined" && obj.name != "") dataMap.name = obj.name; 1082 if (typeof obj.desc != "undefined" && obj.desc != "") dataMap.desc = obj.desc; 1083 if (typeof obj.tel != "undefined" && obj.tel != "") dataMap.tel = obj.tel; 1084 if (typeof obj.email != "undefined" && obj.email != "") dataMap.email = obj.email; 1085 if (typeof obj.url != "undefined" && obj.url != "") dataMap.url = obj.url; 1086 if (typeof obj.logo != "undefined" && obj.logo != "") dataMap.logo = obj.logo; 1087 if (typeof obj.sizeWidth != "undefined" && obj.sizeWidth != "") dataMap.sizeWidth = obj.sizeWidth; 1088 if (typeof obj.sizeHeight != "undefined" && obj.sizeHeight != "") dataMap.sizeHeight = obj.sizeHeight; 1089 if (typeof obj.scaleWidth != "undefined" && obj.scaleWidth != "") dataMap.scaleWidth = obj.scaleWidth; 1090 if (typeof obj.scaleHeight != "undefined" && obj.scaleHeight != "") dataMap.scaleHeight = obj.scaleHeight; 1091 if (typeof obj.originX != "undefined" && obj.originX != "") dataMap.originX = obj.originX; 1092 if (typeof obj.originY != "undefined" && obj.originY != "") dataMap.originY = obj.originY; 1093 if (typeof obj.anchorX != "undefined" && obj.anchorX != "") dataMap.anchorX = obj.anchorX; 1094 if (typeof obj.anchorY != "undefined" && obj.anchorY != "") dataMap.anchorY = obj.anchorY; 1095 if (typeof obj.optimized != "undefined" && obj.optimized != "") dataMap.optimized = obj.optimized; 1096 // END: override configs 1097 1098 if (typeof obj.clickable != "undefined" && obj.clickable != "") dataMap.clickable = obj.clickable; 1099 if (typeof obj.html != "undefined" && obj.html != "") dataMap.html = obj.html; 1100 if (typeof obj.hover != "undefined" && typeof obj.hover == "boolean") dataMap.hover = obj.hover; 1101 if (typeof obj.multi != "undefined" && Object.keys(obj.multi).length > 0) dataMap.multi = obj.multi; 1102 1103 dataMap.mapDiv = obj.mapDiv; 1104 dataMap.latitude = obj.latitude; 1105 dataMap.longitude = obj.longitude; 1106 1107 if (typeof obj.center != "undefined") { 1108 dataMap.center = {}; 1109 if (typeof obj.center.latitude != "undefined") dataMap.center.latitude = obj.center.latitude; 1110 if (typeof obj.center.longitude != "undefined") dataMap.center.longitude = obj.center.longitude; 1111 } else { 1112 dataMap.center = { 1113 latitude: obj.latitude, 1114 longitude: obj.longitude 1115 }; 1116 } 1117 1118 loadMap(dataMap); 1119 } 1120 } else { // single map 1121 if (typeof data.center != "undefined") { 1122 dataMap.center = {}; 1123 if (typeof data.center.latitude != "undefined") dataMap.center.latitude = data.center.latitude; 1124 if (typeof data.center.longitude != "undefined") dataMap.center.longitude = data.center.longitude; 1125 } else { 1126 dataMap.center = { 1127 latitude: data.latitude, 1128 longitude: data.longitude 1129 }; 1130 } 1131 1132 loadMap(dataMap); 1133 } 1134 1135 return dataMap; 1136 } 1137 1138 function loadMap(data) { 1139 var elm = data.mapDiv; 1140 1141 elm = elm.substring(0, 1) == "#" ? elm.substring(1) : elm; // remove hash 1142 1143 var mapElement = document.getElementById(elm), 1144 styleOptions = [], 1145 mapOptions = { 1146 center: new google.maps.LatLng(data.center.latitude, data.center.longitude), 1147 zoom: data.zoom, 1148 minZoom: data.minZoom, 1149 zoomControl: data.zoomControl, 1150 zoomControlOptions: { 1151 style: google.maps.ZoomControlStyle.DEFAULT, 1152 }, 1153 disableDoubleClickZoom: data.disableDoubleClickZoom, 1154 scaleControl: data.scaleControl, 1155 scrollwheel: data.scrollwheel, 1156 panControl: data.panControl, 1157 streetViewControl: data.streetViewControl, 1158 draggable: data.draggable, 1159 mapTypeControl: data.mapTypeControl, 1160 mapTypeControlOptions: { 1161 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, 1162 }, 1163 mapTypeId: google.maps.MapTypeId.ROADMAP, 1164 overviewMapControl: data.overviewMapControl, 1165 overviewMapControlOptions: { 1166 opened: false, 1167 } 1168 }, 1169 googleMap = new google.maps.Map(mapElement, mapOptions); 1170 1171 if (data.multi === false) { 1172 var arr = {}; 1173 1174 if (typeof data["name"] != "undefined") arr["name"] = data["name"]; 1175 if (typeof data["desc"] != "undefined") arr["de
1175sc"] = data["desc"]; 1176 if (typeof data["tel"] != "undefined") arr["tel"] = data["tel"]; 1177 if (typeof data["email"] != "undefined") arr["email"] = data["email"]; 1178 if (typeof data["url"] != "undefined") arr["url"] = data["url"]; 1179 if (typeof data["logo"] != "undefined") arr["logo"] = data["logo"]; 1180 if (typeof data["sizeWidth"] != "undefined") arr["sizeWidth"] = data["sizeWidth"]; 1181 if (typeof data["sizeHeight"] != "undefined") arr["sizeHeight"] = data["sizeHeight"]; 1182 if (typeof data["scaleWidth"] != "undefined") arr["scaleWidth"] = data["scaleWidth"]; 1183 if (typeof data["scaleHeight"] != "undefined") arr["scaleHeight"] = data["scaleHeight"]; 1184 if (typeof data["originX"] != "undefined") arr["originX"] = data["originX"]; 1185 if (typeof data["originY"] != "undefined") arr["originY"] = data["originY"]; 1186 if (typeof data["anchorX"] != "undefined") arr["anchorX"] = data["anchorX"]; 1187 if (typeof data["anchorY"] != "undefined") arr["anchorY"] = data["anchorY"]; 1188 if (typeof data["optimized"] != "undefined") arr["optimized"] = data["optimized"]; 1189 if (typeof data["clickable"] != "undefined") arr["clickable"] = data["clickable"]; 1190 if (typeof data["html"] != "undefined") arr["html"] = data["html"]; 1191 if (typeof data["hover"] != "undefined") arr["hover"] = data["hover"]; 1192 1193 arr["longitude"] = data["longitude"]; 1194 arr["latitude"] = data["latitude"]; 1195 1196 setMaps(arr, googleMap, data.center); 1197 } else { 1198 for (var i = 0; i < Object.keys(data.multi).length; i++) { 1199 var arr = data.multi[i]; 1200 1201 if (typeof data["clickable"] != "undefined") arr["clickable"] = data.clickable; 1202 if (typeof data["html"] != "undefined") arr["html"] = data.html; 1203 if (typeof data["hover"] != "undefined") arr["hover"] = data.hover; 1204 1205 if (typeof arr["size"] != "undefined") { 1206 if (typeof arr["size"]["width"] != "undefined") arr["sizeWidth"] = arr["size"]["width"]; 1207 if (typeof arr["size"]["height"] != "undefined") arr["sizeHeight"] = arr["size"]["height"]; 1208 1209 delete arr["size"]; 1210 } 1211 if (typeof arr["scale"] != "undefined") { 1212 if (typeof arr["scale"]["width"] != "undefined") arr["scaleWidth"] = arr["scale"]["width"]; 1213 if (typeof arr["scale"]["height"] != "undefined") arr["scaleHeight"] = arr["scale"]["height"]; 1214 1215 delete arr["scale"]; 1216 } 1217 if (typeof arr["origin"] != "undefined") { 1218 if (typeof arr["origin"]["x"] != "undefined") arr["originX"] = arr["origin"]["x"]; 1219 if (typeof arr["origin"]["y"] != "undefined") arr["originY"] = arr["origin"]["y"]; 1220 1221 delete arr["origin"]; 1222 } 1223 if (typeof arr["anchor"] != "undefined") { 1224 if (typeof arr["anchor"]["x"] != "undefined") arr["anchorX"] = arr["anchor"]["x"]; 1225 if (typeof arr["anchor"]["y"] != "undefined") arr["anchorY"] = arr["anchor"]["y"]; 1226 1227 delete arr["anchor"]; 1228 } 1229 if (typeof arr["optimized"] != "undefined") arr["optimized"] = arr["optimized"]; 1230 setMaps(arr, googleMap, data.center); 1231 } 1232 } 1233 1234 // stylers 1235 if (data.styles !== false) styleOptions = data.styles; 1236 else if (data.style !== false) { 1237 if (typeof data.style.hue != "undefined" || typeof data.style.gamma != "undefined" || typeof data.style.lightness != "undefined" || typeof data.style.saturation != "undefined") { 1238 if (typeof styleOptions[0] == "undefined") styleOptions[0] = {}; 1239 if (typeof styleOptions[0].stylers == "undefined") styleOptions[0].stylers = []; 1240 } 1241 1242 if (typeof data.style.hue != "undefined") { 1243 styleOptions[0].stylers.push({ 1244 hue: data.style.hue 1245 }); 1246 } 1247 if (typeof data.style.gamma != "undefined") { 1248 styleOptions[0].stylers.push({ 1249 gamma: data.style.gamma 1250 }); 1251 } 1252 if (typeof data.style.lightness != "undefined") { 1253 styleOptions[0].stylers.push({ 1254 lightness: data.style.lightness 1255 }); 1256 } 1257 if (typeof data.style.saturation != "undefined") { 1258 styleOptions[0].stylers.push({ 1259 saturation: data.style.saturation 1260 }); 1261 } 1262 } 1263 1264 var styledMapOptions = { 1265 name: "MAP" 1266 }, 1267 sampleType = new google.maps.StyledMapType(styleOptions, styledMapOptions); 1268 1269 googleMap.mapTypes.set("sample", sampleType); 1270 googleMap.setMapTypeId("sample"); 1271 1272 // force reset 1273 googleMap.setZoom(data.zoom); 1274 googleMap.setCenter(new google.maps.LatLng(data.center.latitude, data.center.longitude)); 1275 } 1276 1277 function setMaps(obj, map, center) { 1278 var options = {}; 1279 1280 if (obj["html"] !== false) { 1281 if (typeof obj["name"] != "undefined") options["title"] = obj["name"]; 1282 if (typeof obj["desc"] != "undefined") options["desc"] = obj["desc"]; 1283 if (typeof obj["tel"] != "undefined") options["tel"] = obj["tel"]; 1284 if (typeof obj["email"] != "undefined") options["email"] = obj["email"]; 1285 if (typeof obj["url"] != "undefined") options["web"] = obj["url"]; 1286 } 1287 1288 if (typeof obj["logo"] != "undefined") { 1289 var optIcon = {}; 1290 1291 optIcon["url"] = obj["logo"]; 1292 1293 if (typeof obj["sizeWidth"] != "undefined" && typeof obj["sizeHeight"] != "undefined" && Number.isInteger(obj["sizeWidth"]) && Number.isInteger(obj["sizeHeight"])) optIcon["size"] = new google.maps.Size(obj["sizeWidth"], obj["sizeHeight"]); 1294 1295 if (typeof obj["scaleWidth"] != "undefined" && typeof obj["scaleHeight"] != "undefined" && Number.isInteger(obj["scaleWidth"]) && Number.isInteger(obj["scaleHeight"])) optIcon["scaledSize"] = new google.maps.Size(obj["scaleWidth"], obj["scaleHeight"]); 1296 1297 if (typeof obj["originX"] != "undefined" && typeof obj["originY"] != "undefined" && Number.isInteger(obj["originX"]) && Number.isInteger(obj["originY"])) optIcon["origin"] = new google.maps.Point(obj["originX"], obj["originY"]); 1298 1299 if (typeof obj["anchorX"] != "undefined" && typeof obj["anchorY"] != "undefined" && Number.isInteger(obj["anchorX"]) && Number.isInteger(obj["anchorY"])) optIcon["anchor"] = new google.maps.Point(obj["anchorX"], obj["anchorY"]); 1300 1301 if (typeof obj["optimized"] != "undefined") optIcon["optimized"] = obj["optimized"]; 1302 1303 if (typeof optIcon["size"] != "undefined" && typeof optIcon["origin"] != "undefined" && typeof optIcon["anchor"] != "undefined") options["icon"] = optIcon; 1304 else options["icon"] = obj["logo"] ? new google.maps.MarkerImage(obj["logo"]) : null; 1305 } 1306 1307 options["position"] = new google.maps.LatLng(obj["latitude"], obj["longitude"]); 1308 options["map"] = map; 1309 1310 var marker = new google.maps.Marker(options); 1311 gmarkers[gnum] = marker; 1312 gnum++; 1313 1314 if (obj["clickable"] == "js") { 1315 google.maps.event.addListener(marker, "click", function() { 1316 if (obj["click"].constructor == Function) obj["click"].apply(this, [].concat(Array.prototype.slice.call(arguments))); 1317 }); 1318 } 1319 1320 if (obj["html"] !== false) { 1321 var dialog = new google.maps.InfoWindow(), 1322 infoWindowVisible = (function() { 1323 var currentlyVisible = false;
1324 return function(visible) { 1325 for (var z in visible) { 1326 if (/closure_uid/i.test(z)) { 1327 currentlyVisible = visible[z]; 1328 1329 break; 1330 } 1331 } 1332 1333 return currentlyVisible; 1334 1335 1336 if (visible !== undefined) currentlyVisible = visible; 1337 return currentlyVisible; 1338 }; 1339 }()), 1340 dialogShow = (function() { 1341 return function() { 1342 var vCheck = infoWindowVisible(marker); 1343 if (vCheck == _dialogsOpen_) { 1344 dialog.close(); 1345 _dialogsOpen_ = true; 1346 } else { 1347 var tpl = {}; 1348 tpl["name"] = typeof obj["name"] != "undefined" ? obj["name"] : ""; 1349 tpl["desc"] = typeof obj["desc"] != "undefined" ? obj["desc"] : ""; 1350 tpl["tel"] = typeof obj["tel"] != "undefined" ? obj["tel"] : ""; 1351 tpl["email"] = typeof obj["email"] != "undefined" ? obj["email"] : ""; 1352 tpl["url"] = typeof obj["url"] != "undefined" ? obj["url"] : ""; 1353 1354 var html = 1355 obj["html"] 1356 .replace(/{name}/ig, tpl["name"]) 1357 .replace(/{title}/ig, tpl["name"]) 1358 1359 .replace(/{txt}/ig, tpl["desc"]) 1360 .replace(/{text}/ig, tpl["desc"]) 1361 .replace(/{desc}/ig, tpl["desc"]) 1362 .replace(/{description}/ig, tpl["desc"]) 1363 1364 .replace(/{tel}/ig, tpl["tel"]) 1365 .replace(/{telephone}/ig, tpl["tel"]) 1366 .replace(/{phone}/ig, tpl["tel"]) 1367 .replace(/{moible}/ig, tpl["tel"]) 1368 1369 .replace(/{mail}/ig, tpl["email"]) 1370 .replace(/{email}/ig, tpl["email"]) 1371 1372 .replace(/{url}/ig, tpl["url"]) 1373 .replace(/{web}/ig, tpl["url"]) 1374 .replace(/{website}/ig, tpl["url"]); 1375 1376 _dialogs_.forEach(function(d, ix) { 1377 google.maps.event.trigger(d, "closeclick"); 1378 d.close(map, marker); 1379 }); 1380 1381 dialog = new google.maps.InfoWindow({ 1382 content: html 1383 }); 1384 1385 // reset 1386 _dialogs_ = []; 1387 _dialogs_.push(dialog); 1388 1389 dialog.open(map, marker); 1390 _dialogsOpen_ = vCheck; 1391 } 1392 }; 1393 }()); 1394 1395 // _dialogs_.push(dialog); 1396 1397 // events 1398 google.maps.event.addListener(marker, "click", function() { 1399 if (obj["clickable"] == "link" && typeof obj["url"] != "undefined" && obj["url"] != "") { 1400 if (!isExternal(obj["url"]) && $(obj["url"]).length) { 1401 $("html, body").stop().animate({ 1402 scrollTop: $(obj["url"]).offset().top 1403 }, 500); 1404 } else window.open(obj["url"], "_parent"); 1405 } else if (obj["clickable"] == "popup" && isHTML(obj.html)) { 1406 map.panTo(marker.getPosition()); 1407 dialogShow(); 1408 } 1409 }); 1410 google.maps.event.addListener(dialog, "closeclick", function() { 1411 infoWindowVisible(marker); 1412 }); 1413 1414 if (obj["hover"] === true && obj["clickable"] == "link") { 1415 google.maps.event.addListener(marker, "mouseover", function() { 1416 dialogShow(); 1417 }); 1418 1419 google.maps.event.addListener(marker, "mouseout", function() { 1420 dialog.close(); 1421 infoWindowVisible(false); 1422 }); 1423 } 1424 } 1425 1426 /* 1427 window.onresize = function(event) { 1428 google.maps.event.trigger(map, "resize"); 1429 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1430 }; 1431 */ 1432 1433 // always center 1434 google.maps.event.addDomListener(window, "resize", function() { 1435 var center = map.getCenter(); 1436 google.maps.event.trigger(map, "resize"); 1437 // map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1438 map.setCenter(center); 1439 }); 1440 1441 google.maps.event.addListenerOnce(map, "idle", function() { 1442 google.maps.event.trigger(map, "resize"); 1443 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1444 }); 1445 1446 // google.maps.event.trigger(map, "resize"); // onload 1447 1448 $(window).resize(function() { 1449 google.maps.event.trigger(map, "resize"); 1450 }); 1451 } 1452 } 1453 google.maps.event.addDomListener(window, "load", init); 1454 } 1455 // END: gmap 1456 1457 // BEGIN: rollover button 1458 $("body").on({ 1459 click: function() { 1460 $(this).parents(".bxSlider-pager").find("img.btn").trigger("mouseout"); 1461 1462 if ((UA.indexOf("iPad") < 0) && (UA.indexOf("iPhone") < 0) && (UA.indexOf("iPod") < 0)) $(this).trigger("mouseout").trigger("mouseover"); // not iOS 1463 }, 1464 touchstart: function() { 1465 $(this).trigger("click"); 1466 }, 1467 mouseover: function() { 1468 if ((UA.indexOf("iPad") < 0) && (UA.indexOf("iPhone") < 0) && (UA.indexOf("iPod") < 0)) { // not iOS 1469 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr("src")); 1470 1471 $(this).attr("src").match(/^(.*)(\.{1}.*)/g); 1472 1473 var $src = RegExp.$1 + "_on" + RegExp.$2; 1474 1475 $(this).attr("src", $src); // update src 1476 } 1477 }, 1478 mouseout: function() { 1479 if ((UA.indexOf("iPad") < 0) && (UA.indexOf("iPhone") < 0) && (UA.indexOf("iPod") < 0)) { // not iOS 1480 if ($(this).hasClass("copy-change")) { 1481 var _src_ = $(this).attr("src"); 1482 1483 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1484 1485 $(this) 1486 .attr("src", _src_) // update src 1487 .removeClass("copy-change"); 1488 } else if ($(this).data("src-original")) $(this).attr("src", $(this).data("src-original")); // update src 1489 1490 $(this).removeData("src-original"); 1491 } 1492 } 1493 }, "img.btn"); 1494 1495 $("body").on({ 1496 click: function() { 1497 $(this).parents(".bxSlider-pager").find("picture.btn").trigger("mouseout"); 1498 1499 $(this).trigger("mouseout").trigger("mouseover"); 1500 }, 1501 touchstart: function() { 1502 $(this).trigger("click"); 1503 }, 1504 mouseover: function() { 1505 $(this).children().each(function() { 1506 var _attr_ = false;
1507 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1508 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1509 1510 if (_attr_ && $(this).attr(_attr_)) { 1511 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr(_attr_)); 1512 1513 $(this).attr(_attr_).match(/^(.*)(\.{1}.*)/g); 1514 1515 var $src = RegExp.$1 + "_on" + RegExp.$2; 1516 1517 $(this).attr(_attr_, $src); // update src 1518 } 1519 }); 1520 }, 1521 mouseout: function() { 1522 var $picture = $(this); 1523 1524 $picture.children().each(function() { 1525 var _attr_ = false; 1526 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1527 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1528 1529 if (_attr_ && $(this).attr(_attr_)) { 1530 if ($picture.hasClass("copy-change")) { 1531 var _src_ = $(this).attr(_attr_); 1532 1533 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1534 1535 $(this) 1536 .attr(_attr_, _src_) // update src 1537 .removeClass("copy-change"); 1538 } else if ($(this).data("src-original")) $(this).attr(_attr_, $(this).data("src-original")); // update src 1539 1540 $(this).removeData("src-original"); 1541 } 1542 }); 1543 } 1544 }, "picture.btn"); 1545 // END: rollover button 1546 1547 // BEGIN: smooth scroll 1548 // $("body").on("click", "a[href*='#']:not([href='#'])", function(e) { 1549 // $("body").on("click", "a[*|href*='#']:not([href='#'])", function(e) { 1550 $("body").on("click", "a[href*='#']:not([href='#']), a[xlink\\:href*='#']:not([xlink\\:href='#'])", function(e) { 1551 var parseURL = function(url) { 1552 var tag = document.createElement("a"); 1553 tag.href = url; 1554 1555 return tag; 1556 }, 1557 parser = null; 1558 1559 if ($(this).attr("href")) parser = parseURL($(this).attr("href")); 1560 else if ($(this).attr("xlink:href")) parser = parseURL($(this).attr("xlink:href")); 1561 1562 1563 1564 // .nav-fixed: elm sẽ cá» Äá»nh 1565 // .nav-target: tá»a Äá» sẽ tÃnh 1566 // .nav-pin: elm sẽ gắn .fixed 1567 if (parser && location.pathname.replace(/^\//, "") == parser.pathname.replace(/^\//, "") && location.hostname == parser.hostname && !$(this).hasClass("unsmooth")) { 1568 var _hash_ = this.hash || $(this).attr("href") || $(this).attr("xlink:href"), 1569 ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g, // [storage] FCBase.regex.trimHash 1570 trimHash = _hash_.replace(ptnHash, "\\$1"), 1571 $anchor = $(trimHash); 1572 1573 $anchor = $anchor.length > 0 ? $anchor : $("[name=" + trimHash.slice(1) + "]"); 1574 1575 if ($anchor.length) { 1576 e.preventDefault(); 1577 1578 if ($anchor.parents(".tab-content").first().length > 0) $anchor = $anchor.parents(".tab-content").first(); 1579 1580 var $offsetY = $anchor.offset().top, 1581 $navOffset = 0; 1582 1583 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1584 1585 if ($(".tabs-switch").length) { 1586 $(".tabs-switch").each(function() { 1587 var $tabsSwitch = $(this), 1588 $tabLink = $tabsSwitch.children(".tab-link"); 1589 1590 if ($tabLink.children("[data-tab-anchor='" + trimHash + "']").length) $tabLink.children("[data-tab-anchor='" + trimHash + "']").click(); // trigger for set active tab 1591 }); 1592 } 1593 1594 if ($(".nav-target").length) { 1595 // $("html, body").stop().animate({ 1596 // scrollTop: $(".nav-target").offset().top + 10 1597 // }, 100, function() { 1598 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1599 1600 $("html, body").stop().animate({ 1601 scrollTop: $offsetY - $navOffset + 1 1602 }, 500); 1603 // }); 1604 } else { 1605 $("html, body").stop().animate({ 1606 scrollTop: $offsetY - $navOffset + 1 1607 }, 500); 1608 } 1609 1610 // window.location.hash = trimHash; // update location 1611 1612 return false;
1613 } else console.log("[smooth-scroll] Anchor element not found"); 1614 } 1615 }); 1616 // END: smooth scroll 1617 1618 // BEGIN: scroll to top 1619 /*if ($(window).scrollTop() > 0) $("#pagetop").addClass("visible"); 1620 else $("#pagetop").removeClass("visible");*/ 1621 1622 1623 1624 // BEGIN: text vertical 1625 $(".txt-vertical").each(function() { 1626 if (!$(this).hasClass("all-str")) { 1627 var $regex = /(\d{1,2})/g; 1628 1629 if ($(this).hasClass("per-line")) $regex = /(\d)/g; 1630 1631 $(this).html(function(idx, val) { 1632 return val.replace($regex, '<span class="int">$1</span>'); 1633 }); 1634 } 1635 1636 if ($(this).children(".txt-normal").length) { 1637 $(this).children(".txt-normal").html(function(idx, val) { 1638 var $characters = $.trim(val).split(""); 1639 return '<span class="int">' + $characters.join('</span><span class="int">') + '</span>'; 1640 }); 1641 } 1642 }); 1643 $(".txt-vertical-x").each(function() { 1644 $(this).html($(this).text().replace(/(.)/g, "<span>$1</span>")); 1645 }); 1646 // END: text vertical 1647 1648 // BEGIN: social button 1649 var __socialsHTML__ = "", 1650 __socialsLang = $("html").attr("lang") !== undefined && $.trim($("html").attr("lang")).length == 2 ? $.trim($("html").attr("lang")).toLowerCase() : "ja", 1651 $socialsLine = "", 1652 $socialsTwitter = "", 1653 $socialsFacebook = "", 1654 locationURL = window.location.href || location.href; 1655 1656 $socialsTwitter += '<div class="social-twitter">'; 1657 $socialsTwitter += '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>'; 1658 $socialsTwitter += '<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>'; 1659 $socialsTwitter += '</div>'; 1660 1661 $socialsFacebook += '<div class="social-facebook">'; 1662 $socialsFacebook += '<div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>'; 1663 $socialsFacebook += '</div>'; 1664 1665 $socialsLine += '<div class="social-line">'; 1666 $socialsLine += '<div class="line-it-button" data-lang="' + __socialsLang + '" data-type="like" data-url="' + locationURL + '" data-share="true" style="display: none;">'; 1667 $socialsLine += '<script src="https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js" async="async" defer="defer"></script>'; 1668 $socialsLine += '</div>'; 1669 $socialsLine += '</div>'; 1670 1671 if ($("#socialbuttons").length) { 1672 var $socialsOrder = typeof $("#socialbuttons").attr("data") != "undefined" ? $("#socialbuttons").attr("data").split("") : false; 1673 1674 if (typeof $socialsOrder == "object" && $socialsOrder.length) { 1675 for (var socialsType in $socialsOrder) { 1676 if ($.trim(socialsType).length > 0) { 1677 socialsType = socialsType.toLowerCase(); 1678 1679 if ($socialsOrder[socialsType].toLocaleLowerCase() === "f") __socialsHTML__ += $socialsFacebook; 1680 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "t") __socialsHTML__ += $socialsTwitter; 1681 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "l") __socialsHTML__ += $socialsLine; 1682 } 1683 } 1684 } else { 1685 __socialsHTML__ += $socialsTwitter; 1686 __socialsHTML__ += $socialsFacebook; 1687 __socialsHTML__ += $socialsLine; 1688 } 1689 1690 $("#socialbuttons").html(__socialsHTML__); 1691 } 1692 // END: social button 1693 1694 /* fix smoothscroll on IE - jumpy fixed background */ 1695 if (navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { 1696 $("body.ie-smoothscroll") 1697 .on("mousewheel", function(e) { 1698 if (event.preventDefault) event.preventDefault(); 1699 else event.returnValue = false; 1700 1701 var delta = null, 1702 offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft, 1703 offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop; 1704 1705 if (e.wheelDelta) delta = e.wheelDelta; 1706 else if (e.originalEvent) { 1707 if (e.originalEvent.wheelDelta) delta = e.originalEvent.wheelDelta; 1708 else if (e.originalEvent.deltaY) delta = 0 - e.originalEvent.deltaY; 1709 else if (e.originalEvent.detail) delta = e.originalEvent.detail * -40; 1710 } else if (event.originalEvent) { 1711 if (event.originalEvent.wheelDelta) delta = event.originalEvent.wheelDelta; 1712 else if (event.originalEvent.deltaY) delta = 0 - event.originalEvent.deltaY; 1713 else if (event.originalEvent.detail) delta = event.originalEvent.detail * -40; 1714 } 1715 1716 if (delta !== null) window.scrollTo(0, offsetY - delta); 1717 }); 1718 } 1719 1720 // scrollBefore(); // smoothscroll before page loaded 1721 1722 $("body").on({ 1723 mouseup: function() { 1724 // $("html").addClass("break-jump"); 1725 $(this).removeClass("scrollable"); 1726 }, 1727 mousedown: function() { 1728 // $("html").addClass("break-jump"); 1729 $(this).addClass("scrollable"); 1730 }, 1731 mouseleave: function() { 1732 // $("html").addClass("break-jump"); 1733 $(this).removeClass("scrollable"); 1734 } 1735 }, ".gmap"); 1736 1737 // BEGIN: .pagination 1738 $(".pagination").each(function() {
1739 initPager($(this)); 1740 }); 1741 1742 $(".pagination") 1743 .on("click", ".page-link .page-first", function() { 1744 var $pagination = $(this).parents(".pagination").first(), 1745 $pageContent = $pagination.children(".page-content"), 1746 $pageLink = $pagination.children(".page-link"), 1747 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 1748 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 1749 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 1750 navOffset = 0; 1751 1752 if (!$pagination.hasClass("clicked")) { 1753 $pagination.addClass("clicked"); 1754 1755 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1756 1757 if (mode == "fade") { 1758 if ($pageContent.children().length > 1) { 1759 $pageContent.children().stop().fadeOut(duration, function() { 1760 $(this).removeAttr("style").removeClass("active"); 1761 }).siblings().first().stop().delay(duration).fadeIn(duration, function() { 1762 $(this).removeAttr("style").addClass("active"); 1763 1764 if (scrollable) { 1765 $("body, html").stop().animate({ 1766 scrollTop: $pagination.offset().top - navOffset 1767 }, 300); 1768 } 1769 1770 $pagination.removeClass("clicked"); 1771 }); 1772 } else { 1773 $pageContent.children().first().stop().fadeIn(duration, function() { 1774 $(this).removeAttr("style").addClass("active"); 1775 1776 if (scrollable) { 1777 $("body, html").stop().animate({ 1778 scrollTop: $pagination.offset().top - navOffset 1779 }, 300); 1780 } 1781 1782 $pagination.removeClass("clicked"); 1783 }); 1784 } 1785 } else if (mode == "slide") { 1786 if ($pageContent.children().length > 1) { 1787 $pageContent.children().stop().slideUp(duration, function() { 1788 $(this).removeAttr("style").removeClass("active"); 1789 }).siblings().first().stop().delay(duration).slideDown(duration, function() { 1790 $(this).removeAttr("style").addClass("active"); 1791 1792 if (scrollable) { 1793 $("body, html").stop().animate({ 1794 scrollTop: $pagination.offset().top - navOffset 1795 }, 300); 1796 } 1797 1798 $pagination.removeClass("clicked"); 1799 }); 1800 } else { 1801 $pageContent.children().first().stop().slideDown(duration, function() { 1802 $(this).removeAttr("style").addClass("active"); 1803 1804 if (scrollable) { 1805 $("body, html").stop().animate({ 1806 scrollTop: $pagination.offset().top - navOffset 1807 }, 300); 1808 } 1809 1810 $pagination.removeClass("clicked"); 1811 }); 1812 } 1813 } else { 1814 if ($pageContent.children().length > 1) { 1815 $pageContent.children().stop().hide(duration, function() { 1816 $(this).removeAttr("style").removeClass("active"); 1817 }).siblings().first().stop().delay(duration).show(duration, function() { 1818 $(this).removeAttr("style").addClass("active"); 1819 1820 if (scrollable) { 1821 $("body, html").stop().animate({ 1822 scrollTop: $pagination.offset().top - navOffset 1823 }, 300); 1824 } 1825 1826 $pagination.removeClass("clicked"); 1827 }); 1828 } else { 1829 $pageContent.children().first().stop().show(duration, function() { 1830 $(this).removeAttr("style").addClass("active"); 1831 1832 if (scrollable) { 1833 $("body, html").stop().animate({ 1834 scrollTop: $pagination.offset().top - navOffset 1835 }, 300); 1836 } 1837 1838 $pagination.removeClass("clicked"); 1839 }); 1840 } 1841 } 1842 1843 $pageLink.find(".page-item.active").removeClass("active"); 1844 $pageLink.each(function() { 1845 $(this).find(".page-item").first().addClass("active"); 1846 }); 1847 } 1848 }) 1849 .on("click", ".page-link .page-last", function() { 1850 var $pagination = $(this).parents(".pagination").first(), 1851 $pageContent = $pagination.children(".page-content"), 1852 $pageLink = $pagination.children(".page-link"), 1853 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 1854 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 1855 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 1856 navOffset = 0; 1857 1858 if (!$pagination.hasClass("clicked")) { 1859 $pagination.addClass("clicked"); 1860 1861 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1862 1863 if (mode == "fade") { 1864 if ($pageContent.children().length > 1) { 1865 $pageContent.children().stop().fadeOut(duration, function() { 1866 $(this).removeAttr("style").removeClass("active"); 1867 }
1867).siblings().last().stop().delay(duration).fadeIn(duration, function() { 1868 $(this).removeAttr("style").addClass("active"); 1869 1870 if (scrollable) { 1871 $("body, html").stop().animate({ 1872 scrollTop: $pagination.offset().top - navOffset 1873 }, 300); 1874 } 1875 1876 $pagination.removeClass("clicked"); 1877 }); 1878 } else { 1879 $pageContent.children().last().stop().fadeIn(duration, function() { 1880 $(this).removeAttr("style").addClass("active"); 1881 1882 if (scrollable) { 1883 $("body, html").stop().animate({ 1884 scrollTop: $pagination.offset().top - navOffset 1885 }, 300); 1886 } 1887 1888 $pagination.removeClass("clicked"); 1889 }); 1890 } 1891 } else if (mode == "slide") { 1892 if ($pageContent.children().length > 1) { 1893 $pageContent.children().stop().slideUp(duration, function() { 1894 $(this).removeAttr("style").removeClass("active"); 1895 }).siblings().last().stop().delay(duration).slideDown(duration, function() { 1896 $(this).removeAttr("style").addClass("active"); 1897 1898 if (scrollable) { 1899 $("body, html").stop().animate({ 1900 scrollTop: $pagination.offset().top - navOffset 1901 }, 300); 1902 } 1903 1904 $pagination.removeClass("clicked"); 1905 }); 1906 } else { 1907 $pageContent.children().last().stop().slideDown(duration, function() { 1908 $(this).removeAttr("style").addClass("active"); 1909 1910 if (scrollable) { 1911 $("body, html").stop().animate({ 1912 scrollTop: $pagination.offset().top - navOffset 1913 }, 300); 1914 } 1915 1916 $pagination.removeClass("clicked"); 1917 }); 1918 } 1919 } else { 1920 if ($pageContent.children().length > 1) { 1921 $pageContent.children().stop().hide(duration, function() { 1922 $(this).removeAttr("style").removeClass("active"); 1923 }).siblings().last().stop().delay(duration).show(duration, function() { 1924 $(this).removeAttr("style").addClass("active"); 1925 1926 if (scrollable) { 1927 $("body, html").stop().animate({ 1928 scrollTop: $pagination.offset().top - navOffset 1929 }, 300); 1930 } 1931 1932 $pagination.removeClass("clicked"); 1933 }); 1934 } else { 1935 $pageContent.children().last().stop().show(duration, function() { 1936 $(this).removeAttr("style").addClass("active"); 1937 1938 if (scrollable) { 1939 $("body, html").stop().animate({ 1940 scrollTop: $pagination.offset().top - navOffset 1941 }, 300); 1942 } 1943 1944 $pagination.removeClass("clicked"); 1945 }); 1946 } 1947 } 1948 1949 $pageLink.find(".page-item.active").removeClass("active"); 1950 $pageLink.each(function() { 1951 $(this).find(".page-item").last().addClass("active"); 1952 }); 1953 } 1954 }) 1955 .on("click", ".page-link .page-next", function() { 1956 var $pagination = $(this).parents(".pagination").first(), 1957 navOffset = 0; 1958 1959 if (!$pagination.hasClass("clicked")) { 1960 $pagination.addClass("clicked"); 1961 1962 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1963
1964 var $pageContent = $pagination.children(".page-content"), 1965 $pageLink = $pagination.children(".page-link"), 1966 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 1967 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 1968 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 1969 $pageCurrent = $pageLink.find(".page-item.active"), 1970 $pageClone = $pageLink.clone(), 1971 idx = 0; 1972 1973 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 1974 1975 idx = $pageClone.find(".page-item.active").index(); 1976 1977 $pageLink.find(".page-item.active").removeClass("active"); 1978 1979 if ($pageClone.find(".page-item.active").next(".page-item").length > 0) { 1980 if (mode == "fade") { 1981 if ($pageContent.children().length > 1) { 1982 $pageContent.children().stop().fadeOut(duration, function() { 1983 $(this).removeAttr("style").removeClass("active"); 1984 }).siblings().eq(idx + 1).stop().delay(duration).fadeIn(duration, function() { 1985 $(this).removeAttr("style").addClass("active"); 1986 1987 if (scrollable) { 1988 $("body, html").stop().animate({ 1989 scrollTop: $pagination.offset().top - navOffset 1990 }, 300); 1991 } 1992 1993 $pagination.removeClass("clicked"); 1994 }); 1995 } else { 1996 $pageContent.children().eq(idx + 1).stop().fadeIn(duration, function() { 1997 $(this).removeAttr("style").addClass("active"); 1998 1999 if (scrollable) { 2000 $("body, html").stop().animate({ 2001 scrollTop: $pagination.offset().top - navOffset 2002 }, 300); 2003 } 2004 2005 $pagination.removeClass("clicked"); 2006 }); 2007 } 2008 } else if (mode == "slide") { 2009 if ($pageContent.children().length > 1) { 2010 $pageContent.children().stop().slideUp(duration, function() { 2011 $(this).removeAttr("style").removeClass("active"); 2012 }).siblings().eq(idx + 1).stop().delay(duration).slideDown(duration, function() { 2013 $(this).removeAttr("style").addClass("active"); 2014 2015 if (scrollable) { 2016 $("body, html").stop().animate({ 2017 scrollTop: $pagination.offset().top - navOffset 2018 }, 300); 2019 } 2020 2021 $pagination.removeClass("clicked"); 2022 }); 2023 } else { 2024 $pageContent.children().eq(idx + 1).stop().slideDown(duration, function() { 2025 $(this).removeAttr("style").addClass("active"); 2026 2027 if (scrollable) { 2028 $("body, html").stop().animate({ 2029 scrollTop: $pagination.offset().top - navOffset 2030 }, 300); 2031 } 2032 2033 $pagination.removeClass("clicked"); 2034 }); 2035 } 2036 } else { 2037 if ($pageContent.children().length > 1) { 2038 $pageContent.children().stop().hide(duration, function() { 2039 $(this).removeAttr("style").removeClass("active"); 2040 }).siblings().eq(idx + 1).stop().delay(duration).show(duration, function() { 2041 $(this).removeAttr("style").addClass("active"); 2042 2043 if (scrollable) { 2044 $("body, html").stop().animate({ 2045 scrollTop: $pagination.offset().top - navOffset 2046 }, 300); 2047 } 2048 2049 $pagination.removeClass("clicked"); 2050 }); 2051 } else { 2052 $pageContent.children().eq(idx + 1).stop().show(duration, function() { 2053 $(this).removeAttr("style").addClass("active"); 2054 2055 if (scrollable) { 2056 $("body, html").stop().animate({ 2057 scrollTop: $pagination.offset().top - navOffset 2058 }, 300); 2059 } 2060 2061 $pagination.removeClass("clicked"); 2062 }); 2063 } 2064 } 2065 2066 $pageCurrent.next(".page-item").addClass("active"); 2067 } else { 2068 if (mode == "fade") { 2069 if ($pageContent.children().length > 1) { 2070 $pageContent.children().stop().fadeOut(duration, function() { 2071 $(this).removeAttr("style").removeClass("active"); 2072 }).siblings().first().stop().delay(duration).fadeIn(duration, function() { 2073 $(this).removeAttr("style").addClass("active"); 2074 2075 if (scrollable) { 2076 $("body, html").stop().animate({ 2077 scrollTop: $pagination.offset().top - navOffset 2078 }, 300); 2079 } 2080 2081 $pagination.removeClass("clicked"); 2082 }); 2083 } else { 2084 $pageContent.children().first().stop().fadeIn(duration, function() { 2085 $(this).removeAttr("style").addClass("active"); 2086 2087 if (scrollable) { 2088 $("body, html").stop().animate({ 2089 scrollTop: $pagination.offset().top - navOffset 2090 }, 300); 2091 } 2092 2093 $pagination.removeClass("clicked"); 2094 }); 2095 } 2096 } else if (mode == "slide") { 2097 if ($pageContent.children().length > 1) { 2098 $pageContent.children().stop().slideUp(duration, function() { 2099 $(this).removeAttr("style").removeClass("active"); 2100 }).siblings().first().stop().delay(duration).slideDown(duration, function() { 2101 $(this).removeAttr("style").addClass("active"); 2102 2103 if (scrollable) { 2104 $("body, html").stop().animate({ 2105 scrollTop: $pagination.offset().top - navOffset 2106 }, 300); 2107 } 2108 2109 $pagination.removeClass("clicked"); 2110 }); 2111 } else { 2112 $pageContent.children().first().stop().slideDown(duration, function() { 2113 $(this).removeAttr("style").addClass("active"); 2114 2115 if (scrollable) { 2116 $("body, html").stop().animate({ 2117 scrollTop: $pagination.offset().top - navOffset 2118 }, 300); 2119 } 2120 2121 $pagination.removeClass("clicked"); 2122 }); 2123 } 2124 } else { 2125 if ($pageContent.children().length > 1) { 2126 $pageContent.children().stop().hide(duration, function() { 2127 $(this).removeAttr("style").removeClass("active"); 2128 }).siblings().first().stop().delay(duration).show(duration, function() { 2129 $(this).removeAttr("style").addClass("active"); 2130 2131 if (scrollable) { 2132 $("body, html").stop().animate({ 2133 scrollTop: $pagination.offset().top - navOffset 2134 }, 300); 2135 } 2136 2137 $pagination.removeClass("clicked"); 2138 }); 2139 } else { 2140 $pageContent.children().first().stop().show(duration, function() { 2141 $(this).removeAttr("style").addClass("active"); 2142 2143 if (scrollable) { 2144 $("body, html").stop().animate({ 2145 scrollTop: $pagination.offset().top - navOffset 2146 }, 300); 2147 } 2148 2149 $pagination.removeClass("clicked"); 2150 }); 2151 } 2152 } 2153 2154 $pageLink.each(function() { 2155 $(this).find(".page-item").first().addClass("active"); 2156 }); 2157 } 2158 } 2159 }) 2160 .on("click", ".page-link .page-prev", function() { 2161 var $pagination = $(this).parents(".pagination").first(), 2162 navOffset = 0; 2163 2164 if (!$pagination.hasClass("clicked")) { 2165 $pagination.addClass("clicked"); 2166 2167 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 2168
2169 var $pageContent = $pagination.children(".page-content"), 2170 $pageLink = $pagination.children(".page-link"), 2171 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 2172 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 2173 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 2174 $pageCurrent = $pageLink.find(".page-item.active"), 2175 $pageClone = $pageLink.clone(), 2176 idx = 0; 2177 2178 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 2179 2180 idx = $pageClone.find(".page-item.active").index(); 2181 2182 $pageLink.find(".page-item.active").removeClass("active"); 2183 2184 if ($pageClone.find(".page-item.active").prev(".page-item").length > 0) { 2185 if (mode == "fade") { 2186 if ($pageContent.children().length > 1) { 2187 $pageContent.children().stop().fadeOut(duration, function() { 2188 $(this).removeAttr("style").removeClass("active"); 2189 }).siblings().eq(idx - 1).stop().delay(duration).fadeIn(duration, function() { 2190 $(this).removeAttr("style").addClass("active"); 2191 2192 if (scrollable) { 2193 $("body, html").stop().animate({ 2194 scrollTop: $pagination.offset().top - navOffset 2195 }, 300); 2196 } 2197 2198 $pagination.removeClass("clicked"); 2199 }); 2200 } else { 2201 $pageContent.children().eq(idx - 1).stop().fadeIn(duration, function() { 2202 $(this).removeAttr("style").addClass("active"); 2203 2204 if (scrollable) { 2205 $("body, html").stop().animate({ 2206 scrollTop: $pagination.offset().top - navOffset 2207 }, 300); 2208 } 2209 2210 $pagination.removeClass("clicked"); 2211 }); 2212 } 2213 } else if (mode == "slide") { 2214 if ($pageContent.children().length > 1) { 2215 $pageContent.children().stop().slideUp(duration, function() { 2216 $(this).removeAttr("style").removeClass("active"); 2217 }).siblings().eq(idx - 1).stop().delay(duration).slideDown(duration, function() { 2218 $(this).removeAttr("style").addClass("active"); 2219 2220 if (scrollable) { 2221 $("body, html").stop().animate({ 2222 scrollTop: $pagination.offset().top - navOffset 2223 }, 300); 2224 } 2225 2226 $pagination.removeClass("clicked"); 2227 }); 2228 } else { 2229 $pageContent.children().eq(idx - 1).stop().slideDown(duration, function() { 2230 $(this).removeAttr("style").addClass("active"); 2231 2232 if (scrollable) { 2233 $("body, html").stop().animate({ 2234 scrollTop: $pagination.offset().top - navOffset 2235 }, 300); 2236 } 2237 2238 $pagination.removeClass("clicked"); 2239 }); 2240 } 2241 } else { 2242 if ($pageContent.children().length > 1) { 2243 $pageContent.children().stop().hide(duration, function() { 2244 $(this).removeAttr("style").removeClass("active"); 2245 }).siblings().eq(idx - 1).stop().delay(duration).show(duration, function() { 2246 $(this).removeAttr("style").addClass("active"); 2247 2248 if (scrollable) { 2249 $("body, html").stop().animate({ 2250 scrollTop: $pagination.offset().top - navOffset 2251 }, 300); 2252 } 2253 2254 $pagination.removeClass("clicked"); 2255 }); 2256 } else { 2257 $pageContent.children().eq(idx - 1).stop().show(duration, function() { 2258 $(this).removeAttr("style").addClass("active"); 2259 2260 if (scrollable) { 2261 $("body, html").stop().animate({ 2262 scrollTop: $pagination.offset().top - navOffset 2263 }, 300); 2264 } 2265 2266 $pagination.removeClass("clicked"); 2267 }); 2268 } 2269 } 2270 2271 $pageCurrent.prev(".page-item").addClass("active"); 2272 } else { 2273 if (mode == "fade") { 2274 if ($pageContent.children().length > 1) { 2275 $pageContent.children().stop().fadeOut(duration, function() { 2276 $(this).removeAttr("style").removeClass("active"); 2277 }
2277).siblings().last().stop().delay(duration).fadeIn(duration, function() { 2278 $(this).removeAttr("style").addClass("active"); 2279 2280 if (scrollable) { 2281 $("body, html").stop().animate({ 2282 scrollTop: $pagination.offset().top - navOffset 2283 }, 300); 2284 } 2285 2286 $pagination.removeClass("clicked"); 2287 }); 2288 } else { 2289 $pageContent.children().last().stop().fadeIn(duration, function() { 2290 $(this).removeAttr("style").addClass("active"); 2291 2292 if (scrollable) { 2293 $("body, html").stop().animate({ 2294 scrollTop: $pagination.offset().top - navOffset 2295 }, 300); 2296 } 2297 2298 $pagination.removeClass("clicked"); 2299 }); 2300 } 2301 } else if (mode == "slide") { 2302 if ($pageContent.children().length > 1) { 2303 $pageContent.children().stop().slideUp(duration, function() { 2304 $(this).removeAttr("style").removeClass("active"); 2305 }).siblings().last().stop().delay(duration).slideDown(duration, function() { 2306 $(this).removeAttr("style").addClass("active"); 2307 2308 if (scrollable) { 2309 $("body, html").stop().animate({ 2310 scrollTop: $pagination.offset().top - navOffset 2311 }, 300); 2312 } 2313 2314 $pagination.removeClass("clicked"); 2315 }); 2316 } else { 2317 $pageContent.children().last().stop().slideDown(duration, function() { 2318 $(this).removeAttr("style").addClass("active"); 2319 2320 if (scrollable) { 2321 $("body, html").stop().animate({ 2322 scrollTop: $pagination.offset().top - navOffset 2323 }, 300); 2324 } 2325 2326 $pagination.removeClass("clicked"); 2327 }); 2328 } 2329 } else { 2330 if ($pageContent.children().length > 1) { 2331 $pageContent.children().stop().hide(duration, function() { 2332 $(this).removeAttr("style").removeClass("active"); 2333 }).siblings().last().stop().delay(duration).show(duration, function() { 2334 $(this).removeAttr("style").addClass("active"); 2335 2336 if (scrollable) { 2337 $("body, html").stop().animate({ 2338 scrollTop: $pagination.offset().top - navOffset 2339 }, 300); 2340 } 2341 2342 $pagination.removeClass("clicked"); 2343 }); 2344 } else { 2345 $pageContent.children().last().stop().show(duration, function() { 2346 $(this).removeAttr("style").addClass("active"); 2347 2348 if (scrollable) { 2349 $("body, html").stop().animate({ 2350 scrollTop: $pagination.offset().top - navOffset 2351 }, 300); 2352 } 2353 2354 $pagination.removeClass("clicked"); 2355 }); 2356 } 2357 } 2358 2359 $pageLink.each(function() { 2360 $(this).find(".page-item").last().addClass("active"); 2361 }); 2362 } 2363 } 2364 }) 2365 .on("click", ".page-link .page-item", function() { 2366 var $pagination = $(this).parents(".pagination").first(), 2367 navOffset = 0; 2368 2369 if (!$pagination.hasClass("clicked")) { 2370 $pagination.addClass("clicked"); 2371 2372 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 2373 2374 $(this).addClass("current"); 2375
2376 var $pageContent = $pagination.children(".page-content"), 2377 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 2378 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 2379 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 2380 $pageClone = $pagination.children(".page-link").find(".page-item.current").parents(".page-link").first().clone(), 2381 idx = 0; 2382 2383 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 2384 2385 idx = $pageClone.find(".page-item.current").index(); 2386 2387 if (mode == "fade") { 2388 if ($pageContent.children().length > 1) { 2389 $pageContent.children().stop().fadeOut(duration, function() { 2390 $(this).removeAttr("style").removeClass("active"); 2391 }).siblings().eq(idx).stop().delay(duration).fadeIn(duration, function() { 2392 $(this).removeAttr("style").addClass("active"); 2393 2394 if (scrollable) { 2395 $("body, html").stop().animate({ 2396 scrollTop: $pagination.offset().top - navOffset 2397 }, 300); 2398 } 2399 2400 $pagination.removeClass("clicked"); 2401 }); 2402 } else { 2403 $pageContent.children().eq(idx).stop().fadeIn(duration, function() { 2404 $(this).removeAttr("style").addClass("active"); 2405 2406 if (scrollable) { 2407 $("body, html").stop().animate({ 2408 scrollTop: $pagination.offset().top - navOffset 2409 }, 300); 2410 } 2411 2412 $pagination.removeClass("clicked"); 2413 }); 2414 } 2415 } else if (mode == "slide") { 2416 if ($pageContent.children().length > 1) { 2417 $pageContent.children().stop().slideUp(duration, function() { 2418 $(this).removeAttr("style").removeClass("active"); 2419 }).siblings().eq(idx).stop().delay(duration).slideDown(duration, function() { 2420 $(this).removeAttr("style").addClass("active"); 2421 2422 if (scrollable) { 2423 $("body, html").stop().animate({ 2424 scrollTop: $pagination.offset().top - navOffset 2425 }, 300); 2426 } 2427 2428 $pagination.removeClass("clicked"); 2429 }); 2430 } else { 2431 $pageContent.children().eq(idx).stop().slideDown(duration, function() { 2432 $(this).removeAttr("style").addClass("active"); 2433 2434 if (scrollable) { 2435 $("body, html").stop().animate({ 2436 scrollTop: $pagination.offset().top - navOffset 2437 }, 300); 2438 } 2439 2440 $pagination.removeClass("clicked"); 2441 }); 2442 } 2443 } else { 2444 if ($pageContent.children().length > 1) { 2445 $pageContent.children().stop().hide(duration, function() { 2446 $(this).removeAttr("style").removeClass("active"); 2447 }).siblings().eq(idx).stop().delay(duration).show(duration, function() { 2448 $(this).removeAttr("style").addClass("active"); 2449 2450 if (scrollable) { 2451 $("body, html").stop().animate({ 2452 scrollTop: $pagination.offset().top - navOffset 2453 }, 300); 2454 } 2455 2456 $pagination.removeClass("clicked"); 2457 }); 2458 } else { 2459 $pageContent.children().eq(idx).stop().show(duration, function() { 2460 $(this).removeAttr("style").addClass("active"); 2461 2462 if (scrollable) { 2463 $("body, html").stop().animate({ 2464 scrollTop: $pagination.offset().top - navOffset 2465 }, 300); 2466 } 2467 2468 $pagination.removeClass("clicked"); 2469 }); 2470 } 2471 } 2472 2473 $pagination.children(".page-link").find(".page-item.current").removeClass("current"); 2474 $pagination.children(".page-link").find(".page-item.active").removeClass("active"); 2475 $pagination.children(".page-link").each(function() { 2476 $(this).find(".page-item").eq(idx).addClass("active"); 2477 }); 2478 } 2479 }) 2480 .on("click", ".page-link li.disabled", function() {}); 2481 // END: .pagination 2482}); 2483 2484// user agents 2485var isMobile = { 2486 Android: function() { 2487 return navigator.userAgent.match(/Android/i); 2488 }, 2489 BlackBerry: function() { 2490 return navigator.userAgent.match(/BlackBerry/i); 2491 }, 2492 iOS: function() { 2493 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 2494 }, 2495 Opera: function() { 2496 return navigator.userAgent.match(/Opera Mini/i); 2497 }, 2498 Windows: function() { 2499 return navigator.userAgent.match(/IEMobile/i); 2500 }, 2501 any: function() { 2502 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 2503 } 2504}; 2505 2506var fbTimer = null, 2507 fbCodes = {}, 2508 fbPage = document.querySelectorAll(".fb-page"); 2509 2510if (fbPage.length > 0) { 2511 for (var i in fbPage) { 2512 if (fbPage[i].constructor === HTMLDivElement) fbCodes[i] = fbPage[i].outerHTML; 2513 } 2514} 2515 2516$(window).resize(function() { 2517 // fix bg parallax on mobile 2518 if (isMobile.any()) $(".bg-parallax").css("background-attachment", "inherit"); 2519 else $(".bg-parallax").css("background-attachment", ""); 2520 2521 $(".pagination").removeClass("clicked"); 2522 2523 if ($("#fb-root").attr("data-resize")) { 2524 if (fbTimer != null) clearTimeout(fbTimer); 2525 2526 // delay for document is loaded 2527 fbTimer = setTimeout(function() { 2528 if (typeof FB !== "undefined") { 2529 $(".fb-page").each(function(i) { 2530 if (fbCodes[i]) $(this).replaceWith(fbCodes[i]); 2531 }); 2532 2533 FB.XFBML.parse(document, function() { 2534 if ($("#fb-root").attr("data-resize") == "once") $("#fb-root").removeAttr("data-resize"); 2535 }); 2536 } 2537 }, 1000); 2538 } 2539}).on("scroll resize", function() { 2540 /*if ($(this).scrollTop() > 0) $("#pagetop").addClass("visible"); 2541 else $("#pagetop").removeClass("visible");*/ 2542 2543 if ($(".nav-fixed").length) {
2544 var $navPinY = $(".nav-target").length ? $(".nav-target").offset().top - $(".nav-fixed").outerHeight() - 1 : $(".nav-fixed").offset().top; 2545 if ($(this).scrollTop() > $navPinY || ($navPinY < 0 && $(this).scrollTop() > 0)) { 2546 if ($(".nav-pin").length) $(".nav-pin").addClass("fixed"); 2547 else $(".nav-fixed").addClass("fixed"); 2548 } else { 2549 if ($(".nav-pin").length) $(".nav-pin").removeClass("fixed"); 2550 else $(".nav-fixed").removeClass("fixed"); 2551 } 2552 } 2553}).on("load", function() { 2554 // scrollBefore(); 2555}); 2556 2557var scrollBefore = function() { 2558 var hash = window.location.hash || location.hash, 2559 ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g; 2560 2561 if (hash) { 2562 hash = hash.replace(ptnHash, "\\$1"); 2563 if ($(hash).length > 0) { 2564 if ($(".tabs-switch").length > 0) { 2565 if ($(hash).length > 0 && $(hash).parents(".tab-content").first().length > 0) { 2566 var tabChild = $(hash); 2567 $(hash).parents().each(function() { 2568 if ($(this).attr("class") !== undefined && $.inArray("tab-content", $(this).attr("class").split(" ")) >= 0) return false; 2569 else tabChild = $(this); 2570 }); 2571 2572 setTimeout(function() { 2573 tabChild.parents(".tabs-switch").first().children(".tab-link").children().eq(tabChild.index()).click(); // trigger tab in multiple dim 2574 }, 10); 2575 } else { 2576 $(".tabs-switch").each(function() { 2577 var $tabLink = $(this).children(".tab-link"); 2578 2579 if ($tabLink.children(hash).length > 0) { 2580 setTimeout(function() { 2581 $tabLink.children(hash).click(); // trigger for set active tab 2582 }, 10); 2583 } 2584 }); 2585 } 2586 } 2587 2588 if ($(".bx-wrapper").length > 0) $(window).trigger("resize"); 2589 2590 setTimeout(function() { 2591 if ($(".nav-fixed").length > 0) { 2592 var offsetY = $(hash).offset().top, 2593 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 2594 2595 // if ($(".nav-pin").length > 0) offsetY -= $(".nav-pin").outerHeight(); 2596 2597 window.scroll(0, offsetY - navHeight); 2598 2599 // re-updated offset 2600 if ($(".nav-target").length > 0) { 2601 var reupdated = true; 2602 $(window).scroll(function() { 2603 if (reupdated && $(this).scrollTop() >= $(".nav-target").offset().top) { 2604 reupdated = false; 2605 2606 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 2607 2608 window.scroll(0, $(hash).offset().top - navHeight); 2609 } 2610 }); 2611 } 2612 } else window.scrollTo(0, $(hash).offset().top); 2613 }, 10); 2614 2615 $("a[href='" + hash + "']").click(); 2616 } // else window.scrollTo(0, _offsetY); 2617 } 2618}; 2619 2620scrollBefore(); // DOM loaded 2621 2622 2623 2624/* 2625 * Plugins/Functions 2626 * 2627 */ 2628 2629// check object is variable or DOM elements 2630function isObjectVar(obj) { 2631 return ((typeof obj != "undefined") && (typeof obj === "object") && (obj.nodeType !== 1) && (typeof obj.ownerDocument !== "object")); 2632} 2633 2634(function($) { 2635 // BEGIN: $.fcvScroll 2636 $.fn.fcvScroll = function(options) { 2637 var options = $.extend({ 2638 selector: ".section", // selector 2639 delay: 50, // time delay (ms) 2640 duration: 400, // time duration (ms) 2641 reference: .9, 2642 }, options); 2643 2644 if (options.selector) { 2645 var $wrapper = $(this), 2646 $offsetSelectors = [], 2647 $scrollDown = true, 2648 $scrollPos = $(window).scrollTop(), 2649 $scrollTimer = null; 2650 2651 $wrapper.find(options.selector).each(function(i) { 2652 $offsetSelectors.push($(this).offset().top); // offsetY fined 2653 }); 2654 2655 $(window).scroll(function() { 2656 $scrollDown = $(window).scrollTop() >= $scrollPos; 2657 $scrollPos = $(window).scrollTop(); 2658 2659 clearTimeout($scrollTimer); 2660 2661 if ($.inArray($(window).scrollTop(), $offsetSelectors) < 0) { // not in area fined 2662 $scrollTimer = setTimeout(function() { // fcv-snap 2663 var $scrollTop = $(window).scrollTop(), 2664 $posY = $(window).height() * options.reference, 2665 $position = 0, 2666 $target; 2667 2668 if ($scrollDown) { // direction down 2669 $position = $scrollTop + $posY - 1; 2670 $wrapper.find(options.selector).each(function() { 2671 var $offsetY = $(this).offset().top; 2672 if (($offsetY > $scrollTop) && ($offsetY <= $position)) { 2673 $target = $(this); 2674 return false;
2675 } 2676 }); 2677 } else { // direction up 2678 $position = $scrollTop - $posY + 1; 2679 $wrapper.find(options.selector).each(function() { 2680 var $offsetY = $(this).offset().top; 2681 if (($offsetY < $scrollTop) && ($offsetY >= $position)) { 2682 $target = $(this); 2683 return false; 2684 } 2685 }); 2686 } 2687 2688 if ($target) { 2689 $("html, body").stop().animate({ 2690 scrollTop: $target.offset().top 2691 }, options.duration, function() { 2692 clearTimeout($scrollTimer); 2693 }); 2694 } 2695 }, options.delay); 2696 } 2697 }).resize(function() { 2698 if ($(options.selector).hasClass("minHeight")) { 2699 $(options.selector).css({ 2700 minHeight: $(window).height() 2701 }); 2702 } else { 2703 $(options.selector).css({ 2704 height: $(window).height() 2705 }); 2706 } 2707 }).trigger("resize"); 2708 } else console.error("Missing selector"); 2709 2710 return this; 2711 }; 2712 // END: $.fcvScroll 2713})(jQuery); 2714 2715var gmarkers = [], 2716 gnum = 0; 2717 2718 2719 2720// BEGIN: heightLine 2721function heightLine() { 2722 this.className = "heightLine"; 2723 this.parentClassName = "heightLineParent" 2724 reg = new RegExp(this.className + "-([a-zA-Z0-9-_]+)", "i"); 2725 objCN = new Array(); 2726 var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all; 2727 for (var i = 0; i < objAll.length; i++) { 2728 if (typeof objAll[i].className == "string") { 2729 var eltClass = objAll[i].className.split(/\s+/); 2730 for (var j = 0; j < eltClass.length; j++) { 2731 if (eltClass[j] == this.className) { 2732 if (!objCN["main CN"]) objCN["main CN"] = new Array(); 2733 objCN["main CN"].push(objAll[i]); 2734 break; 2735 } else if (eltClass[j] == this.parentClassName) { 2736 if (!objCN["parent CN"]) objCN["parent CN"] = new Array(); 2737 objCN["parent CN"].push(objAll[i]); 2738 break; 2739 } else if (eltClass[j].match(reg)) { 2740 var OCN = eltClass[j].match(reg) 2741 if (!objCN[OCN]) objCN[OCN] = new Array(); 2742 objCN[OCN].push(objAll[i]); 2743 break; 2744 } 2745 } 2746 } 2747 } 2748 2749 //check font size 2750 var e = document.createElement("div"); 2751 var s = document.createTextNode("S"); 2752 e.appendChild(s); 2753 e.style.classname = "check-fontsize"; 2754 e.style.visibility = "hidden"; 2755 e.style.position = "absolute"; 2756 e.style.top = "0"; 2757 document.body.appendChild(e); 2758 var defHeight = e.offsetHeight; 2759 2760 changeBoxSize = function() { 2761 for (var key in objCN) { 2762 if (objCN.hasOwnProperty(key)) { 2763 //parent type 2764 if (key == "parent CN") { 2765 for (var i = 0; i < objCN[key].length; i++) { 2766 var max_height = 0; 2767 var CCN = objCN[key][i].childNodes; 2768 for (var j = 0; j < CCN.length; j++) { 2769 if (CCN[j] && CCN[j].nodeType == 1) { 2770 CCN[j].style.height = "auto"; 2771 max_height = max_height > CCN[j].offsetHeight ? max_height : CCN[j].offsetHeight; 2772 } 2773 } 2774 for (var j = 0; j < CCN.length; j++) { 2775 if (CCN[j].style) { 2776 var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], ''); 2777 var newheight = max_height; 2778 if (stylea.paddingTop) newheight -= stylea.paddingTop.replace("px", ""); 2779 if (stylea.paddingBottom) newheight -= stylea.paddingBottom.replace("px", ""); 2780 if (stylea.borderTopWidth && stylea.borderTopWidth != "medium") newheight -= stylea.borderTopWidth.replace("px", ""); 2781 if (stylea.borderBottomWidth && stylea.borderBottomWidth != "medium") newheight -= stylea.borderBottomWidth.replace("px", ""); 2782 CCN[j].style.height = newheight + "px"; 2783 } 2784 } 2785 } 2786 } else { 2787 var max_height = 0; 2788 for (var i = 0; i < objCN[key].length; i++) { 2789 objCN[key][i].style.height = "auto"; 2790 max_height = max_height > objCN[key][i].offsetHeight ? max_height : objCN[key][i].offsetHeight; 2791 } 2792 for (var i = 0; i < objCN[key].length; i++) { 2793 if (objCN[key][i].style) { 2794 var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], ''); 2795 var newheight = max_height; 2796 if (stylea.paddingTop) newheight -= stylea.paddingTop.replace("px", ""); 2797 if (stylea.paddingBottom) newheight -= stylea.paddingBottom.replace("px", ""); 2798 if (stylea.borderTopWidth && stylea.borderTopWidth != "medium") newheight -= stylea.borderTopWidth.replace("px", "") 2799 if (stylea.borderBottomWidth && stylea.borderBottomWidth != "medium") newheight -= stylea.borderBottomWidth.replace("px", ""); 2800 objCN[key][i].style.height = newheight + "px"; 2801 } 2802 } 2803 } 2804 } 2805 } 2806 } 2807 2808 checkBoxSize = function() { 2809 if (defHeight != e.offsetHeight) { 2810 changeBoxSize(); 2811 defHeight = e.offsetHeight; 2812 } 2813 2814 // var elm = document.querySelector(".check-fontsize"); 2815 // if (elm) elm.parentNode.removeChild(elm); 2816 } 2817 changeBoxSize(); 2818 setInterval(checkBoxSize, 1000) 2819 window.onresize = changeBoxSize; 2820} 2821 2822function addEvent(elm, listener, fn) { 2823 try { 2824 elm.addEventListener(listener, fn, false); 2825 } catch (e) { 2826 elm.attachEvent("on" + listener, fn); 2827 } 2828} 2829addEvent(window, "load", heightLine); 2830// END: heightLine 2831 2832(function() { // DOM loaded 2833 // facebook 2834 var fbRoot = document.getElementById("fb-root"); 2835 if (fbRoot) { 2836 var fbScript = document.createElement("script"), 2837 fbScriptContent = "", 2838 fbVersion = fbRoot.getAttribute("data-version") ? fbRoot.getAttribute("data-version") : "v2.12", 2839 fbLanguage = fbRoot.getAttribute("data-language") ? fbRoot.getAttribute("data-language") : "ja_JP"; 2840 2841 fbVersion = fbVersion.substr(0, 1).toLowerCase() == "v" ? fbVersion.substr(1) : fbVersion; 2842 2843 fbScriptContent += '(function(d, s, id) {'; 2844 fbScriptContent += 'var js, fjs = d.getElementsByTagName(s)[0];'; 2845 fbScriptContent += 'if (d.getElementById(id)) return;'; 2846 fbScriptContent += 'js = d.createElement(s);'; 2847 fbScriptContent += 'js.id = id;'; 2848 fbScriptContent += 'js.src = "https://connect.facebook.net/' + fbLanguage + '/sdk.js#xfbml=1&version=v' + fbVersion + '";'; 2849 fbScriptContent += 'fjs.parentNode.insertBefore(js, fjs);'; 2850 fbScriptContent += '}(document, "script", "facebook-jssdk"));'; 2851 2852 fbScript.innerHTML = fbScriptContent; 2853 document.body.appendChild(fbScript); 2854 } 2855 2856 // WOW js 2857 if (typeof window["WOW"] === "function") { 2858 var wowData = { 2859 boxClass: typeof $("body").attr("data-wow-box") != "undefined" ? $("body").attr("data-wow-box") : "wow", 2860 animateClass: typeof $("body").attr("data-wow-animate") != "undefined" ? $("body").attr("data-wow-animate") : "animated", 2861 offset: typeof $("body").attr("data-wow-offset") != "undefined" ? parseInt($("body").attr("data-wow-offset")) : 0, 2862 mobile: $.inArray($("body").attr("data-wow-mobile"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 2863 live: $.inArray($("body").attr("data-wow-live"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 2864 resetAnimation: $.inArray($("body").attr("data-wow-reset"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 2865 callback: function(box) {}, 2866 scrollContainer: null 2867 }, 2868 _wow_ = new WOW(wowData); 2869 2870 _wow_.init(); 2871 } 2872})(); 2873 2874// conflicts 2875if (!Object.keys) { 2876 Object.keys = (function() { 2877 "use strict"; 2878 var hasOwnProperty = Object.prototype.hasOwnProperty, 2879 hasDontEnumBug = !({ 2880 toString: null 2881 }).propertyIsEnumerable("toString"), 2882 dontEnums = [ 2883 "toString",
2884 "toLocaleString", 2885 "valueOf", 2886 "hasOwnProperty", 2887 "isPrototypeOf", 2888 "propertyIsEnumerable", 2889 "constructor" 2890 ], 2891 dontEnumsLength = dontEnums.length; 2892 2893 return function(obj) { 2894 if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) { 2895 throw new TypeError("Object.keys called on non-object"); 2896 } 2897 2898 var result = [], 2899 prop, i; 2900 2901 for (prop in obj) { 2902 if (hasOwnProperty.call(obj, prop)) { 2903 result.push(prop); 2904 } 2905 } 2906 2907 if (hasDontEnumBug) { 2908 for (i = 0; i < dontEnumsLength; i++) { 2909 if (hasOwnProperty.call(obj, dontEnums[i])) { 2910 result.push(dontEnums[i]); 2911 } 2912 } 2913 } 2914 return result; 2915 }; 2916 }()); 2917} 2918 2919function isHTML(str) { 2920 var a = document.createElement("div"); 2921 a.innerHTML = str; 2922 for (var child = a.childNodes, i = child.length; i--;) { 2923 if (child[i].nodeType == 1) return true; 2924 } 2925 return false; 2926} 2927 2928// BEGIN: slide fading 2929var $slideFadeTimer = {}; 2930 2931function slideFadeStart(elm) { 2932 var $this = elm, 2933 __idx__ = $(".slide-fade").index($this), 2934 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 2935 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000, 2936 $delay = typeof $this.attr("data-delay") != "undefined" ? parseInt($this.attr("data-delay")) : false; 2937 2938 if ($timer < $duration) $timer = $duration * 2; 2939 2940 $this.removeClass("stop"); 2941 if (!$this.children(".active").length) { 2942 $this.children().hide(); 2943 $this.children().eq(0).show().addClass("active"); 2944 2945 if ($this.siblings(".slide-page").length) $this.siblings(".slide-page").children().eq(0).addClass("active"); 2946 } else { 2947 if ($this.siblings(".slide-page").length) $this.siblings(".slide-page").children().eq($this.children(".active").index()).addClass("active"); 2948 } 2949 2950 // $slideFadeTimer[__idx__] = setInterval(function() { 2951 // slideFade($this, $duration); 2952 // }, $timer); 2953 2954 $this.parents(".slideParent").addClass("move-start").attr("data", $this.children(".active").index()); 2955 2956 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 2957 $slideFadeTimer[__idx__] = setTimeout(function() { 2958 slideFade($this, $duration); 2959 }, $delay ? $delay : $timer); 2960} 2961 2962function slideFade(elm, duration) { 2963 var elmActive = elm.children(".active"), 2964 slideContinue = elm.hasClass("stop") || (elm.hasClass("once") && elmActive.next().length < 1) ? false : true; 2965 2966 if (slideContinue) { 2967 var __idx__ = $(".slide-fade").index(elm), 2968 timer = typeof elm.attr("data-timer") != "undefined" ? parseInt(elm.attr("data-timer")) : 4000; 2969 2970 if (elmActive.next().length) { 2971 if (typeof elmActive.next().attr("data-duration") != "undefined") duration = parseInt(elmActive.next().attr("data-duration")); 2972 } else { 2973 if (typeof elm.children().eq(0).attr("data-duration") != "undefined") duration = parseInt(elm.children().eq(0).attr("data-duration")); 2974 } 2975 2976 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 2977 2978 elmActive.stop().fadeOut(duration, function() { 2979 $(this).removeClass("active").removeAttr("style").hide(); 2980 }); 2981 2982 elm.parents(".slideParent").removeClass("move-start move-next move-prev move-first move-last"); 2983 2984 if (elmActive.next().length > 0) { 2985 if (typeof elmActive.next().attr("data-timer") != "undefined") timer = parseInt(elmActive.next().attr("data-timer")); 2986 if (timer < duration) timer = duration * 2; 2987 2988 if (elm.siblings(".slide-page").length > 0) { 2989 elm.siblings(".slide-page").children(".active").removeClass("active"); 2990 elm.siblings(".slide-page").children().eq(elmActive.next().index()).addClass("active"); 2991 } 2992 2993 elm.parents(".slideParent").addClass("move-next").attr("data", elmActive.next().index()); 2994 if (elmActive.next().is(":last-child")) elm.parents(".slideParent").addClass("move-last"); 2995 2996 elmActive.next().stop().fadeIn(duration, function() { 2997 $(this).addClass("active").removeAttr("style").show(); 2998 2999 if (elm.siblings(".slide-btn").hasClass("clicked")) elm.siblings(".slide-btn.clicked").removeClass("clicked"); 3000 if (elm.siblings(".slide-page").hasClass("clicked")) elm.siblings(".slide-page.clicked").removeClass("clicked"); 3001 3002 if ($(this).next().length < 1 && elm.hasClass("once")) elm.addClass("slide-finished"); 3003 3004 $slideFadeTimer[__idx__] = setTimeout(function() { 3005 slideFade(elm, duration); 3006 }, timer); 3007 }); 3008 } else { 3009 if (typeof elm.children().eq(0).attr("data-timer") != "undefined") timer = parseInt(elm.children().eq(0).attr("data-timer")); 3010 if (timer < duration) timer = duration * 2; 3011 3012 if (elm.siblings(".slide-page").length > 0) { 3013 elm.siblings(".slide-page").children(".active").removeClass("active"); 3014 elm.siblings(".slide-page").children().eq(0).addClass("active"); 3015 } 3016 3017 elm.parents(".slideParent").addClass("move-first").attr("data", 0); 3018 3019 elm.children().eq(0).stop().fadeIn(duration, function() { 3020 $(this).addClass("active").removeAttr("style").show(); 3021 3022 if (elm.siblings(".slide-btn").hasClass("clicked")) elm.siblings(".slide-btn.clicked").removeClass("clicked"); 3023 if (elm.siblings(".slide-page").hasClass("clicked")) elm.siblings(".slide-page.clicked").removeClass("clicked"); 3024 3025 if ($(this).next().length < 1 && elm.hasClass("once")) elm.addClass("slide-finished"); 3026 3027 $slideFadeTimer[__idx__] = setTimeout(function() { 3028 slideFade(elm, duration); 3029 }, timer); 3030 }); 3031 } 3032 } else elm.addClass("slide-finished"); 3033} 3034// END: slide fading 3035 3036// BEGIN: .pagination 3037function reloadPager(elm) { 3038 if (elm) { 3039 if (elm instanceof jQuery && elm.length > 0) { 3040 elm.each(function() {
3041 initPager($(this)); 3042 }); 3043 } 3044 } else { 3045 $(".pagination").each(function() { 3046 initPager($(this)); 3047 }); 3048 } 3049} 3050 3051function initPager(elm) { 3052 // if (elm.children(".page-content").children().length > 0) { 3053 var $pagination = elm, 3054 $pageContent = $pagination.children(".page-content"), 3055 total = $pageContent.children().length; 3056 3057 var dataPage = { 3058 first: typeof $pagination.attr("data-first") !== "undefined" && $pagination.attr("data-first").length > 0 ? $pagination.attr("data-first") : false, 3059 last: typeof $pagination.attr("data-last") !== "undefined" && $pagination.attr("data-last").length > 0 ? $pagination.attr("data-last") : false, 3060 next: typeof $pagination.attr("data-next") !== "undefined" && $pagination.attr("data-next").length > 0 ? $pagination.attr("data-next") : false, 3061 prev: typeof $pagination.attr("data-prev") !== "undefined" && $pagination.attr("data-prev").length > 0 ? $pagination.attr("data-prev") : false, 3062 active: typeof $pagination.attr("data-active") !== "undefined" && $pagination.attr("data-active").length > 0 ? parseInt($pagination.attr("data-active"), 10) : 1, 3063 max: typeof $pagination.attr("data-max") !== "undefined" && $pagination.attr("data-max").length > 0 ? parseInt($pagination.attr("data-max"), 10) : false, 3064 page: typeof $pagination.attr("data-page") !== "undefined" && $.inArray($pagination.attr("data-page"), ["top", "bottom", "both"]) >= 0 ? $pagination.attr("data-page") : false 3065 }; 3066 3067 if (dataPage.active > total) dataPage.active = 1; 3068 3069 if (dataPage.max) { // && $pageContent.children().length > 0 3070 if ($pageContent.children(".page-wrap").length > 0) { 3071 if ($pageContent.children(".page-wrap").children().length > 0) $pageContent.children(".page-wrap").children().unwrap(); 3072 else $pageContent.children(".page-wrap").remove(); 3073 } 3074 3075 $pageContent.children().not(".page-wrap").each(function(i) { 3076 if (i % dataPage.max === 0) $pageContent.append('<div class="page-wrap" />'); 3077 3078 $(this).appendTo($pageContent.children(".page-wrap").last()); 3079 }); 3080 3081 total = $pageContent.children().length; 3082 } 3083 3084 if ($pagination.children(".page-link").length > 0) $pagination.children(".page-link").remove(); 3085 3086 if (dataPage.page && total > 0) { 3087 if (dataPage.page == "top") $pagination.prepend('<div class="page-link" />'); 3088 else if (dataPage.page == "bottom") $pagination.append('<div class="page-link" />'); 3089 else { 3090 $pagination.prepend('<div class="page-link" />'); 3091 $pagination.append('<div class="page-link" />'); 3092 } 3093 3094 $pagination.children(".page-link").each(function(p) { 3095 var $pageLink = $(this); 3096 3097 var htmlItem = []; 3098 htmlItem.push('<ul>'); 3099 if (dataPage.first) htmlItem.push('<li class="page-first">' + dataPage.first + '</li>'); 3100 if (dataPage.prev) htmlItem.push('<li class="page-prev">' + dataPage.prev + '</li>'); 3101 for (var i = 1; i <= total; i++) { 3102 // if (i == dataPage.active) htmlItem.push('<li class="page-item active">' + i + '</li>'); 3103 // else htmlItem.push('<li class="page-item">' + i + '</li>'); 3104 htmlItem.push('<li class="page-item">' + i + '</li>'); 3105 } 3106 if (dataPage.next) htmlItem.push('<li class="page-next">' + dataPage.next + '</li>'); 3107 if (dataPage.last) htmlItem.push('<li class="page-last">' + dataPage.last + '</li>'); 3108 htmlItem.push('</ul>'); 3109 3110 htmlItem = htmlItem.join("\n"); 3111 $pageLink.html(htmlItem); 3112 3113 var scrollable = $pagination.attr("data-scroll"), 3114 duration = $pagination.attr("data-duration"), 3115 modeable = $pagination.attr("data-mode"); 3116 3117 $pagination.attr("data-scroll", false); // off scroll on first loaded 3118 $pagination.attr("data-duration", 0); // off duration on first loaded 3119 $pagination.attr("data-mode", false); // off mode on first loaded 3120 3121 if (p >= $pagination.children(".page-link").length - 1) { // last 3122 setTimeout(function() {
3123 $pageLink.find(".page-item").eq(dataPage.active - 1).click(); 3124 }, 1); 3125 } // else $pageLink.find(".page-item").eq(dataPage.active - 1).addClass("active"); 3126 }); 3127 3128 // re-setting for data-scroll 3129 if (typeof scrollable === "undefined") $pagination.removeAttr("data-scroll"); 3130 else $pagination.attr("data-scroll", scrollable); 3131 3132 // re-setting for data-duration 3133 if (typeof duration === "undefined") $pagination.removeAttr("data-duration"); 3134 else $pagination.attr("data-duration", duration); 3135 3136 // re-setting for data-mode 3137 if (typeof modeable === "undefined") $pagination.removeAttr("data-mode"); 3138 else $pagination.attr("data-mode", modeable); 3139 } else { 3140 $pageContent.children(".page-wrap").first().addClass("active"); // show 3141 } 3142 // } 3143} 3144// END: .pagination 3145 3146var checkDomain = function(url) { 3147 if (url.indexOf('//') === 0) url = location.protocol + url; 3148 return url.toLowerCase().replace(/([a-z])?:\/\//, "$1").split("/")[0]; 3149}; 3150var isExternal = function(url) { 3151 return ((url.indexOf(":") > -1 || url.indexOf("//") > -1) && checkDomain(location.href) !== checkDomain(url)); 3152};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.