.
*
* @private
* @property
* @name element
* @type Element
* @cat Plugins/Em
*/
element: $('
').css({ left: '-100em',
position: 'absolute',
width: '100em' })
.prependTo('body')[0],
/**
* The action to perform when a change in the font size is detected.
*
* @example $.em.action = function() { ... }
* @desc The default action is to trigger a global “emchange” event.
* You probably shouldn’t change this behaviour as other plugins may
* rely on it, but the option is here for completion.
*
* @example $(document).bind('emchange', function(e, cur, prev) {...})
* @desc Any functions triggered on this event are passed the current
* font size, and last known font size as additional parameters.
*
* @private
* @property
* @name action
* @type Function
* @cat Plugins/Em
* @see current
* @see previous
*/
action: function() {
var currentWidth = $.em.element.offsetWidth / 100;
// If the font size has changed since we last checked…
if ( currentWidth != $.em.current ) {
/**
* The previous pixel value of the user agent’s font size. See
* $.em.current for caveats. Will initially be undefined until
* the “emchange” event is triggered.
*
* @example $.em.previous;
* @result 16
*
* @property
* @name previous
* @type Number
* @cat Plugins/Em
* @see current
*/
$.em.previous = $.em.current;
/**
* The current pixel value of the user agent’s font size. As
* with $.em.previous, this value *may* be subject to minor
* browser rounding errors that mean you might not want to
* rely upon it as an absolute value.
*
* @example $.em.current;
* @result 14
*
* @property
* @name current
* @type Number
* @cat Plugins/Em
* @see previous
*/
$.em.current = currentWidth;
$.event.trigger(eventName, [$.em.current, $.em.previous]);
}
}
}, $.em );
/**
* Bind a function to the emchange event of each matched element.
*
* @example $("p").emchange( function() { alert("Hello"); } );
*
* @name emchange
* @type jQuery
* @param Function fn A function to bind to the emchange event.
* @cat Plugins/Em
*/
/**
* Trigger the emchange event of each matched element.
*
* @example $("p").emchange()
*
* @name emchange
* @type jQuery
* @cat Plugins/Em
*/
$.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn)
: this.trigger(eventName); };
// Store the initial pixel value of the user agent’s font size.
$.em.current = $.em.element.offsetWidth / 100;
/**
* While polling for font-size changes, $.em.iid stores the intervalID in
* case you should want to cancel with clearInterval().
*
* @example window.clearInterval( $.em.iid );
*
* @property
* @name iid
* @type Number
* @cat Plugins/Em
*/
$.em.iid = setInterval( $.em.action, $.em.delay );
});
/*
* Easy Slider 1.5 - jQuery plugin
* written by Alen Grakalic
* http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built for jQuery library
* http://jquery.com
*
*/
/*
* markup example for $("#slider").easySlider();
*
*
*
*/
(function($) {
$.fn.easySlider = function(options){
// default configuration properties
var defaults = {
prevId: 'prevBtn',
prevText: 'Previous',
nextId: 'nextBtn',
nextText: 'Next',
controlsShow: true,
controlsBefore: '',
controlsAfter: '',
controlsFade: true,
firstId: 'firstBtn',
firstText: 'First',
firstShow: false,
lastId: 'lastBtn',
lastText: 'Last',
lastShow: false,
vertical: false,
speed: 800,
auto: false,
pause: 2000,
continuous: false
};
var options = $.extend(defaults, options);
this.each(function() {
var obj = $(this);
var s = $("li", obj).length;
var w = $("li", obj).width();
var h = $("li", obj).height();
obj.width(w);
obj.height(h);
obj.css("overflow","hidden");
var ts = s-1;
var t = 0;
$("ul", obj).css('width',s*w);
if(!options.vertical) $("li", obj).css('float','left');
if(options.controlsShow){
var html = options.controlsBefore;
if(options.firstShow) html += '
'+ options.firstText +'';
html += '
'+ options.prevText +'';
html += '
'+ options.nextText +'';
if(options.lastShow) html += '
'+ options.lastText +'';
html += options.controlsAfter;
$(obj).after(html);
};
$("a","#"+options.nextId).click(function(){
animate("next",true);
});
$("a","#"+options.prevId).click(function(){
animate("prev",true);
});
$("a","#"+options.firstId).click(function(){
animate("first",true);
});
$("a","#"+options.lastId).click(function(){
animate("last",true);
});
function animate(dir,clicked){
var ot = t;
switch(dir){
case "next":
t = (ot>=ts) ? (options.continuous ? 0 : ts) : t+1;
break;
case "prev":
t = (t<=0) ? (options.continuous ? ts : 0) : t-1;
break;
case "first":
t = 0;
break;
case "last":
t = ts;
break;
default:
break;
};
var diff = Math.abs(ot-t);
var speed = diff*options.speed;
if(!options.vertical) {
p = (t*w*-1);
$("ul",obj).animate(
{ marginLeft: p },
speed
);
} else {
p = (t*h*-1);
$("ul",obj).animate(
{ marginTop: p },
speed
);
};
if(!options.continuous && options.controlsFade){
if(t==ts){
$("a","#"+options.nextId).hide();
$("a","#"+options.lastId).hide();
} else {
$("a","#"+options.nextId).show();
$("a","#"+options.lastId).show();
};
if(t==0){
$("a","#"+options.prevId).hide();
$("a","#"+options.firstId).hide();
} else {
$("a","#"+options.prevId).show();
$("a","#"+options.firstId).show();
};
};
if(clicked) clearTimeout(timeout);
if(options.auto && dir=="next" && !clicked){;
timeout = setTimeout(function(){
animate("next",false);
},diff*options.speed+options.pause);
};
};
// init
var timeout;
if(options.auto){;
timeout = setTimeout(function(){
animate("next",false);
},options.pause);
};
if(!options.continuous && options.controlsFade){
$("a","#"+options.prevId).hide();
$("a","#"+options.firstId).hide();
};
});
};
})(jQuery);
/*
droplicious v.1.0 Created May 21, 2009
Copyright @2009 http://headfirstproductions.ca Author: Darren Terhune
Contributors: Jan Sovak http://canada-jack.com, Mason Meyer http://www.masonmeyer.com
This software is licensed under the Creative Commons Attribution 2.5 Canada License
*/
var dropliciousShowingUpDuration = 0.3;
var dropliciousHidingDuration = 0.1;
var dropliciousHideDelay = 0;
function dropliciousShowingUpEffect(element){
if(!element.visible()){
new Effect.BlindDown(element, {
duration: dropliciousShowingUpDuration,
queue: {
position: 'end',
scope: element.identify(),
limit:2
}
});
}
}
function dropliciousHidingEffect(element){
new Effect.BlindUp(element, {
duration: dropliciousHidingDuration,
queue: {
position: 'end',
scope: element.identify(),
limit: 2
}
});
}
function setDelayedHide(element){
element.addClassName('waitingtohide')
if(!element.hasClassName('hidding')){
if (!element.hasClassName('hiddingtimerset')){
element.addClassName('hiddingtimerset');
setTimeout(function(){ delayedHide(element); }, dropliciousHideDelay * 1000);
}
}
}
function delayedHide(dropElement){
dropElement.removeClassName('hiddingtimerset');
if (dropElement.hasClassName('waitingtohide')){
dropliciousHidingEffect(dropElement);
dropElement.addClassName('hidding');
setTimeout(
function(){
dropElement.removeClassName('waitingtohide');
dropElement.removeClassName('hidding');
dropElement.removeClassName('active');
}, dropliciousHidingDuration * 1000);
}
}
function linkMouseOut(id){
var dropElement = id.element().next();
if (dropElement && dropElement.hasClassName('active')){
setDelayedHide(dropElement);
}
}
function linkMouseOver(id){
var dropElement = id.element().next();
if(dropElement){
if (!dropElement.hasClassName('hidding')){
dropElement.removeClassName('waitingtohide');
}
if (!dropElement.hasClassName('active')){
dropElement.addClassName('active');
dropliciousShowingUpEffect(dropElement);
}
}
}
function submenuMouseOut(event){
var dropElement = event.findElement("ul");
if (dropElement && dropElement.hasClassName('active')){
setDelayedHide(dropElement);
}
}
function submenuMouseOver(event){
var dropElement = event.findElement("ul");
if (dropElement && !dropElement.hasClassName('hidding')){
dropElement.removeClassName('waitingtohide');
}
}
document.observe('dom:loaded', function() {
$$('a.drops').each(function(name) {
name.observe('mousemove', linkMouseOver.bindAsEventListener(this));
name.observe('mouseout', linkMouseOut.bindAsEventListener(this));
});
$$('ul.scriptaculously').each(function(name){
name.observe('mousemove', submenuMouseOver.bindAsEventListener(this));
name.observe('mouseout', submenuMouseOut.bindAsEventListener(this));
});
})