Skip to content

Instantly share code, notes, and snippets.

@bash-tp
Last active May 20, 2019 03:41
Show Gist options
  • Save bash-tp/baab15b87a5811476426dcb00c414915 to your computer and use it in GitHub Desktop.
Save bash-tp/baab15b87a5811476426dcb00c414915 to your computer and use it in GitHub Desktop.
TagPro Map Name Display
// ==UserScript==
// @name TagPro Map Name Display
// @version 1.2
// @author bash#
// @namespace http://www.reddit.com/user/bash_tp/
// @description Shows the name of the current map above the clock
// @include *://*.koalabeast.com*
// @include *://*.jukejuice.com*
// @include *://*.newcompte.fr*
// @updateURL https://gist.github.com/bash-tp/baab15b87a5811476426dcb00c414915/raw/tagpro_map_name_display.user.js
// @downloadURL https://gist.github.com/bash-tp/baab15b87a5811476426dcb00c414915/raw/tagpro_map_name_display.user.js
// ==/UserScript==
tagpro.ready(function() {
var map_name;
var map_author;
var text_name;
var text_author;
function update_text() {
if (!text_name) {
text_name = new PIXI.Text(map_name, { fontSize: "10pt", strokeThickness: 3, fill: "#ffffff", fontWeight: "bold" });
text_author = new PIXI.Text('by ' + map_author, { fontSize: "8pt", strokeThickness: 3, fill: "#ffffff", fontWeight: "bold" });
text_name.anchor.x = 0.5;
text_author.anchor.x = 0.5;
tagpro.renderer.layers.ui.addChild(text_name);
tagpro.renderer.layers.ui.addChild(text_author);
}
var vp = $("#viewport");
text_name.x = vp.width() / 2;
text_name.y = vp.height() - 90;
text_author.x = vp.width() / 2;
text_author.y = vp.height() - 70;
}
tagpro.socket.on('map', function(e) {
if (map_name) {
return;
}
map_name = e.info.name;
map_author = e.info.author;
update_text();
});
$(window).resize(function() {
update_text();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment