Greasy Fork is available in English.

°F+°C Weather - google

Shows the current °F and °C weather temperature at the same time on google.

Устаревшая версия за 22.04.2022. Перейдите к последней версии.

Чтобы установить этот скрипт, вы сначала должны установить расширение браузера, например Tampermonkey, Greasemonkey или Violentmonkey.

Чтобы установить этот скрипт, вы сначала должны установить расширение браузера, например Tampermonkey или Violentmonkey.

Чтобы установить этот скрипт, вы сначала должны установить расширение браузера, например Tampermonkey или Violentmonkey.

Чтобы установить этот скрипт, вы сначала должны установить расширение браузера, например Tampermonkey или Userscripts.

Чтобы установить этот скрипт, сначала вы должны установить расширение браузера, например Tampermonkey.

Чтобы установить этот скрипт, вы должны установить расширение — менеджер скриптов.

(у меня уже есть менеджер скриптов, дайте мне установить скрипт!)

Чтобы установить этот стиль, сначала вы должны установить расширение браузера, например Stylus.

Чтобы установить этот стиль, сначала вы должны установить расширение браузера, например Stylus.

Чтобы установить этот стиль, сначала вы должны установить расширение браузера, например Stylus.

Чтобы установить этот стиль, сначала вы должны установить расширение — менеджер стилей.

Чтобы установить этот стиль, сначала вы должны установить расширение — менеджер стилей.

Чтобы установить этот стиль, сначала вы должны установить расширение — менеджер стилей.

(у меня уже есть менеджер стилей, дайте мне установить скрипт!)

// ==UserScript==
// @name         °F+°C Weather - google
// @namespace    https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
// @version      6
// @description  Shows the current °F and °C weather temperature at the same time on google.
// @author       hacker09
// @include      *://www.google.*
// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://www.google.com&size=64
// @run-at       document-end
// @grant        none
// @noframes
// ==/UserScript==

(function() {
  'use strict';
  var CorF; //Create a global variable

  if (document.querySelector("div.vk_bk.wob-unit > span,div.wob_uctr > span").innerText === '°F') //If the current temperature is in °F
  { //Starts the if condition
    CorF = '°F'; //Page was loaded in °F
  } //Finishes the if condition

  async function ShowCF() {
    var c = document.getElementById('wob_tm').innerText; //Save the current temperature value
    var f = document.getElementById('wob_ttm').innerText; //Save the hidden temperature value

    document.querySelector("div.wob_tctr").style.display = 'none'; //Hide the big text temperature
    document.querySelector("div.wob_uctr").style.fontSize = '47px'; //Increase the script custom text font size
    document.querySelectorAll("div.wob_uctr > span").forEach(el => el.style.color = 'white'); //Make the script temperature white

    if (CorF === '°F') //If the current temperature is in °F
    { //Starts the if condition
      document.querySelectorAll("div.wob_uctr > .wob_t:nth-child(1),div.wob_uctr > .wob_t:nth-child(2)").forEach(el => el.innerText = c + '°F'); //Show °F
      document.querySelectorAll("div.wob_uctr > .wob_t:nth-child(4),div.wob_uctr > .wob_t:nth-child(5)").forEach(el => el.innerText = f + '°C'); //Show °C
    } //Finishes the if condition
    else //If the current temperature is in °C
    { //Starts the else condition
      document.querySelectorAll("div.wob_uctr > .wob_t:nth-child(1),div.wob_uctr > .wob_t:nth-child(2)").forEach(el => el.innerText = c + '°C'); //Show °C
      document.querySelectorAll("div.wob_uctr > .wob_t:nth-child(4),div.wob_uctr > .wob_t:nth-child(5)").forEach(el => el.innerText = f + '°F'); //Show °F
    } //Finishes the else condition
  }

  ShowCF(); //Calls the ShowCF function

  new MutationObserver(async function() { //Whe the weather bar is scrolled
    await ShowCF(); //Calls the ShowCF function
  }).observe(document.querySelector("#wob_sh"), { //Defines the element and the characteristics to be observed
    attributes: true,
    attributeOldValue: true,
    characterData: true,
    characterDataOldValue: true,
    childList: true,
    subtree: true
  }); //Finishes the definitions to be oberserved
})();