code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
isLoon() { return "undefined" != typeof $loon }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
isLoon
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
toObj
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
toStr
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
getjson
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
setjson
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
getScript(t) { return new Promise(e => { this.get({url: t}, (t, s, i) => e(i)) }) }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
getScript
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = ...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
runScript
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.exists...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
loaddata
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
writedata
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
lodash_get
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
lodash_set
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } ret...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
getdata
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
setdata
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
getval
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
setval
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookie...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
initGotEnv
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {"X-Surge-Skip-Scripting": !1})), $httpClient.get(t, (t, s, i) => { ...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
get
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object....
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
post
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
time(t, e = null) { const s = e ? new Date(e) : new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000); let i = {"M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
time
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {"open-url": t} : this.isSurge() ? {url: t} : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
o
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {"open-url": t} : this.isSurge() ? {url: t} : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-...
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
o
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
log
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
wait(t) { return new Promise(e => setTimeout(e, t)) }
RegExp: https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
wait
javascript
Toulu-debug/enen
iOS_Cookie.js
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
MIT
function tower() { var args = Array.prototype.slice.call(arguments); var fn = args.pop(); args.push('--output-directory', 'tmp'); var child = spawn('./bin/tower', args); var result = ''; var error = ''; child.stdout.setEncoding('utf-8'); child.stdout.on('data', function(data){ result += data; }...
Execute a tower command, return output as string.
tower
javascript
tower-archive/tower
test/cli.js
https://github.com/tower-archive/tower/blob/master/test/cli.js
MIT
function clearTmp() { if (fs.existsSync('tmp')) fs.removeDirectoryRecursiveSync('tmp'); fs.mkdirSync('tmp'); }
Execute a tower command, return output as string.
clearTmp
javascript
tower-archive/tower
test/cli.js
https://github.com/tower-archive/tower/blob/master/test/cli.js
MIT
function encode(name, value) { return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
encode
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function getSelectMultiple_(el) { var values = []; each(el.options, function (o) { if (o.selected) { values.push(o.value); } }); return values.length ? values : null; }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getSelectMultiple_
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function getSelectSingle_(el) { var selectedIndex = el.selectedIndex; return selectedIndex >= 0 ? el.options[selectedIndex].value : null; }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getSelectSingle_
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function getValue(el) { var type = el.type; if (!type) { return null; } switch (type.toLowerCase()) { case "select-one": return getSelectSingle_(el); case "select-multiple": return getSelectMultiple_(el); case "radio": return el.checked ? el.value : null; ...
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getValue
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function insertElement(el, child, prepend) { if (prepend) { var first = el.childNodes[0]; el.insertBefore(child, first); } else { el.appendChild(child); } }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
insertElement
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function insertContent(parent, child, prepend) { var str = isString(child); if (!str && child.length) { each(child, function (v) { return insertContent(parent, v, prepend); }); return; } each(parent, str ? function (v) { return v.insertAdjacentHTML(prepend ? "afterbegin...
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
insertContent
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Component(classDef, el, options) { _classCallCheck(this, Component); // Display error if el is valid HTML Element if (!(el instanceof Element)) { console.error(Error(el + ' is not an HTML Element')); } // If exists, destroy and reinitialize in child var ins = classDef.getInstanc...
Generic constructor for all components @constructor @param {Element} el @param {Object} options
Component
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }
Generate approximated selector string for a jQuery object @param {jQuery} obj jQuery object to be parsed @returns {string}
s4
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Collapsible(el, options) { _classCallCheck(this, Collapsible); var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); _this3.el.M_Collapsible = _this3; /** * Options for the collapsible...
Construct Collapsible instance @constructor @param {Element} el @param {Object} options
Collapsible
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Modal(el, options) { _classCallCheck(this, Modal); var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options)); _this13.el.M_Modal = _this13; /** * Options for the modal * @member Modal#options ...
Construct Modal instance and set up overlay @constructor @param {Element} el @param {Object} options
Modal
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Materialbox(el, options) { _classCallCheck(this, Materialbox); var _this16 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options)); _this16.el.M_Materialbox = _this16; /** * Options for the modal ...
Construct Materialbox instance @constructor @param {Element} el @param {Object} options
Materialbox
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Tabs(el, options) { _classCallCheck(this, Tabs); var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options)); _this22.el.M_Tabs = _this22; /** * Options for the Tabs * @member Tabs#options * @prop ...
Construct Tabs instance @constructor @param {Element} el @param {Object} options
Tabs
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Tooltip(el, options) { _classCallCheck(this, Tooltip); var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options)); _this26.el.M_Tooltip = _this26; _this26.options = $.extend({}, Tooltip.defaults, options); ...
Construct Tooltip instance @constructor @param {Element} el @param {Object} options
Tooltip
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function getWavesEffectElement(e) { if (TouchHandler.allowEvent(e) === false) { return null; } var element = null; var target = e.target || e.srcElement; while (target.parentNode !== null) { if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) { ...
Delegated click handler for .waves-effect element. returns null when .waves-effect element not in "click tree"
getWavesEffectElement
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function showEffect(e) { var element = getWavesEffectElement(e); if (element !== null) { Effect.show(e, element); if ('ontouchstart' in window) { element.addEventListener('touchend', Effect.hide, false); element.addEventListener('touchcancel', Effect.hide, false); } el...
Bubble the click and show effect if .waves-effect elem was found
showEffect
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Toast(options) { _classCallCheck(this, Toast); /** * Options for the toast * @member Toast#options */ this.options = $.extend({}, Toast.defaults, options); this.message = this.options.html; /** * Describes current pan state toast * @type {Boole...
Attach Waves to an input element (or any element which doesn't bubble mouseup/mousedown events). Intended to be used with dynamically loaded forms/inputs, or where the user doesn't want a delegated click handler.
Toast
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Sidenav(el, options) { _classCallCheck(this, Sidenav); var _this31 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options)); _this31.el.M_Sidenav = _this31; _this31.id = _this31.$el.attr('id'); /** * Optio...
Construct Sidenav instance and set up overlay @constructor @param {Element} el @param {Object} options
Sidenav
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function ScrollSpy(el, options) { _classCallCheck(this, ScrollSpy); var _this35 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options)); _this35.el.M_ScrollSpy = _this35; /** * Options for the modal * @memb...
Construct ScrollSpy instance @constructor @param {Element} el @param {Object} options
ScrollSpy
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Autocomplete(el, options) { _classCallCheck(this, Autocomplete); var _this37 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options)); _this37.el.M_Autocomplete = _this37; /** * Options for the au...
Construct Autocomplete instance @constructor @param {Element} el @param {Object} options
Autocomplete
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
sortFunctionBound = function (a, b) { return _this39.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase()); }
Render dropdown content @param {Object} data data set @param {String} val current input value
sortFunctionBound
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Slider(el, options) { _classCallCheck(this, Slider); var _this40 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options)); _this40.el.M_Slider = _this40; /** * Options for the modal * @member Slider#options ...
Construct Slider instance and set up overlay @constructor @param {Element} el @param {Object} options
Slider
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Chips(el, options) { _classCallCheck(this, Chips); var _this45 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options)); _this45.el.M_Chips = _this45; /** * Options for the modal * @member Chips#options ...
Construct Chips instance and set up overlay @constructor @param {Element} el @param {Object} options
Chips
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Pushpin(el, options) { _classCallCheck(this, Pushpin); var _this47 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options)); _this47.el.M_Pushpin = _this47; /** * Options for the modal * @member Pushpin#o...
Construct Pushpin instance @constructor @param {Element} el @param {Object} options
Pushpin
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function FloatingActionButton(el, options) { _classCallCheck(this, FloatingActionButton); var _this48 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options)); _this48.el.M_FloatingActionButton =...
Construct FloatingActionButton instance @constructor @param {Element} el @param {Object} options
FloatingActionButton
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Datepicker(el, options) { _classCallCheck(this, Datepicker); var _this53 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options)); _this53.el.M_Datepicker = _this53; _this53.options = $.extend({}, Datepicker.d...
Construct Datepicker instance and set up overlay @constructor @param {Element} el @param {Object} options
Datepicker
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function CharacterCounter(el, options) { _classCallCheck(this, CharacterCounter); var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); _this61.el.M_CharacterCounter = _this61; /** ...
Construct CharacterCounter instance @constructor @param {Element} el @param {Object} options
CharacterCounter
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Carousel(el, options) { _classCallCheck(this, Carousel); var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); _this62.el.M_Carousel = _this62; /** * Options for the carousel * @member ...
Construct Carousel instance @constructor @param {Element} el @param {Object} options
Carousel
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function TapTarget(el, options) { _classCallCheck(this, TapTarget); var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); _this67.el.M_TapTarget = _this67; /** * Options for the select * @mem...
Construct TapTarget instance @constructor @param {Element} el @param {Object} options
TapTarget
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function FormSelect(el, options) { _classCallCheck(this, FormSelect); // Don't init if browser default version var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); if (_this68.$el.hasClass('browser-defa...
Construct FormSelect instance @constructor @param {Element} el @param {Object} options
FormSelect
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
function Range(el, options) { _classCallCheck(this, Range); var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); _this72.el.M_Range = _this72; /** * Options for the range * @member Range#options ...
Construct Range instance @constructor @param {Element} el @param {Object} options
Range
javascript
Dogfalo/materialize
dist/js/materialize.js
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
MIT
constructor(el, options) { super(Autocomplete, el, options); this.el.M_Autocomplete = this; /** * Options for the autocomplete * @member Autocomplete#options * @prop {Number} duration * @prop {Number} dist * @prop {number} shift * @prop {number} padding ...
Construct Autocomplete instance @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
static get defaults() { return _defaults; }
Options for the autocomplete @member Autocomplete#options @prop {Number} duration @prop {Number} dist @prop {number} shift @prop {number} padding @prop {Boolean} fullWidth @prop {Boolean} indicators @prop {Boolean} noWrap @prop {Function} onCycleTo
defaults
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
static init(els, options) { return super.init(this, els, options); }
Options for the autocomplete @member Autocomplete#options @prop {Number} duration @prop {Number} dist @prop {number} shift @prop {number} padding @prop {Boolean} fullWidth @prop {Boolean} indicators @prop {Boolean} noWrap @prop {Function} onCycleTo
init
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
_handleInputKeyupAndFocus(e) { if (e.type === 'keyup') { Autocomplete._keydown = false; } this.count = 0; let val = this.el.value.toLowerCase(); // Don't capture enter or arrow key usage. if (e.keyCode === 13 || e.keyCode === 38 || e.keyCode === 40) { return; ...
Handle Input Keyup and Focus @param {Event} e
_handleInputKeyupAndFocus
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
_handleContainerMousedownAndTouchstart(e) { this._mousedown = true; }
Handle Container Mousedown and Touchstart @param {Event} e
_handleContainerMousedownAndTouchstart
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
_handleContainerMouseupAndTouchend(e) { this._mousedown = false; }
Handle Container Mouseup and Touchend @param {Event} e
_handleContainerMouseupAndTouchend
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
selectOption(el) { let text = el.text().trim(); this.el.value = text; this.$el.trigger('change'); this._resetAutocomplete(); this.close(); // Handle onAutocomplete callback. if (typeof this.options.onAutocomplete === 'function') { this.options.onAutocomplete.call(this,...
Select autocomplete option @param {Element} el Autocomplete option list item element
selectOption
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
_renderDropdown(data, val) { this._resetAutocomplete(); let matchingData = []; // Gather all matching data for (let key in data) { if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) { let entry = { data: data[key], key: key ...
Render dropdown content @param {Object} data data set @param {String} val current input value
_renderDropdown
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
sortFunctionBound = (a, b) => { return this.options.sortFunction( a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase() ); }
Render dropdown content @param {Object} data data set @param {String} val current input value
sortFunctionBound
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
sortFunctionBound = (a, b) => { return this.options.sortFunction( a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase() ); }
Render dropdown content @param {Object} data data set @param {String} val current input value
sortFunctionBound
javascript
Dogfalo/materialize
js/autocomplete.js
https://github.com/Dogfalo/materialize/blob/master/js/autocomplete.js
MIT
constructor(el, options) { super(FloatingActionButton, el, options); this.el.M_FloatingActionButton = this; /** * Options for the fab * @member FloatingActionButton#options * @prop {Boolean} [direction] - Direction fab menu opens * @prop {Boolean} [hoverEnabled=true] - En...
Construct FloatingActionButton instance @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/buttons.js
https://github.com/Dogfalo/materialize/blob/master/js/buttons.js
MIT
static get defaults() { return _defaults; }
Options for the fab @member FloatingActionButton#options @prop {Boolean} [direction] - Direction fab menu opens @prop {Boolean} [hoverEnabled=true] - Enable hover vs click @prop {Boolean} [toolbarEnabled=false] - Enable toolbar transition
defaults
javascript
Dogfalo/materialize
js/buttons.js
https://github.com/Dogfalo/materialize/blob/master/js/buttons.js
MIT
static init(els, options) { return super.init(this, els, options); }
Options for the fab @member FloatingActionButton#options @prop {Boolean} [direction] - Direction fab menu opens @prop {Boolean} [hoverEnabled=true] - Enable hover vs click @prop {Boolean} [toolbarEnabled=false] - Enable toolbar transition
init
javascript
Dogfalo/materialize
js/buttons.js
https://github.com/Dogfalo/materialize/blob/master/js/buttons.js
MIT
constructor(el, options) { super(Carousel, el, options); this.el.M_Carousel = this; /** * Options for the carousel * @member Carousel#options * @prop {Number} duration * @prop {Number} dist * @prop {Number} shift * @prop {Number} padding * @prop {Numb...
Construct Carousel instance @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
static get defaults() { return _defaults; }
Options for the carousel @member Carousel#options @prop {Number} duration @prop {Number} dist @prop {Number} shift @prop {Number} padding @prop {Number} numVisible @prop {Boolean} fullWidth @prop {Boolean} indicators @prop {Boolean} noWrap @prop {Function} onCycleTo
defaults
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
static init(els, options) { return super.init(this, els, options); }
Options for the carousel @member Carousel#options @prop {Number} duration @prop {Number} dist @prop {Number} shift @prop {Number} padding @prop {Number} numVisible @prop {Boolean} fullWidth @prop {Boolean} indicators @prop {Boolean} noWrap @prop {Function} onCycleTo
init
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_setCarouselHeight(imageOnly) { let firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); let firstImage = firstSlide.find('img').first(); if (firstImage.length) { if (firstImage[0]...
Set carousel height based on first slide @param {Booleam} imageOnly - true for image slides
_setCarouselHeight
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_xpos(e) { // touch event if (e.targetTouches && e.targetTouches.length >= 1) { return e.targetTouches[0].clientX; } // mouse event return e.clientX; }
Get x position from event @param {Event} e
_xpos
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_ypos(e) { // touch event if (e.targetTouches && e.targetTouches.length >= 1) { return e.targetTouches[0].clientY; } // mouse event return e.clientY; }
Get y position from event @param {Event} e
_ypos
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_autoScroll() { let elapsed, delta; if (this.amplitude) { elapsed = Date.now() - this.timestamp; delta = this.amplitude * Math.exp(-elapsed / this.options.duration); if (delta > 2 || delta < -2) { this._scroll(this.target - delta); requestAnimationFrame(this._aut...
Auto scrolls to nearest carousel item.
_autoScroll
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_updateItemStyle(el, opacity, zIndex, transform) { el.style[this.xform] = transform; el.style.zIndex = zIndex; el.style.opacity = opacity; el.style.visibility = 'visible'; }
Cycle to target @param {Element} el @param {Number} opacity @param {Number} zIndex @param {String} transform
_updateItemStyle
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
_cycleTo(n, callback) { let diff = this.center % this.count - n; // Account for wraparound. if (!this.noWrap) { if (diff < 0) { if (Math.abs(diff + this.count) < Math.abs(diff)) { diff += this.count; } } else if (diff > 0) { if (Math.abs(diff ...
Cycle to target @param {Number} n @param {Function} callback
_cycleTo
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
next(n) { if (n === undefined || isNaN(n)) { n = 1; } let index = this.center + n; if (index >= this.count || index < 0) { if (this.noWrap) { return; } index = this._wrap(index); } this._cycleTo(index); }
Cycle to next item @param {Number} [n]
next
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
prev(n) { if (n === undefined || isNaN(n)) { n = 1; } let index = this.center - n; if (index >= this.count || index < 0) { if (this.noWrap) { return; } index = this._wrap(index); } this._cycleTo(index); }
Cycle to previous item @param {Number} [n]
prev
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
set(n, callback) { if (n === undefined || isNaN(n)) { n = 0; } if (n > this.count || n < 0) { if (this.noWrap) { return; } n = this._wrap(n); } this._cycleTo(n, callback); }
Cycle to nth item @param {Number} [n] @param {Function} callback
set
javascript
Dogfalo/materialize
js/carousel.js
https://github.com/Dogfalo/materialize/blob/master/js/carousel.js
MIT
function encode(name, value) { return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
encode
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
function getSelectMultiple_(el) { var values = []; each(el.options, function (o) { if (o.selected) { values.push(o.value); } }); return values.length ? values : null; }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getSelectMultiple_
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
function getSelectSingle_(el) { var selectedIndex = el.selectedIndex; return selectedIndex >= 0 ? el.options[selectedIndex].value : null; }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getSelectSingle_
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
function getValue(el) { var type = el.type; if (!type) { return null; } switch (type.toLowerCase()) { case "select-one": return getSelectSingle_(el); case "select-multiple": return getSelectMultiple_(el); case "radio": return (el.checked) ? el.value : null...
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
getValue
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
function insertElement(el, child, prepend) { if (prepend) { var first = el.childNodes[0]; el.insertBefore(child, first); } else { el.appendChild(child); } }
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
insertElement
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
function insertContent(parent, child, prepend) { var str = isString(child); if (!str && child.length) { each(child, function (v) { return insertContent(parent, v, prepend); }); return; } each(parent, str ? function (v) { return v.insertAdjacentHTML(prepend ? "afterbegin...
Modified Triggers browser event @param String eventName @param Object data - Add properties to event object
insertContent
javascript
Dogfalo/materialize
js/cash.js
https://github.com/Dogfalo/materialize/blob/master/js/cash.js
MIT
constructor(el, options) { super(CharacterCounter, el, options); this.el.M_CharacterCounter = this; /** * Options for the character counter */ this.options = $.extend({}, CharacterCounter.defaults, options); this.isInvalid = false; this.isValidLength = false; t...
Construct CharacterCounter instance @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/characterCounter.js
https://github.com/Dogfalo/materialize/blob/master/js/characterCounter.js
MIT
constructor(el, options) { super(Chips, el, options); this.el.M_Chips = this; /** * Options for the modal * @member Chips#options * @prop {Array} data * @prop {String} placeholder * @prop {String} secondaryPlaceholder * @prop {Object} autocompleteOptions ...
Construct Chips instance and set up overlay @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/chips.js
https://github.com/Dogfalo/materialize/blob/master/js/chips.js
MIT
static get defaults() { return _defaults; }
Options for the modal @member Chips#options @prop {Array} data @prop {String} placeholder @prop {String} secondaryPlaceholder @prop {Object} autocompleteOptions
defaults
javascript
Dogfalo/materialize
js/chips.js
https://github.com/Dogfalo/materialize/blob/master/js/chips.js
MIT
static init(els, options) { return super.init(this, els, options); }
Options for the modal @member Chips#options @prop {Array} data @prop {String} placeholder @prop {String} secondaryPlaceholder @prop {Object} autocompleteOptions
init
javascript
Dogfalo/materialize
js/chips.js
https://github.com/Dogfalo/materialize/blob/master/js/chips.js
MIT
_renderChip(chip) { if (!chip.tag) { return; } let renderedChip = document.createElement('div'); let closeIcon = document.createElement('i'); renderedChip.classList.add('chip'); renderedChip.textContent = chip.tag; renderedChip.setAttribute('tabindex', 0); $(clos...
Render Chip @param {chip} chip @return {Element}
_renderChip
javascript
Dogfalo/materialize
js/chips.js
https://github.com/Dogfalo/materialize/blob/master/js/chips.js
MIT
_isValid(chip) { if (chip.hasOwnProperty('tag') && chip.tag !== '') { let exists = false; for (let i = 0; i < this.chipsData.length; i++) { if (this.chipsData[i].tag === chip.tag) { exists = true; break; } } return !exists; } ...
Check if chip is valid @param {chip} chip
_isValid
javascript
Dogfalo/materialize
js/chips.js
https://github.com/Dogfalo/materialize/blob/master/js/chips.js
MIT
constructor(el, options) { super(Collapsible, el, options); this.el.M_Collapsible = this; /** * Options for the collapsible * @member Collapsible#options * @prop {Boolean} [accordion=false] - Type of the collapsible * @prop {Function} onOpenStart - Callback function calle...
Construct Collapsible instance @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
static get defaults() { return _defaults; }
Options for the collapsible @member Collapsible#options @prop {Boolean} [accordion=false] - Type of the collapsible @prop {Function} onOpenStart - Callback function called before collapsible is opened @prop {Function} onOpenEnd - Callback function called after collapsible is opened @prop {Function} onCloseStart - Callb...
defaults
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
static init(els, options) { return super.init(this, els, options); }
Options for the collapsible @member Collapsible#options @prop {Boolean} [accordion=false] - Type of the collapsible @prop {Function} onOpenStart - Callback function called before collapsible is opened @prop {Function} onOpenEnd - Callback function called after collapsible is opened @prop {Function} onCloseStart - Callb...
init
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
_animateIn(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length) { let $body = $collapsibleLi.children('.collapsible-body'); anim.remove($body[0]); $body.css({ display: 'block', overflow: 'hidden', height: 0, ...
Animate in collapsible slide @param {Number} index - 0th index of slide
_animateIn
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
_animateOut(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length) { let $body = $collapsibleLi.children('.collapsible-body'); anim.remove($body[0]); $body.css('overflow', 'hidden'); anim({ targets: $body[0], height: 0,...
Animate out collapsible slide @param {Number} index - 0th index of slide to open
_animateOut
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
open(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { // onOpenStart callback if (typeof this.options.onOpenStart === 'function') { this.options.onOpenStart.call(this, $collapsibleLi[0])...
Open Collapsible @param {Number} index - 0th index of slide
open
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
close(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { // onCloseStart callback if (typeof this.options.onCloseStart === 'function') { this.options.onCloseStart.call(this, $collapsibleLi[...
Close Collapsible @param {Number} index - 0th index of slide
close
javascript
Dogfalo/materialize
js/collapsible.js
https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js
MIT
constructor(classDef, el, options) { // Display error if el is valid HTML Element if (!(el instanceof Element)) { console.error(Error(el + ' is not an HTML Element')); } // If exists, destroy and reinitialize in child let ins = classDef.getInstance(el); if (!!ins) { ins.destroy(); ...
Generic constructor for all components @constructor @param {Element} el @param {Object} options
constructor
javascript
Dogfalo/materialize
js/component.js
https://github.com/Dogfalo/materialize/blob/master/js/component.js
MIT