Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tampermonkey update breaking weather loading from forecast.io #923

Closed
gitguys opened this issue Apr 28, 2020 · 1 comment
Closed

Tampermonkey update breaking weather loading from forecast.io #923

gitguys opened this issue Apr 28, 2020 · 1 comment

Comments

@gitguys
Copy link

gitguys commented Apr 28, 2020

Expected Behavior

Basic javascript userscript loads and shows weather in an iframe from forecast.io - it's worked for years with Tampermonkey on all browsers including Chrome, Safari and Firefox Mac and Windows.

Actual Behavior

Disappears with latest Tampermonkey 4.10.6112 update or perhaps the 4.9.x version. The weather refuses to load on all browsers including Chrome and Firefox on Mac and Windows.

In Chrome I see an error that says:

requestsblocked

"Requests to the server have been blocked by an extension"

Because of this issue I'm not updating Tampermonkey on Safari, but I assume its probably broke there too.

Is there a way to revert back to the previous version of Tampermonkey? This really stinks.

Specifications

Chrome and Firefox on Mac and Windows. Probably Safari too I assume.

Script

// ==UserScript==
// @name                Weather iFrame
// @namespace      wat
// @version             0.1
// @description       try to take over the world!
// @include             https://www.startpage.com/en/?
// @include             https://www.startpage.com/
// @include             https://www.startpage.com/en/*
// @include             https://www.google.com/
// @include             https://www.google.com/webhp*
// @require             http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

// ==/UserScript==

var iframe=document.createElement("iframe");
iframe.id="weather"
iframe.class="weather"
iframe.src = '//forecast.io/embed/#lat=39.636077&lon=-105.039545&name=Denver&color=white'
iframe.setAttribute("style", "padding: 10px; ;border:5px;height: 220px; width: 380px;  border-radius: 40px; position:absolute; top: -45px; left: -10px !important;");
document.documentElement.appendChild(iframe);

(function() {
    'use strict';

    var stylesheet = `

#weather {
    opacity: 0.6; /* css standard */
    filter: contrast(50%) brightness(100%); /* internet explorer */
    transition: 2s;
}

#weather:hover {
    opacity: 1; /* css standard */
    filter: contrast(50%) brightness(200%); /* internet explorer */
}

div#hptl {display: none !important}

`;

    var styleElem = document.createElement('style');
    styleElem.textContent = stylesheet;
    document.head.appendChild(styleElem);
})();
@derjanb
Copy link
Member

derjanb commented May 18, 2020

This is a CSP limitation of the "outer" page:

Refused to frame 'https://forecast.io/' because it violates the following Content Security Policy directive: "frame-src 'self' *.startpage.com".

I'll add a new API to handle this: #881 (comment)

Duplicate of #881

@derjanb derjanb closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants