forked from mtodd/auto-awesome
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Bookmarklet to automatically "Awesome" songs every 45 seconds for [Turntable.fm](http://turntable.fm). | ||
|
||
Full credit to @wallace for the [original solution](https://gist.github.com/1063492). | ||
|
||
[See the AutoAwesome help page for the Bookmarklet link](https://mtodd.github.com/auto-awesome) |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
source=${1:-"source.js"} | ||
output=${2:-"bookmarklet.js"} | ||
|
||
cat $source | ./javascript_bookmarklet_builder > $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env perl | ||
# | ||
# http://daringfireball.net/2007/03/javascript_bookmarklet_builder | ||
# Licence: http://www.opensource.org/licenses/mit-license.php | ||
|
||
use strict; | ||
use warnings; | ||
use URI::Escape qw(uri_escape_utf8); | ||
use open IO => ":utf8", # UTF8 by default | ||
":std"; # Apply to STDIN/STDOUT/STDERR | ||
|
||
my $src = do { local $/; <> }; | ||
|
||
# Zap the first line if there's already a bookmarklet comment: | ||
$src =~ s{^// ?javascript:.+\n}{}; | ||
my $bookmarklet = $src; | ||
|
||
for ($bookmarklet) { | ||
s{^\s*//.+\n}{}gm; # Kill comments. | ||
s{\t}{ }gm; # Tabs to spaces | ||
s{[ ]{2,}}{ }gm; # Space runs to one space | ||
s{^\s+}{}gm; # Kill line-leading whitespace | ||
s{\s+$}{}gm; # Kill line-ending whitespace | ||
s{\n}{}gm; # Kill newlines | ||
} | ||
|
||
# Escape single- and double-quotes, spaces, control chars, unicode: | ||
$bookmarklet = "javascript:" . | ||
uri_escape_utf8($bookmarklet, qq('" \x00-\x1f\x7f-\xff)); | ||
|
||
print "$bookmarklet\n"; | ||
|
||
# Put bookmarklet on clipboard: | ||
`/bin/echo -n '$bookmarklet' | /usr/bin/pbcopy`; |
This file was deleted.
Oops, something went wrong.