[wp-hackers] Start of new themes page

David House dmhouse at gmail.com
Thu Jun 2 11:13:08 GMT 2005


On 5/29/05, David House <dmhouse at gmail.com> wrote:
> Would something like the attached work? I haven't tested it but it
> seems simple enough.

As it turns out, no it wouldn't :) I've fixed some bugs in my code, so
the attached code should now work. Just tack it on to the end of
/extend/themes/theme-scroll.js. It still doesn't smoothScroll to the
hashed theme, but that's a deliberate design decision and my rationale
still stands from my previous email.

-- 
-David House, dmhouse at gmail.com, http://xmouse.ithium.net
-------------- next part --------------
// allow /extend/themes/#foo to act as if the link for theme 'foo' had be clicked
function autoScrollToTheme() {
	//if there's a hash, copy that has to the themes frame
	if (window.location.hash) {
		frames['themes'].window.location.hash = window.location.hash;
	}
	
	//highlight the link for the selected theme
	els = document.getElementsByTagName('a');
	for (var i = 0; i < els.length; i++) {
		var thishref = els.item(i).getAttribute('href');
		if (thishref.indexOf(window.location.hash) != -1 && 
			thishref.indexOf(window.location.hash) == (thishref.length - window.location.hash.length))
			highlightLink(els.item(i));
	}
}

addEvent(window, 'load', autoScrollToTheme);


More information about the wp-hackers mailing list