[TEP-COMMIT] [CVS admin] new javascript functions to add magic to the administration tool
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:04:23 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin/includes on MAIN
general.js +170 -2 1.3 -> 1.4
new javascript functions to add magic to the administration tool
there's also a function to correct Internet Explorer's usage of transparent
PNG images
----------
admin /admin /includes
general.js 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- general.js 2003/06/29 22:50:52 1.3
+++ general.js 2004/07/22 23:04:22 1.4
@@ -20,9 +20,177 @@
}
function rowOverEffect(object) {
- if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
+ object.className = 'mouseOver';
}
function rowOutEffect(object) {
- if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
+ object.className = '';
}
+
+function updateDatePullDownMenu(objForm, fieldName) {
+ var pdmDays = fieldName + "_days";
+ var pdmMonths = fieldName + "_months";
+ var pdmYears = fieldName + "_years";
+
+ time = new Date(objForm[pdmYears].options[objForm[pdmYears].selectedIndex].text, objForm[pdmMonths].options[objForm[pdmMonths].selectedIndex].value, 1);
+
+ time = new Date(time - 86400000);
+
+ var selectedDay = objForm[pdmDays].options[objForm[pdmDays].selectedIndex].text;
+ var daysInMonth = time.getDate();
+
+ for (var i=0; i<objForm[pdmDays].length; i++) {
+ objForm[pdmDays].options[0] = null;
+ }
+
+ for (var i=0; i<daysInMonth; i++) {
+ objForm[pdmDays].options[i] = new Option(i+1);
+ }
+
+ if (selectedDay <= daysInMonth) {
+ objForm[pdmDays].options[selectedDay-1].selected = true;
+ } else {
+ objForm[pdmDays].options[daysInMonth-1].selected = true;
+ }
+}
+
+function showHide(id1, id2) {
+ toggleBlock(id1);
+ toggleBlock(id2);
+}
+
+function toggleBlock(id) {
+ if (document.getElementById) {
+ itm = document.getElementById(id);
+ } else if (document.all){
+ itm = document.all[id];
+ } else if (document.layers){
+ itm = document.layers[id];
+ }
+
+ if (itm) {
+ if (itm.style.display == "none") {
+ itm.style.display = "block";
+ } else {
+ itm.style.display = "none";
+ }
+ }
+}
+
+function toggleDivBlocks(group, exempt) {
+ if (!document.getElementsByTagName) return null;
+
+ if (!exempt) exempt = "";
+
+ var divs = document.getElementsByTagName("div");
+
+ for(var i=0; i < divs.length; i++) {
+ var div = divs[i];
+ var id = div.id;
+
+ if ((id != exempt) && (id.indexOf(group) == 0)) {
+ hideBlock(id);
+ }
+ }
+
+ showBlock(exempt);
+}
+
+function toggleInfoBox(exempt) {
+ if (!exempt || !document.getElementsByTagName) return null;
+
+ var infoBox = "infoBox_" + exempt;
+
+ var divs = document.getElementsByTagName("div");
+
+ for(var i=0; i < divs.length; i++) {
+ var div = divs[i];
+ var id = div.id;
+
+ if (id.indexOf("infoBox_") == 0) {
+ var infoBoxForm = id.substring(8);
+
+ if (document.forms[infoBoxForm]) {
+ document.forms[infoBoxForm].reset();
+ }
+
+ if (id != infoBox) {
+ hideBlock(id);
+ }
+ }
+ }
+
+ showBlock(infoBox);
+}
+
+function showBlock(id) {
+ if (document.getElementById) {
+ itm = document.getElementById(id);
+ } else if (document.all){
+ itm = document.all[id];
+ } else if (document.layers){
+ itm = document.layers[id];
+ }
+
+ if (itm) {
+ itm.style.display = "block";
+ }
+}
+
+function hideBlock(id) {
+ if (document.getElementById) {
+ itm = document.getElementById(id);
+ } else if (document.all){
+ itm = document.all[id];
+ } else if (document.layers){
+ itm = document.layers[id];
+ }
+
+ if (itm) {
+ itm.style.display = "none";
+ }
+}
+
+function toggleClass(removeClass, addClass, cssClass, tagName) {
+ if (!document.getElementsByTagName) return null;
+
+ if (!tagName) tagName = "div";
+
+ var tags = document.getElementsByTagName(tagName);
+
+ for(var i=0; i < tags.length; i++) {
+ var tag = tags[i];
+ var id = tag.id;
+
+ if ((id != addClass) && (id.indexOf(removeClass) == 0)) {
+ tag.className = "";
+ }
+ }
+
+ document.getElementById(addClass).className = cssClass;
+}
+
+/*@cc_on
+@if (@_jscript_version >= 5.5 && @_win32)
+// Correctly handle PNG transparency in Win IE 5.5 or higher.
+// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004
+function correctPNG() {
+ for(var i=0; i<document.images.length; i++) {
+ var img = document.images[i]
+ var imgName = img.src.toUpperCase()
+ if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
+ var imgID = (img.id) ? "id='" + img.id + "' " : ""
+ var imgClass = (img.className) ? "class='" + img.className + "' " : ""
+ var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
+ var imgStyle = "display:inline-block;" + img.style.cssText
+ if (img.align == "left") imgStyle = "float:left;" + imgStyle
+ if (img.align == "right") imgStyle = "float:right;" + imgStyle
+ if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
+ var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
+ img.outerHTML = strNewHTML
+ i = i-1
+ }
+ }
+}
+window.attachEvent("onload", correctPNG);
+@end @*/
CVSspam 0.2.8
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click