tampermonkey | popular userscript manager , with over 10 million users | Browser Plugin library
kandi X-RAY | tampermonkey Summary
kandi X-RAY | tampermonkey Summary
Tampermonkey is the most popular userscript manager for Google Chrome.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates CodeMirror instance .
- Processes regular expression
- parse html tag
- tag handler
- Change DOM attributes
- The handler for the mouseup event .
- Parse a string .
- Fixes IE event listeners .
- Process CSS selector token .
- Advances of the first token
tampermonkey Key Features
tampermonkey Examples and Code Snippets
Community Discussions
Trending Discussions on tampermonkey
QUESTION
I have a tampermonkey script that highlights table rows when specific columns contain specific text.
For example the code below successfully highlights rows were column 1 contains 'M' and rows where column 3 contains 'P'.
...ANSWER
Answered 2022-Mar-09 at 03:27Grab all the elements and filter that down to the ones with the
elements matching your requirements.
Once you have that filtered collection, set the background colour.
QUESTION
I'd like to create a global variable list in javascript that will add new elements to the list. I need it global because I'm using Tampermonkey, and I want to keep old elements inside the list and able to add new elements to it.
How can I do this correctly?
I have tried something like this but it's not working :c
...ANSWER
Answered 2022-Jan-28 at 09:31GM_setValue("arr_names", check_empty.push(user));
QUESTION
I try to add an button via Tampermonkey to websites. That button should only appear in the outer body and not in iframes.
So, for example, this is before the Tampermokey runs...
...ANSWER
Answered 2022-Jan-28 at 09:09Update 2
If the pages are dynamically generated, varies in content, and/or what and how things are loaded cannot be controlled, etc., try adding the button with .insertAdjacentHTML()
method. Also adding elements to body
isn't the best choice of locations because it's at the top of the hierarchy of HTML and there should be only few elements there.
QUESTION
I tend to write my own user scripts (aka Violentmonkey / Tampermonkey scripts; formerly Greasemonkey scripts). I often end up selecting elements by class name while doing so - either using native javascript or having the script load jQuery and using that.
I've noticed that sometimes I see dynamically generated class names like "SeriesIndexFooter-footer-3WmRg" with the bolded bits appearing to be some randomly generated part (I think this gets generated by React? I haven't used React myself but have sometimes seen "React" in other element names when encountering these). Obviously, I can just hard-code these classnames in my script AS-IS and it will work... but my concern is that if a site / local server app gets updated later that this will break my user script.
e.g.
...ANSWER
Answered 2022-Jan-09 at 21:56There is no way you can predict class suffix that you are talking about.
That is used for purpose of encapsulating styles so that it applies only for that specific element or group of elements.
What you can do in your case is to use few CSS selectors that relay on searching values in attributes. In your case it would look something like this:
QUESTION
I'm using the technique described here (code, demo) for using video frames as WebGL textures, and the simple scene (just showing the image in 2D, rather than a 3D rotating cube) from here.
The goal is a Tampermonkey userscript (with WebGL shaders, i.e. video effects) for YouTube.
The canvas is filled grey due to gl.clearColor(0.5,0.5,0.5,1)
. But the next lines of code, which should draw the frame from the video, have no visible effect. What part might be wrong? There are no errors.
I tried to shorten the code before posting, but apparently even simple WebGL scenes require a lot of boilerplate code.
...ANSWER
Answered 2022-Jan-08 at 15:24Edit: As it has been pointed out, first two sections of this answer are completely wrong.
TLDR: This might not be feasible without a backend server first fetching the video data.
If you check the MDN tutorial you followed, the video object passed to texImage2D
is actually an MP4 video. However, in your script, the video object you have access to (document.getElementsByTagName("video")[0]
) is just a DOM object. You don't have the actual video data. And it is not easy to get access to that for YouTube. The YouTube player do not fetch the video data in one shot, rather the YouTube streaming server makes sure to stream chunks of the video. I am not absolutely sure on this, but I think it'll be very difficult to work around this if your goal is to have a real time video effects.
I found some discussion on this (link1, link2) which might help.
That being said, there are some issues in your code from WebGL perspective. Ideally the code you have should be showing a blue rectangle as that is the texture data you are creating, instead of the initial glClearColor
color. And after the video starts to play, it should switch to the video texture (which will show as black due to the issue I have explained above).
I think it is due to the way you had setup your position data and doing clip space calculation in the shader. That can be skipped to directly send normalized device coordinate position data. Here is the updated code, with some cleaning up to make it shorter, which behaves as expected:
QUESTION
I'd like to apply a shader to videos on YouTube.
My current attempt is to use Three.js for that, namely to turn this example of applying a shader to a video (code here) into a Tampermonkey userscript to run on youtube.com.
Are the following @require
statements correctly translated from the original import
statements? How do I solve the problems eslint: no-undef - 'THREE' is not defined
, eslint: no-undef - 'PerspectiveCamera' is not defined
(if I delete THREE.
, assuming that the contents of three.module.js
get imported directly), eslint: no-undef - 'RenderPass' is not defined
?
ANSWER
Answered 2021-Dec-31 at 18:02eslint: no-undef - 'THREE' is not defined
is not necessarily problematic.
Use normal JavaScript versions of the Three.js scripts instead of module versions:
QUESTION
I can run the following in the Chrome console and it does what I want without error:
document.querySelector('.flat.pagination.next').dispatchEvent(new MouseEvent("mousedown",{ view: window, bubbles: true, cancelable: true, clientX: 0, clientY: 0, button: 0 }));
However, if I put the same line of code in to a Tampermonkey script, I get the following error:
Uncaught TypeError: Failed to construct 'MouseEvent': Failed to read the 'view' property from 'UIEventInit': Failed to convert value to 'Window'.
Presumably there is something wrong with the view: window
part, but I can't see why it would behave differently in the console to a script.
Any ideas how I can get it to work?
...ANSWER
Answered 2021-Nov-15 at 15:45I was able to get it to work as I needed by removing the options:
QUESTION
I am new to javascript and Tampermonkey. I wanted to add a frame to the Memrise's website. The code is as follows:
...ANSWER
Answered 2021-Oct-31 at 14:54Use GM_addElement to circumvent such CSP restrictions:
QUESTION
If I watch a YouTube video and try to drag the player down, it's doing this:
Sometimes it doesn't do this. Sometimes it's only doing this in fullscreen. Sometimes it's also doing this in theatre mode. It started happening not so long ago.
I've tried
document.addEventListener('mousemove', (e) => { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault();}, true)
in Tampermonkey, but it disables all the other mousemoves except the drag down for miniplayer. I've tried user-select: none
, but it doesn't solve this issue either.
I've tried in Incognito mode, with extensions disabled. Nothing helped.
I'm running latest Chrome. 95.0.4638.54
This doesn't happen in Chromium for some reason: version 94.0.4606.81
I'm not the only one with this problem: https://www.reddit.com/r/youtube/comments/l4falt/is_there_a_way_to_turn_off_the_drag_down_to/
I haven't found any other forum posts about it.
Is there any way to disable this functionality?
Update: this code seems to work: https://pastebin.com/n093g9Ur
...ANSWER
Answered 2021-Oct-31 at 07:21It was a bit difficult, but to solve this problem:
- First it was necessary to find the element which listens to user events which trigger this behaviour, by using Ctrl-Shift-C on YouTube player's element and then adding "pointer-events: 'none'" to its parent elements' CSS, until it disables this functionality.
- The element that was listening for the events can be selected with
document.querySelector('ytd-page-manager #player-container');
(it turns out there are multiple elements withplayer-container
id on YouTube). - Then we get event listeners for this element by typing "getEventListeners(temp1)" in Chrome developer console (where temp1 is the 'ytd-page-manager #player-container' element after right clicking and choosing "store as a global variable")
- Then we add our own event listener with Capture:true and stop immediate propagation for these events (it was enough to do for the "pointerdown" event)
So after the page has loaded the code would be
QUESTION
On GitLab, you can browse and download job artifacts at annoyingly redirected URLs like these:
- https://gitlab.com/NatoBoram/eldarya-enhancements/-/jobs/artifacts/master/browse/dist?job=deploy
- https://gitlab.com/NatoBoram/eldarya-enhancements/-/jobs/artifacts/master/file/dist/eldarya-enhancements.min.user.js?job=deploy
- https://gitlab.com/NatoBoram/eldarya-enhancements/-/jobs/artifacts/master/raw/dist/eldarya-enhancements.min.user.js?job=deploy
I can use these URLs as a download link in the release page. However, I'm distributing a userscript; users do not want to download them, they want to view them (so TamperMonkey and Greasemonkey can install them).
How do I make it so users can install a userscript from an arbitrary branch/tag/commit without quitting GitLab?
...ANSWER
Answered 2021-Oct-29 at 06:00Unfortunately this is not supported for gitlab.com since workhorse always sets the content disposition as 'attachment' for artifacts, causing the browser to download the file. The only cases where the content disposition header is set as 'inline' is when viewing blobs.
Your best possible workaround would be to commit your built files to the repository (or another repository/snippets) and use the raw view. Conveniently, project snippets are basically a repository within a repository you can use for this purpose.
For example, you can use the project snippets API in your pipeline to create a snippet containing your user scripts, then use the snippet raw URL in your release. I tested this as working with tampermonkey.
Another possible workaround may be to host your files on GitLab pages, but each publish to GitLab pages will overwrite the previous publish, so you'll have to download all your previous artifacts and re-publish them every time if you want to support all your branches/tags.
This may also prove problematic, as concurrent pipelines (like a tag+branch pipeline) may have race-conditions unless you guard them with resource groups.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tampermonkey
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page