Telesal lite

Makes telesal page black and shows only who wants to answer. Good to the podium. Use dolphin and tempermonkey add-on to make it work on android devices.

当前为 2015-02-16 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Telesal lite
// @description  Makes telesal page black and shows only who wants to answer. Good to the podium. Use dolphin and tempermonkey add-on to make it work on android devices.
// @namespace    http://theanykey.se
// @include      http://*.telesal.org/*
// @include      *.telesal.org/*
// @version      1.1
// ==/UserScript==

// Check for top menu and remove it
var p = document.getElementsByClassName('menu-bar pull-right');
var cstr = "container-fluid-header";
for (var i=p.length; --i>=0;) 
{
    var n = p[i];
    while(n.className.split(" ").indexOf(cstr)==-1) { // won't work in older browsers
        n = n.parentNode;
    }
    if (n)
    {
    	n.parentNode.removeChild(n);
    }
}

// Remove foot
var elmFoot = document.getElementById("FooterContainer");
if (elmFoot)
{
	elmFoot.parentNode.removeChild(elmFoot);
}

// Start timer for dostuff when page is loaded
InitTimerDone=false;
myTimer=window.setInterval(function () {removeStuffAfterLoad()}, 5000);

// Start comment timer
myCommentTimer=window.setInterval(function () {checkIfSomeoneWantToComment()}, 1000);

function GiveAllIds()
{
    var currentNode,
        ni = document.createNodeIterator(document.documentElement, NodeFilter.SHOW_ELEMENT);
    var mycounter=0;
    while(currentNode = ni.nextNode()) {
        mycounter+=1;
        if (currentNode.getAttribute("id")==null)
        {
            currentNode.setAttribute("id", currentNode.nodeName + mycounter);
        }
    }    
}

function removeMeetingNotStartedYetAlarm()
{
    // Check for first class with "alert alert-info ng-scope" that is the alert
    var AlertNotStartetYet = document.getElementsByClassName('alert alert-info ng-scope')[0];
    if (AlertNotStartetYet)
    {
        AlertNotStartetYet.parentNode.removeChild(AlertNotStartetYet);
    }
    else
    {
        //alert("alert window not found!");   
    }
}

function removeHistoryView()
{
    // Check for first tag with "bt-history" that is the history view
    var HistoryView = document.getElementsByTagName('bt-history')[0];
    if (HistoryView)
    {
        HistoryView.parentNode.removeChild(HistoryView);
    }
    else
    {
        //alert("history view not found!");   
    }
}

function removeH3s()
{
    // Check for first tag with "H3" that is the head texts
    var HistoryView = document.getElementsByTagName('H3')[0];
    if (HistoryView)
    {
        HistoryView.parentNode.removeChild(HistoryView);
    }
    else
    {
        //alert("H3 not found!");   
    }
}

function removeTextHeadForTableWhoIsListening()
{
    // Check for first tag with "thead" that is the head texts
    var TableHeadText = document.getElementsByTagName('thead')[0];
    if (TableHeadText)
    {
        TableHeadText.parentNode.removeChild(TableHeadText);
    }
    else
    {
        //alert("Listeners head text not found!");   
    }
}

function ChangeCenterTable()
{
    // Get ContentContainer and set new class
    var ContentContainerClass = document.getElementById('ContentContainer');
    if (ContentContainerClass)
    {
        ContentContainerClass.setAttribute("class","ng-scope");
    }
    else
    {
        //alert("Content Container not found!");   
    }
}

function ChangeErrorDialog()
{
    // Get ContentContainer and set new class
    var ErrorDialog = document.getElementById('error-dialog');
    if (ErrorDialog)
    {
        ErrorDialog.setAttribute("class","ng-scope");
    }
    else
    {
        //alert("Error dialog not found!");   
    }
}

function setLargeFontAndBlackColor()
{
    var HtmlBody = document.getElementsByTagName('body')[0];
    if (HtmlBody)
    {
        HtmlBody.setAttribute("style", "font-size:30px ! important; background-color:#000000 ! important; color:#ffffff ! important;");
    }
    else
    {
     	//alert("Cant find html body!");   
    }
}

