Whether these work will of course depend on whether your Javascript is running in page scope or sandboxed. I haven't done user script work in years so I don't know whether this post will actually apply to anyone...
App.AddBinder(callback);
The callback will be called any time anything makes a change to the DOM with the only argument being the node that should be bound. You can use this to, for example, do something with comments when the comment page is changed.
Whether these work will of course depend on whether your Javascript is running in page scope or sandboxed. I haven't done user script work in years so I don't know whether this post will actually apply to anyone...
Running it in page scope is the default these days, because it simplifies interacting with site JavaScript APIs as sites become more and more AJAXy, so they should be fairly useful to people.
5981374 That's good to know then. Ideally I'd say everyone should try and stay away from including jQuery in their scripts. The difference we've seen in performance due to me rewriting the codebase is truly staggering. It's even easier to write user scripts with native JS too because you don't have to worry about supporting crappy browsers like I do 😛
*nod* If I can ever find time to go through my old scripts and bring them up to spec (test suites and TypeScript rewrites), I'll definitely be replacing jQuery with use of modern APIs.
As-is, I'm just glad that all of my fimfic tweaks were made as Userstyles specifically to give the browser maximum ability to optimize for performance.
When I first discovered jQuery, everyone was seemingly prasing as the best thing since sliced bread. Now everyone says to stay away from it as much as you can. Longevity certainly isn't a thing in the world of IT.
5981779 jQuery's still good if your requirements are extreme compatibility and legacy support. Fimfiction isn't a government website though and that means we can logically drop support for a lot of those old browsers which frees us up to use much more performant native Javascript. Also Javascript is just way more fleshed out and more powerful nowadays than it used to be.
Whether these work will of course depend on whether your Javascript is running in page scope or sandboxed. I haven't done user script work in years so I don't know whether this post will actually apply to anyone...
The callback will be called any time anything makes a change to the DOM with the only argument being the node that should be bound. You can use this to, for example, do something with comments when the comment page is changed.
You can use this to bind an event a dom element higher in the tree to avoid needing to bind on the element itself. For example you could use:
To output the href of any link that is clicked. There's a lot of other jQuery type functions as well in there you can use.
Ajax Requests are simple enough too.
If you need any help with any of the fQuery stuff I can help answer, but it should avoid the desire for using jQuery in general.
Running it in page scope is the default these days, because it simplifies interacting with site JavaScript APIs as sites become more and more AJAXy, so they should be fairly useful to people.
5981374
That's good to know then. Ideally I'd say everyone should try and stay away from including jQuery in their scripts. The difference we've seen in performance due to me rewriting the codebase is truly staggering. It's even easier to write user scripts with native JS too because you don't have to worry about supporting crappy browsers like I do 😛
5981429
*nod* If I can ever find time to go through my old scripts and bring them up to spec (test suites and TypeScript rewrites), I'll definitely be replacing jQuery with use of modern APIs.
As-is, I'm just glad that all of my fimfic tweaks were made as Userstyles specifically to give the browser maximum ability to optimize for performance.
When I first discovered jQuery, everyone was seemingly prasing as the best thing since sliced bread. Now everyone says to stay away from it as much as you can. Longevity certainly isn't a thing in the world of IT.
5981779
jQuery's still good if your requirements are extreme compatibility and legacy support. Fimfiction isn't a government website though and that means we can logically drop support for a lot of those old browsers which frees us up to use much more performant native Javascript. Also Javascript is just way more fleshed out and more powerful nowadays than it used to be.