$(function() {
category = Array();
category['outline'] = Array();
category['outline'][0] = "開催概要";
category['outline'][1] = "飛生芸術祭とは?飛生芸術祭の開催概要です。";
category['about'] = Array();
category['about'][0] = "ABOUT";
category['about'][1] = "飛生芸術祭とは?飛生芸術祭2015の開催概要です。";
category['news'] = Array();
category['news'][0] = "NEWS";
category['news'][1] = "飛生芸術祭関連のインフォメーション・ニュースです。";
category['schedule'] = Array();
category['schedule'][0] = "SCHEDULE";
category['schedule'][1] = "飛生芸術祭2015の開催スケジュールです。";
category['supporters'] = Array();
category['supporters'][0] = "SUPPORTERS";
category['supporters'][1] = "飛生アートコミュニティーの活動を支えてくださっているサポーターの皆様";
category['access'] = Array();
category['access'][0] = "ACCESS";
category['access'][1] = "飛生アートコミュニティーまでの道のりです。";
function htmlEncode(value){
return $('
').text(value).html();
}
function htmlDecode(value){
return $('').html(value).text();
}
function create_fullcalendar(){
// Google Calender feed
$('#calendar').fullCalendar({
eventSources:[
{
url:"http://www.google.com/calendar/feeds/info%40lifesnap.jp/public/basic",
className:"event_set_1"
},
{
url:"http://www.google.com/calendar/feeds/ja.japanese%23holiday%40group.v.calendar.google.com/public/basic",
className:"event_set_2"
}
],
timeFormat: "H:mm",
loading: function(bool) {
if (bool) {
$('#cal_loading').show();
}else{
$('#cal_loading').fadeOut(200);
$(".fc-event-time").parent().addClass("single_day");
$(".fc-event-time").parent().parent().addClass("single_day_wrapper");
}
}
});
$(document).on("click", ".fc-content a", function(){
return false;
});
setTimeout(function() {
}, 2000);
}
scroll_action_flag = "";
root_site_title = "飛生芸術祭 2015「僕らは同じ夢をみる-」 2015年9月6日(日)〜13日(日)";
history_counter = 0;
past_href = location.href;
memorize_scrolltop = $(window).scrollTop();
memorize_lastvisit = "entry";
memorize_lasturl = location.href;
profile_url = "outline";
now_viewing = "";
var scroll_margin = 0;
var window_height = $(window).height();
var window_width = $(window).width();
$(window).bind('load', function() {
setTimeout(
function(){
window_height = $(window).height();
window_width = $(window).width();
if( $("html.touch_device")[0] ){
scroll_margin = Math.round(window_width/7);
}else{
scroll_margin = Math.round(window_width/3.5);
}
if( now_viewing != "about" ){
var scroll_adjustment = 2;
}else{
var scroll_adjustment = 1;
}
if( memorize_lastvisit == "entry" ){
scroll_action_flag = false;
$("#entry > article").css({"margin-top": $(window).scrollTop()+60});
$("div#entry").fadeIn(400);
memorize_lastindex = "";
memorize_lastvisit_article_type = "";
}else if( memorize_lastvisit == "index" || memorize_lastvisit == "profile" ){
scroll_action_flag = false;
var target_nav = $(".class_" + "".replace( "/", "_" ) + " a");
target_nav.removeClass("over");
target_nav.addClass("active");
//article_type(ground・floating)の読み取り
var article_type = $( "article#" + now_viewing ).attr("class");
if( article_type == "ground" ){
var scrollto = $('#' + now_viewing ).offset().top + scroll_margin * scroll_adjustment;
$('html,body').animate({
scrollTop: scrollto
}, 3000, "easeOutQuint",
function(){
scroll_action_flag = true;
});
}else if( article_type == "floating" ){
$( "article#" + now_viewing ).css({"margin-top": $(window).scrollTop()+60});
$( "article#" + now_viewing ).parent().fadeIn(
400,function(){
if( now_viewing == "schedule" && ! $("#calendar * ").length ){
create_fullcalendar();
}
}
);
}
memorize_lastvisit_article_type = article_type;
}else{
scroll_action_flag = false;
setTimeout(
function(){
scroll_action_flag = true;
}
, 1000);
memorize_lastvisit_article_type = "";
}
}
, 1000);
});
function window_action() {
window_height = $(window).height();
window_width = $(window).width();
if( $("html.touch_device")[0] ){
scroll_margin = Math.round(window_width/7);
}else{
scroll_margin = Math.round(window_width/3.5);
}
}
$(window).bind("resize", window_action);
function PJAX_hrefchange( href, onpop ) {
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 ){
past_href = href;
var id = href.replace( "http://fes.tobiu.com/2015/", "" );
var id = id.replace( "?mode=preview", "" );
now_viewing = id;
_gaq.push(['_trackPageview', '/' + id ]);
ajax_request = $.ajax({
url: "http://fes.tobiu.com/2015/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 != "" ){
$("body").append("");
if( memorize_lastvisit == "entry"){
$('html,body').animate({
scrollTop: memorize_scrolltop
}, '200',
function(){
scroll_action_flag = false;
});
}else{
memorize_scrolltop = $(window).scrollTop();
}
ajax_request = $.ajax({
url: "http://fes.tobiu.com/2015/ajax_entry.php",
data: "id=" + category_filter + "/" + entry_id + "",
success:
function(data, dataType){
$("div#entry").fadeOut(
400,
function(){
$(this).empty().append(data).fadeIn(
400,function(){
$("#entry > article").css({"margin-top": $(window).scrollTop()+60});
$("div#loading").fadeOut(1500).remove();
}
);
}
);
memorize_lastvisit = "entry";
memorize_lastvisit_article_type = "";
memorize_lasturl = href;
memorize_lastindex = category_filter;
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}else if( entry_id != "" ){
$("body").append("");
ajax_request = $.ajax({
url: "http://fes.tobiu.com/2015/ajax_entry.php",
data: "id=" + entry_id + "",
success:
function(data, dataType){
$("div#entry").fadeOut(
400,
function(){
$(this).empty().append(data).fadeIn(
400,function(){
$("#entry > article").css({"margin-top": $(window).scrollTop()+60});
$("div#loading").fadeOut(1500).remove();
}
);
}
);
memorize_lastvisit = "entry";
memorize_lastvisit_article_type = "";
memorize_lasturl = href;
memorize_scrolltop = 0;
memorize_lastindex = "";
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
}
if( typeof entry_id == "undefined" && ( id != "" || id == profile_url ) ){
//article_type(ground・floating)の読み取り
var article_type = $( "article#" + id ).attr("class");
if( memorize_lastvisit == "entry" ){
$('html,body').stop().animate({
scrollTop: memorize_scrolltop
}, 800);
$("div#entry").fadeOut(
400,
function(){
$(this).empty();
scroll_action_flag = true;
memorize_lastvisit = "index";
memorize_lasturl = href;
memorize_scrolltop = 0;
memorize_lastindex = id;
}
);
if( memorize_lastindex != id ){
if( article_type == "ground" ){
var scrollto = $('#' + id).offset().top + scroll_margin;
$('html,body').animate({
scrollTop: scrollto
}, 3000, "easeOutQuint",
function(){
scroll_action_flag = true;
});
}else if( article_type == "floating" ){
$( "article#" + id ).css({"margin-top": $(window).scrollTop()+60});
$( "article#" + id ).parent().fadeIn(
400,function(){
$("div#loading").fadeOut(1500).remove();
if( id == "schedule" && ! $("#calendar * ").length ){
create_fullcalendar();
}
}
);
}
memorize_lastvisit = "index";
memorize_lastvisit_article_type = article_type;
memorize_lasturl = href;
memorize_scrolltop = $(window).scrollTop();
memorize_lastindex = id;
}
}else{
$( "article.floating" ).parent().fadeOut(400);
if( article_type == "ground" ){
var scrollto = $('#' + id).offset().top + scroll_margin;
$('html,body').animate({
scrollTop: scrollto
}, 1000,
function(){
scroll_action_flag = true;
});
}else if( article_type == "floating" ){
$( "article#" + id ).css({"margin-top": $(window).scrollTop()+60});
$( "article#" + id ).parent().fadeIn(
400,function(){
$("div#loading").fadeOut(1500).remove();
if( id == "schedule" && ! $("#calendar * ").length ){
create_fullcalendar();
}
}
);
}
memorize_lastvisit = "index";
memorize_lastvisit_article_type = article_type;
memorize_lasturl = href;
memorize_scrolltop = $(window).scrollTop();
memorize_lastindex = id;
}
}
if( id == "" ){
$( "article.floating" ).parent().fadeOut(
400,function(){
scroll_action_flag = true;
}
);
$("div#entry").fadeOut(
400,
function(){
$(this).empty();
}
);
if( memorize_lastvisit_article_type != "floating" ){
var scrollto = 0;
$('html,body').animate({
scrollTop: scrollto
}, 3000, "swing",
function(){
scroll_action_flag = true;
});
}
memorize_lastvisit = "root";
memorize_lastvisit_article_type = "";
memorize_lasturl = href;
memorize_scrolltop = 0;
}
if( typeof entry_id == "undefined" ){
$("#navi nav li a").removeClass("active");
$("#navi nav li a").addClass("over");
var target_nav = $(".class_" + id.replace( "/", "_" ) + " a");
target_nav.removeClass("over");
target_nav.addClass("active");
}
}else{
if ( href.replace( "http://fes.tobiu.com/2015/", "" ) == "" ){
$('html,body').animate({
scrollTop: 0
}, 'slow');
}
}
}
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 = "http://fes.tobiu.com/2015/#!/" + 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( "http://fes.tobiu.com/2015/", "" );
var href = "http://fes.tobiu.com/2015/#!/" + href.replace( /^.\//, '' );
var past_href = location.href;
if ( href == "http://fes.tobiu.com/2015/#!/" && past_href == "http://fes.tobiu.com/2015/#!/" ) {
$('html,body').animate({
scrollTop: 0
}, 1000);
memorize_lastvisit_article_type = "";
}
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 = "http://fes.tobiu.com/2015/";
}
}
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 );
}
}
});
$(window).scroll(function(){
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 + scroll_margin;
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++;
}
});
var scroll_val = $(window).scrollTop();
$.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"] ){
var id = menu_list[i]["id"];
now_viewing = id;
past_href = "http://fes.tobiu.com/2015/" + id;
var page_title = category[id][0] + " | " + root_site_title;
PJAX_pushState( "http://fes.tobiu.com/2015/" + 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 != "" ){
var id = "";
now_viewing = id;
past_href = "http://fes.tobiu.com/2015/";
PJAX_pushState( "http://fes.tobiu.com/2015/", root_site_title );
document.title = root_site_title;
$("#navi nav li a").removeClass("active");
$("#navi nav li a").addClass("over");
_gaq.push(['_trackPageview', '/' + id ]);
}
}
});
scroll_action_flag = true;
}
, 4000);
}
});
});