impress/public/assets/prototype-e04e119358e980a8e5889b320a2194d9.js

10 lines
77 KiB
JavaScript
Raw Normal View History

/* Prototype JavaScript framework, version 1.6.1
* (c) 2005-2009 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/
function $A(e){if(!e)return[];if("toArray"in Object(e))return e.toArray();var t=e.length||0,n=new Array(t);while(t--)n[t]=e[t];return n}function $w(e){return Object.isString(e)?(e=e.strip(),e?e.split(/\s+/):[]):[]}function $H(e){return new Hash(e)}function $R(e,t,n){return new ObjectRange(e,t,n)}function $(e){if(arguments.length>1){for(var t=0,n=[],r=arguments.length;t<r;t++)n.push($(arguments[t]));return n}return Object.isString(e)&&(e=document.getElementById(e)),Element.extend(e)}function $$(){return Selector.findChildElements(document,$A(arguments))}var Prototype={Version:"1.6.1",Browser:function(){var e=navigator.userAgent,t=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!t,Opera:t,WebKit:e.indexOf("AppleWebKit/")>-1,Gecko:e.indexOf("Gecko")>-1&&e.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(e)}}(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:function(){var e=window.Element||window.HTMLElement;return!!e&&!!e.prototype}(),SpecificElementExtensions:function(){if(typeof window.HTMLDivElement!="undefined")return!0;var e=document.createElement("div"),t=document.createElement("form"),n=!1;return e.__proto__&&e.__proto__!==t.__proto__&&(n=!0),e=t=null,n}()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(e){return e}};Prototype.Browser.MobileSafari&&(Prototype.BrowserFeatures.SpecificElementExtensions=!1);var Abstract={},Try={these:function(){var e;for(var t=0,n=arguments.length;t<n;t++){var r=arguments[t];try{e=r();break}catch(i){}}return e}},Class=function(){function e(){}function t(){function r(){this.initialize.apply(this,arguments)}var t=null,n=$A(arguments);Object.isFunction(n[0])&&(t=n.shift()),Object.extend(r,Class.Methods),r.superclass=t,r.subclasses=[],t&&(e.prototype=t.prototype,r.prototype=new e,t.subclasses.push(r));for(var i=0;i<n.length;i++)r.addMethods(n[i]);return r.prototype.initialize||(r.prototype.initialize=Prototype.emptyFunction),r.prototype.constructor=r,r}function n(e){var t=this.superclass&&this.superclass.prototype,n=Object.keys(e);Object.keys({toString:!0}).length||(e.toString!=Object.prototype.toString&&n.push("toString"),e.valueOf!=Object.prototype.valueOf&&n.push("valueOf"));for(var r=0,i=n.length;r<i;r++){var s=n[r],o=e[s];if(t&&Object.isFunction(o)&&o.argumentNames().first()=="$super"){var u=o;o=function(e){return function(){return t[e].apply(this,arguments)}}(s).wrap(u),o.valueOf=u.valueOf.bind(u),o.toString=u.toString.bind(u)}this.prototype[s]=o}return this}return{create:t,Methods:{addMethods:n}}}();(function(){function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){try{return v(e)?"undefined":e===null?"null":e.inspect?e.inspect():String(e)}catch(t){if(t instanceof RangeError)return"...";throw t}}function r(e){var t=typeof e;switch(t){case"undefined":case"function":case"unknown":return;case"boolean":return e.toString()}if(e===null)return"null";if(e.toJSON)return e.toJSON();if(f(e))return;var n=[];for(var i in e){var s=r(e[i]);v(s)||n.push(i.toJSON()+": "+s)}return"{"+n.join(", ")+"}"}function i(e){return $H(e).toQueryString()}function s(e){return e&&e.toHTML?e.toHTML():String.interpret(e)}function o(e){var t=[];for(var n in e)t.push(n);return t}function u(e){var t=[];for(var n in e)t.push(e[n]);return t}function a(e){return t({},e)}function f(e){return!!e&&e.nodeType==1}function l(t){return e.call(t)=="[object Array]"}function c(e){return e instanceof Hash}function h(e){return typeof e=="function"}function p(t){return e.call(t)=="[object String]"}function d(t){return e.call(t)=="[object Number]"}function v(e){return typeof e=="undefined"}var e=Object.prototype.toString;t(Object,{extend:t,inspect:n,toJSON:r,toQueryString:i,toHTML:s,keys:o,values:u,clone:a,isElement:f,isArray:l,isHash:c,isFunction:h,isString:p,isNumber:d,isUndefined:v})})(),Object.extend(Function.prototype,function(){function t(e,t){var n=e.length,r=t.length;while(r--)e[n+r]=t[r];return e}function n(n,r){return n
:"")+t),e},removeClassName:function(e,t){if(!(e=$(e)))return;return e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").strip(),e},toggleClassName:function(e,t){if(!(e=$(e)))return;return Element[Element.hasClassName(e,t)?"removeClassName":"addClassName"](e,t)},cleanWhitespace:function(e){e=$(e);var t=e.firstChild;while(t){var n=t.nextSibling;t.nodeType==3&&!/\S/.test(t.nodeValue)&&e.removeChild(t),t=n}return e},empty:function(e){return $(e).innerHTML.blank()},descendantOf:function(e,t){e=$(e),t=$(t);if(e.compareDocumentPosition)return(e.compareDocumentPosition(t)&8)===8;if(t.contains)return t.contains(e)&&t!==e;while(e=e.parentNode)if(e==t)return!0;return!1},scrollTo:function(e){e=$(e);var t=Element.cumulativeOffset(e);return window.scrollTo(t[0],t[1]),e},getStyle:function(e,t){e=$(e),t=t=="float"?"cssFloat":t.camelize();var n=e.style[t];if(!n||n=="auto"){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return t=="opacity"?n?parseFloat(n):1:n=="auto"?null:n},getOpacity:function(e){return $(e).getStyle("opacity")},setStyle:function(e,t){e=$(e);var n=e.style,r;if(Object.isString(t))return e.style.cssText+=";"+t,t.include("opacity")?e.setOpacity(t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var i in t)i=="opacity"?e.setOpacity(t[i]):n[i=="float"||i=="cssFloat"?Object.isUndefined(n.styleFloat)?"cssFloat":"styleFloat":i]=t[i];return e},setOpacity:function(e,t){return e=$(e),e.style.opacity=t==1||t===""?"":t<1e-5?0:t,e},getDimensions:function(e){e=$(e);var t=Element.getStyle(e,"display");if(t!="none"&&t!=null)return{width:e.offsetWidth,height:e.offsetHeight};var n=e.style,r=n.visibility,i=n.position,s=n.display;n.visibility="hidden",i!="fixed"&&(n.position="absolute"),n.display="block";var o=e.clientWidth,u=e.clientHeight;return n.display=s,n.position=i,n.visibility=r,{width:o,height:u}},makePositioned:function(e){e=$(e);var t=Element.getStyle(e,"position");if(t=="static"||!t)e._madePositioned=!0,e.style.position="relative",Prototype.Browser.Opera&&(e.style.top=0,e.style.left=0);return e},undoPositioned:function(e){return e=$(e),e._madePositioned&&(e._madePositioned=undefined,e.style.position=e.style.top=e.style.left=e.style.bottom=e.style.right=""),e},makeClipping:function(e){return e=$(e),e._overflow?e:(e._overflow=Element.getStyle(e,"overflow")||"auto",e._overflow!=="hidden"&&(e.style.overflow="hidden"),e)},undoClipping:function(e){return e=$(e),e._overflow?(e.style.overflow=e._overflow=="auto"?"":e._overflow,e._overflow=null,e):e},cumulativeOffset:function(e){var t=0,n=0;do t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;while(e);return Element._returnOffset(n,t)},positionedOffset:function(e){var t=0,n=0;do{t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;if(e){if(e.tagName.toUpperCase()=="BODY")break;var r=Element.getStyle(e,"position");if(r!=="static")break}}while(e);return Element._returnOffset(n,t)},absolutize:function(e){e=$(e);if(Element.getStyle(e,"position")=="absolute")return e;var t=Element.positionedOffset(e),n=t[1],r=t[0],i=e.clientWidth,s=e.clientHeight;return e._originalLeft=r-parseFloat(e.style.left||0),e._originalTop=n-parseFloat(e.style.top||0),e._originalWidth=e.style.width,e._originalHeight=e.style.height,e.style.position="absolute",e.style.top=n+"px",e.style.left=r+"px",e.style.width=i+"px",e.style.height=s+"px",e},relativize:function(e){e=$(e);if(Element.getStyle(e,"position")=="relative")return e;e.style.position="relative";var t=parseFloat(e.style.top||0)-(e._originalTop||0),n=parseFloat(e.style.left||0)-(e._originalLeft||0);return e.style.top=t+"px",e.style.left=n+"px",e.style.height=e._originalHeight,e.style.width=e._originalWidth,e},cumulativeScrollOffset:function(e){var t=0,n=0;do t+=e.scrollTop||0,n+=e.scrollLeft||0,e=e.parentNode;while(e);return Element._returnOffset(n,t)},getOffsetParent:function(e){if(e.offsetParent)return $(e.offsetParent);if(e==document.body)return $(e);while((e=e.parentNode)&&e!=document.body)if(Element.getStyle(e,"position")!="static")return $(e);return $(document.body)},viewportOffset:function(e){var t=0,n=0,r=e;do{t+=r.of
(r).map(Element.extend);for(var i=0,s=[],o=r.length;i<o;i++){var u=r[i];if(t&&u.type!=t||n&&u.name!=n)continue;s.push(Element.extend(u))}return s},disable:function(e){return e=$(e),Form.getElements(e).invoke("disable"),e},enable:function(e){return e=$(e),Form.getElements(e).invoke("enable"),e},findFirstElement:function(e){var t=$(e).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled}),n=t.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return n?n:t.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(e){return e=$(e),e.findFirstElement().activate(),e},request:function(e,t){e=$(e),t=Object.clone(t||{});var n=t.parameters,r=e.readAttribute("action")||"";return r.blank()&&(r=window.location.href),t.parameters=e.serialize(!0),n&&(Object.isString(n)&&(n=n.toQueryParams()),Object.extend(t.parameters,n)),e.hasAttribute("method")&&!t.method&&(t.method=e.method),new Ajax.Request(r,t)}},Form.Element={focus:function(e){return $(e).focus(),e},select:function(e){return $(e).select(),e}},Form.Element.Methods={serialize:function(e){e=$(e);if(!e.disabled&&e.name){var t=e.getValue();if(t!=undefined){var n={};return n[e.name]=t,Object.toQueryString(n)}}return""},getValue:function(e){e=$(e);var t=e.tagName.toLowerCase();return Form.Element.Serializers[t](e)},setValue:function(e,t){e=$(e);var n=e.tagName.toLowerCase();return Form.Element.Serializers[n](e,t),e},clear:function(e){return $(e).value="",e},present:function(e){return $(e).value!=""},activate:function(e){e=$(e);try{e.focus(),e.select&&(e.tagName.toLowerCase()!="input"||!/^(?:button|reset|submit)$/i.test(e.type))&&e.select()}catch(t){}return e},disable:function(e){return e=$(e),e.disabled=!0,e},enable:function(e){return e=$(e),e.disabled=!1,e}};var Field=Form.Element,$F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(e,t){switch(e.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(e,t);default:return Form.Element.Serializers.textarea(e,t)}},inputSelector:function(e,t){if(Object.isUndefined(t))return e.checked?e.value:null;e.checked=!!t},textarea:function(e,t){if(Object.isUndefined(t))return e.value;e.value=t},select:function(e,t){if(Object.isUndefined(t))return this[e.type=="select-one"?"selectOne":"selectMany"](e);var n,r,i=!Object.isArray(t);for(var s=0,o=e.length;s<o;s++){n=e.options[s],r=this.optionValue(n);if(i){if(r==t){n.selected=!0;return}}else n.selected=t.include(r)}},selectOne:function(e){var t=e.selectedIndex;return t>=0?this.optionValue(e.options[t]):null},selectMany:function(e){var t,n=e.length;if(!n)return null;for(var r=0,t=[];r<n;r++){var i=e.options[r];i.selected&&t.push(this.optionValue(i))}return t},optionValue:function(e){return Element.extend(e).hasAttribute("value")?e.value:e.text}},Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,e,t,n){$super(n,t),this.element=$(e),this.lastValue=this.getValue()},execute:function(){var e=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(e)?this.lastValue!=e:String(this.lastValue)!=String(e))this.callback(this.element,e),this.lastValue=e}}),Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}}),Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}}),Abstract.EventObserver=Class.create({initialize:function(e,t){this.element=$(e),this.callback=t,this.lastValue=this.getValue(),this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var e=this.getValue();this.lastValue!=e&&(this.callback(this.element,e),this.lastValue=e)},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(e){if(e.type)switch(e.type.toLowerCase()){case"checkbox":case"radio":Event.observe(e,"click",this.onElementEvent.bind(this));break;default: