violentmonkey | Violentmonkey provides userscripts support for browsers | Browser Plugin library
kandi X-RAY | violentmonkey Summary
kandi X-RAY | violentmonkey Summary
Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Mongo API implementation .
- collect data from storage
- Makes a wrapper for global scope events .
- wrap the xhr - response callback
- Inject scripts into the page
- Make an http request .
- Inject a page sandbox sandbox
- Extract keys from files .
- Injects an item into a DOM .
- Make a meta info object .
violentmonkey Key Features
violentmonkey Examples and Code Snippets
Community Discussions
Trending Discussions on violentmonkey
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
In tampermonkey, advanced settings, you can find a setting called "Inject mode" at the "Expirimental" tab. Here, you can select a mode called "Instant".
I was wondering, what does it do different? How does it work? Is it simular to ViolentMonkeys injection methods?
...ANSWER
Answered 2021-Nov-11 at 12:53Judging by the source code in other extensions like Stylus or Violentmonkey (beta) that recently added the same feature:
- The background script makes a
Blob
in the background script with the data, gets its URL viaURL.createObjectURL
, puts it into aSet-Cookie
header via chrome.webRequest API. - The content script reads the URL from
document.cookie
and uses it in a synchronous XMLHttpRequest to get the original data synchronously.
This trick is based on an answer by Xan.
QUESTION
I use the following code in ViolentMonkey (or GreaseKit or TamperMonkey) to refresh a page every 30 seconds:
...ANSWER
Answered 2021-Aug-28 at 19:36You can read the .innerText
property of the body, then use String#includes
to see if your phrase is present.
If it is present you can return
out of the function to end the script.
Something like this:
QUESTION
I'm trying to create a simple script in ViolentMonkey to run on Letterboxd.com film pages - e.g. https://letterboxd.com/film/mirror/.
I'm aiming to remove certain elements from the page - namely, the average rating and the facebook share buttons.
My script looks like so:
...ANSWER
Answered 2021-Jan-26 at 22:32The problem here seems to be that the rating graph (incl. the average rating) is loaded asynchronous and thus is not present when your script runs.
In order to counter this, you could listen for changes of the parent .sidebar
element and then remove it as soon as it's present:
QUESTION
First attempt at a userscript, and despite finding numerous examples on the internet of how to remove elements from a page, none of them work (and this looks like one of the most basic applications of a userscript, too).
Using violentmonkey-2.12.8 on this page:
I want to remove the "exitModalOverlay" div (disabling it in the developer tools does exactly what I want), which blacks out the page (preventing me from reading it).
I will insert one of the more common techniques I have found (which doesn't work). I would appreciate any method which does. Thanks.
...ANSWER
Answered 2021-Jan-02 at 01:25Maybe so...
QUESTION
I want to stop a javascript .js to load on a specific website with greasemonkey/violentmonkey scrpit
...ANSWER
Answered 2020-Dec-26 at 06:33The second method below usually works but something seems to be interfering with it on your page for some reason. An ugly workaround is to put an empty hljs property on the window in advance, so that the page script, when run, thinks it already exists and does nothing:
QUESTION
I have been trying to migrate an userScript into my own extension but for some reason I am not able to run the following code:
...ANSWER
Answered 2020-Aug-01 at 10:29To start with, remove the glob as it can cause issues.
QUESTION
I'm new to greasemonkey and trying to understand how greasemonkey is different from the embedded web console. A simple script which works perfectly on web console does not work on greasemonkey, and I have no idea why.
EnvironmentsFirefox 74.0 on Arch Linux
Greasemonkey 4.9
Here is the test script I use:
...ANSWER
Answered 2020-Mar-28 at 18:15Web Console is part of browser scope while a GreaseMonkey script is injected into a page content and its scope it limited to that page only.
You can open a new tab/window from page content with GM but that window/tab will have its own page content scope which is separate from the first one. Therefore, you can not access properties belonging to another tab/window from a page content of different tab.
This separation is for all content scripts and not only for GM. Otherwise, it would have created a great security risk if JS in one tab/page could access data on other tabs.
Update:
As pointed out by wOxxOm, the CSP and cross-origin policy prevents Cross-Origin Resource Sharing (CORS).
In your example, in Firefox, the first issue is that Firefox will "Block pop-up windows" from the content script.
Testing Firefox dedicated userScripts API on FireMonkey, after allowing popup, still causes an error:
SecurityError: Permission denied to access property "onload" on cross-origin object
In this case, I believe it is due to the sandboxing of userScripts for security.
GM/TM/VM do not use the userScripts API and use other means to inject userSripts which results in different outcome.
QUESTION
I've been using a homemade greasemonkey scripts for ages on my laptop Firefox. It includes storing data with GM.setValue.
Now I just bought an Android tablet, and would like to be able to use this script and update the values, whereas I'm using the laptop or the tablet.
Hoped that Firefox Sync would handle that, but not even the scripts are synced.
I thought of synchronizing the script dans db files (Google drive, dropbox, whatever), but I realized that since the v4, the db that used to be in gm_scripts is gone, and I have no idea where Greasemonkey stores either the scripts or their associated database now.
I'm looking for anything that might make it work.
1) Is there a way to handle that with Firefox Sync ?
2) Would an alternative (Tampermonkey, Violentmonkey, ?) handle that better ?
3) Where can I find the scripts/database in the new Greasemonkey system ?
4) Could I synchronize them via Google drive ? (There seem to be some hacks to sync a file between machines)
5) Would there be a simple, free alternative that would allow me to synchronize a very small file between machines ?
=============================================== Update on this:
I tried TamperMonkey instead, it has a sync feature but even if it seems ok on different laptops or my phone, the syncing is random at best on the tablet.
Also realized that only scripts are synced, and not their data. The script almost never changes, but the data is updated several times a day, so not really a solution anyway.
Data doesn't exist anymore in a readable file format, so no luck either on syncing the data file externally.
TamperMonkey has also an import/export feature, this does take the data into account. So the best I can do for now is thinking about exporting then importing every time I switch device. Not ideal so still in search of a better solution.
...ANSWER
Answered 2020-Feb-03 at 05:57Represents the sync storage area. Items in sync storage are synced by the browser, and are available across all instances of that browser that the user is logged into (e.g. via Firefox sync, or a Google account), across different devices.
There are limitations with sync.
- Sync requires login
- Up to 100kb can be synced and more than that fails
- Storage sync usually syncs the entire extension storage and in case of user-script managers, they are often larger than 100kb as they include the user-scripts as well
- Data is stored elsewhere (not on your computer) which can have security/privacy concerns
- Storage read/write requires internet access and longer times due to remote data storage
- Extension must have the sync option
1) Is there a way to handle that with Firefox Sync ?
Yes but depends on aforementioned. While Firefox sync doesn't appear to have the 100kb limit, syncing the entire Firefox takes longer (How do I set up Sync on my computer?).
2) Would an alternative (Tampermonkey, Violentmonkey, ?) handle that better ?
Greasemonkey: No sync feature
Tampermonkey: Sync to Dropbox, Google Drive, or a WebDAV service
Violentmonkey: Sync to Dropbox, OneDrive, Google Drive, or a WebDAV service
Firemonkey: No sync feature
TM/VM 3rd party storage sync allows storage of more than 100KB. However, using 3rd party storage allows 3rd party tracking which is a privacy consideration. The storage read/write operation is also a lot slower.
3) Where can I find the scripts/database in the new Greasemonkey system ?
Since Firefox 57, extensions can not save files to the HD and the only storage area is the extension storage which is not accessible as before.
4) Could I synchronize them via Google drive ? (There seem to be some hacks to sync a file between machines)
Refer to above
5) Would there be a simple, free alternative that would allow me to synchronize a very small file between machines ?
That depends on the set-up and how often data is changed.
For example, if data is not often changed, especially if the data privacy is imperative, there is the backup export/import option (script + data). Therefore, the extension data can be saved to a USB flash drive and loaded anywhere (suitable for shared environment).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install violentmonkey
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