id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
42,800
neyric/webhookit
public/javascripts/inputex/js/fields/SerializeField-beta.js
function(sValue) { if(!XML || !YAHOO.lang.isFunction(XML.ObjTree) ) { alert("ObjTree.js not loaded."); return null; } var xotree = new XML.ObjTree(); var tree = xotree.parseXML( sValue ); return tree; }
javascript
function(sValue) { if(!XML || !YAHOO.lang.isFunction(XML.ObjTree) ) { alert("ObjTree.js not loaded."); return null; } var xotree = new XML.ObjTree(); var tree = xotree.parseXML( sValue ); return tree; }
[ "function", "(", "sValue", ")", "{", "if", "(", "!", "XML", "||", "!", "YAHOO", ".", "lang", ".", "isFunction", "(", "XML", ".", "ObjTree", ")", ")", "{", "alert", "(", "\"ObjTree.js not loaded.\"", ")", ";", "return", "null", ";", "}", "var", "xotree", "=", "new", "XML", ".", "ObjTree", "(", ")", ";", "var", "tree", "=", "xotree", ".", "parseXML", "(", "sValue", ")", ";", "return", "tree", ";", "}" ]
deserialize from XML @static
[ "deserialize", "from", "XML" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/SerializeField-beta.js#L144-L152
42,801
neyric/webhookit
server.js
function(req, res){ return function(){ var buf = [], messages = req.flash(), types = Object.keys(messages), len = types.length; if (!len) { return ''; } buf.push('<div id="messages">'); for (var i = 0 ; i < len; ++i) { var type = types[i], msgs = messages[type], j; buf.push(' <ul class="' + type + '">'); for (j = 0, len = msgs.length; j < len; ++j) { var msg = msgs[j]; buf.push(' <li>' + msg + '</li>'); } buf.push(' </ul>'); } buf.push('</div>'); return buf.join('\n'); }; }
javascript
function(req, res){ return function(){ var buf = [], messages = req.flash(), types = Object.keys(messages), len = types.length; if (!len) { return ''; } buf.push('<div id="messages">'); for (var i = 0 ; i < len; ++i) { var type = types[i], msgs = messages[type], j; buf.push(' <ul class="' + type + '">'); for (j = 0, len = msgs.length; j < len; ++j) { var msg = msgs[j]; buf.push(' <li>' + msg + '</li>'); } buf.push(' </ul>'); } buf.push('</div>'); return buf.join('\n'); }; }
[ "function", "(", "req", ",", "res", ")", "{", "return", "function", "(", ")", "{", "var", "buf", "=", "[", "]", ",", "messages", "=", "req", ".", "flash", "(", ")", ",", "types", "=", "Object", ".", "keys", "(", "messages", ")", ",", "len", "=", "types", ".", "length", ";", "if", "(", "!", "len", ")", "{", "return", "''", ";", "}", "buf", ".", "push", "(", "'<div id=\"messages\">'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "len", ";", "++", "i", ")", "{", "var", "type", "=", "types", "[", "i", "]", ",", "msgs", "=", "messages", "[", "type", "]", ",", "j", ";", "buf", ".", "push", "(", "' <ul class=\"'", "+", "type", "+", "'\">'", ")", ";", "for", "(", "j", "=", "0", ",", "len", "=", "msgs", ".", "length", ";", "j", "<", "len", ";", "++", "j", ")", "{", "var", "msg", "=", "msgs", "[", "j", "]", ";", "buf", ".", "push", "(", "' <li>'", "+", "msg", "+", "'</li>'", ")", ";", "}", "buf", ".", "push", "(", "' </ul>'", ")", ";", "}", "buf", ".", "push", "(", "'</div>'", ")", ";", "return", "buf", ".", "join", "(", "'\\n'", ")", ";", "}", ";", "}" ]
req.flash to html helper
[ "req", ".", "flash", "to", "html", "helper" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/server.js#L70-L93
42,802
neyric/webhookit
public/javascripts/yui/slider/slider.js
Slider
function Slider(sElementId, sGroup, oThumb, sType) { Slider.ANIM_AVAIL = (!YAHOO.lang.isUndefined(YAHOO.util.Anim)); if (sElementId) { this.init(sElementId, sGroup, true); this.initSlider(sType); this.initThumb(oThumb); } }
javascript
function Slider(sElementId, sGroup, oThumb, sType) { Slider.ANIM_AVAIL = (!YAHOO.lang.isUndefined(YAHOO.util.Anim)); if (sElementId) { this.init(sElementId, sGroup, true); this.initSlider(sType); this.initThumb(oThumb); } }
[ "function", "Slider", "(", "sElementId", ",", "sGroup", ",", "oThumb", ",", "sType", ")", "{", "Slider", ".", "ANIM_AVAIL", "=", "(", "!", "YAHOO", ".", "lang", ".", "isUndefined", "(", "YAHOO", ".", "util", ".", "Anim", ")", ")", ";", "if", "(", "sElementId", ")", "{", "this", ".", "init", "(", "sElementId", ",", "sGroup", ",", "true", ")", ";", "this", ".", "initSlider", "(", "sType", ")", ";", "this", ".", "initThumb", "(", "oThumb", ")", ";", "}", "}" ]
A DragDrop implementation that can be used as a background for a slider. It takes a reference to the thumb instance so it can delegate some of the events to it. The goal is to make the thumb jump to the location on the background when the background is clicked. @class Slider @extends YAHOO.util.DragDrop @uses YAHOO.util.EventProvider @constructor @param {String} id The id of the element linked to this instance @param {String} sGroup The group of related DragDrop items @param {SliderThumb} oThumb The thumb for this slider @param {String} sType The type of slider (horiz, vert, region)
[ "A", "DragDrop", "implementation", "that", "can", "be", "used", "as", "a", "background", "for", "a", "slider", ".", "It", "takes", "a", "reference", "to", "the", "thumb", "instance", "so", "it", "can", "delegate", "some", "of", "the", "events", "to", "it", ".", "The", "goal", "is", "to", "make", "the", "thumb", "jump", "to", "the", "location", "on", "the", "background", "when", "the", "background", "is", "clicked", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L43-L52
42,803
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { return new Slider(sBGElId, sBGElId, new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, iUp, iDown, iTickSize), "vert"); }
javascript
function (sBGElId, sHandleElId, iUp, iDown, iTickSize) { return new Slider(sBGElId, sBGElId, new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, iUp, iDown, iTickSize), "vert"); }
[ "function", "(", "sBGElId", ",", "sHandleElId", ",", "iUp", ",", "iDown", ",", "iTickSize", ")", "{", "return", "new", "Slider", "(", "sBGElId", ",", "sBGElId", ",", "new", "YAHOO", ".", "widget", ".", "SliderThumb", "(", "sHandleElId", ",", "sBGElId", ",", "0", ",", "0", ",", "iUp", ",", "iDown", ",", "iTickSize", ")", ",", "\"vert\"", ")", ";", "}" ]
Factory method for creating a vertical slider @method YAHOO.widget.Slider.getVertSlider @static @param {String} sBGElId the id of the slider's background element @param {String} sHandleElId the id of the thumb element @param {int} iUp the number of pixels the element can move up @param {int} iDown the number of pixels the element can move down @param {int} iTickSize optional parameter for specifying that the element should move a certain number pixels at a time. @return {Slider} a vertical slider control
[ "Factory", "method", "for", "creating", "a", "vertical", "slider" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L87-L91
42,804
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(t) { var self = this; /** * A YAHOO.widget.SliderThumb instance that we will use to * reposition the thumb when the background is clicked * @property thumb * @type YAHOO.widget.SliderThumb */ this.thumb = t; t.cacheBetweenDrags = true; if (t._isHoriz && t.xTicks && t.xTicks.length) { this.tickPause = Math.round(360 / t.xTicks.length); } else if (t.yTicks && t.yTicks.length) { this.tickPause = Math.round(360 / t.yTicks.length); } // delegate thumb methods t.onAvailable = function() { return self.setStartSliderState(); }; t.onMouseDown = function () { self._mouseDown = true; return self.focus(); }; t.startDrag = function() { self._slideStart(); }; t.onDrag = function() { self.fireEvents(true); }; t.onMouseUp = function() { self.thumbMouseUp(); }; }
javascript
function(t) { var self = this; /** * A YAHOO.widget.SliderThumb instance that we will use to * reposition the thumb when the background is clicked * @property thumb * @type YAHOO.widget.SliderThumb */ this.thumb = t; t.cacheBetweenDrags = true; if (t._isHoriz && t.xTicks && t.xTicks.length) { this.tickPause = Math.round(360 / t.xTicks.length); } else if (t.yTicks && t.yTicks.length) { this.tickPause = Math.round(360 / t.yTicks.length); } // delegate thumb methods t.onAvailable = function() { return self.setStartSliderState(); }; t.onMouseDown = function () { self._mouseDown = true; return self.focus(); }; t.startDrag = function() { self._slideStart(); }; t.onDrag = function() { self.fireEvents(true); }; t.onMouseUp = function() { self.thumbMouseUp(); }; }
[ "function", "(", "t", ")", "{", "var", "self", "=", "this", ";", "/**\n * A YAHOO.widget.SliderThumb instance that we will use to \n * reposition the thumb when the background is clicked\n * @property thumb\n * @type YAHOO.widget.SliderThumb\n */", "this", ".", "thumb", "=", "t", ";", "t", ".", "cacheBetweenDrags", "=", "true", ";", "if", "(", "t", ".", "_isHoriz", "&&", "t", ".", "xTicks", "&&", "t", ".", "xTicks", ".", "length", ")", "{", "this", ".", "tickPause", "=", "Math", ".", "round", "(", "360", "/", "t", ".", "xTicks", ".", "length", ")", ";", "}", "else", "if", "(", "t", ".", "yTicks", "&&", "t", ".", "yTicks", ".", "length", ")", "{", "this", ".", "tickPause", "=", "Math", ".", "round", "(", "360", "/", "t", ".", "yTicks", ".", "length", ")", ";", "}", "// delegate thumb methods", "t", ".", "onAvailable", "=", "function", "(", ")", "{", "return", "self", ".", "setStartSliderState", "(", ")", ";", "}", ";", "t", ".", "onMouseDown", "=", "function", "(", ")", "{", "self", ".", "_mouseDown", "=", "true", ";", "return", "self", ".", "focus", "(", ")", ";", "}", ";", "t", ".", "startDrag", "=", "function", "(", ")", "{", "self", ".", "_slideStart", "(", ")", ";", "}", ";", "t", ".", "onDrag", "=", "function", "(", ")", "{", "self", ".", "fireEvents", "(", "true", ")", ";", "}", ";", "t", ".", "onMouseUp", "=", "function", "(", ")", "{", "self", ".", "thumbMouseUp", "(", ")", ";", "}", ";", "}" ]
Initializes the slider's thumb. Executed in the constructor. @method initThumb @param {YAHOO.widget.SliderThumb} t the slider thumb
[ "Initializes", "the", "slider", "s", "thumb", ".", "Executed", "in", "the", "constructor", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L340-L379
42,805
neyric/webhookit
public/javascripts/yui/slider/slider.js
function () { Event.on(this.id, "keydown", this.handleKeyDown, this, true); Event.on(this.id, "keypress", this.handleKeyPress, this, true); }
javascript
function () { Event.on(this.id, "keydown", this.handleKeyDown, this, true); Event.on(this.id, "keypress", this.handleKeyPress, this, true); }
[ "function", "(", ")", "{", "Event", ".", "on", "(", "this", ".", "id", ",", "\"keydown\"", ",", "this", ".", "handleKeyDown", ",", "this", ",", "true", ")", ";", "Event", ".", "on", "(", "this", ".", "id", ",", "\"keypress\"", ",", "this", ".", "handleKeyPress", ",", "this", ",", "true", ")", ";", "}" ]
Sets up the listeners for keydown and key press events. @method _bindKeyEvents @protected
[ "Sets", "up", "the", "listeners", "for", "keydown", "and", "key", "press", "events", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L395-L398
42,806
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(e) { if (this.enableKeys) { var kc = Event.getCharCode(e); switch (kc) { case 0x25: // left case 0x26: // up case 0x27: // right case 0x28: // down case 0x24: // home case 0x23: // end Event.preventDefault(e); break; default: } } }
javascript
function(e) { if (this.enableKeys) { var kc = Event.getCharCode(e); switch (kc) { case 0x25: // left case 0x26: // up case 0x27: // right case 0x28: // down case 0x24: // home case 0x23: // end Event.preventDefault(e); break; default: } } }
[ "function", "(", "e", ")", "{", "if", "(", "this", ".", "enableKeys", ")", "{", "var", "kc", "=", "Event", ".", "getCharCode", "(", "e", ")", ";", "switch", "(", "kc", ")", "{", "case", "0x25", ":", "// left", "case", "0x26", ":", "// up", "case", "0x27", ":", "// right", "case", "0x28", ":", "// down", "case", "0x24", ":", "// home", "case", "0x23", ":", "// end", "Event", ".", "preventDefault", "(", "e", ")", ";", "break", ";", "default", ":", "}", "}", "}" ]
Executed when a keypress event happens with the control focused. Prevents the default behavior for navigation keys. The actual logic for moving the slider thumb in response to a key event happens in handleKeyDown. @param {Event} e the keypress event
[ "Executed", "when", "a", "keypress", "event", "happens", "with", "the", "control", "focused", ".", "Prevents", "the", "default", "behavior", "for", "navigation", "keys", ".", "The", "actual", "logic", "for", "moving", "the", "slider", "thumb", "in", "response", "to", "a", "key", "event", "happens", "in", "handleKeyDown", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L407-L423
42,807
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(e) { if (this.enableKeys) { var kc = Event.getCharCode(e), t = this.thumb, h = this.getXValue(), v = this.getYValue(), changeValue = true; switch (kc) { // left case 0x25: h -= this.keyIncrement; break; // up case 0x26: v -= this.keyIncrement; break; // right case 0x27: h += this.keyIncrement; break; // down case 0x28: v += this.keyIncrement; break; // home case 0x24: h = t.leftConstraint; v = t.topConstraint; break; // end case 0x23: h = t.rightConstraint; v = t.bottomConstraint; break; default: changeValue = false; } if (changeValue) { if (t._isRegion) { this._setRegionValue(Slider.SOURCE_KEY_EVENT, h, v, true); } else { this._setValue(Slider.SOURCE_KEY_EVENT, (t._isHoriz ? h : v), true); } Event.stopEvent(e); } } }
javascript
function(e) { if (this.enableKeys) { var kc = Event.getCharCode(e), t = this.thumb, h = this.getXValue(), v = this.getYValue(), changeValue = true; switch (kc) { // left case 0x25: h -= this.keyIncrement; break; // up case 0x26: v -= this.keyIncrement; break; // right case 0x27: h += this.keyIncrement; break; // down case 0x28: v += this.keyIncrement; break; // home case 0x24: h = t.leftConstraint; v = t.topConstraint; break; // end case 0x23: h = t.rightConstraint; v = t.bottomConstraint; break; default: changeValue = false; } if (changeValue) { if (t._isRegion) { this._setRegionValue(Slider.SOURCE_KEY_EVENT, h, v, true); } else { this._setValue(Slider.SOURCE_KEY_EVENT, (t._isHoriz ? h : v), true); } Event.stopEvent(e); } } }
[ "function", "(", "e", ")", "{", "if", "(", "this", ".", "enableKeys", ")", "{", "var", "kc", "=", "Event", ".", "getCharCode", "(", "e", ")", ",", "t", "=", "this", ".", "thumb", ",", "h", "=", "this", ".", "getXValue", "(", ")", ",", "v", "=", "this", ".", "getYValue", "(", ")", ",", "changeValue", "=", "true", ";", "switch", "(", "kc", ")", "{", "// left", "case", "0x25", ":", "h", "-=", "this", ".", "keyIncrement", ";", "break", ";", "// up", "case", "0x26", ":", "v", "-=", "this", ".", "keyIncrement", ";", "break", ";", "// right", "case", "0x27", ":", "h", "+=", "this", ".", "keyIncrement", ";", "break", ";", "// down", "case", "0x28", ":", "v", "+=", "this", ".", "keyIncrement", ";", "break", ";", "// home", "case", "0x24", ":", "h", "=", "t", ".", "leftConstraint", ";", "v", "=", "t", ".", "topConstraint", ";", "break", ";", "// end", "case", "0x23", ":", "h", "=", "t", ".", "rightConstraint", ";", "v", "=", "t", ".", "bottomConstraint", ";", "break", ";", "default", ":", "changeValue", "=", "false", ";", "}", "if", "(", "changeValue", ")", "{", "if", "(", "t", ".", "_isRegion", ")", "{", "this", ".", "_setRegionValue", "(", "Slider", ".", "SOURCE_KEY_EVENT", ",", "h", ",", "v", ",", "true", ")", ";", "}", "else", "{", "this", ".", "_setValue", "(", "Slider", ".", "SOURCE_KEY_EVENT", ",", "(", "t", ".", "_isHoriz", "?", "h", ":", "v", ")", ",", "true", ")", ";", "}", "Event", ".", "stopEvent", "(", "e", ")", ";", "}", "}", "}" ]
Executed when a keydown event happens with the control focused. Updates the slider value and display when the keypress is an arrow key, home, or end as long as enableKeys is set to true. @param {Event} e the keydown event
[ "Executed", "when", "a", "keydown", "event", "happens", "with", "the", "control", "focused", ".", "Updates", "the", "slider", "value", "and", "display", "when", "the", "keypress", "is", "an", "arrow", "key", "home", "or", "end", "as", "long", "as", "enableKeys", "is", "set", "to", "true", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L431-L477
42,808
neyric/webhookit
public/javascripts/yui/slider/slider.js
function() { var el = this.thumb.getEl(); if (el) { /** * The center of the slider element is stored so we can * place it in the correct position when the background is clicked. * @property thumbCenterPoint * @type {"x": int, "y": int} */ this.thumbCenterPoint = { x: parseInt(el.offsetWidth/2, 10), y: parseInt(el.offsetHeight/2, 10) }; } }
javascript
function() { var el = this.thumb.getEl(); if (el) { /** * The center of the slider element is stored so we can * place it in the correct position when the background is clicked. * @property thumbCenterPoint * @type {"x": int, "y": int} */ this.thumbCenterPoint = { x: parseInt(el.offsetWidth/2, 10), y: parseInt(el.offsetHeight/2, 10) }; } }
[ "function", "(", ")", "{", "var", "el", "=", "this", ".", "thumb", ".", "getEl", "(", ")", ";", "if", "(", "el", ")", "{", "/**\n * The center of the slider element is stored so we can \n * place it in the correct position when the background is clicked.\n * @property thumbCenterPoint\n * @type {\"x\": int, \"y\": int}\n */", "this", ".", "thumbCenterPoint", "=", "{", "x", ":", "parseInt", "(", "el", ".", "offsetWidth", "/", "2", ",", "10", ")", ",", "y", ":", "parseInt", "(", "el", ".", "offsetHeight", "/", "2", ",", "10", ")", "}", ";", "}", "}" ]
When the thumb is available, we cache the centerpoint of the element so we can position the element correctly when the background is clicked @method setThumbCenterPoint
[ "When", "the", "thumb", "is", "available", "we", "cache", "the", "centerpoint", "of", "the", "element", "so", "we", "can", "position", "the", "element", "correctly", "when", "the", "background", "is", "clicked" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L521-L538
42,809
neyric/webhookit
public/javascripts/yui/slider/slider.js
function() { var args = _AS.call(arguments); args.unshift(Slider.SOURCE_SET_VALUE); return this._setValue.apply(this,args); }
javascript
function() { var args = _AS.call(arguments); args.unshift(Slider.SOURCE_SET_VALUE); return this._setValue.apply(this,args); }
[ "function", "(", ")", "{", "var", "args", "=", "_AS", ".", "call", "(", "arguments", ")", ";", "args", ".", "unshift", "(", "Slider", ".", "SOURCE_SET_VALUE", ")", ";", "return", "this", ".", "_setValue", ".", "apply", "(", "this", ",", "args", ")", ";", "}" ]
Provides a way to set the value of the slider in code. @method setValue @param {int} newOffset the number of pixels the thumb should be positioned away from the initial start point @param {boolean} skipAnim set to true to disable the animation for this move action (but not others). @param {boolean} force ignore the locked setting and set value anyway @param {boolean} silent when true, do not fire events @return {boolean} true if the move was performed, false if it failed
[ "Provides", "a", "way", "to", "set", "the", "value", "of", "the", "slider", "in", "code", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L686-L690
42,810
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(finalCoord) { var t = this.thumb, self = this, nextCoord = null, tmpX, tmpY; if (t._isRegion) { nextCoord = this._getNextX(this.curCoord, finalCoord); tmpX = (nextCoord !== null) ? nextCoord[0] : this.curCoord[0]; nextCoord = this._getNextY(this.curCoord, finalCoord); tmpY = (nextCoord !== null) ? nextCoord[1] : this.curCoord[1]; nextCoord = tmpX !== this.curCoord[0] || tmpY !== this.curCoord[1] ? [ tmpX, tmpY ] : null; } else if (t._isHoriz) { nextCoord = this._getNextX(this.curCoord, finalCoord); } else { nextCoord = this._getNextY(this.curCoord, finalCoord); } if (nextCoord) { // cache the position this.curCoord = nextCoord; // move to the next coord this.thumb.alignElWithMouse(t.getEl(), nextCoord[0] + this.thumbCenterPoint.x, nextCoord[1] + this.thumbCenterPoint.y); // check if we are in the final position, if not make a recursive call if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) { setTimeout(function() { self.moveOneTick(finalCoord); }, this.tickPause); } else { this.unlock(); if (!this._mouseDown) { this.endMove(); } } } else { this.unlock(); if (!this._mouseDown) { this.endMove(); } } }
javascript
function(finalCoord) { var t = this.thumb, self = this, nextCoord = null, tmpX, tmpY; if (t._isRegion) { nextCoord = this._getNextX(this.curCoord, finalCoord); tmpX = (nextCoord !== null) ? nextCoord[0] : this.curCoord[0]; nextCoord = this._getNextY(this.curCoord, finalCoord); tmpY = (nextCoord !== null) ? nextCoord[1] : this.curCoord[1]; nextCoord = tmpX !== this.curCoord[0] || tmpY !== this.curCoord[1] ? [ tmpX, tmpY ] : null; } else if (t._isHoriz) { nextCoord = this._getNextX(this.curCoord, finalCoord); } else { nextCoord = this._getNextY(this.curCoord, finalCoord); } if (nextCoord) { // cache the position this.curCoord = nextCoord; // move to the next coord this.thumb.alignElWithMouse(t.getEl(), nextCoord[0] + this.thumbCenterPoint.x, nextCoord[1] + this.thumbCenterPoint.y); // check if we are in the final position, if not make a recursive call if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) { setTimeout(function() { self.moveOneTick(finalCoord); }, this.tickPause); } else { this.unlock(); if (!this._mouseDown) { this.endMove(); } } } else { this.unlock(); if (!this._mouseDown) { this.endMove(); } } }
[ "function", "(", "finalCoord", ")", "{", "var", "t", "=", "this", ".", "thumb", ",", "self", "=", "this", ",", "nextCoord", "=", "null", ",", "tmpX", ",", "tmpY", ";", "if", "(", "t", ".", "_isRegion", ")", "{", "nextCoord", "=", "this", ".", "_getNextX", "(", "this", ".", "curCoord", ",", "finalCoord", ")", ";", "tmpX", "=", "(", "nextCoord", "!==", "null", ")", "?", "nextCoord", "[", "0", "]", ":", "this", ".", "curCoord", "[", "0", "]", ";", "nextCoord", "=", "this", ".", "_getNextY", "(", "this", ".", "curCoord", ",", "finalCoord", ")", ";", "tmpY", "=", "(", "nextCoord", "!==", "null", ")", "?", "nextCoord", "[", "1", "]", ":", "this", ".", "curCoord", "[", "1", "]", ";", "nextCoord", "=", "tmpX", "!==", "this", ".", "curCoord", "[", "0", "]", "||", "tmpY", "!==", "this", ".", "curCoord", "[", "1", "]", "?", "[", "tmpX", ",", "tmpY", "]", ":", "null", ";", "}", "else", "if", "(", "t", ".", "_isHoriz", ")", "{", "nextCoord", "=", "this", ".", "_getNextX", "(", "this", ".", "curCoord", ",", "finalCoord", ")", ";", "}", "else", "{", "nextCoord", "=", "this", ".", "_getNextY", "(", "this", ".", "curCoord", ",", "finalCoord", ")", ";", "}", "if", "(", "nextCoord", ")", "{", "// cache the position", "this", ".", "curCoord", "=", "nextCoord", ";", "// move to the next coord", "this", ".", "thumb", ".", "alignElWithMouse", "(", "t", ".", "getEl", "(", ")", ",", "nextCoord", "[", "0", "]", "+", "this", ".", "thumbCenterPoint", ".", "x", ",", "nextCoord", "[", "1", "]", "+", "this", ".", "thumbCenterPoint", ".", "y", ")", ";", "// check if we are in the final position, if not make a recursive call", "if", "(", "!", "(", "nextCoord", "[", "0", "]", "==", "finalCoord", "[", "0", "]", "&&", "nextCoord", "[", "1", "]", "==", "finalCoord", "[", "1", "]", ")", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "moveOneTick", "(", "finalCoord", ")", ";", "}", ",", "this", ".", "tickPause", ")", ";", "}", "else", "{", "this", ".", "unlock", "(", ")", ";", "if", "(", "!", "this", ".", "_mouseDown", ")", "{", "this", ".", "endMove", "(", ")", ";", "}", "}", "}", "else", "{", "this", ".", "unlock", "(", ")", ";", "if", "(", "!", "this", ".", "_mouseDown", ")", "{", "this", ".", "endMove", "(", ")", ";", "}", "}", "}" ]
Move the slider one tick mark towards its final coordinate. Used for the animation when tick marks are defined @method moveOneTick @param {int[]} the destination coordinate @private
[ "Move", "the", "slider", "one", "tick", "mark", "towards", "its", "final", "coordinate", ".", "Used", "for", "the", "animation", "when", "tick", "marks", "are", "defined" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L950-L996
42,811
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(e) { if (!this.backgroundEnabled || this.isLocked()) { return false; } this._mouseDown = true; var x = Event.getPageX(e), y = Event.getPageY(e); this.focus(); this._slideStart(); this.moveThumb(x, y); }
javascript
function(e) { if (!this.backgroundEnabled || this.isLocked()) { return false; } this._mouseDown = true; var x = Event.getPageX(e), y = Event.getPageY(e); this.focus(); this._slideStart(); this.moveThumb(x, y); }
[ "function", "(", "e", ")", "{", "if", "(", "!", "this", ".", "backgroundEnabled", "||", "this", ".", "isLocked", "(", ")", ")", "{", "return", "false", ";", "}", "this", ".", "_mouseDown", "=", "true", ";", "var", "x", "=", "Event", ".", "getPageX", "(", "e", ")", ",", "y", "=", "Event", ".", "getPageY", "(", "e", ")", ";", "this", ".", "focus", "(", ")", ";", "this", ".", "_slideStart", "(", ")", ";", "this", ".", "moveThumb", "(", "x", ",", "y", ")", ";", "}" ]
Handles the mousedown event for the slider background @method onMouseDown @private
[ "Handles", "the", "mousedown", "event", "for", "the", "slider", "background" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1069-L1083
42,812
neyric/webhookit
public/javascripts/yui/slider/slider.js
function () { var t = this.thumb; t.setXConstraint(t.leftConstraint, t.rightConstraint, t.xTickSize); t.setYConstraint(t.topConstraint, t.bottomConstraint, t.xTickSize); }
javascript
function () { var t = this.thumb; t.setXConstraint(t.leftConstraint, t.rightConstraint, t.xTickSize); t.setYConstraint(t.topConstraint, t.bottomConstraint, t.xTickSize); }
[ "function", "(", ")", "{", "var", "t", "=", "this", ".", "thumb", ";", "t", ".", "setXConstraint", "(", "t", ".", "leftConstraint", ",", "t", ".", "rightConstraint", ",", "t", ".", "xTickSize", ")", ";", "t", ".", "setYConstraint", "(", "t", ".", "topConstraint", ",", "t", ".", "bottomConstraint", ",", "t", ".", "xTickSize", ")", ";", "}" ]
Resets the X and Y contraints for the thumb. Used in lieu of the thumb instance's inherited resetConstraints because some logic was not applicable. @method resetThumbConstraints @protected
[ "Resets", "the", "X", "and", "Y", "contraints", "for", "the", "thumb", ".", "Used", "in", "lieu", "of", "the", "thumb", "instance", "s", "inherited", "resetConstraints", "because", "some", "logic", "was", "not", "applicable", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1117-L1122
42,813
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(parentPos) { var myPos = YAHOO.util.Dom.getXY(this.getEl()), ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; }
javascript
function(parentPos) { var myPos = YAHOO.util.Dom.getXY(this.getEl()), ppos = parentPos || YAHOO.util.Dom.getXY(this.parentElId); return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ]; }
[ "function", "(", "parentPos", ")", "{", "var", "myPos", "=", "YAHOO", ".", "util", ".", "Dom", ".", "getXY", "(", "this", ".", "getEl", "(", ")", ")", ",", "ppos", "=", "parentPos", "||", "YAHOO", ".", "util", ".", "Dom", ".", "getXY", "(", "this", ".", "parentElId", ")", ";", "return", "[", "(", "myPos", "[", "0", "]", "-", "ppos", "[", "0", "]", ")", ",", "(", "myPos", "[", "1", "]", "-", "ppos", "[", "1", "]", ")", "]", ";", "}" ]
Returns the difference between the location of the thumb and its parent. @method getOffsetFromParent @param {[int, int]} parentPos Optionally accepts the position of the parent @type [int, int]
[ "Returns", "the", "difference", "between", "the", "location", "of", "the", "thumb", "and", "its", "parent", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1303-L1308
42,814
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (iLeft, iRight, iUp, iDown, iTickSize) { this.initLeft = iLeft; this.initRight = iRight; this.initUp = iUp; this.initDown = iDown; this.setXConstraint(iLeft, iRight, iTickSize); this.setYConstraint(iUp, iDown, iTickSize); if (iTickSize && iTickSize > 1) { this._graduated = true; } this._isHoriz = (iLeft || iRight); this._isVert = (iUp || iDown); this._isRegion = (this._isHoriz && this._isVert); }
javascript
function (iLeft, iRight, iUp, iDown, iTickSize) { this.initLeft = iLeft; this.initRight = iRight; this.initUp = iUp; this.initDown = iDown; this.setXConstraint(iLeft, iRight, iTickSize); this.setYConstraint(iUp, iDown, iTickSize); if (iTickSize && iTickSize > 1) { this._graduated = true; } this._isHoriz = (iLeft || iRight); this._isVert = (iUp || iDown); this._isRegion = (this._isHoriz && this._isVert); }
[ "function", "(", "iLeft", ",", "iRight", ",", "iUp", ",", "iDown", ",", "iTickSize", ")", "{", "this", ".", "initLeft", "=", "iLeft", ";", "this", ".", "initRight", "=", "iRight", ";", "this", ".", "initUp", "=", "iUp", ";", "this", ".", "initDown", "=", "iDown", ";", "this", ".", "setXConstraint", "(", "iLeft", ",", "iRight", ",", "iTickSize", ")", ";", "this", ".", "setYConstraint", "(", "iUp", ",", "iDown", ",", "iTickSize", ")", ";", "if", "(", "iTickSize", "&&", "iTickSize", ">", "1", ")", "{", "this", ".", "_graduated", "=", "true", ";", "}", "this", ".", "_isHoriz", "=", "(", "iLeft", "||", "iRight", ")", ";", "this", ".", "_isVert", "=", "(", "iUp", "||", "iDown", ")", ";", "this", ".", "_isRegion", "=", "(", "this", ".", "_isHoriz", "&&", "this", ".", "_isVert", ")", ";", "}" ]
Set up the slider, must be called in the constructor of all subclasses @method initSlider @param {int} iLeft the number of pixels the element can move left @param {int} iRight the number of pixels the element can move right @param {int} iUp the number of pixels the element can move up @param {int} iDown the number of pixels the element can move down @param {int} iTickSize the width of the tick interval.
[ "Set", "up", "the", "slider", "must", "be", "called", "in", "the", "constructor", "of", "all", "subclasses" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1352-L1369
42,815
neyric/webhookit
public/javascripts/yui/slider/slider.js
function () { if (!this.available) { return 0; } var newOffset = this.getOffsetFromParent(); if (YAHOO.lang.isNumber(newOffset[0])) { this.lastOffset = newOffset; return (newOffset[0] - this.startOffset[0]); } else { return (this.lastOffset[0] - this.startOffset[0]); } }
javascript
function () { if (!this.available) { return 0; } var newOffset = this.getOffsetFromParent(); if (YAHOO.lang.isNumber(newOffset[0])) { this.lastOffset = newOffset; return (newOffset[0] - this.startOffset[0]); } else { return (this.lastOffset[0] - this.startOffset[0]); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "available", ")", "{", "return", "0", ";", "}", "var", "newOffset", "=", "this", ".", "getOffsetFromParent", "(", ")", ";", "if", "(", "YAHOO", ".", "lang", ".", "isNumber", "(", "newOffset", "[", "0", "]", ")", ")", "{", "this", ".", "lastOffset", "=", "newOffset", ";", "return", "(", "newOffset", "[", "0", "]", "-", "this", ".", "startOffset", "[", "0", "]", ")", ";", "}", "else", "{", "return", "(", "this", ".", "lastOffset", "[", "0", "]", "-", "this", ".", "startOffset", "[", "0", "]", ")", ";", "}", "}" ]
Gets the current X offset from the element's start position in pixels. @method getXValue @return {int} the number of pixels (positive or negative) the slider has moved horizontally from the start position.
[ "Gets", "the", "current", "X", "offset", "from", "the", "element", "s", "start", "position", "in", "pixels", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1400-L1411
42,816
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (slider) { Event.on(slider.id,'keydown', this._handleKeyDown, this,true); Event.on(slider.id,'keypress',this._handleKeyPress,this,true); }
javascript
function (slider) { Event.on(slider.id,'keydown', this._handleKeyDown, this,true); Event.on(slider.id,'keypress',this._handleKeyPress,this,true); }
[ "function", "(", "slider", ")", "{", "Event", ".", "on", "(", "slider", ".", "id", ",", "'keydown'", ",", "this", ".", "_handleKeyDown", ",", "this", ",", "true", ")", ";", "Event", ".", "on", "(", "slider", ".", "id", ",", "'keypress'", ",", "this", ".", "_handleKeyPress", ",", "this", ",", "true", ")", ";", "}" ]
Set up the listeners for the keydown and keypress events. @method _bindKeyEvents @protected
[ "Set", "up", "the", "listeners", "for", "the", "keydown", "and", "keypress", "events", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1700-L1703
42,817
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (min, max, skipAnim, force, silent) { var mins = this.minSlider, maxs = this.maxSlider, mint = mins.thumb, maxt = maxs.thumb, self = this, done = { min : false, max : false }; // Clear constraints to prevent animated thumbs from prematurely // stopping when hitting a constraint that's moving with the other // thumb. if (mint._isHoriz) { mint.setXConstraint(mint.leftConstraint,maxt.rightConstraint,mint.tickSize); maxt.setXConstraint(mint.leftConstraint,maxt.rightConstraint,maxt.tickSize); } else { mint.setYConstraint(mint.topConstraint,maxt.bottomConstraint,mint.tickSize); maxt.setYConstraint(mint.topConstraint,maxt.bottomConstraint,maxt.tickSize); } // Set up one-time slideEnd callbacks to call updateValue when both // thumbs have been set this._oneTimeCallback(mins,'slideEnd',function () { done.min = true; if (done.max) { self.updateValue(silent); // Clean the slider's slideEnd events on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); self._cleanEvent(maxs,'slideEnd'); },0); } }); this._oneTimeCallback(maxs,'slideEnd',function () { done.max = true; if (done.min) { self.updateValue(silent); // Clean both sliders' slideEnd events on a timeout since this // will be executed from inside one of the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); self._cleanEvent(maxs,'slideEnd'); },0); } }); // Must emit Slider slideEnd event to propagate to updateValue mins.setValue(min,skipAnim,force,false); maxs.setValue(max,skipAnim,force,false); }
javascript
function (min, max, skipAnim, force, silent) { var mins = this.minSlider, maxs = this.maxSlider, mint = mins.thumb, maxt = maxs.thumb, self = this, done = { min : false, max : false }; // Clear constraints to prevent animated thumbs from prematurely // stopping when hitting a constraint that's moving with the other // thumb. if (mint._isHoriz) { mint.setXConstraint(mint.leftConstraint,maxt.rightConstraint,mint.tickSize); maxt.setXConstraint(mint.leftConstraint,maxt.rightConstraint,maxt.tickSize); } else { mint.setYConstraint(mint.topConstraint,maxt.bottomConstraint,mint.tickSize); maxt.setYConstraint(mint.topConstraint,maxt.bottomConstraint,maxt.tickSize); } // Set up one-time slideEnd callbacks to call updateValue when both // thumbs have been set this._oneTimeCallback(mins,'slideEnd',function () { done.min = true; if (done.max) { self.updateValue(silent); // Clean the slider's slideEnd events on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); self._cleanEvent(maxs,'slideEnd'); },0); } }); this._oneTimeCallback(maxs,'slideEnd',function () { done.max = true; if (done.min) { self.updateValue(silent); // Clean both sliders' slideEnd events on a timeout since this // will be executed from inside one of the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); self._cleanEvent(maxs,'slideEnd'); },0); } }); // Must emit Slider slideEnd event to propagate to updateValue mins.setValue(min,skipAnim,force,false); maxs.setValue(max,skipAnim,force,false); }
[ "function", "(", "min", ",", "max", ",", "skipAnim", ",", "force", ",", "silent", ")", "{", "var", "mins", "=", "this", ".", "minSlider", ",", "maxs", "=", "this", ".", "maxSlider", ",", "mint", "=", "mins", ".", "thumb", ",", "maxt", "=", "maxs", ".", "thumb", ",", "self", "=", "this", ",", "done", "=", "{", "min", ":", "false", ",", "max", ":", "false", "}", ";", "// Clear constraints to prevent animated thumbs from prematurely", "// stopping when hitting a constraint that's moving with the other", "// thumb.", "if", "(", "mint", ".", "_isHoriz", ")", "{", "mint", ".", "setXConstraint", "(", "mint", ".", "leftConstraint", ",", "maxt", ".", "rightConstraint", ",", "mint", ".", "tickSize", ")", ";", "maxt", ".", "setXConstraint", "(", "mint", ".", "leftConstraint", ",", "maxt", ".", "rightConstraint", ",", "maxt", ".", "tickSize", ")", ";", "}", "else", "{", "mint", ".", "setYConstraint", "(", "mint", ".", "topConstraint", ",", "maxt", ".", "bottomConstraint", ",", "mint", ".", "tickSize", ")", ";", "maxt", ".", "setYConstraint", "(", "mint", ".", "topConstraint", ",", "maxt", ".", "bottomConstraint", ",", "maxt", ".", "tickSize", ")", ";", "}", "// Set up one-time slideEnd callbacks to call updateValue when both", "// thumbs have been set", "this", ".", "_oneTimeCallback", "(", "mins", ",", "'slideEnd'", ",", "function", "(", ")", "{", "done", ".", "min", "=", "true", ";", "if", "(", "done", ".", "max", ")", "{", "self", ".", "updateValue", "(", "silent", ")", ";", "// Clean the slider's slideEnd events on a timeout since this", "// will be executed from inside the event's fire", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "_cleanEvent", "(", "mins", ",", "'slideEnd'", ")", ";", "self", ".", "_cleanEvent", "(", "maxs", ",", "'slideEnd'", ")", ";", "}", ",", "0", ")", ";", "}", "}", ")", ";", "this", ".", "_oneTimeCallback", "(", "maxs", ",", "'slideEnd'", ",", "function", "(", ")", "{", "done", ".", "max", "=", "true", ";", "if", "(", "done", ".", "min", ")", "{", "self", ".", "updateValue", "(", "silent", ")", ";", "// Clean both sliders' slideEnd events on a timeout since this", "// will be executed from inside one of the event's fire", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "_cleanEvent", "(", "mins", ",", "'slideEnd'", ")", ";", "self", ".", "_cleanEvent", "(", "maxs", ",", "'slideEnd'", ")", ";", "}", ",", "0", ")", ";", "}", "}", ")", ";", "// Must emit Slider slideEnd event to propagate to updateValue", "mins", ".", "setValue", "(", "min", ",", "skipAnim", ",", "force", ",", "false", ")", ";", "maxs", ".", "setValue", "(", "max", ",", "skipAnim", ",", "force", ",", "false", ")", ";", "}" ]
Sets the min and max thumbs to new values. @method setValues @param min {int} Pixel offset to assign to the min thumb @param max {int} Pixel offset to assign to the max thumb @param skipAnim {boolean} (optional) Set to true to skip thumb animation. Default false @param force {boolean} (optional) ignore the locked setting and set value anyway. Default false @param silent {boolean} (optional) Set to true to skip firing change events. Default false
[ "Sets", "the", "min", "and", "max", "thumbs", "to", "new", "values", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1739-L1789
42,818
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (min, skipAnim, force, silent) { var mins = this.minSlider, self = this; this.activeSlider = mins; // Use a one-time event callback to delay the updateValue call // until after the slide operation is done self = this; this._oneTimeCallback(mins,'slideEnd',function () { self.updateValue(silent); // Clean the slideEnd event on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); }, 0); }); mins.setValue(min, skipAnim, force); }
javascript
function (min, skipAnim, force, silent) { var mins = this.minSlider, self = this; this.activeSlider = mins; // Use a one-time event callback to delay the updateValue call // until after the slide operation is done self = this; this._oneTimeCallback(mins,'slideEnd',function () { self.updateValue(silent); // Clean the slideEnd event on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(mins,'slideEnd'); }, 0); }); mins.setValue(min, skipAnim, force); }
[ "function", "(", "min", ",", "skipAnim", ",", "force", ",", "silent", ")", "{", "var", "mins", "=", "this", ".", "minSlider", ",", "self", "=", "this", ";", "this", ".", "activeSlider", "=", "mins", ";", "// Use a one-time event callback to delay the updateValue call", "// until after the slide operation is done", "self", "=", "this", ";", "this", ".", "_oneTimeCallback", "(", "mins", ",", "'slideEnd'", ",", "function", "(", ")", "{", "self", ".", "updateValue", "(", "silent", ")", ";", "// Clean the slideEnd event on a timeout since this", "// will be executed from inside the event's fire", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "_cleanEvent", "(", "mins", ",", "'slideEnd'", ")", ";", "}", ",", "0", ")", ";", "}", ")", ";", "mins", ".", "setValue", "(", "min", ",", "skipAnim", ",", "force", ")", ";", "}" ]
Set the min thumb position to a new value. @method setMinValue @param min {int} Pixel offset for min thumb @param skipAnim {boolean} (optional) Set to true to skip thumb animation. Default false @param force {boolean} (optional) ignore the locked setting and set value anyway. Default false @param silent {boolean} (optional) Set to true to skip firing change events. Default false
[ "Set", "the", "min", "thumb", "position", "to", "a", "new", "value", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1802-L1819
42,819
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (max, skipAnim, force, silent) { var maxs = this.maxSlider, self = this; this.activeSlider = maxs; // Use a one-time event callback to delay the updateValue call // until after the slide operation is done this._oneTimeCallback(maxs,'slideEnd',function () { self.updateValue(silent); // Clean the slideEnd event on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(maxs,'slideEnd'); }, 0); }); maxs.setValue(max, skipAnim, force); }
javascript
function (max, skipAnim, force, silent) { var maxs = this.maxSlider, self = this; this.activeSlider = maxs; // Use a one-time event callback to delay the updateValue call // until after the slide operation is done this._oneTimeCallback(maxs,'slideEnd',function () { self.updateValue(silent); // Clean the slideEnd event on a timeout since this // will be executed from inside the event's fire setTimeout(function () { self._cleanEvent(maxs,'slideEnd'); }, 0); }); maxs.setValue(max, skipAnim, force); }
[ "function", "(", "max", ",", "skipAnim", ",", "force", ",", "silent", ")", "{", "var", "maxs", "=", "this", ".", "maxSlider", ",", "self", "=", "this", ";", "this", ".", "activeSlider", "=", "maxs", ";", "// Use a one-time event callback to delay the updateValue call", "// until after the slide operation is done", "this", ".", "_oneTimeCallback", "(", "maxs", ",", "'slideEnd'", ",", "function", "(", ")", "{", "self", ".", "updateValue", "(", "silent", ")", ";", "// Clean the slideEnd event on a timeout since this", "// will be executed from inside the event's fire", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "_cleanEvent", "(", "maxs", ",", "'slideEnd'", ")", ";", "}", ",", "0", ")", ";", "}", ")", ";", "maxs", ".", "setValue", "(", "max", ",", "skipAnim", ",", "force", ")", ";", "}" ]
Set the max thumb position to a new value. @method setMaxValue @param max {int} Pixel offset for max thumb @param skipAnim {boolean} (optional) Set to true to skip thumb animation. Default false @param force {boolean} (optional) ignore the locked setting and set value anyway. Default false @param silent {boolean} (optional) Set to true to skip firing change events. Default false
[ "Set", "the", "max", "thumb", "position", "to", "a", "new", "value", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1832-L1848
42,820
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(silent) { var min = this.minSlider.getValue(), max = this.maxSlider.getValue(), changed = false, mint,maxt,dim,minConstraint,maxConstraint,thumbInnerWidth; if (min != this.minVal || max != this.maxVal) { changed = true; mint = this.minSlider.thumb; maxt = this.maxSlider.thumb; dim = this.isHoriz ? 'x' : 'y'; thumbInnerWidth = this.minSlider.thumbCenterPoint[dim] + this.maxSlider.thumbCenterPoint[dim]; // Establish barriers within the respective other thumb's edge, less // the minRange. Limit to the Slider's range in the case of // negative minRanges. minConstraint = Math.max(max-thumbInnerWidth-this.minRange,0); maxConstraint = Math.min(-min-thumbInnerWidth-this.minRange,0); if (this.isHoriz) { minConstraint = Math.min(minConstraint,maxt.rightConstraint); mint.setXConstraint(mint.leftConstraint,minConstraint, mint.tickSize); maxt.setXConstraint(maxConstraint,maxt.rightConstraint, maxt.tickSize); } else { minConstraint = Math.min(minConstraint,maxt.bottomConstraint); mint.setYConstraint(mint.leftConstraint,minConstraint, mint.tickSize); maxt.setYConstraint(maxConstraint,maxt.bottomConstraint, maxt.tickSize); } } this.minVal = min; this.maxVal = max; if (changed && !silent) { this.fireEvent("change", this); } }
javascript
function(silent) { var min = this.minSlider.getValue(), max = this.maxSlider.getValue(), changed = false, mint,maxt,dim,minConstraint,maxConstraint,thumbInnerWidth; if (min != this.minVal || max != this.maxVal) { changed = true; mint = this.minSlider.thumb; maxt = this.maxSlider.thumb; dim = this.isHoriz ? 'x' : 'y'; thumbInnerWidth = this.minSlider.thumbCenterPoint[dim] + this.maxSlider.thumbCenterPoint[dim]; // Establish barriers within the respective other thumb's edge, less // the minRange. Limit to the Slider's range in the case of // negative minRanges. minConstraint = Math.max(max-thumbInnerWidth-this.minRange,0); maxConstraint = Math.min(-min-thumbInnerWidth-this.minRange,0); if (this.isHoriz) { minConstraint = Math.min(minConstraint,maxt.rightConstraint); mint.setXConstraint(mint.leftConstraint,minConstraint, mint.tickSize); maxt.setXConstraint(maxConstraint,maxt.rightConstraint, maxt.tickSize); } else { minConstraint = Math.min(minConstraint,maxt.bottomConstraint); mint.setYConstraint(mint.leftConstraint,minConstraint, mint.tickSize); maxt.setYConstraint(maxConstraint,maxt.bottomConstraint, maxt.tickSize); } } this.minVal = min; this.maxVal = max; if (changed && !silent) { this.fireEvent("change", this); } }
[ "function", "(", "silent", ")", "{", "var", "min", "=", "this", ".", "minSlider", ".", "getValue", "(", ")", ",", "max", "=", "this", ".", "maxSlider", ".", "getValue", "(", ")", ",", "changed", "=", "false", ",", "mint", ",", "maxt", ",", "dim", ",", "minConstraint", ",", "maxConstraint", ",", "thumbInnerWidth", ";", "if", "(", "min", "!=", "this", ".", "minVal", "||", "max", "!=", "this", ".", "maxVal", ")", "{", "changed", "=", "true", ";", "mint", "=", "this", ".", "minSlider", ".", "thumb", ";", "maxt", "=", "this", ".", "maxSlider", ".", "thumb", ";", "dim", "=", "this", ".", "isHoriz", "?", "'x'", ":", "'y'", ";", "thumbInnerWidth", "=", "this", ".", "minSlider", ".", "thumbCenterPoint", "[", "dim", "]", "+", "this", ".", "maxSlider", ".", "thumbCenterPoint", "[", "dim", "]", ";", "// Establish barriers within the respective other thumb's edge, less", "// the minRange. Limit to the Slider's range in the case of", "// negative minRanges.", "minConstraint", "=", "Math", ".", "max", "(", "max", "-", "thumbInnerWidth", "-", "this", ".", "minRange", ",", "0", ")", ";", "maxConstraint", "=", "Math", ".", "min", "(", "-", "min", "-", "thumbInnerWidth", "-", "this", ".", "minRange", ",", "0", ")", ";", "if", "(", "this", ".", "isHoriz", ")", "{", "minConstraint", "=", "Math", ".", "min", "(", "minConstraint", ",", "maxt", ".", "rightConstraint", ")", ";", "mint", ".", "setXConstraint", "(", "mint", ".", "leftConstraint", ",", "minConstraint", ",", "mint", ".", "tickSize", ")", ";", "maxt", ".", "setXConstraint", "(", "maxConstraint", ",", "maxt", ".", "rightConstraint", ",", "maxt", ".", "tickSize", ")", ";", "}", "else", "{", "minConstraint", "=", "Math", ".", "min", "(", "minConstraint", ",", "maxt", ".", "bottomConstraint", ")", ";", "mint", ".", "setYConstraint", "(", "mint", ".", "leftConstraint", ",", "minConstraint", ",", "mint", ".", "tickSize", ")", ";", "maxt", ".", "setYConstraint", "(", "maxConstraint", ",", "maxt", ".", "bottomConstraint", ",", "maxt", ".", "tickSize", ")", ";", "}", "}", "this", ".", "minVal", "=", "min", ";", "this", ".", "maxVal", "=", "max", ";", "if", "(", "changed", "&&", "!", "silent", ")", "{", "this", ".", "fireEvent", "(", "\"change\"", ",", "this", ")", ";", "}", "}" ]
Executed when one of the sliders is moved @method updateValue @param silent {boolean} (optional) Set to true to skip firing change events. Default false @private
[ "Executed", "when", "one", "of", "the", "sliders", "is", "moved" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1857-L1899
42,821
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(e) { var min = this.minSlider, max = this.maxSlider, minLocked = min.isLocked() || !min.backgroundEnabled, maxLocked = max.isLocked() || !min.backgroundEnabled, Ev = YAHOO.util.Event, d; if (minLocked || maxLocked) { this.activeSlider = minLocked ? max : min; } else { if (this.isHoriz) { d = Ev.getPageX(e)-min.thumb.initPageX-min.thumbCenterPoint.x; } else { d = Ev.getPageY(e)-min.thumb.initPageY-min.thumbCenterPoint.y; } this.activeSlider = d*2 > max.getValue()+min.getValue() ? max : min; } }
javascript
function(e) { var min = this.minSlider, max = this.maxSlider, minLocked = min.isLocked() || !min.backgroundEnabled, maxLocked = max.isLocked() || !min.backgroundEnabled, Ev = YAHOO.util.Event, d; if (minLocked || maxLocked) { this.activeSlider = minLocked ? max : min; } else { if (this.isHoriz) { d = Ev.getPageX(e)-min.thumb.initPageX-min.thumbCenterPoint.x; } else { d = Ev.getPageY(e)-min.thumb.initPageY-min.thumbCenterPoint.y; } this.activeSlider = d*2 > max.getValue()+min.getValue() ? max : min; } }
[ "function", "(", "e", ")", "{", "var", "min", "=", "this", ".", "minSlider", ",", "max", "=", "this", ".", "maxSlider", ",", "minLocked", "=", "min", ".", "isLocked", "(", ")", "||", "!", "min", ".", "backgroundEnabled", ",", "maxLocked", "=", "max", ".", "isLocked", "(", ")", "||", "!", "min", ".", "backgroundEnabled", ",", "Ev", "=", "YAHOO", ".", "util", ".", "Event", ",", "d", ";", "if", "(", "minLocked", "||", "maxLocked", ")", "{", "this", ".", "activeSlider", "=", "minLocked", "?", "max", ":", "min", ";", "}", "else", "{", "if", "(", "this", ".", "isHoriz", ")", "{", "d", "=", "Ev", ".", "getPageX", "(", "e", ")", "-", "min", ".", "thumb", ".", "initPageX", "-", "min", ".", "thumbCenterPoint", ".", "x", ";", "}", "else", "{", "d", "=", "Ev", ".", "getPageY", "(", "e", ")", "-", "min", ".", "thumb", ".", "initPageY", "-", "min", ".", "thumbCenterPoint", ".", "y", ";", "}", "this", ".", "activeSlider", "=", "d", "*", "2", ">", "max", ".", "getValue", "(", ")", "+", "min", ".", "getValue", "(", ")", "?", "max", ":", "min", ";", "}", "}" ]
A background click will move the slider thumb nearest to the click. Override if you need different behavior. @method selectActiveSlider @param e {Event} the mousedown event @private
[ "A", "background", "click", "will", "move", "the", "slider", "thumb", "nearest", "to", "the", "click", ".", "Override", "if", "you", "need", "different", "behavior", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1908-L1927
42,822
neyric/webhookit
public/javascripts/yui/slider/slider.js
function(e) { if (!e._handled && !this.minSlider._sliding && !this.maxSlider._sliding) { e._handled = true; this.selectActiveSlider(e); return YW.Slider.prototype.onMouseDown.call(this.activeSlider, e); } else { return false; } }
javascript
function(e) { if (!e._handled && !this.minSlider._sliding && !this.maxSlider._sliding) { e._handled = true; this.selectActiveSlider(e); return YW.Slider.prototype.onMouseDown.call(this.activeSlider, e); } else { return false; } }
[ "function", "(", "e", ")", "{", "if", "(", "!", "e", ".", "_handled", "&&", "!", "this", ".", "minSlider", ".", "_sliding", "&&", "!", "this", ".", "maxSlider", ".", "_sliding", ")", "{", "e", ".", "_handled", "=", "true", ";", "this", ".", "selectActiveSlider", "(", "e", ")", ";", "return", "YW", ".", "Slider", ".", "prototype", ".", "onMouseDown", ".", "call", "(", "this", ".", "activeSlider", ",", "e", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Delegates the onMouseDown to the appropriate Slider @method _handleMouseDown @param e {Event} mouseup event @protected
[ "Delegates", "the", "onMouseDown", "to", "the", "appropriate", "Slider" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1936-L1944
42,823
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (o,evt,fn) { var sub = function () { // Unsubscribe myself o.unsubscribe(evt, sub); // Pass the event handler arguments to the one time callback fn.apply({},arguments); }; o.subscribe(evt,sub); }
javascript
function (o,evt,fn) { var sub = function () { // Unsubscribe myself o.unsubscribe(evt, sub); // Pass the event handler arguments to the one time callback fn.apply({},arguments); }; o.subscribe(evt,sub); }
[ "function", "(", "o", ",", "evt", ",", "fn", ")", "{", "var", "sub", "=", "function", "(", ")", "{", "// Unsubscribe myself", "o", ".", "unsubscribe", "(", "evt", ",", "sub", ")", ";", "// Pass the event handler arguments to the one time callback", "fn", ".", "apply", "(", "{", "}", ",", "arguments", ")", ";", "}", ";", "o", ".", "subscribe", "(", "evt", ",", "sub", ")", ";", "}" ]
Schedule an event callback that will execute once, then unsubscribe itself. @method _oneTimeCallback @param o {EventProvider} Object to attach the event to @param evt {string} Name of the event @param fn {Function} function to execute once @private
[ "Schedule", "an", "event", "callback", "that", "will", "execute", "once", "then", "unsubscribe", "itself", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1967-L1975
42,824
neyric/webhookit
public/javascripts/yui/slider/slider.js
function (o,evt) { var ce,i,len,j,subs,newSubs; if (o.__yui_events && o.events[evt]) { for (i = o.__yui_events.length; i >= 0; --i) { if (o.__yui_events[i].type === evt) { ce = o.__yui_events[i]; break; } } if (ce) { subs = ce.subscribers; newSubs = []; j = 0; for (i = 0, len = subs.length; i < len; ++i) { if (subs[i]) { newSubs[j++] = subs[i]; } } ce.subscribers = newSubs; } } }
javascript
function (o,evt) { var ce,i,len,j,subs,newSubs; if (o.__yui_events && o.events[evt]) { for (i = o.__yui_events.length; i >= 0; --i) { if (o.__yui_events[i].type === evt) { ce = o.__yui_events[i]; break; } } if (ce) { subs = ce.subscribers; newSubs = []; j = 0; for (i = 0, len = subs.length; i < len; ++i) { if (subs[i]) { newSubs[j++] = subs[i]; } } ce.subscribers = newSubs; } } }
[ "function", "(", "o", ",", "evt", ")", "{", "var", "ce", ",", "i", ",", "len", ",", "j", ",", "subs", ",", "newSubs", ";", "if", "(", "o", ".", "__yui_events", "&&", "o", ".", "events", "[", "evt", "]", ")", "{", "for", "(", "i", "=", "o", ".", "__yui_events", ".", "length", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "if", "(", "o", ".", "__yui_events", "[", "i", "]", ".", "type", "===", "evt", ")", "{", "ce", "=", "o", ".", "__yui_events", "[", "i", "]", ";", "break", ";", "}", "}", "if", "(", "ce", ")", "{", "subs", "=", "ce", ".", "subscribers", ";", "newSubs", "=", "[", "]", ";", "j", "=", "0", ";", "for", "(", "i", "=", "0", ",", "len", "=", "subs", ".", "length", ";", "i", "<", "len", ";", "++", "i", ")", "{", "if", "(", "subs", "[", "i", "]", ")", "{", "newSubs", "[", "j", "++", "]", "=", "subs", "[", "i", "]", ";", "}", "}", "ce", ".", "subscribers", "=", "newSubs", ";", "}", "}", "}" ]
Clean up the slideEnd event subscribers array, since each one-time callback will be replaced in the event's subscribers property with null. This will cause memory bloat and loss of performance. @method _cleanEvent @param o {EventProvider} object housing the CustomEvent @param evt {string} name of the CustomEvent @private
[ "Clean", "up", "the", "slideEnd", "event", "subscribers", "array", "since", "each", "one", "-", "time", "callback", "will", "be", "replaced", "in", "the", "event", "s", "subscribers", "property", "with", "null", ".", "This", "will", "cause", "memory", "bloat", "and", "loss", "of", "performance", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider.js#L1986-L2008
42,825
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
createElement
function createElement(el, attrs) { var newEl = document.createElement(el); attrs = attrs || {}; if (attrs.className) { Dom.addClass(newEl, attrs.className); } if (attrs.styles) { setStyles(newEl, attrs.styles); } if (attrs.parent) { attrs.parent.appendChild(newEl); } if (attrs.id) { newEl.setAttribute("id", attrs.id); } if (attrs.content) { if (attrs.content.nodeName) { newEl.appendChild(attrs.content); } else { newEl.innerHTML = attrs.content; } } return newEl; }
javascript
function createElement(el, attrs) { var newEl = document.createElement(el); attrs = attrs || {}; if (attrs.className) { Dom.addClass(newEl, attrs.className); } if (attrs.styles) { setStyles(newEl, attrs.styles); } if (attrs.parent) { attrs.parent.appendChild(newEl); } if (attrs.id) { newEl.setAttribute("id", attrs.id); } if (attrs.content) { if (attrs.content.nodeName) { newEl.appendChild(attrs.content); } else { newEl.innerHTML = attrs.content; } } return newEl; }
[ "function", "createElement", "(", "el", ",", "attrs", ")", "{", "var", "newEl", "=", "document", ".", "createElement", "(", "el", ")", ";", "attrs", "=", "attrs", "||", "{", "}", ";", "if", "(", "attrs", ".", "className", ")", "{", "Dom", ".", "addClass", "(", "newEl", ",", "attrs", ".", "className", ")", ";", "}", "if", "(", "attrs", ".", "styles", ")", "{", "setStyles", "(", "newEl", ",", "attrs", ".", "styles", ")", ";", "}", "if", "(", "attrs", ".", "parent", ")", "{", "attrs", ".", "parent", ".", "appendChild", "(", "newEl", ")", ";", "}", "if", "(", "attrs", ".", "id", ")", "{", "newEl", ".", "setAttribute", "(", "\"id\"", ",", "attrs", ".", "id", ")", ";", "}", "if", "(", "attrs", ".", "content", ")", "{", "if", "(", "attrs", ".", "content", ".", "nodeName", ")", "{", "newEl", ".", "appendChild", "(", "attrs", ".", "content", ")", ";", "}", "else", "{", "newEl", ".", "innerHTML", "=", "attrs", ".", "content", ";", "}", "}", "return", "newEl", ";", "}" ]
Create an element, set its class name and optionally install the element to its parent. @method createElement @param el {String} The element to be created @param attrs {Object} Configuration of parent, class and id attributes. If the content is specified, it is inserted after creation of the element. The content can also be an HTML element in which case it would be appended as a child node of the created element. @private
[ "Create", "an", "element", "set", "its", "class", "name", "and", "optionally", "install", "the", "element", "to", "its", "parent", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L314-L343
42,826
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
getStyle
function getStyle(el, style, type) { var value; if (!el) { return 0; } function getStyleIntVal(el, style) { var val; /* * XXX: Safari calculates incorrect marginRight for an element * which has its parent element style set to overflow: hidden * https://bugs.webkit.org/show_bug.cgi?id=13343 * Let us assume marginLeft == marginRight */ if (style == "marginRight" && YAHOO.env.ua.webkit) { val = parseInt(Dom.getStyle(el, "marginLeft"), 10); } else { val = parseInt(Dom.getStyle(el, style), 10); } return JS.isNumber(val) ? val : 0; } function getStyleFloatVal(el, style) { var val; /* * XXX: Safari calculates incorrect marginRight for an element * which has its parent element style set to overflow: hidden * https://bugs.webkit.org/show_bug.cgi?id=13343 * Let us assume marginLeft == marginRight */ if (style == "marginRight" && YAHOO.env.ua.webkit) { val = parseFloat(Dom.getStyle(el, "marginLeft")); } else { val = parseFloat(Dom.getStyle(el, style)); } return JS.isNumber(val) ? val : 0; } if (typeof type == "undefined") { type = "int"; } switch (style) { case "height": value = el.offsetHeight; if (value > 0) { value += getStyleIntVal(el, "marginTop") + getStyleIntVal(el, "marginBottom"); } else { value = getStyleFloatVal(el, "height") + getStyleIntVal(el, "marginTop") + getStyleIntVal(el, "marginBottom") + getStyleIntVal(el, "borderTopWidth") + getStyleIntVal(el, "borderBottomWidth") + getStyleIntVal(el, "paddingTop") + getStyleIntVal(el, "paddingBottom"); } break; case "width": value = el.offsetWidth; if (value > 0) { value += getStyleIntVal(el, "marginLeft") + getStyleIntVal(el, "marginRight"); } else { value = getStyleFloatVal(el, "width") + getStyleIntVal(el, "marginLeft") + getStyleIntVal(el, "marginRight") + getStyleIntVal(el, "borderLeftWidth") + getStyleIntVal(el, "borderRightWidth") + getStyleIntVal(el, "paddingLeft") + getStyleIntVal(el, "paddingRight"); } break; default: if (type == "int") { value = getStyleIntVal(el, style); } else if (type == "float") { value = getStyleFloatVal(el, style); } else { value = Dom.getStyle(el, style); } break; } return value; }
javascript
function getStyle(el, style, type) { var value; if (!el) { return 0; } function getStyleIntVal(el, style) { var val; /* * XXX: Safari calculates incorrect marginRight for an element * which has its parent element style set to overflow: hidden * https://bugs.webkit.org/show_bug.cgi?id=13343 * Let us assume marginLeft == marginRight */ if (style == "marginRight" && YAHOO.env.ua.webkit) { val = parseInt(Dom.getStyle(el, "marginLeft"), 10); } else { val = parseInt(Dom.getStyle(el, style), 10); } return JS.isNumber(val) ? val : 0; } function getStyleFloatVal(el, style) { var val; /* * XXX: Safari calculates incorrect marginRight for an element * which has its parent element style set to overflow: hidden * https://bugs.webkit.org/show_bug.cgi?id=13343 * Let us assume marginLeft == marginRight */ if (style == "marginRight" && YAHOO.env.ua.webkit) { val = parseFloat(Dom.getStyle(el, "marginLeft")); } else { val = parseFloat(Dom.getStyle(el, style)); } return JS.isNumber(val) ? val : 0; } if (typeof type == "undefined") { type = "int"; } switch (style) { case "height": value = el.offsetHeight; if (value > 0) { value += getStyleIntVal(el, "marginTop") + getStyleIntVal(el, "marginBottom"); } else { value = getStyleFloatVal(el, "height") + getStyleIntVal(el, "marginTop") + getStyleIntVal(el, "marginBottom") + getStyleIntVal(el, "borderTopWidth") + getStyleIntVal(el, "borderBottomWidth") + getStyleIntVal(el, "paddingTop") + getStyleIntVal(el, "paddingBottom"); } break; case "width": value = el.offsetWidth; if (value > 0) { value += getStyleIntVal(el, "marginLeft") + getStyleIntVal(el, "marginRight"); } else { value = getStyleFloatVal(el, "width") + getStyleIntVal(el, "marginLeft") + getStyleIntVal(el, "marginRight") + getStyleIntVal(el, "borderLeftWidth") + getStyleIntVal(el, "borderRightWidth") + getStyleIntVal(el, "paddingLeft") + getStyleIntVal(el, "paddingRight"); } break; default: if (type == "int") { value = getStyleIntVal(el, style); } else if (type == "float") { value = getStyleFloatVal(el, style); } else { value = Dom.getStyle(el, style); } break; } return value; }
[ "function", "getStyle", "(", "el", ",", "style", ",", "type", ")", "{", "var", "value", ";", "if", "(", "!", "el", ")", "{", "return", "0", ";", "}", "function", "getStyleIntVal", "(", "el", ",", "style", ")", "{", "var", "val", ";", "/*\n * XXX: Safari calculates incorrect marginRight for an element\n * which has its parent element style set to overflow: hidden\n * https://bugs.webkit.org/show_bug.cgi?id=13343\n * Let us assume marginLeft == marginRight\n */", "if", "(", "style", "==", "\"marginRight\"", "&&", "YAHOO", ".", "env", ".", "ua", ".", "webkit", ")", "{", "val", "=", "parseInt", "(", "Dom", ".", "getStyle", "(", "el", ",", "\"marginLeft\"", ")", ",", "10", ")", ";", "}", "else", "{", "val", "=", "parseInt", "(", "Dom", ".", "getStyle", "(", "el", ",", "style", ")", ",", "10", ")", ";", "}", "return", "JS", ".", "isNumber", "(", "val", ")", "?", "val", ":", "0", ";", "}", "function", "getStyleFloatVal", "(", "el", ",", "style", ")", "{", "var", "val", ";", "/*\n * XXX: Safari calculates incorrect marginRight for an element\n * which has its parent element style set to overflow: hidden\n * https://bugs.webkit.org/show_bug.cgi?id=13343\n * Let us assume marginLeft == marginRight\n */", "if", "(", "style", "==", "\"marginRight\"", "&&", "YAHOO", ".", "env", ".", "ua", ".", "webkit", ")", "{", "val", "=", "parseFloat", "(", "Dom", ".", "getStyle", "(", "el", ",", "\"marginLeft\"", ")", ")", ";", "}", "else", "{", "val", "=", "parseFloat", "(", "Dom", ".", "getStyle", "(", "el", ",", "style", ")", ")", ";", "}", "return", "JS", ".", "isNumber", "(", "val", ")", "?", "val", ":", "0", ";", "}", "if", "(", "typeof", "type", "==", "\"undefined\"", ")", "{", "type", "=", "\"int\"", ";", "}", "switch", "(", "style", ")", "{", "case", "\"height\"", ":", "value", "=", "el", ".", "offsetHeight", ";", "if", "(", "value", ">", "0", ")", "{", "value", "+=", "getStyleIntVal", "(", "el", ",", "\"marginTop\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginBottom\"", ")", ";", "}", "else", "{", "value", "=", "getStyleFloatVal", "(", "el", ",", "\"height\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginTop\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginBottom\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"borderTopWidth\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"borderBottomWidth\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"paddingTop\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"paddingBottom\"", ")", ";", "}", "break", ";", "case", "\"width\"", ":", "value", "=", "el", ".", "offsetWidth", ";", "if", "(", "value", ">", "0", ")", "{", "value", "+=", "getStyleIntVal", "(", "el", ",", "\"marginLeft\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginRight\"", ")", ";", "}", "else", "{", "value", "=", "getStyleFloatVal", "(", "el", ",", "\"width\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginLeft\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"marginRight\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"borderLeftWidth\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"borderRightWidth\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"paddingLeft\"", ")", "+", "getStyleIntVal", "(", "el", ",", "\"paddingRight\"", ")", ";", "}", "break", ";", "default", ":", "if", "(", "type", "==", "\"int\"", ")", "{", "value", "=", "getStyleIntVal", "(", "el", ",", "style", ")", ";", "}", "else", "if", "(", "type", "==", "\"float\"", ")", "{", "value", "=", "getStyleFloatVal", "(", "el", ",", "style", ")", ";", "}", "else", "{", "value", "=", "Dom", ".", "getStyle", "(", "el", ",", "style", ")", ";", "}", "break", ";", "}", "return", "value", ";", "}" ]
Get the computed style of an element. @method getStyle @param el {HTMLElement} The element for which the style needs to be returned. @param style {String} The style attribute @param type {String} "int", "float", etc. (defaults to int) @private
[ "Get", "the", "computed", "style", "of", "an", "element", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L355-L445
42,827
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
getCarouselItemSize
function getCarouselItemSize(which) { var carousel = this, child, item, size = 0, first = carousel.get("firstVisible"), vertical = false; if (carousel._itemsTable.numItems === 0) { return 0; } item = carousel._itemsTable.items[first] || carousel._itemsTable.loading[first]; if (JS.isUndefined(item)) { return 0; } child = Dom.get(item.id); if (typeof which == "undefined") { vertical = carousel.get("isVertical"); } else { vertical = which == "height"; } if (this._itemAttrCache[which]) { return this._itemAttrCache[which]; } if (vertical) { size = getStyle(child, "height"); } else { size = getStyle(child, "width"); } this._itemAttrCache[which] = size; return size; }
javascript
function getCarouselItemSize(which) { var carousel = this, child, item, size = 0, first = carousel.get("firstVisible"), vertical = false; if (carousel._itemsTable.numItems === 0) { return 0; } item = carousel._itemsTable.items[first] || carousel._itemsTable.loading[first]; if (JS.isUndefined(item)) { return 0; } child = Dom.get(item.id); if (typeof which == "undefined") { vertical = carousel.get("isVertical"); } else { vertical = which == "height"; } if (this._itemAttrCache[which]) { return this._itemAttrCache[which]; } if (vertical) { size = getStyle(child, "height"); } else { size = getStyle(child, "width"); } this._itemAttrCache[which] = size; return size; }
[ "function", "getCarouselItemSize", "(", "which", ")", "{", "var", "carousel", "=", "this", ",", "child", ",", "item", ",", "size", "=", "0", ",", "first", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ",", "vertical", "=", "false", ";", "if", "(", "carousel", ".", "_itemsTable", ".", "numItems", "===", "0", ")", "{", "return", "0", ";", "}", "item", "=", "carousel", ".", "_itemsTable", ".", "items", "[", "first", "]", "||", "carousel", ".", "_itemsTable", ".", "loading", "[", "first", "]", ";", "if", "(", "JS", ".", "isUndefined", "(", "item", ")", ")", "{", "return", "0", ";", "}", "child", "=", "Dom", ".", "get", "(", "item", ".", "id", ")", ";", "if", "(", "typeof", "which", "==", "\"undefined\"", ")", "{", "vertical", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", ";", "}", "else", "{", "vertical", "=", "which", "==", "\"height\"", ";", "}", "if", "(", "this", ".", "_itemAttrCache", "[", "which", "]", ")", "{", "return", "this", ".", "_itemAttrCache", "[", "which", "]", ";", "}", "if", "(", "vertical", ")", "{", "size", "=", "getStyle", "(", "child", ",", "\"height\"", ")", ";", "}", "else", "{", "size", "=", "getStyle", "(", "child", ",", "\"width\"", ")", ";", "}", "this", ".", "_itemAttrCache", "[", "which", "]", "=", "size", ";", "return", "size", ";", "}" ]
Compute and return the height or width of a single Carousel item depending upon the orientation. @method getCarouselItemSize @param which {String} "height" or "width" to be returned. If this is passed explicitly, the calculated size is not cached. @private
[ "Compute", "and", "return", "the", "height", "or", "width", "of", "a", "single", "Carousel", "item", "depending", "upon", "the", "orientation", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L456-L496
42,828
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
getCarouselItemPosition
function getCarouselItemPosition(pos) { var carousel = this, itemsPerRow = carousel._cols, itemsPerCol = carousel._rows, page, sz, isVertical, itemsCol, itemsRow, sentinel, delta = 0, top, left, rsz, styles = {}, index = 0, itemsTable = carousel._itemsTable, items = itemsTable.items, loading = itemsTable.loading; isVertical = carousel.get("isVertical"); sz = getCarouselItemSize.call(carousel, isVertical ? "height" : "width"); rsz = getRevealSize.call(carousel); // adjust for items not yet loaded while (index < pos) { if (!items[index] && !loading[index]) { delta++; } index++; } pos -= delta; if (itemsPerCol) { page = this.getPageForItem(pos); if (isVertical) { itemsRow = Math.floor(pos/itemsPerRow); delta = itemsRow; top = delta * sz; styles.top = (top + rsz) + "px"; sz = getCarouselItemSize.call(carousel, "width"); itemsCol = pos % itemsPerRow; delta = itemsCol; left = delta * sz; styles.left = left + "px"; } else { itemsCol = pos % itemsPerRow; sentinel = (page - 1) * itemsPerRow; delta = itemsCol + sentinel; left = delta * sz; styles.left = (left + rsz) + "px"; sz = getCarouselItemSize.call(carousel, "height"); itemsRow = Math.floor(pos/itemsPerRow); sentinel = (page - 1) * itemsPerCol; delta = itemsRow - sentinel; top = delta * sz; styles.top = top + "px"; } } else { if (isVertical) { styles.left = 0; styles.top = ((pos * sz) + rsz) + "px"; } else { styles.top = 0; styles.left = ((pos * sz) + rsz) + "px"; } } return styles; }
javascript
function getCarouselItemPosition(pos) { var carousel = this, itemsPerRow = carousel._cols, itemsPerCol = carousel._rows, page, sz, isVertical, itemsCol, itemsRow, sentinel, delta = 0, top, left, rsz, styles = {}, index = 0, itemsTable = carousel._itemsTable, items = itemsTable.items, loading = itemsTable.loading; isVertical = carousel.get("isVertical"); sz = getCarouselItemSize.call(carousel, isVertical ? "height" : "width"); rsz = getRevealSize.call(carousel); // adjust for items not yet loaded while (index < pos) { if (!items[index] && !loading[index]) { delta++; } index++; } pos -= delta; if (itemsPerCol) { page = this.getPageForItem(pos); if (isVertical) { itemsRow = Math.floor(pos/itemsPerRow); delta = itemsRow; top = delta * sz; styles.top = (top + rsz) + "px"; sz = getCarouselItemSize.call(carousel, "width"); itemsCol = pos % itemsPerRow; delta = itemsCol; left = delta * sz; styles.left = left + "px"; } else { itemsCol = pos % itemsPerRow; sentinel = (page - 1) * itemsPerRow; delta = itemsCol + sentinel; left = delta * sz; styles.left = (left + rsz) + "px"; sz = getCarouselItemSize.call(carousel, "height"); itemsRow = Math.floor(pos/itemsPerRow); sentinel = (page - 1) * itemsPerCol; delta = itemsRow - sentinel; top = delta * sz; styles.top = top + "px"; } } else { if (isVertical) { styles.left = 0; styles.top = ((pos * sz) + rsz) + "px"; } else { styles.top = 0; styles.left = ((pos * sz) + rsz) + "px"; } } return styles; }
[ "function", "getCarouselItemPosition", "(", "pos", ")", "{", "var", "carousel", "=", "this", ",", "itemsPerRow", "=", "carousel", ".", "_cols", ",", "itemsPerCol", "=", "carousel", ".", "_rows", ",", "page", ",", "sz", ",", "isVertical", ",", "itemsCol", ",", "itemsRow", ",", "sentinel", ",", "delta", "=", "0", ",", "top", ",", "left", ",", "rsz", ",", "styles", "=", "{", "}", ",", "index", "=", "0", ",", "itemsTable", "=", "carousel", ".", "_itemsTable", ",", "items", "=", "itemsTable", ".", "items", ",", "loading", "=", "itemsTable", ".", "loading", ";", "isVertical", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", ";", "sz", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "isVertical", "?", "\"height\"", ":", "\"width\"", ")", ";", "rsz", "=", "getRevealSize", ".", "call", "(", "carousel", ")", ";", "// adjust for items not yet loaded", "while", "(", "index", "<", "pos", ")", "{", "if", "(", "!", "items", "[", "index", "]", "&&", "!", "loading", "[", "index", "]", ")", "{", "delta", "++", ";", "}", "index", "++", ";", "}", "pos", "-=", "delta", ";", "if", "(", "itemsPerCol", ")", "{", "page", "=", "this", ".", "getPageForItem", "(", "pos", ")", ";", "if", "(", "isVertical", ")", "{", "itemsRow", "=", "Math", ".", "floor", "(", "pos", "/", "itemsPerRow", ")", ";", "delta", "=", "itemsRow", ";", "top", "=", "delta", "*", "sz", ";", "styles", ".", "top", "=", "(", "top", "+", "rsz", ")", "+", "\"px\"", ";", "sz", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "\"width\"", ")", ";", "itemsCol", "=", "pos", "%", "itemsPerRow", ";", "delta", "=", "itemsCol", ";", "left", "=", "delta", "*", "sz", ";", "styles", ".", "left", "=", "left", "+", "\"px\"", ";", "}", "else", "{", "itemsCol", "=", "pos", "%", "itemsPerRow", ";", "sentinel", "=", "(", "page", "-", "1", ")", "*", "itemsPerRow", ";", "delta", "=", "itemsCol", "+", "sentinel", ";", "left", "=", "delta", "*", "sz", ";", "styles", ".", "left", "=", "(", "left", "+", "rsz", ")", "+", "\"px\"", ";", "sz", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "\"height\"", ")", ";", "itemsRow", "=", "Math", ".", "floor", "(", "pos", "/", "itemsPerRow", ")", ";", "sentinel", "=", "(", "page", "-", "1", ")", "*", "itemsPerCol", ";", "delta", "=", "itemsRow", "-", "sentinel", ";", "top", "=", "delta", "*", "sz", ";", "styles", ".", "top", "=", "top", "+", "\"px\"", ";", "}", "}", "else", "{", "if", "(", "isVertical", ")", "{", "styles", ".", "left", "=", "0", ";", "styles", ".", "top", "=", "(", "(", "pos", "*", "sz", ")", "+", "rsz", ")", "+", "\"px\"", ";", "}", "else", "{", "styles", ".", "top", "=", "0", ";", "styles", ".", "left", "=", "(", "(", "pos", "*", "sz", ")", "+", "rsz", ")", "+", "\"px\"", ";", "}", "}", "return", "styles", ";", "}" ]
Compute and return the position of a Carousel item based on its position. @method getCarouselItemPosition @param position {Number} The position of the Carousel item. @private
[ "Compute", "and", "return", "the", "position", "of", "a", "Carousel", "item", "based", "on", "its", "position", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L521-L596
42,829
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
getScrollOffset
function getScrollOffset(delta) { var itemSize = 0, size = 0; itemSize = getCarouselItemSize.call(this); size = itemSize * delta; return size; }
javascript
function getScrollOffset(delta) { var itemSize = 0, size = 0; itemSize = getCarouselItemSize.call(this); size = itemSize * delta; return size; }
[ "function", "getScrollOffset", "(", "delta", ")", "{", "var", "itemSize", "=", "0", ",", "size", "=", "0", ";", "itemSize", "=", "getCarouselItemSize", ".", "call", "(", "this", ")", ";", "size", "=", "itemSize", "*", "delta", ";", "return", "size", ";", "}" ]
Return the scrolling offset size given the number of elements to scroll. @method getScrollOffset @param delta {Number} The delta number of elements to scroll by. @private
[ "Return", "the", "scrolling", "offset", "size", "given", "the", "number", "of", "elements", "to", "scroll", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L619-L627
42,830
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
setItemSelection
function setItemSelection(newpos, oldpos) { var carousel = this, cssClass = carousel.CLASSES, el, firstItem = carousel._firstItem, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), position = oldpos, sentinel = firstItem + numVisible - 1; if (position >= 0 && position < numItems) { if (!JS.isUndefined(carousel._itemsTable.items[position])) { el = Dom.get(carousel._itemsTable.items[position].id); if (el) { Dom.removeClass(el, cssClass.SELECTED_ITEM); } } } if (JS.isNumber(newpos)) { newpos = parseInt(newpos, 10); newpos = JS.isNumber(newpos) ? newpos : 0; } else { newpos = firstItem; } if (JS.isUndefined(carousel._itemsTable.items[newpos])) { newpos = getFirstVisibleForPosition.call(carousel, newpos); carousel.scrollTo(newpos); // still loading the item } if (!JS.isUndefined(carousel._itemsTable.items[newpos])) { el = Dom.get(carousel._itemsTable.items[newpos].id); if (el) { Dom.addClass(el, cssClass.SELECTED_ITEM); } } if (newpos < firstItem || newpos > sentinel) { // out of focus newpos = getFirstVisibleForPosition.call(carousel, newpos); carousel.scrollTo(newpos); } }
javascript
function setItemSelection(newpos, oldpos) { var carousel = this, cssClass = carousel.CLASSES, el, firstItem = carousel._firstItem, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), position = oldpos, sentinel = firstItem + numVisible - 1; if (position >= 0 && position < numItems) { if (!JS.isUndefined(carousel._itemsTable.items[position])) { el = Dom.get(carousel._itemsTable.items[position].id); if (el) { Dom.removeClass(el, cssClass.SELECTED_ITEM); } } } if (JS.isNumber(newpos)) { newpos = parseInt(newpos, 10); newpos = JS.isNumber(newpos) ? newpos : 0; } else { newpos = firstItem; } if (JS.isUndefined(carousel._itemsTable.items[newpos])) { newpos = getFirstVisibleForPosition.call(carousel, newpos); carousel.scrollTo(newpos); // still loading the item } if (!JS.isUndefined(carousel._itemsTable.items[newpos])) { el = Dom.get(carousel._itemsTable.items[newpos].id); if (el) { Dom.addClass(el, cssClass.SELECTED_ITEM); } } if (newpos < firstItem || newpos > sentinel) { // out of focus newpos = getFirstVisibleForPosition.call(carousel, newpos); carousel.scrollTo(newpos); } }
[ "function", "setItemSelection", "(", "newpos", ",", "oldpos", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "el", ",", "firstItem", "=", "carousel", ".", "_firstItem", ",", "isCircular", "=", "carousel", ".", "get", "(", "\"isCircular\"", ")", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "numVisible", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "position", "=", "oldpos", ",", "sentinel", "=", "firstItem", "+", "numVisible", "-", "1", ";", "if", "(", "position", ">=", "0", "&&", "position", "<", "numItems", ")", "{", "if", "(", "!", "JS", ".", "isUndefined", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "position", "]", ")", ")", "{", "el", "=", "Dom", ".", "get", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "position", "]", ".", "id", ")", ";", "if", "(", "el", ")", "{", "Dom", ".", "removeClass", "(", "el", ",", "cssClass", ".", "SELECTED_ITEM", ")", ";", "}", "}", "}", "if", "(", "JS", ".", "isNumber", "(", "newpos", ")", ")", "{", "newpos", "=", "parseInt", "(", "newpos", ",", "10", ")", ";", "newpos", "=", "JS", ".", "isNumber", "(", "newpos", ")", "?", "newpos", ":", "0", ";", "}", "else", "{", "newpos", "=", "firstItem", ";", "}", "if", "(", "JS", ".", "isUndefined", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "newpos", "]", ")", ")", "{", "newpos", "=", "getFirstVisibleForPosition", ".", "call", "(", "carousel", ",", "newpos", ")", ";", "carousel", ".", "scrollTo", "(", "newpos", ")", ";", "// still loading the item", "}", "if", "(", "!", "JS", ".", "isUndefined", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "newpos", "]", ")", ")", "{", "el", "=", "Dom", ".", "get", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "newpos", "]", ".", "id", ")", ";", "if", "(", "el", ")", "{", "Dom", ".", "addClass", "(", "el", ",", "cssClass", ".", "SELECTED_ITEM", ")", ";", "}", "}", "if", "(", "newpos", "<", "firstItem", "||", "newpos", ">", "sentinel", ")", "{", "// out of focus", "newpos", "=", "getFirstVisibleForPosition", ".", "call", "(", "carousel", ",", "newpos", ")", ";", "carousel", ".", "scrollTo", "(", "newpos", ")", ";", "}", "}" ]
Set the selected item. @method setItemSelection @param {Number} newpos The index of the new position @param {Number} oldpos The index of the previous position @private
[ "Set", "the", "selected", "item", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L663-L706
42,831
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
syncPagerUi
function syncPagerUi(page) { var carousel = this, numPages, numVisible; // Don't do anything if the Carousel is not rendered if (!carousel._hasRendered) { return; } numVisible = carousel.get("numVisible"); if (!JS.isNumber(page)) { page = Math.floor(carousel.get("selectedItem") / numVisible); } numPages = Math.ceil(carousel.get("numItems") / numVisible); carousel._pages.num = numPages; carousel._pages.cur = page; if (numPages > carousel.CONFIG.MAX_PAGER_BUTTONS) { carousel._updatePagerMenu(); } else { carousel._updatePagerButtons(); } }
javascript
function syncPagerUi(page) { var carousel = this, numPages, numVisible; // Don't do anything if the Carousel is not rendered if (!carousel._hasRendered) { return; } numVisible = carousel.get("numVisible"); if (!JS.isNumber(page)) { page = Math.floor(carousel.get("selectedItem") / numVisible); } numPages = Math.ceil(carousel.get("numItems") / numVisible); carousel._pages.num = numPages; carousel._pages.cur = page; if (numPages > carousel.CONFIG.MAX_PAGER_BUTTONS) { carousel._updatePagerMenu(); } else { carousel._updatePagerButtons(); } }
[ "function", "syncPagerUi", "(", "page", ")", "{", "var", "carousel", "=", "this", ",", "numPages", ",", "numVisible", ";", "// Don't do anything if the Carousel is not rendered", "if", "(", "!", "carousel", ".", "_hasRendered", ")", "{", "return", ";", "}", "numVisible", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "if", "(", "!", "JS", ".", "isNumber", "(", "page", ")", ")", "{", "page", "=", "Math", ".", "floor", "(", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "/", "numVisible", ")", ";", "}", "numPages", "=", "Math", ".", "ceil", "(", "carousel", ".", "get", "(", "\"numItems\"", ")", "/", "numVisible", ")", ";", "carousel", ".", "_pages", ".", "num", "=", "numPages", ";", "carousel", ".", "_pages", ".", "cur", "=", "page", ";", "if", "(", "numPages", ">", "carousel", ".", "CONFIG", ".", "MAX_PAGER_BUTTONS", ")", "{", "carousel", ".", "_updatePagerMenu", "(", ")", ";", "}", "else", "{", "carousel", ".", "_updatePagerButtons", "(", ")", ";", "}", "}" ]
Synchronize and redraw the Pager UI if necessary. @method syncPagerUi @private
[ "Synchronize", "and", "redraw", "the", "Pager", "UI", "if", "necessary", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L800-L824
42,832
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
getDimensions
function getDimensions(el, which) { switch (which) { case 'height': return getStyle(el, "marginTop") + getStyle(el, "marginBottom") + getStyle(el, "paddingTop") + getStyle(el, "paddingBottom") + getStyle(el, "borderTopWidth") + getStyle(el, "borderBottomWidth"); case 'width': return getStyle(el, "marginLeft") + getStyle(el, "marginRight") + getStyle(el, "paddingLeft") + getStyle(el, "paddingRight") + getStyle(el, "borderLeftWidth") + getStyle(el, "borderRightWidth"); default: break; } return getStyle(el, which); }
javascript
function getDimensions(el, which) { switch (which) { case 'height': return getStyle(el, "marginTop") + getStyle(el, "marginBottom") + getStyle(el, "paddingTop") + getStyle(el, "paddingBottom") + getStyle(el, "borderTopWidth") + getStyle(el, "borderBottomWidth"); case 'width': return getStyle(el, "marginLeft") + getStyle(el, "marginRight") + getStyle(el, "paddingLeft") + getStyle(el, "paddingRight") + getStyle(el, "borderLeftWidth") + getStyle(el, "borderRightWidth"); default: break; } return getStyle(el, which); }
[ "function", "getDimensions", "(", "el", ",", "which", ")", "{", "switch", "(", "which", ")", "{", "case", "'height'", ":", "return", "getStyle", "(", "el", ",", "\"marginTop\"", ")", "+", "getStyle", "(", "el", ",", "\"marginBottom\"", ")", "+", "getStyle", "(", "el", ",", "\"paddingTop\"", ")", "+", "getStyle", "(", "el", ",", "\"paddingBottom\"", ")", "+", "getStyle", "(", "el", ",", "\"borderTopWidth\"", ")", "+", "getStyle", "(", "el", ",", "\"borderBottomWidth\"", ")", ";", "case", "'width'", ":", "return", "getStyle", "(", "el", ",", "\"marginLeft\"", ")", "+", "getStyle", "(", "el", ",", "\"marginRight\"", ")", "+", "getStyle", "(", "el", ",", "\"paddingLeft\"", ")", "+", "getStyle", "(", "el", ",", "\"paddingRight\"", ")", "+", "getStyle", "(", "el", ",", "\"borderLeftWidth\"", ")", "+", "getStyle", "(", "el", ",", "\"borderRightWidth\"", ")", ";", "default", ":", "break", ";", "}", "return", "getStyle", "(", "el", ",", "which", ")", ";", "}" ]
Get full dimensions of an element. @method getDimensions @param {Object} el The element to get the dimensions of @param {String} which Get the height or width of an element @private
[ "Get", "full", "dimensions", "of", "an", "element", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L834-L855
42,833
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
syncUi
function syncUi(o) { var carousel = this; if (!JS.isObject(o)) { return; } switch (o.ev) { case itemAddedEvent: carousel._syncUiForItemAdd(o); break; case itemRemovedEvent: carousel._syncUiForItemRemove(o); break; case itemReplacedEvent: carousel._syncUiForItemReplace(o); break; case loadItemsEvent: carousel._syncUiForLazyLoading(o); break; } carousel.fireEvent(uiUpdateEvent); }
javascript
function syncUi(o) { var carousel = this; if (!JS.isObject(o)) { return; } switch (o.ev) { case itemAddedEvent: carousel._syncUiForItemAdd(o); break; case itemRemovedEvent: carousel._syncUiForItemRemove(o); break; case itemReplacedEvent: carousel._syncUiForItemReplace(o); break; case loadItemsEvent: carousel._syncUiForLazyLoading(o); break; } carousel.fireEvent(uiUpdateEvent); }
[ "function", "syncUi", "(", "o", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "!", "JS", ".", "isObject", "(", "o", ")", ")", "{", "return", ";", "}", "switch", "(", "o", ".", "ev", ")", "{", "case", "itemAddedEvent", ":", "carousel", ".", "_syncUiForItemAdd", "(", "o", ")", ";", "break", ";", "case", "itemRemovedEvent", ":", "carousel", ".", "_syncUiForItemRemove", "(", "o", ")", ";", "break", ";", "case", "itemReplacedEvent", ":", "carousel", ".", "_syncUiForItemReplace", "(", "o", ")", ";", "break", ";", "case", "loadItemsEvent", ":", "carousel", ".", "_syncUiForLazyLoading", "(", "o", ")", ";", "break", ";", "}", "carousel", ".", "fireEvent", "(", "uiUpdateEvent", ")", ";", "}" ]
Handle UI update. Call the appropriate methods on events fired when an item is added, or removed for synchronizing the DOM. @method syncUi @param {Object} o The item that needs to be added or removed @private
[ "Handle", "UI", "update", ".", "Call", "the", "appropriate", "methods", "on", "events", "fired", "when", "an", "item", "is", "added", "or", "removed", "for", "synchronizing", "the", "DOM", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L866-L889
42,834
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
updateStateAfterScroll
function updateStateAfterScroll(item, sentinel) { var carousel = this, page = carousel.get("currentPage"), newPage, numPerPage = carousel.get("numVisible"); newPage = parseInt(carousel._firstItem / numPerPage, 10); if (newPage != page) { carousel.setAttributeConfig("currentPage", { value: newPage }); carousel.fireEvent(pageChangeEvent, newPage); } if (carousel.get("selectOnScroll")) { if (carousel.get("selectedItem") != carousel._selectedItem) { carousel.set("selectedItem", carousel._selectedItem); } } clearTimeout(carousel._autoPlayTimer); delete carousel._autoPlayTimer; if (carousel.isAutoPlayOn()) { carousel.startAutoPlay(); } carousel.fireEvent(afterScrollEvent, { first: carousel._firstItem, last: sentinel }, carousel); }
javascript
function updateStateAfterScroll(item, sentinel) { var carousel = this, page = carousel.get("currentPage"), newPage, numPerPage = carousel.get("numVisible"); newPage = parseInt(carousel._firstItem / numPerPage, 10); if (newPage != page) { carousel.setAttributeConfig("currentPage", { value: newPage }); carousel.fireEvent(pageChangeEvent, newPage); } if (carousel.get("selectOnScroll")) { if (carousel.get("selectedItem") != carousel._selectedItem) { carousel.set("selectedItem", carousel._selectedItem); } } clearTimeout(carousel._autoPlayTimer); delete carousel._autoPlayTimer; if (carousel.isAutoPlayOn()) { carousel.startAutoPlay(); } carousel.fireEvent(afterScrollEvent, { first: carousel._firstItem, last: sentinel }, carousel); }
[ "function", "updateStateAfterScroll", "(", "item", ",", "sentinel", ")", "{", "var", "carousel", "=", "this", ",", "page", "=", "carousel", ".", "get", "(", "\"currentPage\"", ")", ",", "newPage", ",", "numPerPage", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "newPage", "=", "parseInt", "(", "carousel", ".", "_firstItem", "/", "numPerPage", ",", "10", ")", ";", "if", "(", "newPage", "!=", "page", ")", "{", "carousel", ".", "setAttributeConfig", "(", "\"currentPage\"", ",", "{", "value", ":", "newPage", "}", ")", ";", "carousel", ".", "fireEvent", "(", "pageChangeEvent", ",", "newPage", ")", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"selectOnScroll\"", ")", ")", "{", "if", "(", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "!=", "carousel", ".", "_selectedItem", ")", "{", "carousel", ".", "set", "(", "\"selectedItem\"", ",", "carousel", ".", "_selectedItem", ")", ";", "}", "}", "clearTimeout", "(", "carousel", ".", "_autoPlayTimer", ")", ";", "delete", "carousel", ".", "_autoPlayTimer", ";", "if", "(", "carousel", ".", "isAutoPlayOn", "(", ")", ")", "{", "carousel", ".", "startAutoPlay", "(", ")", ";", "}", "carousel", ".", "fireEvent", "(", "afterScrollEvent", ",", "{", "first", ":", "carousel", ".", "_firstItem", ",", "last", ":", "sentinel", "}", ",", "carousel", ")", ";", "}" ]
Update the state variables after scrolling the Carousel view port. @method updateStateAfterScroll @param {Integer} item The index to which the Carousel has scrolled to. @param {Integer} sentinel The last element in the view port. @private
[ "Update", "the", "state", "variables", "after", "scrolling", "the", "Carousel", "view", "port", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L899-L927
42,835
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, n = carousel.get("numItems"); while (n > 0) { if (!carousel.removeItem(0)) { YAHOO.log("Item could not be removed - missing?", "warn", WidgetName); } /* For dynamic loading, the numItems may be much larger than the actual number of items in the table. So, set the numItems to zero, and break out of the loop if the table is already empty. */ if (carousel._itemsTable.numItems === 0) { carousel.set("numItems", 0); break; } n--; } carousel.fireEvent(allItemsRemovedEvent); }
javascript
function () { var carousel = this, n = carousel.get("numItems"); while (n > 0) { if (!carousel.removeItem(0)) { YAHOO.log("Item could not be removed - missing?", "warn", WidgetName); } /* For dynamic loading, the numItems may be much larger than the actual number of items in the table. So, set the numItems to zero, and break out of the loop if the table is already empty. */ if (carousel._itemsTable.numItems === 0) { carousel.set("numItems", 0); break; } n--; } carousel.fireEvent(allItemsRemovedEvent); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "n", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ";", "while", "(", "n", ">", "0", ")", "{", "if", "(", "!", "carousel", ".", "removeItem", "(", "0", ")", ")", "{", "YAHOO", ".", "log", "(", "\"Item could not be removed - missing?\"", ",", "\"warn\"", ",", "WidgetName", ")", ";", "}", "/*\n For dynamic loading, the numItems may be much larger than\n the actual number of items in the table. So, set the\n numItems to zero, and break out of the loop if the table\n is already empty.\n */", "if", "(", "carousel", ".", "_itemsTable", ".", "numItems", "===", "0", ")", "{", "carousel", ".", "set", "(", "\"numItems\"", ",", "0", ")", ";", "break", ";", "}", "n", "--", ";", "}", "carousel", ".", "fireEvent", "(", "allItemsRemovedEvent", ")", ";", "}" ]
Clears the items from Carousel. @method clearItems @public
[ "Clears", "the", "items", "from", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L1564-L1586
42,836
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, first, focusEl, isSelectionInvisible, itemsTable, last, numVisible, selectOnScroll, selected, selItem; // Don't do anything if the Carousel is not rendered if (!carousel._hasRendered) { return; } if (carousel.isAnimating()) { // this messes up real bad! return; } selItem = carousel.get("selectedItem"); numVisible = carousel.get("numVisible"); selectOnScroll = carousel.get("selectOnScroll"); selected = (selItem >= 0) ? carousel.getItem(selItem) : null; first = carousel.get("firstVisible"); last = first + numVisible - 1; isSelectionInvisible = (selItem < first || selItem > last); focusEl = (selected && selected.id) ? Dom.get(selected.id) : null; itemsTable = carousel._itemsTable; if (!selectOnScroll && isSelectionInvisible) { focusEl = (itemsTable && itemsTable.items && itemsTable.items[first]) ? Dom.get(itemsTable.items[first].id) : null; } if (focusEl) { try { focusEl.focus(); } catch (ex) { // ignore focus errors } } carousel.fireEvent(focusEvent); }
javascript
function () { var carousel = this, first, focusEl, isSelectionInvisible, itemsTable, last, numVisible, selectOnScroll, selected, selItem; // Don't do anything if the Carousel is not rendered if (!carousel._hasRendered) { return; } if (carousel.isAnimating()) { // this messes up real bad! return; } selItem = carousel.get("selectedItem"); numVisible = carousel.get("numVisible"); selectOnScroll = carousel.get("selectOnScroll"); selected = (selItem >= 0) ? carousel.getItem(selItem) : null; first = carousel.get("firstVisible"); last = first + numVisible - 1; isSelectionInvisible = (selItem < first || selItem > last); focusEl = (selected && selected.id) ? Dom.get(selected.id) : null; itemsTable = carousel._itemsTable; if (!selectOnScroll && isSelectionInvisible) { focusEl = (itemsTable && itemsTable.items && itemsTable.items[first]) ? Dom.get(itemsTable.items[first].id) : null; } if (focusEl) { try { focusEl.focus(); } catch (ex) { // ignore focus errors } } carousel.fireEvent(focusEvent); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "first", ",", "focusEl", ",", "isSelectionInvisible", ",", "itemsTable", ",", "last", ",", "numVisible", ",", "selectOnScroll", ",", "selected", ",", "selItem", ";", "// Don't do anything if the Carousel is not rendered", "if", "(", "!", "carousel", ".", "_hasRendered", ")", "{", "return", ";", "}", "if", "(", "carousel", ".", "isAnimating", "(", ")", ")", "{", "// this messes up real bad!", "return", ";", "}", "selItem", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", ";", "numVisible", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "selectOnScroll", "=", "carousel", ".", "get", "(", "\"selectOnScroll\"", ")", ";", "selected", "=", "(", "selItem", ">=", "0", ")", "?", "carousel", ".", "getItem", "(", "selItem", ")", ":", "null", ";", "first", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ";", "last", "=", "first", "+", "numVisible", "-", "1", ";", "isSelectionInvisible", "=", "(", "selItem", "<", "first", "||", "selItem", ">", "last", ")", ";", "focusEl", "=", "(", "selected", "&&", "selected", ".", "id", ")", "?", "Dom", ".", "get", "(", "selected", ".", "id", ")", ":", "null", ";", "itemsTable", "=", "carousel", ".", "_itemsTable", ";", "if", "(", "!", "selectOnScroll", "&&", "isSelectionInvisible", ")", "{", "focusEl", "=", "(", "itemsTable", "&&", "itemsTable", ".", "items", "&&", "itemsTable", ".", "items", "[", "first", "]", ")", "?", "Dom", ".", "get", "(", "itemsTable", ".", "items", "[", "first", "]", ".", "id", ")", ":", "null", ";", "}", "if", "(", "focusEl", ")", "{", "try", "{", "focusEl", ".", "focus", "(", ")", ";", "}", "catch", "(", "ex", ")", "{", "// ignore focus errors", "}", "}", "carousel", ".", "fireEvent", "(", "focusEvent", ")", ";", "}" ]
Set focus on the Carousel. @method focus @public
[ "Set", "focus", "on", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L1594-L1643
42,837
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this; if (carousel.fireEvent(beforeHideEvent) !== false) { carousel.removeClass(carousel.CLASSES.VISIBLE); carousel.fireEvent(hideEvent); } }
javascript
function () { var carousel = this; if (carousel.fireEvent(beforeHideEvent) !== false) { carousel.removeClass(carousel.CLASSES.VISIBLE); carousel.fireEvent(hideEvent); } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "carousel", ".", "fireEvent", "(", "beforeHideEvent", ")", "!==", "false", ")", "{", "carousel", ".", "removeClass", "(", "carousel", ".", "CLASSES", ".", "VISIBLE", ")", ";", "carousel", ".", "fireEvent", "(", "hideEvent", ")", ";", "}", "}" ]
Hide the Carousel. @method hide @public
[ "Hide", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L1651-L1658
42,838
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (el, attrs) { var carousel = this, elId = el, // save for a rainy day parse = false, selected; if (!el) { YAHOO.log(el + " is neither an HTML element, nor a string", "error", WidgetName); return; } carousel._hasRendered = false; carousel._navBtns = { prev: [], next: [] }; carousel._pages = { el: null, num: 0, cur: 0 }; carousel._pagination = {}; carousel._itemAttrCache = {}; carousel._itemsTable = { loading: {}, numItems: 0, items: [], size: 0 }; YAHOO.log("Component initialization", WidgetName); if (JS.isString(el)) { el = Dom.get(el); } else if (!el.nodeName) { YAHOO.log(el + " is neither an HTML element, nor a string", "error", WidgetName); return; } Carousel.superclass.init.call(carousel, el, attrs); // check if we're starting somewhere in the middle selected = carousel.get("selectedItem"); if(selected > 0){ carousel.set("firstVisible",getFirstVisibleForPosition.call(carousel,selected)); } if (el) { if (!el.id) { // in case the HTML element is passed el.setAttribute("id", Dom.generateId()); } parse = carousel._parseCarousel(el); if (!parse) { carousel._createCarousel(elId); } } else { el = carousel._createCarousel(elId); } elId = el.id; carousel.initEvents(); if (parse) { carousel._parseCarouselItems(); } // add the selected class if(selected > 0){ setItemSelection.call(carousel,selected,0); } if (!attrs || typeof attrs.isVertical == "undefined") { carousel.set("isVertical", false); } carousel._parseCarouselNavigation(el); carousel._navEl = carousel._setupCarouselNavigation(); instances[elId] = { object: carousel }; carousel._loadItems(Math.min(carousel.get("firstVisible")+carousel.get("numVisible"),carousel.get("numItems"))-1); }
javascript
function (el, attrs) { var carousel = this, elId = el, // save for a rainy day parse = false, selected; if (!el) { YAHOO.log(el + " is neither an HTML element, nor a string", "error", WidgetName); return; } carousel._hasRendered = false; carousel._navBtns = { prev: [], next: [] }; carousel._pages = { el: null, num: 0, cur: 0 }; carousel._pagination = {}; carousel._itemAttrCache = {}; carousel._itemsTable = { loading: {}, numItems: 0, items: [], size: 0 }; YAHOO.log("Component initialization", WidgetName); if (JS.isString(el)) { el = Dom.get(el); } else if (!el.nodeName) { YAHOO.log(el + " is neither an HTML element, nor a string", "error", WidgetName); return; } Carousel.superclass.init.call(carousel, el, attrs); // check if we're starting somewhere in the middle selected = carousel.get("selectedItem"); if(selected > 0){ carousel.set("firstVisible",getFirstVisibleForPosition.call(carousel,selected)); } if (el) { if (!el.id) { // in case the HTML element is passed el.setAttribute("id", Dom.generateId()); } parse = carousel._parseCarousel(el); if (!parse) { carousel._createCarousel(elId); } } else { el = carousel._createCarousel(elId); } elId = el.id; carousel.initEvents(); if (parse) { carousel._parseCarouselItems(); } // add the selected class if(selected > 0){ setItemSelection.call(carousel,selected,0); } if (!attrs || typeof attrs.isVertical == "undefined") { carousel.set("isVertical", false); } carousel._parseCarouselNavigation(el); carousel._navEl = carousel._setupCarouselNavigation(); instances[elId] = { object: carousel }; carousel._loadItems(Math.min(carousel.get("firstVisible")+carousel.get("numVisible"),carousel.get("numItems"))-1); }
[ "function", "(", "el", ",", "attrs", ")", "{", "var", "carousel", "=", "this", ",", "elId", "=", "el", ",", "// save for a rainy day", "parse", "=", "false", ",", "selected", ";", "if", "(", "!", "el", ")", "{", "YAHOO", ".", "log", "(", "el", "+", "\" is neither an HTML element, nor a string\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", ";", "}", "carousel", ".", "_hasRendered", "=", "false", ";", "carousel", ".", "_navBtns", "=", "{", "prev", ":", "[", "]", ",", "next", ":", "[", "]", "}", ";", "carousel", ".", "_pages", "=", "{", "el", ":", "null", ",", "num", ":", "0", ",", "cur", ":", "0", "}", ";", "carousel", ".", "_pagination", "=", "{", "}", ";", "carousel", ".", "_itemAttrCache", "=", "{", "}", ";", "carousel", ".", "_itemsTable", "=", "{", "loading", ":", "{", "}", ",", "numItems", ":", "0", ",", "items", ":", "[", "]", ",", "size", ":", "0", "}", ";", "YAHOO", ".", "log", "(", "\"Component initialization\"", ",", "WidgetName", ")", ";", "if", "(", "JS", ".", "isString", "(", "el", ")", ")", "{", "el", "=", "Dom", ".", "get", "(", "el", ")", ";", "}", "else", "if", "(", "!", "el", ".", "nodeName", ")", "{", "YAHOO", ".", "log", "(", "el", "+", "\" is neither an HTML element, nor a string\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", ";", "}", "Carousel", ".", "superclass", ".", "init", ".", "call", "(", "carousel", ",", "el", ",", "attrs", ")", ";", "// check if we're starting somewhere in the middle", "selected", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", ";", "if", "(", "selected", ">", "0", ")", "{", "carousel", ".", "set", "(", "\"firstVisible\"", ",", "getFirstVisibleForPosition", ".", "call", "(", "carousel", ",", "selected", ")", ")", ";", "}", "if", "(", "el", ")", "{", "if", "(", "!", "el", ".", "id", ")", "{", "// in case the HTML element is passed", "el", ".", "setAttribute", "(", "\"id\"", ",", "Dom", ".", "generateId", "(", ")", ")", ";", "}", "parse", "=", "carousel", ".", "_parseCarousel", "(", "el", ")", ";", "if", "(", "!", "parse", ")", "{", "carousel", ".", "_createCarousel", "(", "elId", ")", ";", "}", "}", "else", "{", "el", "=", "carousel", ".", "_createCarousel", "(", "elId", ")", ";", "}", "elId", "=", "el", ".", "id", ";", "carousel", ".", "initEvents", "(", ")", ";", "if", "(", "parse", ")", "{", "carousel", ".", "_parseCarouselItems", "(", ")", ";", "}", "// add the selected class", "if", "(", "selected", ">", "0", ")", "{", "setItemSelection", ".", "call", "(", "carousel", ",", "selected", ",", "0", ")", ";", "}", "if", "(", "!", "attrs", "||", "typeof", "attrs", ".", "isVertical", "==", "\"undefined\"", ")", "{", "carousel", ".", "set", "(", "\"isVertical\"", ",", "false", ")", ";", "}", "carousel", ".", "_parseCarouselNavigation", "(", "el", ")", ";", "carousel", ".", "_navEl", "=", "carousel", ".", "_setupCarouselNavigation", "(", ")", ";", "instances", "[", "elId", "]", "=", "{", "object", ":", "carousel", "}", ";", "carousel", ".", "_loadItems", "(", "Math", ".", "min", "(", "carousel", ".", "get", "(", "\"firstVisible\"", ")", "+", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "carousel", ".", "get", "(", "\"numItems\"", ")", ")", "-", "1", ")", ";", "}" ]
Initialize the Carousel. @method init @public @param el {HTMLElement | String} The html element that represents the Carousel container. @param attrs {Object} The set of configuration attributes for creating the Carousel.
[ "Initialize", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L1670-L1742
42,839
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (attrs) { var carousel = this; attrs = attrs || {}; Carousel.superclass.initAttributes.call(carousel, attrs); /** * @attribute carouselEl * @description The type of the Carousel element. * @default OL * @type Boolean */ carousel.setAttributeConfig("carouselEl", { validator : JS.isString, value : attrs.carouselEl || "OL" }); /** * @attribute carouselItemEl * @description The type of the list of items within the Carousel. * @default LI * @type Boolean */ carousel.setAttributeConfig("carouselItemEl", { validator : JS.isString, value : attrs.carouselItemEl || "LI" }); /** * @attribute currentPage * @description The current page number (read-only.) * @type Number */ carousel.setAttributeConfig("currentPage", { readOnly : true, value : 0 }); /** * @attribute firstVisible * @description The index to start the Carousel from (indexes begin * from zero) * @default 0 * @type Number */ carousel.setAttributeConfig("firstVisible", { method : carousel._setFirstVisible, validator : carousel._validateFirstVisible, value : attrs.firstVisible || carousel.CONFIG.FIRST_VISIBLE }); /** * @attribute selectOnScroll * @description Set this to true to automatically set focus to * follow scrolling in the Carousel. * @default true * @type Boolean */ carousel.setAttributeConfig("selectOnScroll", { validator : JS.isBoolean, value : attrs.selectOnScroll || true }); /** * @attribute numVisible * @description The number of visible items in the Carousel's * viewport. * @default 3 * @type Number */ carousel.setAttributeConfig("numVisible", { setter : carousel._numVisibleSetter, method : carousel._setNumVisible, validator : carousel._validateNumVisible, value : attrs.numVisible || carousel.CONFIG.NUM_VISIBLE }); /** * @attribute numItems * @description The number of items in the Carousel. * @type Number */ carousel.setAttributeConfig("numItems", { method : carousel._setNumItems, validator : carousel._validateNumItems, value : carousel._itemsTable.numItems }); /** * @attribute scrollIncrement * @description The number of items to scroll by for arrow keys. * @default 1 * @type Number */ carousel.setAttributeConfig("scrollIncrement", { validator : carousel._validateScrollIncrement, value : attrs.scrollIncrement || 1 }); /** * @attribute selectedItem * @description The index of the selected item. * @type Number */ carousel.setAttributeConfig("selectedItem", { setter : carousel._selectedItemSetter, method : carousel._setSelectedItem, validator : JS.isNumber, value : -1 }); /** * @attribute revealAmount * @description The percentage of the item to be revealed on each * side of the Carousel (before and after the first and last item * in the Carousel's viewport.) * @default 0 * @type Number */ carousel.setAttributeConfig("revealAmount", { method : carousel._setRevealAmount, validator : carousel._validateRevealAmount, value : attrs.revealAmount || 0 }); /** * @attribute isCircular * @description Set this to true to wrap scrolling of the contents * in the Carousel. * @default false * @type Boolean */ carousel.setAttributeConfig("isCircular", { validator : JS.isBoolean, value : attrs.isCircular || false }); /** * @attribute isVertical * @description True if the orientation of the Carousel is vertical * @default false * @type Boolean */ carousel.setAttributeConfig("isVertical", { method : carousel._setOrientation, validator : JS.isBoolean, value : attrs.isVertical || false }); /** * @attribute navigation * @description The set of navigation controls for Carousel * @default <br> * { prev: null, // the previous navigation element<br> * next: null } // the next navigation element * @type Object */ carousel.setAttributeConfig("navigation", { method : carousel._setNavigation, validator : carousel._validateNavigation, value : attrs.navigation || {prev: null,next: null,page: null} }); /** * @attribute animation * @description The optional animation attributes for the Carousel. * @default <br> * { speed: 0, // the animation speed (in seconds)<br> * effect: null } // the animation effect (like * YAHOO.util.Easing.easeOut) * @type Object */ carousel.setAttributeConfig("animation", { validator : carousel._validateAnimation, value : attrs.animation || { speed: 0, effect: null } }); /** * @attribute autoPlay * @description Set this to time in milli-seconds to have the * Carousel automatically scroll the contents. * @type Number * @deprecated Use autoPlayInterval instead. */ carousel.setAttributeConfig("autoPlay", { validator : JS.isNumber, value : attrs.autoPlay || 0 }); /** * @attribute autoPlayInterval * @description The delay in milli-seconds for scrolling the * Carousel during auto-play. * Note: The startAutoPlay() method needs to be invoked to trigger * automatic scrolling of Carousel. * @type Number */ carousel.setAttributeConfig("autoPlayInterval", { validator : JS.isNumber, value : attrs.autoPlayInterval || 0 }); /** * @attribute numPages * @description The number of pages in the carousel. * @type Number */ carousel.setAttributeConfig("numPages", { readOnly : true, getter : carousel._getNumPages }); /** * @attribute lastVisible * @description The last item visible in the carousel. * @type Number */ carousel.setAttributeConfig("lastVisible", { readOnly : true, getter : carousel._getLastVisible }); }
javascript
function (attrs) { var carousel = this; attrs = attrs || {}; Carousel.superclass.initAttributes.call(carousel, attrs); /** * @attribute carouselEl * @description The type of the Carousel element. * @default OL * @type Boolean */ carousel.setAttributeConfig("carouselEl", { validator : JS.isString, value : attrs.carouselEl || "OL" }); /** * @attribute carouselItemEl * @description The type of the list of items within the Carousel. * @default LI * @type Boolean */ carousel.setAttributeConfig("carouselItemEl", { validator : JS.isString, value : attrs.carouselItemEl || "LI" }); /** * @attribute currentPage * @description The current page number (read-only.) * @type Number */ carousel.setAttributeConfig("currentPage", { readOnly : true, value : 0 }); /** * @attribute firstVisible * @description The index to start the Carousel from (indexes begin * from zero) * @default 0 * @type Number */ carousel.setAttributeConfig("firstVisible", { method : carousel._setFirstVisible, validator : carousel._validateFirstVisible, value : attrs.firstVisible || carousel.CONFIG.FIRST_VISIBLE }); /** * @attribute selectOnScroll * @description Set this to true to automatically set focus to * follow scrolling in the Carousel. * @default true * @type Boolean */ carousel.setAttributeConfig("selectOnScroll", { validator : JS.isBoolean, value : attrs.selectOnScroll || true }); /** * @attribute numVisible * @description The number of visible items in the Carousel's * viewport. * @default 3 * @type Number */ carousel.setAttributeConfig("numVisible", { setter : carousel._numVisibleSetter, method : carousel._setNumVisible, validator : carousel._validateNumVisible, value : attrs.numVisible || carousel.CONFIG.NUM_VISIBLE }); /** * @attribute numItems * @description The number of items in the Carousel. * @type Number */ carousel.setAttributeConfig("numItems", { method : carousel._setNumItems, validator : carousel._validateNumItems, value : carousel._itemsTable.numItems }); /** * @attribute scrollIncrement * @description The number of items to scroll by for arrow keys. * @default 1 * @type Number */ carousel.setAttributeConfig("scrollIncrement", { validator : carousel._validateScrollIncrement, value : attrs.scrollIncrement || 1 }); /** * @attribute selectedItem * @description The index of the selected item. * @type Number */ carousel.setAttributeConfig("selectedItem", { setter : carousel._selectedItemSetter, method : carousel._setSelectedItem, validator : JS.isNumber, value : -1 }); /** * @attribute revealAmount * @description The percentage of the item to be revealed on each * side of the Carousel (before and after the first and last item * in the Carousel's viewport.) * @default 0 * @type Number */ carousel.setAttributeConfig("revealAmount", { method : carousel._setRevealAmount, validator : carousel._validateRevealAmount, value : attrs.revealAmount || 0 }); /** * @attribute isCircular * @description Set this to true to wrap scrolling of the contents * in the Carousel. * @default false * @type Boolean */ carousel.setAttributeConfig("isCircular", { validator : JS.isBoolean, value : attrs.isCircular || false }); /** * @attribute isVertical * @description True if the orientation of the Carousel is vertical * @default false * @type Boolean */ carousel.setAttributeConfig("isVertical", { method : carousel._setOrientation, validator : JS.isBoolean, value : attrs.isVertical || false }); /** * @attribute navigation * @description The set of navigation controls for Carousel * @default <br> * { prev: null, // the previous navigation element<br> * next: null } // the next navigation element * @type Object */ carousel.setAttributeConfig("navigation", { method : carousel._setNavigation, validator : carousel._validateNavigation, value : attrs.navigation || {prev: null,next: null,page: null} }); /** * @attribute animation * @description The optional animation attributes for the Carousel. * @default <br> * { speed: 0, // the animation speed (in seconds)<br> * effect: null } // the animation effect (like * YAHOO.util.Easing.easeOut) * @type Object */ carousel.setAttributeConfig("animation", { validator : carousel._validateAnimation, value : attrs.animation || { speed: 0, effect: null } }); /** * @attribute autoPlay * @description Set this to time in milli-seconds to have the * Carousel automatically scroll the contents. * @type Number * @deprecated Use autoPlayInterval instead. */ carousel.setAttributeConfig("autoPlay", { validator : JS.isNumber, value : attrs.autoPlay || 0 }); /** * @attribute autoPlayInterval * @description The delay in milli-seconds for scrolling the * Carousel during auto-play. * Note: The startAutoPlay() method needs to be invoked to trigger * automatic scrolling of Carousel. * @type Number */ carousel.setAttributeConfig("autoPlayInterval", { validator : JS.isNumber, value : attrs.autoPlayInterval || 0 }); /** * @attribute numPages * @description The number of pages in the carousel. * @type Number */ carousel.setAttributeConfig("numPages", { readOnly : true, getter : carousel._getNumPages }); /** * @attribute lastVisible * @description The last item visible in the carousel. * @type Number */ carousel.setAttributeConfig("lastVisible", { readOnly : true, getter : carousel._getLastVisible }); }
[ "function", "(", "attrs", ")", "{", "var", "carousel", "=", "this", ";", "attrs", "=", "attrs", "||", "{", "}", ";", "Carousel", ".", "superclass", ".", "initAttributes", ".", "call", "(", "carousel", ",", "attrs", ")", ";", "/**\n * @attribute carouselEl\n * @description The type of the Carousel element.\n * @default OL\n * @type Boolean\n */", "carousel", ".", "setAttributeConfig", "(", "\"carouselEl\"", ",", "{", "validator", ":", "JS", ".", "isString", ",", "value", ":", "attrs", ".", "carouselEl", "||", "\"OL\"", "}", ")", ";", "/**\n * @attribute carouselItemEl\n * @description The type of the list of items within the Carousel.\n * @default LI\n * @type Boolean\n */", "carousel", ".", "setAttributeConfig", "(", "\"carouselItemEl\"", ",", "{", "validator", ":", "JS", ".", "isString", ",", "value", ":", "attrs", ".", "carouselItemEl", "||", "\"LI\"", "}", ")", ";", "/**\n * @attribute currentPage\n * @description The current page number (read-only.)\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"currentPage\"", ",", "{", "readOnly", ":", "true", ",", "value", ":", "0", "}", ")", ";", "/**\n * @attribute firstVisible\n * @description The index to start the Carousel from (indexes begin\n * from zero)\n * @default 0\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"firstVisible\"", ",", "{", "method", ":", "carousel", ".", "_setFirstVisible", ",", "validator", ":", "carousel", ".", "_validateFirstVisible", ",", "value", ":", "attrs", ".", "firstVisible", "||", "carousel", ".", "CONFIG", ".", "FIRST_VISIBLE", "}", ")", ";", "/**\n * @attribute selectOnScroll\n * @description Set this to true to automatically set focus to\n * follow scrolling in the Carousel.\n * @default true\n * @type Boolean\n */", "carousel", ".", "setAttributeConfig", "(", "\"selectOnScroll\"", ",", "{", "validator", ":", "JS", ".", "isBoolean", ",", "value", ":", "attrs", ".", "selectOnScroll", "||", "true", "}", ")", ";", "/**\n * @attribute numVisible\n * @description The number of visible items in the Carousel's\n * viewport.\n * @default 3\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"numVisible\"", ",", "{", "setter", ":", "carousel", ".", "_numVisibleSetter", ",", "method", ":", "carousel", ".", "_setNumVisible", ",", "validator", ":", "carousel", ".", "_validateNumVisible", ",", "value", ":", "attrs", ".", "numVisible", "||", "carousel", ".", "CONFIG", ".", "NUM_VISIBLE", "}", ")", ";", "/**\n * @attribute numItems\n * @description The number of items in the Carousel.\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"numItems\"", ",", "{", "method", ":", "carousel", ".", "_setNumItems", ",", "validator", ":", "carousel", ".", "_validateNumItems", ",", "value", ":", "carousel", ".", "_itemsTable", ".", "numItems", "}", ")", ";", "/**\n * @attribute scrollIncrement\n * @description The number of items to scroll by for arrow keys.\n * @default 1\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"scrollIncrement\"", ",", "{", "validator", ":", "carousel", ".", "_validateScrollIncrement", ",", "value", ":", "attrs", ".", "scrollIncrement", "||", "1", "}", ")", ";", "/**\n * @attribute selectedItem\n * @description The index of the selected item.\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"selectedItem\"", ",", "{", "setter", ":", "carousel", ".", "_selectedItemSetter", ",", "method", ":", "carousel", ".", "_setSelectedItem", ",", "validator", ":", "JS", ".", "isNumber", ",", "value", ":", "-", "1", "}", ")", ";", "/**\n * @attribute revealAmount\n * @description The percentage of the item to be revealed on each\n * side of the Carousel (before and after the first and last item\n * in the Carousel's viewport.)\n * @default 0\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"revealAmount\"", ",", "{", "method", ":", "carousel", ".", "_setRevealAmount", ",", "validator", ":", "carousel", ".", "_validateRevealAmount", ",", "value", ":", "attrs", ".", "revealAmount", "||", "0", "}", ")", ";", "/**\n * @attribute isCircular\n * @description Set this to true to wrap scrolling of the contents\n * in the Carousel.\n * @default false\n * @type Boolean\n */", "carousel", ".", "setAttributeConfig", "(", "\"isCircular\"", ",", "{", "validator", ":", "JS", ".", "isBoolean", ",", "value", ":", "attrs", ".", "isCircular", "||", "false", "}", ")", ";", "/**\n * @attribute isVertical\n * @description True if the orientation of the Carousel is vertical\n * @default false\n * @type Boolean\n */", "carousel", ".", "setAttributeConfig", "(", "\"isVertical\"", ",", "{", "method", ":", "carousel", ".", "_setOrientation", ",", "validator", ":", "JS", ".", "isBoolean", ",", "value", ":", "attrs", ".", "isVertical", "||", "false", "}", ")", ";", "/**\n * @attribute navigation\n * @description The set of navigation controls for Carousel\n * @default <br>\n * { prev: null, // the previous navigation element<br>\n * next: null } // the next navigation element\n * @type Object\n */", "carousel", ".", "setAttributeConfig", "(", "\"navigation\"", ",", "{", "method", ":", "carousel", ".", "_setNavigation", ",", "validator", ":", "carousel", ".", "_validateNavigation", ",", "value", ":", "attrs", ".", "navigation", "||", "{", "prev", ":", "null", ",", "next", ":", "null", ",", "page", ":", "null", "}", "}", ")", ";", "/**\n * @attribute animation\n * @description The optional animation attributes for the Carousel.\n * @default <br>\n * { speed: 0, // the animation speed (in seconds)<br>\n * effect: null } // the animation effect (like\n * YAHOO.util.Easing.easeOut)\n * @type Object\n */", "carousel", ".", "setAttributeConfig", "(", "\"animation\"", ",", "{", "validator", ":", "carousel", ".", "_validateAnimation", ",", "value", ":", "attrs", ".", "animation", "||", "{", "speed", ":", "0", ",", "effect", ":", "null", "}", "}", ")", ";", "/**\n * @attribute autoPlay\n * @description Set this to time in milli-seconds to have the\n * Carousel automatically scroll the contents.\n * @type Number\n * @deprecated Use autoPlayInterval instead.\n */", "carousel", ".", "setAttributeConfig", "(", "\"autoPlay\"", ",", "{", "validator", ":", "JS", ".", "isNumber", ",", "value", ":", "attrs", ".", "autoPlay", "||", "0", "}", ")", ";", "/**\n * @attribute autoPlayInterval\n * @description The delay in milli-seconds for scrolling the\n * Carousel during auto-play.\n * Note: The startAutoPlay() method needs to be invoked to trigger\n * automatic scrolling of Carousel.\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"autoPlayInterval\"", ",", "{", "validator", ":", "JS", ".", "isNumber", ",", "value", ":", "attrs", ".", "autoPlayInterval", "||", "0", "}", ")", ";", "/**\n * @attribute numPages\n * @description The number of pages in the carousel.\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"numPages\"", ",", "{", "readOnly", ":", "true", ",", "getter", ":", "carousel", ".", "_getNumPages", "}", ")", ";", "/**\n * @attribute lastVisible\n * @description The last item visible in the carousel.\n * @type Number\n */", "carousel", ".", "setAttributeConfig", "(", "\"lastVisible\"", ",", "{", "readOnly", ":", "true", ",", "getter", ":", "carousel", ".", "_getLastVisible", "}", ")", ";", "}" ]
Initialize the configuration attributes used to create the Carousel. @method initAttributes @public @param attrs {Object} The set of configuration attributes for creating the Carousel.
[ "Initialize", "the", "configuration", "attributes", "used", "to", "create", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L1752-L1975
42,840
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (index) { var carousel = this; if (index < 0 || index >= carousel.get("numItems")) { YAHOO.log("Index out of bounds", "error", WidgetName); return null; } if (carousel._itemsTable.items[index]) { return Dom.get(carousel._itemsTable.items[index].id); } return null; }
javascript
function (index) { var carousel = this; if (index < 0 || index >= carousel.get("numItems")) { YAHOO.log("Index out of bounds", "error", WidgetName); return null; } if (carousel._itemsTable.items[index]) { return Dom.get(carousel._itemsTable.items[index].id); } return null; }
[ "function", "(", "index", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "index", "<", "0", "||", "index", ">=", "carousel", ".", "get", "(", "\"numItems\"", ")", ")", "{", "YAHOO", ".", "log", "(", "\"Index out of bounds\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "null", ";", "}", "if", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ")", "{", "return", "Dom", ".", "get", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ".", "id", ")", ";", "}", "return", "null", ";", "}" ]
Return the carouselItemEl at index or null if the index is not found. @method getElementForItem @param index {Number} The index of the item to be returned @return {Element} Return the item at index or null if not found @public
[ "Return", "the", "carouselItemEl", "at", "index", "or", "null", "if", "the", "index", "is", "not", "found", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2119-L2132
42,841
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, els = [], i; for (i = 0; i < carousel._itemsTable.numItems; i++) { els.push(carousel.getElementForItem(i)); } return els; }
javascript
function () { var carousel = this, els = [], i; for (i = 0; i < carousel._itemsTable.numItems; i++) { els.push(carousel.getElementForItem(i)); } return els; }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "els", "=", "[", "]", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "carousel", ".", "_itemsTable", ".", "numItems", ";", "i", "++", ")", "{", "els", ".", "push", "(", "carousel", ".", "getElementForItem", "(", "i", ")", ")", ";", "}", "return", "els", ";", "}" ]
Return the carouselItemEl for all items in the Carousel. @method getElementForItems @return {Array} Return all the items @public
[ "Return", "the", "carouselItemEl", "for", "all", "items", "in", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2141-L2149
42,842
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (index) { var carousel = this; if (index < 0 || index >= carousel.get("numItems")) { YAHOO.log("Index out of bounds", "error", WidgetName); return null; } if (carousel._itemsTable.numItems > index) { if (!JS.isUndefined(carousel._itemsTable.items[index])) { return carousel._itemsTable.items[index]; } } return null; }
javascript
function (index) { var carousel = this; if (index < 0 || index >= carousel.get("numItems")) { YAHOO.log("Index out of bounds", "error", WidgetName); return null; } if (carousel._itemsTable.numItems > index) { if (!JS.isUndefined(carousel._itemsTable.items[index])) { return carousel._itemsTable.items[index]; } } return null; }
[ "function", "(", "index", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "index", "<", "0", "||", "index", ">=", "carousel", ".", "get", "(", "\"numItems\"", ")", ")", "{", "YAHOO", ".", "log", "(", "\"Index out of bounds\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "null", ";", "}", "if", "(", "carousel", ".", "_itemsTable", ".", "numItems", ">", "index", ")", "{", "if", "(", "!", "JS", ".", "isUndefined", "(", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ")", ")", "{", "return", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ";", "}", "}", "return", "null", ";", "}" ]
Return the item at index or null if the index is not found. @method getItem @param index {Number} The index of the item to be returned @return {Object} Return the item at index or null if not found @public
[ "Return", "the", "item", "at", "index", "or", "null", "if", "the", "index", "is", "not", "found", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2159-L2174
42,843
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (id) { var carousel = this, n = carousel.get("numItems"), i = 0, items = carousel._itemsTable.items, item; while (i < n) { item = items[i] || {}; if(item.id == id) { return i; } i++; } return -1; }
javascript
function (id) { var carousel = this, n = carousel.get("numItems"), i = 0, items = carousel._itemsTable.items, item; while (i < n) { item = items[i] || {}; if(item.id == id) { return i; } i++; } return -1; }
[ "function", "(", "id", ")", "{", "var", "carousel", "=", "this", ",", "n", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "i", "=", "0", ",", "items", "=", "carousel", ".", "_itemsTable", ".", "items", ",", "item", ";", "while", "(", "i", "<", "n", ")", "{", "item", "=", "items", "[", "i", "]", "||", "{", "}", ";", "if", "(", "item", ".", "id", "==", "id", ")", "{", "return", "i", ";", "}", "i", "++", ";", "}", "return", "-", "1", ";", "}" ]
Return the position of the Carousel item that has the id "id", or -1 if the id is not found. @method getItemPositionById @param index {Number} The index of the item to be returned @public
[ "Return", "the", "position", "of", "the", "Carousel", "item", "that", "has", "the", "id", "id", "or", "-", "1", "if", "the", "id", "is", "not", "found", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2228-L2244
42,844
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, i = carousel.get("firstVisible"), n = i + carousel.get("numVisible"), r = []; while (i < n) { r.push(carousel.getElementForItem(i)); i++; } return r; }
javascript
function () { var carousel = this, i = carousel.get("firstVisible"), n = i + carousel.get("numVisible"), r = []; while (i < n) { r.push(carousel.getElementForItem(i)); i++; } return r; }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "i", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ",", "n", "=", "i", "+", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "r", "=", "[", "]", ";", "while", "(", "i", "<", "n", ")", "{", "r", ".", "push", "(", "carousel", ".", "getElementForItem", "(", "i", ")", ")", ";", "i", "++", ";", "}", "return", "r", ";", "}" ]
Return all visible items as an array. @method getVisibleItems @return {Array} The array of visible items @public
[ "Return", "all", "visible", "items", "as", "an", "array", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2253-L2265
42,845
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (index) { var carousel = this, item, num = carousel.get("numItems"); if (index < 0 || index >= num) { YAHOO.log("Index out of bounds", "error", WidgetName); return false; } item = carousel._itemsTable.items.splice(index, 1); if (item && item.length == 1) { carousel._itemsTable.numItems--; carousel.set("numItems", num - 1); carousel.fireEvent(itemRemovedEvent, { item: item[0], pos: index, ev: itemRemovedEvent }); return true; } return false; }
javascript
function (index) { var carousel = this, item, num = carousel.get("numItems"); if (index < 0 || index >= num) { YAHOO.log("Index out of bounds", "error", WidgetName); return false; } item = carousel._itemsTable.items.splice(index, 1); if (item && item.length == 1) { carousel._itemsTable.numItems--; carousel.set("numItems", num - 1); carousel.fireEvent(itemRemovedEvent, { item: item[0], pos: index, ev: itemRemovedEvent }); return true; } return false; }
[ "function", "(", "index", ")", "{", "var", "carousel", "=", "this", ",", "item", ",", "num", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ";", "if", "(", "index", "<", "0", "||", "index", ">=", "num", ")", "{", "YAHOO", ".", "log", "(", "\"Index out of bounds\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "item", "=", "carousel", ".", "_itemsTable", ".", "items", ".", "splice", "(", "index", ",", "1", ")", ";", "if", "(", "item", "&&", "item", ".", "length", "==", "1", ")", "{", "carousel", ".", "_itemsTable", ".", "numItems", "--", ";", "carousel", ".", "set", "(", "\"numItems\"", ",", "num", "-", "1", ")", ";", "carousel", ".", "fireEvent", "(", "itemRemovedEvent", ",", "{", "item", ":", "item", "[", "0", "]", ",", "pos", ":", "index", ",", "ev", ":", "itemRemovedEvent", "}", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Remove an item at index from the Carousel. @method removeItem @public @param index {Number} The position to where in the list (starts from zero). @return {Boolean} Return true on success, false otherwise
[ "Remove", "an", "item", "at", "index", "from", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2276-L2297
42,846
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (item, index) { var carousel = this, className, content, elId, numItems = carousel.get("numItems"), oel, el = item; if (!item) { return false; } if (JS.isString(item) || item.nodeName) { content = item.nodeName ? item.innerHTML : item; } else if (JS.isObject(item)) { content = item.content; } else { YAHOO.log("Invalid argument to replaceItem", "error", WidgetName); return false; } if (JS.isUndefined(index)) { YAHOO.log("Index must be defined for replaceItem", "error", WidgetName); return false; } else { if (index < 0 || index >= numItems) { YAHOO.log("Index out of bounds in replaceItem", "error", WidgetName); return false; } oel = carousel._itemsTable.items[index]; if(!oel){ oel = carousel._itemsTable.loading[index]; carousel._itemsTable.items[index] = undefined; } carousel._itemsTable.items.splice(index, 1, { item : content, className : item.className || "", id : Dom.generateId() }); el = carousel._itemsTable.items[index]; } carousel.fireEvent(itemReplacedEvent, { newItem: el, oldItem: oel, pos: index, ev: itemReplacedEvent }); return true; }
javascript
function (item, index) { var carousel = this, className, content, elId, numItems = carousel.get("numItems"), oel, el = item; if (!item) { return false; } if (JS.isString(item) || item.nodeName) { content = item.nodeName ? item.innerHTML : item; } else if (JS.isObject(item)) { content = item.content; } else { YAHOO.log("Invalid argument to replaceItem", "error", WidgetName); return false; } if (JS.isUndefined(index)) { YAHOO.log("Index must be defined for replaceItem", "error", WidgetName); return false; } else { if (index < 0 || index >= numItems) { YAHOO.log("Index out of bounds in replaceItem", "error", WidgetName); return false; } oel = carousel._itemsTable.items[index]; if(!oel){ oel = carousel._itemsTable.loading[index]; carousel._itemsTable.items[index] = undefined; } carousel._itemsTable.items.splice(index, 1, { item : content, className : item.className || "", id : Dom.generateId() }); el = carousel._itemsTable.items[index]; } carousel.fireEvent(itemReplacedEvent, { newItem: el, oldItem: oel, pos: index, ev: itemReplacedEvent }); return true; }
[ "function", "(", "item", ",", "index", ")", "{", "var", "carousel", "=", "this", ",", "className", ",", "content", ",", "elId", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "oel", ",", "el", "=", "item", ";", "if", "(", "!", "item", ")", "{", "return", "false", ";", "}", "if", "(", "JS", ".", "isString", "(", "item", ")", "||", "item", ".", "nodeName", ")", "{", "content", "=", "item", ".", "nodeName", "?", "item", ".", "innerHTML", ":", "item", ";", "}", "else", "if", "(", "JS", ".", "isObject", "(", "item", ")", ")", "{", "content", "=", "item", ".", "content", ";", "}", "else", "{", "YAHOO", ".", "log", "(", "\"Invalid argument to replaceItem\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "if", "(", "JS", ".", "isUndefined", "(", "index", ")", ")", "{", "YAHOO", ".", "log", "(", "\"Index must be defined for replaceItem\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "else", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "numItems", ")", "{", "YAHOO", ".", "log", "(", "\"Index out of bounds in replaceItem\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "oel", "=", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ";", "if", "(", "!", "oel", ")", "{", "oel", "=", "carousel", ".", "_itemsTable", ".", "loading", "[", "index", "]", ";", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", "=", "undefined", ";", "}", "carousel", ".", "_itemsTable", ".", "items", ".", "splice", "(", "index", ",", "1", ",", "{", "item", ":", "content", ",", "className", ":", "item", ".", "className", "||", "\"\"", ",", "id", ":", "Dom", ".", "generateId", "(", ")", "}", ")", ";", "el", "=", "carousel", ".", "_itemsTable", ".", "items", "[", "index", "]", ";", "}", "carousel", ".", "fireEvent", "(", "itemReplacedEvent", ",", "{", "newItem", ":", "el", ",", "oldItem", ":", "oel", ",", "pos", ":", "index", ",", "ev", ":", "itemReplacedEvent", "}", ")", ";", "return", "true", ";", "}" ]
Replace an item at index witin Carousel. @method replaceItem @public @param item {String | Object | HTMLElement} The item to be appended to the Carousel. If the parameter is a string, it is assumed to be the content of the newly created item. If the parameter is an object, it is assumed to supply the content and an optional class and an optional id of the newly created item. @param index {Number} The position to where in the list (starts from zero). @return {Boolean} Return true on success, false otherwise
[ "Replace", "an", "item", "at", "index", "witin", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2313-L2362
42,847
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (appendTo) { var carousel = this, cssClass = carousel.CLASSES, rows = carousel._rows; carousel.addClass(cssClass.CAROUSEL); if (!carousel._clipEl) { carousel._clipEl = carousel._createCarouselClip(); carousel._clipEl.appendChild(carousel._carouselEl); } if (appendTo) { carousel.appendChild(carousel._clipEl); carousel.appendTo(appendTo); } else { if (!Dom.inDocument(carousel.get("element"))) { YAHOO.log("Nothing to render. The container should be " + "within the document if appendTo is not " + "specified", "error", WidgetName); return false; } carousel.appendChild(carousel._clipEl); } if (rows) { Dom.addClass(carousel._clipEl, cssClass.MULTI_ROW); } if (carousel.get("isVertical")) { carousel.addClass(cssClass.VERTICAL); } else { carousel.addClass(cssClass.HORIZONTAL); } if (carousel.get("numItems") < 1) { YAHOO.log("No items in the Carousel to render", "warn", WidgetName); return false; } carousel._refreshUi(); return true; }
javascript
function (appendTo) { var carousel = this, cssClass = carousel.CLASSES, rows = carousel._rows; carousel.addClass(cssClass.CAROUSEL); if (!carousel._clipEl) { carousel._clipEl = carousel._createCarouselClip(); carousel._clipEl.appendChild(carousel._carouselEl); } if (appendTo) { carousel.appendChild(carousel._clipEl); carousel.appendTo(appendTo); } else { if (!Dom.inDocument(carousel.get("element"))) { YAHOO.log("Nothing to render. The container should be " + "within the document if appendTo is not " + "specified", "error", WidgetName); return false; } carousel.appendChild(carousel._clipEl); } if (rows) { Dom.addClass(carousel._clipEl, cssClass.MULTI_ROW); } if (carousel.get("isVertical")) { carousel.addClass(cssClass.VERTICAL); } else { carousel.addClass(cssClass.HORIZONTAL); } if (carousel.get("numItems") < 1) { YAHOO.log("No items in the Carousel to render", "warn", WidgetName); return false; } carousel._refreshUi(); return true; }
[ "function", "(", "appendTo", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "rows", "=", "carousel", ".", "_rows", ";", "carousel", ".", "addClass", "(", "cssClass", ".", "CAROUSEL", ")", ";", "if", "(", "!", "carousel", ".", "_clipEl", ")", "{", "carousel", ".", "_clipEl", "=", "carousel", ".", "_createCarouselClip", "(", ")", ";", "carousel", ".", "_clipEl", ".", "appendChild", "(", "carousel", ".", "_carouselEl", ")", ";", "}", "if", "(", "appendTo", ")", "{", "carousel", ".", "appendChild", "(", "carousel", ".", "_clipEl", ")", ";", "carousel", ".", "appendTo", "(", "appendTo", ")", ";", "}", "else", "{", "if", "(", "!", "Dom", ".", "inDocument", "(", "carousel", ".", "get", "(", "\"element\"", ")", ")", ")", "{", "YAHOO", ".", "log", "(", "\"Nothing to render. The container should be \"", "+", "\"within the document if appendTo is not \"", "+", "\"specified\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "carousel", ".", "appendChild", "(", "carousel", ".", "_clipEl", ")", ";", "}", "if", "(", "rows", ")", "{", "Dom", ".", "addClass", "(", "carousel", ".", "_clipEl", ",", "cssClass", ".", "MULTI_ROW", ")", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"isVertical\"", ")", ")", "{", "carousel", ".", "addClass", "(", "cssClass", ".", "VERTICAL", ")", ";", "}", "else", "{", "carousel", ".", "addClass", "(", "cssClass", ".", "HORIZONTAL", ")", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"numItems\"", ")", "<", "1", ")", "{", "YAHOO", ".", "log", "(", "\"No items in the Carousel to render\"", ",", "\"warn\"", ",", "WidgetName", ")", ";", "return", "false", ";", "}", "carousel", ".", "_refreshUi", "(", ")", ";", "return", "true", ";", "}" ]
Render the Carousel. @method render @public @param appendTo {HTMLElement | String} The element to which the Carousel should be appended prior to rendering. @return {Boolean} Status of the operation
[ "Render", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2400-L2444
42,848
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, isVertical = carousel.get("isVertical"), cols = carousel._cols, item = carousel._firstItem - carousel.get("numVisible"); if (item < 0) { // only account for multi-row when scrolling backwards from item 0 if (cols) { item = carousel._firstItem - cols; } } if (carousel.get("selectOnScroll")) { carousel._selectedItem = carousel._getSelectedItem(item); } carousel.scrollTo(item); }
javascript
function () { var carousel = this, isVertical = carousel.get("isVertical"), cols = carousel._cols, item = carousel._firstItem - carousel.get("numVisible"); if (item < 0) { // only account for multi-row when scrolling backwards from item 0 if (cols) { item = carousel._firstItem - cols; } } if (carousel.get("selectOnScroll")) { carousel._selectedItem = carousel._getSelectedItem(item); } carousel.scrollTo(item); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "isVertical", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", ",", "cols", "=", "carousel", ".", "_cols", ",", "item", "=", "carousel", ".", "_firstItem", "-", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "if", "(", "item", "<", "0", ")", "{", "// only account for multi-row when scrolling backwards from item 0", "if", "(", "cols", ")", "{", "item", "=", "carousel", ".", "_firstItem", "-", "cols", ";", "}", "}", "if", "(", "carousel", ".", "get", "(", "\"selectOnScroll\"", ")", ")", "{", "carousel", ".", "_selectedItem", "=", "carousel", ".", "_getSelectedItem", "(", "item", ")", ";", "}", "carousel", ".", "scrollTo", "(", "item", ")", ";", "}" ]
Scroll the Carousel by a page backward. @method scrollPageBackward @public
[ "Scroll", "the", "Carousel", "by", "a", "page", "backward", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2476-L2493
42,849
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, item = carousel._firstItem + carousel.get("numVisible"); if (item > carousel.get("numItems")) { item = 0; } if (carousel.get("selectOnScroll")) { carousel._selectedItem = carousel._getSelectedItem(item); } carousel.scrollTo(item); }
javascript
function () { var carousel = this, item = carousel._firstItem + carousel.get("numVisible"); if (item > carousel.get("numItems")) { item = 0; } if (carousel.get("selectOnScroll")) { carousel._selectedItem = carousel._getSelectedItem(item); } carousel.scrollTo(item); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "item", "=", "carousel", ".", "_firstItem", "+", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "if", "(", "item", ">", "carousel", ".", "get", "(", "\"numItems\"", ")", ")", "{", "item", "=", "0", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"selectOnScroll\"", ")", ")", "{", "carousel", ".", "_selectedItem", "=", "carousel", ".", "_getSelectedItem", "(", "item", ")", ";", "}", "carousel", ".", "scrollTo", "(", "item", ")", ";", "}" ]
Scroll the Carousel by a page forward. @method scrollPageForward @public
[ "Scroll", "the", "Carousel", "by", "a", "page", "forward", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2501-L2514
42,850
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, newpos = 0, selected = carousel.get("selectedItem"); if (selected == this._firstItem) { newpos = selected - carousel.get("numVisible"); carousel._selectedItem = carousel._getSelectedItem(selected-1); carousel.scrollTo(newpos); } else { newpos = carousel.get("selectedItem") - carousel.get("scrollIncrement"); carousel.set("selectedItem",carousel._getSelectedItem(newpos)); } }
javascript
function () { var carousel = this, newpos = 0, selected = carousel.get("selectedItem"); if (selected == this._firstItem) { newpos = selected - carousel.get("numVisible"); carousel._selectedItem = carousel._getSelectedItem(selected-1); carousel.scrollTo(newpos); } else { newpos = carousel.get("selectedItem") - carousel.get("scrollIncrement"); carousel.set("selectedItem",carousel._getSelectedItem(newpos)); } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "newpos", "=", "0", ",", "selected", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", ";", "if", "(", "selected", "==", "this", ".", "_firstItem", ")", "{", "newpos", "=", "selected", "-", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "carousel", ".", "_selectedItem", "=", "carousel", ".", "_getSelectedItem", "(", "selected", "-", "1", ")", ";", "carousel", ".", "scrollTo", "(", "newpos", ")", ";", "}", "else", "{", "newpos", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "-", "carousel", ".", "get", "(", "\"scrollIncrement\"", ")", ";", "carousel", ".", "set", "(", "\"selectedItem\"", ",", "carousel", ".", "_getSelectedItem", "(", "newpos", ")", ")", ";", "}", "}" ]
Select the previous item in the Carousel. @method selectPreviousItem @public
[ "Select", "the", "previous", "item", "in", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2667-L2681
42,851
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, newpos = 0; newpos = carousel.get("selectedItem") + carousel.get("scrollIncrement"); carousel.set("selectedItem", carousel._getSelectedItem(newpos)); }
javascript
function () { var carousel = this, newpos = 0; newpos = carousel.get("selectedItem") + carousel.get("scrollIncrement"); carousel.set("selectedItem", carousel._getSelectedItem(newpos)); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "newpos", "=", "0", ";", "newpos", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "+", "carousel", ".", "get", "(", "\"scrollIncrement\"", ")", ";", "carousel", ".", "set", "(", "\"selectedItem\"", ",", "carousel", ".", "_getSelectedItem", "(", "newpos", ")", ")", ";", "}" ]
Select the next item in the Carousel. @method selectNextItem @public
[ "Select", "the", "next", "item", "in", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2689-L2695
42,852
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, cssClass = carousel.CLASSES; if (carousel.fireEvent(beforeShowEvent) !== false) { carousel.addClass(cssClass.VISIBLE); carousel.fireEvent(showEvent); } }
javascript
function () { var carousel = this, cssClass = carousel.CLASSES; if (carousel.fireEvent(beforeShowEvent) !== false) { carousel.addClass(cssClass.VISIBLE); carousel.fireEvent(showEvent); } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ";", "if", "(", "carousel", ".", "fireEvent", "(", "beforeShowEvent", ")", "!==", "false", ")", "{", "carousel", ".", "addClass", "(", "cssClass", ".", "VISIBLE", ")", ";", "carousel", ".", "fireEvent", "(", "showEvent", ")", ";", "}", "}" ]
Display the Carousel. @method show @public
[ "Display", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2703-L2711
42,853
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, timer; if (JS.isUndefined(carousel._autoPlayTimer)) { timer = carousel.get("autoPlayInterval"); if (timer <= 0) { return; } carousel._isAutoPlayInProgress = true; carousel.fireEvent(startAutoPlayEvent); carousel._autoPlayTimer = setTimeout(function () { carousel._autoScroll(); }, timer); } }
javascript
function () { var carousel = this, timer; if (JS.isUndefined(carousel._autoPlayTimer)) { timer = carousel.get("autoPlayInterval"); if (timer <= 0) { return; } carousel._isAutoPlayInProgress = true; carousel.fireEvent(startAutoPlayEvent); carousel._autoPlayTimer = setTimeout(function () { carousel._autoScroll(); }, timer); } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "timer", ";", "if", "(", "JS", ".", "isUndefined", "(", "carousel", ".", "_autoPlayTimer", ")", ")", "{", "timer", "=", "carousel", ".", "get", "(", "\"autoPlayInterval\"", ")", ";", "if", "(", "timer", "<=", "0", ")", "{", "return", ";", "}", "carousel", ".", "_isAutoPlayInProgress", "=", "true", ";", "carousel", ".", "fireEvent", "(", "startAutoPlayEvent", ")", ";", "carousel", ".", "_autoPlayTimer", "=", "setTimeout", "(", "function", "(", ")", "{", "carousel", ".", "_autoScroll", "(", ")", ";", "}", ",", "timer", ")", ";", "}", "}" ]
Start auto-playing the Carousel. @method startAutoPlay @public
[ "Start", "auto", "-", "playing", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2719-L2733
42,854
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this; if (!JS.isUndefined(carousel._autoPlayTimer)) { clearTimeout(carousel._autoPlayTimer); delete carousel._autoPlayTimer; carousel._isAutoPlayInProgress = false; carousel.fireEvent(stopAutoPlayEvent); } }
javascript
function () { var carousel = this; if (!JS.isUndefined(carousel._autoPlayTimer)) { clearTimeout(carousel._autoPlayTimer); delete carousel._autoPlayTimer; carousel._isAutoPlayInProgress = false; carousel.fireEvent(stopAutoPlayEvent); } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "!", "JS", ".", "isUndefined", "(", "carousel", ".", "_autoPlayTimer", ")", ")", "{", "clearTimeout", "(", "carousel", ".", "_autoPlayTimer", ")", ";", "delete", "carousel", ".", "_autoPlayTimer", ";", "carousel", ".", "_isAutoPlayInProgress", "=", "false", ";", "carousel", ".", "fireEvent", "(", "stopAutoPlayEvent", ")", ";", "}", "}" ]
Stop auto-playing the Carousel. @method stopAutoPlay @public
[ "Stop", "auto", "-", "playing", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2741-L2750
42,855
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, pagination = carousel._pagination; if(!pagination.el){ return false; } var numItems = carousel.get('numItems'), numVisible = carousel.get('numVisible'), firstVisible = carousel.get('firstVisible')+1, currentPage = carousel.get('currentPage')+1, numPages = carousel.get('numPages'), replacements = { 'numVisible' : numVisible, 'numPages' : numPages, 'numItems' : numItems, 'selectedItem' : carousel.get('selectedItem')+1, 'currentPage' : currentPage, 'firstVisible' : firstVisible, 'lastVisible' : carousel.get("lastVisible")+1 }, cb = pagination.callback || {}, scope = cb.scope && cb.obj ? cb.obj : carousel; pagination.el.innerHTML = JS.isFunction(cb.fn) ? cb.fn.apply(scope, [pagination.template, replacements]) : YAHOO.lang.substitute(pagination.template, replacements); }
javascript
function () { var carousel = this, pagination = carousel._pagination; if(!pagination.el){ return false; } var numItems = carousel.get('numItems'), numVisible = carousel.get('numVisible'), firstVisible = carousel.get('firstVisible')+1, currentPage = carousel.get('currentPage')+1, numPages = carousel.get('numPages'), replacements = { 'numVisible' : numVisible, 'numPages' : numPages, 'numItems' : numItems, 'selectedItem' : carousel.get('selectedItem')+1, 'currentPage' : currentPage, 'firstVisible' : firstVisible, 'lastVisible' : carousel.get("lastVisible")+1 }, cb = pagination.callback || {}, scope = cb.scope && cb.obj ? cb.obj : carousel; pagination.el.innerHTML = JS.isFunction(cb.fn) ? cb.fn.apply(scope, [pagination.template, replacements]) : YAHOO.lang.substitute(pagination.template, replacements); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "pagination", "=", "carousel", ".", "_pagination", ";", "if", "(", "!", "pagination", ".", "el", ")", "{", "return", "false", ";", "}", "var", "numItems", "=", "carousel", ".", "get", "(", "'numItems'", ")", ",", "numVisible", "=", "carousel", ".", "get", "(", "'numVisible'", ")", ",", "firstVisible", "=", "carousel", ".", "get", "(", "'firstVisible'", ")", "+", "1", ",", "currentPage", "=", "carousel", ".", "get", "(", "'currentPage'", ")", "+", "1", ",", "numPages", "=", "carousel", ".", "get", "(", "'numPages'", ")", ",", "replacements", "=", "{", "'numVisible'", ":", "numVisible", ",", "'numPages'", ":", "numPages", ",", "'numItems'", ":", "numItems", ",", "'selectedItem'", ":", "carousel", ".", "get", "(", "'selectedItem'", ")", "+", "1", ",", "'currentPage'", ":", "currentPage", ",", "'firstVisible'", ":", "firstVisible", ",", "'lastVisible'", ":", "carousel", ".", "get", "(", "\"lastVisible\"", ")", "+", "1", "}", ",", "cb", "=", "pagination", ".", "callback", "||", "{", "}", ",", "scope", "=", "cb", ".", "scope", "&&", "cb", ".", "obj", "?", "cb", ".", "obj", ":", "carousel", ";", "pagination", ".", "el", ".", "innerHTML", "=", "JS", ".", "isFunction", "(", "cb", ".", "fn", ")", "?", "cb", ".", "fn", ".", "apply", "(", "scope", ",", "[", "pagination", ".", "template", ",", "replacements", "]", ")", ":", "YAHOO", ".", "lang", ".", "substitute", "(", "pagination", ".", "template", ",", "replacements", ")", ";", "}" ]
Update interface's pagination data within a registered template. @method updatePagination @public
[ "Update", "interface", "s", "pagination", "data", "within", "a", "registered", "template", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2758-L2781
42,856
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (tpl, pos, cb) { var carousel = this; carousel._pagination.template = tpl; carousel._pagination.callback = cb || {}; if(!carousel._pagination.el){ carousel._pagination.el = createElement('DIV', {className:carousel.CLASSES.PAGINATION}); if(pos == "before"){ carousel._navEl.insertBefore(carousel._pagination.el, carousel._navEl.firstChild); } else { carousel._navEl.appendChild(carousel._pagination.el); } carousel.on('itemSelected', carousel.updatePagination); carousel.on('pageChange', carousel.updatePagination); } carousel.updatePagination(); }
javascript
function (tpl, pos, cb) { var carousel = this; carousel._pagination.template = tpl; carousel._pagination.callback = cb || {}; if(!carousel._pagination.el){ carousel._pagination.el = createElement('DIV', {className:carousel.CLASSES.PAGINATION}); if(pos == "before"){ carousel._navEl.insertBefore(carousel._pagination.el, carousel._navEl.firstChild); } else { carousel._navEl.appendChild(carousel._pagination.el); } carousel.on('itemSelected', carousel.updatePagination); carousel.on('pageChange', carousel.updatePagination); } carousel.updatePagination(); }
[ "function", "(", "tpl", ",", "pos", ",", "cb", ")", "{", "var", "carousel", "=", "this", ";", "carousel", ".", "_pagination", ".", "template", "=", "tpl", ";", "carousel", ".", "_pagination", ".", "callback", "=", "cb", "||", "{", "}", ";", "if", "(", "!", "carousel", ".", "_pagination", ".", "el", ")", "{", "carousel", ".", "_pagination", ".", "el", "=", "createElement", "(", "'DIV'", ",", "{", "className", ":", "carousel", ".", "CLASSES", ".", "PAGINATION", "}", ")", ";", "if", "(", "pos", "==", "\"before\"", ")", "{", "carousel", ".", "_navEl", ".", "insertBefore", "(", "carousel", ".", "_pagination", ".", "el", ",", "carousel", ".", "_navEl", ".", "firstChild", ")", ";", "}", "else", "{", "carousel", ".", "_navEl", ".", "appendChild", "(", "carousel", ".", "_pagination", ".", "el", ")", ";", "}", "carousel", ".", "on", "(", "'itemSelected'", ",", "carousel", ".", "updatePagination", ")", ";", "carousel", ".", "on", "(", "'pageChange'", ",", "carousel", ".", "updatePagination", ")", ";", "}", "carousel", ".", "updatePagination", "(", ")", ";", "}" ]
Register carousels pagination template, append to interface, and populate. @method registerPagination @param template {String} Pagination template as passed to lang.substitute @public
[ "Register", "carousels", "pagination", "template", "append", "to", "interface", "and", "populate", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2790-L2810
42,857
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (ev, p, o) { o.scope._isAnimationInProgress = false; updateStateAfterScroll.call(o.scope, o.item, o.last); }
javascript
function (ev, p, o) { o.scope._isAnimationInProgress = false; updateStateAfterScroll.call(o.scope, o.item, o.last); }
[ "function", "(", "ev", ",", "p", ",", "o", ")", "{", "o", ".", "scope", ".", "_isAnimationInProgress", "=", "false", ";", "updateStateAfterScroll", ".", "call", "(", "o", ".", "scope", ",", "o", ".", "item", ",", "o", ".", "last", ")", ";", "}" ]
Handle the animation complete event. @method _animationCompleteHandler @param {Event} ev The event. @param {Array} p The event parameters. @param {Object} o The object that has the state of the Carousel @protected
[ "Handle", "the", "animation", "complete", "event", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2868-L2871
42,858
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function() { var carousel = this, currIndex = carousel._firstItem, index; if (currIndex >= carousel.get("numItems") - 1) { if (carousel.get("isCircular")) { index = 0; } else { carousel.stopAutoPlay(); } } else { index = currIndex + carousel.get("numVisible"); } carousel._selectedItem = carousel._getSelectedItem(index); carousel.scrollTo.call(carousel, index); }
javascript
function() { var carousel = this, currIndex = carousel._firstItem, index; if (currIndex >= carousel.get("numItems") - 1) { if (carousel.get("isCircular")) { index = 0; } else { carousel.stopAutoPlay(); } } else { index = currIndex + carousel.get("numVisible"); } carousel._selectedItem = carousel._getSelectedItem(index); carousel.scrollTo.call(carousel, index); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "currIndex", "=", "carousel", ".", "_firstItem", ",", "index", ";", "if", "(", "currIndex", ">=", "carousel", ".", "get", "(", "\"numItems\"", ")", "-", "1", ")", "{", "if", "(", "carousel", ".", "get", "(", "\"isCircular\"", ")", ")", "{", "index", "=", "0", ";", "}", "else", "{", "carousel", ".", "stopAutoPlay", "(", ")", ";", "}", "}", "else", "{", "index", "=", "currIndex", "+", "carousel", ".", "get", "(", "\"numVisible\"", ")", ";", "}", "carousel", ".", "_selectedItem", "=", "carousel", ".", "_getSelectedItem", "(", "index", ")", ";", "carousel", ".", "scrollTo", ".", "call", "(", "carousel", ",", "index", ")", ";", "}" ]
Automatically scroll the contents of the Carousel. @method _autoScroll @protected
[ "Automatically", "scroll", "the", "contents", "of", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2878-L2895
42,859
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (elId) { var carousel = this, cssClass = carousel.CLASSES, el = Dom.get(elId); if (!el) { el = createElement("DIV", { className : cssClass.CAROUSEL, id : elId }); } if (!carousel._carouselEl) { carousel._carouselEl=createElement(carousel.get("carouselEl"), { className: cssClass.CAROUSEL_EL }); } return el; }
javascript
function (elId) { var carousel = this, cssClass = carousel.CLASSES, el = Dom.get(elId); if (!el) { el = createElement("DIV", { className : cssClass.CAROUSEL, id : elId }); } if (!carousel._carouselEl) { carousel._carouselEl=createElement(carousel.get("carouselEl"), { className: cssClass.CAROUSEL_EL }); } return el; }
[ "function", "(", "elId", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "el", "=", "Dom", ".", "get", "(", "elId", ")", ";", "if", "(", "!", "el", ")", "{", "el", "=", "createElement", "(", "\"DIV\"", ",", "{", "className", ":", "cssClass", ".", "CAROUSEL", ",", "id", ":", "elId", "}", ")", ";", "}", "if", "(", "!", "carousel", ".", "_carouselEl", ")", "{", "carousel", ".", "_carouselEl", "=", "createElement", "(", "carousel", ".", "get", "(", "\"carouselEl\"", ")", ",", "{", "className", ":", "cssClass", ".", "CAROUSEL_EL", "}", ")", ";", "}", "return", "el", ";", "}" ]
Create the Carousel. @method createCarousel @param elId {String} The id of the element to be created @protected
[ "Create", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2904-L2922
42,860
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (obj) { var attr, carousel = this, styles = getCarouselItemPosition.call(carousel, obj.pos); return createElement(carousel.get("carouselItemEl"), { className : obj.className, styles : obj.styles, content : obj.content, id : obj.id }); }
javascript
function (obj) { var attr, carousel = this, styles = getCarouselItemPosition.call(carousel, obj.pos); return createElement(carousel.get("carouselItemEl"), { className : obj.className, styles : obj.styles, content : obj.content, id : obj.id }); }
[ "function", "(", "obj", ")", "{", "var", "attr", ",", "carousel", "=", "this", ",", "styles", "=", "getCarouselItemPosition", ".", "call", "(", "carousel", ",", "obj", ".", "pos", ")", ";", "return", "createElement", "(", "carousel", ".", "get", "(", "\"carouselItemEl\"", ")", ",", "{", "className", ":", "obj", ".", "className", ",", "styles", ":", "obj", ".", "styles", ",", "content", ":", "obj", ".", "content", ",", "id", ":", "obj", ".", "id", "}", ")", ";", "}" ]
Create the Carousel item. @method createCarouselItem @param obj {Object} The attributes of the element to be created @protected
[ "Create", "the", "Carousel", "item", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2941-L2951
42,861
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (index) { var carousel = this, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), sentinel = numItems - 1; if (index < 0) { index = isCircular ? Math.ceil(numItems/numVisible)*numVisible + index : 0; } else if (index > sentinel) { index = isCircular ? 0 : sentinel; } return index; }
javascript
function (index) { var carousel = this, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), sentinel = numItems - 1; if (index < 0) { index = isCircular ? Math.ceil(numItems/numVisible)*numVisible + index : 0; } else if (index > sentinel) { index = isCircular ? 0 : sentinel; } return index; }
[ "function", "(", "index", ")", "{", "var", "carousel", "=", "this", ",", "isCircular", "=", "carousel", ".", "get", "(", "\"isCircular\"", ")", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "numVisible", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "sentinel", "=", "numItems", "-", "1", ";", "if", "(", "index", "<", "0", ")", "{", "index", "=", "isCircular", "?", "Math", ".", "ceil", "(", "numItems", "/", "numVisible", ")", "*", "numVisible", "+", "index", ":", "0", ";", "}", "else", "if", "(", "index", ">", "sentinel", ")", "{", "index", "=", "isCircular", "?", "0", ":", "sentinel", ";", "}", "return", "index", ";", "}" ]
Return a valid item for a possibly out of bounds index considering the isCircular property. @method _getValidIndex @param index {Number} The index of the item to be returned @return {Object} Return a valid item index @protected
[ "Return", "a", "valid", "item", "for", "a", "possibly", "out", "of", "bounds", "index", "considering", "the", "isCircular", "property", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2962-L2977
42,862
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), sentinel = numItems - 1; if (val < 0) { if (isCircular) { val = numItems + val; } else { val = carousel.get("selectedItem"); } } else if (val > sentinel) { if (isCircular) { val = val - numItems; } else { val = carousel.get("selectedItem"); } } return val; }
javascript
function (val) { var carousel = this, isCircular = carousel.get("isCircular"), numItems = carousel.get("numItems"), sentinel = numItems - 1; if (val < 0) { if (isCircular) { val = numItems + val; } else { val = carousel.get("selectedItem"); } } else if (val > sentinel) { if (isCircular) { val = val - numItems; } else { val = carousel.get("selectedItem"); } } return val; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ",", "isCircular", "=", "carousel", ".", "get", "(", "\"isCircular\"", ")", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "sentinel", "=", "numItems", "-", "1", ";", "if", "(", "val", "<", "0", ")", "{", "if", "(", "isCircular", ")", "{", "val", "=", "numItems", "+", "val", ";", "}", "else", "{", "val", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", ";", "}", "}", "else", "if", "(", "val", ">", "sentinel", ")", "{", "if", "(", "isCircular", ")", "{", "val", "=", "val", "-", "numItems", ";", "}", "else", "{", "val", "=", "carousel", ".", "get", "(", "\"selectedItem\"", ")", ";", "}", "}", "return", "val", ";", "}" ]
Get the value for the selected item. @method _getSelectedItem @param val {Number} The new value for "selected" item @return {Number} The new value that would be set @protected
[ "Get", "the", "value", "for", "the", "selected", "item", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L2987-L3007
42,863
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (ev) { var carousel = this, carouselItem = carousel.get("carouselItemEl"), container = carousel.get("element"), el, item, target = Event.getTarget(ev), tag = target.tagName.toUpperCase(); if(tag === "INPUT" || tag === "SELECT" || tag === "TEXTAREA") { return; } while (target && target != container && target.id != carousel._carouselEl) { el = target.nodeName; if (el.toUpperCase() == carouselItem) { break; } target = target.parentNode; } if ((item = carousel.getItemPositionById(target.id)) >= 0) { YAHOO.log("Setting selection to " + item, WidgetName); carousel.set("selectedItem", carousel._getSelectedItem(item)); carousel.focus(); } }
javascript
function (ev) { var carousel = this, carouselItem = carousel.get("carouselItemEl"), container = carousel.get("element"), el, item, target = Event.getTarget(ev), tag = target.tagName.toUpperCase(); if(tag === "INPUT" || tag === "SELECT" || tag === "TEXTAREA") { return; } while (target && target != container && target.id != carousel._carouselEl) { el = target.nodeName; if (el.toUpperCase() == carouselItem) { break; } target = target.parentNode; } if ((item = carousel.getItemPositionById(target.id)) >= 0) { YAHOO.log("Setting selection to " + item, WidgetName); carousel.set("selectedItem", carousel._getSelectedItem(item)); carousel.focus(); } }
[ "function", "(", "ev", ")", "{", "var", "carousel", "=", "this", ",", "carouselItem", "=", "carousel", ".", "get", "(", "\"carouselItemEl\"", ")", ",", "container", "=", "carousel", ".", "get", "(", "\"element\"", ")", ",", "el", ",", "item", ",", "target", "=", "Event", ".", "getTarget", "(", "ev", ")", ",", "tag", "=", "target", ".", "tagName", ".", "toUpperCase", "(", ")", ";", "if", "(", "tag", "===", "\"INPUT\"", "||", "tag", "===", "\"SELECT\"", "||", "tag", "===", "\"TEXTAREA\"", ")", "{", "return", ";", "}", "while", "(", "target", "&&", "target", "!=", "container", "&&", "target", ".", "id", "!=", "carousel", ".", "_carouselEl", ")", "{", "el", "=", "target", ".", "nodeName", ";", "if", "(", "el", ".", "toUpperCase", "(", ")", "==", "carouselItem", ")", "{", "break", ";", "}", "target", "=", "target", ".", "parentNode", ";", "}", "if", "(", "(", "item", "=", "carousel", ".", "getItemPositionById", "(", "target", ".", "id", ")", ")", ">=", "0", ")", "{", "YAHOO", ".", "log", "(", "\"Setting selection to \"", "+", "item", ",", "WidgetName", ")", ";", "carousel", ".", "set", "(", "\"selectedItem\"", ",", "carousel", ".", "_getSelectedItem", "(", "item", ")", ")", ";", "carousel", ".", "focus", "(", ")", ";", "}", "}" ]
The "click" handler for the item. @method _itemClickHandler @param {Event} ev The event object @protected
[ "The", "click", "handler", "for", "the", "item", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3016-L3045
42,864
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (ev) { var carousel = this, key = Event.getCharCode(ev), target = Event.getTarget(ev), prevent = false; // do not mess while animation is in progress or naving via select if (carousel.isAnimating() || target.tagName.toUpperCase() === "SELECT") { return; } switch (key) { case 0x25: // left arrow case 0x26: // up arrow carousel.selectPreviousItem(); prevent = true; break; case 0x27: // right arrow case 0x28: // down arrow carousel.selectNextItem(); prevent = true; break; case 0x21: // page-up carousel.scrollPageBackward(); prevent = true; break; case 0x22: // page-down carousel.scrollPageForward(); prevent = true; break; } if (prevent) { if (carousel.isAutoPlayOn()) { carousel.stopAutoPlay(); } Event.preventDefault(ev); } }
javascript
function (ev) { var carousel = this, key = Event.getCharCode(ev), target = Event.getTarget(ev), prevent = false; // do not mess while animation is in progress or naving via select if (carousel.isAnimating() || target.tagName.toUpperCase() === "SELECT") { return; } switch (key) { case 0x25: // left arrow case 0x26: // up arrow carousel.selectPreviousItem(); prevent = true; break; case 0x27: // right arrow case 0x28: // down arrow carousel.selectNextItem(); prevent = true; break; case 0x21: // page-up carousel.scrollPageBackward(); prevent = true; break; case 0x22: // page-down carousel.scrollPageForward(); prevent = true; break; } if (prevent) { if (carousel.isAutoPlayOn()) { carousel.stopAutoPlay(); } Event.preventDefault(ev); } }
[ "function", "(", "ev", ")", "{", "var", "carousel", "=", "this", ",", "key", "=", "Event", ".", "getCharCode", "(", "ev", ")", ",", "target", "=", "Event", ".", "getTarget", "(", "ev", ")", ",", "prevent", "=", "false", ";", "// do not mess while animation is in progress or naving via select", "if", "(", "carousel", ".", "isAnimating", "(", ")", "||", "target", ".", "tagName", ".", "toUpperCase", "(", ")", "===", "\"SELECT\"", ")", "{", "return", ";", "}", "switch", "(", "key", ")", "{", "case", "0x25", ":", "// left arrow", "case", "0x26", ":", "// up arrow", "carousel", ".", "selectPreviousItem", "(", ")", ";", "prevent", "=", "true", ";", "break", ";", "case", "0x27", ":", "// right arrow", "case", "0x28", ":", "// down arrow", "carousel", ".", "selectNextItem", "(", ")", ";", "prevent", "=", "true", ";", "break", ";", "case", "0x21", ":", "// page-up", "carousel", ".", "scrollPageBackward", "(", ")", ";", "prevent", "=", "true", ";", "break", ";", "case", "0x22", ":", "// page-down", "carousel", ".", "scrollPageForward", "(", ")", ";", "prevent", "=", "true", ";", "break", ";", "}", "if", "(", "prevent", ")", "{", "if", "(", "carousel", ".", "isAutoPlayOn", "(", ")", ")", "{", "carousel", ".", "stopAutoPlay", "(", ")", ";", "}", "Event", ".", "preventDefault", "(", "ev", ")", ";", "}", "}" ]
The keyboard event handler for Carousel. @method _keyboardEventHandler @param ev {Event} The event that is being handled. @protected
[ "The", "keyboard", "event", "handler", "for", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3054-L3092
42,865
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function(last) { var carousel = this, numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), reveal = carousel.get("revealAmount"), first = carousel._itemsTable.items.length, lastVisible = carousel.get("lastVisible"); // adjust if going backwards if(first > last && last+1 >= numVisible){ // need to get first a bit differently for the last page first = last % numVisible || last == lastVisible ? last - last % numVisible : last - numVisible + 1; } if(reveal && last < numItems - 1){ last++; } if (last >= first && (!carousel.getItem(first) || !carousel.getItem(last))) { carousel.fireEvent(loadItemsEvent, { ev: loadItemsEvent, first: first, last: last, num: last - first + 1 }); } }
javascript
function(last) { var carousel = this, numItems = carousel.get("numItems"), numVisible = carousel.get("numVisible"), reveal = carousel.get("revealAmount"), first = carousel._itemsTable.items.length, lastVisible = carousel.get("lastVisible"); // adjust if going backwards if(first > last && last+1 >= numVisible){ // need to get first a bit differently for the last page first = last % numVisible || last == lastVisible ? last - last % numVisible : last - numVisible + 1; } if(reveal && last < numItems - 1){ last++; } if (last >= first && (!carousel.getItem(first) || !carousel.getItem(last))) { carousel.fireEvent(loadItemsEvent, { ev: loadItemsEvent, first: first, last: last, num: last - first + 1 }); } }
[ "function", "(", "last", ")", "{", "var", "carousel", "=", "this", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "numVisible", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "reveal", "=", "carousel", ".", "get", "(", "\"revealAmount\"", ")", ",", "first", "=", "carousel", ".", "_itemsTable", ".", "items", ".", "length", ",", "lastVisible", "=", "carousel", ".", "get", "(", "\"lastVisible\"", ")", ";", "// adjust if going backwards", "if", "(", "first", ">", "last", "&&", "last", "+", "1", ">=", "numVisible", ")", "{", "// need to get first a bit differently for the last page", "first", "=", "last", "%", "numVisible", "||", "last", "==", "lastVisible", "?", "last", "-", "last", "%", "numVisible", ":", "last", "-", "numVisible", "+", "1", ";", "}", "if", "(", "reveal", "&&", "last", "<", "numItems", "-", "1", ")", "{", "last", "++", ";", "}", "if", "(", "last", ">=", "first", "&&", "(", "!", "carousel", ".", "getItem", "(", "first", ")", "||", "!", "carousel", ".", "getItem", "(", "last", ")", ")", ")", "{", "carousel", ".", "fireEvent", "(", "loadItemsEvent", ",", "{", "ev", ":", "loadItemsEvent", ",", "first", ":", "first", ",", "last", ":", "last", ",", "num", ":", "last", "-", "first", "+", "1", "}", ")", ";", "}", "}" ]
The load the required set of items that are needed for display. @method _loadItems @protected
[ "The", "load", "the", "required", "set", "of", "items", "that", "are", "needed", "for", "display", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3100-L3123
42,866
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (ev) { var carousel = this, target = Event.getTarget(ev), page = target.value, item; if (page) { item = carousel.getFirstVisibleOnPage(page); carousel._selectedItem = item; carousel.scrollTo(item); carousel.focus(); } }
javascript
function (ev) { var carousel = this, target = Event.getTarget(ev), page = target.value, item; if (page) { item = carousel.getFirstVisibleOnPage(page); carousel._selectedItem = item; carousel.scrollTo(item); carousel.focus(); } }
[ "function", "(", "ev", ")", "{", "var", "carousel", "=", "this", ",", "target", "=", "Event", ".", "getTarget", "(", "ev", ")", ",", "page", "=", "target", ".", "value", ",", "item", ";", "if", "(", "page", ")", "{", "item", "=", "carousel", ".", "getFirstVisibleOnPage", "(", "page", ")", ";", "carousel", ".", "_selectedItem", "=", "item", ";", "carousel", ".", "scrollTo", "(", "item", ")", ";", "carousel", ".", "focus", "(", ")", ";", "}", "}" ]
The "onchange" handler for select box pagination. @method _pagerChangeHandler @param {Event} ev The event object @protected
[ "The", "onchange", "handler", "for", "select", "box", "pagination", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3132-L3144
42,867
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (ev) { var carousel = this, css = carousel.CLASSES, target = Event.getTarget(ev), elNode = target.nodeName.toUpperCase(), val, stringIndex, page, item; if (Dom.hasClass(target, css.PAGER_ITEM) || Dom.hasClass(target.parentNode, css.PAGER_ITEM)) { if (elNode == "EM") { target = target.parentNode;// item is an em and not an anchor (when text is visible) } val = target.href; stringIndex = val.lastIndexOf("#"); page = parseInt(val.substring(stringIndex+1), 10); if (page != -1) { item = carousel.getFirstVisibleOnPage(page); carousel._selectedItem = item; carousel.scrollTo(item); carousel.focus(); } Event.preventDefault(ev); } }
javascript
function (ev) { var carousel = this, css = carousel.CLASSES, target = Event.getTarget(ev), elNode = target.nodeName.toUpperCase(), val, stringIndex, page, item; if (Dom.hasClass(target, css.PAGER_ITEM) || Dom.hasClass(target.parentNode, css.PAGER_ITEM)) { if (elNode == "EM") { target = target.parentNode;// item is an em and not an anchor (when text is visible) } val = target.href; stringIndex = val.lastIndexOf("#"); page = parseInt(val.substring(stringIndex+1), 10); if (page != -1) { item = carousel.getFirstVisibleOnPage(page); carousel._selectedItem = item; carousel.scrollTo(item); carousel.focus(); } Event.preventDefault(ev); } }
[ "function", "(", "ev", ")", "{", "var", "carousel", "=", "this", ",", "css", "=", "carousel", ".", "CLASSES", ",", "target", "=", "Event", ".", "getTarget", "(", "ev", ")", ",", "elNode", "=", "target", ".", "nodeName", ".", "toUpperCase", "(", ")", ",", "val", ",", "stringIndex", ",", "page", ",", "item", ";", "if", "(", "Dom", ".", "hasClass", "(", "target", ",", "css", ".", "PAGER_ITEM", ")", "||", "Dom", ".", "hasClass", "(", "target", ".", "parentNode", ",", "css", ".", "PAGER_ITEM", ")", ")", "{", "if", "(", "elNode", "==", "\"EM\"", ")", "{", "target", "=", "target", ".", "parentNode", ";", "// item is an em and not an anchor (when text is visible)", "}", "val", "=", "target", ".", "href", ";", "stringIndex", "=", "val", ".", "lastIndexOf", "(", "\"#\"", ")", ";", "page", "=", "parseInt", "(", "val", ".", "substring", "(", "stringIndex", "+", "1", ")", ",", "10", ")", ";", "if", "(", "page", "!=", "-", "1", ")", "{", "item", "=", "carousel", ".", "getFirstVisibleOnPage", "(", "page", ")", ";", "carousel", ".", "_selectedItem", "=", "item", ";", "carousel", ".", "scrollTo", "(", "item", ")", ";", "carousel", ".", "focus", "(", ")", ";", "}", "Event", ".", "preventDefault", "(", "ev", ")", ";", "}", "}" ]
The "click" handler for anchor pagination. @method _pagerClickHandler @param {Event} ev The event object @protected
[ "The", "click", "handler", "for", "anchor", "pagination", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3152-L3177
42,868
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (parent) { var carousel = this, child, cssClass, domEl, found, node; cssClass = carousel.CLASSES; domEl = carousel.get("carouselEl"); found = false; for (child = parent.firstChild; child; child = child.nextSibling) { if (child.nodeType == 1) { node = child.nodeName; if (node.toUpperCase() == domEl) { carousel._carouselEl = child; Dom.addClass(carousel._carouselEl, carousel.CLASSES.CAROUSEL_EL); YAHOO.log("Found Carousel - " + node + (child.id ? " (#" + child.id + ")" : ""), WidgetName); found = true; } } } return found; }
javascript
function (parent) { var carousel = this, child, cssClass, domEl, found, node; cssClass = carousel.CLASSES; domEl = carousel.get("carouselEl"); found = false; for (child = parent.firstChild; child; child = child.nextSibling) { if (child.nodeType == 1) { node = child.nodeName; if (node.toUpperCase() == domEl) { carousel._carouselEl = child; Dom.addClass(carousel._carouselEl, carousel.CLASSES.CAROUSEL_EL); YAHOO.log("Found Carousel - " + node + (child.id ? " (#" + child.id + ")" : ""), WidgetName); found = true; } } } return found; }
[ "function", "(", "parent", ")", "{", "var", "carousel", "=", "this", ",", "child", ",", "cssClass", ",", "domEl", ",", "found", ",", "node", ";", "cssClass", "=", "carousel", ".", "CLASSES", ";", "domEl", "=", "carousel", ".", "get", "(", "\"carouselEl\"", ")", ";", "found", "=", "false", ";", "for", "(", "child", "=", "parent", ".", "firstChild", ";", "child", ";", "child", "=", "child", ".", "nextSibling", ")", "{", "if", "(", "child", ".", "nodeType", "==", "1", ")", "{", "node", "=", "child", ".", "nodeName", ";", "if", "(", "node", ".", "toUpperCase", "(", ")", "==", "domEl", ")", "{", "carousel", ".", "_carouselEl", "=", "child", ";", "Dom", ".", "addClass", "(", "carousel", ".", "_carouselEl", ",", "carousel", ".", "CLASSES", ".", "CAROUSEL_EL", ")", ";", "YAHOO", ".", "log", "(", "\"Found Carousel - \"", "+", "node", "+", "(", "child", ".", "id", "?", "\" (#\"", "+", "child", ".", "id", "+", "\")\"", ":", "\"\"", ")", ",", "WidgetName", ")", ";", "found", "=", "true", ";", "}", "}", "}", "return", "found", ";", "}" ]
Find the Carousel within a container. The Carousel is identified by the first element that matches the carousel element tag or the element that has the Carousel class. @method parseCarousel @param parent {HTMLElement} The parent element to look under @return {Boolean} True if Carousel is found, false otherwise @protected
[ "Find", "the", "Carousel", "within", "a", "container", ".", "The", "Carousel", "is", "identified", "by", "the", "first", "element", "that", "matches", "the", "carousel", "element", "tag", "or", "the", "element", "that", "has", "the", "Carousel", "class", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3189-L3212
42,869
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, cssClass = carousel.CLASSES, i=0, rows, child, domItemEl, elId, node, index = carousel.get("firstVisible"), parent = carousel._carouselEl; rows = carousel._rows; domItemEl = carousel.get("carouselItemEl"); for (child = parent.firstChild; child; child = child.nextSibling) { if (child.nodeType == 1) { node = child.nodeName; if (node.toUpperCase() == domItemEl) { if (child.id) { elId = child.id; } else { elId = Dom.generateId(); child.setAttribute("id", elId); } carousel.addItem(child,index); index++; } } } }
javascript
function () { var carousel = this, cssClass = carousel.CLASSES, i=0, rows, child, domItemEl, elId, node, index = carousel.get("firstVisible"), parent = carousel._carouselEl; rows = carousel._rows; domItemEl = carousel.get("carouselItemEl"); for (child = parent.firstChild; child; child = child.nextSibling) { if (child.nodeType == 1) { node = child.nodeName; if (node.toUpperCase() == domItemEl) { if (child.id) { elId = child.id; } else { elId = Dom.generateId(); child.setAttribute("id", elId); } carousel.addItem(child,index); index++; } } } }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "i", "=", "0", ",", "rows", ",", "child", ",", "domItemEl", ",", "elId", ",", "node", ",", "index", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ",", "parent", "=", "carousel", ".", "_carouselEl", ";", "rows", "=", "carousel", ".", "_rows", ";", "domItemEl", "=", "carousel", ".", "get", "(", "\"carouselItemEl\"", ")", ";", "for", "(", "child", "=", "parent", ".", "firstChild", ";", "child", ";", "child", "=", "child", ".", "nextSibling", ")", "{", "if", "(", "child", ".", "nodeType", "==", "1", ")", "{", "node", "=", "child", ".", "nodeName", ";", "if", "(", "node", ".", "toUpperCase", "(", ")", "==", "domItemEl", ")", "{", "if", "(", "child", ".", "id", ")", "{", "elId", "=", "child", ".", "id", ";", "}", "else", "{", "elId", "=", "Dom", ".", "generateId", "(", ")", ";", "child", ".", "setAttribute", "(", "\"id\"", ",", "elId", ")", ";", "}", "carousel", ".", "addItem", "(", "child", ",", "index", ")", ";", "index", "++", ";", "}", "}", "}", "}" ]
Find the items within the Carousel and add them to the items table. A Carousel item is identified by elements that matches the carousel item element tag. @method parseCarouselItems @protected
[ "Find", "the", "items", "within", "the", "Carousel", "and", "add", "them", "to", "the", "items", "table", ".", "A", "Carousel", "item", "is", "identified", "by", "elements", "that", "matches", "the", "carousel", "item", "element", "tag", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3222-L3252
42,870
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (parent) { var carousel = this, cfg, cssClass = carousel.CLASSES, el, i, j, nav, rv = false; nav = Dom.getElementsByClassName(cssClass.PREV_PAGE, "*", parent); if (nav.length > 0) { for (i in nav) { if (nav.hasOwnProperty(i)) { el = nav[i]; YAHOO.log("Found Carousel previous page navigation - " + el + (el.id ? " (#" + el.id + ")" : ""), WidgetName); if (el.nodeName == "INPUT" || el.nodeName == "BUTTON" || el.nodeName == "A") {// Anchor support in Nav (for SEO) carousel._navBtns.prev.push(el); } else { j = el.getElementsByTagName("INPUT"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.prev.push(j[0]); } else { j = el.getElementsByTagName("BUTTON"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.prev.push(j[0]); } } } } } cfg = { prev: nav }; } nav = Dom.getElementsByClassName(cssClass.NEXT_PAGE, "*", parent); if (nav.length > 0) { for (i in nav) { if (nav.hasOwnProperty(i)) { el = nav[i]; YAHOO.log("Found Carousel next page navigation - " + el + (el.id ? " (#" + el.id + ")" : ""), WidgetName); if (el.nodeName == "INPUT" || el.nodeName == "BUTTON" || el.nodeName == "A") {// Anchor support in Nav (for SEO) carousel._navBtns.next.push(el); } else { j = el.getElementsByTagName("INPUT"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.next.push(j[0]); } else { j = el.getElementsByTagName("BUTTON"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.next.push(j[0]); } } } } } if (cfg) { cfg.next = nav; } else { cfg = { next: nav }; } } if (cfg) { carousel.set("navigation", cfg); rv = true; } return rv; }
javascript
function (parent) { var carousel = this, cfg, cssClass = carousel.CLASSES, el, i, j, nav, rv = false; nav = Dom.getElementsByClassName(cssClass.PREV_PAGE, "*", parent); if (nav.length > 0) { for (i in nav) { if (nav.hasOwnProperty(i)) { el = nav[i]; YAHOO.log("Found Carousel previous page navigation - " + el + (el.id ? " (#" + el.id + ")" : ""), WidgetName); if (el.nodeName == "INPUT" || el.nodeName == "BUTTON" || el.nodeName == "A") {// Anchor support in Nav (for SEO) carousel._navBtns.prev.push(el); } else { j = el.getElementsByTagName("INPUT"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.prev.push(j[0]); } else { j = el.getElementsByTagName("BUTTON"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.prev.push(j[0]); } } } } } cfg = { prev: nav }; } nav = Dom.getElementsByClassName(cssClass.NEXT_PAGE, "*", parent); if (nav.length > 0) { for (i in nav) { if (nav.hasOwnProperty(i)) { el = nav[i]; YAHOO.log("Found Carousel next page navigation - " + el + (el.id ? " (#" + el.id + ")" : ""), WidgetName); if (el.nodeName == "INPUT" || el.nodeName == "BUTTON" || el.nodeName == "A") {// Anchor support in Nav (for SEO) carousel._navBtns.next.push(el); } else { j = el.getElementsByTagName("INPUT"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.next.push(j[0]); } else { j = el.getElementsByTagName("BUTTON"); if (JS.isArray(j) && j.length > 0) { carousel._navBtns.next.push(j[0]); } } } } } if (cfg) { cfg.next = nav; } else { cfg = { next: nav }; } } if (cfg) { carousel.set("navigation", cfg); rv = true; } return rv; }
[ "function", "(", "parent", ")", "{", "var", "carousel", "=", "this", ",", "cfg", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "el", ",", "i", ",", "j", ",", "nav", ",", "rv", "=", "false", ";", "nav", "=", "Dom", ".", "getElementsByClassName", "(", "cssClass", ".", "PREV_PAGE", ",", "\"*\"", ",", "parent", ")", ";", "if", "(", "nav", ".", "length", ">", "0", ")", "{", "for", "(", "i", "in", "nav", ")", "{", "if", "(", "nav", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "el", "=", "nav", "[", "i", "]", ";", "YAHOO", ".", "log", "(", "\"Found Carousel previous page navigation - \"", "+", "el", "+", "(", "el", ".", "id", "?", "\" (#\"", "+", "el", ".", "id", "+", "\")\"", ":", "\"\"", ")", ",", "WidgetName", ")", ";", "if", "(", "el", ".", "nodeName", "==", "\"INPUT\"", "||", "el", ".", "nodeName", "==", "\"BUTTON\"", "||", "el", ".", "nodeName", "==", "\"A\"", ")", "{", "// Anchor support in Nav (for SEO)", "carousel", ".", "_navBtns", ".", "prev", ".", "push", "(", "el", ")", ";", "}", "else", "{", "j", "=", "el", ".", "getElementsByTagName", "(", "\"INPUT\"", ")", ";", "if", "(", "JS", ".", "isArray", "(", "j", ")", "&&", "j", ".", "length", ">", "0", ")", "{", "carousel", ".", "_navBtns", ".", "prev", ".", "push", "(", "j", "[", "0", "]", ")", ";", "}", "else", "{", "j", "=", "el", ".", "getElementsByTagName", "(", "\"BUTTON\"", ")", ";", "if", "(", "JS", ".", "isArray", "(", "j", ")", "&&", "j", ".", "length", ">", "0", ")", "{", "carousel", ".", "_navBtns", ".", "prev", ".", "push", "(", "j", "[", "0", "]", ")", ";", "}", "}", "}", "}", "}", "cfg", "=", "{", "prev", ":", "nav", "}", ";", "}", "nav", "=", "Dom", ".", "getElementsByClassName", "(", "cssClass", ".", "NEXT_PAGE", ",", "\"*\"", ",", "parent", ")", ";", "if", "(", "nav", ".", "length", ">", "0", ")", "{", "for", "(", "i", "in", "nav", ")", "{", "if", "(", "nav", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "el", "=", "nav", "[", "i", "]", ";", "YAHOO", ".", "log", "(", "\"Found Carousel next page navigation - \"", "+", "el", "+", "(", "el", ".", "id", "?", "\" (#\"", "+", "el", ".", "id", "+", "\")\"", ":", "\"\"", ")", ",", "WidgetName", ")", ";", "if", "(", "el", ".", "nodeName", "==", "\"INPUT\"", "||", "el", ".", "nodeName", "==", "\"BUTTON\"", "||", "el", ".", "nodeName", "==", "\"A\"", ")", "{", "// Anchor support in Nav (for SEO)", "carousel", ".", "_navBtns", ".", "next", ".", "push", "(", "el", ")", ";", "}", "else", "{", "j", "=", "el", ".", "getElementsByTagName", "(", "\"INPUT\"", ")", ";", "if", "(", "JS", ".", "isArray", "(", "j", ")", "&&", "j", ".", "length", ">", "0", ")", "{", "carousel", ".", "_navBtns", ".", "next", ".", "push", "(", "j", "[", "0", "]", ")", ";", "}", "else", "{", "j", "=", "el", ".", "getElementsByTagName", "(", "\"BUTTON\"", ")", ";", "if", "(", "JS", ".", "isArray", "(", "j", ")", "&&", "j", ".", "length", ">", "0", ")", "{", "carousel", ".", "_navBtns", ".", "next", ".", "push", "(", "j", "[", "0", "]", ")", ";", "}", "}", "}", "}", "}", "if", "(", "cfg", ")", "{", "cfg", ".", "next", "=", "nav", ";", "}", "else", "{", "cfg", "=", "{", "next", ":", "nav", "}", ";", "}", "}", "if", "(", "cfg", ")", "{", "carousel", ".", "set", "(", "\"navigation\"", ",", "cfg", ")", ";", "rv", "=", "true", ";", "}", "return", "rv", ";", "}" ]
Find the Carousel navigation within a container. The navigation elements need to match the carousel navigation class names. @method parseCarouselNavigation @param parent {HTMLElement} The parent element to look under @return {Boolean} True if at least one is found, false otherwise @protected
[ "Find", "the", "Carousel", "navigation", "within", "a", "container", ".", "The", "navigation", "elements", "need", "to", "match", "the", "carousel", "navigation", "class", "names", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3263-L3339
42,871
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, i, isVertical = carousel.get("isVertical"), firstVisible = carousel.get("firstVisible"), item, n, rsz, sz; if (carousel._itemsTable.numItems < 1) { return; } sz = getCarouselItemSize.call(carousel, isVertical ? "height" : "width"); // This fixes the widget to auto-adjust height/width for absolute // positioned children. item = carousel._itemsTable.items[firstVisible].id; sz = isVertical ? getStyle(item, "width") : getStyle(item, "height"); Dom.setStyle(carousel._carouselEl, isVertical ? "width" : "height", sz + "px"); // Set the rendered state appropriately. carousel._hasRendered = true; carousel.fireEvent(renderEvent); }
javascript
function () { var carousel = this, i, isVertical = carousel.get("isVertical"), firstVisible = carousel.get("firstVisible"), item, n, rsz, sz; if (carousel._itemsTable.numItems < 1) { return; } sz = getCarouselItemSize.call(carousel, isVertical ? "height" : "width"); // This fixes the widget to auto-adjust height/width for absolute // positioned children. item = carousel._itemsTable.items[firstVisible].id; sz = isVertical ? getStyle(item, "width") : getStyle(item, "height"); Dom.setStyle(carousel._carouselEl, isVertical ? "width" : "height", sz + "px"); // Set the rendered state appropriately. carousel._hasRendered = true; carousel.fireEvent(renderEvent); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "i", ",", "isVertical", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", ",", "firstVisible", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ",", "item", ",", "n", ",", "rsz", ",", "sz", ";", "if", "(", "carousel", ".", "_itemsTable", ".", "numItems", "<", "1", ")", "{", "return", ";", "}", "sz", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "isVertical", "?", "\"height\"", ":", "\"width\"", ")", ";", "// This fixes the widget to auto-adjust height/width for absolute", "// positioned children.", "item", "=", "carousel", ".", "_itemsTable", ".", "items", "[", "firstVisible", "]", ".", "id", ";", "sz", "=", "isVertical", "?", "getStyle", "(", "item", ",", "\"width\"", ")", ":", "getStyle", "(", "item", ",", "\"height\"", ")", ";", "Dom", ".", "setStyle", "(", "carousel", ".", "_carouselEl", ",", "isVertical", "?", "\"width\"", ":", "\"height\"", ",", "sz", "+", "\"px\"", ")", ";", "// Set the rendered state appropriately.", "carousel", ".", "_hasRendered", "=", "true", ";", "carousel", ".", "fireEvent", "(", "renderEvent", ")", ";", "}" ]
Refresh the widget UI if it is not already rendered, on first item addition. @method _refreshUi @protected
[ "Refresh", "the", "widget", "UI", "if", "it", "is", "not", "already", "rendered", "on", "first", "item", "addition", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3348-L3370
42,872
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (offset) { var carousel = this, which; which = carousel.get("isVertical") ? "top" : "left"; Dom.setStyle(carousel._carouselEl, which, offset + "px"); }
javascript
function (offset) { var carousel = this, which; which = carousel.get("isVertical") ? "top" : "left"; Dom.setStyle(carousel._carouselEl, which, offset + "px"); }
[ "function", "(", "offset", ")", "{", "var", "carousel", "=", "this", ",", "which", ";", "which", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", "?", "\"top\"", ":", "\"left\"", ";", "Dom", ".", "setStyle", "(", "carousel", ".", "_carouselEl", ",", "which", ",", "offset", "+", "\"px\"", ")", ";", "}" ]
Set the Carousel offset to the passed offset. @method _setCarouselOffset @protected
[ "Set", "the", "Carousel", "offset", "to", "the", "passed", "offset", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3378-L3383
42,873
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (clip, attr) { var carousel = this, config = carousel.CONFIG, cssClass = carousel.CLASSES, isVertical, rows, cols, size; isVertical = carousel.get("isVertical"); rows = carousel._rows; cols = carousel._cols; clip = clip || carousel._clipEl; attr = attr || (isVertical ? "height" : "width"); size = parseFloat(Dom.getStyle(clip, attr), 10); size = JS.isNumber(size) ? size : 0; if (isVertical) { size += getDimensions(carousel._carouselEl, "height") + getStyle(carousel._navEl, "height"); } else { size += getDimensions(carousel._carouselEl, "width"); } if (!isVertical) { if (size < config.HORZ_MIN_WIDTH) { size = config.HORZ_MIN_WIDTH; carousel.addClass(cssClass.MIN_WIDTH); } } carousel.setStyle(attr, size + "px"); // Additionally the width of the container should be set for // the vertical Carousel if (isVertical) { size = getCarouselItemSize.call(carousel, "width"); if(cols) { size = size * cols; } Dom.setStyle(carousel._carouselEl, "width", size + "px");// Bug fix for vertical carousel (goes in conjunction with .yui-carousel-element {... 3200px removed from styles), and allows for multirows in IEs). if (size < config.VERT_MIN_WIDTH) { size = config.VERT_MIN_WIDTH; carousel.addClass(cssClass.MIN_WIDTH);// set a min width on vertical carousel, don't see why this shouldn't always be set... } carousel.setStyle("width", size + "px"); } else { if(rows) { size = getCarouselItemSize.call(carousel, "height"); size = size * rows; Dom.setStyle(carousel._carouselEl, "height", size + "px"); } } }
javascript
function (clip, attr) { var carousel = this, config = carousel.CONFIG, cssClass = carousel.CLASSES, isVertical, rows, cols, size; isVertical = carousel.get("isVertical"); rows = carousel._rows; cols = carousel._cols; clip = clip || carousel._clipEl; attr = attr || (isVertical ? "height" : "width"); size = parseFloat(Dom.getStyle(clip, attr), 10); size = JS.isNumber(size) ? size : 0; if (isVertical) { size += getDimensions(carousel._carouselEl, "height") + getStyle(carousel._navEl, "height"); } else { size += getDimensions(carousel._carouselEl, "width"); } if (!isVertical) { if (size < config.HORZ_MIN_WIDTH) { size = config.HORZ_MIN_WIDTH; carousel.addClass(cssClass.MIN_WIDTH); } } carousel.setStyle(attr, size + "px"); // Additionally the width of the container should be set for // the vertical Carousel if (isVertical) { size = getCarouselItemSize.call(carousel, "width"); if(cols) { size = size * cols; } Dom.setStyle(carousel._carouselEl, "width", size + "px");// Bug fix for vertical carousel (goes in conjunction with .yui-carousel-element {... 3200px removed from styles), and allows for multirows in IEs). if (size < config.VERT_MIN_WIDTH) { size = config.VERT_MIN_WIDTH; carousel.addClass(cssClass.MIN_WIDTH);// set a min width on vertical carousel, don't see why this shouldn't always be set... } carousel.setStyle("width", size + "px"); } else { if(rows) { size = getCarouselItemSize.call(carousel, "height"); size = size * rows; Dom.setStyle(carousel._carouselEl, "height", size + "px"); } } }
[ "function", "(", "clip", ",", "attr", ")", "{", "var", "carousel", "=", "this", ",", "config", "=", "carousel", ".", "CONFIG", ",", "cssClass", "=", "carousel", ".", "CLASSES", ",", "isVertical", ",", "rows", ",", "cols", ",", "size", ";", "isVertical", "=", "carousel", ".", "get", "(", "\"isVertical\"", ")", ";", "rows", "=", "carousel", ".", "_rows", ";", "cols", "=", "carousel", ".", "_cols", ";", "clip", "=", "clip", "||", "carousel", ".", "_clipEl", ";", "attr", "=", "attr", "||", "(", "isVertical", "?", "\"height\"", ":", "\"width\"", ")", ";", "size", "=", "parseFloat", "(", "Dom", ".", "getStyle", "(", "clip", ",", "attr", ")", ",", "10", ")", ";", "size", "=", "JS", ".", "isNumber", "(", "size", ")", "?", "size", ":", "0", ";", "if", "(", "isVertical", ")", "{", "size", "+=", "getDimensions", "(", "carousel", ".", "_carouselEl", ",", "\"height\"", ")", "+", "getStyle", "(", "carousel", ".", "_navEl", ",", "\"height\"", ")", ";", "}", "else", "{", "size", "+=", "getDimensions", "(", "carousel", ".", "_carouselEl", ",", "\"width\"", ")", ";", "}", "if", "(", "!", "isVertical", ")", "{", "if", "(", "size", "<", "config", ".", "HORZ_MIN_WIDTH", ")", "{", "size", "=", "config", ".", "HORZ_MIN_WIDTH", ";", "carousel", ".", "addClass", "(", "cssClass", ".", "MIN_WIDTH", ")", ";", "}", "}", "carousel", ".", "setStyle", "(", "attr", ",", "size", "+", "\"px\"", ")", ";", "// Additionally the width of the container should be set for", "// the vertical Carousel", "if", "(", "isVertical", ")", "{", "size", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "\"width\"", ")", ";", "if", "(", "cols", ")", "{", "size", "=", "size", "*", "cols", ";", "}", "Dom", ".", "setStyle", "(", "carousel", ".", "_carouselEl", ",", "\"width\"", ",", "size", "+", "\"px\"", ")", ";", "// Bug fix for vertical carousel (goes in conjunction with .yui-carousel-element {... 3200px removed from styles), and allows for multirows in IEs).", "if", "(", "size", "<", "config", ".", "VERT_MIN_WIDTH", ")", "{", "size", "=", "config", ".", "VERT_MIN_WIDTH", ";", "carousel", ".", "addClass", "(", "cssClass", ".", "MIN_WIDTH", ")", ";", "// set a min width on vertical carousel, don't see why this shouldn't always be set...", "}", "carousel", ".", "setStyle", "(", "\"width\"", ",", "size", "+", "\"px\"", ")", ";", "}", "else", "{", "if", "(", "rows", ")", "{", "size", "=", "getCarouselItemSize", ".", "call", "(", "carousel", ",", "\"height\"", ")", ";", "size", "=", "size", "*", "rows", ";", "Dom", ".", "setStyle", "(", "carousel", ".", "_carouselEl", ",", "\"height\"", ",", "size", "+", "\"px\"", ")", ";", "}", "}", "}" ]
Set the container size. @method _setContainerSize @param clip {HTMLElement} The clip container element. @param attr {String} Either set the height or width. @protected
[ "Set", "the", "container", "size", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3556-L3609
42,874
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this; if (val >= 0 && val < carousel.get("numItems")) { carousel.scrollTo(val); } else { val = carousel.get("firstVisible"); } return val; }
javascript
function (val) { var carousel = this; if (val >= 0 && val < carousel.get("numItems")) { carousel.scrollTo(val); } else { val = carousel.get("firstVisible"); } return val; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "val", ">=", "0", "&&", "val", "<", "carousel", ".", "get", "(", "\"numItems\"", ")", ")", "{", "carousel", ".", "scrollTo", "(", "val", ")", ";", "}", "else", "{", "val", "=", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ";", "}", "return", "val", ";", "}" ]
Set the value for the Carousel's first visible item. @method _setFirstVisible @param val {Number} The new value for firstVisible @return {Number} The new value that would be set @protected
[ "Set", "the", "value", "for", "the", "Carousel", "s", "first", "visible", "item", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3619-L3628
42,875
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (cfg) { var carousel = this; if (cfg.prev) { Event.on(cfg.prev, "click", scrollPageBackward, carousel); } if (cfg.next) { Event.on(cfg.next, "click", scrollPageForward, carousel); } }
javascript
function (cfg) { var carousel = this; if (cfg.prev) { Event.on(cfg.prev, "click", scrollPageBackward, carousel); } if (cfg.next) { Event.on(cfg.next, "click", scrollPageForward, carousel); } }
[ "function", "(", "cfg", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "cfg", ".", "prev", ")", "{", "Event", ".", "on", "(", "cfg", ".", "prev", ",", "\"click\"", ",", "scrollPageBackward", ",", "carousel", ")", ";", "}", "if", "(", "cfg", ".", "next", ")", "{", "Event", ".", "on", "(", "cfg", ".", "next", ",", "\"click\"", ",", "scrollPageForward", ",", "carousel", ")", ";", "}", "}" ]
Set the value for the Carousel's navigation. @method _setNavigation @param cfg {Object} The navigation configuration @return {Object} The new value that would be set @protected
[ "Set", "the", "value", "for", "the", "Carousel", "s", "navigation", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3638-L3647
42,876
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this, numVisible = val; if(JS.isArray(val)) { carousel._cols = val[0]; carousel._rows = val[1]; numVisible = val[0] * val[1]; } return numVisible; }
javascript
function (val) { var carousel = this, numVisible = val; if(JS.isArray(val)) { carousel._cols = val[0]; carousel._rows = val[1]; numVisible = val[0] * val[1]; } return numVisible; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ",", "numVisible", "=", "val", ";", "if", "(", "JS", ".", "isArray", "(", "val", ")", ")", "{", "carousel", ".", "_cols", "=", "val", "[", "0", "]", ";", "carousel", ".", "_rows", "=", "val", "[", "1", "]", ";", "numVisible", "=", "val", "[", "0", "]", "*", "val", "[", "1", "]", ";", "}", "return", "numVisible", ";", "}" ]
Set the value for the number of visible items in the Carousel. @method _numVisibleSetter @param val {Number} The new value for numVisible @return {Number} The new value that would be set @protected
[ "Set", "the", "value", "for", "the", "number", "of", "visible", "items", "in", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3671-L3681
42,877
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this, cssClass = carousel.CLASSES; if (val) { carousel.replaceClass(cssClass.HORIZONTAL, cssClass.VERTICAL); } else { carousel.replaceClass(cssClass.VERTICAL, cssClass.HORIZONTAL); } this._itemAttrCache = {}; // force recomputed next time return val; }
javascript
function (val) { var carousel = this, cssClass = carousel.CLASSES; if (val) { carousel.replaceClass(cssClass.HORIZONTAL, cssClass.VERTICAL); } else { carousel.replaceClass(cssClass.VERTICAL, cssClass.HORIZONTAL); } this._itemAttrCache = {}; // force recomputed next time return val; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ",", "cssClass", "=", "carousel", ".", "CLASSES", ";", "if", "(", "val", ")", "{", "carousel", ".", "replaceClass", "(", "cssClass", ".", "HORIZONTAL", ",", "cssClass", ".", "VERTICAL", ")", ";", "}", "else", "{", "carousel", ".", "replaceClass", "(", "cssClass", ".", "VERTICAL", ",", "cssClass", ".", "HORIZONTAL", ")", ";", "}", "this", ".", "_itemAttrCache", "=", "{", "}", ";", "// force recomputed next time", "return", "val", ";", "}" ]
Set the orientation of the Carousel. @method _setOrientation @param val {Boolean} The new value for isVertical @return {Boolean} The new value that would be set @protected
[ "Set", "the", "orientation", "of", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3735-L3747
42,878
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this; if (val >= 0 && val <= 100) { val = parseInt(val, 10); val = JS.isNumber(val) ? val : 0; carousel._setClipContainerSize(); } else { val = carousel.get("revealAmount"); } return val; }
javascript
function (val) { var carousel = this; if (val >= 0 && val <= 100) { val = parseInt(val, 10); val = JS.isNumber(val) ? val : 0; carousel._setClipContainerSize(); } else { val = carousel.get("revealAmount"); } return val; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "val", ">=", "0", "&&", "val", "<=", "100", ")", "{", "val", "=", "parseInt", "(", "val", ",", "10", ")", ";", "val", "=", "JS", ".", "isNumber", "(", "val", ")", "?", "val", ":", "0", ";", "carousel", ".", "_setClipContainerSize", "(", ")", ";", "}", "else", "{", "val", "=", "carousel", ".", "get", "(", "\"revealAmount\"", ")", ";", "}", "return", "val", ";", "}" ]
Set the value for the reveal amount percentage in the Carousel. @method _setRevealAmount @param val {Number} The new value for revealAmount @return {Number} The new value that would be set @protected
[ "Set", "the", "value", "for", "the", "reveal", "amount", "percentage", "in", "the", "Carousel", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3757-L3768
42,879
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this; return carousel.get("currentPage") + 1 == carousel.get("numPages") ? carousel.get("numItems") - 1: carousel.get("firstVisible") + carousel.get("numVisible") - 1; }
javascript
function () { var carousel = this; return carousel.get("currentPage") + 1 == carousel.get("numPages") ? carousel.get("numItems") - 1: carousel.get("firstVisible") + carousel.get("numVisible") - 1; }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ";", "return", "carousel", ".", "get", "(", "\"currentPage\"", ")", "+", "1", "==", "carousel", ".", "get", "(", "\"numPages\"", ")", "?", "carousel", ".", "get", "(", "\"numItems\"", ")", "-", "1", ":", "carousel", ".", "get", "(", "\"firstVisible\"", ")", "+", "carousel", ".", "get", "(", "\"numVisible\"", ")", "-", "1", ";", "}" ]
Get the index of the last visible item @method _getLastVisible @protected
[ "Get", "the", "index", "of", "the", "last", "visible", "item" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3799-L3804
42,880
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (obj) { var attr, carousel = this, carouselEl = carousel._carouselEl, el, item, itemsTable = carousel._itemsTable, oel, pos, sibling, styles; pos = JS.isUndefined(obj.pos) ? obj.newPos || itemsTable.numItems - 1 : obj.pos; if (!oel) { item = itemsTable.items[pos] || {}; el = carousel._createCarouselItem({ className : item.className, styles : item.styles, content : item.item, id : item.id, pos : pos }); if (JS.isUndefined(obj.pos)) { if (!JS.isUndefined(itemsTable.loading[pos])) { oel = itemsTable.loading[pos]; // if oel is null, it is a problem ... } if (oel) { // replace the node carouselEl.replaceChild(el, oel); // ... and remove the item from the data structure delete itemsTable.loading[pos]; } else { carouselEl.appendChild(el); } } else { if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) { sibling = Dom.get(itemsTable.items[obj.pos + 1].id); } if (sibling) { carouselEl.insertBefore(el, sibling); } else { YAHOO.log("Unable to find sibling","error",WidgetName); } } } else { if (JS.isUndefined(obj.pos)) { if (!Dom.isAncestor(carousel._carouselEl, oel)) { carouselEl.appendChild(oel); } } else { if (!Dom.isAncestor(carouselEl, oel)) { if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) { carouselEl.insertBefore(oel, Dom.get(itemsTable.items[obj.pos + 1].id)); } } } } if (!carousel._hasRendered) { carousel._refreshUi(); } if (carousel.get("selectedItem") < 0) { carousel.set("selectedItem", carousel.get("firstVisible")); } carousel._syncUiItems(); }
javascript
function (obj) { var attr, carousel = this, carouselEl = carousel._carouselEl, el, item, itemsTable = carousel._itemsTable, oel, pos, sibling, styles; pos = JS.isUndefined(obj.pos) ? obj.newPos || itemsTable.numItems - 1 : obj.pos; if (!oel) { item = itemsTable.items[pos] || {}; el = carousel._createCarouselItem({ className : item.className, styles : item.styles, content : item.item, id : item.id, pos : pos }); if (JS.isUndefined(obj.pos)) { if (!JS.isUndefined(itemsTable.loading[pos])) { oel = itemsTable.loading[pos]; // if oel is null, it is a problem ... } if (oel) { // replace the node carouselEl.replaceChild(el, oel); // ... and remove the item from the data structure delete itemsTable.loading[pos]; } else { carouselEl.appendChild(el); } } else { if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) { sibling = Dom.get(itemsTable.items[obj.pos + 1].id); } if (sibling) { carouselEl.insertBefore(el, sibling); } else { YAHOO.log("Unable to find sibling","error",WidgetName); } } } else { if (JS.isUndefined(obj.pos)) { if (!Dom.isAncestor(carousel._carouselEl, oel)) { carouselEl.appendChild(oel); } } else { if (!Dom.isAncestor(carouselEl, oel)) { if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) { carouselEl.insertBefore(oel, Dom.get(itemsTable.items[obj.pos + 1].id)); } } } } if (!carousel._hasRendered) { carousel._refreshUi(); } if (carousel.get("selectedItem") < 0) { carousel.set("selectedItem", carousel.get("firstVisible")); } carousel._syncUiItems(); }
[ "function", "(", "obj", ")", "{", "var", "attr", ",", "carousel", "=", "this", ",", "carouselEl", "=", "carousel", ".", "_carouselEl", ",", "el", ",", "item", ",", "itemsTable", "=", "carousel", ".", "_itemsTable", ",", "oel", ",", "pos", ",", "sibling", ",", "styles", ";", "pos", "=", "JS", ".", "isUndefined", "(", "obj", ".", "pos", ")", "?", "obj", ".", "newPos", "||", "itemsTable", ".", "numItems", "-", "1", ":", "obj", ".", "pos", ";", "if", "(", "!", "oel", ")", "{", "item", "=", "itemsTable", ".", "items", "[", "pos", "]", "||", "{", "}", ";", "el", "=", "carousel", ".", "_createCarouselItem", "(", "{", "className", ":", "item", ".", "className", ",", "styles", ":", "item", ".", "styles", ",", "content", ":", "item", ".", "item", ",", "id", ":", "item", ".", "id", ",", "pos", ":", "pos", "}", ")", ";", "if", "(", "JS", ".", "isUndefined", "(", "obj", ".", "pos", ")", ")", "{", "if", "(", "!", "JS", ".", "isUndefined", "(", "itemsTable", ".", "loading", "[", "pos", "]", ")", ")", "{", "oel", "=", "itemsTable", ".", "loading", "[", "pos", "]", ";", "// if oel is null, it is a problem ...", "}", "if", "(", "oel", ")", "{", "// replace the node", "carouselEl", ".", "replaceChild", "(", "el", ",", "oel", ")", ";", "// ... and remove the item from the data structure", "delete", "itemsTable", ".", "loading", "[", "pos", "]", ";", "}", "else", "{", "carouselEl", ".", "appendChild", "(", "el", ")", ";", "}", "}", "else", "{", "if", "(", "!", "JS", ".", "isUndefined", "(", "itemsTable", ".", "items", "[", "obj", ".", "pos", "+", "1", "]", ")", ")", "{", "sibling", "=", "Dom", ".", "get", "(", "itemsTable", ".", "items", "[", "obj", ".", "pos", "+", "1", "]", ".", "id", ")", ";", "}", "if", "(", "sibling", ")", "{", "carouselEl", ".", "insertBefore", "(", "el", ",", "sibling", ")", ";", "}", "else", "{", "YAHOO", ".", "log", "(", "\"Unable to find sibling\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "}", "}", "}", "else", "{", "if", "(", "JS", ".", "isUndefined", "(", "obj", ".", "pos", ")", ")", "{", "if", "(", "!", "Dom", ".", "isAncestor", "(", "carousel", ".", "_carouselEl", ",", "oel", ")", ")", "{", "carouselEl", ".", "appendChild", "(", "oel", ")", ";", "}", "}", "else", "{", "if", "(", "!", "Dom", ".", "isAncestor", "(", "carouselEl", ",", "oel", ")", ")", "{", "if", "(", "!", "JS", ".", "isUndefined", "(", "itemsTable", ".", "items", "[", "obj", ".", "pos", "+", "1", "]", ")", ")", "{", "carouselEl", ".", "insertBefore", "(", "oel", ",", "Dom", ".", "get", "(", "itemsTable", ".", "items", "[", "obj", ".", "pos", "+", "1", "]", ".", "id", ")", ")", ";", "}", "}", "}", "}", "if", "(", "!", "carousel", ".", "_hasRendered", ")", "{", "carousel", ".", "_refreshUi", "(", ")", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "<", "0", ")", "{", "carousel", ".", "set", "(", "\"selectedItem\"", ",", "carousel", ".", "get", "(", "\"firstVisible\"", ")", ")", ";", "}", "carousel", ".", "_syncUiItems", "(", ")", ";", "}" ]
Synchronize and redraw the UI after an item is added. @method _syncUiForItemAdd @protected
[ "Synchronize", "and", "redraw", "the", "UI", "after", "an", "item", "is", "added", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3812-L3883
42,881
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (o) { var carousel = this, carouselEl = carousel._carouselEl, itemsTable = carousel._itemsTable, pos = o.pos, item = o.newItem, oel = o.oldItem, el; el = carousel._createCarouselItem({ className : item.className, styles : item.styles, content : item.item, id : item.id, pos : pos }); if(el && oel) { Event.purgeElement(oel, true); carouselEl.replaceChild(el, Dom.get(oel.id)); if (!JS.isUndefined(itemsTable.loading[pos])) { itemsTable.numItems++; delete itemsTable.loading[pos]; } } // TODO: should we add the item if oel is undefined? if (!carousel._hasRendered) { carousel._refreshUi(); } carousel._syncUiItems(); }
javascript
function (o) { var carousel = this, carouselEl = carousel._carouselEl, itemsTable = carousel._itemsTable, pos = o.pos, item = o.newItem, oel = o.oldItem, el; el = carousel._createCarouselItem({ className : item.className, styles : item.styles, content : item.item, id : item.id, pos : pos }); if(el && oel) { Event.purgeElement(oel, true); carouselEl.replaceChild(el, Dom.get(oel.id)); if (!JS.isUndefined(itemsTable.loading[pos])) { itemsTable.numItems++; delete itemsTable.loading[pos]; } } // TODO: should we add the item if oel is undefined? if (!carousel._hasRendered) { carousel._refreshUi(); } carousel._syncUiItems(); }
[ "function", "(", "o", ")", "{", "var", "carousel", "=", "this", ",", "carouselEl", "=", "carousel", ".", "_carouselEl", ",", "itemsTable", "=", "carousel", ".", "_itemsTable", ",", "pos", "=", "o", ".", "pos", ",", "item", "=", "o", ".", "newItem", ",", "oel", "=", "o", ".", "oldItem", ",", "el", ";", "el", "=", "carousel", ".", "_createCarouselItem", "(", "{", "className", ":", "item", ".", "className", ",", "styles", ":", "item", ".", "styles", ",", "content", ":", "item", ".", "item", ",", "id", ":", "item", ".", "id", ",", "pos", ":", "pos", "}", ")", ";", "if", "(", "el", "&&", "oel", ")", "{", "Event", ".", "purgeElement", "(", "oel", ",", "true", ")", ";", "carouselEl", ".", "replaceChild", "(", "el", ",", "Dom", ".", "get", "(", "oel", ".", "id", ")", ")", ";", "if", "(", "!", "JS", ".", "isUndefined", "(", "itemsTable", ".", "loading", "[", "pos", "]", ")", ")", "{", "itemsTable", ".", "numItems", "++", ";", "delete", "itemsTable", ".", "loading", "[", "pos", "]", ";", "}", "}", "// TODO: should we add the item if oel is undefined?", "if", "(", "!", "carousel", ".", "_hasRendered", ")", "{", "carousel", ".", "_refreshUi", "(", ")", ";", "}", "carousel", ".", "_syncUiItems", "(", ")", ";", "}" ]
Synchronize and redraw the UI after an item is replaced. @method _syncUiForItemReplace @protected
[ "Synchronize", "and", "redraw", "the", "UI", "after", "an", "item", "is", "replaced", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3891-L3923
42,882
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (obj) { var carousel = this, carouselEl = carousel._carouselEl, el, item, num, pos; num = carousel.get("numItems"); item = obj.item; pos = obj.pos; if (item && (el = Dom.get(item.id))) { if (el && Dom.isAncestor(carouselEl, el)) { Event.purgeElement(el, true); carouselEl.removeChild(el); } if (carousel.get("selectedItem") == pos) { pos = pos >= num ? num - 1 : pos; } } else { YAHOO.log("Unable to find item", "warn", WidgetName); } carousel._syncUiItems(); }
javascript
function (obj) { var carousel = this, carouselEl = carousel._carouselEl, el, item, num, pos; num = carousel.get("numItems"); item = obj.item; pos = obj.pos; if (item && (el = Dom.get(item.id))) { if (el && Dom.isAncestor(carouselEl, el)) { Event.purgeElement(el, true); carouselEl.removeChild(el); } if (carousel.get("selectedItem") == pos) { pos = pos >= num ? num - 1 : pos; } } else { YAHOO.log("Unable to find item", "warn", WidgetName); } carousel._syncUiItems(); }
[ "function", "(", "obj", ")", "{", "var", "carousel", "=", "this", ",", "carouselEl", "=", "carousel", ".", "_carouselEl", ",", "el", ",", "item", ",", "num", ",", "pos", ";", "num", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ";", "item", "=", "obj", ".", "item", ";", "pos", "=", "obj", ".", "pos", ";", "if", "(", "item", "&&", "(", "el", "=", "Dom", ".", "get", "(", "item", ".", "id", ")", ")", ")", "{", "if", "(", "el", "&&", "Dom", ".", "isAncestor", "(", "carouselEl", ",", "el", ")", ")", "{", "Event", ".", "purgeElement", "(", "el", ",", "true", ")", ";", "carouselEl", ".", "removeChild", "(", "el", ")", ";", "}", "if", "(", "carousel", ".", "get", "(", "\"selectedItem\"", ")", "==", "pos", ")", "{", "pos", "=", "pos", ">=", "num", "?", "num", "-", "1", ":", "pos", ";", "}", "}", "else", "{", "YAHOO", ".", "log", "(", "\"Unable to find item\"", ",", "\"warn\"", ",", "WidgetName", ")", ";", "}", "carousel", ".", "_syncUiItems", "(", ")", ";", "}" ]
Synchronize and redraw the UI after an item is removed. @method _syncUiForItemAdd @protected
[ "Synchronize", "and", "redraw", "the", "UI", "after", "an", "item", "is", "removed", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3931-L3954
42,883
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (obj) { var carousel = this, carouselEl = carousel._carouselEl, itemsTable = carousel._itemsTable, len = itemsTable.items.length, sibling = itemsTable.items[obj.last + 1], el, j; // attempt to find the next closest sibling if(!sibling && obj.last < len){ j = obj.first; do { sibling = itemsTable.items[j]; j++; } while (j<len && !sibling); } for (var i = obj.first; i <= obj.last; i++) { if(JS.isUndefined(itemsTable.loading[i]) && JS.isUndefined(itemsTable.items[i])){ el = carousel._createCarouselItem({ className : carousel.CLASSES.ITEM_LOADING, content : carousel.STRINGS.ITEM_LOADING_CONTENT, id : Dom.generateId(), pos : i }); if (el) { if (sibling) { sibling = Dom.get(sibling.id); if (sibling) { carouselEl.insertBefore(el, sibling); } else { YAHOO.log("Unable to find sibling", "error", WidgetName); } } else { carouselEl.appendChild(el); } } itemsTable.loading[i] = el; } } carousel._syncUiItems(); }
javascript
function (obj) { var carousel = this, carouselEl = carousel._carouselEl, itemsTable = carousel._itemsTable, len = itemsTable.items.length, sibling = itemsTable.items[obj.last + 1], el, j; // attempt to find the next closest sibling if(!sibling && obj.last < len){ j = obj.first; do { sibling = itemsTable.items[j]; j++; } while (j<len && !sibling); } for (var i = obj.first; i <= obj.last; i++) { if(JS.isUndefined(itemsTable.loading[i]) && JS.isUndefined(itemsTable.items[i])){ el = carousel._createCarouselItem({ className : carousel.CLASSES.ITEM_LOADING, content : carousel.STRINGS.ITEM_LOADING_CONTENT, id : Dom.generateId(), pos : i }); if (el) { if (sibling) { sibling = Dom.get(sibling.id); if (sibling) { carouselEl.insertBefore(el, sibling); } else { YAHOO.log("Unable to find sibling", "error", WidgetName); } } else { carouselEl.appendChild(el); } } itemsTable.loading[i] = el; } } carousel._syncUiItems(); }
[ "function", "(", "obj", ")", "{", "var", "carousel", "=", "this", ",", "carouselEl", "=", "carousel", ".", "_carouselEl", ",", "itemsTable", "=", "carousel", ".", "_itemsTable", ",", "len", "=", "itemsTable", ".", "items", ".", "length", ",", "sibling", "=", "itemsTable", ".", "items", "[", "obj", ".", "last", "+", "1", "]", ",", "el", ",", "j", ";", "// attempt to find the next closest sibling", "if", "(", "!", "sibling", "&&", "obj", ".", "last", "<", "len", ")", "{", "j", "=", "obj", ".", "first", ";", "do", "{", "sibling", "=", "itemsTable", ".", "items", "[", "j", "]", ";", "j", "++", ";", "}", "while", "(", "j", "<", "len", "&&", "!", "sibling", ")", ";", "}", "for", "(", "var", "i", "=", "obj", ".", "first", ";", "i", "<=", "obj", ".", "last", ";", "i", "++", ")", "{", "if", "(", "JS", ".", "isUndefined", "(", "itemsTable", ".", "loading", "[", "i", "]", ")", "&&", "JS", ".", "isUndefined", "(", "itemsTable", ".", "items", "[", "i", "]", ")", ")", "{", "el", "=", "carousel", ".", "_createCarouselItem", "(", "{", "className", ":", "carousel", ".", "CLASSES", ".", "ITEM_LOADING", ",", "content", ":", "carousel", ".", "STRINGS", ".", "ITEM_LOADING_CONTENT", ",", "id", ":", "Dom", ".", "generateId", "(", ")", ",", "pos", ":", "i", "}", ")", ";", "if", "(", "el", ")", "{", "if", "(", "sibling", ")", "{", "sibling", "=", "Dom", ".", "get", "(", "sibling", ".", "id", ")", ";", "if", "(", "sibling", ")", "{", "carouselEl", ".", "insertBefore", "(", "el", ",", "sibling", ")", ";", "}", "else", "{", "YAHOO", ".", "log", "(", "\"Unable to find sibling\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "}", "}", "else", "{", "carouselEl", ".", "appendChild", "(", "el", ")", ";", "}", "}", "itemsTable", ".", "loading", "[", "i", "]", "=", "el", ";", "}", "}", "carousel", ".", "_syncUiItems", "(", ")", ";", "}" ]
Synchronize and redraw the UI for lazy loading. @method _syncUiForLazyLoading @protected
[ "Synchronize", "and", "redraw", "the", "UI", "for", "lazy", "loading", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L3962-L4006
42,884
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var attr, carousel = this, numItems = carousel.get("numItems"), i, itemsTable = carousel._itemsTable, items = itemsTable.items, loading = itemsTable.loading, item, styles; for (i = 0; i < numItems; i++) { item = items[i] || loading[i]; if (item && item.id) { styles = getCarouselItemPosition.call(carousel, i); item.styles = item.styles || {}; for (attr in styles) { if (styles.hasOwnProperty(attr)) { item.styles[attr] = styles[attr]; } } setStyles(Dom.get(item.id), styles); } } }
javascript
function () { var attr, carousel = this, numItems = carousel.get("numItems"), i, itemsTable = carousel._itemsTable, items = itemsTable.items, loading = itemsTable.loading, item, styles; for (i = 0; i < numItems; i++) { item = items[i] || loading[i]; if (item && item.id) { styles = getCarouselItemPosition.call(carousel, i); item.styles = item.styles || {}; for (attr in styles) { if (styles.hasOwnProperty(attr)) { item.styles[attr] = styles[attr]; } } setStyles(Dom.get(item.id), styles); } } }
[ "function", "(", ")", "{", "var", "attr", ",", "carousel", "=", "this", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ",", "i", ",", "itemsTable", "=", "carousel", ".", "_itemsTable", ",", "items", "=", "itemsTable", ".", "items", ",", "loading", "=", "itemsTable", ".", "loading", ",", "item", ",", "styles", ";", "for", "(", "i", "=", "0", ";", "i", "<", "numItems", ";", "i", "++", ")", "{", "item", "=", "items", "[", "i", "]", "||", "loading", "[", "i", "]", ";", "if", "(", "item", "&&", "item", ".", "id", ")", "{", "styles", "=", "getCarouselItemPosition", ".", "call", "(", "carousel", ",", "i", ")", ";", "item", ".", "styles", "=", "item", ".", "styles", "||", "{", "}", ";", "for", "(", "attr", "in", "styles", ")", "{", "if", "(", "styles", ".", "hasOwnProperty", "(", "attr", ")", ")", "{", "item", ".", "styles", "[", "attr", "]", "=", "styles", "[", "attr", "]", ";", "}", "}", "setStyles", "(", "Dom", ".", "get", "(", "item", ".", "id", ")", ",", "styles", ")", ";", "}", "}", "}" ]
Redraw the UI for item positioning. @method _syncUiItems @protected
[ "Redraw", "the", "UI", "for", "item", "positioning", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4014-L4039
42,885
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (el, setFocus) { var children, cssClass = this.CLASSES, grandParent, parent = el.parentNode; if (!parent) { return; } grandParent = parent.parentNode; if (el.nodeName.toUpperCase() == "BUTTON" && Dom.hasClass(parent, cssClass.BUTTON)) { if (setFocus) { if (grandParent) { children = Dom.getChildren(grandParent); if (children) { Dom.removeClass(children, cssClass.FOCUSSED_BUTTON); } } Dom.addClass(parent, cssClass.FOCUSSED_BUTTON); } else { Dom.removeClass(parent, cssClass.FOCUSSED_BUTTON); } } }
javascript
function (el, setFocus) { var children, cssClass = this.CLASSES, grandParent, parent = el.parentNode; if (!parent) { return; } grandParent = parent.parentNode; if (el.nodeName.toUpperCase() == "BUTTON" && Dom.hasClass(parent, cssClass.BUTTON)) { if (setFocus) { if (grandParent) { children = Dom.getChildren(grandParent); if (children) { Dom.removeClass(children, cssClass.FOCUSSED_BUTTON); } } Dom.addClass(parent, cssClass.FOCUSSED_BUTTON); } else { Dom.removeClass(parent, cssClass.FOCUSSED_BUTTON); } } }
[ "function", "(", "el", ",", "setFocus", ")", "{", "var", "children", ",", "cssClass", "=", "this", ".", "CLASSES", ",", "grandParent", ",", "parent", "=", "el", ".", "parentNode", ";", "if", "(", "!", "parent", ")", "{", "return", ";", "}", "grandParent", "=", "parent", ".", "parentNode", ";", "if", "(", "el", ".", "nodeName", ".", "toUpperCase", "(", ")", "==", "\"BUTTON\"", "&&", "Dom", ".", "hasClass", "(", "parent", ",", "cssClass", ".", "BUTTON", ")", ")", "{", "if", "(", "setFocus", ")", "{", "if", "(", "grandParent", ")", "{", "children", "=", "Dom", ".", "getChildren", "(", "grandParent", ")", ";", "if", "(", "children", ")", "{", "Dom", ".", "removeClass", "(", "children", ",", "cssClass", ".", "FOCUSSED_BUTTON", ")", ";", "}", "}", "Dom", ".", "addClass", "(", "parent", ",", "cssClass", ".", "FOCUSSED_BUTTON", ")", ";", "}", "else", "{", "Dom", ".", "removeClass", "(", "parent", ",", "cssClass", ".", "FOCUSSED_BUTTON", ")", ";", "}", "}", "}" ]
Set the correct class for the navigation buttons. @method _updateNavButtons @param el {Object} The target button @param setFocus {Boolean} True to set focus ring, false otherwise. @protected
[ "Set", "the", "correct", "class", "for", "the", "navigation", "buttons", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4049-L4074
42,886
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, css = carousel.CLASSES, cur = carousel._pages.cur, // current page el, html, i, item, n = carousel.get("numVisible"), num = carousel._pages.num, // total pages pager = carousel._pages.el; // the pager container element if (num === 0 || !pager) { return; // don't do anything if number of pages is 0 } // Hide the pager before redrawing it Dom.setStyle(pager, "visibility", "hidden"); // Remove all nodes from the pager while (pager.firstChild) { pager.removeChild(pager.firstChild); } for (i = 0; i < num; i++) { el = document.createElement("LI"); if (i === 0) { Dom.addClass(el, css.FIRST_PAGE); } if (i == cur) { Dom.addClass(el, css.SELECTED_NAV); } html = "<a class=" + css.PAGER_ITEM + " href=\"#" + (i+1) + "\" tabindex=\"0\"><em>" + carousel.STRINGS.PAGER_PREFIX_TEXT + " " + (i+1) + "</em></a>"; el.innerHTML = html; pager.appendChild(el); } // Show the pager now Dom.setStyle(pager, "visibility", "visible"); }
javascript
function () { var carousel = this, css = carousel.CLASSES, cur = carousel._pages.cur, // current page el, html, i, item, n = carousel.get("numVisible"), num = carousel._pages.num, // total pages pager = carousel._pages.el; // the pager container element if (num === 0 || !pager) { return; // don't do anything if number of pages is 0 } // Hide the pager before redrawing it Dom.setStyle(pager, "visibility", "hidden"); // Remove all nodes from the pager while (pager.firstChild) { pager.removeChild(pager.firstChild); } for (i = 0; i < num; i++) { el = document.createElement("LI"); if (i === 0) { Dom.addClass(el, css.FIRST_PAGE); } if (i == cur) { Dom.addClass(el, css.SELECTED_NAV); } html = "<a class=" + css.PAGER_ITEM + " href=\"#" + (i+1) + "\" tabindex=\"0\"><em>" + carousel.STRINGS.PAGER_PREFIX_TEXT + " " + (i+1) + "</em></a>"; el.innerHTML = html; pager.appendChild(el); } // Show the pager now Dom.setStyle(pager, "visibility", "visible"); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "css", "=", "carousel", ".", "CLASSES", ",", "cur", "=", "carousel", ".", "_pages", ".", "cur", ",", "// current page", "el", ",", "html", ",", "i", ",", "item", ",", "n", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "num", "=", "carousel", ".", "_pages", ".", "num", ",", "// total pages", "pager", "=", "carousel", ".", "_pages", ".", "el", ";", "// the pager container element", "if", "(", "num", "===", "0", "||", "!", "pager", ")", "{", "return", ";", "// don't do anything if number of pages is 0", "}", "// Hide the pager before redrawing it", "Dom", ".", "setStyle", "(", "pager", ",", "\"visibility\"", ",", "\"hidden\"", ")", ";", "// Remove all nodes from the pager", "while", "(", "pager", ".", "firstChild", ")", "{", "pager", ".", "removeChild", "(", "pager", ".", "firstChild", ")", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "num", ";", "i", "++", ")", "{", "el", "=", "document", ".", "createElement", "(", "\"LI\"", ")", ";", "if", "(", "i", "===", "0", ")", "{", "Dom", ".", "addClass", "(", "el", ",", "css", ".", "FIRST_PAGE", ")", ";", "}", "if", "(", "i", "==", "cur", ")", "{", "Dom", ".", "addClass", "(", "el", ",", "css", ".", "SELECTED_NAV", ")", ";", "}", "html", "=", "\"<a class=\"", "+", "css", ".", "PAGER_ITEM", "+", "\" href=\\\"#\"", "+", "(", "i", "+", "1", ")", "+", "\"\\\" tabindex=\\\"0\\\"><em>\"", "+", "carousel", ".", "STRINGS", ".", "PAGER_PREFIX_TEXT", "+", "\" \"", "+", "(", "i", "+", "1", ")", "+", "\"</em></a>\"", ";", "el", ".", "innerHTML", "=", "html", ";", "pager", ".", "appendChild", "(", "el", ")", ";", "}", "// Show the pager now", "Dom", ".", "setStyle", "(", "pager", ",", "\"visibility\"", ",", "\"visible\"", ")", ";", "}" ]
Update the UI for the pager buttons based on the current page and the number of pages. @method _updatePagerButtons @protected
[ "Update", "the", "UI", "for", "the", "pager", "buttons", "based", "on", "the", "current", "page", "and", "the", "number", "of", "pages", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4083-L4128
42,887
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function () { var carousel = this, css = carousel.CLASSES, cur = carousel._pages.cur, // current page el, i, item, n = carousel.get("numVisible"), num = carousel._pages.num, // total pages pager = carousel._pages.el, // the pager container element sel; if (num === 0) { return;// don't do anything if number of pages is 0 } sel = document.createElement("SELECT"); if (!sel) { YAHOO.log("Unable to create the pager menu", "error", WidgetName); return; } // Hide the pager before redrawing it Dom.setStyle(pager, "visibility", "hidden"); // Remove all nodes from the pager while (pager.firstChild) { pager.removeChild(pager.firstChild); } for (i = 0; i < num; i++) { el = document.createElement("OPTION"); el.value = i+1; el.innerHTML = carousel.STRINGS.PAGER_PREFIX_TEXT+" "+(i+1); if (i == cur) { el.setAttribute("selected", "selected"); } sel.appendChild(el); } el = document.createElement("FORM"); if (!el) { YAHOO.log("Unable to create the pager menu", "error", WidgetName); } else { el.appendChild(sel); pager.appendChild(el); } // Show the pager now Event.addListener(sel, "change", carousel._pagerChangeHandler, this, true); Dom.setStyle(pager, "visibility", "visible"); }
javascript
function () { var carousel = this, css = carousel.CLASSES, cur = carousel._pages.cur, // current page el, i, item, n = carousel.get("numVisible"), num = carousel._pages.num, // total pages pager = carousel._pages.el, // the pager container element sel; if (num === 0) { return;// don't do anything if number of pages is 0 } sel = document.createElement("SELECT"); if (!sel) { YAHOO.log("Unable to create the pager menu", "error", WidgetName); return; } // Hide the pager before redrawing it Dom.setStyle(pager, "visibility", "hidden"); // Remove all nodes from the pager while (pager.firstChild) { pager.removeChild(pager.firstChild); } for (i = 0; i < num; i++) { el = document.createElement("OPTION"); el.value = i+1; el.innerHTML = carousel.STRINGS.PAGER_PREFIX_TEXT+" "+(i+1); if (i == cur) { el.setAttribute("selected", "selected"); } sel.appendChild(el); } el = document.createElement("FORM"); if (!el) { YAHOO.log("Unable to create the pager menu", "error", WidgetName); } else { el.appendChild(sel); pager.appendChild(el); } // Show the pager now Event.addListener(sel, "change", carousel._pagerChangeHandler, this, true); Dom.setStyle(pager, "visibility", "visible"); }
[ "function", "(", ")", "{", "var", "carousel", "=", "this", ",", "css", "=", "carousel", ".", "CLASSES", ",", "cur", "=", "carousel", ".", "_pages", ".", "cur", ",", "// current page", "el", ",", "i", ",", "item", ",", "n", "=", "carousel", ".", "get", "(", "\"numVisible\"", ")", ",", "num", "=", "carousel", ".", "_pages", ".", "num", ",", "// total pages", "pager", "=", "carousel", ".", "_pages", ".", "el", ",", "// the pager container element", "sel", ";", "if", "(", "num", "===", "0", ")", "{", "return", ";", "// don't do anything if number of pages is 0", "}", "sel", "=", "document", ".", "createElement", "(", "\"SELECT\"", ")", ";", "if", "(", "!", "sel", ")", "{", "YAHOO", ".", "log", "(", "\"Unable to create the pager menu\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "return", ";", "}", "// Hide the pager before redrawing it", "Dom", ".", "setStyle", "(", "pager", ",", "\"visibility\"", ",", "\"hidden\"", ")", ";", "// Remove all nodes from the pager", "while", "(", "pager", ".", "firstChild", ")", "{", "pager", ".", "removeChild", "(", "pager", ".", "firstChild", ")", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "num", ";", "i", "++", ")", "{", "el", "=", "document", ".", "createElement", "(", "\"OPTION\"", ")", ";", "el", ".", "value", "=", "i", "+", "1", ";", "el", ".", "innerHTML", "=", "carousel", ".", "STRINGS", ".", "PAGER_PREFIX_TEXT", "+", "\" \"", "+", "(", "i", "+", "1", ")", ";", "if", "(", "i", "==", "cur", ")", "{", "el", ".", "setAttribute", "(", "\"selected\"", ",", "\"selected\"", ")", ";", "}", "sel", ".", "appendChild", "(", "el", ")", ";", "}", "el", "=", "document", ".", "createElement", "(", "\"FORM\"", ")", ";", "if", "(", "!", "el", ")", "{", "YAHOO", ".", "log", "(", "\"Unable to create the pager menu\"", ",", "\"error\"", ",", "WidgetName", ")", ";", "}", "else", "{", "el", ".", "appendChild", "(", "sel", ")", ";", "pager", ".", "appendChild", "(", "el", ")", ";", "}", "// Show the pager now", "Event", ".", "addListener", "(", "sel", ",", "\"change\"", ",", "carousel", ".", "_pagerChangeHandler", ",", "this", ",", "true", ")", ";", "Dom", ".", "setStyle", "(", "pager", ",", "\"visibility\"", ",", "\"visible\"", ")", ";", "}" ]
Update the UI for the pager menu based on the current page and the number of pages. If the number of pages is greater than MAX_PAGER_BUTTONS, then the selection of pages is provided by a drop down menu instead of a set of buttons. @method _updatePagerMenu @protected
[ "Update", "the", "UI", "for", "the", "pager", "menu", "based", "on", "the", "current", "page", "and", "the", "number", "of", "pages", ".", "If", "the", "number", "of", "pages", "is", "greater", "than", "MAX_PAGER_BUTTONS", "then", "the", "selection", "of", "pages", "is", "provided", "by", "a", "drop", "down", "menu", "instead", "of", "a", "set", "of", "buttons", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4139-L4197
42,888
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (el) { var carousel = this; if (el) { if (carousel._focusableItemEl) { carousel._focusableItemEl.tabIndex = -1; } carousel._focusableItemEl = el; el.tabIndex = 0; } }
javascript
function (el) { var carousel = this; if (el) { if (carousel._focusableItemEl) { carousel._focusableItemEl.tabIndex = -1; } carousel._focusableItemEl = el; el.tabIndex = 0; } }
[ "function", "(", "el", ")", "{", "var", "carousel", "=", "this", ";", "if", "(", "el", ")", "{", "if", "(", "carousel", ".", "_focusableItemEl", ")", "{", "carousel", ".", "_focusableItemEl", ".", "tabIndex", "=", "-", "1", ";", "}", "carousel", ".", "_focusableItemEl", "=", "el", ";", "el", ".", "tabIndex", "=", "0", ";", "}", "}" ]
Set the correct tab index for the Carousel items. @method _updateTabIndex @param el {Object} The element to be focussed @protected
[ "Set", "the", "correct", "tab", "index", "for", "the", "Carousel", "items", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4206-L4216
42,889
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (cfg) { var rv = true; if (JS.isObject(cfg)) { if (cfg.speed) { rv = rv && JS.isNumber(cfg.speed); } if (cfg.effect) { rv = rv && JS.isFunction(cfg.effect); } else if (!JS.isUndefined(YAHOO.util.Easing)) { cfg.effect = YAHOO.util.Easing.easeOut; } } else { rv = false; } return rv; }
javascript
function (cfg) { var rv = true; if (JS.isObject(cfg)) { if (cfg.speed) { rv = rv && JS.isNumber(cfg.speed); } if (cfg.effect) { rv = rv && JS.isFunction(cfg.effect); } else if (!JS.isUndefined(YAHOO.util.Easing)) { cfg.effect = YAHOO.util.Easing.easeOut; } } else { rv = false; } return rv; }
[ "function", "(", "cfg", ")", "{", "var", "rv", "=", "true", ";", "if", "(", "JS", ".", "isObject", "(", "cfg", ")", ")", "{", "if", "(", "cfg", ".", "speed", ")", "{", "rv", "=", "rv", "&&", "JS", ".", "isNumber", "(", "cfg", ".", "speed", ")", ";", "}", "if", "(", "cfg", ".", "effect", ")", "{", "rv", "=", "rv", "&&", "JS", ".", "isFunction", "(", "cfg", ".", "effect", ")", ";", "}", "else", "if", "(", "!", "JS", ".", "isUndefined", "(", "YAHOO", ".", "util", ".", "Easing", ")", ")", "{", "cfg", ".", "effect", "=", "YAHOO", ".", "util", ".", "Easing", ".", "easeOut", ";", "}", "}", "else", "{", "rv", "=", "false", ";", "}", "return", "rv", ";", "}" ]
Validate animation parameters. @method _validateAnimation @param cfg {Object} The animation configuration @return {Boolean} The status of the validation @protected
[ "Validate", "animation", "parameters", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4226-L4243
42,890
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var carousel = this, numItems = carousel.get("numItems"); if (JS.isNumber(val)) { if (numItems === 0 && val == numItems) { return true; } else { return (val >= 0 && val < numItems); } } return false; }
javascript
function (val) { var carousel = this, numItems = carousel.get("numItems"); if (JS.isNumber(val)) { if (numItems === 0 && val == numItems) { return true; } else { return (val >= 0 && val < numItems); } } return false; }
[ "function", "(", "val", ")", "{", "var", "carousel", "=", "this", ",", "numItems", "=", "carousel", ".", "get", "(", "\"numItems\"", ")", ";", "if", "(", "JS", ".", "isNumber", "(", "val", ")", ")", "{", "if", "(", "numItems", "===", "0", "&&", "val", "==", "numItems", ")", "{", "return", "true", ";", "}", "else", "{", "return", "(", "val", ">=", "0", "&&", "val", "<", "numItems", ")", ";", "}", "}", "return", "false", ";", "}" ]
Validate the firstVisible value. @method _validateFirstVisible @param val {Number} The first visible value @return {Boolean} The status of the validation @protected
[ "Validate", "the", "firstVisible", "value", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4253-L4265
42,891
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (cfg) { var i; if (!JS.isObject(cfg)) { return false; } if (cfg.prev) { if (!JS.isArray(cfg.prev)) { return false; } for (i in cfg.prev) { if (cfg.prev.hasOwnProperty(i)) { if (!JS.isString(cfg.prev[i].nodeName)) { return false; } } } } if (cfg.next) { if (!JS.isArray(cfg.next)) { return false; } for (i in cfg.next) { if (cfg.next.hasOwnProperty(i)) { if (!JS.isString(cfg.next[i].nodeName)) { return false; } } } } return true; }
javascript
function (cfg) { var i; if (!JS.isObject(cfg)) { return false; } if (cfg.prev) { if (!JS.isArray(cfg.prev)) { return false; } for (i in cfg.prev) { if (cfg.prev.hasOwnProperty(i)) { if (!JS.isString(cfg.prev[i].nodeName)) { return false; } } } } if (cfg.next) { if (!JS.isArray(cfg.next)) { return false; } for (i in cfg.next) { if (cfg.next.hasOwnProperty(i)) { if (!JS.isString(cfg.next[i].nodeName)) { return false; } } } } return true; }
[ "function", "(", "cfg", ")", "{", "var", "i", ";", "if", "(", "!", "JS", ".", "isObject", "(", "cfg", ")", ")", "{", "return", "false", ";", "}", "if", "(", "cfg", ".", "prev", ")", "{", "if", "(", "!", "JS", ".", "isArray", "(", "cfg", ".", "prev", ")", ")", "{", "return", "false", ";", "}", "for", "(", "i", "in", "cfg", ".", "prev", ")", "{", "if", "(", "cfg", ".", "prev", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "if", "(", "!", "JS", ".", "isString", "(", "cfg", ".", "prev", "[", "i", "]", ".", "nodeName", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "if", "(", "cfg", ".", "next", ")", "{", "if", "(", "!", "JS", ".", "isArray", "(", "cfg", ".", "next", ")", ")", "{", "return", "false", ";", "}", "for", "(", "i", "in", "cfg", ".", "next", ")", "{", "if", "(", "cfg", ".", "next", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "if", "(", "!", "JS", ".", "isString", "(", "cfg", ".", "next", "[", "i", "]", ".", "nodeName", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "return", "true", ";", "}" ]
Validate and navigation parameters. @method _validateNavigation @param cfg {Object} The navigation configuration @return {Boolean} The status of the validation @protected
[ "Validate", "and", "navigation", "parameters", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4275-L4309
42,892
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var rv = false; if (JS.isNumber(val)) { rv = val > 0 && val <= this.get("numItems"); } else if (JS.isArray(val)) { if (JS.isNumber(val[0]) && JS.isNumber(val[1])) { rv = val[0] * val[1] > 0 && val.length == 2; } } return rv; }
javascript
function (val) { var rv = false; if (JS.isNumber(val)) { rv = val > 0 && val <= this.get("numItems"); } else if (JS.isArray(val)) { if (JS.isNumber(val[0]) && JS.isNumber(val[1])) { rv = val[0] * val[1] > 0 && val.length == 2; } } return rv; }
[ "function", "(", "val", ")", "{", "var", "rv", "=", "false", ";", "if", "(", "JS", ".", "isNumber", "(", "val", ")", ")", "{", "rv", "=", "val", ">", "0", "&&", "val", "<=", "this", ".", "get", "(", "\"numItems\"", ")", ";", "}", "else", "if", "(", "JS", ".", "isArray", "(", "val", ")", ")", "{", "if", "(", "JS", ".", "isNumber", "(", "val", "[", "0", "]", ")", "&&", "JS", ".", "isNumber", "(", "val", "[", "1", "]", ")", ")", "{", "rv", "=", "val", "[", "0", "]", "*", "val", "[", "1", "]", ">", "0", "&&", "val", ".", "length", "==", "2", ";", "}", "}", "return", "rv", ";", "}" ]
Validate the numVisible value. @method _validateNumVisible @param val {Number} The numVisible value @return {Boolean} The status of the validation @protected
[ "Validate", "the", "numVisible", "value", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4331-L4343
42,893
neyric/webhookit
public/javascripts/yui/carousel/carousel-debug.js
function (val) { var rv = false; if (JS.isNumber(val)) { rv = val >= 0 && val < 100; } return rv; }
javascript
function (val) { var rv = false; if (JS.isNumber(val)) { rv = val >= 0 && val < 100; } return rv; }
[ "function", "(", "val", ")", "{", "var", "rv", "=", "false", ";", "if", "(", "JS", ".", "isNumber", "(", "val", ")", ")", "{", "rv", "=", "val", ">=", "0", "&&", "val", "<", "100", ";", "}", "return", "rv", ";", "}" ]
Validate the revealAmount value. @method _validateRevealAmount @param val {Number} The revealAmount value @return {Boolean} The status of the validation @protected
[ "Validate", "the", "revealAmount", "value", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/carousel/carousel-debug.js#L4353-L4361
42,894
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function() { var size = this.get(this.OPT.PICKER_SIZE), h = this.get(this.OPT.HUE); h = size - Math.round(h / 360 * size); // 0 is at the top and bottom of the hue slider. Always go to // the top so we don't end up sending the thumb to the bottom // when the value didn't actually change (e.g., a conversion // produced 360 instead of 0 and the value was already 0). if (h === size) { h = 0; } this.logger.log("Hue slider is being set to " + h); this.hueSlider.setValue(h, this.skipAnim); }
javascript
function() { var size = this.get(this.OPT.PICKER_SIZE), h = this.get(this.OPT.HUE); h = size - Math.round(h / 360 * size); // 0 is at the top and bottom of the hue slider. Always go to // the top so we don't end up sending the thumb to the bottom // when the value didn't actually change (e.g., a conversion // produced 360 instead of 0 and the value was already 0). if (h === size) { h = 0; } this.logger.log("Hue slider is being set to " + h); this.hueSlider.setValue(h, this.skipAnim); }
[ "function", "(", ")", "{", "var", "size", "=", "this", ".", "get", "(", "this", ".", "OPT", ".", "PICKER_SIZE", ")", ",", "h", "=", "this", ".", "get", "(", "this", ".", "OPT", ".", "HUE", ")", ";", "h", "=", "size", "-", "Math", ".", "round", "(", "h", "/", "360", "*", "size", ")", ";", "// 0 is at the top and bottom of the hue slider. Always go to", "// the top so we don't end up sending the thumb to the bottom", "// when the value didn't actually change (e.g., a conversion", "// produced 360 instead of 0 and the value was already 0).", "if", "(", "h", "===", "size", ")", "{", "h", "=", "0", ";", "}", "this", ".", "logger", ".", "log", "(", "\"Hue slider is being set to \"", "+", "h", ")", ";", "this", ".", "hueSlider", ".", "setValue", "(", "h", ",", "this", ".", "skipAnim", ")", ";", "}" ]
Moves the hue slider into the position dictated by the current state of the control @method _updateHueSlider @protected
[ "Moves", "the", "hue", "slider", "into", "the", "position", "dictated", "by", "the", "current", "state", "of", "the", "control" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L564-L580
42,895
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function() { var size = this.get(this.OPT.PICKER_SIZE), s = this.get(this.OPT.SATURATION), v = this.get(this.OPT.VALUE); s = Math.round(s * size / 100); v = Math.round(size - (v * size / 100)); this.logger.log("Setting picker slider to " + [s, v]); this.pickerSlider.setRegionValue(s, v, this.skipAnim); }
javascript
function() { var size = this.get(this.OPT.PICKER_SIZE), s = this.get(this.OPT.SATURATION), v = this.get(this.OPT.VALUE); s = Math.round(s * size / 100); v = Math.round(size - (v * size / 100)); this.logger.log("Setting picker slider to " + [s, v]); this.pickerSlider.setRegionValue(s, v, this.skipAnim); }
[ "function", "(", ")", "{", "var", "size", "=", "this", ".", "get", "(", "this", ".", "OPT", ".", "PICKER_SIZE", ")", ",", "s", "=", "this", ".", "get", "(", "this", ".", "OPT", ".", "SATURATION", ")", ",", "v", "=", "this", ".", "get", "(", "this", ".", "OPT", ".", "VALUE", ")", ";", "s", "=", "Math", ".", "round", "(", "s", "*", "size", "/", "100", ")", ";", "v", "=", "Math", ".", "round", "(", "size", "-", "(", "v", "*", "size", "/", "100", ")", ")", ";", "this", ".", "logger", ".", "log", "(", "\"Setting picker slider to \"", "+", "[", "s", ",", "v", "]", ")", ";", "this", ".", "pickerSlider", ".", "setRegionValue", "(", "s", ",", "v", ",", "this", ".", "skipAnim", ")", ";", "}" ]
Moves the picker slider into the position dictated by the current state of the control @method _updatePickerSlider @protected
[ "Moves", "the", "picker", "slider", "into", "the", "position", "dictated", "by", "the", "current", "state", "of", "the", "control" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L588-L599
42,896
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function() { this.logger.log("hsv " + [this._getH(),this._getS(),this._getV()]); this.set(this.OPT.RGB, Color.hsv2rgb(this._getH(), this._getS(), this._getV())); }
javascript
function() { this.logger.log("hsv " + [this._getH(),this._getS(),this._getV()]); this.set(this.OPT.RGB, Color.hsv2rgb(this._getH(), this._getS(), this._getV())); }
[ "function", "(", ")", "{", "this", ".", "logger", ".", "log", "(", "\"hsv \"", "+", "[", "this", ".", "_getH", "(", ")", ",", "this", ".", "_getS", "(", ")", ",", "this", ".", "_getV", "(", ")", "]", ")", ";", "this", ".", "set", "(", "this", ".", "OPT", ".", "RGB", ",", "Color", ".", "hsv2rgb", "(", "this", ".", "_getH", "(", ")", ",", "this", ".", "_getS", "(", ")", ",", "this", ".", "_getV", "(", ")", ")", ")", ";", "}" ]
Reads the sliders and converts the values to RGB, updating the internal state for all the individual form fields @method _getValuesFromSliders @protected
[ "Reads", "the", "sliders", "and", "converts", "the", "values", "to", "RGB", "updating", "the", "internal", "state", "for", "all", "the", "individual", "form", "fields" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L709-L712
42,897
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function(newOffset) { this.logger.log("hue update: " + newOffset , "warn"); var h = this._getH(), rgb = Color.hsv2rgb(h, 1, 1), styleDef = "rgb(" + rgb.join(",") + ")"; this.set(this.OPT.HUE, h, true); // set picker background to the hue Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef); if (this.hueSlider.valueChangeSource !== Slider.SOURCE_SET_VALUE) { this._getValuesFromSliders(); } this._updateFormFields(); this._updateSwatch(); }
javascript
function(newOffset) { this.logger.log("hue update: " + newOffset , "warn"); var h = this._getH(), rgb = Color.hsv2rgb(h, 1, 1), styleDef = "rgb(" + rgb.join(",") + ")"; this.set(this.OPT.HUE, h, true); // set picker background to the hue Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef); if (this.hueSlider.valueChangeSource !== Slider.SOURCE_SET_VALUE) { this._getValuesFromSliders(); } this._updateFormFields(); this._updateSwatch(); }
[ "function", "(", "newOffset", ")", "{", "this", ".", "logger", ".", "log", "(", "\"hue update: \"", "+", "newOffset", ",", "\"warn\"", ")", ";", "var", "h", "=", "this", ".", "_getH", "(", ")", ",", "rgb", "=", "Color", ".", "hsv2rgb", "(", "h", ",", "1", ",", "1", ")", ",", "styleDef", "=", "\"rgb(\"", "+", "rgb", ".", "join", "(", "\",\"", ")", "+", "\")\"", ";", "this", ".", "set", "(", "this", ".", "OPT", ".", "HUE", ",", "h", ",", "true", ")", ";", "// set picker background to the hue", "Dom", ".", "setStyle", "(", "this", ".", "getElement", "(", "this", ".", "ID", ".", "PICKER_BG", ")", ",", "\"background-color\"", ",", "styleDef", ")", ";", "if", "(", "this", ".", "hueSlider", ".", "valueChangeSource", "!==", "Slider", ".", "SOURCE_SET_VALUE", ")", "{", "this", ".", "_getValuesFromSliders", "(", ")", ";", "}", "this", ".", "_updateFormFields", "(", ")", ";", "this", ".", "_updateSwatch", "(", ")", ";", "}" ]
Event handler for the hue slider. @method _onHueSliderChange @param newOffset {int} pixels from the start position @protected
[ "Event", "handler", "for", "the", "hue", "slider", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L739-L757
42,898
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function () { // bind all of our elements var o=this.OPT, ids = this.get(o.IDS), els = this.get(o.ELEMENTS), i, el, id; // Add the default value as a key for each element for easier lookup for (i in this.ID) { if (lang.hasOwnProperty(this.ID, i)) { ids[this.ID[i]] = ids[i]; } } // Check for picker element, if not there, create all of them el = Dom.get(ids[this.ID.PICKER_BG]); if (!el) { this._createElements(); } else { this.logger.log("Using pre-existing markup"); } for (i in ids) { if (lang.hasOwnProperty(ids, i)) { // look for element el = Dom.get(ids[i]); // generate an id if the implementer passed in an element reference, // and the element did not have an id already id = Dom.generateId(el); // update the id in case we generated the id ids[i] = id; // key is WEBSAFE_SWATCH ids[ids[i]] = id; // key is websafe_swatch // store the dom ref els[id] = el; } } }
javascript
function () { // bind all of our elements var o=this.OPT, ids = this.get(o.IDS), els = this.get(o.ELEMENTS), i, el, id; // Add the default value as a key for each element for easier lookup for (i in this.ID) { if (lang.hasOwnProperty(this.ID, i)) { ids[this.ID[i]] = ids[i]; } } // Check for picker element, if not there, create all of them el = Dom.get(ids[this.ID.PICKER_BG]); if (!el) { this._createElements(); } else { this.logger.log("Using pre-existing markup"); } for (i in ids) { if (lang.hasOwnProperty(ids, i)) { // look for element el = Dom.get(ids[i]); // generate an id if the implementer passed in an element reference, // and the element did not have an id already id = Dom.generateId(el); // update the id in case we generated the id ids[i] = id; // key is WEBSAFE_SWATCH ids[ids[i]] = id; // key is websafe_swatch // store the dom ref els[id] = el; } } }
[ "function", "(", ")", "{", "// bind all of our elements", "var", "o", "=", "this", ".", "OPT", ",", "ids", "=", "this", ".", "get", "(", "o", ".", "IDS", ")", ",", "els", "=", "this", ".", "get", "(", "o", ".", "ELEMENTS", ")", ",", "i", ",", "el", ",", "id", ";", "// Add the default value as a key for each element for easier lookup", "for", "(", "i", "in", "this", ".", "ID", ")", "{", "if", "(", "lang", ".", "hasOwnProperty", "(", "this", ".", "ID", ",", "i", ")", ")", "{", "ids", "[", "this", ".", "ID", "[", "i", "]", "]", "=", "ids", "[", "i", "]", ";", "}", "}", "// Check for picker element, if not there, create all of them", "el", "=", "Dom", ".", "get", "(", "ids", "[", "this", ".", "ID", ".", "PICKER_BG", "]", ")", ";", "if", "(", "!", "el", ")", "{", "this", ".", "_createElements", "(", ")", ";", "}", "else", "{", "this", ".", "logger", ".", "log", "(", "\"Using pre-existing markup\"", ")", ";", "}", "for", "(", "i", "in", "ids", ")", "{", "if", "(", "lang", ".", "hasOwnProperty", "(", "ids", ",", "i", ")", ")", "{", "// look for element", "el", "=", "Dom", ".", "get", "(", "ids", "[", "i", "]", ")", ";", "// generate an id if the implementer passed in an element reference,", "// and the element did not have an id already", "id", "=", "Dom", ".", "generateId", "(", "el", ")", ";", "// update the id in case we generated the id", "ids", "[", "i", "]", "=", "id", ";", "// key is WEBSAFE_SWATCH", "ids", "[", "ids", "[", "i", "]", "]", "=", "id", ";", "// key is websafe_swatch", "// store the dom ref", "els", "[", "id", "]", "=", "el", ";", "}", "}", "}" ]
Creates any missing DOM structure. @method _initElements @protected
[ "Creates", "any", "missing", "DOM", "structure", "." ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L1234-L1274
42,899
neyric/webhookit
public/javascripts/yui/colorpicker/colorpicker-debug.js
function() { var hsv = [this.get(this.OPT.HUE), this.get(this.OPT.SATURATION)/100, this.get(this.OPT.VALUE)/100], rgb = Color.hsv2rgb(hsv); this.logger.log("HSV converted to RGB " + hsv + " : " + rgb); this.set(this.OPT.RGB, rgb); this._updateSliders(); }
javascript
function() { var hsv = [this.get(this.OPT.HUE), this.get(this.OPT.SATURATION)/100, this.get(this.OPT.VALUE)/100], rgb = Color.hsv2rgb(hsv); this.logger.log("HSV converted to RGB " + hsv + " : " + rgb); this.set(this.OPT.RGB, rgb); this._updateSliders(); }
[ "function", "(", ")", "{", "var", "hsv", "=", "[", "this", ".", "get", "(", "this", ".", "OPT", ".", "HUE", ")", ",", "this", ".", "get", "(", "this", ".", "OPT", ".", "SATURATION", ")", "/", "100", ",", "this", ".", "get", "(", "this", ".", "OPT", ".", "VALUE", ")", "/", "100", "]", ",", "rgb", "=", "Color", ".", "hsv2rgb", "(", "hsv", ")", ";", "this", ".", "logger", ".", "log", "(", "\"HSV converted to RGB \"", "+", "hsv", "+", "\" : \"", "+", "rgb", ")", ";", "this", ".", "set", "(", "this", ".", "OPT", ".", "RGB", ",", "rgb", ")", ";", "this", ".", "_updateSliders", "(", ")", ";", "}" ]
Updates the RGB values from the current state of the HSV values. Executed when the one of the HSV form fields are updated _updateRGBFromHSV @protected
[ "Updates", "the", "RGB", "values", "from", "the", "current", "state", "of", "the", "HSV", "values", ".", "Executed", "when", "the", "one", "of", "the", "HSV", "form", "fields", "are", "updated", "_updateRGBFromHSV" ]
13abf6f072e23d536432235da78fd3e4e5d742b6
https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/colorpicker/colorpicker-debug.js#L1373-L1383