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 extractFiles(items, fileList, allowDir, multiple) { var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles'); if (maxFiles == null) { maxFiles = Number.MAX_VALUE; } var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize'); if (maxTotalSize == null) { maxTotalSize = Number.MAX_VALUE; } var includeDir = attrGetter('ngfIncludeDir', scope); var files = [], totalSize = 0; function traverseFileTree(entry, path) { var defer = $q.defer(); if (entry != null) { if (entry.isDirectory) { var promises = [upload.emptyPromise()]; if (includeDir) { var file = {type: 'directory'}; file.name = file.path = (path || '') + entry.name; files.push(file); } var dirReader = entry.createReader(); var entries = []; var readEntries = function () { dirReader.readEntries(function (results) { try { if (!results.length) { angular.forEach(entries.slice(0), function (e) { if (files.length <= maxFiles && totalSize <= maxTotalSize) { promises.push(traverseFileTree(e, (path ? path : '') + entry.name + '/')); } }); $q.all(promises).then(function () { defer.resolve(); }, function (e) { defer.reject(e); }); } else { entries = entries.concat(Array.prototype.slice.call(results || [], 0)); readEntries(); } } catch (e) { defer.reject(e); } }, function (e) { defer.reject(e); }); }; readEntries(); } else { entry.file(function (file) { try { file.path = (path ? path : '') + file.name; if (includeDir) { file = upload.rename(file, file.path); } files.push(file); totalSize += file.size; defer.resolve(); } catch (e) { defer.reject(e); } }, function (e) { defer.reject(e); }); } } return defer.promise; } var promises = [upload.emptyPromise()]; if (items && items.length > 0 && $window.location.protocol !== 'file:') { for (var i = 0; i < items.length; i++) { if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) { var entry = items[i].webkitGetAsEntry(); if (entry.isDirectory && !allowDir) { continue; } if (entry != null) { promises.push(traverseFileTree(entry)); } } else { var f = items[i].getAsFile(); if (f != null) { files.push(f); totalSize += f.size; } } if (files.length > maxFiles || totalSize > maxTotalSize || (!multiple && files.length > 0)) break; } } else { if (fileList != null) { for (var j = 0; j < fileList.length; j++) { var file = fileList.item(j); if (file.type || file.size > 0) { files.push(file); totalSize += file.size; } if (files.length > maxFiles || totalSize > maxTotalSize || (!multiple && files.length > 0)) break; } } } var defer = $q.defer(); $q.all(promises).then(function () { if (!multiple && !includeDir && files.length) { var i = 0; while (files[i] && files[i].type === 'directory') i++; defer.resolve([files[i]]); } else { defer.resolve(files); } }, function (e) { defer.reject(e); }); return defer.promise; }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
extractFiles
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
function traverseFileTree(entry, path) { var defer = $q.defer(); if (entry != null) { if (entry.isDirectory) { var promises = [upload.emptyPromise()]; if (includeDir) { var file = {type: 'directory'}; file.name = file.path = (path || '') + entry.name; files.push(file); } var dirReader = entry.createReader(); var entries = []; var readEntries = function () { dirReader.readEntries(function (results) { try { if (!results.length) { angular.forEach(entries.slice(0), function (e) { if (files.length <= maxFiles && totalSize <= maxTotalSize) { promises.push(traverseFileTree(e, (path ? path : '') + entry.name + '/')); } }); $q.all(promises).then(function () { defer.resolve(); }, function (e) { defer.reject(e); }); } else { entries = entries.concat(Array.prototype.slice.call(results || [], 0)); readEntries(); } } catch (e) { defer.reject(e); } }, function (e) { defer.reject(e); }); }; readEntries(); } else { entry.file(function (file) { try { file.path = (path ? path : '') + file.name; if (includeDir) { file = upload.rename(file, file.path); } files.push(file); totalSize += file.size; defer.resolve(); } catch (e) { defer.reject(e); } }, function (e) { defer.reject(e); }); } } return defer.promise; }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
traverseFileTree
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
readEntries = function () { dirReader.readEntries(function (results) { try { if (!results.length) { angular.forEach(entries.slice(0), function (e) { if (files.length <= maxFiles && totalSize <= maxTotalSize) { promises.push(traverseFileTree(e, (path ? path : '') + entry.name + '/')); } }); $q.all(promises).then(function () { defer.resolve(); }, function (e) { defer.reject(e); }); } else { entries = entries.concat(Array.prototype.slice.call(results || [], 0)); readEntries(); } } catch (e) { defer.reject(e); } }, function (e) { defer.reject(e); }); }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
readEntries
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
function dropAvailable() { var div = document.createElement('div'); return ('draggable' in div) && ('ondrop' in div) && !/Edge\/12./i.test(navigator.userAgent); }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
dropAvailable
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
function applyTransform(ctx, orientation, width, height) { switch (orientation) { case 2: return ctx.transform(-1, 0, 0, 1, width, 0); case 3: return ctx.transform(-1, 0, 0, -1, width, height); case 4: return ctx.transform(1, 0, 0, -1, 0, height); case 5: return ctx.transform(0, 1, 1, 0, 0, 0); case 6: return ctx.transform(0, 1, -1, 0, height, 0); case 7: return ctx.transform(0, -1, -1, 0, height, width); case 8: return ctx.transform(0, -1, 1, 0, 0, width); } }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
applyTransform
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
function arrayBufferToBase64(buffer) { var binary = ''; var bytes = new Uint8Array(buffer); var len = bytes.byteLength; for (var i = 0; i < len; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
arrayBufferToBase64
javascript
danialfarid/ng-file-upload
dist/ng-file-upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
MIT
_extend = function (dst){ var args = arguments, i = 1, _ext = function (val, key){ dst[key] = val; }; for( ; i < args.length; i++ ){ _each(args[i], _ext); } return dst; }
Merge the contents of two or more objects together into the first object
_extend
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function Image(file){ if( file instanceof Image ){ var img = new Image(file.file); api.extend(img.matrix, file.matrix); return img; } else if( !(this instanceof Image) ){ return new Image(file); } this.file = file; this.size = file.size || 100; this.matrix = { sx: 0, sy: 0, sw: 0, sh: 0, dx: 0, dy: 0, dw: 0, dh: 0, resize: 0, // min, max OR preview deg: 0, quality: 1, // jpeg quality filter: 0 }; }
Remove drag'n'drop @param {HTMLElement} el @param {Function} onHover @param {Function} onDrop
Image
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
fn = function (){ var x = over.x|0 , y = over.y|0 , w = over.w || img.width , h = over.h || img.height , rel = over.rel ; // center | right | left x = (rel == 1 || rel == 4 || rel == 7) ? (dw - w + x)/2 : (rel == 2 || rel == 5 || rel == 8 ? dw - (w + x) : x); // center | bottom | top y = (rel == 3 || rel == 4 || rel == 5) ? (dh - h + y)/2 : (rel >= 6 ? dh - (h + y) : y); api.event.off(img, 'error load abort', fn); try { ctx.globalAlpha = over.opacity || 1; ctx.drawImage(img, x, y, w, h); } catch (er){} queue.next(); }
Remove drag'n'drop @param {HTMLElement} el @param {Function} onHover @param {Function} onDrop
fn
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function _transform(err, img){ // img -- info object var images = {} , queue = api.queue(function (err){ fn(err, images); }) ; if( !err ){ api.each(transform, function (params, name){ if( !queue.isFail() ){ var ImgTrans = new Image(img.nodeType ? img : file), isFn = typeof params == 'function'; if( isFn ){ params(img, ImgTrans); } else if( params.width ){ ImgTrans[params.preview ? 'preview' : 'resize'](params.width, params.height, params.strategy); } else { if( params.maxWidth && (img.width > params.maxWidth || img.height > params.maxHeight) ){ ImgTrans.resize(params.maxWidth, params.maxHeight, 'max'); } } if( params.crop ){ var crop = params.crop; ImgTrans.crop(crop.x|0, crop.y|0, crop.w || crop.width, crop.h || crop.height); } if( params.rotate === undef && autoOrientation ){ params.rotate = 'auto'; } ImgTrans.set({ type: ImgTrans.matrix.type || params.type || file.type || 'image/png' }); if( !isFn ){ ImgTrans.set({ deg: params.rotate , overlay: params.overlay , filter: params.filter , quality: params.quality || 1 }); } queue.inc(); ImgTrans.toData(function (err, image){ if( err ){ queue.fail(); } else { images[name] = image; queue.next(); } }); } }); } else { queue.fail(); } }
Remove drag'n'drop @param {HTMLElement} el @param {Function} onHover @param {Function} onDrop
_transform
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
_complete = function (err){ _this._active = !err; clearTimeout(_failId); clearTimeout(_successId); // api.event.off(video, 'loadedmetadata', _complete); callback && callback(err, _this); }
Start camera streaming @param {Function} callback
_complete
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
doneFn = function (err){ if( err ){ callback(err); } else { // Get camera var cam = Camera.get(el); if( options.start ){ cam.start(callback); } else { callback(null, cam); } } }
Publish camera element into container @static @param {HTMLElement} el @param {Object} options @param {Function} [callback]
doneFn
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function _px(val){ return val >= 0 ? val + 'px' : val; }
Add "px" postfix, if value is a number @private @param {*} val @return {String}
_px
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function _detectVideoSignal(video){ var canvas = document.createElement('canvas'), ctx, res = false; try { ctx = canvas.getContext('2d'); ctx.drawImage(video, 0, 0, 1, 1); res = ctx.getImageData(0, 0, 1, 1).data[4] != 255; } catch( e ){} return res; }
@private @param {HTMLVideoElement} video @return {Boolean}
_detectVideoSignal
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function _wrap(fn) { var id = fn.wid = api.uid(); api.Flash._fn[id] = fn; return 'FileAPI.Flash._fn.' + id; }
FileAPI fallback to Flash @flash-developer "Vladimir Demidov" <[email protected]>
_wrap
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
function _unwrap(fn) { try { api.Flash._fn[fn.wid] = null; delete api.Flash._fn[fn.wid]; } catch (e) { } }
FileAPI fallback to Flash @flash-developer "Vladimir Demidov" <[email protected]>
_unwrap
javascript
danialfarid/ng-file-upload
src/FileAPI.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/FileAPI.js
MIT
calculateAspectRatioFit = function (srcWidth, srcHeight, maxWidth, maxHeight, centerCrop) { var ratio = centerCrop ? Math.max(maxWidth / srcWidth, maxHeight / srcHeight) : Math.min(maxWidth / srcWidth, maxHeight / srcHeight); return { width: srcWidth * ratio, height: srcHeight * ratio, marginX: srcWidth * ratio - maxWidth, marginY: srcHeight * ratio - maxHeight }; }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
calculateAspectRatioFit
javascript
danialfarid/ng-file-upload
src/resize.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/resize.js
MIT
resize = function (imagen, width, height, quality, type, ratio, centerCrop, resizeIf) { var deferred = $q.defer(); var canvasElement = document.createElement('canvas'); var imageElement = document.createElement('img'); imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000'); document.body.appendChild(imageElement); imageElement.onload = function () { var imgWidth = imageElement.width, imgHeight = imageElement.height; imageElement.parentNode.removeChild(imageElement); if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) { deferred.reject('resizeIf'); return; } try { if (ratio) { var ratioFloat = upload.ratioToFloat(ratio); var imgRatio = imgWidth / imgHeight; if (imgRatio < ratioFloat) { width = imgWidth; height = width / ratioFloat; } else { height = imgHeight; width = height * ratioFloat; } } if (!width) { width = imgWidth; } if (!height) { height = imgHeight; } var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop); canvasElement.width = Math.min(dimensions.width, width); canvasElement.height = Math.min(dimensions.height, height); var context = canvasElement.getContext('2d'); context.drawImage(imageElement, Math.min(0, -dimensions.marginX / 2), Math.min(0, -dimensions.marginY / 2), dimensions.width, dimensions.height); deferred.resolve(canvasElement.toDataURL(type || 'image/WebP', quality || 0.934)); } catch (e) { deferred.reject(e); } }; imageElement.onerror = function () { imageElement.parentNode.removeChild(imageElement); deferred.reject(); }; imageElement.src = imagen; return deferred.promise; }
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922 @param {Number} srcWidth Source area width @param {Number} srcHeight Source area height @param {Number} maxWidth Nestable area maximum available width @param {Number} maxHeight Nestable area maximum available height @return {Object} { width, height }
resize
javascript
danialfarid/ng-file-upload
src/resize.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/resize.js
MIT
function sendHttp(config) { config.method = config.method || 'POST'; config.headers = config.headers || {}; var deferred = config._deferred = config._deferred || $q.defer(); var promise = deferred.promise; function notifyProgress(e) { if (deferred.notify) { deferred.notify(e); } if (promise.progressFunc) { $timeout(function () { promise.progressFunc(e); }); } } function getNotifyEvent(n) { if (config._start != null && resumeSupported) { return { loaded: n.loaded + config._start, total: (config._file && config._file.size) || n.total, type: n.type, config: config, lengthComputable: true, target: n.target }; } else { return n; } } if (!config.disableProgress) { config.headers.__setXHR_ = function () { return function (xhr) { if (!xhr || !xhr.upload || !xhr.upload.addEventListener) return; config.__XHR = xhr; if (config.xhrFn) config.xhrFn(xhr); xhr.upload.addEventListener('progress', function (e) { e.config = config; notifyProgress(getNotifyEvent(e)); }, false); //fix for firefox not firing upload progress end, also IE8-9 xhr.upload.addEventListener('load', function (e) { if (e.lengthComputable) { e.config = config; notifyProgress(getNotifyEvent(e)); } }, false); }; }; } function uploadWithAngular() { $http(config).then(function (r) { if (resumeSupported && config._chunkSize && !config._finished && config._file) { var fileSize = config._file && config._file.size || 0; notifyProgress({ loaded: Math.min(config._end, fileSize), total: fileSize, config: config, type: 'progress' } ); upload.upload(config, true); } else { if (config._finished) delete config._finished; deferred.resolve(r); } }, function (e) { deferred.reject(e); }, function (n) { deferred.notify(n); } ); } if (!resumeSupported) { uploadWithAngular(); } else if (config._chunkSize && config._end && !config._finished) { config._start = config._end; config._end += config._chunkSize; uploadWithAngular(); } else if (config.resumeSizeUrl) { $http.get(config.resumeSizeUrl).then(function (resp) { if (config.resumeSizeResponseReader) { config._start = config.resumeSizeResponseReader(resp.data); } else { config._start = parseInt((resp.data.size == null ? resp.data : resp.data.size).toString()); } if (config._chunkSize) { config._end = config._start + config._chunkSize; } uploadWithAngular(); }, function (e) { throw e; }); } else if (config.resumeSize) { config.resumeSize().then(function (size) { config._start = size; if (config._chunkSize) { config._end = config._start + config._chunkSize; } uploadWithAngular(); }, function (e) { throw e; }); } else { if (config._chunkSize) { config._start = 0; config._end = config._start + config._chunkSize; } uploadWithAngular(); } promise.success = function (fn) { promise.then(function (response) { fn(response.data, response.status, response.headers, config); }); return promise; }; promise.error = function (fn) { promise.then(null, function (response) { fn(response.data, response.status, response.headers, config); }); return promise; }; promise.progress = function (fn) { promise.progressFunc = fn; promise.then(null, null, function (n) { fn(n); }); return promise; }; promise.abort = promise.pause = function () { if (config.__XHR) { $timeout(function () { config.__XHR.abort(); }); } return promise; }; promise.xhr = function (fn) { config.xhrFn = (function (origXhrFn) { return function () { if (origXhrFn) origXhrFn.apply(promise, arguments); fn.apply(promise, arguments); }; })(config.xhrFn); return promise; }; upload.promisesCount++; if (promise['finally'] && promise['finally'] instanceof Function) { promise['finally'](function () { upload.promisesCount--; }); } return promise; }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
sendHttp
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function notifyProgress(e) { if (deferred.notify) { deferred.notify(e); } if (promise.progressFunc) { $timeout(function () { promise.progressFunc(e); }); } }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
notifyProgress
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function getNotifyEvent(n) { if (config._start != null && resumeSupported) { return { loaded: n.loaded + config._start, total: (config._file && config._file.size) || n.total, type: n.type, config: config, lengthComputable: true, target: n.target }; } else { return n; } }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
getNotifyEvent
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function uploadWithAngular() { $http(config).then(function (r) { if (resumeSupported && config._chunkSize && !config._finished && config._file) { var fileSize = config._file && config._file.size || 0; notifyProgress({ loaded: Math.min(config._end, fileSize), total: fileSize, config: config, type: 'progress' } ); upload.upload(config, true); } else { if (config._finished) delete config._finished; deferred.resolve(r); } }, function (e) { deferred.reject(e); }, function (n) { deferred.notify(n); } ); }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
uploadWithAngular
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function copy(obj) { var clone = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { clone[key] = obj[key]; } } return clone; }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
copy
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function toResumeFile(file, formData) { if (file._ngfBlob) return file; config._file = config._file || file; if (config._start != null && resumeSupported) { if (config._end && config._end >= file.size) { config._finished = true; config._end = file.size; } var slice = file.slice(config._start, config._end || file.size); slice.name = file.name; slice.ngfName = file.ngfName; if (config._chunkSize) { formData.append('_chunkSize', config._chunkSize); formData.append('_currentChunkSize', config._end - config._start); formData.append('_chunkNumber', Math.floor(config._start / config._chunkSize)); formData.append('_totalSize', config._file.size); } return slice; } return file; }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
toResumeFile
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function addFieldToFormData(formData, val, key) { if (val !== undefined) { if (angular.isDate(val)) { val = val.toISOString(); } if (angular.isString(val)) { formData.append(key, val); } else if (upload.isFile(val)) { var file = toResumeFile(val, formData); var split = key.split(','); if (split[1]) { file.ngfName = split[1].replace(/^\s+|\s+$/g, ''); key = split[0]; } config._fileKey = config._fileKey || key; formData.append(key, file, file.ngfName || file.name); } else { if (angular.isObject(val)) { if (val.$$ngfCircularDetection) throw 'ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: ' + key; val.$$ngfCircularDetection = true; try { for (var k in val) { if (val.hasOwnProperty(k) && k !== '$$ngfCircularDetection') { var objectKey = config.objectKey == null ? '[i]' : config.objectKey; if (val.length && parseInt(k) > -1) { objectKey = config.arrayKey == null ? objectKey : config.arrayKey; } addFieldToFormData(formData, val[k], key + objectKey.replace(/[ik]/g, k)); } } } finally { delete val.$$ngfCircularDetection; } } else { formData.append(key, val); } } } }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
addFieldToFormData
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
function digestConfig() { config._chunkSize = upload.translateScalars(config.resumeChunkSize); config._chunkSize = config._chunkSize ? parseInt(config._chunkSize.toString()) : null; config.headers = config.headers || {}; config.headers['Content-Type'] = undefined; config.transformRequest = config.transformRequest ? (angular.isArray(config.transformRequest) ? config.transformRequest : [config.transformRequest]) : []; config.transformRequest.push(function (data) { var formData = new window.FormData(), key; data = data || config.fields || {}; if (config.file) { data.file = config.file; } for (key in data) { if (data.hasOwnProperty(key)) { var val = data[key]; if (config.formDataAppender) { config.formDataAppender(formData, key, val); } else { addFieldToFormData(formData, val, key); } } } return formData; }); }
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS @author Danial <[email protected]> @version <%= pkg.version %>
digestConfig
javascript
danialfarid/ng-file-upload
src/upload.js
https://github.com/danialfarid/ng-file-upload/blob/master/src/upload.js
MIT
work = function() { setTimeout(function() { if (!NProgress.status) return; NProgress.trickle(); work(); }, Settings.trickleSpeed); }
Shows the progress bar. This is the same as setting the status to 0%, except that it doesn't go backwards. NProgress.start();
work
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function toBarPerc(n) { return (-1 + n) * 100; }
(Internal) converts a percentage (`0..1`) to a bar translateX percentage (`-100%..0%`).
toBarPerc
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function barPositionCSS(n, speed, ease) { var barCSS; if (Settings.positionUsing === 'translate3d') { barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' }; } else if (Settings.positionUsing === 'translate') { barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' }; } else { barCSS = { 'margin-left': toBarPerc(n)+'%' }; } barCSS.transition = 'all '+speed+'ms '+ease; return barCSS; }
(Internal) returns the correct CSS for changing the bar's position given an n percentage, and speed and ease from Settings
barPositionCSS
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function next() { var fn = pending.shift(); if (fn) { fn(next); } }
(Internal) Queues a function to be executed.
next
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function camelCase(string) { return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) { return letter.toUpperCase(); }); }
(Internal) Applies css properties to an element, similar to the jQuery css method. While this helper does assist with vendor prefixed property names, it does not perform any manipulation of values prior to setting styles.
camelCase
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function getVendorProp(name) { var style = document.body.style; if (name in style) return name; var i = cssPrefixes.length, capName = name.charAt(0).toUpperCase() + name.slice(1), vendorName; while (i--) { vendorName = cssPrefixes[i] + capName; if (vendorName in style) return vendorName; } return name; }
(Internal) Applies css properties to an element, similar to the jQuery css method. While this helper does assist with vendor prefixed property names, it does not perform any manipulation of values prior to setting styles.
getVendorProp
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function getStyleProp(name) { name = camelCase(name); return cssProps[name] || (cssProps[name] = getVendorProp(name)); }
(Internal) Applies css properties to an element, similar to the jQuery css method. While this helper does assist with vendor prefixed property names, it does not perform any manipulation of values prior to setting styles.
getStyleProp
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function applyCss(element, prop, value) { prop = getStyleProp(prop); element.style[prop] = value; }
(Internal) Applies css properties to an element, similar to the jQuery css method. While this helper does assist with vendor prefixed property names, it does not perform any manipulation of values prior to setting styles.
applyCss
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function hasClass(element, name) { var list = typeof element == 'string' ? element : classList(element); return list.indexOf(' ' + name + ' ') >= 0; }
(Internal) Determines if an element or space separated list of class names contains a class name.
hasClass
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function addClass(element, name) { var oldList = classList(element), newList = oldList + name; if (hasClass(oldList, name)) return; // Trim the opening space. element.className = newList.substring(1); }
(Internal) Adds a class to an element.
addClass
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function removeClass(element, name) { var oldList = classList(element), newList; if (!hasClass(element, name)) return; // Replace the class name. newList = oldList.replace(' ' + name + ' ', ' '); // Trim the opening and closing spaces. element.className = newList.substring(1, newList.length - 1); }
(Internal) Removes a class from an element.
removeClass
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function classList(element) { return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' '); }
(Internal) Gets a space separated list of the class names on the element. The list is wrapped with a single space on each end to facilitate finding matches within the list.
classList
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
function removeElement(element) { element && element.parentNode && element.parentNode.removeChild(element); }
(Internal) Removes an element from the DOM.
removeElement
javascript
rstacruz/nprogress
nprogress.js
https://github.com/rstacruz/nprogress/blob/master/nprogress.js
MIT
static k_combinations(set, k) { var i, j, combs, head, tailcombs; if (k > set.length || k <= 0) { return []; } if (k === set.length) { return [set]; } if (k === 1) { combs = []; for (i = 0; i < set.length; i++) { combs.push([set[i]]); } return combs; } // Assert {1 < k < set.length} combs = []; for (i = 0; i < set.length - k + 1; i++) { head = set.slice(i, i+1); tailcombs = Combinations.k_combinations(set.slice(i + 1), k - 1); for (j = 0; j < tailcombs.length; j++) { combs.push(head.concat(tailcombs[j])); } } return combs; }
K-combinations Get k-sized combinations of elements in a set. Usage: k_combinations(set, k) Parameters: set: Array of objects of any type. They are treated as unique. k: size of combinations to search for. Return: Array of found combinations, size of a combination is k. Examples: k_combinations([1, 2, 3], 1) -> [[1], [2], [3]] k_combinations([1, 2, 3], 2) -> [[1,2], [1,3], [2, 3] k_combinations([1, 2, 3], 3) -> [[1, 2, 3]] k_combinations([1, 2, 3], 4) -> [] k_combinations([1, 2, 3], 0) -> [] k_combinations([1, 2, 3], -1) -> [] k_combinations([], 0) -> []
k_combinations
javascript
CharlieHess/slack-poker-bot
util/combinations.js
https://github.com/CharlieHess/slack-poker-bot/blob/master/util/combinations.js
MIT
static combinations(set) { var k, i, combs, k_combs; combs = []; // Calculate all non-empty k-combinations for (k = 1; k <= set.length; k++) { k_combs = Combinations.k_combinations(set, k); for (i = 0; i < k_combs.length; i++) { combs.push(k_combs[i]); } } return combs; }
Combinations Get all possible combinations of elements in a set. Usage: combinations(set) Examples: combinations([1, 2, 3]) -> [[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]] combinations([1]) -> [[1]]
combinations
javascript
CharlieHess/slack-poker-bot
util/combinations.js
https://github.com/CharlieHess/slack-poker-bot/blob/master/util/combinations.js
MIT
U = function (a, b) { if (!a) { return ''; } b = b || 'x'; var c = ''; var d = 0; var e; for (d; d < a.length; d += 1) a.charCodeAt(d) >= 55296 && a.charCodeAt(d) <= 56319 ? (e = (65536 + 1024 * (Number(a.charCodeAt(d)) - 55296) + Number(a.charCodeAt(d + 1)) - 56320).toString(16), d += 1) : e = a.charCodeAt(d).toString(16), c += b + e; return c.substr(b.length); }
@Keyboard.js @author zhangxinxu @version Created: 17-06-13
U
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
static get observedAttributes () { return ['open']; }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
observedAttributes
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
static get defaults () { return { eventType: 'click', history: false, autoplay: 3000 }; }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
defaults
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get eventType () { let strEventType = this.getAttribute('eventtype') || Tab.defaults.eventType; if (strEventType == 'hover') { strEventType = 'mouseenter'; } return strEventType; }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
eventType
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set eventType (value) { this.setAttribute('eventtype', value); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
eventType
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get history () { return this.hasAttribute('history') || Tab.defaults.history; }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
history
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set history (value) { this.toggleAttribute('history', value); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
history
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get autoplay () { let strAttrAutoplay = this.getAttribute('autoplay'); if (typeof strAttrAutoplay !== 'string') { return false; } if (/^\d+$/.test(strAttrAutoplay)) { return strAttrAutoplay * 1; } return Tab.defaults.autoplay; }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
autoplay
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set autoplay (value) { if (!value && value !== '') { this.removeAttribute('autoplay'); } else { this.setAttribute('autoplay', value); } }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
autoplay
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get name () { return this.getAttribute('name'); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
name
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set name (value) { this.setAttribute('name', value); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
name
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get htmlFor () { return this.getAttribute('for'); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
htmlFor
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get target () { return this.getAttribute('target'); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
target
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set target (value) { this.setAttribute('target', value); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
target
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get open () { return this.hasAttribute('open'); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
open
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set open (value) { this.toggleAttribute('open', value); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
open
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
setParams (options) { this.params = this.params || {}; options = options || {}; Object.assign(this.params, options); }
@Pagination.js @author sunmeiye @version @Created: 20-06-07 @edit: 20-06-07
setParams
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get reverse () { return this.getAttribute('reverse') !== null || this.classList.contains('reverse'); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
reverse
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set reverse (value) { if (value) { this.setAttribute('reverse', ''); } else { this.removeAttribute('reverse'); } }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
reverse
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get htmlFor () { return this.getAttribute('for'); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
htmlFor
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set htmlFor (v) { this.setAttribute('for', v); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
htmlFor
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get align () { return this.getAttribute('align') || 'auto'; }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
align
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set align (v) { this.setAttribute('align', v); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
align
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get eventType () { return this.getAttribute('eventtype') || 'hover'; }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
eventType
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set eventType (v) { this.setAttribute('eventtype', v); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
eventType
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get trigger () { const htmlFor = this.htmlFor; let eleTrigger; if (htmlFor) { eleTrigger = document.getElementById(htmlFor); } return eleTrigger || this; }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
trigger
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
hide () { if (!this.target) { return; } this.target.style.display = 'none'; this.trigger.dispatchEvent(new CustomEvent('hide', { detail: { type: 'ui-tips' } })); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
hide
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
remove () { if (this.parentElement) { this.parentElement.removeChild(this); } this.open = false; }
@Range.js @author xboxyan @version @created: 20-04-30
remove
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
show () { if (this.time > 0) { this.open = true; } }
@Range.js @author xboxyan @version @created: 20-04-30
show
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
hide () { this.open = false; }
@Range.js @author xboxyan @version @created: 20-04-30
hide
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
static allHide (exclude) { ErrorTip.collectionErrorTip.forEach(obj => { if (exclude != obj) { obj.hide(); } }); }
@Range.js @author xboxyan @version @created: 20-04-30
allHide
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get () { return !!(this.classList.contains(CL) || this.matches(CL)); }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
get
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
set (flag) { let action = 'remove'; if (flag) { action = 'add'; if (this.loading) { return flag; } } let strClassButton = CL.replace(LOADING, 'button'); if (this.classList.contains(strClassButton) || this.getAttribute('is') == strClassButton) { this.classList[action](LOADING); } else { this.classList[action](CL); } }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
set
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get () { return document.validate.getValidity(this); }
@Pagination.js @author XboxYan(yanwenbin) @version @Created: 20-04-22 @edit: 20-04-22
get
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
get () { return document.validate.getReportText(this); }
@Pagination.js @author XboxYan(yanwenbin) @version @Created: 20-04-22 @edit: 20-04-22
get
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
value () { return this.validity.valid; }
@Pagination.js @author XboxYan(yanwenbin) @version @Created: 20-04-22 @edit: 20-04-22
value
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
value (content) { return document.validate.reportValidity(this, content); }
@Pagination.js @author XboxYan(yanwenbin) @version @Created: 20-04-22 @edit: 20-04-22
value
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
value () { return document.validate.checkValidity(this); }
@Pagination.js @author XboxYan(yanwenbin) @version @Created: 20-04-22 @edit: 20-04-22
value
javascript
yued-fe/lulu
theme/edge/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/all.js
MIT
static get observedAttributes () { return ['disabled']; }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
observedAttributes
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
constructor () { super(); this.setProperty(); }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
constructor
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
static addClass (...arg) { return ['ui', 'color', ...arg].join('-'); }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
addClass
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
hue2rgb = function (p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
hue2rgb
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
hue2rgb = function (p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
hue2rgb
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
get type () { return this.getAttribute('type') || 'color'; }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
type
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
set type (v) { return this.setAttribute('type', v || 'color'); }
@Color.js @author zhangxinxu @version @created 16-06-03 @edited 20-07-16 @Gwokhov
type
javascript
yued-fe/lulu
theme/edge/js/common/ui/Color.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Color.js
MIT
static get observedAttributes () { return ['open', 'target']; }
@Drop.js @author zhangxinxu @version @created 15-06-30 @edited 20-07-08 edit by wanglei
observedAttributes
javascript
yued-fe/lulu
theme/edge/js/common/ui/Drop.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Drop.js
MIT
static get defaults () { return { eventtype: 'click', position: '7-5' }; }
@Drop.js @author zhangxinxu @version @created 15-06-30 @edited 20-07-08 edit by wanglei
defaults
javascript
yued-fe/lulu
theme/edge/js/common/ui/Drop.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Drop.js
MIT
static allHide (exclude) { ErrorTip.collectionErrorTip.forEach(obj => { if (exclude != obj) { obj.hide(); } }); }
@ErrorTip.js @author zhangxinxu @version @created: 15-07-01 @edited: 20-07-07 edit by peter.qiyuanhao
allHide
javascript
yued-fe/lulu
theme/edge/js/common/ui/ErrorTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/ErrorTip.js
MIT
U = function (a, b) { if (!a) { return ''; } b = b || 'x'; var c = ''; var d = 0; var e; for (d; d < a.length; d += 1) a.charCodeAt(d) >= 55296 && a.charCodeAt(d) <= 56319 ? (e = (65536 + 1024 * (Number(a.charCodeAt(d)) - 55296) + Number(a.charCodeAt(d + 1)) - 56320).toString(16), d += 1) : e = a.charCodeAt(d).toString(16), c += b + e; return c.substr(b.length); }
@Keyboard.js @author zhangxinxu @version Created: 17-06-13
U
javascript
yued-fe/lulu
theme/edge/js/common/ui/Keyboard.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/Keyboard.js
MIT
static get observedAttributes () { return ['open']; }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
observedAttributes
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
constructor () { super(); if (arguments.length) { LightTip.custom.apply(this, arguments); } }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
constructor
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
get type () { return this.getAttribute('type'); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
type
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
get time () { let strTime = this.getAttribute('time'); if (!isNaN(strTime) && !isNaN(parseFloat(strTime))) { return Number(strTime); } return 3000; }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
time
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
set type (value) { this.setAttribute('type', value); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
type
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
set time (value) { this.setAttribute('time', value); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
time
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
get open () { return this.hasAttribute('open'); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
open
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
set open (value) { this.toggleAttribute('open', value); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
open
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
static success (text, time = 3000) { return this.custom(text, 'success', time); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
success
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT
static error (text, time = 3000) { return this.custom(text, 'error', time); }
@LightTip.js @author popeyesailorman(yangfan) @version @Created: 20-05-15 @edit: 20-05-15
error
javascript
yued-fe/lulu
theme/edge/js/common/ui/LightTip.js
https://github.com/yued-fe/lulu/blob/master/theme/edge/js/common/ui/LightTip.js
MIT