Topic on Skin talk:Metrolook

The content links do not work.

3
Pneuma01 (talkcontribs)

The cause seems to be this javascipt error.

Uncaught TypeError: $(...).lastTabIndex is not a function

    at HTMLDocument.<anonymous> (<anonymous>:8:560)

    at mightThrow (load.php?lang=ja&modules=jquery&skin=metrolook&version=tqh7e:49)

    at process (load.php?lang=ja&modules=jquery&skin=metrolook&version=tqh7e:49)
Pneuma01 (talkcontribs)

When I looked into this problem, I found that the anchors work fine for English strings, but they seem to stop working for Unicode strings such as Japanese.

This is a great skin and I wanted to use it, but I'm a little disappointed.

Does anyone know how to solve this problem?

Thank you.

Pneuma01 (talkcontribs)

I added this code to MediaWiki:Metrolook.js and it worked.

$(function(){
	function hasDoubleByte(str) {
	    for (var i = 0, n = str.length; i < n; i++) {
	        if (str.charCodeAt( i ) > 255) { return true; }
	    }
	    return false;
	}
	/**********************************************************************************************
	 * Fix a bug where clicking on an title in the content did not scroll the screen to that section
	 */
	$(".tocnumber,.toctext").off("click").on("click",function(){
		if (hasDoubleByte(this.textContent)){
			var href = $(this).parent().attr("href");
			window.location.replace(href);
			setTimeout(function() {
				$('html, body').animate({
					scrollTop: '-=50'
				}, 200);
			},100);
		}
	});
	/**********************************************************************
	 * Fix the title being hidden in the menu when jumping to the anchor
	 */
	if(location.hash && window.scrollY < document.documentElement.scrollHeight - document.body.clientHeight){
		$('html, body').animate({
			scrollTop: '-=50'
		}, 200);
	}
});
Reply to "The content links do not work."