Skip to content

Instantly share code, notes, and snippets.

@Amzd
Last active April 25, 2019 15:10
Show Gist options
  • Save Amzd/5bbffee884b2388209d764a44a9db1f7 to your computer and use it in GitHub Desktop.
Save Amzd/5bbffee884b2388209d764a44a9db1f7 to your computer and use it in GitHub Desktop.
Share the session with a url
// ==UserScript==
// @name Tracker Network Share 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="share-session"><i id="copy-icon" class="ion ion-ios-copy"></i> Copy session url</a>')
$(document).on ("click", "#share-session", function () {
var ids = $('[id^="player-"]').map(function () {
return this.id.substring(7);
}).get();
var url = "https://rocketleague.tracker.network/live?ids=" + ids
navigator.clipboard.writeText(url).then(function() {
$("#copy-icon").removeClass("ion-ios-copy");
$("#copy-icon").addClass("ion-ios-checkmark");
setTimeout(function() {
$("#copy-icon").removeClass("ion-ios-checkmark");
$("#copy-icon").addClass("ion-ios-copy");
}, 1500);
}, function(err) {
alert("Couldn't copy, sorry? The url is: "+url)
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment