/* ************************************************** name: common.js description: common settings /* 1: use agent =========================================================================================== */ define(function(require) { var jquery = $ = require('jquery'); $('html').addclass('onscroll'); var nut = navigator.useragent.tolowercase(); var uacheck = { "ie" :nut.indexof("msie") != -1, "ie6" :nut.indexof("msie 6") != -1, "ie7" :nut.indexof("msie 7") != -1, "ie8" :nut.indexof("msie 8") != -1, "ff" :nut.indexof("firefox") != -1, "safari" :nut.indexof("safari") != -1, "chrome" :nut.indexof("chrome") != -1, "opera" :nut.indexof("opera") != -1, "iphone" :nut.indexof("iphone") != -1, "ipad" :nut.indexof("ipad") != -1, "ipod" :nut.indexof("ipod") != -1, "android" :nut.indexof("android") != -1, "xp" :nut.indexof("nt 5.1") != -1, "win" :navigator.appversion.indexof ("win") != -1, "mac" :navigator.appversion.indexof ("macintosh") != -1, "ios" :nut.indexof("iphone") != -1 || nut.indexof("ipad") != -1 || nut.indexof("ipod") != -1, "sp" :nut.indexof("iphone") != -1 || nut.indexof("ipad") != -1 || nut.indexof("ipod") != -1 || nut.indexof("android") != -1 }; function ua(target) { return uacheck[target]; } if(ua("sp")) $("html").addclass("sp"); jquery.easing['jswing'] = jquery.easing['swing']; jquery.extend( jquery.easing, { def: 'easeoutquad', swing: function (x, t, b, c, d) { //alert(jquery.easing.default); return jquery.easing[jquery.easing.def](x, t, b, c, d); }, easeinquad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeoutquad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeinoutquad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeincubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeoutcubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeinoutcubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeinquart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeoutquart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeinoutquart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeinquint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeoutquint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeinoutquint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeinsine: function (x, t, b, c, d) { return -c * math.cos(t/d * (math.pi/2)) + c + b; }, easeoutsine: function (x, t, b, c, d) { return c * math.sin(t/d * (math.pi/2)) + b; }, easeinoutsine: function (x, t, b, c, d) { return -c/2 * (math.cos(math.pi*t/d) - 1) + b; }, easeinexpo: function (x, t, b, c, d) { return (t==0) ? b : c * math.pow(2, 10 * (t/d - 1)) + b; }, easeoutexpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-math.pow(2, -10 * t/d) + 1) + b; }, easeinoutexpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * math.pow(2, 10 * (t - 1)) + b; return c/2 * (-math.pow(2, -10 * --t) + 2) + b; }, easeincirc: function (x, t, b, c, d) { return -c * (math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeoutcirc: function (x, t, b, c, d) { return c * math.sqrt(1 - (t=t/d-1)*t) + b; }, easeinoutcirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (math.sqrt(1 - t*t) - 1) + b; return c/2 * (math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeinelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); return -(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b; }, easeoutelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); return a*math.pow(2,-10*t) * math.sin( (t*d-s)*(2*math.pi)/p ) + c + b; }, easeinoutelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); if (t < 1) return -.5*(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b; return a*math.pow(2,-10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )*.5 + c + b; }, easeinback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeoutback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeinoutback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeinbounce: function (x, t, b, c, d) { return c - jquery.easing.easeoutbounce (x, d-t, 0, c, d) + b; }, easeoutbounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeinoutbounce: function (x, t, b, c, d) { if (t < d/2) return jquery.easing.easeinbounce (x, t*2, 0, c, d) * .5 + b; return jquery.easing.easeoutbounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* ************************************************** name: responsive.js ***************************************************** */ var _globalnaviclose; var _headerscrolltop; function _checkrwd(width) { if (!ua("ie7") && !ua("ie8")) { var checkrwd = { 995 :$("#u995").css("display") == "block", 768 :$("#u768").css("display") == "block", 580 :$("#u580").css("display") == "block", 400 :$("#u400").css("display") == "block" } return checkrwd[width]; } else { return false; } } (function($){ if (ua("win") || ua("mac")) $("html").addclass("pc"); if (ua("android")) $("html").addclass("android"); $("html[class!='js']").addclass("js"); })(jquery); (function($) { var _fbready = false; var _section1bgfixed = false; var _section1bgtop = 0; var _section4buttonpos = 0; var _section4buttontop = 0; var _section4buttonbottom = 0; var fbstart = function() { $(window).on("scroll.sibai", fbwatchscroll); fbwatchscroll(); } var fbstop = function() { $(window).off("scroll.sibai"); } var fbfixsize = function() { var winh = $(window).height(); _section1bgtop = $("#sibaisection1").offset().top; _section4buttontop = $("#sibaisection4").offset().top; _section4buttonbottom = $("#sibaisection5").offset().top - winh; } var fbwatchscroll = function() { var scrolltop = $(window).scrolltop(); if (scrolltop < _section1bgtop) { if (_section1bgfixed) { $("#sibaisection1 .sibaiimg").css({ backgroundattachment: "scroll" }); _section1bgfixed = false; } } else { if (!_section1bgfixed) { $("#sibaisection1 .sibaiimg").css({ backgroundattachment: "fixed" }); _section1bgfixed = true; } } if (scrolltop < _section4buttontop) { if (_section4buttonpos != 0) { $("#sibaiplay").removeclass(); _section4buttonpos = 0; } } else if (scrolltop >= _section4buttontop && scrolltop <= _section4buttonbottom) { if (_section4buttonpos != 1) { $("#sibaiplay").removeclass().addclass("fixed"); _section4buttonpos = 1; } } else { if (_section4buttonpos != 2) { $("#sibaiplay").removeclass().addclass("bottom"); _section4buttonpos = 2; } } } var fbfixbgimages = function() { var $elm; var imgw, imgh, x, l; var divw = $(window).width() / 2; var divh = $(window).height(); // for safari if (_checkrwd(768)) { $(".sibaisection, .sibaibody").css({ minheight: 0 }); return; } else if (ua("sp")) { $(".sibaisection, .sibaibody").css({ minheight: 0 }); $("#sibaisection1").css({ minheight: divh + 30 }); return; } else { $(".sibaisection, .sibaibody").css({ minheight: divh }); $("#sibaisection5 .sibaibody").css({ minheight: divh - 180 }); } if (divw / divh > 1.33) { imgw = divw; imgh = divw * .75; x = 0; } else { imgw = divh * 1.33; imgh = divh; x = (imgw - divw) / 2; } var fixbg = function(elm) { for (var i = 0; i < arguments.length; i++) { $elm = $(arguments[i]); if ($elm.parent().hasclass("sibaileftcol")) { l = -x; } else { l = divw - x; } $elm.css({ backgroundsize: imgw + "px " + imgh + "px", backgroundposition: l + "px 50%" }); } } fixbg.apply(null, ["#sibaisection2 .sibaiimg", "#sibaisection3 .sibaiimg", "#sibaisection4 .sibaiimg"]); } var _ctscenes = [ { idx: 0, cols: 2, left: { front: { id: 0 }, next: { id: 2, dir: "up" } }, right: { front: { id: 1 }, next: { id: 3, dir: "down" } } } ]; var _ctready = false; var _ctrotating = false; var _ctcubew = 0, _ctcubeh = 0; var _cttop = 0, _ctbottom = 0; var _ctstep = 0; var _ctdirection = 1, _ctcurrent = 0; var _ctcues = []; var _ctduration = .8; var _cttimeout; var _cttabkey = false; var ctinit = function() { $("body > *").wrapall('
'); $("#sibaisection1, #sibaisection2").wrapall('
'); var left = '
' + $("#sibaisection1 .sibaileftcol").html() + '
' + $("#sibaisection2 .sibaileftcol").html() + '
'; var right = '
' + $("#sibaisection1 .sibairightcol").html() + '
' + $("#sibaisection2 .sibairightcol").html() + '
'; var wide = '
' + $("#sibaisection1").html() + '
' + $("#sibaisection1").html() + '
' + $("#sibaisection5 + .gridset").html() + '
'; var $left = $(left); var $right = $(right); $right.find(".sibaibutton").remove(); var $wide = $(wide); $("#contents").prepend('
'); $("#sibaicubecontainer").append($left, $right, $wide); if (!_isie11) { $(".sibaipanel").css({ backfacevisibility: "hidden" }); } _ctready = true; } var ctstart = function() { $("html").addclass("sibairich"); _ctrotating = false; _ctcurrent = 0; ctfixsize(); $("#sibaipanel0, #sibaipanel1").css({ transform: "rotate3d(0, 0, 0, 0) translate3d(0, 0, 0)" }).removeclass("hide"); $("#sibaicubecontainer").show(); $(window).scrolltop(0).on("scroll.sibai", ctwatchscroll); ctwatchtabkey(); } var ctstop = function() { $("html").removeclass("sibairich"); $(".sibaipanel").addclass("hide"); $("#sibaicubebutton").hide(); $("#sibaicubecontainer").hide().css({ position: "absolute", top: 15 }); $("#sibaibody").removeclass("sibailock"); $(document).off("wheel.sibai keydown.sibai"); $(window).off("scroll.sibai"); $("#sibaicubebutton a").off("click.sibai"); } var ctwatchscroll = function() { var scrolltop = $(window).scrolltop(); if (scrolltop >= _cttop && scrolltop < _ctbottom) { if ($("html").is(":animated") || $("body").is(":animated")) { if (_ctrotating) return; _ctrotating = true; $(window).off("scroll.sibai"); $("#sibaibody").css({ opacity: 0 }).animate({ opacity: 1 }, 400, "easeincubic", function() { $(window).on("scroll.sibai", ctwatchscroll); }); _ctcurrent = 1; ctstackques(0, 0); } else { ctwatchrotation(); } } } var ctwatchrotation = function() { $("#sibaicubecontainer").css({ position: "fixed", top: 0 }); $("#sibaibody").addclass("sibailock"); $(window).off("scroll.sibai"); $(document).off("wheel.sibai keydown.sibai"); $(document).on("wheel.sibai", function(e) { if (_issafari) e.preventdefault(); if (_ctrotating) return; if (-e.originalevent.deltay > 0) { rotateup(); } else { rotatedown(); } }).on("keydown.sibai", function(e) { if (_ctrotating) { e.preventdefault(); return; } switch (e.which) { case 9: e.preventdefault(); _cttabkey = true; if (e.shiftkey) { if (_ctcurrent == 5 && e.target == $("#sibaicubebutton a")[0]) { $("#sibaicubecontainer #sibaiplay")[0].focus(); } else { rotateup(); } } else { if (e.target == $("#sibaicubecontainer #sibaiplay")[0]) { $("#sibaicubebutton a")[0].focus(); } else { rotatedown(); } } break; case 38: e.preventdefault(); rotateup(); break; case 40: e.preventdefault(); rotatedown(); } }); $("#sibaicubebutton a").on("click.sibai", function() { if (_ctrotating) return; rotatedown(); return false; }); var rotateup = function() { if (_ctcurrent == 0) { ctstopwatching(_cttop - 4); } else { _ctrotating = true; ctstackques(_ctcurrent - 1, 0); } } var rotatedown = function() { if (_ctcurrent == 1) { ctstopwatching(_ctbottom + 4); } else { _ctrotating = true; ctstackques(_ctcurrent + 1, 1); } } } var ctwatchtabkey = function() { $(document).off("keydown.sibai").on("keydown.sibai", function(e) { console.log(e.which + "which"); if (e.which == 9) { if (e.target == $("body")[0]) { e.preventdefault(); if (_ctcurrent == 0) { $("#top a")[0].focus(); } else { $("#contents > #sibaisection5 .sibaibutton a")[0].focus(); } } else if (e.target == $("#top a")[0] && e.shiftkey) { e.preventdefault(); _ctcurrent = 7; $(".sibaipanel").addclass("hide"); $("#sibaipanel12").removeclass("hide").css({ transform: "rotate3d(0, 0, 0, 0) translate3d(0, 0, 0)" }); $("#footer a").get(-1).focus(); } else if (e.target == $("#footer a").get(-1) && !e.shiftkey) { e.preventdefault(); _ctcurrent = 0; $("#sibaicubewide").hide(); $("#sibaicubeleft, #sibaicuberight").show(); $(".sibaipanel").addclass("hide"); $("#sibaipanel0, #sibaipanel1").removeclass("hide").css({ transform: "rotate3d(0, 0, 0, 0) translate3d(0, 0, 0)" }); $("#sibaicubebutton").removeclass().addclass("sibaired").show().find("span").text("view more"); $("#top a")[0].focus(); } else if (e.target == $(".sibaipdf a")[0] && !e.shiftkey) { e.preventdefault(); $(_scrollelm).animate({ scrolltop: _cttop }, 200, function() { ctwatchrotation(); $("#sibaicubebutton a")[0].focus(); }); } else if (e.target == $("#contents > #sibaisection5 .sibaibutton a")[0] && e.shiftkey) { e.preventdefault(); if (_ctrotating) return; _ctrotating = true; $(_scrollelm).animate({ scrolltop: _ctbottom }, 400, function() { ctwatchrotation(); _cttabkey = true; ctstackques(6, 0); }); } } else if (e.which == 13 && e.target == $("#top a")[0]) { $("#sibaicubebutton a")[0].focus(); ctwatchrotation(); } }); } var ctstopwatching = function(scrollpos) { $(document).off("wheel.sibai keydown.sibai").on("keydown.sibai", function() { return false; }); _ctrotating = false; $("#sibaicubebutton a").off("click.sibai"); $("#sibaibody").removeclass("sibailock"); $(window).scrolltop(scrollpos).on("scroll.sibai", function() { if ($(window).scrolltop() == 0) { $(window).scrolltop(scrollpos); } else { $(window).off("scroll.sibai").on("scroll.sibai", ctwatchscroll); } }); $("#sibaicubecontainer").css({ position: "absolute", top: 0 }); if (_ctcurrent == 1) { $("#sibaicubecontainer").css({ position: "absolute", top: "50%" }); } disablebrowsersmoothscroll(); if (_cttabkey) { if (_ctcurrent == 1) { if (_ctcubeh < 860) { $(_scrollelm).animate({ scrolltop: _ctbottom + $("#sibaisection2").height() - _ctcubeh }, 400, function() { $("#contents > #sibaisection5 .sibaibutton a")[0].focus(); ctwatchtabkey(); }); } else { $("#contents > #sibaisection5 .sibaibutton a")[0].focus(); ctwatchtabkey(); } } else { $(_scrollelm).animate({ scrolltop: 0 }, 400, function() { $(".sibaipdf a")[0].focus(); ctwatchtabkey(); }); } _cttabkey = false; } else { ctwatchtabkey(); } } var ctstackques = function(destination, direction) { _ctdirection = direction; if (_ctdirection) { _ctcues = _ctscenes.slice(_ctcurrent, destination); } else { var dir = { left: "right", right: "left", up: "down", down: "up" }; var scenes = $.extend(true, [], _ctscenes.slice(destination, _ctcurrent).reverse()); _ctcues = $.map(scenes, function(scene, idx) { var tmp = scene.left.front.id; scene.left.front.id = scene.left.next.id; scene.left.next.id = tmp; scene.left.next.dir = dir[scene.left.next.dir]; if (scene.cols == 2) { tmp = scene.right.front.id; scene.right.front.id = scene.right.next.id; scene.right.next.id = tmp; scene.right.next.dir = dir[scene.right.next.dir]; } return scene; }); } ctrotate(); } var ctrotate = function() { $("#sibaicubebutton").stop().fadeout(200); var cubew_half = _ctcubew / 2; var cubeh_half = _ctcubeh / 2; var duration = math.max(_ctduration / _ctcues.length, _ctduration / 4); var before = { left: "rotate3d(0, 1, 0, 90deg) translate3d(" + cubew_half + "px, 0, " + cubew_half + "px)", right: "rotate3d(0, 1, 0, -90deg) translate3d(-" + cubew_half + "px, 0, " + cubew_half + "px)", up: "rotate3d(1, 0, 0, -90deg) translate3d(0, " + cubeh_half + "px, " + cubeh_half + "px)", down: "rotate3d(1, 0, 0, 90deg) translate3d(0, -" + cubeh_half + "px, " + cubeh_half + "px)" }; console.log('rotate'); var after = { left: before.right, right: before.left, up: before.down, down: before.up }; var front = "rotate3d(0, 0, 0, 0) translate3d(0, 0, 0)"; var zindex = (_isie11) ? [{ zindex: 0 }, { zindex: 1 }] : [{}, {}]; var scene = _ctcues.shift(); _ctcurrent = scene.idx + _ctdirection; $(".sibaipanel").addclass("hide").css({ transitionduration: duration + "s" }); if (scene.cols == 2) { $("#sibaicubewide").hide(); $("#sibaicubeleft, #sibaicuberight").show(); if (scene.left.next.dir == "left" || scene.left.next.dir == "right") { $("#sibaicubeleft").css({ zindex: 0}); $("#sibaicuberight").css({ zindex: 1 }); } else if (scene.right.next.dir == "left" || scene.right.next.dir == "right") { $("#sibaicubeleft").css({ zindex: 1 }); $("#sibaicuberight").css({ zindex: 0 }); } $("#sibaipanel" + scene.left.front.id).css($.extend({ transform: front }, zindex[1])).removeclass("hide"); $("#sibaipanel" + scene.left.next.id).css($.extend({ transform: before[scene.left.next.dir] }, zindex[0])).removeclass("hide"); $("#sibaipanel" + scene.right.front.id).css($.extend({ transform: front }, zindex[1])).removeclass("hide"); $("#sibaipanel" + scene.right.next.id).css($.extend({ transform: before[scene.right.next.dir] }, zindex[0])).removeclass("hide"); settimeout( function() { if (scene.left.front.id != scene.left.next.id) { $("#sibaipanel" + scene.left.front.id).css($.extend({ transform: after[scene.left.next.dir],zindex:0 }, zindex[0])); $("#sibaipanel" + scene.left.next.id).css($.extend({ transform: front,zindex:1 }, zindex[1])); } if (scene.right.front.id != scene.right.next.id) { $("#sibaipanel" + scene.right.front.id).css($.extend({ transform: after[scene.right.next.dir],zindex:0 }, zindex[0])); $("#sibaipanel" + scene.right.next.id).css($.extend({ transform: front,zindex:1 }, zindex[1])).one("transitionend", ctfinishrotation); } else { $("#sibaipanel" + scene.left.next.id).one("transitionend", ctfinishrotation); } }, 30); } else { $("#sibaicubewide").show(); $("#sibaicubeleft, #sibaicuberight").hide(); $("#sibaipanel" + scene.left.front.id).css($.extend({ transform: front }, zindex[1])).removeclass("hide"); $("#sibaipanel" + scene.left.next.id).css($.extend({ transform: before[scene.left.next.dir] }, zindex[0])).removeclass("hide"); settimeout( function() { $("#sibaipanel" + scene.left.front.id).css($.extend({ transform: after[scene.left.next.dir] }, zindex[0])); $("#sibaipanel" + scene.left.next.id).css($.extend({ transform: front }, zindex[1])).one("transitionend", ctfinishrotation); }, 30); } _cttimeout = settimeout(ctfinishrotation, duration * 1500); } var ctfinishrotation = function() { cleartimeout(_cttimeout); if (_ctcurrent == 1) { if (navigator.useragent.indexof("edge") != -1 || _isie11) { // for edge, ie11 var $elm = $("#contents > #sibaisection5 > *").detach(); } ctstopwatching(_ctbottom); } else if (_ctcurrent == 5 && _ctdirection == 1 && _cttabkey) { $("#sibaicubecontainer #sibaiplay")[0].focus(); $("#sibaicubebutton").stop().fadein(200); _ctrotating = false; } else { var tab = _cttabkey; $("#sibaicubebutton").stop().fadein(200, function() { if (tab) { $("#sibaicubebutton a")[0].focus(); } }); _ctrotating = false; } $("#sibaicubecontainer #sibaisection1").addclass("sibaifaded"); _cttabkey = false; } var ctfixsize = function() { _ctcubew = math.ceil($(window).width() / 2); _ctcubeh = $(window).height(); _cttop = math.floor($("#sibaisection1.sibaisection").offset().top); _ctbottom = math.floor($("#sibaisection2.sibaisection").offset().top); _ctstep = math.ceil((_ctbottom - _cttop) / _ctscenes.length); $("#sibaicubecontainer").css({ height: _ctcubeh}); $(".sibaicube").css({ width: _ctcubew }); $(".sibaipanel").css({ width: _ctcubew, height: _ctcubeh }); $("#sibaicubewide, #sibaipanel11, #sibaipanel12").css({ width: $(window).width() }); } var support3dtransitions = function() { var support = false; var prefixes = ["webkit", "moz", "ms", "o"]; var div = document.createelement("div"); if (div.style.perspective !== undefined) { support = true; } else { for (var i = 0; i < prefixes.length; ++i) { if ((prefixes[i] + "perspective") in div.style) { support = true; break; } } } return support; } var isie10to11 = function() { var isie = false; var version = 0; var ua = window.navigator.useragent.tolowercase(); if (ua.indexof("msie") > -1 || ua.indexof("trident") > -1) { isie = true; version = parseint(ua.match(/(msie\s|rv:)([\d\.]+)/)[2]); } return isie && version > 9; } var _issp = false; var _3dsupport = support3dtransitions(); var _isie11 = isie10to11(); var _issafari = ua("safari"); var _scrollelm; var switchversion = function() { if (_checkrwd(768)) { // sp if (!_issp) { if (_3dsupport) { ctstop(); } else { fbstop(); fbfixbgimages(); } } _issp = true; } else if (ua("sp")) { // tablet _issp = false; } else { if (_3dsupport) { // pc: rich if (!_ctready) { ctinit(); ctstart(); } else if (_issp) { ctstart(); } else { ctfixsize(); } } else { // pc: plain if (!_fbready) { fbfixsize(); fbstart(); fbfixbgimages(); _fbready = true; } else if (_issp) { fbfixsize(); fbstart(); fbfixbgimages(); } else { fbfixsize(); fbfixbgimages(); } } _issp = false; } } var disablebrowsersmoothscroll = function() { var ua = navigator.useragent; if (ua.indexof("trident") != -1 || ua.indexof("edge") != -1) { // ie8 or later and edge $(document).on("wheel.sibai", function(e) { e.preventdefault(); window.scrollto(0, $(window).scrolltop() + e.originalevent.deltay); }); } } var getscrollableelement = function() { var elm; $(window).scrolltop(1); if ($("html").scrolltop() > 0) { elm = $("html"); } else if ($("body").scrolltop() > 0) { elm = $("body"); } $(window).scrolltop(0); return elm; } $(function() { // init disablebrowsersmoothscroll(); _scrollelm = getscrollableelement(); switchversion(); // youtube // modalyoutube(); // window resize var resizetimer = false; $(window).on("resize.sibai", function() { if (resizetimer !== false) { cleartimeout(resizetimer); } resizetimer = settimeout(function() { switchversion(); }, 200); }); var fontheight = $("h1").height(); var headerheight = $("#contents").offset().top; setinterval(function() { var fh = $("h1").height(); var hh = $("#contents").offset().top; if (fh != fontheight || hh != headerheight) { switchversion(); fontheight = fh; headerheight = hh; } }, 1000); }); // reset scroll position on reload $(window).on("beforeunload", function() { var ua = window.navigator.useragent.tolowercase(); if (ua.indexof("safari") === -1 || ua.indexof("chrome") !== -1) { $("body").css({ visibility: "hidden" }); $(window).scrolltop(0); } }); })(jquery); })