Created
June 19, 2013 17:35
-
-
Save EtienneLem/5816208 to your computer and use it in GitHub Desktop.
The best way to code bookmarlets (with Rails)
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
def javascript_content(file_name) | |
Rails.application.assets[file_name].source.html_safe | |
end |
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
class Bookmarklet | |
constructor: -> | |
alert('test') | |
# Initialization | |
bookmarklet = new Bookmarklet |
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
<a href="javascript:<%= javascript_content('bookmarklet.js') %>">Bookmarklet</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also: Live Bookmarklet!