Never been to CodeSnippets 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!)

TDZK Accesskeys (See related posts)

// ==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);
})();


You need to create an account or log in to post comments to this site.