Update 'mbchc-local.user.js'

* bugfix (Nickname undefined)
* history will now search by input
This commit is contained in:
Mute 2022-07-16 15:03:53 +00:00
parent c73bffc4bb
commit 6fbe13b17a

View File

@ -45,8 +45,6 @@ var bcModSdk=function(){"use strict";const o="1.0.2";function e(o){alert("Mod ER
RE_LAST_LETTER: /[\w]$/,
RGB_MUTE: "#6c2132",
RGB_POLLY: "#81b1e7",
// COMP_DIV_ID: "MBCHC_AUTOCOMPLETE_HINT",
// COMP_DIV_SHOWN: false,
UTC_OFFSET: new Date().getTimezoneOffset() * 60 * 1000,
HAND_PENETRATORS: ["Flogger", "Whip", "TennisRacket", "Gavel", "SmallVibratingWand", "LargeDildo", "Vibrator", "Hairbrush", "SmallDildo", "Baguette", "Spatula", "Broom"],
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)
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 = {}
found.forEach(c => {if (!map[c.cid]) map[c.cid] = c} )
found = Object.values(map)
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])
},
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 found = {}
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})
}
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))))
},
history: function(down) {
let text = window.ElementValue("InputChat")
if (!this.HISTORY_MODE) {
window.ChatRoomLastMessage.push(text)
this.HISTORY_MODE = true
}
if (down && (window.ChatRoomLastMessageIndex > window.ChatRoomLastMessage.length - 2)) return(this.bell())
if (!down && (window.ChatRoomLastMessageIndex < 2)) return(this.bell())
window.ChatRoomLastMessageIndex = (down) ? window.ChatRoomLastMessageIndex + 1 : window.ChatRoomLastMessageIndex - 1
window.ElementValue("InputChat", window.ChatRoomLastMessage[window.ChatRoomLastMessageIndex])
let [text, history] = [window.ElementValue("InputChat"), window.ChatRoomLastMessage]
if (!this.HISTORY_MODE) {history.push(text); this.HISTORY_MODE = true}
let ids = history.map((t,i) => [t,i]).filter(([t,i]) => t.startsWith(history[history.length - 1])).map(([t,i]) => i)
if (!down) ids.reverse()
let found = ids.find(id => (down) ? id > window.ChatRoomLastMessageIndex : id < window.ChatRoomLastMessageIndex)
if (!found) return(this.bell())
window.ElementValue("InputChat", history[found])
window.ChatRoomLastMessageIndex = found
},
loader: function() {
if (this.remove_load_hook) {