MapFan→GoogleMaps ブックマークレット

ここからの続き。

最初のうちは日本全体映像からぐぐっとターゲットにズームインするのが楽しかったのですが、繰り返すうちにひどくおっくうになってきたので(^_^;)、ズームも(固定ですが)切り換え時に自動でしてくれるようにしました。ただウインドウの表示幅/高さを取得することが必要でそのために Mozilla/FirefoxInternet Explorer それぞれ専用になります。


Mozilla/Firefox

javascript:(function(){var ary=document.form11.textfield222.defaultValue.match(/\d+/g);function getDeg(nn,delta){var deg=parseInt(ary[nn]);deg+=ary[nn+1]/60;deg+=(parseInt(ary[nn+2])+ary[nn+3]/10)/60/60;deg+=delta;return Math.round(deg*1e6)/1e6;}function getSpn(px){return Math.round(px/11600*1e6)/1e6;}location.href='http://maps.google.com/maps?ll='+getDeg(4,0.0032)+','+getDeg(0,-0.00325)+'&spn='+getSpn(window.innerHeight-105)+','+getSpn(window.innerWidth-250)+'&t=k';})()

(整形するとこんなかんじ)

javascript:(
   function(){
      var ary=document.form11.textfield222.defaultValue.match(/\d+/g);
      function getDeg(nn,delta){
         var deg=parseInt(ary[nn]);
         deg+=ary[nn+1]/60;
         deg+=(parseInt(ary[nn+2])+ary[nn+3]/10)/60/60;
         deg+=delta;
         return Math.round(deg*1e6)/1e6;
      }
      function getSpn(px){
         return Math.round(px/11600*1e6)/1e6;
      }
      location.href='http://maps.google.com/maps?ll='
            +getDeg(4,0.0032)+','+getDeg(0,-0.00325)+'&spn='
            +getSpn(window.innerHeight-105)+','
            +getSpn(window.innerWidth-250)+'&t=k';
   })()


Internet Explorer

javascript:(function(){var ary=document.form11.textfield222.defaultValue.match(/\d+/g);function getDeg(nn,delta){var deg=parseInt(ary[nn]);deg+=ary[nn+1]/60;deg+=(parseInt(ary[nn+2])+ary[nn+3]/10)/60/60;deg+=delta;return Math.round(deg*1e6)/1e6;}function getSpn(px){return Math.round(px/11600*1e6)/1e6;}location.href='http://maps.google.com/maps?ll='+getDeg(4,0.0032)+','+getDeg(0,-0.00325)+'&spn='+getSpn(document.body.clientHeight-105)+','+getSpn(document.body.clientWidth-250)+'&t=k';})()

(整形するとこんなかんじ)

javascript:(
   function(){
      var ary=document.form11.textfield222.defaultValue.match(/\d+/g);
      function getDeg(nn,delta){
         var deg=parseInt(ary[nn]);
         deg+=ary[nn+1]/60;
         deg+=(parseInt(ary[nn+2])+ary[nn+3]/10)/60/60;
         deg+=delta;
         return Math.round(deg*1e6)/1e6;
      }
      function getSpn(px){
         return Math.round(px/11600*1e6)/1e6;
      }
       location.href='http://maps.google.com/maps?ll='
            +getDeg(4,0.0032)+','+getDeg(0,-0.00325)+'&spn='
            +getSpn(document.body.clientHeight-105)+','
            +getSpn(document.body.clientWidth-250)+'&t=k';
   })()