// UserScript
// @name Reload & autoscroll buttons at character.ai
// @namespace https://sleazyfork.org/en/users/927364-mozgovlom
// @match https://beta.character.ai/chat?char=*
// @grant none
// @version 1.0.1
// @author Mozgovlom
// @description Adds reload and scroll buttons and autoscroll switch to ease rolling for new messages.
// @icon https://characterai.io/static/logo512.png
// @require https://code.jquery.com/jquery-3.6.1.min.js
// /UserScript
'use strict';
// If enabled, will hide new feedback buttons
// Default: false
const hide_new_rating = false;
// If enabled, will show reply number inside blue "c.AI" label, but only after page reload
// Default: true
const numbering = true;
// If enabled, will always show ยซ and ยป buttons to scroll messages by 5
// Default: true
const quickscrll = true;
// If enabled, will add a row of buttons to hide AI generated images, blur interlocutors
// Default: true
const hide_img_sw = true;
// If enabled, will add a button to apply premade "themes"
// Default: true
const theme_chat_style_sw = false;
const DAY_background_image = "https://i.imgur.com/qzWTGAn.jpg"; //----------LIGHT mode; backgroung image url goes inside " " ----------
const NIGHT_background_image = "https://i.imgur.com/xnDnQHc.jpg"; //----------DARK mode; backgroung image url goes inside " " ----------
const DAY_user_bubble = "lightsteelblue"; //----------LIGHT mode; USER chat buble color goes inside " " ----------
const NIGHT_user_bubble = "#310062"; //----------DARK mode; USER chat buble color goes inside " " ----------
const DAY_char_bubble = "aquamarine"; //----------LIGHT mode; CHAR chat buble color goes inside " " ----------
const NIGHT_char_buble = "#560319"; //----------DARK mode; CHAR chat buble color goes inside " " ----------
// Timed MutationObserver
function waitForElement(querySelector, timeout) {
return new Promise((resolve, reject) => {
var timer = false;
if (document.querySelectorAll(querySelector).length) return resolve();
const observer = new MutationObserver(() => {
if (document.querySelectorAll(querySelector).length) {
observer.disconnect();
if (timer !== false) clearTimeout(timer);
return resolve();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
if (timeout) timer = setTimeout(() => {
observer.disconnect();
reject();
}, timeout);
});
};
// Arrow right and arrow left keypresses for "swiping"
function ARKeyDown() {
document.body.dispatchEvent(
new KeyboardEvent('keydown', {
bubbles: true,
key: 'ArrowRight',
})
);
console.log("Arrow right pressed");
};
function ALKeyDown() {
document.body.dispatchEvent(
new KeyboardEvent('keydown', {
bubbles: true,
key: 'ArrowLeft',
})
);
console.log("Arrow left pressed");
};
// Storing swtich status for page refreshing
let restart1 = sessionStorage.getItem("restart1");
console.log("Reload&Scroll status =", restart1);
let restart2 = sessionStorage.getItem("restart2");
console.log("AutoScroll switch status =", restart2);
let restart3 = sessionStorage.getItem("restart3");
console.log("Hide generated images switch status =", restart3);
let restartTheming1 = sessionStorage.getItem("restartTheming1");
console.log("Wallpaper switch status =", restartTheming1);
let restartTheming2 = sessionStorage.getItem("restartTheming2");
console.log("Chat backgroung color switch status =", restartTheming2);
let restartTheming4 = sessionStorage.getItem("restartTheming4");
console.log("Chat bubbles style 1 switch status =", restartTheming4);
let restartTheming5 = sessionStorage.getItem("restartTheming5");
console.log("Chat bubbles style 2 switch status =", restartTheming5);
// needed for setInterval autoscrollreload
var tid;
// Autoscrolling
function autoscrollreload() {
waitForElement("div[class='swiper-button-next']", 1000).then(function() {
console.log("swiper-button-next is loaded.. do stuff");
ARKeyDown();
}).catch(() => {
});
waitForElement('div[class="Toastify__toast Toastify__toast-theme--light Toastify__toast--default"]', 1000).then(function() {
console.log("Chat Error alert is loaded.. do stuff");
document.querySelector('div[class="Toastify__toast Toastify__toast-theme--light Toastify__toast--default"]>div>div>div>div[class="row"]>div[class="col"]>button[class="btn btn-primary"]').click();
}).catch(() => {
});
};
window.addEventListener('load', function () {
let styleRHTML = document.createElement('style');
styleRHTML.innerHTML = `
.refresh-btn {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
width: 9%;
position: absolute;
top: 2%;
right: 30%;
background-color: lightsteelblue;
color: black;
font-weight: bold;
text-align: center;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.refresh-btn:hover {
background:#789ac7;
}
.refresh-scrl-btn {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
width: 9%;
position: absolute;
top: 2%;
right: 48%;
background-color: lightsteelblue;
color: black;
font-weight: bold;
text-align: center;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.refresh-scrl-btn:hover {
background:#789ac7;
}
.scrl-btn {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
background-color: lightsteelblue;
width: 9%;
position: absolute;
top: 2%;
right: 39%;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.scrl-btn label span:hover {
background:#789ac7;
}
.scrl-btn label {
width:100%;
height:100%;
}
.scrl-btn label span {
text-align:center;
}
.scrl-btn label input {
visibility:hidden;
position: absolute;
left: -10;
width:0px;
height:0px;
}
.scrl-btn input:checked + span {
background-color:#911;
color:#fff;
}
.swiper-button-next-nexts-btn {
cursor: pointer;
user-select: none;
position: absolute;
top: 45%;
right: 0;
color: black;
font-weight: 700;
height: 30px;
z-index: 10;
justify-content: center;
align-items: center;
font-family: swiper-icons;
margin-top: -18px;
transform: scale(0.6, 1.5);
}
.swiper-button-next-nexts-btn:hover {
color: #3c85f6;
}
.swiper-button-next-nexts-btn::after {content: "next" "next";}
.swiper-button-prev-prevs-btn {
cursor: pointer;
user-select: none;
position: absolute;
top: 45%;
left: 0;
color: black;
font-weight: 700;
height: 30px;
z-index: 10;
justify-content: center;
align-items: center;
font-family: swiper-icons;
margin-top: -18px;
transform: scale(0.6, 1.5);
}
.swiper-button-prev-prevs-btn:hover {
color: #3c85f6;
}
.swiper-button-prev-prevs-btn::after {content: "prev" "prev";}
`
let styleHideRate = document.createElement('style');
styleHideRate.innerHTML = div[class="annotation-buttons-container col mb-3"]>div[class="d-flex align-items-center"]:nth-of-type(2) {display: none !important;}
if (hide_new_rating) {
document.body.appendChild(styleHideRate);
};
let styleHideImgButt = document.createElement('style');
styleHideImgButt.innerHTML = .hideImg-btn {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
width: 9%;
position: absolute;
top: 2%;
right: -20%;
background-color: lightsteelblue;
color: black;
font-weight: bold;
text-align: center;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.hideImg-btn:hover {
background:#789ac7;
}
.blur-btn {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
width: 9%;
position: absolute;
top: 2%;
right: 21%;
background-color: lightsteelblue;
color: black;
font-weight: bold;
text-align: center;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.blur-btn:hover {
background:#789ac7;
}
if (hide_img_sw) {
document.body.appendChild(styleHideImgButt);
};
let styleHideImg = document.createElement('style');
styleHideImg.classList.add("styleHideImg");
styleHideImg.innerHTML = div[class="msg char-msg"]>div>img {display: none !important;}
div[class="msg char-msg"]>div>div:nth-of-type(3)>div[class="annotation-buttons-container col mb-3"] {display: none !important;}
div[class="msg char-msg"]>div>div[class="d-flex"] {display: none !important;}
let styleBlur = document.createElement('style');
styleBlur.classList.add("styleBlur");
styleBlur.innerHTML = div[class=" sb-avatar sb-avatar--src"] {filter: blur(7px) !important;}
div[class=" sb-avatar__text"] {filter: blur(7px) !important;}
/* 1 following line is your name blurring*/
span[class="msg-author-name"] {filter: blur(5px) !important; text-decoration:line-through; text-decoration-color:black; text-decoration-style:wavy; text-decoration-thickness:5px;}
/* 2 following lines are char's name blurring*/
div[class="msg-row msg-row-light-bg"]>div>div>div[class="justify-content-start"]>span:not(span[class="msg-author-name"]) {filter: blur(5px) !important; text-decoration:line-through; text-decoration-color:black; text-decoration-style:wavy; text-decoration-thickness:5px;}
div[class*="swiper-slide"]>div>div>div[class="justify-content-start"]>span {color: rgba(0, 0, 0, 0.0) !important;}
/*div[class*="swiper-slide"]>div>div>div[class="justify-content-start"]>span { letter-spacing: -6px;}*/
document.body.appendChild(styleRHTML);
// Reload & autoscroll buttons
let buttonRHTML = document.createElement('div');
buttonRHTML.innerHTML = "F5";
buttonRHTML.onclick = function refreshPage(){
window.location.reload();
};
buttonRHTML.classList.add("refresh-btn");
document.body.appendChild(buttonRHTML);
let buttonRSHTML = document.createElement('div');
buttonRSHTML.innerHTML = "F5S";
buttonRSHTML.classList.add("refresh-scrl-btn");
document.body.appendChild(buttonRSHTML);
buttonRSHTML.addEventListener("click", () => {
sessionStorage.setItem("restart1", "true");
window.location.reload();
});
let buttonSCRLHTML = document.createElement('div');
let labelSCRLHTML = document.createElement('label');
let inputSCRLHTML = document.createElement('input');
let spanSCRLHTML = document.createElement('span');
inputSCRLHTML.type = "checkbox";
spanSCRLHTML.innerHTML = "A";
buttonSCRLHTML.classList.add("scrl-btn");
document.body.appendChild(buttonSCRLHTML);
buttonSCRLHTML.appendChild(labelSCRLHTML);
labelSCRLHTML.appendChild(inputSCRLHTML);
labelSCRLHTML.appendChild(spanSCRLHTML);
// console.log("Checkbox AutoScroll reporting in");
inputSCRLHTML.onclick = function checkem() {
if (inputSCRLHTML.checked) {
tid = setInterval(autoscrollreload, 1000);
console.log("Checkbox AutoScroll checked");
sessionStorage.setItem("restart2", "true");
} else {
clearInterval(tid);
sessionStorage.removeItem("restart2");
console.log("Checkbox AutoScroll unchecked");
};
};
// Quick scroll buttons
let buttonnextsHTML = document.createElement('div');
buttonnextsHTML.onclick = function (){
for (let step = 0; step < 5; step++) {
ARKeyDown();
};
};
buttonnextsHTML.classList.add("swiper-button-next-nexts-btn");
let buttonprevsHTML = document.createElement('div');
buttonprevsHTML.onclick = function (){
for (let step = 0; step < 5; step++) {
ALKeyDown();
};
};
buttonprevsHTML.classList.add("swiper-button-prev-prevs-btn");
// A row of buttons to hide AI generated images, blur interlocutors
let buttonBlur = document.createElement('div');
buttonBlur.innerHTML = "B";
buttonBlur.onclick = function (){
if (document.querySelectorAll('style[class="styleBlur"]').length) {
document.body.removeChild(styleBlur);
buttonBlur.innerHTML = "B";
} else {
document.body.appendChild(styleBlur);
buttonBlur.innerHTML = "UB";
}
};
buttonBlur.classList.add("blur-btn");
document.body.appendChild(buttonBlur);
let buttonhideImg = document.createElement('div');
buttonhideImg.innerHTML = "Hide ImageGen";
buttonhideImg.onclick = function (){
if (document.querySelectorAll('style[class="styleHideImg"]').length) {
document.body.removeChild(styleHideImg);
buttonhideImg.innerHTML = "Hide ImageGen";
sessionStorage.removeItem("restart3");
} else {
document.body.appendChild(styleHideImg);
buttonhideImg.innerHTML = "SHOW ImageGen";
sessionStorage.setItem("restart3", "true");
}
};
buttonhideImg.classList.add("hideImg-btn");
document.body.appendChild(buttonhideImg);
// Checks after page refresh
if (restart2) {
inputSCRLHTML.checked = true;
console.log("Checkbox AutoScroll remains checked");
waitForElement("div[class='msg-row msg-row-light-bg']", 30000).then(function() {
console.log("Chat is loaded.. do stuff");
for (let step = 0; step < 40; step++) {
ARKeyDown();
};
tid = setInterval(autoscrollreload, 1000);
}).catch(() => {
console.log("Chat did not load in 30 seconds");
});
};
if (restart1) {
waitForElement("div[class='msg-row msg-row-light-bg']", 30000).then(function() {
console.log("Chat is loaded.. do stuff");
for (let step = 0; step < 40; step++) {
ARKeyDown();
};
}).catch(() => {
console.log("Chat did not load in 30 seconds");
});
sessionStorage.removeItem("restart1");
};
if (restart3) {
buttonhideImg.innerHTML = "Im";
document.body.appendChild(styleHideImg);
console.log("Checkbox imageGEN remains checked");
};
function make_glow (arg1) {
let orig_num_css_light = 'margin-left: 5px; background-color: rgb(60, 133, 246); color: white; font-weight: 600; font-size: 12px;';
// 1 following line is glow color in case of Light mode
let glow_num_css_light = 'margin-left: 5px; background-color: green; color: white; font-weight: 600; font-size: 12px; box-shadow: green 0px 0px 30px 15px;';
let orig_num_css_dark = 'margin-left: 5px; background-color: rgb(60, 133, 246); color: white; font-weight: 600; font-size: 12px; --darkreader-inline-bgcolor:#1c4d99; --darkreader-inline-color:#e5e0d8;';
// 1 following line is glow color in case of Dark mode
let glow_num_css_dark = 'margin-left: 5px; background-color: green; color: white; font-weight: 600; font-size: 12px; --darkreader-inline-bgcolor:#146612; --darkreader-inline-color:#e5e0d8; box-shadow: green 0px 0px 30px 15px; --darkreader-inline-boxshadow:#146612 0px 0px 30px 15px;';
if (arg1.style.cssText == orig_num_css_light) {
arg1.style.cssText = glow_num_css_light;
} else if (arg1.style.cssText == glow_num_css_light) {
arg1.style.cssText = orig_num_css_light;
} else if (arg1.style.cssText == orig_num_css_dark) {
arg1.style.cssText = glow_num_css_dark;
} else if (arg1.style.cssText == glow_num_css_dark) {
arg1.style.cssText = orig_num_css_dark;
};
};
function glowie () {
var mes_glow = document.querySelectorAll('div[class="swiper-wrapper"]>div>div>div>div>span>div[class=" rounded py-0 px-1"]');
for (let i = 0; i < mes_glow.length; i++) {
if (mes_glow[i].getAttribute('mes_glow_listener') !== 'true') {
mes_glow[i].addEventListener('click', function() {
make_glow(mes_glow[i]);
});
mes_glow[i].setAttribute('mes_glow_listener', 'true');
}
}
};
function add_number () {
var mes_num = document.querySelectorAll('div[class="swiper-wrapper"]>div>div>div>div>span>div>div[class="d-flex flex-row"]>div[class="d-flex flex-column"]');
for (let i = 0; i < mes_num.length; i++) {
// console.log (mes_num[i].innerHTML);
mes_num[i].innerHTML = mes_num[i].innerHTML.replace(mes_num[i].innerHTML, 'c.AI | ' + (i + 1));
}
};
waitForElement("div[class='msg-row msg-row-light-bg']", 30000).then(function() {
console.log("Chat is loaded.. do stuff");
if (quickscrll) {
$('div[class="swiper swiper-initialized swiper-horizontal swiper-pointer-events swiper-autoheight message-slider"]').append(buttonnextsHTML);
$('div[class="swiper swiper-initialized swiper-horizontal swiper-pointer-events swiper-autoheight message-slider"]').append(buttonprevsHTML);
};
if (numbering) {
add_number ();
glowie ();
const mes_num_observer_row = new MutationObserver (
function () {
add_number ();
glowie ();
});
mes_num_observer_row.observe(document.querySelector('div[class="swiper-wrapper"]'), {childList: true});
const mes_num_observer_col = new MutationObserver (
function () {
mes_num_observer_row.observe(document.querySelector('div[class="swiper-wrapper"]'), {childList: true});
});
mes_num_observer_col.observe(document.querySelector('div[class="infinite-scroll-component "]'), {childList: true});
};
}).catch(() => {
console.log("Chat did not load in 30 seconds");
});
/*
//----------------------------------------Chat style theming script section begins here----------------------------------------
//
let styleThemeStyleButt = document.createElement('style');
styleThemeStyleButt.innerHTML=.Theming-btn-dropdown {
cursor: pointer;
user-select: none;
border: 3px solid gray;
padding: 4px;
width: 9%;
position: absolute;
bottom: 1%;
left: 18%;
background-color: lightsteelblue;
color: black;
font-weight: bold;
text-align: center;
z-index: 100;
margin: 0 0 0 4px;
border-radius: 0 0 0 0;
}
.Theming-dropdown-content {
display: none;
position: absolute;
background-color: lightsteelblue;
width: 100%;
z-index: 101;
}
.ThemingListItem {
color: black;
padding: 4px;
text-decoration: none;
display: block;
}
.ThemingListItem:hover {
background-color: #789ac7;
}
.Theming-btn-dropdown:hover .Theming-dropdown-content {
display: block;
bottom: 110%;
margin: 0 0 0px -4px;
border-radius: 0 0 0 0;
}
if (theme_chat_style_sw) {
document.body.appendChild(styleThemeStyleButt);
};
if (localStorage.getItem ("darkMode") === "true") {
var VAR_background_image = NIGHT_background_image;
var VAR_user_bubble = NIGHT_user_bubble;
var VAR_char_bubble = NIGHT_char_buble;
} else {
var VAR_background_image = DAY_background_image;
var VAR_user_bubble = DAY_user_bubble;
var VAR_char_bubble = DAY_char_bubble;
};
let styleCustomTheming1 = document.createElement('style');
styleCustomTheming1.classList.add("CustomTheme1");
styleCustomTheming1.innerHTML = 'body {background-image: url("' + VAR_background_image + '"); background-repeat: no-repeat; background-size: cover;}'
let styleCustomTheming2 = document.createElement('style');
styleCustomTheming2.classList.add("CustomTheme2");
styleCustomTheming2.innerHTML = 'div[class="row chatdisplay2"]{background-color: var(--bs-body-bg);} div[class="row chatfooterbg-normal"] {background-color: var(--bs-body-bg) !important;}'
let styleCustomThemingBub = document.createElement('style');
styleCustomThemingBub.classList.add("CustomThemeBubbleColor");
styleCustomThemingBub.innerHTML = 'div[class="row p-0 m-0"]:has(div[class="msg user-msg"]){background-color:' + VAR_user_bubble + ';} div[class="row p-0 m-0"]:has(div[class="msg char-msg"]){background-color: ' + VAR_char_bubble + ';}'
let styleCustomTheming4 = document.createElement('style');
styleCustomTheming4.classList.add("CustomTheme4");
styleCustomTheming4.innerHTML=//Chat bubble
div[class="row p-0 m-0"]:has(div[class="msg user-msg"]) {border-radius: 30px 30px 0px 30px; padding-top: 10px !important; padding-right: 10px !important; }
div[class="row p-0 m-0"]:has(div[class="msg char-msg"]) {border-radius: 0px 30px 30px 30px; padding-top: 10px !important; padding-left: 10px !important; }
div[class="row p-0 m-0"]:has(span[class="msg-author-name"]) {justify-content: end; }
div[class="col-10 p-2 pt-0"]:has(span[class="msg-author-name"]) { order: 0; }
div[class="col-10 p-2 pt-0"]:not(:has(span[class="msg-author-name"])) { order: 2; }
div[class="col-auto p-0"]{ order: 1; }
div[class="justify-content-start"]:has(span[class="msg-author-name"]) {text-align: right !important; }
span[class="msg-author-name"] {display: block !important;}
div>div[class="col"]:has(div[class="msg user-msg"]) {display: flex; justify-content: end; }
div[class="msg user-msg"] {text-align-last: right; text-align: right; padding-right: 0px; padding-bottom: 0px;}
div[class="msg user-msg"]>div>img {max-width: fit-content !important; margin-left: auto; margin-right: 0px;}
//Text paragraph spacing
div[class="msg user-msg"]>div>div>p {margin-block-end: 0.5em;}
div[class="msg char-msg"]>div>div>div>p {margin-block-end: 0.5em;}
//Color background -above- and below chat
div[class*="chatheaderbg-normal"] {background-color: rgba(0,0,0,0);}
div[class="row chatfooterbg-normal"] {background-color: rgba(0,0,0,0); box-shadow: none;}
div[class="chatbox text-muted d-flex justify-content-start align-items-center p-0 bg-white mx-3"] {width: 783px; margin-left: 0px !important;}
//Scrollbar background
::-webkit-scrollbar { width: auto; background: transparent; background-color: transparent;}
::-webkit-scrollbar-corner {background: transparent; background-color: transparent;}
::-webkit-scrollbar-thumb {color: transparent; background: transparent; border-radius: 10px;}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .3) !important; border-radius: 10px; border: 1px solid rgba(0, 0, 0, .3) !important;}
::-webkit-resizer {background: transparent;}
let styleCustomTheming5 = document.createElement('style');
styleCustomTheming5.classList.add("CustomTheme5");
styleCustomTheming5.innerHTML=//Chat bubble
div[class="row p-0 m-0"]:has(div[class="msg user-msg"]) {border: 3px solid black; border-color: black !important;}
div[class="row p-0 m-0"]:has(div[class="msg char-msg"]) {border: 3px solid black; border-color: black !important;}
//Avatars
div[class=" sb-avatar sb-avatar--src"] {height: 100px !important; width: 100px !important; border-radius: 0px !important;}
div[class=" sb-avatar sb-avatar--src"]>img {height: 100px !important; width: 100px !important; border-radius: 0px !important; border: 3px solid grey;}
div[class=" sb-avatar sb-avatar--text"] {height: 100px !important; width: 100px !important; border-radius: 0px !important;}
div[class=" sb-avatar sb-avatar--text"]>div[class=" sb-avatar__text"] {height: 100px !important; width: 100px !important; border-radius: 0px !important; border: 3px solid grey;}
div[class="msg-row msg-row-light-bg"]>div[class="row p-0 m-0"]>div[class="col-auto p-0"] {margin-top: auto !important; margin-bottom: auto !important;}
div[class*="swiper-slide"]>div[class="row p-0 m-0"]>div[class="col-auto p-0"] {margin-top: auto !important; margin-bottom: auto !important;}
div[class="col-auto p-0"] {padding-top: 1px !important; padding-bottom: 1px !important; padding-left: 1px !important;}
//Text paragraph spacing
div[class="msg user-msg"]>div>div>p {margin-block-end: 0.5em;}
div[class="msg char-msg"]>div>div>div>p {margin-block-end: 0.5em;}
div[class="msg user-msg"] {padding: 0px;}
div[class="msg char-msg"] {padding: 0px;}
//Text padding
div[class="msg char-msg"]>div>div>div {padding-right: 5px; padding-left: 5px;}
div[class="msg user-msg"]>div>div {padding-right: 5px; padding-left: 5px;}
//Text centering
div[class="col-10 p-2 pt-0"] {margin-top: auto !important; margin-bottom: auto !important; padding-top: 1px !important; padding-bottom: 1px !important;}
div[class="msg char-msg"]>div>div[class="markdown-wrapper"] {margin-top: auto !important; margin-bottom: auto !important;}
div[class="msg-row msg-row-light-bg"]>div[class="row p-0 m-0"]>div[class="col-10 p-2 pt-0"]>div[class="justify-content-start"] {display: none;}
div[class="msg user-msg"]>div[class="markdown-wrapper"]>div {margin-top: auto !important; margin-bottom: auto !important;}
//Images
div[class="msg user-msg"]>div>img {max-width: fit-content !important; margin-top: auto !important; margin-bottom: auto !important; margin-right: -46px; margin-left: auto;}
div[class="msg char-msg"]>div>img {margin-top: auto !important; margin-bottom: auto !important; margin-right: -36px; margin-left: auto;}
//Text and image arrangement inside regular messages
div[class="msg user-msg"]>div[class="markdown-wrapper"] {display: flex; flex-direction: row;}
div[class="msg-row msg-row-light-bg"]>div>div>div>div>div[class="msg char-msg"]>div {display: flex; flex-direction: row;}
//Text and image arrangement inside slider
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div {display: inline-grid; grid-template-columns: auto max-content;}
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div>div[class="markdown-wrapper markdown-wrapper-last-msg swiper-no-swiping"] {grid-area: 1 / 1 / span 1 / span 1; margin-top: auto !important; margin-bottom: auto !important;}
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div>div[class="markdown-wrapper markdown-wrapper-last-msg swiper-no-swiping"]>div {margin-top: auto !important; margin-bottom: auto !important;}
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div>div[class="annotation-buttons-container col mb-3"] {grid-area: 2 / 1 / span 1 / span 1; margin-bottom: 0px !important;}
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div>img {grid-area: 1 / 2 / span 1 / span 1;}
div[class*="swiper-slide"]>div>div>div>div>div[class="msg char-msg"]>div>div:nth-of-type(3) {grid-area: 2 / 2 / span 1 / span 1; margin-right: -17px;}
div[class="msg user-msg"] {width: 100%; }
div[class="msg user-msg"]>div[class="markdown-wrapper"] {width: 100%; }
div[class*="swiper-slide"]>div>div[class="col-10 p-2 pt-0"]>div[class="justify-content-start"] {width: 75%; margin-left: auto; }
//Color background -above- and below chat
//div[class*="chatheaderbg-normal"] {background-color: rgba(0,0,0,0);}
//div[class="row chatfooterbg-normal"] {background-color: rgba(0,0,0,0); box-shadow: none;}
div[class="chatbox text-muted d-flex justify-content-start align-items-center p-0 bg-white mx-3"] {border-radius: 0px; width: 783px; margin-left: 0px !important;}
//Scrollbar background
::-webkit-scrollbar {width: auto; background: transparent; background-color: transparent;}
::-webkit-scrollbar-corner {background: transparent; background-color: transparent;}
::-webkit-scrollbar-thumb {color: transparent; background: transparent; border-radius: 0px;}
::-webkit-scrollbar-thumb:hover {background: rgba(255, 255, 255, .3) !important; border-radius: 0px; border: 1px solid rgba(0, 0, 0, .3) !important;}
::-webkit-resizer {background: transparent;}
let frameDropMenuTheming = document.createElement('div');
frameDropMenuTheming.classList.add("Theming-btn-dropdown");
document.body.appendChild(frameDropMenuTheming);
let buttonDropMenuTheming = document.createElement('div');
buttonDropMenuTheming.innerHTML = "Chat style";
buttonDropMenuTheming.classList.add("Theming-btn");
frameDropMenuTheming.appendChild(buttonDropMenuTheming);
let menuDropdownTheming = document.createElement('div');
menuDropdownTheming.classList.add("Theming-dropdown-content");
frameDropMenuTheming.appendChild(menuDropdownTheming);
//----------------------------------------Wallpaper----------------------------------------
let mDropdownTheming1 = document.createElement('div');
mDropdownTheming1.innerHTML = "Set WP";
mDropdownTheming1.classList.add("ThemingListItem");
menuDropdownTheming.appendChild(mDropdownTheming1);
mDropdownTheming1.onclick = function (){
if (document.querySelectorAll('style[class="CustomTheme1"]').length) {
document.body.removeChild(styleCustomTheming1);
mDropdownTheming1.innerHTML = "Set WP";
sessionStorage.removeItem("restartTheming1");
} else {
document.body.appendChild(styleCustomTheming1);
mDropdownTheming1.innerHTML = "Remove WP";
sessionStorage.setItem("restartTheming1", "true");
}
};
if (restartTheming1) {
mDropdownTheming1.innerHTML = "Remove WP";
document.body.appendChild(styleCustomTheming1);
console.log("Checkbox Wallpaper remains checked");
};
//----------------------------------------Chat background color----------------------------------------
let mDropdownTheming2 = document.createElement('div');
mDropdownTheming2.innerHTML = "Set chat BG";
mDropdownTheming2.classList.add("ThemingListItem");
menuDropdownTheming.appendChild(mDropdownTheming2);
mDropdownTheming2.onclick = function (){
if (document.querySelectorAll('style[class="CustomTheme2"]').length) {
document.body.removeChild(styleCustomTheming2);
mDropdownTheming2.innerHTML = "Set chat BG";
sessionStorage.removeItem("restartTheming2");
} else {
document.body.appendChild(styleCustomTheming2);
mDropdownTheming2.innerHTML = "Remove chat BG";
sessionStorage.setItem("restartTheming2", "true");
}
};
if (restartTheming2) {
mDropdownTheming2.innerHTML = "Remove chat BG";
document.body.appendChild(styleCustomTheming2);
console.log("Checkbox Chat backgroung color remains checked");
};
//----------------------------------------Native Dark Mode----------------------------------------
let mDropdownTheming3 = document.createElement('div');
mDropdownTheming3.classList.add("ThemingListItem");
menuDropdownTheming.appendChild(mDropdownTheming3);
if (localStorage.getItem ("darkMode") === "true") {
mDropdownTheming3.innerHTML = "Light Mode";
} else {
mDropdownTheming3.innerHTML = "Dark Mode";
}
mDropdownTheming3.onclick = function (){
if (localStorage.getItem ("darkMode") === "true") {
localStorage.setItem ("darkMode", "false");
mDropdownTheming3.innerHTML = "Dark Mode ๐โ";
} else {
localStorage.setItem ("darkMode", "true");
mDropdownTheming3.innerHTML = "Light Mode ๐โ";
}
};
//----------------------------------------Chat bubbles style 1----------------------------------------
let mDropdownTheming4 = document.createElement('div');
mDropdownTheming4.innerHTML = "Set chat ๐ฌ 1";
mDropdownTheming4.classList.add("ThemingListItem");
menuDropdownTheming.appendChild(mDropdownTheming4);
mDropdownTheming4.onclick = function (){
if (document.querySelectorAll('style[class="CustomTheme5"]').length) {
document.body.removeChild(styleCustomTheming5);
document.body.removeChild(styleCustomThemingBub);
mDropdownTheming5.innerHTML = "Set chat ๐ฌ 2";
sessionStorage.removeItem("restartTheming5");
}
if (document.querySelectorAll('style[class="CustomTheme4"]').length) {
document.body.removeChild(styleCustomTheming4);
document.body.removeChild(styleCustomThemingBub);
mDropdownTheming4.innerHTML = "Set chat ๐ฌ 1";
sessionStorage.removeItem("restartTheming4");
} else {
document.body.appendChild(styleCustomTheming4);
document.body.appendChild(styleCustomThemingBub);
mDropdownTheming4.innerHTML = "Remove chat ๐ฌ 1";
sessionStorage.setItem("restartTheming4", "true");
}
};
if (restartTheming4) {
mDropdownTheming4.innerHTML = "Remove chat ๐ฌ 1";
document.body.appendChild(styleCustomTheming4);
document.body.appendChild(styleCustomThemingBub);
console.log("Checkbox Chat bubbles style 1 remains checked");
};
//----------------------------------------Chat bubbles style 2----------------------------------------
let mDropdownTheming5 = document.createElement('div');
mDropdownTheming5.innerHTML = "Set chat ๐ฌ 2";
mDropdownTheming5.classList.add("ThemingListItem");
menuDropdownTheming.appendChild(mDropdownTheming5);
mDropdownTheming5.onclick = function (){
if (document.querySelectorAll('style[class="CustomTheme4"]').length) {
document.body.removeChild(styleCustomTheming4);
document.body.removeChild(styleCustomThemingBub);
mDropdownTheming4.innerHTML = "Set chat ๐ฌ 1";
sessionStorage.removeItem("restartTheming4");
}
if (document.querySelectorAll('style[class="CustomTheme5"]').length) {
document.body.removeChild(styleCustomTheming5);
document.body.removeChild(styleCustomThemingBub);
mDropdownTheming5.innerHTML = "Set chat ๐ฌ 2";
sessionStorage.removeItem("restartTheming5");
} else {
document.body.appendChild(styleCustomTheming5);
document.body.appendChild(styleCustomThemingBub);
mDropdownTheming5.innerHTML = "Remove chat ๐ฌ 2";
sessionStorage.setItem("restartTheming5", "true");
}
};
if (restartTheming5) {
mDropdownTheming5.innerHTML = "Remove chat ๐ฌ 2";
document.body.appendChild(styleCustomTheming5);
document.body.appendChild(styleCustomThemingBub);
console.log("Checkbox Chat bubbles style 2 remains checked");
};
//
//----------------------------------------Chat style theming script section ends here----------------------------------------
//
*/
}, false);