aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2019-10-04 16:20:34 -0300
committerLibravatar Renard 2019-10-04 16:20:34 -0300
commitf27a8bcfc5a6454f5be7a69152bbb53b7579927e (patch)
treec85fa6764c04f4dc7d612987dc94bc4c8d78aca7
parent2b10f1dbcb4149c0a42982a025d8c31fd1bc0177 (diff)
downloadbai-client-f27a8bcfc5a6454f5be7a69152bbb53b7579927e.tar.gz
bai-client-f27a8bcfc5a6454f5be7a69152bbb53b7579927e.tar.xz
bai-client-f27a8bcfc5a6454f5be7a69152bbb53b7579927e.zip
Setting: interpretar navegador
-rw-r--r--src/App.js3
-rw-r--r--src/Post.js26
-rw-r--r--src/Settings.js16
3 files changed, 40 insertions, 5 deletions
diff --git a/src/App.js b/src/App.js
index 4301b5c..0d667f5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -73,7 +73,8 @@ class App extends Component {
showAvatars: true,
postPassword: this.genPassword(),
embedYoutube: true,
- colorifyIDs: true
+ colorifyIDs: true,
+ browserId: false
};
if (lsSettings === null) {
localStorage.setItem("settings", JSON.stringify(defaultSettings));
diff --git a/src/Post.js b/src/Post.js
index 3d75f36..20e54e6 100644
--- a/src/Post.js
+++ b/src/Post.js
@@ -143,6 +143,10 @@ class Post extends Component {
// Obtener un avatar aleatorio basado en ID
let user_id = post.timestamp_formatted.split(" ID:")[1];
+ if (user_id === undefined) {
+ user_id = "";
+ }
+ console.log("#" + user_id + ", length: " + user_id.length);
const seedrandom = require("seedrandom");
const rng = seedrandom(threadId + index);
const idRng = seedrandom(user_id);
@@ -216,13 +220,33 @@ class Post extends Component {
let starColor = "grey";
let icon = "user";
+ let settingBrowserId = JSON.parse(localStorage.getItem("settings"))
+ .browserId;
+
+ if (user_id.length > 8 && settingBrowserId) {
+ let sufix = user_id.substr(8, 1);
+ const browser = {
+ F: "firefox",
+ C: "chrome",
+ s: "safari",
+ S: "SeaMonkey",
+ o: "opera",
+ I: "internet explorer",
+ E: "microsoft edge",
+ a: "android"
+ };
+ if (Object.keys(browser).includes(sufix)) {
+ icon = browser[sufix];
+ }
+ }
+
if (user_id === "CAP_USER*") {
starColor = "blue";
icon = "check circle";
user_id = "Usuario verificado";
} else if (isMine) {
starColor = "olive";
- } else if (user_id === "???T") {
+ } else if (user_id.startsWith("???")) {
icon = "user secret";
}
if (post.name === "Renard ★") {
diff --git a/src/Settings.js b/src/Settings.js
index efc8995..209fed5 100644
--- a/src/Settings.js
+++ b/src/Settings.js
@@ -36,7 +36,8 @@ class SettingsModal extends Component {
showAvatars: true,
postPassword: "",
embedYoutube: true,
- colorifyIDs: true
+ colorifyIDs: true,
+ browserId: false
};
this.handleChange = this.handleChange.bind(this);
this.toggleSetting = this.toggleSetting.bind(this);
@@ -54,7 +55,8 @@ class SettingsModal extends Component {
showAvatars: settings.showAvatars,
postPassword: settings.postPassword,
embedYoutube: settings.embedYoutube,
- colorifyIDs: settings.colorifyIDs
+ colorifyIDs: settings.colorifyIDs,
+ browserId: settings.browserId
});
}
@@ -91,7 +93,8 @@ class SettingsModal extends Component {
postPassword,
showAvatars,
embedYoutube,
- colorifyIDs
+ colorifyIDs,
+ browserId
} = this.state;
return (
<Modal trigger={this.props.trigger} size="tiny" centered={false}>
@@ -122,6 +125,13 @@ class SettingsModal extends Component {
onChange={this.toggleSetting}
className="settingCheckbox"
/>
+ <Checkbox
+ label="Interpretar navegador de posts"
+ checked={browserId}
+ name="browserId"
+ onChange={this.toggleSetting}
+ className="settingCheckbox"
+ />
<Header as="h4" dividing>
Comportamiento
</Header>