// AB Road Map plus // Author: Nao Ueda // Locazing Inc. http://www.locapoint.com // Version: 1.0 - 08SEP2007 - Initial Release // License: GNU GPL v2 or later // // // リクルートAB-ROAD旅行情報の詳細ページで、地図を追加表示します。 // // ==UserScript== // @name AB Road Map plus // @namespace http://www.locapoint.com/ // @description In AB-Road tour detail page, add route map automatically. // @include http://www.ab-road.net/* // ==/UserScript== (function () { ///// properties if(!W){ var W = unsafeWindow; } if(!d){ var d = W.document; } if(!U){ var U =d.URL; } ///// functions /////////////////////////////////////////////////////////////////////////////// //LatLon2Locapoint /////////////////////////////////////////////////////////////////////////////// function LatLon2Locapoint(lat, lon){ var latstep=Math.floor(((lat-(-90))*45697600/180)); var lngstep=Math.floor(((lon-(-180))*45697600/360)); var locapoint=String.fromCharCode( Math.floor(latstep/1757600%26)+65, Math.floor(latstep/67600%26)+65, Math.floor(latstep/6760%10)+48, 46, Math.floor(lngstep/1757600%26)+65, Math.floor(lngstep/67600%26)+65, Math.floor(lngstep/6760%10)+48, 46, Math.floor(latstep/260%26)+65, Math.floor(latstep/10%26)+65, Math.floor(latstep%10)+48, 46, Math.floor(lngstep/260%26)+65, Math.floor(lngstep/10%26)+65, Math.floor(lngstep%10)+48 ); return(locapoint); } function dept_city2lp(deptCity) { switch (deptCity) { case "NRT": return(LatLon2Locapoint(35.774877,140.388429));break; case "TYO": return(LatLon2Locapoint(35.774877,140.388429));break; case "HND": return(LatLon2Locapoint(35.551013,139.786477));break; case "OSA": return(LatLon2Locapoint(34.43831,135.243587));break; case "KIX": return(LatLon2Locapoint(34.43831,135.243587));break; case "NGO": return(LatLon2Locapoint(34.862694,136.815233));break; case "FUK": return(LatLon2Locapoint(33.597928,130.442176));break; default:return("AA0.AA0.AA0.AA0"); } } var api_key = '964833c169771e35'; //Ueda 964833c169771e35 function do_search (tourid){ // 画面表示切替 //document.getElementById( 'result' ).innerHTML = 'loading...'; // API リクエストURL 生成 var myD = new Date( );//キャッシュ対策 by上田 //var keyword = document.getElementById( 'keyword' ).value; var url = 'http://webservice.recruit.co.jp/ab-road/tour/v1/' + '?format=jsonp&callback=my_callback&' + 'key=' + api_key + '&' + 'id=' + tourid + '&' + 'unique=' + myD.getYear() + '-' + (myD.getMonth()-0+1) + '-' + myD.getDate(); //alert("url=" + url); // リクエスト実施 var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.charset = 'utf-8'; script.src = url; document.getElementsByTagName("head")[0].appendChild( script ); // 成功すると下の my_callback() が実行される } unsafeWindow.my_callback=function(json){ // root node 省略 var lpi=""; var tree = json.results; // エラーハンドリング if( tree.error ){ //alert('エラー' + json.results.error[0].message); return; }else if( tree.results_returned == 0 ){ //alert('一致するツアーはありませんでした'); return; } // 結果を表示(ID指定なので一件だけだが、念のため) for (var i=0; i