$(function() { var window_height = window.innerHeight ? window.innerHeight: $(window).height(); var window_width = $(window).width(); var scroll_val = $(window).scrollTop(); function PJAX_slide_open() { if( $("#home div.slide")[0] ){ slide_start( $("#home div.slide") ); } } function PJAX_slide_close() { } function PJAX_body_shift_on() { if( !$("body.blog")[0] ){ body_shift_y = scroll_val; } // $("body").css({ // "top": -body_shift_y // }); $('html,body').scrollTop(0); $("body").removeClass().addClass("entry blog"); } function PJAX_body_shift_off(body_shift_y) { $("body").removeClass(); // $("body").css({ // "top": 0 // }); $('html,body').scrollTop(body_shift_y); } category = Array(); category['home'] = Array(); category['home'][0] = "美味しいフランス田舎パン"; category['home'][1] = "北海道の素材を使った美味しいフランス田舎パン「ソーケシュ製パン」。地元の食材と羊蹄山の天然水を使って、毎日食べても飽きないパンを焼いています。厳選した豆を自家焙煎で仕上げるコーヒーも魅力。"; category['home'][2] = "page"; category['home'][3] = 0; category['home'][4] = "仮_HOME"; category['shop_main_'] = Array(); category['shop_main_'][0] = "ショップ情報"; category['shop_main_'][1] = "羊蹄山のふもとにある自然豊かな町「北海道喜茂別町」。フランス田舎パンを手作りの薪窯で焼いています。店内にはイートインもあり。のどかな景色を眺めながら美味しいパンとコーヒーはいかがですか?"; category['shop_main_'][2] = "page"; category['shop_main_'][3] = 1; category['shop_main_'][4] = "仮_ソーケシュ製パン×トモエコーヒー"; category['shop_drivein_'] = Array(); category['shop_drivein_'][0] = "ドライブイン ソーケシュ"; category['shop_drivein_'][1] = ""; category['shop_drivein_'][2] = "page"; category['shop_drivein_'][3] = 2; category['shop_drivein_'][4] = "仮_ドライブイン ソーケシュ"; category['onlineshop_'] = Array(); category['onlineshop_'][0] = "オンラインショップ"; category['onlineshop_'][1] = "北海道喜茂別町にあるソーケシュ製パンは、パンとコーヒー豆のお取り寄せも承っております。北海道産食材と自家製天然酵母を使った美味しいフランス田舎パンをお楽しみください。"; category['onlineshop_'][2] = "page"; category['onlineshop_'][3] = 3; category['onlineshop_'][4] = "仮_オンラインショップ"; category['order_'] = Array(); category['order_'][0] = "商品のご購入"; category['order_'][1] = "北海道喜茂別町にあるソーケシュ製パンは、パンとコーヒー豆のお取り寄せも承っております。北海道産食材と自家製天然酵母を使った美味しいフランス田舎パンをお楽しみください。"; category['order_'][2] = "page"; category['order_'][3] = 4; category['order_'][4] = "仮_商品のご購入"; category['order_confirm'] = Array(); category['order_confirm'][0] = "ご購入内容確認画面"; category['order_confirm'][1] = "ソーケシュ製パンのご購入内容確認画面。道産食材と自家製天然酵母で作った美味しいフランス田舎パンをお届けいたします。"; category['order_confirm'][2] = "page"; category['order_confirm'][3] = 5; category['order_confirm'][4] = "仮_商品のご購入 - 内容確認"; category['order_form'] = Array(); category['order_form'][0] = "お客様情報入力画面"; category['order_form'][1] = "お客様情報入力画面。道産食材と自家製天然酵母で作った美味しいフランス田舎パンをお届けいたします。"; category['order_form'][2] = "page"; category['order_form'][3] = 6; category['order_form'][4] = "仮_商品のご購入 - お客様情報入力"; category['order_thanks'] = Array(); category['order_thanks'][0] = "ご購入ありがとうございました"; category['order_thanks'][1] = "ご購入ありがとうございました。道産食材と自家製天然酵母で作った美味しいフランス田舎パンをお届けいたします。"; category['order_thanks'][2] = "page"; category['order_thanks'][3] = 7; category['order_thanks'][4] = "仮_商品のご購入 - ありがとうございました"; category['blog_'] = Array(); category['blog_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_'][1] = "フランス田舎パンのお店「ソーケシュ製パン」のブログはこちら。パンの美味しい食べ方や、日々の暮らしなど、ほっこりブログを美味しいパンと共にお届けしています。"; category['blog_'][2] = "page"; category['blog_'][3] = 8; category['blog_'][4] = "仮_パン屋ブログ"; category['blog_info_'] = Array(); category['blog_info_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_info_'][1] = "フランス田舎パンのお店「ソーケシュ製パン」のブログはこちら。パンの美味しい食べ方や、日々の暮らしなど、ほっこりブログを美味しいパンと共にお届けしています。"; category['blog_info_'][2] = "page"; category['blog_info_'][3] = 9; category['blog_info_'][4] = "仮_パン屋ブログ - お知らせ"; category['blog_shop_'] = Array(); category['blog_shop_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_shop_'][1] = ""; category['blog_shop_'][2] = "page"; category['blog_shop_'][3] = 10; category['blog_shop_'][4] = "仮_パン屋ブログ - ソーケシュ製パン×トモエコーヒー"; category['blog_drivein_'] = Array(); category['blog_drivein_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_drivein_'][1] = ""; category['blog_drivein_'][2] = "page"; category['blog_drivein_'][3] = 11; category['blog_drivein_'][4] = "仮_パン屋ブログ - ドライブインソーケシュ"; category['blog_howto_'] = Array(); category['blog_howto_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_howto_'][1] = "フランス田舎パンのお店「ソーケシュ製パン」のブログはこちら。パンの美味しい食べ方や、日々の暮らしなど、ほっこりブログを美味しいパンと共にお届けしています。"; category['blog_howto_'][2] = "page"; category['blog_howto_'][3] = 12; category['blog_howto_'][4] = "仮_パン屋ブログ - HOW TO(パンとコーヒーのこと)"; category['blog_bread_'] = Array(); category['blog_bread_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_bread_'][1] = ""; category['blog_bread_'][2] = "page"; category['blog_bread_'][3] = 13; category['blog_bread_'][4] = "仮_パン屋ブログ - パンについて"; category['blog_coffee_'] = Array(); category['blog_coffee_'][0] = "田舎のパン屋さんライフスタイルブログ"; category['blog_coffee_'][1] = ""; category['blog_coffee_'][2] = "page"; category['blog_coffee_'][3] = 14; category['blog_coffee_'][4] = "仮_パン屋ブログ - コーヒー豆について"; category['contact_'] = Array(); category['contact_'][0] = "お問い合わせ"; category['contact_'][1] = "フランス田舎パンと美味しいコーヒーのお店「ソーケシュ製パン」のお問い合わせはこちらから。ソーケシュ製パンのこと、コーヒーのこと、通販に関するご質問等、お気軽にお問い合わせください。"; category['contact_'][2] = "page"; category['contact_'][3] = 15; category['contact_'][4] = "仮_お問い合わせ"; category['contact_confirm'] = Array(); category['contact_confirm'][0] = "お問い合わせ - 内容確認"; category['contact_confirm'][1] = "お問い合わせ内容確認画面。"; category['contact_confirm'][2] = "page"; category['contact_confirm'][3] = 16; category['contact_confirm'][4] = "仮_お問い合わせ - 内容確認"; category['contact_thanks'] = Array(); category['contact_thanks'][0] = "お問い合わせ - ありがとうございました"; category['contact_thanks'][1] = "お問い合わせありがとうございました。"; category['contact_thanks'][2] = "page"; category['contact_thanks'][3] = 17; category['contact_thanks'][4] = "仮_お問い合わせ - ありがとうございました"; category['privacy'] = Array(); category['privacy'][0] = "個人情報保護ポリシー"; category['privacy'][1] = "個人情報保護ポリシー。北海道の素材を使った美味しいフランス田舎パン「ソーケシュ製パン」。地元の食材と羊蹄山の天然水を使って、毎日食べても飽きないパンを焼いています。厳選した豆を自家焙煎で仕上げるコーヒーも魅力。"; category['privacy'][2] = "page"; category['privacy'][3] = 18; category['privacy'][4] = "仮_個人情報保護ポリシー"; category['law'] = Array(); category['law'][0] = "特定商取引法に基づく表示"; category['law'][1] = "特定商取引法に関してご案内しております。事業側のルールと消費者を守るルールなど、こちらのページでご確認ください。"; category['law'][2] = "page"; category['law'][3] = 19; category['law'][4] = "仮_特定商取引法に基づく表示"; entry_array = Array(); entry_array['7240'] = Array(); entry_array['7240'][0] = "blog"; entry_array['7240'][1] = "sokeshu_7240"; entry_array['7240'][2] = "blog/お知らせ/"; entry_array['4496'] = Array(); entry_array['4496'][0] = "blog"; entry_array['4496'][1] = "sokeshu_4496"; entry_array['4496'][2] = "blog/お知らせ/__blog/ドライブインソーケシュ/"; entry_array['7475'] = Array(); entry_array['7475'][0] = "blog"; entry_array['7475'][1] = "sokeshu_7475"; entry_array['7475'][2] = "blog/ドライブインソーケシュ/"; entry_array['4500'] = Array(); entry_array['4500'][0] = "blog"; entry_array['4500'][1] = "sokeshu_4500"; entry_array['4500'][2] = "blog/お知らせ/"; entry_array['0699'] = Array(); entry_array['0699'][0] = "blog"; entry_array['0699'][1] = "sokeshu_0699"; entry_array['0699'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['4417'] = Array(); entry_array['4417'][0] = "blog"; entry_array['4417'][1] = "sokeshu_4417"; entry_array['4417'][2] = "blog/ドライブインソーケシュ/"; entry_array['4319'] = Array(); entry_array['4319'][0] = "blog"; entry_array['4319'][1] = "sokeshu_4319"; entry_array['4319'][2] = "blog/お知らせ/"; entry_array['2635'] = Array(); entry_array['2635'][0] = "blog"; entry_array['2635'][1] = "sokeshu_2635"; entry_array['2635'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['9675'] = Array(); entry_array['9675'][0] = "blog"; entry_array['9675'][1] = "sokeshu_9675"; entry_array['9675'][2] = "blog/ドライブインソーケシュ/"; entry_array['1544'] = Array(); entry_array['1544'][0] = "blog"; entry_array['1544'][1] = "sokeshu_1544"; entry_array['1544'][2] = "blog/お知らせ/"; entry_array['2016'] = Array(); entry_array['2016'][0] = "blog"; entry_array['2016'][1] = "sokeshu_2016"; entry_array['2016'][2] = "blog/ドライブインソーケシュ/"; entry_array['1918'] = Array(); entry_array['1918'][0] = "blog"; entry_array['1918'][1] = "sokeshu_1918"; entry_array['1918'][2] = "blog/ドライブインソーケシュ/"; entry_array['0195'] = Array(); entry_array['0195'][0] = "blog"; entry_array['0195'][1] = "sokeshu_0195"; entry_array['0195'][2] = "blog/パンについて/__pickup-パンについて"; entry_array['9449'] = Array(); entry_array['9449'][0] = "blog"; entry_array['9449'][1] = "sokeshu_9449"; entry_array['9449'][2] = "blog/how to(パンとコーヒーのこと)/__blog/パンについて/__pickup-パンについて"; entry_array['0864'] = Array(); entry_array['0864'][0] = "blog"; entry_array['0864'][1] = "sokeshu_0864"; entry_array['0864'][2] = "blog/how to(パンとコーヒーのこと)/__pickup-top-how to"; entry_array['8090'] = Array(); entry_array['8090'][0] = "blog"; entry_array['8090'][1] = "sokeshu_8090"; entry_array['8090'][2] = "blog/how to(パンとコーヒーのこと)/__pickup-top-how to"; entry_array['3765'] = Array(); entry_array['3765'][0] = "blog"; entry_array['3765'][1] = "sokeshu_3765"; entry_array['3765'][2] = "blog/コーヒー豆について/__pickup-トモエコーヒーについて"; entry_array['9927'] = Array(); entry_array['9927'][0] = "blog"; entry_array['9927'][1] = "sokeshu_9927"; entry_array['9927'][2] = "blog/コーヒー豆について/__pickup-トモエコーヒーについて"; entry_array['0172'] = Array(); entry_array['0172'][0] = "blog"; entry_array['0172'][1] = "sokeshu_0172"; entry_array['0172'][2] = "blog/コーヒー豆について/__pickup-トモエコーヒーについて"; entry_array['8526'] = Array(); entry_array['8526'][0] = "blog"; entry_array['8526'][1] = "sokeshu_8526"; entry_array['8526'][2] = "blog/お知らせ/"; entry_array['6984'] = Array(); entry_array['6984'][0] = "blog"; entry_array['6984'][1] = "sokeshu_6984"; entry_array['6984'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['3211'] = Array(); entry_array['3211'][0] = "blog"; entry_array['3211'][1] = "sokeshu_3211"; entry_array['3211'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['3504'] = Array(); entry_array['3504'][0] = "blog"; entry_array['3504'][1] = "sokeshu_3504"; entry_array['3504'][2] = "blog/ソーケシュ製パン×トモエコーヒー/__pickup-top-パン屋ブログ"; entry_array['5314'] = Array(); entry_array['5314'][0] = "blog"; entry_array['5314'][1] = "sokeshu_5314"; entry_array['5314'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['0276'] = Array(); entry_array['0276'][0] = "blog"; entry_array['0276'][1] = "sokeshu_0276"; entry_array['0276'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['4168'] = Array(); entry_array['4168'][0] = "blog"; entry_array['4168'][1] = "sokeshu_4168"; entry_array['4168'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['4996'] = Array(); entry_array['4996'][0] = "blog"; entry_array['4996'][1] = "sokeshu_4996"; entry_array['4996'][2] = "blog/ソーケシュ製パン×トモエコーヒー/__pickup-top-パン屋ブログ"; entry_array['9356'] = Array(); entry_array['9356'][0] = "blog"; entry_array['9356'][1] = "sokeshu_9356"; entry_array['9356'][2] = "blog/お知らせ/"; entry_array['6966'] = Array(); entry_array['6966'][0] = "blog"; entry_array['6966'][1] = "sokeshu_6966"; entry_array['6966'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['2208'] = Array(); entry_array['2208'][0] = "blog"; entry_array['2208'][1] = "sokeshu_2208"; entry_array['2208'][2] = "blog/お知らせ/"; entry_array['5537'] = Array(); entry_array['5537'][0] = "blog"; entry_array['5537'][1] = "sokeshu_5537"; entry_array['5537'][2] = "blog/お知らせ/"; entry_array['8712'] = Array(); entry_array['8712'][0] = "blog"; entry_array['8712'][1] = "sokeshu_8712"; entry_array['8712'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['4740'] = Array(); entry_array['4740'][0] = "blog"; entry_array['4740'][1] = "sokeshu_4740"; entry_array['4740'][2] = "blog/お知らせ/"; entry_array['5472'] = Array(); entry_array['5472'][0] = "blog"; entry_array['5472'][1] = "sokeshu_5472"; entry_array['5472'][2] = "blog/ソーケシュ製パン×トモエコーヒー/__pickup-top-パン屋ブログ"; entry_array['2311'] = Array(); entry_array['2311'][0] = "blog"; entry_array['2311'][1] = "sokeshu_2311"; entry_array['2311'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['9454'] = Array(); entry_array['9454'][0] = "blog"; entry_array['9454'][1] = "sokeshu_9454"; entry_array['9454'][2] = "blog/お知らせ/"; entry_array['7378'] = Array(); entry_array['7378'][0] = "blog"; entry_array['7378'][1] = "sokeshu_7378"; entry_array['7378'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; entry_array['0389'] = Array(); entry_array['0389'][0] = "blog"; entry_array['0389'][1] = "sokeshu_0389"; entry_array['0389'][2] = "blog/パンについて/__pickup-パンについて"; entry_array['8409'] = Array(); entry_array['8409'][0] = "blog"; entry_array['8409'][1] = "sokeshu_8409"; entry_array['8409'][2] = "blog/ソーケシュ製パン×トモエコーヒー/__blog/パンについて/__pickup-パンについて"; entry_array['0603'] = Array(); entry_array['0603'][0] = "blog"; entry_array['0603'][1] = "sokeshu_0603"; entry_array['0603'][2] = "blog/ソーケシュ製パン×トモエコーヒー/"; function htmlEncode(value){ return $('
').text(value).html(); } function htmlDecode(value){ return $('
').html(value).text(); } function create_fullcalendar(){ // Google Calender feed $('#calendar_tomii').fullCalendar({ googleCalendarApiKey: 'AIzaSyARQZH1G-VqGLNJMz21rHu1hMc9OotNgAk', eventSources:[ { googleCalendarId: 'info@lifesnap.jp', className:"event_set_1" }, { googleCalendarId:"japanese__ja@holiday.calendar.google.com", className:"event_set_2" }, { googleCalendarId:"lifesnap.jp_06ijuvifgtbq3p374gtdbjdnak@group.calendar.google.com", className:"event_set_3" } ], timeFormat: "H:mm", loading: function(bool) { if (bool) { $(this).parent().find('.cal_loading').show(); }else{ $(this).parent().find(".cal_loading").fadeOut(200); $(this).find(".fc-event-time").parent().addClass("single_day"); $(this).find(".fc-event-time").parent().parent().addClass("single_day_wrapper"); } } }); $(document).on("click", "a.fc-day-grid-event", function(){ return false; }); } $("img.preload:not('.loaded')").each(function(){ $(this).imagesLoaded(function(){ $(this).addClass("loaded"); }); }); var id = "blog_"; var hash = location.hash; var scroll_action_flag = ""; var base_site_title = "ソーケシュ製パン×トモエコーヒー"; var history_counter = 0; var past_href = location.href; if(past_href.indexOf( "#/" ) != -1){ past_href_arr = past_href.split("#/"); past_href = past_href_arr[0]; } var memorize_scrolltop = $(window).scrollTop(); var memorize_lastvisit = "index"; var memorize_lasturl = location.href; var now_viewing = "blog_"; var site_url = "https://sokeshu.com/"; var body_shift_y = 0; var memorize_lastindex = $("body").attr("data-index").replace( / /g, "/" ); if( $("#entry > *")[0] ){ memorize_lastvisit = "entry"; } if( $("body").attr("data-index") == "" ){ var now_viewing_replaced = now_viewing.replace( /_/g, "/"); var last_text = now_viewing_replaced.substr( (now_viewing_replaced.length-1) ); if( last_text == "/" ){ now_viewing_replaced = now_viewing_replaced; }else{ now_viewing_replaced = now_viewing_replaced + "/"; } memorize_lastindex = now_viewing_replaced; }else{ $("body").attr( "data-index", now_viewing.replace( /_/g, " " ) ) } // if( memorize_lastvisit == "" ){ // $("body").attr("class", "root"); // } // var set_blog_archive_date = ""; // if( (id.match(/\//g)||[]).length == 3 ){ // var split_arr = id.split( '/' ); // if( parseInt(split_arr[1]) <= 9999 && parseInt(split_arr[2]) <= 12 ){ // set_blog_archive_date = split_arr[1]+"/"+split_arr[2]+"/"; // }else{ // window.location = href; // } // id = split_arr[0]+"/"; // } $(window).bind('load', function() { if( $("body").attr("data-index") == "" ){ $("body").attr( "data-index", now_viewing.replace( /_/g, " " ) ) } window_height = window.innerHeight ? window.innerHeight: $(window).height(); window_width = $(window).width(); if( memorize_lastvisit == "root" || memorize_lastvisit == "index" || memorize_lastvisit == "profile" || memorize_lastvisit == "entry" ){ scroll_action_flag = false; if( $("body.entry")[0] && now_viewing == "blog_" ){ $("body").addClass("blog"); } var target_nav = $(".class_" + "blog_".replace( "/", "_" ) + " a"); target_nav.removeClass("over"); target_nav.addClass("active"); //article_type(ground・page・modal)の読み取り var article_type = $( "article#" + now_viewing ).attr("class"); if( article_type == "ground" ){ var scrollto = $('#' + now_viewing ).offset().top; $('html,body').stop().animate({ scrollTop: scrollto }, 800, function(){ scroll_action_flag = true; }); }else if( article_type == "page" ){ PJAX_slide_close(); // var scrollto = 0; // $('html,body').stop().animate({ // scrollTop: scrollto // }, 800, // function(){ // scroll_action_flag = true; // }); }else if( article_type == "modal" ){ PJAX_slide_open(); $( "article#" + now_viewing ).css({"margin-top": $(window).scrollTop()+10}); $( "article#" + now_viewing ).parent().fadeIn( 400,function(){ } ); } if( memorize_lastvisit == "root" ){ PJAX_slide_open(); // if ( now_viewing != "" && $('#' + now_viewing )[0] ){ // var scrollto = $('#' + now_viewing ).offset().top + window_height; // $('html,body').stop().animate({ // scrollTop: scrollto // }, 800); // } // scroll_action_flag = false; // setTimeout( // function(){ // scroll_action_flag = true; // } // , 1500); memorize_lastvisit_article_type = ""; }else{ memorize_lastvisit_article_type = article_type; } } if( $("#home div.slide")[0] ){ slide_start( $("#home div.slide") ); } window_refresh(); }); function PJAX_hrefchange( href, onpop ) { hash = ""; if(href.indexOf( "#/" ) != -1){ hash_arr = href.split("#/"); href = hash_arr[0]; hash = hash_arr[1]; if( href == past_href ){ window.location.hash = "/"+hash; } } if( $("#navi").hasClass("open") ){ $("#navi").removeClass("open"); $("html").removeClass("navi_open"); } scroll_action_flag = false; if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } if( typeof scroll_action_limiter != "undefined" ){ clearTimeout( scroll_action_limiter ); } if( href && past_href != href && href.indexOf( "#" ) == -1 ){ past_href = href; id = href.replace( "https://sokeshu.com/", "" ); id = id.replace( "?mode=preview", "" ); now_viewing = id; ajax_request = $.ajax({ url: "https://sokeshu.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 != "" ){ if( entry_array[entry_id][0] == "blog" ){ var past_directory_arr = memorize_lastindex.split("/"); var past_parent_directory = past_directory_arr[0]; if( past_parent_directory != "blog" ){ window.location = href; } $("body > #wrapper").append("
"); setTimeout( function(){ $("#loading.white").addClass("show"); } , 10); // if( memorize_lastvisit == "entry"){ // $('html,body').stop().animate({ // scrollTop: memorize_scrolltop // }, 800, // function(){ // scroll_action_flag = false; // }); // }else{ // memorize_scrolltop = $(window).scrollTop(); // } ajax_request = $.ajax({ url: "https://sokeshu.com/ajax_entry.php", data: "id=" + id + "&ajax=true" + "", success: function(data, dataType){ $("#entry").fadeOut( 400, function(){ $(this).empty().append(data).fadeIn( 400,function(){ PJAX_body_shift_on(); $("div#loading.white").removeClass("show"); setTimeout( function(){ $("div#loading.white").remove(); } , 500); } ); } ); memorize_lastvisit = "entry"; memorize_lastvisit_article_type = ""; memorize_lasturl = href; memorize_lastindex = $("body").attr("data-index").replace( / /g, "/" ); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } }else if( entry_id != "" ){ if( entry_array[entry_id][0] == "blog" ){ $("body > #wrapper").append("
"); setTimeout( function(){ $("#loading.white").addClass("show"); } , 10); ajax_request = $.ajax({ url: "https://sokeshu.com/ajax_entry.php", data: "id=" + entry_id + "&ajax=true" + "", success: function(data, dataType){ $("#entry").fadeOut( 400, function(){ $(this).empty().append(data).fadeIn( 400,function(){ PJAX_body_shift_on(); $("div#loading.white").removeClass("show"); setTimeout( function(){ $("div#loading.white").remove(); } , 500); } ); } ); memorize_lastvisit = "entry"; memorize_lastvisit_article_type = ""; memorize_lasturl = href; memorize_scrolltop = 0; memorize_lastindex = $("body").attr("data-index").replace( / /g, "/" ); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } } } if( typeof entry_id == "undefined" && id != "" ){ $("body").attr( "data-index", id.replace( /\//g, " " ) ) var set_blog_archive_date = ""; if( (id.match(/\//g)||[]).length == 3 ){ var split_arr = id.split( '/' ); if( parseInt(split_arr[1]) <= 9999 && parseInt(split_arr[2]) <= 12 ){ set_blog_archive_date = split_arr[1]+"/"+split_arr[2]+"/"; }else{ window.location = href; } id = split_arr[0]+"/"; } //article_type(ground・page・modal)の読み取り var article_type = category[id.replace( /\//g, "_")][2]; if( memorize_lastvisit == "entry" ){ $("body > #wrapper").append("
"); setTimeout( function(){ $("#loading.white").addClass("show"); } , 10); // setTimeout( // function(){ // if( typeof entry_id == "undefined" ){ // if( $("body.blog")[0] ){ // $("#entry").empty(); // PJAX_body_shift_off(body_shift_y); // }else{ // $('html,body').stop().animate({ // scrollTop: memorize_scrolltop // }, 800); // } // } // $("div#loading.white").remove(); // } // , 500); setTimeout( function(){ $("#entry").empty(); $("div#loading.white").removeClass("show"); setTimeout( function(){ $("div#loading.white").remove(); } , 500); if( memorize_lastindex != id + set_blog_archive_date ){ PJAX_body_shift_off(0); if( article_type == "ground" ){ var scrollto = $('#' + id).offset().top; $('html,body').stop().animate({ scrollTop: scrollto }, 800, function(){ scroll_action_flag = true; }); }else if( article_type == "modal" ){ $( "article#" + id ).css({"margin-top": $(window).scrollTop()+10}); $( "article#" + id ).parent().fadeIn( 400,function(){ $("div#loading").fadeOut(1500).remove(); } ); } memorize_lastvisit = "index"; memorize_lastvisit_article_type = article_type; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); memorize_lastindex = id + set_blog_archive_date; }else{ PJAX_body_shift_off(body_shift_y); } scroll_action_flag = true; memorize_lastvisit = "index"; memorize_lasturl = href; memorize_scrolltop = 0; memorize_lastindex = id + set_blog_archive_date; } , 500); } $( "article.modal" ).parent().fadeOut(400); if( memorize_lastindex != id + set_blog_archive_date && (article_type == "page" && memorize_lastvisit_article_type != "modal") || ( article_type == "ground" && memorize_lastvisit_article_type == "page" ) ){ PJAX_slide_close(); $("body > #wrapper").append("
"); var first_flag = 0; var past_elm = $("#container > div#groundbase > article"); var past_id = past_elm.attr("id").replace( /_/g, "/"); var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 800); past_elm.animate({ "opacity": 0 },800, "easeOutQuint", function(){ if( first_flag == 0 ){ first_flag += 1; $.ajax({ url: "https://sokeshu.com/ajax_page.php", data: "ajax=true" + "&id=" + id + set_blog_archive_date + "", success: function(data, dataType){ var window_width = $(window).width(); PJAX_body_shift_off(0); $("#container > div#groundbase").prepend(data); var new_elm = past_elm.prev("article"); past_elm.css({ "z-index": 1, "position": "absolute", "top": 0 }); new_elm.css({ "z-index": 2, "opacity": 0 }); new_elm.stop().animate({ "opacity": 1 }, 1500, "easeOutQuint"); $("html").attr("id", "p_" + id.replace( /\//g, "_") ); past_elm.remove(); $("div#loading").fadeOut(500, function(){ $(this).remove(); FB.XFBML.parse(); PJAX_header_switch( id ); if( hash != "" ){ window.location.hash = "/"+hash; } } ); $(".floatbase a.pjax").attr("href", "https://sokeshu.com/" + id); window_refresh(); scroll_action_flag = true; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } }); memorize_lastvisit = "index"; memorize_lastvisit_article_type = article_type; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); memorize_lastindex = id + set_blog_archive_date; }else if( article_type == "ground" && memorize_lastvisit_article_type != "modal" ){ var scrollto = $('#' + id).offset().top; $('html,body').stop().animate({ scrollTop: scrollto }, 800, function(){ scroll_action_flag = true; }); }else if( article_type == "modal" ){ $( "article#" + id ).css({"margin-top": $(window).scrollTop()+10}); $( "article#" + id ).parent().fadeIn( 400,function(){ $("div#loading").fadeOut(1500).remove(); } ); var past_elm = $("#container > div#groundbase > article"); var past_id = past_elm.attr("id").replace( /_/g, "/"); $(".floatbase a.pjax").attr("href", "https://sokeshu.com/" + past_id); } } if( id == "" ){ if( memorize_lastvisit == "entry" ){ if( $("body.blog")[0] ){ PJAX_body_shift_off(0); }else{ $('html,body').stop().animate({ scrollTop: memorize_scrolltop }, 800); } $("#entry").fadeOut( 400, function(){ $(this).empty(); } ); } $("#entry").removeClass(); $( "article.modal" ).parent().fadeOut( 400,function(){ scroll_action_flag = true; } ); if( memorize_lastvisit_article_type != "modal" ){ PJAX_slide_open(); var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 800, function(){ scroll_action_flag = true; }); $("body > #wrapper").append("
"); var first_flag = 0; var past_elm = $("#container > div#groundbase > article"); var past_id = past_elm.attr("id"); var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 800); past_elm.animate({ "opacity": 0 },800, "easeOutQuint", function(){ if( first_flag == 0 ){ first_flag += 1; $("html").attr("id", "p_root" ); $.ajax({ url: "https://sokeshu.com/ajax_slide.php", data: "ajax=true" + "", success: function(data, dataType){ $("div#slide_wrapper").append(data); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); $.ajax({ url: "https://sokeshu.com/ajax_page.php", data: "ajax=true" + "&id=" + id + "", success: function(data, dataType){ var window_width = $(window).width(); $("#container > div#groundbase").prepend(data); var new_elm = past_elm.prev("article"); past_elm.css({ "z-index": 1, "position": "absolute", "top": 0 }); new_elm.css({ "z-index": 2, "opacity": 0 }); new_elm.stop().animate({ "opacity": 1 }, 1500, "easeOutQuint"); past_elm.remove(); $("div#loading").fadeOut(500, function(){ $(this).remove(); FB.XFBML.parse(); PJAX_slide_open(); PJAX_header_switch( id ); if( hash != "" ){ window.location.hash = "/"+hash; } } ); // $(".floatbase a.pjax").attr("href", "https://sokeshu.com/" + "home"); window_refresh(); scroll_action_flag = true; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } }); } memorize_lastvisit = "root"; memorize_lastvisit_article_type = ""; memorize_lasturl = href; memorize_scrolltop = 0; memorize_lastindex = ""; } // if( id != "" ){ // $("body").attr("class", id.replace( "/", " " )) // }else{ // $("body").attr("class", "root") // } if( typeof entry_id == "undefined" ){ $("#navi nav li a").removeClass("active"); $("#navi nav li a").addClass("over"); var target_nav = $(".class_" + id.replace( /\//g, "_") + " a"); target_nav.removeClass("over"); target_nav.addClass("active"); } PJAX_header_switch( id ); }else{ if( hash == "" ){ if ( href.replace( "https://sokeshu.com/", "" ) == "" ){ $('html,body').stop().animate({ scrollTop: 0 }, 800); }else if( href == past_href ){ $('html,body').stop().animate({ scrollTop: 0 }, 800); } } PJAX_header_switch( id ); } PJAX_header_switch( id ); } function PJAX_header_switch( id ) { // console.log("__"+id+"__"); if( id == "" ){ $("#header").removeClass("common"); $("#navi").removeClass("common"); $("#menu_toggle").removeClass("common"); $("#cart").removeClass("common"); }else{ $("#header").addClass("common"); $("#navi").addClass("common"); $("#menu_toggle").addClass("common"); $("#cart").addClass("common"); } } 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://sokeshu.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://sokeshu.com/", "" ); var href = "https://sokeshu.com/#!/" + href.replace( /^.\//, '' ); var past_href = location.href; if ( href == "https://sokeshu.com/#!/" && past_href == "https://sokeshu.com/#!/" ) { $('html,body').stop().animate({ scrollTop: 0 }, 800); memorize_lastvisit_article_type = ""; } window.location = href; history_counter++; } return false; }); var document_height = $(document).height(); var content_height = get_total_height($("#container > div#groundbase > *")); // var entry_height = get_total_height($("#entry > div.inner > *")); if( $("html.touch_device")[0] ){ 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 = $(window).scrollTop(); var scroll_action_flag = true; $(window).scroll(function(){ scroll_val = $(window).scrollTop(); // console.log(scroll_val+window_height+"|"+content_height); if( scroll_val+window_height > content_height - 200 ){ $("html").addClass("scrolled") $("html").addClass("scrollend") $("#header").addClass("common"); $("#navi").addClass("common"); $("#menu_toggle").addClass("common"); $("#cart").addClass("common"); }else if( scroll_val < Math.round(window_height/4) ){ $("html").removeClass("scrolled") $("html").removeClass("scrollend") if( $("html#p_root")[0] ){ PJAX_header_switch( "" ); } }else if( scroll_val >= Math.round(window_height/4) && scroll_val+window_height < content_height - 200 ){ $("html").addClass("scrolled") $("html").removeClass("scrollend") $("#header").addClass("common"); $("#navi").addClass("common"); $("#menu_toggle").addClass("common"); $("#cart").addClass("common"); }else{ $("html").addClass("scrolled") $("html").addClass("scrollend") $("#header").addClass("common"); $("#navi").addClass("common"); $("#menu_toggle").addClass("common"); $("#cart").addClass("common"); } if( scroll_action_flag === true ){ scroll_action_flag = false; if( typeof scroll_action_limiter != "undefined" ){ clearTimeout( scroll_action_limiter ); } scroll_action_limiter = setTimeout( function(){ var menu_list = []; var count_i = 0; $(".ground").each(function(){ if( $(this).attr("id") != null ){ var push_val_id = $(this).attr("id"); var push_val_offset = $("#" + push_val_id).offset().top; var push_val_height = $("#" + push_val_id).height(); menu_list[count_i] = []; menu_list[count_i]["id"] = push_val_id; menu_list[count_i]["offset"] = push_val_offset; menu_list[count_i]["height"] = push_val_height; count_i++; } }); $.each( menu_list, function(i){ if( scroll_val >= menu_list[i]["offset"] && scroll_val <= menu_list[i]["offset"]+menu_list[i]["height"] ){ if( now_viewing != menu_list[i]["id"] ){ id = menu_list[i]["id"]; now_viewing = id; past_href = "https://sokeshu.com/" + id; var page_title = category[id.replace( /\//g, "_")][0] + " | " + base_site_title; PJAX_pushState( "https://sokeshu.com/" + id, page_title ); document.title = page_title; $("#navi nav li a").removeClass("active"); $("#navi nav li a").addClass("over"); var target_nav = $(".class_" + id + " a"); target_nav.removeClass("over"); target_nav.addClass("active"); _gaq.push(['_trackPageview', '/' + id ]); } }else if( scroll_val < menu_list[0]["offset"] ){ if( now_viewing != "" ){ id = ""; now_viewing = id; past_href = "https://sokeshu.com/"; PJAX_pushState( "https://sokeshu.com/", base_site_title ); document.title = base_site_title; $("#navi nav li a").removeClass("active"); $("#navi nav li a").addClass("over"); _gaq.push(['_trackPageview', '/' + id ]); } } }); scroll_action_flag = true; } , 4000); } scroll_trigger(); }); function scroll_trigger() { if( $(".obj")[0] ){ var target = $(".obj"); var length = target.length; for(var i=0; i target_parallax_ratio ){ target_parallax.removeClass("vertical").addClass("horizontal"); }else{ target_parallax.removeClass("horizontal").addClass("vertical"); } var progress = Math.round(((scroll_val-wrapper_offset_top)/(window_height-wrapper_height))*1000)/1000; if( window_height < wrapper_height ){ var move_y = Math.round((-(wrapper_height-window_height)*progress/5)*1000)/1000; }else if( window_height < target_parallax_height ){ var move_y = Math.round(((target_parallax_height-wrapper_height)*progress/20)*1000)/1000; }else{ var move_y = Math.round(((target_parallax_height-wrapper_height)*progress/4)*1000)/1000; } // if( target_parallax_height < window_height ){ // var move_y = Math.round(((target_parallax_height-wrapper_height)*progress/2+(target_parallax_height-wrapper_height)/2)*1000)/1000; // }else if( window_height < wrapper_height ){ // var move_y = Math.round((-100*progress/50-(target_parallax_height-wrapper_height)/2)*1000)/1000; // }else{ // var move_y = Math.round(((target_parallax_height-wrapper_height)*progress/10-(target_parallax_height-wrapper_height)/2)*1000)/1000; // } target_parallax.css({"transform": "matrix(1, 0, 0, 1, 0, "+ move_y +")"}); }); } } function rnd(n){ return Math.floor(Math.random()*(n+1)); } function slide_switch(target_wrapper, past_target, next_target) { var next_id = next_target.attr("id"); target_wrapper.children("ul.dots").find("li").removeClass("active"); var next_dot = target_wrapper.find("."+next_id).addClass("active"); if( past_target != "" ){ past_target.addClass("pending active"); } img_url = next_target.find("div.img").attr("data-img-url"); next_target.find("div.img > img").imagesLoaded(function(){ next_target.addClass("active"); if( past_target != "" ){ setTimeout(function(){ past_target.removeClass("pending active"); },500); } slide_repeat(target_wrapper); }); next_target.find("div.img > img").attr("src", img_url); } function slide_repeat(target_wrapper) { var max_num = target_wrapper.find("ul.carousel > li.cell").length; if( typeof timerId_slide != "undefined" ){ clearTimeout(timerId_slide); } timerId_slide = setTimeout(function(){ if( max_num > 1 ){ var past_target = target_wrapper.find("ul.carousel > li.cell.active"); var next_target = ""; if( past_target.next("li")[0] ){ next_target = past_target.next("li"); }else{ next_target = target_wrapper.find("ul.carousel > li.cell").first(); } slide_switch(target_wrapper, past_target, next_target); }else{ clearTimeout(timerId_slide); } },6000); } function slide_start(target_wrapper) { target_wrapper.addClass("active"); target_wrapper.append('
    '); target_wrapper.find("ul.carousel > li.cell").each(function(i){ var set_class = $(this).attr("id"); target_wrapper.children("ul.dots").append('
  • '); }); var max_num = target_wrapper.find("ul.carousel > li.cell").length; // var first_target = target_wrapper.find("ul.carousel > li.cell").eq(rnd(max_num-1)); var first_target = target_wrapper.find("ul.carousel > li.cell").eq(0); var img_url = first_target.find("div.img").attr("data-img-url"); first_target.find("div.img > img").imagesLoaded(function(){ slide_switch(target_wrapper, "", first_target); slide_repeat(target_wrapper); }); first_target.find("div.img > img").attr("src", img_url); target_wrapper.children("ul.dots").find("li").click(function(){ if( !$(this).hasClass("active") ){ var past_target = target_wrapper.find("ul.carousel > li.cell.active"); var next_target = target_wrapper.find("ul.carousel > li.cell#"+$(this).attr("class")); slide_switch(target_wrapper, past_target, next_target); } }) } function get_total_height(elms) { var total_height = 0; elms.each(function(i){ var height = $(this).outerHeight(true); total_height += height; }); return total_height; } function window_refresh() { document_height = $(document).height(); content_height = get_total_height($("#container > div#groundbase > *")); // entry_height = get_total_height($("#entry > div.inner > *")); if( $("html.touch_device")[0] ){ 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"); } $("img.preload:not('.loaded')").each(function(){ $(this).imagesLoaded(function(){ $(this).addClass("loaded"); scroll_trigger(); }); }); scroll_trigger(); } $(window).bind("resize", window_refresh); });