Advertisement
MeKLiN2

jan3b4observerconsolidate

Jan 3rd, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.03 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Meklin Shutdownchat Script
  3. // @version 1
  4. // @description Modified Shutdownchat, unmatched scripts, brace to be thunderstruck
  5. // @author MeKLiN
  6. // @namespace https://greasyfork.org/en/scripts/483405-meklin-shutdownchat-script
  7. // @match https://www.shutdown.chat/rooms*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=shutdown.chat
  9. // @license MIT
  10. // @grant none
  11. // @exclude https://www.shutdown.chat/profiles*
  12. // @exclude https://www.shutdown.chat/manage*
  13. // @run-at document-start
  14. // @require https://cdnjs.cloudflare.com/ajax/libs/jshint/2.9.7/jshint.js
  15. // @require https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.5/es6-shim.min.js
  16. // @downloadURL https://update.greasyfork.org/scripts/483405/Meklin%20Shutdownchat%20Script.user.js
  17. // @updateURL https://update.greasyfork.org/scripts/483405/Meklin%20Shutdownchat%20Script.meta.js
  18. // ==/UserScript==
  19. // Declare global variables
  20. var blocked_uuids = JSON.parse(localStorage.getItem('blocked_uuids')) || [];
  21. var observer;
  22. var chatbox = document.querySelector('.chatbox');
  23. var customChatmsg;
  24. var customInputWindow;
  25. var customInputWindow2;
  26. var customInputWindow3;
  27. var customInputWindow4; // Declare only once
  28. var clonedGridboxTools;
  29. var ignoreListDiv = document.getElementById('your-ignore-list-div-id');
  30. // Function to initialize the script
  31. function initializeScript() {
  32. console.log("MSS 1.1 STARTED");
  33. debugger;
  34. // Call the function to create the toggle button
  35. createToggleButton();
  36. // Call the initial function to start handling new chat messages
  37. handleNewChatMessages();
  38. // Call the function to observe mutations in the chatbox
  39. observeChatboxMutations();
  40. // Call the function to create the ignore list button
  41. createButtons();
  42. // Call the function to create the save and load buttons
  43. createSaveLoadButtons();
  44. // Call the function to create the ignore button in the user menu
  45. createIgnoreButton();
  46. // Call the function to create the clear cache button
  47. createClearCacheButton();
  48. // Call the function to create the collapse button
  49. createCollapseButton();
  50. // Clone gridbox
  51. cloneGridbox();
  52. // Create the custom input window
  53. createCustomInputWindow();
  54. // Create additional custom input window
  55. createAdditionalCustomInputWindow();
  56. // Now, you should be able to access customInputWindow
  57. console.log(customInputWindow);
  58. // Call the function to ignore a user
  59. ignoreUser('example_uuid');
  60. // Call the cloneGridbox function when needed
  61. cloneGridbox();
  62. // Call the function to create Ignore List Button
  63. createIgnoreListButton();
  64. // Call the function to initialize the observer
  65. initializeObserver();
  66. // Create customInputWindow4
  67. customInputWindow4 = document.createElement("div");
  68. customInputWindow4.className = "your-custom-class";
  69. // Clone gridbox
  70. function cloneGridbox() {
  71. var gridboxTools = document.querySelector('.gridbox_tools');
  72. var clonedGridboxTools = gridboxTools.cloneNode(true);
  73. // Append the new button to the custom input window
  74. customInputWindow4.appendChild(clonedGridboxTools);
  75.  
  76. // ... other logic related to cloneGridbox ...
  77.  
  78. // Append the custom input window to the body
  79. document.body.appendChild(customInputWindow4);
  80. }
  81. }
  82. // Call the function to initialize the script
  83. initializeScript();
  84. // Function to initialize the observer
  85. function initializeObserver() {
  86. // Check if the .chatbox element is found
  87. if (chatbox) {
  88. // Initialize the observer if not already initialized
  89. if (!observer) {
  90. observer = new MutationObserver(function (mutations) {
  91. // Handle mutations
  92. console.log("Mutations:", mutations);
  93. // You can add your logic to handle mutations here
  94. });
  95. // Start observing the .chatbox element
  96. observer.observe(chatbox, { childList: true });
  97. }
  98. }
  99. }
  100. // Call the function to initialize the observer
  101. initializeObserver();
  102. console.log("MAIN OBSERVER INITIALIZED")
  103. function createToggleButton() {
  104. // Add a button to the body
  105. var toggleBackgroundButton = document.createElement("button");
  106. toggleBackgroundButton.textContent = "Toggle Background";
  107. document.body.appendChild(toggleBackgroundButton);
  108.  
  109. // Add an event listener to the button
  110. toggleBackgroundButton.addEventListener("click", function() {
  111. // Get the container element
  112. var container = document.querySelector("#container");
  113.  
  114. // Toggle the background style
  115. if (container.style.background === "") {
  116. // Set the background color when it's not set
  117. container.style.background = "#e0e0e0";
  118. } else {
  119. // Remove the background color when it's set
  120. container.style.background = "";
  121. }
  122. });
  123. }
  124. // Function to observe mutations in the chatbox
  125. function observeChatboxMutations() {
  126. var chatbox = document.querySelector('.chatbox')
  127. if (chatbox instanceof Node && !observer) {
  128. // Create a mutation observer to monitor changes in the chatbox
  129. observer = new MutationObserver(function (mutations) {
  130. mutations.forEach(function (mutation) {
  131. mutation.addedNodes.forEach(function (node) {
  132. if (node.nodeName === "P" && node.dataset.t === "c") {
  133. // Your logic for handling new chat messages goes here
  134. console.log("Processing Chatbox Now");
  135. }
  136. });
  137. });
  138. });
  139. // Start observing the chatbox
  140. observer.observe(chatbox, { childList: true });
  141. } else {
  142. console.error("Chatbox element not found or is not a valid Node. Cannot add event listener.");
  143. }
  144. }
  145. // Function to handle system messages
  146. function handleSystemMessage(systemNode) {
  147. // Move system messages to the bottom right in their own DIV
  148. var systemDiv = document.createElement("div");
  149. systemDiv.className = "system-message";
  150. systemDiv.style.position = "fixed";
  151. systemDiv.style.bottom = "10px";
  152. systemDiv.style.right = "10px";
  153. systemDiv.style.backgroundColor = "#f0f0f0";
  154. systemDiv.style.padding = "10px";
  155. systemDiv.appendChild(systemNode.cloneNode(true));
  156. document.body.appendChild(systemDiv);
  157. // Get the chatbox element after creating the button
  158. var chatbox = document.querySelector('.chatbox');
  159. // Check if the chatbox element is found
  160. if (chatbox) {
  161. // Initialize the observer if not already initialized
  162. if (!observer) {
  163. observer = new MutationObserver(function (mutations) {
  164. // Handle mutations
  165. console.log("Mutations:", mutations);
  166. // You can add your logic to handle mutations here
  167. });
  168. // Start observing the chatbox
  169. observer.observe(chatbox, { childList: true });
  170. }
  171. }
  172. }
  173. function createCollapseButton() {
  174. console.log("createCollapseButton function is called");
  175. var collapseButton = document.createElement("button");
  176. // Set the inner HTML with an SVG and additional text
  177. collapseButton.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
  178. <path fill="none" d="M0 0h24v24H0z"/>
  179. <path d="M8 4v5l-2.5-1.5L3 9V4l5-2zm8 0l5 2v5l-2.5-1.5L16 9V4zM3 11l3.5-1.5L8 11V9L3 7zm13 0l3.5-1.5L21 11V9l-5-2z"/>
  180. </svg>min`;
  181. // Adjust the font size of the text
  182. collapseButton.style.fontSize = "12px"; // Adjust the font size as needed
  183. collapseButton.style.position = "fixed";
  184. collapseButton.style.top = "90px";
  185. collapseButton.style.left = "10px";
  186. // Function to append the button to the body
  187. function appendButtonToBody() {
  188. document.body.appendChild(collapseButton);
  189. }
  190. // Check if the body is available
  191. if (document.body) {
  192. // Append the collapseButton to the body
  193. appendButtonToBody();
  194. } else {
  195. // If the body is not available, wait for DOMContentLoaded event
  196. document.addEventListener("DOMContentLoaded", appendButtonToBody);
  197. }
  198. collapseButton.addEventListener("click", function () {
  199. // Toggle visibility of the chatbox
  200. var chatbox = document.querySelector('.chatbox');
  201. chatbox.style.display = (chatbox.style.display === 'none' || chatbox.style.display === '') ? 'block' : 'none';
  202. });
  203. // Get the chatbox element after creating the button
  204. var chatbox = document.querySelector('.chatbox');
  205. // Check if the chatbox element is found
  206. if (chatbox) {
  207. // Initialize the observer if not already initialized
  208. if (!observer) {
  209. observer = new MutationObserver(function (mutations) {
  210. // Handle mutations
  211. console.log("Mutations:", mutations);
  212. // You can add your logic to handle mutations here
  213. });
  214. // Start observing the chatbox
  215. observer.observe(chatbox, { childList: true });
  216. }
  217. // Log the chatbox element to the console
  218. console.log("Chatbox element:", chatbox);
  219. }
  220. }
  221. function handleNewChatMessages() {
  222. // Get the chatbox element
  223. console.log("Attempting to get chatbox element");
  224. var chatbox = document.querySelector('.chatbox');
  225. // Check if the chatbox element is found
  226. if (!chatbox) {
  227. console.error("Chatbox element not found. Cannot add event listener.");
  228. return;
  229. }
  230. console.log("Chatbox element found. Proceeding with event listener setup.");
  231. // Use the existing observer if not already initialized
  232. if (!observer) {
  233. observer = new MutationObserver(function (mutations) {
  234. // Handle mutations
  235. mutations.forEach(function (mutation) {
  236. mutation.addedNodes.forEach(function (node) {
  237. handleChatMessage(node);
  238. console.log("Mutations:", mutations);
  239. // You can add your logic to handle mutations here
  240. });
  241. });
  242. });
  243. // Start observing the chatbox if observer is defined
  244. if (typeof observer !== 'undefined' && observer !== null) {
  245. observer.observe(chatbox, { childList: true });
  246. } else {
  247. console.error("Observer not defined. Cannot add event listener.");
  248. }
  249. }
  250. // Continue with handling new chat messages
  251. var chatboxElems = chatbox.getElementsByTagName('p');
  252. for (var i = 0; i < chatboxElems.length; i++) {
  253. var chatElem = chatboxElems[i];
  254. if (!chatElem.handled) {
  255. chatElem.handled = true;
  256. // Additional logic for handling specific types of messages
  257. // Remove text containing 'roll'
  258. if (chatElem.textContent.toLowerCase().includes('roll')) {
  259. chatElem.style.display = 'none'; // hide the message
  260. }
  261. // Alter messages of the type .fs_3
  262. if (chatElem.classList.contains('fs_3')) {
  263. chatElem.style.fontSize = '12px';
  264. chatElem.style.color = 'white';
  265. }
  266. // Check if the message is a system message
  267. var systemMessage = chatElem.classList.contains('system');
  268. if (systemMessage) {
  269. // Add a button to hide the system message
  270. addHideButtonToSystemMessage(chatElem);
  271. } else {
  272. // Check if the user is ignored
  273. var fcuserSpan = chatElem.querySelector('.nm.fcuser, .nm.fcmod, .user');
  274. var uuid = fcuserSpan ? fcuserSpan.dataset.uuid : null;
  275. console.log("fcuserSpan:", fcuserSpan); // Add this line to log fcuserSpan
  276. console.log("uuid:", uuid); // Add this line to log uuid
  277. if (uuid) {
  278. // Check if the user is ignored
  279. var isIgnored = blocked_uuids.includes(uuid);
  280. // Modify the appearance based on whether the user is ignored or not
  281. if (isIgnored) {
  282. chatElem.style.display = 'none'; // hide the message
  283. } else {
  284. // Add an "ignore" button to the user menu
  285. addIgnoreButtonToUserMenu(uuid);
  286. }
  287. }
  288. }
  289. }
  290. }
  291. }
  292. // Function to get the user UUID from the user list within FreeChat context
  293. function getUserUUIDFromUserList() {
  294. var userContainer = document.querySelector("#chat > div.fc > div.gridbox_list > div.userlist p.user.fcuser[data-uuid]");
  295. if (userContainer) {
  296. return userContainer.dataset.uuid;
  297. } else {
  298. // If user container is not found, set up a MutationObserver to wait for changes
  299. var observer = new MutationObserver(function (mutations) {
  300. userContainer = document.querySelector("#chat > div.fc > div.gridbox_list > div.userlist p.user.fcuser[data-uuid]");
  301. if (userContainer) {
  302. console.log("User container found after mutation.");
  303. console.log("User UUID: ", userContainer.dataset.uuid);
  304. // Stop observing once the user container is found
  305. observer.disconnect();
  306. }
  307. });
  308. // Start observing changes in the user list
  309. observer.observe(document.querySelector("#chat > div.fc > div.gridbox_list > div.userlist"), { childList: true, subtree: true });
  310. console.error("User container not found in the user list within FreeChat context. Waiting for mutations...");
  311. return null;
  312. }
  313. }
  314. // Wrap function calls inside DomContentLoaded event listener ensuring page load
  315. document.addEventListener('DOMContentLoaded', function () {
  316. // Function to be called after DOMContentLoaded
  317. function afterDOMContentLoaded() {
  318. console.log("dom loaded!")
  319. }
  320. // Use MutationObserver to detect when userlist and chatbox are added to the DOM
  321. var observer = new MutationObserver(function (mutations) {
  322. mutations.forEach(function (mutation) {
  323. mutation.addedNodes.forEach(function (node) {
  324. if (node.classList && (node.classList.contains('userlist') || node.classList.contains('chatbox'))) {
  325. // Userlist or chatbox added to the DOM, stop observing and call functions
  326. observer.disconnect();
  327. afterDOMContentLoaded();
  328. }
  329. });
  330. });
  331. });
  332. // Start observing the body for added nodes
  333. observer.observe(document.body, { childList: true, subtree: true });
  334. // Check if userlist and chatbox are already present
  335. var userlist = document.querySelector('.userlist');
  336. var chatbox = document.querySelector('.chatbox');
  337. if (userlist && chatbox) {
  338. // Function to create a button to view the ignore list
  339. function createIgnoreListButton() {
  340. console.log("createIgnoreListButton function is called");
  341. var ignoreListButton = document.createElement("button");
  342. ignoreListButton.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M20 18V8a6 6 0 0 0-12 0v10h12zM12 2C6.48 2 2 6.48 2 12v10h2V12a5.978 5.978 0 0 1 5.985-6H12V2zm8.293 2.293a1 1 0 0 1 1.414 0l1.414 1.414a1 1 0 0 1 0 1.414L19.414 10l3.707 3.707a1 1 0 0 1 0 1.414l-1.414 1.414a1 1 0 0 1-1.414 0L18 13.414l-3.707 3.707a1 1 0 0 1-1.414 0l-1.414-1.414a1 1 0 0 1 0-1.414L14.586 12 10.88 8.293a1 1 0 0 1 0-1.414L12.294 5.465a1 1 0 0 1 1.414 0z"/></svg>lst`;
  343. ignoreListButton.style.position = "fixed";
  344. ignoreListButton.style.top = "100px";
  345. ignoreListButton.style.left = "10px";
  346. ignoreListButton.addEventListener("click", function () {
  347. // Display the ignore list (you can customize this part)
  348. alert("Ignore List:\n" + blocked_uuids.join(", "));
  349. });
  350. document.body.appendChild(ignoreListButton);
  351. }
  352. createIgnoreListButton(); // Call the function to create the button
  353. } else {
  354. console.error("The userlist element is not found.");
  355. }
  356. // Proceed with querying for .fcuser elements
  357. var users = userlist.querySelectorAll(".fcuser");
  358. users.forEach(function (user) {
  359. // Your code for each user
  360. var uuid = user.dataset.uuid;
  361. // Create the block button
  362. var muteButton = document.createElement("button");
  363. muteButton.innerText = "Mute";
  364. muteButton.addEventListener("click", function() {
  365. muteUser(uuid);
  366. });
  367. // Create the ignore button with a unique class
  368. var ignoreButton = document.createElement("button");
  369. ignoreButton.innerText = "Ignore";
  370. ignoreButton.setAttribute("data-btntype", "ignore"); // Set a new attribute for identification
  371. ignoreButton.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M20 18V8a6 6 0 0 0-12 0v10h12zM12 2C6.48 2 2 6.48 2 12v10h2V12a5.978 5.978 0 0 1 5.985-6H12V2zm8.293 2.293a1 1 0 0 1 1.414 0l1.414 1.414a1 1 0 0 1 0 1.414L19.414 10l3.707 3.707a1 1 0 0 1 0 1.414l-1.414 1.414a1 1 0 0 1-1.414 0L18 13.414l-3.707 3.707a1 1 0 0 1-1.414 0l-1.414-1.414a1 1 0 0 1 0-1.414L14.586 12 10.88 8.293a1 1 0 0 1 0-1.414L12.294 5.465a1 1 0 0 1 1.414 0z"/></svg>`;
  372. ignoreButton.style.marginLeft = "5px";
  373. ignoreButton.style.cursor = "pointer";
  374. // Add a unique class to the ignore button
  375. ignoreButton.classList.add("ignoreButtonClass");
  376. ignoreButton.addEventListener("click", function () {
  377. // Dynamically fetch the user UUID when the "Ignore" button is clicked
  378. var clickedUserUUID = user.dataset.uuid;
  379. blockUser(clickedUserUUID);
  380. });
  381. // Create a container div for the buttons
  382. var buttonContainer = document.createElement("div");
  383. buttonContainer.style.display = "flex";
  384. buttonContainer.style.alignItems = "center";
  385. // Append the buttons to the container
  386. buttonContainer.appendChild(blockButton);
  387. buttonContainer.appendChild(ignoreButton);
  388. // Append the container to the user element
  389. user.parentElement.appendChild(buttonContainer);
  390. });
  391. });
  392. // Function to show a notification
  393. function showNotification(message) {
  394. var notification = document.createElement("div");
  395. notification.style.position = "fixed";
  396. notification.style.top = "10px";
  397. notification.style.left = "10px";
  398. notification.style.backgroundColor = "#000000";
  399. notification.style.padding = "10px";
  400. notification.style.border = "1px solid #ccc";
  401. notification.style.borderRadius = "5px";
  402. notification.style.fontSize = "12px";
  403. notification.style.color = "#C0FF00";
  404. notification.style.opacity = 1;
  405. notification.style.transition = "opacity 2s ease-in-out";
  406. notification.innerHTML = message;
  407. document.body.appendChild(notification);
  408. // Set a timeout to fade out the notification
  409. setTimeout(function () {
  410. notification.style.opacity = 0;
  411. }, 5000); // Adjust the timeout value as needed
  412. // Remove the notification from the DOM after fading out
  413. setTimeout(function () {
  414. document.body.removeChild(notification);
  415. }, 6000); // Adjust the timeout value to match the fade-out duration
  416. }
  417. // Function to create a button to clear the JSON local saved cache
  418. function createClearCacheButton() {
  419. console.log("createClearCacheButton function is called");
  420. var clearCacheButton = document.createElement("button");
  421. clearCacheButton.innerText = "clr";
  422. clearCacheButton.style.position = "fixed";
  423. clearCacheButton.style.top = "50px";
  424. clearCacheButton.style.left = "10px";
  425. clearCacheButton.addEventListener("click", function () {
  426. // Clear the JSON local saved cache
  427. localStorage.removeItem('blocked_uuids');
  428. showNotification("Cache cleared. Please refresh the page.");
  429. });
  430. // Check if the body is available
  431. if (document.body) {
  432. // Append the clearCacheButton to the body
  433. document.body.appendChild(clearCacheButton);
  434. } else {
  435. // If the body is not available, wait for DOMContentLoaded event
  436. document.addEventListener("DOMContentLoaded", function () {
  437. // Append the clearCacheButton to the body
  438. document.body.appendChild(clearCacheButton);
  439. });
  440. }
  441. }
  442. // Function to create a button to collapse the view
  443. function getNickname(fcuserSpan) {
  444. if (!fcuserSpan) return;
  445. // Check if fcuserSpan is a direct child of p
  446. var isDirectChild = fcuserSpan.parentNode.nodeName === "P";
  447. var nickname;
  448. if (isDirectChild) {
  449. nickname = fcuserSpan.innerText.replace(/[:\-]/g, '').trim();
  450. } else {
  451. // If not a direct child, assume it's under an anchor tag (a) in the user list
  452. nickname = fcuserSpan.parentNode.querySelector('.fcuser').innerText.replace(/[:\-]/g, '').trim();
  453. }
  454. return nickname;
  455. }
  456. // Function to handle the new chat messages
  457.  
  458. // Function to add a button to hide system messages
  459. function addHideButtonToSystemMessage(chatElem) {
  460. var hideButton = document.createElement('button');
  461. hideButton.textContent = 'Hide';
  462. hideButton.style.marginLeft = '5px';
  463. hideButton.addEventListener('click', function () {
  464. chatElem.style.display = 'none'; // hide the system message
  465. });
  466. // Append the button to the system message
  467. chatElem.appendChild(hideButton);
  468. }
  469. // Function to add an "ignore" button to the user menu
  470. function addIgnoreButtonToUserMenu(chatElem) {
  471. // Check if the user menu exists
  472. var userMenu = document.querySelector('.usermenu');
  473. if (userMenu && chatElem && chatElem.querySelector) {
  474. // Check if the user is already ignored
  475. var uuid = chatElem.querySelector('.nm.fcuser, .nm.fcmod')?.dataset.uuid;
  476. var isIgnored = blocked_uuids.includes(uuid);
  477. // Create a button for either ignoring or unignoring the user
  478. var ignoreButton = document.createElement('button');
  479. ignoreButton.textContent = isIgnored ? 'Unignore' : 'Ignore';
  480. // Add an event listener to handle ignoring/unignoring the user
  481. ignoreButton.addEventListener('click', function () {
  482. if (isIgnored) {
  483. // Unignore the user
  484. unignoreUser(uuid);
  485. } else {
  486. // Ignore the user
  487. ignoreUser(uuid);
  488. }
  489. });
  490. // Append the button to the user menu
  491. userMenu.appendChild(ignoreButton);
  492. } else {
  493. console.error("Invalid userMenu, chatElem, or querySelector is not supported. Conditions: userMenu=" + userMenu + ", chatElem=" + chatElem + ", chatElem.querySelector=" + (chatElem ? chatElem.querySelector : null));
  494. }
  495. }
  496. // Function to ignore a user
  497. function ignoreUser(uuid) {
  498. // Add your logic here to handle ignoring a user
  499. // For example, you can add the user's UUID to the blocked_uuids array
  500. blocked_uuids.push(uuid);
  501. // Save the updated blocked_uuids to localStorage
  502. localStorage.setItem('blocked_uuids', JSON.stringify(blocked_uuids));
  503. // You can also add additional logic as needed
  504. console.log("Ignoring user with UUID:", uuid);
  505. }
  506. // Function to unignore a user
  507. function unignoreUser(uuid) {
  508. blocked_uuids = blocked_uuids.filter(function (blockedUuid) {
  509. return blockedUuid !== uuid;
  510. });
  511. // Add additional logic as needed
  512. console.log("Unignoring user with UUID:", uuid);
  513. }
  514. // Function to get the user UUID from a chat message
  515. function getUserUUIDFromChatMessage(messageNode) {
  516. var uuidElement = messageNode.querySelector('.nm.fcuser, .nm.fcmod');
  517. if (uuidElement) {
  518. return uuidElement.dataset.uuid;
  519. } else {
  520. console.error("UUID element not found in the chat message:", messageNode);
  521. return null;
  522. }
  523. }
  524. // Function to handle different types of chat messages
  525. function handleChatMessage(node) {
  526. // Check if the node is a chat message
  527. if (node.nodeName === "P" && node.dataset.t === "c") {
  528. // Get the uuid of the user who sent the message
  529. var uuid = getUserUUIDFromChatMessage(node);
  530. if (uuid) {
  531. console.log("Found message with UUID:", uuid);
  532. // Check if the uuid is in the blocked list
  533. if (blocked_uuids.includes(uuid)) {
  534. console.log("Blocking message with UUID:", uuid);
  535. // Hide the message
  536. node.style.display = "none";
  537. } else {
  538. // Alter messages of the type .fs_3
  539. if (node.classList.contains('fs_3')) {
  540. node.style.fontSize = '12px';
  541. node.style.color = 'white';
  542. }
  543. // Add an "ignore" button to the user menu
  544. addIgnoreButtonToUserMenu(node);
  545. }
  546. }
  547. } else if (node.nodeName === "P" && node.querySelector(".sysmsg.fcsys")) {
  548. // Handle system messages
  549. handleSystemMessage(node);
  550. }
  551. }
  552. // Function to block/unblock a user
  553. function blockUser(uuid) {
  554. console.log("blockUser function is called");
  555. var index = blocked_uuids.indexOf(uuid);
  556. if (index !== -1) {
  557. // User is already blocked, so unblock
  558. blocked_uuids.splice(index, 1);
  559. showNotification("User unblocked!");
  560. } else {
  561. // User is not blocked, so block
  562. blocked_uuids.push(uuid);
  563. showNotification("User blocked!");
  564. }
  565. // Save the updated blocked_uuids to localStorage
  566. localStorage.setItem('blocked_uuids', JSON.stringify(blocked_uuids));
  567. }
  568. // usermenu block button event listener:
  569. document.querySelector('.usermenu button[data-btntype="block"]').addEventListener('click', function() {
  570. console.log("User menu block button clicked");
  571. // Get the parent element of the button, assuming it contains user-related data
  572. var userContainer = this.closest('.user-container');
  573. // Assuming the user UUID is stored in a data attribute called data-uuid
  574. var userUUID = userContainer ? userContainer.dataset.uuid : null;
  575. // Check if userUUID is not null before blocking
  576. if (userUUID) {
  577. // Now you have the user UUID, and you can proceed to block the user
  578. blockUser(userUUID);
  579. } else {
  580. console.error("User UUID not found. Unable to block user.");
  581. }
  582. });
  583. // Function to create an ignore button in the user menu
  584. function createIgnoreButton() {
  585. console.log("createIgnoreButton function is called");
  586. // Check if the ignore button is already created
  587. var ignoreButton = document.querySelector('.usermenu button[data-btntype="ignore"]');
  588. if (!ignoreButton) {
  589. ignoreButton = document.createElement("button");
  590. ignoreButton.innerText = "Ignore";
  591. ignoreButton.setAttribute("data-btntype", "ignore"); // Set a new attribute for identification
  592. ignoreButton.style.display = "block";
  593. ignoreButton.style.marginTop = "5px"; // Adjust the styling as needed
  594. // Insert the ignore button into the user menu
  595. var userMenu = document.querySelector('.usermenu');
  596. if (userMenu) {
  597. userMenu.insertBefore(ignoreButton, userMenu.firstChild);
  598. // Add click event directly to the button
  599. ignoreButton.addEventListener("click", function () {
  600. // Log to console to check if the button click is being registered
  601. console.log("Ignore button clicked");
  602. // Invoke the function to get the user UUID from the user list
  603. var userUUID = getUserUUIDFromUserList();
  604. // Check if the user UUID is found
  605. if (userUUID) {
  606. blockUser(userUUID);
  607. } else {
  608. console.error("User UUID not found. Ignoring user without blocking.");
  609. }
  610. });
  611. } else {
  612. console.error("User menu not found.");
  613. }
  614. }
  615. }
  616. // Function to get the user UUID from the chat log
  617. function getUserUUIDFromChatLog() {
  618. var chatLog = document.querySelector('.chatbox');
  619. if (chatLog) {
  620. // Find the first chat message in the log
  621. var firstChatMessage = chatLog.querySelector('p[data-t="c"]');
  622. if (firstChatMessage) {
  623. // Get the UUID from the first chat message
  624. var uuidElement = firstChatMessage.querySelector('.nm.fcuser, .nm.fcmod');
  625. if (uuidElement) {
  626. return uuidElement.dataset.uuid;
  627. } else {
  628. // Handle the case where UUID element is not found
  629. console.error("UUID element not found in the first chat message:", firstChatMessage);
  630. return null;
  631. }
  632. } else {
  633. // Handle the case where no chat messages are found
  634. console.error("No chat messages found in the chat log.");
  635. return null;
  636. }
  637. } else {
  638. // Handle the case where the chatbox element is not found
  639. console.error("Chatbox element not found.");
  640. return null;
  641. }
  642. }
  643. // Create the ignore list div once and append the content dynamically
  644. var ignoreListDiv = document.createElement("div");
  645. ignoreListDiv.style.position = "fixed";
  646. ignoreListDiv.style.top = "135px"; // Move to the top
  647. ignoreListDiv.style.left = "10px";
  648. ignoreListDiv.style.backgroundColor = "white"; // Adjust styling as needed
  649. ignoreListDiv.style.padding = "10px";
  650. ignoreListDiv.style.border = "1px solid black"; // Add border for visibility
  651. ignoreListDiv.style.fontSize = "12px"; // Set font size to 12px
  652. // Create a heading for the ignore list
  653. var ignoreListHeading = document.createElement("h3");
  654. ignoreListHeading.innerText = "Ignore List";
  655. ignoreListDiv.appendChild(ignoreListHeading);
  656. // Create a list to display ignored users
  657. var ignoreList = document.createElement("ul");
  658. ignoreList.style.listStyleType = "none"; // Remove default list styling
  659. ignoreListDiv.appendChild(ignoreList);
  660. // Append the ignore list div to the body
  661. document.body.appendChild(ignoreListDiv);
  662. // Function to create a list item with the ignore list entry and remove button
  663. function createIgnoreListItem(uuid, username) {
  664. var listItem = document.createElement("li");
  665. listItem.innerText = `${username} (${uuid})`;
  666. // Create a remove button for each entry
  667. var removeButton = document.createElement("button");
  668. removeButton.innerText = "Remove";
  669. removeButton.addEventListener("click", function () {
  670. // Remove the entry when the button is clicked
  671. removeIgnoreEntry(uuid);
  672. });
  673. // Append the remove button to the list item
  674. listItem.appendChild(removeButton);
  675. // Append the list item to the ignore list
  676. ignoreList.appendChild(listItem);
  677. }
  678. // Function to refresh the ignore list display
  679. function refreshIgnoreList() {
  680. // Clear the existing content
  681. ignoreList.innerHTML = "";
  682.  
  683. // Populate the ignore list with entries and remove buttons
  684. blocked_uuids.forEach(function (uuid) {
  685. createIgnoreListItem(uuid);
  686. });
  687. }
  688. // Populate the ignore list with entries and remove buttons
  689. blocked_uuids.forEach(function (uuid) {
  690. createIgnoreListItem(uuid);
  691. });
  692. // Function to handle removing an entry from the ignore list
  693. function removeIgnoreEntry(uuid) {
  694. var index = blocked_uuids.indexOf(uuid);
  695. if (index !== -1) {
  696. // Remove the entry from the ignore list
  697. blocked_uuids.splice(index, 1);
  698. // Refresh the ignore list display after removal
  699. refreshIgnoreList();
  700. }
  701. }
  702. // Function to save blocked_uuids to a text file
  703. function saveToTextFile() {
  704. var textToSave = blocked_uuids.join('\n');
  705. var blob = new Blob([textToSave], { type: 'text/plain' });
  706. var link = document.createElement('a');
  707. link.download = 'ignore_list.txt';
  708. link.href = window.URL.createObjectURL(blob);
  709. link.onclick = function () {
  710. document.body.removeChild(link);
  711. };
  712. link.style.display = 'none';
  713. document.body.appendChild(link);
  714. link.click();
  715. }
  716. // Function to load blocked_uuids from a text file
  717. function loadFromTextFile() {
  718. var input = document.createElement('input');
  719. input.type = 'file';
  720. input.accept = '.txt';
  721. input.onchange = function (event) {
  722. var file = event.target.files[0];
  723. if (file) {
  724. var reader = new FileReader();
  725. reader.onload = function (e) {
  726. // Parse the content of the file and update blocked_uuids
  727. blocked_uuids = e.target.result.split('\n').map(function (uuid) {
  728. return uuid.trim();
  729. });
  730. // Update the ignore list display
  731. refreshIgnoreList();
  732. };
  733. reader.readAsText(file);
  734. }
  735. };
  736. input.click();
  737. }
  738. // Function to create a button to save and load ignore list
  739. function createSaveLoadButtons() {
  740. var saveButton = document.createElement("button");
  741. saveButton.innerText = "Save to Text File";
  742. saveButton.addEventListener("click", function () {
  743. saveToTextFile();
  744. });
  745. var loadButton = document.createElement("button");
  746. loadButton.innerText = "Load from Text File";
  747. loadButton.addEventListener("click", function () {
  748. loadFromTextFile();
  749. });
  750. var buttonContainer = document.createElement("div");
  751. buttonContainer.style.marginTop = "10px";
  752. buttonContainer.appendChild(saveButton);
  753. buttonContainer.appendChild(loadButton);
  754.  
  755. // Append the button container to the ignore list div
  756. ignoreListDiv.appendChild(buttonContainer);
  757. }
  758. // Function to create buttons, including the collapse button
  759. function createButtons() {
  760. // Create a container for the buttons
  761. var buttonContainer = document.createElement("div");
  762. buttonContainer.style.position = "fixed";
  763. buttonContainer.style.top = "10px";
  764. buttonContainer.style.left = "10px";
  765. document.body.appendChild(buttonContainer);
  766. // Function to create a button
  767. function createButton(text, clickHandler) {
  768. var button = document.createElement("button");
  769. button.innerText = text;
  770. button.addEventListener("click", clickHandler);
  771. buttonContainer.appendChild(button);
  772. }
  773. // Create the collapse button
  774. createButton("Collapse", function () {
  775. var chatbox = document.querySelector('.chatbox');
  776. chatbox.style.display = (chatbox.style.display === 'none' || chatbox.style.display === '') ? 'block' : 'none';
  777. });
  778. // Create the clear cache button
  779. createButton("Clear Cache", function () {
  780. localStorage.removeItem('blocked_uuids');
  781. showNotification("Cache cleared. Please refresh the page.");
  782. });
  783. // Create the button to hide system messages
  784. createButton("Hide System", function () {
  785. // Get all system messages
  786. var systemMessages = document.querySelectorAll('.chatbox .system');
  787. // Toggle visibility of system messages
  788. systemMessages.forEach(function (systemMessage) {
  789. systemMessage.style.display = (systemMessage.style.display === 'none' || systemMessage.style.display === '') ? 'block' : 'none';
  790. });
  791. });
  792. }
  793. // Function to create and style the gridbox_tools clone input window
  794. function createCustomInputWindow() {
  795. // Create the custom input window
  796. var customInputWindow1 = document.createElement("div");
  797. customInputWindow.className = "gridbox_tools";
  798. customInputWindow.innerHTML = `
  799. <div class="tb">
  800. <!-- Add other elements here similar to the default menu -->
  801. <input type="text" autocomplete="off" class="chatmsg fs_1" style="color: rgb(221, 221, 221);" maxlength="500">
  802. <button class="sendbtn material-icons">Send</button>
  803. </div>
  804. `;
  805. // Append the custom input window to the body
  806. document.body.appendChild(customInputWindow);
  807. // Style the text input
  808. var customChatmsg = customInputWindow.querySelector(".chatmsg");
  809. customChatmsg.style.flex = "1";
  810. customChatmsg.style.padding = "5px";
  811. // Style the send button
  812. var customSendbtn = customInputWindow.querySelector(".sendbtn");
  813. customSendbtn.innerText = "msg"; // Customize the button text as needed
  814. // Add event listener for the send button
  815. customSendbtn.addEventListener("click", function () {
  816. handleCustomButtonClick(customChatmsg.value.trim());
  817. });
  818. }
  819. // Function to create and style additional custom input window
  820. function createAdditionalCustomInputWindow() {
  821. // Create the custom input window
  822. var customInputWindow2 = document.createElement("div");
  823. customInputWindow2.className = "command-input-window";
  824. customInputWindow2.innerHTML = `
  825. <input type="text" autocomplete="off" class="custom-chatmsg" placeholder="Type your command...">
  826. <button class="custom-sendbtn material-icons">Send</button>
  827. <button class="custom-sendbtn2">Send 2</button>
  828. `;
  829. // Style the custom input window
  830. customInputWindow2.style.position = "fixed";
  831. customInputWindow2.style.bottom = "10px";
  832. customInputWindow2.style.left = "10px";
  833. customInputWindow2.style.display = "flex";
  834. customInputWindow2.style.alignItems = "center";
  835. // Append the custom input window to the body
  836. document.body.appendChild(customInputWindow2);
  837. // Style the text input
  838. var customChatmsg = customInputWindow2.querySelector(".custom-chatmsg");
  839. customChatmsg.style.flex = "1";
  840. customChatmsg.style.padding = "5px";
  841. // Style the send buttons
  842. var customSendbtn = customInputWindow2.querySelector(".custom-sendbtn");
  843. customSendbtn.innerText = "cmd"; // Customize the button text as needed
  844. var customSendbtn2 = customInputWindow2.querySelector(".custom-sendbtn2");
  845. customSendbtn2.innerText = "msg"; // Customize the button text as needed
  846. var sendButtons = [customSendbtn, customSendbtn2];
  847. // Create a third button for saying hello
  848. var customSendbtn3 = document.createElement("button");
  849. customSendbtn3.innerText = "hi"; // Customize the button text as needed
  850. // Append the button to the custom input window
  851. customInputWindow2.appendChild(customSendbtn3);
  852. // Add an event listener for the "Send" button
  853. customSendbtn.addEventListener("click", function () {
  854. handleCustomButtonClick(customChatmsg.value.trim());
  855. });
  856. // Add a click event listener to the "Hello" button
  857. customSendbtn3.addEventListener("click", function () {
  858. // Your logic for handling the "Hello" button goes here
  859. var command = customChatmsg.value.trim();
  860. // Clear the input field after processing the command
  861. customChatmsg.value = "";
  862. // Simulate a click on the button
  863. customSendbtn3.click();
  864. });
  865. // Create the button element
  866. var customSendBtn = document.createElement("button");
  867. customSendBtn.className = "sendbtn"; // Add the desired class name
  868. customSendBtn.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24"><path d="M3 3h18v2H3V3zm0 4h12v2H3V7zm0 4h18v2H3v-2zm0 4h12v2H3v-2z"></path></svg>';
  869. // Replace the innerHTML with your SVG code or use an external SVG file
  870. // Append the button to the desired container (e.g., document.body)
  871. document.body.appendChild(customSendBtn);
  872. // Append the third button to the custom input window
  873. customInputWindow2.appendChild(customSendbtn3);
  874. // Style all send buttons
  875. sendButtons.forEach(function (btn) {
  876. btn.style.cursor = "pointer";
  877. btn.style.padding = "5px";
  878. // Add event listener for each button
  879. btn.addEventListener("click", function () {
  880. handleButtonClick(btn);
  881. console.log("handleButtonClick clicked!");
  882. });
  883. });
  884. // Append the new button to the custom input window
  885. customInputWindow2.appendChild(customSendbtn2);
  886. // Add an event listener for the new "Message" button
  887. customSendbtn2.addEventListener("click", function () {
  888. // Your logic for handling the command goes here
  889. var command = customChatmsg.value.trim();
  890. // Clear the input field after processing the command
  891. customChatmsg.value = "";
  892. });
  893. // Append the new button to the custom input window
  894. customInputWindow2.appendChild(customSendbtn2);
  895. // Function to handle default "Send" button click
  896. function handleDefaultSendButtonClick(btn, customChatmsg) {
  897. var command = customChatmsg.value.trim();
  898. // Your logic for handling the command with the default "Send" button goes here
  899. // Use btn to identify which button triggered the click event
  900. // Clear the input field after processing the command
  901. customChatmsg.value = "";
  902. }
  903. // Add an event listener for the original "Send" button
  904. var defaultSendBtn = customInputWindow.querySelector(".sendbtn");
  905. defaultSendBtn.addEventListener("click", function () {
  906. handleButtonClick(defaultSendBtn);
  907. });
  908. // Function to handle button clicks
  909. function handleButtonClick(btn, customChatmsg) {
  910. var command = customChatmsg.value.trim();
  911. // Your logic for handling the command goes here
  912. // Use btn to identify which button triggered the click event
  913. // Clear the input field after processing the command
  914. customChatmsg.value = "";
  915. }
  916. function handleCustomButtonClick(command) {
  917. // Your logic for handling the command goes here
  918. // This might involve calling the necessary functions from furtherchat.js
  919. // Ensure the logic aligns with the existing chat system
  920. // Clear the input field after processing the command
  921. customChatmsg.value = "";
  922. }
  923. // Function to create and style the combined input window
  924. function createCombinedInputWindow() {
  925. // Create the custom input window
  926. var customInputWindow3 = document.createElement("div");
  927. customInputWindow.className = "combined-input-window";
  928. // Append the custom input window to the body
  929. document.body.appendChild(customInputWindow);
  930. // <!-- Add other elements here similar to the default menu -->
  931. customInputWindow.innerHTML = `
  932. <div class="tb">
  933. <input type="text" autocomplete="off" class="chatmsg fs_1" style="color: rgb(221, 221, 221);" maxlength="500">
  934. <button class="sendbtn material-icons">Send</button>
  935. <button class="custom-sendbtn2">Send 2</button>
  936. </div>
  937. `;
  938. // Move the following code inside the createCombinedInputWindow function
  939. var additionalButtonsHTML = `
  940. <select class="sizesel">
  941. <option value="0">smaller</option>
  942. <option value="1">normal</option>
  943. <option value="2">bigger</option>
  944. <option value="3">more bigger</option>
  945. </select>
  946. <button style="display: inline-block;">YouTube Player</button>
  947. <div class="fccb">
  948. <input type="checkbox">
  949. <label><span class="material-icons"></span>Kageshi Mode</label>
  950. </div>
  951. <input type="text" autocomplete="off" class="chatmsg fs_1" maxlength="700" style="color: rgb(221, 221, 221);">
  952. <button class="sendbtn material-icons"></button>
  953. `;
  954. customInputWindow.querySelector('.tb').innerHTML += additionalButtonsHTML;
  955. // Event listener for your "Command" button
  956. var customSendbtn2 = customInputWindow.querySelector(".custom-sendbtn2");
  957. customSendbtn2.addEventListener("click", function () {
  958. // Call the backend function or method for "Send 2"
  959. // Adjust the logic as needed
  960. send2ButtonClick();
  961. });
  962. // Event listener for your additional buttons
  963. var additionalButtons = customInputWindow.querySelectorAll(".your-additional-buttons-class");
  964. additionalButtons.forEach(function (button) {
  965. button.addEventListener("click", function () {
  966. // Call the backend function or method associated with the clicked button
  967. // Adjust the logic as needed
  968. yourAdditionalButtonClick(button);
  969. });
  970. });
  971. // Additional styling or event listeners for the combined input window if needed
  972. }
  973. // Create the combined input window
  974. createCombinedInputWindow();
  975. // Function to handle the "Send 2" button click
  976. function send2ButtonClick() {
  977. // Your logic for handling "Send 2" goes here
  978. console.log("Send 2 button clicked!");
  979. }
  980. // Function to handle additional button clicks
  981. function yourAdditionalButtonClick(button) {
  982. // Determine which button was clicked based on its properties or class, and call the corresponding backend method
  983. if (button.classList.contains("your-specific-button-class")) {
  984. // Call the backend method for the specific button
  985. console.log("Your specific button clicked!");
  986. } else {
  987. // Handle other buttons if needed
  988. }
  989. }
  990. // Append the custom input window to the body
  991. document.body.appendChild(customInputWindow);
  992. // Style the text input
  993. var customChatmsg = customInputWindow.querySelector(".chatmsg");
  994. customChatmsg.style.flex = "1";
  995. customChatmsg.style.padding = "5px";
  996. // Style the send button
  997. var customSendbtn = customInputWindow.querySelector(".sendbtn");
  998. customSendbtn.innerText = "msg"; // Customize the button text as needed
  999. // Add event listener for the send button
  1000. customSendbtn.addEventListener("click", function () {
  1001. handleCustomButtonClick(customChatmsg.value.trim());
  1002. });
  1003. // Assuming you have a reference to your combined input window
  1004. var combinedInputWindow = document.querySelector(".combined-input-window");
  1005. // Event listener for your "Command" button
  1006. var customSendbtn2 = combinedInputWindow.querySelector(".custom-sendbtn2");
  1007. customSendbtn2.addEventListener("click", function () {
  1008. // Call the backend function or method for "Send 2"
  1009. // Adjust the logic as needed
  1010. send2ButtonClick();
  1011. });
  1012. // Event listener for your additional buttons
  1013. var additionalButtons = combinedInputWindow.querySelectorAll(".your-additional-buttons-class");
  1014. additionalButtons.forEach(function (button) {
  1015. button.addEventListener("click", function () {
  1016. // Call the backend function or method associated with the clicked button
  1017. // Adjust the logic as needed
  1018. yourAdditionalButtonClick(button);
  1019. });
  1020. });
  1021. }
  1022. // Declare customInputWindow4 at the beginning of your code
  1023. var customInputWindow4 = document.createElement("div");
  1024. customInputWindow4.className = "your-custom-class"; // Fix the typo here
  1025. // Clone gridbox
  1026. function cloneGridbox() {
  1027. var gridboxTools = document.querySelector('.gridbox_tools');
  1028. var clonedGridboxTools = gridboxTools.cloneNode(true);
  1029. // Append the new button to the custom input window
  1030. customInputWindow4.appendChild(clonedGridboxTools);
  1031. // Append the new button to the custom input window
  1032. var customSendbtn2 = customInputWindow4.querySelector(".custom-sendbtn2");
  1033. customSendbtn2.addEventListener("click", function () {
  1034. // Your logic for handling the "Send 2" command goes here
  1035. var command = customChatmsg.value.trim();
  1036. // Clear the input field after processing the command
  1037. customChatmsg.value = "";
  1038. });
  1039. // Additional styling or event listeners for the combined input window if needed
  1040. // Move this block inside the createCombinedInputWindow function
  1041. // Add additional buttons and elements from your HTML code
  1042. var additionalButtonsHTML = `
  1043. <select class="sizesel">
  1044. <option value="0">smaller</option>
  1045. <option value="1">normal</option>
  1046. <option value="2">bigger</option>
  1047. <option value="3">more bigger</option>
  1048. </select>
  1049. <button style="display: inline-block;">YouTube Player</button>
  1050. <div class="fccb">
  1051. <input type="checkbox">
  1052. <label><span class="material-icons"></span>Kageshi Mode</label>
  1053. </div>
  1054. <input type="text" autocomplete="off" class="chatmsg fs_1" maxlength="700" style="color: rgb(221, 221, 221);">
  1055. <button class="sendbtn material-icons"></button>
  1056. `;
  1057. clonedGridboxTools.querySelector('.tb').innerHTML += additionalButtonsHTML;
  1058. // Append the custom input window to the body
  1059. document.body.appendChild(customInputWindow4);
  1060. }
  1061. //fc_cam.prototype.setkmode = function(t) {
  1062. // this.kageshi_mode = t,
  1063. // null === this.video || null === this.user || this.you || this.paused || this.kageshi_mode && (this.pausecam(this.user),
  1064. // this.ws.sendpbuf(1200798, this.pb.roots.default.fc.p_1200798.encode({
  1065. // cn: this.camno
  1066. // }, null).finish()))
  1067. //}
  1068. function fc_coolbox(t, e, n, i, s, o, c) {
  1069. this.ws = t;
  1070. this.pb = e;
  1071. this.cb = s;
  1072. this.msglimit = o;
  1073. this.pmctrl = n;
  1074. this.layout = i;
  1075. this.yt_cb = c;
  1076. this.font_colour = "#FF0000";
  1077. this.font_size = 1;
  1078. this.elem = document.createElement("div");
  1079. this.elem.className = "tb";
  1080. // Create the color picker
  1081. this.text_cp = document.createElement("input");
  1082. this.text_cp.className = "jscolor";
  1083. this.text_cp.setAttribute("data-jscolor", "{position:'top',hash:false,value:'" + this.font_colour + "',borderRadius:'1px',borderColor:'" + this.ws.theme.lncol + "',controlBorderColor:'" + this.ws.theme.lncol + "',backgroundColor:'" + this.ws.theme.bgcol + "'}");
  1084. this.text_cp.onchange = this.cp_change.bind(this);
  1085. this.elem.appendChild(this.text_cp);
  1086. // Create the font size selector
  1087. this.sel_fs = document.createElement("select");
  1088. this.sel_fs.className = "sizesel";
  1089. this.sel_fs.onchange = this.fs_change.bind(this);
  1090. for (let i = 0; i < 4; i++) {
  1091. let option = document.createElement("option");
  1092. option.innerHTML = (i === 0) ? "smaller" : (i === 1) ? "normal" : (i === 2) ? "bigger" : "more bigger";
  1093. option.value = i;
  1094. this.sel_fs.appendChild(option);
  1095. }
  1096. this.sel_fs.selectedIndex = this.font_size;
  1097. this.elem.appendChild(this.sel_fs);
  1098. // Create the YouTube Player button
  1099. this.btn_ytpl = document.createElement("button");
  1100. this.btn_ytpl.innerHTML = "YouTube Player";
  1101. this.btn_ytpl.onclick = this.yt_click.bind(this);
  1102. this.btn_ytpl.style.display = "none";
  1103. this.elem.appendChild(this.btn_ytpl);
  1104. // Create the Kageshi Mode checkbox
  1105. //this.cb_kmode = new fc_checkbox(false, "Kageshi Mode");
  1106. //this.cb_kmode.addonclick(this.kmode_click.bind(this));
  1107. //this.elem.appendChild(this.cb_kmode.elem);
  1108. // Create the input for messages
  1109. this.text_msg = document.createElement("input");
  1110. this.text_msg.setAttribute("type", "text");
  1111. this.text_msg.setAttribute("autocomplete", "off");
  1112. this.text_msg.className = "chatmsg fs_" + this.font_size;
  1113. this.text_msg.style.color = this.font_colour;
  1114. this.text_msg.value = "";
  1115. this.text_msg.onkeyup = this.msg_keyup.bind(this);
  1116. this.text_msg.autocomplete = "off";
  1117. this.elem.appendChild(this.text_msg);
  1118. // Create the Send button
  1119. this.btn_send = document.createElement("button");
  1120. this.btn_send.className = "sendbtn material-icons";
  1121. this.btn_send.onclick = this.send_click.bind(this);
  1122. this.elem.appendChild(this.btn_send);
  1123. // Append additional buttons for Hello, Message, and Command
  1124. this.btn_hello = document.createElement("button");
  1125. this.btn_hello.innerHTML = "Hello";
  1126. this.btn_hello.onclick = this.hello_click.bind(this);
  1127. this.elem.appendChild(this.btn_hello);
  1128. this.btn_msg = document.createElement("button");
  1129. this.btn_msg.innerHTML = "Message";
  1130. this.btn_msg.onclick = this.msg_click.bind(this);
  1131. this.elem.appendChild(this.btn_msg);
  1132. this.btn_cmd = document.createElement("button");
  1133. this.btn_cmd.innerHTML = "Command";
  1134. this.btn_cmd.onclick = this.cmd_click.bind(this);
  1135. this.elem.appendChild(this.btn_cmd);
  1136. }
  1137.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement