$(function() { category = Array(); category['about/'] = Array(); category['about/']['title'] = "ABOUT"; category['about/']['description'] = "飛生芸術祭の開催概要"; category['about/']['type'] = "page"; category['about/']['pagenation'] = "0"; category['about/']['format'] = "Profile_Format_001"; category['about/']['directory'] = "about/"; category['root'] = Array(); category['root']['title'] = "top"; category['root']['description'] = ""; category['root']['type'] = "page"; category['root']['pagenation'] = "0"; category['root']['format'] = "Part_Content_001"; category['root']['directory'] = "root"; category['intro/'] = Array(); category['intro/']['title'] = "INTRO"; category['intro/']['description'] = "飛生芸術祭のコンセプト"; category['intro/']['type'] = "page"; category['intro/']['pagenation'] = "2"; category['intro/']['format'] = "Part_Content_002"; category['intro/']['directory'] = "intro/"; category['news/'] = Array(); category['news/']['title'] = "NEWS"; category['news/']['description'] = "飛生芸術祭のニュース"; category['news/']['type'] = "page"; category['news/']['pagenation'] = "3"; category['news/']['format'] = "Part_Content_003"; category['news/']['directory'] = "news/"; category['contents/'] = Array(); category['contents/']['title'] = "CONTENTS"; category['contents/']['description'] = "飛生芸術祭のイベント等のご紹介"; category['contents/']['type'] = "page"; category['contents/']['pagenation'] = "4"; category['contents/']['format'] = "Part_Content_004"; category['contents/']['directory'] = "contents/"; category['access/'] = Array(); category['access/']['title'] = "ACCESS"; category['access/']['description'] = "飛生芸術祭の交通アクセス"; category['access/']['type'] = "page"; category['access/']['pagenation'] = "5"; category['access/']['format'] = "Part_Content_005"; category['access/']['directory'] = "access/"; category['about/supporters'] = Array(); category['about/supporters']['title'] = "ABOUT/SUPPORTERS"; category['about/supporters']['description'] = "飛生芸術祭のサポーター"; category['about/supporters']['type'] = "ground"; category['about/supporters']['pagenation'] = "6"; category['about/supporters']['format'] = "Part_Content_010"; category['about/supporters']['directory'] = "about/"; function htmlEncode(value){ return $('
').text(value).html(); } function htmlDecode(value){ return $('
').html(value).text(); } var href = ""; var past_href = location.href; var past_directory = $("body").attr("data-directory"); var past_modal_content_type = ""; var memo_scroll = 0; var id = past_href.replace( "http://fes.tobiu.com/2017/", "" ).replace( "?mode=preview", "" ); var option = ""; function PJAX_pjax( href, option, target ) { var scroll_id = href.replace( "http://fes.tobiu.com/2017/", "" ).replace( "?mode=preview", "" ); if( scroll_id == "" ){ scroll_id = "root"; } PJAX_scroll_ground( scroll_id, option ); if( href && past_href != href && href.indexOf( "#" ) == -1 ){ scroll_action_flag = false; if( typeof scroll_action_limiter != "undefined" ){ clearTimeout( scroll_action_limiter ); } past_href = href; id = href.replace( "http://fes.tobiu.com/2017/", "" ).replace( "?mode=preview", "" ); if( id == "" ){ scroll_off(); }else{ scroll_on(); } console.log(id); console.log("──── pjax ────"); console.log("href: " + href); console.log("option: " + option); console.log("target: " + target); console.log("id: " + id); if( option != "by_scroll" && typeof category[scroll_id] != "undefined" && category[scroll_id]['type'] != "modal" && category[scroll_id]['directory'] == $("body").attr("data-directory") ){ }else if( option != "by_onpop" && option != "by_scroll" && option != "by_load_more" ){ $("body").append('
'); $("body > div.loading").addClass("show"); } if( typeof pjax_request != "undefined" ){ pjax_request.abort(); } pjax_request = $.ajax({ url: "http://fes.tobiu.com/2017/js_pjax_json.php", data: "id=" + id + "&type=json" + "", dataType: "json", success: function(data, dataType){ var pagetitle = data.pagetitle; var meta_og_image = data.meta_og_image; var permalink = data.permalink; var page_format = data.page_format; var body_class = data.body_class; var path = data.path; var directory = data.directory; var directory_1 = data.directory_1; var directory_2 = data.directory_2; var directory_3 = data.directory_3; var directory_4 = data.directory_4; var file = data.file; var scroll = data.scroll; var page_type = data.page_type; var pagenation = data.pagenation; var index_num = data.index_num; var index_parent_dir = data.index_parent_dir; var modal_content_type = data.modal_content_type; var modal_content_page_format = data.modal_content_page_format; var modal_content_entry_date = data.modal_content_entry_date; var modal_content_entry_title_jp = data.modal_content_entry_title_jp; var modal_content_entry_title_en = data.modal_content_entry_title_en; var modal_content_entry_description_jp = data.modal_content_entry_description_jp; var modal_content_entry_description_en = data.modal_content_entry_description_en; var modal_content_media = data.modal_content_media; if( option != "by_onpop" && // option != "by_forward" && option != "by_load_more" ){ console.log("push"); PJAX_pushState( href, pagetitle ); } document.title = pagetitle; var ga_title = pagetitle; $("body").attr("class",body_class); $("body").attr("data-directory",directory); $("body").attr("data-file",file); $("body").attr("data-scroll",scroll); $("body").attr("data-pagenation",pagenation); console.log("modal_content_type: " + modal_content_type); console.log("past_directory: " + past_directory); console.log("directory: " + directory); console.log("href: " + href); console.log("pagenation: " + pagenation); console.log("page_type: " + page_type); // var slsh_to_ub = ground_id.replace( "/", "_" ); // $("#navi nav li").removeClass("active"); // $("#navi nav li").removeClass("p_active"); // var target_nav = $(".class_" + slsh_to_ub + " a"); // target_nav.parent("li").removeClass("over"); // target_nav.parent("li").addClass("active"); // target_nav.closest("li.parent").removeClass("over"); // target_nav.closest("li.parent").addClass("p_active"); if( modal_content_type != "" ){ past_modal_content_type = modal_content_type; PJAX_ajaxload_modal( href, data, option, target ); }else{ if( option != "by_scroll" ){ if( option == "by_load_more" && target != "" ){ PJAX_ajaxload_loadmore( href, data, option, target ); }else if( past_directory != directory ){ past_directory = directory; scrollto(0); PJAX_ajaxload_directory( href, data, option, target ); }else if( past_directory == directory && scroll == "" ){ scroll_action_flag = true; // if( past_modal_content_type == "" ){ // scrollto(0); // }else{ // } }else{ scroll_action_flag = true; var scrollto_val = 0; if( scroll != "" ){ scrollto_val = $("#" + selectorEscape(scroll)).position().top; } scrollto(scrollto_val); } } past_modal_content_type = ""; } // if( data.index_num > 1 ){ // option = "by_forward"; // } // if( $("div#entry > *")[0] ){ // $("div#entry").empty(); // $("div#entry").css("top", 0); // } // if( page_type == "entry" ){ // body_class += " " + "modal"; // scroll_action_flag = false; // memo_scroll = $("body #container > div#base").scrollTop(); // $("div#entry").css("top", memo_scroll + "px"); // $("div#entry").removeClass().addClass(id.replace(/\//g, " ")); // $("body").attr("class",body_class); // PJAX_ajax_load( id,data,option ); // }else if( $("body.modal")[0] ){ // $('#container > div#base').animate({ // scrollTop: memo_scroll // }, 1000, "easeOutQuint"); // $("div#entry").removeClass("active"); // $("body").attr("class",body_class); // scroll_action_flag = true; // }else{ // PJAX_ajax_load( id,data,option ); // } $("body > div.loading").removeClass("show"); setTimeout( function(){ $("body > div.loading").remove(); } , 1000); setTimeout( function(){ if( $("body #entry").css("z-index") == -1 ){ $("body #entry").empty(); } } , 2000); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } } function PJAX_scroll_ground( scroll_id, option ) { if( option != "by_scroll" && typeof category[scroll_id] != "undefined" && category[scroll_id]['type'] != "modal" && category[scroll_id]['directory'] == $("body").attr("data-directory") ){ if( past_modal_content_type == "" ){ console.log("ground: " + scroll_id); var scrollto_val = 0; if( category[scroll_id]['type'] == "ground" && $("#" + selectorEscape(scroll_id))[0] ){ scrollto_val = $("#" + selectorEscape(scroll_id)).position().top; } scrollto(scrollto_val); }else{ $("body").removeClass("entry modal"); } } } function PJAX_ajaxload_modal( href, data, option, target ) { $("#entry").empty(); if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } ajax_request = $.ajax({ url: href, dataType: "html", success: function(data, dataType){ var get_elm = $('#entry > *', $('
').prepend(data)); $("#entry").append(get_elm); $("#entry > div.inner").addClass("pending"); setTimeout( function(){ $("#entry > div.inner").removeClass("pending"); } , 100); var container_id = $("body #container > div#base > article").attr("id"); if( container_id == "root" ){ container_id = ""; } var return_href = "http://fes.tobiu.com/2017/" + container_id; $("#entry a.pjax.close").attr("href",return_href); $("#entry a.pjax.return").attr("href",return_href); img_load(); window_resize(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } function PJAX_ajaxload_directory( href, data, option, target ) { var scroll = data.scroll; if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } ajax_request = $.ajax({ url: href, dataType: "html", success: function(ajax_data, dataType){ var get_elm = $('#container > div#base > article', $('
').prepend(ajax_data)); $("#container > div#base > article").addClass("leave"); $("#container > div#base").append(get_elm); $("#container > div#base > article").addClass("ajax"); setTimeout( function(){ $("#container > div#base > article.leave").remove(); window_resize(); FB.XFBML.parse(); var scrollto_val = 0; if( scroll != "" ){ scrollto_val = $("#" + selectorEscape(scroll)).position().top; } scrollto(scrollto_val); img_load(); } , 500); scroll_action_flag = true; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } function PJAX_ajaxload_loadmore( href, data, option, target ) { 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 > *', $('
').prepend(data)); target.append(get_elm); img_load(); window_resize(); 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 PJAX_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_pjax( href, "by_onpop", "" ); } else { var href = "http://fes.tobiu.com/2017/#!/" + href.replace( /^.\//, '' ); window.location = href; } } $(document).on("click", "a.pjax", function(){ var href = $(this).attr("href"); if ( window.history.pushState ) { PJAX_pjax( href, "", "" ); } else { var href = href.replace( "http://fes.tobiu.com/2017/", "" ); var href = "http://fes.tobiu.com/2017/#!/" + 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_pjax( href, "by_load_more", target ); } return false; }); $(window).hashchange( function(){ var hash = location.hash; if( hash.indexOf( "#!/" ) != -1 ){ var href = hash.replace( /^#!\//, '' ); if( href == "" ){ var href = "http://fes.tobiu.com/2017/"; } PJAX_pjax( 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_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(); if( $("html.touch_device")[0] ){ var window_height = screen.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 window_action() { scroll_trigger(); scroll_val = $("body #container > div#base").scrollTop(); 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 < document_height ){ $("html").addClass("scrolled") $("html").removeClass("scrollend") }else{ $("html").addClass("scrolled") $("html").addClass("scrollend") } 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 = "http://fes.tobiu.com/2017/" + ground_id; // console.log("scroll::"+href); PJAX_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 = "http://fes.tobiu.com/2017/" + ground_directory; // console.log("top::"+href); PJAX_pjax( href, "by_scroll", "" ); } } } } }); scroll_action_flag = true; } , 1000); } } function window_resize() { document_height = $(document).height(); 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( $("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); } if( $("#profile_slide")[0] ){ var profile_slide_ratio = $("#profile_slide").height() / $("#profile_slide").width(); $("#profile_slide > ul > li").each(function(){ var target_li = $(this); var target_img = $(this).find("img"); target_img.imagesLoaded(function(){ target_img.addClass("loaded"); var img_ratio = target_img.height() / target_img.width(); target_li.removeClass("horizontal vertical"); if( profile_slide_ratio < img_ratio ){ target_li.addClass("vertical"); }else{ target_li.addClass("horizontal"); } }); }); } window_action(); } var scroll_flug = true; $("body #container > div#base").scroll(function(){ if(scroll_flug){ scroll_flug = false; window_action(); setTimeout(function(){ scroll_flug = true; return scroll_flug; }, 50); } }); $(window).bind("resize", window_resize); function selectorEscape(val){ return val.replace(/\//g, '\\/'); } $("html").data("preloaded", 0); function preload(){ var img = [], img_arr = $("img.preload"), // ローディング対象の画像を指定 img_arr_lngth = img_arr.size(); var img_arr_lngth_total = img_arr_lngth; if( img_arr_lngth_total > 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 + "%"},2000); if( 0 >= img_arr_lngth ){ $("html").data("preloaded", 1); $("div.progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){ setTimeout(function(){ $.getScript("http://fes.tobiu.com/2017/js/3d.js?1707063", function(){ }); $("div.progress").addClass("out"); setTimeout(function(){ $("div#preloader").fadeOut(1000, function() { $(this).remove(); window_resize(); $("html").addClass("start"); }); },1000); },200); }); } }; img[indx].src = $(this).attr('src'); }); }else{ $("html").data("preloaded", 1); $("div#progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){ $.getScript("http://fes.tobiu.com/2017/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); } } }); });