Update 'mbchc-local.user.js'
* bugfix (Nickname undefined) * history will now search by input
This commit is contained in:
parent
c73bffc4bb
commit
6fbe13b17a
|
@ -45,8 +45,6 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
|
||||||
RE_LAST_LETTER: /[\w]$/,
|
RE_LAST_LETTER: /[\w]$/,
|
||||||
RGB_MUTE: "#6c2132",
|
RGB_MUTE: "#6c2132",
|
||||||
RGB_POLLY: "#81b1e7",
|
RGB_POLLY: "#81b1e7",
|
||||||
// COMP_DIV_ID: "MBCHC_AUTOCOMPLETE_HINT",
|
|
||||||
// COMP_DIV_SHOWN: false,
|
|
||||||
UTC_OFFSET: new Date().getTimezoneOffset() * 60 * 1000,
|
UTC_OFFSET: new Date().getTimezoneOffset() * 60 * 1000,
|
||||||
HAND_PENETRATORS: ["Flogger", "Whip", "TennisRacket", "Gavel", "SmallVibratingWand", "LargeDildo", "Vibrator", "Hairbrush", "SmallDildo", "Baguette", "Spatula", "Broom"],
|
HAND_PENETRATORS: ["Flogger", "Whip", "TennisRacket", "Gavel", "SmallVibratingWand", "LargeDildo", "Vibrator", "Hairbrush", "SmallDildo", "Baguette", "Spatula", "Broom"],
|
||||||
HIDE_SPECIAL: ["Activity","Emoticon"],
|
HIDE_SPECIAL: ["Activity","Emoticon"],
|
||||||
|
@ -255,12 +253,12 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
|
||||||
}
|
}
|
||||||
if (target.startsWith("@")) target = target.slice(1)
|
if (target.startsWith("@")) target = target.slice(1)
|
||||||
found.push(...window.ChatRoomCharacter.filter(c => c.Name.toLocaleLowerCase().indexOf(target) > -1))
|
found.push(...window.ChatRoomCharacter.filter(c => c.Name.toLocaleLowerCase().indexOf(target) > -1))
|
||||||
found.push(...window.ChatRoomCharacter.filter(c => c.Nickname.toLocaleLowerCase().indexOf(target) > -1))
|
found.push(...window.ChatRoomCharacter.filter(c => c.Nickname && (c.Nickname.toLocaleLowerCase().indexOf(target) > -1)))
|
||||||
let map = {}
|
let map = {}
|
||||||
found.forEach(c => {if (!map[c.cid]) map[c.cid] = c} )
|
found.forEach(c => {if (!map[c.cid]) map[c.cid] = c} )
|
||||||
found = Object.values(map)
|
found = Object.values(map)
|
||||||
if (found.length < 1) throw `target "${input}": no match`
|
if (found.length < 1) throw `target "${input}": no match`
|
||||||
if (found.length > 1) throw `target "${input}": multiple matches (${found.map(c => `${c.cid}|${c.Name}|${c.Nickname}`).join(",")})`
|
if (found.length > 1) throw `target "${input}": multiple matches (${found.map(c => `${c.cid}|${c.Name}|${c.Nickname || c.Name}`).join(",")})`
|
||||||
return(found[0])
|
return(found[0])
|
||||||
},
|
},
|
||||||
donate_data: function(target) {
|
donate_data: function(target) {
|
||||||
|
@ -447,7 +445,7 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
|
||||||
let locase = token.toLocaleLowerCase()
|
let locase = token.toLocaleLowerCase()
|
||||||
let found = {}
|
let found = {}
|
||||||
for (let c of window.ChatRoomCharacter) {
|
for (let c of window.ChatRoomCharacter) {
|
||||||
let [n, nn, cid] = [c.Name.toLocaleLowerCase(), c.Nickname.toLocaleLowerCase(), c.cid.toString()]
|
let [n, nn, cid] = [c.Name.toLocaleLowerCase(), (c.Nickname || c.Name).toLocaleLowerCase(), c.cid.toString()]
|
||||||
if (!c.IsPlayer() || me2) [n, nn, cid, `@${n}`, `@${nn}`, `=${cid}`].forEach(s => {if (s.startsWith(locase) && (!check_perms || window.ServerChatRoomGetAllowItem(window.Player, c))) found[s] = true})
|
if (!c.IsPlayer() || me2) [n, nn, cid, `@${n}`, `@${nn}`, `=${cid}`].forEach(s => {if (s.startsWith(locase) && (!check_perms || window.ServerChatRoomGetAllowItem(window.Player, c))) found[s] = true})
|
||||||
}
|
}
|
||||||
this.complete(Object.keys(found))
|
this.complete(Object.keys(found))
|
||||||
|
@ -506,15 +504,14 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
|
||||||
return(mbchc.complete(window.PoseFemale3DCG.map(p => p.Name).filter(p => p.toLocaleLowerCase().startsWith(pose))))
|
return(mbchc.complete(window.PoseFemale3DCG.map(p => p.Name).filter(p => p.toLocaleLowerCase().startsWith(pose))))
|
||||||
},
|
},
|
||||||
history: function(down) {
|
history: function(down) {
|
||||||
let text = window.ElementValue("InputChat")
|
let [text, history] = [window.ElementValue("InputChat"), window.ChatRoomLastMessage]
|
||||||
if (!this.HISTORY_MODE) {
|
if (!this.HISTORY_MODE) {history.push(text); this.HISTORY_MODE = true}
|
||||||
window.ChatRoomLastMessage.push(text)
|
let ids = history.map((t,i) => [t,i]).filter(([t,i]) => t.startsWith(history[history.length - 1])).map(([t,i]) => i)
|
||||||
this.HISTORY_MODE = true
|
if (!down) ids.reverse()
|
||||||
}
|
let found = ids.find(id => (down) ? id > window.ChatRoomLastMessageIndex : id < window.ChatRoomLastMessageIndex)
|
||||||
if (down && (window.ChatRoomLastMessageIndex > window.ChatRoomLastMessage.length - 2)) return(this.bell())
|
if (!found) return(this.bell())
|
||||||
if (!down && (window.ChatRoomLastMessageIndex < 2)) return(this.bell())
|
window.ElementValue("InputChat", history[found])
|
||||||
window.ChatRoomLastMessageIndex = (down) ? window.ChatRoomLastMessageIndex + 1 : window.ChatRoomLastMessageIndex - 1
|
window.ChatRoomLastMessageIndex = found
|
||||||
window.ElementValue("InputChat", window.ChatRoomLastMessage[window.ChatRoomLastMessageIndex])
|
|
||||||
},
|
},
|
||||||
loader: function() {
|
loader: function() {
|
||||||
if (this.remove_load_hook) {
|
if (this.remove_load_hook) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user