Fuck Seeyon OA

Block annoying features of seeyon A8+

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         Fuck Seeyon OA
// @namespace    http://tampermonkey.net/
// @version      2024-04-29
// @description  Block annoying features of seeyon A8+
// @author       You
// @match        */seeyon/*
// @icon         https://www.seeyon.com/favicon.ico
// @grant        none
// @license      WTFPL
// ==/UserScript==

(function() {
    'use strict';

    //Block the blinking A8+
    Object.defineProperty(document, 'title', {
        set: function(e){
            if(document.getElementsByTagName('title').length == 0){
                console.log('no title tag')
                const t = document.createElement('title')
                t.innerHTML = e;
                document.getElementsByTagName('html')[0].appendChild(t)
            }
            if (e == 'A8+') {
                return false
            }
            else {
                document.getElementsByTagName('title')[0].innerHTML = e
                return true
            }
        },
        get: function(e){
            return document.getElementsByTagName('title')[0].innerHTML
        }
    });

    //Use new tab, not popup window
    //Get original descriptor
    const openWindow = Object.getOwnPropertyDescriptor(window, 'open')
    //Intercept function
    if(openWindow){
        const openWindowFunc = openWindow.value;
        const blocker = function(...args){
            console.log('Args:', args)
            if(args[2]) args[2] = null;
            const res = openWindowFunc.apply(this, args)
            return res;
        }
        openWindow.value = blocker;
    }
    Object.defineProperty(window, 'open', openWindow);

})();