Skip to content

Commit 085bc46

Browse files
authored
Merge pull request #753 from steveseguin/beta
Beta - locals and showtime fixes
2 parents 6ecd06f + ff42438 commit 085bc46

10 files changed

Lines changed: 260 additions & 156 deletions

File tree

bot.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,8 @@
14241424

14251425
var timeoutDelay = 0;
14261426
if (urlParams.has("showtime")) {
1427-
timeoutDelay = parseInt(urlParams.get("showtime")) || 20000;
1427+
timeoutDelay = parseInt(urlParams.get("showtime"));
1428+
if (isNaN(timeoutDelay)) { timeoutDelay = 20000; }
14281429
}
14291430

14301431
var borderRadius = 0;

dock.html

Lines changed: 73 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,20 @@
327327
background-color: #c9302c;
328328
}
329329

330-
.viewerIcons {
331-
background-position: left;
332-
background-repeat: no-repeat;
333-
background-size: contain;
334-
padding: 5px;
335-
margin: 0 5px 0 0;
336-
cursor: help;
337-
padding-left: 34px;
338-
border-radius: 25%;
339-
font-variant-numeric: tabular-nums;
340-
font-feature-settings: "tnum" 1, "kern" 0;
341-
font-kerning: none;
342-
white-space: nowrap;
343-
}
330+
.viewerIcons {
331+
background-position: left;
332+
background-repeat: no-repeat;
333+
background-size: contain;
334+
padding: 5px;
335+
margin: 0 5px 0 0;
336+
cursor: help;
337+
padding-left: 34px;
338+
border-radius: 25%;
339+
font-variant-numeric: tabular-nums;
340+
font-feature-settings: "tnum" 1, "kern" 0;
341+
font-kerning: none;
342+
white-space: nowrap;
343+
}
344344

345345
@media (max-width: 600px) {
346346
.modal .modal-content {
@@ -3115,7 +3115,8 @@ <h3>Status</h3>
31153115

31163116
var timeoutDelay = 0;
31173117
if (urlParams.has("showtime")) {
3118-
timeoutDelay = parseInt(urlParams.get("showtime")) || 20000;
3118+
timeoutDelay = parseInt(urlParams.get("showtime"));
3119+
if (isNaN(timeoutDelay)) { timeoutDelay = 20000; }
31193120
}
31203121

31213122
var waitToReveal = 0;
@@ -3351,6 +3352,12 @@ <h3>Status</h3>
33513352
highlightSpecial = false;
33523353
}
33533354

3355+
var highlightFirstTimers = true;
3356+
if (urlParams.has("nofirsttimehighlight")) {
3357+
highlightFirstTimers = false;
3358+
document.documentElement.style.setProperty("--firstime-bgcolor", "unset");
3359+
}
3360+
33543361
var highlightDonos = true;
33553362
if (urlParams.has("nodonohighlight")) {
33563363
highlightDonos = false;
@@ -9590,7 +9597,7 @@ <h2 id="messagesFor">Messages</h2>\
95909597
node.classList.add("member");
95919598
}
95929599

9593-
if (data.firsttime) {
9600+
if (data.firsttime && highlightFirstTimers) {
95949601
node.classList.add("firsttime");
95959602
}
95969603

@@ -9808,18 +9815,18 @@ <h2 id="messagesFor">Messages</h2>\
98089815
}
98099816
}
98109817

