varemenos
9/26/2014 - 4:24 PM

Change the default theme for all boards of fullchan

Change the default theme for all boards of fullchan

(function (theme) {
    var stylesheets = JSON.parse(localStorage.board_stylesheets);
    var keys = Object.keys(stylesheets);

    for (var i = 0; i < keys.length; i++) {
        stylesheets[keys[i]] = theme;
    };

    localStorage.board_stylesheets = JSON.stringify(stylesheets);

    if (!document.getElementById('stylesheet')) {
        var s = document.createElement('link');
        s.rel = 'stylesheet';
        s.type = 'text/css';
        s.id = 'stylesheet';
        var x = document.getElementsByTagName('head')[0];
        x.appendChild(s);
    }

    document.getElementById('stylesheet').href = styles[theme];

    $(window).trigger('stylesheet', theme);
})('Yotsuba B');