Reddit width fixer

Tries to set reddit posts to not be quite so wide so they don't interfere with other elements on the page (useful for RES)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension 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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Reddit width fixer
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Tries to set reddit posts to not be quite so wide so they don't interfere with other elements on the page (useful for RES)
// @author       You
// @match        https://www.reddit.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // https://stackoverflow.com/questions/707565/how-do-you-add-css-with-javascript/14898381#14898381
    function insertCss( code ) {
        var style = document.createElement('style');
        style.type = 'text/css';

        if (style.styleSheet) {
            // IE
            style.styleSheet.cssText = code;
        } else {
            // Other browsers
            style.innerHTML = code;
        }

        document.getElementsByTagName("head")[0].appendChild( style );
    }
    insertCss('.nestedlisting > .thing{width:72.5%;}')
    insertCss('.linklisting > .thing{width:72.5%;}')
})();