Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
f7ff242c88c7
Commit
4403f71f
authored
Mar 19, 2013
by
Dmitriy Zaporozhets
Browse files
added sanitize and linkify functions. Moved some js to lib/
parent
641b62e79c3a
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/jquery.timeago.js
→
app/assets/javascripts/
lib/
jquery.timeago.js
View file @
f7ff242c
File moved
app/assets/javascripts/md5.js
→
app/assets/javascripts/
lib/
md5.js
View file @
f7ff242c
File moved
app/assets/javascripts/utf8_encode.js
→
app/assets/javascripts/
lib/
utf8_encode.js
View file @
f7ff242c
File moved
app/assets/javascripts/main.js.coffee
View file @
f7ff242c
...
...
@@ -32,6 +32,14 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) ->
else
closest_submit
.
enable
()
window
.
sanitize
=
(
str
)
->
return
str
.
replace
(
/<(?:.|\n)*?>/gm
,
''
)
window
.
linkify
=
(
str
)
->
exp
=
/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
return
str
.
replace
(
exp
,
"<a href='$1'>$1</a>"
)
$
->
# Click a .one_click_select field, select the contents
$
(
".one_click_select"
).
on
'click'
,
->
$
(
@
).
select
()
...
...
app/assets/javascripts/wall.js.coffee
View file @
f7ff242c
...
...
@@ -70,7 +70,7 @@
renderNote
:
(
note
)
->
author
=
'<strong class="wall-author">'
+
note
.
author
.
name
+
'</strong>'
body
=
'<span class="wall-text">'
+
note
.
body
+
'</span>'
body
=
'<span class="wall-text">'
+
linkify
(
sanitize
(
note
.
body
))
+
'</span>'
file
=
''
time
=
'<abbr class="timeago" title="'
+
note
.
created_at
+
'">'
+
note
.
created_at
+
'</time>'
...
...
@@ -80,4 +80,3 @@
html
=
'<li>'
+
author
+
body
+
file
+
time
+
'</li>'
$
(
'ul.notes'
).
append
(
html
)
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