From dedf33183bca46fe8e0689948b8f804d007cebdf Mon Sep 17 00:00:00 2001 From: Isaac Bythewood Date: Tue, 5 Mar 2013 22:02:35 +0000 Subject: [PATCH] Improve bookmarklet form --- pinry/static/css/pinry.css | 4 ++++ pinry/static/js/bookmarklet.js | 4 ++-- pinry/static/js/pin-form.js | 18 +++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pinry/static/css/pinry.css b/pinry/static/css/pinry.css index ff5d735..68534f4 100644 --- a/pinry/static/css/pinry.css +++ b/pinry/static/css/pinry.css @@ -116,6 +116,10 @@ textarea { .qq-upload-spinner { display: none; } + +.modal-body { + overflow: hidden; +} /* End Forms */ diff --git a/pinry/static/js/bookmarklet.js b/pinry/static/js/bookmarklet.js index 80db579..351b263 100644 --- a/pinry/static/js/bookmarklet.js +++ b/pinry/static/js/bookmarklet.js @@ -60,7 +60,7 @@ $(document).ready(function() { $(pinryBar).css({ 'background': 'black', 'padding': '15px', - 'position': 'fixed', + 'position': 'absolute', 'z-index': '9002', 'width': '100%', 'top': 0, @@ -91,7 +91,7 @@ $(document).ready(function() { }); $(image).click(function() { var popUrl = getFormUrl()+imageUrl; - window.open(popUrl, '', 'width=590,height=439,toolbar=0,menubar=0'); + window.open(popUrl); $('#pinry-images').remove(); }); return $('#pinry-images').append(image); diff --git a/pinry/static/js/pin-form.js b/pinry/static/js/pin-form.js index 3983076..fe98eb8 100644 --- a/pinry/static/js/pin-form.js +++ b/pinry/static/js/pin-form.js @@ -34,9 +34,17 @@ $(window).load(function() { preview.find('.pin').width(200); preview.find('.pin .text').width(140); preview.find('.pin').fadeIn(300); + if (getFormData().url == "") + preview.find('.image-wrapper').height(278); preview.find('.image-wrapper img').fadeIn(300); - if (preview.find('.pin').height() > 305) - $('#pin-form .modal-body').height(preview.find('.pin').height()); + console.log(preview.find('.pin').height()); + setTimeout(function() { + if (preview.find('.pin').height() > 305) { + $('#pin-form .modal-body').animate({ + 'height': preview.find('.pin').height() + }, 300); + } + }, 300); } function dismissModal(modal) { @@ -57,9 +65,13 @@ $(window).load(function() { pinFromUrl = getUrlParameter('pin-image-url'); modal.modal('show'); // Auto update preview on field changes + var timer; for (var i in formFields) { formFields[i].bind('propertychange keyup input paste', function() { - createPinPreviewFromForm(); + clearTimeout(timer); + timer = setTimeout(function() { + createPinPreviewFromForm() + }, 700); if (!uploadedImage) $('#pin-form-image-upload').parent().parent().fadeOut(300); });