[gen] Bugfixes for IE8.

This commit is contained in:
Gaetan Delannay 2013-02-22 09:54:23 +01:00
parent 070e5042fd
commit cf707cd122

View file

@ -34,13 +34,13 @@ function setLoginVars() {
var isIe = (navigator.appName == "Microsoft Internet Explorer"); var isIe = (navigator.appName == "Microsoft Internet Explorer");
function getElementsHavingName(name) { function getElementsHavingName(tag, name) {
if (!isIe) return document.getElementsByName(name); if (!isIe) return document.getElementsByName(name);
var tables = document.getElementsByTagName('table'); var elems = document.getElementsByTagName(tag);
var res = new Array(); var res = new Array();
for (var i=0; i<tables.length; i++) { for (var i=0; i<elems.length; i++) {
var nameAttr = tables[i].attributes['name']; var nameAttr = elems[i].attributes['name'];
if (nameAttr && (nameAttr.value == name)) res.push(tables[i]); if (nameAttr && (nameAttr.value == name)) res.push(elems[i]);
} }
return res; return res;
} }
@ -81,7 +81,7 @@ function getAjaxChunk(pos) {
xhrObjects[pos].onGet(xhrObjects[pos], hookElem); xhrObjects[pos].onGet(xhrObjects[pos], hookElem);
} }
// Eval inner scripts if any. // Eval inner scripts if any.
var innerScripts = document.getElementsByName("appyHook"); var innerScripts = getElementsHavingName('div', 'appyHook');
for (var i=0; i<innerScripts.length; i++) { for (var i=0; i<innerScripts.length; i++) {
eval(innerScripts[i].innerHTML); eval(innerScripts[i].innerHTML);
} }
@ -223,7 +223,7 @@ function toggleCheckbox(visibleCheckbox, hiddenBoolean) {
function setSubTitles(value) { function setSubTitles(value) {
createCookie('showSubTitles', value); createCookie('showSubTitles', value);
// Get the sub-titles // Get the sub-titles
var subTitles = document.getElementsByName('subTitle'); var subTitles = getElementsHavingName('div', 'subTitle');
if (subTitles.length == 0) return; if (subTitles.length == 0) return;
for (var i=0; i < subTitles.length; i++) { for (var i=0; i < subTitles.length; i++) {
if (value == 'true') subTitles[i].style.display = 'block'; if (value == 'true') subTitles[i].style.display = 'block';
@ -290,7 +290,7 @@ function getMasterValues(master) {
function getSlaves(master) { function getSlaves(master) {
// Gets all the slaves of master. // Gets all the slaves of master.
allSlaves = getElementsHavingName('slave'); allSlaves = getElementsHavingName('table', 'slave');
res = []; res = [];
masterName = master.attributes['name'].value; masterName = master.attributes['name'].value;
if (master.type == 'checkbox') { if (master.type == 'checkbox') {
@ -333,7 +333,7 @@ function updateSlaves(master, slave) {
function initSlaves() { function initSlaves() {
// When the current page is loaded, we must set the correct state for all // When the current page is loaded, we must set the correct state for all
// slave fields. // slave fields.
slaves = getElementsHavingName('slave'); slaves = getElementsHavingName('table', 'slave');
i = slaves.length -1; i = slaves.length -1;
while (i >= 0) { while (i >= 0) {
masterName = getSlaveInfo(slaves[i], 'masterName'); masterName = getSlaveInfo(slaves[i], 'masterName');