Youtube Persist Worldwide

By Burn Last update Dec 4, 2011 — Installed 8,056 times.

code

in
Subscribe to code 3 posts, 2 voices



Avindra V.G. Scriptwright
FirefoxWindows

document.body==document.getElementsByTagName('body')[0]

 
Burn Script's Author
FirefoxMacintosh

thanks, I've updated my code.

 
Avindra V.G. Scriptwright
FirefoxWindows

Additionally, you can do:

	var lang = document.body.className.substr(0,5), stri="";
	//GM_log(lang);
	switch (lang) {

instead of:

	var lang = document.body.className.toString();
	lang = lang.substr(0,5);
	//GM_log(lang);
	var stri = "";
	switch (lang) {

The XPath part can be condensed too:

	var hrefs = document.evaluate(".//strong[@class='region-title']",document.body,null,6,null);
	for (var i=hrefs.snapshotLength - 1;i>=0;--i) {	
		var l = hrefs.snapshotItem(i);
		if (l.textContent.toLowerCase() != stri) {
			//GM_log('OK textContent found: ' + l.textContent + " - stri: "+ stri);
			if (stri != "") {
				YTselectI18n('US', 'gl');
				//GM_log('Worldwide contents ok!');
				break;	
			}
		}  //else GM_log('textContent not found: ' +  l.textContent);
	}

(backwards loop = faster).

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel