Redundant -> deleted
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@53 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
9fec28a776
commit
d5df12426b
@ -1,137 +0,0 @@
|
||||
var debugWindow = null;
|
||||
function debug(text, reverse) {
|
||||
if (debugWindow == null)
|
||||
return;
|
||||
|
||||
time = "-"; //new Date();
|
||||
if (reverse) {
|
||||
$('debug').innerHTML = time + " " + text + "<br>"+ $('debug').innerHTML;
|
||||
debugWindow.getContent().scrollTop=0;
|
||||
}
|
||||
else {
|
||||
$('debug').innerHTML += time + " " + text + "<br>";
|
||||
debugWindow.getContent().scrollTop=10000; // Far away
|
||||
}
|
||||
}
|
||||
|
||||
function hideDebug() {
|
||||
if (debugWindow) {
|
||||
debugWindow.destroy();
|
||||
debugWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
function showDebug(bShow) {
|
||||
if (debugWindow == null) {
|
||||
debugWindow = new Window('debug_window', {className: 'dialog',width:250, height:100, right:4, bottom:42, zIndex:1000, opacity:1, showEffect: Element.show, resizable: true, title: "Debug"})
|
||||
debugWindow.getContent().innerHTML = "<style>#debug_window .dialog_content {background:#000;}</style> <div id='debug'></div>";
|
||||
date=new Date;
|
||||
date.setMonth(date.getMonth()+3);
|
||||
|
||||
//debugWindow.setCookie(null, date);
|
||||
}
|
||||
if( typeof bShow == 'undefined' || bShow)debugWindow.show()
|
||||
}
|
||||
|
||||
|
||||
function clearDebug() {
|
||||
if (debugWindow == null)
|
||||
return;
|
||||
$('debug').innerHTML = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* document.createElement convenience wrapper
|
||||
*
|
||||
* The data parameter is an object that must have the "tag" key, containing
|
||||
* a string with the tagname of the element to create. It can optionally have
|
||||
* a "children" key which can be: a string, "data" object, or an array of "data"
|
||||
* objects to append to this element as children. Any other key is taken as an
|
||||
* attribute to be applied to this tag.
|
||||
*
|
||||
* Available under an MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* @param {Object} data The data representing the element to create
|
||||
* @return {Element} The element created.
|
||||
*/
|
||||
function $E(data) {
|
||||
var el;
|
||||
if ('string'==typeof data) {
|
||||
el=document.createTextNode(data);
|
||||
} else {
|
||||
//create the element
|
||||
el=document.createElement(data.tag);
|
||||
delete(data.tag);
|
||||
|
||||
//append the children
|
||||
if ('undefined'!=typeof data.children) {
|
||||
if ('string'==typeof data.children ||'undefined'==typeof data.children.length) {
|
||||
//strings and single elements
|
||||
el.appendChild($E(data.children));
|
||||
} else {
|
||||
//arrays of elements
|
||||
for (var i=0, child=null; 'undefined'!=typeof (child=data.children[i]); i++) {
|
||||
el.appendChild($E(child));
|
||||
}
|
||||
}
|
||||
delete(data.children);
|
||||
}
|
||||
|
||||
//any other data is attributes
|
||||
for (attr in data) {
|
||||
el[attr]=data[attr];
|
||||
}
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
// FROM Nick Hemsley
|
||||
var Debug = {
|
||||
inspectOutput: function (container, within) {
|
||||
within = within || debugWindow.getContent()
|
||||
|
||||
if (debugWindow == null)
|
||||
return;
|
||||
|
||||
within.appendChild(container)
|
||||
},
|
||||
|
||||
inspect: function(object) {
|
||||
var cont = $E({tag: "div", className: "inspector"})
|
||||
Debug.inspectObj(object, cont)
|
||||
debugWindow.getContent().appendChild(cont)
|
||||
},
|
||||
|
||||
inspectObj: function (object, container) {
|
||||
for (prop in object) {
|
||||
Debug.inspectOutput(Debug.inspectable(object, prop), container)
|
||||
}
|
||||
},
|
||||
|
||||
inspectable: function(object, prop) {
|
||||
cont = $E({tag: 'div', className: 'inspectable', children: [prop + " value: " + object[prop] ]})
|
||||
cont.toInspect = object[prop]
|
||||
Event.observe(cont, 'click', Debug.inspectClicked, false)
|
||||
return cont
|
||||
},
|
||||
|
||||
inspectClicked: function(e) {
|
||||
Debug.inspectContained(Event.element(e))
|
||||
Event.stop(e)
|
||||
},
|
||||
|
||||
inspectContained: function(container) {
|
||||
if (container.opened) {
|
||||
container.parentNode.removeChild(container.opened)
|
||||
delete(container.opened)
|
||||
} else {
|
||||
sibling = container.parentNode.insertBefore($E({tag: "div", className: "child"}), container.nextSibling)
|
||||
if (container.toInspect)
|
||||
Debug.inspectObj(container.toInspect, sibling)
|
||||
container.opened = sibling
|
||||
}
|
||||
}
|
||||
}
|
||||
var inspect = Debug.inspect;
|
1094
xCAT-web/javascripts/effects.js
vendored
1094
xCAT-web/javascripts/effects.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,113 +0,0 @@
|
||||
var commandHistory;
|
||||
var historyIndex;
|
||||
|
||||
function showExtendedDebug() {
|
||||
if (debugWindow != null) {
|
||||
hideDebug();
|
||||
}
|
||||
|
||||
if (debugWindow == null) {
|
||||
commandHistory = new Array();
|
||||
historyIndex = 0;
|
||||
|
||||
debugWindow = new Window('debug_window', {className: 'dialog',width:250, height:100, right:4, minWidth:250, bottom:42, zIndex:1000, opacity:1, showEffect: Element.show, resizable: true, title: "Debug"})
|
||||
debugWindow.getContent().innerHTML = "<style>#debug_window .dialog_content {background:#000;}</style> <div font='monaco' id='debug' style='padding:3px;color:#0F0;font-family:monaco'></div>";
|
||||
|
||||
//create hourglass icon and attach events to it.
|
||||
var cont = "<div id=\"debug_window_inspect\" style=\"width: 15px; height: 15px; background: transparent url(themes/default/inspect.gif) no-repeat 0 0; position:absolute; top:5px; left:70px; cursor:pointer; z-index:3000;\"></div>";
|
||||
|
||||
new Insertion.After('debug_window_maximize', cont);
|
||||
Event.observe('debug_window_inspect', 'click', enterInspectionMode, false);
|
||||
|
||||
//create command text box
|
||||
cont = "Eval:<input id=\"debug_window_command\" type=\"textbox\" style=\"width:150px; height: 12px; color: black;\">"
|
||||
debugWindow.setStatusBar(cont);
|
||||
|
||||
Event.observe('debug_window_command', 'mousedown', donothing);
|
||||
Event.observe('debug_window_command', 'keypress', evalJS, false);
|
||||
}
|
||||
debugWindow.show();
|
||||
}
|
||||
|
||||
function donothing(evt){
|
||||
Field.activate('debug_window_command');
|
||||
return false;
|
||||
}
|
||||
|
||||
function evalJS(evt){
|
||||
if(evt.keyCode == Event.KEY_RETURN){
|
||||
var js = $F('debug_window_command');
|
||||
try{
|
||||
var ret = eval(js);
|
||||
if(ret != null)
|
||||
debug(ret);
|
||||
}catch(e){
|
||||
debug(e);
|
||||
}
|
||||
$('debug_window_command').value = '';
|
||||
|
||||
Field.activate('debug_window_command');
|
||||
commandHistory.push(js);
|
||||
historyIndex = 0;
|
||||
}
|
||||
|
||||
if(evt.keyCode == Event.KEY_UP){
|
||||
if(commandHistory.length > historyIndex){
|
||||
historyIndex++;
|
||||
var js = commandHistory[commandHistory.length-historyIndex];
|
||||
$('debug_window_command').value = js;
|
||||
Event.stop(evt);
|
||||
Field.activate('debug_window_command');
|
||||
}
|
||||
}
|
||||
|
||||
if(evt.keyCode == Event.KEY_DOWN){
|
||||
if(commandHistory.length >= historyIndex && historyIndex > 1){
|
||||
historyIndex--;
|
||||
var js = commandHistory[commandHistory.length-historyIndex];
|
||||
$('debug_window_command').value = js;
|
||||
Event.stop(evt);
|
||||
Field.activate('debug_window_command');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function enterInspectionMode(evt){
|
||||
//stop observing magnifying glass
|
||||
Event.stopObserving('debug_window_inspect', 'click', enterInspectionMode, false);
|
||||
//change pointer
|
||||
document.body.style.cursor='help';
|
||||
//start observing mouse clicks
|
||||
Event.observe(window, 'click', inspectItem, false);
|
||||
}
|
||||
|
||||
function inspectItem(evt){
|
||||
// the element that triggered the event
|
||||
var element = Event.element(evt);
|
||||
if(element.id!="debug_window_inspect"){
|
||||
clearDebug()
|
||||
//change pointer
|
||||
document.body.style.cursor='default';
|
||||
debug(element.id);
|
||||
inspect(element);
|
||||
//stop observing mouse clicks
|
||||
Event.stopObserving(window, 'click', inspectItem, false);
|
||||
//alert('doing something');
|
||||
//start observing mag
|
||||
Event.observe('debug_window_inspect', 'click', enterInspectionMode, false);
|
||||
}
|
||||
}
|
||||
|
||||
function clearDebug() {
|
||||
var win = $('debug');
|
||||
if (win == null)
|
||||
return;
|
||||
|
||||
win.innerHTML=" ";
|
||||
//clear inspections too
|
||||
var divs = document.getElementsByClassName('inspector');
|
||||
divs.each(function(div){
|
||||
Element.remove(div);
|
||||
});
|
||||
}
|
||||
|
3269
xCAT-web/javascripts/prototype.js
vendored
3269
xCAT-web/javascripts/prototype.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,241 +0,0 @@
|
||||
// Singleton class TooltipWindow
|
||||
// This class works with special className. The tooltip content could be in your HTML page as an hidden element or
|
||||
// can be retreive by an AJAX call.
|
||||
//
|
||||
// To work, You just need to set two class name on elements that should show tooltips
|
||||
// - One to say to TooltipManager that this element must have a tooltip ('tooltip' by default)
|
||||
// - Another to indicate how to find the tooltip content
|
||||
// It could be html_XXXX if tootltip content is somewhere hidden in your page, XXX must be DOM ID of this hidden element
|
||||
// It could be ajax_XXXX if tootltip content must be find by an ajax request, XXX will be the string send as id parameter to your server.
|
||||
// Check samples/tooltips/tooltip.html to see how it works
|
||||
//
|
||||
TooltipManager = {
|
||||
options: {cssClassName: 'tooltip', delayOver: 200, delayOut: 1000, shiftX: 10, shiftY: 10,
|
||||
className: 'alphacube', width: 200, height: null,
|
||||
draggable: false, minimizable: false, maximizable: false, showEffect: Element.show, hideEffect: Element.hide},
|
||||
ajaxInfo: null,
|
||||
elements: null,
|
||||
showTimer: null,
|
||||
hideTimer: null,
|
||||
|
||||
// Init tooltip manager
|
||||
// parameters:
|
||||
// - cssClassName (string) : CSS class name where tooltip should be shown.
|
||||
// - ajaxOptions (hash) : Ajax options for ajax tooltip.
|
||||
// For examples {url: "/tooltip/get.php", options: {method: 'get'}}
|
||||
// see Ajax.Request documentation for details
|
||||
//- tooltipOptions (hash) : available keys
|
||||
// - delayOver: int in ms (default 10) delay before showing tooltip
|
||||
// - delayOut: int in ms (default 1000) delay before hidding tooltip
|
||||
// - shiftX: int in pixels (default 10) left shift of the tooltip window
|
||||
// - shiftY: int in pixels (default 10) top shift of the tooltip window
|
||||
// and All window options like showEffect: Element.show, hideEffect: Element.hide to remove animation
|
||||
// default: {className: 'alphacube', width: 200, height: null, draggable: false, minimizable: false, maximizable: false}
|
||||
|
||||
init: function(cssClassName, ajaxInfo, tooltipOptions) {
|
||||
TooltipManager.options = Object.extend(TooltipManager.options, tooltipOptions || {});
|
||||
|
||||
cssClassName = TooltipManager.options.cssClassName || "tooltip";
|
||||
TooltipManager.ajaxInfo = ajaxInfo;
|
||||
TooltipManager.elements = $$("." + cssClassName);
|
||||
TooltipManager.elements.each(function(element) {
|
||||
element = $(element)
|
||||
var info = TooltipManager._getInfo(element);
|
||||
if (info.ajax) {
|
||||
element.ajaxId = info.id;
|
||||
element.ajaxInfo = ajaxInfo;
|
||||
}
|
||||
else {
|
||||
element.tooltipElement = $(info.id);
|
||||
}
|
||||
element.observe("mouseover", TooltipManager._mouseOver);
|
||||
element.observe("mouseout", TooltipManager._mouseOut);
|
||||
});
|
||||
Windows.addObserver(this);
|
||||
},
|
||||
|
||||
addHTML: function(element, tooltipElement) {
|
||||
element = $(element);
|
||||
tooltipElement = $(tooltipElement);
|
||||
element.tooltipElement = tooltipElement;
|
||||
|
||||
element.observe("mouseover", TooltipManager._mouseOver);
|
||||
element.observe("mouseout", TooltipManager._mouseOut);
|
||||
},
|
||||
|
||||
addAjax: function(element, ajaxInfo) {
|
||||
element = $(element);
|
||||
element.ajaxInfo = ajaxInfo;
|
||||
element.observe("mouseover", TooltipManager._mouseOver);
|
||||
element.observe("mouseout", TooltipManager._mouseOut);
|
||||
},
|
||||
|
||||
addURL: function(element, url, width, height) {
|
||||
element = $(element);
|
||||
element.url = url;
|
||||
element.frameWidth = width;
|
||||
element.frameHeight = height;
|
||||
element.observe("mouseover", TooltipManager._mouseOver);
|
||||
element.observe("mouseout", TooltipManager._mouseOut);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if (TooltipManager.tooltipWindow)
|
||||
TooltipManager.tooltipWindow.hide();
|
||||
},
|
||||
|
||||
preloadImages: function(path, images, extension) {
|
||||
if (!extension)
|
||||
extension = ".gif";
|
||||
|
||||
//preload images
|
||||
$A(images).each(function(i) {
|
||||
var image = new Image();
|
||||
image.src= path + "/" + i + extension;
|
||||
});
|
||||
},
|
||||
|
||||
_showTooltip: function(element) {
|
||||
if (this.element == element)
|
||||
return;
|
||||
// Get original element
|
||||
while (element && (!element.tooltipElement && !element.ajaxInfo && !element.url))
|
||||
element = element.parentNode;
|
||||
this.element = element;
|
||||
|
||||
TooltipManager.showTimer = null;
|
||||
if (TooltipManager.hideTimer)
|
||||
clearTimeout(TooltipManager.hideTimer);
|
||||
|
||||
var position = Position.cumulativeOffset(element);
|
||||
var dimension = element.getDimensions();
|
||||
|
||||
if (! this.tooltipWindow)
|
||||
this.tooltipWindow = new Window("__tooltip__", TooltipManager.options);
|
||||
|
||||
this.tooltipWindow.hide();
|
||||
this.tooltipWindow.setLocation(position[1] + dimension.height + TooltipManager.options.shiftY, position[0] + TooltipManager.options.shiftX);
|
||||
|
||||
Event.observe(this.tooltipWindow.element, "mouseover", function(event) {TooltipManager._tooltipOver(event, element)});
|
||||
Event.observe(this.tooltipWindow.element, "mouseout", function(event) {TooltipManager._tooltipOut(event, element)});
|
||||
|
||||
// Reset width/height for computation
|
||||
this.tooltipWindow.height = TooltipManager.options.height;
|
||||
this.tooltipWindow.width = TooltipManager.options.width;
|
||||
|
||||
// Ajax content
|
||||
if (element.ajaxInfo) {
|
||||
var p = element.ajaxInfo.options.parameters;
|
||||
var saveParam = p;
|
||||
|
||||
// Set by CSS
|
||||
if (element.ajaxId) {
|
||||
if (p)
|
||||
p += "&id=" + element.ajaxId;
|
||||
else
|
||||
p = "id=" + element.ajaxId;
|
||||
}
|
||||
element.ajaxInfo.options.parameters = p || "";
|
||||
this.tooltipWindow.setHTMLContent("");
|
||||
this.tooltipWindow.setAjaxContent(element.ajaxInfo.url, element.ajaxInfo.options);
|
||||
element.ajaxInfo.options.parameters = saveParam;
|
||||
}
|
||||
// URL content
|
||||
else if (element.url) {
|
||||
this.tooltipWindow.setURL(element.url);
|
||||
this.tooltipWindow.setSize(element.frameWidth, element.frameHeight);
|
||||
|
||||
// Set tooltip size
|
||||
this.tooltipWindow.height = element.frameHeight;
|
||||
this.tooltipWindow.width = element.frameWidth;
|
||||
}
|
||||
// HTML content
|
||||
else
|
||||
this.tooltipWindow.setHTMLContent(element.tooltipElement.innerHTML);
|
||||
|
||||
if (!element.ajaxInfo) {
|
||||
this.tooltipWindow.show();
|
||||
this.tooltipWindow.toFront();
|
||||
}
|
||||
},
|
||||
|
||||
_hideTooltip: function(element) {
|
||||
if (this.tooltipWindow) {
|
||||
this.tooltipWindow.hide();
|
||||
this.element = null;
|
||||
}
|
||||
},
|
||||
|
||||
_mouseOver: function (event) {
|
||||
var element = Event.element(event);
|
||||
if (TooltipManager.showTimer)
|
||||
clearTimeout(TooltipManager.showTimer);
|
||||
|
||||
TooltipManager.showTimer = setTimeout(function() {TooltipManager._showTooltip(element)}, TooltipManager.options.delayOver)
|
||||
},
|
||||
|
||||
_mouseOut: function(event) {
|
||||
var element = Event.element(event);
|
||||
if (TooltipManager.showTimer) {
|
||||
clearTimeout(TooltipManager.showTimer);
|
||||
TooltipManager.showTimer = null;
|
||||
return;
|
||||
}
|
||||
if (TooltipManager.tooltipWindow)
|
||||
TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
|
||||
},
|
||||
|
||||
_tooltipOver: function(event, element) {
|
||||
if (TooltipManager.hideTimer) {
|
||||
clearTimeout(TooltipManager.hideTimer);
|
||||
TooltipManager.hideTimer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_tooltipOut: function(event, element) {
|
||||
if (TooltipManager.hideTimer == null)
|
||||
TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
|
||||
},
|
||||
|
||||
_getInfo: function(element) {
|
||||
// Find html_ for static content
|
||||
var id = element.className.split(' ').detect(function(name) {return name.indexOf("html_") == 0});
|
||||
var ajax = true;
|
||||
if (id)
|
||||
ajax = false;
|
||||
else
|
||||
// Find ajax_ for ajax content
|
||||
id = element.className.split(' ').detect(function(name) {return name.indexOf("ajax_") == 0});
|
||||
|
||||
id = id.substr(id.indexOf('_')+1, id.length)
|
||||
return id ? {ajax: ajax, id: id} : null;
|
||||
},
|
||||
|
||||
onBeforeShow: function(eventName, win) {
|
||||
var top = parseFloat(win.getLocation().top);
|
||||
var dim = win.element.getDimensions();
|
||||
|
||||
if (top + dim.height > TooltipManager._getScrollTop() + TooltipManager._getPageHeight()) {
|
||||
var position = Position.cumulativeOffset(this.element);
|
||||
|
||||
var top = position[1] - TooltipManager.options.shiftY - dim.height;
|
||||
win.setLocation(top, position[0] + TooltipManager.options.shiftX)
|
||||
}
|
||||
},
|
||||
|
||||
_getPageWidth: function(){
|
||||
return window.innerWidth || document.documentElement.clientWidth || 0;
|
||||
},
|
||||
|
||||
_getPageHeight: function(){
|
||||
return window.innerHeight || document.documentElement.clientHeight || 0;
|
||||
},
|
||||
|
||||
_getScrollTop: function(){
|
||||
return document.documentElement.scrollTop || window.pageYOffset || 0;
|
||||
},
|
||||
|
||||
_getScrollLeft: function(){
|
||||
return document.documentElement.scrollLeft || window.pageXOffset || 0;
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,157 +0,0 @@
|
||||
Effect.ResizeWindow = Class.create();
|
||||
Object.extend(Object.extend(Effect.ResizeWindow.prototype, Effect.Base.prototype), {
|
||||
initialize: function(win, top, left, width, height) {
|
||||
this.window = win;
|
||||
this.window.resizing = true;
|
||||
|
||||
var size = win.getSize();
|
||||
this.initWidth = parseFloat(size.width);
|
||||
this.initHeight = parseFloat(size.height);
|
||||
|
||||
var location = win.getLocation();
|
||||
this.initTop = parseFloat(location.top);
|
||||
this.initLeft = parseFloat(location.left);
|
||||
|
||||
this.width = width != null ? parseFloat(width) : this.initWidth;
|
||||
this.height = height != null ? parseFloat(height) : this.initHeight;
|
||||
this.top = top != null ? parseFloat(top) : this.initTop;
|
||||
this.left = left != null ? parseFloat(left) : this.initLeft;
|
||||
|
||||
this.dx = this.left - this.initLeft;
|
||||
this.dy = this.top - this.initTop;
|
||||
this.dw = this.width - this.initWidth;
|
||||
this.dh = this.height - this.initHeight;
|
||||
|
||||
this.r2 = $(this.window.getId() + "_row2");
|
||||
this.content = $(this.window.getId() + "_content");
|
||||
|
||||
this.contentOverflow = this.content.getStyle("overflow") || "auto";
|
||||
this.content.setStyle({overflow: "hidden"});
|
||||
|
||||
// Wired mode
|
||||
if (this.window.options.wiredDrag) {
|
||||
this.window.currentDrag = win._createWiredElement();
|
||||
this.window.currentDrag.show();
|
||||
this.window.element.hide();
|
||||
}
|
||||
|
||||
this.start(arguments[5]);
|
||||
},
|
||||
|
||||
update: function(position) {
|
||||
var width = Math.floor(this.initWidth + this.dw * position);
|
||||
var height = Math.floor(this.initHeight + this.dh * position);
|
||||
var top = Math.floor(this.initTop + this.dy * position);
|
||||
var left = Math.floor(this.initLeft + this.dx * position);
|
||||
|
||||
if (window.ie) {
|
||||
if (Math.floor(height) == 0)
|
||||
this.r2.hide();
|
||||
else if (Math.floor(height) >1)
|
||||
this.r2.show();
|
||||
}
|
||||
this.r2.setStyle({height: height});
|
||||
this.window.setSize(width, height);
|
||||
this.window.setLocation(top, left);
|
||||
},
|
||||
|
||||
finish: function(position) {
|
||||
// Wired mode
|
||||
if (this.window.options.wiredDrag) {
|
||||
this.window._hideWiredElement();
|
||||
this.window.element.show();
|
||||
}
|
||||
|
||||
this.window.setSize(this.width, this.height);
|
||||
this.window.setLocation(this.top, this.left);
|
||||
this.r2.setStyle({height: null});
|
||||
|
||||
this.content.setStyle({overflow: this.contentOverflow});
|
||||
|
||||
this.window.resizing = false;
|
||||
}
|
||||
});
|
||||
|
||||
Effect.ModalSlideDown = function(element) {
|
||||
var windowScroll = WindowUtilities.getWindowScroll();
|
||||
var height = element.getStyle("height");
|
||||
element.setStyle({top: - (parseFloat(height) - windowScroll.top) + "px"});
|
||||
|
||||
element.show();
|
||||
return new Effect.Move(element, Object.extend({ x: 0, y: parseFloat(height) }, arguments[1] || {}));
|
||||
};
|
||||
|
||||
|
||||
Effect.ModalSlideUp = function(element) {
|
||||
var height = element.getStyle("height");
|
||||
return new Effect.Move(element, Object.extend({ x: 0, y: -parseFloat(height) }, arguments[1] || {}));
|
||||
};
|
||||
|
||||
PopupEffect = Class.create();
|
||||
PopupEffect.prototype = {
|
||||
initialize: function(htmlElement) {
|
||||
this.html = $(htmlElement);
|
||||
this.options = Object.extend({className: "popup_effect", duration: 0.4}, arguments[1] || {});
|
||||
|
||||
},
|
||||
show: function(element, options) {
|
||||
var position = Position.cumulativeOffset(this.html);
|
||||
var size = this.html.getDimensions();
|
||||
var bounds = element.win.getBounds();
|
||||
this.window = element.win;
|
||||
// Create a div
|
||||
if (!this.div) {
|
||||
this.div = document.createElement("div");
|
||||
this.div.className = this.options.className;
|
||||
this.div.style.height = size.height + "px";
|
||||
this.div.style.width = size.width + "px";
|
||||
this.div.style.top = position[1] + "px";
|
||||
this.div.style.left = position[0] + "px";
|
||||
this.div.style.position = "absolute"
|
||||
document.body.appendChild(this.div);
|
||||
}
|
||||
if (this.options.fromOpacity)
|
||||
this.div.setStyle({opacity: this.options.fromOpacity})
|
||||
this.div.show();
|
||||
var style = "top:" + bounds.top + ";left:" +bounds.left + ";width:" + bounds.width +";height:" + bounds.height;
|
||||
if (this.options.toOpacity)
|
||||
style += ";opacity:" + this.options.toOpacity;
|
||||
|
||||
new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._showWindow.bind(this)});
|
||||
},
|
||||
|
||||
hide: function(element, options) {
|
||||
var position = Position.cumulativeOffset(this.html);
|
||||
var size = this.html.getDimensions();
|
||||
this.window.visible = true;
|
||||
var bounds = this.window.getBounds();
|
||||
this.window.visible = false;
|
||||
|
||||
this.window.element.hide();
|
||||
|
||||
this.div.style.height = bounds.height;
|
||||
this.div.style.width = bounds.width;
|
||||
this.div.style.top = bounds.top;
|
||||
this.div.style.left = bounds.left;
|
||||
|
||||
if (this.options.toOpacity)
|
||||
this.div.setStyle({opacity: this.options.toOpacity})
|
||||
|
||||
this.div.show();
|
||||
var style = "top:" + position[1] + "px;left:" + position[0] + "px;width:" + size.width +"px;height:" + size.height + "px";
|
||||
|
||||
if (this.options.fromOpacity)
|
||||
style += ";opacity:" + this.options.fromOpacity;
|
||||
new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._hideDiv.bind(this)});
|
||||
},
|
||||
|
||||
_showWindow: function() {
|
||||
this.div.hide();
|
||||
this.window.element.show();
|
||||
},
|
||||
|
||||
_hideDiv: function() {
|
||||
this.div.hide();
|
||||
}
|
||||
}
|
||||
|
@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com)
|
||||
// YOU MUST INCLUDE window.js BEFORE
|
||||
//
|
||||
// Object to store hide/show windows status in a cookie
|
||||
// Just add at the end of your HTML file this javascript line: WindowStore.init()
|
||||
WindowStore = {
|
||||
doSetCookie: false,
|
||||
cookieName: "__window_store__",
|
||||
expired: null,
|
||||
|
||||
// Init function with two optional parameters
|
||||
// - cookieName (default = __window_store__)
|
||||
// - expiration date (default 3 years from now)
|
||||
init: function(cookieName, expired) {
|
||||
WindowStore.cookieName = cookieName || WindowStore.cookieName
|
||||
|
||||
if (! expired) {
|
||||
var today = new Date();
|
||||
today.setYear(today.getYear()+1903);
|
||||
WindowStore.expired = today;
|
||||
}
|
||||
else
|
||||
WindowStore.expired = expired;
|
||||
|
||||
Windows.windows.each(function(win) {
|
||||
win.setCookie(win.getId(), WindowStore.expired);
|
||||
});
|
||||
|
||||
// Create observer on show/hide events
|
||||
var myObserver = {
|
||||
onShow: function(eventName, win) {
|
||||
WindowStore._saveCookie();
|
||||
},
|
||||
|
||||
onClose: function(eventName, win) {
|
||||
WindowStore._saveCookie();
|
||||
},
|
||||
|
||||
onHide: function(eventName, win) {
|
||||
WindowStore._saveCookie();
|
||||
}
|
||||
}
|
||||
Windows.addObserver(myObserver);
|
||||
|
||||
WindowStore._restoreWindows();
|
||||
WindowStore._saveCookie();
|
||||
},
|
||||
|
||||
show: function(win) {
|
||||
eval("var cookie = " + WindowUtilities.getCookie(WindowStore.cookieName));
|
||||
if (cookie != null) {
|
||||
if (cookie[win.getId()])
|
||||
win.show();
|
||||
}
|
||||
else
|
||||
win.show();
|
||||
},
|
||||
|
||||
// Function to store windows show/hide status in a cookie
|
||||
_saveCookie: function() {
|
||||
if (!doSetCookie)
|
||||
return;
|
||||
|
||||
var cookieValue = "{";
|
||||
Windows.windows.each(function(win) {
|
||||
if (cookieValue != "{")
|
||||
cookieValue += ","
|
||||
cookieValue += win.getId() + ": " + win.isVisible();
|
||||
});
|
||||
cookieValue += "}"
|
||||
|
||||
WindowUtilities.setCookie(cookieValue, [WindowStore.cookieName, WindowStore.expired]);
|
||||
},
|
||||
|
||||
// Function to restore windows show/hide status from a cookie if exists
|
||||
_restoreWindows: function() {
|
||||
eval("var cookie = " + WindowUtilities.getCookie(WindowStore.cookieName));
|
||||
if (cookie != null) {
|
||||
doSetCookie = false;
|
||||
Windows.windows.each(function(win) {
|
||||
if (cookie[win.getId()])
|
||||
win.show();
|
||||
});
|
||||
}
|
||||
doSetCookie = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Object to set a close key an all windows
|
||||
WindowCloseKey = {
|
||||
keyCode: Event.KEY_ESC,
|
||||
|
||||
init: function(keyCode) {
|
||||
if (keyCode)
|
||||
WindowCloseKey.keyCode = keyCode;
|
||||
|
||||
Event.observe(document, 'keydown', this._closeCurrentWindow.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
_closeCurrentWindow: function(event) {
|
||||
var e = event || window.event
|
||||
var characterCode = e.which || e.keyCode;
|
||||
|
||||
// Check if there is a top window (it means it's an URL content)
|
||||
var win = top.Windows.focusedWindow;
|
||||
if (characterCode == WindowCloseKey.keyCode && win) {
|
||||
if (win.cancelCallback)
|
||||
top.Dialog.cancelCallback();
|
||||
else if (win.okCallback)
|
||||
top.Dialog.okCallback();
|
||||
else
|
||||
top.Windows.close(top.Windows.focusedWindow.getId());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user