Skip to content

Changed song lyrics to links#4

Open
ibsavage wants to merge 1 commit into
brashrebel:masterfrom
ibsavage:master
Open

Changed song lyrics to links#4
ibsavage wants to merge 1 commit into
brashrebel:masterfrom
ibsavage:master

Conversation

@ibsavage

Copy link
Copy Markdown

Each link leads to a properly formatted YouTube search, opens in a new tab when clicked on.

Each link leads to a properly formatted YouTube search, opens in a new tab when clicked on.
@brashrebel

Copy link
Copy Markdown
Owner

Oh! That's creative and nice. I really like it. I'll do some quick testing on this later this week and very likely merge it. Thanks for the awesome PR!

@jasonahjie

Copy link
Copy Markdown

Do we handle links which is invalid by providing a check?

@brashrebel

Copy link
Copy Markdown
Owner

@jasonahjie that's kind of a cool idea. I'm thinking about adjusting this so that instead of making the entire lyric be a link, just append a little search icon to the string and make that a link with the title attribute set to something like "Search for this on YouTube". That way it's there but a little more subtle.

@ibsavage

ibsavage commented Sep 28, 2016

Copy link
Copy Markdown
Author

@jasonahjie The lyrics are hardcoded in the php file, and the only characters that would throw off the search request were apostrophes and commas. The code I wrote replaces instances of those with the proper search terms. It might not hurt to add further checks in case YouTube changes its search query pattern.

@brashrebel Sounds good. I was trying to think of how to have the link more subtle, that definitely would do it. One possible solution might be something like:

echo "<div id='christmas'><span class='hello-snow'><i></i><i></i><i></i><i></i></span>$chosen<a target='_blank' style='text-decoration: none' title='Search for this on YouTube' href='https://youtube.com/results?search_query=".str_replace(",", "%2C", str_replace("'", "%27", (preg_replace('/\s+/', '+', strip_tags(trim($chosen))))))."'>&#x1f50a;</a></div>";

This would place the "unicode speaker with sound waves" icon (🔊) after the song title as a link to the youtube search with the title you mentioned. Alternatively, there's also the 🔍 unicode icon which would be &#1F50D;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants