_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q51100 | exportDiagramBulk | train | function exportDiagramBulk(diagrams, filename, format, options, fn) {
diagrams = diagrams || [];
filename = filename || "<%=diagram.name%>.png";
format = format || "png";
options = options || {};
// if elements parameter is selector expression, retrieve them from Repository.
if (_.isStrin... | javascript | {
"resource": ""
} |
q51101 | getFee | train | function getFee(callback) {
var fee = this.remote.createTransaction()._computeFee();
callback(null, {fee: utils.dropsToXrp(fee)});
} | javascript | {
"resource": ""
} |
q51102 | isConnected | train | function isConnected(remote) {
if (isNaN(remote._ledger_current_index)) {
// Remote is missing the index of last ledger closed. Unprepared to submit
// transactions
return false;
}
var server = remote.getServer();
if (!server) {
return false;
}
if (remote._stand_alone) {
// If rippled ... | javascript | {
"resource": ""
} |
q51103 | ensureConnected | train | function ensureConnected(remote, callback) {
if (remote.getServer()) {
callback(null, isConnected(remote));
} else {
callback(null, false);
}
} | javascript | {
"resource": ""
} |
q51104 | success | train | function success(response, body) {
var content = _.assign(body || {}, {success: true});
send(response, content, StatusCode.ok);
} | javascript | {
"resource": ""
} |
q51105 | transactionError | train | function transactionError(response, message, body) {
var content = errorContent(ErrorType.transaction, message, body);
send(response, content, StatusCode.internalServerError);
} | javascript | {
"resource": ""
} |
q51106 | apiError | train | function apiError(response, error) {
var content = errorContentExt(ErrorType.server, error);
send(response, content, StatusCode.internalServerError);
} | javascript | {
"resource": ""
} |
q51107 | invalidRequestError | train | function invalidRequestError(response, error) {
var content = errorContentExt(ErrorType.invalidRequest, error);
send(response, content, StatusCode.badRequest);
} | javascript | {
"resource": ""
} |
q51108 | internalError | train | function internalError(response, message, body) {
var content = errorContent(ErrorType.server, message, body);
send(response, content, StatusCode.internalServerError);
} | javascript | {
"resource": ""
} |
q51109 | connectionError | train | function connectionError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.badGateway);
} | javascript | {
"resource": ""
} |
q51110 | timeOutError | train | function timeOutError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.timeout);
} | javascript | {
"resource": ""
} |
q51111 | train | function(transaction, _callback) {
transaction.remote = api.remote;
if (options.blockDuplicates === true) {
blockDuplicates(transaction, options, _callback);
} else {
_callback(null, transaction);
}
} | javascript | {
"resource": ""
} | |
q51112 | train | function(transaction, _callback) {
try {
transaction.secret(secret);
} catch (exception) {
return _callback(exception);
}
transaction.once('error', _callback);
transaction.once('submitted', function(message) {
if (message.result.slice(0, 3) === 'tec'
&... | javascript | {
"resource": ""
} | |
q51113 | getTransactionAndRespond | train | function getTransactionAndRespond(account, identifier, options, callback) {
getTransaction(
this,
account,
identifier,
options,
function(error, transaction) {
if (error) {
callback(error);
} else {
callback(null, {transaction: transaction});
}
}
);
} | javascript | {
"resource": ""
} |
q51114 | getAccountTx | train | function getAccountTx(api, options, callback) {
var params = {
account: options.account,
ledger_index_min: options.ledger_index_min || options.ledger_index || -1,
ledger_index_max: options.ledger_index_max || options.ledger_index || -1,
limit: options.limit || DEFAULT_RESULTS_PER_PAGE,
forward: op... | javascript | {
"resource": ""
} |
q51115 | getLocalAndRemoteTransactions | train | function getLocalAndRemoteTransactions(api, options, callback) {
function queryRippled(_callback) {
getAccountTx(api, options, function(error, results) {
if (error) {
_callback(error);
} else {
// Set marker so that when this function is called again
// recursively it starts f... | javascript | {
"resource": ""
} |
q51116 | transactionFilter | train | function transactionFilter(transactions, options) {
var filtered_transactions = transactions.filter(function(transaction) {
if (options.exclude_failed) {
if (transaction.state === 'failed' || (transaction.meta
&& transaction.meta.TransactionResult !== 'tesSUCCESS')) {
return false;
}... | javascript | {
"resource": ""
} |
q51117 | getAccountTransactions | train | function getAccountTransactions(api, options, callback) {
try {
validate.address(options.account);
} catch(err) {
return callback(err);
}
if (!options.min) {
options.min = module.exports.DEFAULT_RESULTS_PER_PAGE;
}
if (!options.max) {
options.max = Math.max(options.min,
module.exports... | javascript | {
"resource": ""
} |
q51118 | attachPreviousAndNextTransactionIdentifiers | train | function attachPreviousAndNextTransactionIdentifiers(api,
notificationDetails, topCallback) {
// Get all of the transactions affecting the specified
// account in the given ledger. This is done so that
// we can query for one more than that number on either
// side to ensure that we'll find the next and pr... | javascript | {
"resource": ""
} |
q51119 | getAccountTransactionsInBaseTransactionLedger | train | function getAccountTransactionsInBaseTransactionLedger(callback) {
var params = {
account: notificationDetails.account,
ledger_index_min: notificationDetails.transaction.ledger_index,
ledger_index_max: notificationDetails.transaction.ledger_index,
exclude_failed: false,
max: 99999999,
... | javascript | {
"resource": ""
} |
q51120 | getNextAndPreviousTransactions | train | function getNextAndPreviousTransactions(numTransactionsInLedger, callback) {
async.concat([false, true], function(earliestFirst, concat_callback) {
var params = {
account: notificationDetails.account,
max: numTransactionsInLedger + 1,
min: numTransactionsInLedger + 1,
limit: nu... | javascript | {
"resource": ""
} |
q51121 | sortTransactions | train | function sortTransactions(allTransactions, callback) {
allTransactions.push(notificationDetails.transaction);
var txns = _.uniq(allTransactions, function(tx) {
return tx.hash;
});
txns.sort(utils.compareTransactions);
callback(null, txns);
} | javascript | {
"resource": ""
} |
q51122 | findPreviousAndNextTransactions | train | function findPreviousAndNextTransactions(txns, callback) {
// Find the index in the array of the baseTransaction
var baseTransactionIndex = _.findIndex(txns, function(possibility) {
if (possibility.hash === notificationDetails.transaction.hash) {
return true;
} else if (possibility.client_r... | javascript | {
"resource": ""
} |
q51123 | getNotificationHelper | train | function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
function getTransaction(callback) {
try {
transactions.getTransaction(api, account, identifier, {}, callback);
} catch(err) {
callback(err);
}
}
function checkLedger(baseTransaction, callback) {
serverLi... | javascript | {
"resource": ""
} |
q51124 | getNotification | train | function getNotification(account, identifier, urlBase, callback) {
validate.address(account);
validate.paymentIdentifier(identifier);
return getNotificationHelper(this, account, identifier, urlBase, callback);
} | javascript | {
"resource": ""
} |
q51125 | getNotifications | train | function getNotifications(account, urlBase, options, callback) {
validate.address(account);
var self = this;
function getTransactions(_callback) {
var resultsPerPage = options.results_per_page ||
transactions.DEFAULT_RESULTS_PER_PAGE;
var offset = resultsPerPage * ((options.page || 1) - 1);
... | javascript | {
"resource": ""
} |
q51126 | getSettings | train | function getSettings(account, callback) {
validate.address(account);
this.remote.requestAccountInfo({account: account}, function(error, info) {
if (error) {
return callback(error);
}
var data = info.account_data;
var settings = {
account: data.Account,
transfer_rate: '0'
};
... | javascript | {
"resource": ""
} |
q51127 | changeSettings | train | function changeSettings(account, settings, secret, options, callback) {
var transaction = createSettingsTransaction(account, settings);
var converter = _.partial(
TxToRestConverter.parseSettingsResponseFromTx, settings);
transact(transaction, this, secret, options, converter, callback);
} | javascript | {
"resource": ""
} |
q51128 | setTransactionBitFlags | train | function setTransactionBitFlags(transaction, options) {
for (var flagName in options.flags) {
var flag = options.flags[flagName];
// Set transaction flags
if (!(flag.name in options.input)) {
continue;
}
var value = options.input[flag.name];
if (value === options.clear_setting) {
... | javascript | {
"resource": ""
} |
q51129 | formatPaymentHelper | train | function formatPaymentHelper(account, txJSON) {
if (!(txJSON && /^payment$/i.test(txJSON.TransactionType))) {
throw new InvalidRequestError('Not a payment. The transaction '
+ 'corresponding to the given identifier is not a payment.');
}
var metadata = {
client_resource_id: txJSON.client_resource_id... | javascript | {
"resource": ""
} |
q51130 | submitPayment | train | function submitPayment(account, payment, clientResourceID, secret,
urlBase, options, callback) {
function formatTransactionResponse(message, meta) {
if (meta.state === 'validated') {
var txJSON = message.tx_json;
txJSON.meta = message.metadata;
txJSON.validated = message.validated;
tx... | javascript | {
"resource": ""
} |
q51131 | getPayment | train | function getPayment(account, identifier, callback) {
var self = this;
validate.address(account);
validate.paymentIdentifier(identifier);
// If the transaction was not in the outgoing_transactions db,
// get it from rippled
function getTransaction(_callback) {
transactions.getTransaction(self, account,... | javascript | {
"resource": ""
} |
q51132 | getAccountPayments | train | function getAccountPayments(account, source_account, destination_account,
direction, options, callback) {
var self = this;
function getTransactions(_callback) {
var args = {
account: account,
source_account: source_account,
destination_account: destination_account,
direction: direct... | javascript | {
"resource": ""
} |
q51133 | getOrders | train | function getOrders(account, options, callback) {
var self = this;
validate.address(account);
validate.options(options);
function getAccountOrders(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);... | javascript | {
"resource": ""
} |
q51134 | placeOrder | train | function placeOrder(account, order, secret, options, callback) {
var transaction = createOrderTransaction(account, order);
var converter = TxToRestConverter.parseSubmitOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | {
"resource": ""
} |
q51135 | cancelOrder | train | function cancelOrder(account, sequence, secret, options, callback) {
var transaction = createOrderCancellationTransaction(account, sequence);
var converter = TxToRestConverter.parseCancelOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | {
"resource": ""
} |
q51136 | padValue | train | function padValue(value, length) {
assert.strictEqual(typeof value, 'string');
assert.strictEqual(typeof length, 'number');
var result = value;
while (result.length < length) {
result = '0' + result;
}
return result;
} | javascript | {
"resource": ""
} |
q51137 | setTransactionIntFlags | train | function setTransactionIntFlags(transaction, input, flags) {
for (var flagName in flags) {
var flag = flags[flagName];
if (!input.hasOwnProperty(flag.name)) {
continue;
}
var value = input[flag.name];
if (value) {
transaction.tx_json.SetFlag = flag.value;
} else {
transact... | javascript | {
"resource": ""
} |
q51138 | setTransactionFields | train | function setTransactionFields(transaction, input, fieldSchema) {
for (var fieldName in fieldSchema) {
var field = fieldSchema[fieldName];
var value = input[field.name];
if (typeof value === 'undefined') {
continue;
}
// The value required to clear an account root field varies
if (value... | javascript | {
"resource": ""
} |
q51139 | renameCounterpartyToIssuerInOrderChanges | train | function renameCounterpartyToIssuerInOrderChanges(orderChanges) {
return _.mapValues(orderChanges, function(changes) {
return _.map(changes, function(change) {
return utils.renameCounterpartyToIssuerInOrder(change);
});
});
} | javascript | {
"resource": ""
} |
q51140 | parseFlagsFromResponse | train | function parseFlagsFromResponse(responseFlags, flags) {
var parsedFlags = {};
for (var flagName in flags) {
var flag = flags[flagName];
parsedFlags[flag.name] = Boolean(responseFlags & flag.value);
}
return parsedFlags;
} | javascript | {
"resource": ""
} |
q51141 | parseOrderFromTx | train | function parseOrderFromTx(tx, options) {
if (!options.account) {
throw new Error('Internal Error. must supply options.account');
}
if (tx.TransactionType !== 'OfferCreate'
&& tx.TransactionType !== 'OfferCancel') {
throw new Error('Invalid parameter: identifier. The transaction '
+ 'correspond... | javascript | {
"resource": ""
} |
q51142 | parsePaymentsFromPathFind | train | function parsePaymentsFromPathFind(pathfindResults) {
return pathfindResults.alternatives.map(function(alternative) {
return {
source_account: pathfindResults.source_account,
source_tag: '',
source_amount: (typeof alternative.source_amount === 'string' ?
{
value: utils.dropsToXrp(a... | javascript | {
"resource": ""
} |
q51143 | addTrustLine | train | function addTrustLine(account, trustline, secret, options, callback) {
var transaction = createTrustLineTransaction(account, trustline);
var converter = TxToRestConverter.parseTrustResponseFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | {
"resource": ""
} |
q51144 | getStylingNodes | train | function getStylingNodes (selector) {
if (typeof queryCache[selector] === 'undefined') {
queryCache[selector] = Array.prototype.map.call(
document.querySelectorAll(selector),
function (stylesheet) {
return stylesheet.outerHTML;
}
).join('');
}
return queryCache... | javascript | {
"resource": ""
} |
q51145 | getIframeContentForNode | train | function getIframeContentForNode (node, options) {
return '<!doctype html>' +
'<html ' + options.htmlAttr + '>' +
'<head>' +
options.metaCharset +
options.metaViewport +
options.stylesheets +
options.styles +
'</head>' +
'<body ' + options.bodyAttr + '>' +
... | javascript | {
"resource": ""
} |
q51146 | formatAttributes | train | function formatAttributes (attrObj) {
var attributes = [];
for (var attribute in attrObj) {
attributes.push(attribute + '="' + attrObj[attribute] + '"');
}
return attributes.join(' ');
} | javascript | {
"resource": ""
} |
q51147 | iframify | train | function iframify (node, options) {
options = getOptions(options);
var iframe = document.createElement('iframe');
var html = getIframeContentForNode(node, options);
iframe.srcdoc = html;
if (!('srcdoc' in iframe)) {
console.log(
'Your browser does not support the `srcdoc` attribute o... | javascript | {
"resource": ""
} |
q51148 | Loader | train | function Loader () {
var FINAL_STATES = {'loaded': true, 'complete': true, 4: true}
var head = document.getElementsByTagName('head')[0]
var pending = {}
var counter = 0
return {
/**
* @private
* @callback dataCallback
* @memberof Loader.prototype
* @param {object|string} data JSON obje... | javascript | {
"resource": ""
} |
q51149 | createEventHandlers | train | function createEventHandlers (playemFunctions) {
var eventHandlers = {
onApiReady: function (player) {
// console.log(player.label + " api ready");
if (whenReady && player == whenReady.player) { whenReady.fct() }
if (--playersToLoad == 0) { that.emit('onReady') }
},
... | javascript | {
"resource": ""
} |
q51150 | train | function( url, dir, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
var dirPath = dir;
if(typeof options.cwd !== 'undefined')
dirPath = pa... | javascript | {
"resource": ""
} | |
q51151 | train | function( files, options, callback ) {
if ( !Array.isArray( files ) ) {
files = [files];
}
if ( typeof options === 'function' ) {
callback = options;
options = null;
} else if ( typeof options === 'string' ) {
options = { msg: options };
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth', 'ms... | javascript | {
"resource": ""
} | |
q51152 | train | function( url, wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
executeSvn( [ 'relocate', url, wc ], options, callback );
} | javascript | {
"resource": ""
} | |
q51153 | train | function( wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth' ], options );
executeSvnXml( [ 'status', wc ], options, callback );
} | javascript | {
"resource": ""
} | |
q51154 | train | function( wcs, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
if ( !Array.isArray( wcs ) ) {
wcs = [wcs];
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
executeSvn( [ 'update' ].concat(... | javascript | {
"resource": ""
} | |
q51155 | train | function( target, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
info( target, options, function( err, data ) {
var rev;
if ( !err ) {
var revString;
if ( options.lastChangeRevision ) {
if ( data && data.entry && data.ent... | javascript | {
"resource": ""
} | |
q51156 | train | function( wcDir, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
if ( !Array.isArray( wcDir ) ) {
wcDir = [wcDir];
}
var args = [ '-n' ];
if ( options.lastChangeRevision ) {
args.push( '-c' );
}
execSvnVersion( wcDir.concat( ar... | javascript | {
"resource": ""
} | |
q51157 | train | function( url ) {
var trunkMatch = url.match( /(.*)\/(trunk|branches|tags)\/*(.*)\/*(.*)$/i );
if ( trunkMatch ) {
var rootUrl = trunkMatch[1];
var projectName = rootUrl.match( /\/([^\/]+)$/ )[1];
return {
rootUrl: rootUrl,
projectName: projectName,
type: trunkMatch[2],
typeName: trunkMatch[3],
t... | javascript | {
"resource": ""
} | |
q51158 | train | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
var tagsUrl = parseUrl( url ).tagsUrl;
list( tagsUrl, options, function( err, data ) {
var result = [];
if ( !err && data && data.list && data.list.entry ) {
if ( Ar... | javascript | {
"resource": ""
} | |
q51159 | train | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
getTags( url, options, function( err, tagArray ) {
var latest;
if ( !err && Array.isArray( tagArray ) && tagArray.length > 0 ) {
tagArray.sort( function( a, b ) {
... | javascript | {
"resource": ""
} | |
q51160 | train | function( options ) {
this._options = options || {};
this._commands = [];
this._options.tempFolder = this._options.tempFolder || path.join( os.tmpdir(), 'mucc_' + uuid.v4() );
} | javascript | {
"resource": ""
} | |
q51161 | train | function(element, options) {
element = this.setElement(element);
options = this.setOptions(options);
if (!options.target || !options.marker) {
throw new Error('A marker and target is required');
}
if (element.css('overflow') === 'auto') {
this.container ... | javascript | {
"resource": ""
} | |
q51162 | train | function(marker, type) {
marker = $(marker);
// Stop all the unnecessary processing
if (type === 'activate' && marker.hasClass('is-stalked')) {
return;
} else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
return;
}
var options = ... | javascript | {
"resource": ""
} | |
q51163 | train | function() {
var isWindow = this.container.is(window),
eTop = this.element.offset().top,
offset,
offsets = [];
if (this.element.css('overflow') === 'auto' && !this.element.is('body')) {
this.element[0].scrollTop = 0; // Set scroll to top so offsets are co... | javascript | {
"resource": ""
} | |
q51164 | train | function() {
var scroll = this.container.scrollTop(),
offsets = this.offsets,
onlyWithin = this.options.onlyWithin,
threshold = this.options.threshold;
this.markers.each(function(index, marker) {
marker = $(marker);
var offset = offsets[index... | javascript | {
"resource": ""
} | |
q51165 | train | function(element, options) {
this.setElement(element);
this.setOptions(options, this.element);
// Set events
this.addEvent('horizontalresize', 'window', $.debounce(this.onResize.bind(this)));
this.initialize();
// Render the matrix
this.refresh();
} | javascript | {
"resource": ""
} | |
q51166 | train | function() {
this.items = this.element.find('> li').each(function() {
var self = $(this);
// Cache the initial column width
self.cache('matrix-column-width', self.outerWidth());
});
if (this.options.defer) {
this._deferRender();
} else {
... | javascript | {
"resource": ""
} | |
q51167 | train | function() {
this._calculateColumns();
this.fireEvent('rendering');
var element = this.element,
items = this.items;
// No items
if (!items.length) {
element.removeAttr('style');
// Single column
} else if (this.colCount <= 1) {
... | javascript | {
"resource": ""
} | |
q51168 | train | function() {
var wrapperWidth = this.element.outerWidth(),
colWidth = this.options.width,
gutter = this.options.gutter,
cols = Math.max(Math.floor(wrapperWidth / colWidth), 1),
colsWidth = (cols * (colWidth + gutter)) - gutter,
diff;
if (cols ... | javascript | {
"resource": ""
} | |
q51169 | train | function() {
var promises = [];
this.images = this.element.find('img').each(function(index, image) {
if (image.complete) {
return; // Already loaded
}
var src = image.src,
def = $.Deferred();
image.onload = def.resolve;
... | javascript | {
"resource": ""
} | |
q51170 | train | function() {
var item,
span,
size,
l = this.items.length;
this.matrix = [];
for (var i = 0; i < l; i++) {
item = this.items.eq(i);
size = item.data('matrix-column-width');
// How many columns does this item span?
... | javascript | {
"resource": ""
} | |
q51171 | train | function() {
var gutter = this.options.gutter,
items = this.matrix,
item,
span,
dir = this.options.rtl ? 'right' : 'left',
y = [], // The top position values indexed by column
c = 0, // Current column in the loop
h = 0, // Small... | javascript | {
"resource": ""
} | |
q51172 | train | function(element, options) {
var items, self = this;
element = this.setElement(element);
options = this.setOptions(options, element);
// Set animation and ARIA
element
.aria('live', options.autoCycle ? 'assertive' : 'off')
.addClass(options.animation);
... | javascript | {
"resource": ""
} | |
q51173 | train | function() {
this.stop();
// Go to first item
this.jump(0);
// Remove clones
var dir = this._position || 'left';
this.container.transitionend(function() {
$(this)
.addClass('no-transition')
.css(dir, 0)
.find(... | javascript | {
"resource": ""
} | |
q51174 | train | function() {
if (this.options.animation === 'fade') {
return;
}
var dimension = this._dimension, // height or width
containerSize = 0,
sizes = [];
this.container.removeAttr('style');
this.items.each(function() {
var item = $(this... | javascript | {
"resource": ""
} | |
q51175 | train | function(index) {
if (this.animating) {
return;
}
var indexes = this._getIndex(index),
cloneIndex = indexes[0], // The index including clones
visualIndex = indexes[1]; // The index excluding clones
// Exit early if jumping to same index
if (v... | javascript | {
"resource": ""
} | |
q51176 | train | function() {
if (this.options.autoCycle) {
clearInterval(this.timer);
this.timer = setInterval(this.onCycle.bind(this), this.options.duration);
}
} | javascript | {
"resource": ""
} | |
q51177 | train | function() {
this.animating = false;
var container = this.container,
resetTo = this._resetTo;
// Reset the currently shown item to a specific index
// This achieves the circular infinite scrolling effect
if (resetTo !== null) {
container
... | javascript | {
"resource": ""
} | |
q51178 | train | function() {
var options = this.options,
items = this.items,
container = this.container,
itemsToShow = options.itemsToShow;
if (!options.infinite) {
return;
}
// Append the first items
items.slice(0, itemsToShow)
.clon... | javascript | {
"resource": ""
} | |
q51179 | train | function(index) {
var sum = 0;
$.each(this._sizes, function(i, value) {
if (i < index) {
sum += value.totalSize;
}
});
return sum;
} | javascript | {
"resource": ""
} | |
q51180 | train | function() {
var options = this.options,
animation = options.animation;
// Cycling more than the show amount causes unexpected issues
if (options.itemsToCycle > options.itemsToShow) {
options.itemsToCycle = options.itemsToShow;
}
// Fade animations can o... | javascript | {
"resource": ""
} | |
q51181 | train | function(index) {
this.items
.removeClass('is-active')
.aria('hidden', true)
.slice(index, index + this.options.itemsToShow)
.addClass('is-active')
.aria('hidden', false);
} | javascript | {
"resource": ""
} | |
q51182 | train | function(start) {
var itemsToShow = this.options.itemsToShow,
length = this.items.length,
stop = start + itemsToShow,
set = $([]),
tabs = this.tabs
.removeClass('is-active')
.aria('toggled', false);
if (!tabs.length) {
... | javascript | {
"resource": ""
} | |
q51183 | train | function(nodes, options) {
var element;
options = this.setOptions(options);
this.element = element = this.createElement();
// Nodes found in the page on initialization
this.nodes = $(nodes);
// The wrapping items element
this.items = element.find(this.ns('items... | javascript | {
"resource": ""
} | |
q51184 | train | function(index) {
if (this.animating) {
return;
}
index = $.bound(index, this.data.length);
// Exit since transitions don't occur
if (index === this.index) {
return;
}
var self = this,
element = this.element,
capt... | javascript | {
"resource": ""
} | |
q51185 | train | function(node) {
this.node = node = $(node);
this.index = -1;
var options = this.inheritOptions(this.options, node),
read = this.readValue,
category = read(node, options.getCategory),
items = [],
index = 0;
// Multiple items based on cate... | javascript | {
"resource": ""
} | |
q51186 | train | function(items) {
this.data = items;
this.items.empty();
this.tabs.empty();
for (var li, a, item, i = 0; item = items[i]; i++) {
li = $('<li/>');
li.appendTo(this.items);
a = $('<a/>')
.attr('href', 'javascript:;')
.da... | javascript | {
"resource": ""
} | |
q51187 | train | function(width, height) {
var gutter = (this.options.gutter * 2),
wWidth = $(window).width() - gutter,
wHeight = $(window).height() - gutter,
ratio,
diff;
// Resize if the width is larger
if (width > wWidth) {
ratio = (width / height);... | javascript | {
"resource": ""
} | |
q51188 | train | function(plugin, callback, collection) {
var name = plugin;
// Prefix with toolkit to avoid collisions
if ($.fn[name]) {
name = 'toolkit' + name.charAt(0).toUpperCase() + name.slice(1);
}
$.fn[name] = collection ?
// Apply the instance to a collection o... | javascript | {
"resource": ""
} | |
q51189 | train | function() {
var instance = Toolkit.cache[plugin + ':' + this.selector] = callback.apply(this, arguments);
return this.each(function() {
$(this).cache('toolkit.' + plugin, instance);
});
} | javascript | {
"resource": ""
} | |
q51190 | train | function(event, context, callback, selector) {
var options = this.options;
// Replace tokens
if (event === '{mode}') {
event = options.mode;
}
if (selector === '{selector}') {
selector = this.nodes ? this.nodes.selector : '';
}
// Find a... | javascript | {
"resource": ""
} | |
q51191 | train | function(type, callback) {
var list = this.__hooks[type] || [];
list.push(callback);
this.__hooks[type] = list;
} | javascript | {
"resource": ""
} | |
q51192 | train | function(type, callbacks) {
$.each(callbacks, function(i, callback) {
this.addHook(type, callback);
}.bind(this));
} | javascript | {
"resource": ""
} | |
q51193 | train | function(type) {
var self = this,
event,
context,
func,
selector,
win = $(window),
doc = $(document);
$.each(this.__events, function(i, value) {
event = value[0];
context = value[1];
func = value... | javascript | {
"resource": ""
} | |
q51194 | train | function(type, args) {
var debug = this.options.debug || Toolkit.debug;
if (debug) {
console.log(this.name + '#' + this.uid, new Date().getMilliseconds(), type, args || []);
if (debug === 'verbose') {
console.dir(this);
}
}
var hooks... | javascript | {
"resource": ""
} | |
q51195 | train | function(type, callback) {
if (!callback) {
delete this.__hooks[type];
return;
}
var hooks = this.__hooks[type];
if (hooks) {
$.each(hooks, function(i, hook) {
if (hook === callback) {
hooks = hooks.splice(i, 1);
... | javascript | {
"resource": ""
} | |
q51196 | train | function(options) {
var opts = $.extend(true, {}, Toolkit[this.name].options, options || {}),
key;
// Inherit options based on responsive media queries
if (opts.responsive && window.matchMedia) {
$.each(opts.responsive, function(key, resOpts) {
if (matchM... | javascript | {
"resource": ""
} | |
q51197 | doAria | train | function doAria(element, key, value) {
if ($.type(value) === 'undefined') {
return element.getAttribute('aria-' + key);
}
if (value === true) {
value = 'true';
} else if (value === false) {
value = 'false';
}
element.setAttribute('aria-' + key, value);
} | javascript | {
"resource": ""
} |
q51198 | train | function(type, args) {
Base.prototype.fireEvent.call(this, type, args);
var element = this.element,
node = this.node,
event = $.Event(type + '.toolkit.' + this.keyName);
event.context = this;
// Trigger event on the element and the node
if (element) ... | javascript | {
"resource": ""
} | |
q51199 | train | function(options, element) {
var key, value, obj = {};
for (key in options) {
if (key === 'context' || key === 'template') {
continue;
}
value = element.data((this.keyName + '-' + key).toLowerCase());
if ($.type(value) !== 'undefined') {... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.