« GRINEdit |Main| GRINEdit applet »

« Re: ループ内の無名関数 | JavaScript | Pythonドキュメントの日英マッピングをするGreaseMonkey »

« MovableTypeで箇条書きを楽に入力するプラグイン | MTHack | 「MovableTypeで箇条書きを楽に入力するプラグイン」の改良 »

MTでクリックしたエントリを編集するBookmarklet

ブックマークレットを実行すると<div class="entry" id="entry-<$MTEntryID$>">で囲われている領域をマウスオーバーでハイライト表示し、それをクリックすると編集画面を開く、というブックマークレットです。

フルバージョンは35行あって結構長いので、「川o・-・)<2nd life - bookmarkletの文字数制限を無くす」で紹介されている方法を使うといいと思います。 でもハイライトが静的なもので良ければ短くすることもできます。

javascript: (function(){baseurl = "http://YOUR_MT_POS/mt.cgi?__mode=view&_type=entry&blog_id=1&id=";tags = document.getElementsByTagName('div');for(i = 0; i < tags.length; i++){tag = tags[i];if(tag.className == "entry"){tag.style.background='#DAFADA';tag.style.border='solid';tag.onclick = function(){t = this;id = t.id.substr(6);window.open(baseurl + id);}};}})();

なおいつものようにFirefoxでしか動作確認をしていません。

colorArray=new Array();
borderArray=new Array();
currentTag = undefined;
baseurl = "http://YOUR_SERVER/LOCATION_OF_YOUR_MT/mt.cgi?__mode=view&_type=entry&blog_id=1&id=";

tags = document.getElementsByTagName('div');
for(i = 0; i < tags.length; i++){
  tag = tags[i];
  
  if(tag.className == "entry"){
    tag.onmouseover=function(){
      if(currentTag){
        return;
      }
      currentTag = this;
      t=this;
      colorArray[t]=t.style.background;
      borderArray[t]=t.style.border;
      t.style.background='#DAFADA';
      t.style.border='solid';
    };
    tag.onmouseout = function(){
      t=this;
      t.style.background=colorArray[t];
      t.style.border=borderArray[t];
      currentTag = undefined;
    };
    tag.onclick = function(){
      t = this;
      id = t.id.substr(6);
      window.open(baseurl + id);
    }
  };
}
baseurl = "http://YOUR_SERVER/LOCATION_OF_YOUR_MT/mt.cgi?__mode=view&_type=entry&blog_id=1&id=";

tags = document.getElementsByTagName('div');
for(i = 0; i < tags.length; i++){
  tag = tags[i];

  if(tag.className == "entry"){
    t.style.background='#DAFADA';
    t.style.border='solid';
    tag.onclick = function(){
      t = this;
      id = t.id.substr(6);
      window.open(baseurl + id);
    }
  };
}

トラックバック(Trackback)

Trackback URL: http://www.nishiohirokazu.org/mt/mt-tb.cgi/114

ご意見・ご感想をお送りください(フィードバック)

(フィードバックはメールで送信され、基本的に表示されませんが、内容によっては公開させていただくこともございます。ご了承ください。Your comment doesn't appear the page immediately. If the comment has value to other people, it will be put on the page or subsequent entries. Thank you.)

上の情報は、いずれも未記入でかまいません。 All of above questions are optional.