OSDN Git Service

close #15812
authorh677 <h677>
Sun, 17 May 2009 02:37:39 +0000 (02:37 +0000)
committerh677 <h677>
Sun, 17 May 2009 02:37:39 +0000 (02:37 +0000)
レス番号コンテキストメニューにこのレスのURLコピーを追加。
2ch/したらばはPATH_INFO限定。ほかは両方で取得できるが、外部板は保障外。

Giko.dfm
Giko.pas
GikoDataModule.dfm
GikoDataModule.pas

index 1051e7e..30dd4e3 100644 (file)
--- a/Giko.dfm
+++ b/Giko.dfm
@@ -8406,6 +8406,18 @@ object GikoForm: TGikoForm
     object N83: TMenuItem
       Action = GikoDM.DereferenceResAction
     end
+    object N85: TMenuItem
+      Caption = '-'
+    end
+    object URL2: TMenuItem
+      Caption = #12371#12398#12524#12473#12398'URL'
+      object URLPATHINFO1: TMenuItem
+        Action = GikoDM.konoURLPATHAction
+      end
+      object URLQUERYSTRING1: TMenuItem
+        Action = GikoDM.konoURLQueryAction
+      end
+    end
   end
   object BrowserTabPopupMenu: TPopupMenu
     Images = HotToobarImageList
index d5fcf87..2b5ac3e 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -421,6 +421,10 @@ type
     N83: TMenuItem;
     UpdateGikonaviAction1: TMenuItem;
     N84: TMenuItem;
+    N85: TMenuItem;
+    URL2: TMenuItem;
+    URLPATHINFO1: TMenuItem;
+    URLQUERYSTRING1: TMenuItem;
                                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
         procedure SaveSettingAll();
index 1d05462..6ef96ce 100644 (file)
@@ -1386,6 +1386,21 @@ object GikoDM: TGikoDM
       Hint = #12462#12467#12490#12499#12398#26356#26032
       OnExecute = UpdateGikonaviActionExecute
     end
+    object konoURLPATHAction: TAction
+      Tag = -1
+      Category = #12502#12521#12454#12470#12509#12483#12503#12450#12483#12503
+      Caption = 'PATH_INFO'#24418#24335
+      Hint = #12371#12398#12524#12473#12398'URL'#12467#12500#12540#65288'PATH_INFO'#65289
+      OnExecute = konoURLPATHActionExecute
+    end
+    object konoURLQueryAction: TAction
+      Tag = -1
+      Category = #12502#12521#12454#12470#12509#12483#12503#12450#12483#12503
+      Caption = 'QUERY_STRING'#24418#24335
+      Hint = #12371#12398#12524#12473#12398'URL'#12467#12500#12540#65288'QUERY_STRING'#65289
+      OnExecute = konoURLQueryActionExecute
+      OnUpdate = konoURLQueryActionUpdate
+    end
   end
   object ToobarImageList: TImageList
     Left = 44
index f5a9abe..952d1df 100644 (file)
@@ -243,6 +243,8 @@ type
     ShowTabListAction: TAction;
     DereferenceResAction: TAction;
     UpdateGikonaviAction: TAction;
+    konoURLPATHAction: TAction;
+    konoURLQueryAction: TAction;
        procedure EditNGActionExecute(Sender: TObject);
        procedure ReloadActionExecute(Sender: TObject);
        procedure GoFowardActionExecute(Sender: TObject);
@@ -456,6 +458,9 @@ type
     procedure ShowTabListActionExecute(Sender: TObject);
     procedure DereferenceResActionExecute(Sender: TObject);
     procedure UpdateGikonaviActionExecute(Sender: TObject);
+    procedure konoURLPATHActionExecute(Sender: TObject);
+    procedure konoURLQueryActionExecute(Sender: TObject);
+    procedure konoURLQueryActionUpdate(Sender: TObject);
   private
        { Private \90é\8c¾ }
        procedure ClearResFilter;
@@ -4595,6 +4600,76 @@ begin
     end;
 
 end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iPATH_INFO)
