Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a6ed18cc
Commit
a6ed18cc
authored
Dec 11, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove superfluous return statements generated by coffeescript
parent
293eed4d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
27 deletions
+24
-27
app/assets/javascripts/preview_markdown.js
app/assets/javascripts/preview_markdown.js
+24
-27
No files found.
app/assets/javascripts/preview_markdown.js
View file @
a6ed18cc
...
@@ -22,14 +22,14 @@
...
@@ -22,14 +22,14 @@
mdText
=
form
.
find
(
'
textarea.markdown-area
'
).
val
();
mdText
=
form
.
find
(
'
textarea.markdown-area
'
).
val
();
if
(
mdText
.
trim
().
length
===
0
)
{
if
(
mdText
.
trim
().
length
===
0
)
{
preview
.
text
(
'
Nothing to preview.
'
);
preview
.
text
(
'
Nothing to preview.
'
);
return
this
.
hideReferencedUsers
(
form
);
this
.
hideReferencedUsers
(
form
);
}
else
{
}
else
{
preview
.
text
(
'
Loading...
'
);
preview
.
text
(
'
Loading...
'
);
return
this
.
renderMarkdown
(
mdText
,
(
function
(
_this
)
{
this
.
renderMarkdown
(
mdText
,
(
function
(
_this
)
{
return
function
(
response
)
{
return
function
(
response
)
{
preview
.
html
(
response
.
body
);
preview
.
html
(
response
.
body
);
preview
.
renderGFM
();
preview
.
renderGFM
();
return
_this
.
renderReferencedUsers
(
response
.
references
.
users
,
form
);
_this
.
renderReferencedUsers
(
response
.
references
.
users
,
form
);
};
};
})(
this
));
})(
this
));
}
}
...
@@ -40,9 +40,10 @@
...
@@ -40,9 +40,10 @@
return
;
return
;
}
}
if
(
text
===
this
.
ajaxCache
.
text
)
{
if
(
text
===
this
.
ajaxCache
.
text
)
{
return
success
(
this
.
ajaxCache
.
response
);
success
(
this
.
ajaxCache
.
response
);
return
;
}
}
return
$
.
ajax
({
$
.
ajax
({
type
:
'
POST
'
,
type
:
'
POST
'
,
url
:
window
.
preview_markdown_path
,
url
:
window
.
preview_markdown_path
,
data
:
{
data
:
{
...
@@ -55,16 +56,14 @@
...
@@ -55,16 +56,14 @@
text
:
text
,
text
:
text
,
response
:
response
response
:
response
};
};
return
success
(
response
);
success
(
response
);
};
};
})(
this
)
})(
this
)
});
});
};
};
MarkdownPreview
.
prototype
.
hideReferencedUsers
=
function
(
form
)
{
MarkdownPreview
.
prototype
.
hideReferencedUsers
=
function
(
form
)
{
var
referencedUsers
;
form
.
find
(
'
.referenced-users
'
).
hide
();
referencedUsers
=
form
.
find
(
'
.referenced-users
'
);
return
referencedUsers
.
hide
();
};
};
MarkdownPreview
.
prototype
.
renderReferencedUsers
=
function
(
users
,
form
)
{
MarkdownPreview
.
prototype
.
renderReferencedUsers
=
function
(
users
,
form
)
{
...
@@ -73,15 +72,14 @@
...
@@ -73,15 +72,14 @@
if
(
referencedUsers
.
length
)
{
if
(
referencedUsers
.
length
)
{
if
(
users
.
length
>=
this
.
referenceThreshold
)
{
if
(
users
.
length
>=
this
.
referenceThreshold
)
{
referencedUsers
.
show
();
referencedUsers
.
show
();
re
turn
re
ferencedUsers
.
find
(
'
.js-referenced-users-count
'
).
text
(
users
.
length
);
referencedUsers
.
find
(
'
.js-referenced-users-count
'
).
text
(
users
.
length
);
}
else
{
}
else
{
re
turn
re
ferencedUsers
.
hide
();
referencedUsers
.
hide
();
}
}
}
}
};
};
return
MarkdownPreview
;
return
MarkdownPreview
;
})();
})();
markdownPreview
=
new
window
.
MarkdownPreview
();
markdownPreview
=
new
window
.
MarkdownPreview
();
...
@@ -93,14 +91,13 @@
...
@@ -93,14 +91,13 @@
lastTextareaPreviewed
=
null
;
lastTextareaPreviewed
=
null
;
$
.
fn
.
setupMarkdownPreview
=
function
()
{
$
.
fn
.
setupMarkdownPreview
=
function
()
{
var
$form
,
form_textarea
;
var
$form
=
$
(
this
);
$form
=
$
(
this
);
$form
.
find
(
'
textarea.markdown-area
'
)
form_textarea
=
$form
.
find
(
'
textarea.markdown-area
'
);
.
on
(
'
input
'
,
function
()
{
form_textarea
.
on
(
'
input
'
,
function
()
{
markdownPreview
.
hideReferencedUsers
(
$form
);
return
markdownPreview
.
hideReferencedUsers
(
$form
);
})
});
.
on
(
'
blur
'
,
function
()
{
return
form_textarea
.
on
(
'
blur
'
,
function
()
{
markdownPreview
.
showPreview
(
$form
);
return
markdownPreview
.
showPreview
(
$form
);
});
});
};
};
...
@@ -115,7 +112,7 @@
...
@@ -115,7 +112,7 @@
// toggle content
// toggle content
$form
.
find
(
'
.md-write-holder
'
).
hide
();
$form
.
find
(
'
.md-write-holder
'
).
hide
();
$form
.
find
(
'
.md-preview-holder
'
).
show
();
$form
.
find
(
'
.md-preview-holder
'
).
show
();
return
markdownPreview
.
showPreview
(
$form
);
markdownPreview
.
showPreview
(
$form
);
});
});
$
(
document
).
on
(
'
markdown-preview:hide
'
,
function
(
e
,
$form
)
{
$
(
document
).
on
(
'
markdown-preview:hide
'
,
function
(
e
,
$form
)
{
...
@@ -129,7 +126,7 @@
...
@@ -129,7 +126,7 @@
// toggle content
// toggle content
$form
.
find
(
'
.md-write-holder
'
).
show
();
$form
.
find
(
'
.md-write-holder
'
).
show
();
$form
.
find
(
'
textarea.markdown-area
'
).
focus
();
$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
)
{
$
(
document
).
on
(
'
markdown-preview:toggle
'
,
function
(
e
,
keyboardEvent
)
{
...
@@ -137,11 +134,11 @@
...
@@ -137,11 +134,11 @@
$target
=
$
(
keyboardEvent
.
target
);
$target
=
$
(
keyboardEvent
.
target
);
if
(
$target
.
is
(
'
textarea.markdown-area
'
))
{
if
(
$target
.
is
(
'
textarea.markdown-area
'
))
{
$
(
document
).
triggerHandler
(
'
markdown-preview:show
'
,
[
$target
.
closest
(
'
form
'
)]);
$
(
document
).
triggerHandler
(
'
markdown-preview:show
'
,
[
$target
.
closest
(
'
form
'
)]);
return
keyboardEvent
.
preventDefault
();
keyboardEvent
.
preventDefault
();
}
else
if
(
lastTextareaPreviewed
)
{
}
else
if
(
lastTextareaPreviewed
)
{
$target
=
lastTextareaPreviewed
;
$target
=
lastTextareaPreviewed
;
$
(
document
).
triggerHandler
(
'
markdown-preview:hide
'
,
[
$target
.
closest
(
'
form
'
)]);
$
(
document
).
triggerHandler
(
'
markdown-preview:hide
'
,
[
$target
.
closest
(
'
form
'
)]);
return
keyboardEvent
.
preventDefault
();
keyboardEvent
.
preventDefault
();
}
}
});
});
...
@@ -149,14 +146,14 @@
...
@@ -149,14 +146,14 @@
var
$form
;
var
$form
;
e
.
preventDefault
();
e
.
preventDefault
();
$form
=
$
(
this
).
closest
(
'
form
'
);
$form
=
$
(
this
).
closest
(
'
form
'
);
return
$
(
document
).
triggerHandler
(
'
markdown-preview:show
'
,
[
$form
]);
$
(
document
).
triggerHandler
(
'
markdown-preview:show
'
,
[
$form
]);
});
});
$
(
document
).
on
(
'
click
'
,
writeButtonSelector
,
function
(
e
)
{
$
(
document
).
on
(
'
click
'
,
writeButtonSelector
,
function
(
e
)
{
var
$form
;
var
$form
;
e
.
preventDefault
();
e
.
preventDefault
();
$form
=
$
(
this
).
closest
(
'
form
'
);
$form
=
$
(
this
).
closest
(
'
form
'
);
return
$
(
document
).
triggerHandler
(
'
markdown-preview:hide
'
,
[
$form
]);
$
(
document
).
triggerHandler
(
'
markdown-preview:hide
'
,
[
$form
]);
});
});
}).
call
(
this
);
}).
call
(
this
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment