Greasy Fork

Greasy Fork is available in English.

Clean wetter.com

Hide unrelated elements, auto load updates

当前为 2025-02-26 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Clean wetter.com
// @description Hide unrelated elements, auto load updates
// @namespace   shiftgeist
// @match       https://www.wetter.com/*
// @grant       GM_addStyle
// @version     20250226.1
// @author      shiftgeist
// @license     GNU GPLv3
// @icon        https://cs3.wettercomassets.com/wcomv5/images/icons/favicon/48x48.png
// ==/UserScript==

GM_addStyle(`
nav,
aside,
footer,
#weather-headline,
#current-weather-with-content .thumbnail-container,
#nowcast,
#outstream-outer,
#wetter,
#current-weather-with-content #snow-link,
#furtherDetails,
#ski-area-link,
#livecam,
#globalText,
#pictureNewsWithRightText,
#video-teaser-fixed,
#seo-link-list,
.werbung,
.social-grid,
.warnings-grid,
.city-weather-grid,
.cityweather h2,
.cityweather h3,
.cityweather p,
.page-gradient,
.header-login,
.swg-col-arrow,
.info-grid,
.scroll,
[data-tb-region="inlineVideoBox"],
[data-module="forecast-layout1-additional"],
[data-for="climate"],
[data-template="columnsWidget"],
[data-tb-region="aufmachermodul"],
[data-template="startpageWidget"],
[data-contenttype="hd-live-webcams"],
[data-text="Rückblick"] {
  display: none !important;
  width: 0px !important;
  height: 0px !important;
}

#cnt-with-location-attributes .rtw_weather_txt.text--small {
  font-size: 1rem !important;
}

.desk-two-thirds,
.homepagemapmodule .c1,
.mia-map-container {
  width: unset !important;
  max-width: unset !important;
}

#header-placeholder,
.mia-map-container,
.homepagemapmodule,
.cityweather {
  height: auto !important;
  min-height: auto !important;
}

.forecast-navigation-move,
.bg--blue-gradient,
.forecast-navigation-grid a:not(.is-active):not(:hover),
.forecast-navigation-line a.is-active,
.forecast-navigation-line a:hover {
  background: #3769b6 !important;
}

.forecast-navigation-grid a.is-active,
.forecast-navigation-grid a:hover {
  background: #fff !important;
}

#current-weather-with-content {
  margin: -30px -40px 0;
}

.forecast-navigation-move {
  border-radius: 0 0 4px 4px;
  padding: 10px 10px 6px 10px;
}

.bottom-border--grey {
  border: none !important;
}

.sun-moon .sun {
  font-size: 18px;
}

.spaces-weather-grid .swg-row-wrapper {
  grid-template-columns: unset !important;
}

#cnt-with-location-attributes.flex-gap {
  gap: unset;
}
`);

setInterval(() => {
  const hasUpdate = document.querySelector('#newRefresh .btn');

  if (hasUpdate.offsetParent) {
    hasUpdate.click();
  }
}, 5000);

const selectors = [
  ['div.app-layout', 'News zum Thema Wetter'],
  ['div.app-layout', 'Wetter-News'],
  ['div.app-layout', 'Wetter live in Deutschland'],
  ['div.app-layout', 'Webvideos aus aller Welt'],
  ['div.app-layout', 'Wetter Deutschland'],
  ['div.app-layout', 'Die nächsten Wetterstationen'],
  ['div.app-layout', 'Einen anderen Ort auswählen'],
  ['div.app-layout', 'Das könnte dich auch interessieren'],
  ['div.app-layout', 'Details zur Wetterkarte Regenradar für Deutschland'],
  ['div.app-layout', 'Tipps für die Wahl des richtigen Lichtschutzfaktors'],
  ['div.c2', 'Mehr zum Wetter'],
  ['.layout__item', 'Aktuelle Videos für das Wetter in Deutschland'],
  ['.layout__item', 'Unwetterwarnungen'],
  ['.layout__item', '3-Tage-Wetter'],
  ['.pt--', 'Standort'],
];

selectors.forEach(([select, text]) => {
  const parents = Array.from(document.querySelectorAll(select));
  const parentF = parents.filter(p => p.innerText.toLowerCase().startsWith(text.toLowerCase()));
  parentF.forEach(p => {
    p.style.display = 'none';
  });
  console.log(`[clean] Removed ${parentF.length} elements.`)
})