9811-
node.rawContents = data;
9812-
9813-
const metaFeatured = data.meta && data.meta.featured;
9814-
9815-
if (metaFeatured) {
9816-
if (autoTimeoutEnabled) {
9817-
autoShowQueue.push(node);
9818-
checkAutoShow();
9819-
} else {
9820-
selectedMessage(false, node);
9821-
}
9822-
} else if (autoyoutubememberchat && (data.type == "youtube") && data.membership){
9818+
node.rawContents = data;
9819+
9820+
const metaFeatured = data.meta && data.meta.featured;
9821+
9822+
if (metaFeatured) {
9823+
if (autoTimeoutEnabled) {
9824+
autoShowQueue.push(node);
9825+
checkAutoShow();
9826+
} else {
9827+
selectedMessage(false, node);
9828+
}
9829+
} else if (autoyoutubememberchat && (data.type == "youtube") && data.membership){
98239830
if (autoTimeoutEnabled) {
98249831
autoShowQueue.push(node);
98259832
checkAutoShow();
@@ -11149,44 +11156,44 @@ <h2 id="messagesFor">Messages</h2>\
1114911156
return parts.join('+');
1115011157
}
1115111158

11152-
function initHotkeys() {
11153-
const storage = (chrome && chrome.storage && chrome.storage.sync) ? chrome.storage.sync : null;
11154-
if (!storage) {
11155-
const hotkeys = DEFAULT_HOTKEYS;
11156-
document.addEventListener('keydown', (e) => {
11157-
// Don't trigger if typing in input/textarea/select
11158-
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName)) return;
11159-
if (e.target.isContentEditable) return;
11160-
11161-
const combo = buildKeyCombo(e);
11162-
const action = hotkeys[combo];
11163-
if (action) {
11164-
e.preventDefault();
11165-
if (chrome && chrome.runtime && chrome.runtime.sendMessage) {
11166-
chrome.runtime.sendMessage({ cmd: action });
11167-
}
11168-
}
11169-
});
11170-
return;
11171-
}
11172-
storage.get(['hotkeys'], (result) => {
11173-
const hotkeys = result.hotkeys || DEFAULT_HOTKEYS;
11174-
11175-
document.addEventListener('keydown', (e) => {
11176-
// Don't trigger if typing in input/textarea/select
11177-
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName)) return;
11178-
if (e.target.isContentEditable) return;
11179-
11180-
const combo = buildKeyCombo(e);
11181-
const action = hotkeys[combo];
11182-
if (action) {
11183-
e.preventDefault();
11184-
chrome.runtime.sendMessage({ cmd: action });
11185-
}
11186-
});
11187-
});
11188-
}
11189-
11159+
function initHotkeys() {
11160+
const storage = (chrome && chrome.storage && chrome.storage.sync) ? chrome.storage.sync : null;
11161+
if (!storage) {
11162+
const hotkeys = DEFAULT_HOTKEYS;
11163+
document.addEventListener('keydown', (e) => {
11164+
// Don't trigger if typing in input/textarea/select
11165+
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName)) return;
11166+
if (e.target.isContentEditable) return;
11167+
11168+
const combo = buildKeyCombo(e);
11169+
const action = hotkeys[combo];
11170+
if (action) {
11171+
e.preventDefault();
11172+
if (chrome && chrome.runtime && chrome.runtime.sendMessage) {
11173+
chrome.runtime.sendMessage({ cmd: action });
11174+
}
11175+
}
11176+
});
11177+
return;
11178+
}
11179+
storage.get(['hotkeys'], (result) => {
11180+
const hotkeys = result.hotkeys || DEFAULT_HOTKEYS;
11181+
11182+
document.addEventListener('keydown', (e) => {
11183+
// Don't trigger if typing in input/textarea/select
11184+
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName)) return;
11185+
if (e.target.isContentEditable) return;
11186+
11187+
const combo = buildKeyCombo(e);
11188+
const action = hotkeys[combo];
11189+
if (action) {
11190+
e.preventDefault();
11191+
chrome.runtime.sendMessage({ cmd: action });
11192+
}
11193+
});
11194+
});
11195+
}
11196+
1119011197

1119111198
// Initialize hotkeys
1119211199
initHotkeys();

events.html

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,49 @@
393393
background-color: rgba(255, 255, 255, 0.06);
394394
font-size: 0.85em;
395395
line-height: 1.4;
396+
display: none;
397+
}
398+
399+
.meta-wrapper.expanded .meta-details {
400+
display: block;
401+
}
402+
403+
.meta-summary {
404+
margin-top: 8px;
405+
display: flex;
406+
align-items: center;
407+
gap: 8px;
408+
font-size: 0.85em;
409+
opacity: 0.85;
410+
}
411+
412+
.meta-summary-text {
413+
flex: 1;
414+
white-space: nowrap;
415+
overflow: hidden;
416+
text-overflow: ellipsis;
417+
}
418+
419+
.meta-toggle {
420+
background: rgba(255, 255, 255, 0.1);
421+
border: 1px solid rgba(255, 255, 255, 0.15);
422+
color: inherit;
423+
font-size: 0.75em;
424+
padding: 2px 8px;
425+
border-radius: 4px;
426+
cursor: pointer;
427+
white-space: nowrap;
428+
opacity: 0.7;
429+
transition: opacity 0.15s;
430+
}
431+
432+
.meta-toggle:hover {
433+
opacity: 1;
434+
}
435+
436+
body.light-mode .meta-toggle {
437+
background: rgba(0, 0, 0, 0.06);
438+
border-color: rgba(0, 0, 0, 0.12);
396439
}
397440

398441
body.light-mode .meta-details {
@@ -1207,11 +1250,57 @@ <h1 class="small">Events Dashboard</h1>
12071250
return sections;
12081251
}
12091252

1253+
function buildMetaSummary(sections) {
1254+
const parts = [];
1255+
for (let i = 0; i < sections.length; i++) {
1256+
const fields = sections[i].fields;
1257+
for (let j = 0; j < fields.length; j++) {
1258+
const f = fields[j];
1259+
if (f.badge) continue;
1260+
const label = f.label;
1261+
// Pick only the most useful fields for summary
1262+
if (/^(title|cost|user input|prompt|question|tenure|tier|level|amount|sender|coins|emotes)$/i.test(label)) {
1263+
parts.push(f.value);
1264+
}
1265+
}
1266+
if (parts.length >= 3) break;
1267+
}
1268+
return parts.join(' · ');
1269+
}
1270+
12101271
function createMetaDetailsNode(data) {
12111272
const sections = buildMetaSections(data);
12121273
if (!sections.length) {
12131274
return null;
12141275
}
1276+
1277+
const wrapper = document.createElement('div');
1278+
wrapper.className = 'meta-wrapper';
1279+
1280+
// Build summary line
1281+
const summaryText = buildMetaSummary(sections);
1282+
const summaryRow = document.createElement('div');
1283+
summaryRow.className = 'meta-summary';
1284+
1285+
if (summaryText) {
1286+
const summarySpan = document.createElement('span');
1287+
summarySpan.className = 'meta-summary-text';
1288+
summarySpan.textContent = summaryText;
1289+
summaryRow.appendChild(summarySpan);
1290+
}
1291+
1292+
const toggleBtn = document.createElement('button');
1293+
toggleBtn.className = 'meta-toggle';
1294+
toggleBtn.textContent = 'Details ▸';
1295+
toggleBtn.addEventListener('click', function(e) {
1296+
e.stopPropagation();
1297+
const isExpanded = wrapper.classList.toggle('expanded');
1298+
toggleBtn.textContent = isExpanded ? 'Details ▾' : 'Details ▸';
1299+
});
1300+
summaryRow.appendChild(toggleBtn);
1301+
wrapper.appendChild(summaryRow);
1302+
1303+
// Build full details (hidden by default)
12151304
const container = document.createElement('div');
12161305
container.className = 'meta-details';
12171306
for (let i = 0; i < sections.length; i++) {
@@ -1261,7 +1350,8 @@ <h1 class="small">Events Dashboard</h1>
12611350
sectionNode.appendChild(fieldsWrapper);
12621351
container.appendChild(sectionNode);
12631352
}
1264-
return container;
1353+
wrapper.appendChild(container);
1354+
return wrapper;
12651355
}
12661356

