Forecast.io – auto-show today’s outlook

Automatically expand the detailed forecast for today when visiting Forecast.io

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Forecast.io – auto-show today’s outlook
// @namespace   roryokane.com
// @description Automatically expand the detailed forecast for today when visiting Forecast.io
// @include     http://forecast.io/
// @include     http://forecast.io/#*
// @version     1.0.1
// @grant       none
// ==/UserScript==


// jQuery waitUntilExists plugin
// copied directly from https://gist.githubusercontent.com/PizzaBrandon/5709010/raw/57edca8e8aba3954551397167039a049a572018c/jquery.waituntilexists.min.js
// for the unminified version, see https://gist.github.com/PizzaBrandon/5709010/e539a6f16c10465eb948b9ef6b0fe1d4c17a7c3e#file-jquery-waituntilexists-js
// Why include this inline instead of using @require? To satisfy [Greasy Fork’s policy](https://greasyfork.org/help/external-scripts).
// I can’t find this plugin or any equivalent on a whitelisted site, even though it fits Greasy Fork’s three criteria for external scripts.
// ========== START included plugin ==========
(function(e,f){var b={},g=function(a){b[a]&&(f.clearInterval(b[a]),b[a]=null)};e.fn.waitUntilExists=function(a,h,j){var c=this.selector,d=e(c),k=d.not(function(){return e(this).data("waitUntilExists.found")});"remove"===a?g(c):(k.each(a).data("waitUntilExists.found",!0),h&&d.length?g(c):j||(b[c]=f.setInterval(function(){d.waitUntilExists(a,h,!0)},500)));return d}})(jQuery,window);
// ========== END included plugin ==========


var todayPanelSelected = jQuery('#outlook .day.panel:first .top');
todayPanelSelected.waitUntilExists(function(matchIndex, todayPanel) {
	todayPanel.click();
});