violentmonkey / vm-url Goto Github PK
View Code? Open in Web Editor NEWAdd SPA support to your userscript.
Home Page: https://violentmonkey.github.io/vm-url/
License: MIT License
Add SPA support to your userscript.
Home Page: https://violentmonkey.github.io/vm-url/
License: MIT License
Ironically, it DOES work on Tampermonkey.
Simple script:
// ==UserScript==
// @name Test VM.url
// @match https://github.com/*
// @noframes
// @grant window.onurlchange
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/url
// ==/UserScript==
(() => {
VM.onNavigate(() => {
console.log('VM.onNavigate:', window.location);
});
if (window.onurlchange === null) {
console.log('Using TM');
window.addEventListener('urlchange', (info) => {
console.log('urlchange:', info, window.location);
});
}
console.log('loaded', window.location);
})();
In this configuration:
Userscript manager: Violentmonkey 2.15.0
Platform: firefox 117.0 linux x86-64
I get the following even after clicking to a new page:
loaded Location https://github.com/violentmonkey/vm-url
However, in this configuration:
Userscript manager: Tampermonkey 4.19.0
Platform: Firefox 117.0 Linux x86-64
I get multiple events after changing pages (I wasn't seeing multiples on another website, so I figure this is a GH thing):
Using TM
loaded Location https://github.com/violentmonkey/vm-url
VM.onNavigate: Location https://github.com/violentmonkey/vm-url
urlchange: Object { url: "https://github.com/violentmonkey/vm-url" } Location https://github.com/violentmonkey/vm-url
VM.onNavigate: Location https://github.com/violentmonkey/vm-url
VM.onNavigate: Location https://github.com/violentmonkey/vm-url/issues
urlchange: Object { url: "https://github.com/violentmonkey/vm-url" } Location https://github.com/violentmonkey/vm-url/issues
urlchange: Object { url: "https://github.com/violentmonkey/vm-url/issues" } Location https://github.com/violentmonkey/vm-url/issues
VM.onNavigate: Location https://github.com/violentmonkey/vm-url/issues
urlchange: Object { url: "https://github.com/violentmonkey/vm-url/issues" } Location https://github.com/violentmonkey/vm-url/issues
I also tried this on LinkedIn with similar results.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.