1/** 2 * common.js 3 * æ±ç¨çãªå¦çãè¨è¿° 4 * 5 * 6 * 7 * v.1.0.0 8 * 2015.10.19 9 */ 10 11 12 13/** 14 * åå空é 15 */ 16var OCHABI = OCHABI || {}; 17OCHABI.gakuen = OCHABI.gakuen || {}; 18 19 20 21 22 23 24/** 25 * IEå¯¾å¿ 26 */ 27 28window.console = window.console || {}; 29if(!window.console.log){ 30 window.console.log = function(){}; 31} 32 33if (!Array.prototype.indexOf){ 34 Array.prototype.indexOf = function(elt /*, from*/){ 35 var len = this.length; 36 37 var from = Number(arguments[1]) || 0; 38 from = (from < 0) ? Math.ceil(from) : Math.floor(from); 39 if (from < 0) from += len; 40 41 for (; from < len; from++){ 42 if (from in this && this[from] === elt) return from; 43 } 44 return -1; 45 }; 46} 47 48 49 50 51 52 53/** 54 * 主è¦å¤æ° 55 */ 56OCHABI.gakuen.vars = OCHABI.gakuen.vars || { 57 58 host : '//www.ochabi.ac.jp', 59 60 api_url : '/news_test_json.php', 61 api_timeout : 5000, 62 63 is_transition : (function(){ 64 var ret = (typeof $('<div>').css("transitionProperty") === "string"); 65 return ret; 66 })(), 67 68 transform_prop : (function(){ 69 return (typeof $('<div>').css('-webkit-transform') === "string") ? '-webkit-transform' : 'transform'; 70 })() 71 72}; 73 74 75 76 77 78if(!OCHABI.gakuen.vars.is_transition){ 79 window.location.href = '/browser/'; 80} 81 82 83 84 85 86 87 88 89 90 91 92/** 93 * æ±ç¨é¢æ°ç¾¤ 94 */ 95$.fn.extend({ 96 /** 97 * ç»åã®ãã¼ã«ãªã¼ãã¼ 98 */ 99 SARI : function(){ 100 return this.each(function(){ 101 var item = $(this); 102 var f1 = $('<img>'); 103 var f1_src = item.attr('src'); 104 var f2 = $('<img>'); 105 var f2_src = f1_src.replace('_f1.','_f2.'); 106 107 f2.bind('load',function(){ 108 item.hover(function(){ 109 item.attr({ src : f2_src }); 110 },function(){ 111 item.attr({ src : f1_src }); 112 }); 113 }); 114 f2.attr({ src : f2_src }); 115 }); 116 }, 117 118 /** 119 * ããã¹ããé·ä½ã« 120 * @opt {Number} 1æªæºãªã縮å°çã1以ä¸ãªãå¹ 121 */ 122 strNarrow : function(opt){ 123 124 // æ§IEç¨ 125 var CSS_FILTER = function(item,rate){ 126 //item.addClass('asdf'); 127 rate = Math.round(rate * 100) / 100; 128 item.css({ filter : 'progid:DXImageTransform.Microsoft.Matrix(M11=' + rate + ',M22=1,M12=0,M21=0,sizingMethod="auto expand")' }); 129 //item.get(0).filters.item(0).M11 = rate; 130 }; 131 132 133 return this.each(function(){ 134 135 // æå¤§å¹ ã縮å°ç 136 var max_width = 0; 137 var rate = 0; 138 139 var item = $(this); 140 141 var default_width = item.css('width'); 142 143 // åæå 144 if($.support.opacity){ 145 item.css({ transform : 'scale(1,1)' }); 146 } 147 else{ 148 CSS_FILTER(item,1); 149 } 150 151 var default_display = item.css('display'); 152 item.css({ 153 display : 'inline-block', 154 width : 'auto', 155 whiteSpace : 'nowrap' 156 }); 157 var w = item.width(); 158 159 160 if(!!default_display) item.css({ display : default_display }); 161 162 // 縮å°çã®è¨ç® 163 if(opt < 1){ 164 rate = opt; 165 max_width = w * rate; 166 } 167 else{ 168 max_width = opt; 169 rate = max_width / w; 170 } 171 172 if(rate > 1){ 173 if(!!default_width) item.css({ width : default_width }); 174 return; 175 } 176 177 // ã¤ã³ã©ã¤ã³ã¬ãã«è¦ç´ ã¯ã¤ã³ã©ã¤ã³ãããã¯ã«å¤æ´ 178 if(item.css('display') == "inline"){ 179 item.css({ 180 display : 'inline-block' 181 }); 182 if(!$.support.tbody){ 183 item.css({ 184 display : 'inline', 185 zoom : 1 186 }); 187 } 188 } 189 190 // å¤å½¢ 191 if($.support.opacity){ 192 item.css({ 193 transformOrigin : '0 0', 194 transform : 'scale(' + rate + ',1)', 195 width : w * rate 196 }); 197 } 198 else{ 199 CSS_FILTER(item,rate); 200 } 201 202 }); 203 }, 204 205 /** 206 * IEç¨ãã¬ã¼ã¹ãã«ãã¼ 207 * ããã¹ãã表示ããè¦ç´ ã使ãã¦<input>è¦ç´ ã«éãã 208 */ 209 placeholder : function(opt){ 210 211 var UA = navigator.userAgent; 212 var isPH = !/MSIE (6|7|8|9)/.test(UA); 213 214 if(isPH) return this; 215 else return this.each(function(){ 216 217 // 循ç°ããã¯é»æ¢ãã©ã° 218 var TRIGGER_FLAG = 'placeholder'; 219 220 // <input>è¦ç´ 221 var item = $(this); 222 223 // ãã¬ã¼ã¹ãã«ãã«è¡¨ç¤ºããããã¹ã 224 var ph_text = item.attr('placeholder'); 225 226 // <input>è¦ç´ ãã©ãããã<span>è¦ç´ 227 var wrap = $('<span>').css({ 228 position : 'relative', 229 display : 'inline-block', 230 paddingLeft : 1 231 }); 232 233 // IE7 234 if(!$.support.tbody) wrap.css({ 235 display : 'inline', 236 zoom : 1 237 }); 238 239 // æ¬ä¼¼ãã¬ã¼ã¹ãã«ãã表示ãã<span>è¦ç´ 240 var fakePH = $('<span>
240' + ph_text + '</span>'); 241 242 // wrapã¡ã½ããã使ãã¨IEã§åããªãã®ã§æåã§ã©ãã 243 item.before(wrap); 244 item.remove(); 245 wrap.append(item); 246 247 // <input>è¦ç´ ã®ã¹ã¿ã¤ã«è¨æ¸¬ 248 var size = { 249 width : item.width(), 250 height : item.height() 251 }; 252 253 var border = { 254 top : parseInt(item.css('border-top-width'),10), 255 right : parseInt(item.css('border-right-width'),10), 256 bottom : parseInt(item.css('border-bottom-width'),10), 257 left : parseInt(item.css('border-left-width'),10) 258 }; 259 260 var margin = { 261 top : (item.css('margin-top') == 'auto') ? 0 : parseInt(item.css('margin-top'),10), 262 right : (item.css('margin-right') == 'auto') ? 0 : parseInt(item.css('margin-right'),10), 263 bottom : (item.css('margin-bottom') == 'auto') ? 0 : parseInt(item.css('margin-bottom'),10), 264 left : (item.css('margin-left') == 'auto') ? 0 : parseInt(item.css('margin-left'),10) 265 }; 266 267 var padding = { 268 top : (item.css('padding-top') == 'auto') ? 0 : parseInt(item.css('padding-top'),10), 269 right : (item.css('padding-right') == 'auto') ? 0 : parseInt(item.css('padding-right'),10), 270 bottom : (item.css('padding-bottom') == 'auto') ? 0 : parseInt(item.css('padding-bottom'),10), 271 left : (item.css('padding-left') == 'auto') ? 0 : parseInt(item.css('padding-left'),10) 272 }; 273 274 // æ¬ä¼¼ãã¬ã¼ã¹ãã«ãè¦ç´ ã®è¡¨ç¤ºä½ç½®ã®ç¢ºå® 275 var pos = { 276 left : 0 + margin.left, 277 top : 0 278 }; 279 280 var c_code = item.css('color').replace('#','0x'); 281 var c_r = Math.floor((255 + ((c_code & 0xFF0000) >> 16)) / 2); 282 var c_g = Math.floor((255 + ((c_code & 0xFF00) >> 8)) / 2); 283 var c_b = Math.floor((255 + (c_code & 0xFF)) / 2); 284 var new_color = '#' + c_r.toString(16) + c_g.toString(16) + c_b.toString(16); 285 286 // æ¬ä¼¼ãã¬ã¼ã¹ãã«ãè¦ç´ ã®ã¹ã¿ã¤ã« 287 fakePH.css({ 288 display : 'inline-block', 289 position : 'absolute', 290 left : pos.left, 291 top : pos.top, 292 width : size.width + border.left + border.right, 293 height : size.height + border.top + border.bottom, 294 paddingTop : padding.top, 295 paddingRight : padding.right, 296 paddingBottom : padding.bottom, 297 paddingLeft : padding.left, 298 fontSize : item.css('font-size'), 299 color : new_color, 300 lineHeight : (size.height + (border.top || 0) + (border.bottom || 0)) + 'px', 301 whiteSpace : 'nowrap', 302 overflow : 'hidden' 303 }); 304 305 // IE7 306 if(!$.support.tbody){ 307 fakePH.css({ 308 display : 'inline', 309 zoom : 1 310 }); 311 } 312 // IE8 and IE9 313 else{ 314 var wrap_height = wrap.height(); 315 var fakePH_height = fakePH.height(); 316 if(wrap_height > fakePH_height){ 317 pos.top = (wrap_height - (size.height + padding.top + padding.bottom)) / 2; 318 fakePH.css({ top : pos.top }); 319 } 320 } 321 322 // ã©ããã«æ¬ä¼¼ãã¬ã¼ã¹ãã«ãè¦ç´ ã追å 323 wrap.append(fakePH); 324 325 326 // 表示ãã颿° 327 var showFake = function(){ 328 fakePH.css({ 329 left : pos.left, 330 top : pos.top 331 }); 332 }; 333 334 // é表示ãã颿° 335 var hideFake = function(){ 336 fakePH.css({ 337 left : -5000, 338 top : -5000 339 }); 340 item.trigger('focus',[TRIGGER_FLAG]); 341 }; 342 343 344 // ã¤ãã³ããªã¹ãè¨å® 345 346 item.on('focus',function(evt,FLAG){ 347 if(FLAG == TRIGGER_FLAG) return; 348 349 hideFake(); 350 }); 351 352 fakePH.on('click',function(evt,FLAG){ 353 if(FLAG == TRIGGER_FLAG) return; 354 355 hideFake(); 356 }); 357 358 item.on('blur',function(evt,FLAG){ 359 if(FLAG == TRIGGER_FLAG) return; 360 361 if(item.val().length < 1) showFake(); 362 }); 363 364 if(item.val().length < 1) showFake(); 365 else hideFake(); 366 }); 367 }, 368 369 /** 370 * IEç¨maxlength 371 * textareaè¦ç´ ã®maxlength屿§ãæ¬ä¼¼çã«åç¾ 372 */ 373 maxLength : function(){ 374 375 376 var UA = navigator.userAgent; 377 var isPH = !/MSIE (6|7|8|9)/.test(UA); 378 379 if(isPH) return this; 380 else return this.each(function(){ 381 382 var item = $(this); 383 var m = item.attr('maxlength'); 384 385 // keyupçã®ã¤ãã³ãã使ç¨ããã¨
386 // IMEã®å¤æã«å¯¾å¿ã§ããªãã®ã§ 387 // focusãå¤ããæã«èª¿æ´ 388 item.on('blur',function(){ 389 390 var v = item.val(); 391 if(v.length > m) item.val(v.substr(0,m)); 392 393 }); 394 395 }); 396 397 }, 398 399 /** 400 * ãã¾ãã¾ 401 */ 402 sectionBorder : function(section_selector){ 403 404 section_selector = section_selector || 'section'; 405 406 return this.each(function(){ 407 408 $(section_selector,this).each(function(index){ 409 if(index % 2 == 0) $(this).removeClass('odd').addClass('even'); 410 else $(this).removeClass('even').addClass('odd'); 411 }); 412 413 }); 414 415 }, 416 417 418 /** 419 * æ»ããã¹ã¯ãã¼ã« 420 */ 421 rollup : function(opt){ 422 423 opt = opt || {}; 424 425 return this.each(function(){ 426 427 var target = (opt.target != undefined) ? $(opt.target) : $($(this).attr('href')); 428 if(target.length < 1) return; 429 430 $(this).on('click',function(evt){ 431 evt.preventDefault(); 432 433 var st = $(window).scrollTop(); 434 var et = (opt.top != undefined) ? opt.top : target.offset().top; 435 if(opt.offset != undefined) et += opt.offset; 436 var dur = Math.abs(et - st) / 3; 437 var easing = 'easeInOutQuad'; 438 439 if(!!opt.dur) dur = opt.dur; 440 if(!!opt.easing) easing = opt.easing; 441 442 443 $({ t : st }).animate( 444 { t : et }, 445 { 446 duration : dur, 447 easing : easing, 448 step : function(){ 449 450 $(window).scrollTop(this.t); 451 452 } 453 } 454 ); 455 }); 456 457 }); 458 459 } 460}); 461 462 463 464 465 466 467 468 469/** 470 * ã¬ã¹ãã³ã·ãé¢é£ 471 */ 472OCHABI.gakuen.responsive = OCHABI.gakuen.responsive || { 473 474 // å¹ ã®é¾å¤ 475 width_threshold : { 476 pc : 1280, 477 sp : 768 478 }, 479 480 // ã¬ã¹ãã³ã·ãããªããã©ã° 481 no_responsive : false, 482 483 // pc / sp 484 type : null, 485 486 // ããããã®èµ·åæã«çºç«ãã颿°ãæ ¼ç´ 487 startup_func : { 488 'pc' : [], 489 'sp' : [], 490 'both' : [] 491 }, 492 493 // ããããã®åãæ¿ãæã«çºç«ãã颿°ãæ ¼ç´ 494 change_func : { 495 'pc' : [], 496 'sp' : [], 497 'both' : [] 498 }, 499 500 // æ¡å¤§ç 501 zoomRate : 1, 502 503 /** 504 * çµã¿ç«ã¦ 505 */ 506 build : function(){ 507 var A = this; 508 509 this.setClientClassName(); 510 511 ww = $(window).width(); 512 var html = $('html'); 513 514 515 this.type = (ww > this.width_threshold.sp) ? 'pc' : 516 (ww == 0) ? 'pc' : 'sp'; 517 518 if(html.hasClass('no-responsive')){ 519 this.type = 'pc'; 520 $('meta[name=viewport]').attr({ content : 'width=' + this.width_threshold.pc + 'px' }); 521 } 522 else if(!html.hasClass('android') && !html.hasClass('ios')){ 523 this.type = 'pc'; 524 } 525 else if(html.hasClass('ipad') || html.hasClass('android-tablet')){ 526 this.type = 'sp'; 527 } 528 else if(html.hasClass('android-mobile')){ 529 this.type = 'sp'; 530 } 531 532 533 if(window.location.href.indexOf('type=sp') != -1){ 534 this.type = 'sp'; 535 } 536 if(window.location.href.indexOf('type=pc') != -1){ 537 this.type = 'pc'; 538 } 539 540 $('html').addClass(this.type); 541 542 this.writeCSS(function(){ 543 $(function(){ 544 $(A.startup_func[A.type]).each(function(){ 545 if(typeof this == 'function') this(); 546 }); 547 548 $(A.startup_func.both).each(function(){ 549 if(typeof this == 'function') this(); 550 }); 551 }); 552 }); 553 554 if(this.type == 'sp') A.deviceZoom(750); 555 556 }, 557 558 /** 559 * <link>è¦ç´ ã®æ¸ãåºã 560 */ 561 writeCSS : function(){ 562 var callback = (arguments.length > 0 && typeof arguments[arguments.length - 1]) ? arguments[arguments.length - 1] : null ; 563 564 var common_both = $('<link rel="stylesheet" type="text/css">').appendTo($('head')); 565 var common_type = $('<link rel="stylesheet" type="text/css">').appendTo($('head')); 566 var own_both = $('<link rel="stylesheet" type="text/css">').appendTo($('head')); 567 var own_type = $('<link rel="stylesheet" type="text/css">').appendTo($('head')); 568 569 570 var tmp = window.location.href.split('/'); 571 tmp.splice(tmp.length - 1,1); 572 tmp.splice(0,3); 573 574 var path = '/' + tmp.join('/'); 575 if(path !== '/') path += '/'; 576 577 if($('html').hasClass('errordoc')) path = '/errordoc/'; 578 if($('html').hasClass('news')) path = '/news_base/'; 579 580 if(!!$('html').hasClass('safari-5') || !!$('html').hasClass('ios4')){
581 common_both.attr({ href : '/_common/_css/standard.css' }); 582 common_type.attr({ href : '/_common/_css/' + this.type + '/standard.css' }); 583 own_both.attr({ href : path + '_css/standard.css' }); 584 own_type.attr({ href : path + '_css/' + this.type + '/standard.css' }); 585 if(!!callback){ 586 $(function(){ callback(); }); 587 } 588 } 589 else if(!$('html').hasClass('android-default') && !$('html').hasClass('android-chrome')){ 590 common_type.on('load',function(){ 591 if(!!callback){ 592 if($('html').hasClass('firefox')) setTimeout(function(){ callback(); },100); 593 else callback(); 594 } 595 }); 596 common_both.attr({ href : '/_common/_css/standard.css' }); 597 common_type.attr({ href : '/_common/_css/' + this.type + '/standard.css' }); 598 own_both.attr({ href : path + '_css/standard.css' }); 599 own_type.attr({ href : path + '_css/' + this.type + '/standard.css' }); 600 } 601 else{ 602 common_both.attr({ href : '/_common/_css/standard.css' }); 603 common_type.attr({ href : '/_common/_css/' + this.type + '/standard.css' }); 604 own_both.attr({ href : path + '_css/standard.css' }); 605 own_type.attr({ href : path + '_css/' + this.type + '/standard.css' }); 606 if(!!callback) callback(); 607 } 608 }, 609 610 /** 611 * èµ·åæã«å®è¡ãã颿°ã追å 612 * @type {String} pc ã sp 613 * @fn {Function} 颿° 614 */ 615 addFunc : function(type,fn){ 616 var when = (arguments.length > 2 && arguments[2] == 'change') ? 'change' : 'startup' ; 617 618 //type = (type == 'sp') ? 'sp' : 'pc'; 619 if(when == 'startup') this.startup_func[type].push(fn); 620 else this.change_func[type](fn); 621 }, 622 623 /** 624 * ã¯ã©ã¤ã¢ã³ãå¥ã®ã¯ã©ã¹åãhtmlè¦ç´ ã«è¿½è¨ 625 */ 626 setClientClassName : function(){ 627 var ua = navigator.userAgent.toLowerCase(); 628 var cn = []; 629 630 if(/iphone|ipod|ipad/.test(ua)){ 631 cn.push('ios'); 632 if(ua.indexOf('iphone') != -1) cn.push('iphone'); 633 else if(ua.indexOf('ipod') != -1) cn.push('ipod'); 634 else if(ua.indexOf('ipad') != -1) cn.push('ipad'); 635 636 ua.replace(/os (\d)_/,function($0,$1){ 637 cn.push('ios' + $1); 638 }); 639 640 if(ua.indexOf('safari') != -1) cn.push('safari'); 641 } 642 else if(ua.indexOf('android') != -1){ 643 644 cn.push('android'); 645 if(ua.indexOf('chrome') != -1) cn.push('android-chrome'); 646 else if(ua.indexOf('firefox') != -1) cn.push('android-firefox'); 647 else cn.push('android-default'); 648 649 if(ua.indexOf('mobile') == -1) cn.push('android-tablet'); 650 else cn.push('android-mobile'); 651 } 652 else if(ua.indexOf('os x') != -1){ 653 cn.push('osx'); 654 } 655 else if(ua.indexOf('windows') != -1){ 656 cn.push('windows'); 657 } 658 659 660 if(ua.indexOf('trident') != -1){ 661 cn.push('trident'); 662 } 663 else if(ua.indexOf('edge') != -1){ 664 cn.push('edge'); 665 } 666 else if(ua.indexOf('safari') != -1){ 667 if(ua.indexOf('chrome') != -1) cn.push('chrome'); 668 else{ 669 cn.push('safari'); 670 if(ua.indexOf('version/5') != -1) cn.push('safari-5') 671 } 672 } 673 else if(ua.indexOf('msie') != -1){ 674 cn.push('msie'); 675 ua.replace(/msie (\d+)/,function($0,$1){ 676 cn.push('msie-' + $1); 677 }); 678 } 679 else{ 680 ua.replace(/(chrome|firefox|opera)/,function($0,$1){ 681 cn.push($1); 682 }) 683 } 684 685 686 var html = $('html'); 687 $(cn).each(function(){ 688 html.addClass(this.toString()); 689 }); 690 691 }, 692 693 /** 694 * iOSã§ãã©ã¼ã é¨åã鏿æã«ãºã¼ã ããªãããã« 695 */ 696 restrictZoom : function(){ 697 var A = this; 698 699 if(!/iphone|ipod|ipad/.test(navigator.userAgent.toLowerCase())) return; 700 701 var viewport = $('meta[name=viewport]'); 702 var default_content = viewport.attr('content'); 703 var target = $('select,input[type=text],input[type=email],input[type=search],input[type=tel],input[type=url],input[type=password],textarea'); 704 705 target.on('focus',function(){ 706 var rate = (window.orientation == 90 || window.orientation == 270) ? A.zoomRate * ($(window).width()/$(window).height()) : A.zoomRate; 707 viewport.attr({ content : default_content + 'user-scalabel=no,scale=' + rate + ',maximum-scale=' + rate }); 708 }); 709 710 target.on('blur',function(){ 711 viewport.attr({ content : default_content + ',maximum-scale=100' }); 712 }); 713 }, 714 715 /** 716 * ã³ã³ãã³ããç»é¢å¹ ã«ãã£ãã 717 */ 718 deviceZoom : function(w){ 719 var html = $('html'); 720 var vp = $('meta[name=viewport]'); 721 var ww = $(window).width(); 722 var scale = Math.round(ww / w * 100) / 100; 723 724 this.zoomRate = scale; 725 726 var content = 'width=' + w + ' , initial-scale=' + scale; 727 if(html.hasClass('chrome') || html.hasClass('ios')) content = 'width=' + w; 728 729 vp.attr({ content : content }); 730 }, 731 732 /** 733 * ã³ã³ãã³ã縦横æ¯ã¨iPadã®ç¸¦æ¨ªæ¯ãåããªãå ´å対ç 734 */ 735 ipadWindowRatio : function(){ 736 737
738 if(/ipad/.test(navigator.userAgent.toLowerCase())){ 739 740 var adjustRatio = function(){ 741 var wrap = $('#wrap'); 742 var wrapW = wrap.width(); 743 var wrapH = wrap.height(); 744 var windowW = $(window).width(); 745 var windowH = $(window).height(); 746 var threshold = windowH * wrapW / windowW; 747 748 749 wrap.css({ paddingBottom : Math.max(threshold - wrapH + 50,0) }); 750 }; 751 adjustRatio(); 752 753 754 /*! A fix for the iOS orientationchange zoom bug. 755 Script by @scottjehl, rebound by @wilto. 756 MIT License. 757 */ 758 /* 759 var viewport = $('meta[name=viewport]'); 760 var content_default = viewport.attr('content'); 761 762 var content_disabled_zoom = content_default + ',maximum-scale=1'; 763 var content_enabled_zoom = content_default + ',maximum-scale=10'; 764 765 var enabled = true; 766 767 var enableZoom = function(){ 768 viewport.attr({ content : content_enabled_zoom }); 769 enabled = true; 770 }; 771 772 var disableZoom = function(){ 773 viewport.attr({ content : content_disabled_zoom }); 774 enabled = false; 775 }; 776 777 var tiltCheck = function(e){ 778 779 var aig = e.accelerationIncludingGravity; 780 var x = Math.abs(aig.x); 781 var y = Math.abs(aig.y); 782 var z = Math.abs(aig.z); 783 784 if( (!window.document.orientation || window.document.orientation === 180) && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){ 785 if(enabled) disableZoom(); 786 } 787 else{ 788 if(!enabled) enableZoom(); 789 } 790 } 791 792 $(window).on('orientationchange',function(){ 793 enableZoom(); 794 //adjustRatio(); 795 }); 796 $(window).on('devicemotion',function(evt){ 797 tiltCheck(evt.originalEvent); 798 }); 799 */ 800 801 } 802 803 } 804}; 805OCHABI.gakuen.responsive.build(); 806 807 808 809OCHABI.gakuen.navi = OCHABI.gakuen.navi || { 810 811 contents_wrap : null, 812 navi : null, 813 navi_nav : null, 814 navi_cover : $('<div class="navi-cover">'), 815 button : null, 816 close_button : null, 817 cover : $('<div id="navi-cover">'), 818 stat : 0, 819 navi_available : false, 820 teFn : null, 821 myscroll : null, 822 clickeventname : (OCHABI.gakuen.responsive.type == 'pc') ? 'click' : 'touchstart' , 823 build : function(){ 824 var A = this; 825 826 this.contents_wrap = $('#contents-wrap'); 827 this.navi = $('#navi'); 828 this.navi_nav = $('#navi nav'); 829 this.button = $('#navi-button a'); 830 this.close_button = $('#navi-close-button'); 831 832 this.navi.append(this.navi_cover); 833 834 this.contents_wrap.on('transitionend webkitTransitionEnd',function(){ 835 if(!!A.teFn){ 836 A.teFn(); 837 A.teFn = null; 838 } 839 }); 840 841 this.button.on(this.clickeventname,function(evt){ 842 evt.stopPropagation(); 843 evt.preventDefault(); 844 A.navi_available = false; 845 if(A.stat == 0) A.open(); 846 else A.close(); 847 }); 848 849 this.close_button.on(this.clickeventname,function(evt){ 850 evt.stopPropagation(); 851 evt.preventDefault(); 852 A.navi_available = false; 853 A.close(); 854 }); 855 856 857 }, 858 setIScroll : function(){ 859 this.myscroll = new IScroll('#navi', { 860 mouseWheel: true, 861 click : true 862 }); 863 }, 864 open : function(){ 865 var A = this; 866 var html = $('html'); 867 this.stat = 1; 868 869 this.teFn = function(){ 870 A.navi_available = true; 871 A.navi_cover.addClass('hide'); 872 }; 873 874 875 $('body').append(this.cover); 876 this.cover.on(this.clickeventname,function(evt){ 877 evt.preventDefault(); 878 A.close(); 879 }); 880 881 this.navi.removeClass('hide'); 882 this.navi_cover.removeClass('hide'); 883 this.navi.scrollTop(0); 884 setTimeout(function(){ 885 A.cover.addClass('show'); 886 html.addClass('navi-open'); 887 A.setIScroll(); 888 },1); 889 }, 890 close : function(callback){ 891 var A = this; 892 var html = $('html'); 893 this.stat = 0; 894 895 this.teFn = function(){ 896 A.navi.addClass('hide'); 897 A.navi_cover.removeClass('hide'); 898 if(!!callback) callback(); 899 }; 900 html.removeClass('navi-open'); 901 this.cover.removeClass('show'); 902 this.cover.remove(); 903 904 this.navi_available = true; 905 } 906}; 907 908OCHABI.gakuen.header = OCHABI.gakuen.header || { 909 header : null, 910 hh : 0, 911 build : function(){ 912 var A = this; 913 914 this.header = $('.site-header'); 915 this.hh = this.header.height() 916 + parseInt(this.header.css('padding-top'),10) 917 + parseInt(this.header.css('padding-bottom'),10); 918 919 $(window).on('scroll',function(){ 920 A.adjust(); 921 }); 922 this.adjust(); 923 }, 924 adjust : function(){ 925 var A = this; 926 var st = $(window).scrollTop(); 927 if(st > this.hh) this.header.addClass('tp'); 928 else this.header.removeClass('tp'); 929 } 930}; 931 932 933/** 934 * PCçã«é¢ãããã® 935 */ 936OCHABI.gakuen.pc = OCHABI.gakuen.pc || { 937}; 938 939 940 941/** 942 * ã¹ããçã«é¢ãããã® 943 */ 944OCHABI.gakuen.sp = OCHABI.gakuen.sp || { 945}; 946 947 948 949 950 951 952 953 954/** 955 * PCã®èµ·åæã«å®è¡ 956 */ 957OCHABI.gakuen.responsive.addFunc('pc',function(){ 958}); 959 960 961/** 962 * SPã®èµ·åæã«å®è¡ 963 */ 964OCHABI.gakuen.responsive.addFunc('sp',function(){ 965 966 // URLæ¬ãé表示 967 //if($('html').hasClass('ios')) window.scrollBy(0.5,0); 968 //else window.scrollTo(0,0.5); 969 970 // iOSã®ãºã¼ã ãæ¢ã 971 OCHABI.gakuen.responsive.restrictZoom(); 972}); 973 974 975/** 976 * PC/SPã¨ãèµ·åæã«å®è¡ 977 */ 978OCHABI.gakuen.responsive.addFunc('both',function(){ 979 980 // ãã¼ã«ãªã¼ãã¼ 981 $('img.SARI,input.SARI').SARI(); 982 983 // IEç¨ãã¬ã¼ã¹ãã«ãã¼ 984 $('input[placeholder],textarea[placeholder]').placeholder(); 985 986 // IEç¨maxlength 987 $('textarea[maxlength]').maxLength(); 988 989 // ãã©ã¼ã ã«ãã¶ã¤ã³ãå ¥ããï¼jquery.designedform.jsï¼ 990 if(OCHABI.gakuen.responsive.type == 'tb') setTimeout(function(){ $('.designed').designedForm(); },100); 991 else $('.designed').designedForm(); 992 993 $('form').on('submit',function(evt){ 994 if(!!evt.keyCode && evt.keyCode == 13) return false; 995 }); 996 997 OCHABI.gakuen.header.build(); 998 OCHABI.gakuen.navi.build(); 999 1000 $('.rollup a,.rollup-sp a').rollup(); 1001 1002});
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.