layouts/default: move <script> tag from header to footer.
* Inline Javascript in the <head> is a minor bottleneck because it blocks page rendering. * Fix antiproxying protection (proxy sites like to strip <script> tags from the header).
This commit is contained in:
@@ -53,16 +53,6 @@
|
|||||||
"url" : "<%= root_url %>"
|
"url" : "<%= root_url %>"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
|
||||||
if (typeof window.Danbooru !== "object") {
|
|
||||||
window.Danbooru = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
window.Danbooru.config = <%= [:hostname, :domain, :enable_antiproxying?].map { |opt| [opt, Danbooru.config.send(opt)] }.to_h.to_json.html_safe %>;
|
|
||||||
window.Danbooru.notice = Danbooru.Utility.notice;
|
|
||||||
window.Danbooru.error = Danbooru.Utility.error;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<%= tag.meta name: "description", content: meta_description %>
|
<%= tag.meta name: "description", content: meta_description %>
|
||||||
|
|
||||||
<%= tag.meta property: "og:type", content: "website" %>
|
<%= tag.meta property: "og:type", content: "website" %>
|
||||||
@@ -125,6 +115,16 @@
|
|||||||
<%= yield :layout %>
|
<%= yield :layout %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
if (typeof window.Danbooru !== "object") {
|
||||||
|
window.Danbooru = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Danbooru.config = <%= [:hostname, :domain, :enable_antiproxying?].map { |opt| [opt, Danbooru.config.send(opt)] }.to_h.to_json.html_safe %>;
|
||||||
|
window.Danbooru.notice = Danbooru.Utility.notice;
|
||||||
|
window.Danbooru.error = Danbooru.Utility.error;
|
||||||
|
</script>
|
||||||
|
|
||||||
<%= render "static/footer" %>
|
<%= render "static/footer" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user