exlink
Advanced tools
Comparing version 2.1.0 to 2.2.1
@@ -12,4 +12,5 @@ // jQuery.exLink | ||
var exLink = (function() { | ||
var opts = {}; | ||
initialize = function(options) { | ||
@@ -52,3 +53,3 @@ | ||
if(options != 're') { | ||
jQuery.options = $.extend({}, defaults, options); | ||
opts = $.extend({}, defaults, options); | ||
@@ -68,3 +69,3 @@ $('body').on('click','.exLink, .docuLink',function(event){ | ||
if(jQuery.options.hostCompare) { | ||
if(opts.hostCompare) { | ||
targetByHost(); | ||
@@ -75,5 +76,5 @@ } else { | ||
$('.exLink').css('color', jQuery.options.externalColor); | ||
$('.docuLink').css('color', jQuery.options.documentColor); | ||
$('.exLink').css('color', opts.externalColor); | ||
$('.docuLink').css('color', opts.documentColor); | ||
}; | ||
@@ -85,5 +86,5 @@ | ||
jQuery.each(jQuery.options.protocols, function(key, value) { | ||
if(jQuery.options.noFollow) { | ||
if(jQuery.options.fancyBoxIgnore) { | ||
jQuery.each(opts.protocols, function(key, value) { | ||
if(opts.noFollow) { | ||
if(opts.fancyBoxIgnore) { | ||
$('a[href^="'+value+'://"]').not('.docuLink, .iframe').addClass("exLink").attr('rel', 'nofollow'); | ||
@@ -94,3 +95,3 @@ } else { | ||
} else { | ||
if(jQuery.options.fancyBoxIgnore) { | ||
if(opts.fancyBoxIgnore) { | ||
$('a[href^="'+value+'://"]').not('.docuLink, .iframe').addClass("exLink"); | ||
@@ -118,4 +119,4 @@ } else { | ||
if(hostname.test($(this).attr('href')) === false) { | ||
if(jQuery.options.noFollow) { | ||
if(jQuery.options.fancyBoxignore) { | ||
if(opts.noFollow) { | ||
if(opts.fancyBoxignore) { | ||
$(this).not('.docuLink, .iframe').addClass('exLink').attr('rel', 'nofollow'); | ||
@@ -126,3 +127,3 @@ } else { | ||
} else { | ||
if(jQuery.options.fancyBoxIgnore) { | ||
if(opts.fancyBoxIgnore) { | ||
$(this).not('.docuLink, .iframe').addClass('exLink'); | ||
@@ -139,4 +140,4 @@ } else { | ||
jQuery.each(jQuery.options.filetypes, function(key, value) { | ||
$('a[href$="'+value+'"]').not('.exLink').addClass('docuLink').css('color', jQuery.options.documentColor); | ||
jQuery.each(opts.filetypes, function(key, value) { | ||
$('a[href$="'+value+'"]').not('.exLink').addClass('docuLink').css('color', opts.documentColor); | ||
}); | ||
@@ -148,3 +149,3 @@ }; | ||
if($(obj.target).is('.exLink')) { | ||
if(jQuery.options.linkWarning) { | ||
if(opts.linkWarning) { | ||
@@ -158,4 +159,4 @@ if($(obj.target).is('a')) { | ||
showLinkWarning(href); | ||
if ($.isFunction(jQuery.options.linkCallback)) { | ||
jQuery.options.linkCallback(obj, true); | ||
if ($.isFunction(opts.linkCallback)) { | ||
opts.linkCallback(obj, true); | ||
} | ||
@@ -170,4 +171,4 @@ } else { | ||
window.open(href, '_blank'); | ||
if ($.isFunction(jQuery.options.linkCallback)) { | ||
jQuery.options.linkCallback(obj, false); | ||
if ($.isFunction(opts.linkCallback)) { | ||
opts.linkCallback(obj, false); | ||
} | ||
@@ -177,3 +178,3 @@ | ||
} else { | ||
if(jQuery.options.fileWarning) { | ||
if(opts.fileWarning) { | ||
@@ -188,4 +189,4 @@ if($(obj.target).is('a')) { | ||
if($.isFunction(jQuery.options.fileCallback)) { | ||
jQuery.options.fileCallback(obj, true); | ||
if($.isFunction(opts.fileCallback)) { | ||
opts.fileCallback(obj, true); | ||
} | ||
@@ -201,4 +202,4 @@ | ||
if($.isFunction(jQuery.options.fileCallback)) { | ||
jQuery.options.fileCallback(obj, false); | ||
if($.isFunction(opts.fileCallback)) { | ||
opts.fileCallback(obj, false); | ||
} | ||
@@ -208,4 +209,4 @@ } | ||
if(jQuery.options.clickedColor) { | ||
$(obj.target).css('color', jQuery.options.clickedColor); | ||
if(opts.clickedColor) { | ||
$(obj.target).css('color', opts.clickedColor); | ||
} | ||
@@ -219,3 +220,3 @@ | ||
if(jQuery.options.modalDisplayBG) { | ||
if(opts.modalDisplayBG) { | ||
$('body').append('<div class="modalBG"></div>'); | ||
@@ -225,16 +226,16 @@ $('.modalBG').fadeIn("slow"); | ||
$('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("'+href+'");">'+jQuery.options.dialogConfirmButton+'</div></div>'); | ||
$('body').append('<div class="modal-dialog">'+opts.linkWarningBody+'<br><br><p><center><b>'+href+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+opts.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate("'+href+'");">'+opts.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); | ||
$('.exLinkCancel').css("background-color",opts.dialogCancel); | ||
$('.exLinkContinue').css('background-color', opts.dialogConfirm); | ||
$('.exLinkCancel').css('color', opts.dialogCancelText); | ||
$('.exLinkContinue').css('color', opts.dialogConfirmText); | ||
$('.modal-dialog').css('width', jQuery.options.modalWidth); | ||
$('.modal-dialog').css('height', jQuery.options.modalHeight); | ||
$('.modal-dialog').css('width', opts.modalWidth); | ||
$('.modal-dialog').css('height', opts.modalHeight); | ||
}; | ||
showDocWarning = function(href) { | ||
if(jQuery.options.modalDisplayBG) { | ||
if(opts.modalDisplayBG) { | ||
$('body').append('<div class="modalBG"></div>'); | ||
@@ -244,12 +245,12 @@ $('.modalBG').fadeIn("slow"); | ||
$('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("'+href+'");">'+jQuery.options.dialogConfirmButton+'</div></div>'); | ||
$('body').append('<div class="modal-dialog">'+opts.fileWarningBody+'<br><br><p><center><b>'+href+'</b></center></p><br><br><div class="exLinkButton exLinkCancel" onclick="exLink.closeModal();">'+opts.dialogCancelButton+'</div><div class="exLinkButton exLinkContinue" onclick="exLink.navigate("'+href+'");">'+opts.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); | ||
$('.exLinkCancel').css("background-color",opts.dialogCancel); | ||
$('.exLinkContinue').css('background-color', opts.dialogConfirm); | ||
$('.exLinkCancel').css('color', opts.dialogCancelText); | ||
$('.exLinkContinue').css('color', opts.dialogConfirmText); | ||
$('.modal-dialog').css('width', jQuery.options.modalWidth); | ||
$('.modal-dialog').css('height', jQuery.options.modalHeight); | ||
$('.modal-dialog').css('width', opts.modalWidth); | ||
$('.modal-dialog').css('height', opts.modalHeight); | ||
}; | ||
@@ -265,15 +266,15 @@ | ||
if(jQuery.options.gaTracking) { | ||
if(opts.gaTracking) { | ||
var hname = window.location.hostname; | ||
if(jQuery.options.gaTrackOld) { | ||
var track = _gaq.push(['_trackEvent', jQuery.options.gaTrackLabel, hname, href]); | ||
if(opts.gaTrackOld) { | ||
var track = _gaq.push(['_trackEvent', opts.gaTrackLabel, hname, href]); | ||
} else { | ||
ga('send', 'event', jQuery.options.gaTrackLabel, hname, href); | ||
ga('send', 'event', opts.gaTrackLabel, hname, href); | ||
} | ||
} | ||
if(jQuery.options.newWindow) { | ||
window.open(href, jQuery.options.titleWindow, 'height='+jQuery.options.heightWindow+', width='+jQuery.options.widthWindow); | ||
if(opts.newWindow) { | ||
window.open(href, opts.titleWindow, 'height='+opts.heightWindow+', width='+opts.widthWindow); | ||
} else { | ||
@@ -280,0 +281,0 @@ window.open(href, '_blank'); |
{ | ||
"name": "exlink", | ||
"version": "2.1.0", | ||
"version": "2.2.1", | ||
"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.1.0 | ||
**Current Version:** 2.2.1 | ||
**Release Date:** June 30, 2015 | ||
**Release Date:** August 26, 2015 | ||
@@ -50,3 +50,3 @@ | ||
exLink(); | ||
exLink.init(); | ||
@@ -67,3 +67,3 @@ ``` | ||
$.fn.exLink({ | ||
exLink.init({ | ||
protocols: ['http', 'https'], | ||
@@ -70,0 +70,0 @@ filetypes: ['pdf', 'xls', 'docx', 'doc', 'ppt', 'pptx'], |
Sorry, the diff of this file is not supported yet
31085
6
259