/* * LeaveNotice - plug in to notify users of leaving your site * Examples and documentation at: http://rewdy.com/tools/leavenotice-jquery-plugin * Version: 1.1.3 (07/08/2013) * Copyright (c) 2012 Andrew Meyer * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License * Requires: jQuery v1.4+ */ (function($){$.fn.leaveNotice=function(opt){var defaults={siteName:"EDA",exitMessage:"

Thank you for visiting the Economic Development Website.

We hope your visit was informative and enjoyable.

When attempting to access external websites, you may wish to review each privacy notice since their information collection practices may differ from ours. In addition, our linking to these sites does not constitute an endorsement of any products or services.

",preLinkMessage:"

You will now be directed to:
{URL}

",linkString:"",newWindow:false,timeOut:1e4,overlayId:"ln-blackout",messageBoxId:"ln-messageBox",messageHolderId:"ln-messageHolder",linkId:"ln-link",displayUrlLength:50,overlayAlpha:.3};var options=$.extend(defaults,opt);return this.each(function(){el=$(this);var url=el.attr("href");var ulen=options.displayUrlLength;if(url.length>=ulen){var suffix="..."}else{var suffix=""}var shortUrl=url.substr(0,ulen)+suffix;var title=el.attr("title");if(title===undefined||title==""){var linkText=shortUrl}else{var linkText=title}options.timeOut=options.newWindow?0:options.timeOut;el.click(function(){$("body").append('
');$("body").append('
');if(options.overlayAlpha!==false){$("#"+options.overlayId).css("opacity",options.overlayAlpha)}preFilteredContent=options.exitMessage+options.preLinkMessage;msgContent=preFilteredContent.replace(/\{URL\}/g,'"+linkText+"");msgContent=msgContent.replace(/\{SITENAME\}/g,options.siteName);if(options.timeOut>0){msgContent+='

Cancel or press the ESC key.

'}else{msgContent+='

Click the link above to continue or Cancel

'}$("#"+options.messageBoxId).append(msgContent);if(options.timeOut>0){leaveIn=setTimeout(function(){$("#ln-cancelMessage").html("Loading...");window.location.href=url},options.timeOut)}else{leaveIn=false}if(options.newWindow){$("a#"+options.linkId).attr("target","_blank").click(function(){closeDialog(options,leaveIn)})}$("#ln-cancelLink").click(function(){closeDialog(options,leaveIn);return false});$(document).bind("keyup",function(e){if(e.which==27){closeDialog(options,leaveIn)}});$(window).unload(function(){closeDialog(options,leaveIn)});return false})})};function closeDialog(options,timer){if(options.timeOut>0){clearTimeout(timer)}$("#"+options.overlayId+", #"+options.messageHolderId).fadeOut("fast",function(){$("#"+options.overlayId+", #"+options.messageHolderId).remove()});$(document).unbind("keyup")}})(jQuery);