_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q26500 | WorldRenderer | train | function WorldRenderer(params) {
this.init_(params.hideFullscreenButton);
this.sphereRenderer = new SphereRenderer(this.scene);
this.hotspotRenderer = new HotspotRenderer(this);
this.hotspotRenderer.on('focus', this.onHotspotFocus_.bind(this));
this.hotspotRenderer.on('blur', this.onHotspotBlur_.bind(this));... | javascript | {
"resource": ""
} |
q26501 | Player | train | function Player(selector, contentInfo) {
// Create a VR View iframe depending on the parameters.
var iframe = this.createIframe_(contentInfo);
this.iframe = iframe;
var parentEl = document.querySelector(selector);
parentEl.appendChild(iframe);
// Make a sender as well, for relying commands to the child IF... | javascript | {
"resource": ""
} |
q26502 | HotspotRenderer | train | function HotspotRenderer(worldRenderer) {
this.worldRenderer = worldRenderer;
this.scene = worldRenderer.scene;
// Note: this event must be added to document.body and not to window for it to
// work inside iOS iframes.
var body = document.body;
// Bind events for hotspot interaction.
if (!Util.isMobile()... | javascript | {
"resource": ""
} |
q26503 | SceneInfo | train | function SceneInfo(opt_params) {
var params = opt_params || {};
params.player = {
loop: opt_params.loop,
volume: opt_params.volume,
muted: opt_params.muted
};
this.image = params.image !== undefined ? encodeURI(params.image) : undefined;
this.preview = params.preview !== undefined ? encodeURI(par... | javascript | {
"resource": ""
} |
q26504 | cookieSession | train | function cookieSession (options) {
var opts = options || {}
// cookie name
var name = opts.name || 'session'
// secrets
var keys = opts.keys
if (!keys && opts.secret) keys = [opts.secret]
// defaults
if (opts.overwrite == null) opts.overwrite = true
if (opts.httpOnly == null) opts.httpOnly = true
... | javascript | {
"resource": ""
} |
q26505 | Session | train | function Session (ctx, obj) {
Object.defineProperty(this, '_ctx', {
value: ctx
})
if (obj) {
for (var key in obj) {
this[key] = obj[key]
}
}
} | javascript | {
"resource": ""
} |
q26506 | decode | train | function decode (string) {
var body = Buffer.from(string, 'base64').toString('utf8')
return JSON.parse(body)
} | javascript | {
"resource": ""
} |
q26507 | encode | train | function encode (body) {
var str = JSON.stringify(body)
return Buffer.from(str).toString('base64')
} | javascript | {
"resource": ""
} |
q26508 | tryGetSession | train | function tryGetSession (req) {
var cookies = req.sessionCookies
var name = req.sessionKey
var opts = req.sessionOptions
var str = cookies.get(name, opts)
if (!str) {
return undefined
}
debug('parse %s', str)
try {
return Session.deserialize(req, str)
} catch (err) {
return undefined
... | javascript | {
"resource": ""
} |
q26509 | train | function() {
$this.text($this.data('counterup-nums').shift());
if ($this.data('counterup-nums').length) {
setTimeout($this.data('counterup-func'), $settings.delay);
} else {
delete $this.data('counterup-nums');
$... | javascript | {
"resource": ""
} | |
q26510 | destroyEditOverlay | train | function destroyEditOverlay() {
if (overlay) {
overlay.parentNode.removeChild(overlay);
overlay = null;
}
document.removeEventListener('click', handleDocumentClick);
document.removeEventListener('keyup', handleDocumentKeyup);
document.removeEventListener('mousedown', handleDocumentMousedown);
docum... | javascript | {
"resource": ""
} |
q26511 | deleteAnnotation | train | function deleteAnnotation() {
if (!overlay) { return; }
let annotationId = overlay.getAttribute('data-target-id');
let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`);
let svg = overlay.parentNode.querySelector('svg.annotationLayer');
let { documentId } = getMetadata(svg);
[.... | javascript | {
"resource": ""
} |
q26512 | handleDocumentClick | train | function handleDocumentClick(e) {
if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }
// Remove current overlay
let overlay = document.getElementById('pdf-annotate-edit-overlay');
if (overlay) {
if (isDragging || e.target === overlay) {
return;
}
destroyEditOverlay();
}
} | javascript | {
"resource": ""
} |
q26513 | saveText | train | function saveText() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let { documentId, pageNumber } = getMetadata(svg);
let rect = svg.g... | javascript | {
"resource": ""
} |
q26514 | closeInput | train | function closeInput() {
if (input) {
input.removeEventListener('blur', handleInputBlur);
input.removeEventListener('keyup', handleInputKeyup);
document.body.removeChild(input);
input = null;
}
} | javascript | {
"resource": ""
} |
q26515 | transform | train | function transform(node, viewport) {
let trans = getTranslation(viewport);
// Let SVG natively transform the element
node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`);
// Manually adjust x/y for nested SVG nodes
if (!isFirefox && node... | javascript | {
"resource": ""
} |
q26516 | scalePage | train | function scalePage(pageNumber, viewport, context) {
let page = document.getElementById(`pageContainer${pageNumber}`);
let canvas = page.querySelector('.canvasWrapper canvas');
let svg = page.querySelector('.annotationLayer');
let wrapper = page.querySelector('.canvasWrapper');
let textLayer = page.querySelect... | javascript | {
"resource": ""
} |
q26517 | textLayerElementFromPoint | train | function textLayerElementFromPoint(x, y, pageNumber) {
let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`);
let rect = svg.getBoundingClientRect();
y = scaleUp(svg, {y}).y + rect.top;
x = scaleUp(svg, {x}).x + rect.left;
return [...svg.parentNode.querySelectorAll('.textLayer [data-... | javascript | {
"resource": ""
} |
q26518 | savePoint | train | function savePoint(x, y) {
let svg = findSVGAtPoint(x, y);
if (!svg) {
return;
}
let rect = svg.getBoundingClientRect();
let point = scaleDown(svg, {
x: x - rect.left,
y: y - rect.top
});
lines.push([point.x, point.y]);
if (lines.length <= 1) {
return;
}
if (path) {
svg.remov... | javascript | {
"resource": ""
} |
q26519 | sortByLinePoint | train | function sortByLinePoint(a, b) {
let lineA = a.lines[0];
let lineB = b.lines[0];
return sortByPoint(
{x: lineA[0], y: lineA[1]},
{x: lineB[0], y: lineB[1]}
);
} | javascript | {
"resource": ""
} |
q26520 | savePoint | train | function savePoint() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let content = input.value.trim();
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let rect = svg.getBoundingClient... | javascript | {
"resource": ""
} |
q26521 | binarySearchFirstItem | train | function binarySearchFirstItem(items, condition) {
var minIndex = 0;
var maxIndex = items.length - 1;
if (items.length === 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {
return minIndex;
}
while (minIndex < maxIndex) {
var currentIndex = (minInde... | javascript | {
"resource": ""
} |
q26522 | PDFRenderingQueue_renderView | train | function PDFRenderingQueue_renderView(view) {
var state = view.renderingState;
switch (state) {
case RenderingStates.FINISHED:
return false;
case RenderingStates.PAUSED:
this.highestPriorityPage = view.renderingId;
view.resume();
break;
case Re... | javascript | {
"resource": ""
} |
q26523 | reorderAnnotationsByType | train | function reorderAnnotationsByType(documentId, pageNumber, type) {
PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber)
.then((annotations) => {
return annotations.annotations.filter((a) => {
return a.type === type;
});
})
.then((annotations) => {
annotations.for... | javascript | {
"resource": ""
} |
q26524 | insertComment | train | function insertComment(documentId, annotationId, comment) {
let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);
let promise;
if (!list) {
promise = renderScreenReaderComments(documentId, annotationId, []).then(() => {
list = document.querySelector(`pdf-annotate-... | javascript | {
"resource": ""
} |
q26525 | removeElementById | train | function removeElementById(elementId) {
let el = document.getElementById(elementId);
if (el) {
el.parentNode.removeChild(el);
}
} | javascript | {
"resource": ""
} |
q26526 | getSelectionRects | train | function getSelectionRects() {
try {
let selection = window.getSelection();
let range = selection.getRangeAt(0);
let rects = range.getClientRects();
if (rects.length > 0 &&
rects[0].width > 0 &&
rects[0].height > 0) {
return rects;
}
} catch (e) {}
return null;
} | javascript | {
"resource": ""
} |
q26527 | saveRect | train | function saveRect(type, rects, color) {
let svg = findSVGAtPoint(rects[0].left, rects[0].top);
let node;
let annotation;
if (!svg) {
return;
}
let boundingRect = svg.getBoundingClientRect();
if (!color) {
if (type === 'highlight') {
color = 'FFFF00';
} else if (type === 'strikeout') {... | javascript | {
"resource": ""
} |
q26528 | redraw | train | function redraw(fitties) {
// getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow
// check if styles of all fitties have been computed
fitties.filter(function (f) {
return !f.styleComputed;
}).forEach(function (f)... | javascript | {
"resource": ""
} |
q26529 | shouldRedraw | train | function shouldRedraw(f) {
return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth;
} | javascript | {
"resource": ""
} |
q26530 | computeStyle | train | function computeStyle(f) {
// get style properties
var style = w.getComputedStyle(f.element, null);
// get current font size in pixels (if we already calculated it, use the calculated version)
f.currentFontSize = parseInt(style.getPropertyValue('font-size'), 10);
// get display type and wrap mode... | javascript | {
"resource": ""
} |
q26531 | shouldPreStyle | train | function shouldPreStyle(f) {
var preStyle = false;
// if we already tested for prestyling we don't have to do it again
if (f.preStyleTestCompleted) {
return false;
}
// should have an inline style, if not, apply
if (!/inline-/.test(f.display)) {
preStyle = true;
f.display = ... | javascript | {
"resource": ""
} |
q26532 | applyStyle | train | function applyStyle(f) {
// remember original style, we need this to restore the fitty style when unsubscribing
if (!f.originalStyle) {
f.originalStyle = f.element.getAttribute('style') || '';
}
// set the new style to the original style plus the fitty styles
f.element.style.cssText = f.orig... | javascript | {
"resource": ""
} |
q26533 | dispatchFitEvent | train | function dispatchFitEvent(f) {
f.element.dispatchEvent(new CustomEvent('fit', {
detail: {
oldValue: f.previousFontSize,
newValue: f.currentFontSize,
scaleFactor: f.currentFontSize / f.previousFontSize
}
}));
} | javascript | {
"resource": ""
} |
q26534 | subscribe | train | function subscribe(f) {
// this is a new fitty so we need to validate if it's styles are in order
f.newbie = true;
// because it's a new fitty it should also be dirty, we want it to redraw on the first loop
f.dirty = true;
// we want to be able to update this fitty
fitties.push(f);
} | javascript | {
"resource": ""
} |
q26535 | unsubscribe | train | function unsubscribe(f) {
return function () {
// remove from fitties array
fitties = fitties.filter(function (_) {
return _.element !== f.element;
});
// stop observing DOM
if (f.observeMutations) {
f.observer.disconnect();
}
// reset font size to inheri... | javascript | {
"resource": ""
} |
q26536 | fittyCreate | train | function fittyCreate(elements, options) {
// set options object
var fittyOptions = _extends({}, defaultOptions, options);
// create fitties
var publicFitties = elements.map(function (element) {
// create fitty instance
var f = _extends({}, fittyOptions, {
// internal options for ... | javascript | {
"resource": ""
} |
q26537 | fitty | train | function fitty(target) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// if target is a string
return typeof target === 'string' ?
// treat it as a querySelector
fittyCreate(toArray(document.querySelectorAll(target)), options) :
// create single fitty... | javascript | {
"resource": ""
} |
q26538 | loadFormatters | train | function loadFormatters(){
var arrFiles = glob.sync('./formatters/*.js', {
'cwd': __dirname,
'dot': false,
'nodir': true,
'strict': false,
'silent': true
});
var mapFormatters = {};
arrFiles.forEach(function(file){
var fileInfo = path.parse(file);
... | javascript | {
"resource": ""
} |
q26539 | train | function(constructor, obj, pluginName) {
// if it's not already bridged
if (!obj[pluginName]) {
var fn = function() {};
fn.prototype = constructor;
var pluginInstance = new fn();
// the _init method has to exist in instance constructors but might be missing
// in core constructors
i... | javascript | {
"resource": ""
} | |
q26540 | train | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// note: the order of emitters matters
this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args);
this.__$emitterPublic.trigger.apply(this.__$emitterPublic, a... | javascript | {
"resource": ""
} | |
q26541 | train | function(selector) {
var instances = [],
sel = selector || '.tooltipstered';
$(sel).each(function() {
var $this = $(this),
ns = $this.data('tooltipster-ns');
if (ns) {
$.each(ns, function(i, namespace) {
instances.push($this.data(namespace));
});
}
});
return i... | javascript | {
"resource": ""
} | |
q26542 | train | function() {
var self = this,
$el = self._$tooltip.find('.tooltipster-content'),
formattedContent = self.__Content,
format = function(content) {
formattedContent = content;
};
self._trigger({
type: 'format',
content: self.__Content,
format: format
});
if (self.__options.functio... | javascript | {
"resource": ""
} | |
q26543 | train | function(content) {
// clone if asked. Cloning the object makes sure that each instance has its
// own version of the content (in case a same object were provided for several
// instances)
// reminder: typeof null === object
if (content instanceof $ && this.__options.contentCloning) {
content = content.... | javascript | {
"resource": ""
} | |
q26544 | train | function(r) {
geo.origin.size.height = r.height,
geo.origin.windowOffset.left = r.left,
geo.origin.windowOffset.top = r.top,
geo.origin.size.width = r.width
} | javascript | {
"resource": ""
} | |
q26545 | train | function() {
if (typeof this.__options.animationDuration == 'number') {
this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration];
}
if (typeof this.__options.delay == 'number') {
this.__options.delay = [this.__options.delay, this.__options.delay];
}
... | javascript | {
"resource": ""
} | |
q26546 | train | function() {
var self = this;
// in case the selfDestruction option has been changed by a method call
if (self.__options.selfDestruction) {
// the GC task
self.__garbageCollector = setInterval(function() {
var now = new Date().getTime();
// forget the old events
self.__touchE... | javascript | {
"resource": ""
} | |
q26547 | train | function() {
// there is only one possible open timeout: the delayed opening
// when the mouseenter/touchstart open triggers are used
clearTimeout(this.__timeouts.open);
this.__timeouts.open = null;
// ... but several close timeouts: the delayed closing when the
// mouseleave close trigger is used and... | javascript | {
"resource": ""
} | |
q26548 | train | function(pluginName, defaultOptions) {
var self = this,
options = $.extend(true, {}, defaultOptions);
// if the plugin options were isolated in a property named after the
// plugin, use them (prevents conflicts with other plugins)
var pluginOptions = self.__options[pluginName];
// if not, try to g... | javascript | {
"resource": ""
} | |
q26549 | train | function(pluginName) {
var plugin = $.tooltipster._plugin(pluginName);
if (plugin) {
// if there is a constructor for instances
if (plugin.instance) {
// proxy non-private methods on the instance to allow new instance methods
$.tooltipster.__bridge(plugin.instance, this, plugin.name);
... | javascript | {
"resource": ""
} | |
q26550 | train | function(event) {
var isEmulated = false,
now = new Date().getTime();
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
// delay, in milliseconds. It's supposed to be 300ms in
// most browsers (350ms on iOS) to allow a double tap but
// can be les... | javascript | {
"resource": ""
} | |
q26551 | train | function(event) {
return (
(this._touchIsTouchEvent(event) && !this._touchSwiped(event.target))
|| (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event))
);
} | javascript | {
"resource": ""
} | |
q26552 | train | function(event) {
if (this._touchIsTouchEvent(event)) {
event.time = new Date().getTime();
this.__touchEvents.push(event);
}
return this;
} | javascript | {
"resource": ""
} | |
q26553 | train | function(target) {
var swiped = false;
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
if (e.type == 'touchmove') {
swiped = true;
break;
}
else if (
e.type == 'touchstart'
&& target === e.target
) {
break;
}
}
retu... | javascript | {
"resource": ""
} | |
q26554 | train | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// add properties to the event
args[0].instance = this;
args[0].origin = this._$origin ? this._$origin[0] : null;
args[0].tooltip = this._$tooltip ? this._$tooltip[0... | javascript | {
"resource": ""
} | |
q26555 | train | function(pluginName) {
var self = this;
// if the plugin has been activated on this instance
if (self[pluginName]) {
var plugin = $.tooltipster._plugin(pluginName);
// if there is a constructor for instances
if (plugin.instance) {
// unbridge
$.each(plugin.instance, function(me... | javascript | {
"resource": ""
} | |
q26556 | train | function(content) {
var self = this;
// getter method
if (content === undefined) {
return self.__Content;
}
// setter method
else {
if (!self.__destroyed) {
// change the content
self.__contentSet(content);
if (self.__Content !== null) {
// update the tooltip... | javascript | {
"resource": ""
} | |
q26557 | train | function() {
var self = this;
if (!self.__destroyed) {
if(self.__state != 'closed'){
// no closing delay
self.option('animationDuration', 0)
// force closing
._close(null, null, true);
}
else {
// there might be an open timeout still running
self.__timeoutsClear();
... | javascript | {
"resource": ""
} | |
q26558 | train | function(o, val) {
// getter
if (val === undefined) {
return this.__options[o];
}
// setter
else {
if (!this.__destroyed) {
// change value
this.__options[o] = val;
// format
this.__optionsFormat();
// re-prepare the triggers if needed
if ($.inArray(o, ['tri... | javascript | {
"resource": ""
} | |
q26559 | train | function() {
if (!this.__destroyed) {
this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));
}
else {
this.__destroyError();
}
return this;
} | javascript | {
"resource": ""
} | |
q26560 | train | function() {
this.__forceRedraw();
var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(),
result = { size: {
// bcr.width/height are not defined in IE8- but in this
// case, bcr.right/bottom will have the same value
// except in iOS 8+ where tooltipBcr.bottom/right are wrong
// after ... | javascript | {
"resource": ""
} | |
q26561 | areEqual | train | function areEqual(a,b) {
var same = true;
$.each(a, function(i, _) {
if (b[i] === undefined || a[i] !== b[i]) {
same = false;
return false;
}
});
return same;
} | javascript | {
"resource": ""
} |
q26562 | bodyContains | train | function bodyContains($obj) {
var id = $obj.attr('id'),
el = id ? env.window.document.getElementById(id) : null;
// must also check that the element with the id is the one we want
return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]);
} | javascript | {
"resource": ""
} |
q26563 | train | function() {
return {
// if the tooltip should display an arrow that points to the origin
arrow: true,
// the distance in pixels between the tooltip and the origin
distance: 6,
// allows to easily change the position of the tooltip
functionPosition: null,
maxWidth: null,
// used t... | javascript | {
"resource": ""
} | |
q26564 | train | function() {
// detach our content object first, so the next jQuery's remove()
// call does not unbind its event handlers
if (this.__instance.content() instanceof $) {
this.__instance.content().detach();
}
// remove the tooltip from the DOM
this.__instance._$tooltip.remove();
this.__ins... | javascript | {
"resource": ""
} | |
q26565 | train | function() {
// note: we wrap with a .tooltipster-box div to be able to set a margin on it
// (.tooltipster-base must not have one)
var $html = $(
'<div class="tooltipster-base tooltipster-sidetip">' +
'<div class="tooltipster-box">' +
'<div class="tooltipster-content"></div>' +
'</div>... | javascript | {
"resource": ""
} | |
q26566 | train | function(instance, helper, data){
// this function is pretty dumb and does not check if there is actually
// enough space available around the tooltip to move it, it just makes it
// snap to the grid. You might want to do something smarter in your app!
var gridBcr = $('#demo-position-grid')[0]... | javascript | {
"resource": ""
} | |
q26567 | isWriteable | train | function isWriteable(file) {
let writePermission = true;
try {
const __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch (e) {
/* istanbul ignore next */
writePermission = false;
}
return writePermission;
} | javascript | {
"resource": ""
} |
q26568 | print | train | function print() {
var parts = String(out).split('\n');
/* istanbul ignore next */
if (parts.length > 1) {
out = parts.pop();
var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
slf.log(logging);
}
/* istanbul ignore next */
if (cl... | javascript | {
"resource": ""
} |
q26569 | file | train | function file(path, options) {
try {
try {
fs.lstatSync(path);
} catch (e) {
// If the file doesn't exist and
// the user doesn't want to create it,
// we have no purpose in life. Goodbye.
if (options.create === false) {
throw new Error(e);
} els... | javascript | {
"resource": ""
} |
q26570 | error | train | function error(path, e) {
var status = void 0;
var stdout = void 0;
if (e.code === 'ENOENT' && e.syscall === 'scandir') {
status = 1;
stdout = 'ls: cannot access ' + path + ': No such file or directory';
} else {
status = 2;
stdout = e.stack;
}
ls.self.log(stdout);
... | javascript | {
"resource": ""
} |
q26571 | execDirRecursive | train | function execDirRecursive(path, options) {
var self = this;
var results = [];
walkDirRecursive(path, function (pth) {
var result = self.execDir(pth, options);
results.push(result);
});
return results;
} | javascript | {
"resource": ""
} |
q26572 | execDir | train | function execDir(path, options) {
var rawFiles = [];
function pushFile(file, data) {
rawFiles.push({
file: file,
data: data
});
}
// Add in implied current and parent dirs.
pushFile('.', fs.statSync('.'));
pushFile('..', fs.statSync('..'));
// Walk the passed i... | javascript | {
"resource": ""
} |
q26573 | formatAll | train | function formatAll(results, options, showName) {
var stdout = '';
if (showName) {
for (var i = 0; i < results.length; ++i) {
stdout += results[i].path + ':\n';
if (options.l) {
stdout += 'total ' + results[i].size + '\n';
}
stdout += results[i].results;
if... | javascript | {
"resource": ""
} |
q26574 | train | function() {
var parser = new(window.UAParser || exports.UAParser);
browserData = parser.getResult();
fontDetective = new Detector();
return this;
} | javascript | {
"resource": ""
} | |
q26575 | train | function() {
var bar = '|';
var userAgent = browserData.ua;
var screenPrint = this.getScreenPrint();
var pluginList = this.getPlugins();
var fontList = this.getFonts();
var localStorage = this.isLocalStorage();
var sessionStorage = this.isSessionStorage();
var timeZone =... | javascript | {
"resource": ""
} | |
q26576 | train | function() {
var bar = '|';
var key = "";
for (var i = 0; i < arguments.length; i++) {
key += arguments[i] + bar;
}
return murmurhash3_32_gc(key, 256);
} | javascript | {
"resource": ""
} | |
q26577 | train | function() {
// detectmobilebrowsers.com JavaScript Mobile Detection Script
var dataString = browserData.ua || navigator.vendor || window.opera;
return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobi... | javascript | {
"resource": ""
} | |
q26578 | train | function() {
var pluginsList = "";
for (var i = 0; i < navigator.plugins.length; i++) {
if (i == navigator.plugins.length - 1) {
pluginsList += navigator.plugins[i].name;
} else {
pluginsList += navigator.plugins[i].name + ", ";
}
}
return pluginsList... | javascript | {
"resource": ""
} | |
q26579 | train | function() {
var mimeTypeList = "";
for (var i = 0; i < navigator.mimeTypes.length; i++) {
if (i == navigator.mimeTypes.length - 1) {
mimeTypeList += navigator.mimeTypes[i].description;
} else {
mimeTypeList += navigator.mimeTypes[i].description + ", ";
}
}... | javascript | {
"resource": ""
} | |
q26580 | train | function() {
// create a canvas element
var canvas = document.createElement('canvas');
// define a context var that will be used for browsers with canvas support
var ctx;
// try/catch for older browsers that don't support the canvas element
try {
// attempt to give ctx a ... | javascript | {
"resource": ""
} | |
q26581 | createToken | train | function createToken(options) {
const newToken = chevrotain.createToken(options)
allTokens.push(newToken)
return newToken
} | javascript | {
"resource": ""
} |
q26582 | minimizeCst | train | function minimizeCst(cstElement) {
// tokenType idx is auto generated, can't assert over it
if (cstElement.tokenType) {
delete cstElement.tokenType
}
// CstNode
if (cstElement.children !== undefined) {
cstElement.children = _.o... | javascript | {
"resource": ""
} |
q26583 | toOriginalText | train | function toOriginalText(item) {
if (_.has(item, "tokenName")) {
return item.tokenName
} else if (item instanceof Rule) {
return item.name
} else if (_.isString(item)) {
return item
} else if (_.has(item, "toRule")) {
return item.definition.orgText
} else {
thr... | javascript | {
"resource": ""
} |
q26584 | nextRight | train | function nextRight(v) {
var children = v.children;
return children ? children[children.length - 1] : v.t;
} | javascript | {
"resource": ""
} |
q26585 | firstWalk | train | function firstWalk(v) {
var children = v.children,
siblings = v.parent.children,
w = v.i ? siblings[v.i - 1] : null;
if (children) {
executeShifts(v);
var midpoint = (children[0].z + children[children.length - 1].z) / 2;
if (w) {
v.z = w.z + separation(v._, w._);
... | javascript | {
"resource": ""
} |
q26586 | train | function(name, theme) {
name != null && theme != null && (App.settings.themes[name] = theme);
delete App.vars.cache.themeKeys;
return this;
} | javascript | {
"resource": ""
} | |
q26587 | train | function(src, el) {
//todo: use jquery fallback if available for all QSA references
var nodes = DOM.getNodeArray(el);
nodes.forEach(function (node) {
var img = DOM.newEl('img');
var domProps = {};
domProps[App.setup.dataAttr] = src;
DOM.setA... | javascript | {
"resource": ""
} | |
q26588 | train | function(el, value) {
if (el.holderData) {
el.holderData.resizeUpdate = !!value;
if (el.holderData.resizeUpdate) {
updateResizableElements(el);
}
}
} | javascript | {
"resource": ""
} | |
q26589 | prepareImageElement | train | function prepareImageElement(options, engineSettings, src, el) {
var holderFlags = parseURL(src.substr(src.lastIndexOf(options.domain)), options);
if (holderFlags) {
prepareDOMElement({
mode: null,
el: el,
flags: holderFlags,
engineSettings: engineS... | javascript | {
"resource": ""
} |
q26590 | render | train | function render(renderSettings) {
var image = null;
var mode = renderSettings.mode;
var el = renderSettings.el;
var holderSettings = renderSettings.holderSettings;
var engineSettings = renderSettings.engineSettings;
switch (engineSettings.renderer) {
case 'svg':
if (... | javascript | {
"resource": ""
} |
q26591 | textSize | train | function textSize(width, height, fontSize, scale) {
var stageWidth = parseInt(width, 10);
var stageHeight = parseInt(height, 10);
var bigSide = Math.max(stageWidth, stageHeight);
var smallSide = Math.min(stageWidth, stageHeight);
var newHeight = 0.8 * Math.min(smallSide, bigSide * scale);
... | javascript | {
"resource": ""
} |
q26592 | setInitialDimensions | train | function setInitialDimensions(el) {
if (el.holderData) {
var dimensions = dimensionCheck(el);
if (dimensions) {
var flags = el.holderData.flags;
var fluidConfig = {
fluidHeight: flags.dimensions.height.slice(-1) == '%',
fluidWidth: flag... | javascript | {
"resource": ""
} |
q26593 | visibilityCheck | train | function visibilityCheck() {
var renderableImages = [];
var keys = Object.keys(App.vars.invisibleImages);
var el;
keys.forEach(function (key) {
el = App.vars.invisibleImages[key];
if (dimensionCheck(el) && el.nodeName.toLowerCase() == 'img') {
renderableImages.push(el... | javascript | {
"resource": ""
} |
q26594 | startVisibilityCheck | train | function startVisibilityCheck() {
if (!App.vars.visibilityCheckStarted) {
global.requestAnimationFrame(visibilityCheck);
App.vars.visibilityCheckStarted = true;
}
} | javascript | {
"resource": ""
} |
q26595 | setInvisible | train | function setInvisible(el) {
if (!el.holderData.invisibleId) {
App.vars.invisibleId += 1;
App.vars.invisibleImages['i' + App.vars.invisibleId] = el;
el.holderData.invisibleId = App.vars.invisibleId;
}
} | javascript | {
"resource": ""
} |
q26596 | debounce | train | function debounce(fn) {
if (!App.vars.debounceTimer) fn.call(this);
if (App.vars.debounceTimer) global.clearTimeout(App.vars.debounceTimer);
App.vars.debounceTimer = global.setTimeout(function() {
App.vars.debounceTimer = null;
fn.call(this);
}, App.setup.debounce);
} | javascript | {
"resource": ""
} |
q26597 | completed | train | function completed( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( w3c || event.type === LOAD || doc[READYSTATE] === COMPLETE ) {
detach();
ready();
}
} | javascript | {
"resource": ""
} |
q26598 | detach | train | function detach() {
if ( w3c ) {
doc[REMOVEEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE );
win[REMOVEEVENTLISTENER]( LOAD, completed, FALSE );
} else {
doc[DETACHEVENT]( ONREADYSTATECHANGE, completed );
win[DETACHEVENT]( ONLOAD, completed );
... | javascript | {
"resource": ""
} |
q26599 | usesScopeName | train | function usesScopeName(scopeNames, node) {
function usesScope(root) {
return usesScopeName(scopeNames, root)
}
if (_.isEmpty(scopeNames)) {
return false
}
// rt-if="x"
if (node.type === 'Identifier') {
return _.includes(scopeNames, node.name)
}
// rt-if="e({key1: ... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.