Skip to content

Instantly share code, notes, and snippets.

function handleClick() {
jsonData.subscribe('responseCacheEvent', function (o) {
mychart2.set('dataSource', this);
});
mychart.set("dataSource", jsonData);
}
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;
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'
}
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)
// 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);
YUI({
modules: {
'maps': {
fullpath: '/path/to/map-module.js',
requires: ['node']
}
}
}).use('maps', function (Y) {
var map = new Y.Map(..);
YUI({
modules: {
'maps': {
fullpath: '/path/to/map-module.js',
requires: ['node']
}
}
}).use('maps', function (Y) {
var map = new Y.Map(..);
// Step 1. global definition
function Map(config) {
this._init(config);
}
Map.prototype = {
_container: null,
_init: function (config) {
this._container = document.getElementById(config.container);
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;
}
}
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]);
}
}