用笔记本逛 V2EX 的时候老是得稍微扭一下脖子,有那么些许不得劲,于是:
👨💻:请写一个油猴脚本,屏蔽 https://www.v2ex.com/ 网站内的<div id = “Rightbar”></div> 里的内容,并且让<div id = “Main”></div> 里的内容居中显示
💻:
// ==UserScript==
// @name Hide V2EX right bar and center main content
// @namespace v2ex-hide-rightbar-center-content
// @description Hide the right bar and center main content on V2EX website.
// @version 1
// @grant none
// @match https://www.v2ex.com/*
// ==/UserScript==
(function() {
'use strict';
// Hide the right bar
var rightBar = document.querySelector('#Rightbar');
if (rightBar) {
rightBar.style.display = 'none';
}
// Center the main content
var mainContent = document.querySelector('#Main');
if (mainContent) {
mainContent.style.margin = '0 auto';
mainContent.style.maxWidth = '1000px'; // Optional: limit the maximum width of center content
}
})();
突发奇想,让 chatpgt 写了个 V2EX 内容居中的油猴小工具
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://dixi.eu.org/413.html