_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q27100 | main | train | async function main(inputDir) {
const index = new Index();
try {
const files = await readdir(inputDir);
// Get a list of all files in the directory (filter out other directories)
const allImageFiles = (await Promise.all(
files.map(async file => {
const filename = path.join(inputDir, file)... | javascript | {
"resource": ""
} |
q27101 | saveScreenshotIfExists | train | function saveScreenshotIfExists(testResults) {
var deferred = Q.defer();
if (testResults.screenshotBuffer) {
var screenshotFilePath = path.join(resultsDir, testResults.runId, resultScreenshotName);
fs.writeFile(screenshotFilePath, testResults.screenshotBuffer);
| javascript | {
"resource": ""
} |
q27102 | spyEnabled | train | function spyEnabled(state, reason) {
enabled = (state === true);
| javascript | {
"resource": ""
} |
q27103 | pushContext | train | function pushContext(data) {
// Some data is not needed on subchildren
if (depth === 0) {
data.timestamp = Date.now() - responseEndTime;
data.loadingStep = phantomas.currentStep || '';
... | javascript | {
"resource": ""
} |
q27104 | leaveContext | train | function leaveContext(moreData) {
// Some data is not needed on subchildren
if (depth === 1) {
currentContext.data.time = Date.now() - currentContext.data.timestamp - responseEndTime;
}
... | javascript | {
"resource": ""
} |
q27105 | readFullTree | train | function readFullTree() {
// Return null if the contextTree is not correctly closed
if (root !== currentContext) {
return null;
}
function recusiveRead(node) {
if (nod... | javascript | {
"resource": ""
} |
q27106 | generateCriticalCssWrapped | train | async function generateCriticalCssWrapped (
options,
{ forceTryRestartBrowser } = {}
) {
const width = parseInt(options.width || DEFAULT_VIEWPORT_WIDTH, 10)
const height = parseInt(options.height || DEFAULT_VIEWPORT_HEIGHT, 10)
const timeoutWait = options.timeout || DEFAULT_TIMEOUT
// Merge properties with ... | javascript | {
"resource": ""
} |
q27107 | startNewJob | train | function startNewJob () {
const url = urls.pop() // NOTE: mutates urls array
if (!url) {
// no more new jobs to process (might still be jobs currently in process)
return Promise.resolve()
}
return penthouse({
url,
...penthouseOptions
})
.then(criticalCss => {
// | javascript | {
"resource": ""
} |
q27108 | train | function(url) {
if (silentMode) {
return;
}
console.log(
colors.bold('\nTesting ' + link(url)) +
' ... please wait, this may take a minute.'
| javascript | {
"resource": ""
} | |
q27109 | logResults | train | function logResults(results) {
const { violations, testEngine, testEnvironment, testRunner } = results;
if (violations.length === 0) {
cliReporter(colors.green(' 0 violations found!'));
return;
}
const issueCount = violations.reduce((count, violation) => {
cliReporter(
'\n' +
error(' Viola... | javascript | {
"resource": ""
} |
q27110 | patchPackageJSON_preNodeGyp_modulePath | train | function patchPackageJSON_preNodeGyp_modulePath(filePath)
{
let packageReadData = fs.readFileSync(filePath);
let packageJSON = JSON.parse(packageReadData);
if ( packageJSON && packageJSON.binary && packageJSON.binary.module_path ) {
let binaryPathConfiguration = packageJSON.binary.module_path;
binaryPathC... | javascript | {
"resource": ""
} |
q27111 | visitPackageJSON | train | function visitPackageJSON(folderPath)
{
let files = fs.readdirSync(folderPath);
for (var i in files) {
let name = files[i];
let filePath = path.join(folderPath, files[i]);
if(fs.statSync(filePath).isDirectory()) {
visitPackageJSON(filePath);
| javascript | {
"resource": ""
} |
q27112 | train | function(fileName)
{
var configurations = xcodeProject.pbxXCBuildConfigurationSection(),
INHERITED = '"$(inherited)"',
config, buildSettings, searchPaths;
var fileDir = path.dirname(fileName);
var filePos = '"\\"' + fileDir + '\\""';
for (config in configurations) {
| javascript | {
"resource": ""
} | |
q27113 | _extend | train | function _extend (dst, ...sources) {
if (dst && sources) {
for (let src of sources) {
if (typeof src === 'object') {
| javascript | {
"resource": ""
} |
q27114 | _clone | train | function _clone(src) {
if (!src) {
return src;
}
if (typeof src.clone === 'function') {
return src.clone();
} else if (_isPlainObject(src) || _isArray(src)) {
let ret = new (src.constructor);
Object.getOwnPropertyNames(src).forEach(function(key) {
| javascript | {
"resource": ""
} |
q27115 | registerValueHandler | train | function registerValueHandler (handlers, type, handler) {
let typeofType = typeof type;
if (typeofType !== 'function' && typeofType !== 'string') {
throw new Error("type must be a class constructor or string");
}
if (typeof handler !== 'function') {
throw new Error("handler must be a function");
}
... | javascript | {
"resource": ""
} |
q27116 | getValueHandler | train | function getValueHandler (value, localHandlers, globalHandlers) {
return | javascript | {
"resource": ""
} |
q27117 | blockTicks | train | function blockTicks (d) {
const k = (d.end - d.start) / d.len
return range(0, d.len, conf.ticks.spacing).map((v, i) => {
return {
| javascript | {
"resource": ""
} |
q27118 | forwardSearch | train | function forwardSearch() {
cameFrom = open1Set.pop();
if (cameFrom.closed) {
return;
}
cameFrom.closed = true;
if (cameFrom.f1 < lMin && (cameFrom.g1 + f2 - heuristic(from, cameFrom.node)) < lMin) {
graph.forEachLinkedNode(cameFrom.node.id, | javascript | {
"resource": ""
} |
q27119 | xss | train | function xss(req, res) {
var agent = (req.headers['user-agent'] || '').toLowerCase(); | javascript | {
"resource": ""
} |
q27120 | context | train | function context(self, method) {
if (self instanceof Primus) return;
var failure = new Error('Primus#'+ method + '\'s context should called with a Primus instance');
| javascript | {
"resource": ""
} |
q27121 | remove | train | function remove() {
primus.removeListener('error', remove)
.removeListener('open', remove)
| javascript | {
"resource": ""
} |
q27122 | session | train | function session(req, res, next) {
//
// The session id is stored in the cookies.
// `req.signedCookies` is assigned by the `cookie-parser` middleware.
//
var sid = req.signedCookies[key];
//
// Default to an empty session.
//
req.session = {};
//
// If we don't have a sess... | javascript | {
"resource": ""
} |
q27123 | Spark | train | function Spark(primus, headers, address, query, id, request, socket) {
this.fuse();
var writable = this.writable
, spark = this
, idgen = primus.options.idGenerator;
query = query || {};
id = idgen ? idgen() : (id || nanoid());
headers = headers || {};
address = address || {};
request = request ... | javascript | {
"resource": ""
} |
q27124 | resolve | train | function resolve(relative, base) {
var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))
, i = path.length
, last = path[i - 1]
, unshift = false
, up = 0;
while (i--) {
if (path[i] === '.') {
path.splice(i, 1);
} else if (path[i] === '..') {
path.splice(i... | javascript | {
"resource": ""
} |
q27125 | set | train | function set(part, value, fn) {
var url = this;
switch (part) {
case 'query':
if ('string' === typeof value && value.length) {
value = (fn || qs.parse)(value);
}
url[part] = value;
break;
case 'port':
url[part] = value;
if (!required(value, url.protocol)) {
... | javascript | {
"resource": ""
} |
q27126 | PrimusError | train | function PrimusError(message, logger) {
Error.captureStackTrace(this, this.constructor);
this.message = message;
this.name | javascript | {
"resource": ""
} |
q27127 | ParserError | train | function ParserError(message, spark) {
Error.captureStackTrace(this, this.constructor);
this.message = message;
| javascript | {
"resource": ""
} |
q27128 | encodeArrayBuffer | train | function encodeArrayBuffer(packet, supportsBinary, callback) {
if (!supportsBinary) {
return exports.encodeBase64Packet(packet, callback);
}
var data = packet.data;
var contentArray = new Uint8Array(data);
var resultBuffer = new Uint8Array(1 + data.byteLength);
resultBuffer[0] = packets[packet.type]; | javascript | {
"resource": ""
} |
q27129 | encode | train | function encode(num) {
var encoded = '';
do {
encoded = alphabet[num % length] + encoded;
num | javascript | {
"resource": ""
} |
q27130 | decode | train | function decode(str) {
var decoded = 0;
for (i = 0; i < str.length; i++) {
decoded = decoded | javascript | {
"resource": ""
} |
q27131 | stripify | train | function stripify(file) {
if (/\.json$/.test(file)) return through();
var code = '';
function transform(chunk, encoding, next) {
code += chunk;
next();
}
function flush(done) {
/* jshint validthis: true */
var ast = rocambole.parse(code);
code = rocambole.moonwalk(ast, function strip(n... | javascript | {
"resource": ""
} |
q27132 | spec | train | function spec(req, res) {
if (req.uri.pathname !== specification) return;
res.statusCode | javascript | {
"resource": ""
} |
q27133 | padSecret | train | function padSecret(secretBuffer, size, encoding) {
const secret = secretBuffer.toString(encoding);
const len = secret.length;
if (size && len < size) {
const newSecret = new Array(size - len + 1).join( | javascript | {
"resource": ""
} |
q27134 | getCommandLineOptions | train | function getCommandLineOptions() {
return process.argv
.slice(2)
.map(arg => arg.split('='))
.reduce((accum, arg) => {
const key = arg[0].replace('--', '');
// if secret, do not put in config
if (key === 'secret') {
secret = arg[1];
| javascript | {
"resource": ""
} |
q27135 | totpCheckWithWindow | train | function totpCheckWithWindow(token, secret, options) {
let opt = Object.assign({}, options);
const bounds = getWindowBounds(opt);
const checker = createChecker(token, secret, opt);
| javascript | {
"resource": ""
} |
q27136 | secretKey | train | function secretKey(length, options = {}) {
if (!length || length < 1) {
return '';
}
if (!options.crypto || typeof options.crypto.randomBytes !== 'function') {
throw new Error('Expecting options.crypto to have a randomBytes function');
}
| javascript | {
"resource": ""
} |
q27137 | hotpSecret | train | function hotpSecret(secret, options) {
if (typeof options.encoding !== 'string') {
throw new Error('Expecting options.encoding | javascript | {
"resource": ""
} |
q27138 | isSameToken | train | function isSameToken(token1, token2) {
if (isValidToken(token1) | javascript | {
"resource": ""
} |
q27139 | hotpOptions | train | function hotpOptions(options = {}) {
return Object.assign(
{
algorithm: 'sha1',
createHmacSecret: hotpSecret,
crypto: null,
| javascript | {
"resource": ""
} |
q27140 | totpOptions | train | function totpOptions(options = {}) {
let opt = Object.assign(hotpOptions(), defaultOptions, | javascript | {
"resource": ""
} |
q27141 | hotpDigest | train | function hotpDigest(secret, counter, options) {
if (!options.crypto || typeof options.crypto.createHmac !== 'function') {
throw new Error('Expecting options.crypto to have a createHmac function');
}
if (typeof options.createHmacSecret !== 'function') {
throw new Error('Expecting options.createHmacSecret ... | javascript | {
"resource": ""
} |
q27142 | stringToHex | train | function stringToHex(value) {
const val = value == null ? '' : value;
let hex = '';
let tmp = '';
for (let i = 0; i < val.length; i++) {
// Convert to Hex and Ensure it's in 2 | javascript | {
"resource": ""
} |
q27143 | totpSecret | train | function totpSecret(secret, options) {
if (typeof options.algorithm !== 'string') {
throw new Error('Expecting options.algorithm to be a string');
}
if (typeof options.encoding !== 'string') {
throw new Error('Expecting options.encoding to be a string');
}
const encoded = Buffer.from(secret, options... | javascript | {
"resource": ""
} |
q27144 | randomBytes | train | function randomBytes(size) {
const crypto = window.crypto || window.msCrypto;
if (!crypto || typeof crypto.getRandomValues !== 'function') {
throw new Error(
'Unable to load crypto module. You may be on an older browser'
);
}
if (size > 65536) {
throw new Error('Requested size of random byte... | javascript | {
"resource": ""
} |
q27145 | keyuri | train | function keyuri(user = 'user', service = 'service', secret = '') {
const protocol = 'otpauth://totp/';
const value = data
.replace('{user}', encodeURIComponent(user))
| javascript | {
"resource": ""
} |
q27146 | leftPad | train | function leftPad(value, length) {
const total = !length ? 0 : length;
let padded = value + '';
| javascript | {
"resource": ""
} |
q27147 | norm | train | function norm(arr, p) {
var nnorm = 0,
i = 0;
// check the p-value of the norm, and set for most common case
if (isNaN(p)) p = 2;
// check if multi-dimensional array, and make vector correction
if (isUsable(arr[0])) arr = arr[0];
| javascript | {
"resource": ""
} |
q27148 | regress | train | function regress(jMatX,jMatY){
//print("regressin!");
//print(jMatX.toArray());
var innerinv = jStat.xtranspxinv(jMatX);
//print(innerinv);
var xtransp = jMatX.transpose();
var | javascript | {
"resource": ""
} |
q27149 | loadIncludes | train | function loadIncludes(data, current_file) {
return data.replace(includeExpr, function(src, name, ext) {
try {
var include_path =
path.join(current_file, "../", name+"."+(ext || "markdown"))
| javascript | {
"resource": ""
} |
q27150 | sh_extractTagsFromNodeList | train | function sh_extractTagsFromNodeList(nodeList, result) {
var length = nodeList.length;
for (var i = 0; i < length; i++) {
var node = nodeList.item(i);
switch (node.nodeType) {
case 1:
if (node.nodeName.toLowerCase() === 'br') {
var terminator;
if (/MSIE/.test(navigator.userAgent)) {... | javascript | {
"resource": ""
} |
q27151 | sh_extractTags | train | function sh_extractTags(element, tags) {
var result = {};
result.text = [];
result.tags = tags;
result.pos = 0;
| javascript | {
"resource": ""
} |
q27152 | sh_highlightElement | train | function sh_highlightElement(element, language) {
sh_addClass(element, 'sh_sourceCode');
var originalTags = [];
var inputString = sh_extractTags(element, originalTags);
var highlightTags = | javascript | {
"resource": ""
} |
q27153 | add | train | function add(li, loose, inline, nl) {
if (loose) {
li.push( [ "para" ].concat(inline) );
return;
}
// Hmmm, should this be any block level element or just paras?
var add_to = li[li.length -1] instanceof Array && li[li.length - 1][0] == "para"
? li... | javascript | {
"resource": ""
} |
q27154 | merge_text_nodes | train | function merge_text_nodes( jsonml ) {
// skip the tag name and attribute hash
var i = extract_attr( jsonml ) ? 2 : 1;
while ( i < jsonml.length ) {
// if it's a string check the next item too
if ( typeof jsonml[ i ] === "string" ) {
if ( i + 1 < jsonml.length && typeof jsonml[ i + 1 ] === "string" ... | javascript | {
"resource": ""
} |
q27155 | getJSON | train | async function getJSON(res) {
const contentType = res.headers.get('Content-Type');
const emptyCodes = [204, 205];
if ( | javascript | {
"resource": ""
} |
q27156 | normalizeTypeDescriptors | train | function normalizeTypeDescriptors(types) {
let [requestType, successType, failureType] = types;
if (typeof requestType === 'string' || typeof requestType === 'symbol') {
requestType = { type: requestType };
}
if (typeof successType === 'string' || typeof successType === 'symbol') {
successType = { typ... | javascript | {
"resource": ""
} |
q27157 | actionWith | train | async function actionWith(descriptor, args = []) {
try {
descriptor.payload =
typeof descriptor.payload === 'function'
? await descriptor.payload(...args)
: descriptor.payload;
} catch (e) {
descriptor.payload = new InternalError(e.message);
descriptor.error = true;
}
try {
... | javascript | {
"resource": ""
} |
q27158 | isValidTypeDescriptor | train | function isValidTypeDescriptor(obj) {
const validKeys = ['type', 'payload', 'meta'];
if (!isPlainObject(obj)) {
return false;
}
for (let key in obj) {
if (!~validKeys.indexOf(key)) {
return false;
}
}
if (!('type' in obj)) {
| javascript | {
"resource": ""
} |
q27159 | train | function (cache, listener) {
if (Object.keys(cache).length <= 0) {
listener.forEach(function (callback) {
try {
callback();
| javascript | {
"resource": ""
} | |
q27160 | train | function (file, content, charset, callback) {
try {
if (!file) {
return;
}
charset = (charset || 'utf-8').toLowerCase();
if (charset !== 'utf-8') {
content = require('iconv-lite').encode(content + '\r\n', charset);
}
| javascript | {
"resource": ""
} | |
q27161 | _messageWorker | train | function _messageWorker(message, callback) {
const worker = _getWorker();
function _listen(e) {
if (e.data.id === message.id) {
callback(e.data);
| javascript | {
"resource": ""
} |
q27162 | _generateHandler | train | function _generateHandler(element, waitingOn, callback) {
return function _handleResponseFromWorker(data) {
element.innerHTML = data.result;
element.classList.remove('loading');
element.classList.add('rainbow-show');
if (element.parentNode.tagName === 'PRE') {
element.pa... | javascript | {
"resource": ""
} |
q27163 | _getPrismOptions | train | function _getPrismOptions(options) {
return {
patterns,
inheritenceMap,
aliases,
globalClass: | javascript | {
"resource": ""
} |
q27164 | _getWorkerData | train | function _getWorkerData(code, lang) {
let options = {};
if (typeof lang === 'object') {
options = lang;
lang = options.language;
}
lang = aliases[lang] || lang;
const workerData = {
id: id++,
| javascript | {
"resource": ""
} |
q27165 | _highlightCodeBlocks | train | function _highlightCodeBlocks(codeBlocks, callback) {
const waitingOn = { c: 0 };
for (const block of codeBlocks) {
const language = getLanguageForBlock(block);
if (block.classList.contains('rainbow') || !language) {
continue;
}
// This cancels the pending animation ... | javascript | {
"resource": ""
} |
q27166 | _highlight | train | function _highlight(node, callback) {
callback = callback || function() {};
// The first argument can be an Event or a DOM Element.
//
// I was originally checking instanceof Event but that made it break
// when using mootools.
//
// @see https://github.com/ccampbell/rainbow/issues/32
n... | javascript | {
"resource": ""
} |
q27167 | extend | train | function extend(language, languagePatterns, inherits) {
// If we extend a language again we shouldn't need to specify the
// inheritence for it. For example, if you are adding special highlighting
// for a javascript function that is not in the base javascript rules, you
// should be able to do
//
... | javascript | {
"resource": ""
} |
q27168 | color | train | function color(...args) {
// If you want to straight up highlight a string you can pass the
// string of code, the language, and a callback function.
//
// Example:
//
// Rainbow.color(code, language, function(highlightedCode, language) {
// // this code block is now highlighted
// ... | javascript | {
"resource": ""
} |
q27169 | MetaCharsetReplacerStream | train | function MetaCharsetReplacerStream(options) {
options = options || {};
this.encoding = options.encoding = | javascript | {
"resource": ""
} |
q27170 | proxyRequest | train | function proxyRequest(data, next) {
debug('proxying %s %s', data.clientRequest.method, data.url);
var middlewareHandledRequest = _.some(config.requestMiddleware, function(middleware) {
middleware(data);
return data.clientResponse.headersSent; // if true, then _.some will stop p... | javascript | {
"resource": ""
} |
q27171 | train | function() {
this._locked = true;
this._measureVertexes = L.featureGroup().addTo(this._layer);
this._captureMarker = L.marker(this._map.getCenter(), {
clickable: true,
zIndexOffset: this.options.captureZIndex,
opacity: 0
}).addTo(this._layer);
this._setCaptureMarkerIcon();
thi... | javascript | {
"resource": ""
} | |
q27172 | train | function() {
const model = L.extend({}, this._resultsModel, { points: this._latlngs });
this._locked = false;
L.DomEvent.off(this._container, 'mouseover', this._handleMapMouseOut, this);
this._clearMeasure();
this._captureMarker
.off('mouseout', this._handleMapMouseOut, this)
.off('d... | javascript | {
"resource": ""
} | |
q27173 | train | function() {
this._latlngs = [];
this._resultsModel = null;
this._measureVertexes.clearLayers();
if (this._measureDrag) {
this._layer.removeLayer(this._measureDrag);
}
if (this._measureArea) {
this._layer.removeLayer(this._measureArea);
}
if (this._measureBoundary) {
| javascript | {
"resource": ""
} | |
q27174 | train | function() {
const calced = calc(this._latlngs);
const model = (this._resultsModel = L.extend(
{},
calced,
this._getMeasurementDisplayStrings(calced),
{
| javascript | {
"resource": ""
} | |
q27175 | train | function(evt) {
if (!this._measureDrag) {
this._measureDrag = L.circleMarker(evt.latlng, this._symbols.getSymbol('measureDrag')).addTo(
this._layer
);
| javascript | {
"resource": ""
} | |
q27176 | train | function() {
const latlngs = this._latlngs;
let resultFeature, popupContent;
this._finishMeasure();
if (!latlngs.length) {
return;
}
if (latlngs.length > 2) {
latlngs.push(latlngs[0]); // close path to get full perimeter measurement for areas
}
const calced = calc(latlngs... | javascript | {
"resource": ""
} | |
q27177 | train | function(evt) {
const latlng = this._map.mouseEventToLatLng(evt.originalEvent), // get actual latlng instead of the marker's latlng from originalEvent
lastClick = this._latlngs[this._latlngs.length - 1],
vertexSymbol = this._symbols.getSymbol('measureVertex');
if (!lastClick || !latlng.equals(lastC... | javascript | {
"resource": ""
} | |
q27178 | getBordersSize | train | function getBordersSize(styles, ...positions) {
return positions.reduce((size, position) => | javascript | {
"resource": ""
} |
q27179 | getPaddings | train | function getPaddings(styles) {
const positions = ['top', 'right', 'bottom', 'left'];
const paddings = {};
for (const position of positions) {
| javascript | {
"resource": ""
} |
q27180 | getSVGContentRect | train | function getSVGContentRect(target) {
const bbox = | javascript | {
"resource": ""
} |
q27181 | getHTMLElementContentRect | train | function getHTMLElementContentRect(target) {
// Client width & height properties can't be
// used exclusively as they provide rounded values.
const {clientWidth, clientHeight} = target;
// By this condition we can catch all non-replaced inline, hidden and
// detached elements. Though elements with ... | javascript | {
"resource": ""
} |
q27182 | pushInUnicode | train | function pushInUnicode(cat, elt) {
if (!unicode.hasOwnProperty(cat)) {
unicode[cat] = {
unicode: [],
ranges: []
};
}
| javascript | {
"resource": ""
} |
q27183 | generateFile | train | function generateFile() {
let data = `
/*File generated with ../scripts/unicode.js using ../resources/Unicode/UnicodeData.txt.
* As Java Identifiers may contains unicodes letters, this file defines two sets of unicode
* characters, firstIdentChar used to help to determine if a character can be the first letter
... | javascript | {
"resource": ""
} |
q27184 | standardiseDescriptor | train | function standardiseDescriptor(descr) {
var4 = {};
var4[_methods] = descr[_methods] || _undefined;
var1 = descr[_properties];
var2 = descr.props;
var4[_properties] = isObject(var1 || var2) ? assign({}, var2, var1) : _undefined;
var4[_initializers] = extractUniqueFunctions(descr.init, descr[_i... | javascript | {
"resource": ""
} |
q27185 | train | function(msg) {
var status = 'success';
if (msg.type === 'started') {
status = 'active';
this.buildingNotification(true);
} else {
if (msg.data.reloadApp) {
this.reloadApp();
return;
}
status = msg.data.diagnosticsHtml ? 'error' : 'success';
this.buil... | javascript | {
"resource": ""
} | |
q27186 | bindToggles | train | function bindToggles() {
// Watch for changes on the checkboxes in the device dropdown
var iphone = $('#device-iphone');
var android = $('#device-android');
var windows = $('#device-windows');
var devices = | javascript | {
"resource": ""
} |
q27187 | showDevice | train | function showDevice(device, isShowing) {
$('#device-' + device).checked = isShowing;
var rendered = $('#' + device);
if(!rendered) {
var template = $('#' + device + '-frame-template');
var clone = document.importNode(template, true);
$('preview').appendChild(clone.content);
//check for extra para... | javascript | {
"resource": ""
} |
q27188 | toggleTopWindowClass | train | function toggleTopWindowClass(toggleSwitch) {
var modalWindow;
if (openedWindows.length() > 0) {
modalWindow = openedWindows.top().value;
| javascript | {
"resource": ""
} |
q27189 | prepareTooltip | train | function prepareTooltip() {
ttScope.title = attrs[prefix + 'Title'];
if (contentParse) {
ttScope.content = contentParse(scope);
} else {
ttScope.content = attrs[ttType];
}
ttScope.popupClass = attrs[prefix + 'Class'];... | javascript | {
"resource": ""
} |
q27190 | recalculatePosition | train | function recalculatePosition() {
scope.position = appendToBody ? $position.offset(element) | javascript | {
"resource": ""
} |
q27191 | train | function(evt) {
// Issue #3973
// Firefox treats right click as a click on document
if (element[0] !== evt.target && evt.which !== 3 && scope.matches.length !== 0) {
| javascript | {
"resource": ""
} | |
q27192 | Validator | train | function Validator(opts) {
this.opts = {
messages: deepExtend({}, defaultMessages)
};
if (opts)
deepExtend(this.opts, opts);
this.messages = this.opts.messages;
this.messageKeys = | javascript | {
"resource": ""
} |
q27193 | flatten | train | function flatten(array, target) {
const result = target || [];
for (let i = 0; i < array.length; ++i) {
if (Array.isArray(array[i])) {
| javascript | {
"resource": ""
} |
q27194 | train | function() {
var $this = $(this);
//Save state on change
$this.on("change", function() {
var $this = $(this);
if (typeof($this.treegrid('getSetting', 'onChange')) === "function") {
$this.treegrid('getSetting', 'onChange').appl... | javascript | {
"resource": ""
} | |
q27195 | train | function() {
var $this = $(this);
var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn'));
var tpl = $this.treegrid('getSetting', 'expanderTemplate');
var expander = $this.treegrid('getSetting', 'getExpander').apply(this);
if (expander... | javascript | {
"resource": ""
} | |
q27196 | train | function() {
var $this = $(this);
$this.find('.treegrid-indent').remove();
var tpl = $this.treegrid('getSetting', 'indentTemplate');
var expander = $this.find('.treegrid-expander');
var depth = $this.treegrid('getDepth');
| javascript | {
"resource": ""
} | |
q27197 | train | function() {
var tree = $(this).treegrid('getTreeContainer');
if (tree.data('first_init') === undefined) {
tree.data('first_init', | javascript | {
"resource": ""
} | |
q27198 | train | function() {
var $this = $(this);
if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') {
var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || '';
var stateArray = (stateArrayString === '' ? [] : stateArrayString.spli... | javascript | {
"resource": ""
} | |
q27199 | train | function() {
var $this = $(this);
if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') {
var stateArray = $.cookie($this.treegrid('getSetting', 'saveStateName')).split(',');
if ($.inArray($this.treegrid('getNodeId'), stateArray) !== -1) {
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.