Top > LDRize > Extension > LDRizeShowPreviewOnGoogleDesktop

LDRize/Extension/LDRizeShowPreviewOnGoogleDesktop

Last-modified: 2008-03-25 (火) 12:34:44

LDRize Show Preview On Google Desktop by 958 Edit

前提条件 Edit

概要 Edit

  • LDRize for Seahorse にGoogleDesktop上でプレビューを表示するキーバインドを追加するSeaHorseスクリプト
  • ついでにプレビューが表示されるIFrameの高さも調整

必須拡張 Edit

  • SeaHorse 1.1.1 以上
  • UserAction Extension 1.0.0 以上

動作確認環境 Edit

  • Windows XP SP2
  • Internet Explorer 7
  • Sleipnir 2.6.2
  • Seahorse 1.1.2
  • UserAction Extension 1.0.1

インストール Edit

  • ソースをコピーし、テキストエディタに貼り付け
  • 貼り付けたソース内の全角文字「onclick」を半角文字に置換する(wikiwiki.jpのセキュリティ対策のせいで、半角だと貼り付けられませんでした)
  • sleipnir のインストールディレクトリ\plugins\seahorse\LDRizeShowPreviewOnGoogleDesktop.user.js に保存
  • SeaHorse再読み込み

説明 Edit

  • インストール完了後、GoogleDesktopの検索結果上で LDRize が動作していることを確認後、 r を押してみる

ソース Edit

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 
 
 
 
 
 
 
-
|
|
|
|
|
-
|
-
-
|
|
|
!
-
|
|
|
!
|
|
-
-
|
|
-
!
!
!
!
|
!
// ==UserScript==
// @name           LDRize Show Preview On Google Desktop
// @description    LDRize に Google デスクトップ検索時にプレビューを開くキーバインドを追加
// @include        http:*127.0.0.1:4664/search?q=*
// @author         958
// @version        0.01
// ==/UserScript==
(function() {
    if (!window.LDRize) return;
 
    var $ = window.LDRize.jQuery;
    var selector = 'a.c';
    window.LDRize.addKeyBind('r',
        function() {
            var pinList = window.LDRize.getPinList();
            if (pinList.length > 0) {
                for (var i = 0; i < pinList.length; i++) {
                    var ret = $(selector, pinList[i]).get();
                    if (ret.length > 0)
                        LDRizeShowPreview_TogglePreview(ret[0]);
                }
            } else {
                var ret = $(selector, window.LDRize.getCurrentParagraph()).get();
                if (ret.length > 0)
                    LDRizeShowPreview_TogglePreview(ret[0]);
            }
            window.LDRize.clearPin();
 
            function LDRizeShowPreview_TogglePreview(elm) {
                if (elm.onclick.toString().match(/togglePreview\((.*)\)/)) {
                    elm.fireEvent('onclick');
                    var ret = $('#preview'+RegExp.$1)[0];
                    setTimeout(function(){ret.style.height =
                        ret.contentWindow.document.body.scrollHeight + 10;},100);
                }
            }
        }
    );
})();