Permalink
Browse files

better selecting li

  • Loading branch information...
1 parent d327be4 commit 485519551c8d380558f8abe9c7d48680a828357f @kyupark committed Sep 15, 2012
Showing with 26 additions and 11 deletions.
  1. +23 −5 README.md
  2. +3 −6 lucky.js
View
@@ -1,10 +1,28 @@
lucky.js
=========
-
-For markdown on tumblr, when em used, feeling-lucky it on youtube.
-When strong used, just feeling-lucky it.
-
+Embed lucky.js on Tumblr
+-------------------------
Include this code in your tumblr customize page
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
- <script src="http://cloud.github.com/downloads/kyupark/lucky.js/lucky-0.1.3.js"></script>
+ <script src="http://cloud.github.com/downloads/kyupark/lucky.js/lucky-0.1.3.js"></script>
+
+Feeling lucky on Youtube
+-------------------------
+For markdown on tumblr, when em or li used, feeling-lucky it on youtube. 'artist - song name' order doesn't matter.
+
+For example,
+
+ _Matisyahu's Sunshine_ was playing at the Apple Store.
+
+ iTunes Top 3 Songs September 15
+ + PSY - Gangnam Style
+ + We Are Never Getting Back Together
+ + Maroon 5 - One More Night
+
+Feeling lucky on any website
+-----------------------------
+When strong used, just feeling-lucky it.
+ **John Gruber** writes **Daring Fireball**.
+
+
View
@@ -1,16 +1,13 @@
function lucky(it,site) {
var url = 'http://www.google.com/search?btnI&q=';
- if (site ==! undefined) {
- url = url + "+site:" + site + "+";
-
- }
+ site = (typeof site === "undefined") ? "" : "+site:" + site;
var text = String(it.text()).split('-').join('').split(' ').join('+');
url = url + text;
- it.html('<a target="_blank" href="' + url + '">' + it.text() + '</a>');
+ it.html('<a target="_blank" title="Listen to ' + it.text() +' on YouTube" href="' + url + site + '">' + it.text() + '</a>');
}
$(document).ready(function() {
- $('.cont > li').each(function() {
+ $('.cont > ul > li').each(function() {
lucky($(this), "youtube.com");
});
$('em').each(function() {

0 comments on commit 4855195

Please sign in to comment.