Socket
Socket
Sign inDemoInstall

exlink

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

17

jquery.exLink.js

@@ -5,4 +5,5 @@ // jQuery.exLink

// Web: http://www.yupitszac.com
// Demo: http://www.yupitszac.com/demo/jquery-exlink
// Support: @YupItsZac - Twitter, or fb.me/yupitszac
// Version 2.0.1 April 22, 2015
// Version 2.0.2 April 27, 2015

@@ -24,2 +25,5 @@

fileCallback: null,
gaTracking: false,
gaTrackLabel: 'External Links',
gaTrackOld: false,
linkWarning: true,

@@ -240,2 +244,13 @@ linkWarningBody: 'You are about to leave this website and navigate to the link below. Would you like to continue?',

if(jQuery.options.gaTracking) {
var hname = window.location.hostname;
if(jQuery.options.gaTrackOld) {
var track = _gaq.push(['_trackEvent', jQuery.options.gaTrackLabel, hname, href]);
} else {
ga('send', 'event', jQuery.options.gaTrackLabel, hname, href);
}
}
window.open(href, '_blank');

@@ -242,0 +257,0 @@

2

jquery.exLink.min.js

@@ -1,1 +0,1 @@

!function(o){o.fn.exLink=function(n){var i={protocols:["http","https"],filetypes:["pdf","xls","docx","doc","ppt","pptx"],hostCompare:!1,noFollow:!1,fancyBoxIgnore:!0,linkCallback:null,fileCallback:null,linkWarning:!0,linkWarningBody:"You are about to leave this website and navigate to the link below. Would you like to continue?",fileWarning:!0,fileWarningBody:"You are about to open the file below. Do you wish to continue?",dialogConfirm:"#006600",dialogCancel:"#CC0000",dialogConfirmText:"#fff",dialogCancelText:"#fff",dialogCancelButton:"Cancel",dialogConfirmButton:"Continue",modalDisplayBG:!0,modalWidth:"320px",modalHeight:"240px",externalColor:"",documentColor:"",clickedColor:""};"re"!=n&&(jQuery.options=o.extend({},i,n),o("body").on("click",".exLink, .docuLink",function(o){o.preventDefault(),1!=o.handled&&catchClick(o),o.handled=!0}));jQuery.options.hostCompare?targetByHost():targetByProtocol(),o(".exLink").css("color",jQuery.options.externalColor),o(".docuLink").css("color",jQuery.options.documentColor)},targetByProtocol=function(){jQuery.each(jQuery.options.protocols,function(n,i){jQuery.options.noFollow?jQuery.options.fancyBoxIgnore?o('a[href^="'+i+'://"]').not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):o('a[href^="'+i+'://"]').not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?o('a[href^="'+i+'://"]').not(".docuLink, .iframe").addClass("exLink"):o('a[href^="'+i+'://"]').not(".docuLink").addClass("exLink")}),identifyDocuments()},targetByHost=function(){identifyDocuments();var n=new RegExp(location.host);o("a").each(function(){n.test(o(this).attr("href"))===!1&&(jQuery.options.noFollow?jQuery.options.fancyBoxignore?o(this).not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):o(this).not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?o(this).not(".docuLink, .iframe").addClass("exLink"):o(this).not(".docuLink").addClass("exLink"))})},identifyDocuments=function(){jQuery.each(jQuery.options.filetypes,function(n,i){o('a[href$="'+i+'"]').not(".exLink").addClass("docuLink").css("color",jQuery.options.documentColor)})},catchClick=function(n){if(o(n.target).is(".exLink"))if(jQuery.options.linkWarning){if(o(n.target).is("a"))var i=n.target.href;else var i=o(n.target).closest("a").attr("href");showLinkWarning(i),o.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(n,!0)}else{if(o(n.target).is("a"))var i=n.target.href;else var i=o(n.target).closest("a").attr("href");window.open(i,"_blank"),o.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(n,!1)}else if(jQuery.options.fileWarning){if(o(n.target).is("a"))var i=n.target.href;else var i=o(n.target).closest("a").attr("href");showDocWarning(i),o.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(n,!0)}else{if(o(n.target).is("a"))var i=n.target.href;else var i=o(n.target).closest("a").attr("href");window.open(i,"_blank"),o.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(n,!1)}jQuery.options.clickedColor&&o(n.target).css("color",jQuery.options.clickedColor),window.lastObj=n},showLinkWarning=function(n){jQuery.options.modalDisplayBG&&(o("body").append('<div class="modalBG"></div>'),o(".modalBG").fadeIn("slow")),o("body").append('<div class="modal-dialog">'+jQuery.options.linkWarningBody+"<br><br><p><center><b>"+n+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="$.fn.exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="$.fn.exLink.navigateLocation(&quot;'+n+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),o(".modal-dialog").fadeIn("slow"),o(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),o(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),o(".exLinkCancel").css("color",jQuery.options.dialogCancelText),o(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),o(".modal-dialog").css("width",jQuery.options.modalWidth),o(".modal-dialog").css("height",jQuery.options.modalHeight)},showDocWarning=function(n){jQuery.options.modalDisplayBG&&(o("body").append('<div class="modalBG"></div>'),o(".modalBG").fadeIn("slow")),o("body").append('<div class="modal-dialog">'+jQuery.options.fileWarningBody+"<br><br><p><center><b>"+n+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="$.fn.exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="$.fn.exLink.navigateLocation(&quot;'+n+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),o(".modal-dialog").fadeIn("slow"),o(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),o(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),o(".exLinkCancel").css("color",jQuery.options.dialogCancelText),o(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),o(".modal-dialog").css("width",jQuery.options.modalWidth),o(".modal-dialog").css("height",jQuery.options.modalHeight)},o.fn.exLink.closeModal=function(){o(".modalBG").remove(),o(".modal-dialog").remove()},o.fn.exLink.navigateLocation=function(n){window.open(n,"_blank"),o(".modalBG").remove(),o(".modal-dialog").remove()}}(jQuery);
!function(o){o.fn.exLink=function(n){var e={protocols:["http","https"],filetypes:["pdf","xls","docx","doc","ppt","pptx"],hostCompare:!1,noFollow:!1,fancyBoxIgnore:!0,linkCallback:null,fileCallback:null,gaTracking:!1,gaTrackLabel:"External Links",gaTrackOld:!1,linkWarning:!0,linkWarningBody:"You are about to leave this website and navigate to the link below. Would you like to continue?",fileWarning:!0,fileWarningBody:"You are about to open the file below. Do you wish to continue?",dialogConfirm:"#006600",dialogCancel:"#CC0000",dialogConfirmText:"#fff",dialogCancelText:"#fff",dialogCancelButton:"Cancel",dialogConfirmButton:"Continue",modalDisplayBG:!0,modalWidth:"320px",modalHeight:"240px",externalColor:"",documentColor:"",clickedColor:""};"re"!=n&&(jQuery.options=o.extend({},e,n),o("body").on("click",".exLink, .docuLink",function(o){o.preventDefault(),1!=o.handled&&catchClick(o),o.handled=!0}));jQuery.options.hostCompare?targetByHost():targetByProtocol(),o(".exLink").css("color",jQuery.options.externalColor),o(".docuLink").css("color",jQuery.options.documentColor)},targetByProtocol=function(){jQuery.each(jQuery.options.protocols,function(n,e){jQuery.options.noFollow?jQuery.options.fancyBoxIgnore?o('a[href^="'+e+'://"]').not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):o('a[href^="'+e+'://"]').not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?o('a[href^="'+e+'://"]').not(".docuLink, .iframe").addClass("exLink"):o('a[href^="'+e+'://"]').not(".docuLink").addClass("exLink")}),identifyDocuments()},targetByHost=function(){identifyDocuments();var n=new RegExp(location.host);o("a").each(function(){n.test(o(this).attr("href"))===!1&&(jQuery.options.noFollow?jQuery.options.fancyBoxignore?o(this).not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):o(this).not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?o(this).not(".docuLink, .iframe").addClass("exLink"):o(this).not(".docuLink").addClass("exLink"))})},identifyDocuments=function(){jQuery.each(jQuery.options.filetypes,function(n,e){o('a[href$="'+e+'"]').not(".exLink").addClass("docuLink").css("color",jQuery.options.documentColor)})},catchClick=function(n){if(o(n.target).is(".exLink"))if(jQuery.options.linkWarning){if(o(n.target).is("a"))var e=n.target.href;else var e=o(n.target).closest("a").attr("href");showLinkWarning(e),o.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(n,!0)}else{if(o(n.target).is("a"))var e=n.target.href;else var e=o(n.target).closest("a").attr("href");window.open(e,"_blank"),o.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(n,!1)}else if(jQuery.options.fileWarning){if(o(n.target).is("a"))var e=n.target.href;else var e=o(n.target).closest("a").attr("href");showDocWarning(e),o.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(n,!0)}else{if(o(n.target).is("a"))var e=n.target.href;else var e=o(n.target).closest("a").attr("href");window.open(e,"_blank"),o.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(n,!1)}jQuery.options.clickedColor&&o(n.target).css("color",jQuery.options.clickedColor),window.lastObj=n},showLinkWarning=function(n){jQuery.options.modalDisplayBG&&(o("body").append('<div class="modalBG"></div>'),o(".modalBG").fadeIn("slow")),o("body").append('<div class="modal-dialog">'+jQuery.options.linkWarningBody+"<br><br><p><center><b>"+n+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="$.fn.exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="$.fn.exLink.navigateLocation(&quot;'+n+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),o(".modal-dialog").fadeIn("slow"),o(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),o(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),o(".exLinkCancel").css("color",jQuery.options.dialogCancelText),o(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),o(".modal-dialog").css("width",jQuery.options.modalWidth),o(".modal-dialog").css("height",jQuery.options.modalHeight)},showDocWarning=function(n){jQuery.options.modalDisplayBG&&(o("body").append('<div class="modalBG"></div>'),o(".modalBG").fadeIn("slow")),o("body").append('<div class="modal-dialog">'+jQuery.options.fileWarningBody+"<br><br><p><center><b>"+n+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="$.fn.exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="$.fn.exLink.navigateLocation(&quot;'+n+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),o(".modal-dialog").fadeIn("slow"),o(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),o(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),o(".exLinkCancel").css("color",jQuery.options.dialogCancelText),o(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),o(".modal-dialog").css("width",jQuery.options.modalWidth),o(".modal-dialog").css("height",jQuery.options.modalHeight)},o.fn.exLink.closeModal=function(){o(".modalBG").remove(),o(".modal-dialog").remove()},o.fn.exLink.navigateLocation=function(n){if(jQuery.options.gaTracking){var e=window.location.hostname;if(jQuery.options.gaTrackOld){_gaq.push(["_trackEvent",jQuery.options.gaTrackLabel,e,n])}else ga("send","event",jQuery.options.gaTrackLabel,e,n)}window.open(n,"_blank"),o(".modalBG").remove(),o(".modal-dialog").remove()}}(jQuery);
{
"name": "exlink",
"version": "2.0.1",
"version": "2.0.2",
"description": "jQuery.exLink forces all external links (specified by protocol) and documents (specified by format) to open in a new tab. jQuery.exLink also suports a viausal notification that users are navigating to an external site, or opening a document.",

@@ -5,0 +5,0 @@ "main": "jquery.exLink.js",

@@ -10,5 +10,5 @@ jQuery exLink

**Current Version:** 2.0.1
**Current Version:** 2.0.2
**Release Date:** April 22, 2015
**Release Date:** April 27, 2015

@@ -67,2 +67,5 @@

fileCallback: null,
gaTracking: false,
gaTrackLabel: 'External Links',
gaTrackOld: false,
linkWarningBody: 'You are about to leave this website and navigate to the link below. Would you like to continue?',

@@ -110,2 +113,8 @@ fileWarning: true,

**gaTracking** - Introduced in version 2.0.2, this option enables a Google Analytics event to trigger when any of the links are clicked. Classic and Universeral analytics supported. This is a boolean value set to false by default. Ex: gaTracking: false
**gaTrackLabel** - If you you enable gaTracking, set this to ustomize the event label. This is a string value set to 'External Links' by default. Ex: gaTrackLabel: 'External Links'
**gaTrackOld** - Set this to true if you are using the classic version of Google Analytcis (ga.js). If you are using the new universal tracking (analytics.js), you don't need to use this option. This is a boolean value set to false by default. Ex: gaTrackOld: false
######Visual Options

@@ -141,2 +150,20 @@

exLink Demo & Other Stuffs
==
jQuery.exLink has had more downloads than I expected, which is pretty cool! Almost 800 right now. I've put together a basic demo (which I probably should've done from the beginning) and published it on my website. Also, exLink has been featured or shared to some other websites, and I feel like I should say thanks.
- [jQuery.exLink Demo](www.yupitszac.com/demo/jquery-exlink)
- [exLink on npm](www.npmjs.com/package/exlink)
- [exLink on jQuer.in](www.jquer.in/helpful-jquery-plugins-for-html5-websites/exlink/)
- [exLink on Github](www.github.com/YupItsZac/jQuery.exLink) / Just in case you aren't reading this on Github
Also, if you find this plugin useful (or even if you don't), please connect with me!
- [Github](www.github.com/YupItsZac)
- [Twitter](www.twitter.com/YupItsZac)
- [LinkedIn](www.linkedin.com/in/yupitszac)
- [Facebook](www.fb.me/yupitszac)
Notes & Hints

@@ -143,0 +170,0 @@ ===

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc