_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q18600
train
function(msgs){ var res = '[', msg; for(var i=0, l=msgs.length; i<l; i++) { if(i > 0) { res += ','; } msg = msgs[i]; if(typeof msg === 'string') { res += msg; } else { res += JSON.stringify(msg); } } res += ']'; return res; }
javascript
{ "resource": "" }
q18601
train
function(count, opts, cb) { this.count = count; this.cb = cb; var self = this; if (opts.timeout) { this.timerId = setTimeout(function() { self.cb(true); }, opts.timeout); } }
javascript
{ "resource": "" }
q18602
cached
train
function cached (fn) { var cache = Object.create(null); return (function cachedFn (str) { var hit = cache[str]; return hit || (cache[str] = fn(str)) }) }
javascript
{ "resource": "" }
q18603
toObject
train
function toObject (arr) { var res = {}; for (var i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]); } } return res }
javascript
{ "resource": "" }
q18604
genStaticKeys
train
function genStaticKeys (modules) { return modules.reduce(function (keys, m) { return keys.concat(m.staticKeys || []) }, []).join(',') }
javascript
{ "resource": "" }
q18605
looseEqual
train
function looseEqual (a, b) { var isObjectA = isObject(a); var isObjectB = isObject(b); if (isObjectA && isObjectB) { try { return JSON.stringify(a) === JSON.stringify(b) } catch (e) { // possible circular reference return a === b } } else if (!isObjectA && !isObjectB) { return ...
javascript
{ "resource": "" }
q18606
once
train
function once (fn) { var called = false; return function () { if (!called) { called = true; fn.apply(this, arguments); } } }
javascript
{ "resource": "" }
q18607
simpleNormalizeChildren
train
function simpleNormalizeChildren (children) { for (var i = 0; i < children.length; i++) { if (Array.isArray(children[i])) { return Array.prototype.concat.apply([], children) } } return children }
javascript
{ "resource": "" }
q18608
_toString
train
function _toString(val) { return val == null ? '' : typeof val === 'object' ? JSON.stringify(val, null, 2) : String(val) }
javascript
{ "resource": "" }
q18609
getEnterTargetState
train
function getEnterTargetState (el, stylesheet, startClass, endClass, activeClass, vm) { const targetState = {} const startState = stylesheet[startClass] const endState = stylesheet[endClass] const activeState = stylesheet[activeClass] // 1. fallback to element's default styling if (startState) { for (con...
javascript
{ "resource": "" }
q18610
train
function () { var total = this.stats.length return this.stats.map(function (stat, i) { var point = valueToPoint(stat.value, i, total) return point.x + ',' + point.y }).join(' ') }
javascript
{ "resource": "" }
q18611
valueToPoint
train
function valueToPoint (value, index, total) { var x = 0 var y = -value * 0.8 var angle = Math.PI * 2 / total * index var cos = Math.cos(angle) var sin = Math.sin(angle) var tx = x * cos - y * sin + 100 var ty = x * sin + y * cos + 100 return { x: tx, y: ty } }
javascript
{ "resource": "" }
q18612
assertType
train
function assertType (value, type) { var valid; var expectedType = getType(type); if (expectedType === 'String') { valid = typeof value === (expectedType = 'string'); } else if (expectedType === 'Number') { valid = typeof value === (expectedType = 'number'); } else if (expectedType === 'Boolean') { ...
javascript
{ "resource": "" }
q18613
init
train
function init (cfg) { renderer.Document = cfg.Document; renderer.Element = cfg.Element; renderer.Comment = cfg.Comment; renderer.sendTasks = cfg.sendTasks; }
javascript
{ "resource": "" }
q18614
genModuleGetter
train
function genModuleGetter (instanceId) { var instance = instances[instanceId]; return function (name) { var nativeModule = modules[name] || []; var output = {}; var loop = function ( methodName ) { output[methodName] = function () { var args = [], len = arguments.length; while ( len...
javascript
{ "resource": "" }
q18615
normalize
train
function normalize (v, instance) { const type = typof(v) switch (type) { case 'undefined': case 'null': return '' case 'regexp': return v.toString() case 'date': return v.toISOString() case 'number': case 'string': case 'boolean': case 'array': case 'object': ...
javascript
{ "resource": "" }
q18616
setStreamType
train
function setStreamType(constraints, stream) { if (constraints.mandatory && constraints.mandatory.chromeMediaSource) { stream.isScreen = true; } else if (constraints.mozMediaSource || constraints.mediaSource) { stream.isScreen = true; } else if (constraints.video) { stream.isVideo = t...
javascript
{ "resource": "" }
q18617
xhr
train
function xhr(url, callback, data) { if (!window.XMLHttpRequest || !window.JSON) return; var request = new XMLHttpRequest(); request.onreadystatechange = function() { if (callback && request.readyState == 4 && request.status == 200) { // server MUST return JSON text ...
javascript
{ "resource": "" }
q18618
TextReceiver
train
function TextReceiver(connection) { var content = {}; function receive(data, userid, extra) { // uuid is used to uniquely identify sending instance var uuid = data.uuid; if (!content[uuid]) { content[uuid] = []; } content[uuid].push(data.message); i...
javascript
{ "resource": "" }
q18619
mergeProps
train
function mergeProps(mergein, mergeto) { for (var t in mergeto) { if (typeof mergeto[t] !== 'function') { mergein[t] = mergeto[t]; } } return mergein; }
javascript
{ "resource": "" }
q18620
WhammyVideo
train
function WhammyVideo(duration, quality) { this.frames = []; if (!duration) { duration = 1; } this.duration = 1000 / duration; this.quality = quality || 0.8; }
javascript
{ "resource": "" }
q18621
checkFrames
train
function checkFrames(frames) { if (!frames[0]) { postMessage({ error: 'Something went wrong. Maybe WebP format is not supported in the current browser.' }); return; } var width = frames[0].width, hei...
javascript
{ "resource": "" }
q18622
setCordovaAPIs
train
function setCordovaAPIs() { // if (DetectRTC.osName !== 'iOS') return; if (typeof cordova === 'undefined' || typeof cordova.plugins === 'undefined' || typeof cordova.plugins.iosrtc === 'undefined') return; var iosrtc = cordova.plugins.iosrtc; window.webkitRTCPeerConnection = iosrtc.RTCPeerConnection; ...
javascript
{ "resource": "" }
q18623
emberPlugin
train
function emberPlugin(Raven, Ember) { Ember = Ember || window.Ember; // quit if Ember isn't on the page if (!Ember) return; var _oldOnError = Ember.onerror; Ember.onerror = function EmberOnError(error) { Raven.captureException(error); if (typeof _oldOnError === 'function') { _oldOnError.call(th...
javascript
{ "resource": "" }
q18624
AddPluginBrowserifyTransformer
train
function AddPluginBrowserifyTransformer() { var noop = function(chunk, _, cb) { cb(null, chunk); }; var append = function(cb) { cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);"); }; return function(file) { return through(noop, /plugins/.test(file) ? append : unde...
javascript
{ "resource": "" }
q18625
Raven
train
function Raven() { this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify); // Raven can run in contexts where there's no document (react-native) this._hasDocument = !isUndefined(_document); this._hasNavigator = !isUndefined(_navigator); this._lastCapturedException = null; this._lastData = null; th...
javascript
{ "resource": "" }
q18626
train
function() { TraceKit.report.uninstall(); this._detachPromiseRejectionHandler(); this._unpatchFunctionToString(); this._restoreBuiltIns(); this._restoreConsole(); Error.stackTraceLimit = this._originalErrorStackTraceLimit; this._isRavenInstalled = false; return this; }
javascript
{ "resource": "" }
q18627
train
function(ex, options) { options = objectMerge({trimHeadFrames: 0}, options ? options : {}); if (isErrorEvent(ex) && ex.error) { // If it is an ErrorEvent with `error` property, extract it to get actual Error ex = ex.error; } else if (isDOMError(ex) || isDOMException(ex)) { // If it is a D...
javascript
{ "resource": "" }
q18628
train
function(current) { var last = this._lastData; if ( !last || current.message !== last.message || // defined for captureMessage current.transaction !== last.transaction // defined for captureException/onerror ) return false; // Stacktrace interface (i.e. from captureMessage) ...
javascript
{ "resource": "" }
q18629
train
function(content) { // content.e = error // content.p = promise rejection // content.f = function call the Sentry if ( (content.e || content.p || (content.f && content.f.indexOf('capture') > -1) || (content.f && content.f.indexOf('showReportDialog') > -1)) && lazy ...
javascript
{ "resource": "" }
q18630
generate
train
function generate(plugins, dest) { const pluginNames = plugins.map((plugin) => { return path.basename(plugin, '.js'); }); const pluginCombinations = combine(pluginNames); pluginCombinations.forEach((pluginCombination) => { fs.writeFileSync( path.resolve(dest, `${pluginCombination.join(',')}.js`)...
javascript
{ "resource": "" }
q18631
Client
train
function Client(dsn, options) { if (dsn instanceof Client) return dsn; var ravenInstance = new Raven(); return ravenInstance.config.apply(ravenInstance, arguments); }
javascript
{ "resource": "" }
q18632
build
train
async function build(inputOptions, outputOptions) { const input = Object.assign( { plugins: [ commonjs(), // We can remove this plugin if there are no more CommonJS modules resolve(), // We need this plugin only to build the test script babel({ exclude: 'node_modules/**' ...
javascript
{ "resource": "" }
q18633
ServerDetails
train
function ServerDetails(x) { if (!(this instanceof ServerDetails)) return new ServerDetails(x); const v = x.split(':'); this.hostname = (v[0].length > 0) ? v[0] : ''; this.port = (v.length > 1) ? Number(v[1]) : 80; }
javascript
{ "resource": "" }
q18634
propTypesDocsHandler
train
function propTypesDocsHandler(documentation, path) { const propTypesPath = getMemberValuePath(path, 'propTypes'); const docComment = getDocblock(propTypesPath.parent); const statementPattern = /@.*\:/; const info = {}; if (docComment) { const infoRaw = _.split(docComment, '\n'); _.forEach(infoRaw, (s...
javascript
{ "resource": "" }
q18635
flushQueue
train
function flushQueue() { var queued = WebInspector.log.queued; if (!queued) return; for (var i = 0; i < queued.length; ++i) logMessage(queued[i]); delete WebInspector.log.queued; }
javascript
{ "resource": "" }
q18636
flushQueueIfAvailable
train
function flushQueueIfAvailable() { if (!isLogAvailable()) return; clearInterval(WebInspector.log.interval); delete WebInspector.log.interval; flushQueue(); }
javascript
{ "resource": "" }
q18637
fixrefs
train
function fixrefs(scope, i) { // do children first; order shouldn't matter for (i = scope.children.length; --i >= 0;) fixrefs(scope.children[i]); for (i in scope.refs) if (HOP(scope.refs, i)) { ...
javascript
{ "resource": "" }
q18638
getSize
train
async function getSize (files, opts) { if (typeof files === 'string') files = [files] if (!opts) opts = { } if (opts.webpack === false) { let sizes = await Promise.all(files.map(async file => { let bytes = await readFile(file, 'utf8') let result = { parsed: bytes.length } if (opts.running !...
javascript
{ "resource": "" }
q18639
getEventMetadata
train
function getEventMetadata({ event, payload }) { if (event === 'state') { return chalk.bold(payload.value); } if (event === 'instance-start' || event === 'instance-stop') { if (payload.dc != null) { return chalk.green(`(${payload.dc})`); } } return ''; }
javascript
{ "resource": "" }
q18640
stateString
train
function stateString(s) { switch (s) { case 'INITIALIZING': return chalk.yellow(s); case 'ERROR': return chalk.red(s); case 'READY': return s; default: return chalk.gray('UNKNOWN'); } }
javascript
{ "resource": "" }
q18641
filterUniqueApps
train
function filterUniqueApps() { const uniqueApps = new Set(); return function uniqueAppFilter([appName]) { if (uniqueApps.has(appName)) { return false; } uniqueApps.add(appName); return true; }; }
javascript
{ "resource": "" }
q18642
hashes
train
async function hashes(files) { const map = new Map(); await Promise.all( files.map(async name => { const data = await fs.promises.readFile(name); const h = hash(data); const entry = map.get(h); if (entry) { entry.names.push(name); } else { map.set(hash(data), { na...
javascript
{ "resource": "" }
q18643
train
function( element ) { // if the element is already wrapped, return it if ( element.parent().is( ".ui-effects-wrapper" )) { return element.parent(); } // wrap the element var props = { width: element.outerWidth(true), height: element.outerHeight(true), "float": element.css( "float" ) }, ...
javascript
{ "resource": "" }
q18644
train
function( value, allowAny ) { var parsed; if ( value !== "" ) { parsed = this._parse( value ); if ( parsed !== null ) { if ( !allowAny ) { parsed = this._adjustValue( parsed ); } value = this._format( parsed ); } } this.element.val( value ); this._refresh(); }
javascript
{ "resource": "" }
q18645
makeSingleQuery
train
function makeSingleQuery(allQuery, getMultipleError) { return (container, ...args) => { const els = allQuery(container, ...args) if (els.length > 1) { throw getMultipleElementsFoundError( getMultipleError(container, ...args), container, ) } return els[0] || null } }
javascript
{ "resource": "" }
q18646
makeGetAllQuery
train
function makeGetAllQuery(allQuery, getMissingError) { return (container, ...args) => { const els = allQuery(container, ...args) if (!els.length) { throw getElementError(getMissingError(container, ...args), container) } return els } }
javascript
{ "resource": "" }
q18647
makeFindQuery
train
function makeFindQuery(getter) { return (container, text, options, waitForElementOptions) => waitForElement( () => getter(container, text, options), waitForElementOptions, ) }
javascript
{ "resource": "" }
q18648
makeNormalizer
train
function makeNormalizer({trim, collapseWhitespace, normalizer}) { if (normalizer) { // User has specified a custom normalizer if ( typeof trim !== 'undefined' || typeof collapseWhitespace !== 'undefined' ) { // They've also specified a value for trim or collapseWhitespace throw new...
javascript
{ "resource": "" }
q18649
train
function(arrayOfWebPImages) { config.advertisement = []; var length = arrayOfWebPImages.length; for (var i = 0; i < length; i++) { config.advertisement.push({ duration: i, image: arrayOfWebPImages[i] }); ...
javascript
{ "resource": "" }
q18650
train
function() { if (mediaRecorder && typeof mediaRecorder.clearRecordedData === 'function') { mediaRecorder.clearRecordedData(); } mediaRecorder = null; setState('inactive'); self.blob = null; }
javascript
{ "resource": "" }
q18651
train
function() { var self = this; if (typeof indexedDB === 'undefined' || typeof indexedDB.open === 'undefined') { console.error('IndexedDB API are not available in this browser.'); return; } var dbVersion = 1; var dbName = this.dbName || location.href.repla...
javascript
{ "resource": "" }
q18652
train
function(config) { this.audioBlob = config.audioBlob; this.videoBlob = config.videoBlob; this.gifBlob = config.gifBlob; this.init(); return this; }
javascript
{ "resource": "" }
q18653
getLastNumber
train
function getLastNumber(str){ var retval=""; for (var i=str.length-1;i>=0;--i) if (str[i]>="0"&&str[i]<="9") retval=str[i]+retval; if (retval.length==0) return "0"; return retval; }
javascript
{ "resource": "" }
q18654
existing_stats
train
function existing_stats(stats_type, bucket){ matches = []; //typical case: one-off, fully qualified if (bucket in stats_type) { matches.push(bucket); } //special case: match a whole 'folder' (and subfolders) of stats if (bucket.slice(-2) == ".*") { var folder = bucket.slice(0,-1); for (var na...
javascript
{ "resource": "" }
q18655
Metric
train
function Metric(key, value, ts) { var m = this; this.key = key; this.value = value; this.ts = ts; // return a string representation of this metric appropriate // for sending to the graphite collector. does not include // a trailing newline. this.toText = function() { return m.key + " " + m.value +...
javascript
{ "resource": "" }
q18656
Stats
train
function Stats() { var s = this; this.metrics = []; this.add = function(key, value, ts) { s.metrics.push(new Metric(key, value, ts)); }; this.toText = function() { return s.metrics.map(function(m) { return m.toText(); }).join('\n') + '\n'; }; this.toPickle = function() { var body = MARK + LI...
javascript
{ "resource": "" }
q18657
sk
train
function sk(key) { if (globalKeySanitize) { return key; } else { return key.replace(/\s+/g, '_') .replace(/\//g, '-') .replace(/[^a-zA-Z_\-0-9\.]/g, ''); } }
javascript
{ "resource": "" }
q18658
healthcheck
train
function healthcheck(node) { var ended = false; var node_id = node.host + ':' + node.port; var client = net.connect( {port: node.adminport, host: node.host}, function onConnect() { if (!ended) { client.write('health\r\n'); } } ); client.setTimeout(healthC...
javascript
{ "resource": "" }
q18659
train
function (sLink) { if (sLink[0] === "#") { sLink = document.location.href.substring(0,document.location.href.search("demoapps\.html")) + sLink; } return sLink; }
javascript
{ "resource": "" }
q18660
train
function(oOldOptions, oNewOptions) { var oMergedOptions = jQuery.extend({}, oOldOptions, oNewOptions); jQuery.each(oMergedOptions, function(key) { oMergedOptions[key] = oOldOptions[key] || oNewOptions[key]; // default merge strategy is inclusive OR }); return oMergedOptions; }
javascript
{ "resource": "" }
q18661
train
function(oChild1, oChild2) { var oGeometry1 = DOMUtil.getGeometry(oChild1); var oGeometry2 = DOMUtil.getGeometry(oChild2); var oPosition1 = oGeometry1 && oGeometry1.position; var oPosition2 = oGeometry2 && oGeometry2.position; if (oPosition1 && oPosition2) { var iBottom1 = oPosition1.top + oGeometry...
javascript
{ "resource": "" }
q18662
train
function() { var oViewModel = this.getModel("appView"), bPhoneSize = oViewModel.getProperty("/bPhoneSize"); // Version switch should not be shown on phone sizes or when no versions are found oViewModel.setProperty("/bShowVersionSwitchInHeader", !bPhoneSize && !!this._aNeoAppVersions); oViewModel.s...
javascript
{ "resource": "" }
q18663
train
function () { var that = this; if (!this._oFeedbackDialog) { this._oFeedbackDialog = new sap.ui.xmlfragment("feedbackDialogFragment", "sap.ui.documentation.sdk.view.FeedbackDialog", this); this._oView.addDependent(this._oFeedbackDialog); this._oFeedbackDialog.textInput = Fragment.byId("feedback...
javascript
{ "resource": "" }
q18664
train
function() { var data = {}; if (this._oFeedbackDialog.contextCheckBox.getSelected()) { data = { "texts": { "t1": this._oFeedbackDialog.textInput.getValue() }, "ratings":{ "r1": {"value" : this._oFeedbackDialog.ratingStatus.value} }, "context": {"page": this._get...
javascript
{ "resource": "" }
q18665
train
function(oEvent) { var that = this; var oPressedButton = oEvent.getSource(); that._oFeedbackDialog.ratingBar.forEach(function(oRatingBarElement) { if (oPressedButton !== oRatingBarElement.button) { oRatingBarElement.button.setPressed(false); } else { if (!oRatingBarElement.button.getP...
javascript
{ "resource": "" }
q18666
train
function(path){ // ##### BEGIN: MODIFIED BY SAP var dispatchFunction; // ##### END: MODIFIED BY SAP path = _makePath.apply(null, arguments); if(path !== _hash){ // we should store raw value // ##### BEGIN: MODIFIED BY SAP dispatchFunction = _registerChange(path); if (!h...
javascript
{ "resource": "" }
q18667
Doclet
train
function Doclet(comment) { this.comment = comment = unwrap(comment); this.tags = []; var m; var lastContent = 0; var lastTag = "description"; while ((m = rtag.exec(comment)) != null) { this._addTag(lastTag, comment.slice(lastContent, m.index)); lastTag = m[2]; lastContent = rtag.lastInde...
javascript
{ "resource": "" }
q18668
fnAppendBusyIndicator
train
function fnAppendBusyIndicator() { // Only append if busy state is still set if (!this.getBusy()) { return; } var $this = this.$(this._sBusySection); //If there is a pending delayed call to append the busy indicator, we can clear it now if (this._busyIndicatorDelayedCallId) { clearTimeout(this._bus...
javascript
{ "resource": "" }
q18669
fnAddStandaloneBlockLayer
train
function fnAddStandaloneBlockLayer () { this._oBlockState = BlockLayerUtils.block(this, this.getId() + "-blockedLayer", this._sBlockSection); jQuery(this._oBlockState.$blockLayer.get(0)).addClass("sapUiBlockLayerOnly"); }
javascript
{ "resource": "" }
q18670
fnAddStandaloneBusyIndicator
train
function fnAddStandaloneBusyIndicator () { this._oBusyBlockState = BlockLayerUtils.block(this, this.getId() + "-busyIndicator", this._sBusySection); BusyIndicatorUtils.addHTML(this._oBusyBlockState, this.getBusyIndicatorSize()); }
javascript
{ "resource": "" }
q18671
fnRemoveBusyIndicator
train
function fnRemoveBusyIndicator(bForceRemoval) { // removing all block layers is done upon rerendering and destroy of the control if (bForceRemoval) { fnRemoveAllBlockLayers.call(this); return; } var $this = this.$(this._sBusySection); $this.removeClass('sapUiLocalBusy'); //Unset the actual DOM Eleme...
javascript
{ "resource": "" }
q18672
filterDuplicates
train
function filterDuplicates(/*ref*/ aMessages){ if (aMessages.length > 1) { for (var iIndex = 1; iIndex < aMessages.length; iIndex++) { if (aMessages[0].getCode() == aMessages[iIndex].getCode() && aMessages[0].getMessage() == aMessages[iIndex].getMessage()) { aMessages.shift(); // Remove outer error, since ...
javascript
{ "resource": "" }
q18673
toBuddhist
train
function toBuddhist(oGregorian) { var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year, iYear = oGregorian.year - iEraStartYear + 1; // Before 1941 new year started on 1st of April if (oGregorian.year < 1941 && oGregorian.month < 3) { iYear -= 1; } if (oGregorian.year === nul...
javascript
{ "resource": "" }
q18674
toGregorian
train
function toGregorian(oBuddhist) { var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year, iYear = oBuddhist.year + iEraStartYear - 1; // Before 1941 new year started on 1st of April if (iYear < 1941 && oBuddhist.month < 3) { iYear += 1; } if (oBuddhist.year === null) { iYear...
javascript
{ "resource": "" }
q18675
toGregorianArguments
train
function toGregorianArguments(aArgs) { var oBuddhist, oGregorian; oBuddhist = { year: aArgs[0], month: aArgs[1], day: aArgs[2] !== undefined ? aArgs[2] : 1 }; oGregorian = toGregorian(oBuddhist); aArgs[0] = oGregorian.year; return aArgs; }
javascript
{ "resource": "" }
q18676
train
function (oVersionInfo) { var bResult = false, sFrameworkInfo = ""; try { sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name; bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false; } catch (e) { return bResult; } return bResult; }
javascript
{ "resource": "" }
q18677
train
function () { var that = this; var oInternalRulesPromise = new Promise(function (resolve) { if (that.bCanLoadInternalRules !== null) { resolve(that.bCanLoadInternalRules); return; } jQuery.ajax({ type: "HEAD", url: sInternalPingFilePath, success: function () { ...
javascript
{ "resource": "" }
q18678
train
function(aRows, iField, oLD, oOptions, iLabelSize) { var iRemain = 0; var oRow; for (i = 0; i < aRows.length; i++) { if (iField >= aRows[i].first && iField <= aRows[i].last) { oRow = aRows[i]; break; } } if (!oLD) { oOptions.Size = Math.floor(oRow.availableCell...
javascript
{ "resource": "" }
q18679
sanitizeHistorySensitive
train
function sanitizeHistorySensitive(blockOfProperties) { var elide = false; for (var i = 0, n = blockOfProperties.length; i < n-1; ++i) { var token = blockOfProperties[i]; if (':' === blockOfProperties[i+1]) { elide = !(cssSchema[token].cssPropBits & CSS_PROP_BIT_ALLOWED_IN_LINK); } ...
javascript
{ "resource": "" }
q18680
escapeAttrib
train
function escapeAttrib(s) { return ('' + s).replace(ampRe, '&amp;').replace(ltRe, '&lt;') .replace(gtRe, '&gt;').replace(quotRe, '&#34;'); }
javascript
{ "resource": "" }
q18681
htmlSplit
train
function htmlSplit(str) { // can't hoist this out of the function because of the re.exec loop. var re = /(<\/|<\!--|<[!?]|[&<>])/g; str += ''; if (splitWillCapture) { return str.split(re); } else { var parts = []; var lastPos = 0; var m; while ((m = re.exec(str)) !== nu...
javascript
{ "resource": "" }
q18682
sanitize
train
function sanitize(inputHtml, opt_naiveUriRewriter, opt_nmTokenPolicy) { var tagPolicy = makeTagPolicy(opt_naiveUriRewriter, opt_nmTokenPolicy); return sanitizeWithPolicy(inputHtml, tagPolicy); }
javascript
{ "resource": "" }
q18683
train
function (option) { option = option || {}; if (!BeaconRequest.isSupported()) { throw Error("Beacon API is not supported"); } if (typeof option.url !== "string") { throw Error("Beacon url must be valid"); } this._nMaxBufferLength = option.maxBufferLength || 10; this._aBuffer = []; this._sUrl = o...
javascript
{ "resource": "" }
q18684
train
function (sRule, bAsync) { var sCheckFunction = this.model.getProperty(sRule + "/check"); if (!sCheckFunction) { return; } // Check if a function is found var oMatch = sCheckFunction.match(/function[^(]*\(([^)]*)\)/); if (!oMatch) { return; } // Get the parameters of the function fou...
javascript
{ "resource": "" }
q18685
train
function (component, savedComponents) { for (var index = 0; index < savedComponents.length; index += 1) { if (savedComponents[index].text == component.text && savedComponents[index].selected) { return true; } } return false; }
javascript
{ "resource": "" }
q18686
train
function (oEvent) { var bShowRuleProperties = true, oSelectedRule = this.model.getProperty("/selectedRule"), bAdditionalRulesetsTab = oEvent.getParameter("selectedKey") === "additionalRulesets"; if (bAdditionalRulesetsTab || !oSelectedRule) { bShowRuleProperties = false; } // Ensure we don't m...
javascript
{ "resource": "" }
q18687
train
function (tempLib, treeTable) { var library, rule, oTempLibCopy, bSelected, aRules, iIndex, fnFilter = function (oRule) { return oRule.id === rule.id; }; for (var i in treeTable) { library = treeTable[i]; oTempLibCopy = treeTable[i].nodes; if (library.name !== Cons...
javascript
{ "resource": "" }
q18688
train
function (tempRule, treeTable) { var ruleSource = this.model.getProperty("/editRuleSource"); for (var i in treeTable) { if (treeTable[i].name === Constants.TEMP_RULESETS_NAME) { for (var innerIndex in treeTable[i].nodes) { if (treeTable[i].nodes[innerIndex].id === ruleSource.id) { treeTable[...
javascript
{ "resource": "" }
q18689
train
function () { var tempRules = Storage.getRules(), loadingFromAdditionalRuleSets = this.model.getProperty("/loadingAdditionalRuleSets"); if (tempRules && !loadingFromAdditionalRuleSets && !this.tempRulesLoaded) { this.tempRulesFromStorage = tempRules; this.tempRulesLoaded = true; tempRules.forEac...
javascript
{ "resource": "" }
q18690
train
function (event) { var sPath = event.getSource().getBindingContext("treeModel").getPath(), sourceObject = this.treeTable.getBinding().getModel().getProperty(sPath), libs = this.model.getProperty("/libraries"); libs.forEach(function (lib, libIndex) { lib.rules.forEach(function (rule) { if (rule.i...
javascript
{ "resource": "" }
q18691
train
function (aColumnsIds, bVisibilityValue) { var aColumns = this.treeTable.getColumns(); aColumns.forEach(function(oColumn) { oColumn.setVisible(!bVisibilityValue); aColumnsIds.forEach(function(sRuleId) { if (oColumn.sId.includes(sRuleId)) { oColumn.setVisible(bVisibilityValue); } }); ...
javascript
{ "resource": "" }
q18692
train
function (oEvent) { var oColumn = oEvent.getParameter("column"), bNewVisibilityState = oEvent.getParameter("newVisible"); if (!this.model.getProperty("/persistingSettings")) { return; } oColumn.setVisible(bNewVisibilityState); this.persistVisibleColumns(); }
javascript
{ "resource": "" }
q18693
train
function(oModelReference, mParameter) { if (typeof mParameter == "string") { throw "Deprecated second argument: Adjust your invocation by passing an object with a property sAnnotationJSONDoc as a second argument instead"; } this._mParameter = mParameter; var that = this; /* * get access to OData...
javascript
{ "resource": "" }
q18694
processMetadata
train
function processMetadata () { //only interprete the metadata if the analytics model was not initialised yet if (that.bIsInitialized) { return; } //mark analytics model as initialized that.bIsInitialized = true; /* * add extra annotations if provided */ if (mParameter && mPar...
javascript
{ "resource": "" }
q18695
train
function(sName) { var oQueryResult = this._oQueryResultSet[sName]; // Everybody should have a second chance: // If the name was not fully qualified, check if it is in the default // container if (!oQueryResult && this._oDefaultEntityContainer) { var sQName = this._oDefaultEntityContainer.name + "." ...
javascript
{ "resource": "" }
q18696
train
function(oSchema, sQTypeName) { var aEntitySet = []; for (var i = -1, oEntityContainer; (oEntityContainer = oSchema.entityContainer[++i]) !== undefined;) { for (var j = -1, oEntitySet; (oEntitySet = oEntityContainer.entitySet[++j]) !== undefined;) { if (oEntitySet.entityType == sQTypeName) { aEnti...
javascript
{ "resource": "" }
q18697
train
function(oModel, oEntityType, oEntitySet, oParameterization, oAssocFromParamsToResult) { this._oModel = oModel; this._oEntityType = oEntityType; this._oEntitySet = oEntitySet; this._oParameterization = oParameterization; this._oDimensionSet = {}; this._oMeasureSet = {}; // parse entity type for a...
javascript
{ "resource": "" }
q18698
train
function() { if (this._aDimensionNames) { return this._aDimensionNames; } this._aDimensionNames = []; for ( var sName in this._oDimensionSet) { this._aDimensionNames.push(this._oDimensionSet[sName].getName()); } return this._aDimensionNames; }
javascript
{ "resource": "" }
q18699
train
function() { if (this._aMeasureNames) { return this._aMeasureNames; } this._aMeasureNames = []; for ( var sName in this._oMeasureSet) { this._aMeasureNames.push(this._oMeasureSet[sName].getName()); } return this._aMeasureNames; }
javascript
{ "resource": "" }