Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use either Airbrake or Hoptoad object.

The current http://airbrakeapp.com/javascripts/notifier.js (v0.1.0)
defines a Hoptoad object, which Airbrake 3.0 expects an Airbrake object.
Add Hoptoad as a fall-back. Also wrap the first javascript with a
closure so it won't pollute the global namespace.
  • Loading branch information...
commit 8670b27d44a090ec9edfc36ca9b6ade6c998ef11 1 parent 74dc4ce
@romanbsd romanbsd authored Harold Giménez committed
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/templates/javascript_notifier.erb
View
8 lib/templates/javascript_notifier.erb
@@ -1,13 +1,15 @@
<%= javascript_tag %Q{
+ (function(){
var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + notifierJsScheme + "#{host}/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
- }
-%>
+ })();
+}%>
<%= javascript_tag %Q{
+ window.Airbrake = Airbrake || Hoptoad;
Airbrake.setKey('#{api_key}');
Airbrake.setHost('#{host}');
Airbrake.setEnvironment('#{environment}');
Airbrake.setErrorDefaults({ url: "#{escape_javascript url}", component: "#{controller_name}", action: "#{action_name}" });
- }
+ }
%>
Please sign in to comment.
Something went wrong with that request. Please try again.