summaryrefslogtreecommitdiff
path: root/skins/common/upload.js
blob: 160fbf27a289bec743cdd2387d4f6d94339dba1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function licenseSelectorCheck() {
	var selector = document.getElementById("wpLicense");
	if (selector.selectedIndex > 0 &&
		selector.options[selector.selectedIndex].value == "" ) {
		// Browser is broken, doesn't respect disabled attribute on <option>
		selector.selectedIndex = 0;
	}
}

function licenseSelectorFixup() {
	// for MSIE/Mac; non-breaking spaces cause the <option> not to render
	// but, for some reason, setting the text to itself works
	var selector = document.getElementById("wpLicense");
	var ua = navigator.userAgent;
	var isMacIe = (ua.indexOf("MSIE") != -1) && (ua.indexOf("Mac") != -1);
	if (isMacIe) {
		for (var i = 0; i < selector.options.length; i++) {
			selector.options[i].text = selector.options[i].text;
		}
	}
}

addOnloadHook(licenseSelectorFixup);