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; 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; return this.indexOf(text) == 0;
};*/ };
String.prototype.replaceAll = function (find, replace) { String.prototype.replaceAll = function (find, replace) {
var str = this; var str = this;

View File

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