Mercurial > hg > digilib-old
comparison client/digitallibrary/greyskin/baselib.js @ 435:14557d3879d2
some streamlining
author | hertzhaft |
---|---|
date | Mon, 09 Jan 2006 17:55:35 +0100 |
parents | 35044254c5af |
children | 06f6b72dc8ac |
comparison
equal
deleted
inserted
replaced
434:4eeabb5ed193 | 435:14557d3879d2 |
---|---|
410 if (! detail) { | 410 if (! detail) { |
411 detail = 255; | 411 detail = 255; |
412 } | 412 } |
413 var params = new Array(); | 413 var params = new Array(); |
414 for (param in dlParams) { | 414 for (param in dlParams) { |
415 if (((dlParams[param].detail & detail) > 0)&&(dlParams[param].hasValue)) { | 415 if (((dlParams[param].detail & detail) > 0) |
416 && (dlParams[param].hasValue)) { | |
416 var val = getParameter(param); | 417 var val = getParameter(param); |
417 if (val != "") { | 418 if (val != "") { |
418 params.push(param + "=" + val); | 419 params.push(param + "=" + val); |
419 } | 420 } |
420 } | 421 } |
553 return true; | 554 return true; |
554 } | 555 } |
555 | 556 |
556 function showElement(elem, show) { | 557 function showElement(elem, show) { |
557 // shows or hides the element | 558 // shows or hides the element |
558 if (elem.style) { | 559 if (elem.style) |
559 if (show) { | 560 elem.style.visibility = show ? "visible" : "hidden"; |
560 elem.style.visibility = "visible"; | 561 } else if (defined(elem.visibility)) |
561 } else { | 562 elem.visibility = show ? "show" : "hide"; |
562 elem.style.visibility = "hidden"; | 563 } else |
563 } | 564 alert("showElement(): element has no style or layer property!"); |
564 } else if (defined(elem.visibility)) { | |
565 if (show) { | |
566 elem.visibility = "show"; | |
567 } else { | |
568 elem.visibility = "hide"; | |
569 } | |
570 } else { | |
571 alert("showelement: no style nor layer property!"); | |
572 } | |
573 return true; | 565 return true; |
574 } | 566 } |
575 | 567 |
576 function evtPosition(evt) { | 568 function evtPosition(evt) { |
577 // returns the on-screen Position of the Event | 569 // returns the on-screen Position of the Event |
578 var x; | 570 var x; |
579 var y; | 571 var y; |
580 evt = (evt) ? evt : window.event; | 572 evt = (evt) ? evt : window.event; |
581 if (!evt) { | 573 if (!evt) { |
582 alert("no event found! "+evt); | 574 alert("no event found! " + evt); |
583 return; | 575 return; |
584 } | 576 } |
585 if (defined(evt.pageX)) { | 577 if (defined(evt.pageX)) { |
586 x = parseInt(evt.pageX); | 578 x = parseInt(evt.pageX); |
587 y = parseInt(evt.pageY); | 579 y = parseInt(evt.pageY); |
588 } else if (defined(evt.clientX)) { | 580 } else if (defined(evt.clientX)) { |
589 x = parseInt(document.body.scrollLeft+evt.clientX); | 581 x = parseInt(document.body.scrollLeft + evt.clientX); |
590 y = parseInt(document.body.scrollTop+evt.clientY); | 582 y = parseInt(document.body.scrollTop + evt.clientY); |
591 } else { | 583 } else { |
592 alert("evtPosition: don't know how to deal with "+evt); | 584 alert("evtPosition(): don't know how to deal with " + evt); |
593 } | 585 } |
594 return new Position(x, y); | 586 return new Position(x, y); |
595 } | 587 } |
596 | 588 |
597 function registerEvent(type, elem, handler) { | 589 function registerEvent(type, elem, handler) { |
598 // register the given event handler on the indicated element | 590 // register the given event handler on the indicated element |
721 return this.read(); | 713 return this.read(); |
722 } | 714 } |
723 | 715 |
724 Cookie.prototype.read = function() { | 716 Cookie.prototype.read = function() { |
725 var s = document.cookie; | 717 var s = document.cookie; |
726 var lines = s.split("; "); | 718 var lines = s.split("; "); // semicolon and space for all browsers? |
727 for (var i in lines) { | 719 for (var i in lines) { |
728 var line = lines[i]; | 720 var line = lines[i]; |
729 var sep = line.indexOf("="); | 721 var sep = line.indexOf("="); |
730 if (sep != -1) this.add( | 722 if (sep != -1) this.add( |
731 line.substr(0, sep), | 723 line.substr(0, sep), |