Show Quora upvotes

Shows previously hidden upvotes in a Quora feed

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Show Quora upvotes
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Shows previously hidden upvotes in a Quora feed
// @author       ncg
// @match        https://www.quora.com/
// @grant        none
// ==/UserScript==

const hiddenElementClass = 'hide_in_feed',
      hiddenElementSelector = `.${hiddenElementClass}`;
const feedSelector = '.paged_list_wrapper';
const upvoteButtonSelector = '.Upvote.Button';

function showUpvotesInAnswer(answerElement) {
    let hiddenElement;

    if (!(hiddenElement = answerElement.querySelector(hiddenElementSelector))) {
        return;
    }

    hiddenElement.classList.remove(hiddenElementClass);
}

const feed = document.querySelector(feedSelector);

const mutationObserver = new MutationObserver(function(mutations) {
    mutations.forEach(mutation => {
        mutation.addedNodes.forEach(element => {
            showUpvotesInAnswer(element);
        });
    });
});

mutationObserver.observe(feed, { childList: true });

// Show upvotes for first answers in feed

for (const upvoteButton of document.querySelectorAll(upvoteButtonSelector)) {
    showUpvotesInAnswer(upvoteButton);
}