📄 html.js
字号:
var groups = resultXML.getElementsByTagName("groups")[0]; for (var i = 0; i < groups.childNodes.length; i++) { var id = groups.childNodes[i].getAttribute("id"); var nbPerson = groups.childNodes[i].getAttribute("nbPerson"); listeGroupes.innerHTML += '<li><a href="#" onclick="showGroup('+ id +');">'+ groups.childNodes[i].getAttribute("name") +'</a> ('+ nbPerson +')</li>'; } listeGroupes.innerHTML = '<ul>' + listeGroupes.innerHTML + '</ul>'; } else listeGroupes.innerHTML = problemXmlResult; return true;}/* * Show the form to change password */function getChgPasswdForm() { var content = document.getElementById("content"); content.innerHTML = '<form name="formPassword" id="formPassword" method="post" action="#">' + '<fieldset><legend>'+ lbl_change_password +'</legend>' + '<label for="password1">'+ lbl_new_password +' : </label>' + '<input type="password" id="password1" name="password1" value="" maxlength="16" /> *<br/>' + '<label for="password2">'+ lbl_password_confirmation +' : </label>' + '<input type="password" id="password2" name="password2" value="" maxlength="16" /> *<br/>' + '<input type="button" class="marginButtons" name="chgPassword" value="'+ action_update_password +'" onclick="changePassword();"/>' + '</fieldset></form>'; return true;}/* * Show a message after the password was changed * @param empty XML result, just to see if the password was changed */function getPasswordChanged(resultXML) { var content = document.getElementById("content"); if (resultXML) { content.innerHTML = ""; content.innerHTML = lbl_password_changed; } else content.innerHTML = problemXmlResult; return true;}/* * Update the birthdays list zone * @param Birthdays list, formated in XML */function showBirthdays(resultXML) { var content = document.getElementById("anniversaires"); if (resultXML) { content.innerHTML = ''; var birthdays = resultXML.getElementsByTagName("birthday"); for (var i = 0; i < birthdays.length; i++) { var age = birthdays[i].getAttribute("age"), ageToShow = ""; if (age != null && age.length > 0) ageToShow = ' >> ' + age + ' ' + ((age > 1) ? lbl_years : lbl_year); content.innerHTML += '<li><strong><a href="" onclick="showPerson('+ birthdays[i].getAttribute("id") +'); return false;">'+ birthdays[i].getAttribute("firstname") +' '+ birthdays[i].getAttribute("lastname") + '</a></strong><br/>' + lbl_on + ' <i>'+ birthdays[i].getAttribute("birthdateDay") + '/' + birthdays[i].getAttribute("birthdateMonth")+ ageToShow + '</i></li>'; } content.innerHTML = '<ul>' + content.innerHTML + '</ul>'; } else content.innerHTML = problemXmlResult; return true;}/* * Show birthdays in content zone to print them * @param Birthdays list, formated in XML */function showBirthdaystoPrint(resultXML) { var content = document.getElementById("content"); if (resultXML) { content.innerHTML = ''; var birthdays = resultXML.getElementsByTagName("birthday"); for (var i = 0; i < birthdays.length; i++) { var age = birthdays[i].getAttribute("age"), ageToShow = "", newMonth = birthdays[i].getAttribute("newMonth"), year = birthdays[i].getAttribute("birthdateYear"); if (age != null && age.length > 0) ageToShow = ' >> ' + age + ' ' + ((age > 1) ? lbl_years : lbl_year); if (!year || (year != '0000')) year = '/' + year; else year = ''; if (newMonth) content.innerHTML += "</ul><h2>"+ newMonth +"</h2><ul>"; content.innerHTML += '<li><strong><a href="" onclick="showPerson('+ birthdays[i].getAttribute("id") +'); return false;">'+ birthdays[i].getAttribute("firstname") +' '+ birthdays[i].getAttribute("lastname") + '</a></strong><br/>' + lbl_on + ' <i>'+ birthdays[i].getAttribute("birthdateDay") + '/' + birthdays[i].getAttribute("birthdateMonth") + year + ageToShow + '</i></li>'; } content.innerHTML = '<div class="multiColumn"><ul>' + content.innerHTML + '</ul></div>'; } else content.innerHTML = problemXmlResult; return true;}/* * Open all persons details */function openAll() { chgVisibilityContacts('block'); return true;}/* * Close all persons details */function closeAll() { chgVisibilityContacts('none'); return true;}/* * Toggle the style of persons details * @param CSS display style to change for all persons */function chgVisibilityContacts(valueToReplace) { var content = document.getElementById("content"); if (content.childNodes[0]) { divs = content.childNodes[0].childNodes; for(var i = 0; i < divs.length; i++) { if (divs[i].name = 'someuser') { for(var ii = divs[i].childNodes.length-1; ii > 0; ii--) { if (divs[i].childNodes[ii].name == 'userInfo') divs[i].childNodes[ii].style.display = valueToReplace; } } } } return true;}/* * Show a form to change user preferences * @param User preferences, formated in XML */function showPreferences(resultXML) { var content = document.getElementById("content"), nbArgs = 0; if (resultXML) { content.innerHTML = ""; var notifications = resultXML.getElementsByTagName("notification"); for (var i = 0; i < notifications.length; i++) { var daysBefore = notifications[i].getAttribute("daysBefore"); var value = notifications[i].getAttribute("value"); var checked = (notifications[i].getAttribute("checked") == "1") ? "checked" : ""; var title; if (daysBefore == 0) title = lbl_the_day; else if (daysBefore == 1) title = daysBefore + " " + lbl_day_before; else title = daysBefore + " " + lbl_days_before; content.innerHTML += '<label for="daysBefore'+i+'" class="labelCheckBox">'+title+' </label><input type="checkbox" name="daysBefore'+i+'" id="daysBefore'+i+'" value="'+value+'" '+checked+'/><br/>'; nbArgs = i; } content.innerHTML = '<form name="formPref" id="formPref" method="post" action="#">' + '<fieldset><legend>'+ lbl_birth_reminder_title +'</legend>' + '<p>'+ lbl_birth_reminder_intro +'</p>' + '<div class="marginButtons" style="width: 150px;">' + content.innerHTML + '</div>' + '<input type="button" class="marginButtons" name="chgPref" value="'+ action_update +'" onclick="changePreferences('+ nbArgs + ');"/>' + '</fieldset></form>'; } else content.innerHTML = problemXmlResult; return true; }/* * Show a message after the user has changed his preferences * @param empty XML result, just to see if the preferences was set */function getPreferencesChanged(resultXML) { var content = document.getElementById("content"); if (resultXML) { content.innerHTML = ""; content.innerHTML = '<h3>'+ lbl_preferences_changed +'</h3>'; } else content.innerHTML = problemXmlResult; return true;}/* * Show or hide the div and change the '-' or '+' sign */function showOrHideFrame(obj, div) { var style = document.getElementById(div).style; var state = ''; if (style.display == 'none') { style.display = 'block'; obj.innerHTML = sign_hide; state = 'open'; } else { style.display = 'none'; obj.innerHTML = sign_show; state = 'closed'; } /* * Sending frame's state to server */ var req = newXMLHttpRequest(), param = ''; req.open("POST", "actions/setFrameState.php", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); param = 'key='+ div + '&state=' + state; req.send(param); if (debug) trace("POST actions/setFrameState.php param="+param); return false;}/* * Clean the main zone. */function clearScreen(message) { document.getElementById("content").innerHTML = message; return false;}/* * Trace */function trace(msg) { if(debug) document.getElementById("debug").innerHTML = msg + "<br/>" + document.getElementById("debug").innerHTML;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -