/* designCnt対策 ---------------------------------------------------------------------*/ function designCnt(pos,opt){ return false; } /* イベント ---------------------------------------------------------------------*/ var appendEventListener = function(elem,type,func,capture){ var ret = null; if(elem.addEventListener){ ret = func; elem.addEventListener(type,func,capture); }else if(elem.attachEvent){ ret = func; elem.attachEvent('on' + type,ret); } return ret; }; var deleteEventListener = function(element,type,func,capture){ if(element.removeEventListener){ element.removeEventListener(type,func,capture); }else if(element.detachEvent){ element.detachEvent('on' + type,func); } }; /* URL 取得 ---------------------------------------------------------------------*/ function getUrl(){ var url = { 'url':document.URL, 'url_cutparam':document.URL.replace(/\.html.+/,'.html'), 'domain':document.domain, 'path':location.pathname, 'path_cutparam':location.pathname.replace(/\.html.+/,'.html'), 'port':location.port, 'path_cutpageing_cutparam':location.pathname.replace(/\_\d*\.html(.+)?/,'.html') }; return url; }; /* SiteCatslyst (RESPONCE TIME) ---------------------------------------------------------------------*/ function resTime(){ var str = ''; var num = 0; var num_break = 100; var range = [0,0]; if(typeof dcl_start != 'undefined'){ // 変数チェック var now = new Date(); var date_ms = parseInt((now.getTime() - dcl_start.getTime())) / num_break; if(date_ms >= num_break){ num = (num_break * num_break) + '_'; }else{ num = date_ms; range = [Math.floor(num) * num_break,Math.ceil(num) * num_break]; if(range[0] == range[1]){ range[1] += num_break; } num = range[0] + '_' + range[1]; } str = 'pcv_' + masterChannel() + '_' + num; // console.log(str); }else{ } return str; }; /* IMAGE サーバ ---------------------------------------------------------------------*/ function imgSrv(){ var url = getUrl(); if(!url['domain'].match(/(preview|broom|localhost)/)){ return '//ima' + 'ge.itmedia.co.jp'; }else{ return ''; } }; /* 外部 JS ロード ---------------------------------------------------------------------*/ function setJs(url){ if(setJs.checkJs(url) == false){ setJs.createJs(url); setJs.addJs(); return true; } return false; } setJs.checkJs = function(url){ this.head = document.getElementsByTagName('head')[0]; this.script = this.head.getElementsByTagName('script'); for(var i = 0; i < this.script.length; i++){ if(this.script[i].getAttribute('src') == url){ return true; break; } } return false; } setJs.createJs = function(url){ this.head = document.getElementsByTagName('head')[0]; this.js = document.createElement('script'); this.js.setAttribute('type','text/javascript'); this.js.setAttribute('src',url); } setJs.addJs = function(){ this.head.appendChild(this.js); }; function addJS(_src,_id){ var d = document; var js = d.createElement('script'); js.src = _src; if(_id) js.id = _id; d.head.appendChild(js); return js; }; /* ディレクトリ階層を body class にセット -------------------------------------------------------------*/ function attachBodyClass(){ var a = location.pathname.split('/'); for(var i = 1; i < a.length; i++){ if(a[i].match('.html') || a[i] == '') continue; a[i] = 'dir-' + a[i]; } document.getElementsByTagName('body')[0].className = a.join(' '); }; /* 実行 JS 取得 -----------------------------------------------------------------------*/ function getScriptThis(e){ if(e.nodeName.toLowerCase() == 'script'){ return e; }else{ return arguments.callee(e.lastChild); } }; /* JS TITLE 属性取得 -----------------------------------------------------------------------*/ function getScriptTitleTag(e){ if(e.nodeName.toLowerCase() == 'script'){ return e.getAttribute('title'); }else{ return arguments.callee(e.lastChild); } }; /* META 取得 -----------------------------------------------------------------------*/ function getMETA(metaname){ if(!metaname || metaname == '') return false; var head = document.getElementsByTagName('head')[0]; var meta = head.getElementsByTagName('meta'); var target = []; for(var i = 0; i < meta.length; i++){ if(meta[i].name == metaname){ target.push(meta[i]); break; } } if(target.length == 0) return false; return target[0]; }; /* WAIT 関数(遅延ロード対応) - 2011/04/18 -----------------------------------------------------------------------*/ function domWait(a,func){ var check = 0; try{ eval('check = ' + a); }catch(e){ } if(check){ func() }else{ var f = function(){ domWait(a,func) }; setTimeout(f,100); } }; /* 配列のキーを指定し重複があるものを排除し返す - 2011/06/10 -----------------------------------------------------------------------*/ function uniqueArray(hash){ var storage = {}; var uniqueArray = []; var i,value; for(i = 0; i < hash.length; i++){ value = hash[i]; if(!(value in storage)){ storage[value] = true; uniqueArray.push(value); } } return uniqueArray; } /* ブラウザ幅&高さ取得 - 2011/08/22 -----------------------------------------------------------------------*/ function getBrowserWH(){ var win = window; var doc = document; if(win.innerWidth || win.innerHeight){ return {'w':win.innerWidth,'h':win.innerHeight}; }else if((doc.documentElement && doc.documentElement.clientWidth != 0) || (document.documentElement && document.documentElement.clientHeight != 0)){ return {'w':doc.documentElement.clientWidth,'h':doc.documentElement.clientHeight}; }else if(document.body){ return {'w':doc.body.clientWidth,'h':doc.body.clientHeight}; } return {'w':0,'h':0}; } /* ブラウザスクロール量取得 - 2011/08/22 -----------------------------------------------------------------------*/ function getBrowserScrollXY(){ return {'x':document.documentElement.scrollLeft || document.body.scrollLeft,'y':document.documentElement.scrollTop || document.body.scrollTop}; } /* ノード位置取得 - 2011/08/22 -----------------------------------------------------------------------*/ function getElementXY(e){ var x = 0; var y = 0; while(e){ x += e.offsetLeft; y += e.offsetTop; e = e.offsetParent; } return {'x':x,'y':y}; }; /* ノード幅&高さ取得 - 2011/08/22 -----------------------------------------------------------------------*/ function getElementWH(e){ return {'w':e.offsetWidth,'h':e.offsetHeight}; }; /* ナビゲーションプルダウン(jQuery) - 2011/06/03 第三階層対応 - 2013/05/12 -----------------------------------------------------------------------*/ function localNavigationPD(id,flag){ if(!id || !flag) return false; if(!document.getElementById(id)) return false; var a = document.getElementById(id); var b = a.getElementsByTagName('div'); var c = []; for(var i in flag){ if(i == '') break; for(var j = 0; j < b.length; j++){ if(b[j].className.match(/^lnavBtn\s?/) && b[j].innerHTML.match(i)){ b[j].className += ' lnavBtnHover'; var tempTop = '