aboutsummaryrefslogtreecommitdiffstats
path: root/public/javascripts/general.js
diff options
context:
space:
mode:
authorseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
committerseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
commita4e533f1588a5d34dca4ab462b58ddd83eed37c5 (patch)
tree58bb3b57ec5664e094ae151c18b6c1915256e364 /public/javascripts/general.js
parentd473fce1d0451c913d3ef697d3b45bd58c6fff54 (diff)
parente649c2a7f19d0a75206149d886ff47b3ccda4e91 (diff)
Merge branch 'develop' into xapian-dcabo
Conflicts: spec/models/xapian_spec.rb
Diffstat (limited to 'public/javascripts/general.js')
-rw-r--r--public/javascripts/general.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/public/javascripts/general.js b/public/javascripts/general.js
new file mode 100644
index 000000000..ab74cf318
--- /dev/null
+++ b/public/javascripts/general.js
@@ -0,0 +1,47 @@
+$(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" });
+
+ });
+ $('.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;
+ })
+ })
+}) \ No newline at end of file