Initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
I did the following hack in moo.fx.js:
|
||||
|
||||
At line 79 in the toggle: function() function, I added:
|
||||
|
||||
document.getElementById('nav').style.display = 'block';
|
||||
|
||||
|
||||
|
||||
-- Rick Ellis
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
|
||||
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
|
||||
for more info (http://moofx.mad4milk.net).
|
||||
10/24/2005
|
||||
v(1.0.2)
|
||||
*/
|
||||
|
||||
//base
|
||||
var fx = new Object();
|
||||
fx.Base = function(){};
|
||||
fx.Base.prototype = {
|
||||
setOptions: function(options) {
|
||||
this.options = {
|
||||
duration: 500,
|
||||
onComplete: ''
|
||||
}
|
||||
Object.extend(this.options, options || {});
|
||||
},
|
||||
|
||||
go: function() {
|
||||
this.duration = this.options.duration;
|
||||
this.startTime = (new Date).getTime();
|
||||
this.timer = setInterval (this.step.bind(this), 13);
|
||||
},
|
||||
|
||||
step: function() {
|
||||
var time = (new Date).getTime();
|
||||
var Tpos = (time - this.startTime) / (this.duration);
|
||||
if (time >= this.duration+this.startTime) {
|
||||
this.now = this.to;
|
||||
clearInterval (this.timer);
|
||||
this.timer = null;
|
||||
if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
|
||||
}
|
||||
else {
|
||||
this.now = ((-Math.cos(Tpos*Math.PI)/2) + 0.5) * (this.to-this.from) + this.from;
|
||||
//this time-position, sinoidal transition thing is from script.aculo.us
|
||||
}
|
||||
this.increase();
|
||||
},
|
||||
|
||||
custom: function(from, to) {
|
||||
if (this.timer != null) return;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.go();
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.now = 0;
|
||||
this.increase();
|
||||
},
|
||||
|
||||
clearTimer: function() {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
//stretchers
|
||||
fx.Layout = Class.create();
|
||||
fx.Layout.prototype = Object.extend(new fx.Base(), {
|
||||
initialize: function(el, options) {
|
||||
this.el = $(el);
|
||||
this.el.style.overflow = "hidden";
|
||||
this.el.iniWidth = this.el.offsetWidth;
|
||||
this.el.iniHeight = this.el.offsetHeight;
|
||||
this.setOptions(options);
|
||||
}
|
||||
});
|
||||
|
||||
fx.Height = Class.create();
|
||||
Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {
|
||||
increase: function() {
|
||||
this.el.style.height = this.now + "px";
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
|
||||
else this.custom(0, this.el.scrollHeight);
|
||||
}
|
||||
});
|
||||
|
||||
fx.Width = Class.create();
|
||||
Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {
|
||||
increase: function() {
|
||||
this.el.style.width = this.now + "px";
|
||||
},
|
||||
|
||||
toggle: function(){
|
||||
if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
|
||||
else this.custom(0, this.el.iniWidth);
|
||||
}
|
||||
});
|
||||
|
||||
//fader
|
||||
fx.Opacity = Class.create();
|
||||
fx.Opacity.prototype = Object.extend(new fx.Base(), {
|
||||
initialize: function(el, options) {
|
||||
this.el = $(el);
|
||||
this.now = 1;
|
||||
this.increase();
|
||||
this.setOptions(options);
|
||||
},
|
||||
|
||||
increase: function() {
|
||||
if (this.now == 1) this.now = 0.9999;
|
||||
if (this.now > 0 && this.el.style.visibility == "hidden") this.el.style.visibility = "visible";
|
||||
if (this.now == 0) this.el.style.visibility = "hidden";
|
||||
if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + this.now*100 + ")";
|
||||
this.el.style.opacity = this.now;
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
if (this.now > 0) this.custom(1, 0);
|
||||
else this.custom(0, 1);
|
||||
}
|
||||
});
|
||||
Executable
+241
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
moo.fx pack, effects extensions for moo.fx.
|
||||
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE
|
||||
for more info visit (http://moofx.mad4milk.net).
|
||||
Wednesday, November 16, 2005
|
||||
v1.0.4
|
||||
*/
|
||||
|
||||
//text size modify, now works with pixels too.
|
||||
fx.Text = Class.create();
|
||||
fx.Text.prototype = Object.extend(new fx.Base(), {
|
||||
initialize: function(el, options) {
|
||||
this.el = $(el);
|
||||
this.setOptions(options);
|
||||
if (!this.options.unit) this.options.unit = "em";
|
||||
},
|
||||
|
||||
increase: function() {
|
||||
this.el.style.fontSize = this.now + this.options.unit;
|
||||
}
|
||||
});
|
||||
|
||||
//composition effect, calls Width and Height alltogheter
|
||||
fx.Resize = Class.create();
|
||||
fx.Resize.prototype = {
|
||||
initialize: function(el, options) {
|
||||
this.h = new fx.Height(el, options);
|
||||
if (options) options.onComplete = null;
|
||||
this.w = new fx.Width(el, options);
|
||||
this.el = $(el);
|
||||
},
|
||||
|
||||
toggle: function(){
|
||||
this.h.toggle();
|
||||
this.w.toggle();
|
||||
},
|
||||
|
||||
modify: function(hto, wto) {
|
||||
this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);
|
||||
this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);
|
||||
},
|
||||
|
||||
custom: function(hto, wto) {
|
||||
this.h.custom(this.el.offsetHeight, hto);
|
||||
this.w.custom(this.el.offsetWidth, wto);
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.h.hide();
|
||||
this.w.hide();
|
||||
}
|
||||
}
|
||||
|
||||
//composition effect, calls Opacity and (Width and/or Height) alltogheter
|
||||
fx.FadeSize = Class.create();
|
||||
fx.FadeSize.prototype = {
|
||||
initialize: function(el, options) {
|
||||
this.el = $(el);
|
||||
this.el.o = new fx.Opacity(el, options);
|
||||
if (options) options.onComplete = null;
|
||||
this.el.h = new fx.Height(el, options);
|
||||
this.el.w = new fx.Width(el, options);
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
this.el.o.toggle();
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (arguments[i] == 'height') this.el.h.toggle();
|
||||
if (arguments[i] == 'width') this.el.w.toggle();
|
||||
}
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.el.o.hide();
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (arguments[i] == 'height') this.el.h.hide();
|
||||
if (arguments[i] == 'width') this.el.w.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//intended to work with arrays.
|
||||
var Multi = new Object();
|
||||
Multi = function(){};
|
||||
Multi.prototype = {
|
||||
initialize: function(elements, options){
|
||||
this.options = options;
|
||||
this.el = this.getElementsFromArray(elements);
|
||||
for (i=0;i<this.el.length;i++){
|
||||
this.effect(this.el[i]);
|
||||
}
|
||||
},
|
||||
|
||||
getElementsFromArray: function(array) {
|
||||
var elements = new Array();
|
||||
for (i=0;i<array.length;i++) {
|
||||
elements.push($(array[i]));
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
|
||||
//Fadesize with arrays
|
||||
fx.MultiFadeSize = Class.create();
|
||||
fx.MultiFadeSize.prototype = Object.extend(new Multi(), {
|
||||
effect: function(el){
|
||||
el.fs = new fx.FadeSize(el, this.options);
|
||||
},
|
||||
|
||||
showThisHideOpen: function(el, delay, mode){
|
||||
for (i=0;i<this.el.length;i++){
|
||||
if (this.el[i].offsetHeight > 0 && this.el[i] != el && this.el[i].h.timer == null && el.h.timer == null){
|
||||
this.el[i].fs.toggle(mode);
|
||||
setTimeout(function(){el.fs.toggle(mode);}.bind(el), delay);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
hide: function(el, mode){
|
||||
el.fs.hide(mode);
|
||||
}
|
||||
});
|
||||
|
||||
var Remember = new Object();
|
||||
Remember = function(){};
|
||||
Remember.prototype = {
|
||||
initialize: function(el, options){
|
||||
this.el = $(el);
|
||||
this.days = 365;
|
||||
this.options = options;
|
||||
this.effect();
|
||||
var cookie = this.readCookie();
|
||||
if (cookie) {
|
||||
this.fx.now = cookie;
|
||||
this.fx.increase();
|
||||
}
|
||||
},
|
||||
|
||||
//cookie functions based on code by Peter-Paul Koch
|
||||
setCookie: function(value) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(this.days*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
document.cookie = this.el+this.el.id+this.prefix+"="+value+expires+"; path=/";
|
||||
},
|
||||
|
||||
readCookie: function() {
|
||||
var nameEQ = this.el+this.el.id+this.prefix + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
custom: function(from, to){
|
||||
if (this.fx.now != to) {
|
||||
this.setCookie(to);
|
||||
this.fx.custom(from, to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fx.RememberHeight = Class.create();
|
||||
fx.RememberHeight.prototype = Object.extend(new Remember(), {
|
||||
effect: function(){
|
||||
this.fx = new fx.Height(this.el, this.options);
|
||||
this.prefix = 'height';
|
||||
},
|
||||
|
||||
toggle: function(){
|
||||
if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight);
|
||||
else this.setCookie(0);
|
||||
this.fx.toggle();
|
||||
},
|
||||
|
||||
resize: function(to){
|
||||
this.setCookie(this.el.offsetHeight+to);
|
||||
this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
if (!this.readCookie()) {
|
||||
this.fx.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fx.RememberText = Class.create();
|
||||
fx.RememberText.prototype = Object.extend(new Remember(), {
|
||||
effect: function(){
|
||||
this.fx = new fx.Text(this.el, this.options);
|
||||
this.prefix = 'text';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//use to attach effects without using js code, just classnames and rel attributes.
|
||||
ParseClassNames = Class.create();
|
||||
ParseClassNames.prototype = {
|
||||
initialize: function(options){
|
||||
var babies = document.getElementsByTagName('*') || document.all;
|
||||
for (var i = 0; i < babies.length; i++) {
|
||||
var el = babies[i];
|
||||
//attach the effect, from the classNames;
|
||||
var effects = this.getEffects(el);
|
||||
for (var j = 0; j < effects.length; j++) {
|
||||
if (j == 1 && options) options.onComplete = null;
|
||||
el[effects[j]+"fx"] = new fx[effects[j]](el, options);
|
||||
}
|
||||
//execute methods, from rel
|
||||
if (el.rel) {
|
||||
el.crel = el.rel.split(' ');
|
||||
if (el.crel[0].indexOf("fx_") > -1) {
|
||||
var event = el.crel[0].replace('fx_', '');
|
||||
var tocompute = this.getEffects($(el.crel[1]));
|
||||
el["on"+event] = function(){
|
||||
for (var f = 0; f < tocompute.length; f++) {
|
||||
$(this.crel[1])[tocompute[f]+"fx"][this.crel[2] || "toggle"](this.crel[3] || null, this.crel[4] || null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getEffects: function(el){
|
||||
var effects = new Array();
|
||||
var css = el.className.split(' ');
|
||||
for (var i = 0; i < css.length; i++) {
|
||||
if (css[i].indexOf('fx_') > -1) {
|
||||
var effect = css[i].replace('fx_', '');
|
||||
effects.push(effect);
|
||||
}
|
||||
}
|
||||
return effects;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
function create_menu(basepath)
|
||||
{
|
||||
var base = (basepath == 'null') ? '' : basepath;
|
||||
|
||||
document.write(
|
||||
'<table cellpadding="0" cellspaceing="0" border="0" style="width:98%"><tr>' +
|
||||
'<td class="td" valign="top">' +
|
||||
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'index.html">User Guide Home</a></li>' +
|
||||
'<li><a href="'+base+'toc.html">Table of Contents Page</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'<h3>Basic Info</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'general/requirements.html">Server Requirements</a></li>' +
|
||||
'<li><a href="'+base+'license.html">License Agreement</a></li>' +
|
||||
'<li><a href="'+base+'changelog.html">Change Log</a></li>' +
|
||||
'<li><a href="'+base+'general/credits.html">Credits</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'<h3>Installation</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'installation/downloads.html">Downloading CodeIgniter</a></li>' +
|
||||
'<li><a href="'+base+'installation/index.html">Installation Instructions</a></li>' +
|
||||
'<li><a href="'+base+'installation/upgrading.html">Upgrading from a Previous Version</a></li>' +
|
||||
'<li><a href="'+base+'installation/troubleshooting.html">Troubleshooting</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'<h3>Introduction</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'overview/getting_started.html">Getting Started</a></li>' +
|
||||
'<li><a href="'+base+'overview/at_a_glance.html">CodeIgniter at a Glance</a></li>' +
|
||||
'<li><a href="'+base+'overview/cheatsheets.html">CodeIgniter Cheatsheets</a></li>' +
|
||||
'<li><a href="'+base+'overview/features.html">Supported Features</a></li>' +
|
||||
'<li><a href="'+base+'overview/appflow.html">Application Flow Chart</a></li>' +
|
||||
'<li><a href="'+base+'overview/mvc.html">Model-View-Controller</a></li>' +
|
||||
'<li><a href="'+base+'overview/goals.html">Architectural Goals</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
|
||||
'</td><td class="td_sep" valign="top">' +
|
||||
|
||||
'<h3>General Topics</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'general/urls.html">CodeIgniter URLs</a></li>' +
|
||||
'<li><a href="'+base+'general/controllers.html">Controllers</a></li>' +
|
||||
'<li><a href="'+base+'general/reserved_names.html">Reserved Names</a></li>' +
|
||||
'<li><a href="'+base+'general/views.html">Views</a></li>' +
|
||||
'<li><a href="'+base+'general/models.html">Models</a></li>' +
|
||||
'<li><a href="'+base+'general/helpers.html">Helpers</a></li>' +
|
||||
'<li><a href="'+base+'general/plugins.html">Plugins</a></li>' +
|
||||
'<li><a href="'+base+'general/libraries.html">Using CodeIgniter Libraries</a></li>' +
|
||||
'<li><a href="'+base+'general/creating_libraries.html">Creating Your Own Libraries</a></li>' +
|
||||
'<li><a href="'+base+'general/core_classes.html">Creating Core Classes</a></li>' +
|
||||
'<li><a href="'+base+'general/hooks.html">Hooks - Extending the Core</a></li>' +
|
||||
'<li><a href="'+base+'general/autoloader.html">Auto-loading Resources</a></li>' +
|
||||
'<li><a href="'+base+'general/common_functions.html">Common Functions</a></li>' +
|
||||
'<li><a href="'+base+'general/scaffolding.html">Scaffolding</a></li>' +
|
||||
'<li><a href="'+base+'general/routing.html">URI Routing</a></li>' +
|
||||
'<li><a href="'+base+'general/errors.html">Error Handling</a></li>' +
|
||||
'<li><a href="'+base+'general/caching.html">Caching</a></li>' +
|
||||
'<li><a href="'+base+'general/profiling.html">Profiling Your Application</a></li>' +
|
||||
'<li><a href="'+base+'general/managing_apps.html">Managing Applications</a></li>' +
|
||||
'<li><a href="'+base+'general/alternative_php.html">Alternative PHP Syntax</a></li>' +
|
||||
'<li><a href="'+base+'general/security.html">Security</a></li>' +
|
||||
'<li><a href="'+base+'general/styleguide.html">PHP Style Guide</a></li>' +
|
||||
'<li><a href="'+base+'doc_style/index.html">Writing Documentation</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'</td><td class="td_sep" valign="top">' +
|
||||
|
||||
|
||||
'<h3>Class Reference</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'libraries/benchmark.html">Benchmarking Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/calendar.html">Calendar Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/cart.html">Cart Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/config.html">Config Class</a></li>' +
|
||||
'<li><a href="'+base+'database/index.html">Database Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/email.html">Email Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/encryption.html">Encryption Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/file_uploading.html">File Uploading Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/form_validation.html">Form Validation Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/ftp.html">FTP Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/table.html">HTML Table Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/image_lib.html">Image Manipulation Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/input.html">Input and Security Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/loader.html">Loader Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/language.html">Language Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/output.html">Output Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/pagination.html">Pagination Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/sessions.html">Session Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/trackback.html">Trackback Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/parser.html">Template Parser Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/typography.html">Typography Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/unit_testing.html">Unit Testing Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/uri.html">URI Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/user_agent.html">User Agent Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/xmlrpc.html">XML-RPC Class</a></li>' +
|
||||
'<li><a href="'+base+'libraries/zip.html">Zip Encoding Class</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'</td><td class="td_sep" valign="top">' +
|
||||
|
||||
'<h3>Helper Reference</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="'+base+'helpers/array_helper.html">Array Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/compatibility_helper.html">Compatibility Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/cookie_helper.html">Cookie Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/date_helper.html">Date Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/directory_helper.html">Directory Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/download_helper.html">Download Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/email_helper.html">Email Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/file_helper.html">File Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/form_helper.html">Form Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/html_helper.html">HTML Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/inflector_helper.html">Inflector Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/language_helper.html">Language Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/number_helper.html">Number Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/path_helper.html">Path Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/security_helper.html">Security Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/smiley_helper.html">Smiley Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/string_helper.html">String Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/text_helper.html">Text Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/typography_helper.html">Typography Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/url_helper.html">URL Helper</a></li>' +
|
||||
'<li><a href="'+base+'helpers/xml_helper.html">XML Helper</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
|
||||
'<h3>Additional Resources</h3>' +
|
||||
'<ul>' +
|
||||
'<li><a href="http://codeigniter.com/forums/">Community Forums</a></li>' +
|
||||
'<li><a href="http://codeigniter.com/wiki/">Community Wiki</a></li>' +
|
||||
'</ul>' +
|
||||
|
||||
'</td></tr></table>');
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
/* Prototype JavaScript framework
|
||||
* (c) 2005 Sam Stephenson <sam@conio.net>
|
||||
*
|
||||
* Prototype is freely distributable under the terms of an MIT-style license.
|
||||
*
|
||||
* For details, see the Prototype web site: http://prototype.conio.net/
|
||||
*
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
//note: this is a stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).
|
||||
|
||||
var Class = {
|
||||
create: function() {
|
||||
return function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.extend = function(destination, source) {
|
||||
for (property in source) {
|
||||
destination[property] = source[property];
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
||||
Function.prototype.bind = function(object) {
|
||||
var __method = this;
|
||||
return function() {
|
||||
return __method.apply(object, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
function $() {
|
||||
var elements = new Array();
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = arguments[i];
|
||||
if (typeof element == 'string')
|
||||
element = document.getElementById(element);
|
||||
|
||||
if (arguments.length == 1)
|
||||
return element;
|
||||
|
||||
elements.push(element);
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
|
||||
document.getElementsByClassName = function(className) {
|
||||
var children = document.getElementsByTagName('*') || document.all;
|
||||
var elements = new Array();
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
var classNames = child.className.split(' ');
|
||||
for (var j = 0; j < classNames.length; j++) {
|
||||
if (classNames[j] == className) {
|
||||
elements.push(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
|
||||
if (!window.Element) {
|
||||
var Element = new Object();
|
||||
}
|
||||
|
||||
Object.extend(Element, {
|
||||
remove: function(element) {
|
||||
element = $(element);
|
||||
element.parentNode.removeChild(element);
|
||||
},
|
||||
|
||||
hasClassName: function(element, className) {
|
||||
element = $(element);
|
||||
if (!element)
|
||||
return;
|
||||
var a = element.className.split(' ');
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
if (a[i] == className)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
addClassName: function(element, className) {
|
||||
element = $(element);
|
||||
Element.removeClassName(element, className);
|
||||
element.className += ' ' + className;
|
||||
},
|
||||
|
||||
removeClassName: function(element, className) {
|
||||
element = $(element);
|
||||
if (!element)
|
||||
return;
|
||||
var newClassName = '';
|
||||
var a = element.className.split(' ');
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
if (a[i] != className) {
|
||||
if (i > 0)
|
||||
newClassName += ' ';
|
||||
newClassName += a[i];
|
||||
}
|
||||
}
|
||||
element.className = newClassName;
|
||||
},
|
||||
|
||||
// removes whitespace-only text node children
|
||||
cleanWhitespace: function(element) {
|
||||
element = $(element);
|
||||
for (var i = 0; i < element.childNodes.length; i++) {
|
||||
var node = element.childNodes[i];
|
||||
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
|
||||
Element.remove(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
window.onload = function() {
|
||||
myHeight = new fx.Height('nav', {duration: 400});
|
||||
myHeight.hide();
|
||||
}
|
||||
Reference in New Issue
Block a user