12671357
function buildEventDisplay(data) {

featured.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,8 @@
15531553

15541554
var timeoutDelay = 0;
15551555
if (urlParams.has("showtime")) {
1556-
timeoutDelay = parseInt(urlParams.get("showtime")) || 20000;
1556+
timeoutDelay = parseInt(urlParams.get("showtime"));
1557+
if (isNaN(timeoutDelay)) { timeoutDelay = 20000; }
15571558
}
15581559

15591560
var borderRadius = 0;

popup.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,6 +3495,13 @@ <h3 data-translate="background-shading">Background Shading for Messages</h3>
34953495
<span class="slider round"></span>
34963496
</label>
34973497
<span data-translate="trivial-shading-events">🤏🕶️ Allow background shading for trivial events </span>
3498+
</div>
3499+
<div>
3500+
<label class="switch">
3501+
<input type="checkbox" data-param1="nofirsttimehighlight" />
3502+
<span class="slider round"></span>
3503+
</label>
3504+
<span data-translate="no-background-shading-for-firsttimers">⭕🌿 No background shading for first-time chatters </span>
34983505
</div>
34993506
<div>
35003507
<label class="switch">

sampleoverlay.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
const chatContainer = document.getElementById('chat-container');
217217
const messageListWrapper = document.getElementById('message-list-wrapper');
218218
const MAX_MESSAGES = urlParams.has("limit") ? parseInt(urlParams.get("limit")) : 20; // Adjust as needed
219+
const showtime = urlParams.has("showtime") ? parseInt(urlParams.get("showtime")) : 30000;
219220
const topSpacer = document.getElementById('spacer');
220221

221222
// In reverse mode, hide the spacer and position container at top
@@ -321,8 +322,7 @@
321322
if (timestamp) {
322323
const age = now - timestamp;
323324

324-
// After 30 seconds, start fading
325-
if (age > 30000 && !message.classList.contains('fading')) {
325+
if (showtime > 0 && age > showtime && !message.classList.contains('fading')) {
326326
message.classList.add('fading');
327327
}
328328
}

sources/locals.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,31 +145,25 @@ function toDataURL(url, callback) {
145145
}
146146

147147
var chatimg = '';
148-
try {
149-
chatimg = ele.querySelector(".pmessage__avaimg") || "";
150-
if (chatimg){
151-
chatimg = "https://cdn.locals.com/images/avatars/" + chatimg.style.cssText.split("https://cdn.locals.com/images/avatars/")[1] || "";
152-
chatimg = chatimg.split(".png")[0] + ".png";
153-
} else {
154-
chatimg = ele.querySelector(".ava-container img[src]") || "";
155-
if (chatimg){
156-
chatimg = chatimg.src;
157-
}
158-
}
159-
} catch (e){
160-
chatimg = "";
161-
}
162148

163149
if (!chatimg){
164150
try {
165151
var avatar = ele.querySelector(".chat-message-content-wrapper .w_28px img[src]") || ele.querySelector(".chat-message-content-wrapper img[alt='User'][src]") || ele.querySelector(".chat-message-content-wrapper img[class*='bdr_50%'][src]");
166152
if (!avatar){
167-
var fallbackAvatar = ele.querySelector(".chat-message-content-wrapper img[src]");
168-
if (fallbackAvatar && (!fallbackAvatar.closest || (!fallbackAvatar.closest(".wb_break-word") && !fallbackAvatar.closest(".message-photo")))){
169-
avatar = fallbackAvatar;
170-
}
171-
}
172-
if (avatar){
153+
try {
154+
var fallbackAvatar = ele.querySelector(".chat-message-content-wrapper img[src]");
155+
if (fallbackAvatar && (!fallbackAvatar.closest || (!fallbackAvatar.closest(".wb_break-word") && !fallbackAvatar.closest(".message-photo")))){
156+
avatar = fallbackAvatar;
157+
chatimg = avatar.src;
158+
}
159+
if (!chatimg){
160+
fallbackAvatar = ele.querySelector(".pmessage__avaimg[style]");
161+
if (fallbackAvatar){
162+
chatimg = fallbackAvatar.style.background.split("url(")[1].split('"')[1];
163+
}
164+
}
165+
} catch(e){}
166+
} else {
173167
chatimg = avatar.src;
174168
}
175169
} catch(e){

0 commit comments

Comments
 (0)