diff options
author | Dave Whiteland <dave@mysociety.org> | 2012-05-29 15:57:41 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-05-29 15:57:41 +0100 |
commit | 67da8efc720d2d0bd22bd9fe8655b7e983b35bb4 (patch) | |
tree | 38b8570647124df06c637d4b923f6010211ef328 /web/js/fixmystreet-old-box.js | |
parent | 40b3a51d33caefa8f5fb97ce9be18ef936c7e260 (diff) | |
parent | 131ff6e9bf3626d6a8fff6ae54669d250148a63a (diff) |
Merge remote branch 'origin/master' into fmb-read-only
Conflicts:
bin/send-reports
perllib/FixMyStreet/Cobrand/Default.pm
perllib/FixMyStreet/Cobrand/FixMyStreet.pm
templates/web/fixmystreet/alert/index.html
templates/web/fixmystreet/around/display_location.html
web/cobrands/fixmystreet/_layout.scss
web/js/map-OpenLayers.js
Diffstat (limited to 'web/js/fixmystreet-old-box.js')
-rw-r--r-- | web/js/fixmystreet-old-box.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/web/js/fixmystreet-old-box.js b/web/js/fixmystreet-old-box.js new file mode 100644 index 000000000..72eeafb4d --- /dev/null +++ b/web/js/fixmystreet-old-box.js @@ -0,0 +1,39 @@ +/* + * fixmystreet-old-box.js + * Create the 'email me updates' pop up box on old-style report display pages. + */ + +$(function(){ + + if (!$('#email_alert_box').length) { + return; + } + + var timer; + function email_alert_close() { + $('#email_alert_box').hide('fast'); + } + + $('#email_alert').click(function(e) { + e.preventDefault(); + if ($('#email_alert_box').is(':visible')) { + email_alert_close(); + } else { + var pos = $(this).position(); + $('#email_alert_box').css( { 'left': ( pos.left - 20 ) + 'px', 'top': ( pos.top + 20 ) + 'px' } ); + $('#email_alert_box').show('fast'); + $('#alert_rznvy').focus(); + } + }).hover(function() { + window.clearTimeout(timer); + }, function() { + timer = window.setTimeout(email_alert_close, 2000); + }); + + $('#email_alert_box').hover(function() { + window.clearTimeout(timer); + }, function() { + timer = window.setTimeout(email_alert_close, 2000); + }); + +}); |