Skip to content

Instantly share code, notes, and snippets.

@moritz
Last active May 31, 2018 15:38
Show Gist options
  • Select an option

  • Save moritz/97aa186cd99daee2b63c82bc9a20bb5a to your computer and use it in GitHub Desktop.

Select an option

Save moritz/97aa186cd99daee2b63c82bc9a20bb5a to your computer and use it in GitHub Desktop.
Tau station navigation extension
// ==UserScript==
// @name taustation_extended_nav
// @namespace https://github.com/moritz/
// @description Navigationi extension for taustation.space
// @match https://alpha.taustation.space/*
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
function gs_taustation_enhance() {
$('#game_navigation_areas a[href="/travel/area/inn"]').parent('li').after('<li class="area "> <a style="padding-left: 2em" href="/travel/area/bar">Bar</a> / <a href="/area/hotel-rooms/enter-room">Room</a> / <a href="/travel/area/lounge">Lounge</a> </li>');
$('#game_navigation_areas a[href="/travel/area/market"]').parent('li').after('<li class="area "> <a style="padding-left: 2em" href="/travel/area/vendors">Vendors</a> / <a href="/travel/area/storage">Storage</a> / <a href="/travel/area/electronic-market">Public</a> </li>');
$('#game_navigation_areas a[href="/travel/area/port"]').parent('li').after('<li class="area "> <a style="padding-left: 2em" href="/travel/area/shipping-bay">Shipping</a> / <a href="/travel/area/docks">Docks</a> / <a href="/travel/area/local-shuttles">Shuttles</a> </li>');
// The following line removes the "bonds to credits" conversion option in the bank, if you remove the // at the start
// $('.bond-to-credits').hide();
// bribe for rations:
// $('a.btn-buy-rations').hide();
// CORETECHS learning enhancer (Hotel Room):
// $('form.coretechs-learning-enhancer').hide();
// Personal Trainer (Gym)
// $('.personal-trainer').hide();
// Buy a Round (Lounge)
// $('.buy-a-round').hide();
// Express shuttles (might have some undesired side effects, so use with caution):
// $('.shuttle-schedule-t').parent('div').hide()
}
//document.addEventListener('DOMContentLoaded', gs_taustation_enhance, false);
$(document).ready(gs_taustation_enhance);
@dot-sent
Copy link

dot-sent commented May 28, 2018

Another ugly script, for compactifying info in the left column:

function taustation_compact_stats() {
    $('<div class="collapsed-info-1 player-info--row"><div class="player-info--col--1-of-2"></div><div class="player-info--col--2-of-2"></div></div>' +
     '<div class="collapsed-info-2 player-info--row"><div class="player-info--col--1-of-2"></div><div class="player-info--col--2-of-2"></div></div>' +
     '<div class="collapsed-info-3 player-info--row"><div class="player-info--col--1-of-1"></div></div>').insertAfter('.player-info--row--player');
		var current_row = $('.collapsed-info-3').next();
    for (var i=0; i<4; i++){
        current_row.hide();
        current_row = current_row.next();
    }
  	$('.bonds-text').hide();
    $('.player-info--icon').attr('height', 19).attr('width', 19);
    $('.level-container').detach().appendTo('.collapsed-info-1 .player-info--col--1-of-2').attr('style', 'border-left: none;');
    $('.credit-container').detach().appendTo('.collapsed-info-1 .player-info--col--2-of-2').attr('style', 'border-left: none;');
    $('.experience-container').detach().attr('style', 'padding-left: .563em; padding-right: .563em;').appendTo('.collapsed-info-2 .player-info--col--1-of-2');
    $('.bonds-container').detach().appendTo('.collapsed-info-2 .player-info--col--2-of-2').attr('style', 'border-left: none;');
    $('.toxins-container').detach().appendTo('.collapsed-info-3 .player-info--col--1-of-1').attr('style', 'border-left: none;');

    var stat_labels = { 'strength': 'STR', 'agility': 'AGI', 'stamina': 'STA', 'intelligence': 'INT', 'social': 'SOC' };
    var info_line = '<table class="collapsed-stats"><tbody><tr><td colspan="6">Unit(s) to next tick: <span id="units_to_next_tick">???</span></td></tr><tr>';
    var info_type = ' physical';
  	for (var stat in stat_labels){
        info_line += '<td>' + stat_labels[stat] + '</td><td class="collapsed-stat-value' + info_type + ' ' + stat + '">' + $('.' + stat + ' .pc')[0].innerHTML + '%</td>';
        if (stat == 'stamina'){ // Line break - ugly, I know
            info_line += '</tr><tr>';
            info_type = ' mental';
        }
    }
    info_line += '<td>F</td><td class="collapsed-stat-value focus">' + $('.focus .percentage')[0].innerHTML + '</td></tr></tbody></table>';
    var units_to_update = null;
    setInterval(function(){
        if (units_to_update != null) {
            units_to_update -= 1;
            if (units_to_update < 0){
                units_to_update = null;
                $('#units_to_next_tick')[0].innerHTML = "0 (stats full)";
            } else {
                $('#units_to_next_tick')[0].innerHTML = units_to_update;
            }
        }
        for (var stat in stat_labels){
            var cur_val = $('.' + stat + ' .pc')[0].innerHTML + '%';
            if (cur_val != $('.collapsed-stat-value.' + stat)[0].innerHTML){
                $('.collapsed-stat-value.' + stat)[0].innerHTML = cur_val;
                units_to_update = 347; // 5 minutes to units
            }
        }
        var focus_value = $('.focus .percentage')[0].innerHTML;
        if ($('.collapsed-stat-value.focus')[0].innerHTML != focus_value){
            $('.collapsed-stat-value.focus')[0].innerHTML = focus_value;
                units_to_update = 347; // 5 minutes to units
        }
    }, 864);
    $('<div class="player-info--row">' + info_line + '</div>').insertBefore($('.player-stats'));
    $('.player-stats').hide();
    $('.collapsed-stats').mouseenter(function(){
        $('.player-stats').show();
    }).mouseleave(function(){
        $('.player-stats').hide();
    });
    $('.employment-title').hide();
    var employment_link_titles = {
      '/mission': 'Mission | ',
      '/travel/area/discreet-work': 'Discreet | ',
      '/travel/area/side-jobs': 'Side jobs | ',
      '/career': 'Career'
    };
    var employment_links = $('#employment_panel a');
    for (var emp_link in employment_link_titles){
        $('#employment_panel a[href="' + emp_link + '"]')[0].innerHTML = employment_link_titles[emp_link];
    }
    $('<div class="employment-links" style="padding-left: .563em; padding-top: .563em; padding-bottom: .563em;"></div>').appendTo('#employment_panel');
    $('#employment_panel a').detach().appendTo('div.employment-links');
    $('#employment_panel ul.list-reset').hide();
}

@moritz
Copy link
Author

moritz commented May 31, 2018

@duelafn I've created a separate repository for user scripts; would you care to add your snippet as a script there? I think that scales better than comments on gist :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment