Youtube polymer engine fixes

Some fixes for Youtube polymer engine

< Youtube polymer engine fixes 피드백으로 돌아가기

리뷰: 보통 - 스크립트가 작동하지만 버그 있음

§
게시: 2024-07-16
수정: 2024-07-16

Am having issues in Safari 17.5 on macOS 14.5, the settings icon does not appear. I get this error in the console. Anything I can plug in to help debug?

§
게시: 2024-07-16

Using UserScripts extension by [quoid](https://github.com/quoid/userscripts) to load userscript in Safari. Your script in Tampermonkey in Firefox works fine

Bogudan작성자
§
게시: 2024-07-16

What version of the script you are using?

Was it working with previous versions?

§
게시: 2024-07-16

Latest v2.26.3. This is my first time with the script. I also tried it with an older version v2.21.1 but it made no difference, same errors and no settings icon appearing. I can see the css applying so it seems the script is working behind the scenes

§
게시: 2024-07-16

This is my header

Bogudan작성자
§
게시: 2024-07-16
수정: 2024-07-16

Try replacing following line of code in script:

sbo.getElementsByTagName ('div') [0].appendChild (unwrap (aa)); // created by YT scripts

with this:

try { sbo.getElementsByTagName ('div') [0].appendChild (unwrap (aa)); } catch (ex) { return; } // created by YT scripts
§
게시: 2024-07-16

No error now but still nothing. I tossed in console.log(ex);console.log(sbo.getElementsByTagName ('div') [0]); into the catch statement, and get this thrown exception in console output. So it seems the error is valid. Going to dive into the DOM and see if maybe the layout is different. What should the output of console.log(sbo.getElementsByTagName ('div') [0]); be?

§
게시: 2024-07-16

Tried out just console.log(sbo.getElementsByTagName ('div') to grab the object itself and see the list. Seems the returned object is empty

§
게시: 2024-07-16

Output of console.log(sbo)

§
게시: 2024-07-16

Found the div, looks like there are no parent objects being inserted into it. There must be some issue with appending the div in the lines before sbo.getElementsByTagName ('div') [0].appendChild (unwrap (aa));

Bogudan작성자
§
게시: 2024-07-17

Thanx for debugging.

There must be some issue with appending the div

The issue is that in FF this div is created by YT scripts, not by me. So I rely on this behaviour, which is not instant.

Please, try removing following line of code (this may create multiple icons):

toolBar.insertBefore (mark, sb);

Also, can you try to open https://www.youtube.com/fix-settings (ison leads there)?

§
게시: 2024-07-17

Getting the same undefined is not an object error.

The link to the settings page opens and works👍

§
게시: 2024-07-17
수정: 2024-07-17

I guess the problem is that the div is not being created for some reason. If I force create the div by adding the following code before the line sbo.getElementsByTagName ('div') [0].appendChild (unwrap (aa));, the error goes away. Though the layout of the icon becomes broken, it does work and is visible. I can now access the settings page as normal. Now why isn't polymer creating the div...

Code:

const tempdiv = document.createElement('div');//create the missing div

tempdiv.id = 'button';//assign the attributes that should be there

tempdiv.className = 'style-scope ytd-topbar-menu-button-renderer';

sbo.insertBefore (tempdiv, sbo.childNodes [0]);//insert it where it should be

Bogudan작성자
§
게시: 2024-07-18

Try to execute from web console following:

alert(document.createElement('ytd-topbar-menu-button-renderer').constructor)
§
게시: 2024-07-18

Output is function(){var d=HTMLElement.call(this)||this;d.is=b;if(heb===b)return d.isInert=!0,d;d.createElement();return d}

Bogudan작성자
§
게시: 2024-07-18

Expected value... Try replacing in usersript

const sb = document.createElement ('ytd-topbar-menu-button-renderer');

with

const sb = unwrap (document).createElement ('ytd-topbar-menu-button-renderer');
§
게시: 2024-07-18

Same as before hmm :( Looks like it's hard to say if it's polymer, Safari, or the userscript implementation of the userscript manager. Might open an issue on their repo to see their take

§
게시: 2024-07-18

Could it be related to this issue?

Bogudan작성자
§
게시: 2024-07-19
수정: 2024-07-19

Don't think so. run-at document-start is not technically necessary for this userscript. Can you remove it and test, please?

답글 게시

답글을 게시하려면 로그인하세요.