Resize Forum-Auto

Restyle forum-auto.caradisiac.com

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==// @name Resize Forum-Auto
// @version 1.3
// @author Sly_North
// @description Restyle forum-auto.caradisiac.com
// @grant none
// @include https://forum-auto.caradisiac.com*
// @namespace https://forum-auto.caradisiac.com
// @license MIT
// @icon https://content-eu.invisioncic.com/m304542/monthly_2020_11/android-chrome-36x36.png
// ==/UserScript==

console.log('ResizeForumAuto - Begin');

SetStyleByClass = function(name, style) {
  var elts = document.getElementsByClassName(name);
  if (elts.length > 0) {
    for (var i = 0; i < elts.length; ++i)
    elts[i].setAttribute('style', style);
  }
  else console.log('ResizeForumAuto - Element class not found: ' + name);
}

SetStyleById = function(name, style) {
  var elt = document.getElementById(name);
  if (elt) elt.setAttribute('style', style);
  else console.log('ResizeForumAuto - Element id not found: ' + name);
}

ResizeByClass = function(name) {
  SetStyleByClass(name, 'width: 100vw; max-width: 90vw; margin: 0px; margin-left: 2vw;');
}

ResizeAll = function() {
	ResizeByClass('main');
	ResizeByClass('ipsLayout_container');

  var hasSideBar = document.getElementsByClassName('ipsWidget').length > 1;
  if (hasSideBar) {
  	// Side bar
  	SetStyleByClass('ipsLayout_sidebar', 'padding-left: 10px;min-width: 250px;');
  } else {
  	SetStyleByClass('ipsLayout_sidebarright', 'display: none;');
  }

  // Messages
  SetStyleByClass('ipsComment', 'margin-bottom: 5px;');

  SetStyleById('ipsLayout_contentArea','background: rgb(220, 220, 220);');
  SetStyleByClass('ipsComment_author', 'padding: 0 !important;');
  SetStyleByClass('ipsComment_meta', 'padding: 0;');
  SetStyleByClass('ipsItemControls', 'padding: 0; min-height: 35px; height: 35px;'); // message controls
  SetStyleByClass('ipsPadding_vertical', 'padding: 0; max-height: 70px; overflow: hidden;'); // message signature
  
  // Quotes
  SetStyleByClass('ipsQuote_contents', 'font-size: 75%;');
  SetStyleByClass('ipsQuote_citation', 'max-height: 20px; padding: 0;');
}

setTimeout(100, ResizeAll());
setTimeout(500, ResizeAll());
setTimeout(5000, ResizeAll());
console.log('ResizeForumAuto - End');