Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Userscript 

How To Make Your Own Userscripts!

Since you're already using GM_config, you can also implement GM_SuperValue like this:
PHP Code

<?php 
var GM_SuperValue = new function () {
  
this.set = function(name, val) {
    
GM_config.setValue(name, GM_config.stringify({'val': val}));
  };

  
this.get = function(name, def) {
    var 
rval = GM_config.getValue(name, def);
    return 
rval === def ? rval : GM_config.parser(rval).val;
  };
}; 

It has the advantage of working in user script environments that don't have GM_setValue/GM_getValue. GM_config uses localStorage as a fallback and will run in pretty much any modern browser (in fact, here is a web page that it runs on without any modification). The only downside of using the above code is that you can't store functions, but that only works in Firefox (last time I checked) and I don't know why the hell you'd want to do that anyway.
Amazing very high quality guide here, will be using it tomorrow with my first attempt at a user script. Thanks for the tutorial!


I'm working to understand bases, luckily in this section there's not too activity and a lot of help is provided :)
Not sure if I've posted on this or nah, but I just want to get this back to the top of threads because it is truly an amazing resource.
I'll be using this thread VERY soon. I might even turn it into video format :)
I honestly don't understand why that thread isn't stickied yet 😯
Probably one of the most detailled, in-depth tutorial I've seen in that section.
Fiat justitia ruat cælum

My era of providing technical support and malware removal on HackForums is over, so you can stop PM'ing me about it. Sorry.
I wish I had seen that before. Very good and detailed tutorial!
I subscribed the hell out of this thread, so I can check up on it later to understand userscript more, so thank you for this man this is awesome! <3 [Image: 1f44d.png?v7]
(Feb 3, 2017 12:38 AM)xadamxk Wrote:  Would anyone be interested if I made a more beginner friendly guide?

I would. Also, make Beginner to Advance scripting tutorials.
kitty had a snack
(May 24, 2019 12:28 PM)xadamxk Wrote:  Still down for that?
I'd like to have a course on it but it would require some basic understanding of web dev.

I would definitely read the guides but I don't have time to enroll in a course at this moment.
kitty had a snack


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Hash G.Sep 5, 2016 02:18 AM 6 286 Sep 5, 2016 02:18 AM
Last Post: Frukt
[Userscript] by mrnapolean1May 10, 2016 04:57 PM 11 376 May 10, 2016 04:57 PM
Last Post: mrnapolean1
by RemixNov 11, 2015 10:18 PM 14 421 Nov 11, 2015 10:18 PM
Last Post: Atharva