diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-11 21:15:03 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-12-27 14:07:52 -0600 |
commit | a6ed18cc714f43eea9ecbd5060ad6c26060a628e (patch) | |
tree | 25aa00d280aef65b08d46e2dc1c759cd34c9ca62 /app | |
parent | 293eed4d635692e1c608308bb545a15e33d13c38 (diff) | |
download | gitlab-ce-a6ed18cc714f43eea9ecbd5060ad6c26060a628e.tar.gz |
remove superfluous return statements generated by coffeescript
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/preview_markdown.js | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/app/assets/javascripts/preview_markdown.js b/app/assets/javascripts/preview_markdown.js index 1e261cd49c2..2526cd391f0 100644 --- a/app/assets/javascripts/preview_markdown.js +++ b/app/assets/javascripts/preview_markdown.js @@ -22,14 +22,14 @@ mdText = form.find('textarea.markdown-area').val(); if (mdText.trim().length === 0) { preview.text('Nothing to preview.'); - return this.hideReferencedUsers(form); + this.hideReferencedUsers(form); } else { preview.text('Loading...'); - return this.renderMarkdown(mdText, (function(_this) { + this.renderMarkdown(mdText, (function(_this) { return function(response) { preview.html(response.body); preview.renderGFM(); - return _this.renderReferencedUsers(response.references.users, form); + _this.renderReferencedUsers(response.references.users, form); }; })(this)); } @@ -40,9 +40,10 @@ return; } if (text === this.ajaxCache.text) { - return success(this.ajaxCache.response); + success(this.ajaxCache.response); + return; } - return $.ajax({ + $.ajax({ type: 'POST', url: window.preview_markdown_path, data: { @@ -55,16 +56,14 @@ text: text, response: response }; - return success(response); + success(response); }; })(this) }); }; MarkdownPreview.prototype.hideReferencedUsers = function(form) { - var referencedUsers; - referencedUsers = form.find('.referenced-users'); - return referencedUsers.hide(); + form.find('.referenced-users').hide(); }; MarkdownPreview.prototype.renderReferencedUsers = function(users, form) { @@ -73,15 +72,14 @@ if (referencedUsers.length) { if (users.length >= this.referenceThreshold) { referencedUsers.show(); - return referencedUsers.find('.js-referenced-users-count').text(users.length); + referencedUsers.find('.js-referenced-users-count').text(users.length); } else { - return referencedUsers.hide(); + referencedUsers.hide(); } } }; return MarkdownPreview; - })(); markdownPreview = new window.MarkdownPreview(); @@ -93,15 +91,14 @@ lastTextareaPreviewed = null; $.fn.setupMarkdownPreview = function() { - var $form, form_textarea; - $form = $(this); - form_textarea = $form.find('textarea.markdown-area'); - form_textarea.on('input', function() { - return markdownPreview.hideReferencedUsers($form); - }); - return form_textarea.on('blur', function() { - return markdownPreview.showPreview($form); - }); + var $form = $(this); + $form.find('textarea.markdown-area') + .on('input', function() { + markdownPreview.hideReferencedUsers($form); + }) + .on('blur', function() { + markdownPreview.showPreview($form); + }); }; $(document).on('markdown-preview:show', function(e, $form) { @@ -115,7 +112,7 @@ // toggle content $form.find('.md-write-holder').hide(); $form.find('.md-preview-holder').show(); - return markdownPreview.showPreview($form); + markdownPreview.showPreview($form); }); $(document).on('markdown-preview:hide', function(e, $form) { @@ -129,7 +126,7 @@ // toggle content $form.find('.md-write-holder').show(); $form.find('textarea.markdown-area').focus(); - return $form.find('.md-preview-holder').hide(); + $form.find('.md-preview-holder').hide(); }); $(document).on('markdown-preview:toggle', function(e, keyboardEvent) { @@ -137,11 +134,11 @@ $target = $(keyboardEvent.target); if ($target.is('textarea.markdown-area')) { $(document).triggerHandler('markdown-preview:show', [$target.closest('form')]); - return keyboardEvent.preventDefault(); + keyboardEvent.preventDefault(); } else if (lastTextareaPreviewed) { $target = lastTextareaPreviewed; $(document).triggerHandler('markdown-preview:hide', [$target.closest('form')]); - return keyboardEvent.preventDefault(); + keyboardEvent.preventDefault(); } }); @@ -149,14 +146,14 @@ var $form; e.preventDefault(); $form = $(this).closest('form'); - return $(document).triggerHandler('markdown-preview:show', [$form]); + $(document).triggerHandler('markdown-preview:show', [$form]); }); $(document).on('click', writeButtonSelector, function(e) { var $form; e.preventDefault(); $form = $(this).closest('form'); - return $(document).triggerHandler('markdown-preview:hide', [$form]); + $(document).triggerHandler('markdown-preview:hide', [$form]); }); }).call(this); |