Free4talk keep chat

Makes the chat in the rooms not delete after refreshing

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Free4talk keep chat
// @version      1.0
// @description  Makes the chat in the rooms not delete after refreshing
// @author       Azeez
// @match        https://www.free4talk.com/room/*
// @grant        none
// @license MIT
// @namespace https://greasyfork.org/users/1095860
// ==/UserScript==

(function() {
    'use strict';
    // Check if the keep-chat parameter is already present
    if (!window.location.search.includes('keep-chat=true')) {
        // Add the keep-chat parameter to the current URL
        var separator = window.location.href.includes('?') ? '&' : '?';
        var updatedURL = window.location.href + separator + 'keep-chat=true';
        // Update the URL
        window.history.replaceState({}, document.title, updatedURL);
    }
})();