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