iEMB+

Makes the new iEMB more tolerable

Verze ze dne 04. 11. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         iEMB+
// @namespace    http://yeoxingyee.ml/
// @version      0.2.4
// @description  Makes the new iEMB more tolerable
// @author       YXY
// @match        *://iemb.hci.edu.sg/*
// @grant        none
// ==/UserScript==

(function(){
    'use strict';
    var link = document.createElement("link");
    link.href = "https://dl.dropboxusercontent.com/s/yed55pppaod34jd/iemb%2B.css";
    link.type = "text/css";
    link.rel = "stylesheet";
    var script = document.createElement("script");
    script.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js";
    document.getElementsByTagName("head")[0].appendChild(link);
    document.getElementsByTagName("head")[0].appendChild(script);
})();


    window.onload=function(){
        console.log("iEMB+: Initialising...");
        var verbose = document.createElement("div");
        verbose.id = "verbose";
        document.getElementsByTagName("body")[0].appendChild(verbose);
        $("#verbose").css("background","#000");
        $("#verbose").css("opacity", "0.6");
        $("#verbose").css("color", "white");
        $("#verbose").css("position", "fixed");
        $("#verbose").css("top", "0");
        $("#verbose").css("pointer-events", "none");
        var x = $('.messageboard').length;
        $("#allMsg a em").text(x);
        var reader = '<button id="reader" onClick="autoread()"><a style="text-decoration: none; color: white !important; font-weight: normal;" href="#">Read All</a></button>';
        $(".unread_mess_bg").append(reader);
        var scriptinject = document.createElement("script");
        scriptinject.innerHTML = ["var i = 0;",
"var x = $('.messageboard').length;",
"function autoread(){",
"  document.getElementById('verbose').innerHTML += 'iEMB+: Running checks...<br />';",
"  document.getElementById('verbose').innerHTML += 'iEMB+: '+ x + ' messages remaining to read.<br />';",
"  $('#reader a').text('Reading all messages...');",
"  if (x=='0'){",
"    $('#reader a').text('All Messages are already Read!');",
"    setTimeout(function() { $('#reader a').text('Read All'); }, 2000);",
"    return;",
"  }",
"  var iframeread;",
"    iframeread = document.createElement('iframe');",
"    document.body.appendChild(iframeread);",
"    iframeread.height = '0';",
"    iframeread.src = $('a.messageboard')[i].href;",
"    x--;",
"    i++;",
"  checkread();",
"}",
"function checkread(){",
"  if (!x){",
"    document.getElementById('verbose').innerHTML += 'Done!<br />';",
"    $('#reader a').text('Done!');",
"    location.reload();",
"  }",
"else if(x) {",
"    document.getElementById('verbose').innerHTML += 'iEMB+: Not done yet! rerunning...<br />';",
"    autoread();",
"  }",
"}",

].join('\n');
        document.getElementsByTagName("head")[0].appendChild(scriptinject);
        var iframe = document.createElement("iframe");
        $('img[alt="Important"]').css("filter", "invert(0)");
        $('img[alt="Urgent"]').css("filter", "invert(0)");
        $('img[alt="Information"]').css("filter", "invert(0)");
        console.log("iEMB+: Initialisation complete! All systems green!");
    };