Skip to content

Commit

Permalink
removing event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Walker committed May 5, 2015
1 parent 0ee737c commit 99efa14
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 61 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jQuery-linkify",
"version": "1.1.7",
"version": "infowrap1.1.7",
"homepage": "https://github.com/SoapBox/jQuery-linkify/",
"authors": [
"SoapBox Innovations, Inc. <[email protected]>"
Expand Down
18 changes: 2 additions & 16 deletions dist/jquery.linkify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Made by SoapBox Innovations, Inc.
* Under MIT License
*/
!function($, window, document) {
!function($, window, document, undefined) {
"use strict";
function Linkified(element, options) {
this._defaults = defaults, this.element = element, this.setOptions(options), this.init();
Expand Down Expand Up @@ -70,19 +70,5 @@
var linkified;
(linkified = $.data(this, "plugin-linkify")) ? (linkified.setOptions(options), linkified.init()) : $.data(this, "plugin-linkify", new Linkified(this, options));
});
}, $.fn.linkify.Constructor = Linkified, $(window).on("load", function() {
$("[data-linkify]").each(function() {
var $target, $this = $(this), target = $this.attr("data-linkify"), options = {
tagName: $this.attr("data-linkify-tagname"),
newLine: $this.attr("data-linkify-newline"),
target: $this.attr("data-linkify-target"),
linkClass: $this.attr("data-linkify-linkclass")
};
for (var option in options) "undefined" == typeof options[option] && delete options[option];
$target = "this" === target ? $this : $this.find(target), $target.linkify(options);
});
}), $("body").on("click", ".linkified", function() {
var $link = $(this), url = $link.attr("href"), isEmail = /^mailto:/i.test(url), target = $link.attr("target");
return isEmail ? window.location.href = url : window.open(url, target), !1;
});
}, $.fn.linkify.Constructor = Linkified;
}(jQuery, window, document);
2 changes: 1 addition & 1 deletion dist/jquery.linkify.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 43 additions & 43 deletions src/jquery.linkify.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,47 @@ $.fn.linkify = function (options) {
$.fn.linkify.Constructor = Linkified;

// DOM data- API setup
$(window).on('load', function () {
$('[data-linkify]').each(function () {
var $this = $(this),
$target,
target = $this.attr('data-linkify'),
options = {
tagName: $this.attr('data-linkify-tagname'),
newLine: $this.attr('data-linkify-newline'),
target: $this.attr('data-linkify-target'),
linkClass: $this.attr('data-linkify-linkclass')
};

// Delete undefined options
for (var option in options) {
if (typeof options[option] === 'undefined') {
delete options[option];
}
}

$target = target === 'this' ? $this : $this.find(target);
$target.linkify(options);

});
});

// Setup click events for linkified elements
$('body').on('click', '.linkified', function () {
var $link = $(this),
url = $link.attr('href'),
isEmail = /^mailto:/i.test(url),
target = $link.attr('target');

if (isEmail) {

// mailto links ignore the target
window.location.href = url;

} else {
window.open(url, target);
}

return false;
});
// $(window).on('load', function () {
// $('[data-linkify]').each(function () {
// var $this = $(this),
// $target,
// target = $this.attr('data-linkify'),
// options = {
// tagName: $this.attr('data-linkify-tagname'),
// newLine: $this.attr('data-linkify-newline'),
// target: $this.attr('data-linkify-target'),
// linkClass: $this.attr('data-linkify-linkclass')
// };

// // Delete undefined options
// for (var option in options) {
// if (typeof options[option] === 'undefined') {
// delete options[option];
// }
// }

// $target = target === 'this' ? $this : $this.find(target);
// $target.linkify(options);

// });
// });

// // Setup click events for linkified elements
// $('body').on('click', '.linkified', function () {
// var $link = $(this),
// url = $link.attr('href'),
// isEmail = /^mailto:/i.test(url),
// target = $link.attr('target');

// if (isEmail) {

// // mailto links ignore the target
// window.location.href = url;

// } else {
// window.open(url, target);
// }

// return false;
// });

0 comments on commit 99efa14

Please sign in to comment.