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

[Script Injection] issues with injection #12

Open
magiruuvelvet opened this issue Mar 31, 2018 · 1 comment
Open

[Script Injection] issues with injection #12

magiruuvelvet opened this issue Mar 31, 2018 · 1 comment

Comments

@magiruuvelvet
Copy link
Owner

magiruuvelvet commented Mar 31, 2018

Issues with Script Injection


  • Twitch: FrankerFaceZ doesn't work at all, the script is loaded but that's about it. Sometimes outputs an error about unsuccessfully injection. Used the wrong version there. I tried to inject the Mozilla Firefox version instead of the generic browser version or Chromium version. 🤦‍♀️
FFZ:AP Script
// ==UserScript==
// @id          ffzap
// @name        The FrankerFaceZ Add-On Pack
// @namespace   FFZ-AP
//
// @version     3.0.1
// @updateURL   https://cdn.ffzap.download/injector.user.js
//
// @description A combination of add-ons for the Twitch extension "FrankerFaceZ"
// @author      Lordmau5
// @homepage    https://ffzap.download/
// @icon        https://cdn.ffzap.download/icon32.png
// @icon64      https://cdn.ffzap.download/icon64.png
// @icon128     https://cdn.ffzap.download/icon128.png
//
// @include     http://twitch.tv/*
// @include     https://twitch.tv/*
// @include     http://*.twitch.tv/*
// @include     https://*.twitch.tv/*
//
// @exclude     http://api.twitch.tv/*
// @exclude     https://api.twitch.tv/*
//
// @grant       none
// @run-at      document-end
// ==/UserScript==

function ffzapInit () {
    var script = document.createElement('script');
    
    script.id = 'ffzap_script';
    script.type = 'text/javascript';
    if (localStorage.ffz_ap_debug_mode === 'true') {
        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'https://localhost:3000/', true);
        xhr.onload = function (e) {
            console.log('FFZ:AP: Development Server is present.');
            script.src = 'https://localhost:3000/ffz-ap.js';
            document.body.classList.add('ffz-ap-dev');
            document.head.appendChild(script);
        };
        xhr.onerror = function (e) {
            console.log('FFZ:AP: Development Server is not present. Using CDN.');
            script.src = 'https://direct.lordmau5.com/ffz-ap/ffz-ap.js?_=' + Date.now();
            document.head.appendChild(script);
        };
        return xhr.send(null);
    } else {
        script.src = 'https://cdn.ffzap.download/ffz-ap.min.js';
        document.head.appendChild(script);
    }
}

ffzapInit();

  • maybe more...
@magiruuvelvet
Copy link
Owner Author

script injection seems to work fine. I noticed a problem when working with UserScripts (Greasemonkey): Qt has support for them, but it wouldn't correctly load it. seems like renaming the file to some_script.user.js changed the behavior Qt parses the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant