|
|
@ -1,4 +1,4 @@
|
|
|
|
(function (module) {
|
|
|
|
(function(module) {
|
|
|
|
|
|
|
|
|
|
|
|
var utils, fs;
|
|
|
|
var utils, fs;
|
|
|
|
|
|
|
|
|
|
|
@ -10,7 +10,8 @@
|
|
|
|
module.exports = utils = {
|
|
|
|
module.exports = utils = {
|
|
|
|
generateUUID: function() {
|
|
|
|
generateUUID: function() {
|
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
|
|
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
|
|
|
var r = Math.random() * 16 | 0,
|
|
|
|
|
|
|
|
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
|
|
return v.toString(16);
|
|
|
|
return v.toString(16);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -74,7 +75,7 @@
|
|
|
|
// remove accents, swap ñ for n, etc
|
|
|
|
// remove accents, swap ñ for n, etc
|
|
|
|
var from = "àáäâèéëêìíïîıòóöôùúüûñçşğ·/_,:;";
|
|
|
|
var from = "àáäâèéëêìíïîıòóöôùúüûñçşğ·/_,:;";
|
|
|
|
var to = "aaaaeeeeiiiiioooouuuuncsg------";
|
|
|
|
var to = "aaaaeeeeiiiiioooouuuuncsg------";
|
|
|
|
for (var i=0, l=from.length ; i<l ; i++) {
|
|
|
|
for (var i = 0, l = from.length; i < l; i++) {
|
|
|
|
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
|
|
|
|
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +107,7 @@
|
|
|
|
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
|
|
|
|
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
|
|
|
|
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
|
|
|
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
|
|
|
|
|
|
|
|
|
|
|
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
|
|
|
return input.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
|
|
|
|
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
|
|
|
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -114,10 +115,10 @@
|
|
|
|
buildMetaTags: function(tagsArr) {
|
|
|
|
buildMetaTags: function(tagsArr) {
|
|
|
|
var tags = '',
|
|
|
|
var tags = '',
|
|
|
|
tag;
|
|
|
|
tag;
|
|
|
|
for(var x=0,numTags=tagsArr.length;x<numTags;x++) {
|
|
|
|
for (var x = 0, numTags = tagsArr.length; x < numTags; x++) {
|
|
|
|
if (tags.length > 0) tags += "\n\t";
|
|
|
|
if (tags.length > 0) tags += "\n\t";
|
|
|
|
tag = '<meta';
|
|
|
|
tag = '<meta';
|
|
|
|
for(y in tagsArr[x]) {
|
|
|
|
for (y in tagsArr[x]) {
|
|
|
|
tag += ' ' + y + '="' + tagsArr[x][y] + '"';
|
|
|
|
tag += ' ' + y + '="' + tagsArr[x][y] + '"';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tag += ' />';
|
|
|
|
tag += ' />';
|
|
|
@ -150,8 +151,7 @@
|
|
|
|
badge
|
|
|
|
badge
|
|
|
|
.removeClass('badge-inverse')
|
|
|
|
.removeClass('badge-inverse')
|
|
|
|
.addClass('badge-important')
|
|
|
|
.addClass('badge-important')
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
badge
|
|
|
|
badge
|
|
|
|
.removeClass('badge-important')
|
|
|
|
.removeClass('badge-important')
|
|
|
|
.addClass('badge-inverse')
|
|
|
|
.addClass('badge-inverse')
|
|
|
@ -167,19 +167,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.trim) {
|
|
|
|
if (!String.prototype.trim) {
|
|
|
|
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
|
|
|
|
String.prototype.trim = function() {
|
|
|
|
|
|
|
|
return this.replace(/^\s+|\s+$/g, '');
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.ltrim) {
|
|
|
|
if (!String.prototype.ltrim) {
|
|
|
|
String.prototype.ltrim=function(){return this.replace(/^\s+/,'');};
|
|
|
|
String.prototype.ltrim = function() {
|
|
|
|
|
|
|
|
return this.replace(/^\s+/, '');
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.rtrim) {
|
|
|
|
if (!String.prototype.rtrim) {
|
|
|
|
String.prototype.rtrim=function(){return this.replace(/\s+$/,'');};
|
|
|
|
String.prototype.rtrim = function() {
|
|
|
|
|
|
|
|
return this.replace(/\s+$/, '');
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.fulltrim) {
|
|
|
|
if (!String.prototype.fulltrim) {
|
|
|
|
String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ');};
|
|
|
|
String.prototype.fulltrim = function() {
|
|
|
|
|
|
|
|
return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g, '').replace(/\s+/g, ' ');
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -187,4 +195,8 @@
|
|
|
|
window.utils = module.exports;
|
|
|
|
window.utils = module.exports;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})('undefined' === typeof module ? {module:{exports:{}}} : module)
|
|
|
|
})('undefined' === typeof module ? {
|
|
|
|
|
|
|
|
module: {
|
|
|
|
|
|
|
|
exports: {}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} : module)
|