New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better inline-videos parsing #148
Comments
Want to get down results of experimenting, no push request code yet. args.message = jQuery.parseHTML(args.message).map(function(a) { if(a.outerHTML){ //dom element of any sort switch(a.hostname) { // a link with an href case "youtube.com": case "www.youtube.com": return a.search; //do iframe replacement here, v= important, t= needs conversion if exist break; case "youtu.be": return a.pathname + a.search; //do iframe replacement here, pathname important, t= needs conversion if exist break; default: //undefined - not a link return a.outerHTML; } } else { //this is a string that has to be wrapped in somthing return a.textContent; } }).join(""); |
Pushed first attempt to branch. I'm wondering if I should be displaying the original URL or a sanitized one - leaning towards sanitized, but not very hard. @mweibel - is this code looking good to you? (note to self: remove debug console calls) |
Pushed second attempt, in response to @benlangfeld 's comments. |
Go ahead and open a PR, mark it WIP and hold discussion there @Sudrien. It's easier to review and comment then :) |
#147 suggested adding youtube.be support, there is room for further improvements.
t=
- or, embeds can be started at a certain time during the videoCaveats:
t=#h##m##s
is not the format used in embeds - rather, it'sstart=###
- a single integer, in seconds ( see https://developers.google.com/youtube/player_parameters#start ). At leastt=
uses a consistent order, so a single regex to break them out should be enough.The text was updated successfully, but these errors were encountered: