Sha256: 2304cfdbd1f7c6031ef6b1d266abee61a63d45e5b93f86926bd83a8347964c93

Contents?: true

Size: 1010 Bytes

Versions: 52

Compression:

Stored size: 1010 Bytes

Contents

# -*- coding: utf-8; -*-
#
# lazy_referer.rb: lazy loading referer
#
# Copyright (C) 2013 by MATSUOKA Kohei <kmachu@gmail.com>
# You can distribute it under GPL.
#
if /^(day|form|edit)$/ =~ @mode and not bot? then
	enable_js('referer.js')

	#
	# overwrite method: draw only referer area (content will feach with ajax)
	#
	def referer_of_today_long( diary, limit )
		return if limit == 0
		return unless diary
		date = diary.date.strftime('%Y%m%d')
		# FIXME: endpoint is should created by TDiary::Plugin, because easy customize routing
		endpoint = "#{@conf.index}?plugin=referer&date=#{date}"
		%Q[<button class="lazy_referer" style="padding: 0.5em; width: 20em;" data-endpoint="#{h endpoint}">#{referer_today}</button>\n]
	end
end

#
# return referer of date as is (html)
#
add_content_proc('referer') do |date|
	diary = @diaries[date]
	referer_load_current( diary )
	referer_of_today_long( diary, 100 )
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:

Version data entries

52 entries across 46 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 plugin/lazy_referer.rb
tdiary-contrib-5.2.4 plugin/lazy_referer.rb
tdiary-contrib-5.2.3 plugin/lazy_referer.rb
tdiary-contrib-5.2.2 plugin/lazy_referer.rb
tdiary-contrib-5.2.1 plugin/lazy_referer.rb
tdiary-contrib-5.2.0 plugin/lazy_referer.rb
tdiary-contrib-5.1.7 plugin/lazy_referer.rb
tdiary-contrib-5.1.6 plugin/lazy_referer.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/lazy_referer.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/plugin/lazy_referer.rb
tdiary-contrib-5.1.5 plugin/lazy_referer.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/lazy_referer.rb
tdiary-contrib-5.1.4 plugin/lazy_referer.rb
tdiary-contrib-5.1.3 plugin/lazy_referer.rb
tdiary-contrib-5.1.2 plugin/lazy_referer.rb
tdiary-contrib-5.1.1 plugin/lazy_referer.rb
tdiary-contrib-5.1.0 plugin/lazy_referer.rb
tdiary-contrib-5.0.13 plugin/lazy_referer.rb
tdiary-contrib-5.0.12 plugin/lazy_referer.rb
tdiary-contrib-5.0.11 plugin/lazy_referer.rb