Script para ies

Script que agrega funcionalidades al tid

2017-10-09 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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

(function() {
    var tiempoInicial = new Date();
    try{
        var navbar = document.getElementsByClassName("ui-grid-b");
        navbar[0].id = "Hola";
        var a = document.getElementById("Hola");
        a.classList.remove("ui-grid-b");
    }catch (Exception){
        var navbar = document.getElementsByClassName("ui-grid-c");
        navbar[0].id = "Hola";
        var a = document.getElementById("Hola");
        a.removeChild(a.childNodes[3]);

    }


    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-icon-top");
    aChild.classList.add("ui-btn-up-a");
    
    aSpan1.classList.add("ui-btn-inner");
    aSpan2.classList.add("ui-btn-text");
    
    //aSpan2icon.classList.add("ui-icon");
    aSpan2icon.classList.add("ui-btn-text");
    aSpan2icon.innerText = "\n";
    
    //aSpan2icon.classList.add("ui-icon-star");
    //aSpan2icon.classList.add("ui-icon-shadow");
    //aSpan2icon.innerText = "\xa0";
    
    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";
        }
    }
})();