Sha256: beadf52129de6dd1e7dbf79ba5ed2c4566861e2737e3f2867063806b2b1067f3

Contents?: true

Size: 1.47 KB

Versions: 20

Compression:

Stored size: 1.47 KB

Contents

# daily_theme.rb
#
# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
# Distributed under the GPL
#

def css_tag
	theme_name = File::basename( @css, '.css' )
	css_url = @css

	if @mode =~ /conf$/
		css_url = "#{h theme_url}/conf.css"
		theme_name = 'conf'
	elsif @conf.options.include?('daily_theme.list') && @conf.options['daily_theme.list'].size > 0
		theme_list = @conf.options['daily_theme.list'].split(/\n/)
		index = Time.now.yday % theme_list.size
		theme_name = theme_list[index].strip
		css_url = "#{h theme_url}/#{u theme_name}/#{u theme_name}.css"
	end

	<<-CSS
	<link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all">
	<link rel="stylesheet" href="#{h css_url}" title="#{h theme_name}" type="text/css" media="all">
	CSS
end

add_conf_proc( 'daily_theme', @daily_theme_label, 'theme' ) do
	daily_theme_conf_proc
end

def daily_theme_conf_proc
	if @mode == 'saveconf'
		if @cgi.params['daily_theme.list'] && @cgi.params['daily_theme.list'][0]
			@conf['daily_theme.list'] = @cgi.params['daily_theme.list'][0]
		else
			@conf['daily_theme.list'] = nil
		end
	end

	# initialize Theme list
	@conf['daily_theme.list'] = "default" unless @conf['daily_theme.list']

	result = <<-HTML
	<h3>#{@daily_theme_label}</h3>
	<p>#{@daily_theme_label_desc}</p>
	<p><textarea name="daily_theme.list" cols="70" rows="20">#{h( @conf['daily_theme.list'] )}</textarea></p>
	HTML
end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
tdiary-4.0.4 misc/plugin/daily_theme.rb
tdiary-4.0.3 misc/plugin/daily_theme.rb
tdiary-4.0.2.20140201 misc/plugin/daily_theme.rb
tdiary-4.0.2 misc/plugin/daily_theme.rb
tdiary-4.0.1.20131102 misc/plugin/daily_theme.rb
tdiary-4.0.1.20130929 misc/plugin/daily_theme.rb
tdiary-4.0.1.20130903 misc/plugin/daily_theme.rb
tdiary-4.0.1 misc/plugin/daily_theme.rb
tdiary-4.0.0.20130826 misc/plugin/daily_theme.rb
tdiary-4.0.0 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130727 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130722 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130720 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130617 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130614 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130604 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130527 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130518 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130508 misc/plugin/daily_theme.rb
tdiary-3.2.2.20130507 misc/plugin/daily_theme.rb