1/** 2 * SMART CMSå ±é颿° 3 * @version 1.1 4 */ 5 6/** 7 * ãã¡ã¤ã«ãªã³ã¯ã¯å¥çªè¡¨ç¤º 8 */ 9//$.fn.fileBlank = function() { 10// var target = this; 11// 12// target.each(function() { 13// $(this).attr("target", "_blank"); 14// }); 15//}; 16 17$.fn.fileBlank = function(ext_) { 18 19 var target = this; 20 21 this.addClass(ext_); 22 this.attr("target", "_blank"); 23 24 25}; 26 27 28 29/** 30 * classåã§å¥çªè¡¨ç¤ºï¼å¤é¨ãªã³ã¯ä»ï¼ 31 */ 32$.fn.jsBlankAddText = function() { 33 var target = this; 34 35 target.each(function() { 36 $(this).prepend('ï¼å¤é¨ãªã³ã¯ï¼'); 37 //$(this).append(' <img height="14" width="15" alt="å¤é¨ãµã¤ãã¸" src="./img_page/icon_blank.gif">'); 38 $(this).click(function(){ 39 window.open(this.href,'_blank'); 40 return false; 41 }); 42 }); 43}; 44 45/** 46 * classåã§å¥çªè¡¨ç¤º 47 */ 48$.fn.jsBlank = function() { 49 var target = this; 50 51 target.each(function() { 52 $(this).click(function(){ 53 window.open(this.href,'_blank'); 54 return false; 55 }); 56 }); 57}; 58 59/** 60 * ã¹ã ã¼ãºã¹ã¯ãã¼ã« 61 * $('a[href*=#].smoothCom').smoothScroll(); 62 */ 63$.fn.smoothScroll = function() { 64 var target = this; 65 66 target.each(function(){ 67 var href = $(this).attr("href"); 68 69 70 if(href=='#') { 71 $(this).click(function() { 72 return false; 73 }); 74 return true; 75 } 76 77 var hrefAry = href.match(/^([^#]*)#([^#]+)$/,function(whole,$1){ return $1 }); 78 79 if(hrefAry) { 80 var j = $( "#" + hrefAry[2] ); 81 if(j.size() > 0) { 82 83 jQuery.data($(this).get(0), "pos", j); 84 85 $(this).click(function() { 86 87 $('html,body').animate({scrollTop: jQuery.data($(this).get(0), "pos").offset().top}, 400, "linear", function(){ 88 location.hash = hrefAry[2]; 89 }); 90 return false; 91 }); 92 } 93 } 94 }); 95}; 96 97/** 98 * ç¾å¨ã®ã«ãã´ãªã_onã«ãã 99 *ã 100 * $("#header-nav .list li > a").categoryOn('^(/[^/]+/).*$'); 101 * $("#header-nav .list li > a").categoryOn('^/[^/]+(/[^/]+/).*$');ï¼ç¹å¥ã³ã³ãã³ãï¼ 102 * 103 * @param string å¤å®ãããã¹ç¯å²ï¼æ£è¦è¡¨ç¾ï¼ 104 */ 105$.fn.categoryOn = function(path) { 106 var target = this; 107 108 var regPath = new RegExp(path, "i"); 109 110 var req = location.pathname; 111 req = req.replace(regPath, '$1'); 112 113 target.each(function(idx){ 114 var href = $(this).attr("href"); 115 // ãã¡ã¤ã³ä»ããªã³ã¯ã§ãå転ã§ããããã«ãã 116 if(href.indexOf(req) > -1) { 117 var imgJ = $(this).find('img'); 118 imgJ.unbind('mouseenter').unbind('mouseleave'); 119 imgJ.attr('src', imgJ.attr('src').replace(/_off(\.gif|\.jpg|\.png)/,"_on"+'$1') ); 120 return false; 121 } 122 }); 123}; 124 125/** 126 * ._offã®ç»åããã¼ã«ãªã¼ãã¼ 127 * @param object è¨å® 128 */ 129$.fn.rollOver = function(_cfg) { 130 var target = this; 131 132 target.each(function(){ 133 $(this).hover(function () { 134 $(this).attr("src", $(this).attr("src").replace(_cfg.off, _cfg.on)); 135 },function () { 136 $(this).attr("src", $(this).attr("src").replace(_cfg.on, _cfg.off)); 137 }); 138 }); 139}; 140 141/** 142 * ãã¡ã¤ã³ã®è¡¨è¨ãIPã¢ãã¬ã¹ã«å¤æ 143 * @param object è¨å® 144 */ 145$.fn.urlTranslate = function(_cfg) { 146 var target = this; 147 148 target.each(function(){ 149 $(this).attr("href", $(this).attr("href").replace(_cfg.before, _cfg.after)); 150 }); 151}; 152 153/** 154 * ééãã¼ã«ãªã¼ãã¼ 155 */ 156$.fn.rollOverAlpha = function() { 157 var target = this; 158 159 target.hover(function(){ 160 $(this).fadeTo(100, 0.7); // ãã¦ã¹ãªã¼ãã¼ã§éæåº¦ã60%ã«ãã 161 },function(){ 162 $(this).fadeTo(100, 1.0); // ãã¦ã¹ã¢ã¦ãã§éæåº¦ã100%ã«æ»ã 163 }); 164}; 165 166/** 167 * æåãµã¤ãºå¤æ´ï¼æ¨æº or 大ããããï¼èæ¯è²å¤æ´ 168 * $.fn.styleCatcherUpNormal({btnCls: "scsize",cssID: "scsize",prAry: ['size_default.css', 'size_up.css', 'size_up2.css', 'size_up3.css'],cssPath: '/theme/base/css/',def: 0}); 169 * 170 * @param object è¨å® 171 */ 172$.fn.styleCatcherUpNormal = function(config) { 173 config = $.extend({ 174 btnCls: "scsize", 175 cssID: "scsize", 176 prAry: ['0.css', '1.css', '2.css', '3.css'], 177 cssPath: '/theme/base/css/', 178 def: 0, 179 imgCls: ['.normal-on', '.normal-off', '.big-on', '.big-off'] 180 },config); 181 182 var cssTag = $('<link rel="stylesheet" />');
183 cssTag.attr('id', config.cssID); 184 $("body").append(cssTag); 185 186 //parameter number 187 var prNum; 188 if($.cookie(config.cssID)) { 189 prNum = Number($.cookie(config.cssID)); 190 } else { 191 prNum = Number(config.def); 192 } 193 194 function offRollOver() { 195 $('.' + config.btnCls).each(function(){ 196 var img = $(this).find("img"); 197 img.unbind(); 198 }); 199 } 200 offRollOver(); 201 202 $('.' + config.btnCls).css("cursor", "pointer").css("cursor", "hand"); 203 204 $('.' + config.btnCls).click(function(){ 205 var j = $(this); 206 var img = j.find("img"); 207 var cl = j.attr("class"); 208 209 if(cl.indexOf("up") != -1) { 210 prNum++; 211 if(config.prAry.length-1 <= prNum) { 212 prNum = config.prAry.length-1; 213 $(config.imgCls[0] + ',' + config.imgCls[3]).addClass('hide'); 214 $(config.imgCls[1] + ',' + config.imgCls[2]).removeClass('hide'); 215 } else { 216 $(config.imgCls[0] + ',' + config.imgCls[2]).addClass('hide'); 217 $(config.imgCls[1] + ',' + config.imgCls[3]).removeClass('hide'); 218 } 219 220 } else if(cl.indexOf("normal") != -1) { 221 prNum = 0; 222 $(config.imgCls[1] + ',' + config.imgCls[2]).addClass('hide'); 223 $(config.imgCls[0] + ',' + config.imgCls[3]).removeClass('hide'); 224 } 225 226 $('#' + config.cssID).attr("href", config.cssPath + config.prAry[prNum]); 227 228 //prNumãä¿å 229 $.cookie(config.cssID, prNum, {path:'/'});
230 231 return false; 232 }); 233 234 $('#' + config.cssID).attr("href", config.cssPath + config.prAry[prNum]); 235}; 236 237/** 238 * æåãµã¤ãºï¼å°ãä¸ã大ï¼èæ¯è²å¤æ´ 239 * $.fn.styleCatcher({btnCls: "scColor",cssID: "scColor", cssPath:'/theme/base/css/',def: 2}); 240 * 241 * @param object è¨å® 242 */ 243$.fn.styleCatcher = function (config) { 244 config = $.extend({ 245 attr: 'id', 246 btnCls: 'scsize', 247 cssID: 'scsize', 248 cssPath: '/theme/base/css/', 249 def: 0 250 }, config); 251 var cssTag = $('<link rel="stylesheet">'); 252 cssTag.attr('id', config.cssID); 253 $('body').append(cssTag); 254 255 function offRollAndOn(_id) { 256 $('.' + config.btnCls).each(function (idx) { 257 var id = $(this).attr(config.attr); 258 var img = $(this).find('img'); 259 img.unbind(); 260 if (_id == id) { 261 img.attr('src', img.attr('src').replace('_off.', '_on.')); 262 } else { 263 img.attr('src', img.attr('src').replace('_on.', '_off.')); 264 img.hover(function () { 265 $(this).attr('src', $(this).attr('src').replace('_off.', '_on.')); 266 }, function () { 267 $(this).attr('src', $(this).attr('src').replace('_on.', '_off.')); 268 }); 269 } 270 }); 271 } 272 $('.' + config.btnCls).attr('href', '#'); 273 $('.' + config.btnCls).click(function () { 274 var id = $(this).attr(config.attr); 275 var img = $(this).find('img'); 276 offRollAndOn(id); 277 $('#' + config.cssID).attr('href', config.cssPath + id + '.css'); 278 $.cookie(config.cssID, id, { 279 path: '/' 280 }); 281 return false; 282 }); 283 var fileName; 284 if ($.cookie(config.cssID)) { 285 fileName = $.cookie(config.cssID); 286 } else { 287 fileName = $($('.' + config.btnCls).get(config.def)).attr(config.attr); 288 } 289 offRollAndOn(fileName); 290 $('#' + config.cssID).attr('href', config.cssPath + fileName + '.css'); 291}; 292 293/** 294 * æåãµã¤ãºå¤æ´ï¼æ¨æº or 大ããããï¼ 295 * HTMLã«ã¹ã¿ã ãã¼ã¿å±æ§ç 296 * $.fn.fontSizeSwitch(); 297 * 298 * @param object è¨å® 299 */ 300$.fn.fontSizeSwitch = function(config) { 301 config = $.extend({ 302 attr: 'data-fontsize', 303 switchID: 'scsize', 304 sizeAry: ['default', 'up', 'up2', 'up3'], 305 def: 0, 306 imgCls: { 307 normalOn: '.normal-on', 308 normalOff: '.normal-off', 309 bigOn: '.big-on', 310 bigOff: '.big-off' 311 }, 312 },config); 313 314 //targetEl 315 var $switch = $('.' + config.switchID); 316 317 //parameter number 318 var prNum; 319 if($.cookie(config.switchID)) { 320 prNum = Number($.cookie(config.switchID)) < config.sizeAry.length ? 321 Number($.cookie(config.switchID)) : 322 config.sizeAry.length - 1; 323 } else { 324 prNum = Number(config.def); 325 } 326 327 function isMax(prNum) { 328 return prNum >= config.sizeAry.length - 1; 329 } 330 331 function isMin(prNum) { 332 return prNum === 0; 333 } 334 335 function offRollOver() { 336 $switch.each(function(){ 337 var img = $(this).find("img"); 338 img.unbind(); 339 }); 340 } 341 offRollOver(); 342 343 //ãã©ã³ããµã¤ãºèå¥ç¨ãã¼ã¿å±æ§ä»ä¸ 344 function setData(prNum) { 345 $('html').attr(config.attr, config.sizeAry[prNum]); 346 //æ¨æºãã¿ã³ 347 $(config.imgCls.normalOff).toggleClass('hide', isMin(prNum)); 348 $(config.imgCls.normalOn).toggleClass('hide', !isMin(prNum)); 349 //æ¡å¤§ãã¿ã³ 350 $(config.imgCls.bigOff).toggleClass('hide', isMax(prNum)); 351 $(config.imgCls.bigOn).toggleClass('hide', !isMax(prNum)); 352 } 353 354 $switch.click(function(){ 355 if($(this).hasClass('up') && !isMax(prNum)) { 356 prNum++; 357 } else if($(this).hasClass('normal')) { 358 prNum = 0; 359 } 360 //ãã©ã³ããµã¤ãºå¤æ´ 361 setData(prNum); 362 //prNumãä¿å 363 $.cookie(config.switchID, prNum, {path:'/'});
364 365 return false; 366 }); 367 368 //ãã©ã³ããµã¤ãºåæå¤ 369 setData(prNum); 370}; 371 372/** 373 * èæ¯è²å¤æ´ 374 * ã«ã¹ã¿ã ãã¼ã¿å±æ§ç 375 * $.fn.bgColorSwitch(); 376 * 377 * @param object è¨å® 378 */ 379$.fn.bgColorSwitch = function (config) { 380 config = $.extend({ 381 attr: 'data-bgcolor', 382 switchID: 'sccolor', 383 def: 'color_normal', 384 }, config); 385 386 //targetEl 387 var $switch = $('.' + config.switchID); 388 389 //background ID 390 var bgId; 391 if ($.cookie(config.switchID)) { 392 bgId = $.cookie(config.switchID); 393 } else { 394 bgId = config.def; 395 } 396 397 //èæ¯è²èå¥ç¨ãã¼ã¿å±æ§ä»ä¸ 398 function setData(bgId) { 399 $('html').attr(config.attr, bgId); 400 } 401 402 $($switch).click(function () { 403 bgId = $(this).attr(config.attr); 404 setData(bgId); 405 $.cookie(config.switchID, bgId, {path: '/'}); 406 return false; 407 }); 408 409 setData(bgId); 410}; 411 412/** 413 * XPã®IE7ã¨ä»ã®OSã«ã¡ã¤ãªãªã®ãã©ã³ãæå® 414 */ 415$.fn.fontMeiryo = function() { 416 function getUserAgent() { 417 var obj = {}; 418 obj['userAgent'] = navigator.userAgent; 419 obj['os'] = null; 420 obj['osVersion'] = null; 421 obj['browser'] = null; 422 obj['browserVersion'] = null; 423 424 if(obj['userAgent'].match(/Win/)) { 425 obj['os']='win'; 426 } 427 428 if(obj['userAgent'].match(/Win(dows)?[ ]*(NT[ ]*5\.1|XP)/)) { 429 obj['osVersion']='xp'; 430 } 431 432 if(obj['userAgent'].match(/MSIE/)) { 433 obj['browser']='ie'; 434 var ary = obj['userAgent'].match(/MSIE[ ]*([0-9]+)/); 435 if(ary != null) { 436 obj['browserVersion']=Number(ary[1]); 437 } 438 } 439 440 return obj; 441 } 442 443 var userAgent = getUserAgent(); 444 if( (userAgent['osVersion'] == 'xp' && userAgent['browserVersion'] == '7') || userAgent['osVersion'] != 'xp' ) { 445 $("body").append('<style>body {font-family: "ãã©ã®ãè§ã´ Pro W3", "Hiragino Kaku Gothic Pro", "ã¡ã¤ãªãª", Meiryo, Osaka, "ï¼ï¼³ ï¼°ã´ã·ãã¯", "MS PGothic", sans-serif !important;} </style>'); 446 447 } 448}; 449 450/** 451 * 段çµã®åã ã«é«ããè¨å®ãã 452 * â»æåã®é«ããªã©ãå¤ãããããã©ã³ãã夿´ãã¦ããå®è¡ããã㨠453 * $(".level1Row2Mod").eqGroupHeight(2); 454 * 455 * @param integer æ®µçµæ° 456 */ 457$.fn.eqGroupHeight = function(turn_) { 458 var target = this; 459 target.each(function(){ 460 //æãããå確ä¿ããå¾ãé«ãæããâ¦ã«ã¼ã 461 var ary = new Array(); 462 463 //䏿¦ãé«ãããªã»ãã 464 $(this).find("> *").css('height', 'auto'); 465 466 $(this).find("> *").each(function(idx2_){ 467 ary.push($(this)); 468 if(ary.length >= turn_) { 469 var max = 0; 470 for (var i=0; i < ary.length; i++){ 471 max = Math.max(ary[i].height(), max); 472 } 473 for (var j=0; j < ary.length; j++){ 474 ary[j].height(max); 475 } 476 ary[0].addClass("first-left");//æåã®è¦ç´ ã«ã ãClassãæ¯ã 477 ary = new Array(); 478 } 479 }); 480 //æªã é åã«æ®ã£ã¦ããåãé«ãæãã 481 if(ary.length > 0) { 482 var max = 0; 483 for (var i=0; i < ary.length; i++){ 484 max = Math.max(ary[i].height(), max); 485 } 486 for (var j=0; j < ary.length; j++){ 487 ary[j].height(max); 488 } 489 ary[0].addClass("first-left");//æåã®è¦ç´ ã«ã ãClassãæ¯ã 490 } 491 }); 492}; 493 494/** 495 * 2é層1å 496 * $(".level2Row1Mod").level2Row1(); 497 */ 498$.fn.level2Col1 = function(config) { 499 config = $.extend({ 500 boxClass1: ".box", 501 boxClass2: ".box2", 502 },config); 503 504 var targetsJ = this; 505 var getUl = function(boxJ) { 506 return boxJ.find('ul'); 507 } 508 var getLi = function(boxJ) { 509 return boxJ.find('li'); 510 } 511 512 // box2ã®ã°ã«ã¼ãã¯ä¸ã¤ã«ã¾ã¨ããï¼ãã¼ã¸ä¸è¦§ï¼ 513 targetsJ.each(function(){ 514 var targetJ = $(this); 515 var boxes = targetJ.find('> ' + config.boxClass1 + ',> ' + config.boxClass2); 516 517 var tmpIsBox2 = false; 518 var tmpBox2; 519 boxes.each(function(idx_){ 520 var boxJ = $(this); 521 522 var isBox2 = boxJ.is(config.boxClass2); 523 if(!isBox2) { 524 tmpIsBox2 = false; 525 } 526 527 if(tmpIsBox2 && isBox2) { 528 tmpBox2.append(getLi(boxJ));
529 boxJ.remove(); 530 } 531 532 if(!tmpIsBox2 && isBox2) { 533 tmpBox2 = getUl(boxJ); 534 tmpIsBox2 = true; 535 } 536 }); 537 }); 538 539 // box2ã®ä¸ä¸ã«ãã¼ãã¼ãå ¥ãã 540 targetsJ.each(function(){ 541 var targetJ = $(this); 542 var boxes = targetJ.find('> ' + config.boxClass2); 543 544 boxes.each(function(idx_){ 545 var boxJ = $(this); 546 547 // ä¸ãä¸ã«ãã¼ãã¼ãå ¥ãã 548 if(boxJ.prev().is(config.boxClass + ',' + config.boxClass2)) {boxJ.addClass('borderTopCom');} 549 if(boxJ.next().is(config.boxClass + ',' + config.boxClass2)) {boxJ.addClass('borderBtmCom');} 550 }); 551 }); 552 553} 554 555/** 556 * 2é層2å 557 * $(".level2Row2Mod").level2Col2(); 558 */ 559$.fn.level2Col2 = function(config){ 560 config = $.extend({ 561 boxClass1: ".box", 562 boxClass2: ".box2", 563 floatClassL: "left-col", 564 floatClassR: "right-col" 565 },config); 566 567 var targetsJ = this; 568 569 targetsJ.each(function(){ 570 var parent = $(this); 571 572 var boxes = parent.find('> ' + config.boxClass1); 573 var col; 574 575 // æ¿å ¥ç®å°ãç½®ã 576 var marker = $('<div />'); 577 boxes.filter(':last').after(marker); 578 579 boxes.each(function(idx_){ 580 var box = $(this); 581 var parent = box.parent(); 582 583 if(idx_ % 2 == 0) { 584 col = $('<div class="col" />'); 585 marker.before(col); 586 box.addClass(config.floatClassL); 587 col.append(box); 588 } 589 if(idx_ % 2 == 1) { 590 box.addClass(config.floatClassR); 591 col.append(box); 592 } 593 }); 594 595 // æ¿å ¥ç®å°ãåé¤ 596 marker.remove(); 597 }); 598 599 // box2ã®ä¸ä¸ã«ãã¼ãã¼ãå ¥ãã 600 targetsJ.each(function(){ 601 var targetJ = $(this); 602 var boxes = targetJ.find('> ' + config.boxClass1); 603 604 boxes.each(function(idx_){ 605 var boxJ = $(this); 606 607 // ä¸ãä¸ã«ãã¼ãã¼ãå ¥ãã 608 if(boxJ.prev().is('.col')) {boxJ.addClass('border-top-com');} 609 if(boxJ.next().is('.col')) {boxJ.addClass('border-btm-com');} 610 }); 611 }); 612 613}; 614 615/** 616 * æåãµã¤ãºå¤æ´ç£è¦ 617 * $.fn.fontSizeChange({func:function(){ 618 * $(".level1Row2Mod").eqGroupHeight(2); 619 * $(".level2Row1Mod .list").eqGroupHeight(2); 620 * $("#wrapper").show(); 621 * }}); 622 * 623 * @param object è¨å® 624 */ 625$.fn.fontSizeChange = function(cfg_) { 626 function setFontSizeListener(func_) { 627 var s = $("<span />") 628 .text(" ") 629 .hide() 630 .appendTo("body"); 631 s.data("size", s.css("font-size")); 632 s.data("timer", setInterval(function(){ 633 if(s.css("font-size") != s.data("size")) { 634 s.data("size", s.css("font-size")); 635 func_(); 636 } 637 }, 1000)); 638 639 }; 640 641 cfg_.func(); 642 setFontSizeListener(cfg_.func); 643}; 644 645/** 646 * 横並ã³ç»åâ»ie6 zoom:0.97ã§ç»åãè½ã¡ãç¾è±¡ãè§£æ¶ãä¸ã®ãã£ãã·ã§ã³ãæãè¿ããã 647 */ 648$.fn.colImgSetWidth = function() { 649 650 var target = this; 651 var windowWidth = $(window).innerWidth(); 652 var windowSm = 768;//ãã¬ã¼ã¯ãã¤ã³ã 653 654 target.each(function(){ 655 656 var L = $(this).find(".left-col"); 657 var R = $(this).find(".right-col"); 658 659 var LImg = L.find("img"); 660 var RImg = R.find("img"); 661 662 if (!$.browser.msie && windowSm <= windowWidth || $.browser.msie && $.browser.version < 9) { 663 664 L.width(LImg.width()); 665 R.width(RImg.width()); 666 667 }else{ 668 669 L.removeAttr('style');; 670 R.removeAttr('style');; 671 672 } 673 674 }); 675 676}; 677 678/** 679 * å¸é·ã®äºå®è¡¨ã®åæ¥ç¥ã«è²ã¥ã 680 */ 681$.fn.shichoDonichi = function() { 682 var target = this; 683 684 target.each(function(){ 685 var day = $(this).find("td:eq(1)").text(); 686 687 if(day.indexOf("å") > -1) { 688 $(this).addClass("sat"); 689 } 690 if(day.indexOf("ç¥") > -1 || day.indexOf("æ¥") > -1) { 691 $(this).addClass("sun"); 692 } 693 }); 694}; 695 696/** 697 * tableã®align屿§åé¤ 698 */ 699$.fn.tableDeleteAlign = function() { 700 $("table").removeAttr("align"); 701}; 702 703/** 704 * ã¹ãã¼ããã©ã³ã¸ã®ãªã³ã¯ 705 * $.fn.smartphoneLink({smphDir:'i', img:'<img src="/theme/base/img_pc_common/smartphone.png" width="960" height="114" alt="ã¹ãã¼ããã©ã³å°ç¨ãµã¤ãã¸" />'}); 706 * 707 * @param object è¨å® 708 */ 709$.fn.smartphoneLink = function(cfg_) { 710 if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || 711 navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0) { 712 if(location.pathname.match(/^\/i\//) == null) { 713 $("body").prepend('<p id="smartphone"><a href="/' + cfg_.smphDir + location.pathname + '">' + cfg_.img + '</a></p>'); 714 } 715 } 716}; 717 718/** 719 * ã¹ãã¼ããã©ã³ã¸ãªãã¤ã¬ã¯ã 720 * $.fn.smartphoneRedirect({smphDir:'i', img:'<img src="/theme/base/img_pc_common/smartphone.png" width="960" height="114" alt="ã¹ãã¼ããã©ã³å°ç¨ãµã¤ãã¸" />'}); 721 * 722 * @param object è¨å® 723 */ 724$.fn.smartphoneRedirect = function(cfg_) { 725 if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || 726 navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0) { 727 if(location.pathname.match(/^\/i\//) == null) { 728 if($.cookie('pclink') != null) { 729 $('body').prepend('<p id="smartphone"><a href="/' + cfg_.smphDir + location.pathname + '">' + cfg_.img + '</a></p>'); 730 $('#smartphone a').on('click', function() { 731 $.cookie('pclink', null); 732 return true; 733 }); 734 return; 735 } 736 location.pathname = '/' + cfg_.smphDir + location.pathname; 737 } 738 } 739}; 740 741/** 742 * ã¹ããããPCã«æ»ããªã³ã¯ 743 * $('.smph2PcCom').smph2Pc({
744 * cookie: false 745 * }); 746 * 747 * @param object è¨å® 748 */ 749$.fn.smph2Pc = function(config_) { 750 config_ = $.extend({ 751 // ã¯ãªãã¯ãããã¨ãä¿æãã 752 cookie: false 753 },config_); 754 755 var targetsJ = this; 756 targetsJ.attr('href', location.pathname.replace(/^\/i/,"")); 757 targetsJ.on('click', function() { 758 if(config_.cookie) { 759 $.cookie('pclink', '1', { path: '/'}); 760 } 761 return true; 762 }); 763} 764 765/** 766 * ç»åã¿ã 767 * â»classHideã¯è¨å®ãã¦ãã ãããtabsã¨pagesã¯ä¸ã¤ã ãåå¨ããmodãæå®ãã¦ãã ããï¼idæå®ãæé©ï¼ 768 * $.fn.imgTab({defaultSelect:0,cookie:'topTab',tabs:$("#topTab .list li"),pages:$("#topTab .box")}); 769 * 770 * @param object è¨å® 771 */ 772$.fn.imgTab = function(config) { 773 var targetJ = this; 774 775 config = $.extend({ 776 tabs: null, 777 pages: null, 778 defaultSelect: 0, 779 cookie: 'tab', 780 off: '_off.', 781 on: '_on.', 782 classHide: 'hide' 783 }, config); 784 785 if (config.tabs == null || config.pages == null) { 786 return; 787 } 788 789 var ClassTab = function() {} 790 791 ClassTab.prototype = { 792 793 rollOver: function(select) { 794 var lis = config.tabs; 795 lis.each(function(idx){ 796 var index = lis.index(this); 797 var img = $(this).find("img"); 798 img.unbind("mouseenter").unbind("mouseleave"); //img.unbind('hover');ã§ã¯ã§ããªãããã 799 800 var replaceOn = function(j) { 801 j.each(function(){ 802 $(this).attr("src", $(this).attr("src").replace(config.off, config.on)); 803 }); 804 805 }; 806 var replaceOff = function(j) { 807 j.each(function(){ 808 $(this).attr("src", $(this).attr("src").replace(config.on, config.off)); 809 }); 810 }; 811 replaceOff(img); 812 if (select == idx) { 813 replaceOn(img); 814 } else { 815 img.hover(function() { 816 replaceOn(img); 817 }, function() { 818 replaceOff(img); 819 }); 820 } 821 }); 822 }, 823 showpage: function(select) { 824 config.pages.each(function(idx) { 825 if (idx == select) { 826 $(this).removeClass(config.classHide); 827 } else { 828 $(this).addClass(config.classHide); 829 } 830 }); 831 }, 832 init: function() { 833 834 var cls = this; 835 836 config.pages.each(function(idx) { 837 if (idx == config.defaultSelect) { 838 $(this).removeClass(config.classHide); 839 } else { 840 $(this).addClass(config.classHide); 841 } 842 }); 843 844 config.tabs.click(function() { 845 var idx = config.tabs.index(this); 846 cls.rollOver(idx); 847 cls.showpage(idx); 848 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 849 ariaTab(config.tabs, config.pages, idx); 850 //鏿ãããã¿ãã®çªå·ãã¯ããã¼ã«ä¿å 851 $.cookie(config.cookie, idx, {path: '/', expires: 30 }); 852 return false; 853 }); 854 855 config.tabs.keydown(function(e) { 856 var type = 'keydown'; 857 var $prev = $(this).prev('[role="tab"]'); 858 var $next = $(this).next('[role="tab"]'); 859 var $target; 860 switch (e.keyCode) { 861 case 37: //å·¦ç¢å°ï¼âï¼ 862 $target = $prev; 863 break; 864 case 39: //å³ç¢å°ï¼âï¼ 865 $target = $next; 866 break; 867 default: 868 $target = false; 869 break; 870 } 871 if ($target.length) { 872 var idx = config.tabs.index($target); 873 cls.rollOver(idx); 874 cls.showpage(idx); 875 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 876 ariaTab(config.tabs, config.pages, idx, type); 877 //鏿ãããã¿ãã®çªå·ãã¯ããã¼ã«ä¿å 878 $.cookie(config.cookie, idx, {path: '/', expires: 30 }); 879 return false; 880 } 881 }); 882 883 cls.rollOver(config.defaultSelect); 884 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 885 ariaTab(config.tabs, config.pages, config.defaultSelect); 886 } 887 }; 888 889 890 // åå鏿ã¿ã復å 891 if ($.cookie(config.cookie)) { 892 config.defaultSelect = $.cookie(config.cookie); 893 } 894 // ã¿ã使 895 var tab = new ClassTab();
896 tab.init(); 897 898}; 899 900/** 901 * ããã¹ãã¿ã 902 * â»classHideã¯è¨å®ãã¦ãã ãããtabsã¨pagesã¯ä¸ã¤ã ãåå¨ããmodãæå®ãã¦ãã ããï¼idæå®ãæé©ï¼ 903 * $.fn.textTab({defaultSelect:0,cookie:'topTab',tabs:$("#topTab .titleList li"),pages:$("#topTab .box")}); 904 * 905 * @param object è¨å® 906 */ 907$.fn.textTab = function(config) { 908 var targetJ = this; 909 910 config = $.extend({ 911 tabs: null, 912 pages: null, 913 defaultSelect: 0, 914 cookie: 'tab', 915 classHover: 'hover', 916 classHide: 'hide' 917 }, config); 918 919 if (config.tabs == null || config.pages == null) { 920 return; 921 } 922 923 var ClassTab = function() {} 924 ClassTab.prototype = { 925 rollOver: function(select) { 926 config.tabs.unbind("mouseenter").unbind("mouseleave"); //img.unbind('hover');ã§ã¯ã§ããªã 927 config.tabs.removeClass(config.classHover); 928 config.tabs.each(function(idx) { 929 var tabJ = $(this); 930 931 if (select == idx) { 932 tabJ.addClass(config.classHover); 933 } else { 934 tabJ.hover(function() { 935 tabJ.addClass(config.classHover); 936 }, function() { 937 tabJ.removeClass(config.classHover); 938 }); 939 } 940 }); 941 }, 942 showpage: function(select) { 943 944 config.pages.each(function(idx) { 945 if (idx == select) { 946 $(this).removeClass(config.classHide); 947 } else { 948 $(this).addClass(config.classHide); 949 } 950 }); 951 }, 952 init: function() { 953 var cls = this; 954 955 config.pages.each(function(idx) { 956 if (idx == config.defaultSelect) { 957 $(this).removeClass(config.classHide); 958 } else { 959 $(this).addClass(config.classHide); 960 } 961 }); 962 963 config.tabs.click(function() { 964 var idx = config.tabs.index(this); 965 cls.rollOver(idx); 966 cls.showpage(idx); 967 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 968 ariaTab(config.tabs, config.pages, idx); 969 //鏿ãããã¿ãã®çªå·ãã¯ããã¼ã«ä¿å 970 $.cookie(config.cookie, idx, {path: '/', expires: 30 }); 971 return false; 972 }); 973 974 config.tabs.keydown(function(e) { 975 var type = 'keydown'; 976 var $prev = $(this).prev('[role="tab"]'); 977 var $next = $(this).next('[role="tab"]'); 978 var $target; 979 switch (e.keyCode) { 980 case 37:ã//å·¦ç¢å°ï¼âï¼ 981 $target = $prev; 982 break; 983 case 39:ã//å³ç¢å°ï¼âï¼ 984 $target = $next; 985 break; 986 default: 987 $target = false; 988 break; 989 } 990 if ($target.length) { 991 var idx = config.tabs.index($target); 992 cls.rollOver(idx); 993 cls.showpage(idx); 994 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 995 ariaTab(config.tabs, config.pages, idx, type); 996 //鏿ãããã¿ãã®çªå·ãã¯ããã¼ã«ä¿å 997 $.cookie(config.cookie, idx, {path: '/', expires: 30 }); 998 return false; 999 } 1000 }); 1001 1002 cls.rollOver(config.defaultSelect); 1003 // ã¢ã¯ã»ã·ãã«å¯¾å¿ 1004 ariaTab(config.tabs, config.pages, config.defaultSelect); 1005 } 1006 }; 1007 1008 // åå鏿ã¿ã復å 1009 if ($.cookie(config.cookie)) { 1010 config.defaultSelect = $.cookie(config.cookie); 1011 } 1012 // ã¿ã使 1013 var tab = new ClassTab();
1014 tab.init(); 1015 1016}; 1017 1018 1019// ã¿ãã®ã¢ã¯ã»ã·ããªãã£å¯¾å¿ 1020function ariaTab(tabList, tabPanel, defaultSelect, actionType) { 1021 1022 // åæ¿ã¿ãã¸roleãaria-controlsãaria-selectedã®è¿½å 1023 var tabListParent = $(tabList).parent(); 1024 $(tabListParent).attr('role', 'tablist'); 1025 tabList.attr('role', 'tab'); 1026 1027 tabList.each(function(idx) { 1028 if ($('a', this).attr('href')) { 1029 if (idx == defaultSelect) { 1030 $(this).attr({ 1031 'aria-controls': $(this).find('a').attr('href').substr(1), 1032 'aria-selected': 'true' 1033 }); 1034 $('a',this).removeAttr('tabindex'); 1035 if( actionType == "keydown") { 1036 $('a',this).focus(); 1037 } 1038 } else { 1039 $(this).attr({ 1040 'aria-controls': $(this).find('a').attr('href').substr(1), 1041 'aria-selected': 'false' 1042 }); 1043 $('a',this).attr('tabindex','-1'); 1044 } 1045 } 1046 }); 1047 1048 //ãã¿ãããã«ã®roleãaria-hiddenã®è¿½å 1049 tabPanel.each(function(idx){ 1050 $(this).attr({"role":"tabpanel"}); 1051 if (idx == defaultSelect) { 1052 $(this).attr("aria-hidden","false"); 1053 } 1054 else{ 1055 $(this).attr("aria-hidden","true"); 1056 } 1057 }); 1058} 1059 1060 1061 1062 1063/** 1064 * ã·ã¼ãºã³ã®ç»åå·®ãæ¿ã 1065 * // 1 2 3 4 5 6 7 8 9 10 11 12 1066 * var seasons = [3, 3, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3]; 1067 * $('#headerGraphic').seasonClass({ 1068 * seasons:seasons 1069 * }); 1070 * ex.otsu 1071 * 1072 * @param object è¨å® 1073 */ 1074$.fn.seasonClass = function(config) { 1075 config = $.extend({ 1076 // 1 2 3 4 5 6 7 8 9 10 11 12 1077 seasons: [3, 3, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3] 1078 ,imgs: ['springCom', 'summerCom', 'autumnCom', 'winterCom'] 1079 },config); 1080 1081 // å£ç¯ã®ç»ååå¾ 1082 var month = (new Date()).getMonth(); 1083 var seasonNum = config.seasons[month]; 1084 var newImg = config.imgs[seasonNum]; 1085 1086 var targetsJ = this; 1087 1088 targetsJ.each(function() { 1089 var targetJ = $(this); 1090 targetJ.addClass(newImg); 1091 }); 1092}; 1093 1094/** 1095 * ã¢ã³ã¼ãã£ãªã³ 1096 * $('.accordionMod > li').accordion({ 1097 * classHead:'.title', 1098 * classBody:'.childs', 1099 * classToggle:'on' 1100 * }); 1101 * ex.fujii sp 1102 * 1103 * @param object è¨å® 1104 */ 1105$.fn.svAccordion = function(config) { 1106 var targetsJ = this; 1107 1108 config = $.extend({ 1109 classHead: '.head', 1110 classBody: '.body', 1111 classToggle: 'minus' 1112 },config); 1113 1114 var applyAccordion = function(targetJ) { 1115 1116 var headJ = targetJ.find(config.classHead); 1117 var bodyJ = targetJ.find(config.classBody); 1118 1119 // å ã éãã¦ããããã§ã㯠1120 if(!headJ.hasClass(config.classToggle)) { 1121 bodyJ.hide(); 1122 } 1123 1124 headJ.click(function() { 1125 if(bodyJ.is(':animated')) { 1126 return false; 1127 } 1128 1129 bodyJ.slideToggle("normal",function(){ 1130 if(bodyJ.is(':visible')) { 1131 headJ.addClass(config.classToggle); 1132 } else { 1133 headJ.removeClass(config.classToggle); 1134 } 1135 }); 1136 1137 return false; 1138 }); 1139 } 1140 1141 targetsJ.each(function(){ 1142 applyAccordion($(this)); 1143 }); 1144}; 1145 1146/** 1147 * ãã§ã¼ã ã¹ã©ã¤ãã¼ 1148 * $('#slider').smartSlider2({ 1149 * slider: '.list', 1150 * nav: '.navs', 1151 * play: '.ichiji', 1152 * playHTML: '<img width="21" height="20" alt="ç»åãéå§ãã" src="/theme/base/img_pc_top/slider_play.png"/>', 1153 * stopHTML: '<img width="21" height="20" alt="ç»åã忢ãã" src="/theme/base/img_pc_top/slider_ichiji.png"/>', 1154 * interval: 8000, 1155 * duration: 1000 1156 * }); 1157 * ex.odai 1158 * 1159 * @param object è¨å® 1160 */ 1161$.fn.fadeSlider = function (config) { 1162 var target = this; 1163 config = jQuery.extend({ 1164 slider: null, 1165 nav: null, 1166 play: null, 1167 playHTML:'ã¹ã©ã¤ããã', 1168 stopHTML:'䏿忢', 1169 interval:8000, 1170 duration:1000 1171 },config); 1172 1173 var sliderJ = target.find(config.slider); 1174 var sliderNum = 0;//slideãã¦ããçªå· 1175 var sliderMax = sliderJ.find('li').size(); 1176 var navJ = target.find(config.nav); 1177 var playJ = target.find(config.play); 1178 1179 // èªååæã 1180 var autoPlayID; 1181 var autoPlay = function () { 1182 clearInterval(autoPlayID); 1183 autoPlayID = setInterval(function () { 1184 nextSlide(); 1185 }, config.interval); 1186 }; 1187 autoPlay(); 1188 1189 // èªååæã忢 1190 var autoStop = function () { 1191 clearInterval(autoPlayID); 1192 }; 1193 1194 // ç¾å¨ä½ç½®ãã使 1195 var createNav = function() { 1196 sliderJ.find('li').each(function() { 1197 navJ.append('<span />'); 1198 });
1199 navJ.find('span').each(function() { 1200 var li = $(this); 1201 li.hover(function() { 1202 sliderNum = $(this).index(); 1203 slide(); 1204 autoStop(); 1205 }, 1206 function() { 1207 if(autoPlayState) { 1208 autoPlay(); 1209 } 1210 1211 1212 }); 1213 }); 1214 }; 1215 createNav(); 1216 1217 // 䏿忢 1218 var autoPlayState = true; 1219 var applyPlay = function() { 1220 if(autoPlayState) { 1221 playJ.html(config.stopHTML); 1222 } else { 1223 playJ.html(config.playHTML); 1224 } 1225 }; 1226 var settingPlay = function() { 1227 playJ.click(function() { 1228 autoPlayState = !autoPlayState; 1229 if(autoPlayState) { 1230 autoPlay(); 1231 } else { 1232 autoStop(); 1233 } 1234 applyPlay(); 1235 }); 1236 applyPlay(); 1237 }; 1238 settingPlay(); 1239 1240 // ã¹ã©ã¤ãåæå 1241 var initSlide = function() { 1242 var liJ = sliderJ.find('li').eq(sliderNum); 1243 sliderJ.find('li:visible').hide(); 1244 //sliderJ.find('li').eq(sliderNum).show();; 1245 navJ.find('span').eq(sliderNum).addClass('active'); 1246 liJ.show(); 1247 1248 }; 1249 initSlide(); 1250 1251 // é«ãé©ç¨ 1252 var apllyImgH = function() { 1253 var liJ = sliderJ.find('li').eq(sliderNum); 1254 var ulJ = liJ.parent(); 1255 ulJ.height(liJ.height()); 1256 } 1257 apllyImgH(); 1258 1259 // ã¢ã¯ãã£ããªç»åã«ã¹ã©ã¤ã 1260 var slide = function() { 1261 var liJ = sliderJ.find('li').eq(sliderNum); 1262 var ulJ = liJ.parent(); 1263 ulJ.stop(true,true).animate({height:liJ.height()+'px'}, config.duration); 1264 1265 sliderJ.find('li:visible').stop(true,true).animate({ opacity: 'hide'}, config.duration); 1266 //sliderJ.find('li').eq(sliderNum).stop(true,true).animate({ opacity: 'show'}, config.duration); 1267 liJ.stop(true,true).animate({ opacity: 'show'}, config.duration); 1268 1269 navJ.find('span').removeClass('active'); 1270 navJ.find('span').eq(sliderNum).addClass('active'); 1271 1272 }; 1273 1274 // 次ã®ã¹ã©ã¤ãç»å㸠1275 var nextSlide = function() { 1276 //alert('test'); 1277 sliderNum++; 1278 if(sliderNum >= sliderMax) { 1279 sliderNum = 0; 1280 } 1281 slide(); 1282 }; 1283} 1284 1285/** 1286 * ãã§ã¼ã ã¹ã©ã¤ãã¼ 1287 * $('#slider').simpleLoopSlider({autoSlide : true,interval : 8000,easing : 'easeInOutExpo',duration : 1500}); 1288 * ex.honjo 1289 * 1290 * @param object è¨å® 1291 */ 1292$.fn.slideSlider = function (options) { 1293 var self = $(this); 1294 var li = self.find("li"); 1295 if(li.size() <= 1) { 1296 options.controller = false; 1297 options.pagination = false; 1298 } 1299 1300 var defaults = { 1301 controller: true, 1302 pagination: true, 1303 interval : 3000, 1304 duration : 300, 1305 easing : 'linear' 1306 }; 1307 1308 var o = $.extend(defaults, options); 1309 1310 var ichiji = false; 1311 var over = false; 1312 1313 this.each(function () { 1314 1315 var $slider = $(this), 1316 $prev = $slider.find('.slL'), 1317 $next = $slider.find('.slR'), 1318 $view = $slider.find('.box'), 1319 $container = $view.find('.list'), 1320 $contents = $container.find('li'), 1321 $firstChild = $contents.filter(':first-child'), 1322 $lastChild = $contents.filter(':last-child'), 1323 $stop = $slider.find('.ichiji a'); 1324 1325 var size = { 1326 width : $view.width(), 1327 height: $view.height() 1328 }; 1329 1330 var count = { 1331 min : 0, 1332 max : $contents.length, 1333 current: 0 1334 }; 1335 1336 $container.css({ 1337 width : size.width * ($contents.length + 2) 1338 }); 1339 1340 // slider 1341 var distance; 1342 1343 // 飿ãããã¨ãã«ã¢ãã¡ã¼ã·ã§ã³çµããã®è£æ£ãèµ°ããæ¬¡ãèµ°ã£ã¦è¡¨ç¤ºããããããªãç¾è±¡åé¿ 1344 var apllyBefore = function() { 1345 if(count.current == 0) { 1346 $firstChild.css('left', 0); 1347 $container.css('left', 0); 1348 } 1349 if(count.current == (count.max -1)) { 1350 $lastChild.css('left', ''); 1351 $container.css('left', -(size.width * ($contents.length - 1))); 1352 } 1353 }; 1354 1355 var apply = function() { 1356 distance = size.width * count.current; 1357 1358 if((count.current >= count.min) && (count.current < count.max)) { 1359 $container.stop(true, false).animate({left: -distance}, o.duration, o.easing); 1360 } 1361 else { 1362 if(count.current < count.min) { 1363 $lastChild.css('left', -(size.width * $contents.length)); 1364 $container.stop(true, false).animate({left: -distance}, o.duration, o.easing,function () { 1365 $lastChild.css('left', ''); 1366 $container.css('left', -(size.width * ($contents.length - 1))); 1367 }); 1368 count.current = count.max -1 ; 1369 1370 } 1371 else if(count.current >= count.max) { 1372 $firstChild.css('left', size.width * $contents.length); 1373 $container.stop(true, false).animate({left: -distance}, o.duration, o.easing,function () { 1374 $firstChild.css('left', 0); 1375 $container.css('left', 0); 1376 }); 1377 count.current = 0; 1378 } 1379 } 1380 1381 $pagination.children('a').removeClass('current'); 1382 $pagination.children('a:eq(' + count.current + ')').addClass('current'); 1383 } 1384 1385 var next = function () { 1386 apllyBefore(); 1387 count.current++; 1388 apply(); 1389 }; 1390 1391 var index = function (index) { 1392 apllyBefore(); 1393 count.current = index; 1394 apply(); 1395 }; 1396 1397 var prev = function () { 1398 apllyBefore(); 1399 count.current--; 1400 apply(); 1401 }; 1402 1403 var $pagination = $slider.find('.navs'); 1404 $contents.each(function (i) { 1405 $('<a/>').attr('href', '#') 1406 .text(i + 1) 1407 .appendTo($pagination) 1408 .click(function (e) { 1409 e.preventDefault(); 1410 index(i); 1411 ichiji = false; 1412 play(); 1413 setItiji(); 1414 }); 1415 });
1416 1417 $pagination.find('a:first-child').addClass('current'); 1418 1419 // ç¹°ãè¿ãããªã»ãããã¦ã¹ã¿ã¼ã 1420 var timerID; 1421 var play = function () { 1422 clearInterval(timerID); 1423 timerID = setInterval(function () { 1424 if(ichiji) { 1425 return; 1426 } 1427 if(over) { 1428 return; 1429 } 1430 next(); 1431 }, o.interval); 1432 }; 1433 1434 $prev.click(function () { 1435 prev(); 1436 ichiji = false; 1437 play(); 1438 setItiji(); 1439 return false; 1440 }); 1441 $next.click(function () { 1442 next(); 1443 ichiji = false; 1444 play(); 1445 setItiji(); 1446 return false; 1447 }); 1448 1449 $stop.click(function () { 1450 if(ichiji) { 1451 ichiji = false; 1452 play(); 1453 setItiji(); 1454 } 1455 else { 1456 ichiji = true; 1457 setItiji2(); 1458 } 1459 return false; 1460 }); 1461 1462 var setItiji = function() { 1463 var img = $stop.find('img'); 1464 var src = img.attr('src'); 1465 src = src.replace('itiji2.', 'itiji.'); 1466 img.attr('src', src); 1467 }; 1468 1469 var setItiji2 = function() { 1470 var img = $stop.find('img'); 1471 var src = img.attr('src'); 1472 src = src.replace('itiji.', 'itiji2.'); 1473 img.attr('src', src); 1474 }; 1475 1476 $contents.hover( 1477 function () { 1478 over = true; 1479 }, 1480 function () { 1481 over = false; 1482 play(); 1483 } 1484 ); 1485 play(); 1486 }); 1487}; 1488 1489 1490 1491 1492/** 1493 * ã¹ããåãã©ã¤ãããã¯ã¹ 1494 * 1495 * @param object è¨å® 1496 */ 1497$.fn.lightbox = function(config) { 1498 var targetJ = this; 1499 1500 config = $.extend({ 1501 modalBg:null, 1502 modal:null, 1503 close:null, 1504 scrollID:'sWrapper', 1505 lightSpot:null 1506 },config); 1507 1508 if(config.modalBg == null || config.modal == null) { 1509 return; 1510 } 1511 1512 // ç°¡æã¹ã¯ãã¼ã« 1513 var anchorScroll = function(id){ 1514 var j = $( "#" + id); 1515 if(j.size() == 0) { 1516 return; 1517 } 1518 $('html,body').animate({scrollTop: j.offset().top}, 200, "linear"); 1519 } 1520 1521 1522 var applyModal = function(targetJ) { 1523 1524 1525 var showModal = function() { 1526 var docH = $(document).height(); 1527 config.modalBg.height(docH); 1528 config.modalBg.fadeIn(200); 1529 config.modal.fadeIn(200); 1530 config.lightSpot.css({'z-index': '99'}); 1531 }; 1532 1533 var hideModal = function() { 1534 config.modalBg.hide(); 1535 config.modal.hide(); 1536 anchorScroll(config.scrollID); 1537 config.lightSpot.css({'z-index': 'auto'}); 1538 }; 1539 1540 1541 1542 targetJ.click(function() { 1543 showModal(); 1544 return false; 1545 }); 1546 config.close.click(function() { 1547 hideModal(); 1548 return false; 1549 }); 1550 config.modalBg.click(function() { 1551 hideModal(); 1552 return false; 1553 }); 1554 1555 1556 } 1557 1558 applyModal(targetJ); 1559}; 1560 1561/** 1562 * ããã¼ã¯ãªãã¯æ°ã«ã¦ã³ã 1563 * $('.kokokuMod .list a').bannerClick({ 1564 * title:'åºåã¯ãªãã¯æ°' 1565 * }); 1566 * 1567 * @param object è¨å® 1568 */ 1569$.fn.bannerClick = function(config_) { 1570 var targetJ = this; 1571 1572 config_ = $.extend({ 1573 title:'åºåã¯ãªãã¯æ°' 1574 },config_); 1575 1576 targetJ.click(function(){ 1577 //_gaq.push(['_trackEvent', config_.title, $(this).find("img").attr('alt'), $(this).attr('href')]);// oldï¼æ§ï¼ 1578 if(typeof ga == 'function'){ 1579 ga('send', 'event', config_.title, 'click', $(this).find("img").attr('alt') + 'ï¼' + $(this).attr('href'));// newï¼ã¦ããã¼ãµã«ï¼ 1580 } 1581 }); 1582}; 1583 1584/** 1585 * ããã¼ã¯ãªãã¯æ°ã«ã¦ã³ã(GA4ç¨) 1586 * $('.kokokuMod .list a').bannerClick2({ 1587 * category:'åºåã¯ãªãã¯æ°' 1588 * }); 1589 * 1590 * @param object è¨å® 1591 */ 1592$.fn.bannerClick2 = function(config_) { 1593 var targetJ = this; 1594 1595 config_ = $.extend({ 1596 action:'sv_banner_click', 1597 category:'åºåã¯ãªãã¯æ°', 1598 label:'', 1599 value: 1 1600 },config_); 1601 1602 targetJ.click(function(){ 1603 //GA4ç¨ 1604 if(typeof gtag == 'function'){ 1605 gtag('event', config_.action, { 1606 'event_category': config_.category, 1607 'event_label': $(this).find("img").attr('alt') + 'ï¼' + $(this).attr('href'), 1608 'value': config_.value 1609 }); 1610 } 1611 }); 1612}; 1613 1614 1615 1616/** 1617 * snsãã¿ã³ 1618 * $("body").snsConstraction(); 1619 * 1620 */ 1621 1622$.fn.snsConstraction = function() { 1623 //opacityã¯ie9以éããããã¼ããã¦ããã®ã§ 1624 if(jQuery.support.opacity){ 1625 //IE8æªæºã¯åºããªã 1626 var socialJ = $('#social'); 1627 // twitter 1628 var twitterJ = socialJ.find('#twitter'); 1629 1630 if (twitterJ.size() > 0) { 1631 twitterJ.socialbutton('twitter', { 1632 button: 'horizontal' 1633 }); 1634 } 1635 1636 // google 1637 var google_plusoneJ = socialJ.find('#google_plusone'); 1638 1639 if (google_plusoneJ.size() > 0) { 1640 google_plusoneJ.socialbutton('google_plusone', { 1641 lang: 'ja', 1642 size: 'medium' 1643 }); 1644 } 1645 1646 // facebook_like 1647 var facebook_likeJ = socialJ.find('#facebook_like'); 1648 1649 if (facebook_likeJ.size() > 0) { 1650 facebook_likeJ.socialbutton('facebook_like', { 1651 button: 'button_count' 1652 }); 1653 } 1654 } 1655}; 1656 1657 1658 1659 1660 1661/** 1662 * ã¤ãã³ãã¹ã©ã¤ãã¼ 1663 * $("body").snsConstraction(); 1664 * 1665 */ 1666$.fn.eventSlider = function() { 1667 1668//é¢é£ã¤ãã³ãã¹ã©ã¤ãã¼ï¼device width ã§ææ°åãæ¿ããï¼ 1669 1670 (function(){ 1671 1672 var sliderOption = function(){ 1673 1674 //device widthå¥ã«ææ°ã決ãã 1675 var windowWidth = $(window).innerWidth(); 1676 var windowSm = 768;//ãã¬ã¼ã¯ãã¤ã³ã 1677 var optionArry; 1678 1679 //[maxSlidesã¨minSlides,slideMargin] 1680 if ($.browser.msie && $.browser.version < 9) { 1681 optionArry = [2,15]; 1682 }else if(windowWidth <= windowSm){ 1683 optionArry = [1,0]; 1684 }else{ 1685 optionArry = [2,15]; 1686 } 1687 return optionArry; 1688 } 1689 1690 var optionValue = sliderOption(); 1691 1692 //bxã¹ã©ã¤ãã¼åããã¨ãã®ãªãã·ã§ã³ 1693 var sliderPageMove = { 1694 auto: true 1695 ,autoControls: true 1696 ,speed:1000 1697 ,pause:5000 1698 ,slideWidth: 638 1699 ,maxSlides: optionValue[0] 1700 ,minSlides: optionValue[0] 1701 ,slideMargin: optionValue[1] 1702 ,pager:false 1703 ,moveSlides:1 1704 ,responsive: true 1705 } 1706 1707 var sliderTarget = $('#event-page-slider .bxslider .list,#slider-parts .bxslider .list'); 1708 var slider1 = sliderTarget.bxSlider(sliderPageMove); 1709 1710 1711 //ãªãµã¤ãºããããdevice widthå¥ã«ææ°ã決ãç´ãã¦ããªãã¼ããã 1712 $(window).on('resize',function(e){
1713 1714 if(sliderTarget.length){ 1715 e.preventDefault(); 1716 1717 //ã¹ã©ã¤ãã¼ãåãã¦ãªãã¨ãreloadSliderã¡ã½ããã使ããªãã®ã§ãåã³ã¹ã©ã¤ãã¼ãå®è¡ã 1718 optionValue = sliderOption(); 1719 1720 //bxã¹ã©ã¤ãã¼åããã¨ãã®ãªãã·ã§ã³ãè¨å®ãç´ã 1721 sliderPageMove['maxSlides'] = optionValue[0]; 1722 sliderPageMove['minSlides'] = optionValue[0]; 1723 sliderPageMove['slideMargin'] = optionValue[1]; 1724 1725 //ãªãã¼ã 1726 slider1.reloadSlider(sliderPageMove); 1727 } 1728 1729 }); 1730 1731 })(); 1732 1733 1734 (function(){ 1735 1736 //ã¤ãã³ãç®æ¬¡ã¹ã©ã¤ãã¼ 1737 var sliderListMove = { 1738 1739 auto: true 1740 ,autoControls: true 1741 ,speed:1000 1742 ,pause:5000 1743 ,maxSlides: 1 1744 ,minSlides: 1 1745 ,pager:false 1746 ,moveSlides:1 1747 ,responsive: true 1748 1749 } 1750 1751 var slider2 = $('.event-pickup-area .bxslider .list').bxSlider(sliderListMove); 1752 var slider3 = $('.event-today-area .bxslider .list').bxSlider(sliderListMove); 1753 1754 })(); 1755 1756}; 1757 1758 1759/** 1760 * Jalert åå¾è¡¨ç¤º 1761 * @param ... 1762 * @version 0.1 1763 * @return ... Returns {@ code} 1764 */ 1765 $.fn.jAlertListView = function(config){ 1766 config = $.extend({ 1767 rssPath:'', 1768 historyPath:'', 1769 historyClass:'.more', 1770 listClass:'.list', 1771 limit:'5', 1772 type:'1', 1773 html:'' 1774 },config); 1775 1776 $.ajax({
1777 url:config.rssPath, 1778 timeout: 10000, 1779 dataType: "json", 1780 context:this, 1781 success:function(json){ 1782 if(json.success) { 1783 //å徿å 1784 1785 //ããã©ã«ãã®Jalert 1786 var defalt_html = '<div class="jalert-area"><dl><dt class="title"><span class="bg"><span class="bg2">J-ALERTï¼å ¨å½ç¬æè¦å ±ã·ã¹ãã ï¼</span></span></dt><dd class="in"><ul class="list"></ul><p class="more"></p></dd></dl></div>'; 1787 1788 //xmlé åã夿°ã«æ ¼ç´ 1789 var itemList = json.data; 1790 //çºå¸ããã¦ããªããã°ãªã«ãããªã 1791 if(itemList.length == 0){ 1792 return; 1793 } 1794 1795 //ã«ã¹ã¿ã ãããJalertHTMLãç¢ºèª 1796 var $parentBox = $(this); 1797 var $jAlertBox = function(){ 1798 //htmlãç¡ããã°ããã©ã«ãåºã 1799 var $jalert_html = $(defalt_html); 1800 if(config.html==''){ 1801 return $jalert_html; 1802 }else{ 1803 return config.html; 1804 } 1805 }; 1806 //JAlertã®ããã¯ã¹çæ 1807 $parentBox.append($jAlertBox); 1808 //å±¥æ´ãªã³ã¯è¨ç½® 1809 var $historyLink = $($parentBox).find(config.historyClass); 1810 var $historyA = $('<a href="#">éå»ã®é ä¿¡å±¥æ´ãè¦ã</a>') 1811 $historyA.attr('href',config.historyPath); 1812 $historyLink.append($historyA); 1813 1814 //çºå¸ãããJAlertãªã¹ãã®æ ¼ç´ããã¯ã¹ãå®ç¾© 1815 var $jalertListBox = $($parentBox).find(config.listClass); 1816 1817 //xmlãã¼ã¿ãã¾ãã 1818 $(itemList).each(function(idx){ 1819 1820 1821 if(config.limit!='0'){ 1822 if(idx >= config.limit){ 1823 return false;//break 1824 } 1825 } 1826 1827 var jalertTitle = this.title; 1828 var jalertLink = this.link; 1829 var jalertDate = this.pubDate; 1830 var date = new Date(jalertDate); 1831 var dateText = 'ï¼é ä¿¡æ¥ï¼' + date.getFullYear() + 'å¹´' + (date.getMonth() + 1) + 'æ' + date.getDate() + 'æ¥ï¼'; 1832 //ãªã¹ãçæ 1833 var $li = $('<li><a href="#"></a></li>'); 1834 //ãªã³ã¯çæ 1835 var $liA = $li.find('a'); 1836 $liA.attr('href', jalertLink); 1837 $liA.html(jalertTitle + dateText); 1838 $jalertListBox.append($li); 1839 1840 }); 1841 } 1842 } 1843 });}; 1844 1845 1846/** 1847 * SmartAlert 1848 * @param ... 1849 * @return ... Returns {@ code} 1850*/ 1851$.fn.smartAlertListView = function(config){ 1852 1853 // åæå¤ 1854 config = $.extend({ 1855 rssPath: site_domain + '/cgi-bin/smart_alert.php/1', 1856 historyPath: site_domain + '/cgi-bin/smart_alert.php/1/list', 1857 historyClass: '.more', 1858 ulClass: '.list', 1859 textClass: '.text', 1860 dateClass: '.date', 1861 limit: 3, 1862 dateformat: 'YYYYå¹´MMæDDæ¥(WW) hhæmmåssç§', 1863 noDataView: 1, 1864 },config); 1865 1866 // ãã©ã¡ã¼ã¿ã¼ã®ã¨ã©ã¼å¤å® 1867 var errorMsg = ''; 1868 for(key in config) { 1869 var value = config[key]; 1870 // 空æåã®å¤å® 1871 if(value === '') { 1872 errorMsg += 'ã¨ã©ã¼ï¼' + key + 'ã«ç©ºæåãå ¥ã£ã¦ãã¾ã\n'; 1873 } else { 1874 // æ°å¤ãã©ããã®å¤å® 1875 if(key === 'limit' || key === 'noDataView') { 1876 if($.type(value) !== 'number'){ 1877 errorMsg += 'ã¨ã©ã¼ï¼' + key + 'ã«æååãå ¥ã£ã¦ãã¾ã\n'; 1878 } 1879 // æååãã©ããã®å¤å® 1880 } else { 1881 if($.type(value) !== 'string') { 1882 errorMsg += 'ã¨ã©ã¼ï¼' + key + 'ã«æ°å¤ãå ¥ã£ã¦ãã¾ã\n'; 1883 } 1884 } 1885 } 1886 } 1887 // ã¨ã©ã¼ããã°å®è¡ããªã 1888 if(errorMsg) { 1889 console.error(errorMsg); 1890 // ã¨ã©ã¼ãªããã°å®è¡ 1891 } else { 1892 $.ajax({
1893 url:config.rssPath, 1894 timeout: 10000, 1895 dataType: 'json', 1896 context:this, 1897 success:function(json){ 1898 var itemList = json.data; //xmlé åã夿°ã«æ ¼ç´ 1899 var $parentBox = this; //表示ã¨ãªã¢ã鏿 1900 var $smartAlertUlBox = $parentBox.find(config.ulClass); //ulã¿ã°ã鏿 1901 var $li = $smartAlertUlBox.find('li:first'); //liã¿ã°ã鏿 1902 var litags = ''; 1903 // -------------------------------------------- 1904 //ã¢ã©ã¼ããããã° 1905 if(itemList.length){ 1906 //ä¸è¦§ãã¼ã¸ã¸ã®ãªã³ã¯å è¨å® 1907 $($parentBox).find(config.historyClass + ' a').attr('href', config.historyPath); 1908 //xmlãã¼ã¿ãã¾ãã 1909 $(itemList).each(function(idx){ 1910 if(idx >= config.limit){ 1911 return false; 1912 } 1913 //ã¢ã©ã¼ãå 容ã®ä½æ 1914 var smartAlertTitle = this.title; 1915 var smartAlertLink = this.link; 1916 //ã¢ã©ã¼ãæ¥ä»ã®ä½æ 1917 var date = new Date(this.pubDate); 1918 var weekday = ['æ¥', 'æ', 'ç«', 'æ°´', 'æ¨', 'é', 'å']; 1919 var dateText = config.dateformat; 1920 dateText = dateText.replace(/YYYY/, date.getFullYear()); 1921 dateText = dateText.replace(/MM/, ('0' + (date.getMonth() + 1)).slice(-2)); 1922 dateText = dateText.replace(/DD/, ('0' + date.getDate()).slice(-2)); 1923 dateText = dateText.replace(/WW/, weekday[date.getDay()]); 1924 dateText = dateText.replace(/hh/, ('0' + date.getHours()).slice(-2)); 1925 dateText = dateText.replace(/mm/, ('0' + date.getMinutes()).slice(-2)); 1926 dateText = dateText.replace(/ss/, ('0' + date.getSeconds()).slice(-2)); 1927 dateText = dateText.replace(/M/, date.getMonth() + 1); 1928 dateText = dateText.replace(/D/, date.getDate()); 1929 dateText = dateText.replace(/h/, date.getHours()); 1930 dateText = dateText.replace(/m/, date.getMinutes()); 1931 dateText = dateText.replace(/s/, date.getSeconds()); 1932 //ãªã³ã¯ã®æ¿å ¥ 1933 if($li.find('a').length) { 1934 $li.find('a').attr('href', smartAlertLink); 1935 } 1936 //ã¢ã©ã¼ãå å®¹ã®æ¿å ¥ 1937 if($li.find(config.textClass).length) { 1938 $li.find(config.textClass).text(smartAlertTitle); 1939 } 1940 //ã¢ã©ã¼ãæ¥ä»ã®æ¿å ¥ 1941 if($li.find(config.dateClass).length) { 1942 $li.find(config.dateClass).text(dateText); 1943 } 1944 litags += $li.prop('outerHTML'); 1945 }); 1946 //追å 1947 $smartAlertUlBox.html(litags); 1948 // ã¨ãªã¢ã®è¡¨ç¤º 1949 $parentBox.css('display', 'block'); 1950 1951 // -------------------------------------------- 1952 //ã¢ã©ã¼ãããªããã° 1953 // -------------------------------------------- 1954 } else { 1955 if(config.noDataView) { 1956 $parentBox.css('display', 'block'); 1957 $li = config.noDataClass ? $(config.noDataClass) : '<li>ãã¼ã¿ãããã¾ãã</li>'; 1958 $smartAlertUlBox.html($li); 1959 $parentBox.find(config.historyClass).remove(); //ä¸è¦§ãã¼ã¸ã¸ã®ãã¿ã³ãåé¤ 1960 } else { 1961 $parentBox.remove(); //ã¨ãªã¢ãã¨åé¤ 1962 } 1963 } 1964 } 1965 }); 1966 } 1967 return this; 1968}; 1969 1970 1971 1972 /** 1973 * ajaxéä¿¡ 1974 * url: ajaxéä¿¡ããURL 1975 * param: ãã©ã¡ã¼ã¿ï¼ãªãã¸ã§ã¯ãã§æå®ï¼ 1976 * successHandler: æåãã³ãã© 1977 * errorHandler: 失æãã³ãã© 1978 * completeHandler: å®äºãã³ãã© 1979 * contextObj: ã³ã¼ã«ããã¯é¢æ°ã®thisã¨ãã¦åãåã 1980 **/ 1981function ajax(url, param, successHandler, errorHandler, completeHandler, contextObj) { 1982 $.ajax({
1983 type: 'get', 1984 url: url, 1985 data: param, 1986 dataType: 'json', 1987 context:contextObj, 1988 success: function(data) { 1989 if(successHandler != undefined && successHandler != null) { 1990 successHandler(data); 1991 } 1992 }, 1993 error: function(data) { 1994 if(errorHandler != undefined && errorHandler != null) { 1995 errorHandler(data); 1996 } 1997 }, 1998 complete: function(data) { 1999 if(completeHandler != undefined && completeHandler != null) { 2000 completeHandler(data); 2001 } 2002 } 2003 }); 2004} 2005 2006/** 2007 * GoogleAnalyticsãã¼ã¸ã©ã³ãã³ã°ï¼GA4å¯¾å¿æ¸ï¼ 2008 * @version 1.1 2009 * @param num viewNo,num limit,string element 2010 */ 2011 2012$.fn.gaRanking = function(config){ 2013 2014 config = $.extend({ 2015 titleName:"ããè¦ããããã¼ã¸", 2016 profileNo: "", 2017 limit:5, 2018 printError:"", 2019 replaceStr:"" 2020 },config); 2021 2022 var target = this; 2023 2024 var errorMessageTarget; 2025 if(config.printError !=""){ 2026 errorMessageTarget = $(config.printError); 2027 }else{ 2028 errorMessageTarget = $(this).find('.in'); 2029 } 2030 2031 var hostName; 2032 if(site_domain.length > 0){ 2033 hostName=site_domain; 2034 }else{ 2035 hostName='http://'+location.hostname; 2036 } 2037 2038 if(config.profileNo != ""){ 2039 //ãããã¡ã¤ã«Noãæå®ããã¦ããªããã°åãããªã 2040 var JSON_PATH = hostName + '/ga_ranking.' + config.profileNo + '.json'; 2041 2042 //Ajaxéä¿¡éå§ 2043 ajax(JSON_PATH,{},function(entry){ 2044 2045 var $ul = $(target).find('.list'); 2046 $ul.html(''); 2047 2048 if(entry.success){ 2049 2050 if(entry.data.length > 0){ 2051 2052 for(var i in entry.data){ 2053 2054 if(config.limit!=0){ 2055 if(i >= config.limit) { 2056 return false;// break 2057 } 2058 } 2059 2060 var gaList = entry.data[i]; 2061 var keyArray = Object.keys(gaList); 2062 var gaUrl,gaTitle; 2063 2064 if (keyArray[0]==="screenPageViews"){ 2065 // GA4ç¨ 2066 gaUrl = entry.data[i]['pagePath']; 2067 gaTitle = entry.data[i]['pageTitle']; 2068 } else { 2069 // UAç¨ 2070 gaUrl = entry.data[i]['ga:pagePath']; 2071 gaTitle = entry.data[i]['ga:pageTitle']; 2072 } 2073 2074 //åé¤ãããæè¨ãããã°åé¤ 2075 if(config.replaceStr!=""){ 2076 gaTitle = gaTitle.replace(new RegExp(config.replaceStr,'g'),""); 2077 } 2078 2079 //DOMãçæãã¦å 容ãåºå 2080 var $li = $('<li><a href="#"></a></li>'); 2081 $liA = $li.find('a'); 2082 $liA.attr('href',gaUrl); 2083 $liA.html(gaTitle); 2084 $ul.append($li); 2085 2086 } 2087 }else{ 2088 //åå¾ä»¶æ°0 2089 showErrorMessage(errorMessageTarget, '<p>ç¾å¨ã' + config.titleName + 'ã¯ãããã¾ãã</p>'); 2090 } 2091 2092 }else{ 2093 //åå¾å¤±æ 2094 showErrorMessage(errorMessageTarget, '<p>'+ config.titleName + 'ãåå¾ã§ãã¾ããã§ããã<br>åèªã¿è¾¼ã¿ãã¦ãã ããã</p>'); 2095 } 2096 2097 },function(error){ 2098 //é信失æ 2099 showErrorMessage(errorMessageTarget, '<p>' + config.titleName + 'ãåå¾ã§ãã¾ããã§ããã<br>åèªã¿è¾¼ã¿ãã¦ãã ããã</p>'); 2100 },function(success){},target); 2101 2102 2103 } 2104 2105}; 2106 2107/** 2108 * Object.entries() ã® shim 2109 */ 2110if (!Object.entries) { 2111 Object.entries = function (obj) { 2112 var ownProps = Object.keys(obj), 2113 i = ownProps.length, 2114 resArray = new Array(i); // preallocate the Array 2115 while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; 2116 2117 return resArray; 2118 }; 2119} 2120 2121/** 2122 * ã¹ãããã«ï¼åã¤ãã³ãã®ãã³ããªã³ã°ã®çµãï¼éå¼ãï¼ 2123 * ã¹ã¯ãã¼ã«ã¤ãã³ããªã©ãé£ç¶ã§èµ·ããã¤ãã³ãã®ãã³ããªã³ã°ãéå¼ãã 2124 * ãã©ã¦ã¶ã®è² è·ã軽æ¸ãã¾ãã 2125 * ã¹ã¯ãã¼ã«ãªã©ãé£ç¶çã大ã¡ã¢ãªã®å¯ä½ç¨ãä¼´ãã¤ãã³ãå¦çã«é©ãã¦ãã¾ãã 2126 * 2127 * ä½¿ãæ¹ï¼ 2128 * é常ã®ã¤ãã³ããªãã¹ã³éå§å¾ãããããã§ã¼ã³ã§éå¼ãé »åº¦ãããªç§ã§æå®ãã¾ãã 2129 * 2130 * ä¾ï¼ 2131 * $('.selecter').on('scroll', handler).throttle(200); 2132 * 2133 * @param {number} [interval=100] éå¼ãé »åº¦ãã®ããå¤(ããªç§) 2134 * @returns {jQuery} jQueryãªãã¸ã§ã¯ãï¼ããããã§ã¼ã³ç¨ï¼ 2135 */ 2136$.fn.throttle = function(interval) { 2137 // ãã¤ã¹ãã£ã³ã°å¯¾çã®ãã夿°å®£è¨ãã¹ã³ã¼ãã®å é ã§è¡ãã 2138 var eventArray, 2139 destruction, 2140 eventName, 2141 data, 2142 next, 2143 now, 2144 lastTime, 2145 timerId, 2146 context; 2147 2148 // ããã©ã«ã弿°ã®shim 2149 if (interval === null || interval === undefined) { 2150 interval = 100; 2151 } 2152
2153 // é£çµããã¦ããã¤ãã³ãåãå¾ã 2154 eventArray = Object.entries($._data(this.get(0), 'events')); 2155 2156 // ã¤ãã³ãåã®ææ°ã対象ã¨ãã¦å¾ã 2157 destruction = eventArray[eventArray.length - 1]; 2158 2159 // åå²ä»£å ¥ã®shim 2160 eventName = destruction[0]; 2161 data = destruction[1]; 2162 2163 next = data[0].handler; 2164 this.off(eventName, next); 2165 context = this; 2166 2167 now = Date.now(); 2168 lastTime = now - interval; 2169 2170 this.on(eventName, { next: next }, function(e) { 2171 var now = Date.now(); 2172 2173 // æå¾ã®ä¸åã®äºç´å¤å® 2174 if (timerId) { 2175 // äºç´ä¸ã§ããã°ãåå®è¡å¤å®ã®ãããä¸åº¦äºç´ãåãæ¶ã 2176 clearTimeout(timerId); 2177 } 2178 // ãããå¤å¤å® 2179 if (lastTime + interval < now) { 2180 // ãããå¤ãè¶ ãã¦ããããçµã£ã¦ãããã³ãã©ãå®è¡ 2181 lastTime = now; 2182 e.data.next.bind(context)(e); 2183 } else { 2184 // è¶ ãã¦ãªããªããæå¾ã®ä¸åãäºç´ 2185 timerId = setTimeout(function() { 2186 lastTime = now; 2187 e.data.next.bind(context)(e); 2188 }, interval - (now - lastTime)); 2189 } 2190 }); 2191 2192 return this; 2193}; 2194 2195/** 2196 * ããã¦ã³ã¹ï¼åã¤ãã³ãã®çºç«ã®æ®ãç½®ãï¼ 2197 * ãã¼ã¹ããã¼ã¯ã«ããAjaxéä¿¡ãªã©ã®éãã¤ãã³ãçºç«ãä¸å®æéå ã« 2198 * é£ç¶ã§çºçããã¨ãããæå¾ã®ä¸åãã ããã³ãã©ãå®è¡ãããã¨ã§ 2199 * ãã©ã¦ã¶ã¨å¯ä½ç¨ã®è² è·ã軽æ¸ãã¾ãã 2200 * éä¿¡ãªã©ãé·æéã®å¯ä½ç¨ãä¼´ãã¤ãã³ãå¦çã«é©ãã¦ãã¾ãã 2201 * 2202 * ä½¿ãæ¹ï¼ 2203 * é常ã®ã¤ãã³ããªãã¹ã³éå§å¾ãããããã§ã¼ã³ã§æ®ãç½®ãééãããªç§ã§æå®ãã¾ãã 2204 * 2205 * ä¾ï¼ 2206 * $('.selecter').on('input', handler).debounce(200); 2207 * 2208 * @param {number} [interval=100] é£ç¶çºç«ã¨å¤å®ãããããå¤(ããªç§) 2209 * @returns {jQuery} jQueryãªãã¸ã§ã¯ãï¼ããããã§ã¼ã³ç¨ï¼ 2210 */ 2211$.fn.debounce = function(interval) { 2212 // ãã¤ã¹ãã£ã³ã°å¯¾çã®ãã夿°å®£è¨ãã¹ã³ã¼ãã®å é ã§è¡ãã 2213 var eventArray, 2214 destruction, 2215 eventName, 2216 data, 2217 next, 2218 timerId, 2219 context; 2220 2221 // ããã©ã«ã弿°ã®shim 2222 if (interval === null || interval === undefined) { 2223 interval = 100; 2224 } 2225 2226 // é£çµããã¦ããã¤ãã³ãåãå¾ã 2227 eventArray = Object.entries($._data(this.get(0), 'events')); 2228 2229 // ã¤ãã³ãåã®ææ°ã対象ã¨ãã¦å¾ã 2230 destruction = eventArray[eventArray.length - 1]; 2231 2232 // åå²ä»£å ¥ã®shim 2233 eventName = destruction[0]; 2234 data = destruction[1]; 2235 2236 next = data[0].handler; 2237 2238 this.off(eventName, next); 2239 context = this; 2240 2241 this.on(eventName, { next: next }, function(e) { 2242 clearTimeout(timerId); 2243 2244 timerId = setTimeout(function() { 2245 e.data.next.bind(context)(e); 2246 }, interval); 2247 }); 2248 2249 return this; 2250}; 2251 2252// ã¨ã©ã¼ã¡ãã»ã¼ã¸è¡¨ç¤ºé¢æ° 2253function showErrorMessage(target, message){ 2254 $(target).hide(); 2255 $(target).html(message); 2256 $(target).show(); 2257} 2258 2259// jqueryãã©ã°ã¤ã³ã®åå¨ãã§ã㯠2260function pluginExists( pluginName ){ 2261 return [pluginName] || $.fn[pluginName] ? true : false; 2262}
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.