OPGG界面优化

OPGG界面元素排版优化

// ==UserScript==
// @name         OPGG界面优化
// @namespace    http://tampermonkey.net/
// @version      2024-12-17
// @description  OPGG界面元素排版优化
// @license      Copyright © 2025 Leon. All rights reserved.
// @author       Leon
// @match        https://www.op.gg/*
// @match        https://op.gg/zh-cn/*
// @match        https://op.gg/zh-cn/champions?*
// @match        https://www.op.gg/champions?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=op.gg
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    if (location.pathname.includes('champions')) {
      let timer1 = setTimeout(() => {
    // 创建一个新的 <style> 标签
        const style = document.createElement('style');
        style.type = 'text/css';

        // 定义新的 @media 查询规则
        const newStyles = `
    @media (min-width: 1080px) {
        .md\\:w-width-limit {
            width: 1600px; /* 修改后的宽度 */
        }
        .md\\:text-lg {
            margin-left: 200px;
        }
         .md\\:w-\\[740px\\] {
            width: 830px; /* 修改后的宽度 */
        }
       .md\\:w-\\[332px\\] {
           width: 532px;
       }
    }
    .w-\\[332px\\] {
       width: 532px;
   }
   .flex-row-reverse {
    flex-direction: row;
    margin-left: 100px;
}
.flex {
    display:flex;
    justify-content: center;
}
    .md\\:w-auto {
        justify-content: flex-start !important;
    }
    #content-header {
        display:none;
    }

`;


        // 插入规则到 <style> 标签中
        style.appendChild(document.createTextNode(newStyles));

        // 将 <style> 标签添加到 <head> 中
        document.head.appendChild(style);
    }, 500);
    }
    else if (location.pathname.includes('modes')) {
         let timer1 = setTimeout(() => {
           // 创建一个新的 <style> 标签
           const style = document.createElement('style');
           style.type = 'text/css';

           // 定义新的 @media 查询规则
           const newStyles = `
          .md\\:max-w-\\[332px\\],  .md\\:gap-2 {
             width: 405px !important; /* 修改后的宽度 */
          }
         .md\\:max-w-\\[332px\\] {
              max-width: 405px;
          }
        `;
        // 插入规则到 <style> 标签中
        style.appendChild(document.createTextNode(newStyles));

        // 将 <style> 标签添加到 <head> 中
        document.head.appendChild(style);
    }, 500);
    }
    

})();