repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
mozilla/nunjucks
docs/bower_components/bootstrap/assets/js/jszip.js
function(arg) { if (!arg) { return this; } if (arg instanceof RegExp) { return this.filter(function(relativePath, file) { return file.options.dir && arg.test(relativePath); }); } // else, name is a new folder var ...
javascript
function(arg) { if (!arg) { return this; } if (arg instanceof RegExp) { return this.filter(function(relativePath, file) { return file.options.dir && arg.test(relativePath); }); } // else, name is a new folder var ...
[ "function", "(", "arg", ")", "{", "if", "(", "!", "arg", ")", "{", "return", "this", ";", "}", "if", "(", "arg", "instanceof", "RegExp", ")", "{", "return", "this", ".", "filter", "(", "function", "(", "relativePath", ",", "file", ")", "{", "return...
Add a directory to the zip file, or search. @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. @return {JSZip} an object with the new directory as the root, or an array containing matching folders.
[ "Add", "a", "directory", "to", "the", "zip", "file", "or", "search", "." ]
224645791298db835df0acff3dc596d3a9ed2c4d
https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L582-L601
train
mozilla/nunjucks
docs/bower_components/bootstrap/assets/js/jszip.js
function (buffer) { JSZip.utils.checkSupport("blob"); try { // Blob constructor return new Blob([buffer], { type: "application/zip" }); } catch(e) {} try { // deprecated, browser only, old way var builder = new (window.BlobBu...
javascript
function (buffer) { JSZip.utils.checkSupport("blob"); try { // Blob constructor return new Blob([buffer], { type: "application/zip" }); } catch(e) {} try { // deprecated, browser only, old way var builder = new (window.BlobBu...
[ "function", "(", "buffer", ")", "{", "JSZip", ".", "utils", ".", "checkSupport", "(", "\"blob\"", ")", ";", "try", "{", "// Blob constructor", "return", "new", "Blob", "(", "[", "buffer", "]", ",", "{", "type", ":", "\"application/zip\"", "}", ")", ";", ...
Create a blob from the given ArrayBuffer. @param {ArrayBuffer} buffer the buffer to transform. @return {Blob} the result. @throws {Error} an Error if the browser doesn't support the requested feature.
[ "Create", "a", "blob", "from", "the", "given", "ArrayBuffer", "." ]
224645791298db835df0acff3dc596d3a9ed2c4d
https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L1050-L1070
train
mozilla/nunjucks
docs/bower_components/bootstrap/assets/js/jszip.js
function (str) { var buffer = JSZip.utils.transformTo("arraybuffer", str); return JSZip.utils.arrayBuffer2Blob(buffer); }
javascript
function (str) { var buffer = JSZip.utils.transformTo("arraybuffer", str); return JSZip.utils.arrayBuffer2Blob(buffer); }
[ "function", "(", "str", ")", "{", "var", "buffer", "=", "JSZip", ".", "utils", ".", "transformTo", "(", "\"arraybuffer\"", ",", "str", ")", ";", "return", "JSZip", ".", "utils", ".", "arrayBuffer2Blob", "(", "buffer", ")", ";", "}" ]
Create a blob from the given string. @param {string} str the string to transform. @return {Blob} the result. @throws {Error} an Error if the browser doesn't support the requested feature.
[ "Create", "a", "blob", "from", "the", "given", "string", "." ]
224645791298db835df0acff3dc596d3a9ed2c4d
https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L1077-L1080
train
mozilla/nunjucks
nunjucks/src/filters.js
dictsort
function dictsort(val, caseSensitive, by) { if (!lib.isObject(val)) { throw new lib.TemplateError('dictsort filter: val must be an object'); } let array = []; // deliberately include properties from the object's prototype for (let k in val) { // eslint-disable-line guard-for-in, no-restricted-syntax ...
javascript
function dictsort(val, caseSensitive, by) { if (!lib.isObject(val)) { throw new lib.TemplateError('dictsort filter: val must be an object'); } let array = []; // deliberately include properties from the object's prototype for (let k in val) { // eslint-disable-line guard-for-in, no-restricted-syntax ...
[ "function", "dictsort", "(", "val", ",", "caseSensitive", ",", "by", ")", "{", "if", "(", "!", "lib", ".", "isObject", "(", "val", ")", ")", "{", "throw", "new", "lib", ".", "TemplateError", "(", "'dictsort filter: val must be an object'", ")", ";", "}", ...
eslint-disable-line dot-notation
[ "eslint", "-", "disable", "-", "line", "dot", "-", "notation" ]
224645791298db835df0acff3dc596d3a9ed2c4d
https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/nunjucks/src/filters.js#L85-L123
train
drichard/mindmaps
src/js/ApplicationController.js
doNewDocument
function doNewDocument() { // close old document first var doc = mindmapModel.getDocument(); doCloseDocument(); var presenter = new mindmaps.NewDocumentPresenter(eventBus, mindmapModel, new mindmaps.NewDocumentView()); presenter.go(); }
javascript
function doNewDocument() { // close old document first var doc = mindmapModel.getDocument(); doCloseDocument(); var presenter = new mindmaps.NewDocumentPresenter(eventBus, mindmapModel, new mindmaps.NewDocumentView()); presenter.go(); }
[ "function", "doNewDocument", "(", ")", "{", "// close old document first", "var", "doc", "=", "mindmapModel", ".", "getDocument", "(", ")", ";", "doCloseDocument", "(", ")", ";", "var", "presenter", "=", "new", "mindmaps", ".", "NewDocumentPresenter", "(", "even...
Handles the new document command.
[ "Handles", "the", "new", "document", "command", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/ApplicationController.js#L23-L31
train
drichard/mindmaps
src/js/ApplicationController.js
doSaveDocument
function doSaveDocument() { var presenter = new mindmaps.SaveDocumentPresenter(eventBus, mindmapModel, new mindmaps.SaveDocumentView(), autosaveController, filePicker); presenter.go(); }
javascript
function doSaveDocument() { var presenter = new mindmaps.SaveDocumentPresenter(eventBus, mindmapModel, new mindmaps.SaveDocumentView(), autosaveController, filePicker); presenter.go(); }
[ "function", "doSaveDocument", "(", ")", "{", "var", "presenter", "=", "new", "mindmaps", ".", "SaveDocumentPresenter", "(", "eventBus", ",", "mindmapModel", ",", "new", "mindmaps", ".", "SaveDocumentView", "(", ")", ",", "autosaveController", ",", "filePicker", ...
Handles the save document command.
[ "Handles", "the", "save", "document", "command", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/ApplicationController.js#L36-L40
train
drichard/mindmaps
src/js/ApplicationController.js
doOpenDocument
function doOpenDocument() { var presenter = new mindmaps.OpenDocumentPresenter(eventBus, mindmapModel, new mindmaps.OpenDocumentView(), filePicker); presenter.go(); }
javascript
function doOpenDocument() { var presenter = new mindmaps.OpenDocumentPresenter(eventBus, mindmapModel, new mindmaps.OpenDocumentView(), filePicker); presenter.go(); }
[ "function", "doOpenDocument", "(", ")", "{", "var", "presenter", "=", "new", "mindmaps", ".", "OpenDocumentPresenter", "(", "eventBus", ",", "mindmapModel", ",", "new", "mindmaps", ".", "OpenDocumentView", "(", ")", ",", "filePicker", ")", ";", "presenter", "....
Handles the open document command.
[ "Handles", "the", "open", "document", "command", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/ApplicationController.js#L57-L61
train
drichard/mindmaps
src/js/Inspector.js
updateView
function updateView(node) { var font = node.text.font; view.setBoldCheckboxState(font.weight === "bold"); view.setItalicCheckboxState(font.style === "italic"); view.setUnderlineCheckboxState(font.decoration === "underline"); view.setLinethroughCheckboxState(font.decoration === "line-through"); ...
javascript
function updateView(node) { var font = node.text.font; view.setBoldCheckboxState(font.weight === "bold"); view.setItalicCheckboxState(font.style === "italic"); view.setUnderlineCheckboxState(font.decoration === "underline"); view.setLinethroughCheckboxState(font.decoration === "line-through"); ...
[ "function", "updateView", "(", "node", ")", "{", "var", "font", "=", "node", ".", "text", ".", "font", ";", "view", ".", "setBoldCheckboxState", "(", "font", ".", "weight", "===", "\"bold\"", ")", ";", "view", ".", "setItalicCheckboxState", "(", "font", ...
Sets the view params to match the node's attributes. @param {mindmaps.Node} node
[ "Sets", "the", "view", "params", "to", "match", "the", "node", "s", "attributes", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Inspector.js#L320-L328
train
drichard/mindmaps
src/js/Navigator.js
calculateDraggerSize
function calculateDraggerSize() { var cw = $container.width() / scale; var ch = $container.height() / scale; // doc.x / container.x = canvas.x / dragger.x var width = (cw * canvasSize.x) / docSize.x; var height = (ch * canvasSize.y) / docSize.y; // limit size to bounds of canvas if ...
javascript
function calculateDraggerSize() { var cw = $container.width() / scale; var ch = $container.height() / scale; // doc.x / container.x = canvas.x / dragger.x var width = (cw * canvasSize.x) / docSize.x; var height = (ch * canvasSize.y) / docSize.y; // limit size to bounds of canvas if ...
[ "function", "calculateDraggerSize", "(", ")", "{", "var", "cw", "=", "$container", ".", "width", "(", ")", "/", "scale", ";", "var", "ch", "=", "$container", ".", "height", "(", ")", "/", "scale", ";", "// doc.x / container.x = canvas.x / dragger.x\r", "var", ...
Calculates and sets the size of the dragger element.
[ "Calculates", "and", "sets", "the", "size", "of", "the", "dragger", "element", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Navigator.js#L252-L269
train
drichard/mindmaps
src/js/Navigator.js
calculateCanvasSize
function calculateCanvasSize() { var width = view.getCanvasWidth(); var _scale = docSize.x / width; var height = docSize.y / _scale; view.setCanvasHeight(height); canvasSize.x = width; canvasSize.y = height; }
javascript
function calculateCanvasSize() { var width = view.getCanvasWidth(); var _scale = docSize.x / width; var height = docSize.y / _scale; view.setCanvasHeight(height); canvasSize.x = width; canvasSize.y = height; }
[ "function", "calculateCanvasSize", "(", ")", "{", "var", "width", "=", "view", ".", "getCanvasWidth", "(", ")", ";", "var", "_scale", "=", "docSize", ".", "x", "/", "width", ";", "var", "height", "=", "docSize", ".", "y", "/", "_scale", ";", "view", ...
Calculates and sets the size of the mini canvas.
[ "Calculates", "and", "sets", "the", "size", "of", "the", "mini", "canvas", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Navigator.js#L274-L283
train
drichard/mindmaps
src/js/Navigator.js
calculateDraggerPosition
function calculateDraggerPosition() { var sl = $container.scrollLeft() / scale; var st = $container.scrollTop() / scale; // sl / dox = dl / cw // dl = sl * cw / dox var left = sl * canvasSize.x / docSize.x; var top = st * canvasSize.y / docSize.y; view.setDraggerPosition(left, top);...
javascript
function calculateDraggerPosition() { var sl = $container.scrollLeft() / scale; var st = $container.scrollTop() / scale; // sl / dox = dl / cw // dl = sl * cw / dox var left = sl * canvasSize.x / docSize.x; var top = st * canvasSize.y / docSize.y; view.setDraggerPosition(left, top);...
[ "function", "calculateDraggerPosition", "(", ")", "{", "var", "sl", "=", "$container", ".", "scrollLeft", "(", ")", "/", "scale", ";", "var", "st", "=", "$container", ".", "scrollTop", "(", ")", "/", "scale", ";", "// sl / dox = dl / cw\r", "// dl = sl * cw / ...
Calculates and sets the possition of the dragger element.
[ "Calculates", "and", "sets", "the", "possition", "of", "the", "dragger", "element", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Navigator.js#L288-L297
train
drichard/mindmaps
src/js/Navigator.js
documentOpened
function documentOpened(doc) { docSize = doc.dimensions; mindmap = doc.mindmap; calculateCanvasSize(); calculateDraggerPosition(); calculateDraggerSize(); calculateZoomLevel(); calculateSliderValue(); renderView(); view.showActiveContent(); // move dragger when co...
javascript
function documentOpened(doc) { docSize = doc.dimensions; mindmap = doc.mindmap; calculateCanvasSize(); calculateDraggerPosition(); calculateDraggerSize(); calculateZoomLevel(); calculateSliderValue(); renderView(); view.showActiveContent(); // move dragger when co...
[ "function", "documentOpened", "(", "doc", ")", "{", "docSize", "=", "doc", ".", "dimensions", ";", "mindmap", "=", "doc", ".", "mindmap", ";", "calculateCanvasSize", "(", ")", ";", "calculateDraggerPosition", "(", ")", ";", "calculateDraggerSize", "(", ")", ...
Initialize view when a document was opened.
[ "Initialize", "view", "when", "a", "document", "was", "opened", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Navigator.js#L318-L337
train
drichard/mindmaps
src/js/Navigator.js
renderView
function renderView() { // draw canvas var scale = docSize.x / canvasSize.x; view.draw(mindmap, scale); }
javascript
function renderView() { // draw canvas var scale = docSize.x / canvasSize.x; view.draw(mindmap, scale); }
[ "function", "renderView", "(", ")", "{", "// draw canvas\r", "var", "scale", "=", "docSize", ".", "x", "/", "canvasSize", ".", "x", ";", "view", ".", "draw", "(", "mindmap", ",", "scale", ")", ";", "}" ]
Update the canvas of the view component.
[ "Update", "the", "canvas", "of", "the", "view", "component", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Navigator.js#L342-L346
train
drichard/mindmaps
Jakefile.js
extractScriptNames
function extractScriptNames() { console.log("Extracting script file names from index.html"); var regexScriptName = /<script src="(.*?)"><\/script>/g; var scriptSection = regexScriptSection.exec(indexFile)[1]; // extract script names var names = []; var match; while ((match = regexScriptName.exec(script...
javascript
function extractScriptNames() { console.log("Extracting script file names from index.html"); var regexScriptName = /<script src="(.*?)"><\/script>/g; var scriptSection = regexScriptSection.exec(indexFile)[1]; // extract script names var names = []; var match; while ((match = regexScriptName.exec(script...
[ "function", "extractScriptNames", "(", ")", "{", "console", ".", "log", "(", "\"Extracting script file names from index.html\"", ")", ";", "var", "regexScriptName", "=", "/", "<script src=\"(.*?)\"><\\/script>", "/", "g", ";", "var", "scriptSection", "=", "regexScriptSe...
find the scripts in index.html
[ "find", "the", "scripts", "in", "index", ".", "html" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/Jakefile.js#L14-L29
train
drichard/mindmaps
Jakefile.js
minifyScripts
function minifyScripts(scriptNames) { console.log("Minifying and concatting scripts."); var UglifyJS = require("uglify-js"); var regexMinifed = /min.js$/; var regexCopyright = /^\/\*![\s\S]*?\*\//m; var buffer = []; scriptNames.forEach(function(script) { var scriptFile = fs.readFileSync(srcDir + scrip...
javascript
function minifyScripts(scriptNames) { console.log("Minifying and concatting scripts."); var UglifyJS = require("uglify-js"); var regexMinifed = /min.js$/; var regexCopyright = /^\/\*![\s\S]*?\*\//m; var buffer = []; scriptNames.forEach(function(script) { var scriptFile = fs.readFileSync(srcDir + scrip...
[ "function", "minifyScripts", "(", "scriptNames", ")", "{", "console", ".", "log", "(", "\"Minifying and concatting scripts.\"", ")", ";", "var", "UglifyJS", "=", "require", "(", "\"uglify-js\"", ")", ";", "var", "regexMinifed", "=", "/", "min.js$", "/", ";", "...
run all scripts through uglifyJS and write to new dest
[ "run", "all", "scripts", "through", "uglifyJS", "and", "write", "to", "new", "dest" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/Jakefile.js#L32-L64
train
drichard/mindmaps
Jakefile.js
copyFiles
function copyFiles(dir) { var files = fs.readdirSync(srcDir + dir); files.forEach(function(file) { var currentDir = dir + file; if (!regexExcludeFiles.test(currentDir)) { var stats = fs.statSync(srcDir + currentDir); if (stats.isDirectory()) { if (!fs.existsSync(publishDir ...
javascript
function copyFiles(dir) { var files = fs.readdirSync(srcDir + dir); files.forEach(function(file) { var currentDir = dir + file; if (!regexExcludeFiles.test(currentDir)) { var stats = fs.statSync(srcDir + currentDir); if (stats.isDirectory()) { if (!fs.existsSync(publishDir ...
[ "function", "copyFiles", "(", "dir", ")", "{", "var", "files", "=", "fs", ".", "readdirSync", "(", "srcDir", "+", "dir", ")", ";", "files", ".", "forEach", "(", "function", "(", "file", ")", "{", "var", "currentDir", "=", "dir", "+", "file", ";", "...
Recursively copies all files that dont match the exclude filter from the base directory to the publish directory.
[ "Recursively", "copies", "all", "files", "that", "dont", "match", "the", "exclude", "filter", "from", "the", "base", "directory", "to", "the", "publish", "directory", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/Jakefile.js#L125-L142
train
drichard/mindmaps
src/js/CanvasView.js
makeDraggable
function makeDraggable() { self.$getContainer().dragscrollable({ dragSelector : "#drawing-area, canvas.line-canvas", acceptPropagatedEvent : false, delegateMode : true, preventDefault : true }); }
javascript
function makeDraggable() { self.$getContainer().dragscrollable({ dragSelector : "#drawing-area, canvas.line-canvas", acceptPropagatedEvent : false, delegateMode : true, preventDefault : true }); }
[ "function", "makeDraggable", "(", ")", "{", "self", ".", "$getContainer", "(", ")", ".", "dragscrollable", "(", "{", "dragSelector", ":", "\"#drawing-area, canvas.line-canvas\"", ",", "acceptPropagatedEvent", ":", "false", ",", "delegateMode", ":", "true", ",", "p...
Enables dragging of the map with the mouse.
[ "Enables", "dragging", "of", "the", "map", "with", "the", "mouse", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasView.js#L159-L166
train
drichard/mindmaps
src/js/CanvasView.js
drawNodeCanvas
function drawNodeCanvas(node, color) { var parent = node.getParent(); var depth = node.getDepth(); var offsetX = node.offset.x; var offsetY = node.offset.y; color = color || node.branchColor; var $node = $getNode(node); var $parent = $getNode(parent); var $canvas = $getNodeCanv...
javascript
function drawNodeCanvas(node, color) { var parent = node.getParent(); var depth = node.getDepth(); var offsetX = node.offset.x; var offsetY = node.offset.y; color = color || node.branchColor; var $node = $getNode(node); var $parent = $getNode(parent); var $canvas = $getNodeCanv...
[ "function", "drawNodeCanvas", "(", "node", ",", "color", ")", "{", "var", "parent", "=", "node", ".", "getParent", "(", ")", ";", "var", "depth", "=", "node", ".", "getDepth", "(", ")", ";", "var", "offsetX", "=", "node", ".", "offset", ".", "x", "...
Redraws a node's branch to its parent. @param {mindmaps.Node} node @param {String} optional color
[ "Redraws", "a", "node", "s", "branch", "to", "its", "parent", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasView.js#L596-L608
train
drichard/mindmaps
src/js/CanvasView.js
CaptionEditor
function CaptionEditor(view) { var self = this; var attached = false; // text input for node edits. var $editor = $("<textarea/>", { id : "caption-editor", "class" : "node-text-behaviour" }).bind("keydown", "esc", function() { self.stop(); }).bind("keydown", "return"...
javascript
function CaptionEditor(view) { var self = this; var attached = false; // text input for node edits. var $editor = $("<textarea/>", { id : "caption-editor", "class" : "node-text-behaviour" }).bind("keydown", "esc", function() { self.stop(); }).bind("keydown", "return"...
[ "function", "CaptionEditor", "(", "view", ")", "{", "var", "self", "=", "this", ";", "var", "attached", "=", "false", ";", "// text input for node edits.\r", "var", "$editor", "=", "$", "(", "\"<textarea/>\"", ",", "{", "id", ":", "\"caption-editor\"", ",", ...
Creates a new CaptionEditor. This tool offers an inline editor component to change a node's caption. @constructor @param {mindmaps.CanvasView} view
[ "Creates", "a", "new", "CaptionEditor", ".", "This", "tool", "offers", "an", "inline", "editor", "component", "to", "change", "a", "node", "s", "caption", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasView.js#L759-L853
train
drichard/mindmaps
src/js/HelpController.js
setupHelpButton
function setupHelpButton() { var command = commandRegistry.get(mindmaps.HelpCommand); command.setHandler(showHelp); var notifications = []; function showHelp() { // true if atleast one notifications is still on screen var displaying = notifications.some(function(noti) { return noti....
javascript
function setupHelpButton() { var command = commandRegistry.get(mindmaps.HelpCommand); command.setHandler(showHelp); var notifications = []; function showHelp() { // true if atleast one notifications is still on screen var displaying = notifications.some(function(noti) { return noti....
[ "function", "setupHelpButton", "(", ")", "{", "var", "command", "=", "commandRegistry", ".", "get", "(", "mindmaps", ".", "HelpCommand", ")", ";", "command", ".", "setHandler", "(", "showHelp", ")", ";", "var", "notifications", "=", "[", "]", ";", "functio...
Prepares notfications to show for help command.
[ "Prepares", "notfications", "to", "show", "for", "help", "command", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/HelpController.js#L209-L279
train
drichard/mindmaps
src/js/CanvasDrawingTools.js
roundedRect
function roundedRect(ctx, x, y, width, height, radius) { // from MDN docs ctx.beginPath(); ctx.moveTo(x, y + radius); ctx.lineTo(x, y + height - radius); ctx.quadraticCurveTo(x, y + height, x + radius, y + height); ctx.lineTo(x + width - radius, y + height); ctx.quadraticCurveTo(x + width, y...
javascript
function roundedRect(ctx, x, y, width, height, radius) { // from MDN docs ctx.beginPath(); ctx.moveTo(x, y + radius); ctx.lineTo(x, y + height - radius); ctx.quadraticCurveTo(x, y + height, x + radius, y + height); ctx.lineTo(x + width - radius, y + height); ctx.quadraticCurveTo(x + width, y...
[ "function", "roundedRect", "(", "ctx", ",", "x", ",", "y", ",", "width", ",", "height", ",", "radius", ")", "{", "// from MDN docs", "ctx", ".", "beginPath", "(", ")", ";", "ctx", ".", "moveTo", "(", "x", ",", "y", "+", "radius", ")", ";", "ctx", ...
Draws a rounded rectangle @param ctx @param x @param y @param width @param height @param radius
[ "Draws", "a", "rounded", "rectangle" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasDrawingTools.js#L28-L43
train
drichard/mindmaps
src/js/CanvasPresenter.js
function(node) { if (!node) { node = mindmapModel.selectedNode; } // toggle node visibility var action = new mindmaps.action.ToggleNodeFoldAction(node); mindmapModel.executeAction(action); }
javascript
function(node) { if (!node) { node = mindmapModel.selectedNode; } // toggle node visibility var action = new mindmaps.action.ToggleNodeFoldAction(node); mindmapModel.executeAction(action); }
[ "function", "(", "node", ")", "{", "if", "(", "!", "node", ")", "{", "node", "=", "mindmapModel", ".", "selectedNode", ";", "}", "// toggle node visibility\r", "var", "action", "=", "new", "mindmaps", ".", "action", ".", "ToggleNodeFoldAction", "(", "node", ...
Toggles the fold state of a node. @param {mindmaps.Node} node
[ "Toggles", "the", "fold", "state", "of", "a", "node", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasPresenter.js#L47-L55
train
drichard/mindmaps
src/js/CanvasPresenter.js
showMindMap
function showMindMap(doc) { view.setZoomFactor(zoomController.DEFAULT_ZOOM); var dimensions = doc.dimensions; view.setDimensions(dimensions.x, dimensions.y); var map = doc.mindmap; view.drawMap(map); view.center(); mindmapModel.selectNode(map.root); }
javascript
function showMindMap(doc) { view.setZoomFactor(zoomController.DEFAULT_ZOOM); var dimensions = doc.dimensions; view.setDimensions(dimensions.x, dimensions.y); var map = doc.mindmap; view.drawMap(map); view.center(); mindmapModel.selectNode(map.root); }
[ "function", "showMindMap", "(", "doc", ")", "{", "view", ".", "setZoomFactor", "(", "zoomController", ".", "DEFAULT_ZOOM", ")", ";", "var", "dimensions", "=", "doc", ".", "dimensions", ";", "view", ".", "setDimensions", "(", "dimensions", ".", "x", ",", "d...
Draw the mind map on the canvas. @param {mindmaps.Document} doc
[ "Draw", "the", "mind", "map", "on", "the", "canvas", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasPresenter.js#L225-L234
train
drichard/mindmaps
src/js/CanvasPresenter.js
bind
function bind() { // listen to global events eventBus.subscribe(mindmaps.Event.DOCUMENT_OPENED, function(doc, newDocument) { showMindMap(doc); // if (doc.isNew()) { // // edit root node on start // var root = doc.mindmap.root; // view.editNodeCaption(root); ...
javascript
function bind() { // listen to global events eventBus.subscribe(mindmaps.Event.DOCUMENT_OPENED, function(doc, newDocument) { showMindMap(doc); // if (doc.isNew()) { // // edit root node on start // var root = doc.mindmap.root; // view.editNodeCaption(root); ...
[ "function", "bind", "(", ")", "{", "// listen to global events\r", "eventBus", ".", "subscribe", "(", "mindmaps", ".", "Event", ".", "DOCUMENT_OPENED", ",", "function", "(", "doc", ",", "newDocument", ")", "{", "showMindMap", "(", "doc", ")", ";", "// if (doc....
Hook up with EventBus.
[ "Hook", "up", "with", "EventBus", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/CanvasPresenter.js#L239-L338
train
drichard/mindmaps
src/js/Util.js
getBinaryMapWithDepth
function getBinaryMapWithDepth(depth) { var mm = new mindmaps.MindMap(); var root = mm.root; function createTwoChildren(node, depth) { if (depth === 0) { return; } var left = mm.createNode(); left.text.caption = "Node " + left.id; node.addChild(left); createTwoChildren(...
javascript
function getBinaryMapWithDepth(depth) { var mm = new mindmaps.MindMap(); var root = mm.root; function createTwoChildren(node, depth) { if (depth === 0) { return; } var left = mm.createNode(); left.text.caption = "Node " + left.id; node.addChild(left); createTwoChildren(...
[ "function", "getBinaryMapWithDepth", "(", "depth", ")", "{", "var", "mm", "=", "new", "mindmaps", ".", "MindMap", "(", ")", ";", "var", "root", "=", "mm", ".", "root", ";", "function", "createTwoChildren", "(", "node", ",", "depth", ")", "{", "if", "("...
test Default documents
[ "test", "Default", "documents" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Util.js#L96-L156
train
drichard/mindmaps
src/js/StaticCanvas.js
prepareNodes
function prepareNodes(mindmap) { // clone tree since we modify it var root = mindmap.getRoot().clone(); function addProps(node) { var lineWidth = mindmaps.CanvasDrawingUtil.getLineWidth(zoomFactor, node.getDepth()); var metrics = mindmaps.TextMetrics.getTextMetrics(node, zoomFactor); ...
javascript
function prepareNodes(mindmap) { // clone tree since we modify it var root = mindmap.getRoot().clone(); function addProps(node) { var lineWidth = mindmaps.CanvasDrawingUtil.getLineWidth(zoomFactor, node.getDepth()); var metrics = mindmaps.TextMetrics.getTextMetrics(node, zoomFactor); ...
[ "function", "prepareNodes", "(", "mindmap", ")", "{", "// clone tree since we modify it", "var", "root", "=", "mindmap", ".", "getRoot", "(", ")", ".", "clone", "(", ")", ";", "function", "addProps", "(", "node", ")", "{", "var", "lineWidth", "=", "mindmaps"...
Adds some information to each node which are needed for rendering. @param mindmap @returns
[ "Adds", "some", "information", "to", "each", "node", "which", "are", "needed", "for", "rendering", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/StaticCanvas.js#L42-L79
train
drichard/mindmaps
src/js/StaticCanvas.js
getMindMapDimensions
function getMindMapDimensions(root) { var pos = root.getPosition(); var left = 0, top = 0, right = 0, bottom = 0; var padding = 50; function checkDimensions(node) { var pos = node.getPosition(); var tm = node.textMetrics; if (pos.x < left) { left = pos.x; } if (p...
javascript
function getMindMapDimensions(root) { var pos = root.getPosition(); var left = 0, top = 0, right = 0, bottom = 0; var padding = 50; function checkDimensions(node) { var pos = node.getPosition(); var tm = node.textMetrics; if (pos.x < left) { left = pos.x; } if (p...
[ "function", "getMindMapDimensions", "(", "root", ")", "{", "var", "pos", "=", "root", ".", "getPosition", "(", ")", ";", "var", "left", "=", "0", ",", "top", "=", "0", ",", "right", "=", "0", ",", "bottom", "=", "0", ";", "var", "padding", "=", "...
Finds the nodes which are farthest away from the root and calculates the actual dimensions of the mind map. @param {mindmaps.Node} root @returns {object} with properties width and height
[ "Finds", "the", "nodes", "which", "are", "farthest", "away", "from", "the", "root", "and", "calculates", "the", "actual", "dimensions", "of", "the", "mind", "map", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/StaticCanvas.js#L88-L128
train
drichard/mindmaps
src/js/StaticCanvas.js
drawLines
function drawLines(node, parent) { ctx.save(); var x = node.offset.x; var y = node.offset.y; ctx.translate(x, y); // branch if (parent) { drawBranch(node, parent); } // bottom border if (!node.isRoot()) { ctx.fillStyle = node.branchColor; v...
javascript
function drawLines(node, parent) { ctx.save(); var x = node.offset.x; var y = node.offset.y; ctx.translate(x, y); // branch if (parent) { drawBranch(node, parent); } // bottom border if (!node.isRoot()) { ctx.fillStyle = node.branchColor; v...
[ "function", "drawLines", "(", "node", ",", "parent", ")", "{", "ctx", ".", "save", "(", ")", ";", "var", "x", "=", "node", ".", "offset", ".", "x", ";", "var", "y", "=", "node", ".", "offset", ".", "y", ";", "ctx", ".", "translate", "(", "x", ...
Draws all branches
[ "Draws", "all", "branches" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/StaticCanvas.js#L204-L227
train
drichard/mindmaps
src/js/Command.js
function() { if (this.handler) { this.handler(); if (mindmaps.DEBUG) { console.log("handler called for", this.id); } } else { if (mindmaps.DEBUG) { console.log("no handler found for", this.id); } } }
javascript
function() { if (this.handler) { this.handler(); if (mindmaps.DEBUG) { console.log("handler called for", this.id); } } else { if (mindmaps.DEBUG) { console.log("no handler found for", this.id); } } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "handler", ")", "{", "this", ".", "handler", "(", ")", ";", "if", "(", "mindmaps", ".", "DEBUG", ")", "{", "console", ".", "log", "(", "\"handler called for\"", ",", "this", ".", "id", ")", ";", ...
Executes the command. Tries to call the handler function.
[ "Executes", "the", "command", ".", "Tries", "to", "call", "the", "handler", "function", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Command.js#L40-L51
train
drichard/mindmaps
src/js/UndoManager.js
UndoManager
function UndoManager(maxStackSize) { this.maxStackSize = maxStackSize || 64; var State = { UNDO : "undo", REDO : "redo" }; var self = this; var undoStack = new UndoManager.CircularStack(this.maxStackSize); var redoStack = new UndoManager.CircularStack(this.maxStackSize); var undoConte...
javascript
function UndoManager(maxStackSize) { this.maxStackSize = maxStackSize || 64; var State = { UNDO : "undo", REDO : "redo" }; var self = this; var undoStack = new UndoManager.CircularStack(this.maxStackSize); var redoStack = new UndoManager.CircularStack(this.maxStackSize); var undoConte...
[ "function", "UndoManager", "(", "maxStackSize", ")", "{", "this", ".", "maxStackSize", "=", "maxStackSize", "||", "64", ";", "var", "State", "=", "{", "UNDO", ":", "\"undo\"", ",", "REDO", ":", "\"redo\"", "}", ";", "var", "self", "=", "this", ";", "va...
Creates a new UndoManager @constructor @param {Integer} [maxStackSize=64]
[ "Creates", "a", "new", "UndoManager" ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/UndoManager.js#L7-L152
train
drichard/mindmaps
src/js/Storage.js
function(doc) { try { localStorage.setItem(prefix + doc.id, doc.serialize()); return true; } catch (error) { // QUOTA_EXCEEDED console.error("Error while saving document to local storage", error); return false; } }
javascript
function(doc) { try { localStorage.setItem(prefix + doc.id, doc.serialize()); return true; } catch (error) { // QUOTA_EXCEEDED console.error("Error while saving document to local storage", error); return false; } }
[ "function", "(", "doc", ")", "{", "try", "{", "localStorage", ".", "setItem", "(", "prefix", "+", "doc", ".", "id", ",", "doc", ".", "serialize", "(", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "error", ")", "{", "// QUOTA_EXCEEDED\r", ...
Saves a document to the localstorage. Overwrites the old document if one with the same id exists. @param {mindmaps.Document} doc @returns {Boolean} true if save was successful, false otherwise.
[ "Saves", "a", "document", "to", "the", "localstorage", ".", "Overwrites", "the", "old", "document", "if", "one", "with", "the", "same", "id", "exists", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Storage.js#L69-L79
train
drichard/mindmaps
src/js/Storage.js
function() { var documents = []; // search localstorage for saved documents for ( var i = 0, max = localStorage.length; i < max; i++) { var key = localStorage.key(i); // value is a document if key confirms to prefix if (key.indexOf(prefix) == 0) { var doc = get...
javascript
function() { var documents = []; // search localstorage for saved documents for ( var i = 0, max = localStorage.length; i < max; i++) { var key = localStorage.key(i); // value is a document if key confirms to prefix if (key.indexOf(prefix) == 0) { var doc = get...
[ "function", "(", ")", "{", "var", "documents", "=", "[", "]", ";", "// search localstorage for saved documents\r", "for", "(", "var", "i", "=", "0", ",", "max", "=", "localStorage", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "var", ...
Finds all documents in the local storage object. @returns {Array} an Array of documents
[ "Finds", "all", "documents", "in", "the", "local", "storage", "object", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Storage.js#L97-L111
train
drichard/mindmaps
src/js/Storage.js
function() { var ids = []; // search localstorage for saved documents for ( var i = 0, max = localStorage.length; i < max; i++) { var key = localStorage.key(i); // value is a document if key confirms to prefix if (key.indexOf(prefix) == 0) { ids.push(key.substr...
javascript
function() { var ids = []; // search localstorage for saved documents for ( var i = 0, max = localStorage.length; i < max; i++) { var key = localStorage.key(i); // value is a document if key confirms to prefix if (key.indexOf(prefix) == 0) { ids.push(key.substr...
[ "function", "(", ")", "{", "var", "ids", "=", "[", "]", ";", "// search localstorage for saved documents\r", "for", "(", "var", "i", "=", "0", ",", "max", "=", "localStorage", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "var", "key...
Gets all document ids found in the local storage object. @returns {Array} an Array of document ids
[ "Gets", "all", "document", "ids", "found", "in", "the", "local", "storage", "object", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/Storage.js#L118-L129
train
drichard/mindmaps
src/js/MindMaps.js
addUnloadHook
function addUnloadHook () { window.onbeforeunload = function (e) { var msg = "Are you sure? Any unsaved progress will be lost." e = e || window.event; // For IE and Firefox prior to version 4 if (e) { e.returnValue = msg; } // For Safari return msg; }; }
javascript
function addUnloadHook () { window.onbeforeunload = function (e) { var msg = "Are you sure? Any unsaved progress will be lost." e = e || window.event; // For IE and Firefox prior to version 4 if (e) { e.returnValue = msg; } // For Safari return msg; }; }
[ "function", "addUnloadHook", "(", ")", "{", "window", ".", "onbeforeunload", "=", "function", "(", "e", ")", "{", "var", "msg", "=", "\"Are you sure? Any unsaved progress will be lost.\"", "e", "=", "e", "||", "window", ".", "event", ";", "// For IE and Firefox pr...
Adds a confirmation dialog when the user navigates away from the app.
[ "Adds", "a", "confirmation", "dialog", "when", "the", "user", "navigates", "away", "from", "the", "app", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/MindMaps.js#L105-L118
train
drichard/mindmaps
src/js/MindMaps.js
setupConsole
function setupConsole() { var noOp = function() {}; // provide console object and dummy functions if not built-in var console = window.console || {}; ['log', 'info', 'debug', 'warn', 'error'].forEach(function(prop) { console[prop] = console[prop] || noOp; }); // turn all console.xx calls into...
javascript
function setupConsole() { var noOp = function() {}; // provide console object and dummy functions if not built-in var console = window.console || {}; ['log', 'info', 'debug', 'warn', 'error'].forEach(function(prop) { console[prop] = console[prop] || noOp; }); // turn all console.xx calls into...
[ "function", "setupConsole", "(", ")", "{", "var", "noOp", "=", "function", "(", ")", "{", "}", ";", "// provide console object and dummy functions if not built-in\r", "var", "console", "=", "window", ".", "console", "||", "{", "}", ";", "[", "'log'", ",", "'in...
Initialize the console object.
[ "Initialize", "the", "console", "object", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/MindMaps.js#L141-L163
train
drichard/mindmaps
src/js/MindMaps.js
createHTML5Shims
function createHTML5Shims() { // localstorage dummy (does nothing) if (typeof window.localStorage == 'undefined') { window.localStorage = { getItem : function() { return null; }, setItem : function() { }, clear : function() { }, removeItem : function(...
javascript
function createHTML5Shims() { // localstorage dummy (does nothing) if (typeof window.localStorage == 'undefined') { window.localStorage = { getItem : function() { return null; }, setItem : function() { }, clear : function() { }, removeItem : function(...
[ "function", "createHTML5Shims", "(", ")", "{", "// localstorage dummy (does nothing)\r", "if", "(", "typeof", "window", ".", "localStorage", "==", "'undefined'", ")", "{", "window", ".", "localStorage", "=", "{", "getItem", ":", "function", "(", ")", "{", "retur...
Create shims for HTML5 functionality if not supported by browser.
[ "Create", "shims", "for", "HTML5", "functionality", "if", "not", "supported", "by", "browser", "." ]
489f04f499409ae7a9f70ad4861e999c230fa6a5
https://github.com/drichard/mindmaps/blob/489f04f499409ae7a9f70ad4861e999c230fa6a5/src/js/MindMaps.js#L405-L424
train
hshoff/vx
scripts/docs/index.js
getReadmeText
function getReadmeText(pkg) { const pkgDir = atPackagesDirectory().dir(pkg); const generatedDoc = pkgDir.read('./docs/docs.md'); if (generatedDoc) pkgDir.write('Readme.md', generatedDoc); const text = pkgDir.read(README); if (text) return text; else return ''; // don't return "undefined" }
javascript
function getReadmeText(pkg) { const pkgDir = atPackagesDirectory().dir(pkg); const generatedDoc = pkgDir.read('./docs/docs.md'); if (generatedDoc) pkgDir.write('Readme.md', generatedDoc); const text = pkgDir.read(README); if (text) return text; else return ''; // don't return "undefined" }
[ "function", "getReadmeText", "(", "pkg", ")", "{", "const", "pkgDir", "=", "atPackagesDirectory", "(", ")", ".", "dir", "(", "pkg", ")", ";", "const", "generatedDoc", "=", "pkgDir", ".", "read", "(", "'./docs/docs.md'", ")", ";", "if", "(", "generatedDoc",...
Returns the text of a README at a specific package
[ "Returns", "the", "text", "of", "a", "README", "at", "a", "specific", "package" ]
850ecd6c9dd3791febfcc49073c6eef5dcc04dc7
https://github.com/hshoff/vx/blob/850ecd6c9dd3791febfcc49073c6eef5dcc04dc7/scripts/docs/index.js#L28-L35
train
hshoff/vx
scripts/docs/index.js
getDocObject
function getDocObject(dir, info) { const markdown = getReadmeText(dir); const html = marked(markdown); const cleanedHTML = prepareHTML(html, info); return { pkg: dir, html: cleanedHTML }; }
javascript
function getDocObject(dir, info) { const markdown = getReadmeText(dir); const html = marked(markdown); const cleanedHTML = prepareHTML(html, info); return { pkg: dir, html: cleanedHTML }; }
[ "function", "getDocObject", "(", "dir", ",", "info", ")", "{", "const", "markdown", "=", "getReadmeText", "(", "dir", ")", ";", "const", "html", "=", "marked", "(", "markdown", ")", ";", "const", "cleanedHTML", "=", "prepareHTML", "(", "html", ",", "info...
From a package directory, get the html from the markdown @return {pkg, html}
[ "From", "a", "package", "directory", "get", "the", "html", "from", "the", "markdown" ]
850ecd6c9dd3791febfcc49073c6eef5dcc04dc7
https://github.com/hshoff/vx/blob/850ecd6c9dd3791febfcc49073c6eef5dcc04dc7/scripts/docs/index.js#L41-L46
train
Automattic/kue
lib/http/routes/json.js
get
function get( obj ) { var pending = 0 , res = {} , callback , done; return function _( arg ) { switch(typeof arg) { case 'function': callback = arg; break; case 'string': ++pending; obj[ arg ](function( err, val ) { if( done ) return; ...
javascript
function get( obj ) { var pending = 0 , res = {} , callback , done; return function _( arg ) { switch(typeof arg) { case 'function': callback = arg; break; case 'string': ++pending; obj[ arg ](function( err, val ) { if( done ) return; ...
[ "function", "get", "(", "obj", ")", "{", "var", "pending", "=", "0", ",", "res", "=", "{", "}", ",", "callback", ",", "done", ";", "return", "function", "_", "(", "arg", ")", "{", "switch", "(", "typeof", "arg", ")", "{", "case", "'function'", ":...
Data fetching helper.
[ "Data", "fetching", "helper", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/routes/json.js#L305-L328
train
Automattic/kue
lib/http/public/javascripts/main.js
init
function init(state) { var canvas = o('#loading canvas').get(0) , ctx = canvas.getContext('2d'); loading = new LoadingIndicator; loading.ctx = ctx; loading.size(canvas.width); pollStats(1000); show(state)(); o('li.inactive a').click(show('inactive')); o('li.complete a').click(s...
javascript
function init(state) { var canvas = o('#loading canvas').get(0) , ctx = canvas.getContext('2d'); loading = new LoadingIndicator; loading.ctx = ctx; loading.size(canvas.width); pollStats(1000); show(state)(); o('li.inactive a').click(show('inactive')); o('li.complete a').click(s...
[ "function", "init", "(", "state", ")", "{", "var", "canvas", "=", "o", "(", "'#loading canvas'", ")", ".", "get", "(", "0", ")", ",", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "loading", "=", "new", "LoadingIndicator", ";", "loa...
Initialize UI.
[ "Initialize", "UI", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L51-L79
train
Automattic/kue
lib/http/public/javascripts/main.js
showLoading
function showLoading() { var n = 0; o('#loading').show(); showLoading.timer = setInterval(function () { loading.update(++n).draw(loading.ctx); }, 50); }
javascript
function showLoading() { var n = 0; o('#loading').show(); showLoading.timer = setInterval(function () { loading.update(++n).draw(loading.ctx); }, 50); }
[ "function", "showLoading", "(", ")", "{", "var", "n", "=", "0", ";", "o", "(", "'#loading'", ")", ".", "show", "(", ")", ";", "showLoading", ".", "timer", "=", "setInterval", "(", "function", "(", ")", "{", "loading", ".", "update", "(", "++", "n",...
Show loading indicator.
[ "Show", "loading", "indicator", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L85-L91
train
Automattic/kue
lib/http/public/javascripts/main.js
infiniteScroll
function infiniteScroll() { if (infiniteScroll.bound) return; var body = o('body'); hideLoading(); infiniteScroll.bound = true; o(window).scroll(function (e) { var top = body.scrollTop() , height = body.innerHeight() , windowHeight = window.innerHeight , ...
javascript
function infiniteScroll() { if (infiniteScroll.bound) return; var body = o('body'); hideLoading(); infiniteScroll.bound = true; o(window).scroll(function (e) { var top = body.scrollTop() , height = body.innerHeight() , windowHeight = window.innerHeight , ...
[ "function", "infiniteScroll", "(", ")", "{", "if", "(", "infiniteScroll", ".", "bound", ")", "return", ";", "var", "body", "=", "o", "(", "'body'", ")", ";", "hideLoading", "(", ")", ";", "infiniteScroll", ".", "bound", "=", "true", ";", "o", "(", "w...
Infinite scroll.
[ "Infinite", "scroll", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L106-L125
train
Automattic/kue
lib/http/public/javascripts/main.js
show
function show(state) { return function () { active = state; if (pollForJobs.timer) { clearTimeout(pollForJobs.timer); delete pollForJobs.timer; } history.pushState({ state: state }, state, state); o('#jobs .job').remove(); o('#menu li a').remov...
javascript
function show(state) { return function () { active = state; if (pollForJobs.timer) { clearTimeout(pollForJobs.timer); delete pollForJobs.timer; } history.pushState({ state: state }, state, state); o('#jobs .job').remove(); o('#menu li a').remov...
[ "function", "show", "(", "state", ")", "{", "return", "function", "(", ")", "{", "active", "=", "state", ";", "if", "(", "pollForJobs", ".", "timer", ")", "{", "clearTimeout", "(", "pollForJobs", ".", "timer", ")", ";", "delete", "pollForJobs", ".", "t...
Show jobs with `state`. @param {String} state @param {Boolean} init @return {Function}
[ "Show", "jobs", "with", "state", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L135-L149
train
Automattic/kue
lib/http/public/javascripts/main.js
pollForJobs
function pollForJobs(state, ms) { o('h1').text(state); refreshJobs(state, function () { infiniteScroll(); if (!pollForJobs.timer) pollForJobs.timer = setTimeout(function () { delete pollForJobs.timer; pollForJobs(state, ms); }, ms); }); }
javascript
function pollForJobs(state, ms) { o('h1').text(state); refreshJobs(state, function () { infiniteScroll(); if (!pollForJobs.timer) pollForJobs.timer = setTimeout(function () { delete pollForJobs.timer; pollForJobs(state, ms); }, ms); }); }
[ "function", "pollForJobs", "(", "state", ",", "ms", ")", "{", "o", "(", "'h1'", ")", ".", "text", "(", "state", ")", ";", "refreshJobs", "(", "state", ",", "function", "(", ")", "{", "infiniteScroll", "(", ")", ";", "if", "(", "!", "pollForJobs", "...
Poll for jobs with `state` every `ms`. @param {String} state @param {Number} ms
[ "Poll", "for", "jobs", "with", "state", "every", "ms", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L158-L167
train
Automattic/kue
lib/http/public/javascripts/main.js
refreshJobs
function refreshJobs(state, fn) { // TODO: clean this crap up var jobHeight = o('#jobs .job .block').outerHeight(true) , top = o(window).scrollTop() , height = window.innerHeight , visibleFrom = Math.max(0, Math.floor(top / jobHeight)) , visibleTo = Math.floor((top + height) / jo...
javascript
function refreshJobs(state, fn) { // TODO: clean this crap up var jobHeight = o('#jobs .job .block').outerHeight(true) , top = o(window).scrollTop() , height = window.innerHeight , visibleFrom = Math.max(0, Math.floor(top / jobHeight)) , visibleTo = Math.floor((top + height) / jo...
[ "function", "refreshJobs", "(", "state", ",", "fn", ")", "{", "// TODO: clean this crap up", "var", "jobHeight", "=", "o", "(", "'#jobs .job .block'", ")", ".", "outerHeight", "(", "true", ")", ",", "top", "=", "o", "(", "window", ")", ".", "scrollTop", "(...
Re-request and refresh job elements. @param {String} state @param {Function} fn
[ "Re", "-", "request", "and", "refresh", "job", "elements", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L176-L232
train
Automattic/kue
lib/http/public/javascripts/main.js
pollStats
function pollStats(ms) { request('./stats', function (data) { o('li.inactive .count').text(data.inactiveCount); o('li.active .count').text(data.activeCount); o('li.complete .count').text(data.completeCount); o('li.failed .count').text(data.failedCount); o('li.delayed .count')...
javascript
function pollStats(ms) { request('./stats', function (data) { o('li.inactive .count').text(data.inactiveCount); o('li.active .count').text(data.activeCount); o('li.complete .count').text(data.completeCount); o('li.failed .count').text(data.failedCount); o('li.delayed .count')...
[ "function", "pollStats", "(", "ms", ")", "{", "request", "(", "'./stats'", ",", "function", "(", "data", ")", "{", "o", "(", "'li.inactive .count'", ")", ".", "text", "(", "data", ".", "inactiveCount", ")", ";", "o", "(", "'li.active .count'", ")", ".", ...
Poll for stats every `ms`. @param {Number} ms
[ "Poll", "for", "stats", "every", "ms", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/http/public/javascripts/main.js#L240-L251
train
Automattic/kue
examples/events.js
create
function create() { var name = [ 'tobi', 'loki', 'jane', 'manny' ][ Math.random() * 4 | 0 ]; var job = jobs.create( 'video conversion', { title: 'converting ' + name + '\'s to avi', user: 1, frames: 200 } ); job.on( 'complete', function () { console.log( " Job complete" ); } ).on( 'failed', function...
javascript
function create() { var name = [ 'tobi', 'loki', 'jane', 'manny' ][ Math.random() * 4 | 0 ]; var job = jobs.create( 'video conversion', { title: 'converting ' + name + '\'s to avi', user: 1, frames: 200 } ); job.on( 'complete', function () { console.log( " Job complete" ); } ).on( 'failed', function...
[ "function", "create", "(", ")", "{", "var", "name", "=", "[", "'tobi'", ",", "'loki'", ",", "'jane'", ",", "'manny'", "]", "[", "Math", ".", "random", "(", ")", "*", "4", "|", "0", "]", ";", "var", "job", "=", "jobs", ".", "create", "(", "'vide...
create some jobs at random, usually you would create these in your http processes upon user input etc.
[ "create", "some", "jobs", "at", "random", "usually", "you", "would", "create", "these", "in", "your", "http", "processes", "upon", "user", "input", "etc", "." ]
87d61503d3d9cc024633efc7611bd25551f0f87d
https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/examples/events.js#L14-L31
train
google/marzipano
src/util/compose.js
compose
function compose() { var fnList = arguments; return function composed(initialArg) { var ret = initialArg; for (var i = 0; i < fnList.length; i++) { var fn = fnList[i]; ret = fn.call(null, ret); } return ret; }; }
javascript
function compose() { var fnList = arguments; return function composed(initialArg) { var ret = initialArg; for (var i = 0; i < fnList.length; i++) { var fn = fnList[i]; ret = fn.call(null, ret); } return ret; }; }
[ "function", "compose", "(", ")", "{", "var", "fnList", "=", "arguments", ";", "return", "function", "composed", "(", "initialArg", ")", "{", "var", "ret", "=", "initialArg", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "fnList", ".", "length...
Compose multiple functions `compose(f, g)` returns `function(x) { return f(g(x)); }` @memberof util @param {Function[]} functions The functions to compose @return {Function}
[ "Compose", "multiple", "functions" ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/compose.js#L27-L37
train
google/marzipano
src/Viewer.js
tweenDone
function tweenDone() { if (self._replacedScene) { self._removeSceneEventListeners(self._replacedScene); oldSceneLayers = self._replacedScene.listLayers(); for (var i = 0; i < oldSceneLayers.length; i++) { self._removeLayerFromStage(oldSceneLayers[i]); } self._replacedScene = nu...
javascript
function tweenDone() { if (self._replacedScene) { self._removeSceneEventListeners(self._replacedScene); oldSceneLayers = self._replacedScene.listLayers(); for (var i = 0; i < oldSceneLayers.length; i++) { self._removeLayerFromStage(oldSceneLayers[i]); } self._replacedScene = nu...
[ "function", "tweenDone", "(", ")", "{", "if", "(", "self", ".", "_replacedScene", ")", "{", "self", ".", "_removeSceneEventListeners", "(", "self", ".", "_replacedScene", ")", ";", "oldSceneLayers", "=", "self", ".", "_replacedScene", ".", "listLayers", "(", ...
Once the transition is complete, remove old scene layers from the stage and remove the event listeners. If the old scene was destroyed during the transition, this has already been taken care of. Otherwise, we still need to get a fresh copy of the scene's layers, since they might have changed during the transition.
[ "Once", "the", "transition", "is", "complete", "remove", "old", "scene", "layers", "from", "the", "stage", "and", "remove", "the", "event", "listeners", ".", "If", "the", "old", "scene", "was", "destroyed", "during", "the", "transition", "this", "has", "alre...
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/Viewer.js#L763-L774
train
google/marzipano
src/geometries/Cube.js
rotateVector
function rotateVector(vec, z, x, y) { if (z) { vec3.rotateZ(vec, vec, origin, z); } if (x) { vec3.rotateX(vec, vec, origin, x); } if (y) { vec3.rotateY(vec, vec, origin, y); } }
javascript
function rotateVector(vec, z, x, y) { if (z) { vec3.rotateZ(vec, vec, origin, z); } if (x) { vec3.rotateX(vec, vec, origin, x); } if (y) { vec3.rotateY(vec, vec, origin, y); } }
[ "function", "rotateVector", "(", "vec", ",", "z", ",", "x", ",", "y", ")", "{", "if", "(", "z", ")", "{", "vec3", ".", "rotateZ", "(", "vec", ",", "vec", ",", "origin", ",", "z", ")", ";", "}", "if", "(", "x", ")", "{", "vec3", ".", "rotate...
Rotate a vector in ZXY order.
[ "Rotate", "a", "vector", "in", "ZXY", "order", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/geometries/Cube.js#L74-L84
train
google/marzipano
demos/sample-tour/index.js
stopTouchAndScrollEventPropagation
function stopTouchAndScrollEventPropagation(element, eventList) { var eventList = [ 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'wheel', 'mousewheel' ]; for (var i = 0; i < eventList.length; i++) { element.addEventListener(eventList[i], function(event) { event.stopP...
javascript
function stopTouchAndScrollEventPropagation(element, eventList) { var eventList = [ 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'wheel', 'mousewheel' ]; for (var i = 0; i < eventList.length; i++) { element.addEventListener(eventList[i], function(event) { event.stopP...
[ "function", "stopTouchAndScrollEventPropagation", "(", "element", ",", "eventList", ")", "{", "var", "eventList", "=", "[", "'touchstart'", ",", "'touchmove'", ",", "'touchend'", ",", "'touchcancel'", ",", "'wheel'", ",", "'mousewheel'", "]", ";", "for", "(", "v...
Prevent touch and scroll events from reaching the parent element.
[ "Prevent", "touch", "and", "scroll", "events", "from", "reaching", "the", "parent", "element", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/sample-tour/index.js#L361-L369
train
google/marzipano
demos/device-orientation/DeviceOrientationControlMethod.js
DeviceOrientationControlMethod
function DeviceOrientationControlMethod() { this._dynamics = { yaw: new Marzipano.Dynamics(), pitch: new Marzipano.Dynamics() }; this._deviceOrientationHandler = this._handleData.bind(this); if (window.DeviceOrientationEvent) { window.addEventListener('deviceorientation', this._deviceOrientationHa...
javascript
function DeviceOrientationControlMethod() { this._dynamics = { yaw: new Marzipano.Dynamics(), pitch: new Marzipano.Dynamics() }; this._deviceOrientationHandler = this._handleData.bind(this); if (window.DeviceOrientationEvent) { window.addEventListener('deviceorientation', this._deviceOrientationHa...
[ "function", "DeviceOrientationControlMethod", "(", ")", "{", "this", ".", "_dynamics", "=", "{", "yaw", ":", "new", "Marzipano", ".", "Dynamics", "(", ")", ",", "pitch", ":", "new", "Marzipano", ".", "Dynamics", "(", ")", "}", ";", "this", ".", "_deviceO...
Custom control method to alter the view according to the device orientation.
[ "Custom", "control", "method", "to", "alter", "the", "view", "according", "to", "the", "device", "orientation", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/device-orientation/DeviceOrientationControlMethod.js#L19-L36
train
google/marzipano
src/support/Css.js
checkCssSupported
function checkCssSupported() { // First, check if the 'perspective' CSS property or a vendor-prefixed // variant is available. var perspectiveProperty = prefixProperty('perspective'); var el = document.createElement('div'); var supported = typeof el.style[perspectiveProperty] !== 'undefined'; // Certain ve...
javascript
function checkCssSupported() { // First, check if the 'perspective' CSS property or a vendor-prefixed // variant is available. var perspectiveProperty = prefixProperty('perspective'); var el = document.createElement('div'); var supported = typeof el.style[perspectiveProperty] !== 'undefined'; // Certain ve...
[ "function", "checkCssSupported", "(", ")", "{", "// First, check if the 'perspective' CSS property or a vendor-prefixed", "// variant is available.", "var", "perspectiveProperty", "=", "prefixProperty", "(", "'perspective'", ")", ";", "var", "el", "=", "document", ".", "creat...
Detect CSS 3D transforms support. Adapted from Modernizr.
[ "Detect", "CSS", "3D", "transforms", "support", ".", "Adapted", "from", "Modernizr", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/support/Css.js#L21-L46
train
google/marzipano
src/colorEffects.js
applyToPixel
function applyToPixel(pixel, effect, result) { vec4TransformMat4Transposed(result, pixel, effect.colorMatrix); vec4.add(result, result, effect.colorOffset); }
javascript
function applyToPixel(pixel, effect, result) { vec4TransformMat4Transposed(result, pixel, effect.colorMatrix); vec4.add(result, result, effect.colorOffset); }
[ "function", "applyToPixel", "(", "pixel", ",", "effect", ",", "result", ")", "{", "vec4TransformMat4Transposed", "(", "result", ",", "pixel", ",", "effect", ".", "colorMatrix", ")", ";", "vec4", ".", "add", "(", "result", ",", "result", ",", "effect", ".",...
Apply color effects to a single pixel @param {vec4} pixel Values in range [0,1] @param {Object} effect @param {vec4} effect.colorOffset @param {mat4} effect.colorMatrix @param {vec4} result Object to store result @memberof colorEffects
[ "Apply", "color", "effects", "to", "a", "single", "pixel" ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/colorEffects.js#L61-L64
train
google/marzipano
src/TextureStore.js
TextureStore
function TextureStore(source, stage, opts) { opts = defaults(opts || {}, defaultOptions); this._source = source; this._stage = stage; // The current state. this._state = State.IDLE; // The number of startFrame calls yet to be matched by endFrame calls during // the current frame. this._delimCount = 0...
javascript
function TextureStore(source, stage, opts) { opts = defaults(opts || {}, defaultOptions); this._source = source; this._stage = stage; // The current state. this._state = State.IDLE; // The number of startFrame calls yet to be matched by endFrame calls during // the current frame. this._delimCount = 0...
[ "function", "TextureStore", "(", "source", ",", "stage", ",", "opts", ")", "{", "opts", "=", "defaults", "(", "opts", "||", "{", "}", ",", "defaultOptions", ")", ";", "this", ".", "_source", "=", "source", ";", "this", ".", "_stage", "=", "stage", ";...
Signals that loading a texture has failed. This event may follow {@link TextureStore#textureStartLoad} if the texture fails to load. @event TextureStore#textureError @param {Tile} tile The tile for which the texture loading has failed. @class TextureStore @classdesc A TextureStore maintains a cache of textures use...
[ "Signals", "that", "loading", "a", "texture", "has", "failed", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/TextureStore.js#L297-L329
train
google/marzipano
src/util/retry.js
retry
function retry(fn) { return function retried() { var args = arguments.length ? Array.prototype.slice.call(arguments, 0, arguments.length - 1) : []; var done = arguments.length ? arguments[arguments.length - 1] : noop; var cfn = null; var canceled = false; function exec() { var err = argu...
javascript
function retry(fn) { return function retried() { var args = arguments.length ? Array.prototype.slice.call(arguments, 0, arguments.length - 1) : []; var done = arguments.length ? arguments[arguments.length - 1] : noop; var cfn = null; var canceled = false; function exec() { var err = argu...
[ "function", "retry", "(", "fn", ")", "{", "return", "function", "retried", "(", ")", "{", "var", "args", "=", "arguments", ".", "length", "?", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ",", "arguments", ".", "l...
Return a cancelable function that executes fn in a loop until it returns successfully.
[ "Return", "a", "cancelable", "function", "that", "executes", "fn", "in", "a", "loop", "until", "it", "returns", "successfully", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/retry.js#L22-L51
train
google/marzipano
demos/fallback-tiles/index.js
ready
function ready() { for (var i = 0; i < preloadTiles.length; i++) { var state = layerAbove.textureStore().query(preloadTiles[i]); if (!state.hasTexture) { return false; } } return true; }
javascript
function ready() { for (var i = 0; i < preloadTiles.length; i++) { var state = layerAbove.textureStore().query(preloadTiles[i]); if (!state.hasTexture) { return false; } } return true; }
[ "function", "ready", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "preloadTiles", ".", "length", ";", "i", "++", ")", "{", "var", "state", "=", "layerAbove", ".", "textureStore", "(", ")", ".", "query", "(", "preloadTiles", "[", ...
Check whether all tiles have loaded.
[ "Check", "whether", "all", "tiles", "have", "loaded", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/fallback-tiles/index.js#L126-L134
train
google/marzipano
src/renderers/WebGlCommon.js
setViewport
function setViewport(gl, layer, rect, viewportMatrix) { if (rect.x === 0 && rect.width === 1 && rect.y === 0 && rect.height === 1) { // Fast path for full rect. gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); mat4.identity(viewportMatrix); return; } var offsetX = rect.x; var c...
javascript
function setViewport(gl, layer, rect, viewportMatrix) { if (rect.x === 0 && rect.width === 1 && rect.y === 0 && rect.height === 1) { // Fast path for full rect. gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); mat4.identity(viewportMatrix); return; } var offsetX = rect.x; var c...
[ "function", "setViewport", "(", "gl", ",", "layer", ",", "rect", ",", "viewportMatrix", ")", "{", "if", "(", "rect", ".", "x", "===", "0", "&&", "rect", ".", "width", "===", "1", "&&", "rect", ".", "y", "===", "0", "&&", "rect", ".", "height", "=...
Sets the WebGL viewport and returns a viewport clamping compensation matrix. Negative viewport origin coordinates cause rendering issues. Letting the viewport dimensions extend beyond the visible area do not seem to cause rendering issues, but they may still have an impact on performance. Therefore, when the scene's r...
[ "Sets", "the", "WebGL", "viewport", "and", "returns", "a", "viewport", "clamping", "compensation", "matrix", ".", "Negative", "viewport", "origin", "coordinates", "cause", "rendering", "issues", ".", "Letting", "the", "viewport", "dimensions", "extend", "beyond", ...
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/renderers/WebGlCommon.js#L177-L219
train
google/marzipano
src/util/chain.js
exec
function exec() { // Extract error from arguments. var err = arguments[0]; // Abort chain on error. if (err) { fn = cfn = null; done.apply(null, arguments); return; } // Terminate if there are no functions left in the chain. if (!fnList.length) { ...
javascript
function exec() { // Extract error from arguments. var err = arguments[0]; // Abort chain on error. if (err) { fn = cfn = null; done.apply(null, arguments); return; } // Terminate if there are no functions left in the chain. if (!fnList.length) { ...
[ "function", "exec", "(", ")", "{", "// Extract error from arguments.", "var", "err", "=", "arguments", "[", "0", "]", ";", "// Abort chain on error.", "if", "(", "err", ")", "{", "fn", "=", "cfn", "=", "null", ";", "done", ".", "apply", "(", "null", ",",...
Execute the next function in the chain. Receives the error and return values from the previous function.
[ "Execute", "the", "next", "function", "in", "the", "chain", ".", "Receives", "the", "error", "and", "return", "values", "from", "the", "previous", "function", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/chain.js#L51-L95
train
google/marzipano
src/util/inherits.js
inherits
function inherits(ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function() {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
javascript
function inherits(ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function() {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
[ "function", "inherits", "(", "ctor", ",", "superCtor", ")", "{", "ctor", ".", "super_", "=", "superCtor", ";", "var", "TempCtor", "=", "function", "(", ")", "{", "}", ";", "TempCtor", ".", "prototype", "=", "superCtor", ".", "prototype", ";", "ctor", "...
Make ctor a subclass of superCtor. Do not depend on ES5 Object.create semantics because of older browsers.
[ "Make", "ctor", "a", "subclass", "of", "superCtor", ".", "Do", "not", "depend", "on", "ES5", "Object", ".", "create", "semantics", "because", "of", "older", "browsers", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/inherits.js#L20-L26
train
google/marzipano
demos/layer-effects/index.js
fileToCanvas
function fileToCanvas(file, done) { var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var img = document.createElement('img'); img.onload = function() { canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; ctx.drawImage(img, 0, 0); done(null, canvas...
javascript
function fileToCanvas(file, done) { var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var img = document.createElement('img'); img.onload = function() { canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; ctx.drawImage(img, 0, 0); done(null, canvas...
[ "function", "fileToCanvas", "(", "file", ",", "done", ")", "{", "var", "canvas", "=", "document", ".", "createElement", "(", "'canvas'", ")", ";", "var", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "var", "img", "=", "document", "."...
Convert an image file into a canvas.
[ "Convert", "an", "image", "file", "into", "a", "canvas", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/layer-effects/index.js#L53-L67
train
google/marzipano
demos/layer-effects/index.js
importLayer
function importLayer(file) { fileToCanvas(file, function(err, canvas) { if (err) { alert('Unable to load image file.'); return; } if (canvas.width > maxSize || canvas.height > maxSize) { alert('Image is too large. The maximum supported size is ' + maxSize + ' by ' + maxSize + ' p...
javascript
function importLayer(file) { fileToCanvas(file, function(err, canvas) { if (err) { alert('Unable to load image file.'); return; } if (canvas.width > maxSize || canvas.height > maxSize) { alert('Image is too large. The maximum supported size is ' + maxSize + ' by ' + maxSize + ' p...
[ "function", "importLayer", "(", "file", ")", "{", "fileToCanvas", "(", "file", ",", "function", "(", "err", ",", "canvas", ")", "{", "if", "(", "err", ")", "{", "alert", "(", "'Unable to load image file.'", ")", ";", "return", ";", "}", "if", "(", "can...
Import a canvas into a layer.
[ "Import", "a", "canvas", "into", "a", "layer", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/layer-effects/index.js#L70-L102
train
google/marzipano
demos/layer-effects/index.js
discardLayer
function discardLayer(item) { if (confirm('Remove this layer?')) { scene.destroyLayer(item.layer); layers.remove(item); } }
javascript
function discardLayer(item) { if (confirm('Remove this layer?')) { scene.destroyLayer(item.layer); layers.remove(item); } }
[ "function", "discardLayer", "(", "item", ")", "{", "if", "(", "confirm", "(", "'Remove this layer?'", ")", ")", "{", "scene", ".", "destroyLayer", "(", "item", ".", "layer", ")", ";", "layers", ".", "remove", "(", "item", ")", ";", "}", "}" ]
Discard an existing layer.
[ "Discard", "an", "existing", "layer", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/layer-effects/index.js#L105-L110
train
google/marzipano
demos/touch-gestures/index.js
disableControlsTemporarily
function disableControlsTemporarily() { viewer.controls().disableMethod('touchView'); viewer.controls().disableMethod('pinch'); setTimeout(function() { viewer.controls().enableMethod('touchView'); viewer.controls().enableMethod('pinch'); }, 200); }
javascript
function disableControlsTemporarily() { viewer.controls().disableMethod('touchView'); viewer.controls().disableMethod('pinch'); setTimeout(function() { viewer.controls().enableMethod('touchView'); viewer.controls().enableMethod('pinch'); }, 200); }
[ "function", "disableControlsTemporarily", "(", ")", "{", "viewer", ".", "controls", "(", ")", ".", "disableMethod", "(", "'touchView'", ")", ";", "viewer", ".", "controls", "(", ")", ".", "disableMethod", "(", "'pinch'", ")", ";", "setTimeout", "(", "functio...
Prevent pan and zoom events from being handled after swipe ends.
[ "Prevent", "pan", "and", "zoom", "events", "from", "being", "handled", "after", "swipe", "ends", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/touch-gestures/index.js#L136-L143
train
google/marzipano
demos/touch-gestures/index.js
zoomOnTap
function zoomOnTap(e) { var coords = viewer.view().screenToCoordinates(e.center); coords.fov = viewer.view().fov() * 0.8; viewer.lookTo(coords, { transitionDuration: 300 }); }
javascript
function zoomOnTap(e) { var coords = viewer.view().screenToCoordinates(e.center); coords.fov = viewer.view().fov() * 0.8; viewer.lookTo(coords, { transitionDuration: 300 }); }
[ "function", "zoomOnTap", "(", "e", ")", "{", "var", "coords", "=", "viewer", ".", "view", "(", ")", ".", "screenToCoordinates", "(", "e", ".", "center", ")", ";", "coords", ".", "fov", "=", "viewer", ".", "view", "(", ")", ".", "fov", "(", ")", "...
Zoom on tap.
[ "Zoom", "on", "tap", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/touch-gestures/index.js#L156-L160
train
google/marzipano
src/views/Flat.js
function(min, max) { return function limitX(params) { params.x = clamp(params.x, min, max); return params; }; }
javascript
function(min, max) { return function limitX(params) { params.x = clamp(params.x, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitX", "(", "params", ")", "{", "params", ".", "x", "=", "clamp", "(", "params", ".", "x", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter that constrains the x parameter. @param {number} min The minimum x value. @param {number} max The maximum y value. @return {FlatViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "x", "parameter", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L702-L707
train
google/marzipano
src/views/Flat.js
function(min, max) { return function limitY(params) { params.y = clamp(params.y, min, max); return params; }; }
javascript
function(min, max) { return function limitY(params) { params.y = clamp(params.y, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitY", "(", "params", ")", "{", "params", ".", "y", "=", "clamp", "(", "params", ".", "y", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Return a view limiter that constrains the y parameter. @param {number} min The minimum y value. @param {number} max The maximum y value. @return {FlatViewLimiter}
[ "Return", "a", "view", "limiter", "that", "constrains", "the", "y", "parameter", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L715-L720
train
google/marzipano
src/views/Flat.js
function(min, max) { return function limitZoom(params) { params.zoom = clamp(params.zoom, min, max); return params; }; }
javascript
function(min, max) { return function limitZoom(params) { params.zoom = clamp(params.zoom, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitZoom", "(", "params", ")", "{", "params", ".", "zoom", "=", "clamp", "(", "params", ".", "zoom", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter than constrains the zoom parameter. @param {number} min The minimum zoom value. @param {number} max The maximum zoom value. @return {FlatViewLimiter}
[ "Returns", "a", "view", "limiter", "than", "constrains", "the", "zoom", "parameter", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L728-L733
train
google/marzipano
src/views/Flat.js
function(min, max) { return function limitVisibleX(params) { // Calculate the zoom value that makes the specified range fully visible. var maxZoom = max - min; // Clamp zoom to the maximum value. if (params.zoom > maxZoom) { params.zoom = maxZoom; } // Bound X such that...
javascript
function(min, max) { return function limitVisibleX(params) { // Calculate the zoom value that makes the specified range fully visible. var maxZoom = max - min; // Clamp zoom to the maximum value. if (params.zoom > maxZoom) { params.zoom = maxZoom; } // Bound X such that...
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitVisibleX", "(", "params", ")", "{", "// Calculate the zoom value that makes the specified range fully visible.", "var", "maxZoom", "=", "max", "-", "min", ";", "// Clamp zoom to the maximum value.",...
Returns a view limiter that constrains the values of the x parameter that are inside the viewport. @param {number} min The minimum x value. @param {number} max The maximum x value. @return {FlatViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "values", "of", "the", "x", "parameter", "that", "are", "inside", "the", "viewport", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L760-L777
train
google/marzipano
src/views/Flat.js
function(min, max) { return function limitVisibleY(params) { // Do nothing for a null viewport. if (params.width <= 0 || params.height <= 0) { return params; } // Calculate the X to Y conversion factor. var viewportAspectRatio = params.width / params.height; var factor ...
javascript
function(min, max) { return function limitVisibleY(params) { // Do nothing for a null viewport. if (params.width <= 0 || params.height <= 0) { return params; } // Calculate the X to Y conversion factor. var viewportAspectRatio = params.width / params.height; var factor ...
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitVisibleY", "(", "params", ")", "{", "// Do nothing for a null viewport.", "if", "(", "params", ".", "width", "<=", "0", "||", "params", ".", "height", "<=", "0", ")", "{", "return", ...
Returns a view limiter that constrains the values of the y parameter that are inside the viewport. @param {number} min The minimum y value. @param {number} max The maximum y value. @return {FlatViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "values", "of", "the", "y", "parameter", "that", "are", "inside", "the", "viewport", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L786-L813
train
google/marzipano
src/views/Flat.js
function() { return function limitLetterbox(params) { if(params.width <= 0 || params.height <= 0) { return params; } var viewportAspectRatio = params.width / params.height; var fullWidthZoom = 1.0; var fullHeightZoom = viewportAspectRatio / params.mediaAspectRatio; // I...
javascript
function() { return function limitLetterbox(params) { if(params.width <= 0 || params.height <= 0) { return params; } var viewportAspectRatio = params.width / params.height; var fullWidthZoom = 1.0; var fullHeightZoom = viewportAspectRatio / params.mediaAspectRatio; // I...
[ "function", "(", ")", "{", "return", "function", "limitLetterbox", "(", "params", ")", "{", "if", "(", "params", ".", "width", "<=", "0", "||", "params", ".", "height", "<=", "0", ")", "{", "return", "params", ";", "}", "var", "viewportAspectRatio", "=...
Returns a view limiter that constrains the zoom parameter such that zooming out is prevented beyond the point at which the image is fully visible. Unless the image and the viewport have the same aspect ratio, this will cause bands to appear around the image. @return {FlatViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "zoom", "parameter", "such", "that", "zooming", "out", "is", "prevented", "beyond", "the", "point", "at", "which", "the", "image", "is", "fully", "visible", ".", "Unless", "the", "image", "and",...
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Flat.js#L823-L871
train
google/marzipano
src/util/async.js
async
function async(fn) { return function asynced(done) { var err, ret; try { ret = fn(); } catch (e) { err = e; } finally { if (err) { done(err); } else { done(null, ret); } } }; }
javascript
function async(fn) { return function asynced(done) { var err, ret; try { ret = fn(); } catch (e) { err = e; } finally { if (err) { done(err); } else { done(null, ret); } } }; }
[ "function", "async", "(", "fn", ")", "{", "return", "function", "asynced", "(", "done", ")", "{", "var", "err", ",", "ret", ";", "try", "{", "ret", "=", "fn", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "err", "=", "e", ";", "}", "finall...
Transform a synchronous function into an asynchronous one.
[ "Transform", "a", "synchronous", "function", "into", "an", "asynchronous", "one", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/async.js#L19-L34
train
google/marzipano
demos/video/VideoAsset.js
VideoAsset
function VideoAsset(videoElement) { this._videoElement = null; this._destroyed = false; this._emitChange = this.emit.bind(this, 'change'); this._lastTimestamp = -1; this._emptyCanvas = document.createElement('canvas'); this._emptyCanvas.width = 1; this._emptyCanvas.height = 1; this.setVideo(videoEleme...
javascript
function VideoAsset(videoElement) { this._videoElement = null; this._destroyed = false; this._emitChange = this.emit.bind(this, 'change'); this._lastTimestamp = -1; this._emptyCanvas = document.createElement('canvas'); this._emptyCanvas.width = 1; this._emptyCanvas.height = 1; this.setVideo(videoEleme...
[ "function", "VideoAsset", "(", "videoElement", ")", "{", "this", ".", "_videoElement", "=", "null", ";", "this", ".", "_destroyed", "=", "false", ";", "this", ".", "_emitChange", "=", "this", ".", "emit", ".", "bind", "(", "this", ",", "'change'", ")", ...
Dynamic asset containing a video element. Note that this won't work on IE 11 because of lack of support for video textures. Refer to the video-multi-res demo for a possible workaround.
[ "Dynamic", "asset", "containing", "a", "video", "element", ".", "Note", "that", "this", "won", "t", "work", "on", "IE", "11", "because", "of", "lack", "of", "support", "for", "video", "textures", ".", "Refer", "to", "the", "video", "-", "multi", "-", "...
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/video/VideoAsset.js#L21-L32
train
google/marzipano
src/views/Rectilinear.js
function(min, max) { return function limitYaw(params) { params.yaw = clamp(params.yaw, min, max); return params; }; }
javascript
function(min, max) { return function limitYaw(params) { params.yaw = clamp(params.yaw, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitYaw", "(", "params", ")", "{", "params", ".", "yaw", "=", "clamp", "(", "params", ".", "yaw", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter that constrains the yaw angle. @param {number} min The minimum yaw value. @param {number} max The maximum yaw value. @return {RectilinearViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "yaw", "angle", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Rectilinear.js#L883-L888
train
google/marzipano
src/views/Rectilinear.js
function(min, max) { return function limitPitch(params) { params.pitch = clamp(params.pitch, min, max); return params; }; }
javascript
function(min, max) { return function limitPitch(params) { params.pitch = clamp(params.pitch, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitPitch", "(", "params", ")", "{", "params", ".", "pitch", "=", "clamp", "(", "params", ".", "pitch", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter that constrains the pitch angle. @param {number} min The minimum pitch value. @param {number} max The maximum pitch value. @return {RectilinearViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "pitch", "angle", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Rectilinear.js#L896-L901
train
google/marzipano
src/views/Rectilinear.js
function(min, max) { return function limitRoll(params) { params.roll = clamp(params.roll, min, max); return params; }; }
javascript
function(min, max) { return function limitRoll(params) { params.roll = clamp(params.roll, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitRoll", "(", "params", ")", "{", "params", ".", "roll", "=", "clamp", "(", "params", ".", "roll", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter that constrains the roll angle. @param {number} min The minimum roll value. @param {number} max The maximum roll value. @return {RectilinearViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "roll", "angle", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Rectilinear.js#L909-L914
train
google/marzipano
src/views/Rectilinear.js
function(min, max) { return function limitHfov(params) { var width = params.width; var height = params.height; if (width > 0 && height > 0) { var vmin = convertFov.htov(min, width, height); var vmax = convertFov.htov(max, width, height); params.fov = clamp(params.fov, vmin,...
javascript
function(min, max) { return function limitHfov(params) { var width = params.width; var height = params.height; if (width > 0 && height > 0) { var vmin = convertFov.htov(min, width, height); var vmax = convertFov.htov(max, width, height); params.fov = clamp(params.fov, vmin,...
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitHfov", "(", "params", ")", "{", "var", "width", "=", "params", ".", "width", ";", "var", "height", "=", "params", ".", "height", ";", "if", "(", "width", ">", "0", "&&", "hei...
Returns a view limiter that constrains the horizontal field of view. @param {number} min The minimum horizontal field of view. @param {number} max The maximum horizontal field of view. @return {RectilinearViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "horizontal", "field", "of", "view", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Rectilinear.js#L922-L933
train
google/marzipano
src/views/Rectilinear.js
function(min, max) { return function limitVfov(params) { params.fov = clamp(params.fov, min, max); return params; }; }
javascript
function(min, max) { return function limitVfov(params) { params.fov = clamp(params.fov, min, max); return params; }; }
[ "function", "(", "min", ",", "max", ")", "{", "return", "function", "limitVfov", "(", "params", ")", "{", "params", ".", "fov", "=", "clamp", "(", "params", ".", "fov", ",", "min", ",", "max", ")", ";", "return", "params", ";", "}", ";", "}" ]
Returns a view limiter that constrains the vertical field of view. @param {number} min The minimum vertical field of view. @param {number} max The maximum vertical field of view. @return {RectilinearViewLimiter}
[ "Returns", "a", "view", "limiter", "that", "constrains", "the", "vertical", "field", "of", "view", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/views/Rectilinear.js#L941-L946
train
google/marzipano
src/support/cssPointerEvents.js
checkCssPointerEventsSupported
function checkCssPointerEventsSupported() { // Check for existence of CSS property. var style = document.createElement('a').style; style.cssText = 'pointer-events:auto'; var hasCssProperty = style.pointerEvents === 'auto'; // The above result is spurious on emulation mode for IE 8-10. var isOldIE = browse...
javascript
function checkCssPointerEventsSupported() { // Check for existence of CSS property. var style = document.createElement('a').style; style.cssText = 'pointer-events:auto'; var hasCssProperty = style.pointerEvents === 'auto'; // The above result is spurious on emulation mode for IE 8-10. var isOldIE = browse...
[ "function", "checkCssPointerEventsSupported", "(", ")", "{", "// Check for existence of CSS property.", "var", "style", "=", "document", ".", "createElement", "(", "'a'", ")", ".", "style", ";", "style", ".", "cssText", "=", "'pointer-events:auto'", ";", "var", "has...
Detect CSS pointer-events support.
[ "Detect", "CSS", "pointer", "-", "events", "support", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/support/cssPointerEvents.js#L21-L32
train
google/marzipano
demos/video-multi-res/loadVideoInSync.js
loadVideoInSync
function loadVideoInSync(url, syncElement, cb) { cb = once(cb); var element = document.createElement('video'); element.crossOrigin = 'anonymous'; element.autoplay = true; element.loop = true; // Prevent the video from going full screen on iOS. element.playsInline = true; element.webkitPlaysInline = tr...
javascript
function loadVideoInSync(url, syncElement, cb) { cb = once(cb); var element = document.createElement('video'); element.crossOrigin = 'anonymous'; element.autoplay = true; element.loop = true; // Prevent the video from going full screen on iOS. element.playsInline = true; element.webkitPlaysInline = tr...
[ "function", "loadVideoInSync", "(", "url", ",", "syncElement", ",", "cb", ")", "{", "cb", "=", "once", "(", "cb", ")", ";", "var", "element", "=", "document", ".", "createElement", "(", "'video'", ")", ";", "element", ".", "crossOrigin", "=", "'anonymous...
Attempts to load a video element in sync with another video element
[ "Attempts", "to", "load", "a", "video", "element", "in", "sync", "with", "another", "video", "element" ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/video-multi-res/loadVideoInSync.js#L19-L82
train
google/marzipano
src/Layer.js
Layer
function Layer(source, geometry, view, textureStore, opts) { opts = opts || {}; var self = this; this._source = source; this._geometry = geometry; this._view = view; this._textureStore = textureStore; this._effects = opts.effects || {}; this._fixedLevelIndex = null; this._viewChangeHandler = func...
javascript
function Layer(source, geometry, view, textureStore, opts) { opts = opts || {}; var self = this; this._source = source; this._geometry = geometry; this._view = view; this._textureStore = textureStore; this._effects = opts.effects || {}; this._fixedLevelIndex = null; this._viewChangeHandler = func...
[ "function", "Layer", "(", "source", ",", "geometry", ",", "view", ",", "textureStore", ",", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "var", "self", "=", "this", ";", "this", ".", "_source", "=", "source", ";", "this", ".", "_geom...
Signals that the layer has been rendered. @param {boolean} stable Whether all tiles were successfully rendered without missing textures or resorting to fallbacks. @event Layer#renderComplete @class Layer @classdesc A Layer is a combination of {@link Source}, {@link Geometry}, {@link View} and {@link TextureStore} t...
[ "Signals", "that", "the", "layer", "has", "been", "rendered", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/Layer.js#L46-L76
train
google/marzipano
src/stages/Stage.js
Stage
function Stage(opts) { this._progressive = !!(opts && opts.progressive); // The list of layers in display order (background to foreground). this._layers = []; // The list of renderers; the i-th renderer is for the i-th layer. this._renderers = []; // The lists of tiles to load and render, populated durin...
javascript
function Stage(opts) { this._progressive = !!(opts && opts.progressive); // The list of layers in display order (background to foreground). this._layers = []; // The list of renderers; the i-th renderer is for the i-th layer. this._renderers = []; // The lists of tiles to load and render, populated durin...
[ "function", "Stage", "(", "opts", ")", "{", "this", ".", "_progressive", "=", "!", "!", "(", "opts", "&&", "opts", ".", "progressive", ")", ";", "// The list of layers in display order (background to foreground).", "this", ".", "_layers", "=", "[", "]", ";", "...
Signals that the contents of the stage have been invalidated and must be rendered again. This is used by the {@link RenderLoop} implementation. @event Stage#renderInvalid @interface Stage @classdesc A Stage is a container with the ability to render a stack of {@link Layer layers}. This is a superclass containing ...
[ "Signals", "that", "the", "contents", "of", "the", "stage", "have", "been", "invalidated", "and", "must", "be", "rendered", "again", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/stages/Stage.js#L74-L111
train
google/marzipano
demos/transitions/index.js
nextScene
function nextScene() { switch (currentScene) { case scene1: return (currentScene = scene2); case scene2: return (currentScene = scene1); default: return (currentScene = scene1); } }
javascript
function nextScene() { switch (currentScene) { case scene1: return (currentScene = scene2); case scene2: return (currentScene = scene1); default: return (currentScene = scene1); } }
[ "function", "nextScene", "(", ")", "{", "switch", "(", "currentScene", ")", "{", "case", "scene1", ":", "return", "(", "currentScene", "=", "scene2", ")", ";", "case", "scene2", ":", "return", "(", "currentScene", "=", "scene1", ")", ";", "default", ":",...
Return the next scene to be displayed.
[ "Return", "the", "next", "scene", "to", "be", "displayed", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/transitions/index.js#L65-L71
train
google/marzipano
demos/video/index.js
tryStart
function tryStart() { if (started) { return; } started = true; var video = document.createElement('video'); video.src = '//www.marzipano.net/media/video/mercedes-f1-1280x640.mp4'; video.crossOrigin = 'anonymous'; video.autoplay = true; video.loop = true; // Prevent the video from going full scr...
javascript
function tryStart() { if (started) { return; } started = true; var video = document.createElement('video'); video.src = '//www.marzipano.net/media/video/mercedes-f1-1280x640.mp4'; video.crossOrigin = 'anonymous'; video.autoplay = true; video.loop = true; // Prevent the video from going full scr...
[ "function", "tryStart", "(", ")", "{", "if", "(", "started", ")", "{", "return", ";", "}", "started", "=", "true", ";", "var", "video", "=", "document", ".", "createElement", "(", "'video'", ")", ";", "video", ".", "src", "=", "'//www.marzipano.net/media...
Try to start playback.
[ "Try", "to", "start", "playback", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/video/index.js#L59-L83
train
google/marzipano
demos/video/index.js
waitForReadyState
function waitForReadyState(element, readyState, interval, done) { var timer = setInterval(function() { if (element.readyState >= readyState) { clearInterval(timer); done(null, true); } }, interval); }
javascript
function waitForReadyState(element, readyState, interval, done) { var timer = setInterval(function() { if (element.readyState >= readyState) { clearInterval(timer); done(null, true); } }, interval); }
[ "function", "waitForReadyState", "(", "element", ",", "readyState", ",", "interval", ",", "done", ")", "{", "var", "timer", "=", "setInterval", "(", "function", "(", ")", "{", "if", "(", "element", ".", "readyState", ">=", "readyState", ")", "{", "clearInt...
Wait for an element to reach the given readyState by polling. The HTML5 video element exposes a `readystatechange` event that could be listened for instead, but it seems to be unreliable on some browsers.
[ "Wait", "for", "an", "element", "to", "reach", "the", "given", "readyState", "by", "polling", ".", "The", "HTML5", "video", "element", "exposes", "a", "readystatechange", "event", "that", "could", "be", "listened", "for", "instead", "but", "it", "seems", "to...
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/demos/video/index.js#L88-L95
train
google/marzipano
src/util/clearOwnProperties.js
clearOwnProperties
function clearOwnProperties(obj) { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { obj[prop] = undefined; } } }
javascript
function clearOwnProperties(obj) { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { obj[prop] = undefined; } } }
[ "function", "clearOwnProperties", "(", "obj", ")", "{", "for", "(", "var", "prop", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "obj", "[", "prop", "]", "=", "undefined", ";", "}", "}", "}" ]
Sets an object's own properties to undefined. This may be called by destructors to avoid retaining references and help detect incorrect use of destroyed instances.
[ "Sets", "an", "object", "s", "own", "properties", "to", "undefined", ".", "This", "may", "be", "called", "by", "destructors", "to", "avoid", "retaining", "references", "and", "help", "detect", "incorrect", "use", "of", "destroyed", "instances", "." ]
e3e21b2c1992708992dfeab5970b0f5a3f8f98e0
https://github.com/google/marzipano/blob/e3e21b2c1992708992dfeab5970b0f5a3f8f98e0/src/util/clearOwnProperties.js#L21-L27
train
haraka/Haraka
plugins/data.uribl.js
do_replyto_header
function do_replyto_header (cb) { const replyto = trans.header.get('reply-to'); const rmatch = email_re.exec(replyto); if (rmatch) { return plugin.do_lookups(connection, cb, rmatch[1], 'replyto'); } cb(); }
javascript
function do_replyto_header (cb) { const replyto = trans.header.get('reply-to'); const rmatch = email_re.exec(replyto); if (rmatch) { return plugin.do_lookups(connection, cb, rmatch[1], 'replyto'); } cb(); }
[ "function", "do_replyto_header", "(", "cb", ")", "{", "const", "replyto", "=", "trans", ".", "header", ".", "get", "(", "'reply-to'", ")", ";", "const", "rmatch", "=", "email_re", ".", "exec", "(", "replyto", ")", ";", "if", "(", "rmatch", ")", "{", ...
Reply-To header
[ "Reply", "-", "To", "header" ]
4aea44d56834a1a4be78c56b646a6c266aa7d7b5
https://github.com/haraka/Haraka/blob/4aea44d56834a1a4be78c56b646a6c266aa7d7b5/plugins/data.uribl.js#L332-L339
train
haraka/Haraka
plugins/data.uribl.js
do_msgid_header
function do_msgid_header (cb) { const msgid = trans.header.get('message-id'); const mmatch = /@([^>]+)>/.exec(msgid); if (mmatch) { return plugin.do_lookups(connection, cb, mmatch[1], 'msgid'); } cb(); }
javascript
function do_msgid_header (cb) { const msgid = trans.header.get('message-id'); const mmatch = /@([^>]+)>/.exec(msgid); if (mmatch) { return plugin.do_lookups(connection, cb, mmatch[1], 'msgid'); } cb(); }
[ "function", "do_msgid_header", "(", "cb", ")", "{", "const", "msgid", "=", "trans", ".", "header", ".", "get", "(", "'message-id'", ")", ";", "const", "mmatch", "=", "/", "@([^>]+)>", "/", ".", "exec", "(", "msgid", ")", ";", "if", "(", "mmatch", ")"...
Message-Id header
[ "Message", "-", "Id", "header" ]
4aea44d56834a1a4be78c56b646a6c266aa7d7b5
https://github.com/haraka/Haraka/blob/4aea44d56834a1a4be78c56b646a6c266aa7d7b5/plugins/data.uribl.js#L342-L349
train
haraka/Haraka
outbound/client_pool.js
get_pool
function get_pool (port, host, local_addr, is_unix_socket, max) { port = port || 25; host = host || 'localhost'; const name = `outbound::${port}:${host}:${local_addr}:${cfg.pool_timeout}`; if (!server.notes.pool) server.notes.pool = {}; if (server.notes.pool[name]) return server.notes.pool[name]; ...
javascript
function get_pool (port, host, local_addr, is_unix_socket, max) { port = port || 25; host = host || 'localhost'; const name = `outbound::${port}:${host}:${local_addr}:${cfg.pool_timeout}`; if (!server.notes.pool) server.notes.pool = {}; if (server.notes.pool[name]) return server.notes.pool[name]; ...
[ "function", "get_pool", "(", "port", ",", "host", ",", "local_addr", ",", "is_unix_socket", ",", "max", ")", "{", "port", "=", "port", "||", "25", ";", "host", "=", "host", "||", "'localhost'", ";", "const", "name", "=", "`", "${", "port", "}", "${",...
Separate pools are kept for each set of server attributes.
[ "Separate", "pools", "are", "kept", "for", "each", "set", "of", "server", "attributes", "." ]
4aea44d56834a1a4be78c56b646a6c266aa7d7b5
https://github.com/haraka/Haraka/blob/4aea44d56834a1a4be78c56b646a6c266aa7d7b5/outbound/client_pool.js#L47-L92
train
haraka/Haraka
outbound/hmail.js
sort_mx
function sort_mx (mx_list) { const sorted = mx_list.sort((a,b) => a.priority - b.priority); // This isn't a very good shuffle but it'll do for now. for (let i=0,l=sorted.length-1; i<l; i++) { if (sorted[i].priority === sorted[i+1].priority) { if (Math.round(Math.random())) { // 0 or 1 ...
javascript
function sort_mx (mx_list) { const sorted = mx_list.sort((a,b) => a.priority - b.priority); // This isn't a very good shuffle but it'll do for now. for (let i=0,l=sorted.length-1; i<l; i++) { if (sorted[i].priority === sorted[i+1].priority) { if (Math.round(Math.random())) { // 0 or 1 ...
[ "function", "sort_mx", "(", "mx_list", ")", "{", "const", "sorted", "=", "mx_list", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "priority", "-", "b", ".", "priority", ")", ";", "// This isn't a very good shuffle but it'll do for now.", "for", ...
MXs must be sorted by priority order, but matched priorities must be randomly shuffled in that list, so this is a bit complex.
[ "MXs", "must", "be", "sorted", "by", "priority", "order", "but", "matched", "priorities", "must", "be", "randomly", "shuffled", "in", "that", "list", "so", "this", "is", "a", "bit", "complex", "." ]
4aea44d56834a1a4be78c56b646a6c266aa7d7b5
https://github.com/haraka/Haraka/blob/4aea44d56834a1a4be78c56b646a6c266aa7d7b5/outbound/hmail.js#L1458-L1472
train
haraka/Haraka
server.js
setupListener
function setupListener (host_port, listenerDone) { const hp = /^\[?([^\]]+)\]?:(\d+)$/.exec(host_port); if (!hp) return listenerDone( new Error('Invalid "listen" format in smtp.ini')); const host = hp[1]; const port = parseInt(hp[2], 10); Se...
javascript
function setupListener (host_port, listenerDone) { const hp = /^\[?([^\]]+)\]?:(\d+)$/.exec(host_port); if (!hp) return listenerDone( new Error('Invalid "listen" format in smtp.ini')); const host = hp[1]; const port = parseInt(hp[2], 10); Se...
[ "function", "setupListener", "(", "host_port", ",", "listenerDone", ")", "{", "const", "hp", "=", "/", "^\\[?([^\\]]+)\\]?:(\\d+)$", "/", ".", "exec", "(", "host_port", ")", ";", "if", "(", "!", "hp", ")", "return", "listenerDone", "(", "new", "Error", "("...
array of listeners
[ "array", "of", "listeners" ]
4aea44d56834a1a4be78c56b646a6c266aa7d7b5
https://github.com/haraka/Haraka/blob/4aea44d56834a1a4be78c56b646a6c266aa7d7b5/server.js#L388-L425
train
aspnet/SignalR
clients/cpp/samples/SignalRServer/Scripts/jquery.signalR-2.2.0.js
map
function map(arr, fun, thisp) { var i, length = arr.length, result = []; for (i = 0; i < length; i += 1) { if (arr.hasOwnProperty(i)) { result[i] = fun.call(thisp, arr[i], i, arr); } } return result; }
javascript
function map(arr, fun, thisp) { var i, length = arr.length, result = []; for (i = 0; i < length; i += 1) { if (arr.hasOwnProperty(i)) { result[i] = fun.call(thisp, arr[i], i, arr); } } return result; }
[ "function", "map", "(", "arr", ",", "fun", ",", "thisp", ")", "{", "var", "i", ",", "length", "=", "arr", ".", "length", ",", "result", "=", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "length", ";", "i", "+=", "1", ")", "{", ...
Equivalent to Array.prototype.map
[ "Equivalent", "to", "Array", ".", "prototype", ".", "map" ]
8c6ed160d84f58ce8edf06a1c74221ddc8983ee9
https://github.com/aspnet/SignalR/blob/8c6ed160d84f58ce8edf06a1c74221ddc8983ee9/clients/cpp/samples/SignalRServer/Scripts/jquery.signalR-2.2.0.js#L2518-L2528
train
eKoopmans/html2pdf.js
dist/html2pdf.js
unitConvert
function unitConvert(obj, k) { if (objType(obj) === 'number') { return obj * 72 / 96 / k; } else { var newObj = {}; for (var key in obj) { newObj[key] = obj[key] * 72 / 96 / k; } return newObj; } }
javascript
function unitConvert(obj, k) { if (objType(obj) === 'number') { return obj * 72 / 96 / k; } else { var newObj = {}; for (var key in obj) { newObj[key] = obj[key] * 72 / 96 / k; } return newObj; } }
[ "function", "unitConvert", "(", "obj", ",", "k", ")", "{", "if", "(", "objType", "(", "obj", ")", "===", "'number'", ")", "{", "return", "obj", "*", "72", "/", "96", "/", "k", ";", "}", "else", "{", "var", "newObj", "=", "{", "}", ";", "for", ...
Convert units from px using the conversion value 'k' from jsPDF.
[ "Convert", "units", "from", "px", "using", "the", "conversion", "value", "k", "from", "jsPDF", "." ]
9bbe4b35b76896a78a428a62af553c633040ad90
https://github.com/eKoopmans/html2pdf.js/blob/9bbe4b35b76896a78a428a62af553c633040ad90/dist/html2pdf.js#L110-L120
train
eKoopmans/html2pdf.js
dist/html2pdf.js
html2pdf
function html2pdf(src, opt) { // Create a new worker with the given options. var worker = new html2pdf.Worker(opt); if (src) { // If src is specified, perform the traditional 'simple' operation. return worker.from(src).save(); } else { // Otherwise, return the worker for new Promise-based operation...
javascript
function html2pdf(src, opt) { // Create a new worker with the given options. var worker = new html2pdf.Worker(opt); if (src) { // If src is specified, perform the traditional 'simple' operation. return worker.from(src).save(); } else { // Otherwise, return the worker for new Promise-based operation...
[ "function", "html2pdf", "(", "src", ",", "opt", ")", "{", "// Create a new worker with the given options.", "var", "worker", "=", "new", "html2pdf", ".", "Worker", "(", "opt", ")", ";", "if", "(", "src", ")", "{", "// If src is specified, perform the traditional 'si...
Generate a PDF from an HTML element or string using html2canvas and jsPDF. @param {Element|string} source The source element or HTML string. @param {Object=} opt An object of optional settings: 'margin', 'filename', 'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are sent as settings to their corres...
[ "Generate", "a", "PDF", "from", "an", "HTML", "element", "or", "string", "using", "html2canvas", "and", "jsPDF", "." ]
9bbe4b35b76896a78a428a62af553c633040ad90
https://github.com/eKoopmans/html2pdf.js/blob/9bbe4b35b76896a78a428a62af553c633040ad90/dist/html2pdf.js#L906-L917
train
eKoopmans/html2pdf.js
gulpfile.js
mergeBranch
function mergeBranch(branch) { var mergeCmd = 'git merge --no-ff --no-edit ' + branch; console.log('Merging release into master.') return exec('git checkout master && ' + mergeCmd).then(function() { console.log('Merging release into develop.') return exec('git checkout develop && ' + mergeCmd); }); }
javascript
function mergeBranch(branch) { var mergeCmd = 'git merge --no-ff --no-edit ' + branch; console.log('Merging release into master.') return exec('git checkout master && ' + mergeCmd).then(function() { console.log('Merging release into develop.') return exec('git checkout develop && ' + mergeCmd); }); }
[ "function", "mergeBranch", "(", "branch", ")", "{", "var", "mergeCmd", "=", "'git merge --no-ff --no-edit '", "+", "branch", ";", "console", ".", "log", "(", "'Merging release into master.'", ")", "return", "exec", "(", "'git checkout master && '", "+", "mergeCmd", ...
Merge the specified branch back into master and develop.
[ "Merge", "the", "specified", "branch", "back", "into", "master", "and", "develop", "." ]
9bbe4b35b76896a78a428a62af553c633040ad90
https://github.com/eKoopmans/html2pdf.js/blob/9bbe4b35b76896a78a428a62af553c633040ad90/gulpfile.js#L28-L36
train
davidmerfield/randomColor
randomColor.js
getRealHueRange
function getRealHueRange(colorHue) { if (!isNaN(colorHue)) { var number = parseInt(colorHue); if (number < 360 && number > 0) { return getColorInfo(colorHue).hueRange } } else if (typeof colorHue === 'string') { if (colorDictionary[colorHue]) { var color = colorDictionary[color...
javascript
function getRealHueRange(colorHue) { if (!isNaN(colorHue)) { var number = parseInt(colorHue); if (number < 360 && number > 0) { return getColorInfo(colorHue).hueRange } } else if (typeof colorHue === 'string') { if (colorDictionary[colorHue]) { var color = colorDictionary[color...
[ "function", "getRealHueRange", "(", "colorHue", ")", "{", "if", "(", "!", "isNaN", "(", "colorHue", ")", ")", "{", "var", "number", "=", "parseInt", "(", "colorHue", ")", ";", "if", "(", "number", "<", "360", "&&", "number", ">", "0", ")", "{", "re...
get The range of given hue when options.count!=0
[ "get", "The", "range", "of", "given", "hue", "when", "options", ".", "count!", "=", "0" ]
5e0cdb4d84a214ccc10e4ad3c2308ed09549bede
https://github.com/davidmerfield/randomColor/blob/5e0cdb4d84a214ccc10e4ad3c2308ed09549bede/randomColor.js#L494-L517
train
abouolia/sticky-sidebar
src/jquery.sticky-sidebar.js
_jQueryPlugin
function _jQueryPlugin(config){ return this.each(function(){ var $this = plugin(this), data = plugin(this).data(DATA_NAMESPACE); if( ! data ){ data = new StickySidebar(this, typeof config == 'object' && config); $this.data(DATA_NAMESPACE, data); } ...
javascript
function _jQueryPlugin(config){ return this.each(function(){ var $this = plugin(this), data = plugin(this).data(DATA_NAMESPACE); if( ! data ){ data = new StickySidebar(this, typeof config == 'object' && config); $this.data(DATA_NAMESPACE, data); } ...
[ "function", "_jQueryPlugin", "(", "config", ")", "{", "return", "this", ".", "each", "(", "function", "(", ")", "{", "var", "$this", "=", "plugin", "(", "this", ")", ",", "data", "=", "plugin", "(", "this", ")", ".", "data", "(", "DATA_NAMESPACE", ")...
Sticky Sidebar Plugin Defintion. @param {Object|String} - config
[ "Sticky", "Sidebar", "Plugin", "Defintion", "." ]
bcd40bbf95e84b75916bc3535d7475447f9383f8
https://github.com/abouolia/sticky-sidebar/blob/bcd40bbf95e84b75916bc3535d7475447f9383f8/src/jquery.sticky-sidebar.js#L15-L32
train
pissang/claygl
src/util/sh.js
projectEnvironmentMapGPU
function projectEnvironmentMapGPU(renderer, envMap) { var shTexture = new Texture2D({ width: 9, height: 1, type: Texture.FLOAT }); var pass = new Pass({ fragment: projectEnvMapShaderCode }); pass.material.define('fragment', 'TEXTURE_SIZE', envMap.width); pass.setU...
javascript
function projectEnvironmentMapGPU(renderer, envMap) { var shTexture = new Texture2D({ width: 9, height: 1, type: Texture.FLOAT }); var pass = new Pass({ fragment: projectEnvMapShaderCode }); pass.material.define('fragment', 'TEXTURE_SIZE', envMap.width); pass.setU...
[ "function", "projectEnvironmentMapGPU", "(", "renderer", ",", "envMap", ")", "{", "var", "shTexture", "=", "new", "Texture2D", "(", "{", "width", ":", "9", ",", "height", ":", "1", ",", "type", ":", "Texture", ".", "FLOAT", "}", ")", ";", "var", "pass"...
Project on gpu, but needs browser to support readPixels as Float32Array.
[ "Project", "on", "gpu", "but", "needs", "browser", "to", "support", "readPixels", "as", "Float32Array", "." ]
b157bb50cf8c725fa20f90ebb55481352777f0a7
https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/src/util/sh.js#L19-L51
train
pissang/claygl
src/util/sh.js
projectEnvironmentMapCPU
function projectEnvironmentMapCPU(renderer, cubePixels, width, height) { var coeff = new vendor.Float32Array(9 * 3); var normal = vec3.create(); var texel = vec3.create(); var fetchNormal = vec3.create(); for (var m = 0; m < 9; m++) { var result = vec3.create(); for (var k = 0; k < t...
javascript
function projectEnvironmentMapCPU(renderer, cubePixels, width, height) { var coeff = new vendor.Float32Array(9 * 3); var normal = vec3.create(); var texel = vec3.create(); var fetchNormal = vec3.create(); for (var m = 0; m < 9; m++) { var result = vec3.create(); for (var k = 0; k < t...
[ "function", "projectEnvironmentMapCPU", "(", "renderer", ",", "cubePixels", ",", "width", ",", "height", ")", "{", "var", "coeff", "=", "new", "vendor", ".", "Float32Array", "(", "9", "*", "3", ")", ";", "var", "normal", "=", "vec3", ".", "create", "(", ...
Project on cpu.
[ "Project", "on", "cpu", "." ]
b157bb50cf8c725fa20f90ebb55481352777f0a7
https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/src/util/sh.js#L97-L146
train
pissang/claygl
src/GeometryBase.js
function () { var enabledAttributes = this.getEnabledAttributes(); for (var i = 0; i < enabledAttributes.length; i++) { this.dirtyAttribute(enabledAttributes[i]); } this.dirtyIndices(); this._enabledAttributes = null; this._cache.dirty('any'); }
javascript
function () { var enabledAttributes = this.getEnabledAttributes(); for (var i = 0; i < enabledAttributes.length; i++) { this.dirtyAttribute(enabledAttributes[i]); } this.dirtyIndices(); this._enabledAttributes = null; this._cache.dirty('any'); }
[ "function", "(", ")", "{", "var", "enabledAttributes", "=", "this", ".", "getEnabledAttributes", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "enabledAttributes", ".", "length", ";", "i", "++", ")", "{", "this", ".", "dirtyAttribute"...
Mark attributes and indices in geometry needs to update. Usually called after you change the data in attributes.
[ "Mark", "attributes", "and", "indices", "in", "geometry", "needs", "to", "update", ".", "Usually", "called", "after", "you", "change", "the", "data", "in", "attributes", "." ]
b157bb50cf8c725fa20f90ebb55481352777f0a7
https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/src/GeometryBase.js#L327-L336
train