<%# locals: (script_version:, version_param: nil, format_override: nil)  %>

<%
script = script_version.script
install_as_js = script.js? || format_override == 'js'
code_url = script.code_url(sleazy: sleazy?, cn_greasy: cn_greasy?, format_override:, version_id: version_param)
%>
<%= link_to install_as_js ? t('scripts.install') : t('scripts.install_css'), code_url, {
  class: 'install-link',
  'data-install-format' => install_as_js ? 'js' : 'css',
  'data-ping-url' => install_ping_script_path(script.id, authenticity_token: @caching_request ? PageCache::CSRF_TOKEN : session[:_csrf_token], locale_override: nil),
  'data-post-install-url' => post_install_script_url(script),
  'data-ip-address' => @caching_request ? PageCache::IP_ADDRESS : request.remote_ip,
  'data-script-id' => script.id,
  'data-ping-key' => install_keys.first,
  'data-is-previous-version' => version_param.present?,
  'data-previous-version-warning' => t('scripts.old_version_warning'),
  rel: 'nofollow',
  'data-script-name' => script.default_name,
  'data-script-namespace' => script.namespace,
  'data-script-version' => script_version.version,
  'data-update-label' => t('scripts.update', version: script_version.version),
  'data-downgrade-label' => t('scripts.downgrade', version: script_version.version),
  'data-reinstall-label' => t('scripts.reinstall', version: script_version.version),
} -%>
