This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function handleClick() { | |
| jsonData.subscribe('responseCacheEvent', function (o) { | |
| mychart2.set('dataSource', this); | |
| }); | |
| mychart.set("dataSource", jsonData); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Y.CustomEvent.prototype.getSubscriber = function (fn, ctx) { | |
| var subs = this.subscribers, | |
| afters = this.afters, | |
| id, sub; | |
| for (id in subs) { | |
| if (subs.hasOwnProperty(id)) { | |
| sub = subs[id]; | |
| if ((!fn || sub.fn === fn) && (!ctx || sub.context === ctx)) { | |
| return sub; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var adapter = new Y.SchemaAdapter({ | |
| type: Y.DataSchema.JSON, // or have internal intelligence to map 'json' to this | |
| resultsList: 'records', | |
| fields: [ | |
| { key: 'foo', ... }, | |
| ... | |
| ], | |
| metaFields: { | |
| totalRecords: 'total' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener('focus', prepareHandler, true); // capture phase | |
| input.addEventListener('focus', inputHandler, false); | |
| function prepareHandler(e) { | |
| var name = e.target.name; | |
| process[name] = true; | |
| setTimeout(function () { | |
| if (process[name]) { | |
| // do stuff (e is available, but its methods are useless) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Dirty hack to avoid requirement of yui-skin-sam being | |
| // on the body element for drag resizable columns. | |
| (function (DT) { | |
| var original = DT.prototype._initColumnDragTargetEl; | |
| DT.prototype._initColumnDragTargetEl = function () { | |
| if(!DT._elColumnDragTarget) { | |
| original.apply(this, arguments); | |
| this._elContainer.insertBefore(DT._elColumnDragTarget, | |
| this._elContainer.firstChild); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YUI({ | |
| modules: { | |
| 'maps': { | |
| fullpath: '/path/to/map-module.js', | |
| requires: ['node'] | |
| } | |
| } | |
| }).use('maps', function (Y) { | |
| var map = new Y.Map(..); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YUI({ | |
| modules: { | |
| 'maps': { | |
| fullpath: '/path/to/map-module.js', | |
| requires: ['node'] | |
| } | |
| } | |
| }).use('maps', function (Y) { | |
| var map = new Y.Map(..); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Step 1. global definition | |
| function Map(config) { | |
| this._init(config); | |
| } | |
| Map.prototype = { | |
| _container: null, | |
| _init: function (config) { | |
| this._container = document.getElementById(config.container); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reviveDates(o) { | |
| if (typeof o === 'string') { | |
| var m = o.match(/^(\d{4})-(\d{2})-(\d{2})$/); | |
| return m ? new Date(m[1], m[2], m[3]) : o; | |
| } else { | |
| return o; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YAHOO.widget.DataTable.prototype.getRowByContent = function (col, val) { | |
| var recs = myDataTable.getRecordSet().getRecords(), | |
| i, len; | |
| for (i = 0, len = recs.length; i < len; ++i) { | |
| if (recs[i].getData(col) === val) { | |
| return this.getTrEl(recs[i]); | |
| } | |
| } |