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
function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }
Decodes a base64 string. @param {String} input The string to decode.
safe_add
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
Decodes a base64 string. @param {String} input The string to decode.
rol
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
function str2binb(str) { var bin = []; var mask = 255; for (var i = 0; i < str.length * 8; i += 8) { bin[i>>5] |= (str.charCodeAt(i / 8) & mask) << (24 - i%32); } return bin; }
Decodes a base64 string. @param {String} input The string to decode.
str2binb
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
function binb2str(bin) { var str = ""; var mask = 255; for (var i = 0; i < bin.length * 32; i += 8) { str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask); } return str; }
Decodes a base64 string. @param {String} input The string to decode.
binb2str
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
function binb2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; var triplet, j; for (var i = 0; i < binarray.length * 4; i += 3) { triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * (3 ...
Decodes a base64 string. @param {String} input The string to decode.
binb2b64
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
safe_add = function (x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }
Decodes a base64 string. @param {String} input The string to decode.
safe_add
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
bit_rol = function (num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
Decodes a base64 string. @param {String} input The string to decode.
bit_rol
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
str2binl = function (str) { var bin = []; for(var i = 0; i < str.length * 8; i += 8) { bin[i>>5] |= (str.charCodeAt(i / 8) & 255) << (i%32); } return bin; }
Decodes a base64 string. @param {String} input The string to decode.
str2binl
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
binl2str = function (bin) { var str = ""; for(var i = 0; i < bin.length * 32; i += 8) { str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & 255); } return str; }
Decodes a base64 string. @param {String} input The string to decode.
binl2str
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
binl2hex = function (binarray) { var hex_tab = "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } ...
Decodes a base64 string. @param {String} input The string to decode.
binl2hex
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
md5_cmn = function (q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q),safe_add(x, t)), s),b); }
Decodes a base64 string. @param {String} input The string to decode.
md5_cmn
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
md5_ff = function (a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }
Decodes a base64 string. @param {String} input The string to decode.
md5_ff
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
md5_gg = function (a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }
Decodes a base64 string. @param {String} input The string to decode.
md5_gg
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
md5_hh = function (a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
Decodes a base64 string. @param {String} input The string to decode.
md5_hh
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
md5_ii = function (a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
Decodes a base64 string. @param {String} input The string to decode.
md5_ii
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
core_md5 = function (x, len) { /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var olda, oldb, oldc, oldd; for (v...
Decodes a base64 string. @param {String} input The string to decode.
core_md5
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
wrapper = function(handlers, elem) { while (handlers.length) { this.deleteHandler(handlers.pop()); } this._sasl_auth1_cb.bind(this)(elem); return false; }
PrivateFunction: _sasl_success_cb _Private_ handler for succesful SASL authentication. Parameters: (XMLElement) elem - The matching stanza. Returns: false to remove the handler.
wrapper
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
sendFunc = function () { req.date = new Date(); if (self._conn.options.customHeaders){ var headers = self._conn.options.customHeaders; for (var header in headers) { if (headers.hasOwnProperty(header)) { ...
PrivateFunction: _processRequest _Private_ function to process a request in the queue. This function takes requests off the queue and sends them and restarts dead requests. Parameters: (Integer) i - The index of the request in the queue.
sendFunc
javascript
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
https://github.com/dcloudio/mui/blob/master/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
MIT
filterFn = function(fn) { return fn.type === event; }
mui delegate events @param {type} event @param {type} selector @param {type} callback @returns {undefined}
filterFn
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
function update(fn) { return function(value) { var classes = self.className.split(/\s+/), index = classes.indexOf(value); fn(classes, index, value); self.className = classes.join(" "); ...
mui fixed classList @param {type} document @returns {undefined}
update
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
getDistance = function(p1, p2, props) { if (!props) { props = ['x', 'y']; } var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return sqrt((x * x) + (y * y)); }
angle @param {type} p1 @param {type} p2 @returns {Number}
getDistance
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
getAngle = function(p1, p2, props) { if (!props) { props = ['x', 'y']; } var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return atan2(y, x) * 180 / Math.PI; }
rotation @param {Object} start @param {Object} end
getAngle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
getDirection = function(x, y) { if (x === y) { return ''; } if (abs(x) >= abs(y)) { return x > 0 ? 'left' : 'right'; } return y > 0 ? 'up' : 'down'; }
detect gestures @param {type} event @param {type} touch @returns {undefined}
getDirection
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
getRotation = function(start, end) { var props = ['pageX', 'pageY']; return getAngle(end[1], end[0], props) - getAngle(start[1], start[0], props); }
detect gestures @param {type} event @param {type} touch @returns {undefined}
getRotation
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; var now = $.now(); switch (event.type) { case $.EVENT_MOVE: if (now - flickStartTime > 300) { flickStartTime = now; session.flickStart = touch.center; } break; case $.EVENT_END: case $....
mui gesture flick[left|right|up|down] @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_END: if (!touch.isFinal) { return; } var target = session.target; if (!target || (target.disabled || (target.classList && target.classList.contains('mui-disabl...
mui gesture tap and doubleTap @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_START: clearTimeout(timer); timer = setTimeout(function() { $.trigger(session.target, name, touch); }, options.holdTimeout); break; case $.EVENT_MOVE: i...
mui gesture hold @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_START: if ($.options.gestureConfig.hold) { timer && clearTimeout(timer); timer = setTimeout(function() { touch.hold = true; $.trigger(session.target, name...
mui gesture pinch @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
ajaxBeforeSend = function(xhr, settings) { var context = settings.context if(settings.beforeSend.call(context, xhr, settings) === false) { return false; } }
mui ajax @param {type} $ @returns {undefined}
ajaxBeforeSend
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
ajaxSuccess = function(data, xhr, settings) { settings.success.call(settings.context, data, 'success', xhr); ajaxComplete('success', xhr, settings); }
mui ajax @param {type} $ @returns {undefined}
ajaxSuccess
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
ajaxError = function(error, type, xhr, settings) { settings.error.call(settings.context, xhr, type, error); ajaxComplete(type, xhr, settings); }
mui ajax @param {type} $ @returns {undefined}
ajaxError
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
ajaxComplete = function(status, xhr, settings) { settings.complete.call(settings.context, xhr, status); }
mui ajax @param {type} $ @returns {undefined}
ajaxComplete
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
serialize = function(params, obj, traditional, scope) { var type, array = $.isArray(obj), hash = $.isPlainObject(obj); $.each(obj, function(key, value) { type = $.type(value); if(scope) { key = traditional ? scope : scope + '[' + (hash || type === 'object' || type === 'array' ? key : '') + ']'; ...
mui ajax @param {type} $ @returns {undefined}
serialize
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
serializeData = function(options) { if(options.processData && options.data && typeof options.data !== "string") { var contentType = options.contentType; if(!contentType && options.headers) { contentType = options.headers['Content-Type']; } if(contentType && ~contentType.indexOf(jsonType)) { //applicat...
mui ajax @param {type} $ @returns {undefined}
serializeData
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
appendQuery = function(url, query) { if(query === '') { return url; } return(url + '&' + query).replace(/[&?]{1,2}/, '?'); }
mui ajax @param {type} $ @returns {undefined}
appendQuery
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
mimeToDataType = function(mime) { if(mime) { mime = mime.split(';', 2)[0]; } return mime && (mime === htmlType ? 'html' : mime === jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text'; }
mui ajax @param {type} $ @returns {undefined}
mimeToDataType
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
parseArguments = function(url, data, success, dataType) { if($.isFunction(data)) { dataType = success, success = data, data = undefined; } if(!$.isFunction(success)) { dataType = success, success = undefined; } return { url: url, data: data, success: success, dataType: dataType }; }
mui ajax @param {type} $ @returns {undefined}
parseArguments
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value]; }
mui ajax @param {type} $ @returns {undefined}
setHeader
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
findOffCanvasContainer = function(target) { parentNode = target.parentNode; if (parentNode) { if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) { return parentNode; } else { parentNode = parentNode.parentNode; if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) { return parentNo...
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
findOffCanvasContainer
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { if (target.tagName === 'A' && target.hash) { var offcanvas = document.getElementById(target.hash.replace('#', '')); if (offcanvas) { var container = findOffCanvasContainer(offcanvas); if (container) { $.targets._container = container; return offcanvas; } ...
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { var className = target.className || ''; if (typeof className !== 'string') { //svg className(SVGAnimatedString) className = ''; } if (className && ~className.indexOf(CLASS_ACTION)) { if (target.classList.contains('mui-action-back')) { event.preventDefault(); } ...
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { if (target.tagName === 'A' && target.hash) { var modal = document.getElementById(target.hash.replace('#', '')); if (modal && modal.classList.contains(CLASS_MODAL)) { return modal; } } return false; }
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { if (target.tagName === 'A' && target.hash) { $.targets._popover = document.getElementById(target.hash.replace('#', '')); if ($.targets._popover && $.targets._popover.classList.contains(CLASS_POPOVER)) { return target; } else { $.targets._popover = null; } } r...
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
onPopoverShown = function(e) { this.removeEventListener('webkitTransitionEnd', onPopoverShown); this.addEventListener($.EVENT_MOVE, $.preventDefault); $.trigger(this, 'shown', this); }
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
onPopoverShown
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
onPopoverHidden = function(e) { setStyle(this, 'none'); this.removeEventListener('webkitTransitionEnd', onPopoverHidden); this.removeEventListener($.EVENT_MOVE, $.preventDefault); $.trigger(this, 'hidden', this); }
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
onPopoverHidden
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
removeBackdrop = function(popover) { backdrop.setAttribute('style', 'opacity:0'); $.targets.popover = $.targets._popover = null; //reset removeBackdropTimer = $.later(function() { if (!popover.classList.contains(CLASS_ACTIVE) && backdrop.parentNode && backdrop.parentNode === document.body) { document.body....
Popovers @param {type} $ @param {type} window @param {type} document @param {type} name @param {type} undefined @returns {undefined}
removeBackdrop
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
setStyle = function(popover, display, top, left) { var style = popover.style; if (typeof display !== 'undefined') style.display = display; if (typeof top !== 'undefined') style.top = top + 'px'; if (typeof left !== 'undefined') style.left = left + 'px'; }
segmented-controllers @param {type} $ @param {type} window @param {type} document @param {type} undefined @returns {undefined}
setStyle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
calPosition = function(popover, anchor, isActionSheet) { if (!popover || !anchor) { return; } if (isActionSheet) { //actionsheet setStyle(popover, 'block') return; } var wWidth = window.innerWidth; var wHeight = window.innerHeight; var pWidth = popover.offsetWidth; var pHeight = popover.offs...
segmented-controllers @param {type} $ @param {type} window @param {type} document @param {type} undefined @returns {undefined}
calPosition
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { if (target.classList && target.classList.contains(CLASS_SWITCH)) { return target; } return false; }
Tableviews @param {type} $ @param {type} window @param {type} document @returns {undefined}
handle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
Toggle = function(element) { this.element = element; this.classList = this.element.classList; this.handle = this.element.querySelector(SELECTOR_SWITCH_HANDLE); this.init(); this.initEvent(); }
Tableviews @param {type} $ @param {type} window @param {type} document @returns {undefined}
Toggle
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
toggleActive = function(isActive) { if (isActive) { if (a) { a.classList.add(CLASS_ACTIVE); } else if (cell) { cell.classList.add(CLASS_ACTIVE); } } else { timer && timer.cancel(); if (a) { a.classList.remove(CLASS_ACTIVE); } else if (cell) { cell.classList.remove(CLASS_ACTIVE); ...
Tableviews @param {type} $ @param {type} window @param {type} document @returns {undefined}
toggleActive
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
updateTranslate = function() { if (translateX !== lastTranslateX) { if (buttonsRight && buttonsRight.length > 0) { progress = translateX / sliderActionRightWidth; if (translateX < -sliderActionRightWidth) { translateX = -sliderActionRightWidth - Math.pow(-translateX - sliderActionRightWidth, overFacto...
Tableviews @param {type} $ @param {type} window @param {type} document @returns {undefined}
updateTranslate
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
setTranslate = function(element, x) { if (element) { element.style.webkitTransform = 'translate(' + x + 'px,0)'; } }
Tableviews @param {type} $ @param {type} window @param {type} document @returns {undefined}
setTranslate
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
radioOrCheckboxClick = function(event) { var type = event.target && event.target.type || ''; if (type === 'radio' || type === 'checkbox') { return; } var classList = cell.classList; if (classList.contains('mui-radio')) { var input = cell.querySelector('input[type=radio]'); if (input) { // inpu...
Popup(alert,confirm,prompt) @param {Object} $ @param {Object} window @param {Object} document
radioOrCheckboxClick
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
createInput = function(placeholder) { return '<div class="' + CLASS_POPUP_INPUT + '"><input type="text" autofocus placeholder="' + (placeholder || '') + '"/></div>'; }
Popup(alert,confirm,prompt) @param {Object} $ @param {Object} window @param {Object} document
createInput
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
createInner = function(message, title, extra) { return '<div class="' + CLASS_POPUP_INNER + '"><div class="' + CLASS_POPUP_TITLE + '">' + title + '</div><div class="' + CLASS_POPUP_TEXT + '">' + message.replace(/\r\n/g, "<br/>").replace(/\n/g, "<br/>") + '</div>' + (extra || '') + '</div>'; }
Popup(alert,confirm,prompt) @param {Object} $ @param {Object} window @param {Object} document
createInner
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
createButtons = function(btnArray) { var length = btnArray.length; var btns = []; for (var i = 0; i < length; i++) { btns.push('<span class="' + CLASS_POPUP_BUTTON + (i === length - 1 ? (' ' + CLASS_POPUP_BUTTON_BOLD) : '') + '">' + btnArray[i] + '</span>'); } return ...
Popup(alert,confirm,prompt) @param {Object} $ @param {Object} window @param {Object} document
createButtons
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
removePopupElement = function() { popupElement.parentNode && popupElement.parentNode.removeChild(popupElement); popupElement = null; }
Popup(alert,confirm,prompt) @param {Object} $ @param {Object} window @param {Object} document
removePopupElement
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
closePopup = function() { if (popupStack.length) { popupStack[popupStack.length - 1]['close'](); return true; } else { return false; } }
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
closePopup
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
closePopups = function() { while (popupStack.length) { popupStack[popupStack.length - 1]['close'](); } }
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
closePopups
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
_findProgressbar = function(container) { container = $(container || 'body'); if (container.length === 0) return; container = container[0]; if (container.classList.contains(CLASS_PROGRESSBAR)) { return container; } var progressbars = container.querySelectorAll(SELECTOR_PROGRESSBAR); if (progressbars) { ...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
_findProgressbar
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
showProgressbar = function(container, progress, color) { if (typeof container === 'number') { color = progress; progress = container; container = 'body'; } container = $(container || 'body'); if (container.length === 0) return; container = container[0]; var progressbar; if (container.classList.co...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
showProgressbar
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
hideProgressbar = function(container) { var progressbar = _findProgressbar(container); if (!progressbar) { return; } var classList = progressbar.classList; if (!classList.contains(CLASS_PROGRESSBAR_IN) || classList.contains(CLASS_PROGRESSBAR_OUT)) { return; } classList.remove(CLASS_PROGRESSBAR_IN); ...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
hideProgressbar
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
setProgressbar = function(container, progress, speed) { if (typeof container === 'number') { speed = progress; progress = container; container = false; } var progressbar = _findProgressbar(container); if (!progressbar || progressbar.classList.contains(CLASS_PROGRESSBAR_INFINITE)) { return; } if ...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
setProgressbar
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
findRow = function(target) { for (; target && target !== document; target = target.parentNode) { if (target.classList && target.classList.contains(CLASS_INPUT_ROW)) { return target; } } return null; }
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
findRow
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
Input = function(element, options) { this.element = element; this.options = options || { actions: 'clear' }; if (~this.options.actions.indexOf('slider')) { //slider this.sliderActionClass = CLASS_TOOLTIP + ' ' + CLASS_HIDDEN; this.sliderActionSelector = SELECTOR_TOOLTIP; } else { //clear,speech,searc...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
Input
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
Button = function(element, options) { this.element = element; this.options = $.extend({}, defaultOptions, options); if (!this.options.loadingText) { this.options.loadingText = defaultOptions.loadingText; } if (this.options.loadingIcon === null) { this.opti...
Button @param {type} $ @param {type} window @param {type} document @returns {undefined}
Button
javascript
dcloudio/mui
examples/nativeTab/js/mui.js
https://github.com/dcloudio/mui/blob/master/examples/nativeTab/js/mui.js
MIT
handle = function(event, target) { var className = target.className || ''; if (typeof className !== 'string') { //svg className(SVGAnimatedString) className = ''; } if (className && ~className.indexOf(CLASS_ACTION)) { if (target.classList.contains($.className('action-back'))) { event.preventDefault();...
actions @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/actions.js
https://github.com/dcloudio/mui/blob/master/js/actions.js
MIT
findRow = function(target) { for (; target && target !== document; target = target.parentNode) { if (target.classList && target.classList.contains(CLASS_INPUT_ROW)) { return target; } } return null; }
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
findRow
javascript
dcloudio/mui
js/input.plugin.js
https://github.com/dcloudio/mui/blob/master/js/input.plugin.js
MIT
Input = function(element, options) { this.element = element; this.options = options || { actions: 'clear' }; if (~this.options.actions.indexOf('slider')) { //slider this.sliderActionClass = CLASS_TOOLTIP + ' ' + CLASS_HIDDEN; this.sliderActionSelector = SELECTOR_TOOLTIP; } else { //clear,speech,searc...
Input(TODO resize) @param {type} $ @param {type} window @param {type} document @returns {undefined}
Input
javascript
dcloudio/mui
js/input.plugin.js
https://github.com/dcloudio/mui/blob/master/js/input.plugin.js
MIT
handle = function(event, target) { if (target.tagName === 'A' && target.hash) { var modal = document.getElementById(target.hash.replace('#', '')); if (modal && modal.classList.contains(CLASS_MODAL)) { return modal; } } return false; }
Modals @param {type} $ @param {type} window @param {type} document @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/modals.js
https://github.com/dcloudio/mui/blob/master/js/modals.js
MIT
ajaxBeforeSend = function(xhr, settings) { var context = settings.context if(settings.beforeSend.call(context, xhr, settings) === false) { return false; } }
mui ajax @param {type} $ @returns {undefined}
ajaxBeforeSend
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
ajaxSuccess = function(data, xhr, settings) { settings.success.call(settings.context, data, 'success', xhr); ajaxComplete('success', xhr, settings); }
mui ajax @param {type} $ @returns {undefined}
ajaxSuccess
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
ajaxError = function(error, type, xhr, settings) { settings.error.call(settings.context, xhr, type, error); ajaxComplete(type, xhr, settings); }
mui ajax @param {type} $ @returns {undefined}
ajaxError
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
ajaxComplete = function(status, xhr, settings) { settings.complete.call(settings.context, xhr, status); }
mui ajax @param {type} $ @returns {undefined}
ajaxComplete
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
serialize = function(params, obj, traditional, scope) { var type, array = $.isArray(obj), hash = $.isPlainObject(obj); $.each(obj, function(key, value) { type = $.type(value); if(scope) { key = traditional ? scope : scope + '[' + (hash || type === 'object' || type === 'array' ? key : '') + ']'; ...
mui ajax @param {type} $ @returns {undefined}
serialize
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
serializeData = function(options) { if(options.processData && options.data && typeof options.data !== "string") { var contentType = options.contentType; if(!contentType && options.headers) { contentType = options.headers['Content-Type']; } if(contentType && ~contentType.indexOf(jsonType)) { //applicat...
mui ajax @param {type} $ @returns {undefined}
serializeData
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
appendQuery = function(url, query) { if(query === '') { return url; } return(url + '&' + query).replace(/[&?]{1,2}/, '?'); }
mui ajax @param {type} $ @returns {undefined}
appendQuery
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
mimeToDataType = function(mime) { if(mime) { mime = mime.split(';', 2)[0]; } return mime && (mime === htmlType ? 'html' : mime === jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text'; }
mui ajax @param {type} $ @returns {undefined}
mimeToDataType
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
parseArguments = function(url, data, success, dataType) { if($.isFunction(data)) { dataType = success, success = data, data = undefined; } if(!$.isFunction(success)) { dataType = success, success = undefined; } return { url: url, data: data, success: success, dataType: dataType }; }
mui ajax @param {type} $ @returns {undefined}
parseArguments
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value]; }
mui ajax @param {type} $ @returns {undefined}
setHeader
javascript
dcloudio/mui
js/mui.ajax.js
https://github.com/dcloudio/mui/blob/master/js/mui.ajax.js
MIT
Button = function(element, options) { this.element = element; this.options = $.extend({}, defaultOptions, options); if (!this.options.loadingText) { this.options.loadingText = defaultOptions.loadingText; } if (this.options.loadingIcon === null) { this.opti...
Button @param {type} $ @param {type} window @param {type} document @returns {undefined}
Button
javascript
dcloudio/mui
js/mui.button.js
https://github.com/dcloudio/mui/blob/master/js/mui.button.js
MIT
function update(fn) { return function(value) { var classes = self.className.split(/\s+/), index = classes.indexOf(value); fn(classes, index, value); self.className = classes.join(" "); ...
mui fixed classList @param {type} document @returns {undefined}
update
javascript
dcloudio/mui
js/mui.fixed.classlist.js
https://github.com/dcloudio/mui/blob/master/js/mui.fixed.classlist.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; var now = $.now(); switch (event.type) { case $.EVENT_MOVE: if (now - flickStartTime > 300) { flickStartTime = now; session.flickStart = touch.center; } break; case $.EVENT_END: case $....
mui gesture flick[left|right|up|down] @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/mui.gestures.flick.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.flick.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_START: if ($.options.gestureConfig.hold) { timer && clearTimeout(timer); timer = setTimeout(function() { touch.hold = true; $.trigger(session.target, name...
mui gesture hold @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/mui.gestures.hold.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.hold.js
MIT
getDistance = function(p1, p2, props) { if(!props) { props = ['x', 'y']; } var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return sqrt((x * x) + (y * y)); }
distance @param {type} p1 @param {type} p2 @returns {Number}
getDistance
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
getScale = function(starts, moves) { if(starts.length >= 2 && moves.length >= 2) { var props = ['pageX', 'pageY']; return getDistance(moves[1], moves[0], props) / getDistance(starts[1], starts[0], props); } return 1; }
scale @param {Object} starts @param {Object} moves
getScale
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
getAngle = function(p1, p2, props) { if(!props) { props = ['x', 'y']; } var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return atan2(y, x) * 180 / Math.PI; }
angle @param {type} p1 @param {type} p2 @returns {Number}
getAngle
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
getRotation = function(start, end) { var props = ['pageX', 'pageY']; return getAngle(end[1], end[0], props) - getAngle(start[1], start[0], props); }
rotation @param {Object} start @param {Object} end
getRotation
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
getVelocity = function(deltaTime, x, y) { return { x: x / deltaTime || 0, y: y / deltaTime || 0 }; }
px per ms @param {Object} deltaTime @param {Object} x @param {Object} y
getVelocity
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
detect = function(event, touch) { if($.gestures.stoped) { return; } $.doAction('gestures', function(index, gesture) { if(!$.gestures.stoped) { if($.options.gestureConfig[gesture.name] !== false) { gesture.handle(event, touch); } } }); }
detect gestures @param {type} event @param {type} touch @returns {undefined}
detect
javascript
dcloudio/mui
js/mui.gestures.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_START: clearTimeout(timer); timer = setTimeout(function() { $.trigger(session.target, name, touch); }, options.holdTimeout); break; case $.EVENT_MOVE: i...
mui gesture longtap @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/mui.gestures.longtap.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.longtap.js
MIT
handle = function(event, touch) { var session = $.gestures.session; var options = this.options; switch (event.type) { case $.EVENT_END: if (!touch.isFinal) { return; } var target = session.target; if (!target || (target.disabled || (target.classList && target.classList.contains($.className...
mui gesture tap and doubleTap @param {type} $ @param {type} name @returns {undefined}
handle
javascript
dcloudio/mui
js/mui.gestures.tap.js
https://github.com/dcloudio/mui/blob/master/js/mui.gestures.tap.js
MIT
createCallbackName = function() { return 'mui_jsonp_callback_' + (callbackIndex++); }
MUI JSONP varstion 1.0.0 by Houfeng Houfeng@DCloud.io
createCallbackName
javascript
dcloudio/mui
js/mui.jsonp.js
https://github.com/dcloudio/mui/blob/master/js/mui.jsonp.js
MIT
importScript = function(url) { var element = doc.createElement('script'); element.src = url; element.async = true; element.defer = true; container.appendChild(element); return element; }
MUI JSONP varstion 1.0.0 by Houfeng Houfeng@DCloud.io
importScript
javascript
dcloudio/mui
js/mui.jsonp.js
https://github.com/dcloudio/mui/blob/master/js/mui.jsonp.js
MIT
convertUrl = function(url, data, jsonpParam, callbacnName) { if (jsonpParam) { url = url.replace(jsonpParam + '=?', jsonpParam + '=' + callbacnName); } else { data['callback'] = callbacnName; } var buffer = []; for (var key in data) { buffer.push(key + '=' + encodeURIComponent(data[key])); } retu...
MUI JSONP varstion 1.0.0 by Houfeng Houfeng@DCloud.io
convertUrl
javascript
dcloudio/mui
js/mui.jsonp.js
https://github.com/dcloudio/mui/blob/master/js/mui.jsonp.js
MIT
getQueryString = function(url) { url = url || location.search; var splitIndex = url.indexOf('?'); var queryString = url.substr(splitIndex + 1); var paramArray = queryString.split('&'); var result = {}; for (var i in paramArray) { var params = paramArray[i].split('='); result[params[0]] = params[1]; ...
MUI JSONP varstion 1.0.0 by Houfeng Houfeng@DCloud.io
getQueryString
javascript
dcloudio/mui
js/mui.jsonp.js
https://github.com/dcloudio/mui/blob/master/js/mui.jsonp.js
MIT
getJSONPParam = function(url) { var query = getQueryString(url); for (var name in query) { if (query[name] === '?') { return name; } } return null; }
MUI JSONP varstion 1.0.0 by Houfeng Houfeng@DCloud.io
getJSONPParam
javascript
dcloudio/mui
js/mui.jsonp.js
https://github.com/dcloudio/mui/blob/master/js/mui.jsonp.js
MIT
findOffCanvasContainer = function(target) { parentNode = target.parentNode; if (parentNode) { if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) { return parentNode; } else { parentNode = parentNode.parentNode; if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) { return parentNo...
off-canvas @param {type} $ @param {type} window @param {type} document @param {type} action @returns {undefined}
findOffCanvasContainer
javascript
dcloudio/mui
js/mui.offcanvas.js
https://github.com/dcloudio/mui/blob/master/js/mui.offcanvas.js
MIT
handle = function(event, target) { if (target.tagName === 'A' && target.hash) { var offcanvas = document.getElementById(target.hash.replace('#', '')); if (offcanvas) { var container = findOffCanvasContainer(offcanvas); if (container) { $.targets._container = container; return offcanvas; } ...
off-canvas @param {type} $ @param {type} window @param {type} document @param {type} action @returns {undefined}
handle
javascript
dcloudio/mui
js/mui.offcanvas.js
https://github.com/dcloudio/mui/blob/master/js/mui.offcanvas.js
MIT