Script para ies

Script que agrega funcionalidades al tid

As of 2017-09-07. See the latest version.

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         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";
        }
    }
})();