Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Calendar.prototype.showAtElement = function(element, operation) {
- function setup(e) {
- if (e.x < 0) {
- e.x = 0;
- }
- if (e.y < 0) {
- e.y = 0;
- }
- var boundCalcDiv = document.createElement("div");
- var boundCalcDivStyle = boundCalcDiv.style;
- boundCalcDivStyle.position = "absolute";
- boundCalcDivStyle.right = boundCalcDivStyle.bottom = boundCalcDivStyle.width = boundCalcDivStyle.height = "0px";
- document.body.appendChild(boundCalcDiv);
- var pos = Calendar.getAbsolutePos(boundCalcDiv);
- document.body.removeChild(boundCalcDiv);
- if (Calendar.is_ie) {
- pos.y += document.body.scrollTop;
- pos.x += document.body.scrollLeft;
- } else {
- pos.y += window.scrollY;
- pos.x += window.scrollX;
- }
- var offset = e.x + e.width - pos.x;
- if (offset > 0) {
- e.x -= offset;
- }
- offset = e.y + e.height - pos.y;
- if (offset > 0) {
- e.y -= offset;
- }
- }
- var cal = this;
- var e = Calendar.getAbsolutePos(element);
- if (!operation || typeof operation != "string") {
- this.showAt(e.x, e.y + element.offsetHeight);
- return true;
- }
- this.element.style.display = "block";
- Calendar.continuation_for_the_fucking_khtml_browser = function() {
- var x = cal.element.offsetWidth;
- var y = cal.element.offsetHeight;
- cal.element.style.display = "none";
- var type = operation.substr(0, 1);
- var op = "l";
- if (operation.length > 1) {
- op = operation.substr(1, 1);
- }
- switch(type) {
- case "T":
- e.y -= y;
- break;
- case "B":
- e.y += c.offsetHeight;
- break;
- case "C":
- e.y += (c.offsetHeight - y) / 2;
- break;
- case "t":
- e.y += c.offsetHeight - y;
- break;
- case "b":
- break;
- }
- switch(op) {
- case "L":
- e.x -= x;
- break;
- case "R":
- e.x += element.offsetWidth;
- break;
- case "C":
- e.x += (element.offsetWidth - x) / 2;
- break;
- case "l":
- e.x += element.offsetWidth - x;
- break;
- case "r":
- break;
- }
- e.width = x;
- e.height = y + 40;
- cal.monthsCombo.style.display = "none";
- setup(e);
- cal.showAt(e.x, e.y);
- };
- if (Calendar.is_khtml) {
- setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
- } else {
- Calendar.continuation_for_the_fucking_khtml_browser();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement