').prepend(ajax_data));
$("#navi").empty();
$("#navi").prepend(get_navi_elm);
$("#container > div#base > article").addClass("ajax");
setTimeout(
function(){
$("#container > div#base > article.leave").remove();
load_iframe();
// FB.XFBML.parse();
window_resize();
loading_remove();
var scrollto_val = 0;
if( scroll != "" ){
scrollto_val = $("#" + selectorEscape(scroll)).position().top;
}
scrollto(scrollto_val);
}
, 10);
hashchange_action(hash);
if( data.directory == "root" ){
logo_show();
}else{
logo_hide();
}
img_load();
scroll_action_flag = true;
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function ajaxload_loadmore( href, data, option, target, hash ) {
var scroll = data.scroll;
if( typeof ajax_request != "undefined" ){
ajax_request.abort();
}
ajax_request = $.ajax({
url: href,
dataType: "html",
success:
function(data, dataType){
target.children("li.load_more").remove();
var get_elm = $('div.index > ul > *:not(.create)', $('
').prepend(data));
target.append(get_elm);
img_load();
window_resize();
loading_remove();
scroll_action_flag = true;
var target_index = target.closest(".index");
// thm_random_fade_start( target_index );
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function scrollto(val){
scroll_action_flag = false;
$('#container > div#base').stop().animate({
scrollTop: val
}, 1000, "easeOutQuint",function(){
scroll_action_flag = true;
});
}
function pushState( href, title ) {
if ( window.history.pushState ) {
window.history.pushState( title, null, href );
} else {
}
}
window.onpopstate = function(event){
if (event.state) {
} else {
}
var href = location.href;
if ( window.history.pushState ) {
pjax( href, "by_onpop", "" );
} else {
var href = "https://sumimasen.life/#!/" + href.replace( /^.\//, '' );
window.location = href;
}
}
$(document).on("click", "a.pjax", function(){
var href = $(this).attr("href");
if ( window.history.pushState ) {
pjax( href, "", "" );
} else {
var href = href.replace( "https://sumimasen.life/", "" );
var href = "https://sumimasen.life/#!/" + href.replace( /^.\//, '' );
var past_href = location.href;
window.location = href;
}
return false;
});
$(document).on("click", "div.index > ul > li.load_more > a.pjax_load_more", function(){
var href = $(this).attr("href");
var target = $(this).closest("ul");
if ( window.history.pushState ) {
var parent = $(this).parent();
parent.addClass("loading");
parent.append('
loading
');
pjax( href, "by_load_more", target );
}
return false;
});
$(window).bind('load', function() {
var hash = location.hash;
if( hash.indexOf( "#!/" ) != -1 ){
var href = hash.replace( /^#!\//, '' );
if ( window.history.pushState ) {
window.location = href;
}else{
pjax( href, "", "" );
}
}
});
function scroll_trigger() {
if( $(".scroll_trigger")[0] ){
var target = $(".scroll_trigger");
var length = target.length;
for(var i=0; i
800 ){
var tracking = 0.5;
move_y -= window_height/5;
}else{
var tracking = 0.25;
move_y -= window_height/4;
}
if( target_parallax.attr("data-tracking") ){
var tracking = target_parallax.attr("data-tracking");
}
target_parallax.css({"transform": "matrix(1, 0, 0, 1, 0, "+ -move_y*tracking +")"});
}
}
if(target.eq(i).hasClass('action')) continue;
var in_position = position + window_height/3;
var window_bottom_position = $("body #container > div#base").scrollTop() + $(window).height();
if(in_position < window_bottom_position){
target.eq(i).addClass('action');
if( target.eq(i).find(".index")[0] ){
var target_index = target.eq(i).find(".index");
setTimeout(function(){
// thm_random_fade_start( target_index );
},200);
}
}
}
}
}
// function thm_random_fade_start( target_index ){
// var target_thms = target_index.find("ul > li.thm:not(.show)");
// thm_random_fade( target_thms, 200 );
// }
// function thm_random_fade( targets, delay ){
// var target_num = targets.length;
// var random_i = Math.floor(Math.random()*target_num);
// $(targets[random_i]).addClass("show");
// targets.splice(random_i,1);
// if (target_num > 0) {
// setTimeout(function(){
// thm_random_fade( targets, delay );
// },delay);
// } else {
// return false;
// }
// }
function scroll_off(){
var scroll_event = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll';
$(document).on(scroll_event,function(e){e.preventDefault();});
$(document).on('touchmove.noScroll', function(e) {e.preventDefault();});
}
function scroll_on(){
var scroll_event = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll';
$(document).off(scroll_event);
$(document).off('.noScroll');
}
if( id == "" ){
// scroll_off();
}else{
// scroll_on();
}
var document_height = $(document).height();
var content_height = $("#container > div#base > *").height();
var entry_height = $("#entry > div.inner > *").height();
if( $("html.touch_device")[0] ){
if( window.innerHeight > window.innerWidth ){
var window_height = $(window).height();
}else{
var window_height = $(window).height();
}
}else{
var window_height = window.innerHeight ? window.innerHeight: $(window).height();
}
var window_width = $(window).width();
var window_ratio = window_height / window_width;
var scroll_val = $("body #container > div#base").scrollTop();
var scroll_action_flag = true;
if( $("body.modal")[0] ){
scroll_action_flag = false;
}
if( $("body.entry")[0] ){
scroll_action_flag = false;
}
function base_scroll() {
scroll_trigger();
scroll_val = $("body #container > div#base").scrollTop();
$("div#bg > div#viewer").css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (-scroll_val/2) +")"
});
$("header#top_logo").css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/3) +")"
});
$("div#bg > div#viewer > div#top_img > div.img_parts.top > div.img_parts.top_bg > div.bg_01 > img").css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/4) +")"
});
$("div#bg > div#viewer > div#top_img > div.img_parts.top > div.img_parts.top_bg > div.bg_02 > img").css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/10) +")"
});
// console.log(scroll_val+window_height+"|"+content_height);
if( scroll_val+window_height > content_height - 100 ){
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}else if( scroll_val < Math.round(window_height/5) ){
$("html").removeClass("scrolled")
$("html").removeClass("scrollend")
}else if( scroll_val >= Math.round(window_height/5) && scroll_val+window_height < content_height - 100 ){
$("html").addClass("scrolled")
$("html").removeClass("scrollend")
}else{
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}
if( $("div.index > ul > li.load_more:not(.loading) > a.auto_load_more")[0] ){
var loadmore_elm = $("div.index > ul > li.load_more:not(.loading) > a.auto_load_more");
var loadmore_elm_offset = Number(loadmore_elm.parent().position().top);
if( scroll_val > loadmore_elm_offset-window_height ){
var href = loadmore_elm.attr("href");
var target = loadmore_elm.closest("ul");
if ( window.history.pushState ) {
var parent = loadmore_elm.parent();
parent.addClass("loading");
parent.append('loading
');
pjax( href, "by_load_more", target );
}
}
}
if( $("html.iOS")[0] ){
// scrollbar_height = parseInt(window_height * window_height / content_height);
// $('.scrollbar_thumb').css('height', scrollbar_height);
// var scrollbar_track = window_height - scrollbar_height;
// var scrollbar_offset = scroll_val * scrollbar_track / (content_height - window_height);
// $('.scrollbar_thumb').css('transform', 'translateY(' + scrollbar_offset + 'px)');
}
if( scroll_action_flag === true && $("body #container > div#base article.ground")[0] ){
scroll_action_flag = false;
if( typeof scroll_action_limiter != "undefined" ){
clearTimeout( scroll_action_limiter );
}
scroll_action_limiter = setTimeout(
function(){
$("body #container > div#base article.ground").each(function(){
if( $(this).attr("id") != null ){
var ground_id = $(this).attr("id");
if( typeof category[ground_id] != "undefined" ){
var ground_offset = $("#" + selectorEscape( ground_id )).position().top;
var ground_height = $("#" + selectorEscape( ground_id )).height();
if( scroll_val >= ground_offset && scroll_val <= ground_offset + ground_height ){
// console.log(id);
// console.log(ground_id);
var href = "https://sumimasen.life/" + ground_id;
// console.log("scroll::"+href);
pjax( href, "by_scroll", "" );
}else if( scroll_val < $("body #container > div#base article.ground").first().position().top ){
if( $("body").attr("data-scroll") != "" ){
var scroll_split = $("body").attr("data-scroll").split('/');
var ground_directory = $("body").attr("data-scroll").replace( scroll_split[scroll_split.length-1], "" );
var href = "https://sumimasen.life/" + ground_directory;
// console.log("top::"+href);
pjax( href, "by_scroll", "" );
}
}
}
}
});
scroll_action_flag = true;
}
, 1000);
}
}
function entry_scroll() {
scroll_val = $("#entry > div.inner").scrollTop();
// console.log(scroll_val+window_height+"|"+entry_height);
if( scroll_val+window_height > entry_height - 100 ){
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}else if( scroll_val < Math.round(window_height/5) ){
$("html").removeClass("scrolled")
$("html").removeClass("scrollend")
}else if( scroll_val >= Math.round(window_height/5) && scroll_val+window_height < entry_height - 100 ){
$("html").addClass("scrolled")
$("html").removeClass("scrollend")
}else{
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}
}
function window_resize() {
document_height = $(document).height();
content_height = $("#container > div#base > *").height();
entry_height = $("#entry > div.inner > *").height();
if( $("html.touch_device")[0] ){
if( window.innerHeight > window.innerWidth ){
window_height = $(window).height();
}else{
window_height = $(window).height();
}
}else{
window_height = window.innerHeight ? window.innerHeight: $(window).height();
}
window_width = $(window).width();
window_ratio = window_height / window_width;
if( window_ratio > 1 ){
$("html").removeClass("horizontal");
$("html").addClass("portrait");
}else{
$("html").removeClass("portrait");
$("html").addClass("horizontal");
}
if( window_ratio < 0.6 ){
$("html").addClass("panorama");
}else{
$("html").removeClass("panorama");
}
$("body").css({"height": window_height});
if( $("article#root > article#top")[0] ){
$("article#root > article#top").css({"height": window_height});
}
// if( $("body #container > div#base > article")[0] ){
// var article_margin = (window_height - $("body #container > div#base > article").height())/2;
// if( article_margin < 0 ){
// article_margin = 0;
// }
// $("body #container > div#base > article").css({"padding-top": article_margin,"padding-bottom": article_margin});
// // console.log(article_margin);
// }
base_scroll();
entry_scroll_bind();
entry_scroll();
}
var scroll_flug = true;
$("body #container > div#base").scroll(function(){
base_scroll();
// if(scroll_flug){
// scroll_flug = false;
// base_scroll();
// setTimeout(function(){
// scroll_flug = true;
// return scroll_flug;
// }, 50);
// }
});
function entry_scroll_bind(){
$("html").removeClass("scrolled");
$("html").removeClass("scrollend");
$("#entry > div.inner").scroll(function(){
entry_scroll();
// if(scroll_flug){
// scroll_flug = false;
// base_scroll();
// setTimeout(function(){
// scroll_flug = true;
// return scroll_flug;
// }, 50);
// }
});
}
entry_scroll_bind();
$(window).bind("resize", window_resize);
function selectorEscape(val){
return val.replace(/\//g, '\\/');
}
function logo_hide(){
$("header#top_logo").removeClass("start");
$("header#top_logo > h1 > div > *").hide();
video_stop();
}
function logo_show(){
if( $("body.root")[0] ){
$("header#top_logo > h1 > div > *").show();
$("header#top_logo").addClass("start");
if( $("html.ie")[0] || $("html.edge")[0] ){
svg_play("logo_svg");
}else{
$("header#top_logo > h1 > div > *").attr("class","start");
}
video_play();
}
}
function video_stop(){
$("article#top > div.inner > div.video > ul > li.video_1.part").removeClass("active");
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_1.part > div").empty();
$("article#top > div.inner > div.video > ul > li.video_2.part").removeClass("active");
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_2.part > div").empty();
},1000);
},1000);
}
function video_play(){
if( $("body.root")[0] ){
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_1.part").addClass("active");
create_video( $("article#top > div.inner > div.video > ul > li.video_1.part > div") , "https://sumimasen.life/elements/video_01" , "video_01" );
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_2.part").addClass("active");
create_video( $("article#top > div.inner > div.video > ul > li.video_2.part > div") , "https://sumimasen.life/elements/video_02" , "video_02" );
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.part > div > img").fadeIn(1000);
},1000);
},500);
},4000);
}
// if( $("body.root")[0] ){
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.video_1.part").addClass("active");
// create_video( $("article#top > div.inner > div.video > ul > li.video_1.part > div") , "http://test:1111@leafbrand.co.jp/elements/video_01" , "video_01" );
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.video_2.part").addClass("active");
// create_video( $("article#top > div.inner > div.video > ul > li.video_2.part > div") , "http://test:1111@leafbrand.co.jp/elements/video_02" , "video_02" );
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.part > div > img").fadeIn(1000);
// },1000);
// },500);
// },4000);
// }
}
function create_video(target, video_file, target_id) {
if( $("html.touch_device.iOS")[0] ) {
var width = target.outerWidth();
var height = target.outerHeight();
target.append('');
setTimeout(function(){
target.parent().addClass("play");
var video = document.createElement('video');
video.style.display = 'none';
document.body.appendChild(video);
var canvas = document.getElementById('video_canvas_'+target_id);
$(canvas).css({"display": "block"});
var ctx = canvas.getContext("2d");
var ctime = 0;
var lastTime;
video.addEventListener('canplay',function(){
lastTime = Date.now();
setInterval(function(){
var curTime = Date.now();
var diff = Date.now() - lastTime;
lastTime = curTime;
ctime += diff/1000;
video.currentTime = ctime;
ctx.drawImage(video, 0, 0, width, height);
if(video.duration <= video.currentTime){
ctime = 0;
}
}, 1000/30);
},false);
video.src = video_file +'.mp4?24042721';
video.load();
},1000);
}else{
target.append('');
setTimeout(function(){
target.parent().addClass("play");
target.find("video").each(function(){
if( ! $(this).hasClass("play") ){
$(this).addClass("play");
$(this).get(0).play();
}
});
},1000);
}
}
function svg_play(id){
var svg1 = document.getElementById(id);
window.requestAnimFrame = function(){
return (
function( callback ){
window.setTimeout(callback, 1000 / 60); //60fps
}
);
}();
var current_frame = 0;
var total_frame = 72;
var handle = 0;
var paths = new Array();
var length = new Array();
var rendered = false;
[].slice.call( svg1.querySelectorAll('path') ).forEach( function( path, i ) {
paths[i] = path;
var l = paths[i].getTotalLength() + 30;
length[i] = l;
paths[i].style.strokeDasharray = l + ' ' + l;
paths[i].style.strokeDashoffset = l;
} );
function draw(){
progress = current_frame/total_frame;
if (progress > 1) {
window.clearTimeout(handle);
} else {
current_frame++;
for(var j=0, len = paths.length; j 0 ){
img_arr.each(function(indx){
img[indx] = new Image();
img[indx].onload = function(){
img_arr_lngth = img_arr_lngth - 1;
var progress = Math.round((1-img_arr_lngth/img_arr_lngth_total)*100);
$("div.progress").stop().animate({"width": progress + "%"},1000);
if( 0 >= img_arr_lngth ){
$("html").data("preloaded", 1);
$("div.progress").stop().animate({"width": "100%"},500,"easeOutQuad",function(){
setTimeout(function(){
$("div.progress").addClass("out");
setTimeout(function(){
$("div#preloader").fadeOut(1000, function() {
$(this).remove();
window_resize();
$("html").addClass("start");
logo_show();
});
},200);
},200);
});
}
};
img[indx].src = $(this).attr('src');
});
}else{
$("html").data("preloaded", 1);
$("div#progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){
$.getScript("https://sumimasen.life/js/3d.js?1707063", function(){
});
setTimeout(function(){
$("div.progress").addClass("out");
setTimeout(function(){
$("div#preloader").fadeOut(2000, function() {
$(this).remove();
window_resize();
});
},1000);
},200);
});
}
}
function img_load(){
$("img.preload:not('.loaded')").each(function(){
$(this).imagesLoaded(function(){
$(this).addClass("loaded");
});
});
}
$("div#preloader > div.bg > div.logo_wrapper > img.logo").imagesLoaded(function(){
$("div#preloader > div.bg").addClass("show");
preload();
});
$(window).bind('load', function() {
img_load();
window_resize();
if( $("body #container > div#base article.ground")[0] ){
scroll_action_flag = false;
var target = $("#" + selectorEscape($("body").attr("data-scroll")));
if( target[0] ){
var val = target.position().top;
scrollto(val);
}
}
});
function list_filter( target ){
var wrapper = target.closest("div.index.db > ul > li.filter");
var val = "";
var column = "";
wrapper.find("div.filter_input > div.input_wrapper > *:first-child").each(function(){
var add_val = "";
if( $(this).is("div.checkbox") ){
add_val = $(this).attr("data-value");
}else if( $(this).is("input") ){
add_val = $(this).val();
}
if( add_val != "" ){
column = $(this).attr("data-column");
val += "["+column+"]"+add_val+",";
}
});
var path = target.attr("data-path");
var href = "";
if ( val != "" ) {
href = "https://sumimasen.life/"+path+val;
}else{
href = "https://sumimasen.life/"+path;
}
console.log(href);
pjax( href, "", "" );
return false;
}
$(document).on("change", "div.category_select > select.pulldown_menu", function(){
var val = $(this).val();
var href = "https://sumimasen.life/"+val;
console.log(href);
pjax( href, "", "" );
})
$(document).on("keydown", "#entry_search > div.input_wrapper > input", function(e) {
var val = $(this).val();
if ( e.which == 13 && val != "" ) {
var path = $(this).attr("data-path");
var href = "https://sumimasen.life/"+path+val;
console.log(href);
pjax( href, "", "" );
return false;
}
});
$(document).on("keydown", ".search_menu > div.input_wrapper > input", function(e) {
var val = $(this).val();
if ( e.which == 13 && val != "" ) {
var path = $(this).attr("data-path");
var href = "https://sumimasen.life/"+path+val;
console.log(href);
pjax( href, "", "" );
return false;
}
});
$(document).on("keydown", ".filter_input > div.input_wrapper > input", function(e) {
if ( e.which == 13 ) {
list_filter( $(this) );
}
});
$(document).on("change", ".filter_input > div.input_wrapper > select", function(e) {
list_filter( $(this) );
});
$(document).on("change", ".filter_input > div.input_wrapper > input.date_range", function(e) {
list_filter( $(this) );
});
$(document).on("click touchstart", ".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.filter", function() {
$(this).next(".checkbox_wrapper").addClass("active");
});
$(document).on("click touchstart", ".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.modal_overlay", function() {
$(this).prev(".checkbox_wrapper").removeClass("active");
});
$(document).on("click touchstart", ".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.checkbox_wrapper > div.btn.clear", function() {
$(".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.checkbox_wrapper input[type='checkbox']").prop('checked', false).change();
});
$(document).on("change", ".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.checkbox_wrapper input[type='checkbox']", function(e) {
console.log("checked");
var wrapper = $(this).closest(".checkbox_wrapper");
var val = "";
wrapper.find("input[type='checkbox']:checked").each(function(){
if( $(this).val() != "" ){
val += $(this).val()+"|";
}
});
$(".filter_input > div.input_wrapper > div.pulldown_menu.checkbox").attr("data-value",val);
$(".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.display").text(val);
});
$(document).on("click touchstart", ".filter_input > div.input_wrapper > div.pulldown_menu.checkbox > div.checkbox_wrapper > div.btn.search", function() {
var target = $(this).closest(".pulldown_menu.checkbox");
list_filter( target );
$(this).closest(".checkbox_wrapper").removeClass("active");
});
});