<!DOCTYPE html>
<html class="action-<%= params[:controller] %> action-<%= params[:controller] %>-<%= params[:action] %> <%= 'hide-advanced-editing' if !@current_user.show_advanced_editing %>">
<head>
<% if params[:tags] =~ /(\A(source:|fav:|date:|rating:|mpixels:|parent:|sub:|vote:|score:|order:|user:|limit:|holds:|pool:|[~-])|[ *])/ %>
<meta name="robots" content="noindex, follow">
<% end %>
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
  <title><%= html_title %></title>
  <% if @meta_description %>
    <%= tag "meta", :name => "description", :content => @meta_description %>
  <% end %>
  <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
  <link rel="top" title="<%= CONFIG["app_name"] %>" href="/">
  <% if @canonical_url.present? %>
    <%= tag 'link', :rel => 'canonical', :href => @canonical_url %>
  <% end %>
  <%# The javascript-hide class is used to hide elements (eg. blacklisted posts) from JavaScript. %>
  <script type="text/javascript">
    var css = ".javascript-hide { display: none !important; }";
    var style = document.createElement("style"); style.type = "text/css";
    if(style.styleSheet) // IE
      style.styleSheet.cssText = css;
    else
      style.appendChild(document.createTextNode(css));
    document.getElementsByTagName("head")[0].appendChild(style);
  </script>

  <%= yield :html_header %>
  <%= auto_discovery_link_tag :atom, :controller => "/post", :action => "atom", :tags => params[:tags] %>
  <%= stylesheet_link_tag :application %>

  <script id="user-blacklisted-tags" type="application/json">
    <%= json_escape @current_user.blacklisted_tags_array.to_json.html_safe %>
  </script>

  <script type="text/javascript">
    window.locale = {
      current: "<%= I18n.locale %>",
      default: "<%= I18n.default_locale %>",
    }
  </script>

  <%= javascript_include_tag :application_classic %>
  <%= javascript_include_tag 'application.jsout', extname: false %>

  <%= tag :link, :rel => 'search', :type => Mime[:opensearch], :href => opensearch_path(:xml), :title => CONFIG['app_name'] %>
  <%= CONFIG["custom_html_headers"] %>
  <%= csrf_meta_tag %>
</head>
<body>
  <%= render :partial => "layouts/notice" %>
  <% if content_for? :content %>
    <%= yield :content %>
  <% else %>
    <div id="content">
      <%= yield %>
    </div>
  <% end %>
  <%= yield(:post_cookie_javascripts) %>
  <%= render 'layouts/ga' if CONFIG['ga-tracking-id'] -%>
  <%= render 'layouts/piwik' if CONFIG["piwik_site_id"] and CONFIG["piwik_host"] -%>
</body>
</html>
