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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,500 | nordnet/cordova-hot-code-push | scripts/beforePluginInstallHook.js | suggestCliInstallation | function suggestCliInstallation() {
console.log('---------CHCP-------------');
console.log('To make the development process easier for you - we developed a CLI client for our plugin.');
console.log('To install it, please, use command:');
console.log('npm install -g cordova-hot-code-push-cli');
console.log('Fo... | javascript | function suggestCliInstallation() {
console.log('---------CHCP-------------');
console.log('To make the development process easier for you - we developed a CLI client for our plugin.');
console.log('To install it, please, use command:');
console.log('npm install -g cordova-hot-code-push-cli');
console.log('Fo... | [
"function",
"suggestCliInstallation",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'---------CHCP-------------'",
")",
";",
"console",
".",
"log",
"(",
"'To make the development process easier for you - we developed a CLI client for our plugin.'",
")",
";",
"console",
".",
"... | Show message, that developer should install CLI client for the plugin, so it would be easier to use. | [
"Show",
"message",
"that",
"developer",
"should",
"install",
"CLI",
"client",
"for",
"the",
"plugin",
"so",
"it",
"would",
"be",
"easier",
"to",
"use",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/beforePluginInstallHook.js#L31-L38 |
11,501 | nordnet/cordova-hot-code-push | scripts/beforePluginInstallHook.js | isInstallationAlreadyPerformed | function isInstallationAlreadyPerformed(ctx) {
var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);
try {
fs.accessSync(pathToInstallFlag, fs.F_OK);
return true;
} catch (err) {
return false;
}
} | javascript | function isInstallationAlreadyPerformed(ctx) {
var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);
try {
fs.accessSync(pathToInstallFlag, fs.F_OK);
return true;
} catch (err) {
return false;
}
} | [
"function",
"isInstallationAlreadyPerformed",
"(",
"ctx",
")",
"{",
"var",
"pathToInstallFlag",
"=",
"path",
".",
"join",
"(",
"ctx",
".",
"opts",
".",
"projectRoot",
",",
"'plugins'",
",",
"ctx",
".",
"opts",
".",
"plugin",
".",
"id",
",",
"INSTALLATION_FLA... | region mark that we installed npm packages
Check if we already executed this hook.
@param {Object} ctx - cordova context
@return {Boolean} true if already executed; otherwise - false | [
"region",
"mark",
"that",
"we",
"installed",
"npm",
"packages",
"Check",
"if",
"we",
"already",
"executed",
"this",
"hook",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/beforePluginInstallHook.js#L49-L57 |
11,502 | nordnet/cordova-hot-code-push | scripts/beforePluginInstallHook.js | createPluginInstalledFlag | function createPluginInstalledFlag(ctx) {
var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);
fs.closeSync(fs.openSync(pathToInstallFlag, 'w'));
} | javascript | function createPluginInstalledFlag(ctx) {
var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);
fs.closeSync(fs.openSync(pathToInstallFlag, 'w'));
} | [
"function",
"createPluginInstalledFlag",
"(",
"ctx",
")",
"{",
"var",
"pathToInstallFlag",
"=",
"path",
".",
"join",
"(",
"ctx",
".",
"opts",
".",
"projectRoot",
",",
"'plugins'",
",",
"ctx",
".",
"opts",
".",
"plugin",
".",
"id",
",",
"INSTALLATION_FLAG_FIL... | Create empty file - indicator, that we tried to install dependency modules after installation.
We have to do that, or this hook is gonna be called on any plugin installation. | [
"Create",
"empty",
"file",
"-",
"indicator",
"that",
"we",
"tried",
"to",
"install",
"dependency",
"modules",
"after",
"installation",
".",
"We",
"have",
"to",
"do",
"that",
"or",
"this",
"hook",
"is",
"gonna",
"be",
"called",
"on",
"any",
"plugin",
"insta... | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/beforePluginInstallHook.js#L63-L67 |
11,503 | nordnet/cordova-hot-code-push | scripts/lib/chcpConfigXmlReader.js | readOptions | function readOptions(ctx) {
var configFilePath = path.join(ctx.opts.projectRoot, 'config.xml');
var configXmlContent = xmlHelper.readXmlAsJson(configFilePath, true);
return parseConfig(configXmlContent);
} | javascript | function readOptions(ctx) {
var configFilePath = path.join(ctx.opts.projectRoot, 'config.xml');
var configXmlContent = xmlHelper.readXmlAsJson(configFilePath, true);
return parseConfig(configXmlContent);
} | [
"function",
"readOptions",
"(",
"ctx",
")",
"{",
"var",
"configFilePath",
"=",
"path",
".",
"join",
"(",
"ctx",
".",
"opts",
".",
"projectRoot",
",",
"'config.xml'",
")",
";",
"var",
"configXmlContent",
"=",
"xmlHelper",
".",
"readXmlAsJson",
"(",
"configFil... | region Public API
Read plugin options from config.xml.
If none is specified - default options are returned.
@param {Object} ctx - cordova context object
@return {Object} plugin prefereces | [
"region",
"Public",
"API",
"Read",
"plugin",
"options",
"from",
"config",
".",
"xml",
".",
"If",
"none",
"is",
"specified",
"-",
"default",
"options",
"are",
"returned",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpConfigXmlReader.js#L24-L29 |
11,504 | nordnet/cordova-hot-code-push | www/chcp.js | broadcastEventFromNative | function broadcastEventFromNative(nativeMessage) {
var params = {};
if (nativeMessage.error != null) {
params.error = nativeMessage.error;
}
var chcpEvent = new CustomEvent(nativeMessage.action, {
'detail': params
});
document.dispatchEvent(chcpEvent);
} | javascript | function broadcastEventFromNative(nativeMessage) {
var params = {};
if (nativeMessage.error != null) {
params.error = nativeMessage.error;
}
var chcpEvent = new CustomEvent(nativeMessage.action, {
'detail': params
});
document.dispatchEvent(chcpEvent);
} | [
"function",
"broadcastEventFromNative",
"(",
"nativeMessage",
")",
"{",
"var",
"params",
"=",
"{",
"}",
";",
"if",
"(",
"nativeMessage",
".",
"error",
"!=",
"null",
")",
"{",
"params",
".",
"error",
"=",
"nativeMessage",
".",
"error",
";",
"}",
"var",
"c... | Broadcast event that was received from the native side.
@param {Object} arguments, received from the native side | [
"Broadcast",
"event",
"that",
"was",
"received",
"from",
"the",
"native",
"side",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/www/chcp.js#L126-L136 |
11,505 | nordnet/cordova-hot-code-push | www/chcp.js | function(options, callback) {
if (options === undefined || options == null) {
return;
}
callNativeMethod(pluginNativeMethod.CONFIGURE, options, callback);
} | javascript | function(options, callback) {
if (options === undefined || options == null) {
return;
}
callNativeMethod(pluginNativeMethod.CONFIGURE, options, callback);
} | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"options",
"===",
"undefined",
"||",
"options",
"==",
"null",
")",
"{",
"return",
";",
"}",
"callNativeMethod",
"(",
"pluginNativeMethod",
".",
"CONFIGURE",
",",
"options",
",",
"callback",
... | DEPRECATED! WILL BE REMOVED EVENTUALLY!
If you want to set config-url - use chcp.fetchUpdate(callback, options).
If you want to set auto-download/auto-install preference - do it in config.xml instead of this method.
Set plugin options.
Options are send to the native side.
As soon as they are processed - callback is c... | [
"DEPRECATED!",
"WILL",
"BE",
"REMOVED",
"EVENTUALLY!"
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/www/chcp.js#L201-L207 | |
11,506 | nordnet/cordova-hot-code-push | scripts/lib/chcpConfigXmlWriter.js | setup | function setup(context) {
cordovaContext = context;
platforms = context.opts.platforms;
projectRoot = context.opts.projectRoot;
} | javascript | function setup(context) {
cordovaContext = context;
platforms = context.opts.platforms;
projectRoot = context.opts.projectRoot;
} | [
"function",
"setup",
"(",
"context",
")",
"{",
"cordovaContext",
"=",
"context",
";",
"platforms",
"=",
"context",
".",
"opts",
".",
"platforms",
";",
"projectRoot",
"=",
"context",
".",
"opts",
".",
"projectRoot",
";",
"}"
] | region Private API
Initialize module.
@param {Object} cordovaContext - cordova context instance | [
"region",
"Private",
"API",
"Initialize",
"module",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpConfigXmlWriter.js#L38-L42 |
11,507 | nordnet/cordova-hot-code-push | scripts/lib/chcpConfigXmlWriter.js | getProjectName | function getProjectName(ctx, projectRoot) {
var cordova_util = ctx.requireCordovaModule('cordova-lib/src/cordova/util');
var xml = cordova_util.projectConfig(projectRoot);
var ConfigParser;
// If we are running Cordova 5.4 or abova - use parser from cordova-common.
// Otherwise - from cordova-lib.
try {
... | javascript | function getProjectName(ctx, projectRoot) {
var cordova_util = ctx.requireCordovaModule('cordova-lib/src/cordova/util');
var xml = cordova_util.projectConfig(projectRoot);
var ConfigParser;
// If we are running Cordova 5.4 or abova - use parser from cordova-common.
// Otherwise - from cordova-lib.
try {
... | [
"function",
"getProjectName",
"(",
"ctx",
",",
"projectRoot",
")",
"{",
"var",
"cordova_util",
"=",
"ctx",
".",
"requireCordovaModule",
"(",
"'cordova-lib/src/cordova/util'",
")",
";",
"var",
"xml",
"=",
"cordova_util",
".",
"projectConfig",
"(",
"projectRoot",
")... | Get name of the current project.
@param {Object} ctx - cordova context instance
@param {String} projectRoot - current root of the project
@return {String} name of the project | [
"Get",
"name",
"of",
"the",
"current",
"project",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpConfigXmlWriter.js#L52-L66 |
11,508 | nordnet/cordova-hot-code-push | scripts/lib/chcpConfigXmlWriter.js | getPlatformSpecificConfigXml | function getPlatformSpecificConfigXml(platform) {
var configFilePath = null;
switch (platform) {
case 'ios':
{
configFilePath = pathToIosConfigXml();
break;
}
case 'android':
{
configFilePath = pathToAndroidConfigXml();
break;
}
}
return configFil... | javascript | function getPlatformSpecificConfigXml(platform) {
var configFilePath = null;
switch (platform) {
case 'ios':
{
configFilePath = pathToIosConfigXml();
break;
}
case 'android':
{
configFilePath = pathToAndroidConfigXml();
break;
}
}
return configFil... | [
"function",
"getPlatformSpecificConfigXml",
"(",
"platform",
")",
"{",
"var",
"configFilePath",
"=",
"null",
";",
"switch",
"(",
"platform",
")",
"{",
"case",
"'ios'",
":",
"{",
"configFilePath",
"=",
"pathToIosConfigXml",
"(",
")",
";",
"break",
";",
"}",
"... | Get path to platform-specific config.xml file.
@param {String} platform - for what platform we need config.xml
@return {String} absolute path to config.xml | [
"Get",
"path",
"to",
"platform",
"-",
"specific",
"config",
".",
"xml",
"file",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpConfigXmlWriter.js#L94-L110 |
11,509 | nordnet/cordova-hot-code-push | scripts/lib/chcpConfigXmlWriter.js | injectOptions | function injectOptions(options) {
platforms.forEach(function(platform) {
var configXmlFilePath = getPlatformSpecificConfigXml(platform);
if (configXmlFilePath == null) {
return;
}
// read data from config.xml
var configData = xmlHelper.readXmlAsJson(configXmlFilePath);
if (configData ==... | javascript | function injectOptions(options) {
platforms.forEach(function(platform) {
var configXmlFilePath = getPlatformSpecificConfigXml(platform);
if (configXmlFilePath == null) {
return;
}
// read data from config.xml
var configData = xmlHelper.readXmlAsJson(configXmlFilePath);
if (configData ==... | [
"function",
"injectOptions",
"(",
"options",
")",
"{",
"platforms",
".",
"forEach",
"(",
"function",
"(",
"platform",
")",
"{",
"var",
"configXmlFilePath",
"=",
"getPlatformSpecificConfigXml",
"(",
"platform",
")",
";",
"if",
"(",
"configXmlFilePath",
"==",
"nul... | Write provided options into config.xml file for each platform.
@param {Object} options - plugin options | [
"Write",
"provided",
"options",
"into",
"config",
".",
"xml",
"file",
"for",
"each",
"platform",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpConfigXmlWriter.js#L117-L142 |
11,510 | nordnet/cordova-hot-code-push | scripts/afterPrepareHook.js | processConsoleOptions | function processConsoleOptions(ctx) {
var consoleOptions = ctx.opts.options;
// If we are using Cordova 5.3.3 or lower - arguments are array of strings.
// Will be removed after some time.
if (consoleOptions instanceof Array) {
return processConsoleOptions_cordova_53(consoleOptions);
}
// for newer ve... | javascript | function processConsoleOptions(ctx) {
var consoleOptions = ctx.opts.options;
// If we are using Cordova 5.3.3 or lower - arguments are array of strings.
// Will be removed after some time.
if (consoleOptions instanceof Array) {
return processConsoleOptions_cordova_53(consoleOptions);
}
// for newer ve... | [
"function",
"processConsoleOptions",
"(",
"ctx",
")",
"{",
"var",
"consoleOptions",
"=",
"ctx",
".",
"opts",
".",
"options",
";",
"// If we are using Cordova 5.3.3 or lower - arguments are array of strings.",
"// Will be removed after some time.",
"if",
"(",
"consoleOptions",
... | Read arguments from console.
We are reading only plugin-related preferences.
@param {Object} ctx - cordova context object
@return {Object} parsed arguments; if none were provided - default options are returned | [
"Read",
"arguments",
"from",
"console",
".",
"We",
"are",
"reading",
"only",
"plugin",
"-",
"related",
"preferences",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/afterPrepareHook.js#L48-L59 |
11,511 | nordnet/cordova-hot-code-push | scripts/afterPrepareHook.js | prepareWithCustomBuildOption | function prepareWithCustomBuildOption(ctx, optionName, chcpXmlOptions) {
if (optionName.length == 0) {
return false;
}
var buildConfig = chcpBuildOptions.getBuildConfigurationByName(ctx, optionName);
if (buildConfig == null) {
console.warn('Build configuration for "' + optionName + '" not found in chcp... | javascript | function prepareWithCustomBuildOption(ctx, optionName, chcpXmlOptions) {
if (optionName.length == 0) {
return false;
}
var buildConfig = chcpBuildOptions.getBuildConfigurationByName(ctx, optionName);
if (buildConfig == null) {
console.warn('Build configuration for "' + optionName + '" not found in chcp... | [
"function",
"prepareWithCustomBuildOption",
"(",
"ctx",
",",
"optionName",
",",
"chcpXmlOptions",
")",
"{",
"if",
"(",
"optionName",
".",
"length",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"var",
"buildConfig",
"=",
"chcpBuildOptions",
".",
"getBuildC... | Try to inject build options according to the arguments from the console.
@param {Object} ctx - cordova context object
@param {String} optionName - build option name from console; will be mapped to configuration from chcpbuild.options file
@return {boolean} true - if build option is found and we successfully injected i... | [
"Try",
"to",
"inject",
"build",
"options",
"according",
"to",
"the",
"arguments",
"from",
"the",
"console",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/afterPrepareHook.js#L127-L149 |
11,512 | nordnet/cordova-hot-code-push | scripts/lib/iosWKWebViewEngineSupport.js | setWKWebViewEngineMacro | function setWKWebViewEngineMacro(cordovaContext) {
init(cordovaContext);
// injecting options in project file
var projectFile = loadProjectFile();
setMacro(projectFile.xcode);
projectFile.write();
} | javascript | function setWKWebViewEngineMacro(cordovaContext) {
init(cordovaContext);
// injecting options in project file
var projectFile = loadProjectFile();
setMacro(projectFile.xcode);
projectFile.write();
} | [
"function",
"setWKWebViewEngineMacro",
"(",
"cordovaContext",
")",
"{",
"init",
"(",
"cordovaContext",
")",
";",
"// injecting options in project file",
"var",
"projectFile",
"=",
"loadProjectFile",
"(",
")",
";",
"setMacro",
"(",
"projectFile",
".",
"xcode",
")",
"... | Define preprocessor macro for WKWebViewEngine.
@param {Object} cordovaContext - cordova context | [
"Define",
"preprocessor",
"macro",
"for",
"WKWebViewEngine",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/iosWKWebViewEngineSupport.js#L27-L34 |
11,513 | nordnet/cordova-hot-code-push | scripts/lib/iosWKWebViewEngineSupport.js | init | function init(ctx) {
context = ctx;
projectRoot = ctx.opts.projectRoot;
projectName = getProjectName(ctx, projectRoot);
iosPlatformPath = path.join(projectRoot, 'platforms', 'ios');
var wkWebViewPluginPath = path.join(projectRoot, 'plugins', WKWEBVIEW_PLUGIN_NAME);
isWkWebViewEngineUsed = isDirectoryExists... | javascript | function init(ctx) {
context = ctx;
projectRoot = ctx.opts.projectRoot;
projectName = getProjectName(ctx, projectRoot);
iosPlatformPath = path.join(projectRoot, 'platforms', 'ios');
var wkWebViewPluginPath = path.join(projectRoot, 'plugins', WKWEBVIEW_PLUGIN_NAME);
isWkWebViewEngineUsed = isDirectoryExists... | [
"function",
"init",
"(",
"ctx",
")",
"{",
"context",
"=",
"ctx",
";",
"projectRoot",
"=",
"ctx",
".",
"opts",
".",
"projectRoot",
";",
"projectName",
"=",
"getProjectName",
"(",
"ctx",
",",
"projectRoot",
")",
";",
"iosPlatformPath",
"=",
"path",
".",
"j... | region General private methods
Initialize before execution.
@param {Object} ctx - cordova context instance | [
"region",
"General",
"private",
"methods",
"Initialize",
"before",
"execution",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/iosWKWebViewEngineSupport.js#L43-L51 |
11,514 | nordnet/cordova-hot-code-push | scripts/lib/iosWKWebViewEngineSupport.js | setMacro | function setMacro(xcodeProject) {
var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
var config;
var buildSettings;
for (config in configurations) {
buildSettings = configurations[config].buildSettings;
var preprocessorDefs = buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] ?... | javascript | function setMacro(xcodeProject) {
var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
var config;
var buildSettings;
for (config in configurations) {
buildSettings = configurations[config].buildSettings;
var preprocessorDefs = buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] ?... | [
"function",
"setMacro",
"(",
"xcodeProject",
")",
"{",
"var",
"configurations",
"=",
"nonComments",
"(",
"xcodeProject",
".",
"pbxXCBuildConfigurationSection",
"(",
")",
")",
";",
"var",
"config",
";",
"var",
"buildSettings",
";",
"for",
"(",
"config",
"in",
"... | region Macros injection
Inject WKWebView macro into project configuration file.
@param {Object} xcodeProject - xcode project file instance | [
"region",
"Macros",
"injection",
"Inject",
"WKWebView",
"macro",
"into",
"project",
"configuration",
"file",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/iosWKWebViewEngineSupport.js#L167-L202 |
11,515 | nordnet/cordova-hot-code-push | scripts/lib/chcpBuildOptions.js | getBuildConfigurationByName | function getBuildConfigurationByName(ctx, buildName) {
// load options from the chcpbuild.options file
var chcpBuildOptions = getBuildOptionsFromConfig(ctx);
if (chcpBuildOptions == null) {
return null;
}
var resultConfig = chcpBuildOptions[buildName];
if (!resultConfig) {
return null;
}
// ba... | javascript | function getBuildConfigurationByName(ctx, buildName) {
// load options from the chcpbuild.options file
var chcpBuildOptions = getBuildOptionsFromConfig(ctx);
if (chcpBuildOptions == null) {
return null;
}
var resultConfig = chcpBuildOptions[buildName];
if (!resultConfig) {
return null;
}
// ba... | [
"function",
"getBuildConfigurationByName",
"(",
"ctx",
",",
"buildName",
")",
"{",
"// load options from the chcpbuild.options file",
"var",
"chcpBuildOptions",
"=",
"getBuildOptionsFromConfig",
"(",
"ctx",
")",
";",
"if",
"(",
"chcpBuildOptions",
"==",
"null",
")",
"{"... | region Public API
Generate build options depending on the options, provided in console.
@param {String} buildName - build identifier
@return {Object} build options; null - if none are found | [
"region",
"Public",
"API",
"Generate",
"build",
"options",
"depending",
"on",
"the",
"options",
"provided",
"in",
"console",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpBuildOptions.js#L22-L44 |
11,516 | nordnet/cordova-hot-code-push | scripts/lib/chcpBuildOptions.js | getBuildOptionsFromConfig | function getBuildOptionsFromConfig(ctx) {
var chcpBuildOptionsFilePath = path.join(ctx.opts.projectRoot, OPTIONS_FILE_NAME);
return readObjectFromFile(chcpBuildOptionsFilePath);
} | javascript | function getBuildOptionsFromConfig(ctx) {
var chcpBuildOptionsFilePath = path.join(ctx.opts.projectRoot, OPTIONS_FILE_NAME);
return readObjectFromFile(chcpBuildOptionsFilePath);
} | [
"function",
"getBuildOptionsFromConfig",
"(",
"ctx",
")",
"{",
"var",
"chcpBuildOptionsFilePath",
"=",
"path",
".",
"join",
"(",
"ctx",
".",
"opts",
".",
"projectRoot",
",",
"OPTIONS_FILE_NAME",
")",
";",
"return",
"readObjectFromFile",
"(",
"chcpBuildOptionsFilePat... | region Private API
Read options, listed in chcpbuild.options file.
@return {Object} options from chcpbuild.options file | [
"region",
"Private",
"API",
"Read",
"options",
"listed",
"in",
"chcpbuild",
".",
"options",
"file",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/chcpBuildOptions.js#L55-L59 |
11,517 | nordnet/cordova-hot-code-push | scripts/lib/xmlHelper.js | writeJsonAsXml | function writeJsonAsXml(jsData, filePath, options) {
var xmlBuilder = new xml2js.Builder(options);
var changedXmlData = xmlBuilder.buildObject(jsData);
var isSaved = true;
try {
fs.writeFileSync(filePath, changedXmlData);
} catch (err) {
console.log(err);
isSaved = false;
}
return isSaved;
} | javascript | function writeJsonAsXml(jsData, filePath, options) {
var xmlBuilder = new xml2js.Builder(options);
var changedXmlData = xmlBuilder.buildObject(jsData);
var isSaved = true;
try {
fs.writeFileSync(filePath, changedXmlData);
} catch (err) {
console.log(err);
isSaved = false;
}
return isSaved;
} | [
"function",
"writeJsonAsXml",
"(",
"jsData",
",",
"filePath",
",",
"options",
")",
"{",
"var",
"xmlBuilder",
"=",
"new",
"xml2js",
".",
"Builder",
"(",
"options",
")",
";",
"var",
"changedXmlData",
"=",
"xmlBuilder",
".",
"buildObject",
"(",
"jsData",
")",
... | Write JSON object as xml into the specified file.
@param {Object} jsData - JSON object to write
@param {String} filePath - path to the xml file where data should be saved
@param {Object} options - xml options
@return {boolean} true - if data saved to file; false - otherwise | [
"Write",
"JSON",
"object",
"as",
"xml",
"into",
"the",
"specified",
"file",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/lib/xmlHelper.js#L57-L70 |
11,518 | distillpub/template | src/transforms/typeset.js | acceptNode | function acceptNode(node) {
var parent = node.parentElement;
var isMath = (parent && parent.getAttribute && parent.getAttribute('class')) ? parent.getAttribute('class').includes('katex') || parent.getAttribute('class').includes('MathJax') : false;
return parent &&
parent.nodeName !== 'SCRIPT' &&
... | javascript | function acceptNode(node) {
var parent = node.parentElement;
var isMath = (parent && parent.getAttribute && parent.getAttribute('class')) ? parent.getAttribute('class').includes('katex') || parent.getAttribute('class').includes('MathJax') : false;
return parent &&
parent.nodeName !== 'SCRIPT' &&
... | [
"function",
"acceptNode",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentElement",
";",
"var",
"isMath",
"=",
"(",
"parent",
"&&",
"parent",
".",
"getAttribute",
"&&",
"parent",
".",
"getAttribute",
"(",
"'class'",
")",
")",
"?",
"paren... | 2018-07-11 shancarter@ and ludwigschubert@ no longer know what this was meant to accomplish if it was trying to not replace text in any child nodes of those listed here, then it does not accomplish that. | [
"2018",
"-",
"07",
"-",
"11",
"shancarter"
] | 042da68b9ab9cbbe42fcce3f38b58f1a305dd415 | https://github.com/distillpub/template/blob/042da68b9ab9cbbe42fcce3f38b58f1a305dd415/src/transforms/typeset.js#L38-L58 |
11,519 | googlearchive/vrview | src/embed/world-renderer.js | WorldRenderer | function WorldRenderer(params) {
this.init_(params.hideFullscreenButton);
this.sphereRenderer = new SphereRenderer(this.scene);
this.hotspotRenderer = new HotspotRenderer(this);
this.hotspotRenderer.on('focus', this.onHotspotFocus_.bind(this));
this.hotspotRenderer.on('blur', this.onHotspotBlur_.bind(this));... | javascript | function WorldRenderer(params) {
this.init_(params.hideFullscreenButton);
this.sphereRenderer = new SphereRenderer(this.scene);
this.hotspotRenderer = new HotspotRenderer(this);
this.hotspotRenderer.on('focus', this.onHotspotFocus_.bind(this));
this.hotspotRenderer.on('blur', this.onHotspotBlur_.bind(this));... | [
"function",
"WorldRenderer",
"(",
"params",
")",
"{",
"this",
".",
"init_",
"(",
"params",
".",
"hideFullscreenButton",
")",
";",
"this",
".",
"sphereRenderer",
"=",
"new",
"SphereRenderer",
"(",
"this",
".",
"scene",
")",
";",
"this",
".",
"hotspotRenderer"... | The main WebGL rendering entry point. Manages the scene, camera, VR-related
rendering updates. Interacts with the WebVRManager.
Coordinates the other renderers: SphereRenderer, HotspotRenderer,
ReticleRenderer.
Also manages the AdaptivePlayer and VideoProxy.
Emits the following events:
load: when the scene is loaded... | [
"The",
"main",
"WebGL",
"rendering",
"entry",
"point",
".",
"Manages",
"the",
"scene",
"camera",
"VR",
"-",
"related",
"rendering",
"updates",
".",
"Interacts",
"with",
"the",
"WebVRManager",
"."
] | 610e20c825f65f9a266da399b154d18e7c31de3f | https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/world-renderer.js#L43-L59 |
11,520 | googlearchive/vrview | src/api/player.js | Player | function Player(selector, contentInfo) {
// Create a VR View iframe depending on the parameters.
var iframe = this.createIframe_(contentInfo);
this.iframe = iframe;
var parentEl = document.querySelector(selector);
parentEl.appendChild(iframe);
// Make a sender as well, for relying commands to the child IF... | javascript | function Player(selector, contentInfo) {
// Create a VR View iframe depending on the parameters.
var iframe = this.createIframe_(contentInfo);
this.iframe = iframe;
var parentEl = document.querySelector(selector);
parentEl.appendChild(iframe);
// Make a sender as well, for relying commands to the child IF... | [
"function",
"Player",
"(",
"selector",
",",
"contentInfo",
")",
"{",
"// Create a VR View iframe depending on the parameters.",
"var",
"iframe",
"=",
"this",
".",
"createIframe_",
"(",
"contentInfo",
")",
";",
"this",
".",
"iframe",
"=",
"iframe",
";",
"var",
"par... | Entry point for the VR View JS API.
Emits the following events:
ready: When the player is loaded.
modechange: When the viewing mode changes (normal, fullscreen, VR).
click (id): When a hotspot is clicked. | [
"Entry",
"point",
"for",
"the",
"VR",
"View",
"JS",
"API",
"."
] | 610e20c825f65f9a266da399b154d18e7c31de3f | https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/api/player.js#L33-L64 |
11,521 | googlearchive/vrview | src/embed/hotspot-renderer.js | HotspotRenderer | function HotspotRenderer(worldRenderer) {
this.worldRenderer = worldRenderer;
this.scene = worldRenderer.scene;
// Note: this event must be added to document.body and not to window for it to
// work inside iOS iframes.
var body = document.body;
// Bind events for hotspot interaction.
if (!Util.isMobile()... | javascript | function HotspotRenderer(worldRenderer) {
this.worldRenderer = worldRenderer;
this.scene = worldRenderer.scene;
// Note: this event must be added to document.body and not to window for it to
// work inside iOS iframes.
var body = document.body;
// Bind events for hotspot interaction.
if (!Util.isMobile()... | [
"function",
"HotspotRenderer",
"(",
"worldRenderer",
")",
"{",
"this",
".",
"worldRenderer",
"=",
"worldRenderer",
";",
"this",
".",
"scene",
"=",
"worldRenderer",
".",
"scene",
";",
"// Note: this event must be added to document.body and not to window for it to",
"// work ... | Responsible for rectangular hot spots that the user can interact with.
Specific duties:
Adding and removing hotspots.
Rendering the hotspots (debug mode only).
Notifying when hotspots are interacted with.
Emits the following events:
click (id): a hotspot is clicked.
focus (id): a hotspot is focused.
blur (id): a hots... | [
"Responsible",
"for",
"rectangular",
"hot",
"spots",
"that",
"the",
"user",
"can",
"interact",
"with",
"."
] | 610e20c825f65f9a266da399b154d18e7c31de3f | https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/hotspot-renderer.js#L48-L83 |
11,522 | googlearchive/vrview | src/embed/scene-info.js | SceneInfo | function SceneInfo(opt_params) {
var params = opt_params || {};
params.player = {
loop: opt_params.loop,
volume: opt_params.volume,
muted: opt_params.muted
};
this.image = params.image !== undefined ? encodeURI(params.image) : undefined;
this.preview = params.preview !== undefined ? encodeURI(par... | javascript | function SceneInfo(opt_params) {
var params = opt_params || {};
params.player = {
loop: opt_params.loop,
volume: opt_params.volume,
muted: opt_params.muted
};
this.image = params.image !== undefined ? encodeURI(params.image) : undefined;
this.preview = params.preview !== undefined ? encodeURI(par... | [
"function",
"SceneInfo",
"(",
"opt_params",
")",
"{",
"var",
"params",
"=",
"opt_params",
"||",
"{",
"}",
";",
"params",
".",
"player",
"=",
"{",
"loop",
":",
"opt_params",
".",
"loop",
",",
"volume",
":",
"opt_params",
".",
"volume",
",",
"muted",
":"... | Contains all information about a given scene. | [
"Contains",
"all",
"information",
"about",
"a",
"given",
"scene",
"."
] | 610e20c825f65f9a266da399b154d18e7c31de3f | https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/scene-info.js#L37-L60 |
11,523 | expressjs/cookie-session | index.js | cookieSession | function cookieSession (options) {
var opts = options || {}
// cookie name
var name = opts.name || 'session'
// secrets
var keys = opts.keys
if (!keys && opts.secret) keys = [opts.secret]
// defaults
if (opts.overwrite == null) opts.overwrite = true
if (opts.httpOnly == null) opts.httpOnly = true
... | javascript | function cookieSession (options) {
var opts = options || {}
// cookie name
var name = opts.name || 'session'
// secrets
var keys = opts.keys
if (!keys && opts.secret) keys = [opts.secret]
// defaults
if (opts.overwrite == null) opts.overwrite = true
if (opts.httpOnly == null) opts.httpOnly = true
... | [
"function",
"cookieSession",
"(",
"options",
")",
"{",
"var",
"opts",
"=",
"options",
"||",
"{",
"}",
"// cookie name",
"var",
"name",
"=",
"opts",
".",
"name",
"||",
"'session'",
"// secrets",
"var",
"keys",
"=",
"opts",
".",
"keys",
"if",
"(",
"!",
"... | Create a new cookie session middleware.
@param {object} [options]
@param {boolean} [options.httpOnly=true]
@param {array} [options.keys]
@param {string} [options.name=session] Name of the cookie to use
@param {boolean} [options.overwrite=true]
@param {string} [options.secret]
@param {boolean} [options.signed=true]
@re... | [
"Create",
"a",
"new",
"cookie",
"session",
"middleware",
"."
] | add5791673964540a5283e7abc553d6840f7adf8 | https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L41-L131 |
11,524 | expressjs/cookie-session | index.js | Session | function Session (ctx, obj) {
Object.defineProperty(this, '_ctx', {
value: ctx
})
if (obj) {
for (var key in obj) {
this[key] = obj[key]
}
}
} | javascript | function Session (ctx, obj) {
Object.defineProperty(this, '_ctx', {
value: ctx
})
if (obj) {
for (var key in obj) {
this[key] = obj[key]
}
}
} | [
"function",
"Session",
"(",
"ctx",
",",
"obj",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'_ctx'",
",",
"{",
"value",
":",
"ctx",
"}",
")",
"if",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"this",
... | Session model.
@param {Context} ctx
@param {Object} obj
@private | [
"Session",
"model",
"."
] | add5791673964540a5283e7abc553d6840f7adf8 | https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L141-L151 |
11,525 | expressjs/cookie-session | index.js | decode | function decode (string) {
var body = Buffer.from(string, 'base64').toString('utf8')
return JSON.parse(body)
} | javascript | function decode (string) {
var body = Buffer.from(string, 'base64').toString('utf8')
return JSON.parse(body)
} | [
"function",
"decode",
"(",
"string",
")",
"{",
"var",
"body",
"=",
"Buffer",
".",
"from",
"(",
"string",
",",
"'base64'",
")",
".",
"toString",
"(",
"'utf8'",
")",
"return",
"JSON",
".",
"parse",
"(",
"body",
")",
"}"
] | Decode the base64 cookie value to an object.
@param {String} string
@return {Object}
@private | [
"Decode",
"the",
"base64",
"cookie",
"value",
"to",
"an",
"object",
"."
] | add5791673964540a5283e7abc553d6840f7adf8 | https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L289-L292 |
11,526 | expressjs/cookie-session | index.js | encode | function encode (body) {
var str = JSON.stringify(body)
return Buffer.from(str).toString('base64')
} | javascript | function encode (body) {
var str = JSON.stringify(body)
return Buffer.from(str).toString('base64')
} | [
"function",
"encode",
"(",
"body",
")",
"{",
"var",
"str",
"=",
"JSON",
".",
"stringify",
"(",
"body",
")",
"return",
"Buffer",
".",
"from",
"(",
"str",
")",
".",
"toString",
"(",
"'base64'",
")",
"}"
] | Encode an object into a base64-encoded JSON string.
@param {Object} body
@return {String}
@private | [
"Encode",
"an",
"object",
"into",
"a",
"base64",
"-",
"encoded",
"JSON",
"string",
"."
] | add5791673964540a5283e7abc553d6840f7adf8 | https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L302-L305 |
11,527 | expressjs/cookie-session | index.js | tryGetSession | function tryGetSession (req) {
var cookies = req.sessionCookies
var name = req.sessionKey
var opts = req.sessionOptions
var str = cookies.get(name, opts)
if (!str) {
return undefined
}
debug('parse %s', str)
try {
return Session.deserialize(req, str)
} catch (err) {
return undefined
... | javascript | function tryGetSession (req) {
var cookies = req.sessionCookies
var name = req.sessionKey
var opts = req.sessionOptions
var str = cookies.get(name, opts)
if (!str) {
return undefined
}
debug('parse %s', str)
try {
return Session.deserialize(req, str)
} catch (err) {
return undefined
... | [
"function",
"tryGetSession",
"(",
"req",
")",
"{",
"var",
"cookies",
"=",
"req",
".",
"sessionCookies",
"var",
"name",
"=",
"req",
".",
"sessionKey",
"var",
"opts",
"=",
"req",
".",
"sessionOptions",
"var",
"str",
"=",
"cookies",
".",
"get",
"(",
"name",... | Try getting a session from a request.
@private | [
"Try",
"getting",
"a",
"session",
"from",
"a",
"request",
"."
] | add5791673964540a5283e7abc553d6840f7adf8 | https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L312-L330 |
11,528 | bfintal/Counter-Up | jquery.counterup.js | function() {
$this.text($this.data('counterup-nums').shift());
if ($this.data('counterup-nums').length) {
setTimeout($this.data('counterup-func'), $settings.delay);
} else {
delete $this.data('counterup-nums');
$... | javascript | function() {
$this.text($this.data('counterup-nums').shift());
if ($this.data('counterup-nums').length) {
setTimeout($this.data('counterup-func'), $settings.delay);
} else {
delete $this.data('counterup-nums');
$... | [
"function",
"(",
")",
"{",
"$this",
".",
"text",
"(",
"$this",
".",
"data",
"(",
"'counterup-nums'",
")",
".",
"shift",
"(",
")",
")",
";",
"if",
"(",
"$this",
".",
"data",
"(",
"'counterup-nums'",
")",
".",
"length",
")",
"{",
"setTimeout",
"(",
"... | Updates the number until we're done | [
"Updates",
"the",
"number",
"until",
"we",
"re",
"done"
] | 496d5a038a2b8838e6037896a90a2a5d74bc2a89 | https://github.com/bfintal/Counter-Up/blob/496d5a038a2b8838e6037896a90a2a5d74bc2a89/jquery.counterup.js#L61-L70 | |
11,529 | instructure/pdf-annotate.js | src/UI/edit.js | destroyEditOverlay | function destroyEditOverlay() {
if (overlay) {
overlay.parentNode.removeChild(overlay);
overlay = null;
}
document.removeEventListener('click', handleDocumentClick);
document.removeEventListener('keyup', handleDocumentKeyup);
document.removeEventListener('mousedown', handleDocumentMousedown);
docum... | javascript | function destroyEditOverlay() {
if (overlay) {
overlay.parentNode.removeChild(overlay);
overlay = null;
}
document.removeEventListener('click', handleDocumentClick);
document.removeEventListener('keyup', handleDocumentKeyup);
document.removeEventListener('mousedown', handleDocumentMousedown);
docum... | [
"function",
"destroyEditOverlay",
"(",
")",
"{",
"if",
"(",
"overlay",
")",
"{",
"overlay",
".",
"parentNode",
".",
"removeChild",
"(",
"overlay",
")",
";",
"overlay",
"=",
"null",
";",
"}",
"document",
".",
"removeEventListener",
"(",
"'click'",
",",
"han... | Destroy the edit overlay if it exists. | [
"Destroy",
"the",
"edit",
"overlay",
"if",
"it",
"exists",
"."
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L95-L107 |
11,530 | instructure/pdf-annotate.js | src/UI/edit.js | deleteAnnotation | function deleteAnnotation() {
if (!overlay) { return; }
let annotationId = overlay.getAttribute('data-target-id');
let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`);
let svg = overlay.parentNode.querySelector('svg.annotationLayer');
let { documentId } = getMetadata(svg);
[.... | javascript | function deleteAnnotation() {
if (!overlay) { return; }
let annotationId = overlay.getAttribute('data-target-id');
let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`);
let svg = overlay.parentNode.querySelector('svg.annotationLayer');
let { documentId } = getMetadata(svg);
[.... | [
"function",
"deleteAnnotation",
"(",
")",
"{",
"if",
"(",
"!",
"overlay",
")",
"{",
"return",
";",
"}",
"let",
"annotationId",
"=",
"overlay",
".",
"getAttribute",
"(",
"'data-target-id'",
")",
";",
"let",
"nodes",
"=",
"document",
".",
"querySelectorAll",
... | Delete currently selected annotation | [
"Delete",
"currently",
"selected",
"annotation"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L112-L127 |
11,531 | instructure/pdf-annotate.js | src/UI/edit.js | handleDocumentClick | function handleDocumentClick(e) {
if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }
// Remove current overlay
let overlay = document.getElementById('pdf-annotate-edit-overlay');
if (overlay) {
if (isDragging || e.target === overlay) {
return;
}
destroyEditOverlay();
}
} | javascript | function handleDocumentClick(e) {
if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }
// Remove current overlay
let overlay = document.getElementById('pdf-annotate-edit-overlay');
if (overlay) {
if (isDragging || e.target === overlay) {
return;
}
destroyEditOverlay();
}
} | [
"function",
"handleDocumentClick",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"findSVGAtPoint",
"(",
"e",
".",
"clientX",
",",
"e",
".",
"clientY",
")",
")",
"{",
"return",
";",
"}",
"// Remove current overlay",
"let",
"overlay",
"=",
"document",
".",
"getElement... | Handle document.click event
@param {Event} e The DOM event that needs to be handled | [
"Handle",
"document",
".",
"click",
"event"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L134-L146 |
11,532 | instructure/pdf-annotate.js | src/UI/text.js | saveText | function saveText() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let { documentId, pageNumber } = getMetadata(svg);
let rect = svg.g... | javascript | function saveText() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let { documentId, pageNumber } = getMetadata(svg);
let rect = svg.g... | [
"function",
"saveText",
"(",
")",
"{",
"if",
"(",
"input",
".",
"value",
".",
"trim",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"let",
"clientX",
"=",
"parseInt",
"(",
"input",
".",
"style",
".",
"left",
",",
"10",
")",
";",
"let",
"clientY",
... | Save a text annotation from input | [
"Save",
"a",
"text",
"annotation",
"from",
"input"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/text.js#L65-L96 |
11,533 | instructure/pdf-annotate.js | src/UI/text.js | closeInput | function closeInput() {
if (input) {
input.removeEventListener('blur', handleInputBlur);
input.removeEventListener('keyup', handleInputKeyup);
document.body.removeChild(input);
input = null;
}
} | javascript | function closeInput() {
if (input) {
input.removeEventListener('blur', handleInputBlur);
input.removeEventListener('keyup', handleInputKeyup);
document.body.removeChild(input);
input = null;
}
} | [
"function",
"closeInput",
"(",
")",
"{",
"if",
"(",
"input",
")",
"{",
"input",
".",
"removeEventListener",
"(",
"'blur'",
",",
"handleInputBlur",
")",
";",
"input",
".",
"removeEventListener",
"(",
"'keyup'",
",",
"handleInputKeyup",
")",
";",
"document",
"... | Close the input | [
"Close",
"the",
"input"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/text.js#L101-L108 |
11,534 | instructure/pdf-annotate.js | src/render/appendChild.js | transform | function transform(node, viewport) {
let trans = getTranslation(viewport);
// Let SVG natively transform the element
node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`);
// Manually adjust x/y for nested SVG nodes
if (!isFirefox && node... | javascript | function transform(node, viewport) {
let trans = getTranslation(viewport);
// Let SVG natively transform the element
node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`);
// Manually adjust x/y for nested SVG nodes
if (!isFirefox && node... | [
"function",
"transform",
"(",
"node",
",",
"viewport",
")",
"{",
"let",
"trans",
"=",
"getTranslation",
"(",
"viewport",
")",
";",
"// Let SVG natively transform the element",
"node",
".",
"setAttribute",
"(",
"'transform'",
",",
"`",
"${",
"viewport",
".",
"sca... | Transform the rotation and scale of a node using SVG's native transform attribute.
@param {Node} node The node to be transformed
@param {Object} viewport The page's viewport data
@return {Node} | [
"Transform",
"the",
"rotation",
"and",
"scale",
"of",
"a",
"node",
"using",
"SVG",
"s",
"native",
"transform",
"attribute",
"."
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/render/appendChild.js#L51-L100 |
11,535 | instructure/pdf-annotate.js | src/UI/page.js | scalePage | function scalePage(pageNumber, viewport, context) {
let page = document.getElementById(`pageContainer${pageNumber}`);
let canvas = page.querySelector('.canvasWrapper canvas');
let svg = page.querySelector('.annotationLayer');
let wrapper = page.querySelector('.canvasWrapper');
let textLayer = page.querySelect... | javascript | function scalePage(pageNumber, viewport, context) {
let page = document.getElementById(`pageContainer${pageNumber}`);
let canvas = page.querySelector('.canvasWrapper canvas');
let svg = page.querySelector('.annotationLayer');
let wrapper = page.querySelector('.canvasWrapper');
let textLayer = page.querySelect... | [
"function",
"scalePage",
"(",
"pageNumber",
",",
"viewport",
",",
"context",
")",
"{",
"let",
"page",
"=",
"document",
".",
"getElementById",
"(",
"`",
"${",
"pageNumber",
"}",
"`",
")",
";",
"let",
"canvas",
"=",
"page",
".",
"querySelector",
"(",
"'.ca... | Scale the elements of a page.
@param {Number} pageNumber The page number to be scaled
@param {Object} viewport The viewport of the PDF page (see pdfPage.getViewport(scale, rotate))
@param {Object} context The canvas context that the PDF page is rendered to
@return {Array} The transform data for rendering the PDF page | [
"Scale",
"the",
"elements",
"of",
"a",
"page",
"."
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/page.js#L112-L141 |
11,536 | instructure/pdf-annotate.js | src/a11y/insertElementWithinElement.js | textLayerElementFromPoint | function textLayerElementFromPoint(x, y, pageNumber) {
let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`);
let rect = svg.getBoundingClientRect();
y = scaleUp(svg, {y}).y + rect.top;
x = scaleUp(svg, {x}).x + rect.left;
return [...svg.parentNode.querySelectorAll('.textLayer [data-... | javascript | function textLayerElementFromPoint(x, y, pageNumber) {
let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`);
let rect = svg.getBoundingClientRect();
y = scaleUp(svg, {y}).y + rect.top;
x = scaleUp(svg, {x}).x + rect.left;
return [...svg.parentNode.querySelectorAll('.textLayer [data-... | [
"function",
"textLayerElementFromPoint",
"(",
"x",
",",
"y",
",",
"pageNumber",
")",
"{",
"let",
"svg",
"=",
"document",
".",
"querySelector",
"(",
"`",
"${",
"pageNumber",
"}",
"`",
")",
";",
"let",
"rect",
"=",
"svg",
".",
"getBoundingClientRect",
"(",
... | Get a text layer element at a given point on a page
@param {Number} x The x coordinate of the point
@param {Number} y The y coordinate of the point
@param {Number} pageNumber The page to limit elements to
@return {Element} First text layer element found at the point | [
"Get",
"a",
"text",
"layer",
"element",
"at",
"a",
"given",
"point",
"on",
"a",
"page"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/insertElementWithinElement.js#L84-L92 |
11,537 | instructure/pdf-annotate.js | src/UI/pen.js | savePoint | function savePoint(x, y) {
let svg = findSVGAtPoint(x, y);
if (!svg) {
return;
}
let rect = svg.getBoundingClientRect();
let point = scaleDown(svg, {
x: x - rect.left,
y: y - rect.top
});
lines.push([point.x, point.y]);
if (lines.length <= 1) {
return;
}
if (path) {
svg.remov... | javascript | function savePoint(x, y) {
let svg = findSVGAtPoint(x, y);
if (!svg) {
return;
}
let rect = svg.getBoundingClientRect();
let point = scaleDown(svg, {
x: x - rect.left,
y: y - rect.top
});
lines.push([point.x, point.y]);
if (lines.length <= 1) {
return;
}
if (path) {
svg.remov... | [
"function",
"savePoint",
"(",
"x",
",",
"y",
")",
"{",
"let",
"svg",
"=",
"findSVGAtPoint",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"!",
"svg",
")",
"{",
"return",
";",
"}",
"let",
"rect",
"=",
"svg",
".",
"getBoundingClientRect",
"(",
")",
";",... | Save a point to the line being drawn.
@param {Number} x The x coordinate of the point
@param {Number} y The y coordinate of the point | [
"Save",
"a",
"point",
"to",
"the",
"line",
"being",
"drawn",
"."
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/pen.js#L87-L115 |
11,538 | instructure/pdf-annotate.js | src/a11y/renderScreenReaderHints.js | sortByLinePoint | function sortByLinePoint(a, b) {
let lineA = a.lines[0];
let lineB = b.lines[0];
return sortByPoint(
{x: lineA[0], y: lineA[1]},
{x: lineB[0], y: lineB[1]}
);
} | javascript | function sortByLinePoint(a, b) {
let lineA = a.lines[0];
let lineB = b.lines[0];
return sortByPoint(
{x: lineA[0], y: lineA[1]},
{x: lineB[0], y: lineB[1]}
);
} | [
"function",
"sortByLinePoint",
"(",
"a",
",",
"b",
")",
"{",
"let",
"lineA",
"=",
"a",
".",
"lines",
"[",
"0",
"]",
";",
"let",
"lineB",
"=",
"b",
".",
"lines",
"[",
"0",
"]",
";",
"return",
"sortByPoint",
"(",
"{",
"x",
":",
"lineA",
"[",
"0",... | Sort annotation by it's first line | [
"Sort",
"annotation",
"by",
"it",
"s",
"first",
"line"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/renderScreenReaderHints.js#L42-L49 |
11,539 | instructure/pdf-annotate.js | src/UI/point.js | savePoint | function savePoint() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let content = input.value.trim();
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let rect = svg.getBoundingClient... | javascript | function savePoint() {
if (input.value.trim().length > 0) {
let clientX = parseInt(input.style.left, 10);
let clientY = parseInt(input.style.top, 10);
let content = input.value.trim();
let svg = findSVGAtPoint(clientX, clientY);
if (!svg) {
return;
}
let rect = svg.getBoundingClient... | [
"function",
"savePoint",
"(",
")",
"{",
"if",
"(",
"input",
".",
"value",
".",
"trim",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"let",
"clientX",
"=",
"parseInt",
"(",
"input",
".",
"style",
".",
"left",
",",
"10",
")",
";",
"let",
"clientY",... | Save a new point annotation from input | [
"Save",
"a",
"new",
"point",
"annotation",
"from",
"input"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/point.js#L62-L95 |
11,540 | instructure/pdf-annotate.js | shared/pdf_viewer.js | binarySearchFirstItem | function binarySearchFirstItem(items, condition) {
var minIndex = 0;
var maxIndex = items.length - 1;
if (items.length === 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {
return minIndex;
}
while (minIndex < maxIndex) {
var currentIndex = (minInde... | javascript | function binarySearchFirstItem(items, condition) {
var minIndex = 0;
var maxIndex = items.length - 1;
if (items.length === 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {
return minIndex;
}
while (minIndex < maxIndex) {
var currentIndex = (minInde... | [
"function",
"binarySearchFirstItem",
"(",
"items",
",",
"condition",
")",
"{",
"var",
"minIndex",
"=",
"0",
";",
"var",
"maxIndex",
"=",
"items",
".",
"length",
"-",
"1",
";",
"if",
"(",
"items",
".",
"length",
"===",
"0",
"||",
"!",
"condition",
"(",
... | Use binary search to find the index of the first item in a given array which
passes a given condition. The items are expected to be sorted in the sense
that if the condition is true for one item in the array, then it is also true
for all following items.
@returns {Number} Index of the first array element to pass the t... | [
"Use",
"binary",
"search",
"to",
"find",
"the",
"index",
"of",
"the",
"first",
"item",
"in",
"a",
"given",
"array",
"which",
"passes",
"a",
"given",
"condition",
".",
"The",
"items",
"are",
"expected",
"to",
"be",
"sorted",
"in",
"the",
"sense",
"that",
... | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/shared/pdf_viewer.js#L161-L182 |
11,541 | instructure/pdf-annotate.js | shared/pdf_viewer.js | PDFRenderingQueue_renderView | function PDFRenderingQueue_renderView(view) {
var state = view.renderingState;
switch (state) {
case RenderingStates.FINISHED:
return false;
case RenderingStates.PAUSED:
this.highestPriorityPage = view.renderingId;
view.resume();
break;
case Re... | javascript | function PDFRenderingQueue_renderView(view) {
var state = view.renderingState;
switch (state) {
case RenderingStates.FINISHED:
return false;
case RenderingStates.PAUSED:
this.highestPriorityPage = view.renderingId;
view.resume();
break;
case Re... | [
"function",
"PDFRenderingQueue_renderView",
"(",
"view",
")",
"{",
"var",
"state",
"=",
"view",
".",
"renderingState",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"RenderingStates",
".",
"FINISHED",
":",
"return",
"false",
";",
"case",
"RenderingStates",
".... | Render a page or thumbnail view. This calls the appropriate function
based on the views state. If the view is already rendered it will return
false.
@param {IRenderableView} view | [
"Render",
"a",
"page",
"or",
"thumbnail",
"view",
".",
"This",
"calls",
"the",
"appropriate",
"function",
"based",
"on",
"the",
"views",
"state",
".",
"If",
"the",
"view",
"is",
"already",
"rendered",
"it",
"will",
"return",
"false",
"."
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/shared/pdf_viewer.js#L846-L867 |
11,542 | instructure/pdf-annotate.js | src/a11y/initEventHandlers.js | reorderAnnotationsByType | function reorderAnnotationsByType(documentId, pageNumber, type) {
PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber)
.then((annotations) => {
return annotations.annotations.filter((a) => {
return a.type === type;
});
})
.then((annotations) => {
annotations.for... | javascript | function reorderAnnotationsByType(documentId, pageNumber, type) {
PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber)
.then((annotations) => {
return annotations.annotations.filter((a) => {
return a.type === type;
});
})
.then((annotations) => {
annotations.for... | [
"function",
"reorderAnnotationsByType",
"(",
"documentId",
",",
"pageNumber",
",",
"type",
")",
"{",
"PDFJSAnnotate",
".",
"getStoreAdapter",
"(",
")",
".",
"getAnnotations",
"(",
"documentId",
",",
"pageNumber",
")",
".",
"then",
"(",
"(",
"annotations",
")",
... | Reorder the annotation numbers by annotation type
@param {String} documentId The ID of the document
@param {Number} pageNumber The page number of the annotations
@param {Strig} type The annotation type | [
"Reorder",
"the",
"annotation",
"numbers",
"by",
"annotation",
"type"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L30-L45 |
11,543 | instructure/pdf-annotate.js | src/a11y/initEventHandlers.js | insertComment | function insertComment(documentId, annotationId, comment) {
let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);
let promise;
if (!list) {
promise = renderScreenReaderComments(documentId, annotationId, []).then(() => {
list = document.querySelector(`pdf-annotate-... | javascript | function insertComment(documentId, annotationId, comment) {
let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);
let promise;
if (!list) {
promise = renderScreenReaderComments(documentId, annotationId, []).then(() => {
list = document.querySelector(`pdf-annotate-... | [
"function",
"insertComment",
"(",
"documentId",
",",
"annotationId",
",",
"comment",
")",
"{",
"let",
"list",
"=",
"document",
".",
"querySelector",
"(",
"`",
"${",
"annotationId",
"}",
"`",
")",
";",
"let",
"promise",
";",
"if",
"(",
"!",
"list",
")",
... | Insert a screen reader hint for a comment
@param {String} documentId The ID of the document
@param {String} annotationId The ID of tha assocated annotation
@param {Object} comment The comment to insert a hint for | [
"Insert",
"a",
"screen",
"reader",
"hint",
"for",
"a",
"comment"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L65-L81 |
11,544 | instructure/pdf-annotate.js | src/a11y/initEventHandlers.js | removeElementById | function removeElementById(elementId) {
let el = document.getElementById(elementId);
if (el) {
el.parentNode.removeChild(el);
}
} | javascript | function removeElementById(elementId) {
let el = document.getElementById(elementId);
if (el) {
el.parentNode.removeChild(el);
}
} | [
"function",
"removeElementById",
"(",
"elementId",
")",
"{",
"let",
"el",
"=",
"document",
".",
"getElementById",
"(",
"elementId",
")",
";",
"if",
"(",
"el",
")",
"{",
"el",
".",
"parentNode",
".",
"removeChild",
"(",
"el",
")",
";",
"}",
"}"
] | Remove an element from the DOM by it's ID if it exists
@param {String} elementID The ID of the element to be removed | [
"Remove",
"an",
"element",
"from",
"the",
"DOM",
"by",
"it",
"s",
"ID",
"if",
"it",
"exists"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L98-L103 |
11,545 | instructure/pdf-annotate.js | src/UI/rect.js | getSelectionRects | function getSelectionRects() {
try {
let selection = window.getSelection();
let range = selection.getRangeAt(0);
let rects = range.getClientRects();
if (rects.length > 0 &&
rects[0].width > 0 &&
rects[0].height > 0) {
return rects;
}
} catch (e) {}
return null;
} | javascript | function getSelectionRects() {
try {
let selection = window.getSelection();
let range = selection.getRangeAt(0);
let rects = range.getClientRects();
if (rects.length > 0 &&
rects[0].width > 0 &&
rects[0].height > 0) {
return rects;
}
} catch (e) {}
return null;
} | [
"function",
"getSelectionRects",
"(",
")",
"{",
"try",
"{",
"let",
"selection",
"=",
"window",
".",
"getSelection",
"(",
")",
";",
"let",
"range",
"=",
"selection",
".",
"getRangeAt",
"(",
"0",
")",
";",
"let",
"rects",
"=",
"range",
".",
"getClientRects... | Get the current window selection as rects
@return {Array} An Array of rects | [
"Get",
"the",
"current",
"window",
"selection",
"as",
"rects"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/rect.js#L25-L39 |
11,546 | instructure/pdf-annotate.js | src/UI/rect.js | saveRect | function saveRect(type, rects, color) {
let svg = findSVGAtPoint(rects[0].left, rects[0].top);
let node;
let annotation;
if (!svg) {
return;
}
let boundingRect = svg.getBoundingClientRect();
if (!color) {
if (type === 'highlight') {
color = 'FFFF00';
} else if (type === 'strikeout') {... | javascript | function saveRect(type, rects, color) {
let svg = findSVGAtPoint(rects[0].left, rects[0].top);
let node;
let annotation;
if (!svg) {
return;
}
let boundingRect = svg.getBoundingClientRect();
if (!color) {
if (type === 'highlight') {
color = 'FFFF00';
} else if (type === 'strikeout') {... | [
"function",
"saveRect",
"(",
"type",
",",
"rects",
",",
"color",
")",
"{",
"let",
"svg",
"=",
"findSVGAtPoint",
"(",
"rects",
"[",
"0",
"]",
".",
"left",
",",
"rects",
"[",
"0",
"]",
".",
"top",
")",
";",
"let",
"node",
";",
"let",
"annotation",
... | Save a rect annotation
@param {String} type The type of rect (area, highlight, strikeout)
@param {Array} rects The rects to use for annotation
@param {String} color The color of the rects | [
"Save",
"a",
"rect",
"annotation"
] | f56e8aa2027326894861ef6b060824137e79a1be | https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/rect.js#L146-L207 |
11,547 | rikschennink/fitty | dist/fitty.module.js | redraw | function redraw(fitties) {
// getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow
// check if styles of all fitties have been computed
fitties.filter(function (f) {
return !f.styleComputed;
}).forEach(function (f)... | javascript | function redraw(fitties) {
// getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow
// check if styles of all fitties have been computed
fitties.filter(function (f) {
return !f.styleComputed;
}).forEach(function (f)... | [
"function",
"redraw",
"(",
"fitties",
")",
"{",
"// getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow",
"// check if styles of all fitties have been computed",
"fitties",
".",
"filter",
"(",
"function",
"(... | redraws fitties so they nicely fit their parent container | [
"redraws",
"fitties",
"so",
"they",
"nicely",
"fit",
"their",
"parent",
"container"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L58-L86 |
11,548 | rikschennink/fitty | dist/fitty.module.js | shouldRedraw | function shouldRedraw(f) {
return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth;
} | javascript | function shouldRedraw(f) {
return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth;
} | [
"function",
"shouldRedraw",
"(",
"f",
")",
"{",
"return",
"f",
".",
"dirty",
"!==",
"DrawState",
".",
"DIRTY_LAYOUT",
"||",
"f",
".",
"dirty",
"===",
"DrawState",
".",
"DIRTY_LAYOUT",
"&&",
"f",
".",
"element",
".",
"parentNode",
".",
"clientWidth",
"!==",... | should always redraw if is not dirty layout, if is dirty layout, only redraw if size has changed | [
"should",
"always",
"redraw",
"if",
"is",
"not",
"dirty",
"layout",
"if",
"is",
"dirty",
"layout",
"only",
"redraw",
"if",
"size",
"has",
"changed"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L111-L113 |
11,549 | rikschennink/fitty | dist/fitty.module.js | computeStyle | function computeStyle(f) {
// get style properties
var style = w.getComputedStyle(f.element, null);
// get current font size in pixels (if we already calculated it, use the calculated version)
f.currentFontSize = parseInt(style.getPropertyValue('font-size'), 10);
// get display type and wrap mode... | javascript | function computeStyle(f) {
// get style properties
var style = w.getComputedStyle(f.element, null);
// get current font size in pixels (if we already calculated it, use the calculated version)
f.currentFontSize = parseInt(style.getPropertyValue('font-size'), 10);
// get display type and wrap mode... | [
"function",
"computeStyle",
"(",
"f",
")",
"{",
"// get style properties",
"var",
"style",
"=",
"w",
".",
"getComputedStyle",
"(",
"f",
".",
"element",
",",
"null",
")",
";",
"// get current font size in pixels (if we already calculated it, use the calculated version)",
"... | every fitty element is tested for invalid styles | [
"every",
"fitty",
"element",
"is",
"tested",
"for",
"invalid",
"styles"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L116-L127 |
11,550 | rikschennink/fitty | dist/fitty.module.js | shouldPreStyle | function shouldPreStyle(f) {
var preStyle = false;
// if we already tested for prestyling we don't have to do it again
if (f.preStyleTestCompleted) {
return false;
}
// should have an inline style, if not, apply
if (!/inline-/.test(f.display)) {
preStyle = true;
f.display = ... | javascript | function shouldPreStyle(f) {
var preStyle = false;
// if we already tested for prestyling we don't have to do it again
if (f.preStyleTestCompleted) {
return false;
}
// should have an inline style, if not, apply
if (!/inline-/.test(f.display)) {
preStyle = true;
f.display = ... | [
"function",
"shouldPreStyle",
"(",
"f",
")",
"{",
"var",
"preStyle",
"=",
"false",
";",
"// if we already tested for prestyling we don't have to do it again",
"if",
"(",
"f",
".",
"preStyleTestCompleted",
")",
"{",
"return",
"false",
";",
"}",
"// should have an inline ... | determines if this fitty requires initial styling, can be prevented by applying correct styles through CSS | [
"determines",
"if",
"this",
"fitty",
"requires",
"initial",
"styling",
"can",
"be",
"prevented",
"by",
"applying",
"correct",
"styles",
"through",
"CSS"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L130-L155 |
11,551 | rikschennink/fitty | dist/fitty.module.js | applyStyle | function applyStyle(f) {
// remember original style, we need this to restore the fitty style when unsubscribing
if (!f.originalStyle) {
f.originalStyle = f.element.getAttribute('style') || '';
}
// set the new style to the original style plus the fitty styles
f.element.style.cssText = f.orig... | javascript | function applyStyle(f) {
// remember original style, we need this to restore the fitty style when unsubscribing
if (!f.originalStyle) {
f.originalStyle = f.element.getAttribute('style') || '';
}
// set the new style to the original style plus the fitty styles
f.element.style.cssText = f.orig... | [
"function",
"applyStyle",
"(",
"f",
")",
"{",
"// remember original style, we need this to restore the fitty style when unsubscribing",
"if",
"(",
"!",
"f",
".",
"originalStyle",
")",
"{",
"f",
".",
"originalStyle",
"=",
"f",
".",
"element",
".",
"getAttribute",
"(",
... | apply styles to single fitty | [
"apply",
"styles",
"to",
"single",
"fitty"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L158-L167 |
11,552 | rikschennink/fitty | dist/fitty.module.js | dispatchFitEvent | function dispatchFitEvent(f) {
f.element.dispatchEvent(new CustomEvent('fit', {
detail: {
oldValue: f.previousFontSize,
newValue: f.currentFontSize,
scaleFactor: f.currentFontSize / f.previousFontSize
}
}));
} | javascript | function dispatchFitEvent(f) {
f.element.dispatchEvent(new CustomEvent('fit', {
detail: {
oldValue: f.previousFontSize,
newValue: f.currentFontSize,
scaleFactor: f.currentFontSize / f.previousFontSize
}
}));
} | [
"function",
"dispatchFitEvent",
"(",
"f",
")",
"{",
"f",
".",
"element",
".",
"dispatchEvent",
"(",
"new",
"CustomEvent",
"(",
"'fit'",
",",
"{",
"detail",
":",
"{",
"oldValue",
":",
"f",
".",
"previousFontSize",
",",
"newValue",
":",
"f",
".",
"currentF... | dispatch a fit event on a fitty | [
"dispatch",
"a",
"fit",
"event",
"on",
"a",
"fitty"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L170-L178 |
11,553 | rikschennink/fitty | dist/fitty.module.js | subscribe | function subscribe(f) {
// this is a new fitty so we need to validate if it's styles are in order
f.newbie = true;
// because it's a new fitty it should also be dirty, we want it to redraw on the first loop
f.dirty = true;
// we want to be able to update this fitty
fitties.push(f);
} | javascript | function subscribe(f) {
// this is a new fitty so we need to validate if it's styles are in order
f.newbie = true;
// because it's a new fitty it should also be dirty, we want it to redraw on the first loop
f.dirty = true;
// we want to be able to update this fitty
fitties.push(f);
} | [
"function",
"subscribe",
"(",
"f",
")",
"{",
"// this is a new fitty so we need to validate if it's styles are in order",
"f",
".",
"newbie",
"=",
"true",
";",
"// because it's a new fitty it should also be dirty, we want it to redraw on the first loop",
"f",
".",
"dirty",
"=",
"... | add a new fitty, does not redraw said fitty | [
"add",
"a",
"new",
"fitty",
"does",
"not",
"redraw",
"said",
"fitty"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L189-L199 |
11,554 | rikschennink/fitty | dist/fitty.module.js | unsubscribe | function unsubscribe(f) {
return function () {
// remove from fitties array
fitties = fitties.filter(function (_) {
return _.element !== f.element;
});
// stop observing DOM
if (f.observeMutations) {
f.observer.disconnect();
}
// reset font size to inheri... | javascript | function unsubscribe(f) {
return function () {
// remove from fitties array
fitties = fitties.filter(function (_) {
return _.element !== f.element;
});
// stop observing DOM
if (f.observeMutations) {
f.observer.disconnect();
}
// reset font size to inheri... | [
"function",
"unsubscribe",
"(",
"f",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// remove from fitties array",
"fitties",
"=",
"fitties",
".",
"filter",
"(",
"function",
"(",
"_",
")",
"{",
"return",
"_",
".",
"element",
"!==",
"f",
".",
"element",
... | remove an existing fitty | [
"remove",
"an",
"existing",
"fitty"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L202-L218 |
11,555 | rikschennink/fitty | dist/fitty.module.js | fittyCreate | function fittyCreate(elements, options) {
// set options object
var fittyOptions = _extends({}, defaultOptions, options);
// create fitties
var publicFitties = elements.map(function (element) {
// create fitty instance
var f = _extends({}, fittyOptions, {
// internal options for ... | javascript | function fittyCreate(elements, options) {
// set options object
var fittyOptions = _extends({}, defaultOptions, options);
// create fitties
var publicFitties = elements.map(function (element) {
// create fitty instance
var f = _extends({}, fittyOptions, {
// internal options for ... | [
"function",
"fittyCreate",
"(",
"elements",
",",
"options",
")",
"{",
"// set options object",
"var",
"fittyOptions",
"=",
"_extends",
"(",
"{",
"}",
",",
"defaultOptions",
",",
"options",
")",
";",
"// create fitties",
"var",
"publicFitties",
"=",
"elements",
"... | array of elements in, fitty instances out | [
"array",
"of",
"elements",
"in",
"fitty",
"instances",
"out"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L250-L284 |
11,556 | rikschennink/fitty | dist/fitty.module.js | fitty | function fitty(target) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// if target is a string
return typeof target === 'string' ?
// treat it as a querySelector
fittyCreate(toArray(document.querySelectorAll(target)), options) :
// create single fitty... | javascript | function fitty(target) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// if target is a string
return typeof target === 'string' ?
// treat it as a querySelector
fittyCreate(toArray(document.querySelectorAll(target)), options) :
// create single fitty... | [
"function",
"fitty",
"(",
"target",
")",
"{",
"var",
"options",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"{",
"}",
";",
"// if target is a string",
"return",
... | fitty creation function | [
"fitty",
"creation",
"function"
] | 6c254ac412336a5cb80a5c25adb7779992ce14f8 | https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L287-L299 |
11,557 | htmlhint/HTMLHint | bin/formatter.js | loadFormatters | function loadFormatters(){
var arrFiles = glob.sync('./formatters/*.js', {
'cwd': __dirname,
'dot': false,
'nodir': true,
'strict': false,
'silent': true
});
var mapFormatters = {};
arrFiles.forEach(function(file){
var fileInfo = path.parse(file);
... | javascript | function loadFormatters(){
var arrFiles = glob.sync('./formatters/*.js', {
'cwd': __dirname,
'dot': false,
'nodir': true,
'strict': false,
'silent': true
});
var mapFormatters = {};
arrFiles.forEach(function(file){
var fileInfo = path.parse(file);
... | [
"function",
"loadFormatters",
"(",
")",
"{",
"var",
"arrFiles",
"=",
"glob",
".",
"sync",
"(",
"'./formatters/*.js'",
",",
"{",
"'cwd'",
":",
"__dirname",
",",
"'dot'",
":",
"false",
",",
"'nodir'",
":",
"true",
",",
"'strict'",
":",
"false",
",",
"'sile... | load all formatters | [
"load",
"all",
"formatters"
] | bb9a51e407b2ee1cc0173e70326b3ba786cdad69 | https://github.com/htmlhint/HTMLHint/blob/bb9a51e407b2ee1cc0173e70326b3ba786cdad69/bin/formatter.js#L21-L36 |
11,558 | iamceege/tooltipster | src/js/tooltipster.js | function(constructor, obj, pluginName) {
// if it's not already bridged
if (!obj[pluginName]) {
var fn = function() {};
fn.prototype = constructor;
var pluginInstance = new fn();
// the _init method has to exist in instance constructors but might be missing
// in core constructors
i... | javascript | function(constructor, obj, pluginName) {
// if it's not already bridged
if (!obj[pluginName]) {
var fn = function() {};
fn.prototype = constructor;
var pluginInstance = new fn();
// the _init method has to exist in instance constructors but might be missing
// in core constructors
i... | [
"function",
"(",
"constructor",
",",
"obj",
",",
"pluginName",
")",
"{",
"// if it's not already bridged",
"if",
"(",
"!",
"obj",
"[",
"pluginName",
"]",
")",
"{",
"var",
"fn",
"=",
"function",
"(",
")",
"{",
"}",
";",
"fn",
".",
"prototype",
"=",
"con... | A function to proxy the public methods of an object onto another
@param {object} constructor The constructor to bridge
@param {object} obj The object that will get new methods (an instance or the core)
@param {string} pluginName A plugin name for the console log message
@return {core}
@private | [
"A",
"function",
"to",
"proxy",
"the",
"public",
"methods",
"of",
"an",
"object",
"onto",
"another"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L99-L143 | |
11,559 | iamceege/tooltipster | src/js/tooltipster.js | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// note: the order of emitters matters
this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args);
this.__$emitterPublic.trigger.apply(this.__$emitterPublic, a... | javascript | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// note: the order of emitters matters
this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args);
this.__$emitterPublic.trigger.apply(this.__$emitterPublic, a... | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
";",
"if",
"(",
"typeof",
"args",
"[",
"0",
"]",
"==",
"'string'",
")",
"{",
"args",
"[",
"0",
"]",
"=",
"{",
"type",
"... | Trigger events on the core emitters
@returns {core}
@protected | [
"Trigger",
"events",
"on",
"the",
"core",
"emitters"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L263-L276 | |
11,560 | iamceege/tooltipster | src/js/tooltipster.js | function(selector) {
var instances = [],
sel = selector || '.tooltipstered';
$(sel).each(function() {
var $this = $(this),
ns = $this.data('tooltipster-ns');
if (ns) {
$.each(ns, function(i, namespace) {
instances.push($this.data(namespace));
});
}
});
return i... | javascript | function(selector) {
var instances = [],
sel = selector || '.tooltipstered';
$(sel).each(function() {
var $this = $(this),
ns = $this.data('tooltipster-ns');
if (ns) {
$.each(ns, function(i, namespace) {
instances.push($this.data(namespace));
});
}
});
return i... | [
"function",
"(",
"selector",
")",
"{",
"var",
"instances",
"=",
"[",
"]",
",",
"sel",
"=",
"selector",
"||",
"'.tooltipstered'",
";",
"$",
"(",
"sel",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"var",
"$this",
"=",
"$",
"(",
"this",
")",
"... | Returns instances of all tooltips in the page or an a given element
@param {string|HTML object collection} selector optional Use this
parameter to restrict the set of objects that will be inspected
for the retrieval of instances. By default, all instances in the
page are returned.
@return {array} An array of instance ... | [
"Returns",
"instances",
"of",
"all",
"tooltips",
"in",
"the",
"page",
"or",
"an",
"a",
"given",
"element"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L288-L307 | |
11,561 | iamceege/tooltipster | src/js/tooltipster.js | function() {
var self = this,
$el = self._$tooltip.find('.tooltipster-content'),
formattedContent = self.__Content,
format = function(content) {
formattedContent = content;
};
self._trigger({
type: 'format',
content: self.__Content,
format: format
});
if (self.__options.functio... | javascript | function() {
var self = this,
$el = self._$tooltip.find('.tooltipster-content'),
formattedContent = self.__Content,
format = function(content) {
formattedContent = content;
};
self._trigger({
type: 'format',
content: self.__Content,
format: format
});
if (self.__options.functio... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"$el",
"=",
"self",
".",
"_$tooltip",
".",
"find",
"(",
"'.tooltipster-content'",
")",
",",
"formattedContent",
"=",
"self",
".",
"__Content",
",",
"format",
"=",
"function",
"(",
"content",
")"... | Insert the content into the appropriate HTML element of the tooltip
@returns {self}
@private | [
"Insert",
"the",
"content",
"into",
"the",
"appropriate",
"HTML",
"element",
"of",
"the",
"tooltip"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L575-L610 | |
11,562 | iamceege/tooltipster | src/js/tooltipster.js | function(content) {
// clone if asked. Cloning the object makes sure that each instance has its
// own version of the content (in case a same object were provided for several
// instances)
// reminder: typeof null === object
if (content instanceof $ && this.__options.contentCloning) {
content = content.... | javascript | function(content) {
// clone if asked. Cloning the object makes sure that each instance has its
// own version of the content (in case a same object were provided for several
// instances)
// reminder: typeof null === object
if (content instanceof $ && this.__options.contentCloning) {
content = content.... | [
"function",
"(",
"content",
")",
"{",
"// clone if asked. Cloning the object makes sure that each instance has its",
"// own version of the content (in case a same object were provided for several",
"// instances)",
"// reminder: typeof null === object",
"if",
"(",
"content",
"instanceof",
... | Save the content, cloning it beforehand if need be
@param content
@returns {self}
@private | [
"Save",
"the",
"content",
"cloning",
"it",
"beforehand",
"if",
"need",
"be"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L619-L637 | |
11,563 | iamceege/tooltipster | src/js/tooltipster.js | function(r) {
geo.origin.size.height = r.height,
geo.origin.windowOffset.left = r.left,
geo.origin.windowOffset.top = r.top,
geo.origin.size.width = r.width
} | javascript | function(r) {
geo.origin.size.height = r.height,
geo.origin.windowOffset.left = r.left,
geo.origin.windowOffset.top = r.top,
geo.origin.size.width = r.width
} | [
"function",
"(",
"r",
")",
"{",
"geo",
".",
"origin",
".",
"size",
".",
"height",
"=",
"r",
".",
"height",
",",
"geo",
".",
"origin",
".",
"windowOffset",
".",
"left",
"=",
"r",
".",
"left",
",",
"geo",
".",
"origin",
".",
"windowOffset",
".",
"t... | user callback through an event | [
"user",
"callback",
"through",
"an",
"event"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L832-L837 | |
11,564 | iamceege/tooltipster | src/js/tooltipster.js | function() {
if (typeof this.__options.animationDuration == 'number') {
this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration];
}
if (typeof this.__options.delay == 'number') {
this.__options.delay = [this.__options.delay, this.__options.delay];
}
... | javascript | function() {
if (typeof this.__options.animationDuration == 'number') {
this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration];
}
if (typeof this.__options.delay == 'number') {
this.__options.delay = [this.__options.delay, this.__options.delay];
}
... | [
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"this",
".",
"__options",
".",
"animationDuration",
"==",
"'number'",
")",
"{",
"this",
".",
"__options",
".",
"animationDuration",
"=",
"[",
"this",
".",
"__options",
".",
"animationDuration",
",",
"this",
"... | Some options may need to be formated before being used
@returns {self}
@private | [
"Some",
"options",
"may",
"need",
"to",
"be",
"formated",
"before",
"being",
"used"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L924-L980 | |
11,565 | iamceege/tooltipster | src/js/tooltipster.js | function() {
var self = this;
// in case the selfDestruction option has been changed by a method call
if (self.__options.selfDestruction) {
// the GC task
self.__garbageCollector = setInterval(function() {
var now = new Date().getTime();
// forget the old events
self.__touchE... | javascript | function() {
var self = this;
// in case the selfDestruction option has been changed by a method call
if (self.__options.selfDestruction) {
// the GC task
self.__garbageCollector = setInterval(function() {
var now = new Date().getTime();
// forget the old events
self.__touchE... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// in case the selfDestruction option has been changed by a method call",
"if",
"(",
"self",
".",
"__options",
".",
"selfDestruction",
")",
"{",
"// the GC task",
"self",
".",
"__garbageCollector",
"=",
"set... | Schedules or cancels the garbage collector task
@returns {self}
@private | [
"Schedules",
"or",
"cancels",
"the",
"garbage",
"collector",
"task"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L988-L1020 | |
11,566 | iamceege/tooltipster | src/js/tooltipster.js | function() {
// there is only one possible open timeout: the delayed opening
// when the mouseenter/touchstart open triggers are used
clearTimeout(this.__timeouts.open);
this.__timeouts.open = null;
// ... but several close timeouts: the delayed closing when the
// mouseleave close trigger is used and... | javascript | function() {
// there is only one possible open timeout: the delayed opening
// when the mouseenter/touchstart open triggers are used
clearTimeout(this.__timeouts.open);
this.__timeouts.open = null;
// ... but several close timeouts: the delayed closing when the
// mouseleave close trigger is used and... | [
"function",
"(",
")",
"{",
"// there is only one possible open timeout: the delayed opening",
"// when the mouseenter/touchstart open triggers are used",
"clearTimeout",
"(",
"this",
".",
"__timeouts",
".",
"open",
")",
";",
"this",
".",
"__timeouts",
".",
"open",
"=",
"nul... | Clear appearance timeouts
@returns {self}
@private | [
"Clear",
"appearance",
"timeouts"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L1320-L1335 | |
11,567 | iamceege/tooltipster | src/js/tooltipster.js | function(pluginName, defaultOptions) {
var self = this,
options = $.extend(true, {}, defaultOptions);
// if the plugin options were isolated in a property named after the
// plugin, use them (prevents conflicts with other plugins)
var pluginOptions = self.__options[pluginName];
// if not, try to g... | javascript | function(pluginName, defaultOptions) {
var self = this,
options = $.extend(true, {}, defaultOptions);
// if the plugin options were isolated in a property named after the
// plugin, use them (prevents conflicts with other plugins)
var pluginOptions = self.__options[pluginName];
// if not, try to g... | [
"function",
"(",
"pluginName",
",",
"defaultOptions",
")",
"{",
"var",
"self",
"=",
"this",
",",
"options",
"=",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"defaultOptions",
")",
";",
"// if the plugin options were isolated in a property named after the"... | Meant for plugins to get their options
@param {string} pluginName The name of the plugin that asks for its options
@param {object} defaultOptions The default options of the plugin
@returns {object} The options
@protected | [
"Meant",
"for",
"plugins",
"to",
"get",
"their",
"options"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2117-L2168 | |
11,568 | iamceege/tooltipster | src/js/tooltipster.js | function(pluginName) {
var plugin = $.tooltipster._plugin(pluginName);
if (plugin) {
// if there is a constructor for instances
if (plugin.instance) {
// proxy non-private methods on the instance to allow new instance methods
$.tooltipster.__bridge(plugin.instance, this, plugin.name);
... | javascript | function(pluginName) {
var plugin = $.tooltipster._plugin(pluginName);
if (plugin) {
// if there is a constructor for instances
if (plugin.instance) {
// proxy non-private methods on the instance to allow new instance methods
$.tooltipster.__bridge(plugin.instance, this, plugin.name);
... | [
"function",
"(",
"pluginName",
")",
"{",
"var",
"plugin",
"=",
"$",
".",
"tooltipster",
".",
"_plugin",
"(",
"pluginName",
")",
";",
"if",
"(",
"plugin",
")",
"{",
"// if there is a constructor for instances",
"if",
"(",
"plugin",
".",
"instance",
")",
"{",
... | Used at instantiation of the plugin, or afterwards by plugins that activate themselves
on existing instances
@param {object} pluginName
@returns {self}
@protected | [
"Used",
"at",
"instantiation",
"of",
"the",
"plugin",
"or",
"afterwards",
"by",
"plugins",
"that",
"activate",
"themselves",
"on",
"existing",
"instances"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2178-L2196 | |
11,569 | iamceege/tooltipster | src/js/tooltipster.js | function(event) {
var isEmulated = false,
now = new Date().getTime();
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
// delay, in milliseconds. It's supposed to be 300ms in
// most browsers (350ms on iOS) to allow a double tap but
// can be les... | javascript | function(event) {
var isEmulated = false,
now = new Date().getTime();
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
// delay, in milliseconds. It's supposed to be 300ms in
// most browsers (350ms on iOS) to allow a double tap but
// can be les... | [
"function",
"(",
"event",
")",
"{",
"var",
"isEmulated",
"=",
"false",
",",
"now",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"__touchEvents",
".",
"length",
"-",
"1",
";",
"i",
">=",
... | This will return true if the event is a mouse event which was
emulated by the browser after a touch event. This allows us to
really dissociate mouse and touch triggers.
There is a margin of error if a real mouse event is fired right
after (within the delay shown below) a touch event on the same
element, but hopefully ... | [
"This",
"will",
"return",
"true",
"if",
"the",
"event",
"is",
"a",
"mouse",
"event",
"which",
"was",
"emulated",
"by",
"the",
"browser",
"after",
"a",
"touch",
"event",
".",
"This",
"allows",
"us",
"to",
"really",
"dissociate",
"mouse",
"and",
"touch",
"... | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2210-L2234 | |
11,570 | iamceege/tooltipster | src/js/tooltipster.js | function(event) {
return (
(this._touchIsTouchEvent(event) && !this._touchSwiped(event.target))
|| (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event))
);
} | javascript | function(event) {
return (
(this._touchIsTouchEvent(event) && !this._touchSwiped(event.target))
|| (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event))
);
} | [
"function",
"(",
"event",
")",
"{",
"return",
"(",
"(",
"this",
".",
"_touchIsTouchEvent",
"(",
"event",
")",
"&&",
"!",
"this",
".",
"_touchSwiped",
"(",
"event",
".",
"target",
")",
")",
"||",
"(",
"!",
"this",
".",
"_touchIsTouchEvent",
"(",
"event"... | Returns false if the event was an emulated mouse event or
a touch event involved in a swipe gesture.
@param {object} event
@returns {boolean}
@protected | [
"Returns",
"false",
"if",
"the",
"event",
"was",
"an",
"emulated",
"mouse",
"event",
"or",
"a",
"touch",
"event",
"involved",
"in",
"a",
"swipe",
"gesture",
"."
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2244-L2249 | |
11,571 | iamceege/tooltipster | src/js/tooltipster.js | function(event) {
if (this._touchIsTouchEvent(event)) {
event.time = new Date().getTime();
this.__touchEvents.push(event);
}
return this;
} | javascript | function(event) {
if (this._touchIsTouchEvent(event)) {
event.time = new Date().getTime();
this.__touchEvents.push(event);
}
return this;
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"_touchIsTouchEvent",
"(",
"event",
")",
")",
"{",
"event",
".",
"time",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"this",
".",
"__touchEvents",
".",
"push",
"(",
"event... | Store touch events for a while to detect swiping and emulated mouse events
@param {object} event
@returns {self}
@protected | [
"Store",
"touch",
"events",
"for",
"a",
"while",
"to",
"detect",
"swiping",
"and",
"emulated",
"mouse",
"events"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2269-L2277 | |
11,572 | iamceege/tooltipster | src/js/tooltipster.js | function(target) {
var swiped = false;
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
if (e.type == 'touchmove') {
swiped = true;
break;
}
else if (
e.type == 'touchstart'
&& target === e.target
) {
break;
}
}
retu... | javascript | function(target) {
var swiped = false;
for (var i = this.__touchEvents.length - 1; i >= 0; i--) {
var e = this.__touchEvents[i];
if (e.type == 'touchmove') {
swiped = true;
break;
}
else if (
e.type == 'touchstart'
&& target === e.target
) {
break;
}
}
retu... | [
"function",
"(",
"target",
")",
"{",
"var",
"swiped",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"__touchEvents",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"e",
"=",
"this",
".",
"__touchEv... | Returns true if a swipe happened after the last touchstart event fired on
event.target.
We need to differentiate a swipe from a tap before we let the event open
or close the tooltip. A swipe is when a touchmove (scroll) event happens
on the body between the touchstart and the touchend events of an element.
@param {ob... | [
"Returns",
"true",
"if",
"a",
"swipe",
"happened",
"after",
"the",
"last",
"touchstart",
"event",
"fired",
"on",
"event",
".",
"target",
"."
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2291-L2312 | |
11,573 | iamceege/tooltipster | src/js/tooltipster.js | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// add properties to the event
args[0].instance = this;
args[0].origin = this._$origin ? this._$origin[0] : null;
args[0].tooltip = this._$tooltip ? this._$tooltip[0... | javascript | function() {
var args = Array.prototype.slice.apply(arguments);
if (typeof args[0] == 'string') {
args[0] = { type: args[0] };
}
// add properties to the event
args[0].instance = this;
args[0].origin = this._$origin ? this._$origin[0] : null;
args[0].tooltip = this._$tooltip ? this._$tooltip[0... | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
";",
"if",
"(",
"typeof",
"args",
"[",
"0",
"]",
"==",
"'string'",
")",
"{",
"args",
"[",
"0",
"]",
"=",
"{",
"type",
"... | Triggers an event on the instance emitters
@returns {self}
@protected | [
"Triggers",
"an",
"event",
"on",
"the",
"instance",
"emitters"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2320-L2339 | |
11,574 | iamceege/tooltipster | src/js/tooltipster.js | function(pluginName) {
var self = this;
// if the plugin has been activated on this instance
if (self[pluginName]) {
var plugin = $.tooltipster._plugin(pluginName);
// if there is a constructor for instances
if (plugin.instance) {
// unbridge
$.each(plugin.instance, function(me... | javascript | function(pluginName) {
var self = this;
// if the plugin has been activated on this instance
if (self[pluginName]) {
var plugin = $.tooltipster._plugin(pluginName);
// if there is a constructor for instances
if (plugin.instance) {
// unbridge
$.each(plugin.instance, function(me... | [
"function",
"(",
"pluginName",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// if the plugin has been activated on this instance",
"if",
"(",
"self",
"[",
"pluginName",
"]",
")",
"{",
"var",
"plugin",
"=",
"$",
".",
"tooltipster",
".",
"_plugin",
"(",
"pluginNa... | Deactivate a plugin on this instance
@returns {self}
@protected | [
"Deactivate",
"a",
"plugin",
"on",
"this",
"instance"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2347-L2382 | |
11,575 | iamceege/tooltipster | src/js/tooltipster.js | function(content) {
var self = this;
// getter method
if (content === undefined) {
return self.__Content;
}
// setter method
else {
if (!self.__destroyed) {
// change the content
self.__contentSet(content);
if (self.__Content !== null) {
// update the tooltip... | javascript | function(content) {
var self = this;
// getter method
if (content === undefined) {
return self.__Content;
}
// setter method
else {
if (!self.__destroyed) {
// change the content
self.__contentSet(content);
if (self.__Content !== null) {
// update the tooltip... | [
"function",
"(",
"content",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// getter method",
"if",
"(",
"content",
"===",
"undefined",
")",
"{",
"return",
"self",
".",
"__Content",
";",
"}",
"// setter method",
"else",
"{",
"if",
"(",
"!",
"self",
".",
"... | Sets or gets the content of the tooltip
@returns {mixed|self}
@public | [
"Sets",
"or",
"gets",
"the",
"content",
"of",
"the",
"tooltip"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2407-L2474 | |
11,576 | iamceege/tooltipster | src/js/tooltipster.js | function() {
var self = this;
if (!self.__destroyed) {
if(self.__state != 'closed'){
// no closing delay
self.option('animationDuration', 0)
// force closing
._close(null, null, true);
}
else {
// there might be an open timeout still running
self.__timeoutsClear();
... | javascript | function() {
var self = this;
if (!self.__destroyed) {
if(self.__state != 'closed'){
// no closing delay
self.option('animationDuration', 0)
// force closing
._close(null, null, true);
}
else {
// there might be an open timeout still running
self.__timeoutsClear();
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"__destroyed",
")",
"{",
"if",
"(",
"self",
".",
"__state",
"!=",
"'closed'",
")",
"{",
"// no closing delay",
"self",
".",
"option",
"(",
"'animationDuration'",
"... | Destroys the tooltip
@returns {self}
@public | [
"Destroys",
"the",
"tooltip"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2482-L2589 | |
11,577 | iamceege/tooltipster | src/js/tooltipster.js | function(o, val) {
// getter
if (val === undefined) {
return this.__options[o];
}
// setter
else {
if (!this.__destroyed) {
// change value
this.__options[o] = val;
// format
this.__optionsFormat();
// re-prepare the triggers if needed
if ($.inArray(o, ['tri... | javascript | function(o, val) {
// getter
if (val === undefined) {
return this.__options[o];
}
// setter
else {
if (!this.__destroyed) {
// change value
this.__options[o] = val;
// format
this.__optionsFormat();
// re-prepare the triggers if needed
if ($.inArray(o, ['tri... | [
"function",
"(",
"o",
",",
"val",
")",
"{",
"// getter",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"return",
"this",
".",
"__options",
"[",
"o",
"]",
";",
"}",
"// setter",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"__destroyed",
")",
"{",
... | Get or set options. For internal use and advanced users only.
@param {string} o Option name
@param {mixed} val optional A new value for the option
@return {mixed|self} If val is omitted, the value of the option
is returned, otherwise the instance itself is returned
@public | [
"Get",
"or",
"set",
"options",
".",
"For",
"internal",
"use",
"and",
"advanced",
"users",
"only",
"."
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2750-L2782 | |
11,578 | iamceege/tooltipster | src/js/tooltipster.js | function() {
if (!this.__destroyed) {
this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));
}
else {
this.__destroyError();
}
return this;
} | javascript | function() {
if (!this.__destroyed) {
this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));
}
else {
this.__destroyError();
}
return this;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"__destroyed",
")",
"{",
"this",
".",
"__$emitterPublic",
".",
"triggerHandler",
".",
"apply",
"(",
"this",
".",
"__$emitterPublic",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
... | For public use only, not to be used by plugins
@returns {self}
@public | [
"For",
"public",
"use",
"only",
"not",
"to",
"be",
"used",
"by",
"plugins"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2871-L2881 | |
11,579 | iamceege/tooltipster | src/js/tooltipster.js | function() {
this.__forceRedraw();
var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(),
result = { size: {
// bcr.width/height are not defined in IE8- but in this
// case, bcr.right/bottom will have the same value
// except in iOS 8+ where tooltipBcr.bottom/right are wrong
// after ... | javascript | function() {
this.__forceRedraw();
var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(),
result = { size: {
// bcr.width/height are not defined in IE8- but in this
// case, bcr.right/bottom will have the same value
// except in iOS 8+ where tooltipBcr.bottom/right are wrong
// after ... | [
"function",
"(",
")",
"{",
"this",
".",
"__forceRedraw",
"(",
")",
";",
"var",
"tooltipBcr",
"=",
"this",
".",
"__$tooltip",
"[",
"0",
"]",
".",
"getBoundingClientRect",
"(",
")",
",",
"result",
"=",
"{",
"size",
":",
"{",
"// bcr.width/height are not defi... | Returns the size of the tooltip. When constraints are applied, also returns
whether the tooltip fits in the provided dimensions.
The idea is to see if the new height is small enough and if the content does
not overflow horizontally.
@param {int} width
@param {int} height
@returns {object} An object with a bool `fits` ... | [
"Returns",
"the",
"size",
"of",
"the",
"tooltip",
".",
"When",
"constraints",
"are",
"applied",
"also",
"returns",
"whether",
"the",
"tooltip",
"fits",
"in",
"the",
"provided",
"dimensions",
".",
"The",
"idea",
"is",
"to",
"see",
"if",
"the",
"new",
"heigh... | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3202-L3262 | |
11,580 | iamceege/tooltipster | src/js/tooltipster.js | areEqual | function areEqual(a,b) {
var same = true;
$.each(a, function(i, _) {
if (b[i] === undefined || a[i] !== b[i]) {
same = false;
return false;
}
});
return same;
} | javascript | function areEqual(a,b) {
var same = true;
$.each(a, function(i, _) {
if (b[i] === undefined || a[i] !== b[i]) {
same = false;
return false;
}
});
return same;
} | [
"function",
"areEqual",
"(",
"a",
",",
"b",
")",
"{",
"var",
"same",
"=",
"true",
";",
"$",
".",
"each",
"(",
"a",
",",
"function",
"(",
"i",
",",
"_",
")",
"{",
"if",
"(",
"b",
"[",
"i",
"]",
"===",
"undefined",
"||",
"a",
"[",
"i",
"]",
... | quick & dirty compare function, not bijective nor multidimensional | [
"quick",
"&",
"dirty",
"compare",
"function",
"not",
"bijective",
"nor",
"multidimensional"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3266-L3275 |
11,581 | iamceege/tooltipster | src/js/tooltipster.js | bodyContains | function bodyContains($obj) {
var id = $obj.attr('id'),
el = id ? env.window.document.getElementById(id) : null;
// must also check that the element with the id is the one we want
return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]);
} | javascript | function bodyContains($obj) {
var id = $obj.attr('id'),
el = id ? env.window.document.getElementById(id) : null;
// must also check that the element with the id is the one we want
return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]);
} | [
"function",
"bodyContains",
"(",
"$obj",
")",
"{",
"var",
"id",
"=",
"$obj",
".",
"attr",
"(",
"'id'",
")",
",",
"el",
"=",
"id",
"?",
"env",
".",
"window",
".",
"document",
".",
"getElementById",
"(",
"id",
")",
":",
"null",
";",
"// must also check... | A fast function to check if an element is still in the DOM. It
tries to use an id as ids are indexed by the browser, or falls
back to jQuery's `contains` method. May fail if two elements
have the same id, but so be it
@param {object} $obj A jQuery-wrapped HTML element
@return {boolean} | [
"A",
"fast",
"function",
"to",
"check",
"if",
"an",
"element",
"is",
"still",
"in",
"the",
"DOM",
".",
"It",
"tries",
"to",
"use",
"an",
"id",
"as",
"ids",
"are",
"indexed",
"by",
"the",
"browser",
"or",
"falls",
"back",
"to",
"jQuery",
"s",
"contain... | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3286-L3291 |
11,582 | iamceege/tooltipster | src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js | function() {
return {
// if the tooltip should display an arrow that points to the origin
arrow: true,
// the distance in pixels between the tooltip and the origin
distance: 6,
// allows to easily change the position of the tooltip
functionPosition: null,
maxWidth: null,
// used t... | javascript | function() {
return {
// if the tooltip should display an arrow that points to the origin
arrow: true,
// the distance in pixels between the tooltip and the origin
distance: 6,
// allows to easily change the position of the tooltip
functionPosition: null,
maxWidth: null,
// used t... | [
"function",
"(",
")",
"{",
"return",
"{",
"// if the tooltip should display an arrow that points to the origin",
"arrow",
":",
"true",
",",
"// the distance in pixels between the tooltip and the origin",
"distance",
":",
"6",
",",
"// allows to easily change the position of the toolt... | Defaults are provided as a function for an easy override by inheritance
@return {object} An object with the defaults options
@private | [
"Defaults",
"are",
"provided",
"as",
"a",
"function",
"for",
"an",
"easy",
"override",
"by",
"inheritance"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L15-L43 | |
11,583 | iamceege/tooltipster | src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js | function() {
// detach our content object first, so the next jQuery's remove()
// call does not unbind its event handlers
if (this.__instance.content() instanceof $) {
this.__instance.content().detach();
}
// remove the tooltip from the DOM
this.__instance._$tooltip.remove();
this.__ins... | javascript | function() {
// detach our content object first, so the next jQuery's remove()
// call does not unbind its event handlers
if (this.__instance.content() instanceof $) {
this.__instance.content().detach();
}
// remove the tooltip from the DOM
this.__instance._$tooltip.remove();
this.__ins... | [
"function",
"(",
")",
"{",
"// detach our content object first, so the next jQuery's remove()",
"// call does not unbind its event handlers",
"if",
"(",
"this",
".",
"__instance",
".",
"content",
"(",
")",
"instanceof",
"$",
")",
"{",
"this",
".",
"__instance",
".",
"co... | Called when the tooltip has closed
@private | [
"Called",
"when",
"the",
"tooltip",
"has",
"closed"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L92-L103 | |
11,584 | iamceege/tooltipster | src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js | function() {
// note: we wrap with a .tooltipster-box div to be able to set a margin on it
// (.tooltipster-base must not have one)
var $html = $(
'<div class="tooltipster-base tooltipster-sidetip">' +
'<div class="tooltipster-box">' +
'<div class="tooltipster-content"></div>' +
'</div>... | javascript | function() {
// note: we wrap with a .tooltipster-box div to be able to set a margin on it
// (.tooltipster-base must not have one)
var $html = $(
'<div class="tooltipster-base tooltipster-sidetip">' +
'<div class="tooltipster-box">' +
'<div class="tooltipster-content"></div>' +
'</div>... | [
"function",
"(",
")",
"{",
"// note: we wrap with a .tooltipster-box div to be able to set a margin on it",
"// (.tooltipster-base must not have one)",
"var",
"$html",
"=",
"$",
"(",
"'<div class=\"tooltipster-base tooltipster-sidetip\">'",
"+",
"'<div class=\"tooltipster-box\">'",
"+",
... | Creates the HTML element of the tooltip.
@private | [
"Creates",
"the",
"HTML",
"element",
"of",
"the",
"tooltip",
"."
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L110-L150 | |
11,585 | iamceege/tooltipster | doc/js/scripts.js | function(instance, helper, data){
// this function is pretty dumb and does not check if there is actually
// enough space available around the tooltip to move it, it just makes it
// snap to the grid. You might want to do something smarter in your app!
var gridBcr = $('#demo-position-grid')[0]... | javascript | function(instance, helper, data){
// this function is pretty dumb and does not check if there is actually
// enough space available around the tooltip to move it, it just makes it
// snap to the grid. You might want to do something smarter in your app!
var gridBcr = $('#demo-position-grid')[0]... | [
"function",
"(",
"instance",
",",
"helper",
",",
"data",
")",
"{",
"// this function is pretty dumb and does not check if there is actually\r",
"// enough space available around the tooltip to move it, it just makes it\r",
"// snap to the grid. You might want to do something smarter in your ap... | 8 extra pixels for the arrow to overflow the grid | [
"8",
"extra",
"pixels",
"for",
"the",
"arrow",
"to",
"overflow",
"the",
"grid"
] | bb575f0c8d7494b80cca60a235e14b9477bd1ab7 | https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/doc/js/scripts.js#L203-L220 | |
11,586 | dthree/cash | src/commands/rm.js | isWriteable | function isWriteable(file) {
let writePermission = true;
try {
const __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch (e) {
/* istanbul ignore next */
writePermission = false;
}
return writePermission;
} | javascript | function isWriteable(file) {
let writePermission = true;
try {
const __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch (e) {
/* istanbul ignore next */
writePermission = false;
}
return writePermission;
} | [
"function",
"isWriteable",
"(",
"file",
")",
"{",
"let",
"writePermission",
"=",
"true",
";",
"try",
"{",
"const",
"__fd",
"=",
"fs",
".",
"openSync",
"(",
"file",
",",
"'a'",
")",
";",
"fs",
".",
"closeSync",
"(",
"__fd",
")",
";",
"}",
"catch",
"... | Hack to determine if file has write permissions for current user Avoids having to check user, group, etc, but it's probably slow. | [
"Hack",
"to",
"determine",
"if",
"file",
"has",
"write",
"permissions",
"for",
"current",
"user",
"Avoids",
"having",
"to",
"check",
"user",
"group",
"etc",
"but",
"it",
"s",
"probably",
"slow",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/src/commands/rm.js#L147-L158 |
11,587 | dthree/cash | dist/windows.js | print | function print() {
var parts = String(out).split('\n');
/* istanbul ignore next */
if (parts.length > 1) {
out = parts.pop();
var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
slf.log(logging);
}
/* istanbul ignore next */
if (cl... | javascript | function print() {
var parts = String(out).split('\n');
/* istanbul ignore next */
if (parts.length > 1) {
out = parts.pop();
var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
slf.log(logging);
}
/* istanbul ignore next */
if (cl... | [
"function",
"print",
"(",
")",
"{",
"var",
"parts",
"=",
"String",
"(",
"out",
")",
".",
"split",
"(",
"'\\n'",
")",
";",
"/* istanbul ignore next */",
"if",
"(",
"parts",
".",
"length",
">",
"1",
")",
"{",
"out",
"=",
"parts",
".",
"pop",
"(",
")"... | Properly print stdout as it's fed, waiting for line breaks before sending it to Vorpal. | [
"Properly",
"print",
"stdout",
"as",
"it",
"s",
"fed",
"waiting",
"for",
"line",
"breaks",
"before",
"sending",
"it",
"to",
"Vorpal",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/dist/windows.js#L84-L98 |
11,588 | dthree/cash | packages/touch/dist/commands/touch.js | file | function file(path, options) {
try {
try {
fs.lstatSync(path);
} catch (e) {
// If the file doesn't exist and
// the user doesn't want to create it,
// we have no purpose in life. Goodbye.
if (options.create === false) {
throw new Error(e);
} els... | javascript | function file(path, options) {
try {
try {
fs.lstatSync(path);
} catch (e) {
// If the file doesn't exist and
// the user doesn't want to create it,
// we have no purpose in life. Goodbye.
if (options.create === false) {
throw new Error(e);
} els... | [
"function",
"file",
"(",
"path",
",",
"options",
")",
"{",
"try",
"{",
"try",
"{",
"fs",
".",
"lstatSync",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"// If the file doesn't exist and",
"// the user doesn't want to create it,",
"// we have no purpo... | Handler for a single file using touch.
@param {String} path
@param {Object} options
@api private | [
"Handler",
"for",
"a",
"single",
"file",
"using",
"touch",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/touch/dist/commands/touch.js#L93-L137 |
11,589 | dthree/cash | packages/ls/dist/commands/ls.js | error | function error(path, e) {
var status = void 0;
var stdout = void 0;
if (e.code === 'ENOENT' && e.syscall === 'scandir') {
status = 1;
stdout = 'ls: cannot access ' + path + ': No such file or directory';
} else {
status = 2;
stdout = e.stack;
}
ls.self.log(stdout);
... | javascript | function error(path, e) {
var status = void 0;
var stdout = void 0;
if (e.code === 'ENOENT' && e.syscall === 'scandir') {
status = 1;
stdout = 'ls: cannot access ' + path + ': No such file or directory';
} else {
status = 2;
stdout = e.stack;
}
ls.self.log(stdout);
... | [
"function",
"error",
"(",
"path",
",",
"e",
")",
"{",
"var",
"status",
"=",
"void",
"0",
";",
"var",
"stdout",
"=",
"void",
"0",
";",
"if",
"(",
"e",
".",
"code",
"===",
"'ENOENT'",
"&&",
"e",
".",
"syscall",
"===",
"'scandir'",
")",
"{",
"status... | Returns ls stderr and response codes
for errors.
@param {String} path
@param {Error} e
@param {String} e.code
@param {String} e.syscall
@param {String} e.stack
@api private | [
"Returns",
"ls",
"stderr",
"and",
"response",
"codes",
"for",
"errors",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L112-L126 |
11,590 | dthree/cash | packages/ls/dist/commands/ls.js | execDirRecursive | function execDirRecursive(path, options) {
var self = this;
var results = [];
walkDirRecursive(path, function (pth) {
var result = self.execDir(pth, options);
results.push(result);
});
return results;
} | javascript | function execDirRecursive(path, options) {
var self = this;
var results = [];
walkDirRecursive(path, function (pth) {
var result = self.execDir(pth, options);
results.push(result);
});
return results;
} | [
"function",
"execDirRecursive",
"(",
"path",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"results",
"=",
"[",
"]",
";",
"walkDirRecursive",
"(",
"path",
",",
"function",
"(",
"pth",
")",
"{",
"var",
"result",
"=",
"self",
".",
"... | Recursively executes `execDir`.
For use with `ls -R`.
@param {String} path
@param {Object} options
@return {Array} results
@api private | [
"Recursively",
"executes",
"execDir",
".",
"For",
"use",
"with",
"ls",
"-",
"R",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L139-L148 |
11,591 | dthree/cash | packages/ls/dist/commands/ls.js | execDir | function execDir(path, options) {
var rawFiles = [];
function pushFile(file, data) {
rawFiles.push({
file: file,
data: data
});
}
// Add in implied current and parent dirs.
pushFile('.', fs.statSync('.'));
pushFile('..', fs.statSync('..'));
// Walk the passed i... | javascript | function execDir(path, options) {
var rawFiles = [];
function pushFile(file, data) {
rawFiles.push({
file: file,
data: data
});
}
// Add in implied current and parent dirs.
pushFile('.', fs.statSync('.'));
pushFile('..', fs.statSync('..'));
// Walk the passed i... | [
"function",
"execDir",
"(",
"path",
",",
"options",
")",
"{",
"var",
"rawFiles",
"=",
"[",
"]",
";",
"function",
"pushFile",
"(",
"file",
",",
"data",
")",
"{",
"rawFiles",
".",
"push",
"(",
"{",
"file",
":",
"file",
",",
"data",
":",
"data",
"}",
... | Executes `ls` functionality
for a given directory.
@param {String} path
@param {Object} options
@return {{path: String, size: *, results: *}} results
@api private | [
"Executes",
"ls",
"functionality",
"for",
"a",
"given",
"directory",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L160-L181 |
11,592 | dthree/cash | packages/ls/dist/commands/ls.js | formatAll | function formatAll(results, options, showName) {
var stdout = '';
if (showName) {
for (var i = 0; i < results.length; ++i) {
stdout += results[i].path + ':\n';
if (options.l) {
stdout += 'total ' + results[i].size + '\n';
}
stdout += results[i].results;
if... | javascript | function formatAll(results, options, showName) {
var stdout = '';
if (showName) {
for (var i = 0; i < results.length; ++i) {
stdout += results[i].path + ':\n';
if (options.l) {
stdout += 'total ' + results[i].size + '\n';
}
stdout += results[i].results;
if... | [
"function",
"formatAll",
"(",
"results",
",",
"options",
",",
"showName",
")",
"{",
"var",
"stdout",
"=",
"''",
";",
"if",
"(",
"showName",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"results",
".",
"length",
";",
"++",
"i",
")",
... | Concatenates the results of multiple
`execDir` functions into their proper
form based on options provided.
@param {Array} results
@param {Object} options
@param {boolean} showName
@return {String} stdout
@api private | [
"Concatenates",
"the",
"results",
"of",
"multiple",
"execDir",
"functions",
"into",
"their",
"proper",
"form",
"based",
"on",
"options",
"provided",
"."
] | 3e28dae8bdb71215d5034df9003f3ef2804c2754 | https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L358-L378 |
11,593 | jackspirou/clientjs | src/client.js | function() {
var parser = new(window.UAParser || exports.UAParser);
browserData = parser.getResult();
fontDetective = new Detector();
return this;
} | javascript | function() {
var parser = new(window.UAParser || exports.UAParser);
browserData = parser.getResult();
fontDetective = new Detector();
return this;
} | [
"function",
"(",
")",
"{",
"var",
"parser",
"=",
"new",
"(",
"window",
".",
"UAParser",
"||",
"exports",
".",
"UAParser",
")",
";",
"browserData",
"=",
"parser",
".",
"getResult",
"(",
")",
";",
"fontDetective",
"=",
"new",
"Detector",
"(",
")",
";",
... | Global font detective object. ClientJS constructor which sets the browserData object and returs the client object. | [
"Global",
"font",
"detective",
"object",
".",
"ClientJS",
"constructor",
"which",
"sets",
"the",
"browserData",
"object",
"and",
"returs",
"the",
"client",
"object",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L137-L142 | |
11,594 | jackspirou/clientjs | src/client.js | function() {
var bar = '|';
var userAgent = browserData.ua;
var screenPrint = this.getScreenPrint();
var pluginList = this.getPlugins();
var fontList = this.getFonts();
var localStorage = this.isLocalStorage();
var sessionStorage = this.isSessionStorage();
var timeZone =... | javascript | function() {
var bar = '|';
var userAgent = browserData.ua;
var screenPrint = this.getScreenPrint();
var pluginList = this.getPlugins();
var fontList = this.getFonts();
var localStorage = this.isLocalStorage();
var sessionStorage = this.isSessionStorage();
var timeZone =... | [
"function",
"(",
")",
"{",
"var",
"bar",
"=",
"'|'",
";",
"var",
"userAgent",
"=",
"browserData",
".",
"ua",
";",
"var",
"screenPrint",
"=",
"this",
".",
"getScreenPrint",
"(",
")",
";",
"var",
"pluginList",
"=",
"this",
".",
"getPlugins",
"(",
")",
... | Get Fingerprint. Return a 32-bit integer representing the browsers fingerprint. | [
"Get",
"Fingerprint",
".",
"Return",
"a",
"32",
"-",
"bit",
"integer",
"representing",
"the",
"browsers",
"fingerprint",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L163-L182 | |
11,595 | jackspirou/clientjs | src/client.js | function() {
var bar = '|';
var key = "";
for (var i = 0; i < arguments.length; i++) {
key += arguments[i] + bar;
}
return murmurhash3_32_gc(key, 256);
} | javascript | function() {
var bar = '|';
var key = "";
for (var i = 0; i < arguments.length; i++) {
key += arguments[i] + bar;
}
return murmurhash3_32_gc(key, 256);
} | [
"function",
"(",
")",
"{",
"var",
"bar",
"=",
"'|'",
";",
"var",
"key",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
"+=",
"arguments",
"[",
"i",
"]",
"+",
"... | Get Custom Fingerprint. Take a string of datapoints and eturn a 32-bit integer representing the browsers fingerprint. | [
"Get",
"Custom",
"Fingerprint",
".",
"Take",
"a",
"string",
"of",
"datapoints",
"and",
"eturn",
"a",
"32",
"-",
"bit",
"integer",
"representing",
"the",
"browsers",
"fingerprint",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L185-L192 | |
11,596 | jackspirou/clientjs | src/client.js | function() {
// detectmobilebrowsers.com JavaScript Mobile Detection Script
var dataString = browserData.ua || navigator.vendor || window.opera;
return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobi... | javascript | function() {
// detectmobilebrowsers.com JavaScript Mobile Detection Script
var dataString = browserData.ua || navigator.vendor || window.opera;
return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobi... | [
"function",
"(",
")",
"{",
"// detectmobilebrowsers.com JavaScript Mobile Detection Script",
"var",
"dataString",
"=",
"browserData",
".",
"ua",
"||",
"navigator",
".",
"vendor",
"||",
"window",
".",
"opera",
";",
"return",
"(",
"/",
"(android|bb\\d+|meego).+mobile|avan... | MOBILE METHODS Is Mobile. Check if the browser is on a mobile device. | [
"MOBILE",
"METHODS",
"Is",
"Mobile",
".",
"Check",
"if",
"the",
"browser",
"is",
"on",
"a",
"mobile",
"device",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L343-L347 | |
11,597 | jackspirou/clientjs | src/client.js | function() {
var pluginsList = "";
for (var i = 0; i < navigator.plugins.length; i++) {
if (i == navigator.plugins.length - 1) {
pluginsList += navigator.plugins[i].name;
} else {
pluginsList += navigator.plugins[i].name + ", ";
}
}
return pluginsList... | javascript | function() {
var pluginsList = "";
for (var i = 0; i < navigator.plugins.length; i++) {
if (i == navigator.plugins.length - 1) {
pluginsList += navigator.plugins[i].name;
} else {
pluginsList += navigator.plugins[i].name + ", ";
}
}
return pluginsList... | [
"function",
"(",
")",
"{",
"var",
"pluginsList",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"navigator",
".",
"plugins",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"navigator",
".",
"plugins",
".",
"l... | PLUGIN METHODS Get Plugins. Return a string containing a list of installed plugins. | [
"PLUGIN",
"METHODS",
"Get",
"Plugins",
".",
"Return",
"a",
"string",
"containing",
"a",
"list",
"of",
"installed",
"plugins",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L461-L472 | |
11,598 | jackspirou/clientjs | src/client.js | function() {
var mimeTypeList = "";
for (var i = 0; i < navigator.mimeTypes.length; i++) {
if (i == navigator.mimeTypes.length - 1) {
mimeTypeList += navigator.mimeTypes[i].description;
} else {
mimeTypeList += navigator.mimeTypes[i].description + ", ";
}
}... | javascript | function() {
var mimeTypeList = "";
for (var i = 0; i < navigator.mimeTypes.length; i++) {
if (i == navigator.mimeTypes.length - 1) {
mimeTypeList += navigator.mimeTypes[i].description;
} else {
mimeTypeList += navigator.mimeTypes[i].description + ", ";
}
}... | [
"function",
"(",
")",
"{",
"var",
"mimeTypeList",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"navigator",
".",
"mimeTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"navigator",
".",
"mimeTypes",
".",... | Get Mime Types. Return a string containing a list of installed mime types. | [
"Get",
"Mime",
"Types",
".",
"Return",
"a",
"string",
"containing",
"a",
"list",
"of",
"installed",
"mime",
"types",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L533-L544 | |
11,599 | jackspirou/clientjs | src/client.js | function() {
// create a canvas element
var canvas = document.createElement('canvas');
// define a context var that will be used for browsers with canvas support
var ctx;
// try/catch for older browsers that don't support the canvas element
try {
// attempt to give ctx a ... | javascript | function() {
// create a canvas element
var canvas = document.createElement('canvas');
// define a context var that will be used for browsers with canvas support
var ctx;
// try/catch for older browsers that don't support the canvas element
try {
// attempt to give ctx a ... | [
"function",
"(",
")",
"{",
"// create a canvas element",
"var",
"canvas",
"=",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"// define a context var that will be used for browsers with canvas support",
"var",
"ctx",
";",
"// try/catch for older browsers that don... | Get Canvas Print. Return a string containing the canvas URI data. | [
"Get",
"Canvas",
"Print",
".",
"Return",
"a",
"string",
"containing",
"the",
"canvas",
"URI",
"data",
"."
] | 6674bdd56680e8c8130260634a4086d469d8c7f2 | https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L648-L683 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.