function addGlobalStyle(css) 
{
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

function HidePhoneNumbers()
{
    addGlobalStyle('.participantNumber { font-size: 0px ! important; width:1px ! important; display: none ! important;}');
}

function HideAlerts()
{
    addGlobalStyle('.alert-danger { font-size: 0px ! important; width:1px ! important; display: none ! important;}');
    addGlobalStyle('.alert-info { font-size: 0px ! important; width:1px ! important; display: none ! important;}');
}

function HideCallersHistoryInfo()
{
    addGlobalStyle('.participantHistory { font-size: 0px ! important; width:1px ! important; display: none ! important;}');
}

function HideCallerEditButton()
{
    addGlobalStyle('.participantOptions { font-size: 0px ! important; width:1px ! important; display: none ! important;}');
}

function MakeMoreSpaceForSomeoneWantsToAnswerPopup()
{
    addGlobalStyle('#ContentContainer { padding: 60px 0px ! important; background-color: #000000 ! important;}');
}

function HideLine()
{
    addGlobalStyle('.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td { border-top: 0px #000000 ! important; background-color: #000000 ! important;}');
    addGlobalStyle('.table { border-color: #000000 ! important; background-color: #000000 ! important;}');
    // Bottom shadow line
    addGlobalStyle('.container-fluid-content { box-shadow: none ! important; }');
}

function MakeTableBlackAndWhite()
{
    addGlobalStyle('.table-striped>tbody>tr:nth-child(odd)>td { background-color: #000000 ! important;}');  
}

function SetAllBody()
{
    addGlobalStyle('.body { background-color: #000000 ! important;}');  
}

function SetBiggerButtonAndMoreSpace()
{
    addGlobalStyle('table, th, td {border-collapse: separate ! important;}'); // Space between callers setup
    addGlobalStyle('.table-condensed>thead>tr>th, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>tbody>tr>td, .table-condensed>tfoot>tr>td { padding: 0em 0em 5em ! important;}'); // Space between callers
    addGlobalStyle('.label { padding: .2em .6em 2em; ! important;}'); // Size of comment button
}

function removeStuffAfterLoad()
{
    removeMeetingNotStartedYetAlarm();
    removeHistoryView();
    removeH3s();
    removeTextHeadForTableWhoIsListening();
    ChangeCenterTable();
    ChangeErrorDialog();
    setLargeFontAndBlackColor();
    HidePhoneNumbers();
    HideAlerts();
    HideCallersHistoryInfo();
    HideCallerEditButton();
    MakeMoreSpaceForSomeoneWantsToAnswerPopup();
    HideLine();
    MakeTableBlackAndWhite();
    SetAllBody();
    SetBiggerButtonAndMoreSpace();
    //GiveAllIds();
    InitTimerDone=true; // allow comment timer to the his stuff
    window.clearInterval(myTimer); // Run only once
}

function setAllCallersInvisible()
{
    var p = document.getElementsByClassName('participantName');
    for (var i=p.length; --i>=0;)
    {
        // First node is td with name
        // Parent node is the whole row        
        var n = p[i].parentNode;
        if (n)
        {
            // Set invisible
            n.setAttribute("style","display: none");
        }
    }
}

function setAllWhoWantsToCommentVisible()
{
    var p = document.getElementsByTagName('a');
    var cstr = "participantName";
    for (var i=p.length; --i>=0;) 
    {
        var n = p[i];
        if (n)
        {
            while(n.className.split(" ").indexOf(cstr)==-1) { // won't work in older browsers
                n = n.parentNode;
            }
            // First node is td with name
            // Parent node is the whole row
            n = n.parentNode;
            if (n)
            {                
                // Set visible
                n.setAttribute("style","display: inline ! important;");
            }
        }
    }
}

function hideNoListenersMessage()
{
    var p = document.getElementsByTagName('td');
    for (var i=p.length; --i>=0;) 
    {
        var n = p[i];
        // Check if no particiants
        if (n.getAttribute("translate") != null)
        {
            // Check if no particiants
            if (n.getAttribute("translate").indexOf("NO_PARTICIPANTS"))
            {
                // Set invisible
                n.setAttribute("style","display: none");
            }
        }
    } 	   
}

function checkIfSomeoneWantToComment()
{
    if (InitTimerDone)
    {
        hideNoListenersMessage();
        setAllCallersInvisible();
        setAllWhoWantsToCommentVisible();
    }
}

//alert("All script loaded");