Sha256: 0c18131a90b194e32c3c3494aefb2751c8627e4829bd866582461a95fa45b6d7

Contents?: true

Size: 935 Bytes

Versions: 39

Compression:

Stored size: 935 Bytes

Contents

# theme_online.rb: choice theme from online repository on tDiary.org
#
# options:
#    @options['theme_online.url']: top level URL of another theme site
#
# Copyright (C) 2014 by TADA Tadashi <t@tdtds.jp>
# You can distribute and/or modify it under GPL2 or any later version.
#
require 'json'
require 'open-uri'

def theme_list_online(list)
	url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/'
	url = "http:#{url}" if url =~ %r|\A//|
	begin
		online_list = JSON.load(open(File.join(url, 'themes.json'), &:read))['themes']
		list + online_list.keys.map do |t|
			title = online_list[t]['title']
			label = t == title ? '' : " (#{title})"
			["online/#{t}", "#{t}#{label}"]
		end
	rescue
		@logger.error "could not get theme list from online: #$!"
		list
	end
end

def theme_url_online(theme)
	url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/'
	File.join(url, "#{h theme}/#{h theme}.css")
end

Version data entries

39 entries across 29 versions & 1 rubygems

Version Path
tdiary-5.3.0 misc/plugin/theme_online.rb
tdiary-5.2.4 misc/plugin/theme_online.rb
tdiary-5.2.3 misc/plugin/theme_online.rb
tdiary-5.2.2 misc/plugin/theme_online.rb
tdiary-5.2.1 misc/plugin/theme_online.rb
tdiary-5.2.0 misc/plugin/theme_online.rb
tdiary-5.1.7 misc/plugin/theme_online.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/theme_online.rb
tdiary-5.1.6 misc/plugin/theme_online.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/misc/plugin/theme_online.rb
tdiary-5.1.5 misc/plugin/theme_online.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/theme_online.rb
tdiary-5.1.4 misc/plugin/theme_online.rb
tdiary-5.1.3 misc/plugin/theme_online.rb
tdiary-5.1.2 misc/plugin/theme_online.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/theme_online.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/theme_online.rb
tdiary-5.1.1 misc/plugin/theme_online.rb
tdiary-5.1.0 misc/plugin/theme_online.rb
tdiary-5.0.14 misc/plugin/theme_online.rb