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.3 to 2.1.0

51

jquery.exLink.js

@@ -7,10 +7,10 @@ // jQuery.exLink

// Support: @YupItsZac - Twitter, or fb.me/yupitszac
// Version 2.0.3 April 27, 2015
// Version 2.1.0 June 30, 2015
(function( $ ) {
var exLink = (function() {
$.fn.exLink = function(options) {
initialize = function(options) {

@@ -43,3 +43,7 @@ var defaults = {

documentColor: '',
clickedColor: ''
clickedColor: '',
newWindow: false,
widthWindow: "500",
heightWindow: "400;",
titleWindow: 'exLink by YupItsZac.com'
}

@@ -73,3 +77,3 @@

},
};

@@ -97,3 +101,3 @@ targetByProtocol = function() {

identifyDocuments();
},
};

@@ -127,3 +131,3 @@ targetByHost = function() {

});
},
};

@@ -135,3 +139,3 @@ identifyDocuments = function() {

});
},
};

@@ -201,3 +205,3 @@ catchClick = function(obj) {

},
};

@@ -211,3 +215,3 @@ showLinkWarning = function(href) {

$('body').append('<div class="modal-dialog">'+jQuery.options.linkWarningBody+'<br><br><p><center><b>'+href+'</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;'+href+'&quot;);">'+jQuery.options.dialogConfirmButton+'</div></div>');
$('body').append('<div class="modal-dialog">'+jQuery.options.linkWarningBody+'<br><br><p><center><b>'+href+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate(&quot;'+href+'&quot;);">'+jQuery.options.dialogConfirmButton+'</div></div>');
$('.modal-dialog').fadeIn("slow");

@@ -222,3 +226,3 @@

$('.modal-dialog').css('height', jQuery.options.modalHeight);
},
};

