Skip to content

Instantly share code, notes, and snippets.

@Amzd
Created April 26, 2019 08:37
Show Gist options
  • Save Amzd/0fd754ac26e3f51202a65bbc9ffd4008 to your computer and use it in GitHub Desktop.
Save Amzd/0fd754ac26e3f51202a65bbc9ffd4008 to your computer and use it in GitHub Desktop.
Adds delete all players button
// ==UserScript==
// @name Tracker Network Clear Session
// @namespace https://rocketleague.tracker.network
// @version 0.1
// @description Share the session to a url
// @author You
// @match https://rocketleague.tracker.network/live*
// @grant none
// @run-at document-start
// @require http://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
$(function() {
'use strict';
$(".trn-livetracker .tools-menu").append('<a href="#" id="clear-session"><i id="copy-icon" class="ion ion-close"></i> Remove all players</a>')
$(document).on ("click", "#clear-session", function () {
var players = document.querySelectorAll('[id^="player-"]');
for (var i = 0; i < players.length; i++) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
var a = players[i].getElementsByClassName('card-tools')[0].getElementsByTagName("a");
a[a.length-1].dispatchEvent(evt);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment