Unregister auto-adjust partial/_head.html.erb

This commit is contained in:
chiu 2026-06-05 11:08:05 +00:00
parent 193e98e3b1
commit 7ec2af1c49
1 changed files with 22 additions and 22 deletions

View File

@ -48,28 +48,28 @@ if bundle_update_flag
change_text_fix1 = '<a title="{{site_title_1}}" class="" href="{{home_link_1}}"><img class="site-logo" src="{{logo_url_1}}" alt="Site Logo"></a><script>$(document).ready(function(){var url =$(\'.site-logo\').eq(0).attr(\'src\');if(url == "/assets/default-site-logo.png"){if($(\'.navbar-brand\').length != 0){$(\'.navbar-brand\').eq(0).remove();}else{$(\'.site-title >a\').eq(0).remove();}};if($(\'.navbar-brand\').length == 2 || $(\'.site-title >a\').length == 2){$(\'.site-logo\').css(\'height\',\'auto\')};$(\'.site-logo\').eq(0).css(\'margin-right\',0);$(\'.navbar-brand\').css(\'padding-right\',0)})</script><a title="{{site_title}}" class="" href="{{home_link}}"><img class="site-logo" src="{{logo_url}}" alt="Site Logo"> {{site_name}}</a>'
all_template.each do |folder|
if !folder.include?('mobile')
begin
filename = folder+'partial/_head.html.erb'
texts = File.read(filename).force_encoding('UTF-8')
new_texts = texts.gsub(/<.*javascript_include_tag.*bootstrap.*>/,"<%= javascript_include_tag \"bootstrap.min\"%>")
bootstrap_count = 0
new_texts = new_texts.gsub("<%= javascript_include_tag \"bootstrap.min\"%>"){|t|
bootstrap_count += 1
(bootstrap_count > 1) ? "" : t
}
if new_texts.include?('jquery_prefix')
new_texts = new_texts.gsub(/<.*javascript_include_tag.*\/jquery\.min.*>|<.*javascript_include_tag.*\/jquery-1\.11\.0\.min.*>/,"<%= javascript_include_tag \"jquery.min\"%>")
else
new_texts = new_texts.gsub(/<%= javascript_include_tag \"jquery.min\"%>/,"<%= javascript_include_tag \"jquery.min\"%>\n\t<%= javascript_include_tag \"jquery_prefix\"%>")
end
if texts != new_texts
File.open(filename,'w') do |f|
f.write new_texts
end
end
rescue => e
puts "#{e.inspect}\nnot found #{folder}partial/_head.html.erb"
end
#begin
# filename = folder+'partial/_head.html.erb'
# texts = File.read(filename).force_encoding('UTF-8')
# new_texts = texts.gsub(/<.*javascript_include_tag.*bootstrap.*>/,"<%= javascript_include_tag \"bootstrap.min\"%>")
# bootstrap_count = 0
# new_texts = new_texts.gsub("<%= javascript_include_tag \"bootstrap.min\"%>"){|t|
# bootstrap_count += 1
# (bootstrap_count > 1) ? "" : t
# }
# if new_texts.include?('jquery_prefix')
# new_texts = new_texts.gsub(/<.*javascript_include_tag.*\/jquery\.min.*>|<.*javascript_include_tag.*\/jquery-1\.11\.0\.min.*>/,"<%= javascript_include_tag \"jquery.min\"%>")
# else
# new_texts = new_texts.gsub(/<%= javascript_include_tag \"jquery.min\"%>/,"<%= javascript_include_tag \"jquery.min\"%>\n\t<%= javascript_include_tag \"jquery_prefix\"%>")
# end
# if texts != new_texts
# File.open(filename,'w') do |f|
# f.write new_texts
# end
# end
#rescue => e
# puts "#{e.inspect}\nnot found #{folder}partial/_head.html.erb"
#end
begin
begin