_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3 values | text stringlengths 52 373k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q30600 | train | function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.nextMonth();
}
} | javascript | {
"resource": ""
} | |
q30601 | train | function() {
for (var p=this.pages.length-1;p>=0;--p) {
var cal = this.pages[p];
cal.previousMonth();
}
} | javascript | {
"resource": ""
} | |
q30602 | train | function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.nextYear();
}
} | javascript | {
"resource": ""
} | |
q30603 | train | function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.previousYear();
}
} | javascript | {
"resource": ""
} | |
q30604 | train | function(month, fnRender) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.addMonthRenderer(month, fnRender);
}
} | javascript | {
"resource": ""
} | |
q30605 | train | function(weekday, fnRender) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.addWeekdayRenderer(weekday, fnRender);
}
} | javascript | {
"resource": ""
} | |
q30606 | train | function(date, iMonth) {
// Bug in Safari 1.3, 2.0 (WebKit build < 420), Date.setMonth does not work consistently if iMonth is not 0-11
if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
var newDate = DateMath.add(date, DateMath.MONTH, iMonth-date.getMonth());
date.setTime(newDate.getTime());
} else {
date.setMonth(iMonth);
}
} | javascript | {
"resource": ""
} | |
q30607 | train | function() {
var w = 0;
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
w += cal.oDomContainer.offsetWidth;
}
if (w > 0) {
this.oDomContainer.style.width = w + "px";
}
} | javascript | {
"resource": ""
} | |
q30608 | train | function() {
if (this.beforeDestroyEvent.fire()) {
var cal = this;
// Child objects
if (cal.navigator) {
cal.navigator.destroy();
}
if (cal.cfg) {
cal.cfg.destroy();
}
// DOM event listeners
Event.purgeElement(cal.oDomContainer, true);
// Generated markup/DOM - Not removing the container DIV since we didn't create it.
Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_CONTAINER);
Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_MULTI_UP);
for (var i = 0, l = cal.pages.length; i < l; i++) {
cal.pages[i].destroy();
cal.pages[i] = null;
}
cal.oDomContainer.innerHTML = "";
// JS-to-DOM references
cal.oDomContainer = null;
this.destroyEvent.fire();
}
} | javascript | {
"resource": ""
} | |
q30609 | train | function(cal) {
var calBox = cal.oDomContainer;
this.cal = cal;
this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
this._doc = calBox.ownerDocument;
/**
* Private flag, to identify IE Quirks
* @private
* @property __isIEQuirks
*/
var ie = YAHOO.env.ua.ie;
this.__isIEQuirks = (ie && ((ie <= 6) || (this._doc.compatMode == "BackCompat")));
} | javascript | {
"resource": ""
} | |
q30610 | train | function(nYear) {
var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
this._year = nYear;
}
this._updateYearUI();
} | javascript | {
"resource": ""
} | |
q30611 | train | function() {
this.cal.beforeRenderNavEvent.fire();
if (!this.__rendered) {
this.createNav();
this.createMask();
this.applyListeners();
this.__rendered = true;
}
this.cal.renderNavEvent.fire();
} | javascript | {
"resource": ""
} | |
q30612 | train | function(html) {
var NAV = YAHOO.widget.CalendarNavigator,
C = NAV.CLASSES,
h = html; // just to use a shorter name
h[h.length] = '<div class="' + C.MONTH + '">';
this.renderMonth(h);
h[h.length] = '</div>';
h[h.length] = '<div class="' + C.YEAR + '">';
this.renderYear(h);
h[h.length] = '</div>';
h[h.length] = '<div class="' + C.BUTTONS + '">';
this.renderButtons(h);
h[h.length] = '</div>';
h[h.length] = '<div class="' + C.ERROR + '" id="' + this.id + NAV.ERROR_SUFFIX + '"></div>';
return h;
} | javascript | {
"resource": ""
} | |
q30613 | train | function(html) {
var NAV = YAHOO.widget.CalendarNavigator,
C = NAV.CLASSES;
var id = this.id + NAV.MONTH_SUFFIX,
mf = this.__getCfg("monthFormat"),
months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),
h = html;
if (months && months.length > 0) {
h[h.length] = '<label for="' + id + '">';
h[h.length] = this.__getCfg("month", true);
h[h.length] = '</label>';
h[h.length] = '<select name="' + id + '" id="' + id + '" class="' + C.MONTH_CTRL + '">';
for (var i = 0; i < months.length; i++) {
h[h.length] = '<option value="' + i + '">';
h[h.length] = months[i];
h[h.length] = '</option>';
}
h[h.length] = '</select>';
}
return h;
} | javascript | {
"resource": ""
} | |
q30614 | train | function(html) {
var NAV = YAHOO.widget.CalendarNavigator,
C = NAV.CLASSES;
var id = this.id + NAV.YEAR_SUFFIX,
size = NAV.YR_MAX_DIGITS,
h = html;
h[h.length] = '<label for="' + id + '">';
h[h.length] = this.__getCfg("year", true);
h[h.length] = '</label>';
h[h.length] = '<input type="text" name="' + id + '" id="' + id + '" class="' + C.YEAR_CTRL + '" maxlength="' + size + '"/>';
return h;
} | javascript | {
"resource": ""
} | |
q30615 | train | function(cal) {
var date = YAHOO.widget.DateMath.getDate(this.getYear() - cal.cfg.getProperty("YEAR_OFFSET"), this.getMonth(), 1);
cal.cfg.setProperty("pagedate", date);
cal.render();
} | javascript | {
"resource": ""
} | |
q30616 | train | function() {
YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
} | javascript | {
"resource": ""
} | |
q30617 | train | function() {
var el = this.submitEl,
f = this.__getCfg("initialFocus");
if (f && f.toLowerCase) {
f = f.toLowerCase();
if (f == "year") {
el = this.yearEl;
try {
this.yearEl.select();
} catch (selErr) {
// Ignore;
}
} else if (f == "month") {
el = this.monthEl;
}
}
if (el && YAHOO.lang.isFunction(el.focus)) {
try {
el.focus();
} catch (focusErr) {
// TODO: Fall back if focus fails?
}
}
} | javascript | {
"resource": ""
} | |
q30618 | train | function() {
var NAV = YAHOO.widget.CalendarNavigator;
var yr = null;
if (this.yearEl) {
var value = this.yearEl.value;
value = value.replace(NAV.TRIM, "$1");
if (NAV.YR_PATTERN.test(value)) {
yr = parseInt(value, 10);
}
}
return yr;
} | javascript | {
"resource": ""
} | |
q30619 | topLevelNodeBefore | train | function topLevelNodeBefore(node, top) {
while (!node.previousSibling && node.parentNode != top)
node = node.parentNode;
return topLevelNodeAt(node.previousSibling, top);
} | javascript | {
"resource": ""
} |
q30620 | moveToNodeStart | train | function moveToNodeStart(range, node) {
if (node.nodeType == 3) {
var count = 0, cur = node.previousSibling;
while (cur && cur.nodeType == 3) {
count += cur.nodeValue.length;
cur = cur.previousSibling;
}
if (cur) {
try{range.moveToElementText(cur);}
catch(e){return false;}
range.collapse(false);
}
else range.moveToElementText(node.parentNode);
if (count) range.move("character", count);
}
else {
try{range.moveToElementText(node);}
catch(e){return false;}
}
return true;
} | javascript | {
"resource": ""
} |
q30621 | focusIssue | train | function focusIssue() {
return cs.start.node == cs.end.node && cs.start.offset == 0 && cs.end.offset == 0;
} | javascript | {
"resource": ""
} |
q30622 | selectRange | train | function selectRange(range, window) {
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
} | javascript | {
"resource": ""
} |
q30623 | train | function (p_bDisabled) {
var nButtons = this.getCount(),
i;
if (nButtons > 0) {
i = nButtons - 1;
do {
this._buttons[i].set("disabled", p_bDisabled);
}
while (i--);
}
} | javascript | {
"resource": ""
} | |
q30624 | train | function() {
var columndefs = this.setColumnDefs();
/**
* YUI's datatable instance
*/
this.datatable = new YAHOO.widget.DataTable(this.element, columndefs, this.options.datasource, this.options.datatableOpts);
this.datatable.subscribe('cellClickEvent', this._onCellClick, this, true);
// Automatically set up the paginator
if(this.options.datatableOpts && this.options.datatableOpts.paginator) {
this.datatable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
if(oPayload) {
oPayload.totalRecords = oResponse.meta.totalRecords;
}
return oPayload;
};
}
// Insert button
if ( this.options.allowInsert ){
this.insertButton = inputEx.cn('input', {type:'button', value:msgs.insertItemText}, null, null);
Event.addListener(this.insertButton, 'click', this.onInsertButton, this, true);
this.options.parentEl.appendChild(this.insertButton);
}
// Set up editing flow
var highlightEditableCell = function(oArgs) {
var elCell = oArgs.target;
if(Dom.hasClass(elCell, "yui-dt-editable") || Dom.hasClass(elCell,"yui-dt-col-delete") || Dom.hasClass(elCell,"yui-dt-col-modify") ) {
this.highlightCell(elCell);
}
};
// Locals
this.datatable.set("MSG_LOADING", msgs.loadingText );
this.datatable.set("MSG_EMPTY", msgs.emptyDataText );
this.datatable.set("MSG_ERROR", msgs.errorDataText );
this.datatable.subscribe("cellMouseoverEvent", highlightEditableCell);
this.datatable.subscribe("cellMouseoutEvent", this.datatable.onEventUnhighlightCell);
} | javascript | {
"resource": ""
} | |
q30625 | train | function(oArgs) {
var elCell = oArgs.target;
if(Dom.hasClass(elCell, "yui-dt-editable") || Dom.hasClass(elCell,"yui-dt-col-delete") || Dom.hasClass(elCell,"yui-dt-col-modify") ) {
this.highlightCell(elCell);
}
} | javascript | {
"resource": ""
} | |
q30626 | train | function() {
var columndefs = this.options.columnDefs || this.fieldsToColumndefs(this.options.fields);
// Adding modify column if we use form editing and if allowModify is true
if(this.options.allowModify ) {
columndefs = columndefs.concat([{
key:'modify',
label:' ',
formatter:function(elCell) {
elCell.innerHTML = msgs.modifyText;
elCell.style.cursor = 'pointer';
}
}]);
}
// Adding delete column
if(this.options.allowDelete) {
columndefs = columndefs.concat([{
key:'delete',
label:' ',
formatter:function(elCell) {
elCell.innerHTML = msgs.deleteText;
elCell.style.cursor = 'pointer';
}
}]);
}
return columndefs;
} | javascript | {
"resource": ""
} | |
q30627 | train | function() {
var that = this;
this.dialog = new inputEx.widget.Dialog({
id: this.options.dialogId,
inputExDef: {
type: 'form',
fields: this.options.fields,
buttons: [
{type: 'submit', value: msgs.saveText, onClick: function() { that.onDialogSave(); return false; /* prevent form submit */} },
{type: 'link', value: msgs.cancelText, onClick: function() { that.onDialogCancel(); } }
]
},
title: this.options.dialogLabel,
panelConfig: this.options.panelConfig
});
// Add a listener on the closing button and hook it to onDialogCancel()
YAHOO.util.Event.addListener(that.dialog.close,"click",function(){
that.onDialogCancel();
},that);
} | javascript | {
"resource": ""
} | |
q30628 | train | function() {
var newvalues, record;
//Validate the Form
if ( !this.dialog.getForm().validate() ) return ;
// Update the record
if(!this.insertNewRecord){
// Update the row
newvalues = this.dialog.getValue();
this.datatable.updateRow( this.selectedRecord , newvalues );
// Get the new record
record = this.datatable.getRecord(this.selectedRecord);
// Fire the modify event
this.itemModifiedEvt.fire(record);
}
// Adding new record
else{
// Insert a new row
this.datatable.addRow({});
// Set the Selected Record
var rowIndex = this.datatable.getRecordSet().getLength() - 1;
this.selectedRecord = rowIndex;
// Update the row
newvalues = this.dialog.getValue();
this.datatable.updateRow( this.selectedRecord , newvalues );
// Get the new record
record = this.datatable.getRecord(this.selectedRecord);
// Fire the add event
this.itemAddedEvt.fire(record);
}
this.dialog.hide();
} | javascript | {
"resource": ""
} | |
q30629 | train | function(rowIndex) {
if(!this.dialog) {
this.renderDialog();
}
// NOT Inserting new record
this.insertNewRecord = false;
// Set the selected Record
this.selectedRecord = rowIndex;
// Get the selected Record
var record = this.datatable.getRecord(this.selectedRecord);
this.dialog.whenFormAvailable({
fn: function() {
this.dialog.setValue(record.getData());
this.dialog.show();
},
scope: this
});
} | javascript | {
"resource": ""
} | |
q30630 | train | function(e) {
if(!this.dialog) {
this.renderDialog();
}
// Inserting new record
this.insertNewRecord = true;
this.dialog.whenFormAvailable({
fn: function() {
this.dialog.getForm().clear();
this.dialog.show();
},
scope: this
});
} | javascript | {
"resource": ""
} | |
q30631 | train | function(fields) {
var columndefs = [];
for(var i = 0 ; i < fields.length ; i++) {
columndefs.push( this.fieldToColumndef(fields[i]) );
}
return columndefs;
} | javascript | {
"resource": ""
} | |
q30632 | train | function(field) {
var key, label, colmunDef;
// Retro-compatibility with inputParms
if (lang.isObject(field.inputParams)) {
key = field.inputParams.name;
label = field.inputParams.label;
// New prefered way to set options of a field
} else {
key = field.name;
label = field.label;
}
columnDef = {
key: key,
label: label,
sortable: true,
resizeable: true
};
// Field formatter
if(field.type == "date") {
columnDef.formatter = YAHOO.widget.DataTable.formatDate;
}
else if(field.type == "integer" || field.type == "number") {
columnDef.formatter = YAHOO.widget.DataTable.formatNumber;
/*columnDef.sortOptions = {
defaultDir: "asc",
sortFunction: // TODO: sort numbers !!!
}*/
}
// TODO: other formatters
return columnDef;
} | javascript | {
"resource": ""
} | |
q30633 | train | function(callback) {
async.waterfall([
// 1. Resolve loose package versions.
function(done) {
var master = this.master;
var packageToVersions = this.packageToVersions;
Package.versions(master, packageToVersions, function(err, result) {
this.packageToVersions = result;
done(err, result);
}.bind(this));
}.bind(this),
// 2. Dependency search.
this.dependencySearch.bind(this),
// 3. Make sure we have package and package version dirs.
this.makedirs.bind(this),
// 4. Download the world.
this.download.bind(this),
// 5. Commit the downloads to our package repository.
this.commit.bind(this)
], callback);
} | javascript | {
"resource": ""
} | |
q30634 | train | function(parent, depToVersions) {
var newdeps = {};
var packages = Object.keys(depToVersions);
packages.forEach(function(package) {
var currVersions = this.packageToVersions[package];
var depVersions = depToVersions[package];
newdeps[package] = {};
// Check if we are watching this package.
if (!currVersions) {
// Add all of the versions.
debug(parent + ' needs ' + package + '@' +
Object.keys(depVersions).join(', '));
this.packageToVersions[package] = depVersions;
newdeps[package] = depVersions;
return;
}
// Check which versions we are watching.
var versions = Object.keys(depVersions);
versions
.filter(function(version) {
return !(version in currVersions);
})
.forEach(function(version) {
// Add this version.
debug(parent + ' needs ' + package + '@' + version);
this.packageToVersions[package][version] = true;
newdeps[package][version] = true;
}.bind(this));
}.bind(this));
return newdeps;
} | javascript | {
"resource": ""
} | |
q30635 | train | function(callback) {
async.waterfall([
// Make root directory.
maybeMkdir.bind(null, this.root),
// Make tmp directory.
function(done) {
this.tempdir = path.join(this.root, '.tmp');
maybeMkdir(this.tempdir, { purge: true }, done);
}.bind(this),
// Make directories for each package, package version.
function(done) {
var dirs = [];
for (var package in this.packageToVersions) {
dirs.push(path.resolve(this.tempdir, package));
var versions = this.packageToVersions[package];
for (var version in versions) {
dirs.push(path.resolve(this.tempdir, package, version));
}
}
async.parallel(dirs.map(function(dir) {
return maybeMkdir.bind(null, dir);
}), function(err) {
return done && done(err);
});
}.bind(this)
], callback);
} | javascript | {
"resource": ""
} | |
q30636 | train | function(callback) {
async.series([
this.downloadPackageRootObjects.bind(this),
this.downloadPackageVersions.bind(this)
], function(err) {
return callback && callback(err);
});
} | javascript | {
"resource": ""
} | |
q30637 | train | function(callback) {
var packages = Object.keys(this.packageToVersions);
async.parallel(packages.map(function(package) {
var packageRootUrl = url.resolve(this.master, package);
return this.downloadPackageRootObject.bind(this, package, packageRootUrl);
}.bind(this)), function(err) {
return callback && callback(err);
});
} | javascript | {
"resource": ""
} | |
q30638 | train | function(callback) {
var packageToVersions = this.packageToVersions;
var count = Package.versionCount(packageToVersions);
if (count === 0) {
return callback && callback();
}
var packages = Object.keys(packageToVersions);
async.parallel(
packages
.map(function(package) {
var versions = Object.keys(packageToVersions[package]);
return versions.map(function(version) {
return this.downloadPackageVersion.bind(this, package, version);
}.bind(this));
}.bind(this))
.reduce(function(prev, curr) {
return prev.concat(curr);
}),
function(err) {
return callback && callback(err);
}
);
} | javascript | {
"resource": ""
} | |
q30639 | train | function(callback) {
var packageToVersions = this.packageToVersions;
var count = Package.versionCount(packageToVersions);
if (count === 0) {
return callback && callback();
}
// For each package version, check shasum and copy to server root.
var packages = Object.keys(packageToVersions);
async.parallel(
packages
.map(function(package) {
var versions = Object.keys(packageToVersions[package]);
return versions.map(function(version) {
return this.verifyPackageVersion.bind(this, package, version);
}.bind(this));
}.bind(this))
.reduce(function(prev, curr) {
return prev.concat(curr);
}),
function(err) {
if (err) {
return callback && callback(err);
}
ncp(this.tempdir, this.root, callback);
}.bind(this)
);
} | javascript | {
"resource": ""
} | |
q30640 | train | function (container, type, fn) {
var sType = type,
returnVal = false,
index,
cacheItem;
// Look up the real event--either mouseover or mouseout
if (type == "mouseenter" || type == "mouseleave") {
sType = Event._getType(type);
}
index = Event._getCacheIndex(delegates, container, sType, fn);
if (index >= 0) {
cacheItem = delegates[index];
}
if (container && cacheItem) {
returnVal = Event.removeListener(cacheItem[0], cacheItem[1], cacheItem[3]);
if (returnVal) {
delete delegates[index][2];
delete delegates[index][3];
delegates.splice(index, 1);
}
}
return returnVal;
} | javascript | {
"resource": ""
} | |
q30641 | train | function() {
var val = this.value;
if (this.getter) {
val = this.getter.call(this.owner, this.name, val);
}
return val;
} | javascript | {
"resource": ""
} | |
q30642 | train | function(value, silent) {
var beforeRetVal,
owner = this.owner,
name = this.name;
var event = {
type: name,
prevValue: this.getValue(),
newValue: value
};
if (this.readOnly || ( this.writeOnce && this._written) ) {
return false; // write not allowed
}
if (this.validator && !this.validator.call(owner, value) ) {
return false; // invalid value
}
if (!silent) {
beforeRetVal = owner.fireBeforeChangeEvent(event);
if (beforeRetVal === false) {
return false;
}
}
if (this.setter) {
value = this.setter.call(owner, value, this.name);
if (value === undefined) {
}
}
if (this.method) {
this.method.call(owner, value, this.name);
}
this.value = value; // TODO: set before calling setter/method?
this._written = true;
event.type = name;
if (!silent) {
this.owner.fireChangeEvent(event);
}
return true;
} | javascript | {
"resource": ""
} | |
q30643 | train | function(map, init) {
map = map || {};
if (init) {
this._written = false; // reset writeOnce
}
this._initialConfig = this._initialConfig || {};
for (var key in map) {
if ( map.hasOwnProperty(key) ) {
this[key] = map[key];
if (init) {
this._initialConfig[key] = map[key];
}
}
}
} | javascript | {
"resource": ""
} | |
q30644 | train | function(key){
this._configs = this._configs || {};
var config = this._configs[key];
if (!config || !this._configs.hasOwnProperty(key)) {
return null;
}
return config.getValue();
} | javascript | {
"resource": ""
} | |
q30645 | train | function(key, value, silent){
this._configs = this._configs || {};
var config = this._configs[key];
if (!config) {
return false;
}
return config.setValue(value, silent);
} | javascript | {
"resource": ""
} | |
q30646 | train | function(){
this._configs = this._configs;
var keys = [], key;
for (key in this._configs) {
if ( Lang.hasOwnProperty(this._configs, key) &&
!Lang.isUndefined(this._configs[key]) ) {
keys[keys.length] = key;
}
}
return keys;
} | javascript | {
"resource": ""
} | |
q30647 | train | function(map, silent){
for (var key in map) {
if ( Lang.hasOwnProperty(map, key) ) {
this.set(key, map[key], silent);
}
}
} | javascript | {
"resource": ""
} | |
q30648 | train | function(key, silent){
this._configs = this._configs || {};
if (this._configs[key]) {
this.set(key, this._configs[key]._initialConfig.value, silent);
return true;
}
return false;
} | javascript | {
"resource": ""
} | |
q30649 | train | function(key, silent) {
this._configs = this._configs || {};
var configs = this._configs;
key = ( ( Lang.isString(key) ) ? [key] : key ) ||
this.getAttributeKeys();
for (var i = 0, len = key.length; i < len; ++i) {
if (configs.hasOwnProperty(key[i])) {
this._configs[key[i]].refresh(silent);
}
}
} | javascript | {
"resource": ""
} | |
q30650 | train | function(key) {
this._configs = this._configs || {};
var config = this._configs[key] || {};
var map = {}; // returning a copy to prevent overrides
for (key in config) {
if ( Lang.hasOwnProperty(config, key) ) {
map[key] = config[key];
}
}
return map;
} | javascript | {
"resource": ""
} | |
q30651 | train | function(key, map, init) {
this._configs = this._configs || {};
map = map || {};
if (!this._configs[key]) {
map.name = key;
this._configs[key] = this.createAttribute(map);
} else {
this._configs[key].configure(map, init);
}
} | javascript | {
"resource": ""
} | |
q30652 | train | function(type, callback) {
this._events = this._events || {};
if ( !(type in this._events) ) {
this._events[type] = this.createEvent(type);
}
YAHOO.util.EventProvider.prototype.subscribe.apply(this, arguments);
} | javascript | {
"resource": ""
} | |
q30653 | train | function(e) {
var type = 'before';
type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
e.type = type;
return this.fireEvent(e.type, e);
} | javascript | {
"resource": ""
} | |
q30654 | train | function(type, fn, obj, scope) {
scope = scope || this;
var Event = YAHOO.util.Event,
el = this.get('element') || this.get('id'),
self = this;
if (specialTypes[type] && !Event._createMouseDelegate) {
return false;
}
if (!this._events[type]) { // create on the fly
if (el && this.DOM_EVENTS[type]) {
Event.on(el, type, function(e, matchedEl) {
// Supplement IE with target, currentTarget relatedTarget
if (e.srcElement && !e.target) {
e.target = e.srcElement;
}
if ((e.toElement && !e.relatedTarget) || (e.fromElement && !e.relatedTarget)) {
e.relatedTarget = Event.getRelatedTarget(e);
}
if (!e.currentTarget) {
e.currentTarget = el;
}
// Note: matchedEl el is passed back for delegated listeners
self.fireEvent(type, e, matchedEl);
}, obj, scope);
}
this.createEvent(type, {scope: this});
}
return YAHOO.util.EventProvider.prototype.subscribe.apply(this, arguments); // notify via customEvent
} | javascript | {
"resource": ""
} | |
q30655 | train | function() {
var queue = this._queue;
for (var i = 0, len = queue.length; i < len; ++i) {
this[queue[i][0]].apply(this, queue[i][1]);
}
} | javascript | {
"resource": ""
} | |
q30656 | train | function(parent, before) {
parent = (parent.get) ? parent.get('element') : Dom.get(parent);
this.fireEvent('beforeAppendTo', {
type: 'beforeAppendTo',
target: parent
});
before = (before && before.get) ?
before.get('element') : Dom.get(before);
var element = this.get('element');
if (!element) {
return false;
}
if (!parent) {
return false;
}
if (element.parent != parent) {
if (before) {
parent.insertBefore(element, before);
} else {
parent.appendChild(element);
}
}
this.fireEvent('appendTo', {
type: 'appendTo',
target: parent
});
return element;
} | javascript | {
"resource": ""
} | |
q30657 | train | function(key, map) {
var el = this.get('element');
map = map || {};
map.name = key;
map.setter = map.setter || this.DEFAULT_HTML_SETTER;
map.getter = map.getter || this.DEFAULT_HTML_GETTER;
map.value = map.value || el[key];
this._configs[key] = new YAHOO.util.Attribute(map, this);
} | javascript | {
"resource": ""
} | |
q30658 | train | function(wirings) {
// Reset the internal structure
this.pipes = wirings;
this.pipesByName = {};
// Build the "pipesByName" index
for(var i = 0 ; i < this.pipes.length ; i++) {
this.pipesByName[ this.pipes[i].name] = this.pipes[i];
}
// Customize to display composed module in the left list
this.updateComposedModuleList();
this.updateLoadPanelList();
// Check for autoload param and display the loadPanel otherwise
if(!this.checkAutoLoad()) {
this.loadPanel.show();
}
} | javascript | {
"resource": ""
} | |
q30659 | train | function(string) {
// TODO split params ? &
YAHOO.util.Connect.asyncRequest('GET', this.options.uri+'?availabilityRequest='+string, {
success: function(o) {
var obj = lang.JSON.parse(o.responseText);
if(obj === "true" || !!obj){
this.onAvailable();
}
else if(obj === "false" || !obj){
this.onUnavailable();
}
else{
this.failure(o);
}
},
failure: function(o) {
// TODO ?
},
scope: this
});
} | javascript | {
"resource": ""
} | |
q30660 | train | function() {
if(!this.checkAutoLoadOnce) {
var p = window.location.search.substr(1).split('&');
var oP = {};
for(var i = 0 ; i < p.length ; i++) {
var v = p[i].split('=');
oP[v[0]]=window.decodeURIComponent(v[1]);
}
this.checkAutoLoadOnce = true;
if(oP.autoload) {
this.loadPipe(oP.autoload);
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q30661 | checkPhantomjsVersion | train | function checkPhantomjsVersion(phantomPath) {
console.log('Found PhantomJS at', phantomPath, '...verifying')
return kew.nfcall(cp.execFile, phantomPath, ['--version']).then(function (stdout) {
var version = stdout.trim()
if (helper.version == version) {
return true
} else {
console.log('PhantomJS detected, but wrong version', stdout.trim(), '@', phantomPath + '.')
return false
}
}).fail(function (err) {
console.error('Error verifying phantomjs, continuing', err)
return false
})
} | javascript | {
"resource": ""
} |
q30662 | verifyChecksum | train | function verifyChecksum(fileName, checksum) {
return kew.resolve(hasha.fromFile(fileName, {algorithm: 'sha256'})).then(function (hash) {
var result = checksum == hash
if (result) {
console.log('Verified checksum of previously downloaded file')
} else {
console.log('Checksum did not match')
}
return result
}).fail(function (err) {
console.error('Failed to verify checksum: ', err)
return false
})
} | javascript | {
"resource": ""
} |
q30663 | _storeStates | train | function _storeStates() {
var moduleName, moduleObj, initialStates = [], currentStates = [];
for (moduleName in _modules) {
if (YAHOO.lang.hasOwnProperty(_modules, moduleName)) {
moduleObj = _modules[moduleName];
initialStates.push(moduleName + "=" + moduleObj.initialState);
currentStates.push(moduleName + "=" + moduleObj.currentState);
}
}
_stateField.value = initialStates.join("&") + "|" + currentStates.join("&");
if (YAHOO.env.ua.webkit) {
_stateField.value += "|" + _fqstates.join(",");
}
} | javascript | {
"resource": ""
} |
q30664 | _handleFQStateChange | train | function _handleFQStateChange(fqstate) {
var i, len, moduleName, moduleObj, modules, states, tokens, currentState;
if (!fqstate) {
// Notifies all modules
for (moduleName in _modules) {
if (YAHOO.lang.hasOwnProperty(_modules, moduleName)) {
moduleObj = _modules[moduleName];
moduleObj.currentState = moduleObj.initialState;
moduleObj.onStateChange(unescape(moduleObj.currentState));
}
}
return;
}
modules = [];
states = fqstate.split("&");
for (i = 0, len = states.length; i < len; i++) {
tokens = states[i].split("=");
if (tokens.length === 2) {
moduleName = tokens[0];
currentState = tokens[1];
modules[moduleName] = currentState;
}
}
for (moduleName in _modules) {
if (YAHOO.lang.hasOwnProperty(_modules, moduleName)) {
moduleObj = _modules[moduleName];
currentState = modules[moduleName];
if (!currentState || moduleObj.currentState !== currentState) {
moduleObj.currentState = currentState || moduleObj.initialState;
moduleObj.onStateChange(unescape(moduleObj.currentState));
}
}
}
} | javascript | {
"resource": ""
} |
q30665 | _updateIFrame | train | function _updateIFrame (fqstate) {
var html, doc;
html = '<html><body><div id="state">' +
fqstate.replace(/&/g,'&').
replace(/</g,'<').
replace(/>/g,'>').
replace(/"/g,'"') +
'</div></body></html>';
try {
doc = _histFrame.contentWindow.document;
doc.open();
doc.write(html);
doc.close();
return true;
} catch (e) {
return false;
}
} | javascript | {
"resource": ""
} |
q30666 | _checkIframeLoaded | train | function _checkIframeLoaded() {
var doc, elem, fqstate, hash;
if (!_histFrame.contentWindow || !_histFrame.contentWindow.document) {
// Check again in 10 msec...
setTimeout(_checkIframeLoaded, 10);
return;
}
// Start the thread that will have the responsibility to
// periodically check whether a navigate operation has been
// requested on the main window. This will happen when
// YAHOO.util.History.navigate has been called or after
// the user has hit the back/forward button.
doc = _histFrame.contentWindow.document;
elem = doc.getElementById("state");
// We must use innerText, and not innerHTML because our string contains
// the "&" character (which would end up being escaped as "&") and
// the string comparison would fail...
fqstate = elem ? elem.innerText : null;
hash = _getHash();
setInterval(function () {
var newfqstate, states, moduleName, moduleObj, newHash, historyLength;
doc = _histFrame.contentWindow.document;
elem = doc.getElementById("state");
// See my comment above about using innerText instead of innerHTML...
newfqstate = elem ? elem.innerText : null;
newHash = _getHash();
if (newfqstate !== fqstate) {
fqstate = newfqstate;
_handleFQStateChange(fqstate);
if (!fqstate) {
states = [];
for (moduleName in _modules) {
if (YAHOO.lang.hasOwnProperty(_modules, moduleName)) {
moduleObj = _modules[moduleName];
states.push(moduleName + "=" + moduleObj.initialState);
}
}
newHash = states.join("&");
} else {
newHash = fqstate;
}
// Allow the state to be bookmarked by setting the top window's
// URL fragment identifier. Note that here, we are on IE, and
// IE does not touch the browser history when setting the hash
// (unlike all the other browsers). I used to write:
// top.location.replace( "#" + hash );
// but this had a side effect when the page was not the top frame.
top.location.hash = newHash;
hash = newHash;
_storeStates();
} else if (newHash !== hash) {
// The hash has changed. The user might have clicked on a link,
// or modified the URL directly, or opened the same application
// bookmarked in a specific state using a bookmark. However, we
// know the hash change was not caused by a hit on the back or
// forward buttons, or by a call to navigate() (because it would
// have been handled above) We must handle these cases, which is
// why we also need to keep track of hash changes on IE!
// Note that IE6 has some major issues with this kind of user
// interaction (the history stack gets completely messed up)
// but it seems to work fine on IE7.
hash = newHash;
// Now, store a new history entry. The following will cause the
// code above to execute, doing all the dirty work for us...
_updateIFrame(newHash);
}
}, 50);
_initialized = true;
YAHOO.util.History.onLoadEvent.fire();
} | javascript | {
"resource": ""
} |
q30667 | _initialize | train | function _initialize() {
var i, len, parts, tokens, moduleName, moduleObj, initialStates, initialState, currentStates, currentState, counter, hash;
// Decode the content of our storage field...
parts = _stateField.value.split("|");
if (parts.length > 1) {
initialStates = parts[0].split("&");
for (i = 0, len = initialStates.length; i < len; i++) {
tokens = initialStates[i].split("=");
if (tokens.length === 2) {
moduleName = tokens[0];
initialState = tokens[1];
moduleObj = _modules[moduleName];
if (moduleObj) {
moduleObj.initialState = initialState;
}
}
}
currentStates = parts[1].split("&");
for (i = 0, len = currentStates.length; i < len; i++) {
tokens = currentStates[i].split("=");
if (tokens.length >= 2) {
moduleName = tokens[0];
currentState = tokens[1];
moduleObj = _modules[moduleName];
if (moduleObj) {
moduleObj.currentState = currentState;
}
}
}
}
if (parts.length > 2) {
_fqstates = parts[2].split(",");
}
if (YAHOO.env.ua.ie) {
if (typeof document.documentMode === "undefined" || document.documentMode < 8) {
// IE < 8 or IE8 in quirks mode or IE7 standards mode
_checkIframeLoaded();
} else {
// IE8 in IE8 standards mode
YAHOO.util.Event.on(top, "hashchange",
function () {
var hash = _getHash();
_handleFQStateChange(hash);
_storeStates();
});
_initialized = true;
YAHOO.util.History.onLoadEvent.fire();
}
} else {
// Start the thread that will have the responsibility to
// periodically check whether a navigate operation has been
// requested on the main window. This will happen when
// YAHOO.util.History.navigate has been called or after
// the user has hit the back/forward button.
// On Safari 1.x and 2.0, the only way to catch a back/forward
// operation is to watch history.length... We basically exploit
// what I consider to be a bug (history.length is not supposed
// to change when going back/forward in the history...) This is
// why, in the following thread, we first compare the hash,
// because the hash thing will be fixed in the next major
// version of Safari. So even if they fix the history.length
// bug, all this will still work!
counter = history.length;
// On Gecko and Opera, we just need to watch the hash...
hash = _getHash();
setInterval(function () {
var state, newHash, newCounter;
newHash = _getHash();
newCounter = history.length;
if (newHash !== hash) {
hash = newHash;
counter = newCounter;
_handleFQStateChange(hash);
_storeStates();
} else if (newCounter !== counter && YAHOO.env.ua.webkit) {
hash = newHash;
counter = newCounter;
state = _fqstates[counter - 1];
_handleFQStateChange(state);
_storeStates();
}
}, 50);
_initialized = true;
YAHOO.util.History.onLoadEvent.fire();
}
} | javascript | {
"resource": ""
} |
q30668 | train | function (fn, obj, overrideContext) {
if (_initialized) {
setTimeout(function () {
var ctx = window;
if (overrideContext) {
if (overrideContext === true) {
ctx = obj;
} else {
ctx = overrideContext;
}
}
fn.call(ctx, "onLoad", [], obj);
}, 0);
} else {
YAHOO.util.History.onLoadEvent.subscribe(fn, obj, overrideContext);
}
} | javascript | {
"resource": ""
} | |
q30669 | train | function (module, initialState, onStateChange, obj, overrideContext) {
var scope, wrappedFn;
if (typeof module !== "string" || YAHOO.lang.trim(module) === "" ||
typeof initialState !== "string" ||
typeof onStateChange !== "function") {
throw new Error("Missing or invalid argument");
}
if (_modules[module]) {
// Here, we used to throw an exception. However, users have
// complained about this behavior, so we now just return.
return;
}
// Note: A module CANNOT be registered after calling
// YAHOO.util.History.initialize. Indeed, we set the initial state
// of each registered module in YAHOO.util.History.initialize.
// If you could register a module after initializing the Browser
// History Manager, you would not read the correct state using
// YAHOO.util.History.getCurrentState when coming back to the
// page using the back button.
if (_initialized) {
throw new Error("All modules must be registered before calling YAHOO.util.History.initialize");
}
// Make sure the strings passed in do not contain our separators "," and "|"
module = escape(module);
initialState = escape(initialState);
// If the user chooses to override the scope, we use the
// custom object passed in as the execution scope.
scope = null;
if (overrideContext === true) {
scope = obj;
} else {
scope = overrideContext;
}
wrappedFn = function (state) {
return onStateChange.call(scope, state, obj);
};
_modules[module] = {
name: module,
initialState: initialState,
currentState: initialState,
onStateChange: wrappedFn
};
} | javascript | {
"resource": ""
} | |
q30670 | train | function (stateField, histFrame) {
if (_initialized) {
// The browser history manager has already been initialized.
return;
}
if (YAHOO.env.ua.opera && typeof history.navigationMode !== "undefined") {
// Disable Opera's fast back/forward navigation mode and puts
// it in compatible mode. This makes anchor-based history
// navigation work after the page has been navigated away
// from and re-activated, at the cost of slowing down
// back/forward navigation to and from that page.
history.navigationMode = "compatible";
}
if (typeof stateField === "string") {
stateField = document.getElementById(stateField);
}
if (!stateField ||
stateField.tagName.toUpperCase() !== "TEXTAREA" &&
(stateField.tagName.toUpperCase() !== "INPUT" ||
stateField.type !== "hidden" &&
stateField.type !== "text")) {
throw new Error("Missing or invalid argument");
}
_stateField = stateField;
// IE < 8 or IE8 in quirks mode or IE7 standards mode
if (YAHOO.env.ua.ie && (typeof document.documentMode === "undefined" || document.documentMode < 8)) {
if (typeof histFrame === "string") {
histFrame = document.getElementById(histFrame);
}
if (!histFrame || histFrame.tagName.toUpperCase() !== "IFRAME") {
throw new Error("Missing or invalid argument");
}
_histFrame = histFrame;
}
// Note that the event utility MUST be included inline in the page.
// If it gets loaded later (which you may want to do to improve the
// loading speed of your site), the onDOMReady event never fires,
// and the history library never gets fully initialized.
YAHOO.util.Event.onDOMReady(_initialize);
} | javascript | {
"resource": ""
} | |
q30671 | train | function (module) {
var moduleObj;
if (typeof module !== "string") {
throw new Error("Missing or invalid argument");
}
if (!_initialized) {
throw new Error("The Browser History Manager is not initialized");
}
moduleObj = _modules[module];
if (!moduleObj) {
throw new Error("No such registered module: " + module);
}
return unescape(moduleObj.currentState);
} | javascript | {
"resource": ""
} | |
q30672 | train | function (module) {
var i, len, idx, hash, states, tokens, moduleName;
if (typeof module !== "string") {
throw new Error("Missing or invalid argument");
}
// Use location.href instead of location.hash which is already
// URL-decoded, which creates problems if the state value
// contained special characters...
idx = top.location.href.indexOf("#");
if (idx >= 0) {
hash = top.location.href.substr(idx + 1);
states = hash.split("&");
for (i = 0, len = states.length; i < len; i++) {
tokens = states[i].split("=");
if (tokens.length === 2) {
moduleName = tokens[0];
if (moduleName === module) {
return unescape(tokens[1]);
}
}
}
}
return null;
} | javascript | {
"resource": ""
} | |
q30673 | train | function (paramName, url) {
var i, len, idx, queryString, params, tokens;
url = url || top.location.href;
idx = url.indexOf("?");
queryString = idx >= 0 ? url.substr(idx + 1) : url;
// Remove the hash if any
idx = queryString.lastIndexOf("#");
queryString = idx >= 0 ? queryString.substr(0, idx) : queryString;
params = queryString.split("&");
for (i = 0, len = params.length; i < len; i++) {
tokens = params[i].split("=");
if (tokens.length >= 2) {
if (tokens[0] === paramName) {
return unescape(tokens[1]);
}
}
}
return null;
} | javascript | {
"resource": ""
} | |
q30674 | train | function () {
var ui = Paginator.ui,
name,UIComp;
for (name in ui) {
if (ui.hasOwnProperty(name)) {
UIComp = ui[name];
if (isObject(UIComp) && isFunction(UIComp.init)) {
UIComp.init(this);
}
}
}
} | javascript | {
"resource": ""
} | |
q30675 | train | function (e) {
var v = e.newValue,rpp,state;
if (e.prevValue !== v) {
if (v !== Paginator.VALUE_UNLIMITED) {
rpp = this.get('rowsPerPage');
if (rpp && this.get('recordOffset') >= v) {
state = this.getState({
totalRecords : e.prevValue,
recordOffset : this.get('recordOffset')
});
this.set('recordOffset', state.before.recordOffset);
this._firePageChange(state);
}
}
}
} | javascript | {
"resource": ""
} | |
q30676 | train | function (e) {
if (e.prevValue !== e.newValue) {
var change = this._state || {},
state;
change[e.type.replace(/Change$/,'')] = e.prevValue;
state = this.getState(change);
if (state.page !== state.before.page) {
if (this._batch) {
this._pageChanged = true;
} else {
this._firePageChange(state);
}
}
}
} | javascript | {
"resource": ""
} | |
q30677 | train | function (state) {
if (isObject(state)) {
var current = state.before;
delete state.before;
this.fireEvent('pageChange',{
type : 'pageChange',
prevValue : state.page,
newValue : current.page,
prevState : state,
newState : current
});
}
} | javascript | {
"resource": ""
} | |
q30678 | train | function () {
if (this.get('rendered')) {
return this;
}
var template = this.get('template'),
state = this.getState(),
// ex. yui-pg0-1 (first paginator, second container)
id_base = Paginator.ID_BASE + this.get('id') + '-',
i, len;
// Assemble the containers, keeping them hidden
for (i = 0, len = this._containers.length; i < len; ++i) {
this._renderTemplate(this._containers[i],template,id_base+i,true);
}
// Show the containers if appropriate
this.updateVisibility();
// Set render attribute manually to support its readOnly contract
if (this._containers.length) {
this.setAttributeConfig('rendered', { value: true });
this.fireEvent('render', state);
// For backward compatibility
this.fireEvent('rendered', state);
}
return this;
} | javascript | {
"resource": ""
} | |
q30679 | train | function (container, template, id_base, hide) {
var containerClass = this.get('containerClass'),
markers, i, len;
if (!container) {
return;
}
// Hide the container while its contents are rendered
Dom.setStyle(container,'display','none');
Dom.addClass(container, containerClass);
// Place the template innerHTML, adding marker spans to the template
// html to indicate drop zones for ui components
container.innerHTML = template.replace(/\{([a-z0-9_ \-]+)\}/gi,
'<span class="yui-pg-ui yui-pg-ui-$1"></span>');
// Replace each marker with the ui component's render() output
markers = Dom.getElementsByClassName('yui-pg-ui','span',container);
for (i = 0, len = markers.length; i < len; ++i) {
this.renderUIComponent(markers[i], id_base);
}
if (!hide) {
// Show the container allowing page reflow
Dom.setStyle(container,'display','');
}
} | javascript | {
"resource": ""
} | |
q30680 | train | function (e) {
var alwaysVisible = this.get('alwaysVisible'),
totalRecords,visible,rpp,rppOptions,i,len;
if (!e || e.type === 'alwaysVisibleChange' || !alwaysVisible) {
totalRecords = this.get('totalRecords');
visible = true;
rpp = this.get('rowsPerPage');
rppOptions = this.get('rowsPerPageOptions');
if (isArray(rppOptions)) {
for (i = 0, len = rppOptions.length; i < len; ++i) {
rpp = Math.min(rpp,rppOptions[i]);
}
}
if (totalRecords !== Paginator.VALUE_UNLIMITED &&
totalRecords <= rpp) {
visible = false;
}
visible = visible || alwaysVisible;
for (i = 0, len = this._containers.length; i < len; ++i) {
Dom.setStyle(this._containers[i],'display',
visible ? '' : 'none');
}
}
} | javascript | {
"resource": ""
} | |
q30681 | train | function () {
var records = this.get('totalRecords'),
perPage = this.get('rowsPerPage');
// rowsPerPage not set. Can't calculate
if (!perPage) {
return null;
}
if (records === Paginator.VALUE_UNLIMITED) {
return Paginator.VALUE_UNLIMITED;
}
return Math.ceil(records/perPage);
} | javascript | {
"resource": ""
} | |
q30682 | train | function (page) {
if (!lang.isNumber(page) || page < 1) {
return false;
}
var totalPages = this.getTotalPages();
return (totalPages === Paginator.VALUE_UNLIMITED || totalPages >= page);
} | javascript | {
"resource": ""
} | |
q30683 | train | function () {
var currentPage = this.getCurrentPage(),
totalPages = this.getTotalPages();
return currentPage && (totalPages === Paginator.VALUE_UNLIMITED || currentPage < totalPages);
} | javascript | {
"resource": ""
} | |
q30684 | train | function (page) {
if (!lang.isNumber(page)) {
page = this.getCurrentPage();
}
var perPage = this.get('rowsPerPage'),
records = this.get('totalRecords'),
start, end;
if (!page || !perPage) {
return null;
}
start = (page - 1) * perPage;
if (records !== Paginator.VALUE_UNLIMITED) {
if (start >= records) {
return null;
}
end = Math.min(start + perPage, records) - 1;
} else {
end = start + perPage - 1;
}
return [start,end];
} | javascript | {
"resource": ""
} | |
q30685 | train | function (page,silent) {
if (this.hasPage(page) && page !== this.getCurrentPage()) {
if (this.get('updateOnChange') || silent) {
this.set('recordOffset', (page - 1) * this.get('rowsPerPage'));
} else {
this.fireEvent('changeRequest',this.getState({'page':page}));
}
}
} | javascript | {
"resource": ""
} | |
q30686 | train | function (rpp,silent) {
if (Paginator.isNumeric(rpp) && +rpp > 0 &&
+rpp !== this.get('rowsPerPage')) {
if (this.get('updateOnChange') || silent) {
this.set('rowsPerPage',rpp);
} else {
this.fireEvent('changeRequest',
this.getState({'rowsPerPage':+rpp}));
}
}
} | javascript | {
"resource": ""
} | |
q30687 | train | function (total,silent) {
if (Paginator.isNumeric(total) && +total >= 0 &&
+total !== this.get('totalRecords')) {
if (this.get('updateOnChange') || silent) {
this.set('totalRecords',total);
} else {
this.fireEvent('changeRequest',
this.getState({'totalRecords':+total}));
}
}
} | javascript | {
"resource": ""
} | |
q30688 | train | function (offset,silent) {
if (Paginator.isNumeric(offset) && +offset >= 0 &&
+offset !== this.get('recordOffset')) {
if (this.get('updateOnChange') || silent) {
this.set('recordOffset',offset);
} else {
this.fireEvent('changeRequest',
this.getState({'recordOffset':+offset}));
}
}
} | javascript | {
"resource": ""
} | |
q30689 | train | function (state) {
if (isObject(state)) {
// get flux state based on current state with before state as well
this._state = this.getState({});
// use just the state props from the input obj
state = {
page : state.page,
rowsPerPage : state.rowsPerPage,
totalRecords : state.totalRecords,
recordOffset : state.recordOffset
};
// calculate recordOffset from page if recordOffset not specified.
// not using lang.isNumber for support of numeric strings
if (state.page && state.recordOffset === undefined) {
state.recordOffset = (state.page - 1) *
(state.rowsPerPage || this.get('rowsPerPage'));
}
this._batch = true;
this._pageChanged = false;
for (var k in state) {
if (state.hasOwnProperty(k) && this._configs.hasOwnProperty(k)) {
this.set(k,state[k]);
}
}
this._batch = false;
if (this._pageChanged) {
this._pageChanged = false;
this._firePageChange(this.getState(this._state));
}
}
} | javascript | {
"resource": ""
} | |
q30690 | train | function (id_base) {
this.span = document.createElement('span');
this.span.id = id_base + '-page-report';
this.span.className = this.paginator.get('pageReportClass');
this.update();
return this.span;
} | javascript | {
"resource": ""
} | |
q30691 | train | function (e) {
if (e && e.prevValue === e.newValue) {
return;
}
this.span.innerHTML = Paginator.ui.CurrentPageReport.sprintf(
this.paginator.get('pageReportTemplate'),
this.paginator.get('pageReportValueGenerator')(this.paginator));
} | javascript | {
"resource": ""
} | |
q30692 | train | function (id_base) {
var p = this.paginator;
// Set up container
this.container = document.createElement('span');
this.container.id = id_base + '-pages';
this.container.className = p.get('pageLinksContainerClass');
YAHOO.util.Event.on(this.container,'click',this.onClick,this,true);
// Call update, flagging a need to rebuild
this.update({newValue : null, rebuild : true});
return this.container;
} | javascript | {
"resource": ""
} | |
q30693 | train | function (e) {
if (e && e.prevValue === e.newValue) {
return;
}
var p = this.paginator,
currentPage = p.getCurrentPage();
// Replace content if there's been a change
if (this.current !== currentPage || !currentPage || e.rebuild) {
var labelBuilder = p.get('pageLabelBuilder'),
range = Paginator.ui.PageLinks.calculateRange(
currentPage,
p.getTotalPages(),
p.get('pageLinks')),
start = range[0],
end = range[1],
content = '',
linkTemplate,i;
linkTemplate = '<a href="#" class="' + p.get('pageLinkClass') +
'" page="';
for (i = start; i <= end; ++i) {
if (i === currentPage) {
content +=
'<span class="' + p.get('currentPageClass') + ' ' +
p.get('pageLinkClass') + '">' +
labelBuilder(i,p) + '</span>';
} else {
content +=
linkTemplate + i + '">' + labelBuilder(i,p) + '</a>';
}
}
this.container.innerHTML = content;
}
} | javascript | {
"resource": ""
} | |
q30694 | train | function () {
YAHOO.util.Event.purgeElement(this.container,true);
this.container.parentNode.removeChild(this.container);
this.container = null;
} | javascript | {
"resource": ""
} | |
q30695 | train | function (e) {
var t = YAHOO.util.Event.getTarget(e);
if (t && YAHOO.util.Dom.hasClass(t,
this.paginator.get('pageLinkClass'))) {
YAHOO.util.Event.stopEvent(e);
this.paginator.setPage(parseInt(t.getAttribute('page'),10));
}
} | javascript | {
"resource": ""
} | |
q30696 | train | function (e) {
if (e && e.prevValue === e.newValue) {
return;
}
var par = this.current ? this.current.parentNode : null,
after = this.link;
if (par) {
switch (this.paginator.getTotalPages()) {
case Paginator.VALUE_UNLIMITED :
after = this.na; break;
case this.paginator.getCurrentPage() :
after = this.span; break;
}
if (this.current !== after) {
par.replaceChild(after,this.current);
this.current = after;
}
}
} | javascript | {
"resource": ""
} | |
q30697 | train | function (id_base) {
var p = this.paginator,
c = p.get('nextPageLinkClass'),
label = p.get('nextPageLinkLabel'),
last = p.getTotalPages();
this.link = document.createElement('a');
this.span = document.createElement('span');
this.link.id = id_base + '-next-link';
this.link.href = '#';
this.link.className = c;
this.link.innerHTML = label;
YAHOO.util.Event.on(this.link,'click',this.onClick,this,true);
this.span.id = id_base + '-next-span';
this.span.className = c;
this.span.innerHTML = label;
this.current = p.getCurrentPage() === last ? this.span : this.link;
return this.current;
} | javascript | {
"resource": ""
} | |
q30698 | train | function (e) {
if (e && e.prevValue === e.newValue) {
return;
}
var last = this.paginator.getTotalPages(),
par = this.current ? this.current.parentNode : null;
if (this.paginator.getCurrentPage() !== last) {
if (par && this.current === this.span) {
par.replaceChild(this.link,this.current);
this.current = this.link;
}
} else if (this.current === this.link) {
if (par) {
par.replaceChild(this.span,this.current);
this.current = this.span;
}
}
} | javascript | {
"resource": ""
} | |
q30699 | train | function (e) {
if (e && e.prevValue === e.newValue) {
return;
}
var rpp = this.paginator.get('rowsPerPage')+'',
options = this.select.options,
i,len;
for (i = 0, len = options.length; i < len; ++i) {
if (options[i].value === rpp) {
options[i].selected = true;
break;
}
}
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.