$(function(){ var ua = (function(){ return { ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", ltIE9:document.uniqueID && !window.matchMedia, gtIE10:document.uniqueID && document.documentMode >= 10, Trident:document.uniqueID, Gecko:window.sidebar, Presto:window.opera, Blink:window.chrome, Webkit:!window.chrome && typeof document.webkitIsFullScreen != undefined, Touch:typeof document.ontouchstart != "undefined", Mobile:typeof window.orientation != "undefined" } })(); if(ua.Touch || ua.Mobile){ var dspAct01 = 'tap'; var dspAct02 = 'tap'; }else{ var dspAct01 = 'click'; var dspAct02 = 'mouseenter'; } var winW; var winH; var winY; var slideSpeed = 5000; var slideTrans = 300; winSize(); $(window).on('scroll resize orientationchange',function(){ winSize(); }); clock() setInterval(clock, 1000); $('#topics').on("click",function(){ $("#topics").off("click"); $.ajax({ type: 'get', url: 'https://spur.hpplus.jp/api/article/list.php?tag=[%22%E6%99%82%E8%A8%88%22]&limit=5&format=json', dataType: 'json', success: function(json){ var article = json.articles; var len = article.length; for(var i=0; i < len; i++){ var link = article[i].link; var series = article[i].series_title; var title = article[i].article_title; if(series == 'SPURGRAM'){ var title = series; var label = 'spurgram'; }else{ var title = title; var label = ''; } var img = article[i].thumbnail_images.square.medium.path; var topic = '

' + title + '

'; $('#topics').append(topic); } } }).done(function(){ $('#topics').slick({ slidesToShow: 5, slidesToScroll: 5, adaptiveHeight:true, prevArrow:'Prev', nextArrow:'Next', }); $('#topics .item').find('a').on('mouseenter',function(){ $(this).css({ opacity: 1 }).find('.img').stop().animate({ opacity: .3 },slideTrans).end().find('.title').stop().animate({ opacity: 1 },slideTrans) }).on('mouseleave',function(){ $(this).find('.img').stop().animate({ opacity: 1 },slideTrans).end().find('.title').stop().animate({ opacity: 0 },slideTrans) }); }); }); if($('#top_slide').length){ var tgt = $('#top_slide'); var slideNum = $('#top_slide').find('.slide').size(); var slideTime = slideNum*slideSpeed; var progress = $('#top_slide_progress').find('.progress'); var bar = $('#top_slide_progress').find('.bar') tgt.find('.slide').each(function(i){ var id = 'progress' + i; var progress = '
'; $('#top_slide_progress>.scale').append(progress); }); tgt.on('init', function(event, slick){ var num = 0; $('#top_slide_progress').find('.progress').eq(num).addClass('current'); }).slick({ slidesToShow: 1, arrows: false, fade: true, autoplay: false, speed: slideTrans, autoplaySpeed: slideSpeed, draggable: false }).slick('slickPlay') .on('beforeChange', function(event, slick, currentSlide, nextSlide){ var num = nextSlide; $('#top_slide_progress').find('.progress').removeClass('current').eq(num).addClass('current') }); $('#top_slide_progress').find('.progress').on('click',function(){ tgt.slick('slickGoTo', $(this).attr('data-order')); }); } if($('.lineup').length){ $('.lineup').each(function(){ shuffleContent($(this)); if($(this).parents('.row').attr('id') == 'future'){ var dir = true; } else { var dir = false; } pieces($(this),dir); }); } function winSize(){ winW = $(window).width(); winH = $(window).height(); winY = $(window).scrollTop(); } function clock() { var now = new Date(); var hour = now.getHours(); var min = now.getMinutes(); var sec = now.getSeconds(); var deg = sec*6; if(hour < 10) { hour = "0" + hour; } if(min < 10) { min = "0" + min; } if(sec < 10) { sec = "0" + sec; } var time = '' + hour + ':' + min + ':' + sec + ''; $('#watch_time>.time').html(time.toLocaleString()); $('#watch_hand').css({ transform: 'rotate(' + deg + 'deg)' }); } function pieces($elm,rtl) { $elm.on('init', function(event, slick){ $elm.parents('.contentBody').find('.row').stop().fadeTo(1500,1) }) var slick = $elm.slick({ autoplay: false, autoplaySpeed: slideSpeed, slidesToShow: 5, centerMode: true, prevArrow:'Prev', nextArrow:'Next', rtl: rtl }).slick('slickPlay'); } function shuffleContent(container) { var content = container.find("> *"); var total = content.size(); content.each(function() { content.eq(Math.floor(Math.random()*total)).prependTo(container); }); } var co=$("body").load_watches4mode(); console.log(co); if(!co){ $('#wrapper').removeClass('visible_hidden'); $('#topics').trigger("click"); $('#opening_html').remove(); }else{ $("#opening_html").append(''); } });