I'm trying to mess around with Tampermonkey, and started by creating a script that auto inputs "&level_max=" into the giveaway filter to hide the higher-level GAs. My script makes pages take longer to load and doesn't auto-detect level. Help? :)

// ==UserScript==

// @run-at          document-start
// @name         SG Level Auto-Set
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Auto-inputs your level maximum to the GA filter.
// @author       rred
// @match           *://www.steamgifts.com/giveaways/*
// @grant        none
// ==/UserScript==

(function() {
    var level=3;
    // Your code here...
    if(! (window.location.href.indexOf("&level_max=")>=0) ){
         window.location=window.location.href+("&level_max="+level);
    }
})();
10 years ago*

Comment has been collapsed.

Not sure about your codes, but all my scripts are in this format (provided jQuery is present, which SG has already included).

$(document).ready(function() {
    // scripts here
});

Hope this helps.

10 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 6 years ago.

10 years ago
Permalink

Comment has been collapsed.

Wait so Wizards are just male witches?

10 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 7 years ago.

10 years ago
Permalink

Comment has been collapsed.

Katawa Shoujo, eh.

10 years ago
Permalink

Comment has been collapsed.

Are warlocks witches?

10 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 7 years ago.

10 years ago
Permalink

Comment has been collapsed.

Why use a script when you can use "steamgifts.com/giveaways/search?level_min=2&level_max=3" for example?

10 years ago
Permalink

Comment has been collapsed.

I can't help you with the script, but I wanted to let you know that witches are not female equivalents of wizards. Wizards and witches practice different kinds of magic and for different reasons. I think you can use the word "wizard" for females as well, or you could use "wizardess".

10 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 6 years ago.

10 years ago
Permalink

Comment has been collapsed.

You can get the level with this:

parseInt(document.querySelector('a.nav__button[href*="/account"]').children[1].title).toString()

And you can hide giveaways above your level in the settings.
But if you want to do a script like this you could also add something like this to it:

level = parseInt(document.querySelector('a.nav__button[href*="/account"]').children[1].title).toString();
element = document.links
for (var i=0; i<element.length; i++){
   if(!!element[i].href.match(/\/giveaways\/.+\?/)){
      element[i].href+="&level_max="+level;
   }
}

So the hrefs from an oppened page will already have &level_max (just the ones that are /giveaways/ and have a ? on it, like https://www.steamgifts.com/giveaways/search?page=3).

10 years ago*
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 6 years ago.

10 years ago
Permalink

Comment has been collapsed.

I looked at that topic before posting, but I misunderstood what they said in that part.
ty.

10 years ago
Permalink

Comment has been collapsed.

I tried your script. It is working fine for me.

10 years ago
Permalink

Comment has been collapsed.

Sign in through Steam to add a comment.