// cookie viewmode function changeView() { $.cookie("viewmode", "pc", { path: "/" }); } $(document).ready(function(){ //サムネテキスト /* var ua = navigator.userAgent.toLowerCase().indexOf("iphone") != -1 ? "iphone" : "android"; $(".thumbText").each(function(){ var targetID = $(this).attr("id"); $.get( "/i/inc/ad_thumbText.php", { ua : ua, id : targetID }, function(data){ $("#"+targetID).append(data); } ); }); */ //movie width $(".resizems").each(function(){ w1=$(this).width(); h1=$(this).height(); $(this).css({"width":"98%"}); w2=$(this).width(); h2=h1*w2/w1; $(this).css({"height":h2+"px"}); }); //photoview $(".articleSingle .content .mt-image-none").click(function(){ var imgSrc = $(this).attr("src"); document.location = "/i/photoview/?href="+location.href+"&mode=sm"; }); //個別記事2ページ目以降のバナー表示の操作 //$("#notFirstEntryPageAd").prependTo('.content').show(); //メニューの処理 $('.bt_menu').click(function(){ $('nav').toggle( 'slide', { direction : 'right' }, 300 ); }); $("a.cat").click(function () { $("a.cat").next().hide(); $("a.cat").removeClass("selected"); $(this).addClass("selected"); $(this).next().fadeIn(300); return false; }); $(".container > nav").css("top",$(".container > header").height()+"px"); //sideRanking //$("#rankingTable div:nth-child(1) article:nth-child(6)").after($("#rankingArea2")); //$("#rankingTable div:nth-child(2) article:nth-child(6)").after($("#rankingArea3")); $("#rankingSwitch > div").click(function(){ var showTarget = $(this).attr("data-table"); var hideTarget = showTarget == "popular" ? "twitter" : "popular"; $("#rankingTable div[data-table='"+hideTarget+"']").hide(); $("#rankingTable div[data-table='"+showTarget+"']").show(); }); //ページ上部へ戻る $("footer span").click(function () { $('html,body').animate({ scrollTop: 0 }, 'fast'); return false; }); //pulldown $(".catyomi li:first-child select").change(function() { target = $(".catyomi li:first-child select option:selected").val(); if(target) location.href = "/i/"+target+"/"; }); $(".catyomi li:last-child select").change(function() { target = $(".catyomi li:last-child select option:selected").val(); location.href = "/i/keywords/"+target+"/"; }); //ga var _gaq = _gaq || []; _gaq.push(['_setAccount', '']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); $(function(){ var saizoUrl; var nowDir; var ob; var sob; saizoUrl = location.pathname; if (saizoUrl == "/i/" || saizoUrl == "/i/index.html" || saizoUrl.match(/^\/[0-9]{1,}\.html$/)) { nowDir = "top"; } else if (saizoUrl.match(/[0-9]{4}\/[0-9]{2}\/((index|index_[0-9]{1,})\.html)?$/)) { nowDir = "mon"; } else if (saizoUrl.match(/[0-9]{4}\/[0-9]{2}\/.*\.html/)) { nowDir = "ent"; } else if (saizoUrl.match(/[a-z0-9]*?\/[a-z0-9]*?\/(.*\.html)?/)) { nowDir = "cat"; } else { nowDir = "other"; } //console.log(nowDir); //Googleに送信+コンソールでチェック function gp(cat, act, lab) { var gpCat = cat + ":" + nowDir; var gpAct = act != "" ? cat + ":" + nowDir + " / " + act : "out of order"; var gpLab = lab != "" ? cat + ":" + nowDir + " / " + lab : ""; ga('send', 'event', gpCat, gpAct, gpLab); ga('send', { 'hitType': 'event', 'eventCategory': gpCat, 'eventAction': gpAct, 'eventLabel': gpLab, 'eventValue': '' }); console.log("gpCat-> "+gpCat);console.log("gpAct-> "+gpAct);console.log("gpLab-> "+gpLab);console.log("------------------------------"); } //header ////logo $("header .sitelogo a").click(function(e){ gp("logo", "", "");e.stopImmediatePropagation(); }); ////menu $("nav .submit_right").click(function(e){ gp("menu", "searchIcon", "");e.stopImmediatePropagation(); }); $("nav ul > li > ul > li > a").click(function(e){ navAct = $(this).attr("href").replace("/",""); gp("menu", navAct, $(this).text());e.stopImmediatePropagation(); }); //timeline $("#entries article a").click(function(e){ gp("timeLine", "Title"+($("#entries article a").index(this)+1),"");e.stopImmediatePropagation(); }); $("#readmore a").click(function(e){ gp("timeLine", "More","");e.stopImmediatePropagation(); }); //entry if(nowDir=="ent") { $(".articleSingle div.btarea a").click(function(e){ gp("entry", "All","");e.stopImmediatePropagation(); }); $(".container section:nth-of-type(3)").click(function(e){ gp("entry", "Relation","");e.stopImmediatePropagation(); }); $(".container section.relatedArticle article a").click(function(e){ gp("entry", "Newzia","");e.stopImmediatePropagation(); }); $("ul.articlePaging li a").click(function(e){ gp("entry", "page","");e.stopImmediatePropagation(); }); $("ul.articlePaging li a").click(function(e){ gp("entry", "page","");e.stopImmediatePropagation(); }); $(".articleSingle .nextArticle a").on('click', function(){ var direction = $('.articleSingle .nextArticle a').index(this)==0? 'next': 'prev'; gp("entry", "nextArticle", direction);e.stopImmediatePropagation(); }); ////go back top $("#nextEntryLink a").click(function(e){ gp("nextEntryLink","", "");e.stopImmediatePropagation(); }); ////nextPageTitle $("#nextPageTitle a").click(function(e){ gp("nextPageTitle","", "");e.stopImmediatePropagation(); }); } //rank $("#rankingTable article > a").click(function(e){ var label = $(this).parents("div").attr("data-table"); var rankNum = $("#rankingTable article > a").index(this)+1; var rankN = rankNum > 10 ? "Title"+(rankNum - 10) : "Title"+rankNum; gp("rank", rankN, label);e.stopImmediatePropagation(); }); $("#rankingSwitch div").click(function(e){ var label = $(this).attr("id").match(/Popular/) ? "popular" : "twitter"; gp("rank", "switch", label);//e.stopImmediatePropagation(); }); //pickUp $("#wadaiArea > article > a").click(function(e){ gp("pickUp", "Title"+($("#wadaiArea > article > a").index(this)+1),"");e.stopImmediatePropagation(); }); //cate $(".catyomi ul li:nth-of-type(1) select option").click(function(e){ gp("cate",$(this).text(),"");e.stopImmediatePropagation(); }); //yomi $(".catyomi ul li:nth-of-type(2) select option").click(function(e){ gp("yomi",$(this).text(),"");e.stopImmediatePropagation(); }); //hotkeyword $(".hotkeyword ul li a").click(function(e){ gp("keywords","word",$(this).text());e.stopImmediatePropagation(); }); $(".hotkeyword > div > a").click(function(e){ gp("keywords","all","");e.stopImmediatePropagation(); }); //sns $(".snsLink article a:nth-of-type(1)").click(function(e){ gp("sns","foot","twitter");e.stopImmediatePropagation(); }); $(".snsLink article a:nth-of-type(2)").click(function(e){ gp("sns","foot","facebook");e.stopImmediatePropagation(); }); $(".snsLink article a:nth-of-type(3)").click(function(e){ gp("sns","foot","gplus");e.stopImmediatePropagation(); }); $(".snsLink article a:nth-of-type(4)").click(function(e){ gp("sns","foot","feedly");e.stopImmediatePropagation(); }); //entry snsshare $("#snsShare #shareTwitter a").click(function(e){ gp("snsShare","entrybottom","twitter");e.stopImmediatePropagation(); }); $("#snsShare #shareFacebook a").click(function(e){ gp("snsShare","entrybottom","facebook");e.stopImmediatePropagation(); }); //footer ////medias $("#medias ul li a").click(function(e){ gp("footer","medias",$(this).text());e.stopImmediatePropagation(); }); ////Company $("footer > a").click(function(e){ gp("footer","Company","");e.stopImmediatePropagation(); }); ////up $("footer > span > a").click(function(e){ gp("footer","UP","");e.stopImmediatePropagation(); }); }); });