Get basic working bookmarklet and refactor API into core

This commit is contained in:
Isaac Bythewood
2013-02-26 23:20:50 +00:00
parent af8c0865e0
commit fa7e8c3b83
13 changed files with 181 additions and 229 deletions

View File

@@ -51,6 +51,17 @@ $(window).load(function() {
$('#pin-form-tags').bind('propertychange keyup input paste', function() {
createPreview();
});
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
if (getURLParameter('pin-image-url') != 'null') {
$('#pin-form-image-url').val(getURLParameter('pin-image-url'));
createPreview();
}
$('#pin-form-submit').click(function(e) {
var tags = cleanTags();
$.ajax({
@@ -85,6 +96,8 @@ $(window).load(function() {
});
}
if ($('#display-pin-form').length >= 1) createPinForm();
$('#call-pin-form').click(function() {
createPinForm();
});