/** * @filename geolocator.js * @charset utf-8 * @modified September 10, 2010 * @description GeoLocatorV3 表示用 * * COPYRIGHT (C) 2007-2010 BLADES CO.,LTD. ALL RIGHTS RESERVED. * * This program is free software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License (http://www.gnu.org/) for more details. */ (function(){ var win = this, doc = win.document, hd = doc.getElementsByTagName("head")[0], bdy = doc.body, APP_ID = "bladesGeoLocator", rgxIsMe = /^(.*\/)geolocator\.js(?:\?\d+)?$/, pth, me = (function(){ var s = doc.createElement("script"), ss, i, m; hd.appendChild(s); s.parentNode.removeChild(s); ss = doc.getElementsByTagName("script"); i = ss.length; while(i){ s = ss[--i]; if( m = rgxIsMe.exec(s.src) ){ pth = m[1]; return s; } } })(); if( !doc.getElementById(APP_ID) ){ var isIE = doc.all && !win.opera, isIE7 = isIE && !doc.querySelectorAll, btnClose = doc.createElement("a"), geolocator = doc.createElement("div"), overlay = doc.createElement("div"), wrapper = doc.createElement("div"), lnk = doc.createElement("link"), iframe = doc.createElement("iframe"), df = doc.createDocumentFragment(), ovrCss = overlay.style, wprCss = wrapper.style, ts = +new Date, css = pth + "geolocator.css?" + ts,//開発時用キャッシュ対策 //タグなどoverlayの上に出てしまうタグを消しておく masker = (function(){ var hiddenElements = [], __REMOVE_PROPERTY__ = bdy.style.removeProperty ? "removeProperty" : "removeAttribute"; return{ hide : function(tag){ var elms = doc.getElementsByTagName(tag), elm, css, arr = hiddenElements, i = elms.length; while(i){ elm = elms[--i]; css = elm.style; arr.push({ elm : elm, dft : css.visibility }); css.visibility = "hidden"; } return this; }, show : function(){ var arr = hiddenElements, i = arr.length, itm, css, dft; while(i){ itm = arr[--i]; css = itm.elm.style; dft = itm.dft; if(dft){ css.visibility = dft; }else{ css[ __REMOVE_PROPERTY__ ]("visibility"); } } return this; } }; })(), /** * フェードイン・アウト(IE無視) */ fadeOut = function(css, fnc){ var val = 1, sto = win.setTimeout; (function next(){ var d = val / 2; val -= d > 0.1 ? d : 0.1; if( val > 0 ){ css.opacity = val; sto( next, 48 ); }else{ css.opacity = 0; fnc && fnc(); } })(); }, fadeIn = function(css, fnc){ var val = 0, sto = win.setTimeout; (function next(){ var d = val / 2; val += d > 0.5 ? d : 0.5; if( val < 1 ){ css.opacity = val; sto( next, 64 ); }else{ css.opacity = 1; fnc && fnc(); } })(); }; // masker.hide("object"); isIE && masker.hide("select"); // // 以下のhtmk断片を作成し挿入 // // //
//
//
// // //
//
// lnk.rel = "stylesheet"; lnk.href = css; geolocator.id = APP_ID; overlay.id = APP_ID + "Overlay"; wrapper.id = APP_ID + "Wrapper"; btnClose.id = APP_ID + "BtnClose"; iframe.id = APP_ID + "Iframe"; ovrCss.opacity = wprCss.opacity = 0;//IE無視 btnClose.href = "#"; btnClose.onclick = function(){ fadeOut( wprCss, function(){ fadeOut( ovrCss, function(){ bdy.removeChild(lnk); bdy.removeChild(geolocator); masker.show(); }); }); return false; }; btnClose.onfocus = function(){ this.blur(); }; iframe.frameBorder = 0; wrapper.appendChild(btnClose); wrapper.appendChild(iframe); df.appendChild(lnk);//先に挿入しないとIEでcssが反映されない geolocator.appendChild(overlay); if(isIE7){//before要素再現 XD var bfr = doc.createElement("div"); bfr.id = APP_ID + "Before"; geolocator.appendChild(bfr); } geolocator.appendChild(wrapper); df.appendChild(geolocator); bdy.appendChild(df); //DOMツリーに挿入後iframe内コンテンツ作成 var idoc = iframe.contentWindow.document; idoc.open().write([ '', '', '', '', '', '', '', '', '', 'BLADES GEO LOCATOR', '', '', '
', '
', '
', '
', '
', '
', '
', ' ', ' ', '
', '
', ' ', '
', '
', ' ', '
', '
', ' ', '
', ' ', ' ', ' ', ' ', '

', '
', ' ', ' ', ' ', ' ', ' ', ' ',//フェードイン/フェードアウトで目立たないように ' ', '
', '
', '', isIE ? '' : "",//document.writeを上書き '', '', '', '', '' ].join("")); idoc.close(); //フェードイン fadeIn( ovrCss, function(){ fadeIn( wprCss ); }); } // me.parentNode.removeChild(me); })();