Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flickrプラグイン付属のbookmarkletが動作しない #175

Open
tdtds opened this issue Mar 28, 2017 · 1 comment
Open

flickrプラグイン付属のbookmarkletが動作しない #175

tdtds opened this issue Mar 28, 2017 · 1 comment
Labels

Comments

@tdtds
Copy link
Member

tdtds commented Mar 28, 2017

  • 設定ページにあるBookmarkletで正規表現まわりのエスケープが適切でない
  • 日記のURLがhttpsで始まる場合にBookmarklet内のジャンプ先がおかしい
  • 見つかったpage_photo_idがプラグインにうまく渡っていない

……ような。時間ができたら追いかけてみますがとりあえずメモ。

@tdtds tdtds added the bug label Mar 28, 2017
@machu
Copy link
Member

machu commented May 21, 2017

追っかけてみたら、 3b0339f でflickr.jsを作ったときにブックマークレットからのphoto_id渡しを消しちゃってました。

Bookmarkletのエスケープは以下の修正でOKですが、力尽きたのでひとまずここまで。

diff --git a/plugin/ja/flickr.rb b/plugin/ja/flickr.rb
index a8f07fb..0f7c47b 100644
--- a/plugin/ja/flickr.rb
+++ b/plugin/ja/flickr.rb
@@ -10,7 +10,8 @@ add_conf_proc('flickr', 'Flickr プラグイン') do
     end
   end

-  flickr_bookmarklet = CGI.escapeHTML %Q{javascript:(function(){var w=window;w.page_photo_id||/^\/photos\/[^/]+\/(\d+)\//.test(w.___location.pathname)?w.___location.href="#{@conf.base_url}#{@update}?#{FLICKER_FORM_PID}="+w.page_photo_id||RegExp.$1:void(0);})()}
+  flickr_bookmarklet = CGI.escapeHTML "javascript:(function(){___location.pathname.match(/^\\/photos\\/[^/]+\\/(\\d+)\\//)?___location.href='#{@conf.base_url}/#{@update}?#{FLICKER_FORM_PID}='+RegExp.$1:void(0);})()"
+
   r = <<-_HTML
   <p><a href="http://www.flickr.com/">Flickr</a> に登録した画像を日記に表示するプラグインです。日記の本文中で下記のように呼び
出します。</p>
   <pre>&lt;%=flickr 画像ID, 画像サイズ%&gt;</pre>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants