if (typeof itsmo == 'undefined') {
var itsmo = {};
}
if (typeof itsmo.vars == 'undefined') {
itsmo.vars = {};
}
itsmo.lib = {};
itsmo.vars.pages = {
'range' : '周辺検索',
'suumo' : '不動産検索',
'baitoru' : 'アルバイト検索',
'tabikura' : 'ホテル検索',
'freeword' : 'フリーワード検索',
'addlist' : '住所一覧',
'panelroute' : 'ルート',
'mypage' : 'マイページ',
'myhome' : '自宅',
'myspot' : '登録地点',
'myspot_group' : '登録地点グループ',
'myroute' : '登録ルート',
'poihistory' : '履歴地点',
'routehistory' : '履歴ルート',
'history' : '履歴',
'mysnspost' : 'SNS投稿設定'
};
itsmo.vars.d_host_www = 'www.its-mo.com';
//-------------------------------------------------------------
// AJAX通信
//-------------------------------------------------------------
// 非同期通信
itsmo.lib.lastAjaxObj = null;
itsmo.lib.XMLHttpRequest2_send = function(url, callback, method, query, type, errorCallback) {
if (type == undefined) type = 'xml';
var param = {
url: url,
cache: false,
async: true,
data: query,
dataType: type,
type: method,
success: callback
};
if (null != errorCallback && undefined != errorCallback) {
param.error = errorCallback;
}
itsmo.lib.lastAjaxObj = $.ajax(param);
return itsmo.lib.lastAjaxObj;
};
// 中止
itsmo.lib.XMLHttpRequest2_abort = function( xmlobj ) {
if (xmlobj == null) return;
if (xmlobj.readyState != 0 && xmlobj.readyState != 4) {
xmlobj.abort();
}
};
itsmo.lib.XMLHttpRequest2_abortLast = function() {
var n = itsmo.lib.XMLHttpRequest2_abort(itsmo.lib.lastAjaxObj);
itsmo.lib.lastAjaxObj = null;
return n;
};
// htmlを読み込む
itsmo.lib.XMLHttpRequest2_html = function( url, divid, method, query ) {
return $.ajax({
url: url,
cache: false,
async: true,
data: query,
dataType: 'html',
type: method,
success: function(data, dataType) {
$('#' + divid).html(data);
}
});
};
// 同期通信
itsmo.vars.g_map_request_func = null; // 同期通信の戻り先格納用
itsmo.lib.XMLHttpRequest2_send_wait = function( url, callback, method, data, msg )
{
itsmo.lib.map_wait2open(msg);
itsmo.vars.g_map_request_func = callback;
itsmo.lib.XMLHttpRequest2_send( url, itsmo.lib.XMLHttpRequest2_send_wait_result, method, data );
};
itsmo.lib.XMLHttpRequest2_send_wait_result = function(result) {
itsmo.lib.map_wait2close();
itsmo.vars.g_map_request_func(result);
};
//-------------------------------------------------------------
// LocalStorage関連
//-------------------------------------------------------------
itsmo.lib.localstorage_set = function(data ,type){
let key = "itsmonaviweb:search:history";
let ls_history = JSON.parse(localStorage.getItem(key));
if(ls_history == null){
ls_history = [];
}
if(!data.nm){
return;
}
//履歴にあった場合は何もしない
for(let i in ls_history){
if(ls_history[i]['text'] == data.nm){
return;
}
}
//履歴は10件まで
let limit = 10;
//上限以上の場合全て削除
if(ls_history.length >= limit){
for(let i=limit-1; i< ls_history.length; i++){
ls_history.splice(i ,1);
}
}
//フリーワードを初期値
let val ={};
if(type == undefined){
val = {
'text':data.nm
};
}else{
val = {
'id' : data.id,
'text':data.nm,
'code': !(data.cd) ? data.id : data.cd,
'point' : !(data.lat) ? {} : {lat : data.lat , lon : data.lon},
'type': type,
'tag' :!(data.tag) ? {} : data.tag
}
}
//先頭に追加。リニューアルのLocalstorageに合わせている
let log = [val].concat(ls_history);
localStorage.setItem(key, JSON.stringify(log));
return;
};
//-------------------------------------------------------------
// クッキー関係
//-------------------------------------------------------------
// 書き込み
itsmo.lib.cookie_set = function(key,val,sec){
if(sec == undefined) sec = 1597180133;
var date = new Date();
date.setTime(date.getTime() + (sec * 1000));
var expires = 'expires=' + date.toGMTString();
document.cookie = encodeURIComponent(key)+'='+encodeURIComponent(val) + "; "+expires+'; path=/; domain=www.its-mo.com;';
};
// 読み込み
itsmo.lib.cookie_get_raw = function(key){
var i1 = document.cookie.indexOf(key+"=");
if(i1 < 0) return '';
i1 = i1+key.length+1;
var i2 = document.cookie.indexOf(";",i1);
if(i2 < 0) i2 = document.cookie.length;
return document.cookie.substring(i1,i2);
};
itsmo.lib.cookie_get = function(key){
return decodeURIComponent(itsmo.lib.cookie_get_raw(key));
};
// 書き込み(削除)
itsmo.lib.cookie_del = function(key){
var date = new Date();
date.setTime(date.getTime() - 1800);
var expires = 'expires=' + date.toGMTString();
document.cookie = encodeURIComponent(key)+'=; '+expires+'; path=/; domain=www.its-mo.com;';
};
//-------------------------------------------------------------
// htmlspecialchars
//-------------------------------------------------------------
itsmo.lib.htmlspecialchars = function(ch) {
ch = ch.replace(/&/g,"&") ;
ch = ch.replace(/"/g,""") ;
ch = ch.replace(/'/g,"'") ;//"
ch = ch.replace(//g,">") ;
return ch;
};
//------------------------------------------------
// オブジェクト操作
//------------------------------------------------
// オブジェクト出す消す
itsmo.lib.document_on = function(name, doc) {
if (doc) {
$('#' + name, doc).show();
} else {
$('#' + name).show();
}
};
itsmo.lib.document_off = function(name, doc) {
if (doc) {
$('#' + name, doc).hide();
} else {
$('#' + name).hide();
}
};
// オブジェクトクラス変える
itsmo.lib.document_class = function(name,cl) {
$('#' + name).attr('class', cl);
};
// オブジェクト値セット
itsmo.lib.document_setvalue = function(name,value) {
var obj = $('#' + name);
if(obj.length <= 0) {
return;
}
switch(obj.get(0).type) {
case 'select-one':
obj = obj.get(0);
for(var i=0;i < obj.options.length;i ++) {
if(obj.options[i].value == value) {
obj.selectedIndex = i;
break;
}
}
break;
case 'text':
case 'hidden':
case 'textarea':
case 'password':
obj.val(value);
break;
case 'radio':
obj.get(0).checked = (obj.val() == value);
$("[id^='" + name + "-']").each(function() {
$(this).get(0).checked = ($(this).val() == value);
return true;
});
break;
case 'checkbox':
obj.get(0).checked = (obj.val() == value);
break;
default:
obj = obj.get(0);
if(obj.src != null) {obj.src = value;return;}
if(obj.href != null) {obj.href = value;return;}
if(obj.innerHTML != null) obj.innerHTML = value;
break;
}
};
// value取る
itsmo.lib.document_getvalue = function(name) {
var obj = $('#' + name);
if(obj.length <= 0) {
return null;
}
switch(obj.get(0).type) {
case 'select-one':
obj = obj.get(0);
return obj.options[obj.selectedIndex].value
break;
case 'text':
case 'hidden':
case 'textarea':
case 'password':
case 'file':
return obj.val();
break;
case 'radio':
if(obj.get(0).checked) {
return obj.val();
}
var ret = null;
$("[id^='" + name + "-']").each(function() {
if ($(this).get(0).checked) {
ret = $(this).val();
return false;
}
return true;
});
return ret;
break;
case 'checkbox':
if(obj.get(0).checked) {
return obj.val();
}
return '';
break;
default:
obj = obj.get(0);
if(obj.src != null) return obj.src;
if(obj.href != null) return obj.href;
if(obj.innerHTML != null) return obj.innerHTML;
break;
}
return null;
};
// xmlの値を安全に取る
itsmo.lib.document_getxmlvalue = function(xml,name)
{
if(xml.getElementsByTagName(name) == null) return '';
if(xml.getElementsByTagName(name)[0] == null) return '';
if(xml.getElementsByTagName(name)[0].firstChild == null) return '';
return xml.getElementsByTagName(name)[0].firstChild.nodeValue;
}
// オブジェクトを取る
itsmo.lib.document_getobj = function(name)
{
var obj = g_document.getElementById(name);
return obj;
}
//------------------------------------------------
// 色々
//------------------------------------------------
// ウィンドウの高さを返す。
itsmo.lib.getWindowHeight = function()
{
return $(window).height();
};
//------------------------------------------------
// その他
//------------------------------------------------
// 座標変換 ミリ→度分秒
itsmo.lib.map_dms2deg = function(ms) {
var tmp = ms;
var d = Math.floor(tmp / 3600000);
tmp -= d * 3600000;
var m = Math.floor(tmp / 60000);
tmp -= m * 60000;
var p_dms = d + "°" + m + "′" + tmp / 1000;
//1000で割り切れた場合
tmp -= Math.floor(ms / 1000) * 1000;
if( tmp == 0 ){
p_dms = p_dms + "/0";
}
return p_dms;
};
//------------------------------------------------
// チェックボックス処理
//------------------------------------------------
// チェックボックス一括チェック,解除
itsmo.lib.allCheck = function(classnm,id)
{
var checkBoxs = $("."+classnm);
var checkval = $("#"+id).attr('checked');
if((id).indexOf("1") != -1){
id2 = id.replace("1","2");
$("#"+id2).attr("checked", checkval);
}else if((id).indexOf("2") != -1){
id2 = id.replace("2","1");
$("#"+id2).attr("checked", checkval);
}
checkBoxs.attr('checked', checkval);
};
itsmo.lib.getCheckNum = function(name)
{
var cnt = 0;
var chk = new Array();
for (i = 0; i < $("[name='" + name + "[]']").length; i++) {
if ($('#' + name + i).attr('checked')) {
chk[cnt] = $('#' + name + i).val();
cnt++;
}
}
if (cnt == 0) {
return false;
} else {
return chk;
}
};
// 全選択チェックボックスのchecked==falseにする
itsmo.lib.allCheckOut = function()
{
$(".add_flg").click(function(){
var checked = $(this).attr('checked');
if(checked == false){
$("#list-selectall1").attr('checked',false);
$("#list-selectall2").attr('checked',false);
}
});
};
/*------------------------------------------------------------------
ScreenClose
------------------------------------------------------------------*/
itsmo.lib.ScreenClose = function()
{
$("#screen-wrap").hide();
$("#sc").parent().css('overflow', 'auto');
}
/*------------------------------------------------------------------
ScreenOpen
------------------------------------------------------------------*/
itsmo.lib.ScreenOpen = function()
{
window.scroll(0,0);
$("#sc").parent().css('overflow', 'hidden');
$("#screen-wrap").height($('window').height()).show();
}
//-------------------------------------------------------------
// ウィンドウ開く
//-------------------------------------------------------------
itsmo.vars.g_map_window = null;
itsmo.vars.g_map_window_func = null;
// 窓開く
itsmo.lib.map_windowopen = function(name,func) {
if(itsmo.vars.g_map_window != null) return;
itsmo.vars.g_map_window_func = func;
if (!itsmo.vars.g_screen_non) itsmo.lib.ScreenOpen();
itsmo.vars.g_map_window = name;
itsmo.lib.document_on(itsmo.vars.g_map_window);
$('div.right-add300:has(iframe)').hide();
$('#add-468-in').hide();
// フォーカスを合わせる
// itsmo.lib.map_setfocus_top($('#' + itsmo.vars.g_map_window).children());
itsmo.lib.map_setfocus_top(document.getElementById(itsmo.vars.g_map_window).childNodes);
};
// 窓閉じる
itsmo.lib.map_windowclose = function(nofunc) {
if(itsmo.vars.g_map_window == null) return;
itsmo.lib.document_off(itsmo.vars.g_map_window);
$('div.right-add300:has(iframe)').show();
$('#add-468-in').show();
itsmo.vars.g_map_window = null;
if (!itsmo.vars.g_screen_non) itsmo.lib.ScreenClose();
if(nofunc != 1 && itsmo.vars.g_map_window_func != null){
itsmo.vars.g_map_window_func();
}
itsmo.vars.g_map_confirm_yes = 0;
};
// フォーカスを左上?に移動させる
itsmo.lib.map_setfocus_top = function(parent) {
for(var i = 0;i < parent.length;i ++) {
var node = parent.item(i);
var tag = node.tagName;
if(tag == "INPUT") {
var type = node.type;
if(type == "text" || type == "checkbox" || type == "radio" || type == "image") {
node.focus();
return false;
}
} else if (tag == "TEXTAREA") {
node.focus();
return false;
}
if(node.childNodes.length > 0) {
if(itsmo.lib.map_setfocus_top(node.childNodes) == false) return false;
}
}
return true;
};
// 問い合わせウィンドウ
itsmo.vars.g_map_confirm_yes = 0;
itsmo.lib.map_confirm = function(title,text,func) {
itsmo.lib.document_setvalue('ajax_map_window_confirm_title',title);
itsmo.lib.document_setvalue('ajax_map_window_confirm_text',text);
itsmo.lib.map_windowopen('ajax_map_window_confirm',func);
};
itsmo.lib.map_confirm_yes = function() {
itsmo.vars.g_map_confirm_yes = 1;
itsmo.lib.map_windowclose();
};
itsmo.lib.map_confirm_no = function() {
itsmo.vars.g_map_confirm_yes = 0;
itsmo.lib.map_windowclose();
};
// 確認ウィンドウ
itsmo.vars.g_map_alert_cookie = null;
itsmo.lib.map_alert = function(title,text,cookie,func) {
if(itsmo.lib.cookie_get('cktg_confirm').indexOf(cookie) != -1) {
if(func) func();
return;
}
itsmo.lib.document_setvalue('ajax_map_window_alert_title',title);
itsmo.lib.document_setvalue('ajax_map_window_alert_text',text);
itsmo.lib.document_setvalue('ajax_map_window_alert_chk',0);
itsmo.vars.g_map_alert_cookie = cookie;
itsmo.lib.map_windowopen('ajax_map_window_alert',func);
};
itsmo.lib.map_alert_close = function(title,text,cookie) {
// クッキーに保存
if(itsmo.lib.document_getvalue('ajax_map_window_alert_chk') == 1) {
itsmo.lib.cookie_set('cktg_confirm',itsmo.lib.cookie_get('cktg_confirm')+'\t'+itsmo.vars.g_map_alert_cookie);
}
itsmo.lib.map_windowclose();
};
//-------------------------------------------------------------
// Wait表示
//-------------------------------------------------------------
itsmo.vars.g_map_waitcnt = 0;
itsmo.vars.g_map_waittimer = null;
// 処理中ウィンド表示
itsmo.lib.map_waitopen = function() {
itsmo.lib.document_off('ajax_leftmenu');
itsmo.lib.document_on('ajax_leftmenu_wait');
itsmo.vars.g_map_waitcnt ++;
// 強制的に閉じるウェイト
if(itsmo.vars.g_map_waittimer != null) clearTimeout(itsmo.vars.g_map_waittimer);
itsmo.vars.g_map_waittimer = setTimeout("itsmo.vars.g_map_waittimer = null;itsmo.lib.map_waitclose();" , 20 * 1000);
};
// 処理中ウィンドクローズ
itsmo.lib.map_waitclose = function() {
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
itsmo.vars.g_map_waitcnt --;
if(itsmo.vars.g_map_waitcnt < 1) {
itsmo.vars.g_map_waitcnt = 0;
if(itsmo.vars.g_map_waittimer != null) clearTimeout(itsmo.vars.g_map_waittimer);
}
};
// 処理中ウィンド2表示
itsmo.lib.map_wait2open = function(msg, flagCancelGPS) {
//itsmo.lib.document_setvalue('map_wait_text',msg);
if (flagCancelGPS == true) {
if ($('#map_wait_text').hasClass("exist-btn-cancel") == false) {
$('
').appendTo("#map_wait_text");
$('#map_wait_text').addClass("exist-btn-cancel");
}
} else {
if ($('#map_wait_text').hasClass("exist-btn-cancel") == true) {
$("#btn-cancel-gps").remove();
$('#map_wait_text').removeClass("exist-btn-cancel");
}
}
$('#map_wait_text span').text(msg);
itsmo.lib.map_windowopen('ajax_map_window_wait');
};
// 処理中ウィンド2クローズ
itsmo.lib.map_wait2close = function() {
if(itsmo.vars.g_map_window == 'ajax_map_window_wait') itsmo.lib.map_windowclose();
};
//------------------------------------------------
// エラー画面
//------------------------------------------------
itsmo.lib.map_error = function(title,text,func) {
itsmo.lib.document_setvalue('ajax_map_window_error_title',title);
itsmo.lib.document_setvalue('ajax_map_window_error_text',text);
itsmo.lib.map_windowopen('ajax_map_window_error',func);
$('#ajax_map_window_error a.btn-close').get(0).focus();
};
// 未使用
itsmo.lib.map_error_close = function(title,text,cookie) {
itsmo.lib.map_windowclose();
};
//------------------------------------------------
// エラーメッセージ小窓表示
// param kbn エラー区分(W,E,I)
// param errCd エラーコード
// param errPage エラーページ(itsmo.vars.pagesのキー)
// param setData 動的メッセージ内容
// param cookie cookieのキー
// param func callback関数
//------------------------------------------------
itsmo.lib.aplErrorWindow = function(kbn, errCd, errPage, setData, cookie, func)
{
// エラーメッセージ取得
$.getJSON(
'/files/errorlist.json',
null,
function(json) {
// エラーログ出力
// err = kbn + ":" + errCd + ":" + errPage;
// if (kbn != 'I') $.get('/apl_log.php', { d: err }, function() {});
$.each(json.errors, function(i, item){
code = kbn + errCd;
if (code == item.errcd) {
title = item.title.replace('{page}', itsmo.vars.pages[errPage]);
message = item.message.replace('{prm}', setData);
// 表示ウィンドウ判別
switch (kbn) {
case 'W':
case 'E':
itsmo.lib.map_error(title, message, func);
break;
case 'I':
itsmo.lib.map_alert(title, message, cookie, func);
break;
}
}
});
}
);
};
// 携帯リンクurl作成
itsmo.lib.getLinkMobileUrl = function(lat,lon,lvl) {
if (lat < 10000) {
lat = itsmo.lib.toMilliSec({
lat: lat,
lon: lon
});
lon = lat.lon;
lat = lat.lat;
}
var prm = lat + '-' + lon + '-' + itsmo.lib.map_changeLvl(lvl);
var txt = itsmo.vars.d_mobile_maptolink + 'p1?' + prm ;
return txt;
};
// ガイド用リンクurl作成
itsmo.lib.getLinkItsmoUrl = function(lat,lon,lvl) {
var prm = 'z-' + lat + '-' + lon + '-' + lvl;
// var txt = 'http://' + itsmo.vars.d_host_www + '/' + prm + '.htm';
var txt = 'https://www.its-mo.com/' + prm + '.htm';
return txt;
};
// 携帯へ
itsmo.lib.openLinkMobile = function(lat,lon,lvl) {
var txt = itsmo.lib.getLinkMobileUrl(lat,lon,lvl);
$('#ajax_map_jmap_mtext').val(txt);
$('#ajax_map_jmap_mmail').attr('href','mailto:?BODY=' + encodeURIComponent(txt));
$('#ajax_map_jmap_barcode').attr('src',itsmo.vars.d_qrimg_url+'?d=' + txt);
itsmo.lib.map_windowopen('mobile_send_window');
};
// 携帯用縮尺変換
itsmo.lib.map_changeLvl = function(lvl)
{
var mlvl = {};
mlvl['1'] = '1';
mlvl['2'] = '1';
mlvl['3'] = '1';
mlvl['4'] = '1';
mlvl['5'] = '1';
mlvl['6'] = '1';
mlvl['7'] = '1';
mlvl['8'] = '1';
mlvl['9'] = '2';
mlvl['10'] = '3';
mlvl['11'] = '4';
mlvl['12'] = '5';
mlvl['13'] = '6';
mlvl['14'] = '7';
mlvl['15'] = '7';
mlvl['16'] = '8';
mlvl['17'] = '8';
mlvl['18'] = '9';
return mlvl[lvl];
};
//フリーワード検索
itsmo.lib.freewdSubmit = function(form_id,cat) {
var freewd = $('#' + form_id +' input[name=w]').val();
if(freewd == itsmo.vars.g_freeWordComment[cat]){
freewd = "";
$('#' + form_id +' input[name=w]').val('');
}
let data ={};
data.nm = itsmo.lib.document_getvalue('freewd');
itsmo.lib.localstorage_set(data);
var path = location.pathname;
var paths = path.split('/');
if (paths[1] == 'c' || paths[1] == 'map') {
path = '/'+paths[1]+'/';
} else {
path = '/'+paths[1]+'/'+paths[2]+'/';
}
// Remove Google Analytics
// _gaq.push(['_trackEvent', 'フリーワード', path, freewd, , true]);
var flg = true;
if(freewd.length > 30){
flg = false;
alert('30文字以内で入力してください');
return false;
}
if (flg) {
$('#' + form_id).attr("action", '/search/freeword/');
}
};
/** ミリ秒から十進度形式へ */
itsmo.lib.toLatLon = function(lat, lon) {
if (lat instanceof Object && typeof lat.lat !== 'undefined' && typeof lat.lon !== 'undefined') {
lon = lat.lon;
lat = lat.lat;
}
lat /= 60 * 60 * 1000;
lon /= 60 * 60 * 1000;
return new ZDC.LatLon(lat, lon);
};
/** 十進度形式からミリ秒へ。ミリ秒形式のものはそのまま object 形式にして返す。 */
itsmo.lib.toMilliSec = function(lat, lon) {
if (typeof lon == 'undefined') {
lon = lat.lon;
lat = lat.lat;
}
lat = parseFloat(lat);
lon = parseFloat(lon);
if (lat < 100000000) {
lat = Math.floor(lat * 60 * 60 * 1000);
lon = Math.floor(lon * 60 * 60 * 1000);
}
return {
lat: lat,
lon: lon
};
};
// 距離算出
itsmo.lib.getDistance = function(flat, flon, tlat, tlon) {
var dist = parseInt(itsmo.lib.getDistance2(flat, flon, tlat, tlon) / 1000);
return dist;
};
// 距離算出
itsmo.lib.getDistance2 = function(flat, flon, tlat, tlon) {
var fpoint = new itsmo.lib.toLatLon(flat, flon); // from
var tpoint = new itsmo.lib.toLatLon(tlat, tlon); // to
var dist = ZDC.getLatLonToLatLonDistance(fpoint, tpoint);
return dist;
};
//------------------------------------------------
// 先頭文字50音チェック
//------------------------------------------------
// return 50音id
itsmo.lib.initCheck = function(nm)
{
var init = nm.substr(0,1);
if(('アイウエオ').indexOf(init) != -1 || ('あいうえお').indexOf(init) != -1){
return 1;
}else if(('カキクケコ').indexOf(init) != -1 || ('かきくけこ').indexOf(init) != -1 || ('ガギグゲゴ').indexOf(init) != -1 || ('ガギグゲゴ').indexOf(init) != -1){
return 2;
}else if(('サシスセソ').indexOf(init) != -1 || ('さしすせそ').indexOf(init) != -1 || ('ザジズゼゾ').indexOf(init) != -1 || ('ざじずぜぞ').indexOf(init) != -1){
return 3;
}else if(('タチツテト').indexOf(init) != -1 || ('たちつてと').indexOf(init) != -1 || ('ダヂヅデド').indexOf(init) != -1 || ('だぢづでど').indexOf(init) != -1){
return 4;
}else if(('ナニヌネノ').indexOf(init) != -1 || ('なにぬねの').indexOf(init) != -1){
return 5;
}else if(('ハヒフヘホ').indexOf(init) != -1 || ('はひふへほ').indexOf(init) != -1 || ('バビブベボ').indexOf(init) != -1 || ('ばびぶべぼ').indexOf(init) != -1 || ('パピプペポ').indexOf(init) != -1 || ('ぱぴぷぺぽ').indexOf(init) != -1){
return 6;
}else if(('マミムメモ').indexOf(init) != -1 || ('まみむめも').indexOf(init) != -1){
return 7;
}else if(('ヤユヨ').indexOf(init) != -1 || ('やゆよ').indexOf(init) != -1){
return 8;
}else if(('ラリルレロ').indexOf(init) != -1 || ('らりるれろ').indexOf(init) != -1){
return 9;
}else if(('ワヲン').indexOf(init) != -1 || ('わをん').indexOf(init) != -1){
return 10;
}else{
return 9999;
}
};
// カンマ区切り
itsmo.lib.setComma = function(str)
{
while (str != (str = str.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
return str;
};
// 画像がくずれるので高さ調整
itsmo.lib.chgWidth = function(e){
var tmpImg = new Image();
tmpImg.src = e.src;
if(tmpImg.width <= tmpImg.height){
//$(e).width(56);
e.width=56;
}else if(tmpImg.width > tmpImg.height){
//$(e).height(56);
e.height=56;
}else{
e.width=56;
//$(e).width(56);
}
};
/**
* はいろーぜ通信処理
*
* @param void
* @return void
* @access public
*/
itsmo.vars.g_mysnspost_con = 0;
itsmo.lib.dispHighrose = function(url)
{
var useSSL = 'https:' == document.location.protocol;
// 直前URL保持
if (itsmo.vars.g_mysnspost_con == 1) {
// SNS投稿設定画面から遷移時、マイページURL保存
if(useSSL){
itsmo.lib.cookie_set('cktg_lasturl', 'https://' + itsmo.vars.d_host_www + '/map/mypage/');
}else{
itsmo.lib.cookie_set('cktg_lasturl', 'http://' + itsmo.vars.d_host_www + '/map/mypage/');
}
itsmo.vars.g_mysnspost_con = 0;
} else if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
// ログアウト・会員登録以外から遷移時、直前のURL保存
itsmo.lib.cookie_set('cktg_lasturl', document.URL);
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
location.href = url;
};
/**
* はいろーぜ通信処理(スマホ用)
*
* @param void
* @return void
* @access public
*/
itsmo.lib.dispHighroseSmart = function(url, elem, ref)
{
itsmo.lib.cookie_del('login_ref');
var useSSL = 'https:' == document.location.protocol;
// 直前URL保持
if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
if (document.referrer=="" || document.referrer.indexOf('dcm') >= 0 || document.URL.indexOf('sync') >= 0 || document.referrer.indexOf('/login')) {
if(useSSL){
itsmo.lib.cookie_set("cktg_lasturl", 'https://'+itsmo.vars.d_host_www);
}else{
itsmo.lib.cookie_set("cktg_lasturl", 'http://'+itsmo.vars.d_host_www);
}
if(ref)
itsmo.lib.cookie_set('login_ref', ref);
}else{
itsmo.lib.cookie_set("cktg_lasturl", document.referrer);
}
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.redirect = function(url, element, returnUrl){
itsmo.lib.cookie_del('login_ref');
if(typeof(returnUrl) == 'undefined')
returnUrl = itsmo.vars.d_host_www;
itsmo.lib.cookie_set('cktg_lasturl', returnUrl);
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(element).attr('href', url);
};
/**
* はいろーぜ通信処理(スマホ用)
*
* @param void
* @return void
* @access public
*/
itsmo.lib.dispHighroseSmartMypage = function(url, elem)
{
if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
itsmo.lib.cookie_set("cktg_lasturl", document.URL);
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.flagGotoMap = true;
itsmo.lib.set_caution_map=function(name){
if (itsmo.lib.flagGotoMap) {
if (itsmo.lib.cookie_get('map_caution').length !="") {
var check_caution=JSON.parse(itsmo.lib.cookie_get('map_caution'));
check_caution[name]=1;
itsmo.lib.cookie_set('map_caution',JSON.stringify(check_caution),31536000);
}else{
var map_caution = { map_nomal: 0, map_transit: 0 ,map_landmark:0,map_sightseeing:0,map_lasttrain:0 };
itsmo.lib.cookie_set('map_caution',JSON.stringify(map_caution),31536000);
var check_caution=JSON.parse(itsmo.lib.cookie_get('map_caution'));
check_caution[name]=1;
itsmo.lib.cookie_set('map_caution',JSON.stringify(check_caution),31536000);
}
}
};
itsmo.lib.redirect_map_caution=function(name){
if(name=='normal'|| name ==""){
itsmo.lib.set_caution_map('map_nomal');
}
if(name=='transit'){
itsmo.lib.set_caution_map('map_transit');
}
if(name=='lasttrain'){
itsmo.lib.set_caution_map('map_lasttrain');
}
if(name=='landmark'){
itsmo.lib.set_caution_map('map_landmark');
}
if(name=='tourist'){
itsmo.lib.set_caution_map('map_sightseeing');
}
};
itsmo.lib.url_redirect=function(goback){
if (itsmo.lib.cookie_get('url_redirect').length !="" || itsmo.lib.cookie_get('url_redirect')==undefined){
window.location.href=itsmo.lib.cookie_get('url_redirect');
itsmo.lib.cookie_del('url_redirect');
}else{
window.location.href=goback;
}
};
itsmo.lib.clear_url_redirect=function(goback){
itsmo.lib.cookie_del('url_redirect');
if(typeof(goback) != 'undefined' && goback == false){
} else {
window.location.href=goback;
}
};
itsmo.lib.strToTime = function (text, now){
function strtotime(text, now) {
// discuss at: http://phpjs.org/functions/strtotime/
// version: 1109.2016
// original by: Caio Ariede (http://caioariede.com)
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// improved by: Caio Ariede (http://caioariede.com)
// improved by: A. Matías Quezada (http://amatiasq.com)
// improved by: preuter
// improved by: Brett Zamir (http://brett-zamir.me)
// improved by: Mirko Faber
// input by: David
// bugfixed by: Wagner B. Soares
// bugfixed by: Artur Tchernychev
// note: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
// example 1: strtotime('+1 day', 1129633200);
// returns 1: 1129719600
// example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200);
// returns 2: 1130425202
// example 3: strtotime('last month', 1129633200);
// returns 3: 1127041200
// example 4: strtotime('2009-05-04 08:30:00 GMT');
// returns 4: 1241425800
var parsed, match, today, year, date, days, ranges, len, times, regex, i, fail = false;
if (!text) {
return fail;
}
// Unecessary spaces
text = text.replace(/^\s+|\s+$/g, '')
.replace(/\s{2,}/g, ' ')
.replace(/[\t\r\n]/g, '')
.toLowerCase();
// in contrast to php, js Date.parse function interprets:
// dates given as yyyy-mm-dd as in timezone: UTC,
// dates with "." or "-" as MDY instead of DMY
// dates with two-digit years differently
// etc...etc...
// ...therefore we manually parse lots of common date formats
match = text.match(
/^(\d{1,4})([\-\.\/\:])(\d{1,2})([\-\.\/\:])(\d{1,4})(?:\s(\d{1,2}):(\d{2})?:?(\d{2})?)?(?:\s([A-Z]+)?)?$/);
if (match && match[2] === match[4]) {
if (match[1] > 1901) {
switch (match[2]) {
case '-':
{ // YYYY-M-D
if (match[3] > 12 || match[5] > 31) {
return fail;
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // YYYY.M.D is not parsed by strtotime()
return fail;
}
case '/':
{ // YYYY/M/D
if (match[3] > 12 || match[5] > 31) {
return fail;
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
}
} else if (match[5] > 1901) {
switch (match[2]) {
case '-':
{ // D-M-YYYY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // D.M.YYYY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '/':
{ // M/D/YYYY
if (match[1] > 12 || match[3] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
}
} else {
switch (match[2]) {
case '-':
{ // YY-M-D
if (match[3] > 12 || match[5] > 31 || (match[1] < 70 && match[1] > 38)) {
return fail;
}
year = match[1] >= 0 && match[1] <= 38 ? +match[1] + 2000 : match[1];
return new Date(year, parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // D.M.YY or H.MM.SS
if (match[5] >= 70) { // D.M.YY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
if (match[5] < 60 && !match[6]) { // H.MM.SS
if (match[1] > 23 || match[3] > 59) {
return fail;
}
today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0, match[9] || 0) / 1000;
}
return fail; // invalid format, cannot be parsed
}
case '/':
{ // M/D/YY
if (match[1] > 12 || match[3] > 31 || (match[5] < 70 && match[5] > 38)) {
return fail;
}
year = match[5] >= 0 && match[5] <= 38 ? +match[5] + 2000 : match[5];
return new Date(year, parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case ':':
{ // HH:MM:SS
if (match[1] > 23 || match[3] > 59 || match[5] > 59) {
return fail;
}
today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0) / 1000;
}
}
}
}
// other formats and "now" should be parsed by Date.parse()
if (text === 'now') {
return now === null || isNaN(now) ? new Date()
.getTime() / 1000 | 0 : now | 0;
}
if (!isNaN(parsed = Date.parse(text))) {
return parsed / 1000 | 0;
}
date = now ? new Date(now * 1000) : new Date();
days = {
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,
'thu': 4,
'fri': 5,
'sat': 6
};
ranges = {
'yea': 'FullYear',
'mon': 'Month',
'day': 'Date',
'hou': 'Hours',
'min': 'Minutes',
'sec': 'Seconds'
};
function lastNext(type, range, modifier) {
var diff, day = days[range];
if (typeof day !== 'undefined') {
diff = day - date.getDay();
if (diff === 0) {
diff = 7 * modifier;
} else if (diff > 0 && type === 'last') {
diff -= 7;
} else if (diff < 0 && type === 'next') {
diff += 7;
}
date.setDate(date.getDate() + diff);
}
}
function process(val) {
var splt = val.split(' '), // Todo: Reconcile this with regex using \s, taking into account browser issues with split and regexes
type = splt[0],
range = splt[1].substring(0, 3),
typeIsNumber = /\d+/.test(type),
ago = splt[2] === 'ago',
num = (type === 'last' ? -1 : 1) * (ago ? -1 : 1);
if (typeIsNumber) {
num *= parseInt(type, 10);
}
if (ranges.hasOwnProperty(range) && !splt[1].match(/^mon(day|\.)?$/i)) {
return date['set' + ranges[range]](date['get' + ranges[range]]() + num);
}
if (range === 'wee') {
return date.setDate(date.getDate() + (num * 7));
}
if (type === 'next' || type === 'last') {
lastNext(type, range, num);
} else if (!typeIsNumber) {
return false;
}
return true;
}
times = '(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec' +
'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?' +
'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)';
regex = '([+-]?\\d+\\s' + times + '|' + '(last|next)\\s' + times + ')(\\sago)?';
match = text.match(new RegExp(regex, 'gi'));
if (!match) {
return fail;
}
for (i = 0, len = match.length; i < len; i++) {
if (!process(match[i])) {
return fail;
}
}
// ECMAScript 5 only
// if (!match.every(process))
// return false;
return (date.getTime() / 1000);
}
return strtotime(text, now);
};
itsmo.lib.getMapImgLink = function (latLon, lvl, wh, center){
latLon = itsmo.lib.toMilliSec(latLon);
var mapImageLink = '/map.php?lvl=' + lvl;
mapImageLink += '&lat=' + latLon.lat + '&lon=' + latLon.lon;
mapImageLink += '&w=' + wh.width + '&h=' + wh.height;
if(center){
mapImageLink += '&icn=link02:' + latLon.lat + ':' + latLon.lon;
}
mapImageLink += '&nc=1';
return mapImageLink;
};
itsmo.lib.getBaseURL = function (){
// entire url including querystring - also: window.location.href;
var url = location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));
if (baseURL.indexOf('https://localhost') != -1) {
// Base Url for localhost
var url = location.href; // window.location.href;
var pathname = location.pathname; // window.location.pathname;
var index1 = url.indexOf(pathname);
var index2 = url.indexOf("/", index1 + 1);
var baseLocalUrl = url.substr(0, index2);
return baseLocalUrl + "";
} else {
// Root Url for domain name
return baseURL + "";
}
};
itsmo.lib.getQRCodeLink = function (txt, size){
var qrCodeLink = itsmo.vars.d_qrimg_url + '?d=' + txt;
if(size){
qrCodeLink += '&s=' +size;
}
return qrCodeLink;
};
itsmo.lib.share = {};
itsmo.lib.share.facebookPC = function(title){
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
var app_id = 'app_id=' + '268920203204669' + '&';
var redirect_uri = 'redirect_uri=https://facebook.com&';
var display = 'display=page&';
var _link = 'link=' + url + '&';
var name = 'name=' + title + '&';
var description = 'description=' + url + '&';
var picture = '&picture=https://www.its-mo.com/design/img/smart/bookmark.png&';
var sdk = 'sdk=joey';
var https = 'https://facebook.com/dialog/feed?' + app_id + redirect_uri + picture + name + description + _link + display + sdk;
window.open(https, '_blank');
};
itsmo.lib.share.twitterPC = function(title){
var href = 'https://twitter.com/share?text=';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' +'&url=' + url;
window.open(href, '_blank');
};
itsmo.lib.share.facebookSP = function(title){
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
var baseURL = itsmo.lib.getBaseURL();
var app_id = 'app_id=' + '268920203204669' + '&';
var redirect_uri = 'redirect_uri=' + baseURL + '/c/close_popup.php&';
var display = 'display=touch&';
var _link = 'link=' + url + '&';
var name = 'name=' + title + '&';
var description = 'description=' + url + '&';
var picture = '&picture=https://www.its-mo.com/design/img/smart/bookmark.png&';
var sdk = 'sdk=joey';
var https = 'https://m.facebook.com/dialog/feed?' + app_id + redirect_uri + picture + name + description + _link + display + sdk;
wind = window.open(https, "_blank", "width=450, height=450");
wind.onBeforeUnload = function () {
window.close();
};
};
itsmo.lib.share.twitterSP = function(title){
var href = 'https://twitter.com/share?text=';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' +'&url=' +url;
var width = 400,
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(href, 'twitter', opts);
};
itsmo.lib.share.line = function (title) {
var href = 'https://line.naver.jp/R/msg/text/?';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' + url;
window.open(href);
};
itsmo.lib.share.mail = function (title) {
var url = window.location.href;
var mailTo = 'mailto:?body= %0a %0a' + title + '%0a' + encodeURI(url);
window.location.href = mailTo;
};
itsmo.lib.addHistoryFWSearch = function (word, url, key, active, limit) {
if (typeof limit == 'undefined' || limit == null) {
limit = 10;
}
if (typeof(url) !='undefined'){
if(url.length > 0){
word = [word,url,key];
if(active == 'active'){
word.push(active);
}
}
}
var historyArray = null;
historyArray = itsmo.lib.cookie_get('historyFWSearch');
if (historyArray != "") {
historyArray = JSON.parse(historyArray);
}
var ret = [];
if (word.length >= 1) {
ret.push(word);
}
if (historyArray != null) {
$.each(historyArray, function (i, v) {
if(Array.isArray(word) && Array.isArray(v)){
if (v[0] == word[0]) {
return;
}
}
if(Array.isArray(word)){
if (v == word[0]) {
return;
}
}
if(Array.isArray(v)){
if (v[0] == word) {
return;
}
}
if (v == word) {
return;
}
if (v.length <= 0) {
return;
}
ret.push(v);
if (ret.length >= limit) {
return false;
}
});
}
if (ret != null) {
ret = JSON.stringify(ret);
itsmo.lib.cookie_set('historyFWSearch', ret);
}
};
itsmo.lib.highroseLoginRedirect = function(url, elem, callbackURL) {
itsmo.lib.cookie_del('login_ref');
if(typeof(callbackURL) == 'undefined'){
callbackURL = itsmo.vars.d_host_www;
}
var useSSL = 'https:' == document.location.protocol;
if(useSSL){
itsmo.lib.cookie_set("cktg_lasturl", 'https://'+itsmo.vars.d_host_www + callbackURL);
}else{
itsmo.lib.cookie_set("cktg_lasturl", 'http://'+itsmo.vars.d_host_www + callbackURL);
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.getCurrentAddress = function (currentStarting) {
if (undefined === currentStarting) {
currentStarting = false;
}
window.currentStarting = currentStarting;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(itsmo.lib.getCurrentAddressCallback, itsmo.lib.redirectTaxiError);
} else {
window.location.href = '/taxi/error';
}
};
itsmo.lib.getCurrentAddressCallback = function(position) {
var latlon = new ZDC.LatLon(position.coords.latitude, position.coords.longitude);
latlon = ZDC.wgsTotky(latlon);
var lat = latlon.lat;
var lon = latlon.lon;
var f = latlon.f;
var h = latlon.h;
$.ajax({
type:"GET",
url: '/map/right_click.php',
dataType:"json",
cache: false,
crossDomain: true,
headers: {
'X-Suggest-Auth':'NINAVW'
},
data:{lat:lat, lon:lon , f:f, h:h},
success: function(data) {
if (!(data.err == 1 || data[0] == null)) {
var currentAddr = data[0].address.text;
var currentAddrLat = Math.round(data[0].address.point.lat * 3600 * 1000);
var currentAddrLon = Math.round(data[0].address.point.lon * 3600 * 1000);
itsmo.lib.linkToTaxiFare(currentAddr, currentAddrLat, currentAddrLon);
} else {
window.location.href = '/taxi/error';
}
}
});
};
itsmo.lib.linkToTaxiFare = function(currentAddr, currentAddrLat, currentAddrLon) {
var facilityInfo = $('#facility-info').val();
if(currentAddr != '' && currentAddrLat != '' && currentAddrLon != '') {
var strUrl = '/taxi/?getin=' + facilityInfo + '&getoff=' + currentAddr + '_' + currentAddrLat + '_' + currentAddrLon;
if (window.currentStarting) {
strUrl = '/taxi/?getin=' + currentAddr + '_' + currentAddrLat + '_' + currentAddrLon + '&getoff=' + facilityInfo;
}
window.location.href = strUrl;
}
};
itsmo.lib.redirectTaxiError = function(error) {
window.location.href = '/taxi/error';
}
itsmo.sub = {};
//------------------------------------------------
// クリッカブルレイヤー関係
//------------------------------------------------
itsmo.sub.getHtmlSize = function(html) {
var sz = $('#idCalcSize').html(html);
sz = new ZDC.WH(sz.outerWidth({margin: true}), sz.outerHeight({margin: true}));
return sz;
};
//小吹き出し作成
itsmo.vars.g_map_tipid_clickable_s = {};
itsmo.sub.set_tooltip_s = function(tipHtml, data)
{
var clat = data.lat;
var clon = data.lon;
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var i = itsmo.vars.g_map_search_location;
if ( clat == '') {
clat = i.lat;
}
if ( clon == '') {
clon = i.lon;
}
var offset= new ZDC.Pixel(-10, -10);
var sz = itsmo.sub.getHtmlSize(tipHtml);
if (typeof data.tooltipOffset !== 'undefined') {
offset = data.tooltipOffset;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(clat, clon), {
html: tipHtml,
size: sz,
offset: offset
});
var id = itsmo.vars.g_map_layer_clickable.add( tip );
data['tip_id'] = id;
data.tipHtml = tipHtml;
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById( id );
itsmo.map.addEventTooltip(tip, itsmo.map.D_TIPZIDX_RANGE );
// config に合わせて再設定。
itsmo.sub.set_tooltip_s.setHtml(uid);
return div_id;
};
itsmo.sub.set_tooltip_s.setHtmlAll = function() {
$.each(itsmo.vars.g_map_tipid_clickable_s, function(i, v) {
itsmo.sub.set_tooltip_s.setHtml(i);
});
};
itsmo.sub.set_tooltip_s.setHtml = function(uid) {
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if (typeof data.tipHtml === 'undefined') {
return;
}
var id = data.tip_id;
var tipHtml = data.tipHtml;
tipHtml = tipHtml.replace(/%%uid%%/g, '' + uid);
if (itsmo.vars.g_config.mapinfo_minimize != 0) {
tipHtml = tipHtml.replace('class="fukidasi0"', 'class="f-supper0"');
}
var sz = itsmo.sub.getHtmlSize(tipHtml);
var e = itsmo.vars.g_map_layer_clickable.get(id);
e.setHtml(tipHtml, sz);
};
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
itsmo.sub.map_clickable_tipopen = function(html,data) {
if (itsmo.vars.g_map_tipid_clickable_open_uid == data.uid) {
return;
}
itsmo.sub.map_clickable_tipclear();
var div_id = 'tip_o_' + data.uid;
html = '' + html + '
';
// ツールチップを作成
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: html,
//size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-10, -10)
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE + 3);
itsmo.vars.g_map_tipid_clickable_open_uid = data.uid;
itsmo.vars.g_map_tipid_clickable_open = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_tipid_clickable_open);
$("#"+ div_id +" span[class^='List-pic-waku'] img").error(function(){
itsmo.changeNoImageSrc(this);
});
return div_id;
};
//ツールチップclose
itsmo.sub.map_clickable_tipclose = function() {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
//itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
};
//ツールチップ(大)clear
itsmo.sub.map_clickable_tipclear = function() {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
};
//ツールチップ全部clear
itsmo.sub.map_clickable_TipAllClear = function(flg) {
if(itsmo.vars.g_map_tipid_clickable_open != null){
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
}
if(itsmo.vars.g_map_tipid_clickable_s){
jQuery.each(itsmo.vars.g_map_tipid_clickable_s, function(i,val) {
itsmo.vars.g_map_layer_clickable.removeById(val.tip_id);
});
}
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
itsmo.vars.g_map_tipid_clickable_s = {};
// 登録地点チップクリア
itsmo.myspot.myspot_TipAllClear();
if (flg) {
// 自宅チップ最小化
itsmo.mypage.home_closeballoon();
// IPリンクチップ最小化
itsmo.sub.map_maplink_tipclear();
}
itsmo.map.bus.clearAllBalloons();
itsmo.map.roadStation.clearResult();
itsmo.facilityNight.clearAllBalloons();
};
//------------------------------------------------
// overture
//------------------------------------------------
itsmo.vars.g_map_overture_moved = 9999999;
itsmo.sub.map_overture = function() {
// 表示用のスペースがテンプレに無い場合は処理しない
if($('#ajax_map_overture_header').length <= 0) return;
if(itsmo.vars.g_map_search_location_old != null) {
itsmo.vars.g_map_overture_moved += itsmo.lib.getDistance2(
itsmo.vars.g_map_search_location_old.lat, itsmo.vars.g_map_search_location_old.lon,
itsmo.vars.g_map_search_location.lat, itsmo.vars.g_map_search_location.lon);
}
if(itsmo.vars.g_map_overture_moved < 999000) {
// 表示
if(zSr != null && (itsmo.vars.g_map_overture_type == 'mapDef' || itsmo.vars.g_map_overture_type == 'mapContents')) {
if(zSr.length > 6) {
var descr = zSr[ 6]; // 説明文
var unused1 = zSr[ 7]; //
var clickURL = zSr[ 8]; // クリックURL
var title = zSr[ 9]; // タイトル
var sitehost = zSr[10]; // 表示URL
var unused2 = zSr[11]; //
// 表示
var e = $('#ajax_map_overture_header div.map_header-over');
e.find('a:first').attr('href', clickURL);
e.find('span.over-title:first').html(title);
e.find('span.over-des:first').html(descr);
$('#ajax_map_overture_header div.map_header2').show();
/*
tmp = ''
itsmo.lib.document_setvalue('ajax_map_overture_header',tmp);
itsmo.lib.document_on('ajax_map_over_div');
*/
}
itsmo.vars.g_map_overture_type = null;
}
} else {
// 更新
itsmo.vars.g_map_overture_moved = 0;
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, function(result) {
if(result.status == 0) {
itsmo.sub.map_overture_request(null,result.items[0].addrCode,1,'mapDef');
} else {
itsmo.sub.map_overture_request(null,'00',1,'mapDef');
}
setTimeout(itsmo.sub.map_overture, 1 * 1000);
},1);
}
};
// 通信メイン処理
itsmo.vars.g_map_overture_obj = null;
itsmo.vars.g_map_overture_type = null;
var zSr = null;
itsmo.sub.map_overture_request = function(word,id,cnt,type) {
itsmo.vars.g_map_overture_type = type;
// 通信先作成
js = '//im.ov.yahoo.co.jp/js_flat/?source=zenrin_jp_itsumo_im&outputCharEnc=utf8&keywordCharEnc=utf8';
js += "&ctxtUrl="+encodeURI(document.URL);
if(document.referrer) js += "&ref="+encodeURI(document.referrer);
if(word != null) js += "&ctxtKeywords="+encodeURI(word);
if(id != null) js += "&ctxtId=ad"+id;
js += "&maxCount="+cnt;
js += "&type="+itsmo.vars.g_map_overture_type;
// json
if(itsmo.vars.g_map_overture_obj != null) {
document.getElementsByTagName("head").item(0).removeChild(itsmo.vars.g_map_overture_obj);
delete itsmo.vars.g_map_overture_obj;
}
itsmo.vars.g_map_overture_obj = document.createElement('script');
itsmo.vars.g_map_overture_obj.setAttribute('type', 'text/javascript');
itsmo.vars.g_map_overture_obj.setAttribute('charset', 'utf-8');
itsmo.vars.g_map_overture_obj.setAttribute('src', js);
document.getElementsByTagName('head').item(0).appendChild(itsmo.vars.g_map_overture_obj);
};
// スクロール完了時に im を出す時に呼ぶ関数。
itsmo.sub.map_overture_by_scrollend = function() {
// 住所を取得。
ZDC.Search.getAddrByLatLon({
latlons: [itsmo.lib.toLatLon(itsmo.vars.g_map_search_location)]
}, itsmo.sub.map_overture_by_scrollend_callback);
};
itsmo.sub.map_overture_by_scrollend_callback = function(status, result) {
if (status.code == '000' && result.length >= 1) {
} else {
return;
}
// 取得成功
var pref = '0', addr = '';
pref = result[0].address.code;
addr = result[0].address.text;
s = '0000' + parseInt(pref.substring(0, 5), 10);
s = s.substring(s.length - 5);
var id = 'ad' + s;
var type = 'mapDef';
var freewd = '';
var num = 1;
var url = itsmo.ad.make_im_url(num, freewd, id, type);
$.ajax({
type: "GET",
url: url,
cache: false,
dataType: "jsonp",
async: false,
timeout: 60000,
error: function(xhr, textStatus, errorThrown) {
// TODO:エラーの場合のログは?
},
success: itsmo.sub.map_overture_set
});
};
itsmo.sub.map_overture_set = function(json) {
var e = $('#ajax_map_overture_header div.map_header-over');
json = json['Results']['ResultSet'];
e.find('a:first').attr('href', json['Listing'][0]['ClickUrl']);
e.find('span.over-title:first').text(json['Listing'][0]['title']);
e.find('span.over-des:first').text(json['Listing'][0]['description']);
e.find('a.over-right-link:first').attr('href', json['Label']['InquiryUrl']).text(json['Label']['LabelText']);
$('#ajax_map_overture_header div.map_header2').show();
};
//------------------------------------------------
// 選択カーソル設置
//------------------------------------------------
itsmo.vars.g_map_setcursor_id = null;
itsmo.vars.g_map_setcursor_lat = null;
itsmo.vars.g_map_setcursor_lon = null;
itsmo.vars.g_map_setcursor_icon = null;
itsmo.sub.map_setcursor = function(lat,lon,icon) {
if(icon == null) icon = 'link02';
if(itsmo.vars.g_map_setcursor_id != null) itsmo.vars.g_map_layer_vics.removeById(itsmo.vars.g_map_setcursor_id);
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = icon;
var html = '
';
$pixX = -11;
$pixY = -30;
// 「ここ」アイコン画像サイズ変更に伴い、オフセット値調整
// (link02のみの対応、他タイプは従来通り-11,-30のオフセット) 2013/08/30 konishi
if (icon == 'link02') {
$pixX = -13;
$pixY = -32;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(lat, lon), {
html: html,
size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel($pixX, $pixY)
});
itsmo.vars.g_map_setcursor_id = itsmo.vars.g_map_layer_vics.add(tip);
itsmo.vars.g_map_layer_vics.showById(itsmo.vars.g_map_setcursor_id);
};
//------------------------------------------------
// エリアマッチ広告
//------------------------------------------------
itsmo.sub.map_ad_areamatch_cookie_key = 'no_areamatch';
itsmo.sub.map_ad_areamatch = function() {
var s = itsmo.lib.cookie_get(itsmo.sub.map_ad_areamatch_cookie_key);
var is_visible = $('#id_area_match').is(':visible');
if ('1' == s && is_visible) {
is_visible = false;
itsmo.sub.map_ad_areamatch_close(true);
}
if (!is_visible) {
return false;
}
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'mode=ad_areamatch_wide&lat='+loc.lat+'&lon='+loc.lon;
itsmo.lib.XMLHttpRequest2_send('/map/ajax.php',itsmo.sub.map_ad_areamatch_result,'GET',prm);
};
itsmo.sub.map_ad_areamatch_result = function(result) {
var err = $('err', result).text();
if (!err) {
//return;
}
txt = $('name',result).text();
copy = $('copy',result).text();
img = $('imgfile',result).text();
url = $('url',result).text();
var e = $('#id_area_match');
var f = e.find('div');
e.find('a:first').attr('href', url);
e.find('img:first').attr('src', img);
if (copy.length <= 0) {
f.hide();
e.find('strong').text('');
e.find('span.font-gray2').text(txt);
} else {
f.show();
e.find('strong').text(txt);
e.find('span.font-gray2').text(copy);
}
};
itsmo.sub.map_ad_areamatch_close = function(no_cookie) {
if (true == no_cookie) {
} else {
itsmo.lib.cookie_set(itsmo.sub.map_ad_areamatch_cookie_key, '1', 24 * 60 * 60);
}
$('#id_area_match_closed').show();
$('#id_area_match').hide();
return false;
};
itsmo.sub.map_ad_areamatch_open = function() {
itsmo.lib.cookie_del(itsmo.sub.map_ad_areamatch_cookie_key);
$('#id_area_match_closed').hide();
$('#id_area_match').show();
itsmo.sub.map_ad_areamatch(); // 再取得
return false;
}
// ホットスポット広告
itsmo.sub.map_ad_hotspot = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'lat='+loc.lat+'&lon='+loc.lon;
itsmo.lib.XMLHttpRequest2_send('/map/ajax_ad_hotspot.php', itsmo.sub.map_ad_hotspot_result, 'GET', prm);
};
itsmo.sub.map_ad_hotspot_result = function(result) {
result = $(result);
var err = parseInt(result.find('err').text());
if (0 != err) {
return;
}
result = result.find('ad');
if (result.length <= 0) {
return;
}
var f = $('#ajax_ad_hotspot_keyword').show().find('div.List-coL-link span:gt(0)').hide();
var cnt = 0;
result.each(function() {
var n = cnt++;
if (n < f.length) {
} else {
return;
}
var s = $(this).text();
f.eq(n).show().find('a').text(s);
});
};
//------------------------------------------------
// おススメ情報
//------------------------------------------------
itsmo.vars.osusume_word = '';
itsmo.sub.map_osusume_search = function(shoki_flg,word,cnt,page) {
if ('10.dev-2nd.local' == location.hostname) {
return;
}
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'mode=osusume&lat='+loc.lat+'&lon='+loc.lon;
itsmo.sub.backBtnChangeHash(['osusume', shoki_flg ? 1 : 0, word, cnt, page]);
if(word){
prm = prm + '&word='+encodeURIComponent(word);
}
if(shoki_flg){
prm = prm + '&shoki_flg=1';
}else{
itsmo.lib.map_waitopen();
}
//if(cnt){ prm = prm + '&cnt=' + cnt; }
//if(page){ prm = prm + '&page=' + page; }
itsmo.lib.XMLHttpRequest2_send('/map/ajax.php',itsmo.sub.map_osusume_search_result,'GET',prm);
};
itsmo.sub.map_osusume_search_result = function(result) {
var err = $('err', result).text();
if (err != null) {
//return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear();
//html
if($(result).find('left_html').text()){
itsmo.sub.map_tab_change('range');
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml($('left_html', result).text());
itsmo.vars.g_range_genre = 'osusume';
// インタレストマッチ広告を挿入
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, itsmo.range.im_getaddr, 1);
}
var set_tip = function (){
//param
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['gnr_nm'] = 'おすすめ情報';
prm['short_nm'] = $(this).find('short_nm').text()
prm['img'] = $(this).find('imgurl').text();
prm['url'] = $(this).find('url').text();
prm['iconL'] = $(this).find('iconL').text();
prm['iconM'] = $(this).find('iconM').text();
prm['iconS'] = $(this).find('iconS').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
//ツールチップ作成
var div_id = itsmo.sub.set_tooltip_s(prm['tip_c'],prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.sub.map_osusume_tip_open(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.sub.map_osusume_tip_open(prm.uid);
});
};
//チップ作成
$(result).find('item').each(set_tip);
};
//おすすめ情報中吹き出し
itsmo.sub.map_osusume_tip_open = function(uid) {
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if(!data){ return false; }
var div_id = itsmo.sub.map_clickable_tipopen(data.tip_o,data);
};
//おすすめ情報パカパカ
itsmo.sub.map_osusumeWindow = function(word){
if(word){
itsmo.vars.osusume_word = word;
$('#osusume_word').text(word);
}
$('#ajax_facet_gnr1_div').toggle();
};
//------------------------------------------------
// ナビ起動
//------------------------------------------------
itsmo.sub.map_linknavi = function() {
var url_prm = "/lib/itsmonavi/its-mo_ext_IF/its-mo_ext_IF.htm?cocd=00¶m1=2&datum=tokyo&unit=msec&point1=";
url_prm += itsmo.vars.g_map_search_box.minx + "/" + itsmo.vars.g_map_search_box.miny + "&point2=";
url_prm += itsmo.vars.g_map_search_box.maxx + "/" + itsmo.vars.g_map_search_box.maxy + "&icon=0&seach=0";
window.open(url_prm,"skin","width=586,height=623,toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=yes");
return;
};
//------------------------------------------------
// メニュータブの制御
//------------------------------------------------
itsmo.sub.map_syuhen_change = function(mode) {
// 変更
switch(mode) {
case 'max':
itsmo.lib.document_on('ajax_map_syuhen_max');
itsmo.lib.document_off('ajax_map_syuhen_min');
break;
case 'min':
itsmo.lib.document_off('ajax_map_syuhen_max');
itsmo.lib.document_on('ajax_map_syuhen_min');
break;
}
};
//------------------------------------------------
// メニュータブの制御
//------------------------------------------------
itsmo.vars.g_map_tab_mode = 'top';
itsmo.vars.g_map_tab_backBtnFuncNoAdd = false;
itsmo.sub.map_genre = function() {
itsmo.range.range_tipclear();
itsmo.myspot.myspot_clearballoon();
itsmo.sub.genre_research_clear();
itsmo.sub.map_tab_change('top');
$("#ajax_scrollable_4").height((itsmo.vars.g_windowHeight - itsmo.vars.PAGE_HEADER_HEIGHT - itsmo.vars.MAP_HEADER_HEIGHT));
};
itsmo.sub.map_tab_change = function(mode, nostop, backBtnFunc) {
// nostop=1:ジャンルクリアしない
if (typeof nostop == 'function' || nostop instanceof Array) {
backBtnFunc = nostop;
nostop = false;
} // 地点変更のイベント初期化
if (typeof backBtnFunc == 'undefined') {
backBtnFunc = null;
}
//itsmo.myspot.chengeClickMap();
var isShowRouteSearch = false;
if (itsmo.vars.g_myroute_cnt == 0){
itsmo.vars.routeSearchResultKeep = 0;
}else{
itsmo.vars.routeSearchResultKeep = 1;
}
// 変更
switch(mode) {
case 'top':// TOP
// リスト
itsmo.lib.document_on('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
$('.map-gunre-midle').hide();
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
backBtnFunc = ['top'];
break;
case 'range':// 周辺検索
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-'+mode);
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_'+mode);
//myspot_clear();
break;
case 'facnum':
case 'busDetail':
case 'michinoeki':
case 'bus':
case 'freeword'://フリーワード
case 'freewordaddr'://フリーワード
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-'+mode);
break;
case 'mypage':// マイページ
case 'myspot':// 登録地点
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','act');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
if (mode == 'mypage') {
// マイページデータ設定
itsmo.mypage.mypage();
} else if (mode == 'myspot') {
// 登録地点データ設定
itsmo.myspot.myspot_listget();
}
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
case 'addrlist':// 位置検索
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','act');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
case 'route':
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_on('ajax_leftmenu_route');
isShowRouteSearch = true;
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','act');
break;
default:
// リスト
itsmo.lib.document_on('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
}
if(!isShowRouteSearch){
if (itsmo.vars.routeSearchResultKeep == 0){
//Clear Route
itsmo.vars.g_myroute_panel_isvisible = 1;
itsmo.vars.g_route_tab_displayed = 0;
itsmo.myroute.showRoutePanel();
}
} else {
if(itsmo.vars.g_route_tab_displayed == 0){
if(itsmo.vars.routeKeep == 0){
itsmo.myroute.myroute_panel_change('close');
itsmo.vars.g_myroute_panel_isvisible = 0;
itsmo.myroute.showRoutePanel();
itsmo.vars.g_myroute_mode = '';
}
itsmo.vars.g_route_tab_displayed = 1;
itsmo.vars.routeKeep = 0;
if (backBtnFunc.length < 2 || backBtnFunc[1] == 'car'){
itsmo.myroute.myroute_car();
} else {
itsmo.myroute.myroute_all();
}
}
}
if (null == backBtnFunc && itsmo.vars.g_map_tab_mode != mode) {
backBtnFunc = function() {
itsmo.sub.map_tab_change(mode, nostop);
};
}
itsmo.vars.g_map_tab_mode = mode;
// 戻るボタン対応
do {
if (typeof backBtnFunc === 'undefined' || null == backBtnFunc) {
break;
}
if (typeof backBtnFunc.flgNoAdd !== 'undefined' && backBtnFunc.flgNoAdd) {
break;
}
if (itsmo.vars.g_map_tab_backBtnFuncNoAdd) {
break;
}
itsmo.sub.backBtnChangeHash(backBtnFunc);
} while(false);
};
itsmo.sub.map_tab_sethtml = function(html) {
itsmo.lib.document_setvalue('ajax_leftmenu_result', html);
$('#ajax_leftmenu_result .List-pic-waku img').error(function(){
itsmo.changeNoImageSrc(this);
});
itsmo.map.setLeftContentSize();
itsmo.ad.im_init();
};
itsmo.sub.map_tab_freewd_blur = function() {
itsmo.layout.freewordBlur('freewd','df');
};
itsmo.sub.map_tab_freewd_onfocus = function() {
itsmo.layout.freewordFocus('freewd','df');
};
/** 戻るボタン対応 */
itsmo.sub.backBtnChangeHash = function(args) {
if (null == args || args.length <= 0) {
return;
}
var s = '#' + args.shift();
$.each(args, function(i, v) {
if (typeof v == 'undefined') {
v = '';
} else {
if(itsmo.vars.g_map_tab_mode!="busDetail"){
v = encodeURIComponent('' + v);
}else{
v = decodeURIComponent('' + v);
}
}
s += ',' + v;
});
window.location.hash = s;
};
itsmo.sub.onHashChange = function(ev) {
itsmo.lib.XMLHttpRequest2_abortLast();
itsmo.lib.map_waitclose();
var cmd = 'top';
var s = window.location.hash;
if (s.length <= 0) {
} else {
s = s.substring(1);
s = s.split(',');
cmd = s.shift();
}
s = $.map(s, function(v, i) {
return decodeURIComponent(v);
});
itsmo.vars.g_map_tab_backBtnFuncNoAdd = true;
var ret = false;
switch (cmd) {
default:
ret = true;
break;
case 'top':
itsmo.sub.backBtnTop();
break;
case 'addrlist':
itsmo.sub.backBtnAddrlist(s);
break;
case 'hostspot':
itsmo.sub.backBtnHostspot(s);
break;
case 'freeword':
itsmo.sub.backBtnFreeword(s);
break;
case 'freewordaddr':
itsmo.sub.backBtnFreewordAddr(s);
break;
case 'mypage':
itsmo.sub.backBtnMypage(s);
break;
case 'myroute':
itsmo.sub.backBtnMyroute(s);
break;
case 'myspot':
itsmo.sub.backBtnMyspot(s);
break;
case 'baitoru':
itsmo.sub.backBtnBaitoru(s);
break;
case 'season':
itsmo.sub.backBtnSeason(s);
break;
case 'suumo':
itsmo.sub.backBtnSuumo(s);
break;
case 'tabikura':
itsmo.sub.backBtnTabikura(s);
break;
case 'spotDetail':
itsmo.sub.backBtnSpotDetail(s);
break;
case 'addrDetail':
itsmo.sub.backBtnAddrDetail(s);
break;
case 'osusume':
itsmo.sub.backBtnOsusume(s);
break;
case 'genre':
itsmo.sub.backBtnGenre(s);
break;
case 'new_building':
itsmo.sub.backBtnNewBuilding(s);
break;
case 'route':
itsmo.sub.backBtnRoute(s);
break;
case 'bus':
itsmo.sub.backBtnBusRoute(s);
break;
case 'michinoeki':
itsmo.sub.backBtnRoadStation(s);
break;
case 'busDetail':
itsmo.sub.backBtnBusDetail(s);
break;
case 'facnum':
itsmo.sub.backBtnFacnum(s);
}
itsmo.vars.g_map_tab_backBtnFuncNoAdd = false;
};
itsmo.sub.backBtnTop = function(args) {
itsmo.sub.map_genre();
};
//addrlist,pageType, adcd, rlat, rlon, radcd
itsmo.sub.backBtnAddrlist = function(args) {
if (args.length == 5) {
itsmo.addrlist.showPage(args[0], args[1], args[2], args[3], args[4]);
}
};
//hostspot,freeword
itsmo.sub.backBtnHostspot = function(args) {
if (args.length == 1) {
itsmo.ad.hotspot.search(args[0]);
}
};
//freeword,mode,word
itsmo.sub.backBtnFreeword = function(args) {
if (args.length == 2) {
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword(args[0], args[1]);
} else if(args.length == 3 && args[1] == BUS_SEARCH_KEYWORD){ //bus around from facility detail
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword(args[0], args[1], args[2]);
}
};
//freeword addr,word
itsmo.sub.backBtnFreewordAddr = function(args) {
if (args.length == 2) {
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword_other(args[1]);
}
};
//mypage,mode,word,page
itsmo.sub.backBtnMypage = function(args) {
if (args.length == 3) {
itsmo.mypage.mypage(args[0]);
}
};
//myroute,id
itsmo.sub.backBtnMyroute = function(args) {
if (args.length == 1) {
itsmo.myroute.myroute_open(args[0]);
}
};
//myspot
itsmo.sub.backBtnMyspot = function(args) {
if (args.length == 1) {
//myspot,p
itsmo.myspot.myspot_disp(args[0]);
} else if (args.length == 3) {
//myspot,id,fid,gid
itsmo.myspot.myspot_open(args[0], args[1], args[2]);
}
};
//baitoru
itsmo.sub.backBtnBaitoru = function(args) {
itsmo.near_baitoru.start();
};
//season,mode
itsmo.sub.backBtnSeason = function(args) {
itsmo.near_season.start(args[0]);
};
//suumo
itsmo.sub.backBtnSuumo = function(args) {
itsmo.near_suumo.start(args);
};
//tabikura
itsmo.sub.backBtnTabikura = function(args) {
itsmo.tabikura.start();
};
//spotDetail,uid,nm,action
itsmo.sub.backBtnSpotDetail = function(args) {
if (args.length == 3) {
itsmo.spot_range.detail_spot(args[0], args[1], args[2]);
}
};
//addrDetail,path,adcd
itsmo.sub.backBtnAddrDetail = function(args) {
if (args.length == 2) {
itsmo.spot_range.detail_addr(args[0], args[1]);
}
};
// osusume,shoki_flg,word,cnt,page
itsmo.sub.backBtnOsusume = function(args) {
itsmo.sub.map_osusume_search(parseInt(args[0], 10), args[1], args[2], args[3]);
};
// genre, genre, topGenreName, genreName
itsmo.sub.backBtnGenre = function(args) {
itsmo.range.range(args[0], args[1], args[2]);
};
itsmo.sub.backBtnNewBuilding = function(args) {
itsmo.near_new_building.start();
};
itsmo.sub.backBtnRoute = function(args){
if (args.length < 1){
itsmo.myroute.routeTop('car');
} else {
itsmo.myroute.routeTop(args[0]);
}
};
itsmo.sub.backBtnBusRoute = function (args){
if (args.length == 2){
itsmo.map.bus.busRouteSearch(args[0], args[1]);
}
};
itsmo.sub.backBtnRoadStation = function (args){
if (args.length == 2){
itsmo.map.roadStation.initSearch(args[0], args[1]);
}
};
itsmo.sub.backBtnBusDetail = function (args){
if (args.length == 2){
itsmo.map.bus.makeDetailBus(args[0], args[1]);
}
};
itsmo.sub.backBtnFacnum = function (args){
if (itsmo.facilityNight.vars.noResearch == false){
itsmo.facilityNight.initFacility();
itsmo.facilityNight.getFacilities();
} else {
itsmo.facilityNight.vars.noResearch = false;
}
};
//------------------------------------------------
// 色々なイベント
//------------------------------------------------
// マウス位置保持 --------------------------------
itsmo.vars.g_map_mouse_x = 0;
itsmo.vars.g_map_mouse_y = 0;
document.onmousemove = function(e) {
if (document.all) {
if ( null != window && undefined != window
&& null != document.body && undefined != document.body
&& null != window.event && undefined != window.event
){
itsmo.vars.g_map_mouse_x = window.event.clientX + document.body.scrollLeft;
itsmo.vars.g_map_mouse_y = window.event.clientY + document.body.scrollTop;
}
} else {
itsmo.vars.g_map_mouse_x = e.clientX;
itsmo.vars.g_map_mouse_y = e.clientY;
}
};
// 貼り付けマップ
itsmo.sub.map_linklink = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/link.php?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
window.open(url,null);
};
// 住宅地図の購入
itsmo.sub.ajax_mapjmapopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/jmap.php?lat='+loc.lat+'&lon='+loc.lon;
$('#ajax_map_window_jmap_book').attr('href' , url + '&mode=book');
$('#ajax_map_window_jmap_download').attr('href' , url+'&mode=download');
var url = 'http://mobile.znet-town.net/jmap/jmap.html?scd=00002&an='+loc.lat+'&ae='+loc.lon+'&geo=tokyo';
$('#ajax_map_window_jmap_mqr').attr('src',itsmo.vars.d_qrimg_url+'?d='+encodeURIComponent(url));
$('#ajax_map_window_jmap_mtext').val(url);
$('#ajax_map_window_jmap_mmail').attr('href','mailto:?BODY='+encodeURIComponent(url));
url = 'http://zapl.znet-town.net/znettownm/sp/naviweb.php?cpid=0002&ref=53&lon='+loc.lon+'&lat='+loc.lat;
$('#ajax_map_window_jmap_smpqr').attr('src',itsmo.vars.d_qrimg_url+'?d='+encodeURIComponent(url));
$('#ajax_map_window_jmap_smptext').val(url);
$('#ajax_map_window_jmap_smpmail').attr('href','mailto:?BODY='+encodeURIComponent(url));
$('#ajax_map_window_jmap_addr').text('住所取得中...');
itsmo.sub.map_getaddr(loc,function(result) {
if(result.status == 0) {
$('#ajax_map_window_jmap_addr').text(result.items[0].address);
} else {
$('#ajax_map_window_jmap_addr').text('住所なし');
}
},6);
itsmo.lib.map_windowopen('ajax_map_window_jmap');
$('#ajax_map_window_jmap .komado-box-w').scrollTop(0);
};
// IPリンク吹き出し作成
itsmo.vars.g_map_link_html_o = null;
itsmo.vars.g_map_link_tipid_c = null;
itsmo.vars.g_map_link_tipid_o = null;
itsmo.sub.maplink_set = function(lat, lon, icon)
{
// ココアイコンのみ作成
itsmo.sub.maplink_tipicon(lat, lon, icon);
if (!itsmo.vars.g_map_link_html_o) {
itsmo.vars.g_map_link_html_o = $('#maplink_tipo_html').html();
}
// 吹き出し+ココアイコン作成
// itsmo.sub.maplink_tipopen(lat, lon, icon, flg);
};
// ココアイコンのみ作成(小吹き出し)
itsmo.sub.maplink_tipicon = function(lat, lon, icon) {
if (icon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = 'link02';
} else {
if (lat && lon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
} else {
lat = itsmo.vars.g_map_setcursor_lat;
lon = itsmo.vars.g_map_setcursor_lon;
}
itsmo.vars.g_map_setcursor_icon = 'link02';
}
var html = $('#maplink_tipc_html').html();
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(lat, lon), {
html: html,
size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-12, -34)
});
tip.setZindex(itsmo.map.D_TIPZIDX_MAPLINK);
itsmo.vars.g_map_link_tipid_c = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_c);
};
// 吹き出し+ココアイコン作成(中吹き出し)
itsmo.sub.maplink_tipopen = function(lat, lon, icon) {
itsmo.map.cancelMapClickEvent();
// itsmo.sub.map_maplink_tipclear();
// 吹き出しデータ設定
if (icon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = 'link02';
} else {
if (lat && lon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
} else {
lat = itsmo.vars.g_map_setcursor_lat;
lon = itsmo.vars.g_map_setcursor_lon;
}
itsmo.vars.g_map_setcursor_icon = 'link02';
}
// ツールチップ作成
// var html = $('#maplink_tipo_html').html();
var html = itsmo.vars.g_map_link_html_o;
html = '' + html + '
';
var point = itsmo.lib.toLatLon(lat, lon);
var size = itsmo.sub.getHtmlSize(html);
var tip = new ZDC.UserWidget(point, {
html: html,
size: size,
offset: new ZDC.Pixel(-162, -(size.height) + 6)
});
tip.setZindex(itsmo.map.D_TIPZIDX_MAPLINK);
itsmo.vars.g_map_link_tipid_o = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_o);
// if (flg) itsmo.sub.maplink_tipclose();
};
// IPリンク吹き出しclose
itsmo.sub.maplink_tipclose = function()
{
itsmo.map.cancelMapClickEvent();
// itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_map_link_tipid_o);
itsmo.sub.map_maplink_tipclear();
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_c);
};
// IPリンク吹き出しclear
itsmo.sub.map_maplink_tipclear = function() {
if(itsmo.vars.g_map_link_tipid_o == null) return;
itsmo.map.cancelMapClickEvent();
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_link_tipid_o);
itsmo.vars.g_map_link_tipid_o = null;
};
// IPリンク アイコン+吹き出し Allclear
itsmo.sub.map_maplink_tipallclear = function() {
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_link_tipid_c);
itsmo.vars.g_map_link_tipid_c = null;
itsmo.vars.g_map_link_html_o = null;
itsmo.sub.map_maplink_tipclear();
};
// IPリンク吹き出し作成(住所系)
itsmo.sub.set_maplink_pre = function(name, addr, lat, lon, zipcode)
{
var sethtml_balo = $('#maplink_tipo_html');
sethtml_balo.find('#maplink-addr').html(addr);
sethtml_balo.find('#maplink-zipcode').html('〒' + zipcode);
//route
// 2017/04/12 Phuoc Le - #8434 Add dataLayer
var gaPre = "dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_";
var gaPost = "_ここアイコン']); return false;"
var jsStart = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereStart('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
var jsGoal = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereGo('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
var jsStopOver = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereByway('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
sethtml_balo.find('#maplink-here-start').attr('onclick', jsStart + gaPre + 'Start' + gaPost);
sethtml_balo.find('#maplink-here-go').attr('onclick', jsGoal + gaPre + 'Goal' + gaPost);
sethtml_balo.find('#maplink-here-stopover').attr('onclick', jsStopOver + gaPre + 'StopOver' + gaPost);
//share
var jsShare = "itsmo.map.Sharing.getInstance().show(" + lat + "," + lon + ",'" + name + "','" + addr + "');"
sethtml_balo.find('#maplink-share').attr('onclick', jsShare);
// 登録
var click_js = sethtml_balo.find('#maplink-reg').attr('onclick');
var arr_click_js = click_js.split(';');
$.each(arr_click_js, function (key, val) {
if (val.indexOf('other_addmyspot') > 0) {
click_js = "itsmo.myspot.other_addmyspot(" + lat + ", " + lon + ", '" + addr + "', '', '', '', '', '0000000000','','','',true)";
arr_click_js[key] = click_js;
return false;
}
});
click_js = arr_click_js.join(';');
sethtml_balo.find('#maplink-reg').attr('onclick', click_js);
// reg home
var click_js = sethtml_balo.find('#maplink-home').attr('onclick');
var arr_click_js = click_js.split(';');
$.each(arr_click_js, function (key, val) {
if (val.indexOf('home_add') > 0) {
click_js = "itsmo.mypage.mypage('home_add', {lat: " + lat + ", lon: " + lon + "});";
arr_click_js[key] = click_js;
return false;
}
});
click_js = arr_click_js.join(';');
sethtml_balo.find('#maplink-home').attr('onclick', click_js);
itsmo.vars.g_map_link_html_o = sethtml_balo.html();
itsmo.sub.maplink_set(lat, lon);
};
// 地図最適化用アイコン作成(小吹き出し)
itsmo.sub.set_tooltip_opt_s = function(tipHtml, data) {
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var sz = new ZDC.WH(22, 34);
var offset = new ZDC.Pixel(-12, -34);
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: tipHtml,
size: sz,//itsmo.sub.getHtmlSize(tipHtml),
offset: offset
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE);
data.noHideTip = true;
data.tip_id = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById(data.tip_id);
return div_id;
};
// 吹き出し+地図最適化用アイコン作成(中吹き出し)
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.sub.map_clickable_tipopen_opt = function(html, data) {
// 中吹き出し削除
var s = itsmo.vars.g_map_layer_clickable.get(itsmo.vars.g_map_tipid_clickable_open);
if (s && s.content) {
var close_tip_id = $(s.content.html).attr('id');
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
close_tip_id = close_tip_id.slice(6);
var close_data = itsmo.vars.g_map_tipid_clickable_s[close_tip_id];
// 小吹き出し表示
itsmo.vars.g_map_layer_clickable.showById(close_data.tip_id);
}
var div_id = 'tip_o_' + data.uid;
html = '' + html + '
';
// ツールチップ作成
var sz = itsmo.sub.getHtmlSize(html);
var offset = new ZDC.Pixel(-12, -34);
if (typeof data.tooltipOffset !== 'undefined') {
offset = data.tooltipOffset;
} else if (typeof data.tooltipOffsetBottomCenter !== 'undefined') {
offset = new ZDC.Pixel(-sz.width / 2 + data.tooltipOffsetBottomCenter[0], -sz.height + data.tooltipOffsetBottomCenter[1]);
} else {
offset.x = -sz.width / 2 + 18;
offset.y -= sz.height;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: html,
size: sz,
offset: offset
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE + 3);
itsmo.vars.g_map_tipid_clickable_open = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_tipid_clickable_open);
if (data.tip_id) {
if (data.noHideTip) {
} else {
itsmo.vars.g_map_layer_clickable.hideById(data.tip_id);
}
}
// bind
$('#' + div_id + ' a.icon-koko-pink').click(function() {
itsmo.sub.set_tooltip_aroundclose(data.tip_id);
});
// bind
$('#' + div_id + ' a.btn-close').click(function() {
itsmo.sub.set_tooltip_aroundclose(data.tip_id);
});
$("#"+ div_id +" span[class^='List-pic-waku'] img").error(function(){
itsmo.changeNoImageSrc(this);
});
};
// 地図最適化用周辺アイコン作成(小吹き出し)
itsmo.sub.set_tooltip_around = function(tipHtml, data) {
var clat = data.lat;
var clon = data.lon;
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var sz = new ZDC.WH(18, 26);
var offset = new ZDC.Pixel(-9, -23);
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(clat, clon), {
html: tipHtml,
size: sz,
offset: offset
});
var id = itsmo.vars.g_map_layer_clickable.add(tip);
data['tip_id'] = id;
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById( id );
return div_id;
};
// 地図最適化用周辺アイコン ツールチップclose
itsmo.sub.set_tooltip_aroundclose = function(tip_id) {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_layer_clickable.showById(tip_id);
itsmo.vars.g_map_tipid_clickable_open = null;
};
//------------------------------------------------
// クリック地図
//------------------------------------------------
itsmo.sub.map_clickopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/mapclick.htm?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
if(itsmo.vars.g_map_setcursor_lat) url += '&slat='+itsmo.vars.g_map_setcursor_lat
+'&slon='+itsmo.vars.g_map_setcursor_lon
+'&sicn='+itsmo.vars.g_map_setcursor_icon;
location.href = url;
};
//------------------------------------------------
// 英字地図
//------------------------------------------------
itsmo.sub.map_engopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/mapeng.htm?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
window.open(url,null);
};
//------------------------------------------------
// 印刷
//------------------------------------------------
itsmo.sub.map_printopen = function() {
var url = 'https://biz.its-mo.com' + '/biz/map/?';
var i = itsmo.vars.g_map_search_location;
url += 'lat='+i.lat+'&lon='+i.lon+'&lvl='+itsmo.vars.g_map_search_scale;
window.open(url, '_blank');
};
//------------------------------------------------
// 住宅地図印刷
//------------------------------------------------
itsmo.sub.residential_map_printopen = function(lat,lon) {
var i = itsmo.vars.g_map_search_location;
if(!lat) lat = i.lat;
if(!lon) lon = i.lon;
var url = 'https://biz.its-mo.com' + '/biz/map/fullscreen/?';
url += 'lat='+lat+'&lon='+lon+'&size=A3&color=CD&pageDirection=VT©able=DA&lvl=15';
window.open(url, '_blank');
};
//------------------------------------------------
// 天気
//------------------------------------------------
itsmo.sub.map_weatheropen = function() {
var url='/weather.html?';
var i = itsmo.vars.g_map_search_location;
url += 'lat='+i.lat+'&lon='+i.lon;
window.open(url,null);
};
//------------------------------------------------
// 住所逆引き表示
//------------------------------------------------
itsmo.sub.map_getaddr = function(loc,func,lvl) {
if(!lvl) lvl = 3;
var partsnum = lvl + 1;
loc = itsmo.lib.toLatLon(loc);
ZDC.Search.getAddrByLatLon({
latlons: [loc]
}, function(status, result) {
var items = [];
if ('000' == status.code && result.length >= 1) {
$.each(result, function(i, v) {
if (v.address.parts.length <= partsnum) {
s = v.address.text;
} else {
s = v.address.parts;
s.splice(partsnum);
s = s.join('');
}
items.push({
addrCode: v.address.code,
address: s
});
});
}
var res = {
status: '000' == status.code ? 0 : 2,
recCount: result.length,
hitCount: result.length,
rest: false,
items: items
};
func(res);
});
};
//------------------------------------------------
// 天気表示
//------------------------------------------------
itsmo.sub.map_getweather = function() {
var tenki = new ZdcNearTenki3Hour();
var opts = new ZdcNearTenki3HourOptions();
var i = itsmo.vars.g_map_search_location;
opts.lon = i.lon;
opts.lat = i.lat;
opts.pointFlg = '2';
ZdcEvent.addListener(tenki, 'end', itsmo.sub.map_getweather_result);
tenki.search(opts);
};
itsmo.sub.map_getweather_result = function(result) {
if(result.status != '0') return;
var now = new Date();
var i = Math.floor(now.getHours() / 3) - 2;
if(i < 0) i = 0;
document.getElementById("ajax_weatherimg").src = result.items[i].tenkiIconUrl;
};
//------------------------------------------------
// nextリンク
//------------------------------------------------
itsmo.sub.map_next_open = function() {
var i = itsmo.vars.g_map_search_location;
var url = 'http://zen-in.zenrin.co.jp/?';
url += 'lat='+i.lat+'&lon='+i.lon+'&lvl='+itsmo.vars.g_map_search_scale;
window.open(url,null);
};
//------------------------------------------------
// 再検索リンク設定
//------------------------------------------------
itsmo.sub.set_genre_research = function() {
if(itsmo.vars.g_freeword_beforeMode != 'range'){
return false;
}
if(itsmo.vars.g_freeword_beforeGenre == 'suumo'){
var href = 'itsmo.near_suumo.searchSubmit()';
var genre = 'マンション・不動産物件';
var icL= '09';
var icM= '001';
var icS= '0000';
//} else if(itsmo.vars.g_freeword_beforeGenre == 'osusume') {
// おすすめの再検索
// itsmo.sub.map_osusume_search(null,itsmo.vars.osusume_word);
} else if(itsmo.vars.g_freeword_beforeGenre == 'baitoru') {
// アルバイトの再検索
var href = 'itsmo.near_baitoru.search()';
var genre = 'バイト・お仕事検索';
var icL= '09';
var icM= '003';
var icS= '0002';
} else if(itsmo.vars.g_freeword_beforeGenre == 'tabikura') {
// 旅くらの再検索
var href = 'itsmo.tabikura.search()';
var genre = 'ホテル・旅館プラン検索';
var icL= '09';
var icM= '006';
var icS= '0000';
} else if(itsmo.vars.g_freeword_beforeGenre == itsmo.near_season.mode){
// 季節特集の再検索
var href = 'itsmo.near_season.cond_search()';
switch(itsmo.vars.g_freeword_beforeGenre){
case 'koyo':
var genre = '紅葉情報';
var icL= '09';
var icM= '007';
var icS= '0001';
break;
case 'hanabi':
var genre = '花火大会情報';
var icL= '09';
var icM= '007';
var icS= '0000';
break;
case 'spring':
var genre = '桜情報';
var icL= '09';
var icM= '007';
var icS= '0014';
break;
case 'illumi':
var genre = 'イルミ情報';
var icL= '09';
var icM= '007';
var icS= '0002';
break;
}
} else {
// それ以外の再検索
var href = 'itsmo.range.range_research()';
//var genre = itsmo.vars.g_range_topGenreName;
var prm = 'cd=' + encodeURIComponent(itsmo.vars.g_freeword_beforeGenre);
var func = function(result){
if(result != 'nodata'){
var cd = itsmo.vars.g_freeword_beforeGenre.split(':');
var icL= cd[0].substr(0, 2);
var icM= cd[0].substr(2, 3);
var icS= cd[0].substr(5, 4);
var searchHtml = '';
$('#ajax_leftmenu_result .map-ttl-h1-sect').after( searchHtml );
$('#ajax_leftmenu_result #main_spot').before( searchHtml );
}
};
itsmo.lib.XMLHttpRequest2_send('/map/ajax_getGenre.php',func,'GET',prm,'text');
return false;
}
var searchHtml = '';
$('#ajax_leftmenu_result .map-ttl-h1-sect').after( searchHtml );
$('#ajax_leftmenu_result #main_spot').before( searchHtml );
};
itsmo.sub.genre_research_clear = function() {
itsmo.vars.g_freeword_beforeMode = '';
itsmo.vars.g_freeword_beforeGenre = '';
};
if (typeof itsmo.map == 'undefined') {
itsmo.map = {};
}
itsmo.map.UserLayer = function() {
this.setZIndex(100);
this._data = [];
};
itsmo.map.UserLayer.prototype.setZIndex = function(n) {
this.zIndexNum = n;
};
itsmo.map.UserLayer.prototype.removeById = function(id) {
if (id >= 0 && id < this._data.length) {
} else {
return false;
}
var n = this._data[id];
if (null == n) {
return false;
}
this._data[id] = null;
itsmo.vars.g_map_obj.removeWidget(n);
return true;
};
itsmo.map.UserLayer.prototype.clear = function() {
$.each(this._data, function(i, v) {
if (null != v) {
itsmo.vars.g_map_obj.removeWidget(v);
}
});
this._data = [];
};
itsmo.map.UserLayer.prototype.clearMarker = function() {
for (var i = 0; i < this._data.length; ++i) {
var v = this._data[i];
if (null == v || !v.isMarker) {
continue;
}
this.setVisibleById(i, false);
itsmo.vars.g_map_obj.removeWidget(v);
this._data[i] = null;
}
};
itsmo.map.UserLayer.prototype.get = function(id) {
if (id >= 0 && id < this._data.length) {
} else {
return null;
}
return this._data[id];
};
itsmo.map.UserLayer.prototype.add = function(widget, isMarker) {
var n = $.inArray(null, this._data);
if (n < 0) {
n = this._data.length;
this._data.push(widget);
} else {
this._data[n] = widget;
}
widget.isMarker = !!isMarker;
itsmo.vars.g_map_obj.addWidget(widget);
return n;
};
itsmo.map.UserLayer.prototype.showById = function(id) {
return this.setVisibleById(id, true);
};
itsmo.map.UserLayer.prototype.showAll = function() {
for (var i = 0; i < this._data.length; ++i) {
this.setVisibleById(i, true);
}
};
itsmo.map.UserLayer.prototype.hideById = function(id) {
return this.setVisibleById(id, false);
};
itsmo.map.UserLayer.prototype.removeById = function(id) {
var v = this.get(id);
if (null == v) {
return;
}
itsmo.vars.g_map_obj.removeWidget(v);
this._data[id] = null;
};
itsmo.map.UserLayer.prototype.setVisibleById = function(id, isShow) {
if (id >= 0 && id < this._data.length) {
} else {
return false;
}
var n = this._data[id];
if (null == n) {
return false;
}
if (isShow) {
if (n instanceof ZDC.Marker || n instanceof ZDC.Polyline) {
n.visible();
} else {
n.open();
}
} else {
if (n instanceof ZDC.Marker || n instanceof ZDC.Polyline) {
n.hidden();
} else {
n.close();
}
}
return true;
};
//------------------------------------------------
// 初期設定
//------------------------------------------------
itsmo.vars.g_map_obj = null;//地図オブジェクト
itsmo.vars.g_map_draged = 0;
// レイヤー
itsmo.vars.g_map_layer_vics = null;
// その他
itsmo.vars.g_map_ctlcur = null;
itsmo.vars.g_map_ctlzoom = null;
itsmo.link = {};
//------------------------------------------------
// 地図サイズ変える
//------------------------------------------------
itsmo.link.map_resize = function(w,h) {
// 入力チェック
w = parseInt(w);
h = parseInt(h);
if(w < 350 || w > 2000) return;
if(h < 350 || h > 2000) return;
// 地図サイズ変更
document.getElementById("ajax_map").style.width = w + 'px';
document.getElementById("ajax_map").style.height = h + 'px';
itsmo.vars.g_map_obj.resizeMapWindow(0, 0, w, h);
itsmo.link.map_changeurl();
};
// 入力
itsmo.link.map_resize_input = function() {
// 入力チェック
w = parseInt(itsmo.lib.document_getvalue("ajax_map_w"));
h = parseInt(itsmo.lib.document_getvalue("ajax_map_h"));
if(w < 350) itsmo.lib.document_setvalue("ajax_map_w",350);
if(h < 350) itsmo.lib.document_setvalue("ajax_map_h",350);
if(w > 2000) itsmo.lib.document_setvalue("ajax_map_w",2000);
if(h > 2000) itsmo.lib.document_setvalue("ajax_map_h",2000);
if(itsmo.lib.document_getvalue("iframe") != 9) return;
itsmo.link.map_resize(w, h);
};
// URL 変更
itsmo.link.map_changeurl = function() {
var w = parseInt(document.getElementById("ajax_map").style.width);
var h = parseInt(document.getElementById("ajax_map").style.height);
var loc = itsmo.vars.g_map_obj.getMapLocation();
var sc = itsmo.vars.g_map_obj.getMapScale();
var url = '
'
+ '大きい地図・ルート検索 '
+ '( powered by ゼンリン地図 いつもNAVI )';
itsmo.lib.document_setvalue("ajax_map_url",url);
itsmo.link.map_setcursor(loc.my,loc.mx);
};
//------------------------------------------------
// 画面初期化
//------------------------------------------------
itsmo.link.map_onload = function(lat,lon,lvl,type) {
// 地図初期化 --------------------------------
itsmo.vars.g_map_obj = new ZdcMapAD(document.getElementById("ajax_map"), document.getElementById("ajax_list_pre"), document.getElementById("ajax_list_area"), 2, 3);
itsmo.vars.g_map_obj.setMapType(4);
itsmo.vars.g_map_obj.CenterFirst = true;
itsmo.vars.g_map_obj.setMapZoomLimit(1,18);
itsmo.vars.g_map_obj.setMapLocation(new ZdcPoint(lon,lat,2),lvl);
itsmo.vars.g_map_obj.setMouseCursor('hand');
//itsmo.vars.g_map_obj.CenterFirst = true;
itsmo.vars.g_map_obj.setWheelOn();
itsmo.vars.g_map_obj.addZdcKeyControl();
var obj = new ZdcMapCenter(4);//中心アイコン
obj.doc.style.filter = '';
itsmo.vars.g_map_obj.addMapCenter(obj);
itsmo.vars.g_map_obj.addMapScaleBar(new ZdcScaleBar());
itsmo.vars.g_map_obj.saveMapLocation(new ZdcPoint(lon,lat,2));
//itsmo.vars.g_map_obj.setWheelOff();
// 中心のクロスを描画しないよう変更 2013/08/29 konishi
$('#mapcenter').css('display' , 'none');
// ユーザーコントロール ----------------------
itsmo.vars.g_map_ctlcur = new ZdcUserControl();
itsmo.vars.g_map_ctlcur.setImage('/design/img/map_ctl/updownleftright.png',new ZdcSize(58,58));
itsmo.vars.g_map_ctlcur.setDocPosition(0,0,0,0); // (img position shd position)
itsmo.vars.g_map_ctlcur.setAction(1, 20, 0,38,18);
itsmo.vars.g_map_ctlcur.setAction(2, 20,40,38,58);
itsmo.vars.g_map_ctlcur.setAction(3, 0,20,18,38);
itsmo.vars.g_map_ctlcur.setAction(4, 40,20,58,38);
itsmo.vars.g_map_ctlcur.setAction(5, 20,20,38,38);
itsmo.vars.g_map_ctlcur.setMouseCursor("hand");
ZdcEvent.addListener(itsmo.vars.g_map_ctlcur, 'clickend', function() {
switch(this.actionid){
case 1:
itsmo.vars.g_map_obj.scrollMap(0,300);
break;
case 2:
itsmo.vars.g_map_obj.scrollMap(0,-300);
break;
case 3:
itsmo.vars.g_map_obj.scrollMap(300,0);
break;
case 4:
itsmo.vars.g_map_obj.scrollMap(-300,0);
break;
case 5:
itsmo.vars.g_map_obj.restoreMapLocation();
break;
}
});
itsmo.vars.g_map_obj.addUserControl(itsmo.vars.g_map_ctlcur, 10, 10);
// ズームコントロール ------------------------
// 詳細設定 ----------------------------------
//itsmo.vars.g_config = new itsmo.config.MapEasyConfig();
//itsmo.vars.g_config.loadConfig();
//itsmo.vars.g_map_obj.Property.CenterFirst = itsmo.vars.g_config.centerfirst;
//itsmo.link.ChgCtlzoom(itsmo.vars.g_config.wheeltype);
//itsmo.link.ChgDbclick(itsmo.vars.g_config.dblclick)
/*
var ctl = new ZdcUserZoomControl();
ctl.setImage("/design/img/map_ctl/small-big.png",new ZdcSize(18, 167),"/design/img/map_ctl/controller.png",new ZdcSize(18, 12));
ctl.setDocPosition(0, 0, 0, 0);
ctl.setAction('zoomOut', 0, 0 , 18, 18);
ctl.setAction('zoomIn' , 0, 145, 18, 163);
ctl.setAction('slither', 0, 18 , 18, 145, 7);
ctl.setAction('setzoom', 0, 18 , 18, 145);
ctl.setZoomLimit(18, 1);
ctl.setMouseCursor("hand");
ZdcEvent.addListener(ctl,"clickend",function(){
itsmo.vars.g_map_draged ++;
switch(this.actionid){
case 'none':
break;
case 'zoomOut':
itsmo.vars.g_map_obj.mapZoomOut();
this.setSlitherPosition();
break;
case 'zoomIn':
itsmo.vars.g_map_obj.mapZoomIn();
this.setSlitherPosition();
break;
case 'setzoom':
var s = this.getZoom();
itsmo.vars.g_map_obj.setMapScale(s);
this.setSlitherPosition();
break;
}
});
ZdcEvent.addListener(ctl,"mousedowngrid",function(){
itsmo.vars.g_map_draged ++;
if(this.actionid=='slither'){
this.dragstart(1);
return false;
}
});
ZdcEvent.addListener(ctl,"mouseup",function(){
itsmo.vars.g_map_draged ++;
if(this.actionid=='slither'){
this.dragend();
}
});
itsmo.vars.g_map_obj.addUserZoomControl(ctl, 73, 30);
ctl.setSlitherPosition();
*/
// シングルクリックで移動させる処理 ----------
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "dragmap", function() {
itsmo.vars.g_map_draged++;
});
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "clickmap", function() {
if (itsmo.vars.g_map_draged < 2) {
itsmo.vars.g_map_obj.scrollToCenter(
new ZdcPoint(itsmo.vars.g_map_obj.Property.MouseCLon, itsmo.vars.g_map_obj.Property.MouseCLat));
}
itsmo.vars.g_map_draged = 0;
});
// レイヤー作成 ------------------------------
// VICS用
itsmo.vars.g_map_layer_vics = new ZdcUserLayer();
itsmo.vars.g_map_layer_vics.setLayerScale(0,18);
itsmo.vars.g_map_layer_vics.setLayerType('manual');
itsmo.vars.g_map_layer_vicsid = itsmo.vars.g_map_obj.addUserLayer(itsmo.vars.g_map_layer_vics);
// モード別の処理 ----------------------------
if(type == 0) {
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "dragmapend" , itsmo.link.map_changeurl);
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "scrollmapend" , itsmo.link.map_changeurl);
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "changezoomend", itsmo.link.map_changeurl);
itsmo.link.map_resize(450,450);
} else {
itsmo.link.map_setcursor(lat,lon);
}
};
//map_configからの引継ぎ
itsmo.link.ChgCtlzoom = function(flg){
//$('#ajax_map #userzoomcontrol').unwrap();
//itsmo.vars.g_map_obj.removeUserZoomControl();
itsmo.vars.g_map_obj.setWheelType(flg == 0 ? 1 : 2);
itsmo.vars.g_map_ctlzoom = new ZdcUserZoomControl();
//itsmo.vars.g_map_ctlzoom.setImage("/design/img/map_ctl/small-big.png",new ZdcSize(19, 150),"/design/img/map_ctl/controller.png",new ZdcSize(19, 11));
itsmo.vars.g_map_ctlzoom.setImage("/design/img/map_ctl/small-big.png",new ZdcSize(18, 167),"/design/img/map_ctl/controller.png",new ZdcSize(18, 12));
if ($.support.msie && $.support.version == 7) {
var zposion = -1;
}else{
var zposion = -0;
}
if(flg == 0){
// ズームコントロール ------------------------
itsmo.vars.g_map_ctlzoom.setDocPosition(zposion, zposion, 0, 0);
itsmo.vars.g_map_ctlzoom.setAction('zoomOut', 0, 0 , 19, 19);
itsmo.vars.g_map_ctlzoom.setAction('zoomIn' , 0, 125 , 19, 145);
itsmo.vars.g_map_ctlzoom.setAction('slither', zposion, 19 , 19, 125, 6);
itsmo.vars.g_map_ctlzoom.setAction('setzoom', 0, 19 , 19, 125);
itsmo.vars.g_map_ctlzoom.setZoomLimit(18, 1);
}else{
// ズームコントロール ------------------------
itsmo.vars.g_map_ctlzoom.setDocPosition(zposion, zposion, 0, 0);
itsmo.vars.g_map_ctlzoom.setAction('zoomIn' , 0, 0 , 19, 19);
itsmo.vars.g_map_ctlzoom.setAction('zoomOut', 0, 125 , 19, 145);
itsmo.vars.g_map_ctlzoom.setAction('slither', zposion, 19 , 19, 125, 6);
itsmo.vars.g_map_ctlzoom.setAction('setzoom', 0, 19 , 19, 125);
itsmo.vars.g_map_ctlzoom.setZoomLimit(1, 18);
itsmo.vars.g_map_ctlzoom.dragtype = 2;
}
ZdcEvent.addListener(itsmo.vars.g_map_ctlzoom,"clickend",function(){
itsmo.vars.g_map_draged ++;
switch(this.actionid){
case 'none':
break;
case 'zoomOut':
itsmo.vars.g_map_obj.mapZoomOut();
this.setSlitherPosition();
break;
case 'zoomIn':
itsmo.vars.g_map_obj.mapZoomIn();
this.setSlitherPosition();
break;
case 'setzoom':
var s = this.getZoom();
itsmo.vars.g_map_obj.setMapScale(s);
this.setSlitherPosition();
break;
}
});
ZdcEvent.addListener(itsmo.vars.g_map_ctlzoom,"mousedowngrid",function(){
itsmo.vars.g_map_draged ++;
if(this.actionid=='slither'){
this.dragstart(1);
return false;
}
});
ZdcEvent.addListener(itsmo.vars.g_map_ctlzoom,"mouseup",function(){
itsmo.vars.g_map_draged ++;
if(this.actionid=='slither'){
this.dragend();
}
});
itsmo.vars.g_map_ctlzoom.setMouseCursor("hand");
itsmo.vars.g_map_obj.addUserZoomControl(itsmo.vars.g_map_ctlzoom, 73, 30); // , 73, 30);
itsmo.vars.g_map_ctlzoom.setSlitherPosition();
if (0 == flg) {
$('#ajax_map #userzoomcontrol').wrap('');
} else {
$('#ajax_map #userzoomcontrol').wrap('');
}
};
itsmo.link.ChgDbclick = function(flg){
if(flg != 0){
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, 'dblclickend', itsmo.link.g_config_dblclick_zoomin);
//右ダブルクリック
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "scrollmapend", itsmo.link.dblclickZoomInScrollMapEnd);
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "clickmapright", itsmo.link.g_config_dblclick_right);
}else{
/*
ZdcEvent.addListener(itsmo.vars.g_map_obj.Property, "clickmap", function() {
if (itsmo.vars.g_map_draged < 2) {
itsmo.vars.g_map_obj.scrollToCenter(new ZdcPoint(itsmo.vars.g_map_obj.MouseCLon, itsmo.vars.g_map_obj.MouseCLat));
}
itsmo.vars.g_map_draged = 0;
});
*/
}
};
itsmo.link.g_config_dblclick_zoominFlg = false;
itsmo.link.g_config_dblclick_zoomin = function() {
// ダブルクリックで拡大。
itsmo.link.g_config_dblclick_zoominFlg = true;
};
itsmo.link.dblclickZoomInScrollMapEnd = function() {
// ダブルクリックで拡大。
if(itsmo.link.g_config_dblclick_zoominFlg){
itsmo.vars.g_map_obj.mapZoomIn();
itsmo.vars.g_map_ctlzoom.setSlitherPosition();
itsmo.vars.g_config_dblclick_zoominFlg = false;
}
};
itsmo.link.g_config_dblclick_right_count = 0; // 右クリック回数
itsmo.link.g_config_dblclick_right_timer = null; // 右ダブルクリック判定用タイムアウト。
itsmo.link.g_config_dblclick_right = function() {
// 右クリックされた。
++itsmo.link.g_config_dblclick_right_count;
if (null == itsmo.link.g_config_dblclick_right_timer) {
itsmo.link.g_config_dblclick_right_timer = setTimeout(itsmo.link.g_config_dblclick_right_timerfunc, 300);
}
};
// 右ダブルクリック判定用のタイムアウト関数。
itsmo.link.g_config_dblclick_right_timerfunc = function() {
itsmo.link.g_config_dblclick_right_timer = null;
var n = itsmo.link.g_config_dblclick_right_count;
itsmo.link.g_config_dblclick_right_count = 0;
if (n > 1) {
// 右ダブルクリックで縮小。
//itsmo.vars.g_map_obj.setMapLocation(new ZdcPoint(itsmo.vars.g_map_obj.MouseLon, itsmo.vars.g_map_obj.MouseLat));
itsmo.vars.g_map_obj.mapZoomOut();
itsmo.vars.g_map_ctlzoom.setSlitherPosition();
}
};
//------------------------------------------------
// 選択カーソル設置
//------------------------------------------------
itsmo.vars.g_map_setcursor_id = null;
itsmo.vars.g_map_setcursor_lat = null;
itsmo.vars.g_map_setcursor_lon = null;
itsmo.vars.g_map_setcursor_icon = null;
itsmo.link.map_setcursor = function(lat,lon,icon) {
if(icon == null) icon = 'link02';
if(itsmo.vars.g_map_setcursor_id != null) itsmo.vars.g_map_layer_vics.removeZdcTooltipById(itsmo.vars.g_map_setcursor_id);
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = icon;
var html = '
';
var tip = new ZdcTooltip();
$pixX = -11;
$pixY = -30;
// 「ここ」アイコン画像サイズ変更に伴い、オフセット値調整
// (link02のみの対応、他タイプは従来通り-11,-30のオフセット) 2013/08/30 konishi
if (icon == 'link02') {
$pixX = -13;
$pixY = -32;
}
tip.setZdcTooltip(new ZdcPoint(lon, lat, 2),html,21,29,new ZdcPixel($pixX, $pixY),0);
itsmo.vars.g_map_setcursor_id = itsmo.vars.g_map_layer_vics.addZdcTooltip(tip);
itsmo.vars.g_map_layer_vics.visibleZdcTooltipById(itsmo.vars.g_map_setcursor_id);
};