0% found this document useful (0 votes)
41 views17 pages

AMQ Friend Highlight Script

This document defines a user script that customizes the coloring of different elements on the Anime Music Quiz website for yourself and friends. It loads color setting data from local storage or cookies and allows saving color preferences. It also creates a window to display a summary of player information with customizable coloring.

Uploaded by

patebolooucarbo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views17 pages

AMQ Friend Highlight Script

This document defines a user script that customizes the coloring of different elements on the Anime Music Quiz website for yourself and friends. It loads color setting data from local storage or cookies and allows saving color preferences. It also creates a window to display a summary of player information with customizable coloring.

Uploaded by

patebolooucarbo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// ==UserScript==

// @name AMQ Highlight Friends


// @namespace [Link]
// @version 0.27
// @description Apply color to name of yourself and friends. and more
// @author nyamu, ensorcell
// @match [Link]
// @grant none
// @require
[Link]
[Link]
// @require
[Link]
[Link]

// ==/UserScript==

if ([Link]('startPage')) {
return;
}

let colorSettingData = [
{
id:"smColorTable",
rows:
[
{
columns:[
{
width: 60,
label: ""
},
{
width: 60,
label: "Color"
},
{
width: 70,
label: "Shadow"
},
{
width: 70,
label: "Scorebox"
},
{
width: 50,
label: "Name"
},
{
width: 50,
label: "Score"
},
{
width: 50,
label: "Level"
},
{
width: 50,
label: "Chat"
},
{
width: 50,
label: "Spec&Lobby"
}
]
},
{
height:30,
columns:[
{
label: "Self"
},
{
id: "smColorSelfColor",
type: "color"
},
{
id: "smColorSelfShadow",
type: "color"
},
{
id: "smColorSelfScorebox",
type: "checkbox"
},
{
id: "smColorSelfName",
type: "checkbox"
},
{
id: "smColorSelfPoint",
type: "checkbox"
},
{
id: "smColorSelfLevel",
type: "checkbox"
},
{
id: "smColorSelfChat",
type: "checkbox"
},
{
id: "smColorSelfSpec",
type: "checkbox"
}
]
},
{
height:30,
columns:[
{
label: "Friend"
},
{
id: "smColorFriendColor",
type: "color"
},
{
id: "smColorFriendShadow",
type: "color"
},
{
id: "smColorFriendScorebox",
type: "checkbox"
},
{
id: "smColorFriendName",
type: "checkbox"
},
{
id: "smColorFriendPoint",
type: "checkbox"
},
{
id: "smColorFriendLevel",
type: "checkbox"
},
{
id: "smColorFriendChat",
type: "checkbox"
},
{
id: "smColorFriendSpec",
type: "checkbox"
}
]
}
]
},
{
id:"smSystemColorTable",
rows:
[
{
columns:
[
{
width: 90,
colspan: 2 ,
label: "Join"
},
{
width: 90,
colspan: 2 ,
label: "Spec"
},
{
width: 90,
colspan: 2 ,
label: "Leave"
}
]
},
{
height:30,
columns:
[
{
id: "smColorJoin",
type: "checkbox"
},
{
id: "smColorJoinColor",
type: "color"
},
{
id: "smColorSpec",
type: "checkbox"
},
{
id: "smColorSpecColor",
type: "color"
},
{
id: "smColorLeave",
type: "checkbox"
},
{
id: "smColorLeaveColor",
type: "color"
}
]
}
]
}
];

var saveData = {
"smColorSelfColor":"#80c7ff",
"smColorFriendColor":"#80ff80",
"smColorSelfShadow":"#228dff",
"smColorFriendShadow":"#40ff40",
"smColorJoinColor":"#8080ff",
"smColorSpecColor":"#ffff80",
"smColorLeaveColor":"#ff8080"
};

function saveSettings() {
[Link]("highlightFriendsSettings", [Link](saveData));
}

// load settings from local storage


function loadSettings() {
// load settings, if nothing is loaded, use default settings
let loadedSettings = [Link]("highlightFriendsSettings");
if (loadedSettings !== null) {
saveData = [Link](loadedSettings);
}
}
function getSaveData(key, defaultvalue) {
if(![Link](key)) return defaultvalue;
return saveData[key];
}
function setSaveData(key, value) {
saveData[key]=value;
saveSettings();
}
function setSavedSettingsIfCookieExists(sdkey, cookiekey) {
let cookievalue=[Link](cookiekey);
if(!cookievalue) return false;
saveData[sdkey]=cookievalue;
return true;
}

