/usr/share/tdiary/contrib/plugin/socialbutton.rb is in tdiary-contrib 3.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # socialbutton.rb
#
# Copyright (c) 2011 MATSUOKA Kohei <kmachu@gmail.com>
# You can redistribute it and/or modify it under GPL2.
#
# enable social button names
@conf['socialbutton.enables'] ||= 'twitter,hatena,facebook_like'
# screen name of the user to attribute the tweet to
@conf['socialbutton.twitter.via'] ||= ''
def socialbutton_js_settings
enable_js('jquery.socialbutton.js')
enable_js('socialbutton.js')
add_js_setting('$tDiary.plugin.socialbutton')
# convert array to json
add_js_setting('$tDiary.plugin.socialbutton.enables',
%Q|["#{@conf['socialbutton.enables'].split(',').join('", "')}"]|)
if @conf['socialbutton.twitter.via'] != ''
options = "{ twitter: { via: '#{@conf['socialbutton.twitter.via']}' } }"
else
options = "{}"
end
add_js_setting('$tDiary.plugin.socialbutton.options', options)
end
socialbutton_footer = Proc.new { %Q|<div class="socialbuttons"></div>| }
if blogkit?
add_body_leave_proc(socialbutton_footer)
else
add_section_leave_proc(socialbutton_footer)
end
add_conf_proc('socialbutton', @socialbutton_label_conf) do
@conf['socialbutton.enables'] ||= []
if @mode == 'saveconf'
@conf['socialbutton.enables'] = @cgi.params['socialbutton.enables'].join(",")
@conf['socialbutton.twitter.via'] = @cgi.params['socialbutton.twitter.via'][0]
end
result = <<-HTML
<h3>#{@socialbutton_label_enables}</h3>
<ul>
HTML
['twitter', 'hatena', 'evernote', 'facebook_like', 'google_plusone', 'pinterest'].each do |service|
checked = @conf['socialbutton.enables'].index(service) ? 'checked' : ''
id = "socialbutton.enables.#{service}"
result << %Q|<li><input id="#{id}" name="socialbutton.enables" type="checkbox" value="#{service}" #{checked}>|
result << %Q|<label for="#{id}">#{service}</label></li>|
end
result << <<-HTML
</ul>
<h3>#{@socialbutton_label_twitter_via}</h3>
<p><input name="socialbutton.twitter.via" value="#{h(@conf['socialbutton.twitter.via'])}"></p>
HTML
end
# load javascript
socialbutton_js_settings()
|