@@ -231,3 +235,3 @@ showDocWarning = function(href) {

$('body').append('<div class="modal-dialog">'+jQuery.options.fileWarningBody+'<br><br><p><center><b>'+href+'</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;'+href+'&quot;);">'+jQuery.options.dialogConfirmButton+'</div></div>');
$('body').append('<div class="modal-dialog">'+jQuery.options.fileWarningBody+'<br><br><p><center><b>'+href+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate(&quot;'+href+'&quot;);">'+jQuery.options.dialogConfirmButton+'</div></div>');
$('.modal-dialog').fadeIn("slow");

@@ -244,3 +248,3 @@

$.fn.exLink.closeModal = function() {
closeModal = function() {

@@ -251,3 +255,3 @@ $('.modalBG').remove();

$.fn.exLink.navigateLocation = function(href) {
navigateLocation = function(href) {

@@ -265,3 +269,7 @@ if(jQuery.options.gaTracking) {

window.open(href, '_blank');
if(jQuery.options.newWindow) {
window.open(href, jQuery.options.titleWindow, 'height='+jQuery.options.heightWindow+', width='+jQuery.options.widthWindow);
} else {
window.open(href, '_blank');
}

@@ -272,2 +280,13 @@ $('.modalBG').remove();

})( jQuery );
//Public stuffs
//These are the functions that are public facing.
//Anything not mapped here will not be accessible form console or the browser.
return {
init: initialize,
closeModal: closeModal,
navigate: navigateLocation
};
})();

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

!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);
var exLink=function(){return initialize=function(o){var n={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:"",newWindow:!1,widthWindow:"500",heightWindow:"400;",titleWindow:"exLink by YupItsZac.com"};"re"!=o&&(jQuery.options=$.extend({},n,o),$("body").on("click",".exLink, .docuLink",function(o){o.preventDefault(),1!=o.handled&&catchClick(o),o.handled=!0}));jQuery.options.hostCompare?targetByHost():targetByProtocol(),$(".exLink").css("color",jQuery.options.externalColor),$(".docuLink").css("color",jQuery.options.documentColor)},targetByProtocol=function(){jQuery.each(jQuery.options.protocols,function(o,n){jQuery.options.noFollow?jQuery.options.fancyBoxIgnore?$('a[href^="'+n+'://"]').not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):$('a[href^="'+n+'://"]').not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?$('a[href^="'+n+'://"]').not(".docuLink, .iframe").addClass("exLink"):$('a[href^="'+n+'://"]').not(".docuLink").addClass("exLink")}),identifyDocuments()},targetByHost=function(){identifyDocuments();var o=new RegExp(location.host);$("a").each(function(){o.test($(this).attr("href"))===!1&&(jQuery.options.noFollow?jQuery.options.fancyBoxignore?$(this).not(".docuLink, .iframe").addClass("exLink").attr("rel","nofollow"):$(this).not(".docuLink").addClass("exLink").attr("rel","nofollow"):jQuery.options.fancyBoxIgnore?$(this).not(".docuLink, .iframe").addClass("exLink"):$(this).not(".docuLink").addClass("exLink"))})},identifyDocuments=function(){jQuery.each(jQuery.options.filetypes,function(o,n){$('a[href$="'+n+'"]').not(".exLink").addClass("docuLink").css("color",jQuery.options.documentColor)})},catchClick=function(o){if($(o.target).is(".exLink"))if(jQuery.options.linkWarning){if($(o.target).is("a"))var n=o.target.href;else var n=$(o.target).closest("a").attr("href");showLinkWarning(n),$.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(o,!0)}else{if($(o.target).is("a"))var n=o.target.href;else var n=$(o.target).closest("a").attr("href");window.open(n,"_blank"),$.isFunction(jQuery.options.linkCallback)&&jQuery.options.linkCallback(o,!1)}else if(jQuery.options.fileWarning){if($(o.target).is("a"))var n=o.target.href;else var n=$(o.target).closest("a").attr("href");showDocWarning(n),$.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(o,!0)}else{if($(o.target).is("a"))var n=o.target.href;else var n=$(o.target).closest("a").attr("href");window.open(n,"_blank"),$.isFunction(jQuery.options.fileCallback)&&jQuery.options.fileCallback(o,!1)}jQuery.options.clickedColor&&$(o.target).css("color",jQuery.options.clickedColor),window.lastObj=o},showLinkWarning=function(o){jQuery.options.modalDisplayBG&&($("body").append('<div class="modalBG"></div>'),$(".modalBG").fadeIn("slow")),$("body").append('<div class="modal-dialog">'+jQuery.options.linkWarningBody+"<br><br><p><center><b>"+o+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate(&quot;'+o+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),$(".modal-dialog").fadeIn("slow"),$(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),$(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),$(".exLinkCancel").css("color",jQuery.options.dialogCancelText),$(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),$(".modal-dialog").css("width",jQuery.options.modalWidth),$(".modal-dialog").css("height",jQuery.options.modalHeight)},showDocWarning=function(o){jQuery.options.modalDisplayBG&&($("body").append('<div class="modalBG"></div>'),$(".modalBG").fadeIn("slow")),$("body").append('<div class="modal-dialog">'+jQuery.options.fileWarningBody+"<br><br><p><center><b>"+o+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+jQuery.options.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate(&quot;'+o+'&quot;);">'+jQuery.options.dialogConfirmButton+"</div></div>"),$(".modal-dialog").fadeIn("slow"),$(".exLinkCancel").css("background-color",jQuery.options.dialogCancel),$(".exLinkContinue").css("background-color",jQuery.options.dialogConfirm),$(".exLinkCancel").css("color",jQuery.options.dialogCancelText),$(".exLinkContinue").css("color",jQuery.options.dialogConfirmText),$(".modal-dialog").css("width",jQuery.options.modalWidth),$(".modal-dialog").css("height",jQuery.options.modalHeight)},closeModal=function(){$(".modalBG").remove(),$(".modal-dialog").remove()},navigateLocation=function(o){if(jQuery.options.gaTracking){var n=window.location.hostname;if(jQuery.options.gaTrackOld){_gaq.push(["_trackEvent",jQuery.options.gaTrackLabel,n,o])}else ga("send","event",jQuery.options.gaTrackLabel,n,o)}jQuery.options.newWindow?window.open(o,jQuery.options.titleWindow,"height="+jQuery.options.heightWindow+", width="+jQuery.options.widthWindow):window.open(o,"_blank"),$(".modalBG").remove(),$(".modal-dialog").remove()},{init:initialize,closeModal:closeModal,navigate:navigateLocation}}();
{
"name": "exlink",
"version": "2.0.3",
"version": "2.1.0",
"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.3
**Current Version:** 2.1.0
**Release Date:** April 27, 2015
**Release Date:** June 30, 2015

@@ -46,6 +46,14 @@

2). After the required files have been included in your document, usage is incredibly easy! For the default case, just initiate the exLink plugin. This uses all of the default options.
2). After the required files have been included in your document, usage is incredibly easy! For the default case, just initiate the exLink plugin. This uses all of the default options.
```javascript
exLink();
```
In versions prior to 2.1.0, initaite exLink with the '$.fn.' declaration.
```javascript
$.fn.exLink();

@@ -85,3 +93,7 @@

documentColor: '',
clickedColor: ''
clickedColor: '',
newWindow: false,
widthWindow: '500',
heightWindow: '400',
titleWindow: 'exLink by YupItsZac.com'
});

@@ -116,6 +128,14 @@

**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'
**gaTrackLabel** - If you you enable gaTracking, set this to customize 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
**newWindow** - New in version 2.1.0, when set to true, exLink forces all external links and documents to open in a new window, not the default 'tab' behavior. Ex: newWindow: true
**widthWindow** - The width of the new window specified via the newWindow option. String value. Ex: widthWindow: '500'
**heightWindow** - The height of the window specified via the newWindow option. String value. Ex: heightWindow: '400'
*titleWindow** - The title of the window specified via the newWindow option. String value. Ex: titleWindow: 'My Window Title'
######Visual Options

@@ -198,3 +218,3 @@

4). If you want to target a single internal link as well, simply add the appropriate class to the link in your content.
4). Prior to version 2.1.0, if you want to target a single internal link as well, simply add the appropriate class to the link in your content.

@@ -201,0 +221,0 @@ ```html

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