1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

Outdated JS file removal

This commit is contained in:
Cameron 2013-02-28 06:31:37 -08:00
parent aa26b0ba36
commit 483c20d71d
5 changed files with 0 additions and 1090 deletions

View File

@ -1,231 +0,0 @@
print_a = function(){
if(window.console)
$A(arguments).each( function(a) {console.log(a) });
};
var_dump = print_a;
var e107Debug = {
init: function() {
//always on top!
this.debugE = new Element('div', { 'id': 'e-debug-console', 'style': 'z-index: 9991' } ).update(this._console_header);
this.cont = new Element('div', { 'id': 'e-debug-console-cont', 'style': 'z-index: 9990' } ).insert(this.debugE);
this.input = new Element('input', { 'id': 'e-debug-console-input', 'type': 'text' } );
this.controlC = new Element('a', { 'id': 'e-debug-console-controls-close', 'href': '#' } ).update(' X');
this.controlE = new Element('a', { 'id': 'e-debug-console-controls-eval', 'href': '#' } ).update(' Run ');
//var controlCC = new Element('div', { 'float': 'right' }).insert(this.controlC);
this.cont.insert( new Element('div', { 'id': 'e-debug-console-controls' }).update('>> ').insert(this.input).insert(this.controlE).insert(this.controlC) );
this.commands = new Array('');
this.clen = this.commands.length;
this.cindex = 0;
var C = this;
(function() {
C.controlC.observe('click', function(e) {
e.stop();
C.hide();
});
C.controlE.observe('click', function(e) {
e.stop();
C.evalInput(); C.setFocus();
});
C.input.observe('keydown', function(e) { //supported in all modern browsers
var keycode = e.keyCode;
var enterKey, escapeKey, keyUp, keyDown;
if (e.DOM_VK_RETURN) { // mozilla
enterKey = e.DOM_VK_RETURN;
escapeKey = e.DOM_VK_ESCAPE;
keyUp = e.DOM_VK_UP;
keyDown = e.DOM_VK_DOWN;
} else { // ie && friends
escapeKey = 27;
enterKey = 13;
keyUp = 38;
keyDown = 40;
}
switch (keycode) {
case enterKey:
C.evalInput();
break;
case keyUp:
C.chistory(-1);
break;
case keyDown:
C.chistory(1);
break;
case escapeKey:
C.input.value = ''; C.input.blur(); C.input.focus();
break;
}
});
//TODO - destroy method, console commands (e.g. \run -help), better key navigation (e.g. Ctrl + Shift + Key)
}).defer();
document.observe('dom:loaded', function() {
$(document.body).insert(this.cont.hide());
if(Prototype.Browser.IE6) this.iecenter();
else this.center();
}.bind(this));
this.keyboardNav = this.keyboardNav.bindAsEventListener(this);
this.re_center = this.center.bindAsEventListener(this);
this.re_iecenter = this.iecenter.bindAsEventListener(this);
this.startKeyboardNav();
},
show: function() {
if(!this.visible()) {
this.startPosObserve();
this._toggle();
}
},
hide: function() {
if(this.visible()) {
this.stopPosObserve();
this._toggle();
}
},
_toggle: function() {
var C = this;
Effect.toggle(this.cont, 'blind', {
duration: 0.4,
beforeStart: this.setFocus.bind(C),
afterFinish: this.setFocus.bind(C)
});
this.cindex = 0; //reset commands index
},
visible: function() {
return this.cont.visible();
},
center: function() {
var w = document.viewport.getWidth(), cw = this.cont.getWidth();
var pos = parseInt(w/2 - cw/2);
this.cont.setStyle({ 'left': pos + 'px'});
},
iecenter: function() {
var offset = document.body.scrollTop;
var w = document.body.clientWidth;
if(!this.cd) this.cd = this.cont.getWidth();
var left = parseInt(w/2 - this.cd/2);
if(left < 0) { //ie6 - sick of it
left = 0;
}
this.cont.setStyle( {
'position': 'absolute',
'top': offset + 'px',
'left': left + 'px'
});
},
setFocus: function() {
if(this.visible()) { this.input.blur(); this.input.focus(); this.scrollDown(); }
else { this.input.value = ''; this.scrollDown(); this.input.blur(); }
},
scrollDown: function() {
this.debugE.scrollTop = this.debugE.scrollHeight;
},
log: function(d) {
this.show();
this.debugE.insert( new Element('div', { 'class': 'console-output' }).update(d) ); //TODO check the type
this.scrollDown();
},
syslog: function(msg, error) {
var logcol = '#333300';
if(error) logcol = '#cc3300';
this.log('<span style="color: ' + logcol + '">&gt;&gt; ' + msg + '</span>');
},
clearLog: function(d) {
this.debugE.update('');
},
evalInput: function() {
var src = this.input.value;
if(!src.length) return;
this.syslog(src);
this.input.value = '';
try {
var ret = eval.call(window, src);
if(ret) this.log(ret);
//setTimeout(src, 0); - Safari only! Not implemented anyway
this.clen = this.commands.push(src);
this.cindex = 0;
} catch(e) {
this.syslog(e, true);
this.clen = this.commands.push(src);
this.cindex = 0;
}
this.setFocus();
},
startKeyboardNav: function() {
document.observe('keydown', this.keyboardNav);
return this;
},
startPosObserve: function() {
if(Prototype.Browser.IE6) {
Event.observe(window,"resize", this.re_iecenter);
Event.observe(window,"scroll", this.re_iecenter);
return this;
}
Event.observe(window,"resize", this.re_center);
return this;
},
stopPosObserve: function() {
if(Prototype.Browser.IE6) {
Event.stopObserving(window,"scroll", this.re_iecenter);
Event.stopObserving(window,"resize", this.re_iecenter);
return this;
}
Event.stopObserving(window,"resize", this.re_center);
return this;
},
keyboardNav: function(event) {
//TODO - find out what kind of shortcuts are safe to be used (Ctrl + Alt + Shift brings me too much irritation)
var keycode = event.keyCode;
var key = String.fromCharCode(keycode).toLowerCase();
var isShifthPressed = event.shiftKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'shift'); //ie & friends
var isCtrlPressed = event.ctrlKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'control'); //ie & friends
var isAltPressed = event.altKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'alt'); //ie & friends
if(isShifthPressed && isCtrlPressed && isAltPressed && key.match(/c|l/) /* && event.element() != this.input */ ) {
if(this.visible()) this.stopPosObserve()._toggle();
else this.startPosObserve()._toggle();
}
},
chistory: function(index) {
var ci = this.clen + this.cindex + index;
if(this.commands[ci] || ci === 0 || ci === this.clen) {
this.input.value = this.commands[ci] || '';
this.cindex += index;
}
},
_console_header: '<span class="smallblacktext">--- <strong>e107 Debug Console v1.0.0:</strong> session started ---</span><br />'
}
e107Debug.init();
echo = function() {
$A(arguments).each( function(a) { e107Debug.log(a) });
}

View File

@ -1,159 +0,0 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* DECORATE HTML LIST ELEMENTS
* Inspired by Magento' decorate JS functions (www.magentocommerce.com)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/decorate.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
e107Utils.Decorate = {
/**
* Decorate table rows and cells, tbody etc
* @see e107Utils.Decorate._decorate()
*/
table: function(table) {
var table = $(table);
if (!table) return;
//default options
this._options = {
'tbody': false,
'tbody_tr': 'odd even first last',
'thead_tr': 'first last',
'tfoot_tr': 'first last',
'tr_td': false
};
// overload options
Object.extend(this._options, (arguments[1] || {}));
// decorate
if (this._options['tbody']) {
this._decorate(table.select('tbody'), this._options['tbody']);
}
if (this._options['tbody_tr']) {
this._decorate(table.select('tbody tr:not(.no-decorate)'), this._options['tbody_tr']);
}
if (this._options['thead_tr']) {
this._decorate(table.select('thead tr:not(.no-decorate)'), this._options['thead_tr']);
}
if (this._options['tfoot_tr']) {
this._decorate(table.select('tfoot tr:not(.no-decorate)'), this._options['tfoot_tr']);
}
if (this._options['tr_td']) {
table.select('tr:not(.no-decorate)').each( function(tr) {
this._decorate(tr.select('td:not(.no-decorate)'), this._options['tr_td']);
}.bind(this));
}
},
/**
* Decorate list (ul)
* Default decorate CSS classes for list items are "odd", "even" and "last"
*
* Examples:
* e107Utils.Decorate.list('mylist'); //default decorate options over element with id 'mylist'
* e107Utils.Decorate.list('mylist', 'odd even'); //decorate options odd and even only over element with id 'mylist'
*
* @param list - id/DOM object of list element (ul) to be decorated
* [@param options] - string|array decorate options - @see e107Utils.Decorate._decorate()
* [@param recursive] - boolean decorate all childs if present
*/
list: function(list) {
list = $(list);
if (list) {
if (!varset(arguments[2])) {
var items = list.select('li:not(.no-decorate)');
} else {
var items = list.childElements();
}
this._decorate(items, (arguments[1] || 'odd even last'));
}
},
/**
* Set "odd", "even" and "last" CSS classes for list items
*
* Examples:
* e107Utils.Decorate.dataList('mydatalist'); //default decorate options over element with id 'mydatalist'
* e107Utils.Decorate.dataList('mydatalist', 'odd even'); //decorate options odd and even for dt elements, default for dd elements
*
* [@param dt_options] - string|array dt element decorate options - @see e107Utils.Decorate._decorate()
* [@param dd_options] - string|array dd element decorate options - @see e107Utils.Decorate._decorate()
*/
dataList: function(list) {
list = $(list);
if (list) {
this._decorate(list.select('dt:not(.no-decorate)'), (arguments[1] || 'odd even last'));
this._decorate(list.select('dd:not(.no-decorate)'), (arguments[2] || 'odd even last'));
}
},
/**
* Add classes to specified elements.
* Supported classes are: 'odd', 'even', 'first', 'last'
*
* @param elements - array of elements to be decorated
* [@param decorateParams] - array of classes to be set. If omitted or empty, all available will be used
*/
_decorate: function(elements) {
var decorateAllParams = $w('odd even first last');
this.decorateParams = $A();
this.params = {};
if (!elements.length) return;
if(!varset(arguments[1])) {
this.decorateParams = decorateAllParams;
} else if(typeof(arguments[1]) == 'string') {
this.decorateParams = $w(arguments[1]);
} else {
this.decorateParams = arguments[1];
}
decorateAllParams.each( function(v) {
this.params[v] = this.decorateParams.include(v);
}.bind(this));
// decorate first
if(this.params.first) {
Element.addClassName(elements[0], 'first');
}
// decorate last
if(this.params.last) {
Element.addClassName(elements[elements.length-1], 'last');
}
if(!this.params.even && !this.params.odd) {
return;
}
var selections = elements.partition(this._isEven);
if(this.params.even) {
selections[0].invoke('addClassName', 'even');
}
if(this.params.odd) {
selections[1].invoke('addClassName', 'odd');
}
},
/**
* Select/Reject/Partition callback function
*
* @see e107Utils.Decorate._decorate()
*/
_isEven: function(dummy, i) {
return ((i+1) % 2 == 0);
}
}