function cookies2SavedData() {
if(!setSavedSettingsIfCookieExists("smColorSelfColor","smColorSelfColor")) {
if(!
setSavedSettingsIfCookieExists("smColorSelfColor","smColorSelfName")) {
loadSettings();
return;
}
}
if(!
setSavedSettingsIfCookieExists("smColorFriendColor","smColorFriendColor")) {

setSavedSettingsIfCookieExists("smColorFriendColor","smColorFriendName");
}
setSavedSettingsIfCookieExists("smColorSelfShadow","smColorSelfShadow");
setSavedSettingsIfCookieExists("smColorFriendShadow","smColorFriendShadow");

setSavedSettingsIfCookieExists("smColorJoinColor","smColorJoinColor");
setSavedSettingsIfCookieExists("smColorSpecColor","smColorSpecColor");
setSavedSettingsIfCookieExists("smColorLeaveColor","smColorLeaveColor");

for(let table of colorSettingData) {


for (let row of [Link]) {
for (let column of [Link]) {
if([Link]==="checkbox") {
let value=[Link]([Link]);
if(value!==undefined) {
saveData[[Link]]=value==="true";
deleteCookie([Link]);
}
}
}
}
}

deleteCookie("smColorSelfColor");
deleteCookie("smColorSelfName");
deleteCookie("smColorFriendColor");
deleteCookie("smColorFriendName");
deleteCookie("smColorSelfShadow");
deleteCookie("smColorFriendShadow");
deleteCookie("smColorJoinColor");
deleteCookie("smColorSpecColor");
deleteCookie("smColorLeaveColor");

saveSettings();
}

function deleteCookie(key) {
[Link](key, "", { expires: 0 });
}
cookies2SavedData();

