-
Notifications
You must be signed in to change notification settings - Fork 73
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
Userscript Fix #146
base: master
Are you sure you want to change the base?
Userscript Fix #146
Conversation
thank you (firefox v133.0.3 64 bits) |
const originalAppendChild = document.head.appendChild; | ||
|
||
document.head.appendChild = function (element) { | ||
if (element.tagName === "SCRIPT") { | ||
if (element.src.includes("player-core-variant-a")) { | ||
if (element.src && element.src.includes("player-core-variant-a")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (element.src && element.src.includes("player-core-variant-a")) { | |
if (element?.src?.includes("player-core-variant-a")) { |
// @grant none | ||
// ==/UserScript== | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
var isVariantA = false; | ||
|
||
const originalAppendChild = document.head.appendChild; | ||
|
||
document.head.appendChild = function (element) { | ||
if (element.tagName === "SCRIPT") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (element.tagName === "SCRIPT") { | |
if (element?.tagName === "SCRIPT") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion just for consistency, probably sure it's not needed (an element with no tag name does not make any sense).
userscript/twitchnosub.user.js
Outdated
|
||
if (!isVariantA) { | ||
this.addEventListener("message", (event) => { | ||
const data = event.data; | ||
|
||
if (data.id == 1 && data.type == 1) { | ||
const newData = event.data; | ||
|
||
const newData = { ...data }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really needed to use the spread operator here ? why const newData = event.data;
does not work ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newData = { ...data };
avoids changing the original data.
const newData = event.data;
is causing Error #4000
, Issue #144
It works only if I re-add |
@trapgod1 I use Violentmonkey and there is a scenario in which the script will not work.
🤔 |
Tested your bug fixes (1.0.4) and it still doesn't work if |
whats browser are you using ? Edit: TamperMonkey Permission issue Edit 2: New version should of fixed the issue |
Yes I was using TamperMonkey on Firefox. Just tested 1.0.5, seems to load fine this time! |
Just tested 1.0.5, no problems at all. Thank you so much :) |
No description provided.