View File

@ -1,295 +0,0 @@
/**
* Global prefs
*/
e107Base.setPrefs('core-shadow', {
theme: "e107_shadow",
focus: false,
zIndex: 100
});
/*
* Class: e107Widgets.Shadow Add shadow around a DOM element. The element MUST BE in
* ABSOLUTE position.
*
* Shadow can be skinned by CSS (see e107_shadow.css). CSS
* must be included to see shadow.
*
* A shadow can have two states: focused and blur. Shadow shifts are set in CSS
* file as margin and padding of shadow_container to add visual information.
*
* Example: new e107Widgets.Shadow("element_id");
*/
e107Widgets.Shadow = Class.create(e107WidgetAbstract, {
/*
* Method: initialize Constructor, adds shadow elements to the DOM if
* element is in the DOM. Element MUST BE in ABSOLUTE position.
* Parameters: element - DOM element options - Hashmap of options -
* theme (default: mac_shadow) - focus (default: true) - zIndex
* (default: 100)
*/
initialize: function(element, options) {
this.initMod('core-shadow', options);
this.element = $(element);
this.create();
this.iframe = e107API.Browser.IE && e107API.Browser.IE < 7 ? new e107Utils.IframeShim() : null;
this.render();
},
/*
* Method: destroy Destructor, removes elements from the DOM
*/
destroy: function() {
if (this.shadow.parentNode)
this.remove();
},
// Group: Size and Position
/*
* Method: setPosition Sets top/left shadow position in pixels
* Parameters: top - top position in pixel left - left position in pixel
*/
setPosition: function(top, left) {
if (this.shadowSize) {
var shadowStyle = this.shadow.style;
top = parseInt(top) - this.shadowSize.top + this.shadowShift.top;
left = parseInt(left) - this.shadowSize.left + this.shadowShift.left;
shadowStyle.top = top + 'px';
shadowStyle.left = left + 'px';
if (this.iframe)
this.iframe.setPosition(top, left);
}
return this;
},
/*
* Method: setSize Sets width/height shadow in pixels
* Parameters: width - width in pixel height - height in pixel
*/
setSize: function(width, height) {
if (this.shadowSize) {
try {
var w = Math.max(0, parseInt(width) + this.shadowSize.width - this.shadowShift.width) + "px";
this.shadow.style.width = w;
var h = Math.max(0, parseInt(height) - this.shadowShift.height) + "px";
// this.shadowContents[1].style.height = h;
this.shadowContents[1].childElements().each(function(e) {
e.style.height = h
});
this.shadowContents.each(function(item) {
item.style.width = w
});
if (this.iframe)
this.iframe.setSize(width + this.shadowSize.width - this.shadowShift.width, height + this.shadowSize.height - this.shadowShift.height);
} catch (e) {
// IE could throw an exception if called to early
}
}
return this;
},
/*
* Method: setBounds Sets shadow bounds in pixels
* Parameters: bounds - an Hash {top:, left:, width:, height:}
*/
setBounds: function(bounds) {
return this.setPosition(bounds.top, bounds.left).setSize(bounds.width, bounds.height);
},
/*
* Method: setZIndex Sets shadow z-index
* Parameters: zIndex - zIndex value
*/
setZIndex: function(zIndex) {
this.shadow.style.zIndex = zIndex;
return this;
},
// Group: Render
/*
* Method: show Displays shadow
*/
show: function() {
this.render();
this.shadow.show();
if (this.iframe)
this.iframe.show();
return this;
},
/*
* Method: hide Hides shadow
*/
hide: function() {
this.shadow.hide();
if (this.iframe)
this.iframe.hide();
return this;
},
/*
* Method: remove Removes shadow from the DOM
*/
remove: function() {
this.shadow.remove();
return this;
},
// Group: Status
/*
* Method: focus Focus shadow.
* Change shadow shift. Shift values are set in CSS file as margin and
* padding of shadow_container to add visual information of shadow
* status.
*/
focus: function() {
this.options.focus = true;
this.updateShadow();
return this;
},
/*
* Method: blur Blurs shadow.
* Change shadow shift. Shift values are set in CSS file as margin and
* padding of shadow_container to add visual information of shadow
* status.
*/
blur: function() {
this.options.focus = false;
this.updateShadow();
return this;
},
// Private Functions
// Adds shadow elements to DOM, computes shadow size and displays it
render: function() {
if (this.element.parentNode && !Object.isElement(this.shadow.parentNode)) {
this.element.parentNode.appendChild(this.shadow);
this.computeSize();
this.setBounds(Object.extend(this.element.getDimensions(), this.getElementPosition()));
this.shadow.show();
}
return this;
},
// Creates HTML elements without inserting them into the DOM
create: function() {
var zIndex = this.element.getStyle('zIndex');
zIndex = (zIndex || this.options.zIndex) - 1;
this.element.setStyle( {
zIndex: zIndex
});
this.shadowContents = new Array(3);
this.shadowContents[0] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper"
}).insert(new Element("div", {
className: "n_shadow"
}))).insert(new Element("div", {
className: "shadow_right ne_shadow"
})).insert(new Element("div", {
className: "shadow_left nw_shadow"
}));
this.shadowContents[1] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper c_shadow"
})).insert(new Element("div", {
className: "shadow_right e_shadow"
})).insert(new Element("div", {
className: "shadow_left w_shadow"
}));
this.centerElements = this.shadowContents[1].childElements();
this.shadowContents[2] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper"
}).insert(new Element("div", {
className: "s_shadow"
}))).insert(new Element("div", {
className: "shadow_right se_shadow"
})).insert(new Element("div", {
className: "shadow_left sw_shadow"
}));
this.shadow = new Element("div", {
className: "shadow_container " + this.options.theme,
style: "position:absolute; top:-10000px; left:-10000px; display:none; z-index:" + zIndex
}).insert(this.shadowContents[0]).insert(this.shadowContents[1]).insert(this.shadowContents[2]);
},
// Compute shadow size
computeSize: function() {
if (this.focusedShadowShift)
return;
this.shadow.show();
// Trick to get shadow shift designed in CSS as padding
var content = this.shadowContents[1].select("div.c_shadow").first();
this.unfocusedShadowShift = {};
this.focusedShadowShift = {};
$w("top left bottom right").each(function(pos) {
this.unfocusedShadowShift[pos] = content.getNumStyle("padding-" + pos) || 0
}.bind(this));
this.unfocusedShadowShift.width = this.unfocusedShadowShift.left + this.unfocusedShadowShift.right;
this.unfocusedShadowShift.height = this.unfocusedShadowShift.top + this.unfocusedShadowShift.bottom;
$w("top left bottom right").each(function(pos) {
this.focusedShadowShift[pos] = content.getNumStyle("margin-" + pos) || 0
}.bind(this));
this.focusedShadowShift.width = this.focusedShadowShift.left + this.focusedShadowShift.right;
this.focusedShadowShift.height = this.focusedShadowShift.top + this.focusedShadowShift.bottom;
this.shadowShift = this.options.focus ? this.focusedShadowShift : this.unfocusedShadowShift;
// Get shadow size
this.shadowSize = {
top: this.shadowContents[0].childElements()[1].getNumStyle("height"),
left: this.shadowContents[0].childElements()[1].getNumStyle("width"),
bottom: this.shadowContents[2].childElements()[1].getNumStyle("height"),
right: this.shadowContents[0].childElements()[2].getNumStyle("width")
};
this.shadowSize.width = this.shadowSize.left + this.shadowSize.right;
this.shadowSize.height = this.shadowSize.top + this.shadowSize.bottom;
// Remove padding
content.setStyle("padding:0; margin:0");
this.shadow.hide();
},
// Update shadow size (called when it changes from focused to blur and
// vice-versa)
updateShadow: function() {
this.shadowShift = this.options.focus ? this.focusedShadowShift : this.unfocusedShadowShift;
var shadowStyle = this.shadow.style,
pos = this.getElementPosition(),
size = this.element.getDimensions();
shadowStyle.top = pos.top - this.shadowSize.top + this.shadowShift.top + 'px';
shadowStyle.left = pos.left - this.shadowSize.left + this.shadowShift.left + 'px';
shadowStyle.width = size.width + this.shadowSize.width - this.shadowShift.width + "px";
var h = parseInt(size.height - this.shadowShift.height) + "px";
this.centerElements.each(function(e) {
e.style.height = h
});
var w = parseInt(size.width + this.shadowSize.width - this.shadowShift.width) + "px";
this.shadowContents.each(function(item) {
item.style.width = w
});
},
// Get element position in integer values
getElementPosition: function() {
return {
top: this.element.getNumStyle("top"),
left: this.element.getNumStyle("left")
}
}
});

