Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use a play icon for youtube links.

  • Loading branch information...
commit b837ce9648e354d4f7b1b9b2714c6b606ef949d4 1 parent e1151e4
@kdeldycke authored
View
11 theme/static/css/style.css
@@ -106,6 +106,17 @@ a {
}
+.mglass {
+ background-color: rgba(0, 0, 0, 0.3);
+}
+.mglass:hover {
+ opacity: 1;
+}
+#content .video .mglass {
+ background-image: url(/theme/img/play-button.png);
+}
+
+
.masonry {
margin: 0 auto;
}
View
BIN  theme/static/img/play-button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
14 theme/static/js/application.js
@@ -40,9 +40,19 @@
});
});
+ // YouTube URL parser. Source: http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex/10315969#10315969
+ function parse_youtube_url(url) {
+ var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
+ return (url.match(p)) ? RegExp.$1 : false;
+ }
+
// Display an icon overlay for images enclosed in a link in the main content column
- $(function(){
- $("#content a img").mglass();
+ $("#content a img").each(function(i, image){
+ $(image).mglass({opacity: 1,});
+ var image_link = $(image).closest("a");
+ if (parse_youtube_url(image_link.attr("href")) != false) {
+ image_link.addClass("video");
+ };
});
})
Please sign in to comment.
Something went wrong with that request. Please try again.