Skip to content

Instantly share code, notes, and snippets.

@lambtron
Last active December 10, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambtron/4500330 to your computer and use it in GitHub Desktop.
Save lambtron/4500330 to your computer and use it in GitHub Desktop.
This is the home page of the TextMe! application. This describes how the user would put in his/her phone number and generate a link that would be dragged to the toolbar to act as a bookmarklet.
<section class="form">
<input type="text" placeholder="xxx-xxx-xxxx">
<button type="submit">Make my bookmarklet!</button>
</section>
<section id="bookmarklet-container">
<span><p>Your link will be generated below and drag it to your toolbar!</p></span>
<div id="bookmarklet">
</div>
</section>
<script type="text/javascript">
$(document).ready( function() {
$('.form > .btn').click( function() {
var recipient = $('.form .input-medium').val();
if ( recipient != "" ) {
var href = "javascript:(function(){var s=document.createElement('script');s.src='http://www.andy-jiang.com/text2.js';s.onload=function(){sendSMS(" + recipient + ")};document.body.appendChild(s);})();";
// Make the draggable bookmarklet.
var a = document.createElement('a');
a.title = "TextMe!";
a.innerHTML = "TextMe!";
a.href = href;
$('#bookmarklet').html(a);
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment