Script para ies

Script que agrega funcionalidades al tid

Versione datata 07/09/2017. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Script para ies
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Script que agrega funcionalidades al tid
// @author       SirFerra
// @match        http://tid.ies21.edu.ar/*
// @grant        none
// ==/UserScript==

(function() {
    var tiempoInicial = new Date();
    var navbar = document.getElementsByClassName("ui-grid-b");
    navbar[0].id = "Hola";
    var a = document.getElementById("Hola");
    a.classList.remove("ui-grid-b");
    a.classList.add("ui-grid-c");
    var liBtn = document.createElement("li");
    liBtn.id = "botonchito";
    liBtn.classList.add("ui-block-d");
    
    var aChild = document.createElement("a");
    var aSpan1 = document.createElement("span");
    var aSpan2 = document.createElement("span");
    var aSpan2icon = document.createElement("span");
    aChild.classList.add("ui-btn");
    aChild.classList.add("ui-btn-inline");

    aChild.classList.add("ui-btn-up-a");
    
    aSpan1.classList.add("ui-btn-inner");
    aSpan2.classList.add("ui-btn-text");
    

    aSpan2icon.classList.add("ui-btn-text");
    aSpan2icon.innerText = "\n";
    

    aChild.id = "achild";
    aChild.href= "javascript:void(0)";
    aChild.onclick= function(){
        tiempoInicial = new Date();
       return false;
        };
    
    aSpan1.appendChild(aSpan2icon);
    aSpan1.appendChild(aSpan2);
    aChild.appendChild(aSpan1);
    liBtn.appendChild(aChild);
    a.appendChild(liBtn);
    
    // Calcular tiempo de lectura
    var todosLosP = document.getElementsByTagName("p");
    var texto = "";
    for(i = 0;i<todosLosP.length;i++){texto += (todosLosP[i].innerText);}
    primerBlanco = /^ /;
    ultimoBlanco = / $/;
    variosBlancos = /[ ]+/g;
    texto = texto.replace (variosBlancos," ");
    texto = texto.replace(primerBlanco,"");
    texto = texto.replace(ultimoBlanco,"");
    textoTroceado = texto.split(" ");
    
    numeroPalabras = textoTroceado.length;
    
    console.log("Palabras contadas: " + numeroPalabras);
    console.log("El tiempo estimado de lectura, se basa en unas 150 o 100 palabras por minuto");
    console.log("Tiempo inicial: " + tiempoInicial);
    aSpan2.innerText = Math.round(numeroPalabras / 170) + " - "+ Math.round(numeroPalabras/130) + " min aprox\n";
    var b = false;
    var time = setInterval(myTimer, 1000);
    

    function myTimer() {
        if(b){b=false;}else{b=true;}
        var c = new Date();
        var segundos = (c.getTime() - tiempoInicial.getTime()) /1000;
        var min = Math.floor(segundos / 60);
        segundos = Math.round(segundos % 60);
        if(b){
           aSpan2icon.innerText = min + ":" + segundos+ "\n";
        }else{
            aSpan2icon.innerText = min + " " + segundos + "\n";
        }
    }
})();