lib/tdiary/plugin/00default.rb in tdiary-5.0.0 vs lib/tdiary/plugin/00default.rb in tdiary-5.0.1
- old
+ new
@@ -1,6 +1,5 @@
-# -*- coding: utf-8 -*-
#
# 00default.rb: default plugins
#
# Copyright (C) 2010, TADA Tadashi <t@tdtds.jp>
# You can redistribute it and/or modify it under GPL2 or any later version.
@@ -353,15 +352,15 @@
def jquery_tag
%Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>]
end
-enable_js( '00default.js' )
+enable_js( '00default.js', async: false )
add_js_setting( '$tDiary.style', "'#{@conf.style.downcase.sub( /\Ablog/, '' )}'" )
if /^form|edit|preview|showcomment/ =~ @mode
- enable_js( '02edit.js' )
+ enable_js( '02edit.js', async: true )
end
def script_tag_query_string
"?#{TDIARY_VERSION}#{Time::now.strftime('%Y%m%d')}"
end
@@ -371,15 +370,16 @@
end
def script_tag
require 'uri'
query = script_tag_query_string
- html = @javascripts.sort.map {|script|
+ html = @javascripts.keys.sort.map {|script|
+ async = @javascripts[script][:async] ? "async" : ""
if URI(script).scheme or script =~ %r|\A//|
- %Q|<script src="#{script}"></script>|
+ %Q|<script src="#{script}" #{async}></script>|
else
- %Q|<script src="#{js_url}/#{script}#{query}"></script>|
+ %Q|<script src="#{js_url}/#{script}#{query}" #{async}></script>|
end
}.join( "\n\t" )
html << "\n" << <<-HEAD
<script><!--
#{@javascript_setting.map{|a| "#{a[0]} = #{a[1]};"}.join("\n\t\t")}
@@ -747,10 +747,10 @@
#
# preferences (saving methods)
#
if @mode =~ /conf|saveconf/
- enable_js( '01conf.js' )
+ enable_js( '01conf.js', async: true )
end
# basic (default)
def saveconf_default
if @mode == 'saveconf' then