forked from maccman/holla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
30 lines (25 loc) · 830 Bytes
/
utils.js
File metadata and controls
30 lines (25 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function($){
$.fn.item = function(){
var item = $(this).tmplItem().data;
return($.isFunction(item.reload) ? item.reload() : null);
};
$.fn.forItem = function(item){
return this.filter(function(){
var compare = $(this).tmplItem().data;
if (item.eql && item.eql(compare) || item === compare)
return true;
});
};
$.fn.autolink = function () {
return this.each( function(){
var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g;
$(this).html( $(this).html().replace(re, '<a href="$1">$1</a> ') );
});
};
$.fn.mailto = function () {
return this.each( function() {
var re = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g
$(this).html( $(this).html().replace( re, '<a href="mailto:$1">$1</a>' ) );
});
};
})(jQuery);