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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40,500 | micromatch/glob-fs | index.js | function(method, arr/*, arguments*/) {
var args = [].slice.call(arguments, 2);
utils.arrayify(arr || []).forEach(function (obj) {
this[method](obj, args);
}.bind(this));
return this;
} | javascript | function(method, arr/*, arguments*/) {
var args = [].slice.call(arguments, 2);
utils.arrayify(arr || []).forEach(function (obj) {
this[method](obj, args);
}.bind(this));
return this;
} | [
"function",
"(",
"method",
",",
"arr",
"/*, arguments*/",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
")",
";",
"utils",
".",
"arrayify",
"(",
"arr",
"||",
"[",
"]",
")",
".",
"forEach",
"(",
"fu... | Map the given `method` over `array`.
@param {String} `method`
@param {Array} `arr`
@return {Object} `this` for chaining | [
"Map",
"the",
"given",
"method",
"over",
"array",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/index.js#L261-L267 | |
40,501 | micromatch/glob-fs | lib/readers.js | function(pattern, options, cb) {
if (typeof options === 'function') {
return this.readdir(pattern, {}, options);
}
this.emit('read');
this.setPattern(pattern, options);
this.iteratorAsync(this.pattern.base, function (err) {
if (err) return cb(err);
this.emit('end'... | javascript | function(pattern, options, cb) {
if (typeof options === 'function') {
return this.readdir(pattern, {}, options);
}
this.emit('read');
this.setPattern(pattern, options);
this.iteratorAsync(this.pattern.base, function (err) {
if (err) return cb(err);
this.emit('end'... | [
"function",
"(",
"pattern",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"return",
"this",
".",
"readdir",
"(",
"pattern",
",",
"{",
"}",
",",
"options",
")",
";",
"}",
"this",
".",
"emit",
"("... | Asynchronously glob files or directories that match
the given `pattern`.
```js
var glob = require('glob-fs')({ gitignore: true });
glob.readdir('*.js', function (err, files) {
//=> do stuff with `files`
});
```
@name .readdir
@param {String} `pattern` Glob pattern
@param {Object} `options`
@param {Function} `cb` ... | [
"Asynchronously",
"glob",
"files",
"or",
"directories",
"that",
"match",
"the",
"given",
"pattern",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/lib/readers.js#L25-L39 | |
40,502 | micromatch/glob-fs | lib/readers.js | function(pattern, options) {
this.emit('read');
this.setPattern(pattern, options);
this.iteratorSync(this.pattern.base);
this.emit('end', this.files);
return this.files;
} | javascript | function(pattern, options) {
this.emit('read');
this.setPattern(pattern, options);
this.iteratorSync(this.pattern.base);
this.emit('end', this.files);
return this.files;
} | [
"function",
"(",
"pattern",
",",
"options",
")",
"{",
"this",
".",
"emit",
"(",
"'read'",
")",
";",
"this",
".",
"setPattern",
"(",
"pattern",
",",
"options",
")",
";",
"this",
".",
"iteratorSync",
"(",
"this",
".",
"pattern",
".",
"base",
")",
";",
... | Synchronously glob files or directories that match
the given `pattern`.
```js
var glob = require('glob-fs')({ gitignore: true });
var files = glob.readdirSync('*.js');
//=> do stuff with `files`
```
@name .readdirSync
@param {String} `pattern` Glob pattern
@param {Object} `options`
@returns {Array} Returns an arra... | [
"Synchronously",
"glob",
"files",
"or",
"directories",
"that",
"match",
"the",
"given",
"pattern",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/lib/readers.js#L59-L65 | |
40,503 | micromatch/glob-fs | lib/readers.js | function(pattern, options) {
this.emit('read');
this.setPattern(pattern, options);
var res = this.iteratorStream(this.pattern.base);
this.emit('end', this.files);
return res;
} | javascript | function(pattern, options) {
this.emit('read');
this.setPattern(pattern, options);
var res = this.iteratorStream(this.pattern.base);
this.emit('end', this.files);
return res;
} | [
"function",
"(",
"pattern",
",",
"options",
")",
"{",
"this",
".",
"emit",
"(",
"'read'",
")",
";",
"this",
".",
"setPattern",
"(",
"pattern",
",",
"options",
")",
";",
"var",
"res",
"=",
"this",
".",
"iteratorStream",
"(",
"this",
".",
"pattern",
".... | Stream files or directories that match the given glob `pattern`.
```js
var glob = require('glob-fs')({ gitignore: true });
glob.readdirStream('*.js')
.on('data', function (file) {
console.log(file.path);
})
.on('error', console.error)
.on('end', function () {
console.log('end');
});
```
@name .readdirStream
@param ... | [
"Stream",
"files",
"or",
"directories",
"that",
"match",
"the",
"given",
"glob",
"pattern",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/lib/readers.js#L90-L96 | |
40,504 | micromatch/glob-fs | lib/file.js | File | function File(file) {
this.cache = new Map();
this.history = [];
this.pattern = file.pattern;
this.recurse = file.recurse;
this.dirname = file.dirname;
this.segment = file.segment;
this.path = file.path;
this.orig = file.path;
} | javascript | function File(file) {
this.cache = new Map();
this.history = [];
this.pattern = file.pattern;
this.recurse = file.recurse;
this.dirname = file.dirname;
this.segment = file.segment;
this.path = file.path;
this.orig = file.path;
} | [
"function",
"File",
"(",
"file",
")",
"{",
"this",
".",
"cache",
"=",
"new",
"Map",
"(",
")",
";",
"this",
".",
"history",
"=",
"[",
"]",
";",
"this",
".",
"pattern",
"=",
"file",
".",
"pattern",
";",
"this",
".",
"recurse",
"=",
"file",
".",
"... | Create a new `File` from the given `object`.
@param {Object} `object`
@api public | [
"Create",
"a",
"new",
"File",
"from",
"the",
"given",
"object",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/lib/file.js#L24-L33 |
40,505 | micromatch/glob-fs | lib/pattern.js | Pattern | function Pattern(glob, options, isNegated) {
utils.defineProp(this, 'cache', new Map());
this.negated = !!isNegated;
this.options = options || {};
this.parse(glob);
return this;
} | javascript | function Pattern(glob, options, isNegated) {
utils.defineProp(this, 'cache', new Map());
this.negated = !!isNegated;
this.options = options || {};
this.parse(glob);
return this;
} | [
"function",
"Pattern",
"(",
"glob",
",",
"options",
",",
"isNegated",
")",
"{",
"utils",
".",
"defineProp",
"(",
"this",
",",
"'cache'",
",",
"new",
"Map",
"(",
")",
")",
";",
"this",
".",
"negated",
"=",
"!",
"!",
"isNegated",
";",
"this",
".",
"o... | Create an instance of `Pattern` with the given `options`.
@param {String} `glob`
@param {Object} `options`
@param {Boolean} `isNegated`
@api public | [
"Create",
"an",
"instance",
"of",
"Pattern",
"with",
"the",
"given",
"options",
"."
] | 9419fb8a112ca6554af0448cbb801c00953af8e5 | https://github.com/micromatch/glob-fs/blob/9419fb8a112ca6554af0448cbb801c00953af8e5/lib/pattern.js#L30-L36 |
40,506 | SilentCicero/ethereumjs-accounts | index.js | function(str){
if(_.isUndefined(str))
str = '00';
return String(str).length % 2 ? '0' + String(str) : String(str);
} | javascript | function(str){
if(_.isUndefined(str))
str = '00';
return String(str).length % 2 ? '0' + String(str) : String(str);
} | [
"function",
"(",
"str",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"str",
")",
")",
"str",
"=",
"'00'",
";",
"return",
"String",
"(",
"str",
")",
".",
"length",
"%",
"2",
"?",
"'0'",
"+",
"String",
"(",
"str",
")",
":",
"String",
"(",
... | Pad the given string with a prefix zero, if length is uneven.
@method (formatHex)
@param {String} str The string to pad for use as hex
@return {String} The padded or formatted string for use as a hex string | [
"Pad",
"the",
"given",
"string",
"with",
"a",
"prefix",
"zero",
"if",
"length",
"is",
"uneven",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L94-L99 | |
40,507 | SilentCicero/ethereumjs-accounts | index.js | function(num){
if(_.isUndefined(num) || num == 0)
num = '00';
if(_.isString(num) || _.isNumber(num))
num = new BigNumber(String(num));
if(isBigNumber(num))
num = num.toString(16);
return formatHex(num);
} | javascript | function(num){
if(_.isUndefined(num) || num == 0)
num = '00';
if(_.isString(num) || _.isNumber(num))
num = new BigNumber(String(num));
if(isBigNumber(num))
num = num.toString(16);
return formatHex(num);
} | [
"function",
"(",
"num",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"num",
")",
"||",
"num",
"==",
"0",
")",
"num",
"=",
"'00'",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"num",
")",
"||",
"_",
".",
"isNumber",
"(",
"num",
")",
")",
... | Prepair numbers for raw transactions.
@method (formatNumber)
@param {Number|String|BigNumber} The object to be used as a number
@return {String} The padded, toString hex value of the number | [
"Prepair",
"numbers",
"for",
"raw",
"transactions",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L110-L121 | |
40,508 | SilentCicero/ethereumjs-accounts | index.js | function(addr, format){
if(_.isUndefined(format) || !_.isString(format))
format = 'hex';
if(_.isUndefined(addr)
|| !_.isString(addr))
addr = '0000000000000000000000000000000000000000';
if(addr.substr(0, 2) == '0x' && format == 'raw')
addr = addr.substr(2);
if(addr.subst... | javascript | function(addr, format){
if(_.isUndefined(format) || !_.isString(format))
format = 'hex';
if(_.isUndefined(addr)
|| !_.isString(addr))
addr = '0000000000000000000000000000000000000000';
if(addr.substr(0, 2) == '0x' && format == 'raw')
addr = addr.substr(2);
if(addr.subst... | [
"function",
"(",
"addr",
",",
"format",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"format",
")",
"||",
"!",
"_",
".",
"isString",
"(",
"format",
")",
")",
"format",
"=",
"'hex'",
";",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"addr",
")",... | Prepair Ethereum address for either raw transactions or browser storage.
@method (formatAddress)
@param {String} addr An ethereum address to prep
@param {String} format The format type (i.e. 'raw' or 'hex')
@return {String} The prepaired ethereum address | [
"Prepair",
"Ethereum",
"address",
"for",
"either",
"raw",
"transactions",
"or",
"browser",
"storage",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L133-L148 | |
40,509 | SilentCicero/ethereumjs-accounts | index.js | function(length) {
var charset = "abcdef0123456789";
var i;
var result = "";
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
if(window.crypto && window.crypto.getRandomValues) {
values = new Uint32Array(length);
window.crypto.getRandomValues(values);
... | javascript | function(length) {
var charset = "abcdef0123456789";
var i;
var result = "";
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
if(window.crypto && window.crypto.getRandomValues) {
values = new Uint32Array(length);
window.crypto.getRandomValues(values);
... | [
"function",
"(",
"length",
")",
"{",
"var",
"charset",
"=",
"\"abcdef0123456789\"",
";",
"var",
"i",
";",
"var",
"result",
"=",
"\"\"",
";",
"var",
"isOpera",
"=",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"window",
".",
"opera",
"... | Generate 16 random alpha numeric bytes.
@method (randomBytes)
@param {Number} length The string length that should be generated
@return {String} A 16 char/UTF-8 byte string of random alpha-numeric characters | [
"Generate",
"16",
"random",
"alpha",
"numeric",
"bytes",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L159-L178 | |
40,510 | SilentCicero/ethereumjs-accounts | index.js | function(value){
if(_.isUndefined(value) || !_.isObject(value))
return false;
return (value instanceof BigNumber) ? true : false;
} | javascript | function(value){
if(_.isUndefined(value) || !_.isObject(value))
return false;
return (value instanceof BigNumber) ? true : false;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"value",
")",
"||",
"!",
"_",
".",
"isObject",
"(",
"value",
")",
")",
"return",
"false",
";",
"return",
"(",
"value",
"instanceof",
"BigNumber",
")",
"?",
"true",
":",
"f... | Is the object provided a Bignumber object.
@method (isBigNumber) | [
"Is",
"the",
"object",
"provided",
"a",
"Bignumber",
"object",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L187-L192 | |
40,511 | SilentCicero/ethereumjs-accounts | index.js | function(context){
Object.defineProperty(context, 'length', {
get: function() {
var count = 0;
// count valid accounts in browser storage
_.each(this.get(), function(account, accountIndex){
if(_.isUndefined(account)
|| !_.isObject(accoun... | javascript | function(context){
Object.defineProperty(context, 'length', {
get: function() {
var count = 0;
// count valid accounts in browser storage
_.each(this.get(), function(account, accountIndex){
if(_.isUndefined(account)
|| !_.isObject(accoun... | [
"function",
"(",
"context",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"context",
",",
"'length'",
",",
"{",
"get",
":",
"function",
"(",
")",
"{",
"var",
"count",
"=",
"0",
";",
"// count valid accounts in browser storage",
"_",
".",
"each",
"(",
"th... | Define object properties such as 'length'.
@method (defineProperties)
@param {Object} context The Accounts object context | [
"Define",
"object",
"properties",
"such",
"as",
"length",
"."
] | 265e825fd3f4d841e039336b6be0b24cb54f4a2e | https://github.com/SilentCicero/ethereumjs-accounts/blob/265e825fd3f4d841e039336b6be0b24cb54f4a2e/index.js#L214-L236 | |
40,512 | raymondsze/create-react-scripts | packages/create-react-scripts/compose.js | pipe | function pipe(funcs) {
return function pipeRewire(config) {
const args = Array.prototype.slice.call(arguments, 1);
(funcs || []).forEach(func => {
if (func && typeof func === 'function') {
// slice the first argument "config"
config = func.apply(this, [config].concat(args));
}
... | javascript | function pipe(funcs) {
return function pipeRewire(config) {
const args = Array.prototype.slice.call(arguments, 1);
(funcs || []).forEach(func => {
if (func && typeof func === 'function') {
// slice the first argument "config"
config = func.apply(this, [config].concat(args));
}
... | [
"function",
"pipe",
"(",
"funcs",
")",
"{",
"return",
"function",
"pipeRewire",
"(",
"config",
")",
"{",
"const",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"(",
"funcs",
"||",
"[",
"]",
... | pipe rewire do not use recursion here to prevent maximum call stack | [
"pipe",
"rewire",
"do",
"not",
"use",
"recursion",
"here",
"to",
"prevent",
"maximum",
"call",
"stack"
] | 14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6 | https://github.com/raymondsze/create-react-scripts/blob/14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6/packages/create-react-scripts/compose.js#L7-L18 |
40,513 | raymondsze/create-react-scripts | packages/create-react-scripts/compose.js | mergeScripts | function mergeScripts(crsScripts) {
const scripts = {
build: path.join(__dirname, 'scripts/build.js'),
start: path.join(__dirname, 'scripts/start.js'),
test: path.join(__dirname, 'scripts/test.js'),
};
crsScripts.forEach(scriptSet => {
Object.assign(scripts, scriptSet || {});
});
return script... | javascript | function mergeScripts(crsScripts) {
const scripts = {
build: path.join(__dirname, 'scripts/build.js'),
start: path.join(__dirname, 'scripts/start.js'),
test: path.join(__dirname, 'scripts/test.js'),
};
crsScripts.forEach(scriptSet => {
Object.assign(scripts, scriptSet || {});
});
return script... | [
"function",
"mergeScripts",
"(",
"crsScripts",
")",
"{",
"const",
"scripts",
"=",
"{",
"build",
":",
"path",
".",
"join",
"(",
"__dirname",
",",
"'scripts/build.js'",
")",
",",
"start",
":",
"path",
".",
"join",
"(",
"__dirname",
",",
"'scripts/start.js'",
... | merge scripts and remove the duplicates do not use recursion here to prevent maximum call stack | [
"merge",
"scripts",
"and",
"remove",
"the",
"duplicates",
"do",
"not",
"use",
"recursion",
"here",
"to",
"prevent",
"maximum",
"call",
"stack"
] | 14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6 | https://github.com/raymondsze/create-react-scripts/blob/14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6/packages/create-react-scripts/compose.js#L22-L32 |
40,514 | raymondsze/create-react-scripts | packages/create-react-scripts/compose.js | compose | function compose(...args) {
// convert pipe to compose by reverse the array
const crsConfigs = args.slice(0).reverse();
const crsConfig = {
env: pipe(crsConfigs.map(c => c.env)),
paths: pipe(crsConfigs.map(c => c.paths)),
webpack: pipe(crsConfigs.map(c => c.webpack)),
devServer: pipe(crsConfigs.ma... | javascript | function compose(...args) {
// convert pipe to compose by reverse the array
const crsConfigs = args.slice(0).reverse();
const crsConfig = {
env: pipe(crsConfigs.map(c => c.env)),
paths: pipe(crsConfigs.map(c => c.paths)),
webpack: pipe(crsConfigs.map(c => c.webpack)),
devServer: pipe(crsConfigs.ma... | [
"function",
"compose",
"(",
"...",
"args",
")",
"{",
"// convert pipe to compose by reverse the array",
"const",
"crsConfigs",
"=",
"args",
".",
"slice",
"(",
"0",
")",
".",
"reverse",
"(",
")",
";",
"const",
"crsConfig",
"=",
"{",
"env",
":",
"pipe",
"(",
... | this function is used to compose multiple configs into one config | [
"this",
"function",
"is",
"used",
"to",
"compose",
"multiple",
"configs",
"into",
"one",
"config"
] | 14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6 | https://github.com/raymondsze/create-react-scripts/blob/14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6/packages/create-react-scripts/compose.js#L35-L47 |
40,515 | raymondsze/create-react-scripts | packages/create-react-scripts/index.js | createReactScripts | function createReactScripts(scriptsDir) {
// obtain the crs.config path
// we allow user to use crs.config under app directory instead if scriptsDir is not provided
// in this case, we do not allow customize new scripts and template
const crsConfigPath = path.join(scriptsDir || process.cwd(), 'crs.config.js');
... | javascript | function createReactScripts(scriptsDir) {
// obtain the crs.config path
// we allow user to use crs.config under app directory instead if scriptsDir is not provided
// in this case, we do not allow customize new scripts and template
const crsConfigPath = path.join(scriptsDir || process.cwd(), 'crs.config.js');
... | [
"function",
"createReactScripts",
"(",
"scriptsDir",
")",
"{",
"// obtain the crs.config path",
"// we allow user to use crs.config under app directory instead if scriptsDir is not provided",
"// in this case, we do not allow customize new scripts and template",
"const",
"crsConfigPath",
"=",
... | This function is used to customize the react-scripts | [
"This",
"function",
"is",
"used",
"to",
"customize",
"the",
"react",
"-",
"scripts"
] | 14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6 | https://github.com/raymondsze/create-react-scripts/blob/14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6/packages/create-react-scripts/index.js#L14-L97 |
40,516 | raymondsze/create-react-scripts | packages/create-react-scripts-ssr/scripts/build-server.js | buildServer | function buildServer() {
console.log();
console.log(`${chalk.cyan('SERVER-SIDE')}`);
console.log('===========================================================');
fs.emptyDirSync(paths.appServerBuild);
console.log('Creating a server-side production build...');
let compiler = webpack(serverlize(paths, config)... | javascript | function buildServer() {
console.log();
console.log(`${chalk.cyan('SERVER-SIDE')}`);
console.log('===========================================================');
fs.emptyDirSync(paths.appServerBuild);
console.log('Creating a server-side production build...');
let compiler = webpack(serverlize(paths, config)... | [
"function",
"buildServer",
"(",
")",
"{",
"console",
".",
"log",
"(",
")",
";",
"console",
".",
"log",
"(",
"`",
"${",
"chalk",
".",
"cyan",
"(",
"'SERVER-SIDE'",
")",
"}",
"`",
")",
";",
"console",
".",
"log",
"(",
"'====================================... | we can run the server-side build | [
"we",
"can",
"run",
"the",
"server",
"-",
"side",
"build"
] | 14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6 | https://github.com/raymondsze/create-react-scripts/blob/14c0b8bcf7dcf69bd7c6fa394a5d27f3b25f2ad6/packages/create-react-scripts-ssr/scripts/build-server.js#L49-L120 |
40,517 | Jam3/three-buffer-vertex-data | index.js | rebuildAttribute | function rebuildAttribute (attrib, data, itemSize) {
if (attrib.itemSize !== itemSize) return true
if (!attrib.array) return true
var attribLength = attrib.array.length
if (Array.isArray(data) && Array.isArray(data[0])) {
// [ [ x, y, z ] ]
return attribLength !== data.length * itemSize
} else {
/... | javascript | function rebuildAttribute (attrib, data, itemSize) {
if (attrib.itemSize !== itemSize) return true
if (!attrib.array) return true
var attribLength = attrib.array.length
if (Array.isArray(data) && Array.isArray(data[0])) {
// [ [ x, y, z ] ]
return attribLength !== data.length * itemSize
} else {
/... | [
"function",
"rebuildAttribute",
"(",
"attrib",
",",
"data",
",",
"itemSize",
")",
"{",
"if",
"(",
"attrib",
".",
"itemSize",
"!==",
"itemSize",
")",
"return",
"true",
"if",
"(",
"!",
"attrib",
".",
"array",
")",
"return",
"true",
"var",
"attribLength",
"... | Test whether the attribute needs to be re-created, returns false if we can re-use it as-is. | [
"Test",
"whether",
"the",
"attribute",
"needs",
"to",
"be",
"re",
"-",
"created",
"returns",
"false",
"if",
"we",
"can",
"re",
"-",
"use",
"it",
"as",
"-",
"is",
"."
] | c5318e2b6697c40920f3abc9b02a8ac979d330ee | https://github.com/Jam3/three-buffer-vertex-data/blob/c5318e2b6697c40920f3abc9b02a8ac979d330ee/index.js#L86-L98 |
40,518 | remarkjs/remark-rehype | index.js | bridge | function bridge(destination, options) {
return transformer
function transformer(node, file, next) {
destination.run(mdast2hast(node, options), file, done)
function done(err) {
next(err)
}
}
} | javascript | function bridge(destination, options) {
return transformer
function transformer(node, file, next) {
destination.run(mdast2hast(node, options), file, done)
function done(err) {
next(err)
}
}
} | [
"function",
"bridge",
"(",
"destination",
",",
"options",
")",
"{",
"return",
"transformer",
"function",
"transformer",
"(",
"node",
",",
"file",
",",
"next",
")",
"{",
"destination",
".",
"run",
"(",
"mdast2hast",
"(",
"node",
",",
"options",
")",
",",
... | Bridge-mode. Runs the destination with the new hast tree. | [
"Bridge",
"-",
"mode",
".",
"Runs",
"the",
"destination",
"with",
"the",
"new",
"hast",
"tree",
"."
] | 07469598e3a2c794f51e0741b8213066b3c702c9 | https://github.com/remarkjs/remark-rehype/blob/07469598e3a2c794f51e0741b8213066b3c702c9/index.js#L20-L30 |
40,519 | Wtower/ng-gentelella | build/js/index.min.js | drawDonutHole | function drawDonutHole(layer) {
if (options.series.pie.innerRadius > 0) {
// subtract the center
layer.save();
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
layer.globalCompositeOperation = "destination-out"; // t... | javascript | function drawDonutHole(layer) {
if (options.series.pie.innerRadius > 0) {
// subtract the center
layer.save();
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
layer.globalCompositeOperation = "destination-out"; // t... | [
"function",
"drawDonutHole",
"(",
"layer",
")",
"{",
"if",
"(",
"options",
".",
"series",
".",
"pie",
".",
"innerRadius",
">",
"0",
")",
"{",
"// subtract the center",
"layer",
".",
"save",
"(",
")",
";",
"var",
"innerRadius",
"=",
"options",
".",
"serie... | end draw function Placed here because it needs to be accessed from multiple locations | [
"end",
"draw",
"function",
"Placed",
"here",
"because",
"it",
"needs",
"to",
"be",
"accessed",
"from",
"multiple",
"locations"
] | 3c45611cfa200e660aa497ba82d191231163487b | https://github.com/Wtower/ng-gentelella/blob/3c45611cfa200e660aa497ba82d191231163487b/build/js/index.min.js#L58078-L58105 |
40,520 | Wtower/ng-gentelella | build/js/index.min.js | makeUtcWrapper | function makeUtcWrapper(d) {
function addProxyMethod(sourceObj, sourceMethod, targetObj, targetMethod) {
sourceObj[sourceMethod] = function() {
return targetObj[targetMethod].apply(targetObj, arguments);
};
};
var utc = {
date: d
};
// support strftime, if found
if (d.strftime != undefined)... | javascript | function makeUtcWrapper(d) {
function addProxyMethod(sourceObj, sourceMethod, targetObj, targetMethod) {
sourceObj[sourceMethod] = function() {
return targetObj[targetMethod].apply(targetObj, arguments);
};
};
var utc = {
date: d
};
// support strftime, if found
if (d.strftime != undefined)... | [
"function",
"makeUtcWrapper",
"(",
"d",
")",
"{",
"function",
"addProxyMethod",
"(",
"sourceObj",
",",
"sourceMethod",
",",
"targetObj",
",",
"targetMethod",
")",
"{",
"sourceObj",
"[",
"sourceMethod",
"]",
"=",
"function",
"(",
")",
"{",
"return",
"targetObj"... | To have a consistent view of time-based data independent of which time zone the client happens to be in we need a date-like object independent of time zones. This is done through a wrapper that only calls the UTC versions of the accessor methods. | [
"To",
"have",
"a",
"consistent",
"view",
"of",
"time",
"-",
"based",
"data",
"independent",
"of",
"which",
"time",
"zone",
"the",
"client",
"happens",
"to",
"be",
"in",
"we",
"need",
"a",
"date",
"-",
"like",
"object",
"independent",
"of",
"time",
"zones... | 3c45611cfa200e660aa497ba82d191231163487b | https://github.com/Wtower/ng-gentelella/blob/3c45611cfa200e660aa497ba82d191231163487b/build/js/index.min.js#L58475-L58504 |
40,521 | Wtower/ng-gentelella | build/js/index.min.js | dateGenerator | function dateGenerator(ts, opts) {
if (opts.timezone == "browser") {
return new Date(ts);
} else if (!opts.timezone || opts.timezone == "utc") {
return makeUtcWrapper(new Date(ts));
} else if (typeof timezoneJS != "undefined" && typeof timezoneJS.Date != "undefined") {
var d = new timezoneJS.Date();
/... | javascript | function dateGenerator(ts, opts) {
if (opts.timezone == "browser") {
return new Date(ts);
} else if (!opts.timezone || opts.timezone == "utc") {
return makeUtcWrapper(new Date(ts));
} else if (typeof timezoneJS != "undefined" && typeof timezoneJS.Date != "undefined") {
var d = new timezoneJS.Date();
/... | [
"function",
"dateGenerator",
"(",
"ts",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
".",
"timezone",
"==",
"\"browser\"",
")",
"{",
"return",
"new",
"Date",
"(",
"ts",
")",
";",
"}",
"else",
"if",
"(",
"!",
"opts",
".",
"timezone",
"||",
"opts",
".",... | select time zone strategy. This returns a date-like object tied to the desired timezone | [
"select",
"time",
"zone",
"strategy",
".",
"This",
"returns",
"a",
"date",
"-",
"like",
"object",
"tied",
"to",
"the",
"desired",
"timezone"
] | 3c45611cfa200e660aa497ba82d191231163487b | https://github.com/Wtower/ng-gentelella/blob/3c45611cfa200e660aa497ba82d191231163487b/build/js/index.min.js#L58509-L58524 |
40,522 | Wtower/ng-gentelella | build/js/index.min.js | processOptions | function processOptions(plot, options) {
if (options.series.curvedLines.active) {
plot.hooks.processDatapoints.unshift(processDatapoints);
}
} | javascript | function processOptions(plot, options) {
if (options.series.curvedLines.active) {
plot.hooks.processDatapoints.unshift(processDatapoints);
}
} | [
"function",
"processOptions",
"(",
"plot",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"series",
".",
"curvedLines",
".",
"active",
")",
"{",
"plot",
".",
"hooks",
".",
"processDatapoints",
".",
"unshift",
"(",
"processDatapoints",
")",
";",
"}",
... | if the plugin is active register processDatapoints method | [
"if",
"the",
"plugin",
"is",
"active",
"register",
"processDatapoints",
"method"
] | 3c45611cfa200e660aa497ba82d191231163487b | https://github.com/Wtower/ng-gentelella/blob/3c45611cfa200e660aa497ba82d191231163487b/build/js/index.min.js#L59678-L59682 |
40,523 | Wtower/ng-gentelella | build/js/index.min.js | processDatapoints | function processDatapoints(plot, series, datapoints) {
var nrPoints = datapoints.points.length / datapoints.pointsize;
var EPSILON = 0.005;
//detects missplaced legacy parameters (prior v1.x.x) in the options object
//this can happen if somebody upgrades to v1.x.x without adjusting the parameters or uses o... | javascript | function processDatapoints(plot, series, datapoints) {
var nrPoints = datapoints.points.length / datapoints.pointsize;
var EPSILON = 0.005;
//detects missplaced legacy parameters (prior v1.x.x) in the options object
//this can happen if somebody upgrades to v1.x.x without adjusting the parameters or uses o... | [
"function",
"processDatapoints",
"(",
"plot",
",",
"series",
",",
"datapoints",
")",
"{",
"var",
"nrPoints",
"=",
"datapoints",
".",
"points",
".",
"length",
"/",
"datapoints",
".",
"pointsize",
";",
"var",
"EPSILON",
"=",
"0.005",
";",
"//detects missplaced l... | only if the plugin is active | [
"only",
"if",
"the",
"plugin",
"is",
"active"
] | 3c45611cfa200e660aa497ba82d191231163487b | https://github.com/Wtower/ng-gentelella/blob/3c45611cfa200e660aa497ba82d191231163487b/build/js/index.min.js#L59685-L59733 |
40,524 | Localize/node-google-translate | lib/main.js | function(apiKey) {
return function(path, data, done) {
var url = apiBase + path + '?' + querystring.stringify(_.extend({ 'key': apiKey }, data));
request.get(url, globalResponseHandler({ url: url }, done));
};
} | javascript | function(apiKey) {
return function(path, data, done) {
var url = apiBase + path + '?' + querystring.stringify(_.extend({ 'key': apiKey }, data));
request.get(url, globalResponseHandler({ url: url }, done));
};
} | [
"function",
"(",
"apiKey",
")",
"{",
"return",
"function",
"(",
"path",
",",
"data",
",",
"done",
")",
"{",
"var",
"url",
"=",
"apiBase",
"+",
"path",
"+",
"'?'",
"+",
"querystring",
".",
"stringify",
"(",
"_",
".",
"extend",
"(",
"{",
"'key'",
":"... | Closure that returns a function for making a GET request to Google with an apiKey | [
"Closure",
"that",
"returns",
"a",
"function",
"for",
"making",
"a",
"GET",
"request",
"to",
"Google",
"with",
"an",
"apiKey"
] | 233e2c92556bb8ddf780fb4e66c5e879ccd74237 | https://github.com/Localize/node-google-translate/blob/233e2c92556bb8ddf780fb4e66c5e879ccd74237/lib/main.js#L19-L24 | |
40,525 | henridf/apache-spark-node | lib/as_scala.js | buffer | function buffer(arr) {
if (!Array.isArray(arr)) {
return;
}
var l = new List();
arr.forEach(function(el) {
l[syncMethodName("add")](el);
});
return convert[syncMethodName("asScalaBuffer")](l);
} | javascript | function buffer(arr) {
if (!Array.isArray(arr)) {
return;
}
var l = new List();
arr.forEach(function(el) {
l[syncMethodName("add")](el);
});
return convert[syncMethodName("asScalaBuffer")](l);
} | [
"function",
"buffer",
"(",
"arr",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"return",
";",
"}",
"var",
"l",
"=",
"new",
"List",
"(",
")",
";",
"arr",
".",
"forEach",
"(",
"function",
"(",
"el",
")",
"{",
"l... | convert a js array into a buffer | [
"convert",
"a",
"js",
"array",
"into",
"a",
"buffer"
] | 9210e1deab0f0a765f183fcf4f23a69aca14eb3a | https://github.com/henridf/apache-spark-node/blob/9210e1deab0f0a765f183fcf4f23a69aca14eb3a/lib/as_scala.js#L26-L36 |
40,526 | henridf/apache-spark-node | lib/as_scala.js | map | function map(arr) {
var hm = new HashMap();
Object.keys(arr).forEach(function(k) {
hm.put(k, arr[k]);
});
return convert[syncMethodName("asScalaMap")](hm);
} | javascript | function map(arr) {
var hm = new HashMap();
Object.keys(arr).forEach(function(k) {
hm.put(k, arr[k]);
});
return convert[syncMethodName("asScalaMap")](hm);
} | [
"function",
"map",
"(",
"arr",
")",
"{",
"var",
"hm",
"=",
"new",
"HashMap",
"(",
")",
";",
"Object",
".",
"keys",
"(",
"arr",
")",
".",
"forEach",
"(",
"function",
"(",
"k",
")",
"{",
"hm",
".",
"put",
"(",
"k",
",",
"arr",
"[",
"k",
"]",
... | convert a js object into a map | [
"convert",
"a",
"js",
"object",
"into",
"a",
"map"
] | 9210e1deab0f0a765f183fcf4f23a69aca14eb3a | https://github.com/henridf/apache-spark-node/blob/9210e1deab0f0a765f183fcf4f23a69aca14eb3a/lib/as_scala.js#L39-L45 |
40,527 | bpierre/fontello-svg | index.js | svgUrl | function svgUrl(name, collection) {
for (var i = 0, result; i < COLLECTION_FILTERS.length; i++) {
if (COLLECTION_FILTERS[i][0].test(collection)) {
result = COLLECTION_FILTERS[i][1];
collection = _.isFunction(result)? result(collection) : result;
break;
}
}
return 'https://raw.github.com/... | javascript | function svgUrl(name, collection) {
for (var i = 0, result; i < COLLECTION_FILTERS.length; i++) {
if (COLLECTION_FILTERS[i][0].test(collection)) {
result = COLLECTION_FILTERS[i][1];
collection = _.isFunction(result)? result(collection) : result;
break;
}
}
return 'https://raw.github.com/... | [
"function",
"svgUrl",
"(",
"name",
",",
"collection",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"result",
";",
"i",
"<",
"COLLECTION_FILTERS",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"COLLECTION_FILTERS",
"[",
"i",
"]",
"[",
"0",... | Returns the URL of a Fontello SVG | [
"Returns",
"the",
"URL",
"of",
"a",
"Fontello",
"SVG"
] | bced088e0aaffd0f7910ade7a0253fdae32f6518 | https://github.com/bpierre/fontello-svg/blob/bced088e0aaffd0f7910ade7a0253fdae32f6518/index.js#L21-L31 |
40,528 | bpierre/fontello-svg | index.js | createGlyph | function createGlyph(name, collection, id, colors, fileFormat) {
var glyph = Object.create(Glyph);
if (!colors) colors = { 'black': 'rgb(0,0,0)' };
if (!fileFormat) fileFormat = "{0}-{1}-{2}.svg";
if (!id) id = name;
glyph.id = id;
glyph.name = name;
glyph.collection = collection;
glyph.url = svgUrl(gly... | javascript | function createGlyph(name, collection, id, colors, fileFormat) {
var glyph = Object.create(Glyph);
if (!colors) colors = { 'black': 'rgb(0,0,0)' };
if (!fileFormat) fileFormat = "{0}-{1}-{2}.svg";
if (!id) id = name;
glyph.id = id;
glyph.name = name;
glyph.collection = collection;
glyph.url = svgUrl(gly... | [
"function",
"createGlyph",
"(",
"name",
",",
"collection",
",",
"id",
",",
"colors",
",",
"fileFormat",
")",
"{",
"var",
"glyph",
"=",
"Object",
".",
"create",
"(",
"Glyph",
")",
";",
"if",
"(",
"!",
"colors",
")",
"colors",
"=",
"{",
"'black'",
":",... | Creates and returns a Glyph instance | [
"Creates",
"and",
"returns",
"a",
"Glyph",
"instance"
] | bced088e0aaffd0f7910ade7a0253fdae32f6518 | https://github.com/bpierre/fontello-svg/blob/bced088e0aaffd0f7910ade7a0253fdae32f6518/index.js#L77-L90 |
40,529 | bpierre/fontello-svg | index.js | glyphCreator | function glyphCreator() {
var unique = nodupes();
return function(name, collection, colors) {
return createGlyph(name, collection, unique(name), colors);
};
} | javascript | function glyphCreator() {
var unique = nodupes();
return function(name, collection, colors) {
return createGlyph(name, collection, unique(name), colors);
};
} | [
"function",
"glyphCreator",
"(",
")",
"{",
"var",
"unique",
"=",
"nodupes",
"(",
")",
";",
"return",
"function",
"(",
"name",
",",
"collection",
",",
"colors",
")",
"{",
"return",
"createGlyph",
"(",
"name",
",",
"collection",
",",
"unique",
"(",
"name",... | Returns a function to create glyphs and incrementing their IDs as needed. | [
"Returns",
"a",
"function",
"to",
"create",
"glyphs",
"and",
"incrementing",
"their",
"IDs",
"as",
"needed",
"."
] | bced088e0aaffd0f7910ade7a0253fdae32f6518 | https://github.com/bpierre/fontello-svg/blob/bced088e0aaffd0f7910ade7a0253fdae32f6518/index.js#L93-L98 |
40,530 | bpierre/fontello-svg | index.js | allGlyphs | function allGlyphs(rawGlyphs, colors, fileFormat) {
var unique = nodupes();
rawGlyphs = fixNames(rawGlyphs);
return rawGlyphs.map(function(rawGlyph) {
var name = rawGlyph.css;
var collection = rawGlyph.src;
return createGlyph(name, collection, unique(name), colors, fileFormat);
});
} | javascript | function allGlyphs(rawGlyphs, colors, fileFormat) {
var unique = nodupes();
rawGlyphs = fixNames(rawGlyphs);
return rawGlyphs.map(function(rawGlyph) {
var name = rawGlyph.css;
var collection = rawGlyph.src;
return createGlyph(name, collection, unique(name), colors, fileFormat);
});
} | [
"function",
"allGlyphs",
"(",
"rawGlyphs",
",",
"colors",
",",
"fileFormat",
")",
"{",
"var",
"unique",
"=",
"nodupes",
"(",
")",
";",
"rawGlyphs",
"=",
"fixNames",
"(",
"rawGlyphs",
")",
";",
"return",
"rawGlyphs",
".",
"map",
"(",
"function",
"(",
"raw... | Creates and returns all Glyphs from a rawGlyphs list | [
"Creates",
"and",
"returns",
"all",
"Glyphs",
"from",
"a",
"rawGlyphs",
"list"
] | bced088e0aaffd0f7910ade7a0253fdae32f6518 | https://github.com/bpierre/fontello-svg/blob/bced088e0aaffd0f7910ade7a0253fdae32f6518/index.js#L124-L132 |
40,531 | bpierre/fontello-svg | index.js | missingGlyphs | function missingGlyphs(glyphs, svgDir, cb) {
async.reject(glyphs, function(glyph, cb) {
var filenames = glyph.filenames().map(function(filename) {
return svgDir + '/' + filename;
});
async.every(filenames, fs.exists, cb);
}, cb);
} | javascript | function missingGlyphs(glyphs, svgDir, cb) {
async.reject(glyphs, function(glyph, cb) {
var filenames = glyph.filenames().map(function(filename) {
return svgDir + '/' + filename;
});
async.every(filenames, fs.exists, cb);
}, cb);
} | [
"function",
"missingGlyphs",
"(",
"glyphs",
",",
"svgDir",
",",
"cb",
")",
"{",
"async",
".",
"reject",
"(",
"glyphs",
",",
"function",
"(",
"glyph",
",",
"cb",
")",
"{",
"var",
"filenames",
"=",
"glyph",
".",
"filenames",
"(",
")",
".",
"map",
"(",
... | Filters all glyphs to returns only the ones missing on the FS | [
"Filters",
"all",
"glyphs",
"to",
"returns",
"only",
"the",
"ones",
"missing",
"on",
"the",
"FS"
] | bced088e0aaffd0f7910ade7a0253fdae32f6518 | https://github.com/bpierre/fontello-svg/blob/bced088e0aaffd0f7910ade7a0253fdae32f6518/index.js#L135-L142 |
40,532 | alexbardas/bignumber.js | big-number.js | BigNumber | function BigNumber(initialNumber) {
var index;
if (!(this instanceof BigNumber)) {
return new BigNumber(initialNumber);
}
this.number = [];
this.sign = 1;
this.rest = 0;
// The initial number can be an array, string, number of another big number
... | javascript | function BigNumber(initialNumber) {
var index;
if (!(this instanceof BigNumber)) {
return new BigNumber(initialNumber);
}
this.number = [];
this.sign = 1;
this.rest = 0;
// The initial number can be an array, string, number of another big number
... | [
"function",
"BigNumber",
"(",
"initialNumber",
")",
"{",
"var",
"index",
";",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"BigNumber",
")",
")",
"{",
"return",
"new",
"BigNumber",
"(",
"initialNumber",
")",
";",
"}",
"this",
".",
"number",
"=",
"[",
"]"... | Constructor function which creates a new BigNumber object from an integer, a string, an array or other BigNumber object | [
"Constructor",
"function",
"which",
"creates",
"a",
"new",
"BigNumber",
"object",
"from",
"an",
"integer",
"a",
"string",
"an",
"array",
"or",
"other",
"BigNumber",
"object"
] | a17195f2cb49bcd86ebaaf8f161a03e82b94d6fc | https://github.com/alexbardas/bignumber.js/blob/a17195f2cb49bcd86ebaaf8f161a03e82b94d6fc/big-number.js#L53-L98 |
40,533 | lorenwest/monitor-dashboard | lib/js/Page.js | function(viewClass) {
var t = this,
newIdNum = 1,
components = t.get('components'),
classParts = viewClass.split('.'),
appName = classParts[0],
appView = classParts[1];
// Instantiate and add the component
var component = new Component({
id: M... | javascript | function(viewClass) {
var t = this,
newIdNum = 1,
components = t.get('components'),
classParts = viewClass.split('.'),
appName = classParts[0],
appView = classParts[1];
// Instantiate and add the component
var component = new Component({
id: M... | [
"function",
"(",
"viewClass",
")",
"{",
"var",
"t",
"=",
"this",
",",
"newIdNum",
"=",
"1",
",",
"components",
"=",
"t",
".",
"get",
"(",
"'components'",
")",
",",
"classParts",
"=",
"viewClass",
".",
"split",
"(",
"'.'",
")",
",",
"appName",
"=",
... | Add a new component to the Page model by component class
This uses the default component attributes
@method addComponent
@param viewClass - Class name for the main view in the component
@return component - The newly instantiated component | [
"Add",
"a",
"new",
"component",
"to",
"the",
"Page",
"model",
"by",
"component",
"class"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Page.js#L59-L78 | |
40,534 | lorenwest/monitor-dashboard | lib/js/Page.js | function(options) {
var t = this,
opts = _.extend({trim:true, deep:true}, options),
raw = Backbone.Model.prototype.toJSON.call(t, opts);
return raw;
} | javascript | function(options) {
var t = this,
opts = _.extend({trim:true, deep:true}, options),
raw = Backbone.Model.prototype.toJSON.call(t, opts);
return raw;
} | [
"function",
"(",
"options",
")",
"{",
"var",
"t",
"=",
"this",
",",
"opts",
"=",
"_",
".",
"extend",
"(",
"{",
"trim",
":",
"true",
",",
"deep",
":",
"true",
"}",
",",
"options",
")",
",",
"raw",
"=",
"Backbone",
".",
"Model",
".",
"prototype",
... | Overridden to override some options | [
"Overridden",
"to",
"override",
"some",
"options"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Page.js#L81-L86 | |
40,535 | lorenwest/monitor-dashboard | lib/js/ComponentSettingsView.js | function() {
var t = this;
t.$el.append(template.apply({}));
t.editor = t.$('.nm-cs-source-edit');
t.sourceButton = t.$('.nm-cs-view-source');
// Get bindings to 'name=' attributes before custom views are rendered
t.componentBindings = Backbone.ModelBinder.createDefaultBindings(t.$... | javascript | function() {
var t = this;
t.$el.append(template.apply({}));
t.editor = t.$('.nm-cs-source-edit');
t.sourceButton = t.$('.nm-cs-view-source');
// Get bindings to 'name=' attributes before custom views are rendered
t.componentBindings = Backbone.ModelBinder.createDefaultBindings(t.$... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"t",
".",
"$el",
".",
"append",
"(",
"template",
".",
"apply",
"(",
"{",
"}",
")",
")",
";",
"t",
".",
"editor",
"=",
"t",
".",
"$",
"(",
"'.nm-cs-source-edit'",
")",
";",
"t",
".",
"so... | This is called once after construction to render the components onto the screen. The components change their value when the data model changes. | [
"This",
"is",
"called",
"once",
"after",
"construction",
"to",
"render",
"the",
"components",
"onto",
"the",
"screen",
".",
"The",
"components",
"change",
"their",
"value",
"when",
"the",
"data",
"model",
"changes",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentSettingsView.js#L58-L67 | |
40,536 | lorenwest/monitor-dashboard | lib/js/ComponentSettingsView.js | function(model, componentView, customView) {
var t = this,
componentPane = t.$('.nm-cs-component');
// Remember the model state on entry
t.model = model;
t.componentView = componentView;
t.monitor = model.get('monitor');
t.originalModel = t.model.toJSON({trim:false});
... | javascript | function(model, componentView, customView) {
var t = this,
componentPane = t.$('.nm-cs-component');
// Remember the model state on entry
t.model = model;
t.componentView = componentView;
t.monitor = model.get('monitor');
t.originalModel = t.model.toJSON({trim:false});
... | [
"function",
"(",
"model",
",",
"componentView",
",",
"customView",
")",
"{",
"var",
"t",
"=",
"this",
",",
"componentPane",
"=",
"t",
".",
"$",
"(",
"'.nm-cs-component'",
")",
";",
"// Remember the model state on entry",
"t",
".",
"model",
"=",
"model",
";",... | Set the specified data model into the component, specifying any custom component settings view | [
"Set",
"the",
"specified",
"data",
"model",
"into",
"the",
"component",
"specifying",
"any",
"custom",
"component",
"settings",
"view"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentSettingsView.js#L71-L139 | |
40,537 | lorenwest/monitor-dashboard | lib/js/ComponentSettingsView.js | function(e) {
var t = this;
// Make view options changes immediately on keydown
// Note: Don't be so aggressive with monitor initParams, because that
// could result in backend round-trips for each keystroke.
setTimeout(function(){
t.viewOptionBinder._onElChanged(e);
},0);
... | javascript | function(e) {
var t = this;
// Make view options changes immediately on keydown
// Note: Don't be so aggressive with monitor initParams, because that
// could result in backend round-trips for each keystroke.
setTimeout(function(){
t.viewOptionBinder._onElChanged(e);
},0);
... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Make view options changes immediately on keydown",
"// Note: Don't be so aggressive with monitor initParams, because that",
"// could result in backend round-trips for each keystroke.",
"setTimeout",
"(",
"function",
"... | Detect changes on keydown - after the value has been set | [
"Detect",
"changes",
"on",
"keydown",
"-",
"after",
"the",
"value",
"has",
"been",
"set"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentSettingsView.js#L146-L158 | |
40,538 | lorenwest/monitor-dashboard | lib/js/ComponentSettingsView.js | function() {
var t = this;
// Add the component to the model, then to the page view
var copy = t.model.toJSON();
delete copy.id;
var component = t.pageView.model.addComponent(copy.viewClass);
component.set(copy);
// Position the component on top left
var cv = t.pageView... | javascript | function() {
var t = this;
// Add the component to the model, then to the page view
var copy = t.model.toJSON();
delete copy.id;
var component = t.pageView.model.addComponent(copy.viewClass);
component.set(copy);
// Position the component on top left
var cv = t.pageView... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Add the component to the model, then to the page view",
"var",
"copy",
"=",
"t",
".",
"model",
".",
"toJSON",
"(",
")",
";",
"delete",
"copy",
".",
"id",
";",
"var",
"component",
"=",
"t",
".",
... | Copy the component | [
"Copy",
"the",
"component"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentSettingsView.js#L161-L179 | |
40,539 | lorenwest/monitor-dashboard | lib/js/AppTemplate.js | function(dirpath, file) {
var templateFile = Path.join(__dirname, '../template/app', dirpath, file),
outputFile = Path.join(appPath, dirpath, file);
try {
var template = new Template({text: FS.readFileSync(templateFile).toString(), watchFile:false});
FS.writeFileSync(outputFile, template.app... | javascript | function(dirpath, file) {
var templateFile = Path.join(__dirname, '../template/app', dirpath, file),
outputFile = Path.join(appPath, dirpath, file);
try {
var template = new Template({text: FS.readFileSync(templateFile).toString(), watchFile:false});
FS.writeFileSync(outputFile, template.app... | [
"function",
"(",
"dirpath",
",",
"file",
")",
"{",
"var",
"templateFile",
"=",
"Path",
".",
"join",
"(",
"__dirname",
",",
"'../template/app'",
",",
"dirpath",
",",
"file",
")",
",",
"outputFile",
"=",
"Path",
".",
"join",
"(",
"appPath",
",",
"dirpath",... | Output the specified file from the template directory | [
"Output",
"the",
"specified",
"file",
"from",
"the",
"template",
"directory"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/AppTemplate.js#L61-L71 | |
40,540 | lorenwest/monitor-dashboard | lib/js/AppTemplate.js | function(dirpath) {
try {
// Make the directory under the app
if (dirpath !== '/') {
FS.mkdirSync(Path.join('.', appPath, dirpath));
}
// Read the template directory
var templateDir = Path.join(__dirname, '../template/app', dirpath);
var files = FS.readdirSync(templateD... | javascript | function(dirpath) {
try {
// Make the directory under the app
if (dirpath !== '/') {
FS.mkdirSync(Path.join('.', appPath, dirpath));
}
// Read the template directory
var templateDir = Path.join(__dirname, '../template/app', dirpath);
var files = FS.readdirSync(templateD... | [
"function",
"(",
"dirpath",
")",
"{",
"try",
"{",
"// Make the directory under the app",
"if",
"(",
"dirpath",
"!==",
"'/'",
")",
"{",
"FS",
".",
"mkdirSync",
"(",
"Path",
".",
"join",
"(",
"'.'",
",",
"appPath",
",",
"dirpath",
")",
")",
";",
"}",
"//... | Traverse the app template directory, outputting all files | [
"Traverse",
"the",
"app",
"template",
"directory",
"outputting",
"all",
"files"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/AppTemplate.js#L74-L101 | |
40,541 | nullobject/jsdoc-react | src/publish.js | buildClasses | function buildClasses (db) {
const classes = data.findClasses(db).order('name')
return classes.map(function (klass) {
const fns = data
.findChildFunctions(db, [klass])
.order('name')
.map(copyFunction)
return copyClass(klass, fns)
})
} | javascript | function buildClasses (db) {
const classes = data.findClasses(db).order('name')
return classes.map(function (klass) {
const fns = data
.findChildFunctions(db, [klass])
.order('name')
.map(copyFunction)
return copyClass(klass, fns)
})
} | [
"function",
"buildClasses",
"(",
"db",
")",
"{",
"const",
"classes",
"=",
"data",
".",
"findClasses",
"(",
"db",
")",
".",
"order",
"(",
"'name'",
")",
"return",
"classes",
".",
"map",
"(",
"function",
"(",
"klass",
")",
"{",
"const",
"fns",
"=",
"da... | Builds the classes from the database object `db`. | [
"Builds",
"the",
"classes",
"from",
"the",
"database",
"object",
"db",
"."
] | 4db6650a8f20c49c9ab1fe03bfaaeae65356c8f0 | https://github.com/nullobject/jsdoc-react/blob/4db6650a8f20c49c9ab1fe03bfaaeae65356c8f0/src/publish.js#L62-L73 |
40,542 | lorenwest/monitor-dashboard | lib/js/PagesProbe.js | function() {
var t = this;
if (t.dirWatcher) {
t.dirWatcher.close();
t.dirWatcher = null;
}
for (var pageId in t.fileWatchers) {
t.fileWatchers[pageId].close();
}
t.fileWatchers = {};
} | javascript | function() {
var t = this;
if (t.dirWatcher) {
t.dirWatcher.close();
t.dirWatcher = null;
}
for (var pageId in t.fileWatchers) {
t.fileWatchers[pageId].close();
}
t.fileWatchers = {};
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"if",
"(",
"t",
".",
"dirWatcher",
")",
"{",
"t",
".",
"dirWatcher",
".",
"close",
"(",
")",
";",
"t",
".",
"dirWatcher",
"=",
"null",
";",
"}",
"for",
"(",
"var",
"pageId",
"in",
"t",
... | Release probe resources | [
"Release",
"probe",
"resources"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PagesProbe.js#L125-L135 | |
40,543 | lorenwest/monitor-dashboard | lib/js/PagesProbe.js | function(dirs, callback) {
var t = this,
numLeft = dirs.length,
fileRegexp = /.json$/,
trimmed = [];
// Already trimmed
if (numLeft === 0) {
return callback(null, dirs);
}
// Process each directory
dirs.forEach(function(dir) {
t.hasCont... | javascript | function(dirs, callback) {
var t = this,
numLeft = dirs.length,
fileRegexp = /.json$/,
trimmed = [];
// Already trimmed
if (numLeft === 0) {
return callback(null, dirs);
}
// Process each directory
dirs.forEach(function(dir) {
t.hasCont... | [
"function",
"(",
"dirs",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"numLeft",
"=",
"dirs",
".",
"length",
",",
"fileRegexp",
"=",
"/",
".json$",
"/",
",",
"trimmed",
"=",
"[",
"]",
";",
"// Already trimmed",
"if",
"(",
"numLeft",
"==="... | Trim directories that have no content
This accepts an array of objects, where each object must have a 'path' element.
If no content is at the path, the object will be trimmed from the array.
The path element will be removed after checking.
@method trimDirs
@param dirs {Object} An object that contains a 'path' elemen... | [
"Trim",
"directories",
"that",
"have",
"no",
"content"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PagesProbe.js#L273-L300 | |
40,544 | lorenwest/monitor-dashboard | lib/js/PagesProbe.js | function(dirname, fileRegexp, callback) {
var t = this;
// Get the directory at this level
FS.readdir(dirname, function(error, fileNames) {
// Process errors
if (error) {
console.error('Read dir error', error);
return callback(error);
}
// Process... | javascript | function(dirname, fileRegexp, callback) {
var t = this;
// Get the directory at this level
FS.readdir(dirname, function(error, fileNames) {
// Process errors
if (error) {
console.error('Read dir error', error);
return callback(error);
}
// Process... | [
"function",
"(",
"dirname",
",",
"fileRegexp",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Get the directory at this level",
"FS",
".",
"readdir",
"(",
"dirname",
",",
"function",
"(",
"error",
",",
"fileNames",
")",
"{",
"// Process errors",
... | Determine if a directory has any contents.
This will return true if any sub-directories with contents exist, or
if any files with the specified RegExp exist.
@method hasContents
@param dirname {Path} Full path to the directory
@param fileRegexp {RegExp} Regular expression to test for files
@param callback {function(e... | [
"Determine",
"if",
"a",
"directory",
"has",
"any",
"contents",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PagesProbe.js#L314-L369 | |
40,545 | lorenwest/monitor-dashboard | lib/js/PagesProbe.js | function(fileNames, callback) {
var t = this,
stats = [],
didError = false,
numLeft = fileNames.length;
// No files to process
if (fileNames.length === 0) {
return callback(null, stats);
}
// Call stat on each file
fileNames.forEach(function(fi... | javascript | function(fileNames, callback) {
var t = this,
stats = [],
didError = false,
numLeft = fileNames.length;
// No files to process
if (fileNames.length === 0) {
return callback(null, stats);
}
// Call stat on each file
fileNames.forEach(function(fi... | [
"function",
"(",
"fileNames",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"stats",
"=",
"[",
"]",
",",
"didError",
"=",
"false",
",",
"numLeft",
"=",
"fileNames",
".",
"length",
";",
"// No files to process",
"if",
"(",
"fileNames",
".",
"... | Stat all the files, returning an array of file stats matching the
array of input files.
@method statFiles
@param fileNames {Array} An array of filenames to stat (from this directory)
@param callback {Function(error, stats)}
@param callback.error {Mixed} Set if an error occured
@param callback.stats {Array of Stat} An ... | [
"Stat",
"all",
"the",
"files",
"returning",
"an",
"array",
"of",
"file",
"stats",
"matching",
"the",
"array",
"of",
"input",
"files",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PagesProbe.js#L381-L418 | |
40,546 | lorenwest/monitor-dashboard | lib/js/TreeView.js | function() {
var t = this,
branches = t.model.get('branches'),
leaves = t.model.get('leaves'),
hash = "";
// The hash is the text of the branches & leaves
branches && branches.forEach(function(node) {
var label = node.get('label') || node.id,
descript... | javascript | function() {
var t = this,
branches = t.model.get('branches'),
leaves = t.model.get('leaves'),
hash = "";
// The hash is the text of the branches & leaves
branches && branches.forEach(function(node) {
var label = node.get('label') || node.id,
descript... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"branches",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'branches'",
")",
",",
"leaves",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'leaves'",
")",
",",
"hash",
"=",
"\"\"",
";",
"// The hash ... | Return a hash code representing the visual state of the underlying data model. This is compared with subsequent states to prevent too much re-rendering. | [
"Return",
"a",
"hash",
"code",
"representing",
"the",
"visual",
"state",
"of",
"the",
"underlying",
"data",
"model",
".",
"This",
"is",
"compared",
"with",
"subsequent",
"states",
"to",
"prevent",
"too",
"much",
"re",
"-",
"rendering",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TreeView.js#L194-L222 | |
40,547 | lorenwest/monitor-dashboard | lib/js/TreeView.js | function() {
var t = this,
branches = t.model.get('branches'),
leaves = t.model.get('leaves');
// Determine if we should connect a monitor to this node
//
// Connect a monitor if:
// * There isn't one already connected, and
// * There's a monitor definition avail... | javascript | function() {
var t = this,
branches = t.model.get('branches'),
leaves = t.model.get('leaves');
// Determine if we should connect a monitor to this node
//
// Connect a monitor if:
// * There isn't one already connected, and
// * There's a monitor definition avail... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"branches",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'branches'",
")",
",",
"leaves",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'leaves'",
")",
";",
"// Determine if we should connect a monitor to... | Determine if we should connect a monitor to the node, and connect if necessary. | [
"Determine",
"if",
"we",
"should",
"connect",
"a",
"monitor",
"to",
"the",
"node",
"and",
"connect",
"if",
"necessary",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TreeView.js#L226-L302 | |
40,548 | lorenwest/monitor-dashboard | lib/js/SettingsView.js | function() {
var t = this,
json = t.model.toJSON({trim:false});
t.sourceView.model = json;
t.sourceView.setData();
t.editor.val(JSON.stringify(json, null, 2));
} | javascript | function() {
var t = this,
json = t.model.toJSON({trim:false});
t.sourceView.model = json;
t.sourceView.setData();
t.editor.val(JSON.stringify(json, null, 2));
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"json",
"=",
"t",
".",
"model",
".",
"toJSON",
"(",
"{",
"trim",
":",
"false",
"}",
")",
";",
"t",
".",
"sourceView",
".",
"model",
"=",
"json",
";",
"t",
".",
"sourceView",
".",
"setData... | Fill the view-source and edit-source editors | [
"Fill",
"the",
"view",
"-",
"source",
"and",
"edit",
"-",
"source",
"editors"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SettingsView.js#L123-L129 | |
40,549 | lorenwest/monitor-dashboard | lib/js/Server.js | function(params, options) {
var t = this,
port = t.get('port'),
server = t.get('server'),
templates = t.get('templates'),
siteDbPath = t.get('siteDbPath'),
parentPath = siteDbPath.indexOf('.') === 0 ? process.cwd() : '';
// Distribute the site path to probe... | javascript | function(params, options) {
var t = this,
port = t.get('port'),
server = t.get('server'),
templates = t.get('templates'),
siteDbPath = t.get('siteDbPath'),
parentPath = siteDbPath.indexOf('.') === 0 ? process.cwd() : '';
// Distribute the site path to probe... | [
"function",
"(",
"params",
",",
"options",
")",
"{",
"var",
"t",
"=",
"this",
",",
"port",
"=",
"t",
".",
"get",
"(",
"'port'",
")",
",",
"server",
"=",
"t",
".",
"get",
"(",
"'server'",
")",
",",
"templates",
"=",
"t",
".",
"get",
"(",
"'templ... | Initialize the server | [
"Initialize",
"the",
"server"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L70-L127 | |
40,550 | lorenwest/monitor-dashboard | lib/js/Server.js | function(request, response, next) {
var t = this;
// URL rewrites
var url = URL.resolve('', request.url);
if (url === '/favicon.ico') {
var faviconUrl = t.site.get('favicon');
url = request.url = faviconUrl || request.url;
}
// Remove the leading slash for page mani... | javascript | function(request, response, next) {
var t = this;
// URL rewrites
var url = URL.resolve('', request.url);
if (url === '/favicon.ico') {
var faviconUrl = t.site.get('favicon');
url = request.url = faviconUrl || request.url;
}
// Remove the leading slash for page mani... | [
"function",
"(",
"request",
",",
"response",
",",
"next",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// URL rewrites",
"var",
"url",
"=",
"URL",
".",
"resolve",
"(",
"''",
",",
"request",
".",
"url",
")",
";",
"if",
"(",
"url",
"===",
"'/favicon.ico'",... | Internal route for all non-static site endpoints
@method siteRoute
@param request {Connect.Request} The http request object
@param response {Connect.Response} The http response object
@param next {Function()} Function to pass control if this doesn't handle the url. | [
"Internal",
"route",
"for",
"all",
"non",
"-",
"static",
"site",
"endpoints"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L137-L193 | |
40,551 | lorenwest/monitor-dashboard | lib/js/Server.js | function(request, response, next) {
var t = this,
url = request.url,
searchStart = url.indexOf('?'),
templates = t.get('templates');
// Remove any URL params
if (searchStart > 0) {
url = url.substr(0, searchStart);
}
// Get the page model
t._ge... | javascript | function(request, response, next) {
var t = this,
url = request.url,
searchStart = url.indexOf('?'),
templates = t.get('templates');
// Remove any URL params
if (searchStart > 0) {
url = url.substr(0, searchStart);
}
// Get the page model
t._ge... | [
"function",
"(",
"request",
",",
"response",
",",
"next",
")",
"{",
"var",
"t",
"=",
"this",
",",
"url",
"=",
"request",
".",
"url",
",",
"searchStart",
"=",
"url",
".",
"indexOf",
"(",
"'?'",
")",
",",
"templates",
"=",
"t",
".",
"get",
"(",
"'t... | Route to a monitor page.
@protected
@method _monitorPageRoute
@param request {Connect.Request} The http request object
@param response {Connect.Response} The http response object
@param next {Function()} Function to pass control if this doesn't handle the url. | [
"Route",
"to",
"a",
"monitor",
"page",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L204-L241 | |
40,552 | lorenwest/monitor-dashboard | lib/js/Server.js | function(url, callback) {
var t = this,
originalUrl = url,
page = null;
// Change urls that end in / to /index
if (url.substr(-1) === '/') {
url = url + 'index';
}
// Return if it's in cache
page = pageCache.get(url);
if (page) {
return cal... | javascript | function(url, callback) {
var t = this,
originalUrl = url,
page = null;
// Change urls that end in / to /index
if (url.substr(-1) === '/') {
url = url + 'index';
}
// Return if it's in cache
page = pageCache.get(url);
if (page) {
return cal... | [
"function",
"(",
"url",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"originalUrl",
"=",
"url",
",",
"page",
"=",
"null",
";",
"// Change urls that end in / to /index",
"if",
"(",
"url",
".",
"substr",
"(",
"-",
"1",
")",
"===",
"'/'",
")",... | Get the specified page from cache
This retrieves the page from cache, or puts it there.
@method _getPage
@param url {url} URL to the page
@param callback {function(error, pageModel)} Called when complete | [
"Get",
"the",
"specified",
"page",
"from",
"cache"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L252-L319 | |
40,553 | lorenwest/monitor-dashboard | lib/js/Server.js | function(callback) {
callback = callback || function(){};
var t = this,
server = t.get('server'),
port = t.get('port'),
allowExternalConnections = t.get('allowExternalConnections');
// Allow connections from INADDR_ANY or LOCALHOST only
var host = allowExternalConn... | javascript | function(callback) {
callback = callback || function(){};
var t = this,
server = t.get('server'),
port = t.get('port'),
allowExternalConnections = t.get('allowExternalConnections');
// Allow connections from INADDR_ANY or LOCALHOST only
var host = allowExternalConn... | [
"function",
"(",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"server",
"=",
"t",
".",
"get",
"(",
"'server'",
")",
",",
"port",
"=",
"t",
".",
"get",
"(",
"'port'",
... | Start the UI server
This method starts listening for incoming UI requests.
@method start
@param [callback] {Function(error)} - Called when the server has started
The server has started
This event is fired when the server has begun listening for incoming
web requests.
@event start
A client error has been detecte... | [
"Start",
"the",
"UI",
"server"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L345-L393 | |
40,554 | lorenwest/monitor-dashboard | lib/js/Server.js | function() {
var t = this;
// Test an app directory to see if it's a monitor app
var testAppDir = function(dir) {
// Load the package.json if it exists (and remove relative refs)
var pkg;
dir = Path.resolve(dir);
try {
pkg = JSON.parse(FS.readFileSync(dir + ... | javascript | function() {
var t = this;
// Test an app directory to see if it's a monitor app
var testAppDir = function(dir) {
// Load the package.json if it exists (and remove relative refs)
var pkg;
dir = Path.resolve(dir);
try {
pkg = JSON.parse(FS.readFileSync(dir + ... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Test an app directory to see if it's a monitor app",
"var",
"testAppDir",
"=",
"function",
"(",
"dir",
")",
"{",
"// Load the package.json if it exists (and remove relative refs)",
"var",
"pkg",
";",
"dir",
"=... | Discover and load all node_monitor application modules
This is designed to run during server initialization, and is synchronous.
@method loadApps | [
"Discover",
"and",
"load",
"all",
"node_monitor",
"application",
"modules"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L430-L488 | |
40,555 | lorenwest/monitor-dashboard | lib/js/Server.js | function(dir) {
// Load the package.json if it exists (and remove relative refs)
var pkg;
dir = Path.resolve(dir);
try {
pkg = JSON.parse(FS.readFileSync(dir + '/package.json', 'utf-8'));
} catch (e) {
// Report an error if the package.json has a parse proble... | javascript | function(dir) {
// Load the package.json if it exists (and remove relative refs)
var pkg;
dir = Path.resolve(dir);
try {
pkg = JSON.parse(FS.readFileSync(dir + '/package.json', 'utf-8'));
} catch (e) {
// Report an error if the package.json has a parse proble... | [
"function",
"(",
"dir",
")",
"{",
"// Load the package.json if it exists (and remove relative refs)",
"var",
"pkg",
";",
"dir",
"=",
"Path",
".",
"resolve",
"(",
"dir",
")",
";",
"try",
"{",
"pkg",
"=",
"JSON",
".",
"parse",
"(",
"FS",
".",
"readFileSync",
"... | Test an app directory to see if it's a monitor app | [
"Test",
"an",
"app",
"directory",
"to",
"see",
"if",
"it",
"s",
"a",
"monitor",
"app"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L434-L458 | |
40,556 | lorenwest/monitor-dashboard | lib/js/Server.js | function(dir) {
// Return if the node_modules directory doesn't exist.
try {
FS.statSync(dir);
} catch (e) {return;}
// Check each direcory for a monitor-dashboard app
FS.readdirSync(dir).forEach(function(moduleName) {
// See if this is a monitor app, and l... | javascript | function(dir) {
// Return if the node_modules directory doesn't exist.
try {
FS.statSync(dir);
} catch (e) {return;}
// Check each direcory for a monitor-dashboard app
FS.readdirSync(dir).forEach(function(moduleName) {
// See if this is a monitor app, and l... | [
"function",
"(",
"dir",
")",
"{",
"// Return if the node_modules directory doesn't exist.",
"try",
"{",
"FS",
".",
"statSync",
"(",
"dir",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
";",
"}",
"// Check each direcory for a monitor-dashboard app",
"FS",
"... | Process all apps under a node_modules directory | [
"Process",
"all",
"apps",
"under",
"a",
"node_modules",
"directory"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L461-L480 | |
40,557 | lorenwest/monitor-dashboard | lib/js/Server.js | function(callback) {
var t = this, server = t.get('server');
callback = callback || function(){};
// Unwatch all template files
t.get('templates').forEach(function(template) {
template.unWatchFile();
});
// Don't stop more than once.
if (!t.isListening) {
retu... | javascript | function(callback) {
var t = this, server = t.get('server');
callback = callback || function(){};
// Unwatch all template files
t.get('templates').forEach(function(template) {
template.unWatchFile();
});
// Don't stop more than once.
if (!t.isListening) {
retu... | [
"function",
"(",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"server",
"=",
"t",
".",
"get",
"(",
"'server'",
")",
";",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"// Unwatch all template files",
"t",
".",
"get",
... | Stop processing inbound web and monitor traffic
This method stops accepting new inbound monitor connections, and closes
all existing monitor connections associated with the server.
@method stop
@param callback {Function(error)} - Called when the server has stopped
The server has stopped
This event is fired after t... | [
"Stop",
"processing",
"inbound",
"web",
"and",
"monitor",
"traffic"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Server.js#L653-L679 | |
40,558 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function() {
var t = this;
t.$el.append(template.apply({}));
t.dialog = t.$('.modal');
// Build the tour tree view
t.tv = new UI.TreeView({
preFetch: true,
monitorParams: {probeClass: 'ToursProbe'}
});
t.tv.render().appendTo(t.$('.nm-tsv-tree'));
// Sele... | javascript | function() {
var t = this;
t.$el.append(template.apply({}));
t.dialog = t.$('.modal');
// Build the tour tree view
t.tv = new UI.TreeView({
preFetch: true,
monitorParams: {probeClass: 'ToursProbe'}
});
t.tv.render().appendTo(t.$('.nm-tsv-tree'));
// Sele... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"t",
".",
"$el",
".",
"append",
"(",
"template",
".",
"apply",
"(",
"{",
"}",
")",
")",
";",
"t",
".",
"dialog",
"=",
"t",
".",
"$",
"(",
"'.modal'",
")",
";",
"// Build the tour tree view"... | This is called once after construction to render the components onto the screen. | [
"This",
"is",
"called",
"once",
"after",
"construction",
"to",
"render",
"the",
"components",
"onto",
"the",
"screen",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L52-L73 | |
40,559 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function(e) {
var t = this,
item = $(e.currentTarget),
path = item.attr('data-path');
t.showTour(path);
} | javascript | function(e) {
var t = this,
item = $(e.currentTarget),
path = item.attr('data-path');
t.showTour(path);
} | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
",",
"item",
"=",
"$",
"(",
"e",
".",
"currentTarget",
")",
",",
"path",
"=",
"item",
".",
"attr",
"(",
"'data-path'",
")",
";",
"t",
".",
"showTour",
"(",
"path",
")",
";",
"}"
] | Process a tour selection | [
"Process",
"a",
"tour",
"selection"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L76-L81 | |
40,560 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function() {
var t = this;
// Set the current tour pages
t.pages = t.tour.get('pages');
// Tour fields
t.$('.nm-tsv-id').val(t.tour.get('id'));
t.$('.nm-tsv-title').val(t.tour.get('title'));
t.$('.nm-tsv-description').val(t.tour.get('description'));
t.$('.nm-tsv-auto-ne... | javascript | function() {
var t = this;
// Set the current tour pages
t.pages = t.tour.get('pages');
// Tour fields
t.$('.nm-tsv-id').val(t.tour.get('id'));
t.$('.nm-tsv-title').val(t.tour.get('title'));
t.$('.nm-tsv-description').val(t.tour.get('description'));
t.$('.nm-tsv-auto-ne... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Set the current tour pages",
"t",
".",
"pages",
"=",
"t",
".",
"tour",
".",
"get",
"(",
"'pages'",
")",
";",
"// Tour fields",
"t",
".",
"$",
"(",
"'.nm-tsv-id'",
")",
".",
"val",
"(",
"t",... | Send data to the form | [
"Send",
"data",
"to",
"the",
"form"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L113-L137 | |
40,561 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function() {
var t = this;
// Show the modal dialog
t.dialog.centerBox().css({top:40}).modal('show');
// Set the cursor when the dialog fades in
setTimeout(function(){
t.$('.nm-tsv-title').focus();
}, 500);
} | javascript | function() {
var t = this;
// Show the modal dialog
t.dialog.centerBox().css({top:40}).modal('show');
// Set the cursor when the dialog fades in
setTimeout(function(){
t.$('.nm-tsv-title').focus();
}, 500);
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Show the modal dialog",
"t",
".",
"dialog",
".",
"centerBox",
"(",
")",
".",
"css",
"(",
"{",
"top",
":",
"40",
"}",
")",
".",
"modal",
"(",
"'show'",
")",
";",
"// Set the cursor when the di... | Called when the dialog is opened | [
"Called",
"when",
"the",
"dialog",
"is",
"opened"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L140-L150 | |
40,562 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function() {
var t = this;
for (var i in t.tv.orderedNodes) {
var node = t.tv.orderedNodes[i];
if (node.type === 'leaf') {
var tour = node.node;
t.showTour('/' + tour.get('id'));
break;
}
}
} | javascript | function() {
var t = this;
for (var i in t.tv.orderedNodes) {
var node = t.tv.orderedNodes[i];
if (node.type === 'leaf') {
var tour = node.node;
t.showTour('/' + tour.get('id'));
break;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"for",
"(",
"var",
"i",
"in",
"t",
".",
"tv",
".",
"orderedNodes",
")",
"{",
"var",
"node",
"=",
"t",
".",
"tv",
".",
"orderedNodes",
"[",
"i",
"]",
";",
"if",
"(",
"node",
".",
"type",... | Show the first tour in the tree | [
"Show",
"the",
"first",
"tour",
"in",
"the",
"tree"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L153-L163 | |
40,563 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function(e) {
var t = this;
// Scrape the form
var params = {
title: t.$('.nm-tsv-title').val(),
description: t.$('.nm-tsv-description').val(),
autoNextSec: t.$('.nm-tsv-auto-next-sec').val()
};
if (!parseInt(params.autoNextSec)) {
// Assure blank, NaN, un... | javascript | function(e) {
var t = this;
// Scrape the form
var params = {
title: t.$('.nm-tsv-title').val(),
description: t.$('.nm-tsv-description').val(),
autoNextSec: t.$('.nm-tsv-auto-next-sec').val()
};
if (!parseInt(params.autoNextSec)) {
// Assure blank, NaN, un... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Scrape the form",
"var",
"params",
"=",
"{",
"title",
":",
"t",
".",
"$",
"(",
"'.nm-tsv-title'",
")",
".",
"val",
"(",
")",
",",
"description",
":",
"t",
".",
"$",
"(",
"'.nm-tsv-de... | Called when a form input element changes | [
"Called",
"when",
"a",
"form",
"input",
"element",
"changes"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L166-L196 | |
40,564 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function() {
var t = this,
modal = t.newTourPage.$('.modal');
UI.hideToolTips();
modal.centerBox().css({top:20, left:modal.css('left').replace(/px/,'') - 40}).modal('show');
$('.modal-backdrop:last-child').css({zIndex:1140});
} | javascript | function() {
var t = this,
modal = t.newTourPage.$('.modal');
UI.hideToolTips();
modal.centerBox().css({top:20, left:modal.css('left').replace(/px/,'') - 40}).modal('show');
$('.modal-backdrop:last-child').css({zIndex:1140});
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"modal",
"=",
"t",
".",
"newTourPage",
".",
"$",
"(",
"'.modal'",
")",
";",
"UI",
".",
"hideToolTips",
"(",
")",
";",
"modal",
".",
"centerBox",
"(",
")",
".",
"css",
"(",
"{",
"top",
":"... | Open the addPage dialog | [
"Open",
"the",
"addPage",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L319-L325 | |
40,565 | lorenwest/monitor-dashboard | lib/js/TourSettingsView.js | function(page) {
var t = this,
newPages = t.pages.slice(0);
newPages.push(page);
t.tour.set('pages', newPages);
t.tour.isDirty = true;
t.setDirty(true);
t.loadForm();
} | javascript | function(page) {
var t = this,
newPages = t.pages.slice(0);
newPages.push(page);
t.tour.set('pages', newPages);
t.tour.isDirty = true;
t.setDirty(true);
t.loadForm();
} | [
"function",
"(",
"page",
")",
"{",
"var",
"t",
"=",
"this",
",",
"newPages",
"=",
"t",
".",
"pages",
".",
"slice",
"(",
"0",
")",
";",
"newPages",
".",
"push",
"(",
"page",
")",
";",
"t",
".",
"tour",
".",
"set",
"(",
"'pages'",
",",
"newPages"... | Add a page to the current tour | [
"Add",
"a",
"page",
"to",
"the",
"current",
"tour"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/TourSettingsView.js#L328-L336 | |
40,566 | lorenwest/monitor-dashboard | lib/js/UI.js | setAttr | function setAttr(setModel, newValue, setOptions) {
var oldValue = model._containedModels[attrName];
// Pass through if removing
if (newValue === undefined || newValue === null) {
model._containedModels[attrName] = newValue;
return;
}
// Is the new value the correct type?
... | javascript | function setAttr(setModel, newValue, setOptions) {
var oldValue = model._containedModels[attrName];
// Pass through if removing
if (newValue === undefined || newValue === null) {
model._containedModels[attrName] = newValue;
return;
}
// Is the new value the correct type?
... | [
"function",
"setAttr",
"(",
"setModel",
",",
"newValue",
",",
"setOptions",
")",
"{",
"var",
"oldValue",
"=",
"model",
".",
"_containedModels",
"[",
"attrName",
"]",
";",
"// Pass through if removing",
"if",
"(",
"newValue",
"===",
"undefined",
"||",
"newValue",... | Build the function for setting model data | [
"Build",
"the",
"function",
"for",
"setting",
"model",
"data"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/UI.js#L254-L306 |
40,567 | lorenwest/monitor-dashboard | lib/js/Template.js | function(params, options) {
var t = this;
// If raw text was sent to the template, compile and return
if (t.get('text')) {
t.compile();
return;
}
// Watch for changes in the text element
t.on('change:text', t.compile, t);
// Process a file template
var ... | javascript | function(params, options) {
var t = this;
// If raw text was sent to the template, compile and return
if (t.get('text')) {
t.compile();
return;
}
// Watch for changes in the text element
t.on('change:text', t.compile, t);
// Process a file template
var ... | [
"function",
"(",
"params",
",",
"options",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// If raw text was sent to the template, compile and return",
"if",
"(",
"t",
".",
"get",
"(",
"'text'",
")",
")",
"{",
"t",
".",
"compile",
"(",
")",
";",
"return",
";",
... | Initialize the template | [
"Initialize",
"the",
"template"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Template.js#L66-L98 | |
40,568 | lorenwest/monitor-dashboard | lib/js/Template.js | function() {
var t = this, path = t.get('path');
t.watcher = FileProbe.watchLoad(path, {persistent: true}, function(error, content) {
if (!error) {
t.set('text', content);
}
});
} | javascript | function() {
var t = this, path = t.get('path');
t.watcher = FileProbe.watchLoad(path, {persistent: true}, function(error, content) {
if (!error) {
t.set('text', content);
}
});
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"path",
"=",
"t",
".",
"get",
"(",
"'path'",
")",
";",
"t",
".",
"watcher",
"=",
"FileProbe",
".",
"watchLoad",
"(",
"path",
",",
"{",
"persistent",
":",
"true",
"}",
",",
"function",
"(",
... | Watch the file for changes
This sets up a watcher for the file specified in the ```path``` element.
It is called by the constructor if the ```watchFile``` data element is true.
@private
@method _watchFile | [
"Watch",
"the",
"file",
"for",
"changes"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Template.js#L109-L116 | |
40,569 | lorenwest/monitor-dashboard | lib/js/Template.js | function(params) {
var t = this, text = t.get('text'), compiled = t.get('compiled');
// Convert parameters to JS object if they're a backbone model
if (params instanceof Backbone.Model) {
params = params.toJSON();
}
// Compile the template if necessary
if (!compiled) {
... | javascript | function(params) {
var t = this, text = t.get('text'), compiled = t.get('compiled');
// Convert parameters to JS object if they're a backbone model
if (params instanceof Backbone.Model) {
params = params.toJSON();
}
// Compile the template if necessary
if (!compiled) {
... | [
"function",
"(",
"params",
")",
"{",
"var",
"t",
"=",
"this",
",",
"text",
"=",
"t",
".",
"get",
"(",
"'text'",
")",
",",
"compiled",
"=",
"t",
".",
"get",
"(",
"'compiled'",
")",
";",
"// Convert parameters to JS object if they're a backbone model",
"if",
... | Apply the parameters to the template
This accepts an object and returns the template with the parameters
applied.
@method apply
@param params {Object or Backbone.Model} Parameters to apply to the template
@return {String} The template text with parameters applied | [
"Apply",
"the",
"parameters",
"to",
"the",
"template"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Template.js#L141-L156 | |
40,570 | lorenwest/monitor-dashboard | lib/js/Template.js | function() {
var t = this, text = t.get('text');
var compiled = Mustache.compile(text);
t.set({compiled: compiled});
return compiled;
} | javascript | function() {
var t = this, text = t.get('text');
var compiled = Mustache.compile(text);
t.set({compiled: compiled});
return compiled;
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"text",
"=",
"t",
".",
"get",
"(",
"'text'",
")",
";",
"var",
"compiled",
"=",
"Mustache",
".",
"compile",
"(",
"text",
")",
";",
"t",
".",
"set",
"(",
"{",
"compiled",
":",
"compiled",
"... | Compile the text element into the compiled element
@protected
@method compile
@return {Function} Compiled function ready to call | [
"Compile",
"the",
"text",
"element",
"into",
"the",
"compiled",
"element"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Template.js#L165-L170 | |
40,571 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function() {
var styles = {},
viewOptions = component.get('viewOptions'),
title = viewOptions.get('title') || '',
background = viewOptions.get('background'),
css = component.get('css');
for (var selector in css) {
styles['#' + component.id + ' ' ... | javascript | function() {
var styles = {},
viewOptions = component.get('viewOptions'),
title = viewOptions.get('title') || '',
background = viewOptions.get('background'),
css = component.get('css');
for (var selector in css) {
styles['#' + component.id + ' ' ... | [
"function",
"(",
")",
"{",
"var",
"styles",
"=",
"{",
"}",
",",
"viewOptions",
"=",
"component",
".",
"get",
"(",
"'viewOptions'",
")",
",",
"title",
"=",
"viewOptions",
".",
"get",
"(",
"'title'",
")",
"||",
"''",
",",
"background",
"=",
"viewOptions"... | Apply styles for this component ID | [
"Apply",
"styles",
"for",
"this",
"component",
"ID"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L115-L129 | |
40,572 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function() {
// Don't continue if the probe portion was what changed.
var thisMonitor = JSON.stringify(monitor.toMonitorJSON());
if (thisMonitor === t.priorMonitor) {
return;
}
// Remove the component listeners
log.info('render.monitorChange', t.logCtxt);
... | javascript | function() {
// Don't continue if the probe portion was what changed.
var thisMonitor = JSON.stringify(monitor.toMonitorJSON());
if (thisMonitor === t.priorMonitor) {
return;
}
// Remove the component listeners
log.info('render.monitorChange', t.logCtxt);
... | [
"function",
"(",
")",
"{",
"// Don't continue if the probe portion was what changed.",
"var",
"thisMonitor",
"=",
"JSON",
".",
"stringify",
"(",
"monitor",
".",
"toMonitorJSON",
"(",
")",
")",
";",
"if",
"(",
"thisMonitor",
"===",
"t",
".",
"priorMonitor",
")",
... | Destroy this component, and render a new component if the underlying monitor definition changes. | [
"Destroy",
"this",
"component",
"and",
"render",
"a",
"new",
"component",
"if",
"the",
"underlying",
"monitor",
"definition",
"changes",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L135-L153 | |
40,573 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function() {
var t = this;
UI.hideToolTips();
UI.pageView.model.get('components').remove(t.model);
t.connectMonitor(false);
t.view.remove();
} | javascript | function() {
var t = this;
UI.hideToolTips();
UI.pageView.model.get('components').remove(t.model);
t.connectMonitor(false);
t.view.remove();
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"UI",
".",
"hideToolTips",
"(",
")",
";",
"UI",
".",
"pageView",
".",
"model",
".",
"get",
"(",
"'components'",
")",
".",
"remove",
"(",
"t",
".",
"model",
")",
";",
"t",
".",
"connectMonit... | Close the component view
This removes the component from the model, closing the view and leaving
the form in a dirty state.
@method close | [
"Close",
"the",
"component",
"view"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L216-L222 | |
40,574 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function(connect, callback) {
callback = callback || function(){};
var t = this,
needsConnecting = false,
logMethod = (connect ? 'connectMonitor' : 'disconnectMonitor'),
originalParams = null,
monitor = t.model.get('monitor'),
isConnected = monitor.isConnect... | javascript | function(connect, callback) {
callback = callback || function(){};
var t = this,
needsConnecting = false,
logMethod = (connect ? 'connectMonitor' : 'disconnectMonitor'),
originalParams = null,
monitor = t.model.get('monitor'),
isConnected = monitor.isConnect... | [
"function",
"(",
"connect",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"needsConnecting",
"=",
"false",
",",
"logMethod",
"=",
"(",
"connect",
"?",
"'connectMonitor'",
... | Connect or disconnect the monitor, calling the callback when done.
@method connectMonitor
@param connect {boolean} Connect if true, disconnect if false
@param callback(error) | [
"Connect",
"or",
"disconnect",
"the",
"monitor",
"calling",
"the",
"callback",
"when",
"done",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L231-L294 | |
40,575 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function(e) {
var t = this;
UI.pauseTour();
// Set the component model into the settings view
settingsView.setModel(t.model, t, t.viewClass['SettingsView']);
// Center and show the settings
$('#nm-cv-settings').centerBox().css({top:40}).modal('show');
e.stopPropagation();
... | javascript | function(e) {
var t = this;
UI.pauseTour();
// Set the component model into the settings view
settingsView.setModel(t.model, t, t.viewClass['SettingsView']);
// Center and show the settings
$('#nm-cv-settings').centerBox().css({top:40}).modal('show');
e.stopPropagation();
... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
";",
"UI",
".",
"pauseTour",
"(",
")",
";",
"// Set the component model into the settings view",
"settingsView",
".",
"setModel",
"(",
"t",
".",
"model",
",",
"t",
",",
"t",
".",
"viewClass",
"[",
... | Open the component settings dialog | [
"Open",
"the",
"component",
"settings",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L320-L335 | |
40,576 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function() {
var t = this,
pageView = UI.pageView,
pageModel = pageView.model,
view = t.view,
getMonitor = function(id) {return pageView.getMonitor(id);},
monitor = t.model.get('monitor');
// Execute the onInit
try {
eval(t.model.get('onInit')... | javascript | function() {
var t = this,
pageView = UI.pageView,
pageModel = pageView.model,
view = t.view,
getMonitor = function(id) {return pageView.getMonitor(id);},
monitor = t.model.get('monitor');
// Execute the onInit
try {
eval(t.model.get('onInit')... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"pageView",
"=",
"UI",
".",
"pageView",
",",
"pageModel",
"=",
"pageView",
".",
"model",
",",
"view",
"=",
"t",
".",
"view",
",",
"getMonitor",
"=",
"function",
"(",
"id",
")",
"{",
"return",... | This executes the onInit code contained in the component model | [
"This",
"executes",
"the",
"onInit",
"code",
"contained",
"in",
"the",
"component",
"model"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L338-L354 | |
40,577 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function(persist) {
var t = this,
viewElem = t.$('.nm-cv'),
thisZIndex = (viewElem.css('zIndex') === 'auto' ? 0 : +viewElem.css('zIndex')),
components = UI.pageView.model.get('components'),
maxZIndex = 0;
// Get the maximum z-index (disregarding this)
component... | javascript | function(persist) {
var t = this,
viewElem = t.$('.nm-cv'),
thisZIndex = (viewElem.css('zIndex') === 'auto' ? 0 : +viewElem.css('zIndex')),
components = UI.pageView.model.get('components'),
maxZIndex = 0;
// Get the maximum z-index (disregarding this)
component... | [
"function",
"(",
"persist",
")",
"{",
"var",
"t",
"=",
"this",
",",
"viewElem",
"=",
"t",
".",
"$",
"(",
"'.nm-cv'",
")",
",",
"thisZIndex",
"=",
"(",
"viewElem",
".",
"css",
"(",
"'zIndex'",
")",
"===",
"'auto'",
"?",
"0",
":",
"+",
"viewElem",
... | Raise this component to the top of the stack If persist is true, persist any new zIndex into the CSS of the data model Returns the component zIndex | [
"Raise",
"this",
"component",
"to",
"the",
"top",
"of",
"the",
"stack",
"If",
"persist",
"is",
"true",
"persist",
"any",
"new",
"zIndex",
"into",
"the",
"CSS",
"of",
"the",
"data",
"model",
"Returns",
"the",
"component",
"zIndex"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L359-L396 | |
40,578 | lorenwest/monitor-dashboard | lib/js/ComponentView.js | function() {
var t = this,
viewElem = t.$('.nm-cv'),
width = viewElem.outerWidth() + 10;
// Change the model CSS.
var css = _.clone(t.model.get('css')),
parsedCss = $.parseStyleString(css['.nm-cv'] || '');
parsedCss['left'] = '-' + width + 'px';
css['.nm-cv']... | javascript | function() {
var t = this,
viewElem = t.$('.nm-cv'),
width = viewElem.outerWidth() + 10;
// Change the model CSS.
var css = _.clone(t.model.get('css')),
parsedCss = $.parseStyleString(css['.nm-cv'] || '');
parsedCss['left'] = '-' + width + 'px';
css['.nm-cv']... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"viewElem",
"=",
"t",
".",
"$",
"(",
"'.nm-cv'",
")",
",",
"width",
"=",
"viewElem",
".",
"outerWidth",
"(",
")",
"+",
"10",
";",
"// Change the model CSS.",
"var",
"css",
"=",
"_",
".",
"clo... | Move the component to the left of others by the width + 10 | [
"Move",
"the",
"component",
"to",
"the",
"left",
"of",
"others",
"by",
"the",
"width",
"+",
"10"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/ComponentView.js#L399-L410 | |
40,579 | lorenwest/monitor-dashboard | lib/js/PageSettingsView.js | function() {
var t = this;
t.saveChanges();
// Open the new component dialog if no components exist
if (t.model.get('components').length === 0) {
t.pageView.newComponent();
}
} | javascript | function() {
var t = this;
t.saveChanges();
// Open the new component dialog if no components exist
if (t.model.get('components').length === 0) {
t.pageView.newComponent();
}
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"t",
".",
"saveChanges",
"(",
")",
";",
"// Open the new component dialog if no components exist",
"if",
"(",
"t",
".",
"model",
".",
"get",
"(",
"'components'",
")",
".",
"length",
"===",
"0",
")",
... | Local override for page save | [
"Local",
"override",
"for",
"page",
"save"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageSettingsView.js#L98-L106 | |
40,580 | lorenwest/monitor-dashboard | lib/js/PageSettingsView.js | function() {
var t = this;
if (window.confirm('Are you sure you want to permanently delete this page?')) {
t.pageView.exiting = true;
t.model.destroy(function(){
UI.pageView.navigateTo('/');
});
return true;
}
return false;
} | javascript | function() {
var t = this;
if (window.confirm('Are you sure you want to permanently delete this page?')) {
t.pageView.exiting = true;
t.model.destroy(function(){
UI.pageView.navigateTo('/');
});
return true;
}
return false;
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"if",
"(",
"window",
".",
"confirm",
"(",
"'Are you sure you want to permanently delete this page?'",
")",
")",
"{",
"t",
".",
"pageView",
".",
"exiting",
"=",
"true",
";",
"t",
".",
"model",
".",
... | Delete the page? | [
"Delete",
"the",
"page?"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageSettingsView.js#L120-L130 | |
40,581 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function(e) {
var t = this,
item = $(e.currentTarget),
id = item.attr('data-id'),
path = item.attr('data-path');
// Process a tour selection
if ($(e.currentTarget).parents('.nm-sb-tours').length) {
UI.pageView.runTour(path);
return;
}
// Proc... | javascript | function(e) {
var t = this,
item = $(e.currentTarget),
id = item.attr('data-id'),
path = item.attr('data-path');
// Process a tour selection
if ($(e.currentTarget).parents('.nm-sb-tours').length) {
UI.pageView.runTour(path);
return;
}
// Proc... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
",",
"item",
"=",
"$",
"(",
"e",
".",
"currentTarget",
")",
",",
"id",
"=",
"item",
".",
"attr",
"(",
"'data-id'",
")",
",",
"path",
"=",
"item",
".",
"attr",
"(",
"'data-path'",
")",
";"... | Process an item selection | [
"Process",
"an",
"item",
"selection"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L118-L132 | |
40,582 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function(e) {
var t = this;
UI.hideToolTips();
UI.pauseTour();
// Tell the settings it's about to be shown
UI.pageView.$('#nm-pv-new').centerBox().css({top:100}).modal('show');
setTimeout(function(){
$('.nm-np-address').focus();
}, 500);
// Don't propagate the c... | javascript | function(e) {
var t = this;
UI.hideToolTips();
UI.pauseTour();
// Tell the settings it's about to be shown
UI.pageView.$('#nm-pv-new').centerBox().css({top:100}).modal('show');
setTimeout(function(){
$('.nm-np-address').focus();
}, 500);
// Don't propagate the c... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
";",
"UI",
".",
"hideToolTips",
"(",
")",
";",
"UI",
".",
"pauseTour",
"(",
")",
";",
"// Tell the settings it's about to be shown",
"UI",
".",
"pageView",
".",
"$",
"(",
"'#nm-pv-new'",
")",
".",
... | Open the new page dialog | [
"Open",
"the",
"new",
"page",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L163-L176 | |
40,583 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function(e) {
var t = this;
UI.hideToolTips();
UI.pauseTour();
// Tell the settings it's about to be shown
t.tourSettingsView.show();
// Don't propagate the click to the heading
e.stopPropagation();
} | javascript | function(e) {
var t = this;
UI.hideToolTips();
UI.pauseTour();
// Tell the settings it's about to be shown
t.tourSettingsView.show();
// Don't propagate the click to the heading
e.stopPropagation();
} | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
";",
"UI",
".",
"hideToolTips",
"(",
")",
";",
"UI",
".",
"pauseTour",
"(",
")",
";",
"// Tell the settings it's about to be shown",
"t",
".",
"tourSettingsView",
".",
"show",
"(",
")",
";",
"// Do... | Open the tour settings dialog | [
"Open",
"the",
"tour",
"settings",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L179-L189 | |
40,584 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function(e) {
var t = this,
sidebar = $('.nm-sb'),
newWidth = startWidth = sidebar.width(),
startX = e.pageX;
function drag(e) {
newWidth = startWidth + (e.pageX - startX);
sidebar.css({width:newWidth});
t.tour.css({left: newWidth + t.handleWidth});
... | javascript | function(e) {
var t = this,
sidebar = $('.nm-sb'),
newWidth = startWidth = sidebar.width(),
startX = e.pageX;
function drag(e) {
newWidth = startWidth + (e.pageX - startX);
sidebar.css({width:newWidth});
t.tour.css({left: newWidth + t.handleWidth});
... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
",",
"sidebar",
"=",
"$",
"(",
"'.nm-sb'",
")",
",",
"newWidth",
"=",
"startWidth",
"=",
"sidebar",
".",
"width",
"(",
")",
",",
"startX",
"=",
"e",
".",
"pageX",
";",
"function",
"drag",
"... | Resize the sidebar | [
"Resize",
"the",
"sidebar"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L192-L224 | |
40,585 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function() {
var t = this,
sbJSON = t.sidebar.toJSON({deep:true, trim:true});
// Function to trim closed sub-branches from a tree
var trimSubBranch = function(tree) {
var branches = tree.branches;
for (var i in branches) {
var subTree = branches[i];
if (s... | javascript | function() {
var t = this,
sbJSON = t.sidebar.toJSON({deep:true, trim:true});
// Function to trim closed sub-branches from a tree
var trimSubBranch = function(tree) {
var branches = tree.branches;
for (var i in branches) {
var subTree = branches[i];
if (s... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"sbJSON",
"=",
"t",
".",
"sidebar",
".",
"toJSON",
"(",
"{",
"deep",
":",
"true",
",",
"trim",
":",
"true",
"}",
")",
";",
"// Function to trim closed sub-branches from a tree",
"var",
"trimSubBranch... | Save the sidebar to localStorage | [
"Save",
"the",
"sidebar",
"to",
"localStorage"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L227-L255 | |
40,586 | lorenwest/monitor-dashboard | lib/js/SidebarView.js | function(tree) {
var branches = tree.branches;
for (var i in branches) {
var subTree = branches[i];
if (subTree.isOpen && !subTree.isLoading) {
branches[i] = trimSubBranch(subTree);
} else {
branches[i] = {
id: subTree.id,
}... | javascript | function(tree) {
var branches = tree.branches;
for (var i in branches) {
var subTree = branches[i];
if (subTree.isOpen && !subTree.isLoading) {
branches[i] = trimSubBranch(subTree);
} else {
branches[i] = {
id: subTree.id,
}... | [
"function",
"(",
"tree",
")",
"{",
"var",
"branches",
"=",
"tree",
".",
"branches",
";",
"for",
"(",
"var",
"i",
"in",
"branches",
")",
"{",
"var",
"subTree",
"=",
"branches",
"[",
"i",
"]",
";",
"if",
"(",
"subTree",
".",
"isOpen",
"&&",
"!",
"s... | Function to trim closed sub-branches from a tree | [
"Function",
"to",
"trim",
"closed",
"sub",
"-",
"branches",
"from",
"a",
"tree"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/SidebarView.js#L232-L248 | |
40,587 | lorenwest/monitor-dashboard | lib/js/Component.js | function(size) {
var t = this,
css = _.clone(t.get('css')),
parsedCss = $.parseStyleString(css['.nm-cv-viewport'] || '');
if (!parsedCss.height && !parsedCss.width) {
parsedCss.height = size.height + 'px';
parsedCss.width = size.width + 'px';
css['.nm-cv-viewport'... | javascript | function(size) {
var t = this,
css = _.clone(t.get('css')),
parsedCss = $.parseStyleString(css['.nm-cv-viewport'] || '');
if (!parsedCss.height && !parsedCss.width) {
parsedCss.height = size.height + 'px';
parsedCss.width = size.width + 'px';
css['.nm-cv-viewport'... | [
"function",
"(",
"size",
")",
"{",
"var",
"t",
"=",
"this",
",",
"css",
"=",
"_",
".",
"clone",
"(",
"t",
".",
"get",
"(",
"'css'",
")",
")",
",",
"parsedCss",
"=",
"$",
".",
"parseStyleString",
"(",
"css",
"[",
"'.nm-cv-viewport'",
"]",
"||",
"'... | Set the default component size
This will add CSS to set the component size if it hasn't already been set.
@method setDefaultSize
@param size {Object}
@param size.height {Integer} Default height
@param size.width {Integer} Default width | [
"Set",
"the",
"default",
"component",
"size"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Component.js#L74-L84 | |
40,588 | lorenwest/monitor-dashboard | lib/js/Component.js | function(options) {
var t = this,
opts = _.extend({trim:true, deep:true, monitorOnly:true}, options),
raw = Backbone.Model.prototype.toJSON.call(t, opts);
// Keep only the monitor portion (strip the probe portion)?
if (opts.monitorOnly) {
raw.monitor = t.get('monitor').toM... | javascript | function(options) {
var t = this,
opts = _.extend({trim:true, deep:true, monitorOnly:true}, options),
raw = Backbone.Model.prototype.toJSON.call(t, opts);
// Keep only the monitor portion (strip the probe portion)?
if (opts.monitorOnly) {
raw.monitor = t.get('monitor').toM... | [
"function",
"(",
"options",
")",
"{",
"var",
"t",
"=",
"this",
",",
"opts",
"=",
"_",
".",
"extend",
"(",
"{",
"trim",
":",
"true",
",",
"deep",
":",
"true",
",",
"monitorOnly",
":",
"true",
"}",
",",
"options",
")",
",",
"raw",
"=",
"Backbone",
... | Overridden to produce only the persistent portion of the page | [
"Overridden",
"to",
"produce",
"only",
"the",
"persistent",
"portion",
"of",
"the",
"page"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/Component.js#L87-L97 | |
40,589 | lorenwest/monitor-dashboard | lib/js/PageView.js | function(e) {
var code = e.keyCode;
// Hotkeys while a tour is present
if (UI.pageView.tourView) {
// 1-9 direct page navigation
var target;
if (code >= 49 && code <=57) {
target = $('.nm-tv-page[data-index="' + (code - 49) + '"]');
}
// Pause / Run
... | javascript | function(e) {
var code = e.keyCode;
// Hotkeys while a tour is present
if (UI.pageView.tourView) {
// 1-9 direct page navigation
var target;
if (code >= 49 && code <=57) {
target = $('.nm-tv-page[data-index="' + (code - 49) + '"]');
}
// Pause / Run
... | [
"function",
"(",
"e",
")",
"{",
"var",
"code",
"=",
"e",
".",
"keyCode",
";",
"// Hotkeys while a tour is present",
"if",
"(",
"UI",
".",
"pageView",
".",
"tourView",
")",
"{",
"// 1-9 direct page navigation",
"var",
"target",
";",
"if",
"(",
"code",
">=",
... | Process hot keys | [
"Process",
"hot",
"keys"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L210-L242 | |
40,590 | lorenwest/monitor-dashboard | lib/js/PageView.js | function(e) {
var t = this,
box = t.getComponentArea(),
sidebarWidth = t.sidebar.width(),
canvasWidth = t.$el.width() - sidebarWidth,
canvasCenter = canvasWidth / 2;
// No components
if (!box.width) {return;}
// Obtain the center point, and offset the ca... | javascript | function(e) {
var t = this,
box = t.getComponentArea(),
sidebarWidth = t.sidebar.width(),
canvasWidth = t.$el.width() - sidebarWidth,
canvasCenter = canvasWidth / 2;
// No components
if (!box.width) {return;}
// Obtain the center point, and offset the ca... | [
"function",
"(",
"e",
")",
"{",
"var",
"t",
"=",
"this",
",",
"box",
"=",
"t",
".",
"getComponentArea",
"(",
")",
",",
"sidebarWidth",
"=",
"t",
".",
"sidebar",
".",
"width",
"(",
")",
",",
"canvasWidth",
"=",
"t",
".",
"$el",
".",
"width",
"(",
... | Center the page by adding left margin to the canvas | [
"Center",
"the",
"page",
"by",
"adding",
"left",
"margin",
"to",
"the",
"canvas"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L289-L305 | |
40,591 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
var t = this,
box = t.getComponentArea();
// Shift all components by the furthest left
if (box.left) {
t.$('.nm-pv-component').each(function() {
var elem = $(this).find('.nm-cv'),
left = (parseInt(elem.css('left'), 10)),
model = t.c... | javascript | function() {
var t = this,
box = t.getComponentArea();
// Shift all components by the furthest left
if (box.left) {
t.$('.nm-pv-component').each(function() {
var elem = $(this).find('.nm-cv'),
left = (parseInt(elem.css('left'), 10)),
model = t.c... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"box",
"=",
"t",
".",
"getComponentArea",
"(",
")",
";",
"// Shift all components by the furthest left",
"if",
"(",
"box",
".",
"left",
")",
"{",
"t",
".",
"$",
"(",
"'.nm-pv-component'",
")",
".",... | Move all components so the furthest left is on the left of the canvas. This makes the scrollbars make sense. | [
"Move",
"all",
"components",
"so",
"the",
"furthest",
"left",
"is",
"on",
"the",
"left",
"of",
"the",
"canvas",
".",
"This",
"makes",
"the",
"scrollbars",
"make",
"sense",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L309-L329 | |
40,592 | lorenwest/monitor-dashboard | lib/js/PageView.js | function(model) {
var t = this,
componentView = new ComponentView({model: model});
componentView.$el
.addClass('nm-pv-component')
.data('view', componentView);
componentView.render();
t.canvas.append(componentView.$el);
t.componentViews[model.get('id')] = componen... | javascript | function(model) {
var t = this,
componentView = new ComponentView({model: model});
componentView.$el
.addClass('nm-pv-component')
.data('view', componentView);
componentView.render();
t.canvas.append(componentView.$el);
t.componentViews[model.get('id')] = componen... | [
"function",
"(",
"model",
")",
"{",
"var",
"t",
"=",
"this",
",",
"componentView",
"=",
"new",
"ComponentView",
"(",
"{",
"model",
":",
"model",
"}",
")",
";",
"componentView",
".",
"$el",
".",
"addClass",
"(",
"'nm-pv-component'",
")",
".",
"data",
"(... | Add a component to the canvas | [
"Add",
"a",
"component",
"to",
"the",
"canvas"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L332-L341 | |
40,593 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
var t = this,
components = t.model.get('components'),
canvas = t.$('.nm-pv-canvas');
// Remove components not in the data model
canvas.find('.nm-pv-component').each(function() {
var component = $(this);
if (!components.get(component.attr('id'))) {
... | javascript | function() {
var t = this,
components = t.model.get('components'),
canvas = t.$('.nm-pv-canvas');
// Remove components not in the data model
canvas.find('.nm-pv-component').each(function() {
var component = $(this);
if (!components.get(component.attr('id'))) {
... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"components",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'components'",
")",
",",
"canvas",
"=",
"t",
".",
"$",
"(",
"'.nm-pv-canvas'",
")",
";",
"// Remove components not in the data model",
"canvas"... | This adds and removes components from the page, updating component data models if necessary. | [
"This",
"adds",
"and",
"removes",
"components",
"from",
"the",
"page",
"updating",
"component",
"data",
"models",
"if",
"necessary",
"."
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L357-L381 | |
40,594 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
var t = this,
pageView = t,
getMonitor = function(id){return t.getMonitor(id);};
pageModel = t.model;
// Execute the onInit
try {
eval(t.model.get('onInit'));
}
catch (e) {
console.error('PageView onInit threw exception: ', e);
... | javascript | function() {
var t = this,
pageView = t,
getMonitor = function(id){return t.getMonitor(id);};
pageModel = t.model;
// Execute the onInit
try {
eval(t.model.get('onInit'));
}
catch (e) {
console.error('PageView onInit threw exception: ', e);
... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"pageView",
"=",
"t",
",",
"getMonitor",
"=",
"function",
"(",
"id",
")",
"{",
"return",
"t",
".",
"getMonitor",
"(",
"id",
")",
";",
"}",
";",
"pageModel",
"=",
"t",
".",
"model",
";",
"... | This executes the onInit code contained in the page model | [
"This",
"executes",
"the",
"onInit",
"code",
"contained",
"in",
"the",
"page",
"model"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L384-L398 | |
40,595 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
var t = this,
raw = t.model.toJSON({trim:false});
return !(_.isEqual(t.originalPage, raw));
} | javascript | function() {
var t = this,
raw = t.model.toJSON({trim:false});
return !(_.isEqual(t.originalPage, raw));
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"raw",
"=",
"t",
".",
"model",
".",
"toJSON",
"(",
"{",
"trim",
":",
"false",
"}",
")",
";",
"return",
"!",
"(",
"_",
".",
"isEqual",
"(",
"t",
".",
"originalPage",
",",
"raw",
")",
")"... | Is the page model different from the persisted state? | [
"Is",
"the",
"page",
"model",
"different",
"from",
"the",
"persisted",
"state?"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L401-L405 | |
40,596 | lorenwest/monitor-dashboard | lib/js/PageView.js | function(isDirty) {
var t = this;
// Pause a tour if the page turns dirty
if (isDirty) {
UI.pauseTour();
}
// Change the view elements
t.$el.toggleClass('dirty', isDirty);
if (!isDirty) {
t.originalPage = t.model.toJSON({trim:false});
}
} | javascript | function(isDirty) {
var t = this;
// Pause a tour if the page turns dirty
if (isDirty) {
UI.pauseTour();
}
// Change the view elements
t.$el.toggleClass('dirty', isDirty);
if (!isDirty) {
t.originalPage = t.model.toJSON({trim:false});
}
} | [
"function",
"(",
"isDirty",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Pause a tour if the page turns dirty",
"if",
"(",
"isDirty",
")",
"{",
"UI",
".",
"pauseTour",
"(",
")",
";",
"}",
"// Change the view elements",
"t",
".",
"$el",
".",
"toggleClass",
"("... | Set the page as dirty or not | [
"Set",
"the",
"page",
"as",
"dirty",
"or",
"not"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L408-L421 | |
40,597 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
// Remember the current page state
var t = this;
t.pageSettingsView.originalModel = t.model.toJSON({trim:false});
// Load & show the dialog
t.showDialog('#nm-pv-settings');
} | javascript | function() {
// Remember the current page state
var t = this;
t.pageSettingsView.originalModel = t.model.toJSON({trim:false});
// Load & show the dialog
t.showDialog('#nm-pv-settings');
} | [
"function",
"(",
")",
"{",
"// Remember the current page state",
"var",
"t",
"=",
"this",
";",
"t",
".",
"pageSettingsView",
".",
"originalModel",
"=",
"t",
".",
"model",
".",
"toJSON",
"(",
"{",
"trim",
":",
"false",
"}",
")",
";",
"// Load & show the dialo... | This shows the page settings modal dialog | [
"This",
"shows",
"the",
"page",
"settings",
"modal",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L462-L469 | |
40,598 | lorenwest/monitor-dashboard | lib/js/PageView.js | function() {
var t = this,
components = t.model.get('components');
components.remove(components.models);
t.showSettings();
} | javascript | function() {
var t = this,
components = t.model.get('components');
components.remove(components.models);
t.showSettings();
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"components",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'components'",
")",
";",
"components",
".",
"remove",
"(",
"components",
".",
"models",
")",
";",
"t",
".",
"showSettings",
"(",
")",
"... | This clears all page components and opens the settings dialog | [
"This",
"clears",
"all",
"page",
"components",
"and",
"opens",
"the",
"settings",
"dialog"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L472-L477 | |
40,599 | lorenwest/monitor-dashboard | lib/js/PageView.js | function(id) {
var t = this,
components = t.model.get('components');
return components.get(id).get('monitor');
} | javascript | function(id) {
var t = this,
components = t.model.get('components');
return components.get(id).get('monitor');
} | [
"function",
"(",
"id",
")",
"{",
"var",
"t",
"=",
"this",
",",
"components",
"=",
"t",
".",
"model",
".",
"get",
"(",
"'components'",
")",
";",
"return",
"components",
".",
"get",
"(",
"id",
")",
".",
"get",
"(",
"'monitor'",
")",
";",
"}"
] | Get the monitor for the specified component ID | [
"Get",
"the",
"monitor",
"for",
"the",
"specified",
"component",
"ID"
] | a990e03d07096515744332ae0761441f8534369c | https://github.com/lorenwest/monitor-dashboard/blob/a990e03d07096515744332ae0761441f8534369c/lib/js/PageView.js#L480-L484 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.