BetterFark

I miss FarkAnalReverteresque and smiths

Από την 28/03/2016. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         BetterFark
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  I miss FarkAnalReverteresque and smiths
// @author       LesserEvil
// @match        http://*.fark.com
// @match        http://*.fark.com/*
// @match        http://fark.com/*
// @match        https://*.fark.com/*
// @match        https://*.fark.com
// @match        https://fark.com/*
// @grant        none
// ==/UserScript==

'use strict';

function scrollIntoView(eleID) {
   var e = document.getElementById(eleID);
   if (!!e && e.scrollIntoView) {
       e.scrollIntoView();
   }
}

function appendElementToBody(elem)
{
    document.getElementsByTagName('body')[0].appendChild(elem);
}
function injectStyles(rule) {
    var elem = document.createElement("DIV");
    elem.innerHTML = '<style>' + rule + '</style>';
    appendElementToBody(elem);
}

function doRemoveBubbles()
{
    var commentIcons = document.getElementsByClassName("icon_comment");
    var i, bubbleCount=0;
    for( i in commentIcons )
    {
        if ( typeof(commentIcons[i]) == "object" )
        {
            if ( commentIcons[i].className != null )
            {
                bubbleCount++;
                commentIcons[i].className = "better_comment";
            }
            
        }
    }
    console.log("scrubbing "+bubbleCount+" bubbles away");
}

function displayFarkNew()
{
    scrollIntoView("new");
}

function doBetterFark()
{
    console.log("Making Fark a better place for you and me");
    var newsContainer = document.querySelectorAll('div#newsContainer')[0];
    var mainContainer = document.querySelectorAll('div#container')[0];
    if ( newsContainer !== null )
    {
        newsContainer.style.width = '100%';
    }
    else
    {
        console.log("Unable to find div.newsContainer");
    }
    if ( mainContainer !== null )
    {
        mainContainer.style.width = '100%';
    }
    else
    {
        console.log("Unable to find div.container");
    }
    
    injectStyles('a.icon_comment { border-width: 0px; }');
    injectStyles('a.better_comment { font-size: 120%; }');
    doRemoveBubbles();
    doRemoveBubbles();
    doRemoveBubbles();
    doRemoveBubbles();
    setTimeout(displayFarkNew(),100);
    setTimeout(doRemoveBubbles(), 100);
    setTimeout(doRemoveBubbles(), 200);
    setTimeout(doRemoveBubbles(), 2000);
    setTimeout(doRemoveBubbles(), 3000);
    setTimeout(doRemoveBubbles(), 4000);

}

setTimeout(doBetterFark(),100);