aboutsummaryrefslogtreecommitdiffstats
path: root/public/javascripts/general.js
blob: 989907998d7435f25a15e2356197bd1f099de314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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();
   }

})