$(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['news/'] = Array(); category['news/']['title'] = "NEWS"; category['news/']['description'] = "ニュース"; category['news/']['type'] = "index:16"; category['news/']['pagenation'] = "1"; category['news/']['format'] = "Part_Content_002"; category['events/'] = Array(); category['events/']['title'] = "EVENTS"; category['events/']['description'] = "イベント"; category['events/']['type'] = "index:64"; category['events/']['pagenation'] = "2"; category['events/']['format'] = "Part_Content_003"; category['map'] = Array(); category['map']['title'] = "MAP"; category['map']['description'] = "開催イベントマップ"; category['map']['type'] = "page"; category['map']['pagenation'] = "3"; category['map']['format'] = "Part_Content_004"; category['creators/'] = Array(); category['creators/']['title'] = "CREATOR'S FILE"; category['creators/']['description'] = "クリエイターズファイル"; category['creators/']['type'] = "index:64"; category['creators/']['pagenation'] = "4"; category['creators/']['format'] = "Part_Content_005"; category['supporters'] = Array(); category['supporters']['title'] = "SUPPORTERS"; category['supporters']['description'] = "サポーター"; category['supporters']['type'] = "page"; category['supporters']['pagenation'] = "5"; category['supporters']['format'] = "Part_Content_006"; category['report'] = Array(); category['report']['title'] = "REPORT"; category['report']['description'] = "開催を終えて"; category['report']['type'] = "page"; category['report']['pagenation'] = "6"; category['report']['format'] = "Part_Content_007"; category['events/sapporo-side-eventspace/'] = Array(); category['events/sapporo-side-eventspace/']['title'] = "EVENTS/札幌駅側イベントスペース/"; category['events/sapporo-side-eventspace/']['description'] = "札幌駅側イベントスペースのイベント一覧"; category['events/sapporo-side-eventspace/']['type'] = "sort"; category['events/sapporo-side-eventspace/']['pagenation'] = "7"; category['events/sapporo-side-eventspace/']['format'] = "Content_Format_002"; category['events/kitasan-hiroba/'] = Array(); category['events/kitasan-hiroba/']['title'] = "EVENTS/キタサンHIROBA(西)/"; category['events/kitasan-hiroba/']['description'] = "キタサンHIROBA(西)のイベント一覧"; category['events/kitasan-hiroba/']['type'] = "sort"; category['events/kitasan-hiroba/']['pagenation'] = "8"; category['events/kitasan-hiroba/']['format'] = "Content_Format_002"; category['events/ikoi-l/'] = Array(); category['events/ikoi-l/']['title'] = "EVENTS/憩いの空間L/"; category['events/ikoi-l/']['description'] = "憩いの空間Lのイベント一覧"; category['events/ikoi-l/']['type'] = "sort"; category['events/ikoi-l/']['pagenation'] = "9"; category['events/ikoi-l/']['format'] = "Content_Format_002"; category['events/ikoi-east/'] = Array(); category['events/ikoi-east/']['title'] = "EVENTS/憩いの空間EAST/"; category['events/ikoi-east/']['description'] = "憩いの空間EASTのイベント一覧"; category['events/ikoi-east/']['type'] = "sort"; category['events/ikoi-east/']['pagenation'] = "10"; category['events/ikoi-east/']['format'] = "Content_Format_002"; category['events/ikoi-west/'] = Array(); category['events/ikoi-west/']['title'] = "EVENTS/憩いの空間WEST/"; category['events/ikoi-west/']['description'] = "憩いの空間WESTのイベント一覧"; category['events/ikoi-west/']['type'] = "sort"; category['events/ikoi-west/']['pagenation'] = "11"; category['events/ikoi-west/']['format'] = "Content_Format_002"; category['events/n2/'] = Array(); category['events/n2/']['title'] = "EVENTS/北2条交差点広場(東・西)/"; category['events/n2/']['description'] = "北2条交差点広場(東・西)のイベント一覧"; category['events/n2/']['type'] = "sort"; category['events/n2/']['pagenation'] = "12"; category['events/n2/']['format'] = "Content_Format_002"; category['events/n1-east/'] = Array(); category['events/n1-east/']['title'] = "EVENTS/北1条イベントスペース EAST/"; category['events/n1-east/']['description'] = "北1条イベントスペース EASTのイベント一覧"; category['events/n1-east/']['type'] = "sort"; category['events/n1-east/']['pagenation'] = "13"; category['events/n1-east/']['format'] = "Content_Format_002"; category['events/doori-hiroba-east/'] = Array(); category['events/doori-hiroba-east/']['title'] = "EVENTS/ドオリHIROBA(東)/"; category['events/doori-hiroba-east/']['description'] = "ドオリHIROBA(東)のイベント一覧"; category['events/doori-hiroba-east/']['type'] = "sort"; category['events/doori-hiroba-east/']['pagenation'] = "14"; category['events/doori-hiroba-east/']['format'] = "Content_Format_002"; category['events/doori-hiroba-west/'] = Array(); category['events/doori-hiroba-west/']['title'] = "EVENTS/ドオリHIROBA(西)/"; category['events/doori-hiroba-west/']['description'] = "ドオリHIROBA(西)のイベント一覧"; category['events/doori-hiroba-west/']['type'] = "sort"; category['events/doori-hiroba-west/']['pagenation'] = "15"; category['events/doori-hiroba-west/']['format'] = "Content_Format_002"; category['events/relate/'] = Array(); category['events/relate/']['title'] = "EVENTS/関連イベント/"; category['events/relate/']['description'] = "関連イベント一覧"; category['events/relate/']['type'] = "sort"; category['events/relate/']['pagenation'] = "16"; category['events/relate/']['format'] = "Content_Format_002"; category['root'] = Array(); category['root']['title'] = "NEWS/"; category['root']['description'] = ""; category['root']['type'] = "sort"; category['root']['pagenation'] = "0"; category['root']['format'] = "Content_Format_001"; category['creators/architecture/'] = Array(); category['creators/architecture/']['title'] = "CREATOR'S FILE/architecture/"; category['creators/architecture/']['description'] = "CREATOR'S FILE:architecture 一覧"; category['creators/architecture/']['type'] = "sort"; category['creators/architecture/']['pagenation'] = "18"; category['creators/architecture/']['format'] = "Content_Format_003"; category['creators/lighting/'] = Array(); category['creators/lighting/']['title'] = "CREATOR'S FILE/lighting/"; category['creators/lighting/']['description'] = "CREATOR'S FILE:lighting 一覧"; category['creators/lighting/']['type'] = "sort"; category['creators/lighting/']['pagenation'] = "19"; category['creators/lighting/']['format'] = "Content_Format_003"; category['creators/graphics/'] = Array(); category['creators/graphics/']['title'] = "CREATOR'S FILE/graphics/"; category['creators/graphics/']['description'] = "CREATOR'S FILE:graphics 一覧"; category['creators/graphics/']['type'] = "sort"; category['creators/graphics/']['pagenation'] = "20"; category['creators/graphics/']['format'] = "Content_Format_003"; category['creators/landscape/'] = Array(); category['creators/landscape/']['title'] = "CREATOR'S FILE/landscape/"; category['creators/landscape/']['description'] = "CREATOR'S FILE:landscape 一覧"; category['creators/landscape/']['type'] = "sort"; category['creators/landscape/']['pagenation'] = "21"; category['creators/landscape/']['format'] = "Content_Format_003"; category['creators/fashion/'] = Array(); category['creators/fashion/']['title'] = "CREATOR'S FILE/fashion/"; category['creators/fashion/']['description'] = "CREATOR'S FILE:fashion 一覧"; category['creators/fashion/']['type'] = "sort"; category['creators/fashion/']['pagenation'] = "22"; category['creators/fashion/']['format'] = "Content_Format_003"; category['creators/commercial-space/'] = Array(); category['creators/commercial-space/']['title'] = "CREATOR'S FILE/commercial-space/"; category['creators/commercial-space/']['description'] = "CREATOR'S FILE:commercial-space 一覧"; category['creators/commercial-space/']['type'] = "sort"; category['creators/commercial-space/']['pagenation'] = "23"; category['creators/commercial-space/']['format'] = "Content_Format_003"; category['creators/total-design/'] = Array(); category['creators/total-design/']['title'] = "CREATOR'S FILE/total-design/"; category['creators/total-design/']['description'] = "CREATOR'S FILE:total-design 一覧"; category['creators/total-design/']['type'] = "sort"; category['creators/total-design/']['pagenation'] = "24"; category['creators/total-design/']['format'] = "Content_Format_003"; category['root'] = Array(); category['root']['title'] = "TOP"; category['root']['description'] = ""; category['root']['type'] = "page"; category['root']['pagenation'] = "0"; category['root']['format'] = "Part_Content_001"; function htmlEncode(value){ return $('
').text(value).html(); } function htmlDecode(value){ return $('
').html(value).text(); } $("img.preload:not('.loaded')").each(function(){ $(this).imagesLoaded(function(){ $(this).addClass("loaded"); }); }); var href = ""; var past_href = location.href; var memo_scroll = 0; $("body").attr("data-directory","events/sapporo-side-eventspace/"); function PJAX_hrefchange( href, option ) { if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } if( href && past_href != href && href.indexOf( "#" ) == -1 ){ past_href = href; var id = href.replace( "http://sapporodesignweek.jp/2016/", "" ); var id = id.replace( "?mode=preview", "" ); ajax_request = $.ajax({ url: "http://sapporodesignweek.jp/2016/js_pjax_json.php", data: "id=" + id + "&type=json" + "", dataType: "json", success: function(data, dataType){ if( option != "onpop" && option != "forward" ){ PJAX_pushState( href, data.pagetitle ); } document.title = data.pagetitle; var ga_title = data.pagetitle; ga('send', 'pageview', {'page': '/2016/' + id, 'title': ga_title}) var page_type = data.page_type; var body_class = data.body_class; var index_parent_dir = data.index_parent_dir; if( data.index_num > 1 ){ option = "forward"; } if( $("div#entry > *")[0] ){ $("div#entry > *").fadeOut(500); setTimeout( function(){ $("div#entry").empty(); $("div#entry").css("top", 0); } , 500); } if( page_type == "entry" ){ body_class += " " + "modal"; scroll_action_flag = false; memo_scroll = $(window).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] ){ $('html,body').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 ); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } } function PJAX_ajax_load( id,data,option ) { $("body").append("
"); if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } ajax_request = $.ajax({ url: "http://sapporodesignweek.jp/2016/ajax_load.php", data: "id=" + id + "&ajax=true" + "", dataType: "html", success: function(elm, dataType){ $("div#loading").fadeOut(500, function() { $(this).remove(); }); PJAX_ajax_leave( id,data,option,elm ); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } function PJAX_ajax_leave( id,data,option,elm ) { 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 page_type = data.page_type; var index_num = data.index_num; var index_parent_dir = data.index_parent_dir; var base = $("#container > div#base"); // rootから離脱 if( $("body.root")[0] ){ $("body").removeClass("root_show"); PJAX_ajax_leave_stand(); setTimeout( function(){ base.hide(); $("body #container > div#base > article").remove(); $("div#slide_wrapper").empty(); setTimeout( function(){ $("body").removeClass(); PJAX_ajax_move( id,data,elm ); } , 100); } , 500); } // pageから離脱 if( $("body.page")[0] ){ setTimeout( function(){ PJAX_ajax_leave_stand(); setTimeout( function(){ base.hide(); $("body #container > div#base > article").remove(); setTimeout( function(){ $("body").removeClass(); PJAX_ajax_move( id,data,elm ); } , 100); } , 500); } , 10); } if( page_type == "entry" ){ $("div#entry").empty().append(elm).append('').append(''); setTimeout( function(){ $("div#entry").addClass("active"); } , 100); }else{ // indexから離脱 if( $("body.index")[0] ){ if( path == $("body").attr("data-directory") ){ }else if( directory == $("body").attr("data-directory") ){ if( option == "forward" ){ // 離脱しないでサムネイル追加 $("div.index > ul > li.loadmore").remove(); var append_elm = $('
').html(elm).find("div.index > ul > li"); var target_wrapper = $("div.index > ul"); target_wrapper.append(append_elm); window_resize(); setTimeout( function(){ var target_thm = $("div.index > ul > li:not(.active)"); PJAX_random_add(target_thm, 200); $("img.preload:not('.loaded')").each(function(){ $(this).imagesLoaded(function(){ $(this).addClass("loaded"); }); }); } , 500); } }else{ PJAX_ajax_leave_stand(); setTimeout( function(){ base.hide(); $("body #container > div#base > article").remove(); setTimeout( function(){ $("body").removeClass(); PJAX_ajax_move( id,data,elm ); } , 100); } , 500); } } } } function PJAX_ajax_leave_stand() { $('html,body').stop().animate({ scrollTop: 0 }, 1000, "easeOutQuint"); $("body").addClass("leave"); } function PJAX_random_add( targets, delay ){ var target_num = targets.length; var random_i = Math.floor(Math.random()*target_num); $(targets[random_i]).addClass("active"); targets.splice(random_i,1); if (target_num > 0) { setTimeout(function(){ PJAX_random_add( targets, delay ); },delay); } else { return false; } } if( $("div.index > ul > li:not(.active)")[0] ){ var target_thm = $("div.index > ul > li:not(.active)"); PJAX_random_add(target_thm, 200); } function PJAX_ajax_move( id,data,elm ) { 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 page_type = data.page_type; var index_num = data.index_num; var index_parent_dir = data.index_parent_dir; $("body").attr("class",body_class); var base = $("#container > div#base"); if( page_type == "root" ){ $("body").addClass("root"); $("body").attr("data-directory",directory); base.children("article").remove(); $.ajax({ url: "http://sapporodesignweek.jp/2016/ajax_slide.php", data: "ajax=true" + "", success: function(slide_elm, dataType){ $("body").addClass("root_show"); base.show(); $("div#slide_wrapper").append(slide_elm); base.append(elm); // swipe_init(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } if( page_type == "page" ){ $("body").attr("data-directory",directory); base.children("article").remove(); base.append(elm).show(); base.children("article").addClass("hide"); setTimeout( function(){ base.children("article").removeClass("hide"); } , 500); } if( page_type == "index" ){ $("body").attr("data-directory",directory); base.children("article").remove(); base.append(elm); window_resize(); base.children("article").addClass("hide"); base.show(); setTimeout( function(){ var target_thm = $("div.index > ul > li:not(.active)"); PJAX_random_add(target_thm, 200); base.children("article").removeClass("hide"); $("img.preload:not('.loaded')").each(function(){ $(this).imagesLoaded(function(){ $(this).addClass("loaded"); }); }); } , 500); 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( $("html.no_ajax")[0] ){ window.location = href; }else{ if ( window.history.pushState ) { PJAX_hrefchange( href, "onpop" ); } else { var href = "http://sapporodesignweek.jp/2016/#!/" + href.replace( /^.\//, '' ); window.location = href; } } } $(document).on("click", "a.pjax", function(){ var href = $(this).attr("href"); if ( window.history.pushState ) { PJAX_hrefchange( href,"" ); } else { var href = href.replace( "http://sapporodesignweek.jp/2016/", "" ); var href = "http://sapporodesignweek.jp/2016/#!/" + href.replace( /^.\//, '' ); var past_href = location.href; window.location = href; } return false; }); $(window).hashchange( function(){ var hash = location.hash; if( hash.indexOf( "#!/" ) != -1 ){ var href = hash.replace( /^#!\//, '' ); if( href == "" ){ var href = "http://sapporodesignweek.jp/2016/"; } 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,"" ); } } }); var window_height = window.innerHeight ? window.innerHeight: $(window).height(); var window_width = $(window).width(); var scroll_val = $(window).scrollTop(); var scroll_action_flag = true; function window_action() { scroll_val = $(window).scrollTop(); if( scroll_action_flag == true && $("div.index > ul > li.loadmore")[0] ){ var target = $("div.index > ul > li.loadmore"); var load_more_top = target.offset().top; if( scroll_val > load_more_top - window_height - 500 ){ scroll_action_flag = false; var href = target.find("a").attr("href"); $("div.index > ul > li.loadmore").remove(); PJAX_hrefchange( href, "forward" ); setTimeout( function(){ scroll_action_flag = true; } , 1000); } } } $(window).scroll(function(){ window_action(); }); function window_resize() { window_height = window.innerHeight ? window.innerHeight: $(window).height(); window_width = $(window).width(); window_action(); } $(window).bind("resize", window_resize); window_resize(); // scroll_swipe_flg = true; // $(document).on("mousewheel", "body.root #container > div#base > article > div.content > div.body", function(e) { // if( scroll_swipe_flg == true ){ // scroll_swipe_flg = false; // if(e.deltaY >= 1) { // } else { // $("body #container > div#base > article > div.content > div.body").off(); // PJAX_hrefchange( "http://sapporodesignweek.jp/2016/events/", "" ); // setTimeout( // function(){ // scroll_swipe_flg = true; // } // , 1000); // } // } // }); function isTouch(){ return (document.ontouchstart !== undefined); } // function swipe_init(){ // $("body.root #container > div#base > article > div.content > div.body").on({ // 'touchstart': function(e) { // this.touchX = event.changedTouches[0].pageX; // this.touchY = event.changedTouches[0].pageY; // }, // 'touchmove': function(e) { // var moveX = this.touchX - event.changedTouches[0].pageX; // var moveY = this.touchY - event.changedTouches[0].pageY; // if( this.touchX < moveX ){ // // move left // }else{ // // move right // } // if( this.touchY < moveY ){ // // move up // }else{ // // move down // if( scroll_swipe_flg == true ){ // scroll_swipe_flg = false; // $("body #container > div#base > article > div.content > div.body").off(); // PJAX_hrefchange( "http://sapporodesignweek.jp/2016/events/", "" ); // setTimeout( // function(){ // scroll_swipe_flg = true; // } // , 1000); // } // } // }, // 'touchend': function(e) { // } // }); // } // if( isTouch() ){ // swipe_init(); // } });