Discussões » Feedback do Greasy Fork
How Greasy Fork's script button being dynamic?
install.js https://pastebin.com/27DneanG
micromodal.js https://pastebin.com/yAhuhSws
I think this part
import { canInstallUserJS, canInstallUserCSS } from "./managers";
is the most important one
managers.js https://pastebin.com/WMJiBddk
install.js https://pastebin.com/27DneanG
micromodal.js https://pastebin.com/yAhuhSws
I think this part
import { canInstallUserJS, canInstallUserCSS } from "./managers";
is the most important one
managers.js https://pastebin.com/WMJiBddk
Thanks!!! I found that how it works.
window.external.Violentmonkey
OR window.external.Tampermonkey
is an object with string version
and function isInstalled
.
isInstalled
requires two string parameters (name
and namespace
) and return a Promise.
window.external.Violentmonkey.isInstalled("YouTube CPU Tamer by AnimationFrame","http://tampermonkey.net/").then(r=>console.log(r))
It will give the version code of the installed script, or null
if not installed.
@CY Fung
Please give me the shortest possible code to achieve that, I will love to see it working in a simple way, and in a single script. I was too lazy to read everything, understand it, then code it. But I am very interested in your project!
How this works? Might I ask how to interact with the UserScript manager in Greasy Fork?
I am thinking to write a UserScript to detect whether a script is installed or not in the search list page.