root/platform/tdiary/plugin/hb_footer4sec_js.rb @ 9986

Revision 9986, 0.9 kB (checked in by hsbt, 7 years ago)

platform/tdiary/plugin/hb_footer4sec_js.rb: bugfix. escape uri.

Line 
1# hb_footer4sec_js.rb $Revision 1.0 $
2#
3# Copyright (c) 2008 SHIBATA Hiroshi <h-sbt@nifty.com>
4# You can redistribute it and/or modify it under GPL2.
5#
6
7def permalink( date, index )
8        ymd = date.strftime( "%Y%m%d" )
9        uri = @conf.index.dup
10        uri[0, 0] = @conf.base_url unless %r|^https?://|i =~ uri
11        uri.gsub!( %r|/\./|, '/' )
12
13        uri + anchor( "#{ymd}p%02d" % index )
14end
15
16add_section_leave_proc do |date, index|
17        if @mode == 'day' and not bot? and not @conf.mobile_agent? then
18                <<-SCRIPT
19                <script type= "text/javascript">/*<![CDATA[*/
20                var hatena_bookmark_anywhere_limit = 10;
21                var hatena_bookmark_anywhere_style = true;
22                var hatena_bookmark_anywhere_collapse = true;
23                var hatena_bookmark_anywhere_url = "#{permalink(date, index)}";
24                /*]]>*/</script>
25                <script src="#{@conf.base_url}hatena-bookmark-anywhere.js" type="text/javascript" charset="utf-8"></script>
26                <div id="hatena_bookmark_anywhere"></div>
27                SCRIPT
28        end
29end
Note: See TracBrowser for help on using the browser.