diff options
Diffstat (limited to 'web/cobrands')
-rw-r--r-- | web/cobrands/fixmystreet.com/js.js | 26 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 19 |
2 files changed, 26 insertions, 19 deletions
diff --git a/web/cobrands/fixmystreet.com/js.js b/web/cobrands/fixmystreet.com/js.js index 3abba8e33..9dbd11f2c 100644 --- a/web/cobrands/fixmystreet.com/js.js +++ b/web/cobrands/fixmystreet.com/js.js @@ -1,3 +1,29 @@ jQuery.validator.addMethod('validName', function(value, element) { var validNamePat = /\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i; return this.optional(element) || value.length > 5 && value.match( /\S/ ) && value.match( /\s/ ) && !value.match( validNamePat ); }, translation_strings.category ); + +$(function(){ + + /* Front page banner for other countries */ + + $('.top_banner__close').live('click', function() { + $('.top_banner--country').hide(); + $.cookie('has_seen_country_message', 1, {expires: 365, path: '/'}); + }); + + if ( $('body.frontpage').length ) { + if (!$.cookie('has_seen_country_message')) { + $.ajax({ + url: 'https://gaze.mysociety.org/gaze-rest?f=get_country_from_ip', + success: function(data) { + if ( data && data != 'GB\n' ) { + var banner = '<div class="top_banner top_banner--country"><a href="#" class="top_banner__close">Close</a> <p>This site is for reporting <strong>problems in the UK</strong>. There are FixMyStreet sites <a href="http://www.fixmystreet.org/sites/">all over the world</a>, or you could set up your own using the <a href="http://www.fixmystreet.org/">FixMyStreet Platform</a>.</p></div>'; + $('body').prepend(banner); + $('.top_banner--country').slideDown('slow'); + } + } + }); + } + } + +}); diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index f01c5142d..4de18be9a 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -532,25 +532,6 @@ $.fn.drawer = function(id, ajax) { }).fadeOut(500); }); - $('.top_banner__close').live('click', function() { - $('.top_banner--country').hide(); - $.cookie('has_seen_country_message', 1, {expires: 365, path: '/'}); - }); - - if ( cobrand == 'fixmystreet' && $('body.frontpage').length ) { - if (!$.cookie('has_seen_country_message')) { - $.ajax({ - url: '/country_message', - success: function(data) { - if ( data ) { - $('body').prepend(data); - $('.top_banner--country').slideDown('slow'); - } - } - }); - } - } - /* * Fancybox fullscreen images */ |