1/*! 2 * ScriptName: common.js 3 * Version: 2.5 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_new/rss/rss.php", //rss.phpã®å ´æãé層ãå¤ããæã®ã¿å¤æ´ã 971 key : rssData.key, //RSSã®URLã 972 indention : typeof rssData.indention != "undefined" ? rssData.indention : false, //æ¬æã®ã½ã¼ã¹ã表示ãããã©ãã 973 hidePhoto : typeof rssData.hidePhoto != "undefined" ? rssData.hidePhoto : false, 974 MAX : typeof rssData.max != "undefined" ? rssData.max : 3, //è¨äºã®æå¤§æ°ã 975 titleMax : typeof rssData.titleMax != "undefined" ? rssData.titleMax : 10, //ã¿ã¤ãã«ã®æå¤§æåæ°ã 976 postMax : typeof rssData.postMax != "undefined" ? rssData.postMax : 50, //æ¬æã®æå¤§æåæ°ã 977 endtext : typeof rssData.endText != "undefined" ? rssData.endText : "...", //æå¤§æåæ°ãè¶ ããå¾ã«è¿½å ããããã¹ãã 978 Datetype : rssData.dateFormat, //æ¥ä»ã®å½¢å¼ãä¾)ââå¹´ââæââæ¥ 979 Image : typeof rssData.image != "undefined" ? (rssData.image === true ? "yes" : rssData.image) : "no", //ç»åä»ãã®è¨äºãã©ãããyesããããã¯noã§ã
980 ImageSize : rssData.imageSize, //表示ããç»åã®ãµã¤ãºãwidth=æ¨ªå¹ ãheight="ç¸¦å¹ " 981 noImage : typeof rssData.noImage != "undefined" ? (rssData.noImage === true ? "yes" : rssData.noImage) : "no", //No-imageç»åãå¿ è¦ãã©ãããyesããããã¯noã§ã 982 noImage_src : typeof rssData.noImageSRC != "undefined" ? rssData.noImageSRC : "shared_new/img/index/no_image.jpg", //No-imageç»åã®ãã¹ã 983 source : function (LINK, TITLE, DATE, POST, IMAGE, CATEGORY, AUTHOR, COUNT) { 984 var post = ""; 985 986 if (typeof rssData.template != "undefined") { 987 if (rssData.indention == "yes" && rssData.hidePhoto) POST = $("<div>").html(POST).find("img, iframe").remove().end().html(); 988 989 post = 990 rssData.template 991 .replace(/{title}/ig, TITLE) 992 .replace(/{name}/ig, TITLE) 993 .replace(/{content}/ig, POST) 994 .replace(/{desc}/ig, POST) 995 .replace(/{date}/ig, DATE) 996 .replace(/{image}/ig, IMAGE) 997 .replace(/{img}/ig, IMAGE) 998 .replace(/{photo}/ig, IMAGE) 999 .replace(/{pic}/ig, IMAGE) 1000 .replace(/{picture}/ig, IMAGE) 1001 .replace(/{url}/ig, LINK) 1002 .replace(/{link}/ig, LINK) 1003 .replace(/{cat}/ig, CATEGORY) 1004 .replace(/{category}/ig, CATEGORY) 1005 .replace(/{user}/ig, AUTHOR) 1006 .replace(/{creator}/ig, AUTHOR) 1007 .replace(/{author}/ig, AUTHOR) 1008 .replace(/{count}/ig, COUNT) 1009 .replace(/{total}/ig, COUNT); 1010 } 1011 1012 return post; 1013 } 1014 }, rssCallbacks); 1015 } else console.error(rssData.elm + " not found", rssData); 1016 } 1017 } 1018 } 1019 // END: RSS 1020 1021 // BEGIN: gmap 1022 if (typeof gmap === "object" && isObjectVar(gmap)) { 1023 var _dialogs_ = [], 1024 _dialogsOpen_ = true; 1025 1026 function init() { 1027 var errorsMap = { 1028 mapDiv: false, 1029 latLong: false 1030 }, 1031 objData = {}; // single || multiMap || multiPoint 1032 1033 1034 // checking 1035 if (typeof gmap.maps != "undefined" && Object.keys(gmap.maps).length > 0) { // multi map 1036 if (typeof gmap.maps[0] == "undefined") { // associative array 1037 if (typeof gmap.maps.mapDiv == "undefined" || gmap.maps.mapDiv == "") errorsMap.mapDiv = 1; 1038 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; 1039 } else { // object 1040 for (var s in gmap.maps) { // loop 1041 if (typeof gmap.maps[s].mapDiv == "undefined" || gmap.maps[s].mapDiv == "") { 1042 errorsMap.mapDiv = 2; 1043 break; 1044 } 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")) { 1045 errorsMap.latLong = 2; 1046 break; 1047 } 1048 } 1049 } 1050 } else { // single map 1051 if (typeof gmap.mapDiv == "undefined" || gmap.mapDiv == "") errorsMap.mapDiv = 3; 1052 else if ((typeof gmap.latitude == "undefined" && typeof gmap.latitude != "number") || (typeof gmap.longitude == "undefined" || typeof gmap.longitude != "number")) errorsMap.latLong = 3; 1053 } 1054 1055 1056 if (errorsMap.mapDiv || errorsMap.latLong) { 1057 console.info("ERROR", errorsMap); 1058 return false; 1059 } else { 1060 // if () 1061 var init = initMap(gmap); 1062 // console.log(init); 1063 } 1064 1065 /* 1066 * initialize 1067 * 1068 */ 1069 1070 function initMap(data) { 1071 var dataMap = { 1072 mapDiv: false, 1073 latitude: false, 1074 longitude: false, 1075 1076 center: false, 1077 1078 zoom: 17, 1079 minZoom: 2, 1080 zoomControl: true, 1081 disableDoubleClickZoom: true, 1082 mapTypeControl: true, 1083 scaleControl: true, 1084 scrollwheel: false, 1085 panControl: true, 1086 streetViewControl: true, 1087 draggable: true, 1088 overviewMapControl: true, 1089 1090 styles: false, 1091 style: false, 1092 1093 name: false, 1094 desc: false, 1095 tel: false, 1096 email: false, 1097 1098 url: false, 1099 logo: false, 1100 size: false, 1101 scale: false, 1102 origin: false, 1103 anchor: false, 1104 optimized: false, 1105 1106 clickable: false, 1107 hover: false, 1108 html: false, 1109 1110 multi: false 1111 }; 1112 1113 // BEGIN: configs default 1114 if (typeof data.zoom != "undefined" && typeof data.zoom == "number") dataMap.zoom = data.zoom; 1115 if (typeof data.minZoom != "undefined" && typeof data.minZoom == "number") dataMap.minZ
1115oom = data.minZoom; 1116 if (typeof data.zoomControl != "undefined" && typeof data.zoomControl == "boolean") dataMap.zoomControl = data.zoomControl; 1117 if (typeof data.disableDoubleClickZoom != "undefined" && typeof data.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = data.disableDoubleClickZoom; 1118 if (typeof data.mapTypeControl != "undefined" && typeof data.mapTypeControl == "boolean") dataMap.mapTypeControl = data.mapTypeControl; 1119 if (typeof data.scaleControl != "undefined" && typeof data.scaleControl == "boolean") dataMap.scaleControl = data.scaleControl; 1120 if (typeof data.scrollwheel != "undefined" && typeof data.scrollwheel == "boolean") dataMap.scrollwheel = data.scrollwheel; 1121 if (typeof data.panControl != "undefined" && typeof data.panControl == "boolean") dataMap.panControl = data.panControl; 1122 if (typeof data.streetViewControl != "undefined" && typeof data.streetViewControl == "boolean") dataMap.streetViewControl = data.streetViewControl; 1123 if (typeof data.draggable != "undefined" && typeof data.draggable == "boolean") dataMap.draggable = data.draggable; 1124 if (typeof data.overviewMapControl != "undefined" && typeof data.overviewMapControl == "boolean") dataMap.overviewMapControl = data.overviewMapControl; 1125 1126 if (typeof data.name != "undefined" && data.name != "") dataMap.name = data.name; 1127 if (typeof data.desc != "undefined" && data.desc != "") dataMap.desc = data.desc; 1128 if (typeof data.tel != "undefined" && data.tel != "") dataMap.tel = data.tel; 1129 if (typeof data.email != "undefined" && data.email != "") dataMap.email = data.email; 1130 if (typeof data.url != "undefined" && data.url != "") dataMap.url = data.url; 1131 if (typeof data.logo != "undefined" && data.logo != "") dataMap.logo = data.logo; 1132 if (typeof data.size != "undefined" && typeof data.size.width != "undefined" && data.size.width != "") dataMap.sizeWidth = data.size.width; 1133 if (typeof data.size != "undefined" && typeof data.size.height != "undefined" && data.size.height != "") dataMap.sizeHeight = data.size.height; 1134 if (typeof data.scale != "undefined" && typeof data.scale.width != "undefined" && data.scale.width != "") dataMap.scaleWidth = data.scale.width; 1135 if (typeof data.scale != "undefined" && typeof data.scale.height != "undefined" && data.scale.height != "") dataMap.scaleHeight = data.scale.height; 1136 if (typeof data.origin != "undefined" && typeof data.origin.x != "undefined" && data.origin.x != "") dataMap.originX = data.origin.x; 1137 if (typeof data.origin != "undefined" && typeof data.origin.y != "undefined" && data.origin.y != "") dataMap.originY = data.origin.y; 1138 if (typeof data.anchor != "undefined" && typeof data.anchor.x != "undefined" && data.anchor.x != "") dataMap.anchorX = data.anchor.x; 1139 if (typeof data.anchor != "undefined" && typeof data.anchor.y != "undefined" && data.anchor.y != "") dataMap.anchorY = data.anchor.y; 1140 if (typeof data.optimized != "undefined" && data.optimized != "") dataMap.optimized = data.optimized; 1141 1142 if (typeof data.clickable != "undefined" && data.clickable != "") dataMap.clickable = data.clickable; 1143 if (typeof data.html != "undefined" && data.html != "") dataMap.html = data.html; 1144 if (typeof data.hover != "undefined" && typeof data.hover == "boolean") dataMap.hover = data.hover; 1145 1146 if (typeof data.multi != "undefined" && Object.keys(data.multi).length > 0) dataMap.multi = data.multi; 1147 1148 if (typeof data.styles != "undefined") dataMap.styles = data.styles; 1149 else if (typeof data.style != "undefined") { 1150 dataMap.style = {}; 1151 if (typeof data.style.hue != "undefined") dataMap.style.hue = data.style.hue; 1152 if (typeof data.style.gamma != "undefined") dataMap.style.gamma = data.style.gamma; 1153 if (typeof data.style.lightness != "undefined") dataMap.style.lightness = data.style.lightness; 1154 if (typeof data.style.saturation != "undefined") dataMap.style.saturation = data.style.saturation; 1155 } 1156 // END: configs default 1157 1158 dataMap.mapDiv = data.mapDiv; 1159 dataMap.latitude = data.latitude; 1160 dataMap.longitude = data.longitude; 1161 1162 if (typeof data.maps != "undefined" && Object.keys(data.maps).length > 0) { // multi map 1163 var objMap = {}; 1164 if (typeof data.maps[0] == "undefined") objMap[0] = data.maps; // object 1165 else objMap = data.maps; // array 1166 1167 for (var g in objMap) { // loop 1168 var obj = objMap[g]; 1169 1170 // BEGIN: override configs 1171 if (typeof obj.zoom != "undefined" && typeof obj.zoom == "number") dataMap.zoom = obj.zoom; 1172 if (typeof obj.minZoom != "undefined" && typeof obj.minZoom == "number") dataMap.minZ
1172oom = obj.minZoom; 1173 if (typeof obj.zoomControl != "undefined" && typeof obj.zoomControl == "boolean") dataMap.zoomControl = obj.zoomControl; 1174 if (typeof obj.disableDoubleClickZoom != "undefined" && typeof obj.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = obj.disableDoubleClickZoom; 1175 if (typeof obj.mapTypeControl != "undefined" && typeof obj.mapTypeControl == "boolean") dataMap.mapTypeControl = obj.mapTypeControl; 1176 if (typeof obj.scaleControl != "undefined" && typeof obj.scaleControl == "boolean") dataMap.scaleControl = obj.scaleControl; 1177 if (typeof obj.scrollwheel != "undefined" && typeof obj.scrollwheel == "boolean") dataMap.scrollwheel = obj.scrollwheel; 1178 if (typeof obj.panControl != "undefined" && typeof obj.panControl == "boolean") dataMap.panControl = obj.panControl; 1179 if (typeof obj.streetViewControl != "undefined" && typeof obj.streetViewControl == "boolean") dataMap.streetViewControl = obj.streetViewControl; 1180 if (typeof obj.draggable != "undefined" && typeof obj.draggable == "boolean") dataMap.draggable = obj.draggable; 1181 if (typeof obj.overviewMapControl != "undefined" && typeof obj.overviewMapControl == "boolean") dataMap.overviewMapControl = obj.overviewMapControl; 1182 1183 if (typeof obj.styles != "undefined") dataMap.styles = obj.styles; 1184 else if (typeof obj.style != "undefined") { 1185 dataMap.style = {}; 1186 if (typeof obj.style.hue != "undefined") dataMap.style.hue = obj.style.hue; 1187 if (typeof obj.style.gamma != "undefined") dataMap.style.gamma = obj.style.gamma; 1188 if (typeof obj.style.lightness != "undefined") dataMap.style.lightness = obj.style.lightness; 1189 if (typeof obj.style.saturation != "undefined") dataMap.style.saturation = obj.style.saturation; 1190 } 1191 1192 if (typeof obj.name != "undefined" && obj.name != "") dataMap.name = obj.name; 1193 if (typeof obj.desc != "undefined" && obj.desc != "") dataMap.desc = obj.desc; 1194 if (typeof obj.tel != "undefined" && obj.tel != "") dataMap.tel = obj.tel; 1195 if (typeof obj.email != "undefined" && obj.email != "") dataMap.email = obj.email; 1196 if (typeof obj.url != "undefined" && obj.url != "") dataMap.url = obj.url; 1197 if (typeof obj.logo != "undefined" && obj.logo != "") dataMap.logo = obj.logo; 1198 if (typeof obj.sizeWidth != "undefined" && obj.sizeWidth != "") dataMap.sizeWidth = obj.sizeWidth; 1199 if (typeof obj.sizeHeight != "undefined" && obj.sizeHeight != "") dataMap.sizeHeight = obj.sizeHeight; 1200 if (typeof obj.scaleWidth != "undefined" && obj.scaleWidth != "") dataMap.scaleWidth = obj.scaleWidth; 1201 if (typeof obj.scaleHeight != "undefined" && obj.scaleHeight != "") dataMap.scaleHeight = obj.scaleHeight; 1202 if (typeof obj.originX != "undefined" && obj.originX != "") dataMap.originX = obj.originX; 1203 if (typeof obj.originY != "undefined" && obj.originY != "") dataMap.originY = obj.originY; 1204 if (typeof obj.anchorX != "undefined" && obj.anchorX != "") dataMap.anchorX = obj.anchorX; 1205 if (typeof obj.anchorY != "undefined" && obj.anchorY != "") dataMap.anchorY = obj.anchorY; 1206 if (typeof obj.optimized != "undefined" && obj.optimized != "") dataMap.optimized = obj.optimized; 1207 // END: override configs 1208 1209 if (typeof obj.clickable != "undefined" && obj.clickable != "") dataMap.clickable = obj.clickable; 1210 if (typeof obj.html != "undefined" && obj.html != "") dataMap.html = obj.html; 1211 if (typeof obj.hover != "undefined" && typeof obj.hover == "boolean") dataMap.hover = obj.hover; 1212 if (typeof obj.multi != "undefined" && Object.keys(obj.multi).length > 0) dataMap.multi = obj.multi; 1213 1214 dataMap.mapDiv = obj.mapDiv; 1215 dataMap.latitude = obj.latitude; 1216 dataMap.longitude = obj.longitude; 1217 1218 if (typeof obj.center != "undefined") { 1219 dataMap.center = {}; 1220 if (typeof obj.center.latitude != "undefined") dataMap.center.latitude = obj.center.latitude; 1221 if (typeof obj.center.longitude != "undefined") dataMap.center.longitude = obj.center.longitude; 1222 } else { 1223 dataMap.center = { 1224 latitude: obj.latitude, 1225 longitude: obj.longitude 1226 }; 1227 } 1228 1229 loadMap(dataMap); 1230 } 1231 } else { // single map 1232 if (typeof data.center != "undefined") { 1233 dataMap.center = {}; 1234 if (typeof data.center.latitude != "undefined") dataMap.center.latitude = data.center.latitude; 1235 if (typeof data.center.longitude != "undefined") dataMap.center.longitude = data.center.longitude; 1236 } else { 1237 dataMap.center = { 1238 latitude: data.latitude, 1239 longitude: data.longitude 1240 }; 1241 } 1242 1243 loadMap(dataMap); 1244 } 1245 1246 return dataMap; 1247 } 1248 1249 function loadMap(data) { 1250 var elm = data.mapDiv; 1251 1252 elm = elm.substring(0, 1) == "#" ? elm.substring(1) : elm; // remove hash 1253 1254 var mapElement = document.getElementById(elm), 1255 styleOptions = [], 1256 mapOptions = { 1257 center: new google.maps.LatLng(data.center.latitude, data.center.longitude), 1258 zoom: data.zoom, 1259 minZoom: data.minZoom, 1260 zoomControl: data.zoomControl, 1261 zoomControlOptions: { 1262 style: google.maps.ZoomControlStyle.DEFAULT, 1263 }, 1264 disableDoubleClickZoom: data.disableDoubleClickZoom, 1265 scaleControl: data.scaleControl, 1266 scrollwheel: data.scrollwheel, 1267 panControl: data.panControl, 1268 streetViewControl: data.streetViewControl, 1269 draggable: data.draggable, 1270 mapTypeControl: data.mapTypeControl, 1271 mapTypeControlOptions: { 1272 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, 1273 }, 1274 mapTypeId: google.maps.MapTypeId.ROADMAP, 1275 overviewMapControl: data.overviewMapControl, 1276 overviewMapControlOptions: { 1277 opened: false, 1278 } 1279 }, 1280 googleMap = new google.maps.Map(mapElement, mapOptions); 1281 1282 if (data.multi === false) { 1283 var arr = {}; 1284 1285 if (typeof data["name"] != "undefined") arr["name"] = data["name"];
1286 if (typeof data["desc"] != "undefined") arr["desc"] = data["desc"]; 1287 if (typeof data["tel"] != "undefined") arr["tel"] = data["tel"]; 1288 if (typeof data["email"] != "undefined") arr["email"] = data["email"]; 1289 if (typeof data["url"] != "undefined") arr["url"] = data["url"]; 1290 if (typeof data["logo"] != "undefined") arr["logo"] = data["logo"]; 1291 if (typeof data["sizeWidth"] != "undefined") arr["sizeWidth"] = data["sizeWidth"]; 1292 if (typeof data["sizeHeight"] != "undefined") arr["sizeHeight"] = data["sizeHeight"]; 1293 if (typeof data["scaleWidth"] != "undefined") arr["scaleWidth"] = data["scaleWidth"]; 1294 if (typeof data["scaleHeight"] != "undefined") arr["scaleHeight"] = data["scaleHeight"]; 1295 if (typeof data["originX"] != "undefined") arr["originX"] = data["originX"]; 1296 if (typeof data["originY"] != "undefined") arr["originY"] = data["originY"]; 1297 if (typeof data["anchorX"] != "undefined") arr["anchorX"] = data["anchorX"]; 1298 if (typeof data["anchorY"] != "undefined") arr["anchorY"] = data["anchorY"]; 1299 if (typeof data["optimized"] != "undefined") arr["optimized"] = data["optimized"]; 1300 if (typeof data["clickable"] != "undefined") arr["clickable"] = data["clickable"]; 1301 if (typeof data["html"] != "undefined") arr["html"] = data["html"]; 1302 if (typeof data["hover"] != "undefined") arr["hover"] = data["hover"]; 1303 1304 arr["longitude"] = data["longitude"]; 1305 arr["latitude"] = data["latitude"]; 1306 1307 setMaps(arr, googleMap, data.center); 1308 } else { 1309 for (var i = 0; i < Object.keys(data.multi).length; i++) { 1310 var arr = data.multi[i]; 1311 1312 if (typeof data["clickable"] != "undefined") arr["clickable"] = data.clickable; 1313 if (typeof data["html"] != "undefined") arr["html"] = data.html; 1314 if (typeof data["hover"] != "undefined") arr["hover"] = data.hover; 1315 1316 if (typeof arr["size"] != "undefined") { 1317 if (typeof arr["size"]["width"] != "undefined") arr["sizeWidth"] = arr["size"]["width"]; 1318 if (typeof arr["size"]["height"] != "undefined") arr["sizeHeight"] = arr["size"]["height"]; 1319 1320 delete arr["size"]; 1321 } 1322 if (typeof arr["scale"] != "undefined") { 1323 if (typeof arr["scale"]["width"] != "undefined") arr["scaleWidth"] = arr["scale"]["width"]; 1324 if (typeof arr["scale"]["height"] != "undefined") arr["scaleHeight"] = arr["scale"]["height"]; 1325 1326 delete arr["scale"]; 1327 } 1328 if (typeof arr["origin"] != "undefined") { 1329 if (typeof arr["origin"]["x"] != "undefined") arr["originX"] = arr["origin"]["x"]; 1330 if (typeof arr["origin"]["y"] != "undefined") arr["originY"] = arr["origin"]["y"]; 1331 1332 delete arr["origin"]; 1333 } 1334 if (typeof arr["anchor"] != "undefined") { 1335 if (typeof arr["anchor"]["x"] != "undefined") arr["anchorX"] = arr["anchor"]["x"]; 1336 if (typeof arr["anchor"]["y"] != "undefined") arr["anchorY"] = arr["anchor"]["y"]; 1337 1338 delete arr["anchor"]; 1339 } 1340 if (typeof arr["optimized"] != "undefined") arr["optimized"] = arr["optimized"]; 1341 setMaps(arr, googleMap, data.center); 1342 } 1343 } 1344 1345 // stylers 1346 if (data.styles !== false) styleOptions = data.styles; 1347 else if (data.style !== false) { 1348 if (typeof data.style.hue != "undefined" || typeof data.style.gamma != "undefined" || typeof data.style.lightness != "undefined" || typeof data.style.saturation != "undefined") { 1349 if (typeof styleOptions[0] == "undefined") styleOptions[0] = {}; 1350 if (typeof styleOptions[0].stylers == "undefined") styleOptions[0].stylers = []; 1351 } 1352 1353 if (typeof data.style.hue != "undefined") { 1354 styleOptions[0].stylers.push({ 1355 hue: data.style.hue 1356 }); 1357 } 1358 if (typeof data.style.gamma != "undefined") { 1359 styleOptions[0].stylers.push({ 1360 gamma: data.style.gamma 1361 }); 1362 } 1363 if (typeof data.style.lightness != "undefined") { 1364 styleOptions[0].stylers.push({ 1365 lightness: data.style.lightness 1366 }); 1367 } 1368 if (typeof data.style.saturation != "undefined") { 1369 styleOptions[0].stylers.push({ 1370 saturation: data.style.saturation 1371 }); 1372 } 1373 } 1374 1375 var styledMapOptions = { 1376 name: "MAP" 1377 }, 1378 sampleType = new google.maps.StyledMapType(styleOptions, styledMapOptions); 1379 1380 googleMap.mapTypes.set("sample", sampleType); 1381 googleMap.setMapTypeId("sample"); 1382 1383 // force reset 1384 googleMap.setZoom(data.zoom); 1385 googleMap.setCenter(new google.maps.LatLng(data.center.latitude, data.center.longitude)); 1386 } 1387 function setMaps(obj, map, center) { 1388 var options = {}; 1389 1390 if (obj["html"] !== false) { 1391 if (typeof obj["name"] != "undefined") options["title"] = obj["name"]; 1392 if (typeof obj["desc"] != "undefined") options["desc"] = obj["desc"]; 1393 if (typeof obj["tel"] != "undefined") options["tel"] = obj["tel"]; 1394 if (typeof obj["email"] != "undefined") options["email"] = obj["email"]; 1395 if (typeof obj["url"] != "undefined") options["web"] = obj["url"]; 1396 } 1397 1398 if (typeof obj["logo"] != "undefined") { 1399 var optIcon = {}; 1400 1401 optIcon["url"] = obj["logo"]; 1402 1403 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"]); 1404 1405 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"]); 1406 1407 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"]); 1408 1409 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"]); 1410 1411 if (typeof obj["optimized"] != "undefined") optIcon["optimized"] = obj["optimized"]; 1412 1413 if (typeof optIcon["size"] != "undefined" && typeof optIcon["origin"] != "undefined" && typeof optIcon["anchor"] != "undefined") options["icon"] = optIcon; 1414 else options["icon"] = obj["logo"] ? new google.maps.MarkerImage(obj["logo"]) : null; 1415 } 1416 1417 options["position"] = new google.maps.LatLng(obj["latitude"], obj["longitude"]); 1418 options["map"] = map; 1419 1420 var marker = new google.maps.Marker(options); 1421 gmarkers[gnum] = marker; 1422 gnum++; 1423 1424 if (obj["clickable"] == "js") { 1425 google.maps.event.addListener(marker, "click", function() { 1426 if (obj["click"].constructor == Function) obj["click"].apply(this, [].concat(Array.prototype.slice.call(arguments))); 1427 }); 1428 } 1429 1430 if (obj["html"] !== false) { 1431 var dialog = new google.maps.InfoWindow(), 1432 infoWindowVisible = (function() { 1433 var currentlyVisible = false;
1434 return function(visible) { 1435 for (var z in visible) { 1436 if (/closure_uid/i.test(z)) { 1437 currentlyVisible = visible[z]; 1438 1439 break; 1440 } 1441 } 1442 1443 return currentlyVisible; 1444 1445 1446 if (visible !== undefined) currentlyVisible = visible; 1447 return currentlyVisible; 1448 }; 1449 }()), 1450 dialogShow = (function() { 1451 return function() { 1452 var vCheck = infoWindowVisible(marker); 1453 if (vCheck == _dialogsOpen_) { 1454 dialog.close(); 1455 _dialogsOpen_ = true; 1456 } else { 1457 var tpl = {}; 1458 tpl["name"] = typeof obj["name"] != "undefined" ? obj["name"] : ""; 1459 tpl["desc"] = typeof obj["desc"] != "undefined" ? obj["desc"] : ""; 1460 tpl["tel"] = typeof obj["tel"] != "undefined" ? obj["tel"] : ""; 1461 tpl["email"] = typeof obj["email"] != "undefined" ? obj["email"] : ""; 1462 tpl["url"] = typeof obj["url"] != "undefined" ? obj["url"] : ""; 1463 1464 var html = 1465 obj["html"] 1466 .replace(/{name}/ig, tpl["name"]) 1467 .replace(/{title}/ig, tpl["name"]) 1468 1469 .replace(/{txt}/ig, tpl["desc"]) 1470 .replace(/{text}/ig, tpl["desc"]) 1471 .replace(/{desc}/ig, tpl["desc"]) 1472 .replace(/{description}/ig, tpl["desc"]) 1473 1474 .replace(/{tel}/ig, tpl["tel"]) 1475 .replace(/{telephone}/ig, tpl["tel"]) 1476 .replace(/{phone}/ig, tpl["tel"]) 1477 .replace(/{moible}/ig, tpl["tel"]) 1478 1479 .replace(/{mail}/ig, tpl["email"]) 1480 .replace(/{email}/ig, tpl["email"]) 1481 1482 .replace(/{url}/ig, tpl["url"]) 1483 .replace(/{web}/ig, tpl["url"]) 1484 .replace(/{website}/ig, tpl["url"]); 1485 1486 _dialogs_.forEach(function(d, ix) { 1487 google.maps.event.trigger(d, "closeclick"); 1488 d.close(map, marker); 1489 }); 1490 1491 dialog = new google.maps.InfoWindow({ 1492 content: html 1493 }); 1494 1495 // reset 1496 _dialogs_ = []; 1497 _dialogs_.push(dialog); 1498 1499 dialog.open(map, marker); 1500 _dialogsOpen_ = vCheck; 1501 } 1502 }; 1503 }()); 1504 1505 // _dialogs_.push(dialog); 1506 1507 // events 1508 google.maps.event.addListener(marker, "click", function() { 1509 if (obj["clickable"] == "link" && typeof obj["url"] != "undefined" && obj["url"] != "") { 1510 if (!isExternal(obj["url"]) && $(obj["url"]).length) { 1511 $("html, body").stop().animate({ 1512 scrollTop: $(obj["url"]).offset().top 1513 }, 500); 1514 } else window.open(obj["url"], "_parent"); 1515 } else if (obj["clickable"] == "popup" && isHTML(obj.html)) { 1516 map.panTo(marker.getPosition()); 1517 dialogShow(); 1518 } 1519 }); 1520 google.maps.event.addListener(dialog, "closeclick", function() { 1521 infoWindowVisible(marker); 1522 }); 1523 1524 if (obj["hover"] === true && obj["clickable"] == "link") { 1525 google.maps.event.addListener(marker, "mouseover", function() { 1526 dialogShow(); 1527 }); 1528 1529 google.maps.event.addListener(marker, "mouseout", function() { 1530 dialog.close(); 1531 infoWindowVisible(false); 1532 }); 1533 } 1534 } 1535 1536 /* 1537 window.onresize = function(event) { 1538 google.maps.event.trigger(map, "resize"); 1539 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1540 }; 1541 */ 1542 1543 // always center 1544 google.maps.event.addDomListener(window, "resize", function() { 1545 var center = map.getCenter(); 1546 google.maps.event.trigger(map, "resize"); 1547 // map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1548 map.setCenter(center); 1549 }); 1550 1551 google.maps.event.addListenerOnce(map, "idle", function() { 1552 google.maps.event.trigger(map, "resize"); 1553 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1554 }); 1555 1556 // google.maps.event.trigger(map, "resize"); // onload 1557 1558 $(window).resize(function() { 1559 google.maps.event.trigger(map, "resize"); 1560 }); 1561 } 1562 } 1563 google.maps.event.addDomListener(window, "load", init); 1564 } 1565 // END: gmap 1566 1567 // BEGIN: rollover button 1568 $("body").on({ 1569 click: function() { 1570 $(this).parents(".bxSlider-pager").find("img.btn").trigger("mouseout"); 1571 1572 $(this).trigger("mouseout").trigger("mouseover"); 1573 }, 1574 touchstart: function() { 1575 $(this).trigger("click"); 1576 }, 1577 mouseover: function() { 1578 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr("src")); 1579 1580 $(this).attr("src").match(/^(.*)(\.{1}.*)/g); 1581 1582 var $src = RegExp.$1 + "_on" + RegExp.$2; 1583 1584 $(this).attr("src", $src); // update src 1585 }, 1586 mouseout: function() { 1587 if ($(this).hasClass("copy-change")) { 1588 var _src_ = $(this).attr("src"); 1589 1590 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1591 1592 $(this) 1593 .attr("src", _src_) // update src 1594 .removeClass("copy-change"); 1595 } else if ($(this).data("src-original")) $(this).attr("src", $(this).data("src-original")); // update src 1596 1597 $(this).removeData("src-original"); 1598 } 1599 }, "img.btn"); 1600 1601 $("body").on({ 1602 click: function() { 1603 $(this).parents(".bxSlider-pager").find("picture.btn").trigger("mouseout"); 1604 1605 $(this).trigger("mouseout").trigger("mouseover"); 1606 }, 1607 touchstart: function() { 1608 $(this).trigger("click"); 1609 }, 1610 mouseover: function() { 1611 $(this).children().each(function() { 1612 var _attr_ = false;
1613 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1614 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1615 1616 if (_attr_ && $(this).attr(_attr_)) { 1617 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr(_attr_)); 1618 1619 $(this).attr(_attr_).match(/^(.*)(\.{1}.*)/g); 1620 1621 var $src = RegExp.$1 + "_on" + RegExp.$2; 1622 1623 $(this).attr(_attr_, $src); // update src 1624 } 1625 }); 1626 }, 1627 mouseout: function() { 1628 var $picture = $(this); 1629 1630 $picture.children().each(function() { 1631 var _attr_ = false; 1632 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1633 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1634 1635 if (_attr_ && $(this).attr(_attr_)) { 1636 if ($picture.hasClass("copy-change")) { 1637 var _src_ = $(this).attr(_attr_); 1638 1639 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1640 1641 $(this) 1642 .attr(_attr_, _src_) // update src 1643 .removeClass("copy-change"); 1644 } else if ($(this).data("src-original")) $(this).attr(_attr_, $(this).data("src-original")); // update src 1645 1646 $(this).removeData("src-original"); 1647 } 1648 }); 1649 } 1650 }, "picture.btn"); 1651 // END: rollover button 1652 1653 // BEGIN: smooth scroll 1654 $("body").on("click", "a[href*='#']:not([href='#'])", function(e) { 1655 // .nav-fixed: elm sẽ cá» Äá»nh 1656 // .nav-target: tá»a Äá» sẽ tÃnh 1657 // .nav-pin: elm sẽ gắn .fixed 1658 if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname && !$(this).hasClass("unsmooth")) { 1659 var ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g, 1660 hash = this.hash.replace(ptnHash, "\\$1"), 1661 $anchor = $(hash); 1662 1663 $anchor = $anchor.length > 0 ? $anchor : $("[name=" + hash.slice(1) +"]"); 1664 1665 if ($anchor.length) { 1666 e.preventDefault(); 1667 1668 if ($anchor.parents(".tab-content").first().length > 0) $anchor = $anchor.parents(".tab-content").first(); 1669 1670 var $offsetY = $anchor.offset().top, 1671 $navOffset = 0; 1672 1673 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1674 1675 if ($(".tabs-switch").length) { 1676 $(".tabs-switch").each(function() { 1677 var $tabsSwitch = $(this), 1678 $tabLink = $tabsSwitch.children(".tab-link"); 1679 1680 if ($tabLink.children("[data-tab-anchor='" + hash + "']").length) $tabLink.children("[data-tab-anchor='" + hash + "']").click(); // trigger for set active tab 1681 }); 1682 } 1683 1684 if ($(".nav-target").length) { 1685 // $("html, body").stop().animate({ 1686 // scrollTop: $(".nav-target").offset().top + 10 1687 // }, 100, function() { 1688 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1689 1690 $("html, body").stop().animate({ 1691 scrollTop: $offsetY - $navOffset 1692 }, 500); 1693 // }); 1694 } else { 1695 $("html, body").stop().animate({ 1696 scrollTop: $offsetY - $navOffset 1697 }, 500); 1698 } 1699 1700 // window.location.hash = hash; // update location 1701 1702 return false; 1703 } 1704 } 1705 }); 1706 // END: smooth scroll 1707 1708 // BEGIN: scroll to top 1709 if ($(window).scrollTop() > 0) $("#pagetop").addClass("visible"); 1710 else $("#pagetop").removeClass("visible"); 1711 1712 $("body").on("click", "#pagetop", function() { 1713 if (!$(this).hasClass("in-scroll")) { 1714 $(this).addClass("in-scroll"); 1715 1716 var $scrollDuration = $.inArray($(this).attr("data-duration"), ["slow", "normal", "fast"]) >= 0 || parseInt($(this).attr("data-duration")) > 0 ? $(this).attr("data-duration") : "slow"; 1717 1718 $("html, body").stop().animate({ 1719 scrollTop: 0 1720 }, $scrollDuration, function() { 1721 $("#pagetop").removeClass("in-scroll"); 1722 }); 1723 } 1724 }); 1725 // END: scroll to top 1726 1727 // BEGIN: text vertical 1728 $(".txt-vertical").each(function() { 1729 if (!$(this).hasClass("all-str")) { 1730 var $regex = /(\d{1,2})/g; 1731 1732 if ($(this).hasClass("per-line")) $regex = /(\d)/g; 1733 1734 $(this).html(function(idx, val) { 1735 return val.replace($regex, '<span class="int">$1</span>'); 1736 }); 1737 } 1738 1739 if ($(this).children(".txt-normal").length) { 1740 $(this).children(".txt-normal").html(function(idx, val) { 1741 var $characters = $.trim(val).split(""); 1742 return '<span class="int">' + $characters.join('</span><span class="int">') + '</span>'; 1743 }); 1744 } 1745 }); 1746 $(".txt-vertical-x").each(function() { 1747 $(this).html($(this).text().replace(/(.)/g, "<span>$1</span>")); 1748 }); 1749 // END: text vertical 1750 1751 // BEGIN: social button 1752 var __socialsHTML__ = "", 1753 __socialsLang = $("html").attr("lang") !== undefined && $.trim($("html").attr("lang")).length == 2 ? $.trim($("html").attr("lang")).toLowerCase() : "ja", 1754 $socialsLine = "", 1755 $socialsTwitter = "", 1756 $socialsFacebook = "", 1757 $socialsGooglePlus = "", 1758 locationURL = window.location.href || location.href; 1759 1760 $socialsTwitter += '<div class="social-twitter">'; 1761 $socialsTwitter += '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>'; 1762 $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>'; 1763 $socialsTwitter += '</div>'; 1764 1765 $socialsFacebook += '<div class="social-facebook">'; 1766 $socialsFacebook += '<div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>'; 1767 $socialsFacebook += '</div>'; 1768 1769 $socialsGooglePlus += '<div class="social-google">'; 1770 $socialsGooglePlus += '<div class="g-plusone" data-size="medium"></div>'; 1771 $socialsGooglePlus += '</div>'; 1772 1773 $socialsLine += '<div class="social-line">'; 1774 $socialsLine += '<div class="line-it-button" data-lang="' + __socialsLang + '" data-type="like" data-url="' + locationURL + '" data-share="true" style="display: none;">'; 1775 $socialsLine += '<script src="https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js" async="async" defer="defer"></script>'; 1776 $socialsLine += '</div>'; 1777 $socialsLine += '</div>'; 1778 1779 if ($("#socialbuttons").length) { 1780 var $socialsOrder = typeof $("#socialbuttons").attr("data") != "undefined" ? $("#socialbuttons").attr("data").split("") : false;
1781 1782 if (typeof $socialsOrder == "object" && $socialsOrder.length) { 1783 for (var socialsType in $socialsOrder) { 1784 if ($.trim(socialsType).length > 0) { 1785 socialsType = socialsType.toLowerCase(); 1786 1787 if ($socialsOrder[socialsType].toLocaleLowerCase() === "f") __socialsHTML__ += $socialsFacebook; 1788 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "t") __socialsHTML__ += $socialsTwitter; 1789 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "g") __socialsHTML__ += $socialsGooglePlus; 1790 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "l") __socialsHTML__ += $socialsLine; 1791 } 1792 } 1793 } else { 1794 __socialsHTML__ += $socialsTwitter; 1795 __socialsHTML__ += $socialsFacebook; 1796 __socialsHTML__ += $socialsGooglePlus; 1797 __socialsHTML__ += $socialsLine; 1798 } 1799 1800 $("#socialbuttons").html(__socialsHTML__); 1801 } 1802 // END: social button 1803 1804 /* fix smoothscroll on IE - jumpy fixed background */ 1805 if (navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { 1806 $("body.ie-smoothscroll") 1807 .on("mousewheel", function (e) { 1808 if (event.preventDefault) event.preventDefault(); 1809 else event.returnValue = false; 1810 1811 var delta = null, 1812 offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft, 1813 offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop; 1814 1815 if (e.wheelDelta) delta = e.wheelDelta; 1816 else if (e.originalEvent) { 1817 if (e.originalEvent.wheelDelta) delta = e.originalEvent.wheelDelta; 1818 else if (e.originalEvent.deltaY) delta = 0 - e.originalEvent.deltaY; 1819 else if (e.originalEvent.detail) delta = e.originalEvent.detail * -40; 1820 } else if (event.originalEvent) { 1821 if (event.originalEvent.wheelDelta) delta = event.originalEvent.wheelDelta; 1822 else if (event.originalEvent.deltaY) delta = 0 - event.originalEvent.deltaY; 1823 else if (event.originalEvent.detail) delta = event.originalEvent.detail * -40; 1824 } 1825 1826 if (delta !== null) window.scrollTo(0, offsetY - delta); 1827 }); 1828 } 1829 1830 // scrollBefore(); // smoothscroll before page loaded 1831 1832 $("body").on({ 1833 mouseup: function() { 1834 // $("html").addClass("break-jump"); 1835 $(this).removeClass("scrollable"); 1836 }, mousedown: function() { 1837 // $("html").addClass("break-jump"); 1838 $(this).addClass("scrollable"); 1839 }, mouseleave: function() { 1840 // $("html").addClass("break-jump"); 1841 $(this).removeClass("scrollable"); 1842 } 1843 }, ".gmap"); 1844 1845 // BEGIN: .pagination 1846 $(".pagination").each(function() { 1847 initPager($(this)); 1848 }); 1849 1850 $(".pagination") 1851 .on("click", ".page-link .page-first", function() { 1852 var $pagination = $(this).parents(".pagination").first(), 1853 $pageContent = $pagination.children(".page-content"), 1854 $pageLink = $pagination.children(".page-link"), 1855 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 1856 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 1857 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 1858 navOffset = 0; 1859 1860 if (!$pagination.hasClass("clicked")) { 1861 $pagination.addClass("clicked"); 1862 1863 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1864 1865 if (mode == "fade") { 1866 if ($pageContent.children().length > 1) { 1867 $pageContent.children().stop().fadeOut(duration, function() { 1868 $(this).removeAttr("style").removeClass("active"); 1869 }).siblings().first().stop().delay(duration).fadeIn(duration, function() { 1870 $(this).removeAttr("style").addClass("active"); 1871 1872 if (scrollable) { 1873 $("body, html").stop().animate({ 1874 scrollTop: $pagination.offset().top - navOffset 1875 }, 300); 1876 } 1877 1878 $pagination.removeClass("clicked"); 1879 }); 1880 } else { 1881 $pageContent.children().first().stop().fadeIn(duration, function() { 1882 $(this).removeAttr("style").addClass("active"); 1883 1884 if (scrollable) { 1885 $("body, html").stop().animate({ 1886 scrollTop: $pagination.offset().top - navOffset 1887 }, 300); 1888 } 1889 1890 $pagination.removeClass("clicked"); 1891 }); 1892 } 1893 } else if (mode == "slide") { 1894 if ($pageContent.children().length > 1) { 1895 $pageContent.children().stop().slideUp(duration, function() { 1896 $(this).removeAttr("style").removeClass("active"); 1897 }).siblings().first().stop().delay(duration).slideDown(duration, function() { 1898 $(this).removeAttr("style").addClass("active"); 1899 1900 if (scrollable) { 1901 $("body, html").stop().animate({ 1902 scrollTop: $pagination.offset().top - navOffset 1903 }, 300); 1904 } 1905 1906 $pagination.removeClass("clicked"); 1907 }); 1908 } else { 1909 $pageContent.children().first().stop().slideDown(duration, function() { 1910 $(this).removeAttr("style").addClass("active"); 1911 1912 if (scrollable) { 1913 $("body, html").stop().animate({ 1914 scrollTop: $pagination.offset().top - navOffset 1915 }, 300); 1916 } 1917 1918 $pagination.removeClass("clicked"); 1919 }); 1920 } 1921 } else { 1922 if ($pageContent.children().length > 1) { 1923 $pageContent.children().stop().hide(duration, function() { 1924 $(this).removeAttr("style").removeClass("active"); 1925 }).siblings().first().stop().delay(duration).show(duration, function() { 1926 $(this).removeAttr("style").addClass("active"); 1927 1928 if (scrollable) { 1929 $("body, html").stop().animate({ 1930 scrollTop: $pagination.offset().top - navOffset 1931 }, 300); 1932 } 1933 1934 $pagination.removeClass("clicked"); 1935 }); 1936 } else { 1937 $pageContent.children().first().stop().show(duration, function() { 1938 $(this).removeAttr("style").addClass("active"); 1939 1940 if (scrollable) { 1941 $("body, html").stop().animate({ 1942 scrollTop: $pagination.offset().top - navOffset 1943 }, 300); 1944 } 1945 1946 $pagination.removeClass("clicked"); 1947 }); 1948 } 1949 } 1950 1951 $pageLink.find(".page-item.active").removeClass("active"); 1952 $pageLink.each(function() { 1953 $(this).find(".page-item").first().addClass("active"); 1954 }); 1955 } 1956 }) 1957 .on("click", ".page-link .page-last", function() { 1958 var $pagination = $(this).parents(".pagination").first(), 1959 $pageContent = $pagination.children(".page-content"), 1960 $pageLink = $pagination.children(".page-link"), 1961 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 1962 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 1963 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 1964 navOffset = 0; 1965 1966 if (!$pagination.hasClass("clicked")) { 1967 $pagination.addClass("clicked"); 1968 1969 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1970 1971 if (mode == "fade") { 1972 if ($pageContent.children().length > 1) { 1973 $pageContent.children().stop().fadeOut(duration, function() { 1974 $(this).removeAttr("style").removeClass("active"); 1975 }
1975).siblings().last().stop().delay(duration).fadeIn(duration, function() { 1976 $(this).removeAttr("style").addClass("active"); 1977 1978 if (scrollable) { 1979 $("body, html").stop().animate({ 1980 scrollTop: $pagination.offset().top - navOffset 1981 }, 300); 1982 } 1983 1984 $pagination.removeClass("clicked"); 1985 }); 1986 } else { 1987 $pageContent.children().last().stop().fadeIn(duration, function() { 1988 $(this).removeAttr("style").addClass("active"); 1989 1990 if (scrollable) { 1991 $("body, html").stop().animate({ 1992 scrollTop: $pagination.offset().top - navOffset 1993 }, 300); 1994 } 1995 1996 $pagination.removeClass("clicked"); 1997 }); 1998 } 1999 } else if (mode == "slide") { 2000 if ($pageContent.children().length > 1) { 2001 $pageContent.children().stop().slideUp(duration, function() { 2002 $(this).removeAttr("style").removeClass("active"); 2003 }).siblings().last().stop().delay(duration).slideDown(duration, function() { 2004 $(this).removeAttr("style").addClass("active"); 2005 2006 if (scrollable) { 2007 $("body, html").stop().animate({ 2008 scrollTop: $pagination.offset().top - navOffset 2009 }, 300); 2010 } 2011 2012 $pagination.removeClass("clicked"); 2013 }); 2014 } else { 2015 $pageContent.children().last().stop().slideDown(duration, function() { 2016 $(this).removeAttr("style").addClass("active"); 2017 2018 if (scrollable) { 2019 $("body, html").stop().animate({ 2020 scrollTop: $pagination.offset().top - navOffset 2021 }, 300); 2022 } 2023 2024 $pagination.removeClass("clicked"); 2025 }); 2026 } 2027 } else { 2028 if ($pageContent.children().length > 1) { 2029 $pageContent.children().stop().hide(duration, function() { 2030 $(this).removeAttr("style").removeClass("active"); 2031 }).siblings().last().stop().delay(duration).show(duration, function() { 2032 $(this).removeAttr("style").addClass("active"); 2033 2034 if (scrollable) { 2035 $("body, html").stop().animate({ 2036 scrollTop: $pagination.offset().top - navOffset 2037 }, 300); 2038 } 2039 2040 $pagination.removeClass("clicked"); 2041 }); 2042 } else { 2043 $pageContent.children().last().stop().show(duration, function() { 2044 $(this).removeAttr("style").addClass("active"); 2045 2046 if (scrollable) { 2047 $("body, html").stop().animate({ 2048 scrollTop: $pagination.offset().top - navOffset 2049 }, 300); 2050 } 2051 2052 $pagination.removeClass("clicked"); 2053 }); 2054 } 2055 } 2056 2057 $pageLink.find(".page-item.active").removeClass("active"); 2058 $pageLink.each(function() { 2059 $(this).find(".page-item").last().addClass("active"); 2060 }); 2061 } 2062 }) 2063 .on("click", ".page-link .page-next", function() { 2064 var $pagination = $(this).parents(".pagination").first(), 2065 navOffset = 0; 2066 2067 if (!$pagination.hasClass("clicked")) { 2068 $pagination.addClass("clicked"); 2069 2070 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 2071 2072 var $pageContent = $pagination.children(".page-content"), 2073 $pageLink = $pagination.children(".page-link"), 2074 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 2075 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 2076 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 2077 $pageCurrent = $pageLink.find(".page-item.active"), 2078 $pageClone = $pageLink.clone(), 2079 idx = 0; 2080 2081 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 2082 2083 idx = $pageClone.find(".page-item.active").index(); 2084 2085 $pageLink.find(".page-item.active").removeClass("active"); 2086 2087 if ($pageClone.find(".page-item.active").next(".page-item").length > 0) { 2088 if (mode == "fade") { 2089 if ($pageContent.children().length > 1) { 2090 $pageContent.children().stop().fadeOut(duration, function() { 2091 $(this).removeAttr("style").removeClass("active"); 2092 }).siblings().eq(idx + 1).stop().delay(duration).fadeIn(duration, function() { 2093 $(this).removeAttr("style").addClass("active"); 2094 2095 if (scrollable) { 2096 $("body, html").stop().animate({ 2097 scrollTop: $pagination.offset().top - navOffset 2098 }, 300); 2099 } 2100 2101 $pagination.removeClass("clicked"); 2102 }); 2103 } else { 2104 $pageContent.children().eq(idx + 1).stop().fadeIn(duration, function() { 2105 $(this).removeAttr("style").addClass("active"); 2106 2107 if (scrollable) { 2108 $("body, html").stop().animate({ 2109 scrollTop: $pagination.offset().top - navOffset 2110 }, 300); 2111 } 2112 2113 $pagination.removeClass("clicked"); 2114 }); 2115 } 2116 } else if (mode == "slide") { 2117 if ($pageContent.children().length > 1) { 2118 $pageContent.children().stop().slideUp(duration, function() { 2119 $(this).removeAttr("style").removeClass("active"); 2120 }).siblings().eq(idx + 1).stop().delay(duration).slideDown(duration, function() { 2121 $(this).removeAttr("style").addClass("active"); 2122 2123 if (scrollable) { 2124 $("body, html").stop().animate({ 2125 scrollTop: $pagination.offset().top - navOffset 2126 }, 300); 2127 } 2128 2129 $pagination.removeClass("clicked"); 2130 }); 2131 } else { 2132 $pageContent.children().eq(idx + 1).stop().slideDown(duration, function() { 2133 $(this).removeAttr("style").addClass("active"); 2134 2135 if (scrollable) { 2136 $("body, html").stop().animate({ 2137 scrollTop: $pagination.offset().top - navOffset 2138 }, 300); 2139 } 2140 2141 $pagination.removeClass("clicked"); 2142 }); 2143 } 2144 } else { 2145 if ($pageContent.children().length > 1) { 2146 $pageContent.children().stop().hide(duration, function() { 2147 $(this).removeAttr("style").removeClass("active"); 2148 }).siblings().eq(idx + 1).stop().delay(duration).show(duration, function() { 2149 $(this).removeAttr("style").addClass("active"); 2150 2151 if (scrollable) { 2152 $("body, html").stop().animate({ 2153 scrollTop: $pagination.offset().top - navOffset 2154 }, 300); 2155 } 2156 2157 $pagination.removeClass("clicked"); 2158 }); 2159 } else { 2160 $pageContent.children().eq(idx + 1).stop().show(duration, function() { 2161 $(this).removeAttr("style").addClass("active"); 2162 2163 if (scrollable) { 2164 $("body, html").stop().animate({ 2165 scrollTop: $pagination.offset().top - navOffset 2166 }, 300); 2167 } 2168 2169 $pagination.removeClass("clicked"); 2170 }); 2171 } 2172 } 2173 2174 $pageCurrent.next(".page-item").addClass("active"); 2175 } else { 2176 if (mode == "fade") { 2177 if ($pageContent.children().length > 1) { 2178 $pageContent.children().stop().fadeOut(duration, function() { 2179 $(this).removeAttr("style").removeClass("active"); 2180 }).siblings().first().stop().delay(duration).fadeIn(duration, function() { 2181 $(this).removeAttr("style").addClass("active"); 2182 2183 if (scrollable) { 2184 $("body, html").stop().animate({ 2185 scrollTop: $pagination.offset().top - navOffset 2186 }, 300); 2187 } 2188 2189 $pagination.removeClass("clicked"); 2190 }); 2191 } else { 2192 $pageContent.children().first().stop().fadeIn(duration, function() { 2193 $(this).removeAttr("style").addClass("active"); 2194 2195 if (scrollable) { 2196 $("body, html").stop().animate({ 2197 scrollTop: $pagination.offset().top - navOffset 2198 }, 300); 2199 } 2200 2201 $pagination.removeClass("clicked"); 2202 }); 2203 } 2204 } else if (mode == "slide") { 2205 if ($pageContent.children().length > 1) { 2206 $pageContent.children().stop().slideUp(duration, function() { 2207 $(this).removeAttr("style").removeClass("active"); 2208 }).siblings().first().stop().delay(duration).slideDown(duration, function() { 2209 $(this).removeAttr("style").addClass("active"); 2210 2211 if (scrollable) { 2212 $("body, html").stop().animate({ 2213 scrollTop: $pagination.offset().top - navOffset 2214 }, 300); 2215 } 2216 2217 $pagination.removeClass("clicked"); 2218 }); 2219 } else { 2220 $pageContent.children().first().stop().slideDown(duration, function() { 2221 $(this).removeAttr("style").addClass("active"); 2222 2223 if (scrollable) { 2224 $("body, html").stop().animate({ 2225 scrollTop: $pagination.offset().top - navOffset 2226 }, 300); 2227 } 2228 2229 $pagination.removeClass("clicked"); 2230 }); 2231 } 2232 } else { 2233 if ($pageContent.children().length > 1) { 2234 $pageContent.children().stop().hide(duration, function() { 2235 $(this).removeAttr("style").removeClass("active"); 2236 }).siblings().first().stop().delay(duration).show(duration, function() { 2237 $(this).removeAttr("style").addClass("active"); 2238 2239 if (scrollable) { 2240 $("body, html").stop().animate({ 2241 scrollTop: $pagination.offset().top - navOffset 2242 }, 300); 2243 } 2244 2245 $pagination.removeClass("clicked"); 2246 }); 2247 } else { 2248 $pageContent.children().first().stop().show(duration, function() { 2249 $(this).removeAttr("style").addClass("active"); 2250 2251 if (scrollable) { 2252 $("body, html").stop().animate({ 2253 scrollTop: $pagination.offset().top - navOffset 2254 }, 300); 2255 } 2256 2257 $pagination.removeClass("clicked"); 2258 }); 2259 } 2260 } 2261 2262 $pageLink.each(function() { 2263 $(this).find(".page-item").first().addClass("active"); 2264 }); 2265 } 2266 } 2267 }) 2268 .on("click", ".page-link .page-prev", function() { 2269 var $pagination = $(this).parents(".pagination").first(), 2270 navOffset = 0; 2271 2272 if (!$pagination.hasClass("clicked")) { 2273 $pagination.addClass("clicked"); 2274 2275 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 2276
2277 var $pageContent = $pagination.children(".page-content"), 2278 $pageLink = $pagination.children(".page-link"), 2279 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 2280 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 2281 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 2282 $pageCurrent = $pageLink.find(".page-item.active"), 2283 $pageClone = $pageLink.clone(), 2284 idx = 0; 2285 2286 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 2287 2288 idx = $pageClone.find(".page-item.active").index(); 2289 2290 $pageLink.find(".page-item.active").removeClass("active"); 2291 2292 if ($pageClone.find(".page-item.active").prev(".page-item").length > 0) { 2293 if (mode == "fade") { 2294 if ($pageContent.children().length > 1) { 2295 $pageContent.children().stop().fadeOut(duration, function() { 2296 $(this).removeAttr("style").removeClass("active"); 2297 }).siblings().eq(idx - 1).stop().delay(duration).fadeIn(duration, function() { 2298 $(this).removeAttr("style").addClass("active"); 2299 2300 if (scrollable) { 2301 $("body, html").stop().animate({ 2302 scrollTop: $pagination.offset().top - navOffset 2303 }, 300); 2304 } 2305 2306 $pagination.removeClass("clicked"); 2307 }); 2308 } else { 2309 $pageContent.children().eq(idx - 1).stop().fadeIn(duration, function() { 2310 $(this).removeAttr("style").addClass("active"); 2311 2312 if (scrollable) { 2313 $("body, html").stop().animate({ 2314 scrollTop: $pagination.offset().top - navOffset 2315 }, 300); 2316 } 2317 2318 $pagination.removeClass("clicked"); 2319 }); 2320 } 2321 } else if (mode == "slide") { 2322 if ($pageContent.children().length > 1) { 2323 $pageContent.children().stop().slideUp(duration, function() { 2324 $(this).removeAttr("style").removeClass("active"); 2325 }).siblings().eq(idx - 1).stop().delay(duration).slideDown(duration, function() { 2326 $(this).removeAttr("style").addClass("active"); 2327 2328 if (scrollable) { 2329 $("body, html").stop().animate({ 2330 scrollTop: $pagination.offset().top - navOffset 2331 }, 300); 2332 } 2333 2334 $pagination.removeClass("clicked"); 2335 }); 2336 } else { 2337 $pageContent.children().eq(idx - 1).stop().slideDown(duration, function() { 2338 $(this).removeAttr("style").addClass("active"); 2339 2340 if (scrollable) { 2341 $("body, html").stop().animate({ 2342 scrollTop: $pagination.offset().top - navOffset 2343 }, 300); 2344 } 2345 2346 $pagination.removeClass("clicked"); 2347 }); 2348 } 2349 } else { 2350 if ($pageContent.children().length > 1) { 2351 $pageContent.children().stop().hide(duration, function() { 2352 $(this).removeAttr("style").removeClass("active"); 2353 }).siblings().eq(idx - 1).stop().delay(duration).show(duration, function() { 2354 $(this).removeAttr("style").addClass("active"); 2355 2356 if (scrollable) { 2357 $("body, html").stop().animate({ 2358 scrollTop: $pagination.offset().top - navOffset 2359 }, 300); 2360 } 2361 2362 $pagination.removeClass("clicked"); 2363 }); 2364 } else { 2365 $pageContent.children().eq(idx - 1).stop().show(duration, function() { 2366 $(this).removeAttr("style").addClass("active"); 2367 2368 if (scrollable) { 2369 $("body, html").stop().animate({ 2370 scrollTop: $pagination.offset().top - navOffset 2371 }, 300); 2372 } 2373 2374 $pagination.removeClass("clicked"); 2375 }); 2376 } 2377 } 2378 2379 $pageCurrent.prev(".page-item").addClass("active"); 2380 } else { 2381 if (mode == "fade") { 2382 if ($pageContent.children().length > 1) { 2383 $pageContent.children().stop().fadeOut(duration, function() { 2384 $(this).removeAttr("style").removeClass("active"); 2385 }
2385).siblings().last().stop().delay(duration).fadeIn(duration, function() { 2386 $(this).removeAttr("style").addClass("active"); 2387 2388 if (scrollable) { 2389 $("body, html").stop().animate({ 2390 scrollTop: $pagination.offset().top - navOffset 2391 }, 300); 2392 } 2393 2394 $pagination.removeClass("clicked"); 2395 }); 2396 } else { 2397 $pageContent.children().last().stop().fadeIn(duration, function() { 2398 $(this).removeAttr("style").addClass("active"); 2399 2400 if (scrollable) { 2401 $("body, html").stop().animate({ 2402 scrollTop: $pagination.offset().top - navOffset 2403 }, 300); 2404 } 2405 2406 $pagination.removeClass("clicked"); 2407 }); 2408 } 2409 } else if (mode == "slide") { 2410 if ($pageContent.children().length > 1) { 2411 $pageContent.children().stop().slideUp(duration, function() { 2412 $(this).removeAttr("style").removeClass("active"); 2413 }).siblings().last().stop().delay(duration).slideDown(duration, function() { 2414 $(this).removeAttr("style").addClass("active"); 2415 2416 if (scrollable) { 2417 $("body, html").stop().animate({ 2418 scrollTop: $pagination.offset().top - navOffset 2419 }, 300); 2420 } 2421 2422 $pagination.removeClass("clicked"); 2423 }); 2424 } else { 2425 $pageContent.children().last().stop().slideDown(duration, function() { 2426 $(this).removeAttr("style").addClass("active"); 2427 2428 if (scrollable) { 2429 $("body, html").stop().animate({ 2430 scrollTop: $pagination.offset().top - navOffset 2431 }, 300); 2432 } 2433 2434 $pagination.removeClass("clicked"); 2435 }); 2436 } 2437 } else { 2438 if ($pageContent.children().length > 1) { 2439 $pageContent.children().stop().hide(duration, function() { 2440 $(this).removeAttr("style").removeClass("active"); 2441 }).siblings().last().stop().delay(duration).show(duration, function() { 2442 $(this).removeAttr("style").addClass("active"); 2443 2444 if (scrollable) { 2445 $("body, html").stop().animate({ 2446 scrollTop: $pagination.offset().top - navOffset 2447 }, 300); 2448 } 2449 2450 $pagination.removeClass("clicked"); 2451 }); 2452 } else { 2453 $pageContent.children().last().stop().show(duration, function() { 2454 $(this).removeAttr("style").addClass("active"); 2455 2456 if (scrollable) { 2457 $("body, html").stop().animate({ 2458 scrollTop: $pagination.offset().top - navOffset 2459 }, 300); 2460 } 2461 2462 $pagination.removeClass("clicked"); 2463 }); 2464 } 2465 } 2466 2467 $pageLink.each(function() { 2468 $(this).find(".page-item").last().addClass("active"); 2469 }); 2470 } 2471 } 2472 }) 2473 .on("click", ".page-link .page-item", function() { 2474 var $pagination = $(this).parents(".pagination").first(), 2475 navOffset = 0; 2476 2477 if (!$pagination.hasClass("clicked")) { 2478 $pagination.addClass("clicked"); 2479 2480 if ($(".nav-fixed").length > 0) navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 2481 2482 $(this).addClass("current"); 2483 2484 var $pageContent = $pagination.children(".page-content"), 2485 mode = $pagination.attr("data-mode") !== "undefined" && $.inArray($pagination.attr("data-mode"), ["fade", "slide", "block"]) >= 0 ? $pagination.attr("data-mode") : "block", 2486 duration = typeof $pagination.attr("data-duration") !== "undefined" && $pagination.attr("data-duration").length > 0 ? parseInt($pagination.attr("data-duration"), 10) : (mode == "block" ? 0 : 300), 2487 scrollable = typeof $pagination.attr("data-scroll") !== "undefined" && $.inArray($pagination.attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 2488 $pageClone = $pagination.children(".page-link").find(".page-item.current").parents(".page-link").first().clone(), 2489 idx = 0; 2490 2491 $pageClone.find(".page-first, .page-last, .page-next, .page-prev, .page-ellipse").remove(); 2492 2493 idx = $pageClone.find(".page-item.current").index(); 2494 2495 if (mode == "fade") { 2496 if ($pageContent.children().length > 1) { 2497 $pageContent.children().stop().fadeOut(duration, function() { 2498 $(this).removeAttr("style").removeClass("active"); 2499 }).siblings().eq(idx).stop().delay(duration).fadeIn(duration, function() { 2500 $(this).removeAttr("style").addClass("active"); 2501 2502 if (scrollable) { 2503 $("body, html").stop().animate({ 2504 scrollTop: $pagination.offset().top - navOffset 2505 }, 300); 2506 } 2507 2508 $pagination.removeClass("clicked"); 2509 }); 2510 } else { 2511 $pageContent.children().eq(idx).stop().fadeIn(duration, function() { 2512 $(this).removeAttr("style").addClass("active"); 2513 2514 if (scrollable) { 2515 $("body, html").stop().animate({ 2516 scrollTop: $pagination.offset().top - navOffset 2517 }, 300); 2518 } 2519 2520 $pagination.removeClass("clicked"); 2521 }); 2522 } 2523 } else if (mode == "slide") { 2524 if ($pageContent.children().length > 1) { 2525 $pageContent.children().stop().slideUp(duration, function() { 2526 $(this).removeAttr("style").removeClass("active"); 2527 }).siblings().eq(idx).stop().delay(duration).slideDown(duration, function() { 2528 $(this).removeAttr("style").addClass("active"); 2529 2530 if (scrollable) { 2531 $("body, html").stop().animate({ 2532 scrollTop: $pagination.offset().top - navOffset 2533 }, 300); 2534 } 2535 2536 $pagination.removeClass("clicked"); 2537 }); 2538 } else { 2539 $pageContent.children().eq(idx).stop().slideDown(duration, function() { 2540 $(this).removeAttr("style").addClass("active"); 2541 2542 if (scrollable) { 2543 $("body, html").stop().animate({ 2544 scrollTop: $pagination.offset().top - navOffset 2545 }, 300); 2546 } 2547 2548 $pagination.removeClass("clicked"); 2549 }); 2550 } 2551 } else { 2552 if ($pageContent.children().length > 1) { 2553 $pageContent.children().stop().hide(duration, function() { 2554 $(this).removeAttr("style").removeClass("active"); 2555 }).siblings().eq(idx).stop().delay(duration).show(duration, function() { 2556 $(this).removeAttr("style").addClass("active"); 2557 2558 if (scrollable) { 2559 $("body, html").stop().animate({ 2560 scrollTop: $pagination.offset().top - navOffset 2561 }, 300); 2562 } 2563 2564 $pagination.removeClass("clicked"); 2565 }); 2566 } else { 2567 $pageContent.children().eq(idx).stop().show(duration, function() { 2568 $(this).removeAttr("style").addClass("active"); 2569 2570 if (scrollable) { 2571 $("body, html").stop().animate({ 2572 scrollTop: $pagination.offset().top - navOffset 2573 }, 300); 2574 } 2575 2576 $pagination.removeClass("clicked"); 2577 }); 2578 } 2579 } 2580 2581 $pagination.children(".page-link").find(".page-item.current").removeClass("current"); 2582 $pagination.children(".page-link").find(".page-item.active").removeClass("active"); 2583 $pagination.children(".page-link").each(function() { 2584 $(this).find(".page-item").eq(idx).addClass("active"); 2585 }); 2586 } 2587 }) 2588 .on("click", ".page-link li.disabled", function() { 2589 }); 2590 // END: .pagination 2591}); 2592 2593// user agents 2594var isMobile = { 2595 Android: function() { 2596 return navigator.userAgent.match(/Android/i); 2597 }, 2598 BlackBerry: function() { 2599 return navigator.userAgent.match(/BlackBerry/i); 2600 }, 2601 iOS: function() { 2602 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 2603 }, 2604 Opera: function() { 2605 return navigator.userAgent.match(/Opera Mini/i); 2606 }, 2607 Windows: function() { 2608 return navigator.userAgent.match(/IEMobile/i); 2609 }, 2610 any: function() { 2611 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 2612 } 2613}; 2614 2615var fbTimer = null, 2616 fbCodes = {}, 2617 fbPage = document.querySelectorAll(".fb-page"); 2618 2619if (fbPage.length > 0) { 2620 for (var i in fbPage) { 2621 if (fbPage[i].constructor === HTMLDivElement) fbCodes[i] = fbPage[i].outerHTML; 2622 } 2623} 2624 2625$(window).resize(function() { 2626 // fix bg parallax on mobile 2627 if (isMobile.any()) $(".bg-parallax").css("background-attachment", "inherit"); 2628 else $(".bg-parallax").css("background-attachment", ""); 2629 2630 $(".pagination").removeClass("clicked"); 2631 2632 if ($("#fb-root").attr("data-resize")) { 2633 if (fbTimer != null) clearTimeout(fbTimer); 2634 2635 // delay for document is loaded 2636 fbTimer = setTimeout(function() { 2637 if (typeof FB !== "undefined") { 2638 $(".fb-page").each(function(i) { 2639 if (fbCodes[i]) $(this).replaceWith(fbCodes[i]); 2640 }); 2641 2642 FB.XFBML.parse(); 2643 } 2644 }, 1000); 2645 } 2646}).on("scroll resize", function() { 2647 if ($(this).scrollTop() > 0) $("#pagetop").addClass("visible"); 2648 else $("#pagetop").removeClass("visible"); 2649 2650 if ($(".nav-fixed").length) { 2651 var $navPinY = $(".nav-target").length ? $(".nav-target").offset().top - $(".nav-fixed").outerHeight() - 1 : $(".nav-fixed").offset().top; 2652 if ($(this).scrollTop() > $navPinY || ($navPinY < 0 && $(this).scrollTop() > 0)) { 2653 if ($(".nav-pin").length) $(".nav-pin").addClass("fixed"); 2654 else $(".nav-fixed").addClass("fixed"); 2655 } else { 2656 if ($(".nav-pin").length) $(".nav-pin").removeClass("fixed"); 2657 else $(".nav-fixed").removeClass("fixed"); 2658 } 2659 } 2660}).on("load", function() { 2661 // scrollBefore(); 2662}); 2663 2664var scrollBefore = function() { 2665 var hash = window.location.hash || location.hash, 2666 ptnHash = /([;
2666?%&,+*~\':"!^$[\]()=>|\/@])/g; 2667 2668 if (hash) { 2669 hash = hash.replace(ptnHash, "\\$1"); 2670 if ($(hash).length > 0) { 2671 if ($(".tabs-switch").length > 0) { 2672 if ($(hash).length > 0 && $(hash).parents(".tab-content").first().length > 0) { 2673 var tabChild = $(hash); 2674 $(hash).parents().each(function() { 2675 if ($(this).attr("class") !== undefined && $.inArray("tab-content", $(this).attr("class").split(" ")) >= 0) return false; 2676 else tabChild = $(this); 2677 }); 2678 2679 setTimeout(function() { 2680 tabChild.parents(".tabs-switch").first().children(".tab-link").children().eq(tabChild.index()).click(); // trigger tab in multiple dim 2681 }, 10); 2682 } else { 2683 $(".tabs-switch").each(function() { 2684 var $tabLink = $(this).children(".tab-link"); 2685 2686 if ($tabLink.children(hash).length > 0) { 2687 setTimeout(function() { 2688 $tabLink.children(hash).click(); // trigger for set active tab 2689 }, 10); 2690 } 2691 }); 2692 } 2693 } 2694 2695 2696 if ($(".bxSlider").length > 0) $(window).trigger("resize"); 2697 2698 setTimeout(function() { 2699 if ($(".nav-fixed").length > 0) { 2700 var offsetY = $(hash).offset().top, 2701 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 2702 2703 // if ($(".nav-pin").length > 0) offsetY -= $(".nav-pin").outerHeight(); 2704 2705 window.scroll(0, offsetY - navHeight); 2706 2707 // re-updated offset 2708 if ($(".nav-target").length > 0) { 2709 var reupdated = true; 2710 $(window).scroll(function() { 2711 if (reupdated && $(this).scrollTop() >= $(".nav-target").offset().top) { 2712 reupdated = false; 2713 2714 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 2715 2716 window.scroll(0, $(hash).offset().top - navHeight); 2717 } 2718 }); 2719 } 2720 } else window.scrollTo(0, $(hash).offset().top); 2721 }, 10); 2722 2723 $("a[href='" + hash + "']").click(); 2724 } // else window.scrollTo(0, _offsetY); 2725 } 2726}; 2727 2728scrollBefore(); // DOM loaded 2729 2730 2731 2732/* 2733 * Plugins/Functions 2734 * 2735 */ 2736 2737// check object is variable or DOM elements 2738function isObjectVar(obj) { 2739 return ((typeof obj != "undefined") && (typeof obj === "object") && (obj.nodeType !== 1) && (typeof obj.ownerDocument !== "object")); 2740} 2741 2742(function($) { 2743 // BEGIN: $.feed 2744 $.fn.feed = function (option, callbacks) { 2745 var option = $.extend({ 2746 Path : "", 2747 BOX : $(this), 2748 key : 0, 2749 MAX : 5, 2750 titleMax : 40, 2751 postMax : 100, 2752 endtext : "...", 2753 indention : "no", 2754 Datetype : { year: "å¹´", month: "æÅË", date: "æâÂ¥" }, 2755 Image : "no", 2756 ImageSize : { width: "200", height: "150"}, //表示ãÂâ¢Ã£ââ¹Ã§âȌÆÂã®ãâµãâ¤ã⺠2757 noImage : "no", 2758 noImage_src : "shared_new/img/shared_new/no_image.jpg", 2759 source : "", 2760 done : false 2761 }, option); 2762 2763 $.support.cors = true; // fixed no transport error 2764 $.ajax({ 2765 url: option["Path"], 2766 crossDomain: true, 2767 cache: false, 2768 async: false, 2769 type: "POST", 2770 dataType: "xml", 2771 data: { 2772 key: option["key"] 2773 }, 2774 error: function(jqXHR, textStatus, errorThrown) { 2775 console.log(textStatus + ": " + errorThrown); 2776 2777 return false; 2778 }, success: function(data) { 2779 var cnt = 0, 2780 imgTbl = [], 2781 img = "", 2782 src = "", 2783 ss = "", 2784 category = "", // FCV - added 2785 author = "", // FCV - added 2786 html = ""; 2787 2788 $(option["BOX"]["selector"]).empty(); // clear template - FCV added 2789 2790 //è¦Âç´ ãââÃ¥â¦Â¨Ã£Â¦éâ¦ÂÃ¥Ëâã« 2791 $(data).find("item").each(function(){ 2792 var title = $("title",this).text(), //ãâ¿ãâ¤ãÆËãÆÂ« 2793 link = $("link",this).text(), //ãÆÂªÃ£ÆÂ³Ã£â¯åâ¦Ë 2794 category = $("category",this).text(), // FCV - added 2795 author = $("dc\\:creator",this).text(), // FCV - added 2796 ex = $("description",this).text(); //注éâ¡Ëæââ¡Ã§Â«Â 2797 2798 //æÅ¾ââ¡Ã£Â®ãâ½ãÆÂ¼Ã£â¹ãââ表示ãÂâ¢Ã£ââ¹Ã£Ââ¹Ã£Â©ãÂâ ãÂâ¹ 2799 if(option.indention === "yes") ex = $('content\\:encoded',this).text(); 2800 2801 //ãâ¹ãÆÅ¡Ã£ÆÂ¼Ã£â¹ãââÃ¥â°Å éâ¢Â¤ 2802 ex.replace(/\s+/g, ""); 2803 ex.replace(" ", ""); 2804 2805 //ãâ¿ãâ¤ãÆËãÆÂ«Ã£ÂÅ1è¡Åã«åÂŽã¾ãââ°Ã£ÂªãÂâå ´åÂËãâ¬Â調æâ¢Â´ 2806 if (title.length > option.titleMax) { 2807 var rename = title.substring(0,option.titleMax-1) + option.endtext; 2808 title = rename; 2809 } 2810 2811 //æÅ¾ââ¡Ã£Â®èª¿æâ¢Â´ 2812 if (ex.length > option.postMax) { 2813 var retxt = ex.substring(0,option.postMax-1) + option.endtext; 2814 ex = retxt; 2815 } 2816 2817 //æâ¥ä»ËÃ¥Ââå¾â 2818 // ISO date string - regex 2819 // ^(\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))$ 2820 var pubDate = $("pubDate",this).text().length > 0 ? true : false, 2821 Datetxt = pubDate ? $("pubDate",this).text() : $("dc\\:date",this).text(), 2822 dateISO = pubDate ? new Date() : new Date(Datetxt), 2823 year = pubDate ? Datetxt.substring(12, 16) : dateISO.getMonth() + 1,
2824 month = pubDate ? Datetxt.substring(8, 11) : dateISO.getDate(), 2825 date = pubDate ? Datetxt.substring(5, 7) : dateISO.getFullYear(); 2826 2827 //èâ¹Â±Ã¨ÂªÅ¾Ã¨Â¡Â¨Ã¨Â¨Ëã®æÅËãââæâ¥æÅ¬èªžã«å¤â°Ã¦Â⺠2828 if (month == "Jan") month = "01"; 2829 if (month == "Feb") month = "02"; 2830 if (month == "Mar") month = "03"; 2831 if (month == "Apr") month = "04"; 2832 if (month == "May") month = "05"; 2833 if (month == "Jun") month = "06"; 2834 if (month == "Jul") month = "07"; 2835 if (month == "Aug") month = "08"; 2836 if (month == "Sep") month = "09"; 2837 if (month == "Oct") month = "10"; 2838 if (month == "Nov") month = "11"; 2839 if (month == "Dec") month = "12"; 2840 2841 //æâ¥ä»Ëã®形张2842 date = year + option.Datetype.year + month + option.Datetype.month + date + option.Datetype.date; 2843 2844 //çâȌÆÂã®åÂâå¾â 2845 if(option.Image !== "no") { 2846 2847 ss = $(this).find('[nodeName="content:encoded"]').context.textContent; 2848 html = $.parseHTML( ss ); 2849 2850 imgTbl.length = 0; 2851 2852 2853 var AllImage = $(html).find("img"); 2854 2855 for (i=0, Max=AllImage.length; i<Max; i++) { 2856 //çµµæââ¡Ã¥Ââãââéâ¢Â¤Ã¥Â¤âãÂâ¢Ã£ââ¹ 2857 if (!$(AllImage)[i].src.match("s.w.org")) Array.prototype.push.apply(imgTbl, [$(AllImage)[i].src]); 2858 } 2859 2860 if (imgTbl[0]) src = imgTbl[0]; 2861 else src = option.noImage_src; //no-imageçâȌÆÂ 2862 2863 if (option.noImage === "yes") { 2864 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>'; 2865 } 2866 2867 if (option.noImage === "no") { 2868 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>'; 2869 else img = '<span class="no-image" style="display:none;"></span>'; 2870 } 2871 } 2872 2873 //Ã¥â¡ÂºÃ¥Å âºÃ£Â®ãâ½ãÆÂ¼Ã£â¹ 2874 if(!title.match("PR")) { 2875 var postdata = option.source, 2876 post = postdata(link,title,date,ex,img,category,author,cnt); // FCV - modified 2877 2878 $(option.BOX.selector).append(post); 2879 } 2880 2881 //çµâäºâ ãÆâ¢Ã£ÆÂ©Ã£â° 2882 cnt++; 2883 if(cnt > (option.MAX -1)) return false; 2884 }); 2885 } 2886 }).done(function() { 2887 if (typeof callbacks === "function") callbacks.call(this); 2888 }); 2889 }; 2890 // END: $.feed 2891 2892 // BEGIN: $.fcvScroll 2893 $.fn.fcvScroll = function(options) { 2894 var options = $.extend({ 2895 selector: ".section", // selector 2896 delay: 50, // time delay (ms) 2897 duration: 400, // time duration (ms) 2898 reference: .9, 2899 }, options); 2900 2901 if (options.selector) { 2902 var $wrapper = $(this), 2903 $offsetSelectors = [], 2904 $scrollDown = true, 2905 $scrollPos = $(window).scrollTop(), 2906 $scrollTimer = null; 2907 2908 $wrapper.find(options.selector).each(function(i) { 2909 $offsetSelectors.push($(this).offset().top); // offsetY fined 2910 }); 2911 2912 $(window).scroll(function() { 2913 $scrollDown = $(window).scrollTop() >= $scrollPos; 2914 $scrollPos = $(window).scrollTop(); 2915 2916 clearTimeout($scrollTimer); 2917 2918 if ($.inArray($(window).scrollTop(), $offsetSelectors) < 0) { // not in area fined 2919 $scrollTimer = setTimeout(function() { // fcv-snap 2920 var $scrollTop = $(window).scrollTop(), 2921 $posY = $(window).height() * options.reference, 2922 $position = 0, 2923 $target; 2924 2925 if ($scrollDown) { // direction down 2926 $position = $scrollTop + $posY - 1; 2927 $wrapper.find(options.selector).each(function() { 2928 var $offsetY = $(this).offset().top; 2929 if (($offsetY > $scrollTop) && ($offsetY <= $position)) { 2930 $target = $(this); 2931 return false; 2932 } 2933 }); 2934 } else { // direction up 2935 $position = $scrollTop - $posY + 1; 2936 $wrapper.find(options.selector).each(function() { 2937 var $offsetY = $(this).offset().top; 2938 if (($offsetY < $scrollTop) && ($offsetY >= $position)) { 2939 $target = $(this); 2940 return false;
2941 } 2942 }); 2943 } 2944 2945 if ($target) { 2946 $("html, body").stop().animate({ 2947 scrollTop: $target.offset().top 2948 }, options.duration, function() { 2949 clearTimeout($scrollTimer); 2950 }); 2951 } 2952 }, options.delay); 2953 } 2954 }).resize(function() { 2955 if ($(options.selector).hasClass("minHeight")) { 2956 $(options.selector).css({ 2957 minHeight: $(window).height() 2958 }); 2959 } else { 2960 $(options.selector).css({ 2961 height: $(window).height() 2962 }); 2963 } 2964 }).trigger("resize"); 2965 } else console.error("Missing selector"); 2966 2967 return this; 2968 }; 2969 // END: $.fcvScroll 2970})(jQuery); 2971 2972var gmarkers = [], 2973 gnum = 0; 2974 2975 2976 2977// BEGIN: heightLine 2978function heightLine() { 2979 2980 this.className="heightLine"; 2981 this.parentClassName="heightLineParent" 2982 reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i"); 2983 objCN =new Array(); 2984 var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all; 2985 for(var i = 0; i < objAll.length; i++) { 2986 if (typeof objAll[i].className == "string") { 2987 var eltClass = objAll[i].className.split(/\s+/); 2988 for(var j = 0; j < eltClass.length; j++) { 2989 if(eltClass[j] == this.className) { 2990 if(!objCN["main CN"]) objCN["main CN"] = new Array(); 2991 objCN["main CN"].push(objAll[i]); 2992 break; 2993 }else if(eltClass[j] == this.parentClassName){ 2994 if(!objCN["parent CN"]) objCN["parent CN"] = new Array(); 2995 objCN["parent CN"].push(objAll[i]); 2996 break; 2997 }else if(eltClass[j].match(reg)){ 2998 var OCN = eltClass[j].match(reg) 2999 if(!objCN[OCN]) objCN[OCN]=new Array(); 3000 objCN[OCN].push(objAll[i]); 3001 break; 3002 } 3003 } 3004 } 3005 } 3006 3007 //check font size 3008 var e = document.createElement("div"); 3009 var s = document.createTextNode("S"); 3010 e.appendChild(s); 3011 e.style.classname="check-fontsize"; 3012 e.style.visibility="hidden"; 3013 e.style.position="absolute"; 3014 e.style.top="0"; 3015 document.body.appendChild(e); 3016 var defHeight = e.offsetHeight; 3017 3018 changeBoxSize = function(){ 3019 for(var key in objCN){ 3020 if (objCN.hasOwnProperty(key)) { 3021 //parent type 3022 if(key == "parent CN"){ 3023 for(var i=0 ; i<objCN[key].length ; i++){ 3024 var max_height=0; 3025 var CCN = objCN[key][i].childNodes; 3026 for(var j=0 ; j<CCN.length ; j++){ 3027 if(CCN[j] && CCN[j].nodeType == 1){ 3028 CCN[j].style.height="auto"; 3029 max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight; 3030 } 3031 } 3032 for(var j=0 ; j<CCN.length ; j++){ 3033 if(CCN[j].style){ 3034 var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], ''); 3035 var newheight = max_height; 3036 if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px",""); 3037 if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px",""); 3038 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px",""); 3039 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 3040 CCN[j].style.height =newheight+"px"; 3041 } 3042 } 3043 } 3044 }else{ 3045 var max_height=0; 3046 for(var i=0 ; i<objCN[key].length ; i++){ 3047 objCN[key][i].style.height="auto"; 3048 max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight; 3049 } 3050 for(var i=0 ; i<objCN[key].length ; i++){ 3051 if(objCN[key][i].style){ 3052 var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], ''); 3053 var newheight = max_height; 3054 if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px",""); 3055 if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px",""); 3056 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","") 3057 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 3058 objCN[key][i].style.height =newheight+"px"; 3059 } 3060 } 3061 } 3062 } 3063 } 3064 } 3065 3066 checkBoxSize = function(){ 3067 if(defHeight != e.offsetHeight){ 3068 changeBoxSize(); 3069 defHeight= e.offsetHeight; 3070 } 3071 3072 // var elm = document.querySelector(".check-fontsize"); 3073 // if (elm) elm.parentNode.removeChild(elm); 3074 } 3075 changeBoxSize(); 3076 setInterval(checkBoxSize,1000) 3077 window.onresize=changeBoxSize; 3078} 3079 3080function addEvent(elm,listener,fn){ 3081 try{ 3082 elm.addEventListener(listener,fn,false); 3083 }catch(e){ 3084 elm.attachEvent("on"+listener,fn); 3085 } 3086} 3087addEvent(window, "load", heightLine); 3088// END: heightLine 3089 3090(function() { // DOM loaded 3091 // facebook 3092 var fbRoot = document.getElementById("fb-root"); 3093 if (fbRoot) { 3094 var fbScript = document.createElement("script"), 3095 fbScriptContent = "", 3096 fbVersion = fbRoot.getAttribute("data-version") ? fbRoot.getAttribute("data-version") : "v2.12", 3097 fbLanguage = fbRoot.getAttribute("data-language") ? fbRoot.getAttribute("data-language") : "ja_JP"; 3098 3099 fbVersion = fbVersion.substr(0, 1).toLowerCase() == "v" ? fbVersion.substr(1) : fbVersion; 3100 3101 fbScriptContent += '(function(d, s, id) {'; 3102 fbScriptContent += 'var js, fjs = d.getElementsByTagName(s)[0];'; 3103 fbScriptContent += 'if (d.getElementById(id)) return;'; 3104 fbScriptContent += 'js = d.createElement(s);'; 3105 fbScriptContent += 'js.id = id;'; 3106 fbScriptContent += 'js.src = "https://connect.facebook.net/' + fbLanguage + '/sdk.js#xfbml=1&version=v' + fbVersion + '";'; 3107 fbScriptContent += 'fjs.parentNode.insertBefore(js, fjs);'; 3108 fbScriptContent += '}(document, "script", "facebook-jssdk"));'; 3109 3110 fbScript.innerHTML = fbScriptContent; 3111 document.body.appendChild(fbScript); 3112 } 3113 3114 // WOW js 3115 if (typeof window["WOW"] === "function") { 3116 var wowData = { 3117 boxClass: typeof $("body").attr("data-wow-box") != "undefined" ? $("body").attr("data-wow-box") : "wow", 3118 animateClass: typeof $("body").attr("data-wow-animate") != "undefined" ? $("body").attr("data-wow-animate") : "animated", 3119 offset: typeof $("body").attr("data-wow-offset") != "undefined" ? parseInt($("body").attr("data-wow-offset")) : 0, 3120 mobile: $.inArray($("body").attr("data-wow-mobile"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 3121 live: $.inArray($("body").attr("data-wow-live"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 3122 resetAnimation: $.inArray($("body").attr("data-wow-reset"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 3123 callback: function(box) {}, 3124 scrollContainer: null 3125 }, 3126 _wow_ = new WOW(wowData); 3127 3128 _wow_.init(); 3129 } 3130})(); 3131 3132// conflicts 3133if (!Object.keys) { 3134 Object.keys = (function() { 3135 "use strict"; 3136 var hasOwnProperty = Object.prototype.hasOwnProperty, 3137 hasDontEnumBug = !({ 3138 toString: null 3139 }).propertyIsEnumerable("toString"), 3140 dontEnums = [ 3141 "toString",
3142 "toLocaleString", 3143 "valueOf", 3144 "hasOwnProperty", 3145 "isPrototypeOf", 3146 "propertyIsEnumerable", 3147 "constructor" 3148 ], 3149 dontEnumsLength = dontEnums.length; 3150 3151 return function(obj) { 3152 if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) { 3153 throw new TypeError("Object.keys called on non-object"); 3154 } 3155 3156 var result = [], 3157 prop, i; 3158 3159 for (prop in obj) { 3160 if (hasOwnProperty.call(obj, prop)) { 3161 result.push(prop); 3162 } 3163 } 3164 3165 if (hasDontEnumBug) { 3166 for (i = 0; i < dontEnumsLength; i++) { 3167 if (hasOwnProperty.call(obj, dontEnums[i])) { 3168 result.push(dontEnums[i]); 3169 } 3170 } 3171 } 3172 return result; 3173 }; 3174 }()); 3175} 3176 3177function isHTML(str) { 3178 var a = document.createElement("div"); 3179 a.innerHTML = str; 3180 for (var child = a.childNodes, i = child.length; i--;) { 3181 if (child[i].nodeType == 1) return true; 3182 } 3183 return false; 3184} 3185 3186// BEGIN: slide fading 3187var $slideFadeTimer = {}; 3188 3189function slideFadeStart(elm) { 3190 var $this = elm, 3191 __idx__ = $(".slide-fade").index($this), 3192 $duration = typeof $this.attr("data-duration") != "undefined" ? parseInt($this.attr("data-duration")) : 1000, 3193 $timer = typeof $this.attr("data-timer") != "undefined" ? parseInt($this.attr("data-timer")) : 4000, 3194 $delay = typeof $this.attr("data-delay") != "undefined" ? parseInt($this.attr("data-delay")) : false; 3195 3196 if ($timer < $duration) $timer = $duration * 2; 3197 3198 $this.removeClass("stop"); 3199 if (!$this.children(".active").length) { 3200 $this.children().hide(); 3201 $this.children().eq(0).show().addClass("active"); 3202 3203 if ($this.siblings(".slide-page").length) $this.siblings(".slide-page").children().eq(0).addClass("active"); 3204 } else { 3205 if ($this.siblings(".slide-page").length) $this.siblings(".slide-page").children().eq($this.children(".active").index()).addClass("active"); 3206 } 3207 3208 // $slideFadeTimer[__idx__] = setInterval(function() { 3209 // slideFade($this, $duration); 3210 // }, $timer); 3211 3212 $this.parents(".slideParent").addClass("move-start").attr("data", $this.children(".active").index()); 3213 3214 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 3215 $slideFadeTimer[__idx__] = setTimeout(function() { 3216 slideFade($this, $duration); 3217 }, $delay ? $delay : $timer); 3218} 3219 3220function slideFade(elm, duration) { 3221 var elmActive = elm.children(".active"), 3222 slideContinue = elm.hasClass("stop") || (elm.hasClass("once") && elmActive.next().length < 1) ? false : true; 3223 3224 if (slideContinue) { 3225 var __idx__ = $(".slide-fade").index(elm), 3226 timer = typeof elm.attr("data-timer") != "undefined" ? parseInt(elm.attr("data-timer")) : 4000; 3227 3228 if (elmActive.next().length) { 3229 if (typeof elmActive.next().attr("data-duration") != "undefined") duration = parseInt(elmActive.next().attr("data-duration")); 3230 } else { 3231 if (typeof elm.children().eq(0).attr("data-duration") != "undefined") duration = parseInt(elm.children().eq(0).attr("data-duration")); 3232 } 3233 3234 if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]); 3235 3236 elmActive.stop().fadeOut(duration, function() { 3237 $(this).removeClass("active").removeAttr("style").hide(); 3238 }); 3239 3240 elm.parents(".slideParent").removeClass("move-start move-next move-prev move-first move-last"); 3241 3242 if (elmActive.next().length > 0) { 3243 if (typeof elmActive.next().attr("data-timer") != "undefined") timer = parseInt(elmActive.next().attr("data-timer")); 3244 if (timer < duration) timer = duration * 2; 3245 3246 if (elm.siblings(".slide-page").length > 0) { 3247 elm.siblings(".slide-page").children(".active").removeClass("active"); 3248 elm.siblings(".slide-page").children().eq(elmActive.next().index()).addClass("active"); 3249 } 3250 3251 elm.parents(".slideParent").addClass("move-next").attr("data", elmActive.next().index()); 3252 if (elmActive.next().is(":last-child")) elm.parents(".slideParent").addClass("move-last"); 3253 3254 elmActive.next().stop().fadeIn(duration, function() { 3255 $(this).addClass("active").removeAttr("style").show(); 3256 3257 if (elm.siblings(".slide-btn").hasClass("clicked")) elm.siblings(".slide-btn.clicked").removeClass("clicked"); 3258 if (elm.siblings(".slide-page").hasClass("clicked")) elm.siblings(".slide-page.clicked").removeClass("clicked"); 3259 3260 if ($(this).next().length < 1 && elm.hasClass("once")) elm.addClass("slide-finished"); 3261 3262 $slideFadeTimer[__idx__] = setTimeout(function() { 3263 slideFade(elm, duration); 3264 }, timer); 3265 }); 3266 } else { 3267 if (typeof elm.children().eq(0).attr("data-timer") != "undefined") timer = parseInt(elm.children().eq(0).attr("data-timer")); 3268 if (timer < duration) timer = duration * 2; 3269 3270 if (elm.siblings(".slide-page").length > 0) { 3271 elm.siblings(".slide-page").children(".active").removeClass("active"); 3272 elm.siblings(".slide-page").children().eq(0).addClass("active"); 3273 } 3274 3275 elm.parents(".slideParent").addClass("move-first").attr("data", 0); 3276 3277 elm.children().eq(0).stop().fadeIn(duration, function() { 3278 $(this).addClass("active").removeAttr("style").show(); 3279 3280 if (elm.siblings(".slide-btn").hasClass("clicked")) elm.siblings(".slide-btn.clicked").removeClass("clicked"); 3281 if (elm.siblings(".slide-page").hasClass("clicked")) elm.siblings(".slide-page.clicked").removeClass("clicked"); 3282 3283 if ($(this).next().length < 1 && elm.hasClass("once")) elm.addClass("slide-finished"); 3284 3285 $slideFadeTimer[__idx__] = setTimeout(function() { 3286 slideFade(elm, duration); 3287 }, timer); 3288 }); 3289 } 3290 } else elm.addClass("slide-finished"); 3291} 3292// END: slide fading 3293 3294// BEGIN: .pagination 3295function reloadPager(elm) { 3296 if (elm) { 3297 if (elm instanceof jQuery && elm.length > 0) { 3298 elm.each(function() {
3299 initPager($(this)); 3300 }); 3301 } 3302 } else { 3303 $(".pagination").each(function() { 3304 initPager($(this)); 3305 }); 3306 } 3307} 3308function initPager(elm) { 3309 // if (elm.children(".page-content").children().length > 0) { 3310 var $pagination = elm, 3311 $pageContent = $pagination.children(".page-content"), 3312 total = $pageContent.children().length; 3313 3314 var dataPage = { 3315 first: typeof $pagination.attr("data-first") !== "undefined" && $pagination.attr("data-first").length > 0 ? $pagination.attr("data-first") : false, 3316 last: typeof $pagination.attr("data-last") !== "undefined" && $pagination.attr("data-last").length > 0 ? $pagination.attr("data-last") : false, 3317 next: typeof $pagination.attr("data-next") !== "undefined" && $pagination.attr("data-next").length > 0 ? $pagination.attr("data-next") : false, 3318 prev: typeof $pagination.attr("data-prev") !== "undefined" && $pagination.attr("data-prev").length > 0 ? $pagination.attr("data-prev") : false, 3319 active: typeof $pagination.attr("data-active") !== "undefined" && $pagination.attr("data-active").length > 0 ? parseInt($pagination.attr("data-active"), 10) : 1, 3320 max: typeof $pagination.attr("data-max") !== "undefined" && $pagination.attr("data-max").length > 0 ? parseInt($pagination.attr("data-max"), 10) : false, 3321 page: typeof $pagination.attr("data-page") !== "undefined" && $.inArray($pagination.attr("data-page"), ["top", "bottom", "both"]) >= 0 ? $pagination.attr("data-page") : false 3322 }; 3323 3324 if (dataPage.active > total) dataPage.active = 1; 3325 3326 if (dataPage.max) { // && $pageContent.children().length > 0 3327 if ($pageContent.children(".page-wrap").length > 0) { 3328 if ($pageContent.children(".page-wrap").children().length > 0) $pageContent.children(".page-wrap").children().unwrap(); 3329 else $pageContent.children(".page-wrap").remove(); 3330 } 3331 3332 $pageContent.children().not(".page-wrap").each(function(i) { 3333 if (i % dataPage.max === 0) $pageContent.append('<div class="page-wrap" />'); 3334 3335 $(this).appendTo($pageContent.children(".page-wrap").last()); 3336 }); 3337 3338 total = $pageContent.children().length; 3339 } 3340 3341 if ($pagination.children(".page-link").length > 0) $pagination.children(".page-link").remove(); 3342 3343 if (dataPage.page && total > 0) { 3344 if (dataPage.page == "top") $pagination.prepend('<div class="page-link" />'); 3345 else if (dataPage.page == "bottom") $pagination.append('<div class="page-link" />'); 3346 else { 3347 $pagination.prepend('<div class="page-link" />'); 3348 $pagination.append('<div class="page-link" />'); 3349 } 3350 3351 $pagination.children(".page-link").each(function(p) { 3352 var $pageLink = $(this); 3353 3354 var htmlItem = []; 3355 htmlItem.push('<ul>'); 3356 if (dataPage.first) htmlItem.push('<li class="page-first">' + dataPage.first + '</li>'); 3357 if (dataPage.prev) htmlItem.push('<li class="page-prev">' + dataPage.prev + '</li>'); 3358 for (var i = 1; i <= total; i++) { 3359 // if (i == dataPage.active) htmlItem.push('<li class="page-item active">' + i + '</li>'); 3360 // else htmlItem.push('<li class="page-item">' + i + '</li>'); 3361 htmlItem.push('<li class="page-item">' + i + '</li>'); 3362 } 3363 if (dataPage.next) htmlItem.push('<li class="page-next">' + dataPage.next + '</li>'); 3364 if (dataPage.last) htmlItem.push('<li class="page-last">' + dataPage.last + '</li>'); 3365 htmlItem.push('</ul>'); 3366 3367 htmlItem = htmlItem.join("\n"); 3368 $pageLink.html(htmlItem); 3369 3370 var scrollable = $pagination.attr("data-scroll"), 3371 duration = $pagination.attr("data-duration"), 3372 modeable = $pagination.attr("data-mode"); 3373 3374 $pagination.attr("data-scroll", false); // off scroll on first loaded 3375 $pagination.attr("data-duration", 0); // off duration on first loaded 3376 $pagination.attr("data-mode", false); // off mode on first loaded 3377 3378 if (p >= $pagination.children(".page-link").length - 1) { // last 3379 setTimeout(function() { 3380 $pageLink.find(".page-item").eq(dataPage.active - 1).click(); 3381 }, 1); 3382 } // else $pageLink.find(".page-item").eq(dataPage.active - 1).addClass("active"); 3383 }); 3384 3385 // re-setting for data-scroll 3386 if (typeof scrollable === "undefined") $pagination.removeAttr("data-scroll"); 3387 else $pagination.attr("data-scroll", scrollable); 3388 3389 // re-setting for data-duration 3390 if (typeof duration === "undefined") $pagination.removeAttr("data-duration"); 3391 else $pagination.attr("data-duration", duration); 3392 3393 // re-setting for data-mode 3394 if (typeof modeable === "undefined") $pagination.removeAttr("data-mode"); 3395 else $pagination.attr("data-mode", modeable); 3396 } else {
3397 $pageContent.children(".page-wrap").first().addClass("active"); // show 3398 } 3399 // } 3400} 3401// END: .pagination 3402 3403var checkDomain = function(url) { 3404 if (url.indexOf('//') === 0) url = location.protocol + url; 3405 return url.toLowerCase().replace(/([a-z])?:\/\//, "$1").split("/")[0]; 3406}; 3407var isExternal = function(url) { 3408 return ((url.indexOf(":") > -1 || url.indexOf("//") > -1) && checkDomain(location.href) !== checkDomain(url)); 3409};
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.