Permalink
Browse files

Run all this privately.

  • Loading branch information...
1 parent 620e81b commit f619910b923bbf8bd688b474aad3eb1e88b22172 @lamby committed Mar 7, 2014
Showing with 19 additions and 17 deletions.
  1. +19 −17 js/injected.js
View
@@ -1,22 +1,24 @@
-var view = Strava.Labs.Activities.SegmentLeaderboardView;
-var fn = view.prototype.render;
+(function() {
+ var view = Strava.Labs.Activities.SegmentLeaderboardView;
+ var fn = view.prototype.render;
-view.prototype.render = function () {
- var elem = jQuery(this.el);
- var result = fn.apply(this, Array.prototype.slice.call(arguments));
+ view.prototype.render = function () {
+ var elem = jQuery(this.el);
+ var result = fn.apply(this, Array.prototype.slice.call(arguments));
- if (elem.hasClass('once-only')) {
- return result;
- }
+ if (elem.hasClass('once-only')) {
+ return result;
+ }
- // Only perform logic once per dropdown to avoid infinite loop.
- elem.addClass('once-only');
+ // Only perform logic once per dropdown to avoid infinite loop.
+ elem.addClass('once-only');
- // Only show "My Results" if we have at least one, which we can infer from
- // whether we have a PR listed.
- if (elem.find('.pr-comparison time').last().text().trim() !== "s") {
- elem.find('.clickable[data-filter=my_results]').click();
- }
+ // Only show "My Results" if we have at least one, which we can infer from
+ // whether we have a PR listed.
+ if (elem.find('.pr-comparison time').last().text().trim() !== "s") {
+ elem.find('.clickable[data-filter=my_results]').click();
+ }
- return result;
-};
+ return result;
+ };
+})();

0 comments on commit f619910

Please sign in to comment.