Youtube Lite
-
@a_5mith yeah, even in new version he has made it can hide from the anonymous and not break the forum. But it's funny that this plugin will not work if I place shoutbox's widget in global header. Still have to disable it for anonymous.
Anw, that's the solution for now -
-
This is my two cents. This is a fix for users when paste yt videos with
&something
library.js:
(function(module) { "use strict"; var YoutubeLite = {}, embed = '<div class="js-lazyYT" data-youtube-id="$1" data-width="640" data-height="360"><iframe class="lazytube" src="//www.youtube.com/embed/$1"></iframe></div>'; var regularUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtube\.com)\/(?:watch\?v=)(.+)">.+<\/a>/g; var shortUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtu\.be)\/(.+)">.+<\/a>/g; var embedUrl = /<a href="(?:https?:\/\/)?(?:www\.)youtube.com\/embed\/([\w\-_]+)">.+<\/a>/; var longUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtube\.com)\/(?:watch\?v=)(.+)&.+">.+<\/a>/g; YoutubeLite.parse = function(data, callback) { if (!data || !data.postData || !data.postData.content) { return callback(null, data); } if (data.postData.content.match(embedUrl)) { data.postData.content = data.postData.content.replace(embedUrl, embed); } if (data.postData.content.match(longUrl)) { data.postData.content = data.postData.content.replace(longUrl, embed); } if (data.postData.content.match(regularUrl)) { data.postData.content = data.postData.content.replace(regularUrl, embed); } if (data.postData.content.match(shortUrl)) { data.postData.content = data.postData.content.replace(shortUrl, embed); } callback(null, data); }; module.exports = YoutubeLite; }(module));
-
@RazorAxis said:
I am trying to put some css in to make these resposive with no such luck, anyone have a css code that works? Thanks.
Remove these two lines.
nodebb-plugin-youtube-lite/static/style.less at master · a5mith/nodebb-plugin-youtube-lite
Lazyloads Youtube Videos on your NodeBB Forum. Contribute to a5mith/nodebb-plugin-youtube-lite development by creating an account on GitHub.
GitHub (github.com)
-
So the following happened:
We over at BitBangers were discussing about forking this plugin and adding a prefix to allow of just posting the link in the shoutbox, and not the enormous embed view. So I started doing that.
When I was done, I remembered that in 0.6.x there are a couple parsing hook changes and that it won't matter because the shoutbox will use
parse.raw
, and this plugin listens toparse.post
.I still pushed it to my repo so do with it what you want
In short, if you prefix a youtube url with a
!
, it'll show something like this. Clicking on the icon will toggle the embed view.Choosing
!
as prefix probably wasn't the best idea but you can easily change it in the regex.GitHub - Schamper/nodebb-plugin-youtube-lite: NodeBB 0.6.0 - v0.3.2 | NodeBB 0.5.x - v0.2.0
NodeBB 0.6.0 - v0.3.2 | NodeBB 0.5.x - v0.2.0. Contribute to Schamper/nodebb-plugin-youtube-lite development by creating an account on GitHub.
GitHub (github.com)
-
Version 0.4.0 has been released of this. Probably didn't need such a large release, but for anyone not using NodeBBs markdown editor, probably won't work for you. So will try and keep both v0.3.x and v0.4.x similar, minus the changes.
So @Julian did something and submitted a PR.
Removed old use of parse hooks, relying purely on markdown parser update now.
Yeah, 0.4.0 if you want that.
EDIT: The PR if anyone wants to see what's changed.
-
Video name does not appear. And console says:
http://gdata.youtube.com/feeds/api/videos/1QCK_gFGi90?v=2&alt=json Failed to load resource: the server responded with a status of 410 (Gone)