zackad / Uptobox - Add to my account

// ==UserScript==
// @name        Uptobox - Add to my account
// @namespace   zackad's script
// @include     http://uptobox.com/*
// @include     https://uptobox.com/*
// @version     0.1.2
// @grant       none
// ==/UserScript==

$(document).ready(function() {
    if ($('.menu a[href$="logout"]').length > 0) {
        var fileId = window.location.pathname.toString().replace('/', '');
        var protocol = window.location.protocol;
        var randomId = 'am' + Math.ceil(Math.random() * 1000000000);
        var url = protocol + '//uptobox.com/?op=my_files&add_my_acc=' + fileId;
        var link = '<a href="#" onclick="return jah(\'' + url + '\',\'' + randomId + '\')" class="blue_link">Add to my Account</a>';
        var button = '<small id="' + randomId + '">' + link + '</small>';
        if ($('.tos small').length == 0) {
            $('.tos').append(button);
        }
    }
});