Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diaspora
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan
diaspora
Commits
8e753cc0
Commit
8e753cc0
authored
14 years ago
by
archi
Browse files
Options
Downloads
Patches
Plain Diff
Youtube proof of concept patch/preview - not done yet (see bug #332)
parent
50f9e8f2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/helpers/status_messages_helper.rb
+5
-2
5 additions, 2 deletions
app/helpers/status_messages_helper.rb
public/javascripts/view.js
+9
-0
9 additions, 0 deletions
public/javascripts/view.js
with
14 additions
and
2 deletions
app/helpers/status_messages_helper.rb
+
5
−
2
View file @
8e753cc0
...
...
@@ -16,8 +16,11 @@ module StatusMessagesHelper
# next line is important due to XSS! (h is rail's make_html_safe-function)
message
=
h
(
message
).
html_safe
message
.
gsub!
(
/( |^)(www\.[^ ]+\.[^ ])/
,
'\1http://\2'
);
return
message
.
gsub
(
/(http|ftp):\/\/([^ ]+)/
,
'<a target="_blank" href="\1://\2">\2</a>'
);
message
.
gsub!
(
/( |^)(www\.[^ ]+\.[^ ])/
,
'\1http://\2'
)
message
.
gsub!
(
/( |^)http:\/\/www\.youtube\.com\/watch.*v=([A-Za-z0-9_]+)[^ ]*/
,
'\1youtube::\2'
)
message
.
gsub!
(
/(http|ftp):\/\/([^ ]+)/
,
'<a target="_blank" href="\1://\2">\2</a>'
)
message
.
gsub!
(
/youtube::([A-Za-z0-9_]+)/
,
'<a name="\1" onclick="openYoutube(\'\1\', this)" href="#\1">Youtube: \1</a>'
)
return
message
end
end
This diff is collapsed.
Click to expand it.
public/javascripts/view.js
+
9
−
0
View file @
8e753cc0
...
...
@@ -72,3 +72,12 @@ $.fn.clearForm = function() {
});
};
function
openYoutube
(
videoid
,
link
)
{
var
container
=
document
.
createElement
(
'
div
'
);
container
.
innerHTML
=
'
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/
'
+
videoid
+
'
?fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/
'
+
videoid
+
'
?fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object><br><a href="#
'
+
videoid
+
'
" onclick="closeYoutube(this)">Close</a> <a href="http://www.youtube.com/watch?v=
'
+
videoid
+
'
" target="_blank">Watch on Youtube</a>
'
;
link
.
parentNode
.
insertBefore
(
container
,
this
.
nextSibling
);
}
function
closeYoutube
(
link
)
{
link
.
parentNode
.
parentNode
.
removeChild
(
link
.
parentNode
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment