Jump to content

UserScript not working

I have made a small script to add a random loadout selector to battlelog for BF4 (actually doing it to help a youtube channel's show work because the new menu system messed it up), but for some reason the code doesn't seem to run. The script is shown in my addons page (Firefox+grease monkey), and its included pages show the correct page, but for some reason the code doesn't run and the console.log command is never executed, let alone the rest of the code. I have tested it in Firebug and the script itself seems to work fine, but grease monkey doesn't seem to be injecting the code. Here is my code:

// ==UserScript==// @name		Battlelog Loadout Randomizer// @version		1.0.0// @author		Me// @description	Adds a Randomize Loadout button to the battlelog loadout selection screen to enable random loadout selection// @include		http://battlelog.battlefield.com/bf4/loadout/*// @include    	https://battlelog.battlefield.com/bf4/loadout/*// @grant       none// ==/UserScript==console.log("Here we go!");/*while(!$("#loadout-actions").length>0){    }*///This should delay the code from running until the content has been loaded over ajax, but I disabled it to rule out any possible conflicts$("#loadout-actions").prepend("<div id='loadout-randomizer' class='btn btn-small'>Randomize Loadout</div>");$("#loadout-randomizer").click(function(){var weapons = new Array($(".items-select-item:not(.locked)"));var selected = weapons[0][Math.floor(Math.random()*weapons[0].length)];var guid = $(selected).attr("data-guid");$("[data-guid='"+guid+"']").click();});});

If anyone can suggest a way to make the code work, and I think it's got something to do with the metadata, I will be very grateful :D

EDIT: Oh and according to Firebug the greasemonkey.js file has been loaded, but not the loadout_randomizer.user.js file, the contents of which are above

Edited by colonel_mortis

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×