View File

@ -1,328 +0,0 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* e107Widget.Tabs Class
*
* Create tabs, supports ajax/inline content, browser history & bookmarks
* (unobtrusive Javascript)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/tabs.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
/**
* Global prefs
*/
e107Base.setPrefs('core-tabs', {
tabsClassName: 'e-tabs',
bookmarkFix: true,
historyNavigation: false,
pageOverlay: false,
elementOverlay: true,
ajaxCache: true
});
e107Widgets.Tabs = Class.create(e107WidgetAbstract, {
initialize: function(container, options) {
this.Version = '1.0';
this.events = new e107EventManager(this);
var optHandlers = {
show: this.show,
hide: this.hide
}
Object.extend(optHandlers , options || {});
this.global = this;
this.initMod('core-tabs', optHandlers).__initTabData(container);
},
__initTabData: function(container) {
var cstring, celement = $(container);
if(null === celement)
throw('e107Widgets.Tabs: invalid value for container'); //TODO Lan
if(Object.isString(container)) {
cstring = container;
} else if(Object.isElement(container)) {
cstring = celement.identify();
}
this.histotyHash = ('etab-' + cstring).camelize();
if(!this.getModCache('-data')) {
this.setModCache('-data', {});
}
this.tabData = this.getModCache('-data')['ref-' + cstring];
this._observer = this.observer.bindAsEventListener(this); //click observer
if(!this.tabData && !this.___initialized) {
if(this.options.bookmarkFix || this.options.historyNavigation) this.options.history = true;
this.___methods = $w('show hide select tabSelect ajaxSelect visible getPanelId getMenuId startObserve stopObserve getPanelId getPanel getMenuId getMenu');
this.tabData = {
container: celement,
list: $A()
}
if(celement.nodeName.toLowerCase != 'ul')
var celements = celement.select('ul.' + this.options.tabsClassName + ' > li');
else
var celements = $$('body')[0].select(cstring + ' > li');
celements.inject(this.tabData.list, function(arr, elitem, i) {
var mid = elitem.identify(),
a = elitem.select('a')[0],
act = a.hash.substr(1),
cid = $(act);
var that = this;
arr[i] = { Index: i, menuId: mid, menu: elitem, menuAction: act, actionItem: a, panel: cid, panelId: cid.id, ajaxUrl: a.readAttribute('rel'), global: that, exec: that._exec.bind(that, i) };
this._extendTab(arr[i]);
return arr;
}.bind(this));
this.exec_recursive('hide').getDefault().select();
this.startEvents();
this.___initialized = true;
this.getModCache('-data')['ref-' + cstring] = this.tabData;
}
},
_extendTab: function(data) {
this.___methods.inject(data, function(obj, method) {
obj[method] = this[method].bind(this, obj);
return obj;
}.bind(this));
data.events = new e107EventManager(this);
data.options = this.options;
data.histotyHash = this.histotyHash;
return this._detectLoad(data);
},
_detectLoad: function(tab) {
if(tab.ajaxUrl) {
var lopts = $w(tab.ajaxUrl).detect(function (values) {
return values.startsWith('ajax-tab');
});
if(lopts) {
var link = tab.actionItem.readAttribute('href').split('#')[0]; //link url
tab.ajaxUrl = link ? link : document.location.href.split('#')[0]; //self url
}
return tab;
}
tab.ajaxUrl = false;
return tab;
},
_exec: function(index, method, options) {
if(!this.___methods.include(method) || !this.tabData.list[index]) {
throw('e107Widgets.Tabs._exec: wrong method or object not found!');
}
this.tabData.list[index][method](options);
return this.tabData.list[index];
},
/**
* Available only in instance' global scope
*/
exec: function(index, method, options) {
this.tabData.list[index].exec(method, options || {});
return this;
},
/**
* Available only in instance' global scope
*/
exec_recursive: function(method, except, options) {
if(except)
this.tabData.list.without(except).invoke('exec', method, options || {});
else
this.tabData.list.invoke('exec', method, options || {});
return this;
},
_getTabByIdnex: function(index) {
return this.tabData.list[index] || null;
},
_getTabByPanelId: function(name) {
return this.tabData.list.find(function(tab_obj) { return tab_obj.getPanelId() == name }) || null;
},
/**
* Available only in instance' global scope
*/
get: function(tab) {
if(Object.isNumber(tab))
return this._getTabByIdnex(tab);
else if(Object.isString(tab))
return this._getTabByPanelId(tab);
return tab;
},
getPanelId: function(tab_obj) {
return tab_obj.panelId;
},
getPanel: function(tab_obj) {
return tab_obj.panel;
},
getMenuId: function(tab_obj) {
return tab_obj.menuId;
},
getMenu: function(tab_obj) {
return tab_obj.menu;
},
/**
* Available only in instance' global scope
*/
getDefault: function() {
var current = e107History.get(this.histotyHash);
if(current) {
var tab = this.get(current) || this.tabData.list[0];
this._active = tab.Index;
return tab;
}
this._active = 0;
return this.tabData.list[0];
},
getActive: function() {
if(!this.global._active) {
var _active = this.tabData.list.find(function(tab_obj) { return tab_obj.visible(); }) || null;
if(_active) {
this.global._active = _active.Index;
}
}
return this.get(this.global._active);
},
visible: function(tab) {
return tab.getPanel().visible();
},
show: function(tab) {
tab.getMenu().addClassName('active');
tab.getPanel().addClassName('active').show();
if(tab.global.options.history)
e107History.set(tab.histotyHash, tab.getPanelId());
return tab;
},
hide: function(tab) {
tab.getMenu().removeClassName('active');
tab.getPanel().removeClassName('active').hide();
return tab;
},
select: function(tab) {
if(!tab.visible()) {
if(tab.ajaxUrl)
return tab.ajaxSelect();
return tab.tabSelect();
}
return tab;
},
ajaxSelect: function(tab) {
if(!tab.ajaxUrl || (this.global.options.ajaxCache && tab.options['ajaxCached']))
return tab.tabSelect();
var ovel = this.global.options.overlayElement === true ? tab.getPanel() : $(this.global.options.overlayElement);
tab.getMenu().addClassName('active');
new e107Ajax.Updater(tab.getPanel(), tab.ajaxUrl, {
overlayPage: this.options.pageOverlay ? tab.getPanel() : false,
overlayElement: ovel || false,
onComplete: function() { tab.options.ajaxCached = this.global.options.ajaxCache; tab.tabSelect(); }.bind(this)
});
return tab;
},
tabSelect: function(tab) {
this.global.events.notify('hideActive', this.global.getActive()); //global trigger
tab.events.notify('hide', this.global.getActive()); // tab object trigger
this.options.hide(this.global.getActive());
this.global.events.notify('showSelected', tab); //global trigger
tab.events.notify('show', tab); // tab object trigger
this.options.show(tab);
this.global._active = tab.Index;
return tab;
},
startEvents: function() {
this.exec_recursive('startObserve');
this._startHistory();
return this;
},
stopEvents: function() {
this.exec_recursive('stopObserve');
this._stopHistory();
return this;
},
startObserve: function(tab) {
tab.actionItem.observe('click', this._observer); return this;
},
stopObserve: function(tab) {
tab.actionItem.stopObserving('click', this._observer); return this;
},
observer: function(event) {
var el = event.findElement('a');
if(el) {
event.stop();
this.get(el.hash.substr(1)).select();
}
},
eventObserve: function(method, callback) {
this.events.observe(method, callback); return this;
},
eventStopObserve: function() {
this.events.stopObserving(method, callback); return this;
},
_startHistory: function() {
if(this.options.historyNavigation) {
e107History.Observer.start();
var that = this;
// set handler for this instance
e107History.Registry.set({
id: this.histotyHash,
onStateChange: function(tab) {
that.get(String(tab)).select();
}
});
}
},
_stopHistory: function() {
e107History.Observer.stop();
e107History.Registry.unset(this.histotyHash);
}
});

