CSS: ventusky.com

Corrections to UI of ventusky.com

当前为 2022-10-20 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          CSS: ventusky.com
// @description   Corrections to UI of ventusky.com
// @author        MK
// @namespace     max44
// @homepage      https://greasyfork.org/en/users/309172-max44
// @match         *://www.ventusky.com/*
// @icon          https://www.ventusky.com/images/favicon.ico
// @version       1.3
// @license       MIT
// @require       https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @run-at        document-idle
// ==/UserScript==

(function() {
  var css = `
  /*Remove App button*/
  li#menu-app {
    display: none !important;
  }

  /*Remove Download App button (Android)*/
  a[href^="https://play.google.com"] {
    display: none !important;
  }

  /*Remove Download App button (iOS)*/
  a[href^="https://itunes.apple.com"] {
    display: none !important;
  }

  /*Smaller header*/
  form#header {
    height: unset !important;
    padding: unset !important;
    background: unset !important;
    background-size: unset !important;
    width: 50% !important;
  }
  form#header::after {
    background: unset !important;
  }

  /*Smaller menu button*/
  /*menu::before {
    padding-left: unset !important;
    line-height: 3em !important;
    border-radius: 2em !important;
  }*/

  /*New settings button for mobile version*/
  menu2 a {
    right: 1em !important;
    text-align: center !important;
    border-radius: 2em !important;
    box-shadow: 0 1.5px 3px rgba(0,0,0,.25) !important;
    background: #fff !important;
    line-height: 2.125em !important;
    height: 2.125em !important;
    width: 5em !important;
    color: #12507f !important;
    display: block !important;
    position: absolute !important;
  }
  `;

  if (typeof GM_addStyle != 'undefined') {
    GM_addStyle(css);
  } else if (typeof PRO_addStyle != 'undefined') {
    PRO_addStyle(css);
  } else if (typeof addStyle != 'undefined') {
    addStyle(css);
  } else {
    var node = document.createElement('style');
    node.type = 'text/css';
    node.appendChild(document.createTextNode(css));
    document.documentElement.appendChild(node);
  }

  //Change Menu button to Settings button on mobile version
  const rootCallback = function (mutationsList, observer) {
    var menuLi = document.querySelector("menu li");
    if (menuLi != null) {
      if (getComputedStyle(menuLi).float === "none") { //If menu item is for mobile browser
        var menu2 = document.querySelector("#menu2");
        if (menu2 == null) $("body").append('<menu2 id="menu2"></menu2>');
        menu2 = document.querySelector("#menu2");
        if (menu2 != null) {
          $("li#menu-settings").appendTo("#menu2");
          $("body > menu").hide();//remove();
        }
      }
    }
  }

  const config = {childList: true, subtree: true};
  const rootNode = document.querySelector("body");
  if (rootNode != null) {
    const rootObserver = new MutationObserver(rootCallback);
    rootObserver.observe(rootNode, config);
  }

  /*let waitForMenu = setInterval(function() { //Check page content constantly
    var menuLi = document.querySelector("menu li");
    if (menuLi != null) {
      if (getComputedStyle(menuLi).float === "none") { //If menu item is for mobile browser
        var menu2 = document.querySelector("#menu2");
        if (menu2 == null) $("body").append('<menu2 id="menu2"></menu2>');
        menu2 = document.querySelector("#menu2");
        if (menu2 != null) {
          $("li#menu-settings").appendTo("#menu2");
          $("body > menu").hide();//remove();
          clearInterval(waitForMenu);
        }
      } else clearInterval(waitForMenu); //Stop waiting, because it is not mobile browser
    }
  }, 500); //Interval to check page content*/

})();