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