summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/star.js
diff options
context:
space:
mode:
authorMike Greiling <mgreiling@gitlab.com>2017-07-05 17:20:41 +0000
committerClement Ho <clemmakesapps@gmail.com>2017-07-05 17:20:41 +0000
commitc06dad62e1004eb5b4f2251a233f740d3fa2a5c2 (patch)
tree78346e13ce069442c662bb14e7b33bb607c3f2d6 /app/assets/javascripts/star.js
parent11e03bf49c9dfc220c29129498996d52cd4276e2 (diff)
downloadgitlab-ce-c06dad62e1004eb5b4f2251a233f740d3fa2a5c2.tar.gz
Remove IIFEs around several javascript classes
Diffstat (limited to 'app/assets/javascripts/star.js')
-rw-r--r--app/assets/javascripts/star.js50
1 files changed, 24 insertions, 26 deletions
diff --git a/app/assets/javascripts/star.js b/app/assets/javascripts/star.js
index c75b44cc2fd..840ae1edd9d 100644
--- a/app/assets/javascripts/star.js
+++ b/app/assets/javascripts/star.js
@@ -1,30 +1,28 @@
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-unused-vars, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, no-new, max-len */
/* global Flash */
-(function() {
- this.Star = (function() {
- function Star() {
- $('.project-home-panel .toggle-star').on('ajax:success', function(e, data, status, xhr) {
- var $starIcon, $starSpan, $this, toggleStar;
- $this = $(this);
- $starSpan = $this.find('span');
- $starIcon = $this.find('i');
- toggleStar = function(isStarred) {
- $this.parent().find('.star-count').text(data.star_count);
- if (isStarred) {
- $starSpan.removeClass('starred').text('Star');
- $starIcon.removeClass('fa-star').addClass('fa-star-o');
- } else {
- $starSpan.addClass('starred').text('Unstar');
- $starIcon.removeClass('fa-star-o').addClass('fa-star');
- }
- };
- toggleStar($starSpan.hasClass('starred'));
- }).on('ajax:error', function(e, xhr, status, error) {
- new Flash('Star toggle failed. Try again later.', 'alert');
- });
- }
+window.Star = (function() {
+ function Star() {
+ $('.project-home-panel .toggle-star').on('ajax:success', function(e, data, status, xhr) {
+ var $starIcon, $starSpan, $this, toggleStar;
+ $this = $(this);
+ $starSpan = $this.find('span');
+ $starIcon = $this.find('i');
+ toggleStar = function(isStarred) {
+ $this.parent().find('.star-count').text(data.star_count);
+ if (isStarred) {
+ $starSpan.removeClass('starred').text('Star');
+ $starIcon.removeClass('fa-star').addClass('fa-star-o');
+ } else {
+ $starSpan.addClass('starred').text('Unstar');
+ $starIcon.removeClass('fa-star-o').addClass('fa-star');
+ }
+ };
+ toggleStar($starSpan.hasClass('starred'));
+ }).on('ajax:error', function(e, xhr, status, error) {
+ new Flash('Star toggle failed. Try again later.', 'alert');
+ });
+ }
- return Star;
- })();
-}).call(window);
+ return Star;
+})();