id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6,700 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function( contentItem, index, _$suspendResize ) {
var newItemSize, itemSize, i, splitterElement;
contentItem = this.layoutManager._$normalizeContentItem( contentItem, this );
if( index === undefined ) {
index = this.contentItems.length;
}
if( this.contentItems.length > 0 ) {
splitterElement = this._... | javascript | function( contentItem, index, _$suspendResize ) {
var newItemSize, itemSize, i, splitterElement;
contentItem = this.layoutManager._$normalizeContentItem( contentItem, this );
if( index === undefined ) {
index = this.contentItems.length;
}
if( this.contentItems.length > 0 ) {
splitterElement = this._... | [
"function",
"(",
"contentItem",
",",
"index",
",",
"_$suspendResize",
")",
"{",
"var",
"newItemSize",
",",
"itemSize",
",",
"i",
",",
"splitterElement",
";",
"contentItem",
"=",
"this",
".",
"layoutManager",
".",
"_$normalizeContentItem",
"(",
"contentItem",
","... | Add a new contentItem to the Row or Column
@param {lm.item.AbstractContentItem} contentItem
@param {[int]} index The position of the new item within the Row or Column.
If no index is provided the item will be added to the end
@param {[bool]} _$suspendResize If true the items won't be resized. This will leave the item ... | [
"Add",
"a",
"new",
"contentItem",
"to",
"the",
"Row",
"or",
"Column"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L35-L84 | |
6,701 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function() {
if( this.isInitialised === true ) return;
var i;
lm.items.AbstractContentItem.prototype._$init.call( this );
for( i = 0; i < this.contentItems.length - 1; i++ ) {
this.contentItems[ i ].element.after( this._createSplitter( i ).element );
}
for( i = 0; i < this.contentItems.length; i++ ) {... | javascript | function() {
if( this.isInitialised === true ) return;
var i;
lm.items.AbstractContentItem.prototype._$init.call( this );
for( i = 0; i < this.contentItems.length - 1; i++ ) {
this.contentItems[ i ].element.after( this._createSplitter( i ).element );
}
for( i = 0; i < this.contentItems.length; i++ ) {... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isInitialised",
"===",
"true",
")",
"return",
";",
"var",
"i",
";",
"lm",
".",
"items",
".",
"AbstractContentItem",
".",
"prototype",
".",
"_$init",
".",
"call",
"(",
"this",
")",
";",
"for",
"(",
... | Invoked recursively by the layout manager. AbstractContentItem.init appends
the contentItem's DOM elements to the container, RowOrColumn init adds splitters
in between them
@package private
@override AbstractContentItem._$init
@returns {void} | [
"Invoked",
"recursively",
"by",
"the",
"layout",
"manager",
".",
"AbstractContentItem",
".",
"init",
"appends",
"the",
"contentItem",
"s",
"DOM",
"elements",
"to",
"the",
"container",
"RowOrColumn",
"init",
"adds",
"splitters",
"in",
"between",
"them"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L252-L266 | |
6,702 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function() {
var i,
totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize,
headerSize = this.layoutManager.config.dimensions.headerHeight,
totalWidth = this.element.width(),
totalHeight = this.element.height(),
totalAssigned = 0,
additionalPixel,
itemSize,
itemSizes = [];
... | javascript | function() {
var i,
totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize,
headerSize = this.layoutManager.config.dimensions.headerHeight,
totalWidth = this.element.width(),
totalHeight = this.element.height(),
totalAssigned = 0,
additionalPixel,
itemSize,
itemSizes = [];
... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"totalSplitterSize",
"=",
"(",
"this",
".",
"contentItems",
".",
"length",
"-",
"1",
")",
"*",
"this",
".",
"_splitterSize",
",",
"headerSize",
"=",
"this",
".",
"layoutManager",
".",
"config",
".",
"dimensions... | Calculates the absolute sizes of all of the children of this Item.
@returns {object} - Set with absolute sizes and additional pixels. | [
"Calculates",
"the",
"absolute",
"sizes",
"of",
"all",
"of",
"the",
"children",
"of",
"this",
"Item",
"."
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L300-L346 | |
6,703 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function() {
var minItemWidth = this.layoutManager.config.dimensions ? (this.layoutManager.config.dimensions.minItemWidth || 0) : 0,
sizeData = null,
entriesOverMin = [],
totalOverMin = 0,
totalUnderMin = 0,
remainingWidth = 0,
itemSize = 0,
contentItem = null,
reducePercent,
reducedWidth,
... | javascript | function() {
var minItemWidth = this.layoutManager.config.dimensions ? (this.layoutManager.config.dimensions.minItemWidth || 0) : 0,
sizeData = null,
entriesOverMin = [],
totalOverMin = 0,
totalUnderMin = 0,
remainingWidth = 0,
itemSize = 0,
contentItem = null,
reducePercent,
reducedWidth,
... | [
"function",
"(",
")",
"{",
"var",
"minItemWidth",
"=",
"this",
".",
"layoutManager",
".",
"config",
".",
"dimensions",
"?",
"(",
"this",
".",
"layoutManager",
".",
"config",
".",
"dimensions",
".",
"minItemWidth",
"||",
"0",
")",
":",
"0",
",",
"sizeData... | Adjusts the column widths to respect the dimensions minItemWidth if set.
@returns {} | [
"Adjusts",
"the",
"column",
"widths",
"to",
"respect",
"the",
"dimensions",
"minItemWidth",
"if",
"set",
"."
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L430-L504 | |
6,704 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function( index ) {
var splitter;
splitter = new lm.controls.Splitter( this._isColumn, this._splitterSize, this._splitterGrabSize );
splitter.on( 'drag', lm.utils.fnBind( this._onSplitterDrag, this, [ splitter ] ), this );
splitter.on( 'dragStop', lm.utils.fnBind( this._onSplitterDragStop, this, [ splitter ] ),... | javascript | function( index ) {
var splitter;
splitter = new lm.controls.Splitter( this._isColumn, this._splitterSize, this._splitterGrabSize );
splitter.on( 'drag', lm.utils.fnBind( this._onSplitterDrag, this, [ splitter ] ), this );
splitter.on( 'dragStop', lm.utils.fnBind( this._onSplitterDragStop, this, [ splitter ] ),... | [
"function",
"(",
"index",
")",
"{",
"var",
"splitter",
";",
"splitter",
"=",
"new",
"lm",
".",
"controls",
".",
"Splitter",
"(",
"this",
".",
"_isColumn",
",",
"this",
".",
"_splitterSize",
",",
"this",
".",
"_splitterGrabSize",
")",
";",
"splitter",
"."... | Instantiates a new lm.controls.Splitter, binds events to it and adds
it to the array of splitters at the position specified as the index argument
What it doesn't do though is append the splitter to the DOM
@param {Int} index The position of the splitter
@returns {lm.controls.Splitter} | [
"Instantiates",
"a",
"new",
"lm",
".",
"controls",
".",
"Splitter",
"binds",
"events",
"to",
"it",
"and",
"adds",
"it",
"to",
"the",
"array",
"of",
"splitters",
"at",
"the",
"position",
"specified",
"as",
"the",
"index",
"argument"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L516-L524 | |
6,705 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function ( index ) {
if ( typeof index == 'undefined' ) {
var count = 0;
for (var i = 0; i < this.contentItems.length; ++i)
if ( this._isDocked( i ) )
count++;
return count;
}
if ( index < this.contentItems.length )
return this.contentItems[ index ]._docker && this.contentItems[ index ]._dock... | javascript | function ( index ) {
if ( typeof index == 'undefined' ) {
var count = 0;
for (var i = 0; i < this.contentItems.length; ++i)
if ( this._isDocked( i ) )
count++;
return count;
}
if ( index < this.contentItems.length )
return this.contentItems[ index ]._docker && this.contentItems[ index ]._dock... | [
"function",
"(",
"index",
")",
"{",
"if",
"(",
"typeof",
"index",
"==",
"'undefined'",
")",
"{",
"var",
"count",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"contentItems",
".",
"length",
";",
"++",
"i",
")",
"i... | Gets docking information
@private | [
"Gets",
"docking",
"information"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L549-L559 | |
6,706 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function ( that ) {
that = that || this;
var can = that.contentItems.length - that._isDocked() > 1;
for (var i = 0; i < that.contentItems.length; ++i )
if ( that.contentItems[ i ] instanceof lm.items.Stack ) {
that.contentItems[ i ].header._setDockable( that._isDocked( i ) || can );
that.contentItems[ ... | javascript | function ( that ) {
that = that || this;
var can = that.contentItems.length - that._isDocked() > 1;
for (var i = 0; i < that.contentItems.length; ++i )
if ( that.contentItems[ i ] instanceof lm.items.Stack ) {
that.contentItems[ i ].header._setDockable( that._isDocked( i ) || can );
that.contentItems[ ... | [
"function",
"(",
"that",
")",
"{",
"that",
"=",
"that",
"||",
"this",
";",
"var",
"can",
"=",
"that",
".",
"contentItems",
".",
"length",
"-",
"that",
".",
"_isDocked",
"(",
")",
">",
"1",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
... | Validate if row or column has ability to dock
@private | [
"Validate",
"if",
"row",
"or",
"column",
"has",
"ability",
"to",
"dock"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L565-L573 | |
6,707 | golden-layout/golden-layout | src/js/items/RowOrColumn.js | function( arr ) {
var minWidth = 0, minHeight = 0;
for( var i = 0; i < arr.length; ++i ) {
minWidth = Math.max( arr[ i ].minWidth || 0, minWidth );
minHeight = Math.max( arr[ i ].minHeight || 0, minHeight );
}
return { horizontal: minWidth, vertical: minHeight };
} | javascript | function( arr ) {
var minWidth = 0, minHeight = 0;
for( var i = 0; i < arr.length; ++i ) {
minWidth = Math.max( arr[ i ].minWidth || 0, minWidth );
minHeight = Math.max( arr[ i ].minHeight || 0, minHeight );
}
return { horizontal: minWidth, vertical: minHeight };
} | [
"function",
"(",
"arr",
")",
"{",
"var",
"minWidth",
"=",
"0",
",",
"minHeight",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"++",
"i",
")",
"{",
"minWidth",
"=",
"Math",
".",
"max",
"(",
"arr",
... | Gets the minimum dimensions for the given item configuration array
@param item
@private | [
"Gets",
"the",
"minimum",
"dimensions",
"for",
"the",
"given",
"item",
"configuration",
"array"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/items/RowOrColumn.js#L580-L589 | |
6,708 | golden-layout/golden-layout | src/js/controls/Tab.js | function() {
this.element.off( 'mousedown touchstart', this._onTabClickFn );
this.closeElement.off( 'click touchstart', this._onCloseClickFn );
if( this._dragListener ) {
this.contentItem.off( 'destroy', this._dragListener.destroy, this._dragListener );
this._dragListener.off( 'dragStart', this._onDragStart... | javascript | function() {
this.element.off( 'mousedown touchstart', this._onTabClickFn );
this.closeElement.off( 'click touchstart', this._onCloseClickFn );
if( this._dragListener ) {
this.contentItem.off( 'destroy', this._dragListener.destroy, this._dragListener );
this._dragListener.off( 'dragStart', this._onDragStart... | [
"function",
"(",
")",
"{",
"this",
".",
"element",
".",
"off",
"(",
"'mousedown touchstart'",
",",
"this",
".",
"_onTabClickFn",
")",
";",
"this",
".",
"closeElement",
".",
"off",
"(",
"'click touchstart'",
",",
"this",
".",
"_onCloseClickFn",
")",
";",
"i... | Destroys the tab
@private
@returns {void} | [
"Destroys",
"the",
"tab"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/controls/Tab.js#L104-L113 | |
6,709 | golden-layout/golden-layout | src/js/controls/Tab.js | function( x, y ) {
if( !this.header._canDestroy )
return null;
if( this.contentItem.parent.isMaximised === true ) {
this.contentItem.parent.toggleMaximise();
}
new lm.controls.DragProxy(
x,
y,
this._dragListener,
this._layoutManager,
this.contentItem,
this.header.parent
);
} | javascript | function( x, y ) {
if( !this.header._canDestroy )
return null;
if( this.contentItem.parent.isMaximised === true ) {
this.contentItem.parent.toggleMaximise();
}
new lm.controls.DragProxy(
x,
y,
this._dragListener,
this._layoutManager,
this.contentItem,
this.header.parent
);
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"!",
"this",
".",
"header",
".",
"_canDestroy",
")",
"return",
"null",
";",
"if",
"(",
"this",
".",
"contentItem",
".",
"parent",
".",
"isMaximised",
"===",
"true",
")",
"{",
"this",
".",
"conten... | Callback for the DragListener
@param {Number} x The tabs absolute x position
@param {Number} y The tabs absolute y position
@private
@returns {void} | [
"Callback",
"for",
"the",
"DragListener"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/controls/Tab.js#L124-L138 | |
6,710 | golden-layout/golden-layout | src/js/controls/Tab.js | function( event ) {
// left mouse button or tap
if( event.button === 0 || event.type === 'touchstart' ) {
this.header.parent.setActiveContentItem( this.contentItem );
// middle mouse button
} else if( event.button === 1 && this.contentItem.config.isClosable ) {
this._onCloseClick( event );
}
} | javascript | function( event ) {
// left mouse button or tap
if( event.button === 0 || event.type === 'touchstart' ) {
this.header.parent.setActiveContentItem( this.contentItem );
// middle mouse button
} else if( event.button === 1 && this.contentItem.config.isClosable ) {
this._onCloseClick( event );
}
} | [
"function",
"(",
"event",
")",
"{",
"// left mouse button or tap",
"if",
"(",
"event",
".",
"button",
"===",
"0",
"||",
"event",
".",
"type",
"===",
"'touchstart'",
")",
"{",
"this",
".",
"header",
".",
"parent",
".",
"setActiveContentItem",
"(",
"this",
"... | Callback when the tab is clicked
@param {jQuery DOM event} event
@private
@returns {void} | [
"Callback",
"when",
"the",
"tab",
"is",
"clicked"
] | 41ffb9f693b810132760d7b1218237820e5f9612 | https://github.com/golden-layout/golden-layout/blob/41ffb9f693b810132760d7b1218237820e5f9612/src/js/controls/Tab.js#L148-L157 | |
6,711 | russellgoldenberg/scrollama | src/init.js | updateStepAboveIO | function updateStepAboveIO() {
io.stepAbove = stepEl.map((el, i) => {
const marginTop = -offsetMargin + stepOffsetHeight[i];
const marginBottom = offsetMargin - viewH;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const options = { rootMargin };
// console.log(options)... | javascript | function updateStepAboveIO() {
io.stepAbove = stepEl.map((el, i) => {
const marginTop = -offsetMargin + stepOffsetHeight[i];
const marginBottom = offsetMargin - viewH;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const options = { rootMargin };
// console.log(options)... | [
"function",
"updateStepAboveIO",
"(",
")",
"{",
"io",
".",
"stepAbove",
"=",
"stepEl",
".",
"map",
"(",
"(",
"el",
",",
"i",
")",
"=>",
"{",
"const",
"marginTop",
"=",
"-",
"offsetMargin",
"+",
"stepOffsetHeight",
"[",
"i",
"]",
";",
"const",
"marginBo... | look above for intersection | [
"look",
"above",
"for",
"intersection"
] | 486c14807c43d284eaaf2118e52b116798e618b9 | https://github.com/russellgoldenberg/scrollama/blob/486c14807c43d284eaaf2118e52b116798e618b9/src/init.js#L363-L374 |
6,712 | russellgoldenberg/scrollama | src/init.js | updateStepProgressIO | function updateStepProgressIO() {
io.stepProgress = stepEl.map((el, i) => {
const marginTop = stepOffsetHeight[i] - offsetMargin;
const marginBottom = -viewH + offsetMargin;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const threshold = createThreshold(stepOffsetHeight[i]);... | javascript | function updateStepProgressIO() {
io.stepProgress = stepEl.map((el, i) => {
const marginTop = stepOffsetHeight[i] - offsetMargin;
const marginBottom = -viewH + offsetMargin;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const threshold = createThreshold(stepOffsetHeight[i]);... | [
"function",
"updateStepProgressIO",
"(",
")",
"{",
"io",
".",
"stepProgress",
"=",
"stepEl",
".",
"map",
"(",
"(",
"el",
",",
"i",
")",
"=>",
"{",
"const",
"marginTop",
"=",
"stepOffsetHeight",
"[",
"i",
"]",
"-",
"offsetMargin",
";",
"const",
"marginBot... | progress progress tracker | [
"progress",
"progress",
"tracker"
] | 486c14807c43d284eaaf2118e52b116798e618b9 | https://github.com/russellgoldenberg/scrollama/blob/486c14807c43d284eaaf2118e52b116798e618b9/src/init.js#L391-L403 |
6,713 | jashkenas/backbone | examples/backbone.localStorage.js | function(model) {
this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
if (!_.include(this.records, model.id.toString()))
this.records.push(model.id.toString()); this.save();
return this.find(model);
} | javascript | function(model) {
this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
if (!_.include(this.records, model.id.toString()))
this.records.push(model.id.toString()); this.save();
return this.find(model);
} | [
"function",
"(",
"model",
")",
"{",
"this",
".",
"localStorage",
"(",
")",
".",
"setItem",
"(",
"this",
".",
"name",
"+",
"\"-\"",
"+",
"model",
".",
"id",
",",
"JSON",
".",
"stringify",
"(",
"model",
")",
")",
";",
"if",
"(",
"!",
"_",
".",
"i... | Update a model by replacing its copy in `this.data`. | [
"Update",
"a",
"model",
"by",
"replacing",
"its",
"copy",
"in",
"this",
".",
"data",
"."
] | 75e6d0ce6394bd2b809823c7f7dc014ddb6ae287 | https://github.com/jashkenas/backbone/blob/75e6d0ce6394bd2b809823c7f7dc014ddb6ae287/examples/backbone.localStorage.js#L66-L71 | |
6,714 | jashkenas/backbone | examples/backbone.localStorage.js | function() {
return _(this.records).chain()
.map(function(id){
return this.jsonData(this.localStorage().getItem(this.name+"-"+id));
}, this)
.compact()
.value();
} | javascript | function() {
return _(this.records).chain()
.map(function(id){
return this.jsonData(this.localStorage().getItem(this.name+"-"+id));
}, this)
.compact()
.value();
} | [
"function",
"(",
")",
"{",
"return",
"_",
"(",
"this",
".",
"records",
")",
".",
"chain",
"(",
")",
".",
"map",
"(",
"function",
"(",
"id",
")",
"{",
"return",
"this",
".",
"jsonData",
"(",
"this",
".",
"localStorage",
"(",
")",
".",
"getItem",
"... | Return the array of all models currently in storage. | [
"Return",
"the",
"array",
"of",
"all",
"models",
"currently",
"in",
"storage",
"."
] | 75e6d0ce6394bd2b809823c7f7dc014ddb6ae287 | https://github.com/jashkenas/backbone/blob/75e6d0ce6394bd2b809823c7f7dc014ddb6ae287/examples/backbone.localStorage.js#L79-L86 | |
6,715 | jashkenas/backbone | examples/backbone.localStorage.js | function(model) {
if (model.isNew())
return false
this.localStorage().removeItem(this.name+"-"+model.id);
this.records = _.reject(this.records, function(id){
return id === model.id.toString();
});
this.save();
return model;
} | javascript | function(model) {
if (model.isNew())
return false
this.localStorage().removeItem(this.name+"-"+model.id);
this.records = _.reject(this.records, function(id){
return id === model.id.toString();
});
this.save();
return model;
} | [
"function",
"(",
"model",
")",
"{",
"if",
"(",
"model",
".",
"isNew",
"(",
")",
")",
"return",
"false",
"this",
".",
"localStorage",
"(",
")",
".",
"removeItem",
"(",
"this",
".",
"name",
"+",
"\"-\"",
"+",
"model",
".",
"id",
")",
";",
"this",
"... | Delete a model from `this.data`, returning it. | [
"Delete",
"a",
"model",
"from",
"this",
".",
"data",
"returning",
"it",
"."
] | 75e6d0ce6394bd2b809823c7f7dc014ddb6ae287 | https://github.com/jashkenas/backbone/blob/75e6d0ce6394bd2b809823c7f7dc014ddb6ae287/examples/backbone.localStorage.js#L89-L98 | |
6,716 | mozilla/nunjucks | docs/bower_components/bootstrap/assets/js/jszip.js | function (name, data, o) {
// be sure sub folders exist
var parent = parentFolder(name), dataType = JSZip.utils.getTypeOf(data);
if (parent) {
folderAdd.call(this, parent);
}
o = prepareFileAttrs(o);
if (o.dir || data === null || typeof data === "undefined") {
o.b... | javascript | function (name, data, o) {
// be sure sub folders exist
var parent = parentFolder(name), dataType = JSZip.utils.getTypeOf(data);
if (parent) {
folderAdd.call(this, parent);
}
o = prepareFileAttrs(o);
if (o.dir || data === null || typeof data === "undefined") {
o.b... | [
"function",
"(",
"name",
",",
"data",
",",
"o",
")",
"{",
"// be sure sub folders exist",
"var",
"parent",
"=",
"parentFolder",
"(",
"name",
")",
",",
"dataType",
"=",
"JSZip",
".",
"utils",
".",
"getTypeOf",
"(",
"data",
")",
";",
"if",
"(",
"parent",
... | Add a file in the current folder.
@private
@param {string} name the name of the file
@param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
@param {Object} o the options of the file
@return {Object} the new file. | [
"Add",
"a",
"file",
"in",
"the",
"current",
"folder",
"."
] | 224645791298db835df0acff3dc596d3a9ed2c4d | https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L254-L291 | |
6,717 | mozilla/nunjucks | docs/bower_components/bootstrap/assets/js/jszip.js | function (file, compression) {
var result = new JSZip.CompressedObject(), content;
// the data has not been decompressed, we might reuse things !
if (file._data instanceof JSZip.CompressedObject) {
result.uncompressedSize = file._data.uncompressedSize;
result.crc32 = file._data.crc3... | javascript | function (file, compression) {
var result = new JSZip.CompressedObject(), content;
// the data has not been decompressed, we might reuse things !
if (file._data instanceof JSZip.CompressedObject) {
result.uncompressedSize = file._data.uncompressedSize;
result.crc32 = file._data.crc3... | [
"function",
"(",
"file",
",",
"compression",
")",
"{",
"var",
"result",
"=",
"new",
"JSZip",
".",
"CompressedObject",
"(",
")",
",",
"content",
";",
"// the data has not been decompressed, we might reuse things !",
"if",
"(",
"file",
".",
"_data",
"instanceof",
"J... | Generate a JSZip.CompressedObject for a given zipOject.
@param {ZipObject} file the object to read.
@param {JSZip.compression} compression the compression to use.
@return {JSZip.CompressedObject} the compressed result. | [
"Generate",
"a",
"JSZip",
".",
"CompressedObject",
"for",
"a",
"given",
"zipOject",
"."
] | 224645791298db835df0acff3dc596d3a9ed2c4d | https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L333-L368 | |
6,718 | mozilla/nunjucks | docs/bower_components/bootstrap/assets/js/jszip.js | function(name, file, compressedObject, offset) {
var data = compressedObject.compressedContent,
utfEncodedFileName = this.utf8encode(file.name),
useUTF8 = utfEncodedFileName !== file.name,
o = file.options,
dosTime,
dosDate;
// date
// @see http... | javascript | function(name, file, compressedObject, offset) {
var data = compressedObject.compressedContent,
utfEncodedFileName = this.utf8encode(file.name),
useUTF8 = utfEncodedFileName !== file.name,
o = file.options,
dosTime,
dosDate;
// date
// @see http... | [
"function",
"(",
"name",
",",
"file",
",",
"compressedObject",
",",
"offset",
")",
"{",
"var",
"data",
"=",
"compressedObject",
".",
"compressedContent",
",",
"utfEncodedFileName",
"=",
"this",
".",
"utf8encode",
"(",
"file",
".",
"name",
")",
",",
"useUTF8"... | Generate the various parts used in the construction of the final zip file.
@param {string} name the file name.
@param {ZipObject} file the file content.
@param {JSZip.CompressedObject} compressedObject the compressed object.
@param {number} offset the current offset from the start of the zip file.
@return {object} the ... | [
"Generate",
"the",
"various",
"parts",
"used",
"in",
"the",
"construction",
"of",
"the",
"final",
"zip",
"file",
"."
] | 224645791298db835df0acff3dc596d3a9ed2c4d | https://github.com/mozilla/nunjucks/blob/224645791298db835df0acff3dc596d3a9ed2c4d/docs/bower_components/bootstrap/assets/js/jszip.js#L378-L455 | |
6,719 | 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 | |
6,720 | 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 | |
6,721 | 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 | |
6,722 | 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 |
6,723 | 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 |
6,724 | 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 |
6,725 | 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 |
6,726 | 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 |
6,727 | 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 |
6,728 | 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 |
6,729 | 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 |
6,730 | 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 |
6,731 | 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 |
6,732 | 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 |
6,733 | 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 |
6,734 | 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 |
6,735 | 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 |
6,736 | 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 |
6,737 | 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 |
6,738 | 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 |
6,739 | 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 |
6,740 | 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 | |
6,741 | 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 |
6,742 | 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 |
6,743 | 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 |
6,744 | 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 |
6,745 | 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 |
6,746 | 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 |
6,747 | 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 | |
6,748 | 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 |
6,749 | 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 | |
6,750 | 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 | |
6,751 | 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 | |
6,752 | 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 |
6,753 | 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 |
6,754 | 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 |
6,755 | 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 |
6,756 | 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 |
6,757 | 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 |
6,758 | 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 |
6,759 | 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 |
6,760 | 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 |
6,761 | 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 |
6,762 | 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 |
6,763 | 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 |
6,764 | 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 |
6,765 | 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 |
6,766 | 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 |
6,767 | 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 |
6,768 | 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 |
6,769 | 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 |
6,770 | 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 |
6,771 | 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 |
6,772 | 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 |
6,773 | 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 |
6,774 | 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 |
6,775 | 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 |
6,776 | 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 |
6,777 | 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 |
6,778 | 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 |
6,779 | 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 |
6,780 | 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 |
6,781 | 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 |
6,782 | 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 |
6,783 | 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 |
6,784 | 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 | |
6,785 | 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 | |
6,786 | 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 | |
6,787 | 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 | |
6,788 | 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 | |
6,789 | 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 | |
6,790 | 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 |
6,791 | 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 |
6,792 | 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 | |
6,793 | 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 | |
6,794 | 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 | |
6,795 | 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 | |
6,796 | 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 | |
6,797 | 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 |
6,798 | 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 |
6,799 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.