GOG.com - Updated Thread Count in Title

Display a count of updated threads in the GOG forum list page title and icon and reload once an hour so a pinned tab can be used as an update notifier

Stan na 02-10-2014. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        GOG.com - Updated Thread Count in Title
// @namespace   ssokolow.com
// @description Display a count of updated threads in the GOG forum list page title and icon and reload once an hour so a pinned tab can be used as an update notifier
// @contributionURL http://tinyurl.com/kfgayrh
// @match     *://www.gog.com/forum
// @require   http://cdnjs.cloudflare.com/ajax/libs/tinycon/0.5/tinycon.min.js

// @version     5
// @grant       none
// ==/UserScript==

// Set up hourly reload before anything that unexpected markup could break
setTimeout(function() { window.location.reload(true); }, 3600 * 1000);

// Initialize with values indicating a soft error
var bubble_bg = '#FF8000';
var unviewed_count = '!';

var category = $(".topics .text:contains('My favourite topics')");
if (category.length) { // If not some kind of "server overloaded" page...
    category = category.parents('h2').next('.category');

    // Use an empty list of favourite topics to detect being logged out
    if (category.find('.item:not(.message)').length) {
        bubble_bg = '#9CC824';
        unviewed_count = category.find('.item:not(.visited) .name a').length;
    } else {
        bubble_bg = '#ff0000';
        unviewed_count = 'X';
    }
}

Tinycon.setOptions({
    width: 7,
    height: 9,
    font: '10px arial',
    colour: '#ffffff',
    background: bubble_bg,
    fallback: false
});
Tinycon.setBubble(unviewed_count);
$('title').text($('title').text() + ' (' + unviewed_count + ')');