Hoppa till innehållet

MediaWiki-diskussion:Gadget-UppladdningarContentSub.js

Sidans innehåll stöds inte på andra språk.
Från Wikipedia

Experiment with ContentTranslation[redigera wikitext]

Hi,

We are experimenting with the ContentTranslation feature here. This script breaks it: ContentTranslation doesn't show any of the usual toolbars, so #contentSub and str are undefined.

Can you please make it conditional? For example, if it's undefined, just return from the function? Something like:

$( function() {
	var str,
		$contentSub = $( '#contentSub' );

	if ( $contentSub.length === 0 ) {
		return;
	}

	str = $contentSub.html();
	$contentSub.html( str.replace( /<[^<>]+>Uppladdningar<\/a> \| /, "" ) );
} );

To try whether it works, enable the ContentTranslation beta feature and go to Special:ContentTranslation.

Thanks a lot! --Amir E. Aharoni (diskussion) 3 mars 2015 kl. 16.37 (CET)[svara]

I have enabled the beta feature and disabled the gadget, but I can't see anything that's broken. EnDumEn? Nirmos (diskussion) 4 mars 2015 kl. 05.08 (CET)[svara]
Did you try going to Special:ContentTranslation? When I have the gadget enabled and I go there, I see a blank screen. --Amir E. Aharoni (diskussion) 4 mars 2015 kl. 08.28 (CET)[svara]
I'm sorry. I see how stupid my previous comment is now. I've changed to your code. Nirmos (diskussion) 4 mars 2015 kl. 08.52 (CET)[svara]
No problem, thank you! --Amir E. Aharoni (diskussion) 10 mars 2015 kl. 23.52 (CET)[svara]