diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-09-12 10:46:10 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-09-12 10:46:10 +0100 |
commit | ec621a8a56ca04f4f8e5cf4566c7c66daf808b74 (patch) | |
tree | 030c7f447028607fdb145ac42d9e244af49b97c4 /public/javascripts/general.js | |
parent | 7690df08b8e929cd8d9aa26cd7b1a79a39db760e (diff) |
Modify "link to this" behaviour: make it pop up a box with an input prefilled with the URL, and display it with an icon rather than text. Fixes #172.
Diffstat (limited to 'public/javascripts/general.js')
-rw-r--r-- | public/javascripts/general.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/public/javascripts/general.js b/public/javascripts/general.js index ed5095f82..3d6aae0d8 100644 --- a/public/javascripts/general.js +++ b/public/javascripts/general.js @@ -1,4 +1,5 @@ $(document).ready(function() { + // flash message for people coming from other countries if(window.location.search.substring(1).search("country_name") == -1) { if (!$.cookie('has_seen_country_message')) { $.ajax({ @@ -18,5 +19,21 @@ $(document).ready(function() { $('#other-country-notice').click(function() { $('#other-country-notice').hide(); $.cookie('has_seen_country_message', 1, {expires: 365, path: '/'}); - }) + }); + // "link to this" widget + $('a.link_to_this').click(function() { + var box = $('div#link_box'); + var location = window.location.protocol + "//" + window.location.hostname + $(this).attr('href'); + box.width(location.length + " em"); + box.find('input').val(location).attr('size', location.length + " em"); + box.show(); + box.find('input').select(); + box.position({ + my: "left top", + at: "left bottom", + of: this, + collision: "fit" }); + + }); + $('.close-button').click(function() { $(this).parent().hide() }); })
\ No newline at end of file |