lib/tdiary/plugin/00default.rb in tdiary-4.1.3 vs lib/tdiary/plugin/00default.rb in tdiary-4.2.0

- old
+ new

@@ -204,10 +204,11 @@ add_header_proc do calc_links <<-HEADER <meta http-equiv="Content-Type" content="text/html; charset=#{h charset}"> <meta name="generator" content="tDiary #{h TDIARY_VERSION}"> + <meta name="viewport" content="width=device-width,initial-scale=1"> #{last_modified_header} #{content_script_type} #{author_name_tag} #{author_mail_tag} #{index_page_tag} @@ -215,18 +216,17 @@ #{default_ogp} #{description_tag} #{jquery_tag.chomp} #{script_tag.chomp} #{css_tag.chomp} - #{smartphone_tag.chomp} #{title_tag.chomp} #{robot_control.chomp} HEADER end def calc_links - if /day|edit/ =~ @mode or (@cgi.mobile_agent? and /latest|month|nyear/ =~ @mode) then + if /day|edit/ =~ @mode then today = @date.strftime('%Y%m%d') days = [] yms = [] this_month = today[0,6] @@ -259,15 +259,11 @@ @next_day = (Time.local(y, m, d) + 24*60*60).strftime( '%Y%m%d' ) end end def charset - if @cgi.mobile_agent? then - @conf.mobile_encoding - else - @conf.encoding - end + @conf.encoding end def last_modified_header if @last_modified then %Q|<meta http-equiv="Last-Modified" content="#{CGI::rfc1123_date( @last_modified )}">| @@ -421,25 +417,10 @@ <link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all"> <link rel="stylesheet" href="#{h css}" title="#{h title}" type="text/css" media="all"> CSS end -def smartphone_tag - if @cgi.smartphone? then - <<-CSS -<meta name = "viewport" content = "width = device-width"> - <style type="text/css"><!-- - form.comment textarea { - width: 80%; - } - --></style> - CSS - else - '' - end -end - def robot_control if /^form|edit|preview|showcomment$/ =~ @mode then '<meta name="robots" content="noindex,nofollow">' else '' @@ -466,11 +447,11 @@ add_title_proc do |date, title| nyear_link( date, title ) end def nyear_link( date, title ) - if @conf.show_nyear and @mode != 'nyear' and !@cgi.mobile_agent? then + if @conf.show_nyear and @mode != 'nyear' then m = date.strftime( '%m' ) d = date.strftime( '%d' ) years = @years.find_all {|year, months| months.include? m} if years.length >= 2 then %Q|#{title} <span class="nyear">[<a href="#{h @conf.index}#{anchor m + d}" title="#{h(nyear_diary_title)}">#{nyear_diary_label}</a>]</span>| @@ -523,24 +504,19 @@ end def subtitle_link( date, index, subtitle ) r = '' - if @cgi.mobile_agent? then - r << %Q[<A NAME="p#{'%02d' % index}">*</A> ] - r << %Q|(#{h @author})| if @multi_user and @author and subtitle - else - if date then - r << "<a " - r << %Q[name="p#{'%02d' % index}" ] if @anchor_name - param = "#{date.strftime( '%Y%m%d' )}#p#{'%02d' % index}" - titleattr = (not subtitle or subtitle.empty?) ? '' : %Q[ title="#{remove_tag( apply_plugin( subtitle )).gsub( /"/, "&quot;" )}"] - r << %Q[href="#{h @conf.index}#{anchor param}"#{titleattr}>#{@conf.section_anchor}</a> ] - end - - r << %Q[(#{h @author}) ] if @multi_user and @author and subtitle + if date then + r << "<a " + r << %Q[name="p#{'%02d' % index}" ] if @anchor_name + param = "#{date.strftime( '%Y%m%d' )}#p#{'%02d' % index}" + titleattr = (not subtitle or subtitle.empty?) ? '' : %Q[ title="#{remove_tag( apply_plugin( subtitle )).gsub( /"/, "&quot;" )}"] + r << %Q[href="#{h @conf.index}#{anchor param}"#{titleattr}>#{@conf.section_anchor}</a> ] end + + r << %Q[(#{h @author}) ] if @multi_user and @author and subtitle r << make_category_link( subtitle ) end # # make anchor tag in my diary @@ -841,10 +817,10 @@ r << <<-HTML </select> <input name="css" size="30" value="#{h @conf.css}"> </p> <p><img id="theme_thumbnail" src="http://www.tdiary.org/theme.image/#{img}.jpg" alt="#{@theme_thumbnail_label}"></p> - #{@theme_location_comment unless @cgi.mobile_agent?} + #{@theme_location_comment} HTML end def theme_list_local(list) theme_paths = [::TDiary::PATH, TDiary.server_root].map {|d| "#{d}/theme/*" }