let playerSummaryWindow;
let playerSummaryWindowTable;
let playerSummaryWindowOpenButton;
function createPlayerSummaryWindow() {
playerSummaryWindow = new AMQWindow({
title: "Player Summary",
position: {
x: 0,
y: 34
},
width: 400,
height: 374,
minWidth: 400,
minHeight: 300,
zIndex: 1010,
resizable: true,
draggable: true
});

[Link]({
id: "playerSummaryWindowTableContainer",
width: 1.0,
height: "calc(100%)",
scrollable: {
x: false,
y: true
}
});

playerSummaryWindowTable = $(`<table id="playerSummaryWindowTable"


class="table floatingContainer"></table>`);
[Link][0].[Link](playerSummaryWindowTable);

clearTable();

playerSummaryWindowOpenButton = $(`<div id="qpPlayerSummaryButton"


class="clickAble qpOption"><i aria-hidden="true" class="fa fa-users
qpMenuItem"></i></div>`)
.click(function () {
if([Link]()) {
$(".rowSelected").removeClass("rowSelected");
[Link]();
}
else {
[Link]();
}
})
.popover({
placement: "bottom",
content: "Player Summary",
trigger: "hover"
});

let oldWidth = $("#qpOptionContainer").width();


$("#qpOptionContainer").width(oldWidth + 35);
$("#qpOptionContainer > div").append(playerSummaryWindowOpenButton);
}
function clearTable() {
[Link]().remove();

[Link]([Link]==="Ranked"?"Friend
Summary":"Player Summary");

let header = $(`<tr class="header"></tr>`)


let rankCol = $(`<td class="fstRank"><b>Rank</b></td>`);
let scoreCol = $(`<td class="fstScore"><b>Score<b></td>`);
let nameCol = $(`<td class="fstName"><b>Name</b></td>`);
let boxCol = $(`<td class="fstBox"><b>Box</b></td>`);
let answerCol = $(`<td class="fstAnswer"><b>Last Answer</b></td>`);

[Link](rankCol);
[Link](scoreCol);
[Link](nameCol);
[Link](boxCol);
[Link](answerCol);
[Link](header);
}

createPlayerSummaryWindow();

$([Link]).keydown(function (event) {
if ([Link] === 145) {
if ([Link]()) {
[Link]();
}
else {
[Link]();
}
}
});

let quizReadyListener = new Listener("quiz ready", (data) => {


clearTable();
});

function updatePlayerRow(player) {
let row=[Link]("#friendScore"+[Link]);
let isScoreLife=([Link]==="Battle Royale" || [Link]==="Last Man
Standing");

if([Link]==0) {
let playerrow=$(`<tr id="friendScore`+[Link]+`"
class="friendScore clickAble"></tr>`);
let rankCol = $(`<td class="fstRank">`+([Link]===undefined?
1:[Link])+`</td>`);
let scoreCol = $(`<td class="fstScore"></td>`);
if(isScoreLife) {
[Link]( ([Link]===undefined?
[Link]():[Link]) +
" ("+ ([Link]===undefined?
0:[Link]) +")");
}
else [Link]([Link]===undefined?0:[Link]);
let nameCol = $(`<td
class="fstName">`+[Link][[Link]]._name+`</td>`);
let boxCol = $(`<td class="fstBox">`+findBoxById([Link])
+`</td>`);
let answerCol = $(`<td
class="fstAnswer">`+[Link][[Link]].avatarSlot.
$[Link]()+`</td>`);
[Link](rankCol);
[Link](scoreCol);
[Link](nameCol);
[Link](boxCol);
[Link](answerCol);
[Link](function () {
SelectAvatarGroup($(this).find(".fstBox").text());
});
[Link](playerrow);

row=[Link]("#friendScore"+[Link])
[0];
}
else {
row=row[0];
if([Link]!==undefined) $
(row).find(".fstRank").text([Link]);

if([Link]!==undefined) $
(row).find(".fstScore").text([Link]);
if(isScoreLife) {
$(row).find(".fstScore").text( ([Link]===undefined?
[Link]():[Link]) +
" ("+ ([Link]===undefined?
0:[Link]) +")");
}
else $(row).find(".fstScore").text([Link]===undefined?
0:[Link]);

$(row).find(".fstBox").text(findBoxById([Link]));
$
(row).find(".fstAnswer").text([Link][[Link]].avatarSlot.
$[Link]());
}
if([Link]===undefined) {
$(row).removeClass("correctGuess");
$(row).removeClass("incorrectGuess");
}
else if([Link]===true) {
$(row).addClass("correctGuess");
$(row).removeClass("incorrectGuess");
}
else {
$(row).removeClass("correctGuess");
$(row).addClass("incorrectGuess");
}
}

function findBoxById(id) {
let object=[Link]._groupSlotMap;
return [Link](object).find(key => object[key].indexOf(id) !==-1);
}

function updateFriendTable(players) {
setTimeout(() => {
if([Link]!=="quiz") return;
[Link]((player) => {
if([Link][[Link]]) {
if([Link] !== "Ranked" ||
[Link]([Link][[Link]]._name) ||
[Link][[Link]]._name==selfName)
updatePlayerRow(player);
}
});
let rows=[Link](".friendScore");
$(rows).sort(function(a,b){
let _a=($(a).find(".fstBox").text()*10000)+($
(a).find(".fstRank").text()*1);
let _b=($(b).find(".fstBox").text()*10000)+($
(b).find(".fstRank").text()*1);
return (_a - _b);
}).appendTo(playerSummaryWindowTable);
},1);
}

new Listener("Spectate Game", (data) => {


if(![Link]) {
if([Link]) {
if([Link] === 'Battle Royale' &&
[Link] === quiz.QUIZ_STATES.BATTLE_ROYAL) return;
updateFriendTable([Link]);
}
}
}).bindListener();

function removeFriendFromTable(friendname) {
if(![Link]) return;
if([Link] !== "Ranked") return;
let id =
[Link]([Link]).find(key=>[Link][key]._name===friendname);
if(id!==undefined) {
let row=[Link]("#friendScore"+id);
if(row!==undefined)
[Link]();
}
}

new Listener("Game Starting", (data) => {


updateFriendTable([Link]([Link]));
}).bindListener();

new Listener("answer results", (data) => {


setTimeout(() => {
if([Link]) refreshColors();
updateFriendTable([Link]);
},1);
}).bindListener();

new Listener("player late join", (data) => {


setTimeout(() => {
refreshColors();
},1);
}).bindListener();
function SelectAvatarGroup(number) {
[Link] = number;
[Link](number);
if ([Link]([Link]).length > 1) {
[Link].
$[Link]().scrollTop([Link][number].topOff
set - 3);
}
}

$("#settingsGraphicContainer")
.append($("<div></div>")
.addClass("row")
.attr("style", "padding-top: 10px")
.append($("<div></div>")
.addClass("col-xs-12")
.attr("id", "smColorSettings")
.append($("<div></div>")
.attr("style", "text-align: center")
.append($("<label></label>")
.text("ColorSettings")
)
)
)
);

$("#smColorSettings")
.append($("<div></div>")
.attr("id", "smColorContainer")
.addClass("col-xs-12")
.addClass("checkboxContainer")
.addClass("text-center")
);
for(let table of colorSettingData) {
$("#smColorContainer")
.append($("<table></table>")
.attr("id", [Link])
);
for (let row of [Link]) {
let tr=$("<tr></tr>");
if([Link]("height"))
[Link]("height",[Link]);
for (let column of [Link]) {
let td=$("<td></td>");
if([Link]("width"))
[Link]("width",[Link]);
if([Link]("colspan"))
[Link]("colspan",[Link]);
if([Link]=="color") {
[Link]($("<input id='" + [Link] + "' type='color'>")
.val(saveData[[Link]])
);
[Link]('change',function() {
setTimeout(() => {
let color=$("#"+[Link]).val();
setSaveData([Link], color);
ColorChanged();
},1);
});
}
else if([Link]=="checkbox") {
let div=$('<div></div>');
[Link]("customCheckbox");
let checkbox=$('<input type="checkbox"
id="'+[Link]+'">');
[Link]("checked", getSaveData([Link], true));
[Link](function () {
setTimeout(() => {
let check=$("#"+[Link]).prop("checked");
setSaveData([Link], check);
ColorChanged();
},1);
});
[Link](checkbox);
[Link]($('<label for="'+[Link]+'"><i class="fa fa-
check" aria-hidden="true"></i></label>'));
[Link](div);
}
else {
if([Link]("label"))
[Link]([Link]);
}
[Link](td);
}
$("#"+[Link]).append(tr);
}
}

function ColorChanged() {
let selfcolor=$("#smColorSelfColor").val();
let selfshadow=$("#smColorSelfShadow").val();
let friendcolor=$("#smColorFriendColor").val();
let friendshadow=$("#smColorFriendShadow").val();

let selfscorebox=$("#smColorSelfScorebox").prop("checked");
$(".[Link]").css("color", selfscorebox?selfcolor:"");
$(".[Link]").css("text-shadow", selfscorebox?"0 0 10px
"+selfshadow:"");
$(".[Link]").css("color", $("#smColorSelfName").prop("checked")?
selfcolor:"");
$(".[Link]").css("color", $("#smColorSelfLevel").prop("checked")?
selfcolor:"");
$(".[Link]").css("color", $("#smColorSelfPoint").prop("checked")?
selfcolor:"");
$(".[Link]").css("color", $("#smColorSelfChat").prop("checked")?
selfcolor:"");
$(".[Link]").children("h3").css("color", $
("#smColorSelfSpec").prop("checked")?$("#smColorSelfColor").val():"");

let friendscorebox=$("#smColorFriendScorebox").prop("checked");
$(".[Link]").css("color", friendscorebox?friendcolor:"");
$(".[Link]").css("text-shadow", friendscorebox?"0 0 10px
"+friendshadow:"");
$(".[Link]").css("color", $
("#smColorFriendName").prop("checked")?friendcolor:"");
$(".[Link]").css("color", $
("#smColorFriendLevel").prop("checked")?friendcolor:"");
$(".[Link]").css("color", $
("#smColorFriendPoint").prop("checked")?friendcolor:"");
$(".[Link]").css("color", $("#smColorFriendChat").prop("checked")?
friendcolor:"");
$(".[Link]").children("h3").css("color", $
("#smColorFriendSpec").prop("checked")?$("#smColorFriendColor").val():"");

$(".csmJoin").css("color", $("#smColorJoin").prop("checked")?$
("#smColorJoinColor").val():"");
$(".csmSpec").css("color", $("#smColorSpec").prop("checked")?$
("#smColorSpecColor").val():"");
$(".csmLeft").css("color", $("#smColorLeave").prop("checked")?$
("#smColorLeaveColor").val():"");
}

[Link] = (function() {
var old=[Link];
return function() {
[Link](this,arguments);
onViewChanged();
}
})();

function onViewChanged() {
clearTable();
colorScorebox();
colorPlayers();
colorAvatar();
colorSpectators();
};

function colorScorebox() {
if(![Link]) return;
$(".[Link]").css("color", $
("#smColorSelfScorebox").prop("checked")?$("#smColorSelfColor").val():"")
.css("text-shadow", $("#smColorSelfScorebox").prop("checked")?"0 0 10px
"+$("#smColorSelfShadow").val():"");
$(".qpsPlayerName").each((index, elem) => {
if([Link]($(elem).text())) {
$(elem).addClass("friend").css("color", $
("#smColorFriendScorebox").prop("checked")?$("#smColorFriendColor").val():"")
.css("text-shadow", $
("#smColorFriendScorebox").prop("checked")?"0 0 10px "+$
("#smColorFriendShadow").val():"");
}
else if($(elem).text()!==selfName) {
$(elem).removeClass("friend").css("color", "").css("text-shadow",
"");
}
});
}

function colorAvatar() {
if(![Link]) return;
$(".qpAvatarName").each((index, elem) => {
if(isSelf($(elem).text())) {
$(elem).addClass("self")
.css("color", $("#smColorSelfName").prop("checked")?$
("#smColorSelfColor").val():"");
let parent=$(elem).parent();
[Link](".qpAvatarLevelBar > .qpAvatarLevel")
.addClass("self")
.css("color", $("#smColorSelfLevel").prop("checked")?$
("#smColorSelfColor").val():"");
[Link](".qpAvatarScoreContainer > .qpAvatarScore")
.addClass("self")
.css("color", $("#smColorSelfPoint").prop("checked")?$
("#smColorSelfColor").val():"");
}
else if(isFriend($(elem).text())) {
$(elem).addClass("friend")
.css("color", $("#smColorFriendName").prop("checked")?$
("#smColorFriendColor").val():"");
let parent=$(elem).parent();
[Link](".qpAvatarLevelBar > .qpAvatarLevel")
.addClass("friend")
.css("color", $("#smColorFriendLevel").prop("checked")?$
("#smColorFriendColor").val():"");
[Link](".qpAvatarScoreContainer > .qpAvatarScore")
.addClass("friend")
.css("color", $("#smColorFriendPoint").prop("checked")?$
("#smColorFriendColor").val():"");
}
else {
$(elem).removeClass("friend")
.css("color", "");
let parent=$(elem).parent();
[Link](".qpAvatarLevelBar > .qpAvatarLevel")
.removeClass("friend")
.css("color", "");
[Link](".qpAvatarScoreContainer > .qpAvatarScore")
.removeClass("friend")
.css("color", "");
}
});
}

new Listener("Game Chat Message", function (payload) {


updateChatMessage(payload);
}).bindListener();

new Listener("game chat update", function (payload) {


[Link](message => {
updateChatMessage(message);
});
}).bindListener();

function updateChatMessage(message) {
if([Link] === selfName) {
setTimeout(() => {
$(`#gcPlayerMessage-${[Link]}`).find(".gcUserName")
.addClass("self")
.css("color", $("#smColorSelfChat").prop("checked")?$
("#smColorSelfColor").val():"");
},0);
}
else if ([Link]([Link])) {
setTimeout(() => {
$(`#gcPlayerMessage-${[Link]}`).find(".gcUserName")
.addClass("friend")
.css("color", $("#smColorFriendChat").prop("checked")?$
("#smColorFriendColor").val():"");
},0);
}
}

new Listener("New Spectator", function (spectator) {


colorSpectators();
}).bindListener();

new Listener("Player Changed To Spectator", function (payload) {


colorSpectators();
}).bindListener();

function colorSpectators(){
if(![Link] && ![Link]) return;
setTimeout(() => {$(".gcSpectatorItem").children("h3").each((index,elem)=> {
if(isSelf($(elem).text())) {
$(elem).parent().addClass("self")
$(elem).css("color", $("#smColorSelfSpec").prop("checked")?$
("#smColorSelfColor").val():"");
}
else if(isFriend($(elem).text())) {
$(elem).parent().addClass("friend")
$(elem).css("color", $("#smColorFriendSpec").prop("checked")?$
("#smColorFriendColor").val():"");
}
else {
$(elem).parent().removeClass("friend")
$(elem).css("color","");
}
});},0);
}
function isSelf(username) {
var s=[Link]('(');
if(s>-1) {
username=[Link](0, s).trim();
}
return username===selfName;
}
function isFriend(username) {
var s=[Link]('(');
if(s>-1) {
username=[Link](0, s).trim();
}
return [Link](username);
}

new Listener("New Player", function(){


colorPlayers();
}).bindListener();

new Listener("Spectator Change To Player", function(){


colorPlayers();
}).bindListener();

function colorPlayers(){
if(![Link]) return;
setTimeout(() => {$
(".lobbyAvatarNameContainerInner").children("h2").each((index,elem)=> {
if(isSelf($(elem).text())) {
$(elem).parent().addClass("self")
$(elem).css("color", $("#smColorSelfSpec").prop("checked")?$
("#smColorSelfColor").val():"");
}
else if(isFriend($(elem).text())) {
$(elem).parent().addClass("friend")
$(elem).css("color", $("#smColorFriendSpec").prop("checked")?$
("#smColorFriendColor").val():"");
}
else {
$(elem).parent().removeClass("friend")
$(elem).css("color", "");
}
});},0);
}

[Link] = function (title, msg) {


let template=`
<li{2}>
<span>{0}</span><br>
<div class="gcMsgIndent">{1}</div>
</li>
`;
let typestr="";
if([Link]("started spec") || [Link]("to spec")) {
typestr=' class="csmSpec"';
}
else if([Link]("joined the") || [Link]("to player")) {
typestr=' class="csmJoin"';
}
else if([Link]("stopped spec") || [Link]("left the") ||
[Link]("kicked from")) {
typestr=' class="csmLeft"';
}
if (!msg) {
msg = "";
}
[Link](format(template, title, msg, typestr));

$(".csmJoin").css("color", $("#smColorJoin").prop("checked")?$
("#smColorJoinColor").val():"");
$(".csmSpec").css("color", $("#smColorSpec").prop("checked")?$
("#smColorSpecColor").val():"");
$(".csmLeft").css("color", $("#smColorLeave").prop("checked")?$
("#smColorLeaveColor").val():"");
};

new Listener("new friend", (friend) => {


setTimeout(() => {
refreshColors();
},0);
}).bindListener();
new Listener("friend removed", (target) => {
setTimeout(() => {
refreshColors();
removeFriendFromTable([Link]);
},0);
}).bindListener();

function refreshColors() {
colorScorebox();
colorPlayers();
colorAvatar();
colorSpectators();
}

AMQ_addScriptData({
name: "Highlight Friends",
author: "nyamu",
description: `
<p>Change color of yourself and friends' text in score box and avatar box
and chat.</p>
<p>It makes it easier to find your friends in room that many users joined
like ranked game.</p>
<p>You can adjust these colors and toggle on Settings > Graphics tab.</p>
<img src="[Link] />
<p>You can open/close Player Summary window by clicking this button.</p>
<img src="[Link] />
<p>It's almost like scorebox but shows some additional infomation. When you
clicked someone, it shows his/her box.</p>
<img src="[Link] />
<p>It shows your friends only in ranked game. It might be more useful in
ranked game than normal room.</p>
<img src="[Link] />
<p>Codes that applying colors to friend name on chat and lobby was provided
by ensorcell. thanks a lot.</p>
<p>Thanks a lot TheJoseph98 for providing window script and mentoring.</p>
`
});

AMQ_addStyle(`
#playerSummaryWindowTableContainer {
padding: 10px;
}
.friendScore {
height: 30px;
}
.friendScore > td {
vertical-align: middle;
border: 1px solid black;
text-align: center;
}
.fstRank {
min-width: 40px;
}
.fstScore {
min-width: 40px;
}
.fstName {
min-width: 80px;
}
.fstBox {
min-width: 40px;
}
.fstAnswer {
min-width: 80px;
}
.correctGuess {
background-color: rgba(0, 200, 0, 0.07);
}
.incorrectGuess {
background-color: rgba(255, 0, 0, 0.07);
}
#qpPlayerSummaryButton {
width: 30px;
height: 100%;
margin-right: 5px;
}
`);

Common questions

Powered by AI

The script implements several mechanisms for dynamic visual updates. Event listeners like 'Game Starting', 'New Player', and 'answer results' monitor game and player states, triggering functions such as 'colorPlayers' and 'colorSpectators'. These functions apply the user-defined CSS color settings in real-time, updating the appearance of player names, chat interactions, and other elements as the events occur. The 'ColorChanged' function ensures that any alteration in settings instantly reflects in the game interface, keeping the display consistent with the user's personalized preferences. This dynamic updating ensures a responsive and engaging gaming experience where visual cues remain up-to-date .

The Player Summary Window provides functionalities such as displaying a table of players and their associated data like rank, score, name, box, and last answer. It opens with a dedicated button that, when clicked, reveals the window's contents, formatted with headers for each data type. The window adjusts depending on the quiz game mode, showing either a 'Friend Summary' or 'Player Summary'. It is interactive and draggable, offering insights on players like their current position and their latest guess. Additionally, the Player Summary Window integrates closely with event listeners to update dynamically with player data .

The script enhances user experience by visually distinguishing friends from other players through color customization. It does this by allowing users to assign specific colors and effects to their own and their friends' names, chat messages, and avatar details, making them easier to identify in crowded game environments. This customization is user-controlled through settings found in the script interface, thereby increasing personalization. In addition, the script integrates functions to highlight friends who join, leave, or spectate games, further aiding in keeping track of social interactions. Overall, these features provide a social layer to the gaming experience, enhancing user engagement and keeping them connected with friends more effectively .

The Player Summary Window integrates with various script components to provide comprehensive visibility into game information. It interacts with event listeners to update player data dynamically, reflecting real-time changes in rankings, scores, and other details. When game modes shift, the window adjusts its header to reflect the current context (e.g., 'Friend Summary' vs. 'Player Summary'). It utilizes functions like 'updatePlayerRow' to insert or modify rows in the summary table, accommodating newly received data from listeners like 'answer results' and 'player late join'. This persistent interaction ensures that users always have access to updated, relevant information, presented in a clear, organized manner .

The AMQ Highlight Friends script manages color settings by maintaining a data structure 'saveData' that stores default or user-defined colors for various elements like 'smColorSelfColor', 'smColorFriendColor', etc. Users can apply these settings to game elements by accessing functionalities such as 'getSaveData' and 'setSaveData', which retrieve or update these settings respectively. These colors are applied to elements such as player names and chat messages through CSS styles, customizable via checkboxes and color inputs. Changes to settings are reflected using functions like 'ColorChanged', which updates the visual appearance when a change is made. The script uses local storage to retain settings across sessions .

The script employs CSS to style various game elements, applying user-defined color preferences to enhance visual differentiation. Specific elements affected include '.qpsPlayerName', '.qpAvatarName', and '.gcUserName', which receive styles based on friend or self status, determined dynamically through script functions and event listeners. Styles like text color and text-shadow are managed using CSS properties, applied conditionally via JavaScript functions like 'ColorChanged'. These styles enable a customized look for score boxes, chat messages, and avatar displays, improving user experience by making important elements stand out .

Custom checkboxes and color inputs provide the user interface for managing visual settings in the AMQ Highlight Friends script. These components allow users to enable or disable visual effects and select specific colors for customizing the appearance of themselves and friends within the game. For instance, checkboxes like 'smColorSelfScorebox' determine whether certain color settings are applied, while color inputs let users choose particular hues. The interaction with these elements is directly linked to functions like 'ColorChanged,' which updates the game interface based on the selected options, facilitating user-driven personalization .

The script determines if a player is a friend or the user themselves through functions like 'isSelf' and 'isFriend'. The 'isSelf' function compares usernames against the variable 'selfName', whereas 'isFriend' utilizes a 'socialTab.isFriend' check to verify player status. This identification process involves stripping additional text (e.g., parentheses) from usernames to ensure accurate matching. Identified friends and self are then classified with classes such as 'self' or 'friend', allowing specific styling rules to be applied through CSS, customizing how they appear in the chat and lobby .

The script uses cookies and local storage to ensure user settings persist between sessions. It first attempts to retrieve settings from cookies using functions like 'setSavedSettingsIfCookieExists'. If data is not found, it defaults to local storage via 'loadSettings' which loads the predefined 'saveData' structure. This technique ensures settings are consistently available, regardless of the user's session state. If cookies are present, their values take precedence, reflected by functions such as 'cookies2SavedData'. This dual mechanism of cookies and local storage prevents the loss of preferences, maintaining a seamless user experience through persistent settings management .

The script improves feature accessibility by offering tools that enhance visibility and interaction, crucial in a competitive ranked game setting. Options to colorize names, scores, and chat messages enable users to identify and focus on friends and self quickly amidst numerous players. The Player Summary Window enhances this by providing a concise overview of friend's performance in ranked games, giving users easy access to strategic insights. By allowing customization of these elements, the script not only tailors to individual preferences but also aids in reducing cognitive load, enabling users to maintain attention on gameplay without distractions .

You might also like