diff options
author | Mark Longair <mhl@pobox.com> | 2013-09-26 10:50:12 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-11-19 17:31:35 +0000 |
commit | 7e5fe3d27f1921841f45b46dc508af133403c1f0 (patch) | |
tree | 02f7bf9fdea41be4ead92efed80b7d95e2d72c7c /app/assets/javascripts/general.js | |
parent | aa83f5741d9276356454f3eb869b2834246e0635 (diff) |
Switch Javascript (bar admin) to be served with the asset pipline
Diffstat (limited to 'app/assets/javascripts/general.js')
-rw-r--r-- | app/assets/javascripts/general.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/app/assets/javascripts/general.js b/app/assets/javascripts/general.js new file mode 100644 index 000000000..b52131b83 --- /dev/null +++ b/app/assets/javascripts/general.js @@ -0,0 +1,53 @@ +$(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({ + url: "/country_message", + dataType: 'html', + success: function(country_message){ + if (country_message != ''){ + $('#other-country-notice').html(country_message); + $('body:not(.front) #other-country-notice').show() + } + } + }) + + } + } + + $('#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" }); + return false; + }); + + $('.close-button').click(function() { $(this).parent().hide() }); + $('div#variety-filter a').each(function() { + $(this).click(function() { + var form = $('form#search_form'); + form.attr('action', $(this).attr('href')); + form.submit(); + return false; + }) + }) + + if($.cookie('seen_foi2') == 1) { + $('#everypage').hide(); + } + +}) |