1/* ---------------------------------------- 2 [common.js] JavaScript 3 copyright : Lampros co.,Ltd. 4---------------------------------------- */ 5window.onunload = function(){}; 6 7var dfv = { 8 overClass : "btn", 9 notOverClass : "noBt", 10 overChar : "_s2", 11 ua : null, 12 hash : null 13}; 14 15/* Run 16 -----------------------------------------------------------------------------------------------*/ 17jQuery(function($){ 18 19 // setSmoothScroll 20 // {speed:1, offset:0} 21 $( 'a[href^="#"]:not(.nosm)' ).setSmoothScroll(); 22 23 // svg convert 24 // <img src="hoge.svg" [id="targetID"] class="svg"> ---> <svg><g><path>....</path></g></svg> 25 $('img.svg').setSvgConvert(); 26 27 // Animate On Scroll Library 28 // https://michalsnik.github.io/aos/ 29 // original animation 30 // (set) data-aos="hoge" / (out) [data-aos="hoge"] {} / (in) [data-aos="hoge"].aos-animate {} 31 AOS.init({ 32 offset: 60, 33 delay: 0, 34 duration: 400, 35 easing: 'ease-out-cubic', 36 once: false, 37 mirror: false, 38 anchorPlacement: 'top-bottom' 39 }); 40 41 // navOpenCls 42 // target:"ã¯ã©ã¹ãä»å ãã対象", bar:"ã¯ãªãã¯ãããã¿ã³", cls:"ä»å ããã¯ã©ã¹å", bg:"èæ¯ãã¯ãªãã¯ã§éããå ´åã®å¯¾è±¡", initEv:åæã¤ãã³ã追å , openEv:ä»å æã¤ãã³ã追å , closeEv:å餿ã¤ãã³ã追å 43 $.navOpenCls({target:"html", bar:".nav_bar", cls:"nav_open"}); 44 45 $("#lang > a").on("click", function(){ 46 $("#lang").toggleClass("on"); 47 return false; 48 }); 49 $(document).on("click", function(e){ 50 if(!$(e.target).closest("#lang").length) $("#lang").removeClass("on"); 51 }); 52 53 // object-fit for IE 54 //.hoge { object-fit: cover; object-position: bottom; font-family: 'object-fit: cover; object-position: bottom;' } 55 // objectFitImages(); 56 57 // nav height 58 (function(){ 59 var $win = $(window), $nav = $("#nav"), $nav_wrap = $("#nav_wrap"), 60 setHeight = function(){ 61 $nav.height($nav_wrap.height()); 62 }, 63 init = function(){ 64 setHeight(); 65 $win.on("resize", setHeight); 66 }(); 67 }()); 68 69 // setMouseDirection 70 // ã¿ã¼ã²ããã«ãã¦ã¹ãªã¼ãã¼æã¨ãã¦ã¹ã¢ã¦ãæã«åä½ã«ãã£ãã¯ã©ã¹åãä»ä¸ãã¾ã 71 // ãã¦ã¹ãªã¼ãã¼æï¼[md-enter-top, md-enter-bottom, md-enter-left, md-enter-right, md-enter-unknown] 72 // ãã¦ã¹ã¢ã¦ãæï¼[md-leave-top, md-leave-bottom, md-leave-left, md-leave-right, md-leave-unknown] 73 //$("ã¿ã¼ã²ãã").setMouseDirection(); 74 75}); 76 77jQuery.event.add(window, "load", function(){ 78 79 // hashScrool 80 // {speed:1, offset:0} 81 window.setTimeout(function(){ $.hashScrool({ hash:$.getHashName() }); }, 250); 82 83 // setRowlayout 84 // flortã使ç¨ãIE9å¯¾å¿ 85 // 親è¦ç´ ã« .row-(å岿°[num])-(ãã¼ã¸ã³ [px/rem/%])-(ããã¼ãæ¹å ãã¼ãã«/é [n/r]) 86 // åè¦ç´ ã« .col-(å岿°[num]) and .col-(æ¨ªå¹ åå²[l/m/ms/s])(å岿°[num]) 87 // ((l)) max-width:1024px iPad 横 / ((m)) max-width:768px iPad 縦 / ((ms)) max-width:736px iPhone 横 / ((s)) max-width:414px iPhone 縦 88 // autoHeight:[ ".ah1", ".ah2" ](ãµãé ç®ã®é«ãããæãã), fixedContents:true(横ã«ãã£ãã), contentsAlign:"center"(ä¸å¤®æã:center/å·¦æã:left), prefix:"#id "ï¼æ¥é èªï¼ 89 if($.checkUserAgent("MSIE 9")) $("*[class^=row-], *[class*=' row-']", "body").setRowlayout({autoHeight:[".ah1",".ah2",".ah3",".ah4",".ah5",".ah6"]}); 90 // setRowlayoutFlex 91 // display:flexã使ç¨ãIE10以éå¯¾å¿ 92 // 親è¦ç´ ã« .row-(å岿°[num])-(ãã¼ã¸ã³ [0/px/em/rem/%/vw/vh][ãªãã·ã§ã³ |l_å¤|m_å¤|ms_å¤|s_å¤])ãï¼ãªãã·ã§ã³ã-(ããã¼ãæ¹å ãã¼ãã«/é [n/r]-(å·¦å³ä½ç½® å·¦/ä¸å¤®/å³ [l/c/r])ï¼ 93 // ((l)) max-width:1024px iPad 横 / ((m)) max-width:768px iPad 縦 / ((ms)) max-width:736px iPhone 横 / ((s)) max-width:414px iPhone 縦 94 // prefix:"#id "ï¼æ¥é èªï¼ 95 //autoHeightã¯ah1ï½ah6ã¾ã§ä½¿ç¨å¯è½ 96 else $("*[class^=row-], *[class*=' row-']", "body").setRowlayoutFlex(); 97 98 // pageup 99 // limitScrollY:100, changeTime:0.3, target:null, targetOffset:10, cls:ä»å ã¯ã©ã¹å, clsTg:ä»å ã¯ã©ã¹å ´æ 100 $( "#pageup" ).setPageup({limitScrollY:250, cls:"scroll", clsTg:"body"}); 101
102 // setParallaxBackground 103 // movement:ç§»åéï¼æ°å¤ï¼ 104 $(".parallax_bg").setParallaxBackground(); 105 106 // lightGallery 107 if(typeof $.fn.lightGallery == 'function') $(".light_gallery").lightGallery({ download:false }); 108 109 // setToggleOpen 110 // hiliteCls:ä»å ã¯ã©ã¹å, openTime:éãï¼éããæé, ease:TweenMaxã®ã¤ã¼ã¸ã³ã°è¨å®(https://greensock.com/docs/Easing), open_initial:åæã§éãããã¿ã¤ãã«IDãArrayå½¢å¼ã§æå®(["id1","id2"]), type:"radio"ã©ã¸ãªãã¿ã³é¢¨, height:é«ãåºå®(px), sp:ã¹ããæã®ã¿(true) 111 // openAll() å ¨ã¦éããï¼ãcloseAll() å ¨ã¦éãã 112 $(".toggle").setToggleOpen(); 113 114 //nav_wrap_fix 115 (function(){ 116 var $win = $(window), $header = $("#header"), $tgw = $("#nav"), $tg = $("#nav_wrap"), header_height = 0, nav_height = 0, 117 setHeaderHeight = function(){ 118 header_height = $header.outerHeight(); 119 nav_height = $tgw.outerHeight(); 120 }, 121 setFixCheck = function(){ 122 if($win.scrollTop() < header_height ){ 123 $tg.removeClass("nav_wrap_fix"); 124 } else { 125 $tg.addClass("nav_wrap_fix"); 126 } 127 }, 128 init = function(){ 129 setHeaderHeight(); 130 setFixCheck(); 131 $win.on("resize", setHeaderHeight); 132 $win.on("scroll", setFixCheck); 133 }(); 134 }()); 135 136 // spnav 137 (function(){ 138 var $win = $(window), $tg = $("#nav_wrap .w"), tg_h = $tg.height(), tg_t = 0, preScroll = $win.scrollTop(), scrolling_increment = 0, 139 runSpNav = function(){ 140 if($win.scrollTop() > 0) scrolling_increment = $win.scrollTop() - preScroll; 141 tg_t -= scrolling_increment; 142 if(scrolling_increment > 0 && $win.scrollTop() ){ 143 $tg.removeClass("view"); 144 } else { 145 $tg.addClass("view"); 146 } 147 preScroll = $win.scrollTop(); 148 }, 149 init = function(){ 150 $win.on("scroll", runSpNav); 151 }(); 152 }()); 153 154 155 // owl-carousel-pg 156 // class="owl-carousel owl-carousel-pg" 157 if(typeof $.fn.owlCarousel == 'function'){ 158 $('.owl-carousel-pg').setOwlCarouselPG(); 159 $(".owl-carousel-pg-ds").setOwlCarouselPG({ thumbs: true, thumbsPrerendered: true }); 160 } 161 162 163 // ââââã¦ã£ã³ãã¦å¹ ãã§ãã¯ããã¼ã³ãæå¿ ãåé¤ãããã¯ã³ã¡ã³ãã¢ã¦ãââââââââ 164 //$.informationTool(); 165 166 AOS.refresh(); 167 168}); 169 170document.ontouchstart = function(){}; 171 172/* Common Library 173 -----------------------------------------------------------------------------------------------*/ 174 175(function($){ 176 177 /* instance method ----------------------------------------------------------------------------*/ 178 // * setMouseDirection --------------------------------------------------------------------- 179 $.fn.setMouseDirection = function(options){ 180 var op = $.extend({ 181 "enterTop": "md-enter-top", 182 "enterBottom": "md-enter-bottom",
183 "enterLeft": "md-enter-left", 184 "enterRight": "md-enter-right", 185 "enterUnknown": "md-enter-unknown", 186 "leaveTop": "md-leave-top", 187 "leaveBottom": "md-leave-bottom", 188 "leaveLeft": "md-leave-left", 189 "leaveRight": "md-leave-right", 190 "leaveUnknown": "md-leave-unknown" 191 }, options ), 192 $win = $(window), $tgs = $(this), tv = 20, 193 mDmouseenter = function(e){ 194 var $this = $(this), cls = e.offsetX < tv ? op.enterLeft : e.offsetX > $this.outerWidth() - tv ? op.enterRight : e.offsetY < tv ? op.enterTop : e.offsetY > $this.outerHeight() - tv ? op.enterBottom : op.enterUnknown; 195 $this.removeClass(function(index, className){ return(className.match(/\bmd-\S+/g) || []).join(' '); }); 196 $this.addClass(cls); 197 }, 198 mDmouseleave = function(e){ 199 var $this = $(this), cls = e.offsetX < tv ? op.leaveLeft : e.offsetX > $this.outerWidth() - tv ? op.leaveRight : e.offsetY < tv ? op.leaveTop : e.offsetY > $this.outerHeight() - tv ? op.leaveBottom : op.leaveUnknown; 200 $this.removeClass(function(index, className){ return(className.match(/\bmd-\S+/g) || []).join(' '); }); 201 $this.addClass(cls); 202 }, 203 init = function(){ 204 $tgs.on("mouseenter", mDmouseenter).on("mouseleave", mDmouseleave); 205 }(); 206 }; 207 // * setOwlCarouselPG ---------------------------------------------------------------------- 208 $.fn.setOwlCarouselPG = function(options){ 209 var op = $.extend({ 210 animateOut: 'fadeOut', 211 items:1, 212 loop:true, 213 autoplay:true, 214 autoplayTimeout:5000, 215 mouseDrag:false, 216 touchDrag:false, 217 pullDrag:false 218 }, options), $tgs = $(this), 219 setPg = function(){ 220 var $tg = $(this), 221 init = function(){ 222 $tg.owlCarousel(op); 223 $tg.trigger('stop.owl.autoplay'); 224 $tg.on('inview', function(event, isInView){ 225 if(isInView) $tg.trigger('play.owl.autoplay'); 226 else $tg.trigger('stop.owl.autoplay'); 227 }); 228 //$tg.on("mouseenter", function(){ $tg.trigger('stop.owl.autoplay'); }); 229 //$tg.on("mouseleave", function(){ $tg.trigger('play.owl.autoplay'); }); 230 $tg.find(".owl-dots").on("click", function(){ $tg.trigger('stop.owl.autoplay'); $tg.trigger('play.owl.autoplay'); }); 231 }(); 232 }, 233 init = function(){ 234 $tgs.each(setPg); 235 }(); 236 return this; 237 }; 238 // * setToggleOpen ------------------------------------------------------------------------- 239 $.fn.setToggleOpen = function(options){ 240 var op = $.extend({hiliteCls:"open", openTime:0.5, ease:Power1.easeInOut, open_initial:null, type:null, height:null, sp:null}, options), my = this, $win = $(window), $tgs = $(this), 241 setToggleOpen = function(){ 242 var $tg = $(this), $opTg = ($tg.attr("data-target")) ? $($tg.attr("data-target")) : $tg.next(), $opTgInner = $opTg.children(), opTgH, $closeBt = $opTg.find(".close"), 243 getHeight = function(){ 244 opTgH = (op.height) ? op.height : $opTgInner.outerHeight(); 245 }, 246 getHeightResize = function(){ 247 if($tg.hasClass(op.hiliteCls)){ 248 getHeight(); 249 $opTg.height(opTgH); 250 } 251 }, 252 tgCk = function(v){ 253 var opck = $tg.hasClass(op.hiliteCls); 254 getHeight(); 255 if(op.type == "radio") if(v === undefined) my.closeAll(); 256 if(opck){ 257 $tg.removeClass(op.hiliteCls); 258 $opTg.removeClass(op.hiliteCls); 259 TweenMax.to($opTg, op.openTime, {height: 0, ease: op.ease}); 260 } else { 261 $tg.addClass(op.hiliteCls); 262 $opTg.addClass(op.hiliteCls); 263 TweenMax.to($opTg, op.openTime, {height: opTgH, ease: op.ease}); 264 } 265 }, 266 init = function(){ 267 getHeight(); 268 $win.on("resize", getHeightResize); 269 $tg.on("click", function(e, v){ tgCk(v); }); 270 $opTgInner.css({display: "block"}); 271 if(op.height) $opTgInner.css({display: "block", height: opTgH + "px", overflowY: "scroll"}); 272 $opTg.css({display: "block", overflow: "hidden"}).height(0); 273 if($closeBt) $closeBt.on("click", function(){ 274 $tg.trigger("click", "triggerCk"); 275 return false; 276 }); 277 }(); 278 }, 279 _init = function(){ 280 var set = function(){ 281 $tgs.each(setToggleOpen); 282 if(op.open_initial){ 283 op.open_initial.forEach(function(tg){ 284 if(! $(tg).hasClass(op.hiliteCls)) $(tg).trigger("click", "triggerCk"); 285 });
286 } 287 } 288 if(op.sp == null) set(); 289 else if(736 >= $win.outerWidth()) set(); 290 }(); 291 my.openAll = function(){ 292 $tgs.each(function(){ 293 var $tg = $(this); 294 if(! $tg.hasClass(op.hiliteCls)) $tg.trigger("click", "triggerCk"); 295 }); 296 }; 297 my.closeAll = function(){ 298 $tgs.each(function(){ 299 var $tg = $(this); 300 if($tg.hasClass(op.hiliteCls)) $tg.trigger("click", "triggerCk"); 301 }); 302 }; 303 return this; 304 }; 305 // * setParallaxBackground ----------------------------------------------------------------- 306 $.fn.setParallaxBackground = function(options){ 307 var op = $.extend({ 308 movement:300 309 }, options ); 310 var $win = $(window), $tgs = $(this), movement = op.movement, requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, 311 run = function(){ 312 var $tg = $(this), osft = 0, wH = 0, tgW = 0, tgH = 0, bgW = 0, bgH = 0, mvd = 0, 313 setBgSize = function(){ 314 var th = tgH + movement, ds = th / bgH, tw = bgW * ds; 315 if(tgW < tw) $tg.css({ "background-size": "auto " + (tgH + movement) + "px" }); 316 else $tg.css({ "background-size": tgW + "px auto" }); 317 }, 318 imgParallax = function(){ 319 window.requestAnimationFrame(imgParallax); 320 $tg.css({ "background-position-y":-(movement - (((($win.scrollTop() + wH) - osft) / mvd) * movement)) + "px" }); 321 }, 322 getSize = function(){ 323 wH = $win.height(); 324 tgW = $tg.width(); 325 tgH = $tg.outerHeight(); 326 osft = $tg.offset().top; 327 mvd = wH + tgH; 328 setBgSize(); 329 }, 330 init = function(){ 331 $tg.css({opacity:0}); 332 $tg.getBackgroundSize(function(arg){ 333 bgW = arg.width; 334 bgH = arg.height; 335 getSize(); 336 $win.on("resize", getSize); 337 imgParallax(); 338 TweenMax.to($tg, 1, {opacity:1, ease:Sine.easeOut}); 339 }); 340 }(); 341 }, 342 init = function(){ 343 window.requestAnimationFrame = requestAnimationFrame; 344 $tgs.each(run); 345 }(); 346 return this; 347 }; 348 // * setPageup ----------------------------------------------------------------------------- 349 $.fn.setPageup = function(options){ 350 var op = $.extend( { limitScrollY:100, changeTime:0.3, target:null, targetOffset:10, cls:null, clsTg:null }, options ), 351 $win = $( window ), ck = true, 352 $tg = $( this ), tgh = $tg.height() +op.targetOffset, targetTop = 0, 353 runScroll = function(){ 354 if( $win.scrollTop() > op.limitScrollY ){ 355 if( ck ){ 356 TweenMax.set( $tg, { opacity:0, display:"block" }); 357 TweenMax.to( $tg, op.changeTime, { opacity:1, ease:Sine.easeOut }); 358 ck = false; 359 if(op.cls && op.clsTg) $(op.clsTg).addClass(op.cls); 360 } 361 } else { 362 TweenMax.to( $tg, op.changeTime, { opacity:0, ease:Sine.easeIn, onComplete:function(){ $tg.css( { display:"none" } ); } }); 363 ck = true; 364 if(op.cls && op.clsTg) $(op.clsTg).removeClass(op.cls); 365 } 366 if( op.target !== null ){ 367 targetTop = $( op.target ).offset().top; 368 if( $win.scrollTop() + $win.height() > targetTop ){ 369 $tg.css( { top:targetTop - $win.scrollTop() - tgh, bottom:"auto" } ); 370 } else { 371 $tg.css( { top:"auto", bottom:"" } ); 372 } 373 } 374 }, 375 init = function(){ 376 TweenMax.set( $tg, { opacity:0, display:"block" }); 377 $win.on("scroll", runScroll); 378 runScroll(); 379 }(); 380 return this; 381 }; 382 // * setSetSelecter ------------------------------------------------------------------------ 383 $.fn.setSelecter = function(options){ 384 var op = $.extend( { selecter:".selecter", selecterVal:".selecter-val", selecterList:".selecter-list", selectCls:"selected", hideSelectClear:true }, options ), 385 $_tg = $( this ), 386 _setSelecter = function(){ 387 var $html = $( "html" ), $tg = $( this ), $selecter = $tg.find( op.selecter ), $selecterVal = $tg.find( op.selecterVal ), $selecterLists = $tg.find( op.selecterList ), $selecterList = $selecterLists.find( "a" ), isTouch = true, 388 type = function(){ 389 if( $tg.hasClass( "type-check" ) ) return "check"; 390 if( $tg.hasClass( "type-radio" ) ) return "radio"; 391 if( $tg.hasClass( "type-pulldown" ) ) return "pulldown"; 392 }(), 393 setTypeCheckRadio = function(){ 394 var clickSelecter = function(){ 395 var $this = $( this ); 396 if( !isTouch ) return false; 397 if( type == "radio" ){ 398 $selecter.removeClass( op.selectCls ); 399 $selecter.each( function(){ hideSwitch( $( this ) ); } ); 400 }
401 ( $this.hasClass( op.selectCls ) ) ? $this.removeClass( op.selectCls ) : $this.addClass( op.selectCls ); 402 viewSwitch( $this ); 403 return false; 404 }; 405 $selecter.each( function(){ hideSwitch( $( this ) ); } ); 406 $selecter.on( "click", clickSelecter ).on( "touchstart", isTouchTrue ).on( "touchmove", isTouchFalse ).on( "touchend", clickSelecter ); 407 }, 408 setTypePulldown = function(){ 409 var clickSelecter = function(){ 410 if( !isTouch ) return false; 411 selecterListsView(); 412 return false; 413 }, 414 clickSelecterList = function(){ 415 var $this = $( this ), data = $this.html(), dataVal = $this.attr( "data-val" ); 416 if( !isTouch ) return false; 417 $selecter.attr( "data-val", dataVal ); 418 $selecterVal.html( data ); 419 $selecter.addClass( op.selectCls ); 420 $selecterList.removeClass( op.selectCls ); 421 $this.addClass( op.selectCls ); 422 $selecterList.each( function(){ viewSwitch( $( this ) ); } ); 423 selecterListsHide(); 424 return false; 425 }, 426 selecterListsHide = function(){ 427 if( !isTouch ) return false; 428 $html.off( "click", selecterListsHide ).off( "touchend", selecterListsHide ); 429 $selecterLists.css( { opacity:0, display:"none" } ); 430 }, 431 selecterListsView = function(){ 432 $html.on( "click", selecterListsHide ).on( "touchstart", isTouchTrue ).on( "touchmove", isTouchFalse ).on( "touchend", selecterListsHide ); 433 $selecterLists.css( { opacity:1, display:"block" } ); 434 }; 435 selecterListsHide(); 436 $selecter.attr( "data-firstVal", $selecterVal.html() ); 437 $selecter.on( "click", clickSelecter ).on( "touchstart", isTouchTrue ).on( "touchmove", isTouchFalse ).on( "touchend", clickSelecter ); 438 $selecterList.each( function(){ hideSwitch( $( this ) ); } ); 439 $selecterList.on( "click", clickSelecterList ).on( "touchstart", isTouchTrue ).on( "touchmove", isTouchFalse ).on( "touchend", clickSelecterList ); 440 }, 441 isTouchTrue = function(){ isTouch = true; }, 442 isTouchFalse = function(){ isTouch = false; } 443 hideSwitch = function( $target ){ 444 var dataSwitch =$target.attr( "data-switch" ); 445 if( dataSwitch ){ 446 if( op.hideSelectClear ){ 447 $( dataSwitch ).find( "." + op.selectCls ).removeClass( op.selectCls ); 448 $( dataSwitch ).find( "a" ).each( function(){ hideSwitch( $( this ) ); } ); 449 $( dataSwitch ).find( "[data-firstVal]" ).find( op.selecterVal ).html( $( dataSwitch ).find( "[data-firstVal]" ).attr( "data-firstVal" ) ); 450 } 451 $( dataSwitch ).css( { opacity:0, display:"none" } ); 452 } 453 }, 454 viewSwitch = function( $target ){ 455 var dataSwitch =$target.attr( "data-switch" ); 456 ( dataSwitch && $target.hasClass( op.selectCls ) ) ? $( dataSwitch ).css( { opacity:1, display:"block" } ) : hideSwitch( $target ); 457 }, 458 init = function(){ 459 switch( type ){ 460 case "check": setTypeCheckRadio(); break; 461 case "radio": setTypeCheckRadio(); break; 462 case "pulldown": setTypePulldown(); break; 463 }; 464 }(); 465 }, 466 _init = function(){ 467 $_tg.each( _setSelecter ); 468 }(); 469 return this; 470 }; 471 // * setInOutView -------------------------------------------------------------------------- 472 $.fn.setInOutView = function(options){ 473 var op = $.extend( { "inFunf":null, "outFunc":null }, options ), 474 $tg = $( this ), onCk = false, offCk = true, tgHeight = $tg.height, requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, 475 run = function(){ 476 window.requestAnimationFrame(run); 477 var whsize = $( window ).height(), wst = $( window ).scrollTop(), vp = wst + whsize; 478 if( !onCk && ( $tg.offset().top + tgHeight ) >= wst && $tg.offset().top <= vp ){ 479 onCk = true; offCk = false; 480 if( op.inFunf !== null ) op.inFunf(); 481 } else if( !offCk && ( ( $tg.offset().top + tgHeight ) < wst || $tg.offset().top > vp ) ){ 482 onCk = false; offCk = true; 483 if( op.outFunc !== null ) op.outFunc(); 484 } 485 }, 486 init = function(){ 487 window.requestAnimationFrame = requestAnimationFrame; 488 run(); 489 //$( window ).on( "scroll resize", run ); 490 }(); 491 return this; 492 }; 493 // * autoHeight ---------------------------------------------------------------------------- 494 $.fn.autoHeight = function(options){ 495 var op = $.extend({ "column":null }, options ), $tg = $( this ).not( ':hidden' ), columnNum, maxHeight = 0, target = [], cntAll = 0, cnt = 0; 496 if( op.column !== null ){ columnNum = op.column } else { columnNum = $tg.length }; 497 $tg.each(function(){ 498 var $_tg = $( this ); 499 $_tg.css( { "height":"auto" } ); 500 var thisHeight = $_tg.outerHeight(); 501 if( maxHeight < thisHeight ) maxHeight = thisHeight; 502 target.push( $_tg ); 503 cnt++; 504 cntAll++; 505 if( cntAll === $tg.length || cnt === columnNum ){ 506 target.forEach(function( target ){ 507 target.css( "height", maxHeight ); 508 });
509 maxHeight = 0; 510 target = []; 511 cnt = 0; 512 } 513 }); 514 return this; 515 }; 516 // * setTween ------------------------------------------------------------------------------ 517 $.fn.setTween = function(animates, options){ 518 var op = $.extend({ time:1, easing:"linear", delay:0, queue:false, onComplete:function(){} }, options ), 519 $tg = $( this ), 520 init = function(){ 521 setTimeout( function(){ $tg.animate( animates, { duration:op.time * 1000, easing:op.easing, queue:op.queue, complete:op.onComplete }); }, op.delay * 1000 ); 522 }(); 523 return this; 524 }; 525 // * setSmoothScroll ----------------------------------------------------------------------- 526 $.fn.setSmoothScroll = function(options){ 527 var op = $.extend( { speed:1, offset:0 }, options ); 528 $( this ).click(function(){ 529 var href = $( this ).attr( "href" ), hashNum = href.indexOf("#"); 530 if(hashNum != 0) href = href.slice(hashNum); 531 $.runSmoothScroll( { target:href, speed:op.speed, offset:op.offset } ); 532 return false; 533 }); 534 return this; 535 }; 536 // * setTab -------------------------------------------------------------------------------- 537 $.fn.setTab = function(options){ 538 var op = $.extend( { firstOpen:0, tabClassName:".tab", tabContentsClassName:".tabContents", hiliteCharImg:dfv.overChar, hiliteCharTxt:"on", autoChange:false, changeTime:3, tabLinkClassName:"tabLink", toggle:false }, options ); 539 $( this ).each(function(){ 540 var tabs = [], contents = [], tabNum = $( op.tabClassName, this ).children().length, nowId = null, cnt = cnt2 = 0, timer, 541 sethilite = function( cnt ){ 542 if( typeof tabs[ nowId ] !== "undefined" ) tabs[ nowId ].removeClass( op.hiliteCharTxt ); 543 if( typeof contents[ nowId ] !== "undefined" ) contents[ nowId ].hide(); 544 if( typeof contents[ cnt ] !== "undefined" ) contents[ cnt ].show().css( "opacity", 0 ).setTween( { opacity:1 }, { time:0.5, delay:0, easing:"easeInCubic" } ); 545 if( typeof tabs[ cnt ] !== "undefined" ) tabs[ cnt ].addClass( op.hiliteCharTxt ); 546 nowId = cnt; 547 }, 548 nextTab = function(){ 549 var nextId = nowId + 1; 550 if( nextId >= tabNum ) nextId = 0; 551 sethilite( nextId ); 552 }; 553 $( op.tabClassName, this ).children().each(function(){ 554 tabs.push( $( this ) ); 555 $( this ).find( "a" ).click(function(){ 556 if( op.autoChange ){ 557 clearInterval( timer ); 558 timer = setInterval( nextTab, op.changeTime * 1000 ); 559 } 560 if( $( this ).parent().index() === nowId ){ if( op.toggle ) sethilite( -1 ); } 561 else { sethilite( $( this ).parent().index() ); } 562 return false; 563 }); 564 if( cnt === op.firstOpen ) sethilite( cnt ); 565 cnt++; 566 }); 567 $( op.tabContentsClassName, this ).children().each(function(){ 568 contents.push( $( this ) ); 569 $( this ).find( "a." + op.tabLinkClassName ).click(function(){ 570 var rel = $( this ).attr( "rel" ); 571 if( rel ){ 572 sethilite( rel ); 573 return false; 574 } 575 }); 576 if( cnt2 !== op.firstOpen ) $( this ).hide(); 577 cnt2++; 578 }); 579 if( op.autoChange ){ timer = setInterval( nextTab, op.changeTime * 1000 ); } 580 }); 581 return this; 582 }; 583 // * setRowlayoutFlex ---------------------------------------------------------------------- 584 $.fn.setRowlayoutFlex = function(options){ 585 var op = $.extend({ 586 last: "col-last", 587 step: 0.5,//0.25 588 prefix:"", 589 autoHeight:[".ah1",".ah2",".ah3",".ah4",".ah5",".ah6"] 590 }, options), 591 $win = $(window), 592 $targets = $(this), 593 newStyle = document.createElement('style'), 594 stylesheets, 595 cssRulesIdx, 596 mkRule = [], 597 rule = [], 598 setRowlayoutRule = function(){ 599 $.each($targets, function(i, tg){ 600 var tgClss = $(tg).attr("class"), rowCls = tgClss.match(/row-(.*?)-([0-9a-z_|%]{1,30})/), $children = $(tg).children(); 601 if(!rowCls) return false; 602 rule.push(rowCls); 603 $children.each(function(){ 604 var $tg = $(this), childrenCls = $tg.attr("class"), childrenRowCls, addCls = "", $wrap = $('<div />'); 605 if(childrenCls){
606 childrenRowCls = childrenCls.match(/col-([0-9a-z_]{1,4})/g); 607 if(childrenRowCls){ 608 childrenRowCls.forEach(function(tg, i){ 609 addCls += "flex-" + tg + " "; 610 }); 611 } 612 } 613 $wrap.addClass(addCls); 614 $tg.wrap($wrap); 615 }); 616 }); 617 rule.forEach(function(tg, i){ 618 var mkId = tg[1] + "-" + tg[2], tgsp = tg[2].match(/([0-9a-z_%]{1,10})/g), 619 dot_conversion = function(val){ 620 return val.toString().replace(".", "_"); 621 }; 622 tgsp.forEach(function(tg, i){ 623 if(tgsp[i] === 0) tgsp[i] = "0px"; 624 }); 625 if(mkRule.indexOf(mkId) == -1){ 626 var cssRule = "", cssRule1 = "", cssRule2 = "", baseW = '99.999% / ' + tg[1]; 627 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '"] { display: flex; flex-flow: row wrap; margin-left: -' + tgsp[0] + '; margin-bottom: -' + tgsp[0] + '; }', cssRulesIdx++); 628 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '-r"] { flex-direction: row-reverse; }', cssRulesIdx++); 629 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '-r-c"], ' + op.prefix + ' *[class*="row-' + mkId + '-n-c"] { justify-content: center; }', cssRulesIdx++); 630 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '-r-r"], ' + op.prefix + ' *[class*="row-' + mkId + '-n-r"] { justify-content: flex-end; }', cssRulesIdx++); 631 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '"] > * { padding-left: ' + tgsp[0] + '; margin-bottom: ' + tgsp[0] + '; }', cssRulesIdx++); 632 stylesheets.insertRule(op.prefix + ' *[class*="row-' + mkId + '"] > * > * { height: 100%; }', cssRulesIdx++); 633 for(var a = 1; a <= tg[1]; a = a + op.step){ 634 if(a == 1) cssRule = op.prefix + ' *[class*="row-' + mkId + '"] > * { width:calc('+ baseW +'); }'; 635 else cssRule = op.prefix + ' *[class*="row-' + mkId + '"][class*="col-' + dot_conversion(a) + '"] > * { width:calc(('+ baseW +') * '+ a +'); }'; 636 stylesheets.insertRule(cssRule, cssRulesIdx++); 637 } 638 for(var a = 1; a <= tg[1]; a = a + op.step){ 639 cssRule = op.prefix + ' *[class*="row-' + mkId + '"] > .flex-col-' + dot_conversion(a) + ' { width:calc(('+ baseW +') * '+ a +'); }'; 640 stylesheets.insertRule(cssRule, cssRulesIdx++); 641 } 642 var cssRule_ = { l:'@media screen and (max-width:1024px) {', m:'@media screen and (max-width:768px) {', ms:'@media screen and (max-width:736px) {', s:'@media screen and (max-width:414px) {' }; 643 for(var a = 1; a <= tg[1]; a = a + op.step){ 644 var num = dot_conversion(a); 645 cssRule_["l"] += op.prefix + ' *[class*="row-' + mkId + '"][class*="col-l' + num + '"] > * { width:calc(('+ baseW +') * '+ a +'); }'; 646 cssRule_["m"] += op.prefix + ' *[class*="row-' + mkId + '"][class*="col-m' + num + '"] > * { width:calc(('+ baseW +') * '+ a +'); }'; 647 cssRule_["ms"] += op.prefix + ' *[class*="row-' + mkId + '"][class*="col-ms' + num + '"] > * { width:calc(('+ baseW +') * '+ a +'); }'; 648 cssRule_["s"] += op.prefix + ' *[class*="row-' + mkId + '"][class*="col-s' + num + '"] > * { width:calc(('+ baseW +') * '+ a +'); }'; 649 } 650 for(var a = 1; a <= tg[1]; a = a + op.step){ 651 var num = dot_conversion(a); 652 cssRule_["l"] += op.prefix + ' *[class*="row-' + mkId + '"] > .flex-col-l' + num + ' { width:calc(('+ baseW +') * '+ a +'); }'; 653 cssRule_["m"] += op.prefix + ' *[class*="row-' + mkId + '"] > .flex-col-m' + num + ' { width:calc(('+ baseW +') * '+ a +'); }'; 654 cssRule_["ms"] += op.prefix + ' *[class*="row-' + mkId + '"] > .flex-col-ms' + num + ' { width:calc(('+ baseW +') * '+ a +'); }'; 655 cssRule_["s"] += op.prefix + ' *[class*="row-' + mkId + '"] > .flex-col-s' + num + ' { width:calc(('+ baseW +') * '+ a +'); }'; 656 } 657 if(tgsp.length >= 2){ 658 for(var i = 1; i < tgsp.length; i++){ 659 var _tgsp = tgsp[i].split('_'); 660 cssRule_[_tgsp[0]] += op.prefix + ' *[class*="row-' + mkId + '"] { display: flex; flex-flow: row wrap; margin-left: -' + _tgsp[1] + '; margin-bottom: -' + _tgsp[1] + '; }';
661 cssRule_[_tgsp[0]] += op.prefix + ' *[class*="row-' + mkId + '"] > * { padding-left: ' + _tgsp[1] + '; margin-bottom: ' + _tgsp[1] + '; }'; 662 } 663 } 664 stylesheets.insertRule(cssRule_["l"] + '}', cssRulesIdx++); 665 stylesheets.insertRule(cssRule_["m"] + '}', cssRulesIdx++); 666 stylesheets.insertRule(cssRule_["ms"] + '}', cssRulesIdx++); 667 stylesheets.insertRule(cssRule_["s"] + '}', cssRulesIdx++); 668 stylesheets.insertRule('*[class^="row-"], *[class*=" row-"] { opacity: 1; }', cssRulesIdx++); 669 mkRule.push(mkId); 670 } 671 }); 672 }, 673 setAutoHeight = function(){ 674 var $target = $(this), $children = $target.children(), targetW, 675 run = function(){ 676 var _targetW = targetW = $target.width(), $hatg = $(); 677 $children.removeClass(op.last); 678 $children.each(function(){ 679 var $tg = $(this), tgsW = 0; 680 tgsW = $tg.outerWidth(true); 681 if(_targetW == targetW) _targetW -= tgsW; 682 else if(_targetW >= tgsW || _targetW >= $tg.outerWidth()) _targetW -= tgsW; 683 else { 684 $tg.prev().addClass(op.last); 685 _targetW = targetW - tgsW; 686 } 687 }); 688 $children.filter(":last").addClass(op.last); 689 $children.each(function(){ 690 var $this = $(this); 691 $hatg = $hatg.add($this); 692 if($this.hasClass(op.last)){ 693 op.autoHeight.forEach(function(target){ 694 var $tgs = $hatg.find(target); 695 if($tgs) $tgs.autoHeight(); 696 }); 697 $hatg = $(); 698 } 699 }); 700 }, 701 init = function(){ 702 run(); 703 $win.on("debouncedresize", run); 704 }(); 705 }, 706 init = function(){ 707 newStyle.type = "text/css"; 708 document.head.appendChild(newStyle); 709 stylesheets = newStyle.sheet; 710 cssRulesIdx = stylesheets.cssRules.length; 711 setRowlayoutRule(); 712 $targets.each(setAutoHeight); 713 }(); 714 return this; 715 }; 716 // * setRowlayout -------------------------------------------------------------------------- 717 $.fn.setRowlayout = function(options){ 718 var op = $.extend( { 719 first: "col-first", 720 middle: "col-middle", 721 last: "col-last", 722 autoHeight:null, 723 fixedContents:false, 724 contentsAlign:null, 725 prefix:"" 726 }, options ), 727 $win = $(window), 728 $targets = $(this), 729 tgCss = document.styleSheets.item(0), 730 cssIdx = tgCss.cssRules.length, 731 mkRule = [], 732 setRowlayoutRule = function(){ 733 var rule = []; 734 $.each($targets, function(i, val){ 735 var clss = $(val).attr("class"), rowCls = clss.match(/row-(.*?)-([0-9a-z%]{1,10})/); 736 if(!rowCls) return false; 737 rule.push(rowCls[0].split("-")); 738 }); 739 rule.forEach(function(val, i){ 740 var mkId = val[1] + "-" + val[2], margin = /(\d+)(\D+)/.exec(val[2]), 741 drp = function(val){ 742 return val.toString().replace(".", "_"); 743 }; 744 if(mkRule.indexOf(mkId) == -1){ 745 var cssRule = "", step = 0.25; 746 tgCss.insertRule(op.prefix + '*[class*="row-' + mkId + '"] { margin-bottom:-' + val[2] + '; }', cssIdx++); 747 tgCss.insertRule(op.prefix + '*[class*="row-' + mkId + '"] > * { margin-right:' + val[2] + '; margin-bottom:' + val[2] + '; }', cssIdx++); 748 tgCss.insertRule(op.prefix + '*[class*="row-' + mkId + '-r"] > * { margin-right:0; margin-left:' + val[2] + '; }', cssIdx++); 749 for(var a=1; a<=val[1]; a=a+step){ 750 if( a == 1 ){ 751 cssRule = op.prefix + '*[class*="row-' + mkId + '"] > * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 752 tgCss.insertRule(cssRule, cssIdx++); 753 } 754 cssRule = op.prefix + '*[class*="row-' + mkId + '"].col-' + drp(a) + ' > * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 755 tgCss.insertRule(cssRule, cssIdx++); 756 } 757 for(var a=1; a<=val[1]; a=a+step){ 758 cssRule = op.prefix + '*[class*="row-' + mkId + '"] > .col-' + drp(a) + ' {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 759 tgCss.insertRule(cssRule, cssIdx++); 760 } 761 cssRule = '@media screen and (max-width:1024px) {'; 762 for(var a=1; a<=val[1]; a=a+step){ 763 cssRule += op.prefix + '*[class*="row-' + mkId + '"].col-l' + drp(a) + ' >
763 * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ')}'; 764 } 765 for(var a=1; a<=val[1]; a=a+step){ 766 cssRule += op.prefix + '*[class*="row-' + mkId + '"] > .col-l' + drp(a) + ' {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 767 } 768 cssRule += '}'; 769 tgCss.insertRule(cssRule, cssIdx++); 770 cssRule = '@media screen and (max-width:768px) {'; 771 for(var a=1; a<=val[1]; a=a+step){ 772 cssRule += op.prefix + '*[class*="row-' + mkId + '"].col-m' + drp(a) + ' > * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ')}'; 773 } 774 for(var a=1; a<=val[1]; a=a+step){ 775 cssRule += op.prefix + '*[class*="row-' + mkId + '"] > .col-m' + drp(a) + ' {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 776 } 777 cssRule += '}'; 778 tgCss.insertRule(cssRule, cssIdx++); 779 cssRule = '@media screen and (max-width:736px) {'; 780 for(var a=1; a<=val[1]; a=a+step){ 781 cssRule += op.prefix + '*[class*="row-' + mkId + '"].col-ms' + drp(a) + ' > * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ')}'; 782 } 783 for(var a=1; a<=val[1]; a=a+step){ 784 cssRule += op.prefix + '*[class*="row-' + mkId + '"] > .col-ms' + drp(a) + ' {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 785 } 786 cssRule += '}'; 787 tgCss.insertRule(cssRule, cssIdx++); 788 cssRule = '@media screen and (max-width:414px) {'; 789 for(var a=1; a<=val[1]; a=a+step){ 790 cssRule += op.prefix + '*[class*="row-' + mkId + '"].col-s' + drp(a) + ' > * {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ')}'; 791 } 792 for(var a=1; a<=val[1]; a=a+step){ 793 cssRule += op.prefix + '*[class*="row-' + mkId + '"] > .col-s' + drp(a) + ' {width:calc((((99.9999% - '+ (margin[1]*(val[1]-1))+margin[2] + ') / ' + val[1] + ') * ' + a + ') + ' + ((a-1)*margin[1])+margin[2] + ');}'; 794 } 795 cssRule += '}'; 796 tgCss.insertRule(cssRule, cssIdx++); 797 mkRule.push(mkId); 798 } 799 }); 800 tgCss.insertRule(op.prefix + '*[class^="row-"] > .col-first, *[class^="row-"] > .col-first {}', cssIdx++); 801 tgCss.insertRule(op.prefix + '*[class^="row-"] > .col-middle, *[class*=" row-"] > .col-middle {}', cssIdx++); 802 tgCss.insertRule(op.prefix + '*[class^="row-"] > .col-last, *[class*=" row-"] > .col-last { margin-right:0; }', cssIdx++); 803 tgCss.insertRule(op.prefix + '*[class*="-r"] > .col-last { margin-left:0 !important; }', cssIdx++); 804 tgCss.insertRule(op.prefix + '*[class^="row-"], *[class*=" row-"] { opacity: 1; }', cssIdx++); 805 }, 806 setRowlayout = function(){ 807 var $target = $(this), $children = $target.children(), targetW = 0, 808 run = function(){ 809 targetW = $target.width(); 810 var _targetW = targetW, $hatg = $(), fixw = 0; 811 $children.removeClass( op.first ).removeClass( op.middle ).removeClass( op.last ); 812 $children.each(function(){ 813 var $tg = $( this ), tgsW = 0; 814 if( op.fixedContents == true || op.contentsAlign ) $tg.css( { width:"", "margin-left":"" } ); 815 tgsW = $tg.outerWidth( true ); 816 if( _targetW == targetW ){ 817 $tg.addClass( op.first ); 818 _targetW -= tgsW; 819 } else if ( _targetW >= tgsW-10 || _targetW >= $tg.outerWidth()-10 ){ 820 $tg.addClass( op.middle ); 821 _targetW -= tgsW; 822 } else { 823 $tg.prev().removeClass( op.middle ).addClass( op.last ); 824 $tg.addClass( op.first ); 825 _targetW = targetW - tgsW; 826 } 827 }); 828 $children.filter( ":last" ).removeClass( op.middle ).addClass( o
828p.last ); 829 $children.each(function(){ 830 var $this = $( this ); 831 $hatg = $hatg.add( $this ); 832 if( op.fixedContents == true || op.contentsAlign ) fixw += $this.outerWidth( true ); 833 if( $this.hasClass( op.last ) ){ 834 if( op.fixedContents == true || op.contentsAlign ){ 835 var _w = targetW - fixw; 836 if( _w > 10 ){ 837 if( op.contentsAlign ){ 838 if( op.contentsAlign == "center" ) _w = _w / 2; 839 if( op.contentsAlign == "left" ) _w = _w - 1; 840 $hatg.eq( 0 ).css( { "margin-left":_w + "px" } ); 841 } else { 842 var stepw = _w / $hatg.length; 843 $hatg.each(function(){ 844 $( this ).width( $( this ).width() + Math.floor( stepw ) ); 845 }); 846 } 847 } 848 fixw = 0; 849 } 850 if( op.autoHeight !== null ){ 851 op.autoHeight.forEach(function( target ){ 852 $hatg.find( target ).autoHeight(); 853 }); 854 } 855 $hatg.autoHeight(); 856 $hatg = $(); 857 } 858 }); 859 }, 860 init = function(){ 861 run(); 862 //$win.on( "debouncedresize", run ); 863 $win.on( "resize", run ); 864 }(); 865 }, 866 init = function(){ 867 setRowlayoutRule(); 868 $($targets.get().reverse()).each(setRowlayout); 869 }(); 870 return this; 871 }; 872 // * setSvgConvert ------------------------------------------------------------------------- 873 $.fn.setSvgConvert = function(){ 874 var $tgs = $(this), 875 setSvg = function(){ 876 var $img = $(this), imgID = $img.attr('id'), imgClass = $img.attr('class'), imgURL = $img.attr('src'), imgAlt = $img.attr('alt'); 877 $.get(imgURL, function(data) { 878 var $svg = $(data).find('svg'); 879 if(typeof imgID !== 'undefined') $svg.attr('id', imgID); 880 if(typeof imgClass !== 'undefined') $svg.attr('class', imgClass+' replaced-svg'); 881 if(typeof imgAlt !== 'undefined') $svg.prepend('<title>' + imgAlt + "</title>"); 882 $svg = $svg.removeAttr('xmlns:a'); 883 if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')) 884 $img.replaceWith($svg); 885 }, 'xml'); 886 }, 887 init = function(){ 888 $tgs.each(setSvg); 889 }(); 890 return this; 891 }; 892 // * setGoogleMap -------------------------------------------------------------------------- 893 $.setGoogleMap = function(options){ 894 var op = $.extend( { "mapTypeId":google.maps.MapTypeId.ROADMAP, panControl:false, zoomControl:true, mapTypeControl:false, scaleControl:false, streetViewControl:false, overviewMapControl:false, mapId:null, lat:null, lng:null, zoom:null, marker:null }, options ), 895 map = null, markers = [], lastInfoWindow = null, 896 addMarker = function(){ 897 if( op.marker == null ) return false; 898 op.marker.forEach(function( val, index ){ 899 var LatLng = new google.maps.LatLng( val.lat, val.lng ) 900 var marker = new google.maps.Marker( { position:LatLng, title:"", icon:val.markerImg } ); 901 marker.setMap( map ); 902 marker.openInfoWindow = function(){ 903 openInfoWindow( val.html, LatLng, marker ); 904 }; 905 if( val.html ) google.maps.event.addListener( marker, "click", marker.openInfoWindow ); 906 markers[ index ] = marker; 907 }); 908 }, 909 openInfoWindow = function( html, latLng, marker ){ 910 closeInfoWindow(); 911 var infoWindow = new google.maps.InfoWindow({ content:html, position:latLng }); 912 infoWindow.open( map, marker ); 913 lastInfoWindow = infoWindow; 914 }, 915 closeInfoWindow = function(){ 916 if( lastInfoWindow ) lastInfoWindow.close(); 917 }, 918 init = function(){ 919 if( op.mapId == null || op.lat == null || op.lng == null || op.zoom == null ) return false; 920 map = new google.maps.Map( document.getElementById( op.mapId ), { 921 center:new google.maps.LatLng( op.lat, op.lng ), 922 zoom:op.zoom, 923 mapTypeId:op.mapTypeId, 924 panControl:op.panControl, 925 zoomControl:op.zoomControl, 926 mapTypeControl:op.mapTypeControl, 927 scaleControl:op.scaleControl, 928 streetViewControl:op.streetViewControl, 929 overviewMapControl:op.overviewMapControl 930 }); 931 addMarker(); 932 }(); 933 this.getMarkers = function(){ 934 return markers; 935 }; 936 return this; 937 }; 938 939 /* class method -------------------------------------------------------------------------------*/ 940 // - navOpenCls ---------------------------------------------------------------------------- 941 $.navOpenCls = function(options){ 942 var op = $.extend( { target:"", bar:"", cls:"", bg:"", initEv:function(){}, openEv:function(){}, closeEv:function(){} }, options ), $win = $(window), $html = $("html"), st; 943 if( op.target && op.bar && op.cls ){ 944 var $tg = $( op.target ), $navBar = $( op.bar ), clsname = op.cls, opCk = false, 945 navClick = function(){ 946 if( opCk ){
947 $tg.removeClass( clsname ); 948 if(op.target == "html") $win.scrollTop(st); 949 op.closeEv(); 950 opCk = false; 951 } else { 952 if(op.target == "html"){ 953 st = $win.scrollTop(); 954 $html.css({top:-st}); 955 } 956 $tg.addClass( clsname ); 957 op.openEv(); 958 opCk = true; 959 } 960 return false; 961 }, 962 navClick2 = function(obj){ 963 if( obj.target.nodeName != "A" ){ 964 navClick(); 965 } 966 }, 967 init = function(){ 968 $tg.removeClass( clsname ); 969 $navBar.on( "click", navClick ); 970 if( $( op.bg ) ) $( op.bg ).on( "click", navClick2 ); 971 op.initEv(); 972 }(); 973 } 974 }; 975 // - runSmoothScroll ----------------------------------------------------------------------- 976 $.runSmoothScroll = function(options){ 977 var op = $.extend( { target:null, speed:1, offset:0 }, options ), 978 $win = $( window ), href = op.target, $tg = $( href === "#" || href === "" ? "html" : href ), position = $tg.offset().top - op.offset, wst = $win.scrollTop(), $body = $( "html" ); 979 $win.scrollTop( wst + 1 ); 980 if( $( "body" ).scrollTop() > 0 ) $body = $( "body" ); 981 if( $.checkUserAgent( "Android" ) ){ 982 $body.setTween( { scrollTop:position }, { time:op.speed, easing:'easeInOutCubic' } ); 983 } else { 984 $body.setTween( { scrollTop:position }, { time:op.speed, easing:'easeInOutCubic' } ); 985 } 986 }; 987 // - checkUserAgent ------------------------------------------------------------------------ 988 $.checkUserAgent = function(ua){ 989 if( dfv.ua === null ) dfv.ua = navigator.userAgent; 990 if( ua.indexOf( "MSIE" ) !== -1 ){ 991 if( dfv.ua.indexOf( "MSIE" ) !== -1 ){ 992 var ie = (function(){ 993 var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); 994 while( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); 995 return v > 4 ? v : undef; 996 }()), ieVer = "MSIE " + ie; 997 if( ieVer.indexOf( ua ) !== -1 ){ return true; } else { return false; } 998 } else { return false; } 999 } else if( dfv.ua.indexOf( ua ) !== -1 ){ return true; } else { return false; } 1000 }; 1001 // - preLoadImages ------------------------------------------------------------------------- 1002 $.preLoadImages = function(){ 1003 for( var i = 0, n = arguments[ 0 ].length; i < n; i++ ){ 1004 var img = new Image(); 1005 $( img ).load().attr( "src", arguments[ 0 ][ i ] ); 1006 } 1007 }; 1008 // - getHashName --------------------------------------------------------------------------- 1009 $.getHashName = function(){ 1010 if( dfv.hash === null ) dfv.hash = window.location.hash; 1011 return dfv.hash; 1012 }; 1013 // - hashScrool ---------------------------------------------------------------------------- 1014 $.hashScrool = function(options){ 1015 var op = $.extend( { hash:"", speed:1, offset:0 }, options ); 1016 if( op.hash && op.hash !== "#" ) $.runSmoothScroll( { target:op.hash, speed:op.speed, offset:op.offset } ); 1017 }; 1018 // - retrieveGETqs ------------------------------------------------------------------------- 1019 $.retrieveGETqs = function(){ 1020 var qsParm = new Array(), query = window.location.search.substring( 1 ), parms = query.split( '&' ); 1021 for( var i = 0; i < parms.length; i++ ){ 1022 var pos = parms[ i ].indexOf('='); 1023 if( pos > 0 ){ 1024 var key = parms[ i ].substring( 0, pos ), val = parms[ i ].substring( pos + 1 ); 1025 qsParm[ key ] = val; 1026 } 1027 } 1028 return qsParm; 1029 }; 1030 // - informationTool ----------------------------------------------------------------------- 1031 $.informationTool = function(options){ 1032 var op = $.extend({}, options), 1033 $win = $(window), 1034 $body = $("body"), 1035 $iw = $('<div id="LIW">\ 1036 <div id="LIW-main">\ 1037 <a href="javascript:;" id="LIW-open" data-target="#LIW-sub"><span><i class="fas fa-plus-square"></i></span></a>\ 1038 <span id="LIW-wh">ww<span id="LIW-wh-w"></span> wh<span id="LIW-wh-h"></span>(<span id="LIW-wh-ch"></span>)</span> / \ 1039 <span id="LIW-sc">s<span id="LIW-sc-s"></span></span/> / \ 1040 <span id="LIW-ck"><span id="LIW-ck-1"><span/></span>\ 1041 <a href="javascript:;" id="LIW-close"><i class="fal fa-times-circle"></i></a>\ 1042 </div>\ 1043 <div id="LIW-sub">\ 1044 <div>\ 1045 <table id="LIW-sub-meta"></table>\ 1046 </div>\ 1047 </div>\ 1048 </div>'), 1049 $box = $('<div id="LIW-box" />'), 1050 $w = $iw.find("#LIW-wh-w"), 1051 $h = $iw.find("#LIW-wh-h"), 1052 $ch = $iw.find("#LIW-wh-ch"), 1053 $s = $iw.find("#LIW-sc-s"), 1054 $ck1 = $iw.find("#LIW-ck-1"), 1055 $open = $iw.find("#LIW-open"), 1056 $close = $iw.find("#LIW-close"), 1057 $meta = $iw.find("#LIW-sub-meta"), 1058 ckc = 1, 1059 ck1 = [], 1060 ck2 = [], 1061 windowScrollTop, 1062 closeMode = true, 1063 newStyle = document.createElement('style'), 1064 stylesheets, 1065 cssRulesIdx, 1066 clientX, 1067 clientY, 1068 runResize = function(){ 1069 var w = $win.outerWidth(); 1070 $w.html(w); 1071 if(w <= 1024 && w >= 769) $w.append('<span>(iPad横[</span>l<span>])</span>'); 1072 if(w <= 768 && w >= 737) $w.append('<span>(iPad縦[</span>m<span>])</span>'); 1073 if(w <= 736 && w >= 415) $w.append('<span>(iPhone横[</span>ms<span>])</span>'); 1074 if(w <= 414) $w.append('<span>(iPhone縦[</span>s<span>])</span>'); 1075 $h.html($win.outerHeight()); 1076 $ch.html(Math.ceil($body.outerHeight())); 1077 }, 1078 runScroll = function(){ 1079 windowScrollTop = $win.scrollTop(); 1080 $s.html($win.scrollTop()); 1081 }, 1082 runClick = function(e){
1083 if(e.keyCode != 17) return false; 1084 if( !closeMode ) return false; 1085 var dx = clientX, dy = clientY; 1086 if(ckc == 1){ 1087 ck1["x"] = dx;ck1["y"] = dy + windowScrollTop; 1088 $ck1.html('<span>w</span>-<span>h</span>-<span> (x</span>' + ck1["x"] + '<span>y</span>' + ck1["y"] + '<span>|</span>-)'); 1089 $box.css({top:ck1["y"]+"px", left:ck1["x"]+"px"}); 1090 $body.append($box); 1091 ckc = 2; 1092 } else if(ckc == 2) { 1093 ck2["x"] = dx;ck2["y"] = dy + windowScrollTop; 1094 $ck1.html('<span>w</span>' + Math.abs(ck1["x"] - ck2["x"]) + '<span>h</span>' + Math.abs(ck1["y"] - ck2["y"]) + '<span> (x</span>' + ck1["x"] + '<span>y</span>' + ck1["y"] + '<span>|x</span>' + ck2["x"] + '<span>y</span>' + ck2["y"] + '<span>' + ')'); 1095 $box.css({width:Math.abs(ck1["x"] - ck2["x"])+"px", height:Math.abs(ck1["y"] - ck2["y"])+"px"}); 1096 if(ck1["x"] - ck2["x"] > 0) $box.css({left:ck2["x"]+"px"}); 1097 if(ck1["y"] - ck2["y"] > 0) $box.css({top:ck2["y"]+"px"}); 1098 $box.css({"line-height": Math.abs(ck1["y"] - ck2["y"]) + "px" }); 1099 $box.html('<span>w</span>' + Math.abs(ck1["x"] - ck2["x"]) + '<span> Ã h</span>' + Math.abs(ck1["y"] - ck2["y"])); 1100 ckc = 3; 1101 } else { 1102 $ck1.html(""); 1103 $box.html("").remove().css({width:"3px", height:"3px"}); 1104 ckc = 1; 1105 } 1106 }, 1107 getMeta = function(){ 1108 $meta.html('<tr><th>t</th><td>' + $("title").html() + '</td></tr><tr><th>k</th><td>' + $('meta[name="keywords"]').attr("content") + '</td></tr><tr><th>d</th><td>' + $('meta[name="description"]').attr("content") + '</td></tr>'); 1109 }, 1110 getAlt = function(){ 1111 var tgcnt = 0, enpcnt = 0; 1112 $('img,area').each(function(){ 1113 if($(this).attr("alt") == "") enpcnt++; 1114 tgcnt++; 1115 }); 1116 $meta.append('<tr><th>alt</th><td>' + tgcnt + "(" + enpcnt + ')</td></tr>'); 1117 }, 1118 getHlef = function(){ 1119 var tgcnt = 0, enpcnt = 0; 1120 $('a').each(function(){ 1121 if($(this).attr("href") == "") enpcnt++; 1122 tgcnt++; 1123 }); 1124 $meta.append('<tr><th>href</th><td>' + (tgcnt - 2) + "(" + enpcnt + ')</td></tr>'); 1125 }, 1126 init = function(){ 1127 newStyle.type = "text/css"; 1128 document.head.appendChild(newStyle); 1129 stylesheets = newStyle.sheet; 1130 cssRulesIdx = stylesheets.cssRules.length; 1131 stylesheets.insertRule('#LIW { position: fixed; z-index: 99999999999; width: 460px; bottom: 0; left: 0; padding: 3px; font-size: 12px; color: #AAA; line-height: 1; background-color: rgba(0,0,0,0.8); }', cssRulesIdx++); 1132 stylesheets.insertRule('#LIW-wh-w, #LIW-wh-h, #LIW-wh-ch, #LIW-sc-s, #LIW-ck-1, #LIW-ck-2, #LIW-sub { font-weight: bold; color: #FFF; }', cssRulesIdx++); 1133 stylesheets.insertRule('#LIW-wh-w span, #LIW-ck-1 span, #LIW-ck-2 span, #LIW-sub th { color: #AAA; }', cssRulesIdx++); 1134 stylesheets.insertRule('#LIW-box { position: absolute; z-index: 99999999999; width: 2px; height: 2px; font-size: 12px; font-weight: bold; text-align: center; background-color: rgba(255,255,255,0.6); border: solid 1px #EEE; white-space: nowrap; }', cssRulesIdx++); 1135 stylesheets.insertRule('#LIW-open, #LIW-close { color: #FFF; }', cssRulesIdx++); 1136 stylesheets.insertRule('#LIW-close { color: #FFF; position: absolute; right: 5px; }', cssRulesIdx++); 1137 stylesheets.insertRule('#LIW-sub > div { padding-top: 5px; }', cssRulesIdx++); 1138 stylesheets.insertRule('#LIW-sub-meta { border: solid 1px rgba(255,255,255,0.2); }', cssRulesIdx++); 1139 stylesheets.insertRule('#LIW-sub-meta th, #LIW-sub-meta td { padding: 2px; border-right: solid 1px rgba(255,255,255,0.2); border-bottom: solid 1px rgba(255,255,255,0.2); }', cssRulesIdx++); 1140 1141 $body.append($iw).css({ position: "relative"}); 1142 $win.on("resize", runResize); runResize(); 1143 $win.on("scroll", runScroll); runScroll(); 1144 $win.mousemove(function(e){ 1145 clientX = e.clientX; 1146 clientY = e.clientY; 1147 }); 1148 $win.keydown(function(e){ runClick(e); }); 1149 $close.on("click", function(){ $iw.hide(); closeMode = false; $box.remove(); $win.off("click", runClick); }); 1150 getMeta(); 1151 getAlt(); 1152 getHlef(); 1153 $open.setToggleOpen(); 1154 }(); 1155 }; 1156 1157})(jQuery);
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.