View File

@ -1,77 +0,0 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* e107 Tooltip Widget
* Create static/ajax tooltips (unobtrusive Javascript)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/tooltip.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
/**
* Global prefs
*/
e107Base.setPrefs('core-tooltip', {
backgroundColor: '', // background color (used if set)
borderColor: '', // Default border color (used if set)
textColor: '', // Default text color (used if set)
textShadowColor: '', // Default text shadow color (used if set)
align: "left", // left (default) | right
maxWidth: 250, // Max tooltip width
delay: 250, // Default delay before tooltip appears in ms
mouseFollow: true, // Tooltips follows the mouse moving
opacity: .75, // Default tooltips opacity
appearDuration: .25, // Default appear duration in sec
hideDuration: .25 // Default disappear duration in sec
});
/**
* e107Widget.Tooltip Class
*
* Inspired by CoolTip by Andrey Okonetchnikov
* (http://www.wildbit.com/labs/cooltips)
*/
e107Widgets.Tooltip = Class.create(e107WidgetAbstract, {
Version: '1.0',
initialize: function(element, options) {
this.events = new e107EventManager(this);
this.ttinit = false;
this.initMod('core-tooltip', optHandlers).__initTabData(container);
this.attachListeners();
},
show: function(e) {
},
hide: function(e) {
},
update: function(e){
},
create: function() {
},
attachListeners: function() {
},
_clearTimeout: function(timer) {
clearTimeout(timer);
clearInterval(timer);
return null;
}
});