Removed weird line endings.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2841 e3e1d417-86f3-4887-817a-d78f3d33393fpull/27/merge
parent
fa5db09a73
commit
41f90e44ab
|
@ -1,145 +1,145 @@
|
|||
//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
|
||||
|
||||
/*
|
||||
Script: Fx.Slide.js
|
||||
Effect to slide an element in and out of view.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
Fx.Slide = new Class({
|
||||
|
||||
Extends: Fx,
|
||||
|
||||
options: {
|
||||
mode: 'vertical'
|
||||
},
|
||||
|
||||
initialize: function(element, options){
|
||||
this.addEvent('complete', function(){
|
||||
this.open = (this.wrapper['offset' + this.layout.capitalize()] != 0);
|
||||
if (this.open && Browser.Engine.webkit419) this.element.dispose().inject(this.wrapper);
|
||||
}, true);
|
||||
this.element = this.subject = $(element);
|
||||
this.parent(options);
|
||||
var wrapper = this.element.retrieve('wrapper');
|
||||
this.wrapper = wrapper || new Element('div', {
|
||||
styles: $extend(this.element.getStyles('margin', 'position'), {'overflow': 'hidden'})
|
||||
}).wraps(this.element);
|
||||
this.element.store('wrapper', this.wrapper).setStyle('margin', 0);
|
||||
this.now = [];
|
||||
this.open = true;
|
||||
},
|
||||
|
||||
vertical: function(){
|
||||
this.margin = 'margin-top';
|
||||
this.layout = 'height';
|
||||
this.offset = this.element.offsetHeight;
|
||||
},
|
||||
|
||||
horizontal: function(){
|
||||
this.margin = 'margin-left';
|
||||
this.layout = 'width';
|
||||
this.offset = this.element.offsetWidth;
|
||||
},
|
||||
|
||||
set: function(now){
|
||||
this.element.setStyle(this.margin, now[0]);
|
||||
this.wrapper.setStyle(this.layout, now[1]);
|
||||
return this;
|
||||
},
|
||||
|
||||
compute: function(from, to, delta){
|
||||
var now = [];
|
||||
var x = 2;
|
||||
x.times(function(i){
|
||||
now[i] = Fx.compute(from[i], to[i], delta);
|
||||
});
|
||||
return now;
|
||||
},
|
||||
|
||||
start: function(how, mode){
|
||||
if (!this.check(arguments.callee, how, mode)) return this;
|
||||
this[mode || this.options.mode]();
|
||||
var margin = this.element.getStyle(this.margin).toInt();
|
||||
var layout = this.wrapper.getStyle(this.layout).toInt();
|
||||
var caseIn = [[margin, layout], [0, this.offset]];
|
||||
var caseOut = [[margin, layout], [-this.offset, 0]];
|
||||
var start;
|
||||
switch (how){
|
||||
case 'in': start = caseIn; break;
|
||||
case 'out': start = caseOut; break;
|
||||
case 'toggle': start = (this.wrapper['offset' + this.layout.capitalize()] == 0) ? caseIn : caseOut;
|
||||
}
|
||||
return this.parent(start[0], start[1]);
|
||||
},
|
||||
|
||||
slideIn: function(mode){
|
||||
return this.start('in', mode);
|
||||
},
|
||||
|
||||
slideOut: function(mode){
|
||||
return this.start('out', mode);
|
||||
},
|
||||
|
||||
hide: function(mode){
|
||||
this[mode || this.options.mode]();
|
||||
this.open = false;
|
||||
return this.set([-this.offset, 0]);
|
||||
},
|
||||
|
||||
show: function(mode){
|
||||
this[mode || this.options.mode]();
|
||||
this.open = true;
|
||||
return this.set([0, this.offset]);
|
||||
},
|
||||
|
||||
toggle: function(mode){
|
||||
return this.start('toggle', mode);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Element.Properties.slide = {
|
||||
|
||||
set: function(options){
|
||||
var slide = this.retrieve('slide');
|
||||
if (slide) slide.cancel();
|
||||
return this.eliminate('slide').store('slide:options', $extend({link: 'cancel'}, options));
|
||||
},
|
||||
|
||||
get: function(options){
|
||||
if (options || !this.retrieve('slide')){
|
||||
if (options || !this.retrieve('slide:options')) this.set('slide', options);
|
||||
this.store('slide', new Fx.Slide(this, this.retrieve('slide:options')));
|
||||
}
|
||||
return this.retrieve('slide');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Element.implement({
|
||||
|
||||
slide: function(how, mode){
|
||||
how = how || 'toggle';
|
||||
var slide = this.get('slide'), toggle;
|
||||
switch (how){
|
||||
case 'hide': slide.hide(mode); break;
|
||||
case 'show': slide.show(mode); break;
|
||||
case 'toggle':
|
||||
var flag = this.retrieve('slide:flag', slide.open);
|
||||
slide[(flag) ? 'slideOut' : 'slideIn'](mode);
|
||||
this.store('slide:flag', !flag);
|
||||
toggle = true;
|
||||
break;
|
||||
default: slide.start(how, mode);
|
||||
}
|
||||
if (!toggle) this.eliminate('slide:flag');
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
/*
|
||||
Script: Fx.Slide.js
|
||||
Effect to slide an element in and out of view.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
Fx.Slide = new Class({
|
||||
|
||||
Extends: Fx,
|
||||
|
||||
options: {
|
||||
mode: 'vertical'
|
||||
},
|
||||
|
||||
initialize: function(element, options){
|
||||
this.addEvent('complete', function(){
|
||||
this.open = (this.wrapper['offset' + this.layout.capitalize()] != 0);
|
||||
if (this.open && Browser.Engine.webkit419) this.element.dispose().inject(this.wrapper);
|
||||
}, true);
|
||||
this.element = this.subject = $(element);
|
||||
this.parent(options);
|
||||
var wrapper = this.element.retrieve('wrapper');
|
||||
this.wrapper = wrapper || new Element('div', {
|
||||
styles: $extend(this.element.getStyles('margin', 'position'), {'overflow': 'hidden'})
|
||||
}).wraps(this.element);
|
||||
this.element.store('wrapper', this.wrapper).setStyle('margin', 0);
|
||||
this.now = [];
|
||||
this.open = true;
|
||||
},
|
||||
|
||||
vertical: function(){
|
||||
this.margin = 'margin-top';
|
||||
this.layout = 'height';
|
||||
this.offset = this.element.offsetHeight;
|
||||
},
|
||||
|
||||
horizontal: function(){
|
||||
this.margin = 'margin-left';
|
||||
this.layout = 'width';
|
||||
this.offset = this.element.offsetWidth;
|
||||
},
|
||||
|
||||
set: function(now){
|
||||
this.element.setStyle(this.margin, now[0]);
|
||||
this.wrapper.setStyle(this.layout, now[1]);
|
||||
return this;
|
||||
},
|
||||
|
||||
compute: function(from, to, delta){
|
||||
var now = [];
|
||||
var x = 2;
|
||||
x.times(function(i){
|
||||
now[i] = Fx.compute(from[i], to[i], delta);
|
||||
});
|
||||
return now;
|
||||
},
|
||||
|
||||
start: function(how, mode){
|
||||
if (!this.check(arguments.callee, how, mode)) return this;
|
||||
this[mode || this.options.mode]();
|
||||
var margin = this.element.getStyle(this.margin).toInt();
|
||||
var layout = this.wrapper.getStyle(this.layout).toInt();
|
||||
var caseIn = [[margin, layout], [0, this.offset]];
|
||||
var caseOut = [[margin, layout], [-this.offset, 0]];
|
||||
var start;
|
||||
switch (how){
|
||||
case 'in': start = caseIn; break;
|
||||
case 'out': start = caseOut; break;
|
||||
case 'toggle': start = (this.wrapper['offset' + this.layout.capitalize()] == 0) ? caseIn : caseOut;
|
||||
}
|
||||
return this.parent(start[0], start[1]);
|
||||
},
|
||||
|
||||
slideIn: function(mode){
|
||||
return this.start('in', mode);
|
||||
},
|
||||
|
||||
slideOut: function(mode){
|
||||
return this.start('out', mode);
|
||||
},
|
||||
|
||||
hide: function(mode){
|
||||
this[mode || this.options.mode]();
|
||||
this.open = false;
|
||||
return this.set([-this.offset, 0]);
|
||||
},
|
||||
|
||||
show: function(mode){
|
||||
this[mode || this.options.mode]();
|
||||
this.open = true;
|
||||
return this.set([0, this.offset]);
|
||||
},
|
||||
|
||||
toggle: function(mode){
|
||||
return this.start('toggle', mode);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Element.Properties.slide = {
|
||||
|
||||
set: function(options){
|
||||
var slide = this.retrieve('slide');
|
||||
if (slide) slide.cancel();
|
||||
return this.eliminate('slide').store('slide:options', $extend({link: 'cancel'}, options));
|
||||
},
|
||||
|
||||
get: function(options){
|
||||
if (options || !this.retrieve('slide')){
|
||||
if (options || !this.retrieve('slide:options')) this.set('slide', options);
|
||||
this.store('slide', new Fx.Slide(this, this.retrieve('slide:options')));
|
||||
}
|
||||
return this.retrieve('slide');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Element.implement({
|
||||
|
||||
slide: function(how, mode){
|
||||
how = how || 'toggle';
|
||||
var slide = this.get('slide'), toggle;
|
||||
switch (how){
|
||||
case 'hide': slide.hide(mode); break;
|
||||
case 'show': slide.show(mode); break;
|
||||
case 'toggle':
|
||||
var flag = this.retrieve('slide:flag', slide.open);
|
||||
slide[(flag) ? 'slideOut' : 'slideIn'](mode);
|
||||
this.store('slide:flag', !flag);
|
||||
toggle = true;
|
||||
break;
|
||||
default: slide.start(how, mode);
|
||||
}
|
||||
if (!toggle) this.eliminate('slide:flag');
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|
@ -519,56 +519,56 @@ Element.implement({
|
|||
});
|
||||
|
||||
|
||||
/*
|
||||
Script: Hash.Cookie.js
|
||||
Class for creating, reading, and deleting Cookies in JSON format.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
Hash.Cookie = new Class({
|
||||
|
||||
Extends: Cookie,
|
||||
|
||||
options: {
|
||||
autoSave: true
|
||||
},
|
||||
|
||||
initialize: function(name, options){
|
||||
this.parent(name, options);
|
||||
this.load();
|
||||
},
|
||||
|
||||
save: function(){
|
||||
var value = JSON.encode(this.hash);
|
||||
if (!value || value.length > 4096) return false; //cookie would be truncated!
|
||||
if (value == '{}') this.dispose();
|
||||
else this.write(value);
|
||||
return true;
|
||||
},
|
||||
|
||||
load: function(){
|
||||
this.hash = new Hash(JSON.decode(this.read(), true));
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Hash.Cookie.implement((function(){
|
||||
|
||||
var methods = {};
|
||||
|
||||
Hash.each(Hash.prototype, function(method, name){
|
||||
methods[name] = function(){
|
||||
var value = method.apply(this.hash, arguments);
|
||||
if (this.options.autoSave) this.save();
|
||||
return value;
|
||||
};
|
||||
});
|
||||
|
||||
return methods;
|
||||
|
||||
/*
|
||||
Script: Hash.Cookie.js
|
||||
Class for creating, reading, and deleting Cookies in JSON format.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
Hash.Cookie = new Class({
|
||||
|
||||
Extends: Cookie,
|
||||
|
||||
options: {
|
||||
autoSave: true
|
||||
},
|
||||
|
||||
initialize: function(name, options){
|
||||
this.parent(name, options);
|
||||
this.load();
|
||||
},
|
||||
|
||||
save: function(){
|
||||
var value = JSON.encode(this.hash);
|
||||
if (!value || value.length > 4096) return false; //cookie would be truncated!
|
||||
if (value == '{}') this.dispose();
|
||||
else this.write(value);
|
||||
return true;
|
||||
},
|
||||
|
||||
load: function(){
|
||||
this.hash = new Hash(JSON.decode(this.read(), true));
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Hash.Cookie.implement((function(){
|
||||
|
||||
var methods = {};
|
||||
|
||||
Hash.each(Hash.prototype, function(method, name){
|
||||
methods[name] = function(){
|
||||
var value = method.apply(this.hash, arguments);
|
||||
if (this.options.autoSave) this.save();
|
||||
return value;
|
||||
};
|
||||
});
|
||||
|
||||
return methods;
|
||||
|
||||
})());
|
||||
|
||||
/*
|
||||
|
@ -1031,171 +1031,171 @@ var Sortables = new Class({
|
|||
|
||||
});
|
||||
|
||||
/*
|
||||
Script: Tips.js
|
||||
Class for creating nice tips that follow the mouse cursor when hovering an element.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var Tips = new Class({
|
||||
|
||||
Implements: [Events, Options],
|
||||
|
||||
options: {
|
||||
onShow: function(tip){
|
||||
tip.setStyle('visibility', 'visible');
|
||||
},
|
||||
onHide: function(tip){
|
||||
tip.setStyle('visibility', 'hidden');
|
||||
},
|
||||
showDelay: 100,
|
||||
hideDelay: 100,
|
||||
className: null,
|
||||
offsets: {x: 16, y: 16},
|
||||
fixed: false
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
var params = Array.link(arguments, {options: Object.type, elements: $defined});
|
||||
this.setOptions(params.options || null);
|
||||
|
||||
this.tip = new Element('div').inject(document.body);
|
||||
|
||||
if (this.options.className) this.tip.addClass(this.options.className);
|
||||
|
||||
var top = new Element('div', {'class': 'tip-top'}).inject(this.tip);
|
||||
this.container = new Element('div', {'class': 'tip'}).inject(this.tip);
|
||||
var bottom = new Element('div', {'class': 'tip-bottom'}).inject(this.tip);
|
||||
|
||||
this.tip.setStyles({position: 'absolute', top: 0, left: 0, visibility: 'hidden'});
|
||||
|
||||
if (params.elements) this.attach(params.elements);
|
||||
},
|
||||
|
||||
attach: function(elements){
|
||||
$$(elements).each(function(element){
|
||||
var title = element.retrieve('tip:title', element.get('title'));
|
||||
var text = element.retrieve('tip:text', element.get('rel') || element.get('href'));
|
||||
var enter = element.retrieve('tip:enter', this.elementEnter.bindWithEvent(this, element));
|
||||
var leave = element.retrieve('tip:leave', this.elementLeave.bindWithEvent(this, element));
|
||||
element.addEvents({mouseenter: enter, mouseleave: leave});
|
||||
if (!this.options.fixed){
|
||||
var move = element.retrieve('tip:move', this.elementMove.bindWithEvent(this, element));
|
||||
element.addEvent('mousemove', move);
|
||||
}
|
||||
element.store('tip:native', element.get('title'));
|
||||
element.erase('title');
|
||||
}, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
detach: function(elements){
|
||||
$$(elements).each(function(element){
|
||||
element.removeEvent('mouseenter', element.retrieve('tip:enter') || $empty);
|
||||
element.removeEvent('mouseleave', element.retrieve('tip:leave') || $empty);
|
||||
element.removeEvent('mousemove', element.retrieve('tip:move') || $empty);
|
||||
element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');
|
||||
var original = element.retrieve('tip:native');
|
||||
if (original) element.set('title', original);
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
elementEnter: function(event, element){
|
||||
|
||||
$A(this.container.childNodes).each(Element.dispose);
|
||||
|
||||
var title = element.retrieve('tip:title');
|
||||
|
||||
if (title){
|
||||
this.titleElement = new Element('div', {'class': 'tip-title'}).inject(this.container);
|
||||
this.fill(this.titleElement, title);
|
||||
}
|
||||
|
||||
var text = element.retrieve('tip:text');
|
||||
if (text){
|
||||
this.textElement = new Element('div', {'class': 'tip-text'}).inject(this.container);
|
||||
this.fill(this.textElement, text);
|
||||
}
|
||||
|
||||
this.timer = $clear(this.timer);
|
||||
this.timer = this.show.delay(this.options.showDelay, this);
|
||||
|
||||
this.position((!this.options.fixed) ? event : {page: element.getPosition()});
|
||||
},
|
||||
|
||||
elementLeave: function(event){
|
||||
$clear(this.timer);
|
||||
this.timer = this.hide.delay(this.options.hideDelay, this);
|
||||
},
|
||||
|
||||
elementMove: function(event){
|
||||
this.position(event);
|
||||
},
|
||||
|
||||
position: function(event){
|
||||
var size = window.getSize(), scroll = window.getScroll();
|
||||
var tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight};
|
||||
var props = {x: 'left', y: 'top'};
|
||||
for (var z in props){
|
||||
var pos = event.page[z] + this.options.offsets[z];
|
||||
if ((pos + tip[z] - scroll[z]) > size[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
|
||||
this.tip.setStyle(props[z], pos);
|
||||
}
|
||||
},
|
||||
|
||||
fill: function(element, contents){
|
||||
(typeof contents == 'string') ? element.set('html', contents) : element.adopt(contents);
|
||||
},
|
||||
|
||||
show: function(){
|
||||
this.fireEvent('show', this.tip);
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.fireEvent('hide', this.tip);
|
||||
}
|
||||
|
||||
/*
|
||||
Script: Tips.js
|
||||
Class for creating nice tips that follow the mouse cursor when hovering an element.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var Tips = new Class({
|
||||
|
||||
Implements: [Events, Options],
|
||||
|
||||
options: {
|
||||
onShow: function(tip){
|
||||
tip.setStyle('visibility', 'visible');
|
||||
},
|
||||
onHide: function(tip){
|
||||
tip.setStyle('visibility', 'hidden');
|
||||
},
|
||||
showDelay: 100,
|
||||
hideDelay: 100,
|
||||
className: null,
|
||||
offsets: {x: 16, y: 16},
|
||||
fixed: false
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
var params = Array.link(arguments, {options: Object.type, elements: $defined});
|
||||
this.setOptions(params.options || null);
|
||||
|
||||
this.tip = new Element('div').inject(document.body);
|
||||
|
||||
if (this.options.className) this.tip.addClass(this.options.className);
|
||||
|
||||
var top = new Element('div', {'class': 'tip-top'}).inject(this.tip);
|
||||
this.container = new Element('div', {'class': 'tip'}).inject(this.tip);
|
||||
var bottom = new Element('div', {'class': 'tip-bottom'}).inject(this.tip);
|
||||
|
||||
this.tip.setStyles({position: 'absolute', top: 0, left: 0, visibility: 'hidden'});
|
||||
|
||||
if (params.elements) this.attach(params.elements);
|
||||
},
|
||||
|
||||
attach: function(elements){
|
||||
$$(elements).each(function(element){
|
||||
var title = element.retrieve('tip:title', element.get('title'));
|
||||
var text = element.retrieve('tip:text', element.get('rel') || element.get('href'));
|
||||
var enter = element.retrieve('tip:enter', this.elementEnter.bindWithEvent(this, element));
|
||||
var leave = element.retrieve('tip:leave', this.elementLeave.bindWithEvent(this, element));
|
||||
element.addEvents({mouseenter: enter, mouseleave: leave});
|
||||
if (!this.options.fixed){
|
||||
var move = element.retrieve('tip:move', this.elementMove.bindWithEvent(this, element));
|
||||
element.addEvent('mousemove', move);
|
||||
}
|
||||
element.store('tip:native', element.get('title'));
|
||||
element.erase('title');
|
||||
}, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
detach: function(elements){
|
||||
$$(elements).each(function(element){
|
||||
element.removeEvent('mouseenter', element.retrieve('tip:enter') || $empty);
|
||||
element.removeEvent('mouseleave', element.retrieve('tip:leave') || $empty);
|
||||
element.removeEvent('mousemove', element.retrieve('tip:move') || $empty);
|
||||
element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');
|
||||
var original = element.retrieve('tip:native');
|
||||
if (original) element.set('title', original);
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
elementEnter: function(event, element){
|
||||
|
||||
$A(this.container.childNodes).each(Element.dispose);
|
||||
|
||||
var title = element.retrieve('tip:title');
|
||||
|
||||
if (title){
|
||||
this.titleElement = new Element('div', {'class': 'tip-title'}).inject(this.container);
|
||||
this.fill(this.titleElement, title);
|
||||
}
|
||||
|
||||
var text = element.retrieve('tip:text');
|
||||
if (text){
|
||||
this.textElement = new Element('div', {'class': 'tip-text'}).inject(this.container);
|
||||
this.fill(this.textElement, text);
|
||||
}
|
||||
|
||||
this.timer = $clear(this.timer);
|
||||
this.timer = this.show.delay(this.options.showDelay, this);
|
||||
|
||||
this.position((!this.options.fixed) ? event : {page: element.getPosition()});
|
||||
},
|
||||
|
||||
elementLeave: function(event){
|
||||
$clear(this.timer);
|
||||
this.timer = this.hide.delay(this.options.hideDelay, this);
|
||||
},
|
||||
|
||||
elementMove: function(event){
|
||||
this.position(event);
|
||||
},
|
||||
|
||||
position: function(event){
|
||||
var size = window.getSize(), scroll = window.getScroll();
|
||||
var tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight};
|
||||
var props = {x: 'left', y: 'top'};
|
||||
for (var z in props){
|
||||
var pos = event.page[z] + this.options.offsets[z];
|
||||
if ((pos + tip[z] - scroll[z]) > size[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
|
||||
this.tip.setStyle(props[z], pos);
|
||||
}
|
||||
},
|
||||
|
||||
fill: function(element, contents){
|
||||
(typeof contents == 'string') ? element.set('html', contents) : element.adopt(contents);
|
||||
},
|
||||
|
||||
show: function(){
|
||||
this.fireEvent('show', this.tip);
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.fireEvent('hide', this.tip);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
Script: SmoothScroll.js
|
||||
Class for creating a smooth scrolling effect to all internal links on the page.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var SmoothScroll = new Class({
|
||||
|
||||
Extends: Fx.Scroll,
|
||||
|
||||
initialize: function(options, context){
|
||||
context = context || document;
|
||||
var doc = context.getDocument(), win = context.getWindow();
|
||||
this.parent(doc, options);
|
||||
this.links = (this.options.links) ? $$(this.options.links) : $$(doc.links);
|
||||
var location = win.location.href.match(/^[^#]*/)[0] + '#';
|
||||
this.links.each(function(link){
|
||||
if (link.href.indexOf(location) != 0) return;
|
||||
var anchor = link.href.substr(location.length);
|
||||
if (anchor && $(anchor)) this.useLink(link, anchor);
|
||||
}, this);
|
||||
if (!Browser.Engine.webkit419) this.addEvent('complete', function(){
|
||||
win.location.hash = this.anchor;
|
||||
}, true);
|
||||
},
|
||||
|
||||
useLink: function(link, anchor){
|
||||
link.addEvent('click', function(event){
|
||||
this.anchor = anchor;
|
||||
this.toElement(anchor);
|
||||
event.stop();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
/*
|
||||
Script: SmoothScroll.js
|
||||
Class for creating a smooth scrolling effect to all internal links on the page.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var SmoothScroll = new Class({
|
||||
|
||||
Extends: Fx.Scroll,
|
||||
|
||||
initialize: function(options, context){
|
||||
context = context || document;
|
||||
var doc = context.getDocument(), win = context.getWindow();
|
||||
this.parent(doc, options);
|
||||
this.links = (this.options.links) ? $$(this.options.links) : $$(doc.links);
|
||||
var location = win.location.href.match(/^[^#]*/)[0] + '#';
|
||||
this.links.each(function(link){
|
||||
if (link.href.indexOf(location) != 0) return;
|
||||
var anchor = link.href.substr(location.length);
|
||||
if (anchor && $(anchor)) this.useLink(link, anchor);
|
||||
}, this);
|
||||
if (!Browser.Engine.webkit419) this.addEvent('complete', function(){
|
||||
win.location.hash = this.anchor;
|
||||
}, true);
|
||||
},
|
||||
|
||||
useLink: function(link, anchor){
|
||||
link.addEvent('click', function(event){
|
||||
this.anchor = anchor;
|
||||
this.toElement(anchor);
|
||||
event.stop();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
|
@ -1389,103 +1389,103 @@ var Scroller = new Class({
|
|||
|
||||
});
|
||||
|
||||
/*
|
||||
Script: Accordion.js
|
||||
An Fx.Elements extension which allows you to easily create accordion type controls.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var Accordion = new Class({
|
||||
|
||||
Extends: Fx.Elements,
|
||||
|
||||
options: {/*
|
||||
onActive: $empty,
|
||||
onBackground: $empty,*/
|
||||
display: 0,
|
||||
show: false,
|
||||
height: true,
|
||||
width: false,
|
||||
opacity: true,
|
||||
fixedHeight: false,
|
||||
fixedWidth: false,
|
||||
wait: false,
|
||||
alwaysHide: false
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
var params = Array.link(arguments, {'container': Element.type, 'options': Object.type, 'togglers': $defined, 'elements': $defined});
|
||||
this.parent(params.elements, params.options);
|
||||
this.togglers = $$(params.togglers);
|
||||
this.container = $(params.container);
|
||||
this.previous = -1;
|
||||
if (this.options.alwaysHide) this.options.wait = true;
|
||||
if ($chk(this.options.show)){
|
||||
this.options.display = false;
|
||||
this.previous = this.options.show;
|
||||
}
|
||||
if (this.options.start){
|
||||
this.options.display = false;
|
||||
this.options.show = false;
|
||||
}
|
||||
this.effects = {};
|
||||
if (this.options.opacity) this.effects.opacity = 'fullOpacity';
|
||||
if (this.options.width) this.effects.width = this.options.fixedWidth ? 'fullWidth' : 'offsetWidth';
|
||||
if (this.options.height) this.effects.height = this.options.fixedHeight ? 'fullHeight' : 'scrollHeight';
|
||||
for (var i = 0, l = this.togglers.length; i < l; i++) this.addSection(this.togglers[i], this.elements[i]);
|
||||
this.elements.each(function(el, i){
|
||||
if (this.options.show === i){
|
||||
this.fireEvent('active', [this.togglers[i], el]);
|
||||
} else {
|
||||
for (var fx in this.effects) el.setStyle(fx, 0);
|
||||
}
|
||||
}, this);
|
||||
if ($chk(this.options.display)) this.display(this.options.display);
|
||||
},
|
||||
|
||||
addSection: function(toggler, element, pos){
|
||||
toggler = $(toggler);
|
||||
element = $(element);
|
||||
var test = this.togglers.contains(toggler);
|
||||
var len = this.togglers.length;
|
||||
this.togglers.include(toggler);
|
||||
this.elements.include(element);
|
||||
if (len && (!test || pos)){
|
||||
pos = $pick(pos, len - 1);
|
||||
toggler.inject(this.togglers[pos], 'before');
|
||||
element.inject(toggler, 'after');
|
||||
} else if (this.container && !test){
|
||||
toggler.inject(this.container);
|
||||
element.inject(this.container);
|
||||
}
|
||||
var idx = this.togglers.indexOf(toggler);
|
||||
toggler.addEvent('click', this.display.bind(this, idx));
|
||||
if (this.options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
|
||||
if (this.options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
|
||||
element.fullOpacity = 1;
|
||||
if (this.options.fixedWidth) element.fullWidth = this.options.fixedWidth;
|
||||
if (this.options.fixedHeight) element.fullHeight = this.options.fixedHeight;
|
||||
element.setStyle('overflow', 'hidden');
|
||||
if (!test){
|
||||
for (var fx in this.effects) element.setStyle(fx, 0);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
display: function(index){
|
||||
index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
|
||||
if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
|
||||
this.previous = index;
|
||||
var obj = {};
|
||||
this.elements.each(function(el, i){
|
||||
obj[i] = {};
|
||||
var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
|
||||
this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
|
||||
for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
|
||||
}, this);
|
||||
return this.start(obj);
|
||||
}
|
||||
|
||||
});
|
||||
/*
|
||||
Script: Accordion.js
|
||||
An Fx.Elements extension which allows you to easily create accordion type controls.
|
||||
|
||||
License:
|
||||
MIT-style license.
|
||||
*/
|
||||
|
||||
var Accordion = new Class({
|
||||
|
||||
Extends: Fx.Elements,
|
||||
|
||||
options: {/*
|
||||
onActive: $empty,
|
||||
onBackground: $empty,*/
|
||||
display: 0,
|
||||
show: false,
|
||||
height: true,
|
||||
width: false,
|
||||
opacity: true,
|
||||
fixedHeight: false,
|
||||
fixedWidth: false,
|
||||
wait: false,
|
||||
alwaysHide: false
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
var params = Array.link(arguments, {'container': Element.type, 'options': Object.type, 'togglers': $defined, 'elements': $defined});
|
||||
this.parent(params.elements, params.options);
|
||||
this.togglers = $$(params.togglers);
|
||||
this.container = $(params.container);
|
||||
this.previous = -1;
|
||||
if (this.options.alwaysHide) this.options.wait = true;
|
||||
if ($chk(this.options.show)){
|
||||
this.options.display = false;
|
||||
this.previous = this.options.show;
|
||||
}
|
||||
if (this.options.start){
|
||||
this.options.display = false;
|
||||
this.options.show = false;
|
||||
}
|
||||
this.effects = {};
|
||||
if (this.options.opacity) this.effects.opacity = 'fullOpacity';
|
||||
if (this.options.width) this.effects.width = this.options.fixedWidth ? 'fullWidth' : 'offsetWidth';
|
||||
if (this.options.height) this.effects.height = this.options.fixedHeight ? 'fullHeight' : 'scrollHeight';
|
||||
for (var i = 0, l = this.togglers.length; i < l; i++) this.addSection(this.togglers[i], this.elements[i]);
|
||||
this.elements.each(function(el, i){
|
||||
if (this.options.show === i){
|
||||
this.fireEvent('active', [this.togglers[i], el]);
|
||||
} else {
|
||||
for (var fx in this.effects) el.setStyle(fx, 0);
|
||||
}
|
||||
}, this);
|
||||
if ($chk(this.options.display)) this.display(this.options.display);
|
||||
},
|
||||
|
||||
addSection: function(toggler, element, pos){
|
||||
toggler = $(toggler);
|
||||
element = $(element);
|
||||
var test = this.togglers.contains(toggler);
|
||||
var len = this.togglers.length;
|
||||
this.togglers.include(toggler);
|
||||
this.elements.include(element);
|
||||
if (len && (!test || pos)){
|
||||
pos = $pick(pos, len - 1);
|
||||
toggler.inject(this.togglers[pos], 'before');
|
||||
element.inject(toggler, 'after');
|
||||
} else if (this.container && !test){
|
||||
toggler.inject(this.container);
|
||||
element.inject(this.container);
|
||||
}
|
||||
var idx = this.togglers.indexOf(toggler);
|
||||
toggler.addEvent('click', this.display.bind(this, idx));
|
||||
if (this.options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
|
||||
if (this.options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
|
||||
element.fullOpacity = 1;
|
||||
if (this.options.fixedWidth) element.fullWidth = this.options.fixedWidth;
|
||||
if (this.options.fixedHeight) element.fullHeight = this.options.fixedHeight;
|
||||
element.setStyle('overflow', 'hidden');
|
||||
if (!test){
|
||||
for (var fx in this.effects) element.setStyle(fx, 0);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
display: function(index){
|
||||
index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
|
||||
if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
|
||||
this.previous = index;
|
||||
var obj = {};
|
||||
this.elements.each(function(el, i){
|
||||
obj[i] = {};
|
||||
var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
|
||||
this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
|
||||
for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
|
||||
}, this);
|
||||
return this.start(obj);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue