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 75 76$(document).ready(function() { 77 var UA = navigator.userAgent; 78 if (UA.indexOf("iPhone") < 0 && UA.indexOf("Android") < 0) $(".telhref").contents().unwrap(); // remove link [tel] on desktop 79 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) $("html.mobile-no-animate").addClass("noanimated"); // to remove transition 80 else $("html.mobile-no-animate").removeClass("noanimated"); 81 82 // fix bg parallax on mobile 83 if (isMobile.any()) $(".bg-parallax").css("background-attachment", "inherit"); 84 else $(".bg-parallax").css("background-attachment", ""); 85 86 87 $("body") 88 .on("click", "#fc-console .console-title", function() { 89 $(this).parents("#fc-console").toggleClass("active"); 90 }) 91 .on("click", "#fc-console .console-clear", function() { 92 $("#fc-console").removeClass("active"); 93 $("#fc-console .console-main").empty(); 94 $("#fc-console .console-title").removeAttr("data-total"); 95 }) 96 .on("click", ".copy", function(e) { 97 e.preventDefault(); 98 99 $(this).removeAttr("data-clipboard-text"); 100 }); 101 102 // navigation animate 103 if ($(".nav-animate").length) { 104 $(".nav-animate").each(function() { 105 var $timerNav, 106 $navNull = $(this).hasClass("nav-null"), 107 $navWidth = $(this).find("li").first().outerWidth(), 108 $navPosX = $navNull ? 0 : $(this).find("li").first().position().left, 109 // $navML = 0, 110 $navMR = 0; 111 112 if ($(this).find("li.active").length) { 113 $navWidth = $(this).find("li.active").outerWidth(), 114 $navPosX = $(this).find("li.active").position().left; 115 116 // $navML = $(this).find("li.active").next().length ? parseInt($(this).find("li.active").next().css("margin-left"), 10), 117 $navMR = $(this).find("li.active").prev().length ? parseInt($(this).find("li.active").prev().css("margin-right"), 10) : 0; 118 } else { 119 if (!$navNull) $(this).find("li").first().addClass("active"); 120 121 // $navML = parseInt($(this).find("li").first().css("margin-left"), 10), 122 // $navMR = parseInt($(this).find("li").first().css("margin-right"), 10); 123 } 124 125 $navWidth += $navMR; 126 $navPosX -= $navMR; 127 128 $(this).children("span").css({ 129 width: $navWidth, 130 left: $navPosX 131 }); 132 133 if ($navNull) $(this).children("span").css("opacity", 0); 134 135 $(this).find("li").mouseover(function() {
136 var $navW = $(this).outerWidth(), 137 $navX = $(this).position().left, 138 // $nML = $(this).next().length ? parseInt($(this).next().css("margin-left"), 10), 139 $nMR = $(this).prev().length ? parseInt($(this).prev().css("margin-right"), 10) : 0; 140 141 if ($navNull) { 142 clearTimeout($timerNav); 143 144 $navPosX = $navX - $nMR; 145 146 $(this).parents(".nav-animate").children("span").css("opacity", 1); 147 console.log($navPosX); 148 } 149 150 $(this).parents(".nav-animate").children("span").stop().animate({ 151 width: $navW + $nMR, 152 left: $navX - $nMR 153 }, "fast"); 154 }).mouseleave(function() { 155 var $span = $(this).parents(".nav-animate").children("span"); 156 157 if ($navNull) { 158 clearTimeout($timerNav); 159 $timerNav = setTimeout(function() { 160 console.log($navPosX); 161 $span.stop().fadeOut(100, function() { 162 $(this).removeAttr("style").css({ 163 opacity: 0, 164 width: $navWidth, 165 left: $navPosX 166 }) 167 }); 168 }, 500); 169 } else { 170 $span.stop().animate({ 171 width: $navWidth, 172 left: $navPosX 173 }, "fast"); 174 } 175 }); 176 }); 177 } 178 179 180 // BEGIN: toggle 181 if ($(".toggle").length > 0) { 182 $("body").on("click", ".toggle-link", function() { 183 var $toggleDuration = 500, 184 $toggleElm = $(this).parents(".toggle").first(); 185 186 if (typeof $toggleElm.attr("data-duration") != "undefined") { 187 if ($.inArray($toggleElm.attr("data-duration"), ["slow", "normal", "fast"]) >= 0) $toggleDuration = $toggleElm.attr("data-duration"); 188 else $toggleDuration = parseInt($toggleElm.attr("data-duration")); 189 } 190 191 if ($(this).parents(".single").length > 0) { 192 $(this).parents(".single").find(".toggle-main").stop().slideUp($toggleDuration, function() { 193 $(this).removeAttr("style"); 194 $(this).parents(".toggle").first().removeClass("active"); 195 }); 196 } 197 198 if ($(this).parents(".toggle").first().hasClass("active")) { 199 $(this).siblings(".toggle-main").stop().slideUp($toggleDuration, function() { 200 $(this).removeAttr("style"); 201 $(this).parents(".toggle").first().removeClass("active"); 202 }); 203 } else { 204 $(this).siblings(".toggle-main").stop().slideDown($toggleDuration, function() { 205 $(this).removeAttr("style"); 206 $(this).parents(".toggle").first().addClass("active"); 207 208 // if ($(this).find("[class*=heightLine]").length) heightLine(); 209 210 $(window).trigger("resize"); 211 }); 212 213 if ($(this).siblings(".toggle-main").find("[class*=heightLine]").length) heightLine(); 214 } 215 }); 216 } 217 // END: toggle 218 219 // BEGIN: tabs - switch 220 if ($(".tabs-switch").length) { 221 $(".tabs-switch").each(function() { 222 var $tabsSwitch = $(this), 223 $tabLink = $tabsSwitch.find(".tab-link"), 224 $tabContent = $tabsSwitch.find(".tab-content"); 225 226 $tabLink.children().each(function() { 227 if ($(this).find("img").length > 0 && $(this).find("img").hasClass("btn")) { 228 $(this).data("src", $(this).find("img").attr("src")); 229 230 $(this).find("img").attr("src").match(/^(.*)(\.{1}.*)/g); 231 $(this).data("active", RegExp.$1 + "_on" + RegExp.$2); 232 } 233 }); 234 235 $tabContent.children().hide(); 236 237 if (!$tabsSwitch.hasClass("stop")) { 238 $tabLink.each(function() { 239 // TODO: active by [data-active] 240 var hash = window.location.hash || location.hash; 241 if (hash) { 242 if ($(this).children("[data-tab-anchor='" + hash + "']").length) $(this).children("[data-tab-anchor='" + hash + "']").addClass("active"); 243 else $(this).children().first().addClass("active"); 244 } else if (!$(this).children(".active").length) $(this).children().first().addClass("active"); 245 246 $(this).children(".active").find("img").attr("src", $(this).children(".active").data("active")).removeClass("btn"); 247 }); 248 249 if ($tabLink.children(".active").hasClass("all")) $tabContent.children().show(); 250 else $tabContent.children().eq($tabLink.children(".active").index()).show(); 251 } 252 253 if ($(".bxSlider").length > 0) $(window).trigger("resize"); 254 }); 255 256 $("body").on("click", ".tab-link .tab-item, .tab-link > *", function() { 257 var $itemMode = $(this).hasClass("tab-item"), 258 $this = $itemMode ? $(this, ".tab-item") : $(this), 259 $idxAll = $this.parents(".tab-link").first().children(".all").length > 0 ? $this.parents(".tab-link").first().children(".all").index() : false, 260 $idx = $itemMode ? $this.parents(".tab-link").first().find(".tab-item").index($this) : $this.parents(".tab-link").first().children().index($this), 261 $act = $itemMode ? $this.parents(".tab-link").first().find(".tab-item.active") : $this.parents(".tab-link").first().children(".active"), 262 $tabMode = $.inArray($this.parents(".tabs-switch").first().attr("data"), ["fade", "slide", "block"]) >= 0 ? $this.parents(".tabs-switch").first().attr("data") : "block", 263 $tabDuration = $this.parents(".tabs-switch").first().attr("data-duration") ? parseInt($this.parents(".tabs-switch").first().attr("data-duration")) : 300, 264 $tabContent = $this.parents(".tabs-switch").first().children(".tab-content"), 265 $tabIdx = $this.attr("data-active") ? $this.attr("data-active") : false, 266 $autoScroll = $.inArray($this.parents(".tabs-switch").first().attr("data-scroll"), ["true", "on", "enable", "enabled", "1"]) >= 0 ? true : false, 267 $itself = $.inArray($this.parents(".tabs-switch").first().attr("data-toggle"), ["true", "on", "enable", "enabled", "1"]) >= 0 && $this.hasClass("active") ? true : false, 268 $itHide = $tabContent.children().eq($idx).is(":hidden"); 269 270 if ($tabIdx) { 271 $this.parents(".tabs-switch").first().find(".tab-link").each(function() { 272 var $tabBtn = $itemMode ? $(this).find(".tab-item[data-active='" + $tabIdx + "']") : $(this).children("[data-active='" + $tabIdx + "']"), 273 $elmActive = $itemMode ? $(this).find(".tab-item.active") : $(this).children(".active"); 274 275 $elmActive.find("img").attr("src", $elmActive.data("src")); 276 $elmActive.removeClass("active"); 277 278 if ($itself) { 279 if ($itHide) $tabBtn.addClass("active"); 280 else $tabBtn.removeClass("active"); 281 } else $tabBtn.addClass("active"); 282 283 // if (!$tabBtn.find("img").hasClass("active")) $tabBtn.find("img").attr("src", $tabBtn.data("active")); 284 if ($tabBtn.find("img").hasClass("btn")) $tabBtn.find("img").attr("src", $tabBtn.data("active")).removeClass("btn"); 285 }); 286 } else { 287 if (/^(.*?)_on\.(.*?)$/.test($act.find("img").attr("src"))) $act.find("img").addClass("btn"); 288 289 $act.find("img").attr("src", $act.data("src")); 290 $act.removeClass("active"); 291 292 if ($itself) { 293 if ($itHide) $this.addClass("active"); 294 else $this.removeClass("active"); 295 } else $this.addClass("active"); 296 297 // if (!$this.find("img").hasClass("active")) $this.find("img").attr("src", $this.data("active")); 298 if ($this.find("img").hasClass("btn")) $this.find("img").attr("src", $this.data("active")).removeClass("btn"); 299 } 300 301 if (!$this.parents(".tab-link").first().hasClass("clicked")) { 302 $this.parents(".tab-link").first().addClass("clicked"); 303 304 if ($this.hasClass("all")) { 305 if ($tabMode == "fade") { 306 $tabContent.children().stop().fadeIn($tabDuration, function() { 307 $(this).removeAttr("style").show(); 308 309 if ($(this).find("[class*=heightLine]").length) heightLine(); 310 311 if ($this.children("a").length) $this.children("a").click(); 312 313 $tabContent.css({ 314 minHeight: "" 315 }); 316 317 $(window).trigger("resize"); 318 319 $this.parents(".tab-link").first().removeClass("clicked"); 320 }); 321 } else if ($tabMode == "slide") { 322 $tabContent.children().slideDown($tabDuration, function() { 323 $(this).removeAttr("style").show(); 324 325 if ($(this).find("[class*=heightLine]").length) heightLine(); 326 327 if ($this.children("a").length) $this.children("a").click(); 328 329 $(window).trigger("resize"); 330 331 $this.parents(".tab-link").first().removeClass("clicked"); 332 }); 333 } else { 334 $tabDuration = $(this).parents(".tabs-switch").first().attr("data-duration") ? parseInt($(this).parents(".tabs-switch").first().attr("data-duration")) : 0; 335 336 $tabContent.children().stop().show($tabDuration, function() { 337 $(this).removeAttr("style").show(); 338 339 if ($(this).find("[class*=heightLine]").length) heightLine(); 340 341 if ($this.children("a").length) $this.children("a").click(); 342 343 $(window).trigger("resize"); 344 345 $this.parents(".tab-link").first().removeClass("clicked"); 346 }); 347 } 348 } else { 349 if ($idxAll !== false && $idxAll >= 0 && $idx >= $idxAll) $idx -= 1; 350 351 if ($tabMode == "fade") { 352 if ($itself) { 353 $tabContent.children().eq($idx).stop().fadeToggle($tabDuration, function() { 354 if ($itHide) $(this).removeAttr("style").show(); 355 else $(this).removeAttr("style").hide(); 356 357 if ($(this).find("[class*=heightLine]").length) heightLine(); 358 359 if ($this.children("a").length) $this.children("a").click(); 360 361 $tabContent.css({ 362 minHeight: "" 363 }); 364 365 $(window).trigger("resize"); 366 367 $this.parents(".tab-link").first().removeClass("clicked"); 368 }); 369 } else { 370 $tabContent.css({ 371 minHeight: $tabContent.outerHeight() 372 }); 373 374 $tabContent.children().stop().fadeOut($tabDuration, function() { 375 $(this).removeAttr("style").hide(); 376 }); 377 $tabContent.children().eq($idx).stop().delay($tabDuration).fadeIn($tabDuration, function() { 378 $(this).removeAttr("style").show(); 379 380 if ($(this).find("[class*=heightLine]").length) heightLine(); 381 382 if ($this.children("a").length) $this.children("a").click(); 383 384 $tabContent.css({ 385 minHeight: "" 386 }); 387 388 $(window).trigger("resize"); 389 390 $this.parents(".tab-link").first().removeClass("clicked"); 391 }); 392 } 393 } else if ($tabMode == "slide") { 394 if ($itself) { 395 $tabContent.children().eq($idx).stop().slideToggle($tabDuration, function() { 396 if ($itHide) $(this).removeAttr("style").show(); 397 else $(this).removeAttr("style").hide(); 398 399 if ($(this).find("[class*=heightLine]").length) heightLine(); 400 401 if ($this.children("a").length) $this.children("a").click(); 402 403 $(window).trigger("resize"); 404 405 $this.parents(".tab-link").first().removeClass("clicked"); 406 }); 407 } else { 408 $tabContent.children().stop().slideUp($tabDuration, function() { 409 $(this).removeAttr("style").hide(); 410 }).siblings().eq($idx).stop().slideDown($tabDuration, function() { 411 $(this).removeAttr("style").show(); 412 413 if ($(this).find("[class*=heightLine]").length) heightLine(); 414 415 if ($this.children("a").length) $this.children("a").click(); 416 417 $(window).trigger("resize"); 418 419 $this.parents(".tab-link").first().removeClass("clicked"); 420 }); 421 } 422 } else { 423 $tabDuration = $this.parents(".tabs-switch").first().attr("data-duration") ? parseInt($this.parents(".tabs-switch").first().attr("data-duration")) : 0; 424 425 if ($itself) { 426 $tabContent.children().eq($idx).stop().toggle($tabDuration, function() { 427 if ($itHide) $(this).removeAttr("style").show(); 428 else $(this).removeAttr("style").hide(); 429 430 if ($(this).find("[class*=heightLine]").length) heightLine(); 431 432 if ($this.children("a").length) $this.children("a").click(); 433 434 $(window).trigger("resize"); 435 436 $this.parents(".tab-link").first().removeClass("clicked"); 437 }); 438 } else { 439 $tabContent.children().stop().hide($tabDuration, function() { 440 $(this).removeAttr("style").hide(); 441 }).siblings().eq($idx).stop().show($tabDuration, function() { 442 $(this).removeAttr("style").show(); 443 444 if ($(this).find("[class*=heightLine]").length) heightLine(); 445 446 if ($this.children("a").length) $this.children("a").click(); 447 448 $(window).trigger("resize"); 449 450 $this.parents(".tab-link").first().removeClass("clicked"); 451 }); 452 } 453 } 454 } 455 456 setTimeout(function() { 457 $this.parents(".tab-link").first().removeClass("clicked"); 458 }, $tabDuration); 459 460 if ($(".slick-slider").length > 0) { 461 $(window).trigger("resize"); 462 } 463 464 if ($(".bxSlider").length > 0) { 465 setTimeout(function() { 466 $(window).trigger("resize"); 467 }, 1); 468 } 469 470 if ($autoScroll) { 471 var $offsetY = $tabContent.offset().top, 472 $navOffset = 0; 473 474 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 475 476 if ($(".nav-target").length) { 477 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 478 479 $("html, body").stop().animate({ 480 scrollTop: $offsetY - $navOffset 481 }, 500); 482 } else { 483 $("html, body").stop().animate({ 484 scrollTop: $offsetY - $navOffset 485 }, 500); 486 } 487 } 488 } 489 }); 490 } 491 // END: tab - switch 492 493 // BEGIN: RSS 494 if (typeof rss === "object" && isObjectVar(rss)) { 495 var objRss = {}; 496 497 for (var r in rss) { 498 if (!isNaN(parseFloat(r)) && isFinite(r)) objRss = rss; // multiple 499 else objRss[0] = rss; // single 500 } 501 for (var rssNum in objRss) { // eaching 502 var rssData = objRss[rssNum]; 503 if (typeof rssData != "undefined" && typeof rssData == "object") { 504 if (typeof rssData.dateFormat == "undefined") { 505 rssData.dateFormat = { 506 year: "-", 507 month: "-", 508 date: "" 509 } 510 } 511 if (typeof rssData.imageSize == "undefined") { 512 rssData.imageSize = { 513 width: 300, 514 height: 200 515 } 516 } 517 if (typeof rssData.elm != "undefined" && $(rssData.elm).length) { 518 var content = typeof rssData.template != "undefined" ? rssData.template : "", 519 rssCallbacks = typeof rssData.done === "function" ? rssData.done : function() {}; 520 521 var $rssLoop = $(rssData.elm).feed({ 522 Path : typeof rssData.url != "undefined" ? rssData.url : "shared/rss/rss.php", //rss.phpã®å ´æãé層ãå¤ããæã®ã¿å¤æ´ã 523 key : rssData.key, //RSSã®URLã 524 indention : typeof rssData.indention != "undefined" ? rssData.indention : false, //æ¬æã®ã½ã¼ã¹ã表示ãããã©ãã 525 hidePhoto : typeof rssData.hidePhoto != "undefined" ? rssData.hidePhoto : false, 526 MAX : typeof rssData.max != "undefined" ? rssData.max : 3, //è¨äºã®æå¤§æ°ã 527 titleMax : typeof rssData.titleMax != "undefined" ? rssData.titleMax : 10, //ã¿ã¤ãã«ã®æå¤§æåæ°ã 528 postMax : typeof rssData.postMax != "undefined" ? rssData.postMax : 50, //æ¬æã®æå¤§æåæ°ã 529 endtext : typeof rssData.endText != "undefined" ? rssData.endText : "...", //æå¤§æåæ°ãè¶ ããå¾ã«è¿½å ããããã¹ãã 530 Datetype : rssData.dateFormat, //æ¥ä»ã®å½¢å¼ãä¾)ââå¹´ââæââæ¥ 531 Image : typeof rssData.image != "undefined" ? (rssData.image === true ? "yes" : rssData.image) : "no", //ç»åä»ãã®è¨äºãã©ãããyesããããã¯noã§ã
532 ImageSize : rssData.imageSize, //表示ããç»åã®ãµã¤ãºãwidth=æ¨ªå¹ ãheight="ç¸¦å¹ " 533 noImage : typeof rssData.noImage != "undefined" ? (rssData.noImage === true ? "yes" : rssData.noImage) : "no", //No-imageç»åãå¿ è¦ãã©ãããyesããããã¯noã§ã 534 noImage_src : typeof rssData.noImageSRC != "undefined" ? rssData.noImageSRC : "shared/img/index/no_image.jpg", //No-imageç»åã®ãã¹ã 535 source : function (LINK, TITLE, DATE, POST, IMAGE, CATEGORY, AUTHOR, COUNT) { 536 var post = ""; 537 538 if (typeof rssData.template != "undefined") { 539 if (rssData.indention == "yes" && rssData.hidePhoto) POST = $("<div>").html(POST).find("img, iframe").remove().end().html(); 540 541 post = 542 rssData.template 543 .replace(/{title}/ig, TITLE) 544 .replace(/{name}/ig, TITLE) 545 .replace(/{content}/ig, POST) 546 .replace(/{desc}/ig, POST) 547 .replace(/{date}/ig, DATE) 548 .replace(/{image}/ig, IMAGE) 549 .replace(/{img}/ig, IMAGE) 550 .replace(/{photo}/ig, IMAGE) 551 .replace(/{pic}/ig, IMAGE) 552 .replace(/{picture}/ig, IMAGE) 553 .replace(/{url}/ig, LINK) 554 .replace(/{link}/ig, LINK) 555 .replace(/{cat}/ig, CATEGORY) 556 .replace(/{category}/ig, CATEGORY) 557 .replace(/{user}/ig, AUTHOR) 558 .replace(/{creator}/ig, AUTHOR) 559 .replace(/{author}/ig, AUTHOR) 560 .replace(/{count}/ig, COUNT) 561 .replace(/{total}/ig, COUNT); 562 } 563 564 return post; 565 } 566 }, rssCallbacks); 567 } else console.error(rssData.elm + " not found", rssData); 568 } 569 } 570 } 571 // END: RSS 572 573 // BEGIN: gmap 574 if (typeof gmap === "object" && isObjectVar(gmap)) { 575 var _dialogs_ = [], 576 _dialogsOpen_ = true; 577 578 function init() { 579 var errorsMap = { 580 mapDiv: false, 581 latLong: false 582 }, 583 objData = {}; // single || multiMap || multiPoint 584 585 586 // checking 587 if (typeof gmap.maps != "undefined" && Object.keys(gmap.maps).length > 0) { // multi map 588 if (typeof gmap.maps[0] == "undefined") { // associative array 589 if (typeof gmap.maps.mapDiv == "undefined" || gmap.maps.mapDiv == "") errorsMap.mapDiv = 1; 590 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; 591 } else { // object 592 for (var s in gmap.maps) { // loop 593 if (typeof gmap.maps[s].mapDiv == "undefined" || gmap.maps[s].mapDiv == "") { 594 errorsMap.mapDiv = 2; 595 break; 596 } 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")) { 597 errorsMap.latLong = 2; 598 break; 599 } 600 } 601 } 602 } else { // single map 603 if (typeof gmap.mapDiv == "undefined" || gmap.mapDiv == "") errorsMap.mapDiv = 3; 604 else if ((typeof gmap.latitude == "undefined" && typeof gmap.latitude != "number") || (typeof gmap.longitude == "undefined" || typeof gmap.longitude != "number")) errorsMap.latLong = 3; 605 } 606 607 608 if (errorsMap.mapDiv || errorsMap.latLong) { 609 console.info("ERROR", errorsMap); 610 return false; 611 } else { 612 // if () 613 var init = initMap(gmap); 614 // console.log(init); 615 } 616 617 /* 618 * initialize 619 * 620 */ 621 622 function initMap(data) { 623 var dataMap = { 624 mapDiv: false, 625 latitude: false, 626 longitude: false, 627 628 center: false, 629 630 zoom: 17, 631 minZoom: 2, 632 zoomControl: true, 633 disableDoubleClickZoom: true, 634 mapTypeControl: true, 635 scaleControl: true, 636 scrollwheel: false, 637 panControl: true, 638 streetViewControl: true, 639 draggable: true, 640 overviewMapControl: true, 641 642 styles: false, 643 style: false, 644 645 name: false, 646 desc: false, 647 tel: false, 648 email: false, 649 650 url: false, 651 logo: false, 652 size: false, 653 scale: false, 654 origin: false, 655 anchor: false, 656 optimized: false, 657 658 clickable: false, 659 hover: false, 660 html: false, 661 662 multi: false 663 }; 664 665 // BEGIN: configs default 666 if (typeof data.zoom != "undefined" && typeof data.zoom == "number") dataMap.zoom = data.zoom; 667 if (typeof data.minZoom != "undefined" && typeof data.minZoom == "number") dataMap.minZ
667oom = data.minZoom; 668 if (typeof data.zoomControl != "undefined" && typeof data.zoomControl == "boolean") dataMap.zoomControl = data.zoomControl; 669 if (typeof data.disableDoubleClickZoom != "undefined" && typeof data.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = data.disableDoubleClickZoom; 670 if (typeof data.mapTypeControl != "undefined" && typeof data.mapTypeControl == "boolean") dataMap.mapTypeControl = data.mapTypeControl; 671 if (typeof data.scaleControl != "undefined" && typeof data.scaleControl == "boolean") dataMap.scaleControl = data.scaleControl; 672 if (typeof data.scrollwheel != "undefined" && typeof data.scrollwheel == "boolean") dataMap.scrollwheel = data.scrollwheel; 673 if (typeof data.panControl != "undefined" && typeof data.panControl == "boolean") dataMap.panControl = data.panControl; 674 if (typeof data.streetViewControl != "undefined" && typeof data.streetViewControl == "boolean") dataMap.streetViewControl = data.streetViewControl; 675 if (typeof data.draggable != "undefined" && typeof data.draggable == "boolean") dataMap.draggable = data.draggable; 676 if (typeof data.overviewMapControl != "undefined" && typeof data.overviewMapControl == "boolean") dataMap.overviewMapControl = data.overviewMapControl; 677 678 if (typeof data.name != "undefined" && data.name != "") dataMap.name = data.name; 679 if (typeof data.desc != "undefined" && data.desc != "") dataMap.desc = data.desc; 680 if (typeof data.tel != "undefined" && data.tel != "") dataMap.tel = data.tel; 681 if (typeof data.email != "undefined" && data.email != "") dataMap.email = data.email; 682 if (typeof data.url != "undefined" && data.url != "") dataMap.url = data.url; 683 if (typeof data.logo != "undefined" && data.logo != "") dataMap.logo = data.logo; 684 if (typeof data.size != "undefined" && typeof data.size.width != "undefined" && data.size.width != "") dataMap.sizeWidth = data.size.width; 685 if (typeof data.size != "undefined" && typeof data.size.height != "undefined" && data.size.height != "") dataMap.sizeHeight = data.size.height; 686 if (typeof data.scale != "undefined" && typeof data.scale.width != "undefined" && data.scale.width != "") dataMap.scaleWidth = data.scale.width; 687 if (typeof data.scale != "undefined" && typeof data.scale.height != "undefined" && data.scale.height != "") dataMap.scaleHeight = data.scale.height; 688 if (typeof data.origin != "undefined" && typeof data.origin.x != "undefined" && data.origin.x != "") dataMap.originX = data.origin.x; 689 if (typeof data.origin != "undefined" && typeof data.origin.y != "undefined" && data.origin.y != "") dataMap.originY = data.origin.y; 690 if (typeof data.anchor != "undefined" && typeof data.anchor.x != "undefined" && data.anchor.x != "") dataMap.anchorX = data.anchor.x; 691 if (typeof data.anchor != "undefined" && typeof data.anchor.y != "undefined" && data.anchor.y != "") dataMap.anchorY = data.anchor.y; 692 if (typeof data.optimized != "undefined" && data.optimized != "") dataMap.optimized = data.optimized; 693 694 if (typeof data.clickable != "undefined" && data.clickable != "") dataMap.clickable = data.clickable; 695 if (typeof data.html != "undefined" && data.html != "") dataMap.html = data.html; 696 if (typeof data.hover != "undefined" && typeof data.hover == "boolean") dataMap.hover = data.hover; 697 698 if (typeof data.multi != "undefined" && Object.keys(data.multi).length > 0) dataMap.multi = data.multi; 699 700 if (typeof data.styles != "undefined") dataMap.styles = data.styles; 701 else if (typeof data.style != "undefined") { 702 dataMap.style = {}; 703 if (typeof data.style.hue != "undefined") dataMap.style.hue = data.style.hue; 704 if (typeof data.style.gamma != "undefined") dataMap.style.gamma = data.style.gamma; 705 if (typeof data.style.lightness != "undefined") dataMap.style.lightness = data.style.lightness; 706 if (typeof data.style.saturation != "undefined") dataMap.style.saturation = data.style.saturation; 707 } 708 // END: configs default 709 710 dataMap.mapDiv = data.mapDiv; 711 dataMap.latitude = data.latitude; 712 dataMap.longitude = data.longitude; 713 714 if (typeof data.maps != "undefined" && Object.keys(data.maps).length > 0) { // multi map 715 var objMap = {}; 716 if (typeof data.maps[0] == "undefined") objMap[0] = data.maps; // object 717 else objMap = data.maps; // array 718 719 for (var g in objMap) { // loop 720 var obj = objMap[g]; 721 722 // BEGIN: override configs 723 if (typeof obj.zoom != "undefined" && typeof obj.zoom == "number") dataMap.zoom = obj.zoom; 724 if (typeof obj.minZoom != "undefined" && typeof obj.minZoom == "number") dataMap.minZ
724oom = obj.minZoom; 725 if (typeof obj.zoomControl != "undefined" && typeof obj.zoomControl == "boolean") dataMap.zoomControl = obj.zoomControl; 726 if (typeof obj.disableDoubleClickZoom != "undefined" && typeof obj.disableDoubleClickZoom == "boolean") dataMap.disableDoubleClickZoom = obj.disableDoubleClickZoom; 727 if (typeof obj.mapTypeControl != "undefined" && typeof obj.mapTypeControl == "boolean") dataMap.mapTypeControl = obj.mapTypeControl; 728 if (typeof obj.scaleControl != "undefined" && typeof obj.scaleControl == "boolean") dataMap.scaleControl = obj.scaleControl; 729 if (typeof obj.scrollwheel != "undefined" && typeof obj.scrollwheel == "boolean") dataMap.scrollwheel = obj.scrollwheel; 730 if (typeof obj.panControl != "undefined" && typeof obj.panControl == "boolean") dataMap.panControl = obj.panControl; 731 if (typeof obj.streetViewControl != "undefined" && typeof obj.streetViewControl == "boolean") dataMap.streetViewControl = obj.streetViewControl; 732 if (typeof obj.draggable != "undefined" && typeof obj.draggable == "boolean") dataMap.draggable = obj.draggable; 733 if (typeof obj.overviewMapControl != "undefined" && typeof obj.overviewMapControl == "boolean") dataMap.overviewMapControl = obj.overviewMapControl; 734 735 if (typeof obj.styles != "undefined") dataMap.styles = obj.styles; 736 else if (typeof obj.style != "undefined") { 737 dataMap.style = {}; 738 if (typeof obj.style.hue != "undefined") dataMap.style.hue = obj.style.hue; 739 if (typeof obj.style.gamma != "undefined") dataMap.style.gamma = obj.style.gamma; 740 if (typeof obj.style.lightness != "undefined") dataMap.style.lightness = obj.style.lightness; 741 if (typeof obj.style.saturation != "undefined") dataMap.style.saturation = obj.style.saturation; 742 } 743 744 if (typeof obj.name != "undefined" && obj.name != "") dataMap.name = obj.name; 745 if (typeof obj.desc != "undefined" && obj.desc != "") dataMap.desc = obj.desc; 746 if (typeof obj.tel != "undefined" && obj.tel != "") dataMap.tel = obj.tel; 747 if (typeof obj.email != "undefined" && obj.email != "") dataMap.email = obj.email; 748 if (typeof obj.url != "undefined" && obj.url != "") dataMap.url = obj.url; 749 if (typeof obj.logo != "undefined" && obj.logo != "") dataMap.logo = obj.logo; 750 if (typeof obj.sizeWidth != "undefined" && obj.sizeWidth != "") dataMap.sizeWidth = obj.sizeWidth; 751 if (typeof obj.sizeHeight != "undefined" && obj.sizeHeight != "") dataMap.sizeHeight = obj.sizeHeight; 752 if (typeof obj.scaleWidth != "undefined" && obj.scaleWidth != "") dataMap.scaleWidth = obj.scaleWidth; 753 if (typeof obj.scaleHeight != "undefined" && obj.scaleHeight != "") dataMap.scaleHeight = obj.scaleHeight; 754 if (typeof obj.originX != "undefined" && obj.originX != "") dataMap.originX = obj.originX; 755 if (typeof obj.originY != "undefined" && obj.originY != "") dataMap.originY = obj.originY; 756 if (typeof obj.anchorX != "undefined" && obj.anchorX != "") dataMap.anchorX = obj.anchorX; 757 if (typeof obj.anchorY != "undefined" && obj.anchorY != "") dataMap.anchorY = obj.anchorY; 758 if (typeof obj.optimized != "undefined" && obj.optimized != "") dataMap.optimized = obj.optimized; 759 // END: override configs 760 761 if (typeof obj.clickable != "undefined" && obj.clickable != "") dataMap.clickable = obj.clickable; 762 if (typeof obj.html != "undefined" && obj.html != "") dataMap.html = obj.html; 763 if (typeof obj.hover != "undefined" && typeof obj.hover == "boolean") dataMap.hover = obj.hover; 764 if (typeof obj.multi != "undefined" && Object.keys(obj.multi).length > 0) dataMap.multi = obj.multi; 765 766 dataMap.mapDiv = obj.mapDiv; 767 dataMap.latitude = obj.latitude; 768 dataMap.longitude = obj.longitude; 769 770 if (typeof obj.center != "undefined") { 771 dataMap.center = {}; 772 if (typeof obj.center.latitude != "undefined") dataMap.center.latitude = obj.center.latitude; 773 if (typeof obj.center.longitude != "undefined") dataMap.center.longitude = obj.center.longitude; 774 } else { 775 dataMap.center = { 776 latitude: obj.latitude, 777 longitude: obj.longitude 778 }; 779 } 780 781 loadMap(dataMap); 782 } 783 } else { // single map 784 if (typeof data.center != "undefined") { 785 dataMap.center = {}; 786 if (typeof data.center.latitude != "undefined") dataMap.center.latitude = data.center.latitude; 787 if (typeof data.center.longitude != "undefined") dataMap.center.longitude = data.center.longitude; 788 } else { 789 dataMap.center = { 790 latitude: data.latitude, 791 longitude: data.longitude 792 }; 793 } 794 795 loadMap(dataMap); 796 } 797 798 return dataMap; 799 } 800 801 function loadMap(data) { 802 var elm = data.mapDiv; 803 804 elm = elm.substring(0, 1) == "#" ? elm.substring(1) : elm; // remove hash 805 806 var mapElement = document.getElementById(elm), 807 styleOptions = [], 808 mapOptions = { 809 center: new google.maps.LatLng(data.center.latitude, data.center.longitude), 810 zoom: data.zoom, 811 minZoom: data.minZoom, 812 zoomControl: data.zoomControl, 813 zoomControlOptions: { 814 style: google.maps.ZoomControlStyle.DEFAULT, 815 }, 816 disableDoubleClickZoom: data.disableDoubleClickZoom, 817 scaleControl: data.scaleControl, 818 scrollwheel: data.scrollwheel, 819 panControl: data.panControl, 820 streetViewControl: data.streetViewControl, 821 draggable: data.draggable, 822 mapTypeControl: data.mapTypeControl, 823 mapTypeControlOptions: { 824 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, 825 }, 826 mapTypeId: google.maps.MapTypeId.ROADMAP, 827 overviewMapControl: data.overviewMapControl, 828 overviewMapControlOptions: { 829 opened: false, 830 } 831 }, 832 googleMap = new google.maps.Map(mapElement, mapOptions); 833 834 if (data.multi === false) { 835 var arr = {}; 836 837 if (typeof data["name"] != "undefined") arr["name"] = data["name"];
838 if (typeof data["desc"] != "undefined") arr["desc"] = data["desc"]; 839 if (typeof data["tel"] != "undefined") arr["tel"] = data["tel"]; 840 if (typeof data["email"] != "undefined") arr["email"] = data["email"]; 841 if (typeof data["url"] != "undefined") arr["url"] = data["url"]; 842 if (typeof data["logo"] != "undefined") arr["logo"] = data["logo"]; 843 if (typeof data["sizeWidth"] != "undefined") arr["sizeWidth"] = data["sizeWidth"]; 844 if (typeof data["sizeHeight"] != "undefined") arr["sizeHeight"] = data["sizeHeight"]; 845 if (typeof data["scaleWidth"] != "undefined") arr["scaleWidth"] = data["scaleWidth"]; 846 if (typeof data["scaleHeight"] != "undefined") arr["scaleHeight"] = data["scaleHeight"]; 847 if (typeof data["originX"] != "undefined") arr["originX"] = data["originX"]; 848 if (typeof data["originY"] != "undefined") arr["originY"] = data["originY"]; 849 if (typeof data["anchorX"] != "undefined") arr["anchorX"] = data["anchorX"]; 850 if (typeof data["anchorY"] != "undefined") arr["anchorY"] = data["anchorY"]; 851 if (typeof data["optimized"] != "undefined") arr["optimized"] = data["optimized"]; 852 if (typeof data["clickable"] != "undefined") arr["clickable"] = data["clickable"]; 853 if (typeof data["html"] != "undefined") arr["html"] = data["html"]; 854 if (typeof data["hover"] != "undefined") arr["hover"] = data["hover"]; 855 856 arr["longitude"] = data["longitude"]; 857 arr["latitude"] = data["latitude"]; 858 859 setMaps(arr, googleMap, data.center); 860 } else { 861 for (var i = 0; i < Object.keys(data.multi).length; i++) { 862 var arr = data.multi[i]; 863 864 if (typeof data["clickable"] != "undefined") arr["clickable"] = data.clickable; 865 if (typeof data["html"] != "undefined") arr["html"] = data.html; 866 if (typeof data["hover"] != "undefined") arr["hover"] = data.hover; 867 868 if (typeof arr["size"] != "undefined") { 869 if (typeof arr["size"]["width"] != "undefined") arr["sizeWidth"] = arr["size"]["width"]; 870 if (typeof arr["size"]["height"] != "undefined") arr["sizeHeight"] = arr["size"]["height"]; 871 872 delete arr["size"]; 873 } 874 if (typeof arr["scale"] != "undefined") { 875 if (typeof arr["scale"]["width"] != "undefined") arr["scaleWidth"] = arr["scale"]["width"]; 876 if (typeof arr["scale"]["height"] != "undefined") arr["scaleHeight"] = arr["scale"]["height"]; 877 878 delete arr["scale"]; 879 } 880 if (typeof arr["origin"] != "undefined") { 881 if (typeof arr["origin"]["x"] != "undefined") arr["originX"] = arr["origin"]["x"]; 882 if (typeof arr["origin"]["y"] != "undefined") arr["originY"] = arr["origin"]["y"]; 883 884 delete arr["origin"]; 885 } 886 if (typeof arr["anchor"] != "undefined") { 887 if (typeof arr["anchor"]["x"] != "undefined") arr["anchorX"] = arr["anchor"]["x"]; 888 if (typeof arr["anchor"]["y"] != "undefined") arr["anchorY"] = arr["anchor"]["y"]; 889 890 delete arr["anchor"]; 891 } 892 if (typeof arr["optimized"] != "undefined") arr["optimized"] = arr["optimized"]; 893 setMaps(arr, googleMap, data.center); 894 } 895 } 896 897 // stylers 898 if (data.styles !== false) styleOptions = data.styles; 899 else if (data.style !== false) { 900 if (typeof data.style.hue != "undefined" || typeof data.style.gamma != "undefined" || typeof data.style.lightness != "undefined" || typeof data.style.saturation != "undefined") { 901 if (typeof styleOptions[0] == "undefined") styleOptions[0] = {}; 902 if (typeof styleOptions[0].stylers == "undefined") styleOptions[0].stylers = []; 903 } 904 905 if (typeof data.style.hue != "undefined") { 906 styleOptions[0].stylers.push({ 907 hue: data.style.hue 908 }); 909 } 910 if (typeof data.style.gamma != "undefined") { 911 styleOptions[0].stylers.push({ 912 gamma: data.style.gamma 913 }); 914 } 915 if (typeof data.style.lightness != "undefined") { 916 styleOptions[0].stylers.push({ 917 lightness: data.style.lightness 918 }); 919 } 920 if (typeof data.style.saturation != "undefined") { 921 styleOptions[0].stylers.push({ 922 saturation: data.style.saturation 923 }); 924 } 925 } 926 927 var styledMapOptions = { 928 name: "MAP" 929 }, 930 sampleType = new google.maps.StyledMapType(styleOptions, styledMapOptions); 931 932 googleMap.mapTypes.set("sample", sampleType); 933 googleMap.setMapTypeId("sample"); 934 935 // force reset 936 googleMap.setZoom(data.zoom); 937 googleMap.setCenter(new google.maps.LatLng(data.center.latitude, data.center.longitude)); 938 } 939 function setMaps(obj, map, center) { 940 var options = {}; 941 942 if (obj["html"] !== false) { 943 if (typeof obj["name"] != "undefined") options["title"] = obj["name"]; 944 if (typeof obj["desc"] != "undefined") options["desc"] = obj["desc"]; 945 if (typeof obj["tel"] != "undefined") options["tel"] = obj["tel"]; 946 if (typeof obj["email"] != "undefined") options["email"] = obj["email"]; 947 if (typeof obj["url"] != "undefined") options["web"] = obj["url"]; 948 } 949 950 if (typeof obj["logo"] != "undefined") { 951 var optIcon = {}; 952 953 optIcon["url"] = obj["logo"]; 954 955 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"]); 956 957 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"]); 958 959 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"]); 960 961 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"]); 962 963 if (typeof obj["optimized"] != "undefined") optIcon["optimized"] = obj["optimized"]; 964 965 if (typeof optIcon["size"] != "undefined" && typeof optIcon["origin"] != "undefined" && typeof optIcon["anchor"] != "undefined") options["icon"] = optIcon; 966 else options["icon"] = obj["logo"] ? new google.maps.MarkerImage(obj["logo"]) : null; 967 } 968 969 options["position"] = new google.maps.LatLng(obj["latitude"], obj["longitude"]); 970 options["map"] = map; 971 972 var marker = new google.maps.Marker(options); 973 gmarkers[gnum] = marker; 974 gnum++; 975 976 if (obj["clickable"] == "js") { 977 google.maps.event.addListener(marker, "click", function() { 978 if (obj["click"].constructor == Function) obj["click"].apply(this, [].concat(Array.prototype.slice.call(arguments))); 979 }); 980 } 981 982 if (obj["html"] !== false) { 983 var dialog = new google.maps.InfoWindow(), 984 infoWindowVisible = (function() { 985 var currentlyVisible = false;
986 return function(visible) { 987 for (var z in visible) { 988 if (/closure_uid/i.test(z)) { 989 currentlyVisible = visible[z]; 990 991 break; 992 } 993 } 994 995 return currentlyVisible; 996 997 998 if (visible !== undefined) currentlyVisible = visible; 999 return currentlyVisible; 1000 }; 1001 }()), 1002 dialogShow = (function() { 1003 return function() { 1004 var vCheck = infoWindowVisible(marker); 1005 if (vCheck == _dialogsOpen_) { 1006 dialog.close(); 1007 _dialogsOpen_ = true; 1008 } else { 1009 var tpl = {}; 1010 tpl["name"] = typeof obj["name"] != "undefined" ? obj["name"] : ""; 1011 tpl["desc"] = typeof obj["desc"] != "undefined" ? obj["desc"] : ""; 1012 tpl["tel"] = typeof obj["tel"] != "undefined" ? obj["tel"] : ""; 1013 tpl["email"] = typeof obj["email"] != "undefined" ? obj["email"] : ""; 1014 tpl["url"] = typeof obj["url"] != "undefined" ? obj["url"] : ""; 1015 1016 var html = 1017 obj["html"] 1018 .replace(/{name}/ig, tpl["name"]) 1019 .replace(/{title}/ig, tpl["name"]) 1020 1021 .replace(/{txt}/ig, tpl["desc"]) 1022 .replace(/{text}/ig, tpl["desc"]) 1023 .replace(/{desc}/ig, tpl["desc"]) 1024 .replace(/{description}/ig, tpl["desc"]) 1025 1026 .replace(/{tel}/ig, tpl["tel"]) 1027 .replace(/{telephone}/ig, tpl["tel"]) 1028 .replace(/{phone}/ig, tpl["tel"]) 1029 .replace(/{moible}/ig, tpl["tel"]) 1030 1031 .replace(/{mail}/ig, tpl["email"]) 1032 .replace(/{email}/ig, tpl["email"]) 1033 1034 .replace(/{url}/ig, tpl["url"]) 1035 .replace(/{web}/ig, tpl["url"]) 1036 .replace(/{website}/ig, tpl["url"]); 1037 1038 _dialogs_.forEach(function(d, ix) { 1039 google.maps.event.trigger(d, "closeclick"); 1040 d.close(map, marker); 1041 }); 1042 1043 dialog = new google.maps.InfoWindow({ 1044 content: html 1045 }); 1046 1047 // reset 1048 _dialogs_ = []; 1049 _dialogs_.push(dialog); 1050 1051 dialog.open(map, marker); 1052 _dialogsOpen_ = vCheck; 1053 } 1054 }; 1055 }()); 1056 1057 // _dialogs_.push(dialog); 1058 1059 // events 1060 google.maps.event.addListener(marker, "click", function() { 1061 if (obj["clickable"] == "link" && typeof obj["url"] != "undefined" && obj["url"] != "") { 1062 if (!isExternal(obj["url"]) && $(obj["url"]).length) { 1063 $("html, body").stop().animate({ 1064 scrollTop: $(obj["url"]).offset().top 1065 }, 500); 1066 } else window.open(obj["url"], "_parent"); 1067 } else if (obj["clickable"] == "popup" && isHTML(obj.html)) { 1068 map.panTo(marker.getPosition()); 1069 dialogShow(); 1070 } 1071 }); 1072 google.maps.event.addListener(dialog, "closeclick", function() { 1073 infoWindowVisible(marker); 1074 }); 1075 1076 if (obj["hover"] === true && obj["clickable"] == "link") { 1077 google.maps.event.addListener(marker, "mouseover", function() { 1078 dialogShow(); 1079 }); 1080 1081 google.maps.event.addListener(marker, "mouseout", function() { 1082 dialog.close(); 1083 infoWindowVisible(false); 1084 }); 1085 } 1086 } 1087 1088 /* 1089 window.onresize = function(event) { 1090 google.maps.event.trigger(map, "resize"); 1091 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1092 }; 1093 */ 1094 1095 // always center 1096 google.maps.event.addDomListener(window, "resize", function() { 1097 var center = map.getCenter(); 1098 google.maps.event.trigger(map, "resize"); 1099 // map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1100 map.setCenter(center); 1101 }); 1102 1103 google.maps.event.addListenerOnce(map, "idle", function() { 1104 google.maps.event.trigger(map, "resize"); 1105 map.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); 1106 }); 1107 1108 // google.maps.event.trigger(map, "resize"); // onload 1109 1110 $(window).resize(function() { 1111 google.maps.event.trigger(map, "resize"); 1112 }); 1113 } 1114 } 1115 google.maps.event.addDomListener(window, "load", init); 1116 } 1117 // END: gmap 1118 1119 // BEGIN: rollover button 1120 $("body").on({ 1121 click: function() { 1122 $(this).parents(".bxSlider-pager").find("img.btn").trigger("mouseout"); 1123 1124 $(this).trigger("mouseout").trigger("mouseover"); 1125 }, 1126 touchstart: function() { 1127 $(this).trigger("click"); 1128 }, 1129 mouseover: function() { 1130 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr("src")); 1131 1132 $(this).attr("src").match(/^(.*)(\.{1}.*)/g); 1133 1134 var $src = RegExp.$1 + "_on" + RegExp.$2; 1135 1136 $(this).attr("src", $src); // update src 1137 }, 1138 mouseout: function() { 1139 if ($(this).hasClass("copy-change")) { 1140 var _src_ = $(this).attr("src"); 1141 1142 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1143 1144 $(this) 1145 .attr("src", _src_) // update src 1146 .removeClass("copy-change"); 1147 } else if ($(this).data("src-original")) $(this).attr("src", $(this).data("src-original")); // update src 1148 1149 $(this).removeData("src-original"); 1150 } 1151 }, "img.btn"); 1152 1153 $("body").on({ 1154 click: function() { 1155 $(this).parents(".bxSlider-pager").find("picture.btn").trigger("mouseout"); 1156 1157 $(this).trigger("mouseout").trigger("mouseover"); 1158 }, 1159 touchstart: function() { 1160 $(this).trigger("click"); 1161 }, 1162 mouseover: function() { 1163 $(this).children().each(function() { 1164 var _attr_ = false;
1165 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1166 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1167 1168 if (_attr_ && $(this).attr(_attr_)) { 1169 if (!$(this).data("src-original")) $(this).data("src-original", $(this).attr(_attr_)); 1170 1171 $(this).attr(_attr_).match(/^(.*)(\.{1}.*)/g); 1172 1173 var $src = RegExp.$1 + "_on" + RegExp.$2; 1174 1175 $(this).attr(_attr_, $src); // update src 1176 } 1177 }); 1178 }, 1179 mouseout: function() { 1180 var $picture = $(this); 1181 1182 $picture.children().each(function() { 1183 var _attr_ = false; 1184 if ($(this).prop("tagName").toLowerCase() == "img") _attr_ = "src"; 1185 else if ($(this).prop("tagName").toLowerCase() == "source") _attr_ = "srcset"; 1186 1187 if (_attr_ && $(this).attr(_attr_)) { 1188 if ($picture.hasClass("copy-change")) { 1189 var _src_ = $(this).attr(_attr_); 1190 1191 _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 1192 1193 $(this) 1194 .attr(_attr_, _src_) // update src 1195 .removeClass("copy-change"); 1196 } else if ($(this).data("src-original")) $(this).attr(_attr_, $(this).data("src-original")); // update src 1197 1198 $(this).removeData("src-original"); 1199 } 1200 }); 1201 } 1202 }, "picture.btn"); 1203 // END: rollover button 1204 1205 // BEGIN: smooth scroll 1206 $("body").on("click", "a[href*='#']:not([href='#'])", function(e) { 1207 // .nav-fixed: elm sẽ cá» Äá»nh 1208 // .nav-target: tá»a Äá» sẽ tÃnh 1209 // .nav-pin: elm sẽ gắn .fixed 1210 if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname && !$(this).hasClass("unsmooth")) { 1211 var ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g, 1212 hash = this.hash.replace(ptnHash, "\\$1"), 1213 $anchor = $(hash); 1214 1215 $anchor = $anchor.length > 0 ? $anchor : $("[name=" + hash.slice(1) +"]"); 1216 1217 if ($anchor.length) { 1218 e.preventDefault(); 1219 1220 if ($anchor.parents(".tab-content").first().length > 0) $anchor = $anchor.parents(".tab-content").first(); 1221 1222 var $offsetY = $anchor.offset().top, 1223 $navOffset = 0; 1224 1225 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1226 1227 if ($(".tabs-switch").length) { 1228 $(".tabs-switch").each(function() { 1229 var $tabsSwitch = $(this), 1230 $tabLink = $tabsSwitch.children(".tab-link"); 1231 1232 if ($tabLink.children("[data-tab-anchor='" + hash + "']").length) $tabLink.children("[data-tab-anchor='" + hash + "']").click(); // trigger for set active tab 1233 }); 1234 } 1235 1236 if ($(".nav-target").length) { 1237 // $("html, body").stop().animate({ 1238 // scrollTop: $(".nav-target").offset().top + 10 1239 // }, 100, function() { 1240 if ($(".nav-fixed").length) $navOffset = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height")) : $(".nav-fixed").outerHeight(); 1241 1242 $("html, body").stop().animate({ 1243 scrollTop: $offsetY - $navOffset 1244 }, 500); 1245 // }); 1246 } else { 1247 $("html, body").stop().animate({ 1248 scrollTop: $offsetY - $navOffset 1249 }, 500); 1250 } 1251 1252 // window.location.hash = hash; // update location 1253 1254 return false; 1255 } 1256 } 1257 }); 1258 // END: smooth scroll 1259 1260 // BEGIN: scroll to top 1261 if ($(window).scrollTop() > 0) $("#pagetop").addClass("visible"); 1262 else $("#pagetop").removeClass("visible"); 1263 1264 $("body").on("click", "#pagetop", function() { 1265 if (!$(this).hasClass("in-scroll")) { 1266 $(this).addClass("in-scroll"); 1267 1268 var $scrollDuration = $.inArray($(this).attr("data-duration"), ["slow", "normal", "fast"]) >= 0 || parseInt($(this).attr("data-duration")) > 0 ? $(this).attr("data-duration") : "slow"; 1269 1270 $("html, body").stop().animate({ 1271 scrollTop: 0 1272 }, $scrollDuration, function() { 1273 $("#pagetop").removeClass("in-scroll"); 1274 }); 1275 } 1276 }); 1277 // END: scroll to top 1278 1279 // BEGIN: text vertical 1280 $(".txt-vertical").each(function() { 1281 if (!$(this).hasClass("all-str")) { 1282 var $regex = /(\d{1,2})/g; 1283 1284 if ($(this).hasClass("per-line")) $regex = /(\d)/g; 1285 1286 $(this).html(function(idx, val) { 1287 return val.replace($regex, '<span class="int">$1</span>'); 1288 }); 1289 } 1290 1291 if ($(this).children(".txt-normal").length) { 1292 $(this).children(".txt-normal").html(function(idx, val) { 1293 var $characters = $.trim(val).split(""); 1294 return '<span class="int">' + $characters.join('</span><span class="int">') + '</span>'; 1295 }); 1296 } 1297 }); 1298 $(".txt-vertical-x").each(function() { 1299 $(this).html($(this).text().replace(/(.)/g, "<span>$1</span>")); 1300 }); 1301 // END: text vertical 1302 1303 // BEGIN: social button 1304 var __socialsHTML__ = "", 1305 __socialsLang = $("html").attr("lang") !== undefined && $.trim($("html").attr("lang")).length == 2 ? $.trim($("html").attr("lang")).toLowerCase() : "ja", 1306 $socialsLine = "", 1307 $socialsTwitter = "", 1308 $socialsFacebook = "", 1309 $socialsGooglePlus = "", 1310 locationURL = window.location.href || location.href; 1311 1312 $socialsTwitter += '<div class="social-twitter">'; 1313 $socialsTwitter += '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>'; 1314 $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>'; 1315 $socialsTwitter += '</div>'; 1316 1317 $socialsFacebook += '<div class="social-facebook">'; 1318 $socialsFacebook += '<div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>'; 1319 $socialsFacebook += '</div>'; 1320 1321 $socialsGooglePlus += '<div class="social-google">'; 1322 $socialsGooglePlus += '<div class="g-plusone" data-size="medium"></div>'; 1323 $socialsGooglePlus += '</div>'; 1324 1325 $socialsLine += '<div class="social-line">'; 1326 $socialsLine += '<div class="line-it-button" data-lang="' + __socialsLang + '" data-type="like" data-url="' + locationURL + '" data-share="true" style="display: none;">'; 1327 $socialsLine += '<script src="https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js" async="async" defer="defer"></script>'; 1328 $socialsLine += '</div>'; 1329 $socialsLine += '</div>'; 1330 1331 if ($("#socialbuttons").length) { 1332 var $socialsOrder = typeof $("#socialbuttons").attr("data") != "undefined" ? $("#socialbuttons").attr("data").split("") : false;
1333 1334 if (typeof $socialsOrder == "object" && $socialsOrder.length) { 1335 for (var socialsType in $socialsOrder) { 1336 if ($.trim(socialsType).length > 0) { 1337 socialsType = socialsType.toLowerCase(); 1338 1339 if ($socialsOrder[socialsType].toLocaleLowerCase() === "f") __socialsHTML__ += $socialsFacebook; 1340 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "t") __socialsHTML__ += $socialsTwitter; 1341 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "g") __socialsHTML__ += $socialsGooglePlus; 1342 else if ($socialsOrder[socialsType].toLocaleLowerCase() === "l") __socialsHTML__ += $socialsLine; 1343 } 1344 } 1345 } else { 1346 __socialsHTML__ += $socialsTwitter; 1347 __socialsHTML__ += $socialsFacebook; 1348 __socialsHTML__ += $socialsGooglePlus; 1349 __socialsHTML__ += $socialsLine; 1350 } 1351 1352 $("#socialbuttons").html(__socialsHTML__); 1353 } 1354 // END: social button 1355 1356 /* fix smoothscroll on IE - jumpy fixed background */ 1357 if (navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { 1358 $("body.ie-smoothscroll") 1359 .on("mousewheel", function (e) { 1360 if (event.preventDefault) event.preventDefault(); 1361 else event.returnValue = false; 1362 1363 var delta = null, 1364 offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft, 1365 offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop; 1366 1367 if (e.wheelDelta) delta = e.wheelDelta; 1368 else if (e.originalEvent) { 1369 if (e.originalEvent.wheelDelta) delta = e.originalEvent.wheelDelta; 1370 else if (e.originalEvent.deltaY) delta = 0 - e.originalEvent.deltaY; 1371 else if (e.originalEvent.detail) delta = e.originalEvent.detail * -40; 1372 } else if (event.originalEvent) { 1373 if (event.originalEvent.wheelDelta) delta = event.originalEvent.wheelDelta; 1374 else if (event.originalEvent.deltaY) delta = 0 - event.originalEvent.deltaY; 1375 else if (event.originalEvent.detail) delta = event.originalEvent.detail * -40; 1376 } 1377 1378 if (delta !== null) window.scrollTo(0, offsetY - delta); 1379 }); 1380 } 1381 1382 // scrollBefore(); // smoothscroll before page loaded 1383 1384 $("body").on({ 1385 mouseup: function() { 1386 // $("html").addClass("break-jump"); 1387 $(this).removeClass("scrollable"); 1388 }, mousedown: function() { 1389 // $("html").addClass("break-jump"); 1390 $(this).addClass("scrollable"); 1391 }, mouseleave: function() { 1392 // $("html").addClass("break-jump"); 1393 $(this).removeClass("scrollable"); 1394 } 1395 }, ".gmap"); 1396 1397}); 1398 1399// user agents 1400var isMobile = { 1401 Android: function() { 1402 return navigator.userAgent.match(/Android/i); 1403 }, 1404 BlackBerry: function() { 1405 return navigator.userAgent.match(/BlackBerry/i); 1406 }, 1407 iOS: function() { 1408 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 1409 }, 1410 Opera: function() { 1411 return navigator.userAgent.match(/Opera Mini/i); 1412 }, 1413 Windows: function() { 1414 return navigator.userAgent.match(/IEMobile/i); 1415 }, 1416 any: function() { 1417 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 1418 } 1419}; 1420 1421var fbTimer = null, 1422 fbCodes = {}, 1423 fbPage = document.querySelectorAll(".fb-page"); 1424 1425if (fbPage.length > 0) { 1426 for (var i in fbPage) { 1427 if (fbPage[i].constructor === HTMLDivElement) fbCodes[i] = fbPage[i].outerHTML; 1428 } 1429} 1430 1431$(window).resize(function() { 1432 // fix bg parallax on mobile 1433 if (isMobile.any()) $(".bg-parallax").css("background-attachment", "inherit"); 1434 else $(".bg-parallax").css("background-attachment", ""); 1435 1436}).on("scroll resize", function() { 1437 if ($(this).scrollTop() > 0) $("#pagetop").addClass("visible"); 1438 else $("#pagetop").removeClass("visible"); 1439 1440 if ($(".nav-fixed").length) { 1441 var $navPinY = $(".nav-target").length ? $(".nav-target").offset().top - $(".nav-fixed").outerHeight() - 1 : $(".nav-fixed").offset().top; 1442 if ($(this).scrollTop() > $navPinY || ($navPinY < 0 && $(this).scrollTop() > 0)) { 1443 if ($(".nav-pin").length) $(".nav-pin").addClass("fixed"); 1444 else $(".nav-fixed").addClass("fixed"); 1445 } else { 1446 if ($(".nav-pin").length) $(".nav-pin").removeClass("fixed"); 1447 else $(".nav-fixed").removeClass("fixed"); 1448 } 1449 } 1450}).on("load", function() { 1451 // scrollBefore(); 1452}); 1453 1454var scrollBefore = function() { 1455 var hash = window.location.hash || location.hash, 1456 ptnHash = /([;
1456?%&,+*~\':"!^$[\]()=>|\/@])/g; 1457 1458 if (hash) { 1459 hash = hash.replace(ptnHash, "\\$1"); 1460 if ($(hash).length > 0) { 1461 if ($(".tabs-switch").length > 0) { 1462 if ($(hash).length > 0 && $(hash).parents(".tab-content").first().length > 0) { 1463 var tabChild = $(hash); 1464 $(hash).parents().each(function() { 1465 if ($(this).attr("class") !== undefined && $.inArray("tab-content", $(this).attr("class").split(" ")) >= 0) return false; 1466 else tabChild = $(this); 1467 }); 1468 1469 setTimeout(function() { 1470 tabChild.parents(".tabs-switch").first().children(".tab-link").children().eq(tabChild.index()).click(); // trigger tab in multiple dim 1471 }, 10); 1472 } else { 1473 $(".tabs-switch").each(function() { 1474 var $tabLink = $(this).children(".tab-link"); 1475 1476 if ($tabLink.children(hash).length > 0) { 1477 setTimeout(function() { 1478 $tabLink.children(hash).click(); // trigger for set active tab 1479 }, 10); 1480 } 1481 }); 1482 } 1483 } 1484 1485 1486 if ($(".bxSlider").length > 0) $(window).trigger("resize"); 1487 1488 setTimeout(function() { 1489 if ($(".nav-fixed").length > 0) { 1490 var offsetY = $(hash).offset().top, 1491 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 1492 1493 // if ($(".nav-pin").length > 0) offsetY -= $(".nav-pin").outerHeight(); 1494 1495 window.scroll(0, offsetY - navHeight); 1496 1497 // re-updated offset 1498 if ($(".nav-target").length > 0) { 1499 var reupdated = true; 1500 $(window).scroll(function() { 1501 if (reupdated && $(this).scrollTop() >= $(".nav-target").offset().top) { 1502 reupdated = false; 1503 1504 navHeight = typeof $(".nav-fixed").attr("data-height") != "undefined" ? parseInt($(".nav-fixed").attr("data-height"), 10) : $(".nav-fixed").outerHeight(); 1505 1506 window.scroll(0, $(hash).offset().top - navHeight); 1507 } 1508 }); 1509 } 1510 } else window.scrollTo(0, $(hash).offset().top); 1511 }, 10); 1512 1513 $("a[href='" + hash + "']").click(); 1514 } // else window.scrollTo(0, _offsetY); 1515 } 1516}; 1517 1518scrollBefore(); // DOM loaded 1519 1520 1521 1522/* 1523 * Plugins/Functions 1524 * 1525 */ 1526 1527// check object is variable or DOM elements 1528function isObjectVar(obj) { 1529 return ((typeof obj != "undefined") && (typeof obj === "object") && (obj.nodeType !== 1) && (typeof obj.ownerDocument !== "object")); 1530} 1531 1532(function($) { 1533 // BEGIN: $.feed 1534 $.fn.feed = function (option, callbacks) { 1535 var option = $.extend({ 1536 Path : "", 1537 BOX : $(this), 1538 key : 0, 1539 MAX : 5, 1540 titleMax : 40, 1541 postMax : 100, 1542 endtext : "...", 1543 indention : "no", 1544 Datetype : { year: "å¹´", month: "æÅË", date: "æâÂ¥" }, 1545 Image : "no", 1546 ImageSize : { width: "200", height: "150"}, //表示ãÂâ¢Ã£ââ¹Ã§âȌÆÂã®ãâµãâ¤ã⺠1547 noImage : "no", 1548 noImage_src : "shared/img/shared/no_image.jpg", 1549 source : "", 1550 done : false 1551 }, option); 1552 1553 $.support.cors = true; // fixed no transport error 1554 $.ajax({ 1555 url: option["Path"], 1556 crossDomain: true, 1557 cache: false, 1558 async: false, 1559 type: "POST", 1560 dataType: "xml", 1561 data: { 1562 key: option["key"] 1563 }, 1564 error: function(jqXHR, textStatus, errorThrown) { 1565 console.log(textStatus + ": " + errorThrown); 1566 1567 return false; 1568 }, success: function(data) { 1569 var cnt = 0, 1570 imgTbl = [], 1571 img = "", 1572 src = "", 1573 ss = "", 1574 category = "", // FCV - added 1575 author = "", // FCV - added 1576 html = ""; 1577 1578 $(option["BOX"]["selector"]).empty(); // clear template - FCV added 1579 1580 //è¦Âç´ ãââÃ¥â¦Â¨Ã£Â¦éâ¦ÂÃ¥Ëâã« 1581 $(data).find("item").each(function(){ 1582 var title = $("title",this).text(), //ãâ¿ãâ¤ãÆËãÆÂ« 1583 link = $("link",this).text(), //ãÆÂªÃ£ÆÂ³Ã£â¯åâ¦Ë 1584 category = $("category",this).text(), // FCV - added 1585 author = $("dc\\:creator",this).text(), // FCV - added 1586 ex = $("description",this).text(); //注éâ¡Ëæââ¡Ã§Â«Â 1587 1588 //æÅ¾ââ¡Ã£Â®ãâ½ãÆÂ¼Ã£â¹ãââ表示ãÂâ¢Ã£ââ¹Ã£Ââ¹Ã£Â©ãÂâ ãÂâ¹ 1589 if(option.indention === "yes") ex = $('content\\:encoded',this).text(); 1590 1591 //ãâ¹ãÆÅ¡Ã£ÆÂ¼Ã£â¹ãââÃ¥â°Å éâ¢Â¤ 1592 ex.replace(/\s+/g, ""); 1593 ex.replace(" ", ""); 1594 1595 //ãâ¿ãâ¤ãÆËãÆÂ«Ã£ÂÅ1è¡Åã«åÂŽã¾ãââ°Ã£ÂªãÂâå ´åÂËãâ¬Â調æâ¢Â´ 1596 if (title.length > option.titleMax) { 1597 var rename = title.substring(0,option.titleMax-1) + option.endtext; 1598 title = rename; 1599 } 1600 1601 //æÅ¾ââ¡Ã£Â®èª¿æâ¢Â´ 1602 if (ex.length > option.postMax) { 1603 var retxt = ex.substring(0,option.postMax-1) + option.endtext; 1604 ex = retxt; 1605 } 1606 1607 //æâ¥ä»ËÃ¥Ââå¾â 1608 // ISO date string - regex 1609 // ^(\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))$ 1610 var pubDate = $("pubDate",this).text().length > 0 ? true : false, 1611 Datetxt = pubDate ? $("pubDate",this).text() : $("dc\\:date",this).text(), 1612 dateISO = pubDate ? new Date() : new Date(Datetxt), 1613 year = pubDate ? Datetxt.substring(12, 16) : dateISO.getMonth() + 1,
1614 month = pubDate ? Datetxt.substring(8, 11) : dateISO.getDate(), 1615 date = pubDate ? Datetxt.substring(5, 7) : dateISO.getFullYear(); 1616 1617 //èâ¹Â±Ã¨ÂªÅ¾Ã¨Â¡Â¨Ã¨Â¨Ëã®æÅËãââæâ¥æÅ¬èªžã«å¤â°Ã¦Â⺠1618 if (month == "Jan") month = "01"; 1619 if (month == "Feb") month = "02"; 1620 if (month == "Mar") month = "03"; 1621 if (month == "Apr") month = "04"; 1622 if (month == "May") month = "05"; 1623 if (month == "Jun") month = "06"; 1624 if (month == "Jul") month = "07"; 1625 if (month == "Aug") month = "08"; 1626 if (month == "Sep") month = "09"; 1627 if (month == "Oct") month = "10"; 1628 if (month == "Nov") month = "11"; 1629 if (month == "Dec") month = "12"; 1630 1631 //æâ¥ä»Ëã®形张1632 date = year + option.Datetype.year + month + option.Datetype.month + date + option.Datetype.date; 1633 1634 //çâȌÆÂã®åÂâå¾â 1635 if(option.Image !== "no") { 1636 1637 ss = $(this).find('[nodeName="content:encoded"]').context.textContent; 1638 html = $.parseHTML( ss ); 1639 1640 imgTbl.length = 0; 1641 1642 1643 var AllImage = $(html).find("img"); 1644 1645 for (i=0, Max=AllImage.length; i<Max; i++) { 1646 //çµµæââ¡Ã¥Ââãââéâ¢Â¤Ã¥Â¤âãÂâ¢Ã£ââ¹ 1647 if (!$(AllImage)[i].src.match("s.w.org")) Array.prototype.push.apply(imgTbl, [$(AllImage)[i].src]); 1648 } 1649 1650 if (imgTbl[0]) src = imgTbl[0]; 1651 else src = option.noImage_src; //no-imageçâȌÆÂ 1652 1653 if (option.noImage === "yes") { 1654 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>'; 1655 } 1656 1657 if (option.noImage === "no") { 1658 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>'; 1659 else img = '<span class="no-image" style="display:none;"></span>'; 1660 } 1661 } 1662 1663 //Ã¥â¡ÂºÃ¥Å âºÃ£Â®ãâ½ãÆÂ¼Ã£â¹ 1664 if(!title.match("PR")) { 1665 var postdata = option.source, 1666 post = postdata(link,title,date,ex,img,category,author,cnt); // FCV - modified 1667 1668 $(option.BOX.selector).append(post); 1669 } 1670 1671 //çµâäºâ ãÆâ¢Ã£ÆÂ©Ã£â° 1672 cnt++; 1673 if(cnt > (option.MAX -1)) return false; 1674 }); 1675 } 1676 }).done(function() { 1677 if (typeof callbacks === "function") callbacks.call(this); 1678 }); 1679 }; 1680 // END: $.feed 1681 1682 // BEGIN: $.fcvScroll 1683 $.fn.fcvScroll = function(options) { 1684 var options = $.extend({ 1685 selector: ".section", // selector 1686 delay: 50, // time delay (ms) 1687 duration: 400, // time duration (ms) 1688 reference: .9, 1689 }, options); 1690 1691 if (options.selector) { 1692 var $wrapper = $(this), 1693 $offsetSelectors = [], 1694 $scrollDown = true, 1695 $scrollPos = $(window).scrollTop(), 1696 $scrollTimer = null; 1697 1698 $wrapper.find(options.selector).each(function(i) { 1699 $offsetSelectors.push($(this).offset().top); // offsetY fined 1700 }); 1701 1702 $(window).scroll(function() { 1703 $scrollDown = $(window).scrollTop() >= $scrollPos; 1704 $scrollPos = $(window).scrollTop(); 1705 1706 clearTimeout($scrollTimer); 1707 1708 if ($.inArray($(window).scrollTop(), $offsetSelectors) < 0) { // not in area fined 1709 $scrollTimer = setTimeout(function() { // fcv-snap 1710 var $scrollTop = $(window).scrollTop(), 1711 $posY = $(window).height() * options.reference, 1712 $position = 0, 1713 $target; 1714 1715 if ($scrollDown) { // direction down 1716 $position = $scrollTop + $posY - 1; 1717 $wrapper.find(options.selector).each(function() { 1718 var $offsetY = $(this).offset().top; 1719 if (($offsetY > $scrollTop) && ($offsetY <= $position)) { 1720 $target = $(this); 1721 return false; 1722 } 1723 }); 1724 } else { // direction up 1725 $position = $scrollTop - $posY + 1; 1726 $wrapper.find(options.selector).each(function() { 1727 var $offsetY = $(this).offset().top; 1728 if (($offsetY < $scrollTop) && ($offsetY >= $position)) { 1729 $target = $(this); 1730 return false;
1731 } 1732 }); 1733 } 1734 1735 if ($target) { 1736 $("html, body").stop().animate({ 1737 scrollTop: $target.offset().top 1738 }, options.duration, function() { 1739 clearTimeout($scrollTimer); 1740 }); 1741 } 1742 }, options.delay); 1743 } 1744 }).resize(function() { 1745 if ($(options.selector).hasClass("minHeight")) { 1746 $(options.selector).css({ 1747 minHeight: $(window).height() 1748 }); 1749 } else { 1750 $(options.selector).css({ 1751 height: $(window).height() 1752 }); 1753 } 1754 }).trigger("resize"); 1755 } else console.error("Missing selector"); 1756 1757 return this; 1758 }; 1759 // END: $.fcvScroll 1760})(jQuery); 1761 1762var gmarkers = [], 1763 gnum = 0; 1764 1765 1766 1767// BEGIN: heightLine 1768function heightLine() { 1769 1770 this.className="heightLine"; 1771 this.parentClassName="heightLineParent" 1772 reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i"); 1773 objCN =new Array(); 1774 var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all; 1775 for(var i = 0; i < objAll.length; i++) { 1776 if (typeof objAll[i].className == "string") { 1777 var eltClass = objAll[i].className.split(/\s+/); 1778 for(var j = 0; j < eltClass.length; j++) { 1779 if(eltClass[j] == this.className) { 1780 if(!objCN["main CN"]) objCN["main CN"] = new Array(); 1781 objCN["main CN"].push(objAll[i]); 1782 break; 1783 }else if(eltClass[j] == this.parentClassName){ 1784 if(!objCN["parent CN"]) objCN["parent CN"] = new Array(); 1785 objCN["parent CN"].push(objAll[i]); 1786 break; 1787 }else if(eltClass[j].match(reg)){ 1788 var OCN = eltClass[j].match(reg) 1789 if(!objCN[OCN]) objCN[OCN]=new Array(); 1790 objCN[OCN].push(objAll[i]); 1791 break; 1792 } 1793 } 1794 } 1795 } 1796 1797 //check font size 1798 var e = document.createElement("div"); 1799 var s = document.createTextNode("S"); 1800 e.appendChild(s); 1801 e.style.classname="check-fontsize"; 1802 e.style.visibility="hidden"; 1803 e.style.position="absolute"; 1804 e.style.top="0"; 1805 document.body.appendChild(e); 1806 var defHeight = e.offsetHeight; 1807 1808 changeBoxSize = function(){ 1809 for(var key in objCN){ 1810 if (objCN.hasOwnProperty(key)) { 1811 //parent type 1812 if(key == "parent CN"){ 1813 for(var i=0 ; i<objCN[key].length ; i++){ 1814 var max_height=0; 1815 var CCN = objCN[key][i].childNodes; 1816 for(var j=0 ; j<CCN.length ; j++){ 1817 if(CCN[j] && CCN[j].nodeType == 1){ 1818 CCN[j].style.height="auto"; 1819 max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight; 1820 } 1821 } 1822 for(var j=0 ; j<CCN.length ; j++){ 1823 if(CCN[j].style){ 1824 var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], ''); 1825 var newheight = max_height; 1826 if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px",""); 1827 if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px",""); 1828 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px",""); 1829 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 1830 CCN[j].style.height =newheight+"px"; 1831 } 1832 } 1833 } 1834 }else{ 1835 var max_height=0; 1836 for(var i=0 ; i<objCN[key].length ; i++){ 1837 objCN[key][i].style.height="auto"; 1838 max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight; 1839 } 1840 for(var i=0 ; i<objCN[key].length ; i++){ 1841 if(objCN[key][i].style){ 1842 var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], ''); 1843 var newheight = max_height; 1844 if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px",""); 1845 if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px",""); 1846 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","") 1847 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 1848 objCN[key][i].style.height =newheight+"px"; 1849 } 1850 } 1851 } 1852 } 1853 } 1854 } 1855 1856 checkBoxSize = function(){ 1857 if(defHeight != e.offsetHeight){ 1858 changeBoxSize(); 1859 defHeight= e.offsetHeight; 1860 } 1861 1862 // var elm = document.querySelector(".check-fontsize"); 1863 // if (elm) elm.parentNode.removeChild(elm); 1864 } 1865 changeBoxSize(); 1866 setInterval(checkBoxSize,1000) 1867 window.onresize=changeBoxSize; 1868} 1869 1870function addEvent(elm,listener,fn){ 1871 try{ 1872 elm.addEventListener(listener,fn,false); 1873 }catch(e){ 1874 elm.attachEvent("on"+listener,fn); 1875 } 1876} 1877addEvent(window, "load", heightLine); 1878// END: heightLine 1879 1880(function() { // DOM loaded 1881 1882 // WOW js 1883 if (typeof window["WOW"] === "function") { 1884 var wowData = { 1885 boxClass: typeof $("body").attr("data-wow-box") != "undefined" ? $("body").attr("data-wow-box") : "wow", 1886 animateClass: typeof $("body").attr("data-wow-animate") != "undefined" ? $("body").attr("data-wow-animate") : "animated", 1887 offset: typeof $("body").attr("data-wow-offset") != "undefined" ? parseInt($("body").attr("data-wow-offset")) : 0, 1888 mobile: $.inArray($("body").attr("data-wow-mobile"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 1889 live: $.inArray($("body").attr("data-wow-live"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 1890 resetAnimation: $.inArray($("body").attr("data-wow-reset"), ["false", "off", "disable", "disabled", "0"]) >= 0 ? false : true, 1891 callback: function(box) {}, 1892 scrollContainer: null 1893 }, 1894 _wow_ = new WOW(wowData); 1895 1896 _wow_.init(); 1897 } 1898})(); 1899 1900// conflicts 1901if (!Object.keys) { 1902 Object.keys = (function() { 1903 "use strict"; 1904 var hasOwnProperty = Object.prototype.hasOwnProperty, 1905 hasDontEnumBug = !({ 1906 toString: null 1907 }).propertyIsEnumerable("toString"), 1908 dontEnums = [ 1909 "toString",
1910 "toLocaleString", 1911 "valueOf", 1912 "hasOwnProperty", 1913 "isPrototypeOf", 1914 "propertyIsEnumerable", 1915 "constructor" 1916 ], 1917 dontEnumsLength = dontEnums.length; 1918 1919 return function(obj) { 1920 if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) { 1921 throw new TypeError("Object.keys called on non-object"); 1922 } 1923 1924 var result = [], 1925 prop, i; 1926 1927 for (prop in obj) { 1928 if (hasOwnProperty.call(obj, prop)) { 1929 result.push(prop); 1930 } 1931 } 1932 1933 if (hasDontEnumBug) { 1934 for (i = 0; i < dontEnumsLength; i++) { 1935 if (hasOwnProperty.call(obj, dontEnums[i])) { 1936 result.push(dontEnums[i]); 1937 } 1938 } 1939 } 1940 return result; 1941 }; 1942 }()); 1943} 1944 1945function isHTML(str) { 1946 var a = document.createElement("div"); 1947 a.innerHTML = str; 1948 for (var child = a.childNodes, i = child.length; i--;) { 1949 if (child[i].nodeType == 1) return true; 1950 } 1951 return false; 1952} 1953 1954var checkDomain = function(url) { 1955 if (url.indexOf('//') === 0) url = location.protocol + url; 1956 return url.toLowerCase().replace(/([a-z])?:\/\//, "$1").split("/")[0]; 1957}; 1958var isExternal = function(url) { 1959 return ((url.indexOf(":") > -1 || url.indexOf("//") > -1) && checkDomain(location.href) !== checkDomain(url)); 1960};
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.