var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); /* --- script: Drag.js name: Drag description: The base Drag Class. Can be used to drag and resize Elements using mouse events. license: MIT-style license authors: - Valerio Proietti - Tom Occhinno - Jan Kassens requires: - Core/Events - Core/Options - Core/Element.Event - Core/Element.Style - Core/Element.Dimensions - /MooTools.More provides: [Drag] ... */ var Drag = new Class({ Implements: [Events, Options], options: {/* onBeforeStart: function(thisElement){}, onStart: function(thisElement, event){}, onSnap: function(thisElement){}, onDrag: function(thisElement, event){}, onCancel: function(thisElement){}, onComplete: function(thisElement, event){},*/ snap: 6, unit: 'px', grid: false, style: true, limit: false, handle: false, invert: false, preventDefault: false, stopPropagation: false, modifiers: {x: 'left', y: 'top'} }, initialize: function(){ var params = Array.link(arguments, { 'options': Type.isObject, 'element': function(obj){ return obj != null; } }); this.element = document.id(params.element); this.document = this.element.getDocument(); this.setOptions(params.options || {}); var htype = typeOf(this.options.handle); this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; this.mouse = {'now': {}, 'pos': {}}; this.value = {'start': {}, 'now': {}}; this.selection = (Browser.ie) ? 'selectstart' : 'mousedown'; if (Browser.ie && !Drag.ondragstartFixed){ document.ondragstart = Function.from(false); Drag.ondragstartFixed = true; } this.bound = { start: this.start.bind(this), check: this.check.bind(this), drag: this.drag.bind(this), stop: this.stop.bind(this), cancel: this.cancel.bind(this), eventStop: Function.from(false) }; this.attach(); }, attach: function(){ this.handles.addEvent('mousedown', this.bound.start); return this; }, detach: function(){ this.handles.removeEvent('mousedown', this.bound.start); return this; }, start: function(event){ var options = this.options; if (event.rightClick) return; if (options.preventDefault) event.preventDefault(); if (options.stopPropagation) event.stopPropagation(); this.mouse.start = event.page; this.fireEvent('beforeStart', this.element); var limit = options.limit; this.limit = {x: [], y: []}; var z, coordinates; for (z in options.modifiers){ if (!options.modifiers[z]) continue; var style = this.element.getStyle(options.modifiers[z]); // Some browsers (IE and Opera) don't always return pixels. if (style && !style.match(/px$/)){ if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent()); style = coordinates[options.modifiers[z]]; } if (options.style) this.value.now[z] = (style || 0).toInt(); else this.value.now[z] = this.element[options.modifiers[z]]; if (options.invert) this.value.now[z] *= -1; this.mouse.pos[z] = event.page[z] - this.value.now[z]; if (limit && limit[z]){ var i = 2; while (i--){ var limitZI = limit[z][i]; if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI; } } } if (typeOf(this.options.grid) == 'number') this.options.grid = { x: this.options.grid, y: this.options.grid }; var events = { mousemove: this.bound.check, mouseup: this.bound.cancel }; events[this.selection] = this.bound.eventStop; this.document.addEvents(events); }, check: function(event){ if (this.options.preventDefault) event.preventDefault(); var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); if (distance > this.options.snap){ this.cancel(); this.document.addEvents({ mousemove: this.bound.drag, mouseup: this.bound.stop }); this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element); } }, drag: function(event){ var options = this.options; if (options.preventDefault) event.preventDefault(); this.mouse.now = event.page; for (var z in options.modifiers){ if (!options.modifiers[z]) continue; this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; if (options.invert) this.value.now[z] *= -1; if (options.limit && this.limit[z]){ if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){ this.value.now[z] = this.limit[z][1]; } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){ this.value.now[z] = this.limit[z][0]; } } if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]); if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit); else this.element[options.modifiers[z]] = this.value.now[z]; } this.fireEvent('drag', [this.element, event]); }, cancel: function(event){ this.document.removeEvents({ mousemove: this.bound.check, mouseup: this.bound.cancel }); if (event){ this.document.removeEvent(this.selection, this.bound.eventStop); this.fireEvent('cancel', this.element); } }, stop: function(event){ var events = { mousemove: this.bound.drag, mouseup: this.bound.stop }; events[this.selection] = this.bound.eventStop; this.document.removeEvents(events); if (event) this.fireEvent('complete', [this.element, event]); } }); Element.implement({ makeResizable: function(options){ var drag = new Drag(this, Object.merge({ modifiers: { x: 'width', y: 'height' } }, options)); this.store('resizer', drag); return drag.addEvent('drag', function(){ this.fireEvent('resize', drag); }.bind(this)); } }); /* --- script: Drag.Move.js name: Drag.Move description: A Drag extension that provides support for the constraining of draggables to containers and droppables. license: MIT-style license authors: - Valerio Proietti - Tom Occhinno - Jan Kassens - Aaron Newton - Scott Kyle requires: - Core/Element.Dimensions - /Drag provides: [Drag.Move] ... */ Drag.Move = new Class({ Extends: Drag, options: {/* onEnter: function(thisElement, overed){}, onLeave: function(thisElement, overed){}, onDrop: function(thisElement, overed, event){},*/ droppables: [], container: false, precalculate: false, includeMargins: true, checkDroppables: true }, initialize: function(element, options){ this.parent(element, options); element = this.element; this.droppables = $$(this.options.droppables); this.container = document.id(this.options.container); if (this.container && typeOf(this.container) != 'element') this.container = document.id(this.container.getDocument().body); if (this.options.style){ if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){ var parent = element.getOffsetParent(), styles = element.getStyles('left', 'top'); if (parent && (styles.left == 'auto' || styles.top == 'auto')){ element.setPosition(element.getPosition(parent)); } } if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute'); } this.addEvent('start', this.checkDroppables, true); this.overed = null; }, start: function(event){ if (this.container) this.options.limit = this.calculateLimit(); if (this.options.precalculate){ this.positions = this.droppables.map(function(el){ return el.getCoordinates(); }); } this.parent(event); }, calculateLimit: function(){ var element = this.element, container = this.container, offsetParent = document.id(element.getOffsetParent()) || document.body, containerCoordinates = container.getCoordinates(offsetParent), elementMargin = {}, elementBorder = {}, containerMargin = {}, containerBorder = {}, offsetParentPadding = {}; ['top', 'right', 'bottom', 'left'].each(function(pad){ elementMargin[pad] = element.getStyle('margin-' + pad).toInt(); elementBorder[pad] = element.getStyle('border-' + pad).toInt(); containerMargin[pad] = container.getStyle('margin-' + pad).toInt(); containerBorder[pad] = container.getStyle('border-' + pad).toInt(); offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt(); }, this); var width = element.offsetWidth + elementMargin.left + elementMargin.right, height = element.offsetHeight + elementMargin.top + elementMargin.bottom, left = 0, top = 0, right = containerCoordinates.right - containerBorder.right - width, bottom = containerCoordinates.bottom - containerBorder.bottom - height; if (this.options.includeMargins){ left += elementMargin.left; top += elementMargin.top; } else { right += elementMargin.right; bottom += elementMargin.bottom; } if (element.getStyle('position') == 'relative'){ var coords = element.getCoordinates(offsetParent); coords.left -= element.getStyle('left').toInt(); coords.top -= element.getStyle('top').toInt(); left -= coords.left; top -= coords.top; if (container.getStyle('position') != 'relative'){ left += containerBorder.left; top += containerBorder.top; } right += elementMargin.left - coords.left; bottom += elementMargin.top - coords.top; if (container != offsetParent){ left += containerMargin.left + offsetParentPadding.left; top += ((Browser.ie6 || Browser.ie7) ? 0 : containerMargin.top) + offsetParentPadding.top; } } else { left -= elementMargin.left; top -= elementMargin.top; if (container != offsetParent){ left += containerCoordinates.left + containerBorder.left; top += containerCoordinates.top + containerBorder.top; } } return { x: [left, right], y: [top, bottom] }; }, getDroppableCoordinates: function(element){ var position = element.getCoordinates(); if (element.getStyle('position') == 'fixed'){ var scroll = window.getScroll(); position.left += scroll.x; position.right += scroll.x; position.top += scroll.y; position.bottom += scroll.y; } return position; }, checkDroppables: function(){ var overed = this.droppables.filter(function(el, i){ el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el); var now = this.mouse.now; return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); }, this).getLast(); if (this.overed != overed){ if (this.overed) this.fireEvent('leave', [this.element, this.overed]); if (overed) this.fireEvent('enter', [this.element, overed]); this.overed = overed; } }, drag: function(event){ this.parent(event); if (this.options.checkDroppables && this.droppables.length) this.checkDroppables(); }, stop: function(event){ this.checkDroppables(); this.fireEvent('drop', [this.element, this.overed, event]); this.overed = null; return this.parent(event); } }); Element.implement({ makeDraggable: function(options){ var drag = new Drag.Move(this, options); this.store('dragger', drag); return drag; } }); /* --- script: Fx.Scroll.js name: Fx.Scroll description: Effect to smoothly scroll any element, including the window. license: MIT-style license authors: - Valerio Proietti requires: - Core/Fx - Core/Element.Event - Core/Element.Dimensions - /MooTools.More provides: [Fx.Scroll] ... */ (function(){ Fx.Scroll = new Class({ Extends: Fx, options: { offset: {x: 0, y: 0}, wheelStops: true }, initialize: function(element, options){ this.element = this.subject = document.id(element); this.parent(options); if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body); if (this.options.wheelStops){ var stopper = this.element, cancel = this.cancel.pass(false, this); this.addEvent('start', function(){ stopper.addEvent('mousewheel', cancel); }, true); this.addEvent('complete', function(){ stopper.removeEvent('mousewheel', cancel); }, true); } }, set: function(){ var now = Array.flatten(arguments); if (Browser.firefox) now = [Math.round(now[0]), Math.round(now[1])]; // not needed anymore in newer firefox versions this.element.scrollTo(now[0], now[1]); return this; }, compute: function(from, to, delta){ return [0, 1].map(function(i){ return Fx.compute(from[i], to[i], delta); }); }, start: function(x, y){ if (!this.check(x, y)) return this; var scroll = this.element.getScroll(); return this.parent([scroll.x, scroll.y], [x, y]); }, calculateScroll: function(x, y){ var element = this.element, scrollSize = element.getScrollSize(), scroll = element.getScroll(), size = element.getSize(), offset = this.options.offset, values = {x: x, y: y}; for (var z in values){ if (!values[z] && values[z] !== 0) values[z] = scroll[z]; if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z]; values[z] += offset[z]; } return [values.x, values.y]; }, toTop: function(){ return this.start.apply(this, this.calculateScroll(false, 0)); }, toLeft: function(){ return this.start.apply(this, this.calculateScroll(0, false)); }, toRight: function(){ return this.start.apply(this, this.calculateScroll('right', false)); }, toBottom: function(){ return this.start.apply(this, this.calculateScroll(false, 'bottom')); }, toElement: function(el, axes){ axes = axes ? Array.from(axes) : ['x', 'y']; var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll(); var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){ return axes.contains(axis) ? value + scroll[axis] : false; }); return this.start.apply(this, this.calculateScroll(position.x, position.y)); }, toElementEdge: function(el, axes, offset){ axes = axes ? Array.from(axes) : ['x', 'y']; el = document.id(el); var to = {}, position = el.getPosition(this.element), size = el.getSize(), scroll = this.element.getScroll(), containerSize = this.element.getSize(), edge = { x: position.x + size.x, y: position.y + size.y }; ['x', 'y'].each(function(axis){ if (axes.contains(axis)){ if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis]; if (position[axis] < scroll[axis]) to[axis] = position[axis]; } if (to[axis] == null) to[axis] = scroll[axis]; if (offset && offset[axis]) to[axis] = to[axis] + offset[axis]; }, this); if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y); return this; }, toElementCenter: function(el, axes, offset){ axes = axes ? Array.from(axes) : ['x', 'y']; el = document.id(el); var to = {}, position = el.getPosition(this.element), size = el.getSize(), scroll = this.element.getScroll(), containerSize = this.element.getSize(); ['x', 'y'].each(function(axis){ if (axes.contains(axis)){ to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2; } if (to[axis] == null) to[axis] = scroll[axis]; if (offset && offset[axis]) to[axis] = to[axis] + offset[axis]; }, this); if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y); return this; } }); function isBody(element){ return (/^(?:body|html)$/i).test(element.tagName); } })(); /* --- script: Element.Measure.js name: Element.Measure description: Extends the Element native object to include methods useful in measuring dimensions. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz" license: MIT-style license authors: - Aaron Newton requires: - Core/Element.Style - Core/Element.Dimensions - /MooTools.More provides: [Element.Measure] ... */ (function(){ var getStylesList = function(styles, planes){ var list = []; Object.each(planes, function(directions){ Object.each(directions, function(edge){ styles.each(function(style){ list.push(style + '-' + edge + (style == 'border' ? '-width' : '')); }); }); }); return list; }; var calculateEdgeSize = function(edge, styles){ var total = 0; Object.each(styles, function(value, style){ if (style.test(edge)) total = total + value.toInt(); }); return total; }; var isVisible = function(el){ return !!(!el || el.offsetHeight || el.offsetWidth); }; Element.implement({ measure: function(fn){ if (isVisible(this)) return fn.call(this); var parent = this.getParent(), toMeasure = []; while (!isVisible(parent) && parent != document.body){ toMeasure.push(parent.expose()); parent = parent.getParent(); } var restore = this.expose(), result = fn.call(this); restore(); toMeasure.each(function(restore){ restore(); }); return result; }, expose: function(){ if (this.getStyle('display') != 'none') return function(){}; var before = this.style.cssText; this.setStyles({ display: 'block', position: 'absolute', visibility: 'hidden' }); return function(){ this.style.cssText = before; }.bind(this); }, getDimensions: function(options){ options = Object.merge({computeSize: false}, options); var dim = {x: 0, y: 0}; var getSize = function(el, options){ return (options.computeSize) ? el.getComputedSize(options) : el.getSize(); }; var parent = this.getParent('body'); if (parent && this.getStyle('display') == 'none'){ dim = this.measure(function(){ return getSize(this, options); }); } else if (parent){ try { //safari sometimes crashes here, so catch it dim = getSize(this, options); }catch(e){} } return Object.append(dim, (dim.x || dim.x === 0) ? { width: dim.x, height: dim.y } : { x: dim.width, y: dim.height } ); }, getComputedSize: function(options){ //<1.2compat> //legacy support for my stupid spelling error if (options && options.plains) options.planes = options.plains; // options = Object.merge({ styles: ['padding','border'], planes: { height: ['top','bottom'], width: ['left','right'] }, mode: 'both' }, options); var styles = {}, size = {width: 0, height: 0}, dimensions; if (options.mode == 'vertical'){ delete size.width; delete options.planes.width; } else if (options.mode == 'horizontal'){ delete size.height; delete options.planes.height; } getStylesList(options.styles, options.planes).each(function(style){ styles[style] = this.getStyle(style).toInt(); }, this); Object.each(options.planes, function(edges, plane){ var capitalized = plane.capitalize(), style = this.getStyle(plane); if (style == 'auto' && !dimensions) dimensions = this.getDimensions(); style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt(); size['total' + capitalized] = style; edges.each(function(edge){ var edgesize = calculateEdgeSize(edge, styles); size['computed' + edge.capitalize()] = edgesize; size['total' + capitalized] += edgesize; }); }, this); return Object.append(size, styles); } }); })(); /* --- script: Fx.Elements.js name: Fx.Elements description: Effect to change any number of CSS properties of any number of Elements. license: MIT-style license authors: - Valerio Proietti requires: - Core/Fx.CSS - /MooTools.More provides: [Fx.Elements] */ Fx.Elements = new Class({ Extends: Fx.CSS, initialize: function(elements, options){ this.elements = this.subject = $$(elements); this.parent(options); }, compute: function(from, to, delta){ var now = {}; for (var i in from){ var iFrom = from[i], iTo = to[i], iNow = now[i] = {}; for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta); } return now; }, set: function(now){ for (var i in now){ if (!this.elements[i]) continue; var iNow = now[i]; for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit); } return this; }, start: function(obj){ if (!this.check(obj)) return this; var from = {}, to = {}; for (var i in obj){ if (!this.elements[i]) continue; var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {}; for (var p in iProps){ var parsed = this.prepare(this.elements[i], p, iProps[p]); iFrom[p] = parsed.from; iTo[p] = parsed.to; } } return this.parent(from, to); } }); /* --- script: Fx.Sort.js name: Fx.Sort description: Defines Fx.Sort, a class that reorders lists with a transition. license: MIT-style license authors: - Aaron Newton requires: - Core/Element.Dimensions - /Fx.Elements - /Element.Measure provides: [Fx.Sort] */ Fx.Sort = new Class({ Extends: Fx.Elements, options: { mode: 'vertical' }, initialize: function(elements, options){ this.parent(elements, options); this.elements.each(function(el){ if (el.getStyle('position') == 'static') el.setStyle('position', 'relative'); }); this.setDefaultOrder(); }, setDefaultOrder: function(){ this.currentOrder = this.elements.map(function(el, index){ return index; }); }, sort: function(){ if (!this.check(arguments)) return this; var newOrder = Array.flatten(arguments); var top = 0, left = 0, next = {}, zero = {}, vert = this.options.mode == 'vertical'; var current = this.elements.map(function(el, index){ var size = el.getComputedSize({styles: ['border', 'padding', 'margin']}); var val; if (vert){ val = { top: top, margin: size['margin-top'], height: size.totalHeight }; top += val.height - size['margin-top']; } else { val = { left: left, margin: size['margin-left'], width: size.totalWidth }; left += val.width; } var plane = vert ? 'top' : 'left'; zero[index] = {}; var start = el.getStyle(plane).toInt(); zero[index][plane] = start || 0; return val; }, this); this.set(zero); newOrder = newOrder.map(function(i){ return i.toInt(); }); if (newOrder.length != this.elements.length){ this.currentOrder.each(function(index){ if (!newOrder.contains(index)) newOrder.push(index); }); if (newOrder.length > this.elements.length) newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length); } var margin = 0; top = left = 0; newOrder.each(function(item){ var newPos = {}; if (vert){ newPos.top = top - current[item].top - margin; top += current[item].height; } else { newPos.left = left - current[item].left; left += current[item].width; } margin = margin + current[item].margin; next[item]=newPos; }, this); var mapped = {}; Array.clone(newOrder).sort().each(function(index){ mapped[index] = next[index]; }); this.start(mapped); this.currentOrder = newOrder; return this; }, rearrangeDOM: function(newOrder){ newOrder = newOrder || this.currentOrder; var parent = this.elements[0].getParent(); var rearranged = []; this.elements.setStyle('opacity', 0); //move each element and store the new default order newOrder.each(function(index){ rearranged.push(this.elements[index].inject(parent).setStyles({ top: 0, left: 0 })); }, this); this.elements.setStyle('opacity', 1); this.elements = $$(rearranged); this.setDefaultOrder(); return this; }, getDefaultOrder: function(){ return this.elements.map(function(el, index){ return index; }); }, getCurrentOrder: function(){ return this.currentOrder; }, forward: function(){ return this.sort(this.getDefaultOrder()); }, backward: function(){ return this.sort(this.getDefaultOrder().reverse()); }, reverse: function(){ return this.sort(this.currentOrder.reverse()); }, sortByElements: function(elements){ return this.sort(elements.map(function(el){ return this.elements.indexOf(el); }, this)); }, swap: function(one, two){ if (typeOf(one) == 'element') one = this.elements.indexOf(one); if (typeOf(two) == 'element') two = this.elements.indexOf(two); var newOrder = Array.clone(this.currentOrder); newOrder[this.currentOrder.indexOf(one)] = two; newOrder[this.currentOrder.indexOf(two)] = one; return this.sort(newOrder); } }); }