Wattpad Width Fixer and Suggestions Hider

Futzes with the width settings to make it wider

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Wattpad Width Fixer and Suggestions Hider
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Futzes with the width settings to make it wider
// @author       You
// @match        https://www.wattpad.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=wattpad.com
// @grant        none
// ==/UserScript==

var userPreferenceAdditionalPaddingPX = "0";

(function() {
    'use strict';

    // Your code here...
    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 );
    }
    var authorDeets = document.querySelector('.left-rail > #sticky-nav');
    document.querySelector('header > .meta,header > .restart-part').insertAdjacentElement('beforebegin', authorDeets.cloneNode(true));
    var commentBubblePaddingWidth = window.getComputedStyle(document.querySelector('#story-reading .page p'), null).getPropertyValue('padding-right').split("px")[0]
    insertCss('#sticky-end{width:auto;}')
    insertCss('.panel-reading{margin-left:'+(parseInt(commentBubblePaddingWidth,10)+parseInt(userPreferenceAdditionalPaddingPX,10))+'px;width:auto;}')
    insertCss('#story-reading .page p{margin-right:'+userPreferenceAdditionalPaddingPX+'px}')
    insertCss('.left-rail{display:none;}')
    insertCss('.right-rail{display:none;}')
    insertCss('.modal-open{overflow:inherit;}')
})();