Fix replies errors

This commit is contained in:
Victor 2015-12-07 14:37:31 +02:00
parent f16ecf2363
commit 3670b546cd
2 changed files with 12 additions and 7 deletions

View File

@ -30,9 +30,13 @@ String.prototype.contains = function(text) {
return this.indexOf(text) >= 0;
};
/*String.prototype.startsWith = function(text) {
String.prototype.replaceAll = function(search, replace) {
return this.split(search).join(replace);
};
String.prototype.startsWith = function(text) {
return this.indexOf(text) == 0;
};*/
};
String.prototype.replaceAll = function (find, replace) {
var str = this;

View File

@ -221,21 +221,22 @@ Views.prototype.text_2 = function (whoid, text) {
}
};
Views.prototype.text = function (arg1, arg2) {
if (arguments.length === 1) this.text_1(arg1);
else this.text_2(arg1, arg2);
if (arguments.length === 1) this.text_1(String(arg1));
else this.text_2(String(arg1), String(arg2));
};
Views.prototype.formatString = function (tag, text) {
var edited = text.replaceAll("\\{w.*?\\}", "");
if (edited.contains("{center}")) {
edited = text.replaceAll("\\{center\\}", "");
edited = edited.replaceAll("\\{center\\}", "");
this.textContentTag.style.textAlign = "center";
} else {
this.textContentTag.style.textAlign = "left";
}
if (edited.contains("{html}")) {
edited = edited.replaceAll("\\{html\\}", "");
return edited;
tag.innerHTML = edited;
return;
}
var codes = ["b","i","s","u","big","small"];
var html = false;
@ -249,7 +250,7 @@ Views.prototype.formatString = function (tag, text) {
}
if (html) {
edited = edited.replace("\n", "<br/>");
tag.innerHtml = edited;
tag.innerHTML = edited;
} else {
tag.innerText = edited;
}