mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
formatting - core client side
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
(function(module) {
|
(function(module) {
|
||||||
|
|
||||||
var config = {},
|
var config = {},
|
||||||
@@ -252,7 +250,8 @@
|
|||||||
return template.replace(regex, block);
|
return template.replace(regex, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
var template = this.html, regex, block;
|
var template = this.html,
|
||||||
|
regex, block;
|
||||||
|
|
||||||
return (function parse(data, namespace, template) {
|
return (function parse(data, namespace, template) {
|
||||||
if (!data || data.length == 0) {
|
if (!data || data.length == 0) {
|
||||||
@@ -274,7 +273,9 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var numblocks = data[d].length - 1, i = 0, result = "";
|
var numblocks = data[d].length - 1,
|
||||||
|
i = 0,
|
||||||
|
result = "";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result += parse(data[d][i], namespace, block);
|
result += parse(data[d][i], namespace, block);
|
||||||
@@ -312,7 +313,8 @@
|
|||||||
templates.init();
|
templates.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
})('undefined' === typeof module ? {module:{exports:{}}} : module)
|
})('undefined' === typeof module ? {
|
||||||
|
module: {
|
||||||
|
exports: {}
|
||||||
|
}
|
||||||
|
} : module)
|
||||||
@@ -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);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user