+procedure TGikoDM.konoURLPATHActionExecute(Sender: TObject);
+var
+    No : Integer;
+    ThreadItem : TThreadItem;
+    URL, Protocol, Host, Path, Document, Port, Bookmark : String;
+begin
+       No := GikoForm.KokoPopupMenu.Tag;
+       if No = 0 then Exit;
+
+    ThreadItem := GikoForm.KokoPopupThreadItem;
+    if (ThreadItem.ParentBoard.Is2ch) or not (Pos('?', ThreadItem.URL) > 0) then begin
+        GikoSys.ParseURI(ThreadItem.URL,Protocol, Host, Path, Document, Port, Bookmark);
+        URL := Protocol + '://' + Host + Path + IntToStr(No);
+    end else begin
+        if Pos('?', ThreadItem.URL) > 0 then begin
+            URL := Copy(ThreadItem.URL, 1, Pos('?', ThreadItem.URL)-1);
+            // \82Ü\82¿BBS\97p\8f\88\92u
+            URL := MojuUtils.CustomStringReplace(URL, 'read.pl', 'read.cgi');
+            URL := URL + '/' + ThreadItem.ParentBoard.BBSID + '/' + ChangeFileExt(ThreadItem.FileName, '')  + '/' + IntToStr(No);
+        end;
+    end;
+    Clipboard.SetTextBuf( PChar(URL) );
+end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iQuery_STRING)
+procedure TGikoDM.konoURLQueryActionExecute(Sender: TObject);
+var
+    No : Integer;
+    ThreadItem : TThreadItem;
+    URL, Protocol, Host, Path, Document, Port, Bookmark : String;
+begin
+       No := GikoForm.KokoPopupMenu.Tag;
+       if No = 0 then Exit;
+
+    ThreadItem := GikoForm.KokoPopupThreadItem;
+    // 2ch\82Æ\82µ\82½\82ç\82Î\82Í\81A\83\8c\83X\94Ô\8d\86\82ð\82¤\82Ü\82­\8f\88\97\9d\82µ\82Ä\82­\82ê\82È\82¢\82Ì\82Å\97\98\97p\95s\89Â
+    if ThreadItem.ParentBoard.Is2ch or not (Pos('?', ThreadItem.URL) > 0) then begin
+        GikoSys.ParseURI(ThreadItem.URL, Protocol, Host, Path, Document, Port, Bookmark);
+        URL := Protocol + '://' + Host + '/test/read.cgi?bbs=' + ThreadItem.ParentBoard.BBSID
+            + '&key=' + ChangeFileExt(ThreadItem.FileName, '') + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
+    end else begin
+        URL := ThreadItem.URL;
+        // \82Ü\82¿BBS
+        if Pos('&LAST=', URL) > 0 then begin
+            URL := Copy(URL, 1, Pos('&LAST=', URL) - 1);
+            URL := URL + '&START=' + IntToStr(No) + '&END=' + IntToStr(No);
+        end;
+        // \82»\82Ì\91¼\8aO\95\94\94Â
+        if Pos('&ls=', URL) > 0 then begin
+            URL := Copy(URL, 1, Pos('&ls=', URL) - 1);
+            URL := URL + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
+        end;
+
+    end;
+    Clipboard.SetTextBuf( PChar(URL) );
+end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iQuery_STRING\81j\82Ì\97\98\97p\83`\83F\83b\83N
+procedure TGikoDM.konoURLQueryActionUpdate(Sender: TObject);
+const
+       LIVEDOOR_URL = 'http://jbbs.livedoor.jp/';
+begin
+    // 2ch\82Æ\82µ\82½\82ç\82Î\82Í\97\98\97p\82Å\82«\82È\82¢\82æ\82¤\82É\82·\82é\81i\82¤\82Ü\82­\83\8c\83X\8ew\92è\82Å\82«\82È\82¢\82Ì\82Å\81j
+    konoURLQueryAction.Enabled := false;
+    if (GikoForm.KokoPopupThreadItem <> nil) then begin
+        konoURLQueryAction.Enabled := not GikoForm.KokoPopupThreadItem.ParentBoard.Is2ch;
+        if konoURLQueryAction.Enabled then begin
+            konoURLQueryAction.Enabled := not (Pos(LIVEDOOR_URL, GikoForm.KokoPopupThreadItem.URL) = 1);
+        end;
+    end;
+end;
 
 end.