添付ファイルの情報



[添付ファイル一覧] [全ページの添付ファイル一覧]

filedelete_bookmark_line.js
格納ファイル名:attach/526571756573742F3537_64656C6574655F626F6F6B6D61726B5F6C696E652E6A73
ページ:Request/57
格納ファイル名:attach/526571756573742F3537_64656C6574655F626F6F6B6D61726B5F6C696E652E6A73
MD5ハッシュ値:fc39954089144d90be84c3c411f37d10
サイズ:1.8KB (1824 bytes)
Content-type:application/octet-stream
登録日時:2015/08/23 04:59:51
アクセス数:129
MD5ハッシュ値:fc39954089144d90be84c3c411f37d10
filedelete_bookmark_line.js
  0
  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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
/*
	delete_bookmark_lines.js
	Copyright(C) 2015 Moca
	ver 0.1
	ブックマーク行を削除
	sakura 2.2.0.0 以上
*/
 
(function (){
    if( CompareVersion(Editor.ExpandParameter("$v"), "2.2.0.0") <= 0 ){
        InfoMsg("ブックマーク行を削除は sakura 2.2.0.0 以上専用です");
        return;
    }
    var lineCount = Editor.GetLineCount(0);
    var firstLine = "";
    if( 0 < lineCount ){
        firstLine = Editor.GetLineStr(1);
    }else{
        return;
    }
    var bMarkOk = false;
    var mk = "@@";
    var count = 0;
    var xOld = Editor.ExpandParameter("$x");
    var yOld = Editor.ExpandParameter("$y");
    var drawOld = Editor.SetDrawSwitch(0);
    Editor.AddRefUndoBuffer();
    while( false == bMarkOk ){
        if( firstLine.substr(0, mk.length) != mk ){
            Editor.MoveCursor(1, 1, 0);
            Editor.InsText(mk);
            if( 2 <= lineCount ){
                Editor.MoveCursor(2, 1, 0);
                Editor.SearchNext("^" + mk, 2+4+0x20+0x800+0x1000); // 正規表現,先頭に戻る,元に戻す
                var y = Editor.ExpandParameter("$y");
                if( y == 1 ){
                    bMarkOk = true;
                }
            }else{
                bMarkOk = true;
            }
            Editor.MoveCursor(1, 1, 0);
            Editor.MoveCursor(1, mk.length + 1, 1);
            Editor.Delete();
        }
        if( false == bMarkOk ){
            mk = "@@mk" + count.toString(16) + "@";
        }
        count++;
    };
    var bookCount = 0;
    for( var i = 1; i <= lineCount; i++ ){
        if( 1 == Editor.GetLineAttribute(i, 2) ){
            Editor.MoveCursor(i, 1, 0);
            Editor.InsText(mk);
            bookCount++;
        }
    }
    if( 0 < bookCount ){
        Editor.ReplaceAll("^" + mk, "", 2+4+0x20+0x300+0x800+0x1000); // 正規表現,行削除,元に戻す
    }else{
        // 置換しない場合は元の位置に戻る
        Editor.MoveCursor(yOld, xOld, 0);
    }
    Editor.SetDrawSwitch(drawOld);
    Editor.SetUndoBuffer();
    if( drawOld == 1 ){
        Editor.Redraw(0);
    }
    Editor.StatusMsg("ブックマーク行を" + bookCount + "行削除しました");
})();




    


    ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS