Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

TDZK Accesskeys

// ==UserScript==
// @name          Dreams
// @description   Sets new TDZK accessKeys
// @include       *
// ==UserScript==

(function() {
        function $(id) { return document.getElementById(id) }
        function $$(parent, childs) { return parent.getElementsByTagName(childs) }
        
        window.addEventListener("load", function() {
                // Dock
                as = $$(document, 'a');
                for (i=0; i<as.length; i++) {
                        temp = as[i].href.split("?")
                        if (temp[0] == 'http://nomad.tdzk.com/station/reqDock') {
                                as[i].accessKey = "x"
                        }
                }
                
                // Trade goods
                if ($('tradeform')) {
                        rows = $$($$($('tradeform'), 'tbody')[0], 'tr');
                        for (i=0; i<rows.length; i++) {
                                row = rows[i]
                                accessKeyToAdd = ((i+1) == 10) ? '/' : ((i+1) == 11) ? '*' : ((i+1) == 12) ? '-' : (i+1);
                                rowa = $$(row, 'a')
                                if (rowa[0]) {
                                        rowa[0].accessKey = accessKeyToAdd
                                }
                        }
                }
        }, false);
})();

TDZK Accesskeys

// ==UserScript==
// @name          Dreams
// @description   Sets new TDZK accessKeys
// @include       *
// ==UserScript==

(function() {
        function $(id) { return document.getElementById(id) }
        function $$(parent, childs) { return parent.getElementsByTagName(childs) }
        
        window.addEventListener("load", function() {
                // Dock
                as = $$(document, 'a');
                for (i=0; i<as.length; i++) {
                        temp = as[i].href.split("?")
                        if (temp[0] == 'http://nomad.tdzk.com/station/reqDock') {
                                as[i].accessKey = "x"
                        }
                }
                
                // Trade goods
                if ($('tradeform')) {
                        rows = $$($$($('tradeform'), 'tbody')[0], 'tr');
                        for (i=0; i<rows.length; i++) {
                                row = rows[i]
                                accessKeyToAdd = ((i+1) == 10) ? '/' : ((i+1) == 11) ? '*' : ((i+1) == 12) ? '-' : (i+1);
                                rowa = $$(row, 'a')
                                if (rowa[0]) {
                                        rowa[0].accessKey = accessKeyToAdd
                                }
                        }
                }
        }, false);
})();

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed