$(function() { category = Array(); category['about'] = Array(); category['about'][0] = "BIOGRAPHY"; category['about'][1] = "Biography of SHIMOZAWA Toshiya"; category['about'][2] = "modal"; category['works'] = Array(); category['works'][0] = "WORKS"; category['works'][1] = "Works of SHIMOZAWA Toshiya"; category['works'][2] = "index"; category['works/art'] = Array(); category['works/art'][0] = "WORKS/ART"; category['works/art'][1] = "Art Works of SHIMOZAWA Toshiya"; category['works/art'][2] = "index"; category['works/teathings'] = Array(); category['works/teathings'][0] = "WORKS/TEA-THINGS"; category['works/teathings'][1] = "Tea-things of SHIMOZAWA Toshiya"; category['works/teathings'][2] = "index"; category['news'] = Array(); category['news'][0] = "NEWS"; category['news'][1] = "Information of SHIMOZAWA Toshiya"; category['news'][2] = "index"; category['press'] = Array(); category['press'][0] = "PRESS"; category['press'][1] = "Press about SHIMOZAWA Toshiya"; category['press'][2] = "index"; category['access'] = Array(); category['access'][0] = "ACCESS"; category['access'][1] = "Access of Atelier"; category['access'][2] = "modal"; history_counter = 0; past_href = location.href; memorize_scrolltop = $(window).scrollTop(); memorize_lastvisit = "entry"; root_url = "https://toshiyashimozawa.com/"; past_entry_id = ""; if( "works/art" != "" && category["works/art"][2] == "modal" ){ memorize_past_id = ""; }else{ memorize_past_id = $("div#index > article").attr("class").replace( " ", "/" ); } memorize_lasturl = location.href; profile_url = "about"; $(window).bind('load', function() { var target_nav = $(".class_" + "works/art".replace( "/", "_" )); target_nav.removeClass("over"); target_nav.addClass("active"); if("works/art".indexOf( "/" ) != -1){ var id_arr = "works/art".split('/'); var parent_id = id_arr[0]; var target_nav = $(".class_p_" + parent_id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#navi nav li a:not(.class_p_" + parent_id + ")").next("ul").fadeOut(400); $("#navi nav li a.class_p_" + parent_id).next("ul").fadeIn(200); var target_thm = $("ul#list li[data-category *= '" + category["works/art"][0] + "' ]"); if( target_thm[0] && memorize_lastvisit != "entry" ){ var scrollto = target_thm.first().offset().top - $("#header").height() - 10; }else{ var scrollto = 0; } $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); }else{ var target_nav = $(".class_p_" + "works/art"); target_nav.removeClass("over"); target_nav.addClass("active"); $("#navi nav li a:not(.class_p_works/art)").next("ul").fadeOut(400); $("#navi nav li a.class_p_works/art").next("ul").fadeIn(200); if( memorize_lastvisit != "entry" && "works/art" != "" && category["works/art"][2] != "modal" ){ var scrollto = $("#container").offset().top - 15; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } } }); function PJAX_hrefchange( href, onpop ) { if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } if( href && past_href != href ){ past_href = href; var id = href.replace( "https://toshiyashimozawa.com/", "" ); var id = id.replace( "?mode=preview", "" ); if(memorize_past_id.indexOf( "/" ) != -1){ var memorize_past_id_arr = memorize_past_id.split('/'); var parent_past_id = memorize_past_id_arr[0]; }else{ var parent_past_id = memorize_past_id; } ajax_request = $.ajax({ url: "https://toshiyashimozawa.com/pjax_readtitle_json.php", data: "id=" + id + "&type=json" + "", dataType: "json", success: function(data, dataType){ if(!onpop){ PJAX_pushState( href, data.title ); } document.title = data.title; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); if (id.match(/\d{4}$/)) { var entry_id = id.match(/\d{4}$/); var category_filter = id.replace("/" + entry_id ,""); if( entry_id != "" && category_filter != "" && entry_id != category_filter ){ $("body").append("
"); if( memorize_lastvisit == "entry"){ $('html,body').animate({ scrollTop: memorize_scrolltop }, '200'); }else{ memorize_scrolltop = $(window).scrollTop(); } ajax_request = $.ajax({ url: "https://toshiyashimozawa.com/ajax_entry.php", data: "id=" + category_filter + "/" + entry_id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", memorize_scrolltop + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $(this).remove(); } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_past_id = category_filter; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else if( entry_id != "" ){ $("body").append("
"); if( memorize_lastvisit == "entry"){ $('html,body').animate({ scrollTop: memorize_scrolltop }, '200'); }else{ memorize_scrolltop = $(window).scrollTop(); } ajax_request = $.ajax({ url: "https://toshiyashimozawa.com/ajax_entry.php", data: "id=" + entry_id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", memorize_scrolltop + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $(this).remove(); } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_past_id = ""; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } } if ( id == profile_url ) { memorize_scrolltop = $(window).scrollTop(); $("body").append("
"); ajax_request = $.ajax({ url: "https://toshiyashimozawa.com/ajax_profile.php", data: "id=" + id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", $(window).scrollTop() + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $("div#entry a.modal_overlay, div#entry a.close").attr("href", root_url + memorize_past_id); initialize_gmap("https://toshiyashimozawa.com/","ajax"); $(this).remove(); } ); } ); } ); memorize_lastvisit = "profile"; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else if ( typeof category[id] != "undefined" && category[id][2] == "modal" ) { memorize_scrolltop = $(window).scrollTop(); $("body").append("
"); ajax_request = $.ajax({ url: "https://toshiyashimozawa.com/ajax_entry.php", data: "id=" + id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", $(window).scrollTop() + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $("div#entry a.modal_overlay, div#entry a.close").attr("href", root_url + memorize_past_id); initialize_gmap("https://toshiyashimozawa.com/","ajax"); $(this).remove(); } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else if( typeof entry_id == "undefined" && id != "" ){ if( memorize_lastvisit == "entry" || memorize_lastvisit == "profile" || memorize_lastvisit == "static" ){ $('html,body').animate({ scrollTop: memorize_scrolltop }, 200); $("ul#list").stop().css({ opacity : 1 } ); $("div#entry").stop().animate({ opacity : 0 },200, function(){ $("div#entry").empty().stop().animate({opacity : 1},200); } ); } if( id != memorize_past_id ){ if( id != parent_past_id ){ if( $("ul#list li[data-category *= '" + category[id][0] + "' ]")[0] ){ var target_thm = $("ul#list li[data-category *= '" + category[id][0] + "' ]"); if( target_thm[0] ){ var scrollto = target_thm.first().offset().top - $("#header").height() - 10; }else{ var scrollto = $(document).height(); } $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); }else{ var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } } $("li.load_more > a").attr("data-id",id); var next_page = $("li.load_more > a").attr("data-page"); $("li.load_more > a").attr("href","https://toshiyashimozawa.com/"+id+"/"+next_page); thmArr = []; PJAX_thumb_i = 0; $("div#index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); for(var i = 0 ; i < PJAX_thumb_i ; i++){ thmArr[i].removeClass("on off"); var get_category = thmArr[i].attr("data-category"); var get_href = thmArr[i].find(".tagswitch").attr("data-href"); var get_inner_html = thmArr[i].find(".tagswitch").html(); if( get_category.indexOf(category[id][0]) != -1 || id.indexOf( "/" ) == -1 ){ thmArr[i].find(".tagswitch").replaceWith(''+get_inner_html+'') thmArr[i].addClass("on"); thmArr[i].stop().delay(2*i).animate({ "opacity": 1 },100); var ua = navigator.userAgent; var isIE8 = ua.match(/msie [8.]/i); if( isIE8 ){ thmArr[i].find("figure *[class != 'text_wrapper']").animate({"opacity":1},200); } }else{ thmArr[i].find(".tagswitch").replaceWith('
'+get_inner_html+'
') thmArr[i].addClass("off"); thmArr[i].stop().delay(2*i).animate({ "opacity": 0.1 },100); var ua = navigator.userAgent; var isIE8 = ua.match(/msie [8.]/i); if( isIE8 ){ thmArr[i].find("figure *[class != 'text_wrapper']").animate({"opacity":0.1},200); } } } } memorize_lastvisit = "index"; memorize_lasturl = href; memorize_past_id = id; } if( id == "" ){ if( memorize_lastvisit == "entry" || memorize_lastvisit == "profile" || memorize_lastvisit == "static" ){ $('html,body').animate({ scrollTop: memorize_scrolltop }, 800, "easeOutQuint"); $("ul#list").stop().css({ "opacity" : 1 } ); $("div#entry").stop().animate({ "opacity" : 0 },200, function(){ $("div#entry").empty().stop().animate({opacity : 1},200); memorize_scrolltop = 0; } ); }else{ $('html,body').animate({ scrollTop: 0 }, 800, "easeOutQuint"); $("li.load_more > a").attr("data-id",""); var next_page = $("li.load_more > a").attr("data-page"); $("li.load_more > a").attr("href","https://toshiyashimozawa.com/"+"/"+next_page); thmArr = []; PJAX_thumb_i = 0; $("div#index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); for(var i = 0 ; i < PJAX_thumb_i ; i++){ thmArr[i].removeClass("on off"); var get_href = thmArr[i].find(".tagswitch").attr("data-href"); var get_inner_html = thmArr[i].find(".tagswitch").html(); thmArr[i].find(".tagswitch").replaceWith(''+get_inner_html+'') thmArr[i].addClass("on"); thmArr[i].stop().delay(2*i).animate({ "opacity": 1 },100); var ua = navigator.userAgent; var isIE8 = ua.match(/msie [8.]/i); if( isIE8 ){ thmArr[i].find("figure *[class != 'text_wrapper']").animate({"opacity":1},200); } } } memorize_lastvisit = "root"; memorize_lasturl = href; memorize_past_id = id; } if( typeof entry_id == "undefined" ){ $("#navi nav li a").css({ "border-bottom-color" : "" }); $("#navi nav li a").removeClass("active"); $("#navi nav li a").addClass("over"); var target_nav = $(".class_" + id.replace( "/", "_" )); target_nav.removeClass("over"); target_nav.addClass("active"); if(id.indexOf( "/" ) != -1){ var id_arr = id.split('/'); var parent_id = id_arr[0]; var target_nav = $(".class_p_" + parent_id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#navi nav li a:not(.class_p_" + parent_id + ")").next("ul").fadeOut(400); $("#navi nav li a.class_p_" + parent_id).next("ul").fadeIn(200); $("ul#list").removeClass(); $("ul#list").addClass(parent_id); if( history_counter == 0 ){ var scrollto = $("#container").offset().top - 15; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } }else if( id != "" && id != profile_url && category[id][2] != "modal" ){ if( typeof parent_past_id != "undefined" && id != parent_past_id ){ var scrollto = $("#container").offset().top - 15; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); $("ul#list").stop().animate({ opacity : 0 },200, function(){ $("ul#list").removeClass(); $("ul#list").addClass(id); setTimeout(function(){ $("ul#list").stop().animate({ opacity : 1 },200 ); },10); } ); }else{ $("ul#list").removeClass(); $("ul#list").addClass(id); if( history_counter == 0 ){ var scrollto = $("#container").offset().top - 15; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } } var target_nav = $(".class_p_" + id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#navi nav li a:not(.class_p_" + id + ")").next("ul").fadeOut(400); $("#navi nav li a.class_p_" + id).next("ul").fadeIn(200); memorize_scrolltop = 0; }else if( id == profile_url ){ $("#navi nav li a").next("ul").fadeOut(400); $("ul#list").removeClass(); $("ul#list").addClass("works"); }else if( id != "" && category[id][2] == "modal" ){ $("#navi nav li a").next("ul").fadeOut(400); $("ul#list").removeClass(); $("ul#list").addClass("works"); var target_nav = $(".class_p_" + id.replace( "/", "_" )); target_nav.removeClass("over"); target_nav.addClass("active"); }else{ if( typeof parent_past_id != "undefined" && parent_past_id != "works" && parent_past_id != "" ){ $("ul#list").stop().animate({ opacity : 0 },200, function(){ $("ul#list").removeClass(); $("ul#list").addClass("works"); setTimeout(function(){ $("ul#list").stop().animate({ opacity : 1 },200 ); },10); } ); }else{ // if( past_entry_id == "" ){ // var scrollto = 0; // $('html,body').stop().animate({ // scrollTop: scrollto // }, 1000, "easeOutQuint"); // } $("ul#list").removeClass(); $("ul#list").addClass("works"); setTimeout(function(){ $("ul#list").stop().animate({ opacity : 1 },200 ); },10); } var target_nav = $(".class_works"); target_nav.removeClass("over"); target_nav.addClass("active"); var target_nav = $(".class_p_works"); target_nav.removeClass("over"); target_nav.addClass("active"); $("#navi nav li a:not(.class_p_art)").next("ul").fadeOut(400); $("#navi nav li a.class_p_works").next("ul").fadeIn(200); } }else{ past_entry_id = entry_id; } }else{ var id = href.replace( "https://toshiyashimozawa.com/", "" ); var id = id.replace( "?mode=preview", "" ); if( category[id][2] == "index" ){ var scrollto = $("#container").offset().top - 15; $('html,body').animate({ scrollTop: scrollto }, 800, "easeOutQuint"); } } } function PJAX_pushState( href, title ) { if ( window.history.pushState ) { window.history.pushState( title, null, href ); } else { } } window.onpopstate = function(event){ var onpop = true; if( history_counter != 0 ){ if (event.state) { } else { } var href = location.href; if ( window.history.pushState ) { PJAX_hrefchange( href, onpop ); history_counter++; } else { var href = "https://toshiyashimozawa.com/#!/" + href.replace( /^.\//, '' ); window.location = href; history_counter++; } } history_counter++; } $(document).on("click", "a.pjax", function(){ var href = $(this).attr("href"); if ( window.history.pushState ) { PJAX_hrefchange( href ); history_counter++; } else { var href = href.replace( "https://toshiyashimozawa.com/", "" ); var href = "https://toshiyashimozawa.com/#!/" + href.replace( /^.\//, '' ); window.location = href; history_counter++; } return false; }); $(window).hashchange( function(){ var hash = location.hash; if( hash.indexOf( "#!/" ) != -1 ){ var href = hash.replace( /^#!\//, '' ); if( href == "" ){ var href = "https://toshiyashimozawa.com/"; } } PJAX_hrefchange( href ); }) $(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_hrefchange( href ); } } }); });