hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8d18b74033bab139b1741fb5963a8d6e256f5941 | 12,990 | js | JavaScript | alyBlog/static/node_modules/@baiducloud/sdk/src/http_client.js | Hx-someone/aly-blog | e0205777d2ff1642fde5741a5b5c1b06ad675001 | [
"WTFPL"
] | 1 | 2020-04-17T02:15:45.000Z | 2020-04-17T02:15:45.000Z | alyBlog/static/node_modules/@baiducloud/sdk/src/http_client.js | Hx-someone/aly-blog | e0205777d2ff1642fde5741a5b5c1b06ad675001 | [
"WTFPL"
] | null | null | null | alyBlog/static/node_modules/@baiducloud/sdk/src/http_client.js | Hx-someone/aly-blog | e0205777d2ff1642fde5741a5b5c1b06ad675001 | [
"WTFPL"
] | null | null | null | /**
* Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* @file src/http_client.js
* @author leeight
*/
/* eslint-env node */
/* eslint max-params:[0,10] */
/* globals ArrayBuffer */
var http = require('http');
var https = require('https');
var util = require('util');
var stream = require('stream');
var EventEmitter = require('events').EventEmitter;
var u = require('underscore');
var Q = require('q');
var debug = require('debug')('bce-sdk:HttpClient');
var H = require('./headers');
var Auth = require('./auth');
/**
* The HttpClient
*
* @constructor
* @param {Object} config The http client configuration.
*/
function HttpClient(config) {
EventEmitter.call(this);
this.config = config;
/**
* http(s) request object
* @type {Object}
*/
this._req = null;
}
util.inherits(HttpClient, EventEmitter);
/**
* Send Http Request
*
* @param {string} httpMethod GET,POST,PUT,DELETE,HEAD
* @param {string} path The http request path.
* @param {(string|Buffer|stream.Readable)=} body The request body. If `body` is a
* stream, `Content-Length` must be set explicitly.
* @param {Object=} headers The http request headers.
* @param {Object=} params The querystrings in url.
* @param {function():string=} signFunction The `Authorization` signature function
* @param {stream.Writable=} outputStream The http response body.
* @param {number=} retry The maximum number of network connection attempts.
*
* @resolve {{http_headers:Object,body:Object}}
* @reject {Object}
*
* @return {Q.defer}
*/
HttpClient.prototype.sendRequest = function (httpMethod, path, body, headers, params,
signFunction, outputStream) {
httpMethod = httpMethod.toUpperCase();
var requestUrl = this._getRequestUrl(path, params);
var options = require('url').parse(requestUrl);
debug('httpMethod = %s, requestUrl = %s, options = %j',
httpMethod, requestUrl, options);
// Prepare the request headers.
var defaultHeaders = {};
if (typeof navigator === 'object') {
defaultHeaders[H.USER_AGENT] = navigator.userAgent;
}
else {
defaultHeaders[H.USER_AGENT] = util.format('bce-sdk-nodejs/%s/%s/%s', require('../package.json').version,
process.platform, process.version);
}
defaultHeaders[H.X_BCE_DATE] = new Date().toISOString().replace(/\.\d+Z$/, 'Z');
defaultHeaders[H.CONNECTION] = 'close';
defaultHeaders[H.CONTENT_TYPE] = 'application/json; charset=UTF-8';
defaultHeaders[H.HOST] = options.host;
headers = u.extend({}, defaultHeaders, headers);
// if (!headers.hasOwnProperty(H.X_BCE_REQUEST_ID)) {
// headers[H.X_BCE_REQUEST_ID] = this._generateRequestId();
// }
// Check the content-length
if (!headers.hasOwnProperty(H.CONTENT_LENGTH)) {
var contentLength = this._guessContentLength(body);
if (!(contentLength === 0 && /GET|HEAD/i.test(httpMethod))) {
// 如果是 GET 或 HEAD 请求,并且 Content-Length 是 0,那么 Request Header 里面就不要出现 Content-Length
// 否则本地计算签名的时候会计算进去,但是浏览器发请求的时候不一定会有,此时导致 Signature Mismatch 的情况
headers[H.CONTENT_LENGTH] = contentLength;
}
}
var client = this;
options.method = httpMethod;
options.headers = headers;
// 通过browserify打包后,在Safari下并不能有效处理server的content-type
// 参考ISSUE:https://github.com/jhiesey/stream-http/issues/8
options.mode = 'prefer-fast';
// rejectUnauthorized: If true, the server certificate is verified against the list of supplied CAs.
// An 'error' event is emitted if verification fails.
// Verification happens at the connection level, before the HTTP request is sent.
options.rejectUnauthorized = false;
if (typeof signFunction === 'function') {
var promise = signFunction(this.config.credentials, httpMethod, path, params, headers);
if (isPromise(promise)) {
return promise.then(function (authorization, xbceDate) {
headers[H.AUTHORIZATION] = authorization;
if (xbceDate) {
headers[H.X_BCE_DATE] = xbceDate;
}
debug('options = %j', options);
return client._doRequest(options, body, outputStream);
});
}
else if (typeof promise === 'string') {
headers[H.AUTHORIZATION] = promise;
}
else {
throw new Error('Invalid signature = (' + promise + ')');
}
}
else {
headers[H.AUTHORIZATION] = createSignature(this.config.credentials, httpMethod, path, params, headers);
}
debug('options = %j', options);
return client._doRequest(options, body, outputStream);
};
function createSignature(credentials, httpMethod, path, params, headers) {
var auth = new Auth(credentials.ak, credentials.sk);
return auth.generateAuthorization(httpMethod, path, params, headers);
}
function isPromise(obj) {
return obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
HttpClient.prototype._isValidStatus = function (statusCode) {
return statusCode >= 200 && statusCode < 300;
};
HttpClient.prototype._doRequest = function (options, body, outputStream) {
var deferred = Q.defer();
var api = options.protocol === 'https:' ? https : http;
var client = this;
var req = client._req = api.request(options, function (res) {
if (client._isValidStatus(res.statusCode) && outputStream
&& outputStream instanceof stream.Writable) {
res.pipe(outputStream);
outputStream.on('finish', function () {
deferred.resolve(success(client._fixHeaders(res.headers), {}));
});
outputStream.on('error', function (error) {
deferred.reject(error);
});
return;
}
deferred.resolve(client._recvResponse(res));
});
if (req.xhr && typeof req.xhr.upload === 'object') {
u.each(['progress', 'error', 'abort'], function (eventName) {
req.xhr.upload.addEventListener(eventName, function (evt) {
client.emit(eventName, evt);
}, false);
});
}
req.on('error', function (error) {
deferred.reject(error);
});
try {
client._sendRequest(req, body);
}
catch (ex) {
deferred.reject(ex);
}
return deferred.promise;
};
HttpClient.prototype._generateRequestId = function () {
function chunk() {
var v = (~~(Math.random() * 0xffff)).toString(16);
if (v.length < 4) {
v += new Array(4 - v.length + 1).join('0');
}
return v;
}
return util.format('%s%s-%s-%s-%s-%s%s%s',
chunk(), chunk(), chunk(), chunk(),
chunk(), chunk(), chunk(), chunk());
};
HttpClient.prototype._guessContentLength = function (data) {
if (data == null) {
return 0;
}
else if (typeof data === 'string') {
return Buffer.byteLength(data);
}
else if (typeof data === 'object') {
if (typeof Blob !== 'undefined' && data instanceof Blob) {
return data.size;
}
if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
return data.byteLength;
}
if (Buffer.isBuffer(data)) {
return data.length;
}
/**
if (typeof FormData !== 'undefined' && data instanceof FormData) {
}
*/
}
else if (Buffer.isBuffer(data)) {
return data.length;
}
throw new Error('No Content-Length is specified.');
};
HttpClient.prototype._fixHeaders = function (headers) {
var fixedHeaders = {};
if (headers) {
Object.keys(headers).forEach(function (key) {
var value = headers[key].trim();
if (value) {
key = key.toLowerCase();
if (key === 'etag') {
value = value.replace(/"/g, '');
}
fixedHeaders[key] = value;
}
});
}
return fixedHeaders;
};
HttpClient.prototype._recvResponse = function (res) {
var responseHeaders = this._fixHeaders(res.headers);
var statusCode = res.statusCode;
function parseHttpResponseBody(raw) {
var contentType = responseHeaders['content-type'];
if (!raw.length) {
return {};
}
else if (contentType
&& /(application|text)\/json/.test(contentType)) {
return JSON.parse(raw.toString());
}
return raw;
}
var deferred = Q.defer();
var payload = [];
/* eslint-disable */
res.on('data', function (chunk) {
if (Buffer.isBuffer(chunk)) {
payload.push(chunk);
}
else {
// xhr2返回的内容是 string,不是 Buffer,导致 Buffer.concat 的时候报错了
payload.push(new Buffer(chunk));
}
});
res.on('error', function (e) {
deferred.reject(e);
});
/* eslint-enable */
res.on('end', function () {
var raw = Buffer.concat(payload);
var responseBody = null;
try {
debug('responseHeaders = %j', responseHeaders);
responseBody = parseHttpResponseBody(raw);
}
catch (e) {
debug('statusCode = %s, Parse response body error = %s', statusCode, e.message);
deferred.reject(failure(statusCode, e.message));
return;
}
if (statusCode >= 100 && statusCode < 200) {
deferred.reject(failure(statusCode, 'Can not handle 1xx http status code.'));
}
else if (statusCode < 100 || statusCode >= 300) {
if (responseBody.requestId) {
deferred.reject(failure(statusCode, responseBody.message,
responseBody.code, responseBody.requestId, responseHeaders.date));
}
else {
deferred.reject(failure(statusCode, responseBody));
}
}
deferred.resolve(success(responseHeaders, responseBody));
});
return deferred.promise;
};
/* eslint-disable */
function isXHR2Compatible(obj) {
if (typeof Blob !== 'undefined' && obj instanceof Blob) {
return true;
}
if (typeof ArrayBuffer !== 'undefined' && obj instanceof ArrayBuffer) {
return true;
}
if (typeof FormData !== 'undefined' && obj instanceof FormData) {
return true;
}
}
/* eslint-enable */
HttpClient.prototype._sendRequest = function (req, data) {
/* eslint-disable */
if (!data) {
req.end();
return;
}
if (typeof data === 'string') {
data = new Buffer(data);
}
/* eslint-enable */
if (Buffer.isBuffer(data) || isXHR2Compatible(data)) {
req.write(data);
req.end();
}
else if (data instanceof stream.Readable) {
if (!data.readable) {
throw new Error('stream is not readable');
}
data.on('data', function (chunk) {
req.write(chunk);
});
data.on('end', function () {
req.end();
});
}
else {
throw new Error('Invalid body type = ' + typeof data);
}
};
HttpClient.prototype.buildQueryString = function (params) {
var urlEncodeStr = require('querystring').stringify(params);
// https://en.wikipedia.org/wiki/Percent-encoding
return urlEncodeStr.replace(/[()'!~.*\-_]/g, function (char) {
return '%' + char.charCodeAt().toString(16);
});
};
HttpClient.prototype._getRequestUrl = function (path, params) {
var uri = path;
var qs = this.buildQueryString(params);
if (qs) {
uri += '?' + qs;
}
return this.config.endpoint + uri;
};
function success(httpHeaders, body) {
var response = {};
response[H.X_HTTP_HEADERS] = httpHeaders;
response[H.X_BODY] = body;
return response;
}
function failure(statusCode, message, code, requestId, xBceDate) {
var response = {};
response[H.X_STATUS_CODE] = statusCode;
response[H.X_MESSAGE] = Buffer.isBuffer(message) ? String(message) : message;
if (code) {
response[H.X_CODE] = code;
}
if (requestId) {
response[H.X_REQUEST_ID] = requestId;
}
if (xBceDate) {
response[H.X_BCE_DATE] = xBceDate;
}
return response;
}
module.exports = HttpClient;
| 30.564706 | 118 | 0.595535 |
8d18d68463da4771a1b3b78305770816dd0695ad | 194 | js | JavaScript | index.js | domapic/domapic-base | 832600b118176ddb640b536c83c52d27cc48a7c3 | [
"MIT"
] | null | null | null | index.js | domapic/domapic-base | 832600b118176ddb640b536c83c52d27cc48a7c3 | [
"MIT"
] | 37 | 2018-06-07T16:21:47.000Z | 2019-05-26T09:10:43.000Z | index.js | domapic/domapic-base | 832600b118176ddb640b536c83c52d27cc48a7c3 | [
"MIT"
] | null | null | null | 'use strict'
const cli = require('./lib/cli')
const Service = require('./lib/Service')
const utils = require('./lib/utils')
module.exports = {
cli: cli,
Service: Service,
utils: utils
}
| 16.166667 | 40 | 0.654639 |
8d192d8e692eb75d1613d4047346f08e7bd25db7 | 121 | js | JavaScript | snippets/js/utils/range.js | c6401/snippets | f9599b8ade7c4e3a7a3d819a86bd96fad7a14c5c | [
"MIT"
] | null | null | null | snippets/js/utils/range.js | c6401/snippets | f9599b8ade7c4e3a7a3d819a86bd96fad7a14c5c | [
"MIT"
] | null | null | null | snippets/js/utils/range.js | c6401/snippets | f9599b8ade7c4e3a7a3d819a86bd96fad7a14c5c | [
"MIT"
] | null | null | null | function* range(start = 0, end = 100, step = 1) {
for (let i = start; i < end; i += step) {
yield i;
}
}
| 20.166667 | 49 | 0.471074 |
8d193823a7931a5a200e2c4764d755eeb5fccac0 | 18,796 | js | JavaScript | to-markdown.js | barissenkal/clipboard2markdown | 70b4d908c229f54138c19fec0d913fe17eba4f50 | [
"MIT"
] | null | null | null | to-markdown.js | barissenkal/clipboard2markdown | 70b4d908c229f54138c19fec0d913fe17eba4f50 | [
"MIT"
] | null | null | null | to-markdown.js | barissenkal/clipboard2markdown | 70b4d908c229f54138c19fec0d913fe17eba4f50 | [
"MIT"
] | null | null | null | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toMarkdown = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*
* to-markdown - an HTML to Markdown converter
*
* Copyright 2011+, Dom Christie
* Licenced under the MIT licence
*
*/
'use strict'
var toMarkdown
var converters
var mdConverters = require('./lib/md-converters')
var gfmConverters = require('./lib/gfm-converters')
var HtmlParser = require('./lib/html-parser')
var collapse = require('collapse-whitespace')
/*
* Utilities
*/
var blocks = ['address', 'article', 'aside', 'audio', 'blockquote', 'body',
'canvas', 'center', 'dd', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption',
'figure', 'footer', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'header', 'hgroup', 'hr', 'html', 'isindex', 'li', 'main', 'menu', 'nav',
'noframes', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table',
'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul'
]
function isBlock (node) {
return blocks.indexOf(node.nodeName.toLowerCase()) !== -1
}
var voids = [
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'
]
function isVoid (node) {
return voids.indexOf(node.nodeName.toLowerCase()) !== -1
}
function htmlToDom (string) {
var tree = new HtmlParser().parseFromString(string, 'text/html')
collapse(tree.documentElement, isBlock)
return tree
}
/*
* Flattens DOM tree into single array
*/
function bfsOrder (node) {
var inqueue = [node]
var outqueue = []
var elem
var children
var i
while (inqueue.length > 0) {
elem = inqueue.shift()
outqueue.push(elem)
children = elem.childNodes
for (i = 0; i < children.length; i++) {
if (children[i].nodeType === 1) inqueue.push(children[i])
}
}
outqueue.shift()
return outqueue
}
/*
* Contructs a Markdown string of replacement text for a given node
*/
function getContent (node) {
var text = ''
for (var i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === 1) {
text += node.childNodes[i]._replacement
} else if (node.childNodes[i].nodeType === 3) {
text += node.childNodes[i].data
} else continue
}
return text
}
/*
* Returns the HTML string of an element with its contents converted
*/
function outer (node, content) {
return node.cloneNode(false).outerHTML.replace('><', '>' + content + '<')
}
function canConvert (node, filter) {
if (typeof filter === 'string') {
return filter === node.nodeName.toLowerCase()
}
if (Array.isArray(filter)) {
return filter.indexOf(node.nodeName.toLowerCase()) !== -1
} else if (typeof filter === 'function') {
return filter.call(toMarkdown, node)
} else {
throw new TypeError('`filter` needs to be a string, array, or function')
}
}
function isFlankedByWhitespace (side, node) {
var sibling
var regExp
var isFlanked
if (side === 'left') {
sibling = node.previousSibling
regExp = / $/
} else {
sibling = node.nextSibling
regExp = /^ /
}
if (sibling) {
if (sibling.nodeType === 3) {
isFlanked = regExp.test(sibling.nodeValue)
} else if (sibling.nodeType === 1 && !isBlock(sibling)) {
isFlanked = regExp.test(sibling.textContent)
}
}
return isFlanked
}
function flankingWhitespace (node) {
var leading = ''
var trailing = ''
if (!isBlock(node)) {
var hasLeading = /^[ \r\n\t]/.test(node.innerHTML)
var hasTrailing = /[ \r\n\t]$/.test(node.innerHTML)
if (hasLeading && !isFlankedByWhitespace('left', node)) {
leading = ' '
}
if (hasTrailing && !isFlankedByWhitespace('right', node)) {
trailing = ' '
}
}
return { leading: leading, trailing: trailing }
}
/*
* Finds a Markdown converter, gets the replacement, and sets it on
* `_replacement`
*/
function process (node) {
var replacement
var content = getContent(node)
// Remove blank nodes
if (!isVoid(node) && !/A|TH|TD/.test(node.nodeName) && /^\s*$/i.test(content)) {
node._replacement = ''
return
}
for (var i = 0; i < converters.length; i++) {
var converter = converters[i]
if (canConvert(node, converter.filter)) {
if (typeof converter.replacement !== 'function') {
throw new TypeError(
'`replacement` needs to be a function that returns a string'
)
}
var whitespace = flankingWhitespace(node)
if (whitespace.leading || whitespace.trailing) {
content = content.trim()
}
replacement = whitespace.leading +
converter.replacement.call(toMarkdown, content, node) +
whitespace.trailing
break
}
}
node._replacement = replacement
}
toMarkdown = function (input, options) {
options = options || {}
if (typeof input !== 'string') {
throw new TypeError(input + ' is not a string')
}
// Escape potential ol triggers
input = input.replace(/(>[\r\n\s]*)(\d+)\.( | )/g, '$1$2\\.$3')
var clone = htmlToDom(input).body
var nodes = bfsOrder(clone)
var output
converters = mdConverters.slice(0)
if (options.gfm) {
converters = gfmConverters.concat(converters)
}
if (options.converters) {
converters = options.converters.concat(converters)
}
// Process through nodes in reverse (so deepest child elements are first).
for (var i = nodes.length - 1; i >= 0; i--) {
process(nodes[i])
}
output = getContent(clone)
return output.replace(/^[\t\r\n]+|[\t\r\n\s]+$/g, '')
.replace(/\n\s+\n/g, '\n')
.replace(/\n{2,}/g, '\n')
}
toMarkdown.isBlock = isBlock
toMarkdown.isVoid = isVoid
toMarkdown.outer = outer
module.exports = toMarkdown
},{"./lib/gfm-converters":2,"./lib/html-parser":3,"./lib/md-converters":4,"collapse-whitespace":7}],2:[function(require,module,exports){
'use strict'
function cell (content, node) {
var index = Array.prototype.indexOf.call(node.parentNode.childNodes, node)
var prefix = ' '
if (index === 0) prefix = '| '
return prefix + content + ' |'
}
var highlightRegEx = /highlight highlight-(\S+)/
module.exports = [
{
filter: 'br',
replacement: function () {
return '\n'
}
},
{
filter: ['del', 's', 'strike'],
replacement: function (content) {
return '~~' + content + '~~'
}
},
{
filter: function (node) {
return node.type === 'checkbox' && node.parentNode.nodeName === 'LI'
},
replacement: function (content, node) {
return (node.checked ? '[x]' : '[ ]') + ' '
}
},
{
filter: ['th', 'td'],
replacement: function (content, node) {
return cell(content, node)
}
},
{
filter: 'tr',
replacement: function (content, node) {
var borderCells = ''
var alignMap = { left: ':--', right: '--:', center: ':-:' }
if (node.parentNode.nodeName === 'THEAD') {
for (var i = 0; i < node.childNodes.length; i++) {
var align = node.childNodes[i].attributes.align
var border = '---'
if (align) border = alignMap[align.value] || border
borderCells += cell(border, node.childNodes[i])
}
}
return '\n' + content + (borderCells ? '\n' + borderCells : '')
}
},
{
filter: 'table',
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
},
{
filter: ['thead', 'tbody', 'tfoot'],
replacement: function (content) {
return content
}
},
// Fenced code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' &&
node.firstChild &&
node.firstChild.nodeName === 'CODE'
},
replacement: function (content, node) {
return '\n\n```\n' + node.firstChild.textContent + '\n```\n\n'
}
},
// Syntax-highlighted code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' &&
node.parentNode.nodeName === 'DIV' &&
highlightRegEx.test(node.parentNode.className)
},
replacement: function (content, node) {
var language = node.parentNode.className.match(highlightRegEx)[1]
return '\n\n```' + language + '\n' + node.textContent + '\n```\n\n'
}
},
{
filter: function (node) {
return node.nodeName === 'DIV' &&
highlightRegEx.test(node.className)
},
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
}
]
},{}],3:[function(require,module,exports){
/*
* Set up window for Node.js
*/
var _window = (typeof window !== 'undefined' ? window : this)
/*
* Parsing HTML strings
*/
function canParseHtmlNatively () {
var Parser = _window.DOMParser
var canParse = false
// Adapted from https://gist.github.com/1129031
// Firefox/Opera/IE throw errors on unsupported types
try {
// WebKit returns null on unsupported types
if (new Parser().parseFromString('', 'text/html')) {
canParse = true
}
} catch (e) {}
return canParse
}
function createHtmlParser () {
var Parser = function () {}
// For Node.js environments
if (typeof document === 'undefined') {
var jsdom = require('jsdom')
Parser.prototype.parseFromString = function (string) {
return jsdom.jsdom(string, {
features: {
FetchExternalResources: [],
ProcessExternalResources: false
}
})
}
} else {
if (!shouldUseActiveX()) {
Parser.prototype.parseFromString = function (string) {
var doc = document.implementation.createHTMLDocument('')
doc.open()
doc.write(string)
doc.close()
return doc
}
} else {
Parser.prototype.parseFromString = function (string) {
var doc = new window.ActiveXObject('htmlfile')
doc.designMode = 'on' // disable on-page scripts
doc.open()
doc.write(string)
doc.close()
return doc
}
}
}
return Parser
}
function shouldUseActiveX () {
var useActiveX = false
try {
document.implementation.createHTMLDocument('').open()
} catch (e) {
if (window.ActiveXObject) useActiveX = true
}
return useActiveX
}
module.exports = canParseHtmlNatively() ? _window.DOMParser : createHtmlParser()
},{"jsdom":6}],4:[function(require,module,exports){
'use strict'
module.exports = [
{
filter: 'p',
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
},
{
filter: 'br',
replacement: function () {
return ' \n'
}
},
{
filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
replacement: function (content, node) {
var hLevel = node.nodeName.charAt(1)
var hPrefix = ''
for (var i = 0; i < hLevel; i++) {
hPrefix += '#'
}
return '\n\n' + hPrefix + ' ' + content + '\n\n'
}
},
{
filter: 'hr',
replacement: function () {
return '\n\n* * *\n\n'
}
},
{
filter: ['em', 'i'],
replacement: function (content) {
return '_' + content + '_'
}
},
{
filter: ['strong', 'b'],
replacement: function (content) {
return '**' + content + '**'
}
},
// Inline code
{
filter: function (node) {
var hasSiblings = node.previousSibling || node.nextSibling
var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings
return node.nodeName === 'CODE' && !isCodeBlock
},
replacement: function (content) {
return '`' + content + '`'
}
},
{
filter: function (node) {
return node.nodeName === 'A' && node.getAttribute('href')
},
replacement: function (content, node) {
var titlePart = node.title ? ' "' + node.title + '"' : ''
return '[' + content + '](' + node.getAttribute('href') + titlePart + ')'
}
},
{
filter: 'img',
replacement: function (content, node) {
var alt = node.alt || ''
var src = node.getAttribute('src') || ''
var title = node.title || ''
var titlePart = title ? ' "' + title + '"' : ''
return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
}
},
// Code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' && node.firstChild.nodeName === 'CODE'
},
replacement: function (content, node) {
return '\n\n ' + node.firstChild.textContent.replace(/\n/g, '\n ') + '\n\n'
}
},
{
filter: 'blockquote',
replacement: function (content) {
content = content.trim()
content = content.replace(/\n{3,}/g, '\n\n')
content = content.replace(/^/gm, '> ')
return '\n\n' + content + '\n\n'
}
},
{
filter: 'li',
replacement: function (content, node) {
content = content.replace(/^\s+/, '').replace(/\n/gm, '\n ')
var prefix = '* '
var parent = node.parentNode
var index = Array.prototype.indexOf.call(parent.children, node) + 1
prefix = /ol/i.test(parent.nodeName) ? index + '. ' : '* '
return prefix + content
}
},
{
filter: ['ul', 'ol'],
replacement: function (content, node) {
var strings = []
for (var i = 0; i < node.childNodes.length; i++) {
strings.push(node.childNodes[i]._replacement)
}
if (/li/i.test(node.parentNode.nodeName)) {
return '\n' + strings.join('\n')
}
return '\n\n' + strings.join('\n') + '\n\n'
}
},
{
filter: function (node) {
return this.isBlock(node)
},
replacement: function (content, node) {
// return '\n\n' + this.outer(node, content) + '\n\n'
return '\n\n' + content + '\n\n'
}
},
// Anything else!
{
filter: function () {
return true
},
replacement: function (content, node) {
// return this.outer(node, content)
return content
}
}
]
},{}],5:[function(require,module,exports){
/**
* This file automatically generated from `build.js`.
* Do not manually edit.
*/
module.exports = [
"address",
"article",
"aside",
"audio",
"blockquote",
"canvas",
"dd",
"div",
"dl",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"main",
"nav",
"noscript",
"ol",
"output",
"p",
"pre",
"section",
"table",
"tfoot",
"ul",
"video"
];
},{}],6:[function(require,module,exports){
},{}],7:[function(require,module,exports){
'use strict';
var voidElements = require('void-elements');
Object.keys(voidElements).forEach(function (name) {
voidElements[name.toUpperCase()] = 1;
});
var blockElements = {};
require('block-elements').forEach(function (name) {
blockElements[name.toUpperCase()] = 1;
});
/**
* isBlockElem(node) determines if the given node is a block element.
*
* @param {Node} node
* @return {Boolean}
*/
function isBlockElem(node) {
return !!(node && blockElements[node.nodeName]);
}
/**
* isVoid(node) determines if the given node is a void element.
*
* @param {Node} node
* @return {Boolean}
*/
function isVoid(node) {
return !!(node && voidElements[node.nodeName]);
}
/**
* whitespace(elem [, isBlock]) removes extraneous whitespace from an
* the given element. The function isBlock may optionally be passed in
* to determine whether or not an element is a block element; if none
* is provided, defaults to using the list of block elements provided
* by the `block-elements` module.
*
* @param {Node} elem
* @param {Function} blockTest
*/
function collapseWhitespace(elem, isBlock) {
if (!elem.firstChild || elem.nodeName === 'PRE') return;
if (typeof isBlock !== 'function') {
isBlock = isBlockElem;
}
var prevText = null;
var prevVoid = false;
var prev = null;
var node = next(prev, elem);
while (node !== elem) {
if (node.nodeType === 3) {
// Node.TEXT_NODE
var text = node.data.replace(/[ \r\n\t]+/g, ' ');
if ((!prevText || / $/.test(prevText.data)) && !prevVoid && text[0] === ' ') {
text = text.substr(1);
}
// `text` might be empty at this point.
if (!text) {
node = remove(node);
continue;
}
node.data = text;
prevText = node;
} else if (node.nodeType === 1) {
// Node.ELEMENT_NODE
if (isBlock(node) || node.nodeName === 'BR') {
if (prevText) {
prevText.data = prevText.data.replace(/ $/, '');
}
prevText = null;
prevVoid = false;
} else if (isVoid(node)) {
// Avoid trimming space around non-block, non-BR void elements.
prevText = null;
prevVoid = true;
}
} else {
node = remove(node);
continue;
}
var nextNode = next(prev, node);
prev = node;
node = nextNode;
}
if (prevText) {
prevText.data = prevText.data.replace(/ $/, '');
if (!prevText.data) {
remove(prevText);
}
}
}
/**
* remove(node) removes the given node from the DOM and returns the
* next node in the sequence.
*
* @param {Node} node
* @return {Node} node
*/
function remove(node) {
var next = node.nextSibling || node.parentNode;
node.parentNode.removeChild(node);
return next;
}
/**
* next(prev, current) returns the next node in the sequence, given the
* current and previous nodes.
*
* @param {Node} prev
* @param {Node} current
* @return {Node}
*/
function next(prev, current) {
if (prev && prev.parentNode === current || current.nodeName === 'PRE') {
return current.nextSibling || current.parentNode;
}
return current.firstChild || current.nextSibling || current.parentNode;
}
module.exports = collapseWhitespace;
},{"block-elements":5,"void-elements":8}],8:[function(require,module,exports){
/**
* This file automatically generated from `pre-publish.js`.
* Do not manually edit.
*/
module.exports = {
"area": true,
"base": true,
"br": true,
"col": true,
"embed": true,
"hr": true,
"img": true,
"input": true,
"keygen": true,
"link": true,
"menuitem": true,
"meta": true,
"param": true,
"source": true,
"track": true,
"wbr": true
};
},{}]},{},[1])(1)
});
| 23.852792 | 850 | 0.585178 |
8d1a0173cc43587bec56514d6fc107b664433470 | 297 | js | JavaScript | code/demo/waterfall/position/index.js | AidanDai/aidandai.github.io | 3e8b9e317447de3a39c7200746a89950ddc784dc | [
"MIT"
] | null | null | null | code/demo/waterfall/position/index.js | AidanDai/aidandai.github.io | 3e8b9e317447de3a39c7200746a89950ddc784dc | [
"MIT"
] | 19 | 2018-07-29T03:04:01.000Z | 2022-02-26T01:32:53.000Z | code/demo/waterfall/position/index.js | AidanDai/aidandai.github.io | 3e8b9e317447de3a39c7200746a89950ddc784dc | [
"MIT"
] | 3 | 2016-03-05T13:26:03.000Z | 2017-03-12T15:12:19.000Z | var code = $("#code-main");
var lis = $("#code-main li");
var li = 200;
var width = code.outerWidth();
var left = 0;
var top = 0;
$.each(lis, function(li){
$(li).css({"left": left + "px", "top": top + "px"});
// top += $(li).outerHeight();
});
$(window).resize(function(){});
| 18.5625 | 54 | 0.511785 |
8d1a977dd72377e3453b4c9f6f9e035c73232372 | 1,379 | js | JavaScript | src/components/Hero/index.js | silnose/c-netflix-clone | 2fa0ab26f8705d2cf6b1840df27c458b51ea77a7 | [
"MIT"
] | 1 | 2021-02-05T17:34:07.000Z | 2021-02-05T17:34:07.000Z | src/components/Hero/index.js | silnose/silnoseflix | 2fa0ab26f8705d2cf6b1840df27c458b51ea77a7 | [
"MIT"
] | null | null | null | src/components/Hero/index.js | silnose/silnoseflix | 2fa0ab26f8705d2cf6b1840df27c458b51ea77a7 | [
"MIT"
] | null | null | null | import React, { useState, useEffect } from 'react';
import {
Banner,
Title,
Synopsis,
Button,
ButtonContainer,
BannerDetailsContainer,
FadeBottom,
} from './style';
import { request } from '../../utils/request';
import { moviePostersUrl } from '../../utils/constants';
import { truncate } from '../../utils/utils';
const Hero = () => {
const [movie, setMovie] = useState([]);
useEffect(() => {
async function fetchData() {
try {
const response = await fetch(request.netflixOriginal);
const data = await response.json();
const randomMovieIndex = Math.floor(
Math.random() * data.results.length - 1
);
const randomMovie = data.results[randomMovieIndex];
console.log(randomMovie);
setMovie(randomMovie);
return response;
} catch (error) {
console.log(error);
}
}
fetchData();
}, []);
return (
<Banner poster={`${moviePostersUrl}${movie?.poster_path}`}>
<BannerDetailsContainer>
<Title>{movie?.title || movie?.name || movie?.original_name}</Title>
{/* <ButtonContainer>
<Button>Play</Button>
<Button>My List</Button>
</ButtonContainer> */}
<Synopsis>{truncate(movie?.overview)}</Synopsis>
</BannerDetailsContainer>
<FadeBottom />
</Banner>
);
};
export default Hero;
| 27.039216 | 76 | 0.596809 |
8d1ad05cf5ad7fe6f1e0ad4463e127f0cd8531a5 | 2,072 | js | JavaScript | src/javascript/binary/websocket_pages/user/account/settings/metatrader.js | negar-binary/binary-mt | 05bd439fe04a6af0b2fdabcf007bdcc47d91f042 | [
"Apache-2.0"
] | null | null | null | src/javascript/binary/websocket_pages/user/account/settings/metatrader.js | negar-binary/binary-mt | 05bd439fe04a6af0b2fdabcf007bdcc47d91f042 | [
"Apache-2.0"
] | null | null | null | src/javascript/binary/websocket_pages/user/account/settings/metatrader.js | negar-binary/binary-mt | 05bd439fe04a6af0b2fdabcf007bdcc47d91f042 | [
"Apache-2.0"
] | null | null | null | var MetaTrader = (function(){
'use strict';
var validateRequired = function(value) {
return (!/^.+$/.test(value) ? Content.errorMessage('req') : '');
};
var validatePassword = function(password) {
var errMsg = validateRequired(password);
if (!errMsg) {
if (password.length < 6 || password.length > 25) {
errMsg = Content.errorMessage('range', '6-25');
} else if (!/[0-9]+/.test(password) || !/[A-Z]+/.test(password) || !/[a-z]+/.test(password)) {
errMsg = text.localize('Password should have lower and uppercase letters with numbers.');
} else if (!/^[!-~]+$/.test(password)) {
errMsg = Content.errorMessage('valid', Content.localize().textPassword);
}
}
return errMsg;
};
var validateName = function(name) {
var errMsg = validateRequired(name);
if (!errMsg) {
if (name.length < 2 || name.length > 30) {
errMsg = Content.errorMessage('range', '2-30');
} else if (!/^[a-zA-Z\s-.']+$/.test(name)) {
var letters = Content.localize().textLetters,
space = Content.localize().textSpace,
hyphen = Content.localize().textHyphen,
period = Content.localize().textPeriod,
apost = Content.localize().textApost;
errMsg = Content.errorMessage('reg', [letters, space, hyphen, period, apost]);
}
}
return errMsg;
};
var validateAmount = function(amount) {
var errMsg = validateRequired(amount);
if (!errMsg && (!(/^\d+(\.\d+)?$/).test(amount) || !$.isNumeric(amount))) {
errMsg = Content.errorMessage('reg', [Content.localize().textNumbers]);
}
return errMsg;
};
return {
validateRequired: validateRequired,
validatePassword: validatePassword,
validateName : validateName,
validateAmount : validateAmount,
};
}());
| 34.533333 | 106 | 0.529923 |
8d1adb7cdb25d29e71aada9b01c1c9f45129d083 | 1,900 | js | JavaScript | src/SEQ.js | morris/vstools | 35ca8e4e6a56bc84a90353282fd4ca9658e4c04d | [
"MIT"
] | 70 | 2015-04-13T09:29:10.000Z | 2022-03-15T20:34:51.000Z | src/SEQ.js | scurest/vstools | 2e7fe935fad64ad83847e20328a10f37a560c4bd | [
"MIT"
] | 11 | 2017-01-15T16:15:56.000Z | 2022-01-27T16:11:48.000Z | src/SEQ.js | morris/vstools | 35ca8e4e6a56bc84a90353282fd4ca9658e4c04d | [
"MIT"
] | 10 | 2015-07-27T13:14:07.000Z | 2021-11-13T05:59:22.000Z | import { SEQAnimation } from './SEQAnimation.js';
// 00_COM.SEQ is at 0x80125ea0 in RAM
export class SEQ {
constructor(reader) {
this.reader = reader;
}
read() {
this.header();
this.data();
}
header() {
const r = this.reader;
// base ptr needed because SEQ may be embedded
this.baseOffset = r.pos;
this.numSlots = r.u16(); // 'slots' is just some random name, purpose unknown
this.numBones = r.u8();
r.padding(1);
this.size = r.u32(); // file size
this.dataOffset = r.u32() + 8; // offset to animation data
this.slotOffset = r.u32() + 8; // offset to slots
this.headerOffset = this.slotOffset + this.numSlots; // offset to rotation and keyframe data
}
data() {
const r = this.reader;
const headerOffset = this.headerOffset;
// number of animations has to be computed
// length of all headers / length of one animation header
this.numAnimations =
(headerOffset - this.numSlots - 16) / (this.numBones * 4 + 10);
// read animation headers
this.animations = [];
for (let i = 0; i < this.numAnimations; ++i) {
const animation = new SEQAnimation(this.reader, this);
animation.header(i);
this.animations.push(animation);
}
// read 'slots'
// these are animation ids, can be used as in this.animations[id].
// purpose unknown
this.slots = [];
for (let i = 0; i < this.numSlots; ++i) {
const slot = r.u8();
if (slot >= this.numAnimations && slot !== 255) {
throw new Error('?');
}
this.slots.push(slot);
}
// read animation data
for (let i = 0; i < this.numAnimations; ++i) {
this.animations[i].data();
}
}
build() {
for (let i = 0; i < this.numAnimations; ++i) {
this.animations[i].build();
}
}
ptrData(i) {
return i + this.headerOffset + this.baseOffset;
}
}
| 23.170732 | 96 | 0.591053 |
8d1b9f15ccd83c27250d1a62825cc7ed42d6dbca | 327 | js | JavaScript | docs/classes/C/CRenderGraphFactory-SummaryToolTips.js | pat-sweeney/Caustic | 0bef667dd3fb77de4b8e8b02a341760ab869d1fe | [
"MIT"
] | 1 | 2021-05-19T14:58:46.000Z | 2021-05-19T14:58:46.000Z | docs/classes/C/CRenderGraphFactory-SummaryToolTips.js | pat-sweeney/Caustic | 0bef667dd3fb77de4b8e8b02a341760ab869d1fe | [
"MIT"
] | 2 | 2019-09-28T17:29:47.000Z | 2019-09-28T17:46:37.000Z | docs/classes/C/CRenderGraphFactory-SummaryToolTips.js | pat-sweeney/Caustic | 0bef667dd3fb77de4b8e8b02a341760ab869d1fe | [
"MIT"
] | null | null | null | NDSummary.OnToolTipsLoaded("CClass:CRenderGraphFactory",{1340:"<div class=\"NDToolTip TClass LC\"><div class=\"NDClassPrototype\" id=\"NDClassPrototype1340\"><div class=\"CPEntry TClass Current\"><div class=\"CPName\">CRenderGraphFactory</div></div></div><div class=\"TTSummary\">Implements IRenderGraphFactory</div></div>"}); | 327 | 327 | 0.755352 |
8d1c0e6b9f096f59dba09aa191bffb177edad69d | 1,684 | js | JavaScript | components/DeckHome.js | GoDamage/UdaciCards | 5f062c2adf96b0a2b8ba88418df307ec235a220e | [
"MIT"
] | null | null | null | components/DeckHome.js | GoDamage/UdaciCards | 5f062c2adf96b0a2b8ba88418df307ec235a220e | [
"MIT"
] | null | null | null | components/DeckHome.js | GoDamage/UdaciCards | 5f062c2adf96b0a2b8ba88418df307ec235a220e | [
"MIT"
] | null | null | null | import React, { Component } from "react";
import { connect } from "react-redux";
import { View, Text } from "react-native";
import PropTypes from "prop-types";
import styled from "styled-components";
import UCButton from "./form/UCButton";
import { startQuiz } from "../actions/quizActions";
import { lightBlue } from "../utils/colors";
const StyledView = styled.View`
flex: 1;
background-color: ${lightBlue};
padding: 30px;
align-items: center;
justify-content: center;
`;
const StyledTitle = styled.Text`
margin-bottom: 10px;
font-size: 30px;
font-weight: bold;
`;
const StyledSubText = styled.Text`
margin-bottom: 40px;
font-size: 18px;
`;
class DeckHome extends Component {
render() {
const { title, questions, navigation, startQuiz } = this.props;
handleQuizStart = () => {
startQuiz({ name: title, questions: questions });
navigation.navigate("Quiz");
};
return (
<StyledView>
<StyledTitle>{title}</StyledTitle>
<StyledSubText>{questions.length} cards</StyledSubText>
<UCButton
text="Add Card"
buttonType="primary"
onPress={() => navigation.navigate("NewCard", { name: title })}
/>
{questions.length > 0 && (
<UCButton
text="Start Quiz"
buttonType="secondary"
onPress={() => handleQuizStart()}
/>
)}
</StyledView>
);
}
}
function mapStateToProps(state, ownProps) {
const { name } = ownProps.navigation.state.params;
const { title, questions } = state.deckList[name];
return { title, questions };
}
export default connect(mapStateToProps, { startQuiz })(DeckHome);
| 26.3125 | 73 | 0.628266 |
8d1c1ea30a641d6c4d319a004c3a73ab3eff740f | 6,808 | js | JavaScript | packages/tko.provider.component/spec/componentProviderBehaviors.js | avickers/tko | 4f302f55d075bacad8ece3b440f0803aa95e6574 | [
"MIT"
] | null | null | null | packages/tko.provider.component/spec/componentProviderBehaviors.js | avickers/tko | 4f302f55d075bacad8ece3b440f0803aa95e6574 | [
"MIT"
] | null | null | null | packages/tko.provider.component/spec/componentProviderBehaviors.js | avickers/tko | 4f302f55d075bacad8ece3b440f0803aa95e6574 | [
"MIT"
] | null | null | null |
import {
options
} from 'tko.utils'
import {
observable, isObservable
} from 'tko.observable'
import {
applyBindings
} from 'tko.bind'
import { MultiProvider } from 'tko.provider.multi'
import { DataBindProvider } from 'tko.provider.databind'
import {
bindings as coreBindings
} from 'tko.binding.core'
import {
bindings as componentBindings
} from 'tko.binding.component'
import components from 'tko.utils.component'
import { ComponentProvider } from '../src'
import 'tko.utils/helpers/jasmine-13-helper.js'
describe('Components: Provider', function () {
var bindingHandlers
describe('custom elements', function () {
// Note: knockout/spec/components
beforeEach(function () {
var provider = new MultiProvider({
providers: [new DataBindProvider(), new ComponentProvider()]
})
options.bindingProviderInstance = provider
bindingHandlers = provider.bindingHandlers
bindingHandlers.set(componentBindings)
bindingHandlers.set(coreBindings)
})
it('inserts templates into custom elements', function () {
components.register('helium', {
template: 'X<i data-bind="text: 123"></i>',
synchronous: true,
ignoreCustomElementWarning: true
})
var initialMarkup = 'He: <helium></helium>'
var root = document.createElement('div')
root.innerHTML = initialMarkup
// Since components are loaded asynchronously, it doesn't show up synchronously
applyBindings(null, root)
// expect(root.innerHTML).toEqual(initialMarkup);
expect(root.innerHTML).toEqual(
'He: <helium>X<i data-bind="text: 123">123</i></helium>'
)
})
it('interprets the params of custom elements', function () {
var called = false
components.register('argon', {
viewModel: function (/* params */) {
this.delta = 'G2k'
called = true
},
template: "<b>sXZ <u data-bind='text: delta'></u></b>",
synchronous: true,
ignoreCustomElementWarning: true
})
var ce = document.createElement('argon')
ce.setAttribute('params',
'alpha: 1, beta: [2], charlie: {x: 3}, delta: delta'
)
applyBindings({
delta: 'QxE'
}, ce)
expect(ce.innerHTML).toEqual(
'<b>sXZ <u data-bind="text: delta">G2k</u></b>')
expect(called).toEqual(true)
})
it('does not unwrap observables (#44)', function () {
// Per https://plnkr.co/edit/EzpJD3yXd01aqPbuOq1X
function AppViewModel (value) {
this.appvalue = observable(value)
}
function ParentViewModel (params) {
this.parentvalue = params.value
}
function ChildViewModel (params) {
expect(isObservable(params.value)).toEqual(true)
this.cvalue = params.value
}
var ps = document.createElement('script')
ps.setAttribute('id', 'parent-44')
ps.setAttribute('type', 'text/html')
ps.innerHTML = '<div>Parent: <span data-bind="text: parentvalue"></span></div>' +
'<child params="value: parentvalue"></child>'
document.body.appendChild(ps)
var cs = document.createElement('script')
cs.setAttribute('id', 'child-44')
cs.setAttribute('type', 'text/html')
cs.innerHTML = ''
document.body.appendChild(cs)
var div = document.createElement('div')
div.innerHTML = '<div data-bind="text: appvalue"></div>' +
'<parent params="value: appvalue"></parent>'
var viewModel = new AppViewModel('hello')
components.register('parent', {
template: {
element: 'parent-44'
},
viewModel: ParentViewModel,
synchronous: true,
ignoreCustomElementWarning: true
})
components.register('child', {
template: {
element: 'child-44'
},
viewModel: ChildViewModel,
synchronous: true,
ignoreCustomElementWarning: true
})
var options = {
attribute: 'data-bind',
globals: window,
bindings: bindingHandlers,
noVirtualElements: false
}
options.bindingProviderInstance = new DataBindProvider(options)
applyBindings(viewModel, div)
})
it('uses empty params={$raw:{}} if the params attr is whitespace', function () {
// var called = false;
components.register('lithium', {
viewModel: function (params) {
expect(params).toEqual({
$raw: {}
})
},
template: 'hello',
synchronous: true,
ignoreCustomElementWarning: true
})
var ce = document.createElement('lithium')
ce.setAttribute('params', ' ')
applyBindings({
delta: 'QxE'
}, ce)
// No error raised.
})
it('parses `text: "alpha"` on a custom element', function () {
// re brianmhunt/knockout-secure-binding#38
components.register('neon', {
viewModel: function (params) {
expect(params.text).toEqual('Knights of Ne.')
},
template: 'A noble gas and less noble car.',
synchronous: true,
ignoreCustomElementWarning: true
})
var ne = document.createElement('neon')
ne.setAttribute('params', 'text: "Knights of Ne."')
applyBindings({}, ne)
// No error raised.
})
})
/* describe("nodeParamsToObject", function() {
// var parser = null;
beforeEach(function() {
});
it("returns {$raw:{}} when there is no params attribute", function() {
var parser = new Parser(null, {});
var node = document.createElement("div");
assert.deepEqual(nodeParamsToObject(node, parser), {
$raw: {}
});
});
it("returns the params items", function() {
var parser = new Parser(null, {});
var node = document.createElement("div");
node.setAttribute('params', 'value: "42.99"');
var expect = {
value: "42.99",
$raw: {
value: "42.99"
}
};
assert.deepEqual(toJS(nodeParamsToObject(node, parser)), expect);
});
it("returns unwrapped params", function() {
var parser = new Parser(null, {
fe: observable('Iron')
});
var node = document.createElement("div");
node.setAttribute('params', 'type: fe');
var paramsObject = nodeParamsToObject(node, parser);
assert.equal(paramsObject.type(), "Iron");
assert.equal(paramsObject.$raw.type()(), "Iron");
});
}); // */
})
| 30.666667 | 91 | 0.57168 |
8d1c3a91dcd837784f1eb3867a2ded25cdd7491a | 1,088 | js | JavaScript | src/components/percussions/PercEdit.js | TheRealPhoneCall/berdperc_electron_react | a57d216db27679a3406944716f0cd47606c84e5a | [
"CC0-1.0"
] | null | null | null | src/components/percussions/PercEdit.js | TheRealPhoneCall/berdperc_electron_react | a57d216db27679a3406944716f0cd47606c84e5a | [
"CC0-1.0"
] | null | null | null | src/components/percussions/PercEdit.js | TheRealPhoneCall/berdperc_electron_react | a57d216db27679a3406944716f0cd47606c84e5a | [
"CC0-1.0"
] | null | null | null | import React from 'react';
import { Link } from 'react-router-dom';
import { PercAPI } from '../../data/api'
import PercCard from './PercCard'
import PercSounds from './PercSounds'
const path = require('path')
export default class PercEdit extends React.Component {
constructor() {
super()
}
render() {
console.log("Rendering Percussion Edit Component")
const perc = PercAPI.get(
parseInt(this.props.match.params.id, 10)
)
console.log(perc)
const img_src = path.join(__dirname, "../../images/", perc.image)
console.log(img_src)
return (
<div id="bordered" className="section scrollspy">
<div className="row">
<div id="page-title"><h2>{perc.name}</h2></div>
<div className="col s12">
<PercCard perc={perc} json_file={perc.default_map} />
<PercSounds perc={perc} />
</div>
</div>
</div>
)
}
}; | 28.631579 | 77 | 0.512868 |
8d1cb7631a165d8093889f1a68ac0bb75456af27 | 1,778 | js | JavaScript | js/api/eve/character/online.js | DanSylvest/wanderer-server | 70e0dcf63b9b791d33e4fac9dff63c67b39cab59 | [
"MIT"
] | null | null | null | js/api/eve/character/online.js | DanSylvest/wanderer-server | 70e0dcf63b9b791d33e4fac9dff63c67b39cab59 | [
"MIT"
] | 8 | 2020-08-26T05:08:55.000Z | 2021-01-09T09:40:01.000Z | js/api/eve/character/online.js | DanSylvest/wanderer-server | 70e0dcf63b9b791d33e4fac9dff63c67b39cab59 | [
"MIT"
] | 1 | 2020-10-11T08:05:40.000Z | 2020-10-11T08:05:40.000Z | /**
* Created by Aleksey Chichenkov <rolahd@yandex.ru> on 5/20/20.
*/
const helpers = require("./../../../utils/helpers.js");
const responseName = "responseEveCharacterOnline";
const subscriber = async function (_connectionId, _responseId, _event) {
// we need get token by connection
let token = core.connectionStorage.get(_connectionId);
// when token is undefined - it means what you have no rights
if(token === undefined) {
helpers.errResponse(_connectionId, _responseId, responseName, "You not authorized or token was expired", {code: 1});
return;
}
try {
let userId = await core.tokenController.checkToken(token);
let userCharacters = await core.userController.getUserCharacters(userId);
// we need check, if user has had such characterId
if (userCharacters.indexOf(_event.characterId) === -1) {
helpers.errResponse(_connectionId, _responseId, responseName, "You have not permission for this operation", {code: -1});
return;
}
let isOnline = await core.dbController.charactersDB.get(_event.characterId, "online");
core.charactersController.get(_event.characterId).get("online").subscribe(_connectionId, _responseId);
api.send(_connectionId, _responseId, {
data: isOnline,
success: true,
eventType: responseName
});
} catch (err) {
helpers.errResponse(_connectionId, _responseId, responseName, "Error in subscribe online", {code: 1, handledError: err});
}
};
subscriber.unsubscribe = function (_connectionId, _responseId, _event) {
core.charactersController.get(_event.characterId).get("online").unsubscribe(_connectionId, _responseId);
};
module.exports = subscriber; | 37.829787 | 132 | 0.681102 |
8d1cbb266790c945808e7b510c177b1bd7b83ebe | 4,785 | js | JavaScript | test/unit/tasks/configure/parse-options-spec.js | shubhsherl/Ghost-CLI | e51e1f2a3fd76c11570fc09581838e476e0ee24f | [
"MIT"
] | 415 | 2016-08-12T12:57:52.000Z | 2022-03-29T20:36:52.000Z | test/unit/tasks/configure/parse-options-spec.js | shubhsherl/Ghost-CLI | e51e1f2a3fd76c11570fc09581838e476e0ee24f | [
"MIT"
] | 1,081 | 2016-08-10T21:09:14.000Z | 2022-03-23T16:05:20.000Z | test/unit/tasks/configure/parse-options-spec.js | shubhsherl/Ghost-CLI | e51e1f2a3fd76c11570fc09581838e476e0ee24f | [
"MIT"
] | 239 | 2016-08-14T18:19:43.000Z | 2022-03-23T06:41:01.000Z | const {expect} = require('chai');
const sinon = require('sinon');
const proxyquire = require('proxyquire').noCallThru();
const Config = require('../../../../lib/utils/config');
const {ConfigError} = require('../../../../lib/errors');
function fake(options = {}) {
return proxyquire('../../../../lib/tasks/configure/parse-options', {
'./options': options
});
}
describe('Unit: Tasks: Configure > parseOptions', function () {
it('sets config url to new port if port is different then what url is set to', function () {
const parseOptions = fake();
const config = new Config('config.json');
const saveStub = sinon.stub(config, 'save');
config.set('url', 'http://localhost:2368');
config.set('server.port', 2369);
return parseOptions(config, 'development', {}).then(() => {
expect(config.get('url')).to.equal('http://localhost:2369/');
expect(config.get('server.port')).to.equal(2369);
expect(saveStub.calledOnce).to.be.true;
});
});
it('does not change port if port not defined', function () {
const parseOptions = fake();
const config = new Config('config.json');
const saveStub = sinon.stub(config, 'save');
config.set('url', 'http://localhost:2368');
return parseOptions(config, 'development', {}).then(() => {
expect(config.get('url')).to.equal('http://localhost:2368');
expect(config.get('server.port', null)).to.equal(null);
expect(saveStub.calledOnce).to.be.true;
});
});
it('handles nonexistent values correctly', function () {
const parseOptions = fake({
url: {
defaultValue: 'http://localhost:2368'
},
port: {
configPath: 'server.port'
},
log: {
configPath: 'logging.transports',
defaultValue() {
return Promise.resolve(['file', 'stdout']);
}
}
});
const config = new Config('config.json');
const saveStub = sinon.stub(config, 'save');
return parseOptions(config, 'development', {log: []}).then(() => {
expect(config.get('url')).to.equal('http://localhost:2368');
expect(config.get('server.port')).to.be.undefined;
expect(config.get('logging.transports')).to.deep.equal(['file', 'stdout']);
expect(saveStub.calledOnce).to.be.true;
});
});
it('runs the transform function if one is set', function () {
const parseOptions = fake({
url: {
transform: value => value.toLowerCase()
}
});
const config = new Config('config.json');
const saveStub = sinon.stub(config, 'save');
return parseOptions(config, 'development', {url: 'http://MyWebsite.com'}).then(() => {
expect(config.get('url')).to.equal('http://mywebsite.com');
expect(saveStub.calledOnce).to.be.true;
});
});
it('transforms domain without protocol', function () {
const parseOptions = require('../../../../lib/tasks/configure/parse-options');
const config = new Config('config.json');
const saveStub = sinon.stub(config, 'save');
return parseOptions(config, 'development', {url: 'myWebsite.com'}).then(() => {
expect(config.get('url')).to.equal('https://mywebsite.com');
expect(saveStub.calledOnce).to.be.true;
});
});
it('throws config error if validate function is defined and doesn\'t return true', function () {
const parseOptions = fake({
url: {
validate: () => 'invalid url'
}
});
const config = new Config('config.json');
return parseOptions(config, 'development', {url: 'http://localhost:2368'}).then(() => {
expect(false, 'error should have been thrown').to.be.true;
}).catch((error) => {
expect(error).to.be.an.instanceof(ConfigError);
expect(error.options.config).to.deep.equal({url: 'http://localhost:2368'});
});
});
it('handles non-string arg values correctly', function () {
const parseOptions = require('../../../../lib/tasks/configure/parse-options');
const config = new Config('config.json');
const save = sinon.stub(config, 'save');
return parseOptions(config, 'development', {url: 'http://localhost:2368/', port: 1234}).then(() => {
expect(save.calledOnce).to.be.true;
expect(config.get('url')).to.equal('http://localhost:2368/');
expect(config.get('server.port')).to.equal(1234);
});
});
});
| 38.58871 | 108 | 0.553396 |
8d1cea8f85dfe516fd71e7fae479bdf944c92f89 | 374 | js | JavaScript | 活动预告/request-axios/forEach2.js | HLGhpz/Pro-myNong | 2bac728bc489077031f7a7807394edabaa68c29c | [
"BSD-2-Clause"
] | null | null | null | 活动预告/request-axios/forEach2.js | HLGhpz/Pro-myNong | 2bac728bc489077031f7a7807394edabaa68c29c | [
"BSD-2-Clause"
] | null | null | null | 活动预告/request-axios/forEach2.js | HLGhpz/Pro-myNong | 2bac728bc489077031f7a7807394edabaa68c29c | [
"BSD-2-Clause"
] | null | null | null | const rp = require('request-promise')
const array1 = [1, 2, 3, 4, 5, 6, 7];
array1.forEach(element => {
if(element<4){
consoleElement(element)
}else{
return 0
}
});
console.log("hello world3")
async function consoleElement(element) {
console.log(element)
await rp('http://www.hzau.edu.cn/hdyg.htm')
console.log("hello world2")
return "hello world"
} | 19.684211 | 45 | 0.660428 |
8d1d733608e8749a5bbcc3cfa0d72906a850dcd4 | 4,001 | js | JavaScript | cdn/create.js | lixcode-rep/vasille-js | fcf9011649dc00d0c1441bec219309fcaaf5777c | [
"MIT"
] | null | null | null | cdn/create.js | lixcode-rep/vasille-js | fcf9011649dc00d0c1441bec219309fcaaf5777c | [
"MIT"
] | null | null | null | cdn/create.js | lixcode-rep/vasille-js | fcf9011649dc00d0c1441bec219309fcaaf5777c | [
"MIT"
] | null | null | null | const fs = require("fs");
/**
* @param dir {Dir}
*/
function search(dir) {
let dirent = dir.readSync();
while (dirent !== null) {
if (dirent.isDirectory()) {
search(fs.opendirSync(dir.path + '/' + dirent.name));
}
else if (dirent.isFile() && /\.js$/.test(dirent.name)) {
extract(dir.path + '/' + dirent.name);
}
dirent = dir.readSync();
}
}
const addedClasses = new Set;
const fileQueue = new Array;
const fileList = [];
const predefined = ['Map', 'Set', 'Object', 'Array'];
/**
* @param path {string}
*/
function extract(path) {
const content = fs.readFileSync(path);
const test = content.toString("utf-8");
const lines = test.split('\n').filter(line => !/^import\s/.test(line));
const classes = new Set;
let needRepeat = false;
lines.forEach((line, index) => {
const parentMath = line.match(/class (\w+) extends (\w+)\b/);
if (parentMath &&
!addedClasses.has(parentMath[2]) &&
!classes.has(parentMath[2]) &&
!predefined.includes(parentMath[2])) {
needRepeat = true;
}
const match = line.match(/export (class|const|function) (\w+)/);
if (match) {
classes.add(match[2]);
lines.splice(index, 1, line.replace(/export (class|const|function)/, '$1'));
}
else {
if (parentMath) {
addedClasses.add(parentMath[1]);
}
if (/^export /.test (line)) {
lines.splice (index, 1, '');
}
}
});
if (fileQueue.includes(path)) {
fileQueue.splice(fileQueue.indexOf(path), 1);
}
if (needRepeat) {
fileQueue.push(path);
}
else {
fileList.push(path);
lines.unshift('// ' + path);
classes.forEach(cl => lines.push('window.' + cl + ' = ' + cl + ';'));
fs.appendFileSync(es6, lines.join('\n') + '\n\n');
classes.forEach(cl => addedClasses.add(cl));
}
}
const dir = fs.opendirSync('./lib');
const es6 = __dirname + '/es2015.js';
if (fs.existsSync(es6)) {
fs.rmSync(es6);
}
fs.appendFileSync(es6,'(function(){\n');
search(dir);
while (fileQueue.length) {
extract(fileQueue[0]);
}
fs.appendFileSync(es6,'})();\n');
// ES6 Part
function extractES5 (path) {
const content = fs.readFileSync(path);
const test = content.toString("utf-8");
const lines = test.split('\n');
const classes = new Set;
let lastImportLine = -1;
lines.forEach((line, index) => {
if (/^import /.test(line)) {
lastImportLine = index;
}
const match = line.match(/export { (\w+) }/);
const match1 = line.match(/export (function|var) (\w+)/);
if (match1) {
classes.add(match1[2]);
lines.splice(index, 1, line.replace(/export (function|var)/, '$1'));
}
else if (match) {
classes.add(match[1]);
lines.splice(index, 1, '');
}
else {
if (/^export /.test (line)) {
lines.splice (index, 1, '');
}
else if (line.indexOf("var _this = _super.call(this) || this;") !== -1) {
lines.splice(index, 1, line.replace(
'var _this = _super.call(this) || this;',
'var _this = this; _super.call(this);'
));
}
}
});
lines.splice(0, lastImportLine + 1);
lines.unshift('// ' + path);
classes.forEach(cl => lines.push('window.' + cl + ' = ' + cl + ';'));
fs.appendFileSync(es5, lines.join('\n') + '\n\n');
}
const es5 = __dirname + '/es5.js';
if (fs.existsSync(es5)) {
fs.rmSync(es5);
}
fs.appendFileSync(es5,'(function(){\n');
fs.appendFileSync(es5, fs.readFileSync(__dirname + '/create-helper-es5.js'));
fileList.forEach(file => {
extractES5(file.replace('lib/', 'lib-es5/'));
});
fs.appendFileSync(es5,'})();\n');
| 25.484076 | 88 | 0.51912 |
8d1d82f83a90e63ba0fd7342ab77fb0b1d9fe815 | 1,093 | js | JavaScript | npm/install.js | codegold79/faas-cli | e5f498aa8f909afc55c7a7586630acc8b62fce14 | [
"MIT"
] | null | null | null | npm/install.js | codegold79/faas-cli | e5f498aa8f909afc55c7a7586630acc8b62fce14 | [
"MIT"
] | null | null | null | npm/install.js | codegold79/faas-cli | e5f498aa8f909afc55c7a7586630acc8b62fce14 | [
"MIT"
] | null | null | null | 'use strict';
const os = require('os');
const path = require('path');
const del = require('delete');
const mkdirp = require('mkdirp');
const lib = require('./lib');
module.exports.install = async () => {
const type = os.type();
const arch = os.arch();
let binaryName = lib.getBinaryName(type, arch);
let dest = path.join(__dirname, `bin/${binaryName}`);
mkdirp.sync(path.dirname(dest));
del.sync(dest, { force: true });
try {
let releaseURL = await lib.getRelease()
let downloadURL = releaseURL.replace("tag", "download") +"/"+ binaryName;
let url = downloadURL;
console.log(`Downloading package ${url} to ${dest}`);
await lib.download(url, dest);
} catch (error) {
throw new Error(`Download failed! ${error.message}`);
}
// Don't use `chmod` on Windows
if (binaryName.endsWith('.exe')) {
await lib.cmd(`chmod +x ${dest}`);
}
console.log('Download complete.');
}
module.exports.init = () => {
this.install()
.then(() => process.exit())
.catch(err => {
console.error(err.message);
process.exit(1);
});
}
| 23.255319 | 77 | 0.612992 |
8d1da7c2e21a8f1729c52ec58aa68aa37f4c3fea | 585 | js | JavaScript | scripts/contentful/config-files/contentful-template-boilerplate.js | scimusmn/tsck-flipbooks | cce75d5f37bf1559deabd3df961fd7d6523819a0 | [
"MIT"
] | 1 | 2020-07-27T15:20:03.000Z | 2020-07-27T15:20:03.000Z | scripts/contentful/config-files/contentful-template-boilerplate.js | scimusmn/tsck-flipbooks | cce75d5f37bf1559deabd3df961fd7d6523819a0 | [
"MIT"
] | 3 | 2020-12-03T19:10:19.000Z | 2022-02-07T17:47:05.000Z | scripts/contentful/config-files/contentful-template-boilerplate.js | scimusmn/app-template | ad199bfcc2c543c98c916cdb3ef3e362fa48415b | [
"MIT"
] | null | null | null | import React from 'react';
import { graphql } from 'gatsby';
import PropTypes from 'prop-types';
export const pageQuery = graphql`
query ($slug: String!) {
contentfulMyContentType(slug: { eq: $slug }) {
slug
}
}
`;
const MyContentType = ({ data }) => {
const { contentfulMyContentType } = data;
const { slug } = contentfulMyContentType;
return (
<>
<pre>MyContentType template page</pre>
<h1>{slug}</h1>
</>
);
};
MyContentType.propTypes = {
data: PropTypes.objectOf(PropTypes.object).isRequired,
};
export default MyContentType;
| 19.5 | 56 | 0.641026 |
8d1e364b8d5fbdfceb915877a31a09c915e5bec5 | 186 | js | JavaScript | client/src/ui/dropdown/index.js | xMikux/app | a4b0132fd33d8b3ba5bd9873441280ce2331eaf4 | [
"MIT"
] | 2 | 2021-12-12T19:48:25.000Z | 2021-12-25T06:51:06.000Z | client/src/ui/dropdown/index.js | xMikux/app | a4b0132fd33d8b3ba5bd9873441280ce2331eaf4 | [
"MIT"
] | 14 | 2022-01-04T08:48:29.000Z | 2022-03-12T14:32:21.000Z | client/src/ui/dropdown/index.js | xMikux/app | a4b0132fd33d8b3ba5bd9873441280ce2331eaf4 | [
"MIT"
] | 7 | 2021-10-30T18:52:04.000Z | 2022-02-04T18:23:14.000Z | export {UiDropdown} from "ui/dropdown/UiDropdown";
export {UiDropdownElement} from "ui/dropdown/UiDropdownElement";
export {UiSelectableDropdown} from "ui/dropdown/UiSelectableDropdown"; | 62 | 70 | 0.827957 |
8d1e3ff791d06694f691d423084be5da56f280f6 | 43,742 | js | JavaScript | SageFrame/Modules/Admin/Scheduler/Scripts/SchedularForm.js | AspxCommerce/AspxCommerce2.7 | a31386825eddfae439fbf8df42dacb4743900b13 | [
"MIT"
] | 22 | 2015-06-03T14:24:34.000Z | 2021-02-16T15:51:36.000Z | SageFrame/Modules/Admin/Scheduler/Scripts/SchedularForm.js | AspxCommerce/AspxCommerce2.7 | a31386825eddfae439fbf8df42dacb4743900b13 | [
"MIT"
] | 1 | 2021-03-24T13:05:21.000Z | 2021-03-24T13:05:21.000Z | SageFrame/Modules/Admin/Scheduler/Scripts/SchedularForm.js | AspxCommerce/AspxCommerce2.7 | a31386825eddfae439fbf8df42dacb4743900b13 | [
"MIT"
] | 15 | 2015-06-03T13:16:59.000Z | 2021-01-21T05:30:24.000Z | var currentElement = "";
var url = SchedularModuleFilePath + "WebServices/SchedulerWebService.asmx/";
var offset_ = 1;
var current_ = 1;
var perpage = 10;
var upload;
var form1;
var UserModuleID = SchedularModuleID;
/*document ready */
$(document).ready(function () {
$.validator.addMethod("ValidDates", function (value, element) {
if (value != "__/__/____") {
var startdate = new Date($.trim($("#txtStartDate").val()));
var enddate = new Date($.trim(value));
return this.optional(element) || enddate >= startdate;
} else {
return true;
}
});
$.validator.addMethod("ValidNameSpace", function (value, element) {
var pattern = /\w+\.\w+,\s\w+/g;
if (pattern.test(value)) {
return true;
} else {
return false;
}
});
ImageUploader();
form1 = $("#form1").validate({
rules: {
endDates: "ValidDates",
txtAssemblyName: "ValidNameSpace"
},
messages: {
endDates: "* Enter valid End Date.",
txtAssemblyName: "Please enter valid namespace"
},
submitHandler: function (form) {
upload.submit();
upload.enable();
return true;
}
});
GetSchedularListAll();
ListAllTasks();
$('#popupDatepicker').datepick({
multiSelect: 10
});
$('#txtEndDate').datepick();
$('#txtStartDate').datepick();
$("#txtStartDate").mask("99/99/9999");
$("#txtEndDate").mask("99/99/9999");
$("#running_mode").change(function () {
ResetInput();
switch ($(this).val()) {
case "":
HideAll();
break;
case "0":
//hourly
Showspan(0);
break;
case "1":
//daily
Showspan(1);
break;
case "2":
//weekly
Showspan(2);
break;
case "3":
//weeknumber
$("#s2").show();
$("#s3").show();
break;
case "5":
//once
HideAll();
break;
case "4":
//calendar
Showspan(5);
break;
}
});
for (var i = 1; i < 60; i++) {
$("#txtRepeatMins").append("<option value='" + i + "'>" + i + "</option>");
}
});
/************************************WCF call function*************************************************************************/
function ResetInput() {
$("#s2 :checked").removeAttr("checked");
$("#s3 :checked").removeAttr("checked");
$("#Weekly").val("");
$("textarea").val("");
$("#txtRepeatHrs").val("");
}
function Showspan(divNum) {
for (var i = 0; i <= 5; i++) {
i != divNum ? $("#s" + i).hide() : $("#s" + i).show();
}
}
function HideAll() {
for (var i = 0; i <= 5; i++) {
$("#s" + i).hide();
}
}
function FillWeeks() {
var weekDropDown = ["Select", "1st Week", "2nd Week", "3rd Week", "4th Week"];
$("#s3").prepend("<span style='float:left'>On Week of Month :</span>");
for (var i = 0; i < weekDropDown.length; i++) {
$("#s3>#Weekly").append("<option value=" + i + ">" + weekDropDown[i] + "</option>");
}
//$("#s3").after("<br>");
}
function FillMonthly() {
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
var col = 1;
var str = "<ul style='list-style-type: none;'><li>";
$.each(month, function (index, val) {
str += "<input type='checkbox' name='chkmonth' value='" + index + "'/><label for='" + index + "'>" + val + "</label>";
col++;
});
str += "</li></ul>";
$("#s3").append(str);
}
function AddTask() {
var _assemblyFileName = $("#uploadFileName").val();
var _scheduleName = $('#txtTaskName').val();
var _fullNameSpace = $('#txtAssemblyName').val();
var _startDate = $('#txtStartDate').val();
var _endDate = $('#txtEndDate').val();
var _startHour = $('#txtHours').val() == "" ? 0 : $('#txtHours').val();
var _startMin = $('#txtMins').val() == "" ? 0 : $('#txtMins').val();
var _repeatWeeks = $('#txtRepeatWeeks').val() == "" || $('#txtRepeatWeeks').val() == null ? 0 : $('#txtRepeatWeeks').val();
var _repeatDays = 0;
var _everyHour = 0;
var _everyMin = 0;
var _dependencies = "None";
var _retryTimeLapse = $('#txtRetryFreq').val().length > 0 ? $('#txtRetryFreq').val() : 0;
var _retryFrequencyUnit = $('#ddlRetryUnits option:selected').val();
var _attachToEvent = $('#ddlEventList option:selected').val();
var _catchUpEnabled = $("#chkIsCatchUpEnabled").is(":checked") ? true : false;
var _isEnable = true;
var _servers = "none";
var _createdByUserID = "superuser";
var _runningMode = $('#running_mode').val();
var daysArr = new Array();
var monthsArr = new Array();
var weekNumberArr = 0;
var _weekOfMonth = 0;
var _dates = "";
switch (_runningMode) {
case "0":
//hourly
_everyHour = $('#txtRepeatHrs').val() == "" || $('#txtRepeatHrs').val() == null ? 0 : $('#txtRepeatHrs').val();
_everyMin = $('#txtRepeatMins').val() == "" || $('#txtRepeatMins').val() == null ? 0 : $('#txtRepeatMins').val();
break;
case "1":
//daily
_repeatDays = $('#RepeatDays').val() == "" || $('#RepeatDays').val() == null ? 0 : $('#RepeatDays').val();
$("#s1").show();
break;
case "2":
//weekly
$(":checked[name=chkday]").each(function (index) {
daysArr.push(parseInt($(this).val()));
});
break;
case "3":
//weeknumber
$(":checked[name=chkday]").each(function (index) {
daysArr.push($(this).val());
});
$(":checked[name=chkmonth]").each(function (index) {
monthsArr.push($(this).val());
});
_weekOfMonth = $("#Weekly").val();
break;
case "4":
//calendar
_dates = $("#popupDatepicker").val();
break;
}
var param = {
ScheduleName: _scheduleName,
FullNameSpace: _fullNameSpace,
StartDate: _startDate,
EndDate: _endDate,
StartHour: parseInt(_startHour),
StartMin: parseInt(_startMin),
RepeatWeeks: parseInt(_repeatWeeks),
RepeatDays: parseInt(_repeatDays),
WeekOfMonth: parseInt(_weekOfMonth),
EveryHour: parseInt(_everyHour),
EveryMin: parseInt(_everyMin),
Dependencies: _dependencies,
RetryTimeLapse: parseInt(_retryTimeLapse),
RetryFrequencyUnit: parseInt(_retryFrequencyUnit),
AttachToEvent: parseInt(_attachToEvent),
CatchUpEnabled: _catchUpEnabled,
Servers: _servers,
IsEnable: _isEnable,
CreatedByUserID: _createdByUserID,
RunningMode: _runningMode,
WeekDays: daysArr,
Months: monthsArr,
Dates: _dates,
AssemblyFileName: _assemblyFileName,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID,
UserName: SageFrameUserName
, secureToken: SageFrameSecureToken
};
param = JSON2.stringify(param);
var startdate = new Date($.trim($("#txtStartDate").val()));
var enddate = new Date($.trim($("#txtEndDate").val()));
$.jsonRequest(url + "AddNewSchedule", param, RefreshGrid);
csscody.alert("<h1>Add Confirmation</h1><p>Your task has been added.</p>");
$('#lblFile').text("");
$("#BoxOverlay").css("z-index", "8999");
}
/*** Retrieve Task***/
function GetTask(id) {
var param = {
id: id,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID,
UserName: SageFrameUserName,
secureToken: SageFrameSecureToken
};
param = JSON2.stringify(param);
$.jsonRequest(url + "GetTask", param, DisplayRecord);
}
function DisplayRecord(data) {
ShowNewTaskPopUp(false);
BindTask(data);
}
function GetShortDate(strdate) {
if (strdate.indexOf(" ") > 5) {
var date = new Date(strdate.substring(0, strdate.indexOf(" ")));
return date.getMonth() + 1 + "/" + date.getDate() + "/" + date.getFullYear();
}
}
function BindTask(data) {
ResetInput();
$("#sid").val(data.ScheduleID);
$('#txtTaskName').val(data.ScheduleName);
$('#txtAssemblyName').val(data.FullNamespace);
$('#txtStartDate').val(GetShortDate(data.StartDate));
$('#txtEndDate').val(GetShortDate(data.EndDate));
$('#txtHours').val(data.StartHour);
$('#txtMins').val(data.StartMin);
$('#txtRepeatWeeks').val(data.RepeatWeeks);
$('#txtRetryFreq').val(data.RetryTimeLapse);
$('#ddlRetryUnits').val(data.RetryFrequencyUnit);
$('#ddlEventList').val(data.AttachToEvent);
$('#running_mode').val(data.RunningMode);
if (data.IsEnable) {
console.log(1);
$("#chkIsEnabled").prop("checked", true);
}
else {
console.log(2);
$("#chkIsEnabled").prop("checked", false);
}
if (data.CatchUpEnabled) {
$("#chkIsCatchUpEnabled").attr("checked", "checked");
}
var daysArr = new Array();
var monthsArr = new Array();
var weekNumberArr = 0;
var _weekOfMonth = 0;
var _dates = "";
switch (data.RunningMode) {
case 0:
//hourly
$('#txtRepeatHrs').val(data.EveryHours);
$('#txtRepeatMins').val(data.EveryMin);
HideAll();
Showspan(0);
break;
case 1:
//daily
$('#RepeatDays').val(data.RepeatDays);
HideAll();
Showspan(1);
break;
case 2:
//weekly
var p = JSON2.stringify({
ScheduleID: data.ScheduleID,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName
});
$.jsonRequest(url + "GetScheduleWeeks", p, function (d) {
if (d != undefined && d.length > 0) {
$.each(d, function (i) {
$(":checkbox[name=chkday]").each(function (index) {
var element = parseInt($(this).val());
if (element == parseInt(d[i].WeekDayID)) $(this).attr("checked", "checked");
});
});
}
});
HideAll();
Showspan(2);
break;
case 3:
//weeknumber
var p = JSON2.stringify({
ScheduleID: data.ScheduleID,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName
});
$.jsonRequest(url + "GetScheduleWeeks", p, function (d) {
if (d != undefined && d.length > 0) {
$.each(d, function (i) {
$(":checkbox[name=chkday]").each(function (index) {
var element = parseInt($(this).val());
if (element == parseInt(d[i].WeekDayID)) $(this).attr("checked", "checked");
});
});
}
});
$.jsonRequest(url + "GetScheduleMonths", p, function (d) {
if (d != undefined) {
$.each(d, function (i) {
$(":checkbox[name=chkmonth]").each(function (index) {
var element = parseInt($(this).val());
console.log(element + " == " + parseInt(d[i].MonthID));
if (element == parseInt(d[i].MonthID)) $(this).attr("checked", "checked");
});
});
}
});
HideAll();
$("#Weekly").val(data.WeekOfMonth);
$("#s2").show();
$("#s3").show();
break;
case 4:
//calendar
var p = JSON2.stringify({
ScheduleID: data.ScheduleID,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName
});
$.jsonRequest(url + "GetScheduleDates", p, function (d) {
var specificDate = "";
$.each(d, function (i) {
var strdate = d[i].Schedule_Date;
var test = 'new ' + strdate.replace(/[/]/gi, '');
date = eval(test);
lastStartTime = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
specificDate += lastStartTime + ",";
});
specificDate = specificDate.substring(0, specificDate.lastIndexOf(","));
$("#popupDatepicker").val(specificDate);
});
HideAll();
Showspan(5);
break;
case 5:
HideAll();
break;
}
}
function UpdateSchedule() {
var _scheduleID = $('#sid').val();
var _scheduleName = $('#txtTaskName').val();
var _fullNameSpace = $('#txtAssemblyName').val();
var _startDate = $('#txtStartDate').val();
var _endDate = $('#txtEndDate').val();
var _startHour = $('#txtHours').val() == "" ? 0 : $('#txtHours').val();
var _startMin = $('#txtMins').val() == "" ? 0 : $('#txtMins').val();
var _repeatWeeks = $('#txtRepeatWeeks').val() == "" || $('#txtRepeatWeeks').val() == null ? 0 : $('#txtRepeatWeeks').val();
var _repeatDays = 0;
var _everyHour = 0;
var _everyMin = 0;
var _dependencies = "None";
var _retryTimeLapse = $('#txtRetryFreq').val() == "" ? 0 : $('#txtRetryFreq').val();
var _retryFrequencyUnit = $('#ddlRetryUnits option:selected').val();
var _attachToEvent = $('#ddlEventList option:selected').val();
var _catchUpEnabled = $("#chkIsCatchUpEnabled").is(":checked") ? true : false;
var _isEnable = $("#chkIsEnabled").is(":checked") ? true : false;
var _servers = "none";
var _createdByUserID = "superuser";
var _runningMode = $('#running_mode').val();
var daysArr = new Array();
var monthsArr = new Array();
var weekNumberArr = 0;
var _weekOfMonth = 0;
var _dates = "";
switch (_runningMode) {
case "0":
//hourly
_everyHour = $('#txtRepeatHrs').val() == "" || $('#txtRepeatHrs').val() == null ? 0 : $('#txtRepeatHrs').val();
_everyMin = $('#txtRepeatMins').val() == "" || $('#txtRepeatMins').val() == null ? 0 : $('#txtRepeatMins').val();
break;
case "1":
//daily
_repeatDays = $('#RepeatDays').val() == "" || $('#RepeatDays').val() == null ? 0 : $('#RepeatDays').val();
$("#s1").show();
break;
case "2":
//weekly
$(":checked[name=chkday]").each(function (index) {
daysArr.push(parseInt($(this).val()));
});
break;
case "3":
//weeknumber
$(":checked[name=chkday]").each(function (index) {
daysArr.push($(this).val());
});
$(":checked[name=chkmonth]").each(function (index) {
monthsArr.push($(this).val());
});
_weekOfMonth = $("#Weekly").val();
break;
case "4":
//calendar
_dates = $("#popupDatepicker").val();
break;
}
var param = {
ScheduleID: _scheduleID,
ScheduleName: _scheduleName,
FullNameSpace: _fullNameSpace,
StartDate: _startDate,
EndDate: _endDate,
StartHour: parseInt(_startHour),
StartMin: parseInt(_startMin),
RepeatWeeks: parseInt(_repeatWeeks),
RepeatDays: parseInt(_repeatDays),
WeekOfMonth: parseInt(_weekOfMonth),
EveryHour: parseInt(_everyHour),
EveryMin: parseInt(_everyMin),
Dependencies: _dependencies,
RetryTimeLapse: parseInt(_retryTimeLapse),
RetryFrequencyUnit: parseInt(_retryFrequencyUnit),
AttachToEvent: parseInt(_attachToEvent),
CatchUpEnabled: _catchUpEnabled,
Servers: _servers,
IsEnable: _isEnable,
CreatedByUserID: _createdByUserID,
RunningMode: _runningMode,
WeekDays: daysArr,
Months: monthsArr,
Dates: _dates,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID,
UserName: SageFrameUserName,
secureToken: SageFrameSecureToken
};
param = JSON2.stringify(param);
$.jsonRequest(url + "UpdateSchedule", param, RefreshGrid);
$('#newScheduleDiv').hide();
$('#fade1').remove();
csscody.alert("<h1>Update Confirmation</h1><p>Your task has been updated.</p>");
$("#BoxOverlay").css("z-index", "8999");
}
function RunScheduleNow(id, args) {
var param = {
id: id,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID,
UserName: SageFrameUserName,
secureToken: SageFrameSecureToken
};
param = JSON2.stringify(param);
$.jsonRequest(url + "RunScheduleNow", param, function (data) {
$.facebox.close();
jQuery(document).trigger('loading.facebox');
viewrecord(args);
RefreshGrid();
});
}
function UpdateMsgDiv(data) {
}
/*End of wcf functions*/
function RefreshGrid() {
GetSchedularListAll();
}
function InitalizeContextMenu() {
}
function ShowNewTaskPopUp(isNewSchedule) {
$("#chkIsEnabled").prop("checked", true);
GetCurrentDate();
FillWeeks();
FillMonthly();
AddAllDayTask();
BindEvents();
$('#txtSpecificDate').datepicker();
$("span.fileUploadMsg").html("");
FillHourMin();
$("label[class=error]").remove();
$("span.error").hide();
$("input.error").removeClass("error");
$("#lblFile").text("");
if (isNewSchedule) {
HideAll();
ResetInput();
$("#uploadFileName").attr("class", "required");
$("span.headerSpan").html("Add New Task");
$(".btnupdateTaskspan").hide();
$(".btnAddTaskspan").show();
$("#trDllUpload").show();
$("#fileupload").removeAttr("disabled");
$("#fileupload").click(function () {
$("span.fileUploadMsg").html("");
$("#uploadFileName").val("");
});
$('#newScheduleDiv input[type="text"]').val("");
$('#newScheduleDiv select').val("");
var currentDate = new Date();
$('#txtHours').val(currentDate.getHours());
$('#txtMins').val(currentDate.getMinutes());
$('#txtStartDate').val(currentDate.getMonth() + 1 + "/" + currentDate.getDate() + "/" + currentDate.getFullYear());
$("#txtAssemblyName").removeAttr("disabled");
$("#btnAddTask").click(function () {
var upfile = $("#uploadFileName").val();
if (upfile.length < 1 || (upfile.length > 1 && $("#lblFile").text() == '')) {
$("span.error").show();
$("span.fileUploadMsg").attr("class", "error").html("Please select the dll file").show();
}
});
$('#ddlEventList').val(1);
$('#ddlRetryUnits').val(1);
} else {
$("#uploadFileName").removeAttr("class");
$("span.headerSpan").html("Edit Task");
$(".btnAddTaskspan").hide();
$(".btnupdateTaskspan").unbind().bind("click", function () {
if (form1.form()) {
UpdateSchedule();
}
}).show();
$("#trDllUpload").hide();
$("#txtAssemblyName").attr("disabled", "true");
}
$('#txtHours').removeAttr("style");
$('#txtMins').removeAttr("style");
$('#running_mode').removeAttr("style");
$('#ddlRetryUnits').removeAttr("style");
$('#ddlEventList').removeAttr("style");
$('#txtRepeatHrs').removeAttr("style");
$('#txtRepeatMins').removeAttr("style");
$('#newScheduleDiv').removeClass('invisibleDiv').addClass('loading-visible').fadeIn("slow");
$('body').append("<div id='fade1' style='display:block'></div>");
return false;
}
function ShowAllDayNewTaskPopUp() {
$('#allDayNewSchedule').removeClass('invisibleDiv').addClass('loading-visible').fadeIn("slow");
}
function ListAllTasks() {
BindEvents();
}
function BindAllTasks(data) {
$('#scheduleListAll table tr>td').parent().remove();
for (var i in data) {
var task = data[i].ScheduleName;
var id = data[i].ScheduleID;
var nextStart = new Date(data[i].NextStart);
var IsEnable = data[i].IsEnable;
var lastStart = data[i].HistoryStartDate;
var lastEndDate = data[i].HistoryEndDate;
var taskDiv = $('#scheduleListAll table');
var row = $("<tr/>");
row.append("<td>" + task + "</td>");
row.append("<td>retry </td>");
row.append("<td>N:" + nextStart.getFullYear() + '/' + nextStart.getMonth() + '/' + nextStart.getDate() + ' ' + nextStart.getHours() + ':' + nextStart.getMinutes() + ':' + nextStart.getSeconds() + "</td>");
var lastStartTime = "Not started";
if (lastStart != null) {
var test = 'new ' + lastStart.replace(/[/]/gi, '');
date = eval(test);
lastStartTime = 'S: ' + date.getFullYear() + '/' + date.getMonth() + '/' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + ' ';
}
row.append("<td>" + lastStartTime + "</td>");
var lastEnd = "NA";
if (lastEndDate != null) {
console.log(lastEndDate);
var endDate = 'new ' + lastEndDate.replace(/[/]/gi, '');
endDate = eval(endDate);
lastEnd = ' E:' + endDate.getFullYear() + '/' + endDate.getMonth() + '/' + endDate.getDate() + ' ' + endDate.getHours() + ':' + endDate.getMinutes() + ':' + endDate.getSeconds() + ' ';
}
row.append("<td>" + lastEnd + "</td>");
row.append('<td><span class="detail"><img src="images/history.png" /></span></td>');
var isChecked = IsEnable == true ? "checked" : "";
row.append('<td><span class="isEnable "></span><input class="detail" type="checkbox" value="" id="a"' + isChecked + ' /></td>').change(function () {
var flag = false;
if ($(this).find(":checked").length > 0) {
flag = true;
}
var param = {
scheduleId: parseInt($(this).attr("id")),
isEnable: Boolean(flag),
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName
}
param = JSON2.stringify(param);
$.jsonRequest(url + "UpdateScheduleEnableStatus", param, successFunction);
});
row.append('<td><span class="delete"><img src="images/delete.png"/></span></td>');
taskDiv.append(row);
}
$('div.cssAllSchedule table span.delete').bind("click", function () {
var id = $(this).closest("div").prop("id");
});
}
function successFunction(data) {
$('#trDllUpload').slideDown("slow");
}
function AddAllDayTask() {
$('#btnAddAllDayTask').click(function () {
var task = $('#txtAllDayTaskName').val();
task = '<div class="allDayScheduleItem">' + task + ' <span class="delete"><img src="images/delete.png" /></span></div>';
$(currentElement).append(task);
CloseTaskPopUp();
BindEvents();
});
}
function BindEvents() {
$('.cssClassScheduleItem span.delete').bind("click", function () {
$(this).closest("div").remove();
});
$('.allDayScheduleItem span.delete').bind("click", function () {
$(this).closest("div").remove();
});
$('#bottomControlDiv span.task').bind("click", function () {
ShowNewTaskPopUp(true);
});
$('.cssClassScheduleItem').bind("click", function () {
$('#popDiv').removeClass('invisibleDiv').addClass('loading-visible');
});
$('a.close').bind("click", function () {
$('#popDiv').addClass('invisibleDiv').removeClass('loading-visible');
});
$('#schedulerHeader span.all').bind("click", function () {
$('#scheduleListAll').fadeIn("slow");
$('#scheduler,#scheduleListWeekly,#taskHistoryDiv,#activeTasksDiv,#scheduleListMonthly').hide();
});
$('#schedulerHeader span.day').bind("click", function () {
$('#scheduler').fadeIn("slow");
$('#scheduleListWeekly,#taskHistoryDiv,#activeTasksDiv,#scheduleListMonthly').hide();
$('#scheduleListAll').hide();
});
$('#schedulerHeader span.week').bind("click", function () {
$('#scheduleListWeekly').fadeIn("slow");
$('#scheduler,#scheduleListAll,#taskHistoryDiv,#activeTasksDiv,#scheduleListMonthly').hide();
});
$('#schedulerHeader span.month').bind("click", function () {
$('#scheduleListMonthly').fadeIn("slow");
$('#scheduler,#scheduleListAll,#taskHistoryDiv,#activeTasksDiv,#scheduleListWeekly').hide();
$('#schedulerHeader span.month').unbind("click");
});
$('.closePopUp').on("click", function () {
CloseTaskPopUp();
//$("input.error").removeClass("error");
//$("label.error, span.error").hide();
});
$('#bottomControlDiv span.history').bind("click", function () {
$('#taskHistoryDiv').fadeIn("slow");
$('#scheduler,#scheduleListAll,#scheduleListWeekly,#activeTasksDiv,#scheduleListMonthly').hide();
});
$('#bottomControlDiv span.active').bind("click", function () {
$('#activeTasksDiv').fadeIn("slow");
$('#scheduler,#scheduleListAll,#scheduleListWeekly,#taskHistoryDiv,#scheduleListMonthly').hide();
});
$('#nextDayTasks').bind("click", function () {
alert("Loading next day task");
});
$('#prevDayTasks').bind("click", function () {
alert("Loading previous day task");
});
$('#imgAddTimeFrame').bind("click", function () {
ToggleTimeFrame();
if ($(this).attr("src") == "images/add.png") {
$(this).attr("src", "images/delete.png")
}
else if ($(this).attr("src") == "images/delete.png") {
$(this).attr("src", "images/add.png")
}
});
}
function ToggleTimeFrame() {
$('#timeFrameDiv').slideToggle("slow");
}
function InitializeDragAndDrop() {
$('.cssClassScheduleItem').draggable({
stop: function (event, ui) { }
});
}
function InitializeActivityIndicator() {
$('body').append('<div id="ajaxBusy"><p><img src="images/ajax-loader.gif"></p></div>');
$('#ajaxBusy').css({
display: "none",
margin: "0px",
paddingLeft: "0px",
paddingRight: "0px",
paddingTop: "0px",
paddingBottom: "0px",
position: "absolute",
right: "3px",
top: "3px",
width: "auto"
});
// Ajax activity indicator bound to ajax start/stop document events
$(document).ajaxStart(function () {
$('#ajaxBusy').show();
}).ajaxStop(function () {
$('#ajaxBusy').hide();
});
}
function CloseTaskPopUp() {
$('#newScheduleDiv').hide().addClass('invisibleDiv').removeClass('loading-visible');
$("#fade1").remove();
}
function GetCurrentDate() {
var now = new Date();
var date = "Date:" + now.getDate() + "-" + now.getMonth() + "-" + now.getFullYear();
$('.date').text(date);
}
function backgroundFilter() {
var div;
if (document.getElementById) div = document.getElementById('backgroundFilter');
else if (document.all) div = document.all['backgroundFilter'];
if (div.style.display == '' && div.offsetWidth != undefined && div.offsetHeight != undefined) div.style.display = (div.offsetWidth != 0 && div.offsetHeight != 0) ? 'block' : 'none';
div.style.display = (div.style.display == '' || div.style.display == 'block') ? 'none' : 'block';
}
function errorFn() {
}
function ImageUploader() {
$("span.fileUploadMsg").html();
var uploadFlag = false;
upload = new AjaxUpload($('#fileUpload'), {
action: SchedularModuleFilePath + 'UploadHandler.ashx?userModuleId=' + SchedularModuleID + "&portalID=" +
SageFramePortalID + "&sageFrameSecureToken=" + SageFrameSecureToken + "&userName=" + SageFrameUserName,
name: 'myfile[]',
multiple: true,
data: {},
autoSubmit: false,
responseType: 'json',
onChange: function (file, ext) {
var param = JSON2.stringify({
FileName: file,
portalID: SageFramePortalID,
userModuleId: SchedularModuleID,
sageFrameSecureToken: SageFrameSecureToken,
userName: SageFrameUserName
});
$.jsonRequest(url + "isFileUniqueTask", param, function (data) {
if (data == "0") {
$("span.fileUploadMsg").html("<b>File with name '" + file + "' already exists!!<br> Please enter unique filename.</b>");
} else {
$("span.fileUploadMsg").html("");
$("#uploadFileName").val(file);
$('#lblFile').text(file);
$("span.error").hide();
uploadFlag = true;
}
});
},
onSubmit: function (file, ext) {
if (ext != "exe") {
if (ext && /^(dll)$/i.test(ext)) {
if (!uploadFlag) return false;
} else {
$("span.fileUploadMsg").html("Not a valid dll file!");
return false;
}
}
else {
$("span.fileUploadMsg").html("Not a valid dll file!");
return false;
}
},
onComplete: function (file, response) {
if (response == "LargeImagePixel") {
return ConfirmDialog(this, 'message', "The image size is too large in pixel");
}
if ($("#uploadFileName").val().length < 1) {
$("span.fileUploadMsg").html("Please select dll file!");
}
else if (uploadFlag) {
AddTask();
ListAllTasks();
CloseTaskPopUp();
BindEvents();
uploadFlag = false;
}
}
});
}
function FillHourMin() {
var option = "<option value=0>HH</option>";
var mins = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10"];
for (var i = 1; i <= 24; i++) {
option += "<option value=" + i + ">" + i + "</option>";
}
$("#txtHours").html(option);
$("#txtRepeatHrs").html(option);
/*Minutes*/
var minOption = "<option value=''>MM</option>";
for (i = 0; i < mins.length; i++) {
minOption += "<option value=" + i + ">" + mins[i] + "</option>";
}
for (i = 11; i < 60; i++) {
minOption += "<option value=" + i + ">" + i + "</option>";
}
$("#txtMins").append(minOption).show();
$("#txtRepeatMins").html(minOption);
}
function GetSchedularListAll() {
$("#gdvSchedularListAll").sagegrid({
url: url,
functionMethod: 'GetAllTasks',
colModel: [
{
display: 'ScheduleID',
name: 'schedule_id',
coltype: 'checkbox',
align: 'center',
elemClass: 'EmailsChkbox',
elemDefault: false,
controlclass: 'itemsHeaderChkbox',
hide: true
},
{
display: 'Schedule Name',
name: 'schedule_name',
coltype: 'label',
align: 'center'
},
{
display: 'Full Namespace',
name: 'full_namespace',
coltype: 'label',
align: 'left'
},
{
display: 'Start Date',
name: 'start_date',
coltype: 'label',
align: 'center',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'End Date',
name: 'end_date',
coltype: 'label',
align: 'center',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'StartHour',
name: 'start_hour',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'StartMin',
name: 'start_min',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'RepeatWeeks',
name: 'repeat_weeks',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'RepeatDays',
name: 'repeat_days',
sortable: false,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'WeekOfMonth',
name: 'week_OfMonth',
sortable: false,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'EveryHours',
name: 'every_hours',
sortable: false,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'EveryMin',
name: 'every_min',
sortable: false,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'ObjectDependencies',
name: 'object_dependencies',
sortable: false,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'Retry Time Lapse',
name: 'retry_time_lapse',
sortable: false,
coltype: 'label',
align: 'center',
hide: false
},
{
display: 'RetryFrequencyUnit',
name: 'retry_frequency_unit',
sortable: false,
coltype: 'label',
align: 'center',
hide: true
},
{
display: 'AttachToEvent',
name: 'attach_to_event',
sortable: false,
coltype: 'label',
align: 'center',
hide: true
},
{
display: 'CatchUpEnabled',
name: 'catch_up_enabled',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'Servers',
name: 'servers',
cssclass: '',
sortable: true,
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'CreatedByUserID',
name: 'created_by_userid',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'CreatedOnDate',
name: 'create_ondate',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'LastModifiedbyUserID',
name: 'lastmodified_byuserid',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'LastModifiedDate',
name: 'last_modified_date',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'IsEnable',
name: 'is_enable',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'ScheduleHistoryID',
name: 'schedule_history_id',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'Next Run',
name: 'next_start',
cssclass: '',
coltype: 'label',
align: 'left',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'HistoryStartDate',
name: 'history_start_date',
cssclass: '',
coltype: 'label',
align: 'left',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss',
hide: true
},
{
display: 'Last Run',
name: 'history_end_date',
cssclass: '',
coltype: 'label',
align: 'left',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'RunningMode',
name: 'runningMode',
cssclass: '',
coltype: 'label',
align: 'left'
},
{
display: 'AssemblyFileName',
name: 'assemblyFileName',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'Actions',
name: 'action',
cssclass: 'cssClassAction',
sortable: false,
coltype: 'label',
align: 'center'
}
],
buttons: [
{
display: 'Edit',
name: 'edit',
enable: true,
_event: 'click',
trigger: '1',
arguments: '8,9,16'
},
{
display: 'Delete',
name: 'delete',
enable: true,
_event: 'click',
trigger: '2',
arguments: '1,28'
},
{
display: 'History',
name: 'history',
enable: true,
_event: 'click',
trigger: '3',
arguments: '1,2,3,4,27'
}
],
rp: perpage,
nomsg: "No Records Found!",
param: {
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName
, secureToken: SageFrameSecureToken
},
current: current_,
pnew: offset_,
sortcol: {
0: {
sorter: false
},
1: {
sorter: false
},
19: {
sorter: false
}
}
});
}
function editrecord(args) {
var scheduleId = args[0];
GetTask(scheduleId);
}
function deleterecord(args) {
var scheduleId = args[0];
if (parseInt(scheduleId) > 0) {
var properties = {
onComplete: function (e) {
DeleteTask(scheduleId, args[4], e);
}
}
csscody.confirm("<h1>Delete Confirmation</h1><p>Do you want to delete all selected items?</p>", properties);
$("#BoxOverlay").css("z-index", "8999");
}
}
function viewrecord(args) {
var scheduleId = args[0];
var ScheduleName = args[3];
var ScheduleFullNameSpace = args[4];
var ScheduleStartDate = args[5];
var scheduleEndDate = args[6];
var runningMode = args[7];
$("span.spanScheduleNamespace").html(ScheduleFullNameSpace);
$("span.spanScheduleName").html(ScheduleName);
$("span.spanScheduleStartDate").html(ScheduleStartDate);
$("span.spanScheduleEndDate").html(scheduleEndDate);
$("span.spanScheduleRunningMode").html(runningMode);
GetScheduleHistoryList(scheduleId);
$(document).bind('reveal.facebox', function () {
$("input.btnRunSchedule").unbind().bind("click", function () {
RunScheduleNow(scheduleId, args);
});
});
}
function DeleteTask(id, AssemblyFileName, e) {
if (e) {
var param = {
ScheduleID: parseInt(id),
AssemblyFileName: AssemblyFileName,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID
, UserName: SageFrameUserName,
secureToken: SageFrameSecureToken
};
param = JSON2.stringify(param);
$.jsonRequest(url + "DeleteTask", param, RefreshGrid);
}
}
function GetScheduleHistoryList(id) {
GetSchedularHistoryList(id);
}
function GetSchedularHistoryList(id) {
$("#gdvSchedularHistoryList").sagegrid({
url: url,
functionMethod: 'GetAllScheduleHistory',
colModel: [
{
display: 'ScheduleHistoryID',
name: 'schedule_history_id',
coltype: 'checkbox',
align: 'center',
elemClass: 'EmailsChkbox',
elemDefault: false,
controlclass: 'itemsHeaderChkbox',
hide: true
},
{
display: 'ScheduleID',
name: 'schedule_id',
coltype: 'checkbox',
align: 'center',
hide: true
},
{
display: 'StartDate',
name: 'start_date',
coltype: 'label',
align: 'center',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'EndDate',
name: 'end_date',
coltype: 'label',
align: 'center',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
},
{
display: 'Status',
name: 'return_text',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'ReturnText',
name: 'return_text',
cssclass: '',
coltype: 'label',
align: 'left'
},
{
display: 'Server',
name: 'return_text',
cssclass: '',
coltype: 'label',
align: 'left',
hide: true
},
{
display: 'NextStart',
name: 'end_date',
coltype: 'label',
align: 'center',
type: 'date',
format: 'dd/MM/yyyy HH:mm:ss'
}
],
rp: perpage,
nomsg: "No Records Found!",
param: {
ScheduleID: id,
PortalID: SageFramePortalID,
userModuleId: SchedularModuleID,
UserName: SageFrameUserName,
secureToken: SageFrameSecureToken
},
current: current_,
pnew: offset_,
SuccessPara: {
div: '#scheduleHistoryList'
}
});
}
(function ($) {
$.jsonRequest = function (url, para, successFn) {
$.ajax({
type: "POST",
url: url,
contentType: "application/json; charset=utf-8",
data: para,
dataType: "json",
success: function (msg) {
successFn(msg.d);
},
error: function (msg) {
errorFn();
}
});
}
})(jQuery); | 32.497771 | 213 | 0.493439 |
8d1f02e74f9f225b00c6ce51f7bc7d8e8402a893 | 1,291 | js | JavaScript | node_modules/@styled-icons/fa-solid/CompressAlt/CompressAlt.js | decilio4g/delicias-do-tchelo | 860b5693719280f067c8a0f9a47ccf5ee75a39c7 | [
"MIT"
] | null | null | null | node_modules/@styled-icons/fa-solid/CompressAlt/CompressAlt.js | decilio4g/delicias-do-tchelo | 860b5693719280f067c8a0f9a47ccf5ee75a39c7 | [
"MIT"
] | null | null | null | node_modules/@styled-icons/fa-solid/CompressAlt/CompressAlt.js | decilio4g/delicias-do-tchelo | 860b5693719280f067c8a0f9a47ccf5ee75a39c7 | [
"MIT"
] | 1 | 2021-05-13T23:13:59.000Z | 2021-05-13T23:13:59.000Z | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var styled_icon_1 = require("@styled-icons/styled-icon");
exports.CompressAlt = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
"xmlns": "http://www.w3.org/2000/svg",
};
return (React.createElement(styled_icon_1.StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "-.125em", iconViewBox: "0 0 448 512" }, props, { ref: ref }),
React.createElement("path", { fill: "currentColor", d: "M4.686 427.314L104 328l-32.922-31.029C55.958 281.851 66.666 256 88.048 256h112C213.303 256 224 266.745 224 280v112c0 21.382-25.803 32.09-40.922 16.971L152 376l-99.314 99.314c-6.248 6.248-16.379 6.248-22.627 0L4.686 449.941c-6.248-6.248-6.248-16.379 0-22.627zM443.314 84.686L344 184l32.922 31.029c15.12 15.12 4.412 40.971-16.97 40.971h-112C234.697 256 224 245.255 224 232V120c0-21.382 25.803-32.09 40.922-16.971L296 136l99.314-99.314c6.248-6.248 16.379-6.248 22.627 0l25.373 25.373c6.248 6.248 6.248 16.379 0 22.627z", key: "k0" })));
});
exports.CompressAlt.displayName = 'CompressAlt';
exports.CompressAltDimensions = { height: undefined, width: undefined };
| 80.6875 | 597 | 0.711077 |
8d1f1bf81519c4f2ab00020727a509097c87709e | 3,795 | js | JavaScript | samples/snippet/job_search_create_job.js | saumyasahu-bot/nodejs-talent | 8429814e28cfd2bc72a75cdcbc25fd0d547b3308 | [
"Apache-2.0"
] | 21 | 2019-02-13T21:43:17.000Z | 2021-08-11T23:24:22.000Z | samples/snippet/job_search_create_job.js | saumyasahu-bot/nodejs-talent | 8429814e28cfd2bc72a75cdcbc25fd0d547b3308 | [
"Apache-2.0"
] | 296 | 2019-02-13T21:55:17.000Z | 2022-03-25T16:32:28.000Z | samples/snippet/job_search_create_job.js | saumyasahu-bot/nodejs-talent | 8429814e28cfd2bc72a75cdcbc25fd0d547b3308 | [
"Apache-2.0"
] | 10 | 2019-02-21T19:27:28.000Z | 2021-05-04T05:43:22.000Z | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
// [START job_search_create_job]
const talent = require('@google-cloud/talent').v4;
/**
* Create Job
*
* @param projectId {string} Your Google Cloud Project ID
* @param tenantId {string} Identifier of the Tenant
*/
function sampleCreateJob(
projectId,
tenantId,
companyName,
requisitionId,
title,
description,
jobApplicationUrl,
addressOne,
addressTwo,
languageCode
) {
const client = new talent.JobServiceClient();
// const projectId = 'Your Google Cloud Project ID';
// const tenantId = 'Your Tenant ID (using tenancy is optional)';
// const companyName = 'Company name, e.g. projects/your-project/companies/company-id';
// const requisitionId = 'Job requisition ID, aka Posting ID. Unique per job.';
// const title = 'Software Engineer';
// const description = 'This is a description of this <i>wonderful</i> job!';
// const jobApplicationUrl = 'https://www.example.org/job-posting/123';
// const addressOne = '1600 Amphitheatre Parkway, Mountain View, CA 94043';
// const addressTwo = '111 8th Avenue, New York, NY 10011';
// const languageCode = 'en-US';
const formattedParent = client.tenantPath(projectId, tenantId);
const uris = [jobApplicationUrl];
const applicationInfo = {
uris: uris,
};
const addresses = [addressOne, addressTwo];
const job = {
company: companyName,
requisitionId: requisitionId,
title: title,
description: description,
applicationInfo: applicationInfo,
addresses: addresses,
languageCode: languageCode,
};
const request = {
parent: formattedParent,
job: job,
};
client
.createJob(request)
.then(responses => {
const response = responses[0];
console.log(`Created job: ${response.name}`);
})
.catch(err => {
console.error(err);
});
}
// [END job_search_create_job]
// tslint:disable-next-line:no-any
const argv = require('yargs')
.option('project_id', {
default: 'Your Google Cloud Project ID',
string: true,
})
.option('tenant_id', {
default: 'Your Tenant ID (using tenancy is optional)',
string: true,
})
.option('company_name', {
default: 'Company name, e.g. projects/your-project/companies/company-id',
string: true,
})
.option('requisition_id', {
default: 'Job requisition ID, aka Posting ID. Unique per job.',
string: true,
})
.option('title', {
default: 'Software Engineer',
string: true,
})
.option('description', {
default: 'This is a description of this <i>wonderful</i> job!',
string: true,
})
.option('job_application_url', {
default: 'https://www.example.org/job-posting/123',
string: true,
})
.option('address_one', {
default: '1600 Amphitheatre Parkway, Mountain View, CA 94043',
string: true,
})
.option('address_two', {
default: '111 8th Avenue, New York, NY 10011',
string: true,
})
.option('language_code', {
default: 'en-US',
string: true,
}).argv;
sampleCreateJob(
argv.project_id,
argv.tenant_id,
argv.company_name,
argv.requisition_id,
argv.title,
argv.description,
argv.job_application_url,
argv.address_one,
argv.address_two,
argv.language_code
);
| 27.70073 | 89 | 0.678261 |
8d1faa7a30f32e7bfcc1205f4f5542602f34deea | 5,339 | js | JavaScript | config/data.config.js | qingsongyoudao/qs-uni-account | 44814909062364f9a10399bbe73d706da7a72a89 | [
"MIT"
] | 5 | 2020-07-08T16:36:27.000Z | 2020-10-09T19:52:51.000Z | config/data.config.js | qingsongyoudao/qs-uni-account | 44814909062364f9a10399bbe73d706da7a72a89 | [
"MIT"
] | null | null | null | config/data.config.js | qingsongyoudao/qs-uni-account | 44814909062364f9a10399bbe73d706da7a72a89 | [
"MIT"
] | 3 | 2020-08-12T07:19:29.000Z | 2021-07-19T08:52:24.000Z | export default {
// app应用名称
appName: '',
// 购物车在tab的位置
cartIndex: 3,
// 消息在tab的位置
notifyIndex: 2,
// 验证码发送间隔
sendCodeTime: 60,
// 金额符号
moneySymbol: '¥',
// 单商品替代词
singleSkuText: '基础款',
// 顶部导航菜单
menuTop: [{
icon: 'iconxiaoxi1',
text: '消息',
urlType: 'tab',
url: '/pages/notify/notify'
},
{
icon: 'iconzhuyedefuben',
text: '首页',
urlType: 'tab',
url: '/pages/index/index'
},
{
icon: 'iconwode-',
text: '我的',
urlType: 'tab',
url: '/pages/profile/profile'
},
{
icon: 'icongouwuche2',
text: '购物车',
urlType: 'tab',
url: '/pages/cart/cart'
},
{
icon: 'iconbianji',
text: '我要反馈',
url: '/pages/set/feedback/feedback'
},
{
icon: 'iconquanbudingdan',
text: '我的订单',
url: '/pages/order/order?state=-1'
}
],
// 个人中心-设置中心菜单 e07472 ff4757 ff6b81
settingList: [{
icon: 'icongonggao',
url: '/pages/index/notice/notice',
title: '商城公告',
color: '#ff6b81'
},
{
icon: 'iconyouhuiquan-copy',
url: '/pages/user/coupon/list',
title: '领券中心',
color: '#ff6b81'
},
{
icon: 'icondizhi1',
url: '/pages/user/address/address',
title: '地址管理',
color: '#ff6b81'
},
{
icon: 'iconshoucang3',
url: '/pages/user/collection/collection',
title: '我的收藏',
color: '#ff6b81'
},
{
icon: 'iconfenxiang',
url: '',
title: '分享',
color: '#ff6b81'
},
{
icon: 'iconzhibo',
url: '/pages/marketing/live/list',
title: '直播',
color: '#ff6b81'
},
{
icon: 'iconshezhi3',
url: '/pages/set/set',
title: '设置',
color: '#ff6b81'
}
],
// 设置-设置中心
setList: [{
title: '个人资料',
url: '/pages/user/userinfo/userinfo',
content: ''
},
{
title: '修改密码',
url: '/pages/public/password?type=1',
content: ''
},
{
title: '授权管理',
url: '/pages/set/authorization/list',
content: ''
},
{
title: '发票管理',
url: '/pages/set/invoice/invoice',
content: '',
class: 'mT'
},
{
title: '开票历史',
url: '/pages/set/invoice/list',
content: ''
},
{
title: '清除缓存',
url: 'clearCache',
content: ''
},
{
title: '关于商城',
url: '/pages/set/about/about',
content: '',
class: 'mT'
},
{
title: '站点帮助',
url: '/pages/set/helper/index',
content: ''
},
/* #ifdef APP-PLUS */
{
title: '检查更新',
url: 'versionUpgrade',
content: ''
},
/* #endif */
{
title: '意见反馈',
url: '/pages/set/feedback/list',
content: ''
}
],
// 个人中心-我的订单
orderSectionList: [{
title: '待付款',
icon: 'iconfont icondaifukuan',
url: '/pages/order/order?state=0',
num: null
},
{
title: '待发货',
icon: 'iconfont iconshouye',
url: '/pages/order/order?state=1',
num: null
},
{
title: '待收货',
icon: 'iconfont iconyishouhuo',
url: '/pages/order/order?state=2',
num: null
},
{
title: '评价',
icon: 'iconfont iconpingjia',
url: '/pages/order/order?state=3',
num: null
},
{
title: '退款/售后',
icon: 'iconfont iconshouhoutuikuan',
url: '/pages/order/refund',
num: null
}
],
// 个人中心-积分余额
amountList: [{
title: '余额',
value: 0,
url: '/pages/user/account/account'
},
{
title: '优惠券',
value: 0,
url: '/pages/user/coupon/coupon?type=1'
},
{
title: '积分',
value: 0,
url: '/pages/user/account/integral'
}
],
// 订单状态
orderStatus: [{
key: 0,
value: '待付款'
},
{
key: 1,
value: '待发货'
},
{
key: 2,
value: '已发货'
},
{
key: 3,
value: '已收货'
},
{
key: 4,
value: '已完成'
},
{
key: -1,
value: '退货申请'
},
{
key: -2,
value: '退款中'
},
{
key: -3,
value: '退款完成'
},
{
key: -4,
value: '已关闭'
},
{
key: -5,
value: '撤销申请'
},
{
key: 101,
value: '待成团'
},
{
key: 201,
value: '备货中'
},
{
key: 202,
value: '待付尾款'
}
],
// 订单退货状态
refundStatus: [{
key: 1,
value: '退款申请'
},
{
key: 2,
value: '等待退货'
},
{
key: 3,
value: '等待确认收货'
},
{
key: 4,
value: '等待确认退款'
},
{
key: 5,
value: '已退款'
},
{
key: -1,
value: '退款已拒绝'
},
{
key: -2,
value: '退款已关闭'
},
{
key: -3,
value: '退款不通过'
}
],
// 订单评价状态
evaluateStatus: [{
key: 0,
value: '未评价'
},
{
key: 1,
value: '已评价'
},
{
key: 2,
value: '已追评'
}
],
// 订单状态导航
orderNavList: [{
state: undefined,
text: '全部'
},
{
state: 0,
text: '待付款'
},
{
state: 1,
text: '待发货'
},
{
state: 2,
text: '待收货'
},
{
state: 3,
text: '评价'
}
],
// 直播记录列表
liveTypeList: [{
state: 101,
text: '进行中'
},
{
state: 102,
text: '未开始'
},
{
state: 103,
text: '已结束'
}
],
// 收货地址/自提点
addressTypeList: [{
state: 1,
text: '选择物流配送'
},
{
state: 2,
text: '选择自提配送'
}
],
// 热门推荐
hotRecommendList: [{
url: '/pages/marketing/bargain/list',
icon: '/static/kj.png',
title: '我要砍价',
desc: '淘到理想好物'
},
{
url: '/pages/marketing/group/list',
icon: '/static/tg.png',
title: '团购专区',
desc: '发现品质好物'
},
{
url: '/pages/marketing/discount/list',
icon: '/static/zk.png',
title: '限时折扣',
desc: '抢到就是赚到'
}
],
// 消息类型 1:公告;2:提醒;3:私信
notifyTypeList: [{
type: 0,
content: ''
},
{
type: 1,
content: '公告'
},
{
type: 2,
content: '提醒'
},
{
type: 3,
content: '私信'
}
]
};
| 13.215347 | 44 | 0.495224 |
8d207f8533261a1ed6d7972ed6ad4440510fbd7d | 737 | js | JavaScript | public/dist/js/manager/upload.min.js | wesleyan/spec | f5edcca2d5ad4bb3930191f81375e264b9d4dc66 | [
"MIT"
] | 5 | 2015-04-01T01:01:58.000Z | 2020-06-02T15:59:06.000Z | public/dist/js/manager/upload.min.js | wesleyan/spec | f5edcca2d5ad4bb3930191f81375e264b9d4dc66 | [
"MIT"
] | 8 | 2015-01-30T01:48:58.000Z | 2019-02-18T16:16:43.000Z | public/dist/js/manager/upload.min.js | wesleyan/spec | f5edcca2d5ad4bb3930191f81375e264b9d4dc66 | [
"MIT"
] | 3 | 2015-02-10T23:18:54.000Z | 2020-12-15T20:34:25.000Z | /*! Spec 0.2.0 */
$(function(){var a=function(a){$("div.progress").hide(),$("strong.message").text(a),$("div.alert").show(),$(".alert-info").hide()};$('input[type="submit"]').on("click",function(b){if(""===$("#myFile").val())return!1;b.preventDefault(),$("div.progress").show();var c=new FormData,d=document.getElementById("myFile").files[0];c.append("myFile",d);var e=new XMLHttpRequest;e.open("post","/fileUpload",!0),e.upload.onprogress=function(a){if(a.lengthComputable){var b=a.loaded/a.total*100;$("div.progress div.bar").css("width",b+"%")}},e.onerror=function(){a("An error occurred while submitting the form. Maybe your file is too big")},e.onload=function(){a(200==this.status?this.responseText:this.statusText)},e.send(c)})}); | 368.5 | 719 | 0.679783 |
8d20a68a40ea6c9efa2b6eda336572d1cfdfd2fe | 4,249 | js | JavaScript | src/components/lib/vnodeHelper.js | mizuka-wu/vue-pdfmake | 94f0751cb9b04e0afb68edda6a00fb0515914ecc | [
"MIT"
] | 8 | 2019-04-03T08:38:15.000Z | 2021-09-12T15:22:55.000Z | src/components/lib/vnodeHelper.js | mizuka-wu/vue-pdfmake | 94f0751cb9b04e0afb68edda6a00fb0515914ecc | [
"MIT"
] | 2 | 2019-04-03T08:40:13.000Z | 2019-04-08T01:41:30.000Z | src/components/lib/vnodeHelper.js | mizuka-wu/vue-pdfmake | 94f0751cb9b04e0afb68edda6a00fb0515914ecc | [
"MIT"
] | 5 | 2019-04-16T11:29:33.000Z | 2020-10-15T07:10:32.000Z | import getBase64Image from './image.js'
import { DEFAULT_IMAGE } from './config.js'
/**
* 替换string 或者 value到一个具体数字
* @param {string, number} value
*/
function value2number(value) {
return Number((value + '').replace(';', '').replace('px', ''))
}
/**
* vnode2content的方案
* @param {vnode} vnode - vnode或者列数
* @param {object[]} content - 内容
* @param {object} parentStyle - 继承的style
* @returns {object[]}
*/
export function vnode2content(vnode, content, parentStyle) {
let data = vnode.data || {}
let style = styleAdapter(vnode, parentStyle)
switch (vnode.tag || '') {
case '': {
content.push({
text: vnode.text,
...style,
})
break
}
/**
* @todo 追加width height之类的
*/
case 'img': {
let node = {
image: DEFAULT_IMAGE,
...style,
}
getBase64Image(data.attrs.src)
.then(base64 => (node.image = base64))
.then(() => content.push(node))
break
}
case 'a': {
let linkContent = vnodes2content(vnode.children, [], style)
// @todo link渲染方案
content.push({
text: linkContent[0].text,
link: data.attrs.href,
...style,
})
break
}
case 'ul': {
content.push({
ul: vnodes2content(vnode.children),
})
break
}
case 'ol': {
content.push({
ul: vnodes2content(vnode.children),
})
break
}
default: {
if (vnode.children) {
return vnodes2content(vnode.children, content, style)
}
}
}
return content
}
/**
* vnode列表转content的方法,reduce的代理
* @param {vnodes} vnodes
* @param {object[]} [targetContent]
* @param {object} [parentStyle] - 继承的style
* @returns {object[]}
*/
export function vnodes2content(vnodes = [], targetContent = [], parentStyle) {
return vnodes.reduce(
(content, vnode) => vnode2content(vnode, content, parentStyle),
targetContent
)
}
/**
* vnode的style和vue的适配器
* @param {vnodeObject} vnode
* @param {object} parentStyle
* @return {object} 计算好的样式
*/
export function styleAdapter(vnode, parentStyle = {}) {
let { data = {} } = vnode
let { attrs = {}, normalizedStyle, staticStyle } = data
let originStyle = Object.assign(
{},
attrs, // width height 这一类的属性
staticStyle,
normalizedStyle
)
if (originStyle.margin) {
let margin = originStyle.margin.replace(';', '').split(' ')
switch (margin.length) {
case 1: {
let value = margin[0]
margin = [value, value, value]
break
}
case 2: {
margin = [...margin, ...margin]
break
}
}
// 赋值系列
;['top', 'right', 'bottom', 'left'].forEach((key, index) => {
let value = margin[index] || 0
originStyle['margin-' + key] = originStyle['margin-' + key] || value
})
}
return Object.keys(originStyle).reduce(
(style, attr) => {
let value = originStyle[attr]
switch (attr) {
case 'font-size': {
style.fontSize = value2number(value)
break
}
case 'font-weight': {
if (isNaN(value)) {
style.bold = value.includes('bold')
} else {
style.bold = Number(value) >= 500
}
break
}
case 'font-style': {
style.italics = value === 'italic'
break
}
case 'text-align': {
style.alignment = value
break
}
case 'width': {
style.width = value2number(value)
break
}
case 'height': {
style.height = value2number(value)
break
}
// margin: [left, top, right, bottom] 需要特殊处理
case 'margin-left': {
style.margin[0] = value2number(value)
break
}
case 'margin-top': {
style.margin[1] = value2number(value)
break
}
case 'margin-right': {
style.margin[2] = value2number(value)
break
}
case 'margin-bottom': {
style.margin[3] = value2number(value)
break
}
}
return style
},
Object.assign(
{
margin: [0, 0, 0, 0],
},
parentStyle
)
)
}
| 22.721925 | 78 | 0.526477 |
8d217738e1d93208223c4486ce72bb00779d9edb | 138 | js | JavaScript | public/styles-439d2a9b001824a225c9.js | ardaplun/tentaweb | 698428ba87726b26550117cd5604a1640fa09e3c | [
"MIT"
] | null | null | null | public/styles-439d2a9b001824a225c9.js | ardaplun/tentaweb | 698428ba87726b26550117cd5604a1640fa09e3c | [
"MIT"
] | null | null | null | public/styles-439d2a9b001824a225c9.js | ardaplun/tentaweb | 698428ba87726b26550117cd5604a1640fa09e3c | [
"MIT"
] | null | null | null | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{213:function(n,w,o){}}]);
//# sourceMappingURL=styles-439d2a9b001824a225c9.js.map | 69 | 82 | 0.73913 |
8d21a720bd898daa777a44ca3b294e26b7051531 | 461 | js | JavaScript | gh-pages-site/src/pages/githubPage.js | Sephta/Sephta.github.io | ca91a4968dcdf5ef54cc16179133fde006a43306 | [
"MIT"
] | 1 | 2021-04-18T03:57:07.000Z | 2021-04-18T03:57:07.000Z | gh-pages-site/src/pages/githubPage.js | Sephta/Sephta.github.io | ca91a4968dcdf5ef54cc16179133fde006a43306 | [
"MIT"
] | null | null | null | gh-pages-site/src/pages/githubPage.js | Sephta/Sephta.github.io | ca91a4968dcdf5ef54cc16179133fde006a43306 | [
"MIT"
] | null | null | null | import React from "react"
import { Link } from "gatsby"
import SEO from "../components/seo"
import LandingWrapper from "../components/wrappers/landingWrapper"
const githubPage = () => {
return (
<>
<LandingWrapper>
<SEO title="GitHub" />
<h1
className={"text-center text-5xl font-mono font-bold text-grey-900"}
>
GitHub Page
</h1>
</LandingWrapper>
</>
)
}
export default githubPage
| 20.954545 | 78 | 0.596529 |
8d2234c4fd3a7f7105a4ef468deb8c927dddad97 | 999 | js | JavaScript | src/_common/components/button/Button.js | anumang/ReactNativeCodeBase | 765def93aaec44004074e5c2d629c4008d5767e3 | [
"MIT"
] | null | null | null | src/_common/components/button/Button.js | anumang/ReactNativeCodeBase | 765def93aaec44004074e5c2d629c4008d5767e3 | [
"MIT"
] | 4 | 2020-09-07T16:54:24.000Z | 2021-01-30T10:42:48.000Z | src/_common/components/button/Button.js | anumang/ReactNativeCodeBase | 765def93aaec44004074e5c2d629c4008d5767e3 | [
"MIT"
] | null | null | null | import PropTypes from 'prop-types';
import React, { useMemo } from 'react';
import { Text } from '../text';
import { Touchable } from '../touchable';
import { ViewStyled } from './Button.styled';
const Button = ({ text, primary, onPress }) => {
const borderColor = useMemo(() => ((!primary && 'primary') || undefined), [primary]);
const backgroundColor = useMemo(() => ((primary && 'primary') || 'secondary'), [primary]);
const color = useMemo(() => ((primary && 'textPrimary') || 'textSecondary'), [primary]);
return (
<ViewStyled>
<Touchable
onPress={onPress}
backgroundColor={backgroundColor}
borderColor={borderColor || backgroundColor}>
<Text text={text} size="body2" color={color} />
</Touchable>
</ViewStyled>
);
};
Button.propTypes = {
text: PropTypes.string,
primary: PropTypes.bool,
onPress: PropTypes.func,
};
Button.defaultProps = {
text: '',
primary: false,
onPress: () => {},
};
export default Button;
| 24.365854 | 92 | 0.617618 |
8d22bfa87c8bfe04e6c93d1c53ba3aff971180b0 | 61,660 | js | JavaScript | main.js | dzaima/Canvas | 2dac13b7129633281a2422b0f36da6b3631cd93e | [
"MIT"
] | 15 | 2018-02-23T18:54:43.000Z | 2022-02-12T15:11:57.000Z | main.js | dzaima/Canvas | 2dac13b7129633281a2422b0f36da6b3631cd93e | [
"MIT"
] | null | null | null | main.js | dzaima/Canvas | 2dac13b7129633281a2422b0f36da6b3631cd93e | [
"MIT"
] | null | null | null | //# sourceURL=Main
version = 8;
codepage = "⁰¹²³⁴⁵⁶⁷⁸⁹¶\n+-()[]{}<>‰ø^◂←↑→↓↔↕ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~┌┐└┘├┤┬┴╴╵╶╷╋↖↗↘↙×÷±«»≤≥≡≠ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789‟‼¼½¾√/\∑∙‽‾⇵∔:;⟳⤢⌐ŗ“”„?*↶↷@#%!─│┼═║╫╪╬αω";
const baseChars = [...codepage].filter(c => !"„“”‟\n".includes(c));
const baseChar = c => [].indexOf.bind(baseChars)(c);
let compressionChars = "ZQJKVBPYGFWMUCLDRHSNIATEXOzqjkvbpygfwmucldrhsniatexo~!$%&=?@^()<>[]{};:9876543210#*\"'`.,+\\/_|-\nŗ ";
let compressionModes = 5;
let boxChars=" \n-|/\\_";
var debugCompression = false;
var compressionParts;
const shortNumbers = {};
let simpleNumbers;
let compressedNumberStart;
{
simpleNumbers = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'A': 10,
'6«':12,
'7«':14,
'8«':16,
'9«':18,
'A«':20,
};
let cnum = 0;
let skippable = Object.entries(simpleNumbers).map(c=>c[1]);
baseChars.forEach(chr=>{
cnum++;
while(skippable.includes(cnum)) cnum++;
shortNumbers["‾"+chr] = cnum;
});
compressedNumberStart = cnum+1;
}
if (module) {
var Big = require('./bigDecimal');
var debug = false;
var stepping = false;
var running = false;
const AA = require('./asciiart');
var smartRotate = AA.smartRotate;
var smartOverlapDef = AA.smartOverlapDef;
var smartOverlapBehind = AA.smartOverlapBehind;
var smartOverlap = AA.smartOverlap;
var noBGOverlap = AA.noBGOverlap;
var simpleOverlap = AA.simpleOverlap;
eval("var Canvas = AA.Canvas;");
var debugLog = console.warn;
}
var stringChars;
{
let printableAsciiArr=[];
for (let i = 32; i < 127; i++) printableAsciiArr.push(String.fromCharCode(i));
let printableAscii = printableAsciiArr.join("");
stringChars = printableAscii + "¶ŗ";
}
async function redrawDebug(selStart, selEnd, state) {
result.value = state.printableOut;
let program = state.program;
codeState.innerHTML = '<span class="code">' + program.substring(0,selStart) + '</span>'
+ '<span class="code sel">' + program.substring(selStart,selEnd) + '</span>'
+ '<span class="code">' + program.substring(selEnd) + '</span>';
stateX.innerText = arrRepr(state.vars.x);
stateY.innerText = arrRepr(state.vars.y);
const lastOfLA = state.lastArgs.slice(-2);
stateAlpha.innerText = arrRepr(lastOfLA[0]);
stateOmega.innerText = arrRepr(lastOfLA[1]);
stateRemainders.innerText = arrRepr(state.remainders.slice(-3));
stateSups.innerText = state.supVals.map((c,i)=>["¹²³⁴⁵⁶⁷⁸⁹"[i] + ":", c]).filter(c=>typeof c[1] !== 'function').map(c=>c[0] + arrRepr(c[1])).join(", ");
bgState.innerText = quotify(state.background, `"`);
ptrstackState.innerText = state.ptrs.map(c=>c.toDebug()).join("\n");
let ar, width;
stackState.innerHTML = state.stack.map(c => (
ar=c instanceof Canvas? c.toDebugString(true) : arrRepr(c),
width=Math.max(50,
Math.min(250,
ar.split("\n").map(
c=>c.length
).reduce(
(a,b)=>Math.max(a,b), 0
)*8.7
)
),
`<textarea class="stackItem" style="width:${width}px;height:${Math.min(250,Math.max(50,Math.max(ar.split("\n").length*17+30, ar.length/(width/8.7)*17+30)))}px" readonly>${ar}</textarea>`
)).join("");
while (!stepNow) await sleep(33);
stepNow = false;
}
class Pointer {
/* class meant for extention
stores the pointer info needed for program structures
*/
// ?..]..}..]..}..}
// | | | | |
// sptr points to starting char (or -1)
// eptr points to last bracket (or program.length)
// p = parent CanvasCode class instance
constructor (program, p, sptr, eptr = p.endPt(sptr, false, false, program)) {
if (debug>1) console.log(`pointer added ${sptr}-${eptr} of \`${program}\``);
this.sptr = sptr;
this.eptr = eptr;
this.p = p;
this.program = program;
this.ptr = sptr + 1;
this.finished = false;
this.inParent = true;
if (sptr>=0) {
this.endpts = this.p.endPt(this.sptr, false, true, this.program);
this.endpts.forEach((c,i)=>c.index=i);
let is = [{i:sptr}].concat(this.endpts);
this.branches = is.slice(0,-1).map((c,i)=>({i: c.i+1, c: is[i+1].c, index:i}));
} else {
this.endpts = [{i:eptr, c:undefined, index:0}];
this.branches = [{i:sptr+1, c:undefined, index:0}];
}
this.endptrs = this.endpts.map(c=>c.i);
}
async next() {
if (this.finished) return this.break();
await this.exec();
this.iter();
}
iter() {
this.ptr = this.p.nextIns(this.ptr, this.program);
const ending = this.endptrs.indexOf(this.ptr);
if (ending !== -1) this.continue(this.endpts[ending]);
else if (this.ptr >= this.eptr) this.continue(this.endpts[this.endpts.length]);
}
update(newPtr) {
this.ptr = newPtr;
if (this.ptr >= this.eptr) this.continue(this.endpts[this.endptrs.indexOf(this.ptr)]);
}
continue() {
this.break();
}
branch(index) {
this.ptr = this.branches[index].i;
}
break() {
this.finished = true;
this.onBreak();
this.p.break(this.eptr, this);
}
onBreak() {}
init() {}
toString() {
return `@${this.ptr} pointer; ${this.sptr}-${this.eptr}`;
}
toDebug() { return this.toString(); }
async exec (index = this.ptr) {
let eindex = this.p.nextIns(index, this.program);
let instr = this.program.slice(index, eindex);
if (instr.length > 0 && [...instr].every(c=>stringChars.includes(c))) {
this.p.push(this.p.prepareStr(instr.replace(/¶/g,"\n")));
} else if (instr[0] === '“') {
let str = instr.slice(1, -1);
switch (instr[instr.length-1]) {
case "”":
this.p.push(str);
break;
case "„": {
let num = [...str].map(baseChar);
if (debug && num.some(c => c===-1)) console.log(str+" contained non-compression chars "+num.map((c,i)=>[c,i]).filter(c=>c[0]===-1).map(c=>str[c[1]]));
this.p.push(fromBijective(num, baseChars.length).plus(compressedNumberStart));
} break;
case "‟": {
let num = [...str].map(baseChar);
if (debug && num.some(c => c===-1)) console.log(str+" contained non-compression chars");
num = fromBijective(num, baseChars.length);
let mode;
let string = "";
let popped = []; // yes, for debugging only
function pop(base) {
let arr = num.divideAndRemainder(base);
popped.push(arr[1]+"/"+base);
num = arr[0];
return arr[1].intValue();
}
function popChar(chars) {
return chars[pop(chars.length)];
}
while (num.gt(Big.ZERO)) {
let mode = pop(compressionModes);
popped = [];
switch (mode) {
case 0: // char
for (let len = pop(2) + 1; len > 0; len--) {
string+= popChar(compressionChars);
}
break;
case 1:
for (let len = pop(16) + 3; len > 0; len--) {
string+= popChar(compressionChars);
}
break;
case 2: {
let pos = -1;
let chars = "";
while (pos < compressionChars.length) {
if (pos>=0) chars = compressionChars[pos] + chars;
pos = pos + 1 + pop(compressionChars.length - pos - (pos===-1));
}
let lbit = pop(2);
let len = chars.length + 1;
if (lbit) len+= pop(128)+16;
else len+= pop(16);
if (debugCompression) console.log("dict: " + chars + " len: " + len);
for (; len > 0; len--) {
string+= popChar(chars);
}
} break;
case 3: {
let chars = "";
for (let c of boxChars) if (pop(2)) chars+= c;
let lbit = pop(2);
let len = chars.length + 1;
if (lbit) len+= pop(128)+16;
else len+= pop(16);
if (debugCompression) console.log("boxdict: " + chars + " len: " + len);
for (; len > 0; len--) {
string+= popChar(chars);
}
} break;
}
if (debug>1) console.log(mode + " " + popped.join(" "));
}
this.p.push(this.p.prepareStr(string));
} break;
}
} else if (instr[0] === "‾") {
this.p.push(shortNumbers[instr]);
} else {
let func = this.p.builtins[instr];
if (func === undefined) {
if (debug) console.warn(`the function ${instr}@${index} doesn't exist`);
this.p.push(instr); // idk why k
} else {
try {
func();
} catch (e) {
if (debug) {
console.warn(`error ${instr}@${index} failed on line ${errorLN(e)}`);
console.warn(e);
}
}
}
}
if (!this.p.cpo) return; // i have no idea
if (this !== this.p.cpo && !this.p.cpo.inParent) index = eindex = 0; // WARNING destructive; for the stepper to start normally; TODO fix ⁷V5±‟⁸{↔
if (this.p.debug) debugLog(`${instr}@${index}${eindex-index===1||(eindex===0&&index===0)?'':"-"+(eindex-1)}: ${arrRepr(this.p.stack)}`);
if (stepping) await redrawDebug(index, eindex, this.p);
}
}
// a class to put on the stack - a marker of where `)` or `]` should end
class Break {
// 0 - user created
// 1 - for loops
constructor (id) {
this.id = id;
}
toString() {
return "("+ "⁰¹²³⁴⁵⁶⁷⁸⁹"[this.id];
}
}
async function run (program, inputs = []) {
if (!module) result.value = "";
return new CanvasCode(program, bigify(inputs)).run();
}
CanvasCode = class {
constructor (wholeProgram, inputs) {
// ALL of the state of the program
this.implicitOut = true;
this.stack = [];
this.output = "";
this.background = " ";
this.vars = {};
this.remainders = [];
this.lastArgs = [];
this.supVals = bigify([Infinity, 256, 13, 64, 11, 12, 16, 128, 0]);
this.inpCtr = 0;
this.inputs = inputs.map(c=>c instanceof Canvas? (c.p = this, c) : c);
this.ptrs = [];
// fuck you `this.`
const get = this.get.bind(this);
const pop = this.pop.bind(this);
const push = this.push.bind(this);
const currInp = this.currInp.bind(this);
const remainderPalindromize = this.remainderPalindromize.bind(this);
const cast = this.cast.bind(this);
const getRemainder = this.getRemainder.bind(this);
const remainders = this.remainders;
const lastArgs = this.lastArgs;
// function creation
this.builtins = {
"{": () => this.addPtr(new (
class extends Pointer {
init() {
this.level = this.p.ptrs.length-2;
this.obj = this.p.pop();
this.collect = this.branches.slice(-1)[0].c === "]";
this.canvas = isArt(this.obj);
if (this.canvas) {
this.result = new Canvas([], this.obj.p);
} else this.collected = [];
this.array = !isNum(this.obj) && !this.canvas;
this.endCount = this.canvas? new Big(this.obj.width * this.obj.height) : this.array? new Big(this.obj.length) : this.obj.round(0, Big.ROUND_FLOOR);
this.index = 0;
this.continue(undefined, true);
}
iter() {
this.ptr = this.p.nextIns(this.ptr, this.program);
if (this.ptr >= this.eptr) this.continue();
}
continue(ending, first = false) {
this.ptr = this.branches[0].i;
if (!first && this.collect) {
let added = this.p.collectToArray();
if (this.canvas) {
for (let item of added) this.result.overlap(new Canvas(item, this.p), this.obj.sx + this.x, this.obj.sy + this.y);
} else this.collected.push(...added);
}
if (this.index >= this.endCount.intValue()) return this.break();
if (this.collect) {
this.p.push(new Break(1));
}
let newItem, x, y;
if (this.canvas) {
this.x = this.index%this.obj.width;
this.y = 0 | this.index/this.obj.width;
}
// console.log(this.x,this.y,this.obj,this.index,+this.endCount);
if (this.array) newItem = this.obj[this.index];
else if (this.canvas) newItem = this.obj.repr[this.y][this.x] || this.obj.background;
else newItem = new Big(this.index+1);
this.p.push(newItem);
if (this.canvas) {
this.p.setSup(this.level, newItem);
this.p.setSup(this.level+1, this.x);
this.p.setSup(this.level+2, this.y);
} else {
this.p.setSup(this.level, newItem);
this.p.setSup(this.level+1, this.index + (this.array? 1 : 0));
}
this.index++;
}
onBreak() {
if (this.collect) {
if (this.canvas) {
this.p.push(this.result);
} else this.p.push(this.collected);
}
}
toString() {
return `@${this.ptr} loop; ${this.sptr}-${this.eptr}${this.collect? ' '+ arrRepr(this.collected) : ''}`;
}
}
)(this.program, this, this.cpo.ptr)),
"H": () => this.addPtr(new (
class extends Pointer {
init() {
this.level = this.p.ptrs.length-2;
this.obj = this.p.pop();
this.p.push(this.p.blank);
this.collect = this.branches.slice(-1)[0].c === "]";
this.canvas = isArt(this.obj);
if (this.canvas) {
this.result = new Canvas([], this.obj.p);
} else this.collected = [];
this.array = !isNum(this.obj) && !this.canvas;
this.endCount = this.canvas? new Big(this.obj.width * this.obj.height) : this.array? new Big(this.obj.length) : this.obj.round(0, Big.ROUND_FLOOR);
this.index = 0;
this.continue(undefined, true);
}
iter() {
this.ptr = this.p.nextIns(this.ptr, this.program);
if (this.ptr >= this.eptr) this.continue();
}
continue(ending, first = false) {
this.ptr = this.branches[0].i;
if (!first && this.collect) {
let added = this.p.collectToArray();
if (this.canvas) {
for (let item of added) this.result.overlap(new Canvas(item, this.p), this.obj.sx + this.x, this.obj.sy + this.y);
} else this.collected.push(...added);
}
if (this.index >= this.endCount.intValue()) return this.break();
if (this.collect) {
this.p.push(new Break(1));
}
let newItem, x, y;
if (this.canvas) {
this.x = this.index%this.obj.width;
this.y = 0 | this.index/this.obj.width;
}
// console.log(this.x,this.y,this.obj,this.index,+this.endCount);
if (this.array) newItem = this.obj[this.index];
else if (this.canvas) newItem = this.obj.repr[this.y][this.x] || this.obj.background;
else newItem = new Big(this.index+1);
this.p.push(newItem);
if (this.canvas) {
this.p.setSup(this.level, newItem);
this.p.setSup(this.level+1, this.x);
this.p.setSup(this.level+2, this.y);
} else {
this.p.setSup(this.level, newItem);
this.p.setSup(this.level+1, this.index + (this.array? 1 : 0));
}
this.index++;
}
onBreak() {
if (this.collect) {
if (this.canvas) {
this.p.push(this.result);
} else this.p.push(this.collected);
}
}
toString() {
return `@${this.ptr} loop; ${this.sptr}-${this.eptr}${this.collect? ' '+ arrRepr(this.collected) : ''}`;
}
}
)(this.program, this, this.cpo.ptr)),
"[": () => this.addPtr(new (
class extends Pointer {
init() {
this.level = this.p.ptrs.length-2;
this.obj = this.p.pop();
this.prefix = [];
this.collect = this.branches.slice(-1)[0].c === "]";
this.collected = [];
this.array = !isNum(this.obj);
this.endCount = this.array? this.obj.length : +this.obj.round(0, Big.ROUND_FLOOR);
this.index = 0;
this.continue(undefined, true);
}
iter() {
this.ptr = this.p.nextIns(this.ptr, this.program);
if (this.ptr >= this.eptr) this.continue();
}
continue(ending, first = false) {
this.ptr = this.branches[0].i;
if (!first && this.collect) this.collected.push(...this.p.collectToArray());
if (this.index >= this.endCount) return this.break();
if (this.collect) this.p.push(new Break(1));
if (this.array) {
if (isStr(this.obj)) this.prefix+=this.obj[this.index];
else this.prefix.push(this.obj[this.index]);
this.p.push(this.prefix);
this.p.setSup(this.level, this.obj[this.index]);
this.p.setSup(this.level+1, this.prefix);
this.p.setSup(this.level+2, this.index+(this.array? 1 : 0));
} else {
this.p.setSup(this.level, this.index+1);
this.p.setSup(this.level+1, this.index);
}
this.index++;
}
onBreak() {
if (this.collect) this.p.push(this.collected);
}
toString() {
return `@${this.ptr} loop; ${this.sptr}-${this.eptr} depth ${this.level}`;
}
}
)(this.program, this, this.cpo.ptr)),
"W": () => this.addPtr(new (
class extends Pointer {
init() {
this.doWhile = this.branches.slice(-1)[0].c !== "]";
this.continue(undefined, false);
}
iter() {
this.ptr = this.p.nextIns(this.ptr, this.program);
if (this.ptr >= this.eptr) this.continue();
}
continue(ending, back = true) {
this.ptr = this.branches[0].i;
if (!this.doWhile || back) {
if (falsy(this.doWhile? this.p.pop() : this.p.get()))
return this.break();
}
}
toString() {
return `@${this.ptr} loop; ${this.sptr}-${this.eptr}`;
}
}
)(this.program, this, this.cpo.ptr)),
"?": () => this.addPtr(new (
class extends Pointer {
init() {
this.level = this.p.ptrs.length-2;
this.obj = this.p.pop();
this.p.setSup(this.level, this.obj);
this.switch = this.branches[0].c === "]";
if (this.switch) {
if (falsy(this.obj)) this.branch(1);
else if (this.endpts.length === 2) this.branch(0);
else if (isNum(this.obj) && this.obj.gt(0) && this.obj.lt(this.branches.length-1)) this.branch(this.obj.round(0, Big.ROUND_FLOOR).plus(1));
else this.branch(0);
} else if(falsy(this.obj)) this.finished = true;
}
toString() {
return `@${this.ptr} ${this.switch? "switch" : "if"}; ${this.sptr}-${this.eptr}`;
}
}
)(this.program, this, this.cpo.ptr)),
"‽": () => this.addPtr(new (
class extends Pointer {
init() {
this.level = this.p.ptrs.length-2;
this.obj = this.p.pop();
this.p.setSup(this.level, this.obj);
this.switch = this.branches[0].c === "]";
if (this.switch) {
this.branchf(0);
} else if(truthy(this.obj)) this.finished = true;
}
branchf (ending) {
if (ending%2 === 0 || ending === this.endpts.length-1) this.p.push(new Break(1));
this.branch(ending);
}
continue(ending) {
ending = ending.index;
if (ending%2 === 1 || ending === this.endpts.length-1) this.break();
else {
let results = this.p.collectToArray();
if (results.some(c=>equal(c, this.obj))) this.branchf(ending+1);
else this.branchf(ending+2);
//else if (ending == this.endpts.length-3) branchf(ending+2);
}
}
toString() {
return `@${this.ptr} ${this.switch? "switch" : "if not"}; ${this.sptr}-${this.eptr}`;
}
}
)(this.program, this, this.cpo.ptr)),
"ω": () => push(this.lastArgs.slice(-1)[0]),
"α": () => push(this.lastArgs.slice(-2)[0]),
"g": () => push(this.remainders.slice(-2)[0]),
"⁰": () => {
let utype = type(get(1));
let res = [];
while (type(get(1)) === utype && this.stack.length > 0) {
res.splice(0, 0, pop());
}
push(res);
},
"(": () => push(new Break(0)),
"#": () => {
let I = $('#inputs')[0].value;
let P = $('#program')[0].value;
let E = eval;
let p = new (class{
get p() { return pop(); }
get f() { program.focus(); }
get F() { $('#inputs')[0].focus(); }
});
let res = eval(this.pop());
if (res !== undefined) this.push(res);
},
"}": () => {},
"]": () => {},
"w": () => {this.vars.y = get();}
};
// simple functions
let simpleBuiltins = {
// math
"+": {
NN: (a, b) => a.plus(b),
SS: (a, b) => a+b,
NS: (a, b) => a+b,
SN: (a, b) => a+b,
tt: (a, b) => a.appendHorizontally(b),
// default: (a, b) => (isArr(a)? a : [a]).concat(b),
},
"∔": {
NN: (a, b) => b.subtract(a),
AA: (a, b) => a.concat(b),
AS: (a, s) => (a.push(s), a),
SA: (s, a) => (a.splice(0, 0, s), a),
aa: (a, b) => a.appendVertically(b),
AN: (a, b) => (a.push(b), a),
NA: (a, b) => (b.splice(0, 0, a), b),
},
"-": {
NN: (a, b) => a.minus(b),
AA: (a, b) => b.concat(a),
aa: (a, b) => b.appendVertically(a),
},
"×": {
NN: (a, b) => a.multiply(b),
SS: (a, b) => b+a,
SN: (s, n) => s.repeat(n),
NS: (n, s, ex) => ex("SN", s,n),
AN: (a, n, ex) => {
if (a.some(c=>!isStr(c))) ex("aN");
let max = 0;
for (let {length} of a) max = Math.max(max, length);
return a.map(ln => (ln+" ".repeat(max-ln.length)).repeat(n.intValue()))
},
NA: (n, a, ex) => ex("AN", a, n),
aN: (a, n) => {
let na = this.blank;
for (let i = 0; i < n; i++) {
na.appendHorizontally(a);
}
return na;
},
Na: (n, a, ex) => ex("aN", a, n),
aa: (a, b) => b.appendHorizontally(a),
},
"*": {
SS: (a, b) => [...a].join(b),
AS: (a, s) => a.join(s),
SA: (s, a) => a.join(s),
aS: (a, s) => a.toString().split('\n').map(ln=>[...ln].join(s)),
Sa: (s, a) => a.toString().split('\n').map(ln=>[...ln].join(s)),
SN: (s, n) => new Array(+n).fill(s),
NS: (n, s, ex) => ex("SN", s, n),
AN: (a, n) => new Array(n*a.length).fill(0).map((_,i)=>a[i%a.length]),
NA: (n, a, ex) => ex("AN", a, n),
aN: (a, n) => {
let na = this.blank;
for (let i = 0; i < n; i++) {
na.appendVertically(a);
}
return na;
},
Na: (n, a, ex) => ex("aN", a, n),
aNN: (a, w, h) => {
let na = this.blank;
a.forEach((chr, x, y) => {
for (let xp = 0; xp < w; xp++)
for (let yp = 0; yp < h; yp++)
na.set(x*w + xp, y*h + yp, chr);
});
return na;
},
},
"÷" : (a,b) => b.eq(0)? a : a.divide(b),
"%": (a,b) => a.remainder(b).plus(b).remainder(b),
"√": (a) => a.sqrt(),
"^": (a, b) => a.pow(b.floatValue()),
"<": (a, b) => +a.lt(b),
">": (a, b) => +a.gt(b),
"≡": (a, b) => + equal(a,b),
"≠": (a, b) => +!equal(a,b),
"┬": (a, b) => {
const res = [];
if (b.eq(1)) return new Array(+a).fill(Big.ONE);
while (!a.eq(0)) {
res.push(a.mod(b));
a = a.divide(b).round(0, Big.ROUND_FLOOR);
}
return res.length? res.reverse() : [Big.ZERO];
},
"┴": {
AN: (a, b) => a.reduce((crnt,dig)=>crnt.mul(b).add(dig), Big.ZERO),
NA: (b, a, ex) => ex("AN", a, b),
},
// array & ascii-art manipulation
"∑": {
A: (a) => {
const checkIsNums = (a) => isArr(a) ? a.every(checkIsNums) : isNum(a);
let reduceType;
if (checkIsNums(a)) reduceType = (a,b) => a.plus(b);
else reduceType = (a,b) => a+""+b;
const sumArr = (a) => a.map(c => isArr(c) ? sumArr(c) : c).reduce(reduceType);
return sumArr(a);
}
},
"@": {
AN: (a, n) => a[((n.intValue()-1)%a.length+a.length)%a.length],
NA: (n, a, ex) => ex("AN", a, n),
NS: (n, s, ex) => ex("AN", s, n),
SN: (s, n, ex) => ex("AN", s, n),
aNN: (a, x, y) => a.getChr(x.intValue()-1, y.intValue()-1),
aNNNN: (a, x, y, w, h) => a.subsection(x.intValue()-1, y.intValue()-1, x.intValue()-1+w.intValue(), y.intValue()-1+h.intValue()),
},
"±": {
S: (s) => new Canvas(s, this).horizReverse().toString(), // [...s].reduce((a,b)=>b+a)
N: (n) => new Big(0).minus(n),
A: (a) => new Canvas(a, this).horizReverse().toArr(),
a: (a) => a.horizReverse(),
},
"╋": {
SSS: (a,b,c) => a.split(b).join(c),
aaa: (a,b,c) => {
let res = new Canvas(a);
for (let y = a.sy-b.sy; y < a.ey+b.ey; y++) {
for (let x = a.sx-b.sx; x < a.ex+b.ex; x++) {
if (equal(a.subsection(x, y, x+b.width, y+b.height), b)) {
res.overlap(c, x, y);
}
}
}
return res;
},
aaNN: (a, b, x, y) => a.overlap(b, x.minus(1), y.minus(1), smartOverlap),
length: 4,
default: (a, b, c, d, ex) => ex("aaNN", ...this.orderAs("aaNN", a, b, c, d)),
},
"╋╋": {
aaNN: (a, b, x, y) => a.overlap(b, x.minus(1), y.minus(1), simpleOverlap),
length: 4,
default: (a, b, c, d, ex) => ex("aaNN", ...this.orderAs("aaNN", a, b, c, d)),
},
"⇵": {
N: (n) => {var a=n.divideAndRemainder(2); remainders.push(a[1]); return a[0].plus(a[1])},
A: (a) => a.reverse(),
a: (a) => a.vertReverse(),
},
"↔": {
a: (a) => a.horizMirror(),
},
"↕": {
a: (a) => a.vertMirrorSmart(smartOverlapBehind),
N: (n) => {let a=n.divideAndRemainder(2); remainders.push(a[1]); return a[0].add(1)},
},
"m": {
SN: (s, n) => s.repeat(Math.ceil(n/s.length)).substring(0, +n),
AN: (a, n) => new Array(+n).fill().map((_,i) => a[i%a.length]),
aN: (a, n) => a.repeatingSubsection(+n, a.repr.length),
NS: (n, s, ex) => ex("SN", s, n),
NA: (n, a, ex) => ex("AN", a, n),
Na: (n, a, ex) => ex("aN", a, n),
NN: (a, b) => a.gt(b)? b : a,
},
"M": {
NN: (a, b) => a.gt(b)? a : b,
},
"n": {
AN: (a, n) => {
// n = n.intValue();
const out = [];
let curr = [];
for (let i = 0; i < a.length; i++) {
if (i%n === 0 && i !== 0) {
out.push(curr);
curr = [];
}
curr.push(a[i]);
}
if (curr.length > 0) out.push(curr);
return out;
},
NA: (n, a, ex) => ex("AN", a, n),
SN: (s, n, ex) => ex("AN", [...s], n).map(c => c.join("")),
NS: (n, s, ex) => ex("SN", s, n),
aa: (a, b) => a.overlap(b, 0, 0, smartOverlap),
NN: (a, b) => {push(...a.divideAndRemainder(b));},
},
"⤢": {
// TODO: A:
a: (a) => a.rotate(1).horizReverse(),
N: (n) => n.abs(),
},
"j": {
_A: (a) => {a.splice(0, 1)},
S: (s) => s.slice(1),
a: (a) => (a.repr.splice(0, 1), a.ey--, a),
},
"k": {
_A: (a) => {a.pop()},
S: (s) => s.slice(0, -1),
a: (a) => (a.repr.pop(), a.ey--, a),
},
"J": {
_A: (a) => (a.splice(0, 1)[0]),
S: (s) => {
var res = s.slice(0, 1);
push(s.slice(1));
push(...res);
},
a: (a) => {
let i = a.subsection(-a.sx,-a.sy,a.width-a.sx,1-a.sy);
a.repr.shift();
a.ey--;
push(a);
push(i.toString());
},
},
"K": {
_A: (a) => (a.pop()),
S: (s) => {
var res = s.slice(-1);
push(s.slice(0, -1));
push(res);
},
a: (a) => {
let i = a.subsection(-a.sx,a.height-1-a.sy,a.width-a.sx,a.height-a.sy).toString();
a.repr.pop();
a.ey--;
push(a);
push(i);
},
},
"D": { // TODO strings
A: (a) => {
let out = [];
for (let item of a) {
if (out.every((c) => !equal(c, item))) out.push(item);
}
return out;
},
},
"e": {
aa: (a, s) => s.copy().appendHorizontally(a).appendHorizontally(s),
},
"‼": {
N: (n) => +!n.eq(0),
S: (s) => +(s.length !== 0),
a: (a) => new Canvas(a.repr, this),
},
"!": {
N: (n) => +n.eq(0),
S: (s) => +(s.length === 0),
a: (a) => a.rotate(3).horizReverse(),
},
// string manipulation
"S": {
S: (s) => s.split(" "),
},
"s": {
SS: (a, b) => a.split(b),
SN: (a, b) => a.split(b),
},
"c": {
N: (n) => String.fromCodePoint(n),
S: (s) => s.length===1? s.charCodeAt(0) : [...s].map(chr=>chr.charCodeAt(0)),
a: (a) => a.repr.map(ln=>ln.map(chr=>chr? chr.charCodeAt(0) : 0)),
},
// "f": {
// TTT: (s, o, r) {
// function vreplace(s, o, r) {
//
// }
// vreplace(s, o, r);
// },
// },
//palindromizators
"─": {
a: (a) => a.palindromize(V, smartOverlapBehind, 1, smartOverlap),
},
"──": {
a: (a) => a.palindromize(V, "reverse", 1, simpleOverlap),
},
"═": {
a: (a) => a.palindromize(V, smartOverlapBehind, 0, smartOverlap),
},
"══": {
a: (a) => a.palindromize(V, "reverse", 0, simpleOverlap),
},
"│": {
a: (a) => a.palindromize(H, "mirror", 1, smartOverlap),
},
"││": {
a: (a) => a.palindromize(H, "reverse", 1, simpleOverlap),
},
"║": {
a: (a) => a.palindromize(H, "mirror", 0, smartOverlap),
},
"║║": {
a: (a) => a.palindromize(H, "reverse", 0, simpleOverlap),
},
"┼": {
a: (a) => a.palindromize(H, "mirror", 1, smartOverlap, V, smartOverlapBehind, 1, smartOverlap),
},
"┼┼": {
a: (a) => a.palindromize(H, "reverse", 1, simpleOverlap, V, "reverse", 1, simpleOverlap),
},
"╫": {
a: (a) => a.palindromize(H, "mirror", 0, smartOverlap, V, smartOverlapBehind, 1, smartOverlap),
},
"╫╫": {
a: (a) => a.palindromize(H, "reverse", 0, simpleOverlap, V, "reverse", 1, simpleOverlap),
},
"╪": {
a: (a) => a.palindromize(H, "mirror", 1, smartOverlap, V, smartOverlapBehind, 0, smartOverlap),
},
"╪╪": {
a: (a) => a.palindromize(H, "reverse", 1, simpleOverlap, V, "reverse", 0, simpleOverlap),
},
"╬": {
a: (a) => a.palindromize(H, "mirror", 0, smartOverlap, V, smartOverlapBehind, 0, smartOverlap),
},
"╬╬": {
a: (a) => a.palindromize(H, "reverse", 0, simpleOverlap, V, "reverse", 0, simpleOverlap),
},
// "╬│": {
// a: (a) => a.palindromize(H, "mirror", getRemainder(0), smartOverlap, V, smartOverlapBehind, 0, smartOverlap),
// },
"╬┼": {
a: (a) => a.palindromize(H, "mirror", getRemainder(1), smartOverlap, V, smartOverlapBehind, getRemainder(0), smartOverlap)
},
"┼╬": {
a: (a) => a.palindromize(H, "mirror", getRemainder(0), smartOverlap, V, smartOverlapBehind, getRemainder(1), smartOverlap)
},
"║│": {
a: (a) => remainderPalindromize(a, 2,null),
},
"═─": {
a: (a) => remainderPalindromize(a, null,2),
},
"╬─": {
a: (a) => remainderPalindromize(a, 0,2),
},
"╪─": {
a: (a) => remainderPalindromize(a, 1,2),
},
"╬│": {
a: (a) => remainderPalindromize(a, 2,0),
},
"╫│": {
a: (a) => remainderPalindromize(a, 2,1),
},
// rotators
"⟳": {
a: (a) => a.rotate(1),
aN: (a, n) => a.rotate(n),
},
"↶": {
a: (a) => a.rotate(-1, smartRotate),
aN: (a, n) => a.rotate(-n, smartRotate),
},
"↷": {
a: (a) => a.rotate(1, smartRotate),
aN: (a, n) => a.rotate(n, smartRotate),
},
// useful shorter math stuff
"«": {
N: (n) => n.multiply(2),
S: (s) => s.substring(1)+s.charAt(0),
A: (a) => a.slice(1).concat(a[0]),
a: (a) => a.subsection(1, 0).appendHorizontally(a.subsection(0, 0, 1)),
},
"»": {
N: (n) => {var a=n.divideAndRemainder(2); remainders.push(a[1]); return a[0]},
S: (s) => s.slice(-1).concat(s.slice(0,-1)),
A: (a) => a.slice(-1)+a.slice(0,-1),
a: (a) => a.subsection(-1, 0).appendHorizontally(a.subsection(0, 0, -1)),
},
"╵": {
N: (n) => n.plus(1),
S: (s) => s.replace(/(^\s*|[.?!]\s*)(\w)/g, (a,b,c)=>b+c.toUpperCase()),
A: "vectorize",
},
"╷": {
N: (n) => n.minus(1),
S: (s) => s.replace(/(^|\W)(\w)/g, (a,b,c)=>b+c.toUpperCase()),
A: "vectorize",
},
"├": {
N: (n) => n.plus(2),
S: (s) => s.replace(/([^\w_]*)(\w)/, (a,b,c)=>b+c.toUpperCase()),
A: "vectorize",
},
"┤": {
N: (n) => n.minus(2),
S: (s) => new Big(s),
A: (a) => {
for (let item of a) push(item);
},
},
"½": {
N: (n) => n.divide(2),
A: "vectorize",
},
// stack manipulation
")": this.collectToArray.bind(this),
";": (a,b) => {push(b); push(a)},
":": () => {push(get(1));},
"⌐": () => {push(get(1)); push(get(1))},
"┌": () => (push(get(2))),
"┐": (_) => {},
"└": (a, b, c) => {push(b); push(a); push(c)},
"┘": (a, b, c) => {push(b); push(c); push(a)},
// generators
"∙": () => {
if (stringChars.includes(this.program[this.cpo.ptr-1]) ^ stringChars.includes(this.program[this.cpo.ptr+1])) return " ";
},
"r": {
N: (a) => lrange(a),
aS: (a, S) => (a.background=S, a),
a: (a) => {
const res = this.blank;
let longest = 0;
let start = Infinity;
for (let y = a.sy; y < a.ey; y++) {
const ln = a.trimmedLine(y);
if (ln.length > longest) longest = ln.length;
const s = a.repr[y - a.sy];
let st = 0;
while (st < s.length && s[st] === undefined) st++;
if (start > st) start = st;
}
for (let y = a.sy; y < a.ey; y++) {
const ln = a.trimmedLine(y);
for (let x = 0; x < ln.length; x++) {
res.set(Math.floor((longest-ln.length)/2)+x, y, ln[x]);
}
}
return res;
},
},
"R": {
N: (a) => urange(a),
S: (s) => {this.background = s},
},
"╶": this.nextInp.bind(this),
"╴": () => currInp(),
"A": () => 10,
"ø": () => this.blank,
"z": () => "abcdefghijklmnopqrstuvwxyz",
"Z": () => "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"◂": () => "0123456789",
"◂◂": () => ["1234567890","qwertyuiop","asdfghjkl","zxcvbnm"],
"C": () => " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
"\": {
S: (s) => {
const res = this.blank;
// new Canvas(Array.from(s).map((c, i) => " ".repeat(s.length-i-1)+c), this),
for (let i = 0; i < s.length; i++) res.set(i, i, s[i]);
return res;
},
a: (a) => {
const res = this.blank;
a.forEachChar((chr, x, y) => res.set(x+y, y, chr));
return res;
},
N: (n, ex) => ex("S", "\\".repeat(n)),
},
"/": {
S: (s) => {
const res = this.blank;
// new Canvas(Array.from(s).map((c, i) => " ".repeat(s.length-i-1)+c), this),
for (let i = 0; i < s.length; i++) res.set(s.length-i-1, i, s[i]);
return res;
},
a: (a) => {
const res = this.blank;
a.forEachChar((chr, x, y) => res.set(x-y-1+a.height, y, chr));
return res;
},
N: (n, ex) => ex("S", "/".repeat(n)),
},
"l": {
_S: (a) => a.length,
_A: (a) => a.length,
_N: (a) => a.toString().length,
_a: (a) => a.height,
},
"L": {
S: (a) => a.length,
A: (a) => a.length,
N: (a) => a.toString().length,
_a: (a) => a.width,
},
//variables
"x": () => this.vars.x,
"y": () => this.vars.y,
"X": (a) => {this.vars.x = a},
"Y": (a) => {this.vars.y = a},
"V": () => {
if (this.vars.x === undefined) this.vars.x = new Big(0);
this.vars.x = this.vars.x.plus(1);
},
"v": () => {
// let ToS = get();
if (this.vars.x === undefined) this.vars.x = Big.ZERO; // isNum(ToS)? new Big(0) : isStr(ToS)? "" : isArt(ToS);
if (isNum(this.vars.x)) push(this.vars.x = this.vars.x.plus(1));
else if (isArr(this.vars.x)) this.vars.x.push(pop());
else if (isArt(this.vars.x)) this.vars.x.appendVertically(new Canvas(pop()));
else this.vars.x+= pop();
},
// outputting
"O": () => this.outputFS(true, true, false),
"o": () => this.outputFS(true, false, false),
"T": () => this.outputFS(false, true, true),
"t": () => this.outputFS(false, false, true),
"Q": () => this.outputFS(false, true, false),
"q": () => this.outputFS(false, false, false),
"P": () => this.outputFS(true, true, true),
"p": () => this.outputFS(true, false, true),
"E": code => this.executeHere(code),
"U": {
A: "vectorize",
S: (a) => a.toUpperCase(),
N: (a) => a.round(0, Big.ROUND_CEILING),
},
"u": {
A: "vectorize",
S: (a) => a.toLowerCase(),
N: (a) => a.round(0, Big.ROUND_FLOOR),
},
"raw": (a) => arrRepr(a),
};
// number built-ins
for (let i = 0; i < 10; i++)
simpleBuiltins["0123456789"[i]] = () => new Big(i);
// superscript built-ins
for (let i = 0; i < 9; i++) {
this.builtins["¹²³⁴⁵⁶⁷⁸⁹"[i]] = () => {
if (isFn(this.supVals[i])) this.executeHere(this.supVals[i]());
else push(this.supVals[i]);
};
}
// simple built-ins
function exfn(fn, types = new Array(fn.length).fill("T"), body) {
if (!isFn(fn)) {
throw new Error("exfn called with non-function");
}
let depth = 1;
let args = new Array(types.length);
for (let i = types.length-1; i >= 0; i--) {
let p = types[i];
let c;
if (p[0]==="_") c = get(depth++);
else c = pop(depth);
args[i] = cast(c, p[p.length-1]);
}
lastArgs.push(...args.map(copy));
let res = fn(...args, (type, ...args) => body[type](...args));
if (isJSNum(res)) res = new Big(res);
if (res !== undefined) push(res);
}
for (let builtin in simpleBuiltins) {
let obj = simpleBuiltins[builtin];
this.builtins[builtin] = function () {
if (isFn(obj)) {
return exfn(obj);
}
let len = Object.keys(obj).map(c => c==="default"? 0 : c.length).reduce((a, b)=>Math.max(a,b));
let pattern = "";
for (let i = len; i >= 1; i--) {
pattern+= type(get(i));
}
let foundKey;
function regexify(ptn) {
return new RegExp(ptn
.replace(/a/g , "[aAS]")
.replace(/[tT]/g, "[aASN]")
.replace(/s/g , "[SN]")
.replace(/_/g , "")
+"$");
}
for (let key in obj) {
if (regexify(key).test(pattern)) {
foundKey = key;
break;
}
}
let sub;
if (foundKey) {
sub = obj[foundKey];
if (debug > 1) console.log("found key "+foundKey+" for "+pattern);
} else {
sub = obj.default;
if (!sub) throw new Error(`key not found and there's no default for ${builtin} on ${pattern}`);
exfn(sub, new Array(obj.length).fill("T"), obj);
return;
}
if (isFn(sub)) {
exfn(sub, [...foundKey.replace(/[^_]/g, "$&;").split(";").slice(0, -1)], obj);
// .replace(/[^_]/g, "1").replace(/_1/g, "0")].map(c=>parseInt(c)));
} else if (sub === "vectorize") {
function rec(arr) {
return arr.map( c => {
if (isArr(c)) return rec(c);
let t = type(c);
let found = Object.keys(obj).find(k => regexify(k).test(t));
if (!found) throw new Error(`Type ${t} not defined for ${builtin}`);
return obj[found](c);
});
}
push(rec(pop()));
} else throw new Error("sub wasn't a function or vectorization request");
}.bind(this)
}
// fix quotes & prepended with `{`s if needed
this.functions = wholeProgram.split("\n").map((pr) => {
var ctr = 0;
pr = pr
.replace(/([”‟„]|^)([^“”‟„\n]*)(?=[”‟„])/g, "$1“$2")
.replace(/“[^“”‟„\n]*$/, "$&”");
while (this.endPt(-1, true, false, pr) !== undefined && (!debug || (ctr++) <= 100)) pr = "{"+pr;
if (ctr>=100 && debug) console.warn("couldn't fix braces after 100 iterations!");
return pr;
});
// last sups are the program lines
for (let i = 0; i < this.functions.length; i++) {
this.setSup(9-this.functions.length+i, () => this.functions[i]);
}
// remaining last sups are the inputs
for (let i = 0; i < Math.min(inputs.length, 9); i++) {
this.setSup(8-this.functions.length-i,this.inputs[i]);
}
}
async run (debug = 0, step = false, sleepUpdate = true) {
if (running) throw new Error("already running!");
else running = true;
this.sleepUpdate = sleepUpdate;
this.debug = debug;
this.step = step;
if (!module) result.placeholder="Running...";
var main = this.functions[this.functions.length-1];
this.ptrs.push(new (
class extends Pointer {
toDebug () { return `@${this.ptr}: main program`; }
}
)(main, this, -1, main.length));
var counter = 0;
try {
while (this.ptrs.length > 0) {
if (sleepUpdate && counter%100 === 0) await sleep(0);
counter++;
await this.cpo.next();
if (!running) break;
}
if (this.implicitOut) this.outputFS(false, true, false);
if (!module) {
result.placeholder=running? "No output was returned" : "No output on premature stop";
result.value = this.printableOut;
}
} catch (e) {
console.error(e);
if (!module) result.placeholder = "The interpreter errored during the execution";
if (!stepping && devMode && this.cpo) {
enterStepping();
await redrawDebug(this.cpo.ptr, this.endPt(this.cpo.ptr), this);
stopStepping();
}
}
running = false;
if (stepping) stopStepping();
return this.printableOut;
}
setSup (i, v) {
if (i>8 || i < 0) return;
if (isJSNum(v)) v = new Big(v);
this.supVals[i] = v;
}
addPtr(ptr) {
this.ptrs.push(ptr);
ptr.init();
}
get blank() {
return new Canvas(undefined, this);
}
remainderPalindromize (canvas, x, y) {
var xa = [], ya = [];
if (x!==null) xa = [H, "mirror", x===2? this.getRemainder(0) : x, smartOverlap];
if (y!==null) ya = [V, smartOverlapBehind, y===2? this.getRemainder(0) : y, smartOverlap];
return canvas.palindromize(...xa, ...ya);
}
// output with 2 trailing and leading newlines removed
get printableOut() {
return this.output.replace(/^\n{0,2}|\n{0,2}$/g,"");
}
getRemainder (ift = 1) {
return this.remainders[this.remainders.length-1 - (ift%this.remainders.length)];
}
get cpo() {
return this.ptrs[this.ptrs.length-1];
}
get program() {
return this.cpo.program;
}
endPt (sindex, undefinedOnProgramEnd = false, allEnds = false, program = this.program) {
var ind = sindex;
var ends = [];
var bstk = [{ c:program[ind], s:0 }];
var lvl = 1;
while (lvl > 0) {
ind = this.nextIns(ind, program);
if ("[{H?‽W".includes(program[ind])) {
bstk.push({ c:program[ind], s:0 });
lvl++;
}
let echr = program[ind];
if (echr === "}" || echr === "]") {
let back = false;
let br = bstk[bstk.length-1];
switch (br.c) {
case "[":
case "{":
back = true;
break;
case "‽":
if (br.s === 0) {
if (echr === "}") back = true;
else br.s = 2; // case value named
} else if (br.s === 2) { // action end; case value named
if (echr === "}") br.s = 1; // case action defined
else back = true; // `]]` means no default case
} else if (br.s === 1) { // case action defined
if (echr === "}") back = true;
else br.s = 2;
}
break;
case "?":
if (echr === "}") back = true;
break;
default:
back = true;
}
if (lvl === 1) ends.push({i:ind, c:echr});
if (back) {
lvl--;
bstk.pop();
}
}
if (lvl > 0 && ind >= program.length) return allEnds? (ends.push({i:ind, c:"}"}), ends) : undefinedOnProgramEnd? undefined : program.length;
}
return allEnds? ends : ind;
}
nextIns (index, program = this.program) {
if (stringChars.includes(program[index])) {
while (stringChars.includes(program[index+1])) index++;
return index+1;
}
if (program[index] === "‾") return index+2;
if (program[index] === '“') {
while (index < program.length && !'“„”‟'.includes(program[index+1])) index++;
return index+2;
}
let multibyte = Object.keys(this.builtins).filter(c => c.length>1).find(key =>
[...key].every((char,i)=>
program[index+i] === char
) // && this.builtins[key].length > 0
// && this.builtins[key](2)
);
if (multibyte) {
return index+multibyte.length;
}
return index+1;
}
break(newPtr, who) {
if (debug > 1) debugLog(`break from ${this.ptrs.length} to ${newPtr}`);
var ptr = this.ptrs.indexOf(who);
this.ptrs.splice(ptr, 1);
// if (debug > 1 && who !== ptr) console.warn("break who != last ptr");
if (this.ptrs.length === 0) return;
if (who.inParent && ptr != 0) this.ptrs[ptr-1].update(newPtr);
}
executeHere (newPr) {
newPr = newPr+"";
this.addPtr(new (
class extends Pointer {
init() { this.inParent = false; }
toDebug () { return `@${this.ptr}: helper function`; }
}
)(newPr, this, -1, newPr.length));
}
outputFS (shouldPop, newline, noImpOut) { // output from stack
let item;
if (shouldPop) item = this.pop();
else item = this.get();
if (noImpOut) this.implicitOut = false;
if (newline) this.println(item);
else this.print(item);
}
print (what) {
this.output+= strRepr(what);
}
println (what) {
this.output+= "\n"+strRepr(what);
}
currInp (next) {
if (!next) next = 0;
return copy(this.inputs[(this.inpCtr+next-1)%this.inputs.length]);
}
nextInp() {
let out = this.currInp(1);
this.inpCtr++;
this.inpCtr%= this.inputs.length;
return out;
}
get(ift = 1) { // item from top; 1 = top, 2 = 2nd from top, ect.
let ptr = this.stack.length;
while (ptr > 0 && ift !== 0) {
ptr--;
if (!(this.stack[ptr] instanceof Break)) ift--;
}
if (ift === 0) return this.stack[ptr];
return this.currInp(ift);
}
pop(ift = 1) { // item from top; 1 = top, 2 = 2nd from top, ect.
// var ptr = stack.length-1;
// while (ptr >= 0) {
// if (!(stack[ptr] instanceof Break)) return stack.splice(ptr,1)[0];
// ptr--;
// }
// return nextInp();
let item = this.get(ift);
this.remove(ift);
return item;
}
remove(ift = 1) {
let ptr = this.stack.length;
while (ptr > 0 && ift > 0) {
ptr--;
if (!(this.stack[ptr] instanceof Break)) ift--;
}
while (ift > 0) {
this.stack.splice(0, 0, this.nextInp());
ift--;
}
return this.stack.splice(ptr,1)[0];
}
push (...item) {
this.stack.push(...item.map(c=>
isStr(c) && c.includes("\n")?
new Canvas(c, this) : copy(c, this)
)
);
}
collectToArray() {
const collected = [];
while (this.stack.length > 0 && !(this.stack[this.stack.length-1] instanceof Break)) {
collected.splice(0, 0, this.stack.pop());
}
this.stack.pop();
return collected;
}
orderAs (order, ...params) {
let ppt = params.map((c) => [c, type(c)]); //params plus type
for (let i = 0; i < ppt.length; i++) {
let curType = ppt[1];
let resType = order[i];
if (!subType(curType, resType)) {
let index = i + ppt.slice(i).findIndex(c=>subType(c[1], resType));
ppt.splice(i,0,ppt.splice(index,1)[0]);
}
}
return ppt.map((c, i) => this.cast(c[0], order[i]))
}
cast (item, rt, p) {
if (type(item) === rt || rt === "T") return item;
if (rt === 'N') return new Big(item.toString().replace(",","."));
if (rt === 'a' || rt === 't') return new Canvas(item, this);
if (rt === 'S' || rt === 's') return rt.toString();
throw new Error(`cast error from ${type(item)} to ${rt}: ${item} (probably casting to array which is strange & unsupported)`);
}
prepareStr (str) {
return str.replace(/ŗ/g, () => this.pop());
}
} // END OF CanvasCode
function copy (item) {
if (isArr(item)) return item.map((c) => copy(c));
if (isArt(item)) return new Canvas(item);
if (isNum(item) || isJSNum(item)) return new Big(item);
return item;
}
function equal(a, b) {
if (type(a)!==type(b)) return false;
if (isArr(a)) return a.length === b.length && a.every((c,i) => equal(c, b[i]));
if (isNum(a)) return a.eq(b);
if (isJSNum(a)) return new Big(a).eq(b);
if (isStr(a)) return a===b;
if (isArt(a)) return equal(a.stringForm(), b.stringForm());
throw new Error("no eq test for "+a+";"+b);
}
function subType (a, b) { // is `a` a subtype of `b`?
if (a===b) return true;
if (b==="a" && "AS".includes(a)) return true;
return false;
}
function irange (s, e) {//inclusive range
const out = [];
for (let b = new Big(s); b.lte(e); b = b.plus(1)) {
out.push(b);
}
return out;
}
function urange (e) { // upper range - range [1; arg]
return irange(1, e);
}
function lrange (e) { // lower range - range [1; arg]
return irange(0, e.minus(1));
}
function B (what) {
if (!Number.isFinite(what)) return what;
return new Big(what);
}
//https://stackoverflow.com/a/39914235/7528415
async function sleep (ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function isArr (item) {
return item instanceof Array;
}
function isArt (item) {
return item instanceof Canvas;
}
function isStr (item) {
return typeof item === "string";
}
function isNum (item) {
return item instanceof Big;
}
function isJSNum (item) {
return typeof item === "number";
}
function isFn (item) {
return item instanceof Function
}
function type (item) {
if (isArt(item)) return "a";
if (isArr(item)) return "A";
if (isStr(item)) return "S";
if (isNum(item)) return "N";
}
function strRepr (item) {
if (isArr(item)) return item.map(join).join("\n");
else return item.toString();
}
function arrRepr (item) {
if (item === undefined) return "---";
if (isArr(item)) return `[${item.map(arrRepr).join(", ")}]`;
if (isArt(item)) return quotify(item, "`");
if (isStr(item)) return quotify(item, `"`);
if (isNum(item)) return item+"";
return item.toString();
}
function quotify (what, qt) {
if (isArt(what)) what = what.toDebugString();
else what = what.toString();
const ml = what.includes("\n");
return (qt+qt+qt+"\n").slice(0, ml? 4 : 1) + what + ("\n"+qt+qt+qt).slice(ml? 0 : 3)
}
function bigify (item) {
const out = [];
for (citem of item) {
if (isArr(citem)) citem = bigify(citem);
if (isJSNum(citem) && Number.isFinite(citem)) citem = new Big(citem);
out.push(citem);
}
return out;
}
function truthy (item) {
if (isStr(item)) return item.length > 0;
if (isArr(item)) return item.length > 0;
if (isNum(item)) return !item.eq(0);
if (isArt(item)) return item.width>0 && item.height>0;
return !!item;
}
function falsy (item) {
return !truthy(item);
}
function join (item) {
if (isArr(item)) return item.map(join).join("");
else return item.toString();
}
function flatten (arr) {
return arr.map((ca) => isArr(ca)? flatten(ca) : [ca]).reduce((a,b) => a.concat(b))
}
function errorLN (e) {
try {
return e.stack.split("\n")[1].match(/\d+/g).slice(-2,-1).shift();
} catch (e2) {
return "unknown";
}
}
function toBijective (n, b) {
const res = [];
while(n.gt(b)) {
n = n.minus(1);
let [div, mod] = n.divideAndRemainder(b);
n = div;
res.push(mod);
}
if (n>0) res.push(n.minus(1));
return res;
}
function fromBijective (n, b) {
// return n.reverse().reduce((acc,n) => acc*b + n + 1n, 0n)// + b**BigInt(n.length-1);
let res = Big.ZERO;
for (let i = n.length-1; i>=0; i--) {
res = res.mul(b);
res = res.plus(Big.ONE.plus(n[i]));
}
return res;
}
function compressNum(n) {
n = new Big(n);
if (n.lt(compressedNumberStart)) {
let tn = n.intValue();
let c = Object.entries(simpleNumbers).find(c=>c[1]===tn);
if (c) return c[0];
c = Object.entries(shortNumbers).find(c=>c[1]===tn);
if (c) return c[0];
console.warn("< compressed start but not anywhere",n);
} else return `“${toBijective(n.minus(compressedNumberStart), baseChars.length).map(c=>baseChars[c]).join('')}„`;
}
// function prettyError(e) {console.log(e.stack+"!");
// if (window.chrome) {
// try {
// let t=e.stack.split("\n");
// // console[level](t[0]);
// console.groupCollapsed("%c"+t[0]+" @"+t[1].split("main.js:")[1].slice(0,-1), "font-weight:normal;");
// t.slice(1).map(c=> {
// let parts = c.split(/ at | \(eval at success \(.+\), <anonymous>:/);
// console.log(`in ${parts[1]} @${parts[2].slice(0,-1)}`);
// })
// console.groupEnd();
// } catch (well) {
// console.groupEnd();
// console.error(e);
// }
// } else console.error(e);
// }
function bigLog10(big) {
return (big+"").length + Math.log10("0."+big)
}
function compressString(arr) {
compressionParts = [];
class Part {
constructor (type) {
this.type = type;
this.arr = [];
// this.score = Big.ONE;
}
add(n, b) {
// this.score = this.score.mul(b).add(n);
// this.S=+this.score;
// this.L=Math.log(this.S)/Math.log(252);
this.arr.push([n, b]);
}
finish() {
let res = Big.ONE; // Big.ZERO;
for (let i = this.arr.length-1; i >= 0; i--)
res = res.mul(this.arr[i][1]).plus(this.arr[i][0]);
this.score = res;
this.length = bigLog10(this.score)/Math.log10(252);
}
}
// let stack = [new Part()];
let current;
let allparts = [];
function push(n, b) {
if (debugCompression) console.log(n, b);
current.add(n, b);
}
for (let part of arr) {
if (!part) continue;
part = part.replace(/¶/g, "\n");
if (part.length <= 2) {
current = new Part("char");
push(0, compressionModes);
push(part.length-1, 2);
for (let c of part) push(compressionChars.indexOf(c), compressionChars.length);
allparts.push(...current.arr);
if (debugCompression) compressionParts.push([current]);
current.finish();
} else {
let attempts = [];
if (part.length <= 18) {
current = new Part("chars");
if (debugCompression) console.log("trying raw ASCII");
push(1, compressionModes);
push(part.length-3, 16);
for (let c of part) push(compressionChars.indexOf(c), compressionChars.length);
attempts.push(current);
current.finish();
} else {
current = new Part("chars");
if (debugCompression) console.log("trying raw ASCII");
for (let [subpart] of part.matchAll(".{1,18}")) {
if (subpart.length <= 2) {
push(0, compressionModes);
push(subpart.length-1, 2);
for (let c of subpart) push(compressionChars.indexOf(c), compressionChars.length);
} else {
push(1, compressionModes);
push(subpart.length-3, 16);
for (let c of subpart) push(compressionChars.indexOf(c), compressionChars.length);
}
}
attempts.push(current);
current.finish();
}
let unique = [...part].filter((c,i,a) => a.indexOf(c) === i);
if (unique.length < part.length && unique.every(c=>boxChars.includes(c))) {
let valid = 1;
current = new Part("boxdict");
if (debugCompression) console.log("trying boxdict");
push(3, compressionModes);
for (let c of boxChars)
push(+(unique.includes(c)), 2);
let chars = [...boxChars].filter(c=>unique.includes(c));
let slen = part.length-unique.length-1;
if (slen < 16) {
push(0, 2);
push(slen, 16);
} else {
push(1, 2);
if (slen - 16 >= 128) valid = 0;
push(slen - 16, 128);
}
for (let c of part) push(chars.indexOf(c), chars.length);
if (valid) attempts.push(current);
current.finish();
}
if (unique.length < part.length) { // at least 1 thing is repeating
let valid = 1;
let indexes = unique.map(c=>compressionChars.indexOf(c)).sort((a,b)=>a-b);
let map = indexes.map(c=>compressionChars[c]).reverse();
current = new Part("dict");
if (debugCompression) console.log("trying dict");
push(2, compressionModes);
let curr = -1;
for (let c of indexes) {
push(c-curr-1, compressionChars.length - curr - (curr===-1));
curr = c;
}
let end = compressionChars.length - curr;
push(end-1, end);
let slen = part.length-unique.length-1;
if (slen < 16) {
push(0, 2);
push(slen, 16);
} else {
push(1, 2);
if (slen - 16 >= 128) valid = 0;
push(slen - 16, 128);
}
for (let c of part) push(map.indexOf(c), map.length);
if (valid) attempts.push(current);
current.finish();
}
let sorted = attempts.sort((a,b)=>a.score.minus(b.score).intValue());
allparts.push(...sorted[0].arr);
if (debugCompression) console.log("possible for part:", sorted);
if (debugCompression) compressionParts.push(sorted);
}
}
let res = Big.ZERO;
let ns = allparts;
if (debugCompression) {
let p = new Part();
p.arr = allparts;
p.finish();
compressionParts.push(p);
}
for (let i = ns.length-1; i>= 0; i--) res = res.mul(ns[i][1]).add(ns[i][0]);
return '“' + toBijective(res, baseChars.length).map(c=>baseChars[c]).join('') + '‟';
}
if (module) {
module.exports = {
CanvasCode: CanvasCode,
Canvas: Canvas,
run: run
};
} | 32.572636 | 273 | 0.4795 |
8d22fa69b1299e633932734f683564dcfe685681 | 1,778 | js | JavaScript | tocs/front-end/src/components/registration/ManageStaffAssignment.js | camyhsu/TO-Chinese-School-2020 | 532a5f81f643d5da83ca4673ff0fd40daf748840 | [
"MIT"
] | 1 | 2022-02-14T14:50:30.000Z | 2022-02-14T14:50:30.000Z | tocs/front-end/src/components/registration/ManageStaffAssignment.js | camyhsu/TO-Chinese-School-2020 | 532a5f81f643d5da83ca4673ff0fd40daf748840 | [
"MIT"
] | 8 | 2020-01-24T03:38:29.000Z | 2022-03-30T03:38:21.000Z | tocs/front-end/src/components/registration/ManageStaffAssignment.js | camyhsu/TO-Chinese-School-2020 | 532a5f81f643d5da83ca4673ff0fd40daf748840 | [
"MIT"
] | 3 | 2020-01-24T02:32:26.000Z | 2021-02-09T08:20:58.000Z | import React, { useState, useEffect } from "react";
import Table from "../Table";
import queryString from "query-string";
import RegistrationService from "../../services/registration.service";
import { formatPersonNames } from "../../utils/utilities";
import { Card, CardBody, CardTitle } from "../Cards";
const ManageStaffAssignment = ({ location } = {}) => {
const [content, setContent] = useState({
error: null,
isLoaded: false,
items: [],
});
const header = [
{
title: "Name",
cell: (row) => {
return formatPersonNames({
chineseName: row.person.chineseName,
firstName: row.person.firstName,
lastName: row.person.lastName,
});
},
},
{ title: "Role", prop: "role" },
{ title: "Start Date", prop: "startDate" },
{ title: "End Date", prop: "endDate" },
];
useEffect(() => {
document.title = "TOCS - Home";
const { id } = queryString.parse(location.search);
if (id) {
RegistrationService.getManageStaffAssignment(id).then((response) => {
if (response && response.data) {
setContent({
isLoaded: true,
items: response.data.staffAssignments,
schoolYear: response.data.schoolYear,
});
}
});
}
}, [location.search]);
return (
<Card size="flex">
<CardBody>
{content.schoolYear && (
<CardTitle>Staff Assignments for {content.schoolYear.name}</CardTitle>
)}
<Table
header={header}
items={content.items}
isLoaded={content.isLoaded}
error={content.error}
sortKey="id"
showAll="true"
/>
</CardBody>
</Card>
);
};
export default ManageStaffAssignment;
| 26.537313 | 80 | 0.565242 |
8d23690231a31b4a6920d8c3c820f393c58ec77c | 1,052 | js | JavaScript | app/components/LocationCarousel/CarouselEntryMobile.js | Octember/the-approach | 644c761a9b3dac456753c4ddc939a5fc31c927f0 | [
"MIT"
] | null | null | null | app/components/LocationCarousel/CarouselEntryMobile.js | Octember/the-approach | 644c761a9b3dac456753c4ddc939a5fc31c927f0 | [
"MIT"
] | 6 | 2018-01-03T18:35:23.000Z | 2018-03-11T22:44:15.000Z | app/components/LocationCarousel/CarouselEntryMobile.js | Octember/the-approach | 644c761a9b3dac456753c4ddc939a5fc31c927f0 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
const CarouselImage = styled.img `
height: 300px;
object-fit: cover;
`;
const CarouselSpacer = styled.div `
height: 50px;
background-color: black;
`;
const CarouselOverlayFadeDiv = styled.div `
top: 0;
left: 0;
bottom: 0;
background-image: linear-gradient(to bottom,rgba(0,0,0, 0) 40%, rgba(0,0,0,1));
`;
function CarouselEntryMobile(props) {
const className = props.index === 0 ? 'carousel-item active' : 'carousel-item';
return (
<div className={className}>
<div className="position-relative">
<CarouselImage
className="w-100"
src={props.url}
alt="First slide"
/>
<CarouselOverlayFadeDiv className="position-absolute w-100 h-100" />
</div>
<CarouselSpacer className="w-100" />
</div>
);
}
CarouselEntryMobile.propTypes = {
index: PropTypes.number.isRequired,
url: PropTypes.string.isRequired,
};
export default CarouselEntryMobile;
| 22.382979 | 82 | 0.660646 |
8d242137dcb0e26f240e60ea7391f5dd687fd141 | 18,806 | js | JavaScript | public/33.js | magicak/dashboard | f10a4cd5442c68f22be044e149dd4e5c9234432c | [
"MIT"
] | null | null | null | public/33.js | magicak/dashboard | f10a4cd5442c68f22be044e149dd4e5c9234432c | [
"MIT"
] | null | null | null | public/33.js | magicak/dashboard | f10a4cd5442c68f22be044e149dd4e5c9234432c | [
"MIT"
] | null | null | null | (window.webpackJsonp=window.webpackJsonp||[]).push([[33],{1135:function(t,i){t.exports="/images/33.png?691d6235d4fcb3d23625f046278c14bf"},1136:function(t,i){t.exports="/images/booking-03.png?02675779a80f3a7e79e6e5a3d9e0e232"},1138:function(t,i,e){"use strict";var o=e(436);e.n(o).a},1139:function(t,i,e){(i=e(33)(!1)).push([t.i,".iq-card-body{flex:unset}",""]),t.exports=i},1880:function(t,i,e){"use strict";e.r(i);var o=e(16),a=e(184),s=e(220),r={name:"Dashboard1",components:{AmChart:a.default,ApexChart:s.a},mounted:function(){o.c.index()},data:function(){return{items:[{client:"Ira Membrit",date:"18/10/2019",invoice:"20156",amount:"1500",status:{name:"paid",color:"success"},action:"Copy"},{client:"Pete Sariya",date:"26/10/2019",invoice:"7859",amount:"2000",status:{name:"paid",color:"success"},action:"Send email"},{client:"Cliff Hanger",date:"18/11/2019",invoice:"6396",amount:"2500",status:{name:"past due",color:"danger"},action:"Before Date"},{client:"Terry Aki",date:"14/12/2019",invoice:"7854",amount:"5000",status:{name:"paid",color:"success"},action:"Copy"},{client:"Anna Mull",date:"24/12/2019",invoice:"568569",amount:"10000",status:{name:"paid",color:"success"},action:"Send email"}],monthlyInvocie:[{title:"Camelun ios",color:"success",amount:"12,434.00",paid_month:"17",total_month:"23"},{title:"React",color:"warning",amount:"12,434.00",paid_month:"17",total_month:"23"},{title:"Camelun ios",color:"success",amount:"12,434.00",paid_month:"17",total_month:"23"},{title:"Camelun ios",color:"danger",amount:"12,434.00",paid_month:"17",total_month:"23"}],paymentHistory:[{title:"Deposit from ATL",amount:"- 1,470",icon:"ri-refresh-line",color:"secondary",date:"5 march, 18:33",currency:"USD"},{title:"Deposit PayPal",amount:"+ 2,220",icon:"ri-paypal-line",color:"primary",date:"5 march, 18:33",currency:"USD"},{title:"Deposit from ATL",amount:"+ 250",icon:"ri-check-line",color:"primary",date:"5 march, 18:33",currency:"USD"},{title:"Cancelled",amount:"0",icon:"ri-close-line",color:"info",date:"5 march, 18:33",currency:"USD"},{title:"Refund",amount:"- 500",icon:"ri-arrow-go-back-fill",color:"info",date:"5 march, 18:33",currency:"USD"},{title:"Deposit from ATL",amount:"- 1,470",icon:"ri-refresh-line",color:"secondary",date:"5 march, 18:33",currency:"USD"}],chart1:{series:[{name:"Net Profit",data:[44,55,57,56,61,58,63,60,66]},{name:"Revenue",data:[76,85,101,98,87,105,91,114,94]}],chart:{type:"bar",height:350},colors:["#827af3","#6ce6f4"],plotOptions:{bar:{horizontal:!1,columnWidth:"55%",endingShape:"rounded"}},dataLabels:{enabled:!1},stroke:{show:!0,width:2,colors:["transparent"]},xaxis:{categories:["Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct"]},yaxis:{},fill:{opacity:1},tooltip:{y:{formatter:function(t){return"$ "+t+" thousands"}}}},chart2:{series:[{name:"Desktops",data:[5,10,8,15]}],chart:{height:150,type:"line",zoom:{enabled:!1}},colors:["#827af3"],dataLabels:{enabled:!1},stroke:{curve:"straight"},grid:{row:{colors:["#f3f3f3","transparent"],opacity:.5}},xaxis:{categories:["Jan","Feb","Mar","Apr"]}},darkChart2:{series:[{name:"Desktops",data:[5,10,8,15]}],chart:{height:150,type:"line",foreColor:"#8c91b6",zoom:{enabled:!1}},colors:["#827af3"],dataLabels:{enabled:!1},stroke:{curve:"straight"},grid:{row:{colors:["#f3f3f3","transparent"],opacity:.5}},xaxis:{categories:["Jan","Feb","Mar","Apr"]}},chart3:{series:[44,55,13,33],chart:{width:380,height:180,type:"donut"},dataLabels:{enabled:!1},colors:["#827af3","#6ce6f4","#a09e9e","#fbc647"],responsive:[{breakpoint:480,options:{chart:{width:200},legend:{show:!1}}}],legend:{position:"right",offsetY:0,height:150}},darkChart3:{series:[44,55,13,33],chart:{width:380,height:180,foreColor:"#8c91b6",type:"donut"},dataLabels:{enabled:!1},colors:["#827af3","#6ce6f4","#a09e9e","#fbc647"],responsive:[{breakpoint:480,options:{chart:{width:200},legend:{show:!1}}}],legend:{position:"right",offsetY:0,height:150}}}}},n=(e(1138),e(8)),d=Object(n.a)(r,(function(){var t=this,i=t.$createElement,o=t._self._c||i;return o("b-container",{attrs:{fluid:""}},[o("b-row",[o("b-col",{attrs:{md:"3",sm:"6"}},[o("iq-card",{scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"d-flex align-items-center justify-content-between"},[o("h6",[t._v(t._s(t.$t("dashboard1.card1")))]),t._v(" "),o("span",{staticClass:"iq-icon"},[o("i",{staticClass:"ri-information-fill"})])]),t._v(" "),o("div",{staticClass:"iq-customer-box d-flex align-items-center justify-content-between mt-3"},[o("div",{staticClass:"d-flex align-items-center"},[o("div",{staticClass:"rounded-circle iq-card-icon iq-bg-primary mr-2"},[o("i",{staticClass:"ri-inbox-fill"})]),t._v(" "),o("h2",[t._v("352")])]),t._v(" "),o("div",{staticClass:"iq-map text-primary font-size-32"},[o("i",{staticClass:"ri-bar-chart-grouped-line"})])])]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"3",sm:"6"}},[o("iq-card",{scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"d-flex align-items-center justify-content-between"},[o("h6",[t._v(t._s(t.$t("dashboard1.card2")))]),t._v(" "),o("span",{staticClass:"iq-icon"},[o("i",{staticClass:"ri-information-fill"})])]),t._v(" "),o("div",{staticClass:"iq-customer-box d-flex align-items-center justify-content-between mt-3"},[o("div",{staticClass:"d-flex align-items-center"},[o("div",{staticClass:"rounded-circle iq-card-icon iq-bg-danger mr-2"},[o("i",{staticClass:"ri-radar-line"})]),t._v(" "),o("h2",[t._v("$37k")])]),t._v(" "),o("div",{staticClass:"iq-map text-danger font-size-32"},[o("i",{staticClass:"ri-bar-chart-grouped-line"})])])]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"3",sm:"6"}},[o("iq-card",{scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"d-flex align-items-center justify-content-between"},[o("h6",[t._v(t._s(t.$t("dashboard1.card3")))]),t._v(" "),o("span",{staticClass:"iq-icon"},[o("i",{staticClass:"ri-information-fill"})])]),t._v(" "),o("div",{staticClass:"iq-customer-box d-flex align-items-center justify-content-between mt-3"},[o("div",{staticClass:"d-flex align-items-center"},[o("div",{staticClass:"rounded-circle iq-card-icon iq-bg-warning mr-2"},[o("i",{staticClass:"ri-price-tag-3-line"})]),t._v(" "),o("h2",[t._v("32%")])]),t._v(" "),o("div",{staticClass:"iq-map text-warning font-size-32"},[o("i",{staticClass:"ri-bar-chart-grouped-line"})])])]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"3",sm:"6"}},[o("iq-card",{scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"d-flex align-items-center justify-content-between"},[o("h6",[t._v(t._s(t.$t("dashboard1.card4")))]),t._v(" "),o("span",{staticClass:"iq-icon"},[o("i",{staticClass:"ri-information-fill"})])]),t._v(" "),o("div",{staticClass:"iq-customer-box d-flex align-items-center justify-content-between mt-3"},[o("div",{staticClass:"d-flex align-items-center"},[o("div",{staticClass:"rounded-circle iq-card-icon iq-bg-info mr-2"},[o("i",{staticClass:"ri-refund-line"})]),t._v(" "),o("h2",[t._v("27h")])]),t._v(" "),o("div",{staticClass:"iq-map text-info font-size-32"},[o("i",{staticClass:"ri-bar-chart-grouped-line"})])])]},proxy:!0}])})],1)],1),t._v(" "),o("b-row",[o("b-col",{attrs:{md:"7"}},[o("iq-card",{attrs:{"class-name":"overflow-hidden"},scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.invoiceState")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("i",{staticClass:"ri-more-fill"})]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0}])},[t._v(" "),t._v(" "),o("ApexChart",{staticStyle:{"min-height":"350px"},attrs:{element:"home-chart-02",chartOption:t.chart1}})],1)],1),t._v(" "),o("b-col",{attrs:{md:"5"}},[o("div",{staticClass:"iq-card"},[o("div",{staticClass:"iq-card-body p-0"},[o("img",{staticClass:"rounded w-100 img-fluid",attrs:{src:e(1135),alt:"banner-img"}}),t._v(" "),o("div",{staticClass:"iq-caption"},[o("h1",[t._v("450")]),t._v(" "),o("p",[t._v(t._s(t.$t("dashboard1.invoice")))])])])])])],1),t._v(" "),o("b-row",[o("b-col",{attrs:{md:"8"}},[o("iq-card",{scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.openInvoice")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton5",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("b-table",{staticClass:"mb-0 table-borderless",attrs:{responsive:"",items:t.items},scopedSlots:t._u([{key:"cell(status)",fn:function(i){return[o("b-badge",{attrs:{pill:"",variant:i.value.color}},[t._v(t._s(i.value.name))])]}},{key:"cell(amount)",fn:function(i){return[t._v("\n $"+t._s(i.value)+"\n ")]}}])})]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"4"}},[o("iq-card",{scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.monthlyInvoice")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("ul",{staticClass:"suggestions-lists m-0 p-0"},t._l(t.monthlyInvocie,(function(i,e){return o("li",{key:e,staticClass:"d-flex mb-4 align-items-center"},[o("div",{class:"profile-icon iq-bg-"+i.color},[o("span",[o("i",{staticClass:"ri-check-fill"})])]),t._v(" "),o("div",{staticClass:"media-support-info ml-3"},[o("h6",[t._v(t._s(i.title))]),t._v(" "),o("p",{staticClass:"mb-0"},[o("span",{class:"text-"+i.color},[t._v(t._s(i.paid_month)+" paid")]),t._v(" month out of "+t._s(i.total_month))])]),t._v(" "),o("div",{staticClass:"media-support-amount ml-3"},[o("h6",[o("span",{class:"text-"+i.color},[t._v("$")]),o("b",[t._v(" "+t._s(i.amount))])]),t._v(" "),o("p",{staticClass:"mb-0"},[t._v("per month")])])])})),0)]},proxy:!0}])})],1)],1),t._v(" "),o("b-row",[o("b-col",{attrs:{md:"8"}},[o("b-row",[o("b-col",{attrs:{md:"6"}},[o("iq-card",{attrs:{"body-class":"p-0"},scopedSlots:t._u([{key:"body",fn:function(){return[o("b-img",{staticClass:"rounded",attrs:{src:e(1136),alt:"03",fluid:""}})]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"6"}},[o("iq-card",{attrs:{"body-class":"p-0"},scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.exchangeRates")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("ApexChart",{attrs:{element:"home-chart-01",chartOption:t.chart2}})]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"6"}},[o("iq-card",{attrs:{"body-class":"p-0"},scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.lastCosts")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("AmChart",{attrs:{element:"home-chart-05",type:"line-bar",height:180}})]},proxy:!0}])})],1),t._v(" "),o("b-col",{attrs:{md:"6"}},[o("iq-card",{attrs:{"body-class":"p-0 position-relative"},scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.efficiency")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("ApexChart",{attrs:{element:"home-chart-03",chartOption:t.chart3}})]},proxy:!0}])})],1)],1)],1),t._v(" "),o("b-col",{attrs:{md:"4"}},[o("iq-card",{scopedSlots:t._u([{key:"headerTitle",fn:function(){return[o("h4",{staticClass:"card-title"},[t._v(t._s(t.$t("dashboard1.paymentHistory")))])]},proxy:!0},{key:"headerAction",fn:function(){return[o("b-dropdown",{attrs:{id:"dropdownMenuButton1",right:"",variant:"none","data-toggle":"dropdown"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"text-primary"},[o("i",{staticClass:"ri-more-fill"})])]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-eye-fill mr-2"}),t._v(t._s(t.$t("dropdown.view")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-delete-bin-6-fill mr-2"}),t._v(t._s(t.$t("dropdown.delete")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-pencil-fill mr-2"}),t._v(t._s(t.$t("dropdown.edit")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-printer-fill mr-2"}),t._v(t._s(t.$t("dropdown.print")))]),t._v(" "),o("b-dropdown-item",[o("i",{staticClass:"ri-file-download-fill mr-2"}),t._v(t._s(t.$t("dropdown.download")))])],1)]},proxy:!0},{key:"body",fn:function(){return[o("ul",{staticClass:"suggestions-lists m-0 p-0"},t._l(t.paymentHistory,(function(i,e){return o("li",{key:e,staticClass:"d-flex mb-4 align-items-center"},[o("div",{class:"profile-icon bg-"+i.color},[o("span",[o("i",{class:i.icon})])]),t._v(" "),o("div",{staticClass:"media-support-info ml-3"},[o("h6",[t._v(t._s(i.title))]),t._v(" "),o("p",{staticClass:"mb-0"},[t._v(t._s(i.date))])]),t._v(" "),o("div",{staticClass:"media-support-amount ml-3"},[o("h6",{class:"text-"+i.color},[t._v(t._s(i.amount))]),t._v(" "),o("p",{staticClass:"mb-0"},[t._v(t._s(i.currency))])])])})),0)]},proxy:!0}])})],1)],1)],1)}),[],!1,null,null,null);i.default=d.exports},220:function(t,i,e){"use strict";var o=e(692),a=e.n(o),s={name:"ApexChart",props:["element","chartOption","isLive"],mounted:function(){var t=this,i="#"+t.element,e=new a.a(document.querySelector(i),t.chartOption);setTimeout((function(){e.render(),t.isLive&&setInterval((function(){t.getNewSeries(t.lastDate,{min:10,max:90}),e.updateSeries([{data:t.data}])}),1e3)}),500)},data:function(){return{lastDate:0,data:[],TICKINTERVAL:864e5,XAXISRANGE:7776e5}},methods:{getNewSeries:function(t,i){var e=t+this.TICKINTERVAL;this.lastDate=e;for(var o=0;o<this.data.length-10;o++)this.data[o].x=e-this.XAXISRANGE-this.TICKINTERVAL,this.data[o].y=0;this.data.push({x:e,y:Math.floor(Math.random()*(i.max-i.min+1))+i.min})}}},r=e(8),n=Object(r.a)(s,(function(){var t=this.$createElement;return(this._self._c||t)("div",{attrs:{id:this.element}})}),[],!1,null,null,null);i.a=n.exports},436:function(t,i,e){var o=e(1139);"string"==typeof o&&(o=[[t.i,o,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};e(45)(o,a);o.locals&&(t.exports=o.locals)}}]);
//# sourceMappingURL=33.js.map | 9,403 | 18,775 | 0.641072 |
8d252cc6b289c15ab20604912cbeb05321536931 | 200 | js | JavaScript | src/Routes/Api/V1/usersRoute.js | NiedsonEmanoel/EnglishZAP | f3b7a6db0026eaa542848803cd20e605d3f0ae54 | [
"MIT"
] | null | null | null | src/Routes/Api/V1/usersRoute.js | NiedsonEmanoel/EnglishZAP | f3b7a6db0026eaa542848803cd20e605d3f0ae54 | [
"MIT"
] | null | null | null | src/Routes/Api/V1/usersRoute.js | NiedsonEmanoel/EnglishZAP | f3b7a6db0026eaa542848803cd20e605d3f0ae54 | [
"MIT"
] | null | null | null | const express = require('express');
const route = express.Router();
const {Users} = require('../../../Controllers')
route.get('/', Users.index)
route.post('/', Users.create);
module.exports = route; | 25 | 47 | 0.665 |
8d2551f686fcb2efecaf394730e5cb72e5502d3a | 1,637 | js | JavaScript | api/cpp/en-US/search/files_7.js | subor/subor.github.io | a5f7e76f5941eee09b95957ae3bc204921178606 | [
"MIT"
] | null | null | null | api/cpp/en-US/search/files_7.js | subor/subor.github.io | a5f7e76f5941eee09b95957ae3bc204921178606 | [
"MIT"
] | null | null | null | api/cpp/en-US/search/files_7.js | subor/subor.github.io | a5f7e76f5941eee09b95957ae3bc204921178606 | [
"MIT"
] | null | null | null | var searchData=
[
['overlayexternalservice_2ecpp',['OverlayExternalService.cpp',['../_overlay_external_service_8cpp.html',1,'']]],
['overlayexternalservice_2eh',['OverlayExternalService.h',['../_overlay_external_service_8h.html',1,'']]],
['overlayexternalservice_5fserver_2eskeleton_2ecpp',['OverlayExternalService_server.skeleton.cpp',['../_overlay_external_service__server_8skeleton_8cpp.html',1,'']]],
['overlaymanagersdkdatatypes_5fconstants_2ecpp',['OverlayManagerSDKDataTypes_constants.cpp',['../_overlay_manager_s_d_k_data_types__constants_8cpp.html',1,'']]],
['overlaymanagersdkdatatypes_5fconstants_2eh',['OverlayManagerSDKDataTypes_constants.h',['../_overlay_manager_s_d_k_data_types__constants_8h.html',1,'']]],
['overlaymanagersdkdatatypes_5ftypes_2ecpp',['OverlayManagerSDKDataTypes_types.cpp',['../_overlay_manager_s_d_k_data_types__types_8cpp.html',1,'']]],
['overlaymanagersdkdatatypes_5ftypes_2eh',['OverlayManagerSDKDataTypes_types.h',['../_overlay_manager_s_d_k_data_types__types_8h.html',1,'']]],
['overlaymanagersdkservices_5fconstants_2ecpp',['OverlayManagerSDKServices_constants.cpp',['../_overlay_manager_s_d_k_services__constants_8cpp.html',1,'']]],
['overlaymanagersdkservices_5fconstants_2eh',['OverlayManagerSDKServices_constants.h',['../_overlay_manager_s_d_k_services__constants_8h.html',1,'']]],
['overlaymanagersdkservices_5ftypes_2ecpp',['OverlayManagerSDKServices_types.cpp',['../_overlay_manager_s_d_k_services__types_8cpp.html',1,'']]],
['overlaymanagersdkservices_5ftypes_2eh',['OverlayManagerSDKServices_types.h',['../_overlay_manager_s_d_k_services__types_8h.html',1,'']]]
];
| 109.133333 | 168 | 0.813684 |
8d2558bf4b0d2d01c024ee0881f3cf3c1e2482d2 | 1,354 | js | JavaScript | src/templates/homesection.js | joshuarcher/gatsby-t26-podcasts | a770760e92328143a3c7cdc0ababa38609c234b2 | [
"MIT"
] | null | null | null | src/templates/homesection.js | joshuarcher/gatsby-t26-podcasts | a770760e92328143a3c7cdc0ababa38609c234b2 | [
"MIT"
] | null | null | null | src/templates/homesection.js | joshuarcher/gatsby-t26-podcasts | a770760e92328143a3c7cdc0ababa38609c234b2 | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import logo from './../media/t26-logo.png';
import Link from "gatsby-link";
import './css/homesection.scss';
class HomeSection extends Component {
render() {
return(
<div className='section-main section'>
<div className='center-container'>
<div className='logo'></div>
<div className='logo-subtitle'>Swimming & Triathlon Coaching</div>
<div className='main-menu'>
<Link className='button go-section' to="/podcasts/">"BE RACE READY" Podcast</Link>
<Link className='button go-section' to="/workouts/">Los Angeles Workouts</Link>
<a className='button go-section' href="#online" section='.section-online'>Online Workouts</a>
<a className='button go-section' href="#coaches" section='.section-gerry'>Coaches</a>
</div>
<div className='social'>
<a className='social-link' href='https://www.facebook.com/groups/TOWER26/' target='_f'><i className="fab fa-facebook-f"></i></a>
<a className='social-link' href='https://www.instagram.com/tower_26/' target='_i'><i className="fab fa-instagram"></i></a>
<a className='social-link' href='https://twitter.com/Tower_26' target='_t'><i className="fab fa-twitter"></i></a>
</div>
</div>
</div>
)
}
}
export default HomeSection;
| 42.3125 | 137 | 0.635155 |
8d255e3bbe66699f19f51340a56c55142efba52d | 1,351 | js | JavaScript | bundles/framework/routingUI/resources/locale/sv.js | okauppinen/oskari | 225e0064b70b4699e1483d5a6473b417ba4263ff | [
"MIT"
] | null | null | null | bundles/framework/routingUI/resources/locale/sv.js | okauppinen/oskari | 225e0064b70b4699e1483d5a6473b417ba4263ff | [
"MIT"
] | null | null | null | bundles/framework/routingUI/resources/locale/sv.js | okauppinen/oskari | 225e0064b70b4699e1483d5a6473b417ba4263ff | [
"MIT"
] | null | null | null | Oskari.registerLocalization(
{
"lang": "sv",
"key": "routingUI",
"value": {
"tool": {
"tooltip": "Make route search"
},
"popup": {
"title": "Get route",
"instructions": "Get directions by clicking between two points on the map departure and entry point.",
"button": {
"cancel": "Close",
"getRoute": "Get route"
},
"startingPointTooltip":"Starting point",
"finishingPointTooltip":"Finishing point",
"startingPoint": "Starting point",
"finishingPoint": "Finishing point"
},
"error": {
"title": "Route search was not successful",
"message": "Route search was not successful. Check the departure and the entry point and try again."
},
"routeInstructions": {
"titleOne": "Found one route",
"titleMulti": "Found {count} routes",
"route": "Route",
"duration": "Duration",
"startTime": "Start time",
"endTime": "End time",
"waitingTime": "Waiting time",
"walkingTime": "Walking time",
"transitTime": "Transit time",
"walkDistance": "Walk distance",
"showRoute": "Show route"
}
}
}
); | 33.775 | 114 | 0.49889 |
8d25798b9ed3776aaa61968cb11cbe3bfd763a93 | 1,973 | js | JavaScript | src/components/Notepad.js | Devansh252/Notezy | a7386e9f6dab4beb9b7991265cf8f3e30db93caa | [
"MIT"
] | 15 | 2018-03-20T21:01:20.000Z | 2021-09-27T18:30:12.000Z | src/components/Notepad.js | Devansh252/Notezy | a7386e9f6dab4beb9b7991265cf8f3e30db93caa | [
"MIT"
] | 20 | 2018-03-16T15:51:15.000Z | 2021-10-01T08:30:05.000Z | src/components/Notepad.js | Devansh252/Notezy | a7386e9f6dab4beb9b7991265cf8f3e30db93caa | [
"MIT"
] | 23 | 2018-03-16T21:59:37.000Z | 2021-01-10T15:33:32.000Z | import React, { PureComponent } from "react";
import { connect } from "react-redux";
import { Col } from "react-flexbox-grid";
import Card from "@material-ui/core/Card";
import * as actions from "../actions";
import IconButton from "@material-ui/core/IconButton";
import Delete from "@material-ui/icons/Delete";
class Notepad extends PureComponent {
handleChange = event => {
let noteData = JSON.parse(this.props.noteData);
if (event.target.name === "title") {
noteData.title = event.target.value;
} else if (event.target.name === "message") {
noteData.content = event.target.value;
}
this.props.updateNote(noteData);
};
render() {
return (
<Col
xs={12} md={3} className="notepad-wrap"
id={`Col-${JSON.parse(this.props.noteData).id}`}
>
<Card
id={`Card-${JSON.parse(this.props.noteData).id}`}
className="sticky"
>
<div>
<input
hintText="Title"
fullWidth={true}
value={JSON.parse(this.props.noteData).title}
name="title"
onChange={this.handleChange}
placeholder="Title..."
/>
<textarea
id="message"
name="message"
className="form-control"
required=""
value={JSON.parse(this.props.noteData).content}
onChange={this.handleChange}
placeholder="Things you want to say.."
/>
</div>
<div>
<IconButton
variant="contained"
color="secondary"
style={{ marginTop: "10px" }}
onClick={this.props.remove}
>
<Delete />
</IconButton>
</div>
</Card>
</Col>
);
}
}
function mapStateToProps(state) {
return {};
}
export default connect(
mapStateToProps,
actions
)(Notepad);
| 26.306667 | 62 | 0.527116 |
8d25881e01c5994beb958f53e9270d5da3857071 | 5,229 | js | JavaScript | app/assets/javascripts/activeadmin/froala_editor/plugins/forms.min.js | shinzenkoru/activeadmin_froala_editor | 8df0a83de8402bb2bb0899b9e87e35d084ad080c | [
"MIT"
] | null | null | null | app/assets/javascripts/activeadmin/froala_editor/plugins/forms.min.js | shinzenkoru/activeadmin_froala_editor | 8df0a83de8402bb2bb0899b9e87e35d084ad080c | [
"MIT"
] | null | null | null | app/assets/javascripts/activeadmin/froala_editor/plugins/forms.min.js | shinzenkoru/activeadmin_froala_editor | 8df0a83de8402bb2bb0899b9e87e35d084ad080c | [
"MIT"
] | null | null | null | /*!
* froala_editor v2.8.4 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2018 Froala Labs
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(t.jQuery)}(this,function(l){"use strict";var t=(l=l&&l.hasOwnProperty("default")?l["default"]:l).FE;Object.assign(t.POPUP_TEMPLATES,{"forms.edit":"[_BUTTONS_]","forms.update":"[_BUTTONS_][_TEXT_LAYER_]"}),Object.assign(t.DEFAULTS,{formEditButtons:["inputStyle","inputEdit"],formStyles:{"fr-rounded":"Rounded","fr-large":"Large"},formMultipleStyles:!0,formUpdateButtons:["inputBack","|"]}),t.PLUGINS.forms=function(a){var u;function t(t){t.preventDefault(),a.selection.clear(),l(this).data("mousedown",!0)}function e(t){l(this).data("mousedown")&&(t.stopPropagation(),l(this).removeData("mousedown"),i(u=this)),t.preventDefault()}function o(){a.$el.find("input, textarea, button").removeData("mousedown")}function n(){l(this).removeData("mousedown")}function r(){return u||null}function i(t){var e=a.popups.get("forms.edit");e||(e=function(){var t="";0<a.opts.formEditButtons.length&&(t='<div class="fr-buttons">'+a.button.buildList(a.opts.formEditButtons)+"</div>");var e={buttons:t},o=a.popups.create("forms.edit",e);return a.$wp&&a.events.$on(a.$wp,"scroll.link-edit",function(){r()&&a.popups.isVisible("forms.edit")&&i(r())}),o}());var o=l(u=t);a.popups.refresh("forms.edit"),a.popups.setContainer("forms.edit",a.$sc);var n=o.offset().left+o.outerWidth()/2,s=o.offset().top+o.outerHeight();a.popups.show("forms.edit",n,s,o.outerHeight())}function p(){var t=a.popups.get("forms.update"),e=r();if(e){var o=l(e);o.is("button")?t.find('input[type="text"][name="text"]').val(o.text()):t.find('input[type="text"][name="text"]').val(o.attr("placeholder"))}t.find('input[type="text"][name="text"]').trigger("change")}function f(){u=null}function d(t){if(t)return a.popups.onRefresh("forms.update",p),a.popups.onHide("forms.update",f),!0;var e="";1<=a.opts.formUpdateButtons.length&&(e='<div class="fr-buttons">'+a.button.buildList(a.opts.formUpdateButtons)+"</div>");var o="",n=0;o='<div class="fr-forms-text-layer fr-layer fr-active">',o+='<div class="fr-input-line"><input name="text" type="text" placeholder="Text" tabIndex="'+ ++n+'"></div>';var s={buttons:e,text_layer:o+='<div class="fr-action-buttons"><button class="fr-command fr-submit" data-cmd="updateInput" href="#" tabIndex="'+ ++n+'" type="button">'+a.language.translate("Update")+"</button></div></div>"};return a.popups.create("forms.update",s)}return{_init:function(){a.events.$on(a.$el,a._mousedown,"input, textarea, button",t),a.events.$on(a.$el,a._mouseup,"input, textarea, button",e),a.events.$on(a.$el,"touchmove","input, textarea, button",n),a.events.$on(a.$el,a._mouseup,o),a.events.$on(a.$win,a._mouseup,o),d(!0),a.events.$on(a.$el,"submit","form",function(t){return t.preventDefault(),!1})},updateInput:function(){var t=a.popups.get("forms.update"),e=r();if(e){var o=l(e),n=t.find('input[type="text"][name="text"]').val()||"";n.length&&(o.is("button")?o.text(n):o.attr("placeholder",n)),a.popups.hide("forms.update"),i(e)}},getInput:r,applyStyle:function(t,e,o){void 0===e&&(e=a.opts.formStyles),void 0===o&&(o=a.opts.formMultipleStyles);var n=r();if(!n)return!1;if(!o){var s=Object.keys(e);s.splice(s.indexOf(t),1),l(n).removeClass(s.join(" "))}l(n).toggleClass(t)},showUpdatePopup:function(){var t=r();if(t){var e=l(t),o=a.popups.get("forms.update");o||(o=d()),a.popups.isVisible("forms.update")||a.popups.refresh("forms.update"),a.popups.setContainer("forms.update",a.$sc);var n=e.offset().left+e.outerWidth()/2,s=e.offset().top+e.outerHeight();a.popups.show("forms.update",n,s,e.outerHeight())}},showEditPopup:i,back:function(){a.events.disableBlur(),a.selection.restore(),a.events.enableBlur();var t=r();t&&a.$wp&&("BUTTON"==t.tagName&&a.selection.restore(),i(t))}}},t.RegisterCommand("updateInput",{undo:!1,focus:!1,title:"Update",callback:function(){this.forms.updateInput()}}),t.DefineIcon("inputStyle",{NAME:"magic"}),t.RegisterCommand("inputStyle",{title:"Style",type:"dropdown",html:function(){var t='<ul class="fr-dropdown-list">',e=this.opts.formStyles;for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t+='<li><a class="fr-command" tabIndex="-1" data-cmd="inputStyle" data-param1="'+o+'">'+this.language.translate(e[o])+"</a></li>");return t+="</ul>"},callback:function(t,e){var o=this.forms.getInput();o&&(this.forms.applyStyle(e),this.forms.showEditPopup(o))},refreshOnShow:function(t,e){var o=this.forms.getInput();if(o){var n=l(o);e.find(".fr-command").each(function(){var t=l(this).data("param1");l(this).toggleClass("fr-active",n.hasClass(t))})}}}),t.DefineIcon("inputEdit",{NAME:"edit"}),t.RegisterCommand("inputEdit",{title:"Edit Button",undo:!1,refreshAfterCallback:!1,callback:function(){this.forms.showUpdatePopup()}}),t.DefineIcon("inputBack",{NAME:"arrow-left"}),t.RegisterCommand("inputBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.forms.back()}}),t.RegisterCommand("updateInput",{undo:!1,focus:!1,title:"Update",callback:function(){this.forms.updateInput()}})}); | 747 | 5,069 | 0.697265 |
8d2719c10b8e9370d0a4b27817c96b8f7d9ba7b0 | 810 | js | JavaScript | src/utils.js | ReFormationPro/ohm-editor | 0f26c0268d5c8ac536d9d210519bca173d6f9695 | [
"MIT"
] | 74 | 2016-12-01T03:29:31.000Z | 2022-02-27T15:30:43.000Z | src/utils.js | ReFormationPro/ohm-editor | 0f26c0268d5c8ac536d9d210519bca173d6f9695 | [
"MIT"
] | 43 | 2016-11-29T18:10:02.000Z | 2022-03-23T11:13:44.000Z | src/utils.js | ReFormationPro/ohm-editor | 0f26c0268d5c8ac536d9d210519bca173d6f9695 | [
"MIT"
] | 11 | 2017-01-16T20:27:57.000Z | 2022-01-27T17:12:12.000Z | 'use strict';
function objectForEach(obj, func) {
Object.keys(obj).forEach(function (key) {
return func(key, obj[key], obj);
});
}
module.exports = {
objectForEach,
objectMap(obj, func) {
return Object.keys(obj).map(function (key) {
return func(key, obj[key], obj);
});
},
repeat(n, fn) {
if (n < 0) {
return;
}
while (n > 0) {
fn();
n--;
}
},
shuffle(a) {
let j;
let x;
let i;
for (i = a.length; i; i -= 1) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
}
},
// same as a\b
difference(a, b) {
return a.filter(function (item) {
return b.indexOf(item) === -1;
});
},
includes(array, item) {
return array.indexOf(item) !== -1;
},
};
| 16.2 | 48 | 0.477778 |
8d27cab8dc4e015312c5ceab9e1337d17fea20be | 27,685 | js | JavaScript | test/functional/druidSqlFunctional.mocha.js | wylieallen-i/plywood | c19029354af42c9e757ec3751a7e13eabe6364a8 | [
"Apache-2.0"
] | null | null | null | test/functional/druidSqlFunctional.mocha.js | wylieallen-i/plywood | c19029354af42c9e757ec3751a7e13eabe6364a8 | [
"Apache-2.0"
] | null | null | null | test/functional/druidSqlFunctional.mocha.js | wylieallen-i/plywood | c19029354af42c9e757ec3751a7e13eabe6364a8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2015-2020 Imply Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const { expect } = require('chai');
let { sane } = require('../utils');
let { druidRequesterFactory } = require('plywood-druid-requester');
let plywood = require('../plywood');
let {
External,
DruidSQLExternal,
TimeRange,
$,
s$,
ply,
r,
basicExecutorFactory,
verboseRequesterFactory,
Expression,
} = plywood;
let info = require('../info');
let druidRequester = druidRequesterFactory({
host: info.druidHost,
});
// druidRequester = verboseRequesterFactory({
// requester: druidRequester,
// });
let context = {
priority: -23,
};
describe('DruidSQL Functional', function() {
this.timeout(10000);
let wikiAttributes = [
{
name: '__time',
nativeType: 'TIMESTAMP',
type: 'TIME',
},
{
name: 'added',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'channel',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'cityName',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'comment',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'commentLength',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'commentLengthStr',
nativeType: 'VARCHAR',
type: 'STRING',
},
info.druidHasFullText
? {
name: 'commentTerms',
nativeType: 'VARCHAR',
type: 'STRING',
}
: null,
{
name: 'count',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'countryIsoCode',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'countryName',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'deleted',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'delta',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'deltaBucket100',
nativeType: 'FLOAT',
type: 'NUMBER',
},
{
name: 'deltaByTen',
nativeType: 'DOUBLE',
type: 'NUMBER',
},
{
name: 'delta_hist',
nativeType: 'OTHER',
type: 'NULL',
},
{
name: 'isAnonymous',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'isMinor',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'isNew',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'isRobot',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'isUnpatrolled',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'max_delta',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'metroCode',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'min_delta',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'namespace',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'page',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'page_unique',
nativeType: 'OTHER',
type: 'NULL',
},
{
name: 'regionIsoCode',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'regionName',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'sometimeLater',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'sometimeLaterMs',
nativeType: 'BIGINT',
type: 'NUMBER',
},
{
name: 'user',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'userChars',
nativeType: 'VARCHAR',
type: 'STRING',
},
{
name: 'user_theta',
nativeType: 'OTHER',
type: 'NULL',
},
{
name: 'user_unique',
nativeType: 'OTHER',
type: 'NULL',
},
].filter(Boolean);
let wikiDerivedAttributes = {
pageInBrackets: "'[' ++ $page ++ ']'",
};
describe('source list', () => {
it('does a source list', async () => {
expect(await DruidSQLExternal.getSourceList(druidRequester)).to.deep.equal([
'wikipedia',
'wikipedia-compact',
]);
});
});
describe('custom SQL', () => {
let basicExecutor = basicExecutorFactory({
datasets: {
wiki: External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
attributes: wikiAttributes,
derivedAttributes: wikiDerivedAttributes,
context,
},
druidRequester,
),
},
});
it('works in simple aggregate case', () => {
let ex = $('wiki')
.split(s$(`CONCAT(channel, '~')`), 'Channel')
.apply('Count', $('wiki').sqlAggregate(r(`SUM(t."count")`)))
.apply('Fancy', $('wiki').sqlAggregate(r(`SQRT(SUM(t."added" * t."added"))`)))
.sort('$Count', 'descending')
.limit(3);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
Channel: 'en~',
Count: 114711,
Fancy: 717274.3671253002,
},
{
Channel: 'vi~',
Count: 99010,
Fancy: 70972.1877005352,
},
{
Channel: 'de~',
Count: 25103,
Fancy: 284404.77477356105,
},
]);
});
});
it('can do compare column', () => {
let prevRange = TimeRange.fromJS({
start: new Date('2015-09-12T00:00:00Z'),
end: new Date('2015-09-12T12:00:00Z'),
});
let mainRange = TimeRange.fromJS({
start: new Date('2015-09-12T12:00:00Z'),
end: new Date('2015-09-13T00:00:00Z'),
});
let ex = $('wiki')
.split($('channel'), 'Channel')
.apply(
'CountPrev',
$('wiki')
.filter($('__time').overlap(prevRange))
.sqlAggregate(r(`SUM(t."count")`)),
)
.apply(
'CountMain',
$('wiki')
.filter($('__time').overlap(mainRange))
.sqlAggregate(r(`SUM(t."count")`)),
)
.sort($('CountMain'), 'descending')
.limit(5);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
Channel: 'en',
CountMain: 68606,
CountPrev: 46105,
},
{
Channel: 'vi',
CountMain: 48521,
CountPrev: 50489,
},
{
Channel: 'de',
CountMain: 15857,
CountPrev: 9246,
},
{
Channel: 'fr',
CountMain: 14779,
CountPrev: 6506,
},
{
Channel: 'uz',
CountMain: 10064,
CountPrev: 8,
},
]);
});
});
});
describe('custom SQL with WITH', () => {
let basicExecutor = basicExecutorFactory({
datasets: {
wikiWith: External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia_zzz',
attributes: wikiAttributes,
derivedAttributes: wikiDerivedAttributes,
context,
withQuery: `SELECT *, CONCAT("channel", '-lol') AS "channelLol" FROM wikipedia WHERE channel = 'en'`,
},
druidRequester,
),
},
});
it('works in simple aggregate case', () => {
let ex = $('wikiWith')
.split(s$(`t.channelLol`), 'ChannelLol')
.apply('Count', $('wikiWith').sqlAggregate(r(`SUM(t."count")`)))
.apply('Fancy', $('wikiWith').sqlAggregate(r(`SQRT(SUM(t."added" * t."added"))`)))
.sort('$Count', 'descending')
.limit(3);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
ChannelLol: 'en-lol',
Count: 114711,
Fancy: 717274.3671253002,
},
]);
});
});
});
describe('defined attributes in datasource', () => {
let basicExecutor = basicExecutorFactory({
datasets: {
wiki: External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
attributes: wikiAttributes,
derivedAttributes: wikiDerivedAttributes,
context,
},
druidRequester,
),
},
});
it('works in simple case', () => {
let ex = $('wiki')
.split('$channel', 'Channel')
.apply('Count', $('wiki').sum('$count'))
.sort('$Count', 'descending')
.limit(3);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
Channel: 'en',
Count: 114711,
},
{
Channel: 'vi',
Count: 99010,
},
{
Channel: 'de',
Count: 25103,
},
]);
});
});
it('works in advanced case', () => {
let ex = ply()
.apply('wiki', $('wiki').filter($('channel').is('en')))
.apply('Count', '$wiki.sum($count)')
.apply('TotalAdded', '$wiki.sum($added)')
.apply(
'Namespaces',
$('wiki')
.split('$namespace', 'Namespace')
.apply('Added', '$wiki.sum($added)')
.sort('$Added', 'descending')
.limit(2)
.apply(
'Time',
$('wiki')
.split($('__time').timeBucket('PT1H', 'Etc/UTC'), 'Timestamp')
.apply('TotalAdded', '$wiki.sum($added)')
.sort('$TotalAdded', 'descending')
.limit(3),
),
);
// .apply(
// 'PagesHaving',
// $("wiki").split("$page", 'Page')
// .apply('Count', '$wiki.sum($count)')
// .sort('$Count', 'descending')
// .filter($('Count').lessThan(30))
// .limit(3)
// );
let rawQueries = [];
return basicExecutor(ex, { rawQueries }).then(result => {
expect(rawQueries).to.deep.equal([
{
engine: 'druidsql',
query: {
context: {
priority: -23,
},
query:
'SELECT\nSUM("count") AS "Count",\nSUM("added") AS "TotalAdded"\nFROM "wikipedia" AS t\nWHERE ("channel"=\'en\')\nGROUP BY \'\'',
},
},
{
engine: 'druidsql',
query: {
context: {
priority: -23,
},
query:
'SELECT\n"namespace" AS "Namespace",\nSUM("added") AS "Added"\nFROM "wikipedia" AS t\nWHERE ("channel"=\'en\')\nGROUP BY 1\nORDER BY "Added" DESC\nLIMIT 2',
},
},
{
engine: 'druidsql',
query: {
context: {
priority: -23,
},
query:
'SELECT\nTIME_FLOOR("__time", \'PT1H\', NULL, \'Etc/UTC\') AS "Timestamp",\nSUM("added") AS "TotalAdded"\nFROM "wikipedia" AS t\nWHERE (("channel"=\'en\') AND ("namespace"=\'Main\'))\nGROUP BY 1\nORDER BY "TotalAdded" DESC\nLIMIT 3',
},
},
{
engine: 'druidsql',
query: {
context: {
priority: -23,
},
query:
'SELECT\nTIME_FLOOR("__time", \'PT1H\', NULL, \'Etc/UTC\') AS "Timestamp",\nSUM("added") AS "TotalAdded"\nFROM "wikipedia" AS t\nWHERE (("channel"=\'en\') AND ("namespace"=\'User talk\'))\nGROUP BY 1\nORDER BY "TotalAdded" DESC\nLIMIT 3',
},
},
]);
expect(result.toJS().data).to.deep.equal([
{
Count: 114711,
Namespaces: {
attributes: [
{
name: 'Namespace',
type: 'STRING',
},
{
name: 'Added',
type: 'NUMBER',
},
{
name: 'Time',
type: 'DATASET',
},
],
data: [
{
Added: 11594002,
Namespace: 'Main',
Time: {
attributes: [
{
name: 'Timestamp',
type: 'TIME_RANGE',
},
{
name: 'TotalAdded',
type: 'NUMBER',
},
],
data: [
{
Timestamp: {
end: new Date('2015-09-12T15:00:00.000Z'),
start: new Date('2015-09-12T14:00:00.000Z'),
},
TotalAdded: 740968,
},
{
Timestamp: {
end: new Date('2015-09-12T19:00:00.000Z'),
start: new Date('2015-09-12T18:00:00.000Z'),
},
TotalAdded: 739956,
},
{
Timestamp: {
end: new Date('2015-09-12T23:00:00.000Z'),
start: new Date('2015-09-12T22:00:00.000Z'),
},
TotalAdded: 708543,
},
],
keys: ['Timestamp'],
},
},
{
Added: 9210976,
Namespace: 'User talk',
Time: {
attributes: [
{
name: 'Timestamp',
type: 'TIME_RANGE',
},
{
name: 'TotalAdded',
type: 'NUMBER',
},
],
data: [
{
Timestamp: {
end: new Date('2015-09-12T13:00:00.000Z'),
start: new Date('2015-09-12T12:00:00.000Z'),
},
TotalAdded: 693571,
},
{
Timestamp: {
end: new Date('2015-09-12T18:00:00.000Z'),
start: new Date('2015-09-12T17:00:00.000Z'),
},
TotalAdded: 634804,
},
{
Timestamp: {
end: new Date('2015-09-12T03:00:00.000Z'),
start: new Date('2015-09-12T02:00:00.000Z'),
},
TotalAdded: 573768,
},
],
keys: ['Timestamp'],
},
},
],
keys: ['Namespace'],
},
TotalAdded: 32553107,
},
]);
});
});
it('works with all kinds of cool aggregates on totals level', () => {
let ex = ply()
.apply('NumPages', $('wiki').countDistinct('$page'))
.apply(
'NumEnPages',
$('wiki')
.filter($('channel').is('en'))
.countDistinct('$page'),
)
.apply('ChannelAdded', $('wiki').sum('$added'))
.apply(
'ChannelENAdded',
$('wiki')
.filter($('channel').is('en'))
.sum('$added'),
)
.apply(
'ChannelENishAdded',
$('wiki')
.filter($('channel').contains('en'))
.sum('$added'),
)
.apply('Count', $('wiki').sum('$count'))
.apply(
'CountSquareRoot',
$('wiki')
.sum('$count')
.power(0.5),
)
.apply(
'CountSquared',
$('wiki')
.sum('$count')
.power(2),
)
.apply(
'One',
$('wiki')
.sum('$count')
.power(0),
)
.apply(
'AddedByDeleted',
$('wiki')
.sum('$added')
.divide($('wiki').sum('$deleted')),
)
.apply('Delta95th', $('wiki').quantile('$delta_hist', 0.95))
.apply(
'Delta99thX2',
$('wiki')
.quantile('$delta_hist', 0.99)
.multiply(2),
);
// .apply(
// 'Delta98thEn',
// $('wiki')
// .filter($('channel').is('en'))
// .quantile('$delta_hist', 0.98),
// )
// .apply(
// 'Delta98thDe',
// $('wiki')
// .filter($('channel').is('de'))
// .quantile('$delta_hist', 0.98),
// );
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
AddedByDeleted: 24.909643797343193,
ChannelAdded: 97393743,
ChannelENAdded: 32553107,
ChannelENishAdded: 32553107,
Count: 392443,
CountSquareRoot: 626.4527117029664,
CountSquared: 154011508249,
NumEnPages: 63850,
NumPages: 279107,
One: 1,
Delta95th: 161.95516967773438,
Delta99thX2: 328.9096984863281,
},
]);
});
});
it.skip('works with boolean GROUP BYs', () => {
let ex = $('wiki')
.split($('channel').is('en'), 'ChannelIsEn')
.apply('Count', $('wiki').sum('$count'))
.sort('$Count', 'descending');
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
ChannelIsEn: false,
Count: 277732,
},
{
ChannelIsEn: true,
Count: 114711,
},
]);
});
});
it('works string range', () => {
let ex = $('wiki')
.filter($('cityName').greaterThan('Eagleton'))
.split('$cityName', 'CityName')
.sort('$CityName', 'descending')
.limit(10);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
CityName: 'Ōita',
},
{
CityName: 'Łódź',
},
{
CityName: 'İzmit',
},
{
CityName: 'České Budějovice',
},
{
CityName: 'Ürümqi',
},
{
CityName: 'Ústí nad Labem',
},
{
CityName: 'Évry',
},
{
CityName: 'Épinay-sur-Seine',
},
{
CityName: 'Épernay',
},
{
CityName: 'Élancourt',
},
]);
});
});
it('works with fancy lookup filter', () => {
let ex = ply()
.apply(
'wiki',
$('wiki').filter(
$('channel')
.lookup('channel-lookup')
.fallback('"???"')
.concat(r(' ('), '$channel', r(')'))
.in(['English (en)', 'German (de)']),
),
)
.apply('Count', '$wiki.sum($count)');
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
Count: 114711,
},
]);
});
});
});
describe('incorrect commentLength and comment', () => {
let wikiUserCharAsNumber = External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
timeAttribute: 'time',
allowEternity: true,
context,
attributes: [
{ name: 'time', type: 'TIME' },
{ name: 'comment', type: 'STRING' },
{ name: 'page', type: 'NUMBER' }, // This is incorrect
{ name: 'count', type: 'NUMBER', unsplitable: true },
],
},
druidRequester,
);
});
describe('introspection', () => {
let basicExecutor = basicExecutorFactory({
datasets: {
wiki: External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
context,
},
druidRequester,
),
},
});
it('introspects table', async () => {
const external = await External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
context,
},
druidRequester,
).introspect();
expect(external.version).to.equal(info.druidVersion);
expect(external.toJS().attributes).to.deep.equal(wikiAttributes);
});
it('introspects withQuery (no star)', async () => {
const external = await External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
withQuery: 'SELECT page, user, count(*) as cnt FROM wikipedia GROUP BY 1, 2',
context,
},
druidRequester,
).introspect();
expect(external.version).to.equal(info.druidVersion);
expect(external.toJS().attributes).to.deep.equal([
{
name: 'page',
nativeType: 'STRING',
type: 'STRING',
},
{
name: 'user',
nativeType: 'STRING',
type: 'STRING',
},
{
name: 'cnt',
nativeType: 'LONG',
type: 'NUMBER',
},
]);
});
it('introspects withQuery (with star)', async () => {
const external = await External.fromJS(
{
engine: 'druidsql',
source: 'wikipedia',
withQuery: `SELECT page || 'lol' AS pageLol, added + 1, * FROM wikipedia`,
context,
},
druidRequester,
).introspect();
expect(external.version).to.equal(info.druidVersion);
expect(external.toJS().attributes.slice(0, 5)).to.deep.equal([
{
name: 'pageLol',
nativeType: 'STRING',
type: 'STRING',
},
{
name: '__time',
nativeType: 'LONG',
type: 'NUMBER',
},
{
name: 'added',
nativeType: 'LONG',
type: 'NUMBER',
},
{
name: 'channel',
nativeType: 'STRING',
type: 'STRING',
},
{
name: 'cityName',
nativeType: 'STRING',
type: 'STRING',
},
]);
});
it.skip('works with introspection', () => {
// ToDo: needs null check correction
let ex = ply()
.apply('wiki', $('wiki').filter($('channel').is('en')))
.apply('TotalAdded', '$wiki.sum($added)')
.apply(
'Time',
$('wiki')
.split($('__time').timeBucket('PT1H', 'Etc/UTC'), 'Timestamp')
.apply('TotalAdded', '$wiki.sum($added)')
.sort('$Timestamp', 'ascending')
.limit(3)
.apply(
'Pages',
$('wiki')
.split('$regionName', 'RegionName')
.apply('Deleted', '$wiki.sum($deleted)')
.sort('$Deleted', 'descending')
.limit(2),
),
);
return basicExecutor(ex).then(result => {
expect(result.toJS().data).to.deep.equal([
{
Time: {
attributes: [
{
name: 'Timestamp',
type: 'TIME_RANGE',
},
{
name: 'TotalAdded',
type: 'NUMBER',
},
{
name: 'Pages',
type: 'DATASET',
},
],
data: [
{
Pages: {
attributes: [
{
name: 'RegionName',
type: 'STRING',
},
{
name: 'Deleted',
type: 'NUMBER',
},
],
data: [
{
Deleted: 11807,
RegionName: null,
},
{
Deleted: 848,
RegionName: 'Ontario',
},
],
keys: ['RegionName'],
},
Timestamp: {
end: new Date('2015-09-12T01:00:00.000Z'),
start: new Date('2015-09-12T00:00:00.000Z'),
},
TotalAdded: 331925,
},
{
Pages: {
attributes: [
{
name: 'RegionName',
type: 'STRING',
},
{
name: 'Deleted',
type: 'NUMBER',
},
],
data: [
{
Deleted: 109934,
RegionName: null,
},
{
Deleted: 474,
RegionName: 'Indiana',
},
],
keys: ['RegionName'],
},
Timestamp: {
end: new Date('2015-09-12T02:00:00.000Z'),
start: new Date('2015-09-12T01:00:00.000Z'),
},
TotalAdded: 1418072,
},
{
Pages: {
attributes: [
{
name: 'RegionName',
type: 'STRING',
},
{
name: 'Deleted',
type: 'NUMBER',
},
],
data: [
{
Deleted: 124999,
RegionName: null,
},
{
Deleted: 449,
RegionName: 'Georgia',
},
],
keys: ['RegionName'],
},
Timestamp: {
end: new Date('2015-09-12T03:00:00.000Z'),
start: new Date('2015-09-12T02:00:00.000Z'),
},
TotalAdded: 3045966,
},
],
keys: ['Timestamp'],
},
TotalAdded: 32553107,
},
]);
});
});
});
});
| 26.518199 | 254 | 0.397327 |
8d27d7137dc0992f939ba10c2d0b668fc9d7a1b8 | 869 | js | JavaScript | client/src/components/LandingPage/LandingPage-View.js | darkfusion90/chatrooms | d0b53bf7169022b5096cd3c8f58447e74bed5312 | [
"MIT"
] | 1 | 2020-03-20T10:19:28.000Z | 2020-03-20T10:19:28.000Z | client/src/components/LandingPage/LandingPage-View.js | darkfusion90/chatrooms | d0b53bf7169022b5096cd3c8f58447e74bed5312 | [
"MIT"
] | 5 | 2021-05-11T01:55:16.000Z | 2021-05-29T07:43:41.000Z | client/src/components/LandingPage/LandingPage-View.js | darkfusion90/chatrooms | d0b53bf7169022b5096cd3c8f58447e74bed5312 | [
"MIT"
] | 1 | 2020-02-18T23:20:23.000Z | 2020-02-18T23:20:23.000Z | import React from 'react';
import { ButtonGroup } from 'react-bootstrap'
import {
CreateRoomModalTrigger,
JoinRoomModalTrigger
} from '../standalone/RoomModalTriggers'
import './LandingPage-Style.scss';
const LandingPage = () => {
return (
<div className='landing-page compensate-header w-100'>
<div className='d-flex flex-column align-items-center'>
<p className='welcome-msg'>Welcome to ChatRooms!</p>
<ButtonGroup>
<CreateRoomModalTrigger>
Create Room
</CreateRoomModalTrigger>
<JoinRoomModalTrigger variant='outline-primary'>
Join Room By Id
</JoinRoomModalTrigger>
</ButtonGroup>
</div>
</div>
);
}
export default LandingPage;
| 28.032258 | 68 | 0.559264 |
8d27eac6fef80651858d861c4c1a1a646509d14f | 2,791 | js | JavaScript | local-cli/runWpf/runWpf.js | mikavka/react-native-windows | 2e082951d1bf351e621f7763de7d1b4eda92f6c4 | [
"MIT"
] | null | null | null | local-cli/runWpf/runWpf.js | mikavka/react-native-windows | 2e082951d1bf351e621f7763de7d1b4eda92f6c4 | [
"MIT"
] | 1 | 2018-11-21T22:35:10.000Z | 2018-11-21T22:35:10.000Z | local-cli/runWpf/runWpf.js | mikavka/react-native-windows | 2e082951d1bf351e621f7763de7d1b4eda92f6c4 | [
"MIT"
] | 1 | 2021-06-10T08:43:09.000Z | 2021-06-10T08:43:09.000Z | 'use strict';
const chalk = require('chalk');
const build = require('./utils/build');
const deploy = require('./utils/deploy');
function runWpf(config, args, options) {
// Fix up options
options.root = options.root || process.cwd();
if (options.debug && options.release) {
console.log(chalk.red('Only one of "debug"/"release" options should be specified'));
return;
}
const slnFile = build.getSolutionFile(options);
if (!slnFile) {
console.error(chalk.red('Visual Studio Solution file not found. Maybe run "react-native wpf" first?'));
return;
}
try {
build.restoreNuGetPackages(options, slnFile);
} catch (e) {
console.error(chalk.red('Failed to restore the NuGet packages'));
return;
}
// Get build/deploy options
const buildType = options.release ? 'Release' : 'Debug';
try {
build.buildSolution(slnFile, buildType, options.arch, options.verbose);
} catch (e) {
console.error(chalk.red(`Build failed with message ${e}. Check your build configuration.`));
return;
}
return deploy.startServerInNewWindow(options)
.then(() => {
return deploy.deployToDesktop(options);
})
.catch(e => console.error(chalk.red(`Failed to deploy: ${e.message}`)));
}
/*
// Example of running the WPF Command
runWpf({
root: 'C:\\github\\hack\\myapp',
debug: true,
arch: 'x86',
nugetPath: 'C:\\github\\react\\react-native-windows\\local-cli\\runWindows\\.nuget\\nuget.exe',
desktop: true
});
*/
/**
* Starts the app on a connected Windows emulator or mobile device.
* Options are the following:
* root: String - The root of the application
* debug: Boolean - Specifies debug build
* release: Boolean - Specifies release build
* arch: String - The build architecture (x86, x64, ARM, Any CPU)
* desktop: Boolean - Deploy to the desktop
* emulator: Boolean - Deploy to the emulator
* device: Boolean - Deploy to a device
* target: String - Device GUID to deploy to
* proxy: Boolean - Run using remote JS proxy
* no-packager: Boolean - Do not launch packager while building
*/
module.exports = {
name: 'run-wpf',
description: 'builds your app and starts it on a connected Windows desktop, emulator or device!',
func: runWpf,
options: [{
command: '--release',
description: 'Specifies a release build',
}, {
command: '--root [string]',
description: 'Override the root directory for the windows build which contains the wpf folder.',
}, {
command: '--arch [string]',
description: 'The build architecture (ARM, x86, x64)',
default: 'x86',
}, {
command: '--verbose',
description: 'Enables logging',
default: false,
}, {
command: '--no-packager',
description: 'Do not launch packager while building'
}]
};
| 30.010753 | 107 | 0.661053 |
8d28f8a333ffa9412628f4ee19eb04f42bab7e41 | 25,730 | js | JavaScript | Data-Analysis/venv_macos/lib/python3.8/site-packages/echarts_countries_pypkg/resources/echarts-countries-js/Greece.js | Qiaozhi94/Python-Projects | aefc6cf49c1f4f2cc9beba8dbe80cfa826ba75c4 | [
"MIT"
] | 67 | 2019-03-27T15:07:04.000Z | 2022-03-08T06:16:37.000Z | Data-Analysis/venv_macos/lib/python3.8/site-packages/echarts_countries_pypkg/resources/echarts-countries-js/Greece.js | Qiaozhi94/Python-Projects | aefc6cf49c1f4f2cc9beba8dbe80cfa826ba75c4 | [
"MIT"
] | 4 | 2019-06-01T09:08:16.000Z | 2022-03-22T07:27:42.000Z | Data-Analysis/venv_macos/lib/python3.8/site-packages/echarts_countries_pypkg/resources/echarts-countries-js/Greece.js | Qiaozhi94/Python-Projects | aefc6cf49c1f4f2cc9beba8dbe80cfa826ba75c4 | [
"MIT"
] | 60 | 2019-05-21T08:19:18.000Z | 2022-01-23T14:25:54.000Z | (function (root, factory) {if (typeof define === 'function' && define.amd) {define(['exports', 'echarts'], factory);} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {factory(exports, require('echarts'));} else {factory({}, root.echarts);}}(this, function (exports, echarts) {var log = function (msg) {if (typeof console !== 'undefined') {console && console.error && console.error(msg);}};if (!echarts) {log('ECharts is not Loaded');return;}if (!echarts.registerMap) {log('ECharts Map is not loaded');return;}echarts.registerMap('希腊', {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"Aegean Sea Administration"},"geometry":{"type":"MultiPolygon","coordinates":[["@@`TXdZ@`IXJP@XJ^DRFbFZAGOQBGQDQkWKI[DW[KA][KBaIogUJ]@UbHPdX@HRN"],["@@WLNRTEHOQG"],["@@MLFtJTU\\W@KNYNNPWLGVJT^JBRZNJN`LRnQ@PpXP@PPVdXHVEJE`Jr@ZP^ZM^XP`j@J[C]SWQKGqNMAOHQAQOAMMM_MI@_OW_QGIKwNKYMBOPMdEHGCQVQ^I@_^SGQOKM@CMFWNKXH`MNWQSESQNi@[_[ES[MICWBSXCcWKAIPY\\SAYFGNeNPVj\\LPHVOH@\\"],["@@LJXESM@O`GII_O[QW@NXJdVR"],["@@fCaMWDTN"],["@@UJHNTIEM"],["@@SA@UQDe@KAYFe@}IITLTGJ`FZEHLRE`HHE^LV@dOH["],["@@KLRZhJRCB[eqMRLN@PYM"],["@@QPDHZAFKQI"],["@@QQQBENPFZC"],["@@OHKV\\C@Y"],["@@XFNVRH@dHLTFXCKSEePeAU@[K@ATUGWBQJIVON"],["@@]@DPREHI"],["@@ZEIUSRDJ"],["@@LFdUOKu@GNVPHA"],["@@@TZEYM"],["@@IKYCBZZ@HI"],["@@GLH`YL`LAwCK"],["@@BPXAIKOA"],["@@BZHFPUYI"],["@@QHSC@RKLDNEXDVJJn@PHrFVUVgJIO[OGISYF]C]H"],["@@NGJLZBAdbDJR^HFI_KHWPFNCjHVJBW_GDGhLHUC]GK_EBGbCBKWUVIGKYIOOQASHCR^@FREJYDcLaKFXPDHT[DEK]BWJDf"],["@@W\\KCG^DN`J^EFaIIGWIC"],["@@bPPGRWlDLOMMDUPKhBXYRFLG`NPXY`_DMIijEPBhbHCSLKN@dYfC^APNFZE\\OO]TkBMLWCQW_QGYBEIWBIMUFOKeRaAMQAWIeAEF}IOKIX@T\\^KPDNNJE^PNIPDR"],["@@\\H^AHIbGJMDeMAOOM@IJkJWlHR"],["@@RDXN^ZXAJOXMLPZSQGKa@[MISWiB[IOZ@TSJAhDH"],["@@eFKLHN^DCPLJjRJRZIGUTSCYWKKDMM_B"],["@@kTMRO@FZjTLYB]L["],["@@]FNPfEIOK@"],["@@WO]AoJOXMHEPBTSCoD]\\Q^tLVSfOXOHMTCXHLM^KCQZW"],["@@@PUZAPNN`CRF`KZQhK@QdBJTjVhQOpWNATU^JL\\BXEHIgBGdSRMH_[FMNgKBO[IiJU@IIOBOKUALaKOSDGGLQTET_WGWJ]MiPQ@Y^MfMBMRPL"],["@@SDAZXANFT\\LALWeAUa"],["@@JD\\TtFNENYMM_QGU[ESYQCGK[COKuUQJR`jlALJVLHVBXL"],["@@RONCLQOUJG^@LKPCRSdCVQJY]EM]PCEOHOMGLKE[QBMNOUY@EN_\\GTWHCJQF[^@RUDUGCN[TJLHVBVGXX\\RLRCLJZDLO"],["@@mVDZOLJH\\FRE`_GOUS"],["@@QHD`nGO[OC"],["@@POnON[xK]QSDUPmKUIg@YFQJSBSPALPL@JXHFR`TZEFMXA"],["@@sSDWUA]kKgBe\\DZMMOCSQEIMVYEE_JMAW\\MFeAccSWC_Wiwyc]YaOG]WMB[OOS[SyEMNGTQL_LBJQXCLMFPRjRtLCLD|E`OPY@cPQ@JhQNCN]CIHCPhRPAlLlfXALNR`RX@lLVNFH\\LH^CTPJBd^\\bLV^JHJdT`DTjZfJVJRNNBdPRL`LTfNFfGPBVJ\\fZ\\P[TIMc@QESLQPEKaSCUWQWCULOCMSYIAQSUeQiDKI_IMSG@KMUKuWB"],["@@WMiJQ@ELe^EXDNGLSDMG@K]@IWKDATgBP~E^jUb@PhZAHJNQJW^]BMNGDQSUJIRCFLRDFM\\SRbLCNOAMWS[E"],["@@DVERUPRTW`YEYHa@BZ`RMJCN[peNYn]LQCcDMMULMYQUSgWUJWR]FqBQLMEYJpRN@dK\\DNRJ^NLO^"],["@@FSOAGMHQCW]RS@AXZvPKXE"],["@@NIUK`[@]IKQHQCSN[FIZFRRQTJJ^ZB"],["@@KB@TPLLCEWIE"],["@@LC\\FTGBMOKOBaKcZPHJVNM"],["@@YFCRVBZNXDHMkSEI"],["@@DMSOBMISEOIKSXY@QICUZKBMZYDYTLNE`DNPLlTDTP@dXRC"],["@@[BBRXGBK"],["@@v\\DWM]RC^PJEXFNGL\\YFDRnDFYOKJUUSKSFSYYPUP@NQWCJSgiE_[GUMKSWCq]kJEL]DUVOIQD@LSJIRG`FPRJEZLVjVRB`\\aJHZj`hHXJ"],["@@kNKLDLh@VOBOKE"],["@@gFLN]DFPnCVLNKLHfKLOyCYJGU"],["@@KAEOPCG[SDB\\EHLVLBJM"],["@@KNBNKR[FMHR`h`FNbZ`TPAEQFSOaXGDSNEh@P_PKI]QB@L[QEOFQIICQOKDKUCK[UBM__SoQORPFDNKHFVLRN`dNW\\BTNH"],["@@QZVVbEVahKbLRSE]KBiM@hQ@UKYPS@EJ"],["@@ICMRLLNGAQ"],["@@bYNMRCBOKKYDMbSAM`RD"],["@@\\]VCJK[C@[ZKAUUAgJJRTD[POOIdHHEjJHB\\EJAhBPrUBNbDAOhKJ_^KCIYN{LAKQAA]KGQF"],["@@CNKBIRPNLAVUHZEJH\\CN]JBNILLRVBLJ`F\\IBgd]LRIlLJfADWX@\\GCQH@_GSWKoAGUSDMUgEMOYKS@KJSHMEIR[K"],["@@ED@ZTFHaCSWOFb"],["@@ZZGRYBIZYLCRNBNI`FXMKmPMTNJECcSCGPOU]@HL"],["@@eBAMSAQLAQ]HGTJDSTDPvEVETF^UAS"],["@@PZRpAHRlZTJ_JAEe]OKaKQHKIGCOKECSGKQHHvDF"],["@@hLj\\VHLBOMOTKHSLBhEPKK[@SXYBMZKnEFKªBrACKNIBOGIFMQKFIUG@QKGRSNJRSVGTYQMQcUaHIjNh@Da[YAUS[W[QCPUSUcZENi`HPQLGLI`]^UEk^E^iHD\\SPQHWED\\SLBRYZU\\S@WJeEIEQJM`SN@\\IPDdOJALHRTR"],["@@KDM`BP\\]CU"],["@@RFJGVBfPV@dK|CRBrEdLFN`GJIRDBMOEGWGELORBLQ\\HtEZICOomBMSIAMSOHSrMHIjOBMfGXW\\EAQXU^q\\OXA\\GMKEiPIVDAYNYZEUWLMbSDGbWHOX[F_CYKMgBGFeLQIgAG`QF@LLP_BCVLJVDAf[TYdYRa@SCgSEINUDQ`[tQxVKJKEORIC[NAocOFYASF{OoCgKGF]C]PgLBs`SFIJyTuLFeCUOEHiVIX_^KX]T_AKRZDRZXB^Q^RRA\\NBRfb`DFJ`CPPbFDP\\BnRVnINYRuP_B_IeJcQW@QGGQICBiKMQCK[[CQkBQYH]OG]_C{T[DTYEw@GRMLALSPkLQCQFMPUBKNGXkLEPZNGbJHB`SHBLTDLJGVPLPZXPPCVNLRRCAORGd@LIPDHNRFRO`@PP\\JNGXJxDVFPN\\BHLPBLKZDPPVDLJ`BZPDNURJXI^XF"],["@@C`HTFdL@PPF^RHZQXEPMbWBUMKWIS]SC_UYgMLIZCV"],["@@HPPSRLRBNRSH\\^dTBZf@FMPAVL@JTRrV@Q[OPSEKNaAM{WO]SGUQGYLcKCQLSCQYL_W@OOFWREUUJadWRYgMGWPM_CVc^HHBVQN]DSLW^GRVA\\NMTZTDVYLDJUJmC_[[IBIXI[K@Iou`GVI@[faBSuJQGMFuACPYDLPCLTLNfTADNOF[GKQ[@[ROCQOWEsDKMUAAPRDTVKJQBELXLELNdDXLXUXS@IJJRO`HLDVGR\\HhH\\CzNfTPMHUNAPJTBdJjCZNRBAQNANM\\AHKIMFQPQVAOOHMZC\\PAPRF"],["@@NQIEJUuDHRPXP@"],["@@GHYBGRgF[RUR@TYFMIKFETWHJXSDSGKDChUJMGKLNdXT~h`ENRZEHG\\NPVGLL^RB@RVBBRKZFDEdQJMXSHIVKHDp[fgRJi`QFKNSdEZYV@LZ\\NbrRtHCvJVJjBPNZIR@pUdHBOXSAGXaXHVM@QRCC\\ZE^PLMXCBaW[HgQWc@D[\\B@OREB]KEKcMWFQEMH]AaNMAwdWMMJSIMWEWSo]IMHuVOWUM_gCWByQISUUDaSU"],["@@PBEUQHESeDIL]B_RMRWR`F^MRFRGRObELG"],["@@IRebPJ`GPP`DFGXLJQRA^QB]MMDIKK@i[EIFoPKKMVLDFZUL"],["@@NYKIGU[LERaFKKMJNR`HTTZEHO"],["@@PDMRPROPNHRMAURKPH@NTBEfJTYLMZZ\\NAbU@OMKXGHWWgMMYC[QLO@KNWFkkRIdQHHLQR"],["@@P_GKMAMSMSMMAiMJVCTDVMB[GIdPHlpJPLGBbID@dPTOVQACTnAVK`@`_F]@iY_DK^DAKRK"],["@@zbPIb@bHbBRDVMdDHGdEdNr`LXRnVAPPXANDCa_GSmgcUWWQaYMSSiQcKiCMDeIgDoKea[_YIKB@wIS@KJFhdjZdPN"],["@@QRAPRRFMTHT@\\GHN~EDUPCGUFG^B`IPNRCNJNC`SNQZJ`ELJzMn_PH@U`ABSAaKQcgCSLOYCsSOB^ER_FEKeNFJA\\ONcBBNUAIRMEOVSLCJWBib[LKRQN"],["@@YU_CMLDPCRDXN`CR[BHnALZpPXL\\`HLGJLCLHPdFRNHORJhOVEPOBOTG@OO@@QQkQWGAU]KEMWo_SGIWYQ"],["@@RXjDHFTESqP[kFUCgJeDW@ALfDPC`V"],["@@nNGLBAfG^BRQpcfCXKXBdSfKLSPBHNYT@L_\\\\FRILFDPPFBYXMLBrGdHjBOOgOS@IYXIHOGShDVGA]]@iIWBOGeHYAg_cESDiK[KWOIOBc[OSA{FgAQBcXQfQTUPGTmNML@MSWWOoEQBM\\JRKV[bTV`XLT^LbA^HZ`dRbA|V"],["@@BLnGVBVGXOB[SWAMRC@SPI[UE\\OCAMJWEM_KMVF@VOAIKQHGOoEFP^\\SVFJZAIPBLTFARnZVEDL"],["@@VDrOPGDMQQWC@K`GPHHIC]`W^cIUYAiGUFOXZHLJHTS@SGYQS@ETDNTVFRUFiC@RqLIV^^^ICV`FDQ"],["@@kFGYMiKQKEOVSFWYIGKB_AODU]J@HWLQZSLM^NnMRJTTPNENHdHATRhpJPZLNR^\\JBPRbFvVp^|ZtCJfNt^H@LaNK^KhCTL^aD[YQ_MYAUGSO@K_KQAcKiSmqwiWAR"],["@@VUJAZSSXKKG]C]RIEoAaG_U]CQKOQWQWCQ[]MMO@Om[GUkOOBWEWFOIa]yDMHQ@WTEZ`C\\^PCLRlKRFZITNNGNNKTfHYJWFFZ`FDHlLxFhX`JLLtZCLgDHPTR^F^BJNXE"],["@@IJWEEJZHHPXBHLVJDKGKiSAQ"],["@@YAaTqIGVRL`@LNVLNAVONBHMNKDUIE_B"],["@@tF\\KKQUIEIRIMMk@ELY`QH@PrH@G"],["@@[VfZcJHPOF@\\MLAV\\G`W\\CRHNQTM^eREFSVS\\]BKQOWEKYKLMKGOYY]HETMVQlFHSR@N"],["@@OTXXXBZUa[WD"],["@@B^HHlMU\\@L]T]DEOYFNXcVSFQLRPNKZGNDtU^DPOTCfYWCAOTMtUjBT[PIUIHIS]E_TDZQIGcLaG_J]@EIFgwCcN[TDJ_BIJXLX^QP`l"],["@@X^@FZVdNFAXNTFRKH]`WXMBQVSCONCAQPWAKQWDSTO]ECgK
SSBISeC[EWKOQEaBgGUIa_MJQKCMWKYDAPUJH~GLOB[N]HHP@PQ^UX@NNVIPibARUJCVjAXFLfx`RXtBVFh`@H"]],"encodeOffsets":[[[27521,36244]],[[27512,36281]],[[27764,36358]],[[30294,37030]],[[30204,37027]],[[25813,37114]],[[28289,37096]],[[28356,37133]],[[26451,37137]],[[28437,36747]],[[27040,36931]],[[27841,36721]],[[26309,37503]],[[27681,37474]],[[28512,37541]],[[27615,37373]],[[28542,37402]],[[26772,37404]],[[27720,37444]],[[27100,37404]],[[27804,37440]],[[28441,37488]],[[24824,37651]],[[24922,37621]],[[25201,37667]],[[25111,37707]],[[26051,37705]],[[26152,37737]],[[26533,37765]],[[25560,37481]],[[26904,37441]],[[27766,37531]],[[25725,37584]],[[25921,37668]],[[27324,37197]],[[26005,37268]],[[26413,37263]],[[28800,37056]],[[28081,37262]],[[26037,37281]],[[25965,37324]],[[26444,38025]],[[25561,37829]],[[25595,37858]],[[26918,37857]],[[25690,37937]],[[27746,37947]],[[25801,38026]],[[27565,37887]],[[27088,37880]],[[27748,38195]],[[24982,38289]],[[27360,38201]],[[27350,38256]],[[27361,38303]],[[27182,38223]],[[25920,38314]],[[25875,38287]],[[25828,38277]],[[27648,38353]],[[24686,38590]],[[25292,38881]],[[26921,39418]],[[26810,40321]],[[25573,40441]],[[25921,40918]],[[26131,39479]],[[26640,39067]],[[26895,39445]],[[26168,39496]],[[27088,38494]],[[27108,38477]],[[25561,38318]],[[26641,38484]],[[25583,38557]],[[24891,38436]],[[25294,38521]],[[27361,38714]],[[25064,38095]],[[27456,38087]],[[27720,37648]],[[26640,37821]],[[26187,37782]],[[26280,37761]],[[27785,37843]],[[25262,37859]],[[26211,37818]],[[27587,37891]],[[26081,38052]]]}},{"type":"Feature","properties":{"name":"Crete Administration"},"geometry":{"type":"MultiPolygon","coordinates":[["@@lIBo`IJEXlJBXfIb@nWS]AQN[\\WUK"],["@@`BVCuSSB_HAJZN\\K"],["@@PDTGFIWCQR"],["@@kBAH|HAQK@"],["@@WBAPPLP@FMKO"],["@@UPYJQI[LINRLPBFPTHp_GcDK"],["@@YVFLXMCS"],["@@QBHTTHjMMMOCUB"],["@@ASU@JRNB"],["@@JZIXFZXANK@UK]IIU@"],["@@iREROCcDRNKT]JSGKBWSQBSJUBgGiUMJ
HWE_ZYN]@yIMEUBOTcEQDKGWJWEa@UKuFWPEL_bWF}AMImEiVmNWEkR]FwAOQ
QIT[A_DSEWFSA[OiPMi@[HIG[VBRJDGT[J]@WNCPadHVbPRDBRQ@GLD^IJA\\XfNPMRDP^HPRAPFZSDIJAZRJBNXNH^ENUPNFKPFZLNANX\\GNHRMJFNRQDfNVNDFUOUJ[AKNOCYD_A]bOTB@KPOVCFtLFFFrJXIT@bGBWPRMTDJIPFjRNDTLFVdr_ZWUWAOJ]JKB]JgB¡\\MnId@ROtGGjBNDZM|GXJTIXFRJbEbPAVLPARPFVC`B@N_rNDHNb@HHdJ\\CdOfELE^mXsYaMeY@EQ}HYHiH[AUFQKMCCO~ObKVOhC\\DNO^S^G^@LXXCXTTF`cD_KMPWF[CUEICYLQBQ`GjGCZ@`VZC\\HNG`PtFNKZFPJJIV@|FJ\\JdDpPTJBJXFBH^NJLBPCNREHI\\BNEhF@SJIjJXENHPK\\BbHTABVX@NI^GXQbJfIXdLHfUTPdCA[TMZBFGMaHkNY`KhCzDpH^@FHdC`@NUJC|DRGVDfAVFÎDzFXGPa^UXCTWnCzFhH`RZBdXXDLGTBfZHA¶X\\HVMZGVAbHZBHGZFRGPJNADMKUYQsSFUK[EaZIEIBULQMQcIAQPQMGPKKKKWBOV[PGGaTKRARJbQ\\ALMNDdKZVXfJALdRHHMRLP@PVTHGP\\FHEXChB\\HN^TDFKrHRPCL\\RPRTBLKN@VJVSLDVE`HRJNGKWIEVQdInD\\J^`ILfJNVP@VTEb\\LCNZD@MbNtLWJRfdLTB@WSCJQeOCWaEMIBWToFQS[V]nO^XDc[SYDWKDYIEBSNIG[@WUWMERQ{}CQSW]CGQaGCOKASF]I[A[WQ@aGcJHLUZaDiEc@IISP_A@JYXWF_OUA]HaCGEcC
QSIWBEISaEgD_PUFOM{ReD_CWOcDOC}BWD[GKIaCYOmDeO£REECsT]D[EOKaCSKODWEeJUCKMGQ]GQIsMUB]MQ@ONcF}GiGN_CQHmDYO[BAM]HgBaE@KUBENcAYCCGaL[EMJL[BwGSOwK]Da@UEFXTFL^AGBD`ZH@^MOjkb[@eLQEYFSCUDMEcFMASFcEODKLaAMXKBWXKRQL[D}RQIW@_N"]],"encodeOffsets":[[[24701,35637]],[[26324,35713]],[[26964,36123]],[[26807,36172]],[[26812,36189]],[[25847,36278]],[[24585,35758]],[[26760,35772]],[[26485,36038]],[[26354,36104]],[[25028,36000]]]}},{"type":"Feature","properties":{"name":"Decentralized Administration of Attica"},"geometry":{"type":"MultiPolygon","coordinates":[["@@OZ]L_\\QdWPAZ]LBdCLOTsDwEG"],["@@VKJMZELKZGtaTWPGZWVCD_Y]aP]GIIQyBeFGAYFOGacLKLeICNe@QN{HON@PMFMZSJC`FP_dHLfPCXKLCXJDFbIV_XSHL\\LLJ`ZTARHJFZwL@LWEIFQPM"],["@@[LVHFS"],["@@OFIbZS@S"],["@@O@[XPJ`YCG"],["@@TOMGBKQWUFQGODITe\\BNULEJTHRIFN~QLKVG"],["@@PGZCPKP]SAULKVWLDJ"],["@@C\\\\B@W^EHWPJVUUSiMMHS@GHUAHUSDBTS@c`bD|R"],["@@BRVVXTLRBZN[We@wNiCET[GU@MJFZSV_GaHFL_DKE_TUDKRs@cFWhNdNLNAJZIRRFNLdOxOfQJ_bObCRUPI\\BTFbRTPKJIZBLOJUVKRaXS@AL`L@LXBVNj@hHdKDKTWBIOU@SUKQQDOEQ[K^W\\IBG^G@KYK_ALURDhIZ@r[RCRMAIrSdWG[BWgOeAaMgCcA"],["@@VINMKeQ]@IEHUMGGMCWOCIQ@[GUMIPaCGHLXnRdJbPRP`PzLdR`@VCZLPA"],["@@IBMPWLNPRGbHDH^C@ONANRVFNKKUsQsC"],["@@QGBKdCNGUKI[TQYE@SQFMM@OOGKN[CKIAMYCCIgQSFBJaReDFZIDVhlDhG`@TbjnoC]SSAeNII[HXL`BPTYBkJDJdDZENIfFHJORPNfBjKn[I]"],["@@QGELFNXAEO"],["@@YLLHNS"],["@@IPTDIS"],["@@[@MHBLdHPYKA"],["@@[DIVJTX`LDfENGFW_OM@S["],["@@ALPJLMYG"],["@@_@GKNSYOOWCSLMOKOBQSCYRGP^HCXMVkNINEXUdZHTC`NrFdERFPEzB^GNIQQAS"],["@@MbSJ_@[LeLOVNdZLU^JjENdJNAhRXDJTLJV@RLZHBbSROEUHU@DRIJ`HhDZADPqVcFiBSGMBkABJN@PXJ`AZDVPhKfBXEZDPNAdDXIP@N\\b\\@@TVFLGjDRCTFRL^E@WISBQ[EOKL]dBXM`FPC^D^OJSDYIKDQlO^@TERO@U\\@xF`LNZjDNNlL@lVRKPL|MBJlCVTZFVdLKZLPdBLRDRNGhAVLHObBfJTIHQLGV@RLv_ZAVGXBXQ\\IZH`ERKhENEjipcRIjebKDO\\OVA@QQ@MQNSVEGKSK@OKOg@UGcQeYOYBUJUXaC[LQEQjeLSCKLK[OKIG]DMRkY[vI\\[CWUG]DC]TOPCHLPBDMKIdMUgRQUMVKPACQVAVODaGGOkLI_MUU@K\\[EMDKKMZSKMSAIKUGQMEOULOEWLSDSGOPQAsNFTIxTTILqQKFMZE@VWPoh_HOTM@UGSTUCMgUCK`WBBd[VINSDRN]VKNMZMNFP_ZgZGXUDUMODOSUAQPQ\\OBHTMFOSONHIdbPDX\\EZZ@h[RMNSDAOUDGKS@]RIBQMUBQWkAsIEMUI_S@QUK]@FQ[GeDGF
@UMkDYJAoMm]eE"]],"encodeOffsets":[[[23887,36683]],[[23540,37193]],[[24467,37721]],[[24031,37793]],[[23735,38109]],[[23717,38160]],[[24481,38389]],[[24037,38436]],[[23987,38310]],[[24121,38267]],[[23866,38216]],[[24100,38880]],[[24337,38674]],[[23808,38713]],[[23817,38724]],[[24533,38548]],[[23902,38578]],[[23815,38603]],[[24121,38652]],[[23736,38863]]]}},{"type":"Feature","properties":{"name":"Decentralized Administration of Thessaly - Central Greece"},"geometry":{"type":"MultiPolygon","coordinates":[["@@U@GHZVRIVC@Oc@"],["@@DNVMTCCOaKSHCLPL"],["@@YNFTTRBJ`REWUSDGI["],["@@GVOPYDUIMSJOUASHBR_FKLBRXJhBLJCRBjSLaQS^SGIHOMERSJU@MbKBMMQ\\OIcBAJ^XRbJ@NPIZQJGVPTNXLBLRbB\\MLURA^WhKZONKRGEMOICWNiOKpIDK^YPDNKRCRMt]JYVIH[QGHKIMOC_O[BKHSM]L"],["@@_JGJJLJ\\RXZFhOHY@QKE@QYAUJKM"],["@@QDKLDbVDLE@_GO"],["@@Z\\`FWYaG"],["@@MHPbZ\\ZFD[\\@NKIeBiOOKAWOSPWFV^EJ]IHZJ@"],["@@YJR\\ERLTTKQ"],["@@XVFRCZ\\TXcCYMQgOUABL"],["@@BJIXXXPEBSK[XUGMkCXXQL"],["@@OPXLG["],["@@TMlOVOVDJIvQHQKIbWJVpCbBNSMWcggE[[WAYF@POHcBMC[FOZBPIJHTY`_TCRQTKDQfUTAN\\PVIDShI@OJI"],["@@E\\TDPR^CfKDMVAReK]O@QJGKWDekHUYDMV[EYBUTYGC\\XVNCRLL@dNHH"],["@@OFKR\\CNYZNrLCJSEMBWXHScLWKUYQKJWB"],["@@VLA^\\VnNU@Q^BVMKUKUQMIS@WMSSIUAOWGJc]GU_KIRMFQEATPNXB\\TZHFVMDJPCN\\jLBZR"],["@@FO_FMZPBVEBK"],["@@B\\hGYSO@"],["@@HVPUQMEN"],["@@KPO`XE`HGUQ@A["],["@@HPKLVTFaWM"],["@@TE`C`HVFfCVGPDTK\\ENITBXCJIpSIGUAcaEgH_NOhYJIkla`K__]M]cH_AWKOFQKKHMP@VOH]gDK]XOdGPaIKBYQGBMNCFMhUEWNIBKRBJMCg@aJGWQBSLCf{NFLKX@DQbG\\JHSIQPOT@PKRD\\PPA\\F@MLKdGJKPAXHFI\\CRFVCNJl@JGhBZEVBz`PMY{BIMK@UNMIYHSNEBMISBMIoYSAUS[BM_G]SAKaS_@aJ@TQp_`aJQHUBqQKSASTYO@CYUFCJWJIPQA]fA^OHYBM\\`TMjKPOF[GDRQT[BGLQCQJOODNRCNDTNJMNOCQDSECLJVlTLVGf_REhIRMBcVIG_BOY[HTZXVBRfhGTQF]QGWOSOAGVDH]^DFhHGHLPQDDXeXQGeF]AoFENHJj@VH@TMLE^RN]fWM_DQPiDOK[GKGcDMG@QNUCYReJaDMCa_eJOCcJOLYCWTgB]FOIUDGQKEQFKCQPDJW`OB@bSR[AKOEbJLVNRITHHPGHHZNLKPBbKFFT]VOPIXODkAYTeCYEcXQ`OzUJ]TaBStUTaPWBWHWXSHY\\I@U\\KHYjYBKJiEGV[HWZYLK@OXeXENQH]D[NwRU@UOsEUEeTmPQtGDCsR_SHMXDVGJDVQD[}YCE
BeAUHWAeMODgOSBHVAPHRTLHXZEVHBJp@RNTBjTRXP`CBN^FVP@R^NjIZFJN@XLXAXv\\XX`CPHhGLErBRR`PVFbA\\T~NfALGZe\\IxGBUMUFUVYPEfCBGdBF_Q_DcL[NKAKN_ZaZYjKbORADYVB@IVMRBfQTMHHTGKOPUVF\\GXQXENLI^VhCV_ZUBMRAJKGIRUTCLKTFM\\SlGROfB\\JRGdC\\K"],["@@`BbANR@fMX[[EQISWDSfDEo`gjPDPdhJdf^Z@dRRQv_BMOMD_ZTXGKUDQGcIG@MSKEW\\EDWXGLUjTT]jLTU^IPMjMNBLIQQJMNAAkmVLhCRHTEfJXVRJhG`MDUXEPVOXOJ^I|_LKL[MYDY\\mJWNQTClQ\\]^OLSROvUZIPsLPo\\NgFcNU@QLWJGTkPMHOLA`Kvc`DVQDS^KlBNMVGHKlSdmL]PUNGXY\\Q@E`aRA\\YH[RMDS\\OX]lM\\aNG@eVMGYZ]naCMJOXKB]VW@KPKMaUKBIUK@GkSSBUESDm[m@OFWOCIhIKKcGYD[AYICMQH_@MM]EcFoGEPeFFXNFJrFJVRXARJLSPGDSOE@OOAMSFQZDFH|b\\CFP^CJJILJHE^\\ARM\\@@TVjI\\kXQ^ANS\\LRS`KBCVYNQVSDSJCPeJoDKFgGKHwBKJGfOBWVkEUDGJWJUEGS^EW[MUPGFKTQSM{CUIgJQKQDSMSDOMSBOm@aHQJmPaV_PMAWPG`XDVV\\NACQDYZDNOHcCWTeTGPFIR|AFUNEJUCQNWVG@QKUDWYEAK_B@YGSXGFNvJnVJLlJ^AHGMYuGMEWeBEKaYM@]IS[FAJYAUKEQ]NGKROoWUHOE]JSCgHaaAWMQcGSDEK_IUHiWWHeBY\\QCMOkJECaZOViDKL]Ck[EA]SE_ULCpRNCIQUQFWPHTCHQV@TNPWRDTVPHZMTJNETN`DPPXcPMTBpqPSXU`EJJ`@JCfRZajWFKRANLNR\\PrKZ_|SzBfFPA\\P\\[VaNEFOKQ@[J_RIbsNKH[REZTLCLXJDh@JE^NRAHN[RSHGNJhWZWx[\\N`AbKXAPGbcF_c[_CKS]Wn@LGFSTGB[NITNfG^QYK}COO@QZGZZElDJUTAnFRCZB\\YrCVITL@LXRBPbCPIPU`[PCCY[BIIAWRBhKCMN_VAhQK]HaRGBQ`]TATS^@CQKQcAKOLYcKEUSYDUIkNAK{LOUQ@kkKMMiCMY_KwE[@@VQPSF]@kPCRJLCZIT]P]COD_EWNcAK^PL\\FARJT@X]FQKSEQDiCKHUE@S[@[a@MJOCWBcOMYCWFeAgLUOYC_BWIOM@TLPRgX@N_J}yKOODILWAWDEJbHDRiRMRG}HKCOLSEWDM[FIV@LRP@^KHSUEIIS@WPoI@TG\\KXB\\S@BKUKGNODQiJQGUP[BOPO@DRf^^HANWL_DIHWAETyN}\\Y`BVRNG\\IRm\\WCUMIO`ABUUQ[HAROCSQQDM}VEDQYKFSEQ_MY@SNFLKHSd]PILHNbBCPSR[PCTQZi\\cbEPUReE]N@VOAULDcLCHg[@YGUYDMRMZAJ]eA@OTQQEISUAUJCPMHuIWFYRMY@K_HUJW^KBQSOPka_KK_IAWVOXQNEM[HAXQ@EPo@ONM@SLYF[ZkCMDaKMFIPc@OHyFOAkmKCSSaGqTDJhnHP@`L^GhVVT@jP\\VjHT@LJvXShHJBfRHD^TZwZgFAJRXhNR@CT_VD`MPRRDLSPXHG\\hV^FBJEZSVepmKUP_NCODYAieKSMgKyZWIeLOABUGaOMAQQQQBQGUAIKO@ANJNGLJPWZ_GOG«IEP[JwCSLJ{ZBXQ\\BfITKFATPDVZ@NIPHHJZbCzHBU\\dHXOLQEWToDYHYEIJwCkBDJSNDJCZK\\@PNFD\\RNOPYAUPSJeBYNYHELUPWHGG_FKLBZTLJPXNdDOLHHCXPNDTTP@NWH]VETSRFLGNF\\]DSPCNaTKR@TLVJ@JVb\\\\DLRVJP^TLD\\EFYDEJJZOPOHBLMJM`qHSEQHkGcDjJbIFCXQVMBYXQ@URQV[XKTjN@dgE]LV`XJAXOjB`[OAkH@`FXGJQDib@^VBTJFR\\FFZLF`K\\L^Q^@DOZKRDHXMFAZYTO@PnKTE`HJEdJHPGVDCLRTRbC\\VH\\ClPJLP@Bi^aRBVLZBFIVALT\\@fRILP\\SBGJ`XLPVGLJ`HVAVUVN\\E\\NRI^GVIdDLNtk\\IT@PJV@VQVCFK^CdJ\\\\\\EVMBQhBfITI\\RDbErA^M\\BZGJ\\KZC`UZRXAVidaFFPNB`NTNDXHFhAXN`hDhXNlNDLGRTLfBBZXVhXPP^TVdZPDJONIRJTTN^[NFAXQV"]],"encodeOffsets":[[[25200,39680]],[[24935,39775]],[[25080,39730]],[[25200,39701]],[[24831,38887]],[[24876,38923]],[[23620,40091]],[[24628,40276]],[[24909,40276]],[[24726,40320]],[[24683,40013]],[[24557,40044]],[[24208,40120]],[[24008,40125]],[[24527,40110]],[[24480,40171]],[[22610,39288]],[[23657,39562]],[[23646,39601]],[[24744,39074]],[[24676,39131]],[[24506,39595]],[[22646,41155]]]}},{"type":"Feature","properties":{"name":"Epirus - Western Macedonia Administration"},"geometry":{"type":"Polygon","coordinates":["@@PIRanGFMmUKQYGcQ]A_IOMGJFR_DYIRcX[VML[KMLYQQbUjJjEJK_u|aHIBePM\\BJRLDXYlSfCNEBSEicSDSIMJKDWGWvaDUkUH]XQTWPELmEQtM`B`G\\]^A`aSGHKTAXFvHjS^CI[BOScBUJIZE\\]NChHFOkWI]NO`KTUjB^UCMUU@OSaG_oQSOgISOCMVORUBWME]\\SMISJQPMCIYOUc]SOOgWWUAYeASKHQCKkMWMCg_gWMgBGECWSM_MMAEObEjcBUQWVYD_LYI[YH[A]NqBaFQC[SJeJgAARUN[F[[cI]DELUDURU@OIS@[JslKMcCUJ]HQJ[M[FUMUVUB_GKIUHKO_WHITAO[JKeQ[@KSUBEJYAUKQA]bAjO@IKkO[DUGD[QaQSDKUCOHIGFcGIF_LSOmP@ZSBYNEGWQCYLCP]@]R[K_LKEEY[EEQSIUA@]jaRCHIEW@_lGPB\\A_PiBWWIU_^KhF@ciMLS\\WRUVQR@ZWNARUDWJEIaidClHRGTFrGN_NIAKPGPOIYFIZCFEC[SKO]UIKQ[Ca[IUI@KU@SLQbSDM_EgO[EB]wYOMgSoRSL_AWOsXGOmDYKgDq^YkMfuFOaD]IEOYN@QeUe@OOKJWB]KWVITQBq[SYOAUbaPc@MEJG\\OTcFQE]aQEOOGUAYJMVMPBnYPQ\\AT[SISLUB_VWCWDICC]DIYKeLKXcxERZPF`G`]jebaZ]PKEib_Lqn{kfUPcNMNQAURHLMfJJK^PTONKACQSDUTSC@K_FqRSGk@mFITUJOPiXOP@VKZLPSJCNLTOHITsNY^E^WXdJlCdBFPcNpUHRTVCjUN^CR]RYFeIYFcDabYBEHFTRJ@VJFFZ[AORpPVNLXGRKBSR_J[CGNQHaXM@MOOJAX[DYNGL
GSDETjRBM~EZSTDXYVEXOZGbBlMV@PG|BRHS^TPDZdGJKXGCZFXPFVZ\\DNJNRTD@LaVCNOFEVTPJNENYZCJTJLNXOIj_\\GPFrxDZGNJJMJkrM\\BNOFUXALUH_VPlGPmjMbfFILH`JDdZVLRIT@Ntb\\L`BXSb@\\VHNexFpLhXFJ\\HhA\\JNJFTI\\P^RPBLQHQPBRJTEL\\L`H\\bHRIHDtOFOVN^d\\BTNL`FTNKRLXPJJTZJDnI`L\\GJAVbRRBVV^ZA`OJRQ^IpNCHNVRJ@RIRHXdAJNV\\LZEVH@PJNMfLFDREXXDIdJ[`MVW^md]LGJBhCJWBUTbTP\\IºŜAXB^@\\FVNPRPAhRVB|SRYLA^NBTH~NNJªpApSvLIdqZMFSDNXL@XPTDFL^JnAA\\GFJRVRDLnFZIXOb@TIRFd@JF"],"encodeOffsets":[[22312,41914]]}},{"type":"Feature","properties":{"name":"Macedonia - Thrace Administration"},"geometry":{"type":"MultiPolygon","coordinates":[["@@p`PATP`azOdHdEGQXYVCFM|KFKkGI[FQ\\EReiYDYLSDoVGKK@QMAINQAWW_CQFISgFIMiOAOmMO^UASLCPejQLYFC_GG^YDCvFPX`AVRV@L\\bTPHR@ZFF^GTJX^TB"],["@@Y@afeN]H]ZaVgTG^XAXXbV~T^@hJjAhKbBrSZ@t[laAQIeFYQAgSwG]MgGOG_AWF"],["@@kVuTaHi@SC]OqASHoE\\fRfCTORSPEXcfAVSRSBSLIl\\nDPK`HLL|C\\TEZUF]JWTWTInAJK`MdmJCFWN[NM\\ercTKtS¼i¢[dC`ON_N@B_JQPGZC`JdIHYcA_MaF]NcCc@HcFWRqF_RYF"],["@@OJUBAd`KHc"],["@@gXXLP@VLP]BUXACO{V"],["@@BJ^RBPGJ@d^VZ@RLNhXVFCX^AdVIZKLPdALRDZTjRTJTV~AHFpFTLPRN@ZRZIAMRMR@`GbUjJLVNFR\\nLX@TRVK\\C`FfEBMtKLG`AJIDel\\^ETL`KNLRAEO\\Sb@rDZCÎVpB\\Y\\AzbddNTAPPXfJR[jeTUvH`lL¸NKVRTDPOJCLPdXJdHHN^NLOVAJtBTE`FVEPDbItERFjIf@LFVAY|EVH~A`FdGRHT@lTVfI^LTZL\\B`\\PHrDbEdZJRT`FpfZBJEjROzF`FPCFQ^OvHbOlMrBPL@X\\LZVbKnD|AfINIZdRJ@LVZnAzPLL^AJH\\EdRLpfWDMPCDURA\\U`DFLpTLRPAHSVDDKTBLNhXIXKPB\\GbFNZHBVtRJMTG^DRMTHVE@I\\MCOTCXNCNLXZJJL\\GRPHRfT`IKQbMb]O[NWZDDH`FJLXC^QVRRVxDBMlGPFTOZNCT^^ZHjBZTZE@KRCTMMUbmG_TSHanOHUEQBMV[VETP\\ANH^EGW^CNNZM^FZIRALI@[\\aZGAIRMfI`[ZRC`P`C^ZCh@TMh@FL^Td@TUfUNDrWKbKPFnOFO`[TBVILN`BCOTWZ@RKLBlUCIVOfELQPGH]PSEKPE\\B`E`OZRh@TGVBLN^DTThGTXCDVVBTJbDNLzCXCVOLH\\~^R^AbUdGfBTLjHNKhGVGNQTABVJ\\pFHGVFPNNKTFRVPFPZOVEPSf@G[`SxJbLLLr@bE`RP@LZPJ|LVGdFTEXF`PLGRFVAJ\\ALRDhIXPJPT\\HHRa`iXCZbLDVX`ClI\\cAYBFETQP@^]FEMYF[AGbSAUTKVJTEXKJPT@PdVbGXBFVJLhHtZPBPShIZCZPNA`_xSnGbBPHVBZGlCNKBMTKpOrCHJTCNQbKfHHA@YIKWv@@YFaUSNKESNSMcTcHeOU`cBcEWDSbMBaJcO
Y[yYaDSV_NeKQBMUYDMUCWIEeCA]GIY@YEMM_SGMcKSFuESTmKIU@MJSPOMKGaHQ[IESR[`MJQEIYIDQUEQIHOfFVKIQ[OOQL]\\]CSZCJQfMFKOc]UaBCUp_HQLKCK{@w_OJMCAMdkWS]BgbGOAaGIcNQGFQCS]BEeXAHWWEBG_EqWGKOB__@KWSGMD_EYuKQAaQWDsBQPTNINJPAbSPEVMJK\\UEILwfeNLaI]F_GWHLkCgBGFKFÇZEAJSKaKPQLYD@LUJTOJaF¹RKJYj_JsHYBYEOOS@OG@MUBANKHJKBqB_CUTSFqHENLZLBF\\KNyPsBwOUM]]w]MiQU[A[F}MUgUkci[ieMQQBaPqJ}MaC[`_LaBcKOKUHgvk^epUj]L{DKKQoFaCCKQGqACUMAU]MBQQQF_SIWMDKKBWfMS_WNQOB_POsMemY[MO@eSm]McCeO{MIDaCXU@`OHeH]LMJsZuT}OwOMAgYg@SKgoa}IiDSjE\\MXCNYPQXIDKVS@[HONAXWb@DOX]@ZIZF@OLKjOCISKYG[AyDmEMSEeDaRgNWRAFSdepc\\AvWj@jGlHZCF[GQLQH_O_SAONSDal{\\_J]B_IULaHSAiIoSoe_TO@qPMKOYYAYuBQEYFOZk\\QDMXWRHHSXCEMJWZY`GXFHHRGNQÂ[VOfCfgbGfOP@HSXGGUOCCSFW`OVYSQYEHUVBPENJPkCQWUY@S]XY_GYANOPBTK_MaFgUOFELYBI\\W@E`HNWVeBGT]XgNUMUNAdWP]`HJDfgPFTCT_`UFOPMBQr[\\[XUCQ`WT[RH
GUFULYFYCcNQNQFINHGFcHUNwHYI}uWUS[M]@WSAGjMRcVSB{VeB_NoBYVYHqBKDc`ePeFGHoJaPoPDROZcRIRUJiBMPgFkCiKZjKXKFQd_LELDNGZUX_J[BIP@fXLjA^If@xHlLbNBNTA`XJNDTWPQFQR[PANVNHxINeT]DgJcM_U]HYUPIbAAgEGcS[GwYkLWDg[UDS]COEIbyCgIMONeRKSQuQYPGQSFQCO[TKVWAcJKD[LKBWVS[IYUSekYg_yGYMcE_J]suU_KYC]\\NQAiFgFI\\]JgHOh[^MNIvUPIPWOUWFCV_NgHQIWUeISFQGgDUKnBlMBINRRKJMAiNON]JSViKS^iSKVWHCX[FFXTL@NJHHdCRLVWHYSC`PNANu`QRcQY@e]IccgCOiO_hFpeCCTTXRJ\\FW\\eNQ@MaB_AUPDNTPhJTPpRH`Tb@PVVDN]ViASV_LMPJ^lXEPgGMD[^YFIJAVTdAPJ\\]DiTuGWESBGLTH_b]B[^_H_AsNFRKnOFSXWRG^lVCVubHXCXILJNCTdTFjATMFeDkTWZKCIQ[AONAfGJ{b`vILiFiIaVRRKZLNK\\UNW\\QdZJ`CEQHIPN`J^BdRZHLRnVENmHQbOJ"]],"encodeOffsets":[[[25201,41758]],[[26186,41366]],[[24092,40905]],[[24361,41166]],[[24480,41287]],[[22312,41914]]]}},{"type":"Feature","properties":{"name":"Peloponnese, West Greece and Ionian Sea Administration"},"geometry":{"type":"MultiPolygon","coordinates":[["@@`LFGYQKN"],["@@@V\\DRE@IcCIE"],["@@MLFHdLBU]I"],["@@HKHoIKVMUEWTkCaYKJ@\\NPRBRZTJfJ"],["@@WHOTM@ENRbOPALMKIK_Di"],["@@IJATNNIbFRHBHTPK`GSIH]iMLWSS"],["@@KJA\\KZDR\\yEW"],["@@MLQFgjAPLNYBUJ@TPNCLU@_HWV_bLZKXKFNRFpVVJRjDJVFPLVWCcPQAKXYLHF_LMj[ZIXNZEXIZArWPAbQV@lWGQG_NMrUXCT_`QtOCOJEISWA[X[DmRONkAqOWOO[YQIaPCLOPKBQ[GYOKJS@WHE`cLilIBO^WDCJUC"],["@@eLAPRAVO@I"],["@@GJQEGJVLLY"],["@@EW[NLjVBLOKQ"],["@@YHDl^XhtA_MSYQG[KGNU"],["@@APV`VjXNXJ^RR^FLTDV\\dTHhGVh~IKUFOLKCKTQMQBcFUKKDOZa@QGOieEUMG@UPELXEVTDLkGOQKXeB_USMFM\\OMB[OE@M]KSBIP][AKNSOEKLEXBL_GUf@XUHYeK]OYKCEOUWGJJTOPNJP|DxCp"],["@@XCTBPJbC@MQUcOKSyI_QNKWaUFBfLXTNBPRZPNXD"],["@@DNVMPQAYUK_GILQGKcUHO\\JLA\\FLnQANbL"],["@@IBUT[P\\L\\Y\\OWG"],["@@JSjUIObMBOMGiJ[DFJSD_TCVUVBbR@z]"],["@@`iHUHIPiX_L]DWLkA[XoVOX@L[jCvMT@NNTGPWREXUTaV}R@TZ@XIRSRCVHTYCKFQCwNB\\HTLJQVcNCP]j\\ppbZDXAZKpJTJZI`HVMRAfNdZ`XvKHWTOjO\\JNSZGFPTQBSQMI[MGOWoQgAYGYS[CM[NKIQRKJ[SALWLDRQ^IR@HIhGVBJEKOJO@WWKGZODASRGH[IWFcJ[LOBsLeNWlKVKj@VETiXGVDvV\\\\H]fkHeR[^WGIEUKEWL]AaT"],["@@glX@^_MK"],["@@]VGXPVnQjPFKSUKYgE"],["@@[DIZNR`OFKMS"],["@@QIGZ_TeDIJAVX^DTNV@\\GVFX`CLFBRPF@tLNLlBfbKBRZNTDHsLOREZB@KLOZDNTP@JL\\TDNRC\\`E`H\\QtFZKP@NJLDRMbJH^ALDXQZg@K\\PIJSCINUCGRyHeI[aKQOZOJcPQPYVCXJVVBRRJNGQ_P@TJRK@OVaDSliPSXWPULEF[TSPEN[hWFKGSMOGW@SGQUOQNUJYCOKuHgJYZYPgL[\\iNkASQ[ESMAKU@aVQDaCGPkVP^U`WPNF@RYjTFVSJURORHGJWHFRU`MFQtKHIVE\\KHA^[HQEMYTU@]R]AÃsAQI]A"],["@@]PINFVK^OHK\\CPKNCZUT@HSXGPHXNB`WL@LV@VITTHTQVGMSDYMAEM`IfACQZQEOQGHKKISoOMEeRAXR`KBLSNHPXMLJX@PYCOPUOIJaCGjM]MKKaGGISD_TUhCb"],["@@FMIiV]YKMcPUfK\\K`@TINaYEQKek}I]AEFcKa@ALKHUGaBMJOUP[QW[ICKLO@MN[XKbJPGLFZGHG^DhL`B@MXDbSNWTEh[CiHMiUUOUAQBWGDSTUCQX@hY\\FHGEQk{dkCYUaVUZIlUMKQEJQIYMBMKMcXgdEt@LQVC`SLF`CEKbG`HTUEYNIV@\\HFSjDxMf@\\XMAYKQWSUUAQ_OqPFQCKM_GAG[G[HENSDQMCKUUiACUPQTNNa`FXQUIY@OH{CYGQ@UKG[REXYA[eFKQkXQ@@NQLZLPNWJEQUEWJAZLR]R]DUCaB@LNHAVQjZCTGVH\\VBREVZIRMXLYLFJAZMBCTLUEQBSGQDKLNNS`aEWQSEOZMLG`O^IFFBNQPOI{D{OOUQNwPF`QD]dDV]\\cFgIoWQWNmZeBYS[@QHOZYJ_AQTMNQNAW[O_PO\\@LWFCZ]FSNQXEAQHYPSNYJ]rWQKL[PE\\ULWNmPAHgMA@QMu@_HOTOVGPBHR\\E`BDOKSPEBMNI\\CEWO@EWPAJQPELWJEHUQANWDqODKUJM\\DGWZYOITaV]LeAK\\eEYVYFKXGJURBDQIKN]PG@QXIAGiMGE@aLKIQcJGTKDUEAYWHOKGUFOVKIQPOAWQKIYJ[D_\\QDSTCH]\\Yid@NSBQdG]SJWAIQIEQ`UbALMAWRBhONQI_MF[@uHSEAKQIeLELmDIRY\\OTNNCP@\\URm^_FuOoAALS^@LORYLPXOVQHCL[NUHOJQ@ALQNNXB^GNUNGL[LIZQFSCDQEUKI]TCTZbHVE`MZQJK`BRIJBTUbSFiFwB{ADCAIeIeMAI_OCKNYB]LOqKgQQQCSRGUKH[^D@GTGC[HOUCK\\mPWQ@IdmLCL[OQSKQLAPKFeGAYGYLUCGJUBUISIcNQXQCKLMN@DwCS@_OMWE\\SCQFIGSYGUPAfPNWFORDTiLULM@UVYHEQkRI@]nK\\AVNAXPFNTE\\LOLARHHIRHNYDBR\\HELgJAPRFHJUJEdf@MPQNI\\JXnTMRYI[BON@LSVMlIDShMfKL@PMV@V[TKTcVCZWHDLQHBN[baFCL_ACISADKiDSROBeZR^NAJVIxRXBXHJElMHkHm@sJkCK¡_eIGGgTII[HYGeMUCcFQGSJWAKNQA_ReXGNQo[GOHUIKWCAMWAa[GOU@MTDHOXMJOBEPYTQdDVWLMWAKKUJ]DS@KXOLW@KdMH@`ILKtDPPN@XdTHX@RIJeR[@_KGTLZQZIVQVUJYR[l_PQTJZK@TO~AZV~flhZ`JXRNTlN^vPPLlGxGZWx_[rezgt[bstgfqfn
jpfiLwDQEOQBSQSKRLlQPLJN`FBD`WhDLOz]^yh`uRsNqFTQRF^EHLrXxHZCN`HRSVIVApNXNznbRXVjvLDfjpVZFTbHdA\\GfBXVbG`fBdm\\A`P`@TG`WTEvcdO^HTGjG\\I^EVF`TT@`TXBPRHVNBHLrfRnBXVJFfR\\JC^Z\\hLGtP\\@rlX@XIFMxEXB\\H^@`CrUNIfFTGP]@UTCNOVFZKPOFSV@jXfYdmHE@Svc^FLC\\UHSdEPHPKXAPGT@fHpGVJVGDM\\aZALKP@RKPAdIbLhK\\BXH\\BlWVQhSjINBPK`I`O~KbMJSfKaXGX[XMTQVG^oRQlWfGbYfMhBNE\\D^RZEdLTVZjIJcJKNmVORYJK@¥VTHxhPA^FXZbABP^LR@`GZCDMTKZAJGRN\\C@K\\EdL~@\\F"],["@@VRBV^@@UGOmA"],["@@XGEIDUKIYNGRE`LJRW"],["@@CPFPNC@OOK"],["@@]DKPTRVM@W"],["@@SFhtPACm_I"],["@@EPevlN]ZrhCZLnCHPtWXP`BTKpQhTPNxZA^\\FhP`FTO^CE[HMEKTQFS^UXG@MSOCSOMDWGGPKcCWMIOSKAYLK`EHHXGVOFKZGZMfATIVOZBPOQMC[ME@OL[DYCITMCIlAxDJIZFZGpCXSRFPKGW[cAVyGaDIYGGJO@MUYOCBSLEJSAeR[AW|YITKxD\\IFO¬JPH`HXYIOHKIMBMP@JLVBRHRARRBRPNHbAVPBfKXJzYhLTNfLBjCZDP`MVOnLfoTUFYAI]EgUH[WGTOCKQQNOC_`UDSQ@gMQWBIhExYSYC]QGAeGITguWKIS@iG[UiOS@UUHgK]@_GOgmCIMNWPUAKM]OeEKOQeAWSIcDYH]VaHeIcNWEYNaOGM[C_HY_]I[CQOS@ecIJcBArUZAJPNGHaGXSX_BmQGSXcR_HcDVtGVKDy`g^SbAPJPAPQFHuHSLOlalYN]GiIAJtGTk\\kbKPCLCLCjQIQHF[EWGG@]NCYW]UOACM]YAbiHOUJGBQsSoMKUdOFMqNWAYKWA[DeNM^DZMJk@BZElfTLXMXBTTA^IVJJ@NKJDNKHCXe^PDJNIHUCQTJTBVVhSLUE{WJIKM`@TMRAbPlCTHPIlSNEVURMRF\\ERSF_@eMIRQDOMOF@LQTWh@v]z@VEdKHi@_KioiASOWEMDO`G^GHiLJHGZNVIHVRIPSDx\\hJZADLXBoXGLSJUZIhTJF^TRRgX[lCrDFNRBAXXAJLTMBUQKHGXLZEZDJVN@RNTCLKZNT@FHTD^aEWVCDThFPYGOMC@Q^E^UbIJMhPBVGXZXPCNMXGXOZBToJKRFDTKTIhiRKRJ^ETB^NDJXAfU`]\\QbSL"]],"encodeOffsets":[[[21507,38141]],[[23523,38328]],[[22063,37939]],[[23531,37388]],[[22301,37580]],[[22217,37619]],[[22192,37796]],[[21225,38623]],[[23482,38388]],[[23420,38403]],[[21213,39476]],[[21410,39466]],[[21051,39601]],[[21417,39577]],[[21279,39601]],[[20727,40077]],[[20650,40167]],[[20549,40321]],[[19996,40712]],[[19857,40792]],[[20061,40833]],[[20880,39071]],[[21182,39269]],[[23673,38975]],[[21600,39218]],[[21601,39346]],[[21550,39378]],[[21534,39396]],[[21306,39398]],[[21616,39984]]]}}],"UTF8Encoding":true});})); | 25,730 | 25,730 | 0.787019 |
8d28f8c2889be499d5913f0599e879593fa8fbd5 | 143 | js | JavaScript | data/js/00/50/c2/e4/70/00.36.js | hdm/mac-tracker | 69f0c4efaa3d60111001d40f7a33886cc507e742 | [
"CC-BY-4.0",
"MIT"
] | 20 | 2018-12-26T17:06:05.000Z | 2021-08-05T07:47:31.000Z | data/js/00/50/c2/e4/70/00.36.js | hdm/mac-tracker | 69f0c4efaa3d60111001d40f7a33886cc507e742 | [
"CC-BY-4.0",
"MIT"
] | 1 | 2021-06-03T12:20:55.000Z | 2021-06-03T16:36:26.000Z | data/js/00/50/c2/e4/70/00.36.js | hdm/mac-tracker | 69f0c4efaa3d60111001d40f7a33886cc507e742 | [
"CC-BY-4.0",
"MIT"
] | 8 | 2018-12-27T05:07:48.000Z | 2021-01-26T00:41:17.000Z | macDetailCallback("0050c2e47000/36",[{"a":"Nadrazni 609 Nova Paka CZ 50901","o":"ENIKA.CZ","d":"2011-08-07","t":"add","s":"ieee","c":"CZ"}]);
| 71.5 | 142 | 0.608392 |
8d2917f11195442b96b4512271a5ee20bf05576e | 4,710 | js | JavaScript | index.js | firsttris/homematic-js-rpc | 1adcb25cfa21afdbaa9a43fa20015e073055c270 | [
"MIT"
] | 1 | 2017-04-20T17:38:43.000Z | 2017-04-20T17:38:43.000Z | index.js | firsttris/homematic-js-rpc | 1adcb25cfa21afdbaa9a43fa20015e073055c270 | [
"MIT"
] | null | null | null | index.js | firsttris/homematic-js-rpc | 1adcb25cfa21afdbaa9a43fa20015e073055c270 | [
"MIT"
] | 1 | 2021-06-28T08:37:42.000Z | 2021-06-28T08:37:42.000Z | "use strict";
const xmlrpc = require('xmlrpc');
const Homematic = require('./homematic');
class HomematicRpc extends Homematic {
constructor (host, port) {
super(host);
this.port = port;
this.listeningPort = 9111;
this.localIP = "0.0.0.0";
this.client = xmlrpc.createClient({
host: this.host,
port: port
});
}
registerEventServerInCCU (nameToRegister) {
console.log("Init Call on host %s and port %s", this.host, this.port);
this.client.methodCall("init", ["http://" + this.host + ":" + this.listeningPort, "homematicRpc_" + nameToRegister], function (error, value) {
console.log("CCU Response ...Value (%s) Error : (%s)", JSON.stringify(value), error);
});
}
removeEventServerFromCCU () {
console.log("Removing Event Server");
this.client.methodCall("init", ["http://" + this.host + ":" + this.listeningPort], function (error, value) {
});
}
createEventServer () {
this.localIP = this.getIPAddress();
if (this.localIP == "0.0.0.0") {
console.log("Cannot assign IP Address");
return;
}
const server = xmlrpc.createServer({ host: this.localIP, port: this.listeningPort });
server.on("NotFound", function(method, params) {
console.log("Method %s does not exist. - %s",method, JSON.stringify(params));
});
server.on("system.listMethods", function(err, params, callback) {
console.log("Method call params for 'system.listMethods': %s" , JSON.stringify(params));
callback(null, ["event","system.listMethods", "system.multicall"]);
});
server.on("listDevices", function(err, params, callback) {
console.log('rpc <- listDevices on %s - Zero Reply',that.interface);
callback(null,[]);
});
server.on("newDevices", function(err, params, callback) {
console.log('rpc <- newDevices on %s nobody is interested in newdevices ... ',that.interface);
// we are not intrested in new devices cause we will fetch them at launch
callback(null,[]);
});
server.on("event", function(err, params, callback) {
console.log('rpc <- event on %s' , this.interface );
this.lastMessage = Math.floor((new Date()).getTime() / 1000);
const channel = that.interface + params[1];
const datapoint = params[2];
const value = params[3];
console.log("Ok here is the Event" + JSON.stringify(params));
console.log("RPC single event for %s %s with value %s",channel,datapoint,value);
callback(null,[]);
});
server.on("system.multicall", function(err, params, callback) {
console.log('rpc <- system.multicall on %s' , that.interface);
this.lastMessage = Math.floor((new Date()).getTime() / 1000);
params.map(function(events) {
try {
events.map(function(event) {
if ((event["methodName"] == "event") && (event["params"] !== undefined)) {
const params = event["params"];
const channel = that.interface + params[1];
const datapoint = params[2];
const value = params[3];
console.log("RPC event for %s %s with value %s",channel,datapoint,value);
}
});
} catch (err) {}
});
callback(null);
});
console.log("XML-RPC server is listening on port %s.", this.listeningPort);
}
getIPAddress () {
const interfaces = require("os").networkInterfaces();
for (let devName in interfaces) {
const iface = interfaces[devName];
for (let i = 0; i < iface.length; i++) {
const alias = iface[i];
if (alias.family === "IPv4" && alias.address !== "127.0.0.1" && !alias.internal)
return alias.address;
}
}
return "0.0.0.0";
}
getValue (channel, attribute, callback) {
this.client.methodCall('getValue', [channel, attribute], function (error, response) {
if(callback) callback(error, response);
});
}
setValue (channel, attribute, value, callback) {
this.client.methodCall('setValue', [channel, attribute, value], function (error, response) {
if(callback) callback(error, response);
});
}
}
module.exports = HomematicRpc; | 37.983871 | 150 | 0.540764 |
8d291a3e809893d4d14e9b2b439cdb6d9413b5e7 | 4,508 | js | JavaScript | semcore/tab-panel/__tests__/index.test.js | YoMama84/intergalactic | 8907157c95cf1841c49fc6e3baa3b970e5f8ac44 | [
"MIT"
] | 71 | 2021-01-21T16:32:07.000Z | 2022-01-16T21:51:43.000Z | semcore/tab-panel/__tests__/index.test.js | YoMama84/intergalactic | 8907157c95cf1841c49fc6e3baa3b970e5f8ac44 | [
"MIT"
] | 40 | 2021-02-03T15:15:40.000Z | 2022-03-31T10:06:02.000Z | semcore/tab-panel/__tests__/index.test.js | YoMama84/intergalactic | 8907157c95cf1841c49fc6e3baa3b970e5f8ac44 | [
"MIT"
] | 20 | 2021-02-03T13:13:43.000Z | 2022-03-20T18:02:23.000Z | import React from 'react';
import { sstyled } from '@semcore/core';
import { render, fireEvent, cleanup, axe } from 'jest-preset-ui/testing';
import snapshot from 'jest-preset-ui/snapshot';
import TabPanel from '../src';
describe('TabPanel', () => {
afterEach(cleanup);
test('Should support onChange callback', () => {
const spy = jest.fn();
const { getByTestId } = render(
<TabPanel value={1} onChange={spy}>
<TabPanel.Item value={1}>1</TabPanel.Item>
<TabPanel.Item value={2}>1</TabPanel.Item>
<TabPanel.Item value={3}>1</TabPanel.Item>
<TabPanel.Item value={4} data-testid={'tab-4'}>
1
</TabPanel.Item>
</TabPanel>,
);
fireEvent.click(getByTestId('tab-4'));
expect(spy).toBeCalledWith(4, expect.any(Object));
});
test('Should support onClick on Tab', () => {
const spy = jest.fn();
const { getByTestId } = render(
<TabPanel value={1}>
<TabPanel.Item value={1}>1</TabPanel.Item>
<TabPanel.Item value={2}>1</TabPanel.Item>
<TabPanel.Item value={3}>1</TabPanel.Item>
<TabPanel.Item value={4} onClick={spy} data-testid={'tab-4'}>
1
</TabPanel.Item>
</TabPanel>,
);
fireEvent.click(getByTestId('tab-4'));
expect(spy).toHaveBeenCalledTimes(1);
});
test('Should not call TabPanel onChange after falsy onClick on Tab', () => {
const spy = jest.fn();
const spyClick = jest.fn(() => false);
const { getByTestId } = render(
<TabPanel value={1} onChange={spy}>
<TabPanel.Item value={1}>1</TabPanel.Item>
<TabPanel.Item value={2}>1</TabPanel.Item>
<TabPanel.Item value={3}>1</TabPanel.Item>
<TabPanel.Item value={4} data-testid={'tab-4'} onClick={spyClick}>
1
</TabPanel.Item>
</TabPanel>,
);
fireEvent.click(getByTestId('tab-4'));
expect(spy).toHaveBeenCalledTimes(0);
});
test('Should not support clicks on disabled tab', () => {
const spy = jest.fn();
const { getByTestId } = render(
<TabPanel value={1} onChange={spy}>
<TabPanel.Item value={1}>1</TabPanel.Item>
<TabPanel.Item value={2}>1</TabPanel.Item>
<TabPanel.Item value={3}>1</TabPanel.Item>
<TabPanel.Item value={3} data-testid={'tab-4'} disabled>
1
</TabPanel.Item>
</TabPanel>,
);
fireEvent.click(getByTestId('tab-4'));
expect(spy).toHaveBeenCalledTimes(0);
});
test('Should render correctly', async () => {
const component = (
<TabPanel value={2} wMax={200}>
<TabPanel.Item value={1}>Test 1</TabPanel.Item>
<TabPanel.Item value={2}>Test 2</TabPanel.Item>
<TabPanel.Item value={3}>Test 3</TabPanel.Item>
<TabPanel.Item value={4} disabled>
Test 4
</TabPanel.Item>
</TabPanel>
);
expect(await snapshot(component)).toMatchImageSnapshot();
});
test('Should add styles to under children', async () => {
const component = (
<TabPanel
defaultValue={1}
styles={sstyled.css`
SText {
color: green;
}
SAddon {
color: orange;
}
`}
>
<TabPanel.Item value={1}>
<TabPanel.Item.Text>Text</TabPanel.Item.Text>
<TabPanel.Item.Addon>Addon</TabPanel.Item.Addon>
</TabPanel.Item>
</TabPanel>
);
expect(await snapshot(component)).toMatchImageSnapshot();
});
test('Should support addons', async () => {
const Addon = React.forwardRef(function({ forwardRef, Children, Root, ...p }, ref) {
return (
<span ref={ref} {...p}>
Addon prop
</span>
);
});
const component = (
<TabPanel value={1}>
<TabPanel.Item value={1} addonLeft={Addon} addonRight={Addon}>
TEXT 1
</TabPanel.Item>
<TabPanel.Item value={2}>
<TabPanel.Item.Addon tag={Addon} />
<TabPanel.Item.Text>TEXT 2</TabPanel.Item.Text>
<TabPanel.Item.Addon tag={Addon} />
</TabPanel.Item>
</TabPanel>
);
expect(await snapshot(component)).toMatchImageSnapshot();
});
test('a11y', async () => {
const { container } = render(
<TabPanel value={1}>
<TabPanel.Item value={1}>1</TabPanel.Item>
<TabPanel.Item value={2}>2</TabPanel.Item>
</TabPanel>,
);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
| 29.083871 | 88 | 0.57276 |
8d292df3c38687b95255ce290cca446434e8c3c0 | 384 | js | JavaScript | test/unit/subset/verb/toAdjective.test.js | PSUSWENG894/nlpApp | caba8446e7492562af8001689ff23d151a729215 | [
"MIT"
] | 1 | 2021-08-17T04:49:08.000Z | 2021-08-17T04:49:08.000Z | test/unit/subset/verb/toAdjective.test.js | PSUSWENG894/nlpApp | caba8446e7492562af8001689ff23d151a729215 | [
"MIT"
] | 1 | 2022-02-27T22:20:10.000Z | 2022-02-27T22:20:10.000Z | test/unit/subset/verb/toAdjective.test.js | PSUSWENG894/nlpApp | caba8446e7492562af8001689ff23d151a729215 | [
"MIT"
] | 1 | 2020-01-16T23:21:39.000Z | 2020-01-16T23:21:39.000Z | var test = require('tape');
var nlp = require('../../lib/nlp');
test('verb-to-adjective:', function(t) {
[
['walk', 'walkable'],
['sing', 'singable'],
['win', 'winnable'],
['convert', 'convertible'],
['see', 'visible']
].forEach(function(a) {
var str = nlp(a[0]).verbs().asAdjective()[0];
t.equal(str, a[1], str + ' -> ' + a[1]);
});
t.end();
});
| 22.588235 | 49 | 0.5 |
8d298156e1b4ab1f96e5cc652d426ece9dd1fe36 | 350 | js | JavaScript | src/angular-carousel.js | chadobado/angular-carousel | 8c017f45c72f919f80ef51a1c8838658c34b8ebb | [
"MIT"
] | 1 | 2017-12-05T20:24:23.000Z | 2017-12-05T20:24:23.000Z | src/angular-carousel.js | chadobado/angular-carousel | 8c017f45c72f919f80ef51a1c8838658c34b8ebb | [
"MIT"
] | null | null | null | src/angular-carousel.js | chadobado/angular-carousel | 8c017f45c72f919f80ef51a1c8838658c34b8ebb | [
"MIT"
] | 1 | 2016-01-05T17:19:25.000Z | 2016-01-05T17:19:25.000Z | /*global angular */
/*
Angular touch carousel with CSS GPU accel and slide buffering/cycling
http://github.com/revolunet/angular-carousel
TODO :
- skip initial animation
- add/remove ngRepeat collection
- prev/next cbs
- cycle + no initial index ? (is -1 and has bug)
- cycle + indicator
*/
angular.module('angular-carousel', ['ngMobile']);
| 21.875 | 69 | 0.72 |
8d29eca50fd260adb32fc2bcb209b52ed75f7b5e | 3,132 | js | JavaScript | api/middlewares/schemas/misc.js | LuisAlejandro/express-auth-sequelize-docker-template | 80dfe19bb4599a28bda1765dd5a0d64bf3009497 | [
"MIT"
] | null | null | null | api/middlewares/schemas/misc.js | LuisAlejandro/express-auth-sequelize-docker-template | 80dfe19bb4599a28bda1765dd5a0d64bf3009497 | [
"MIT"
] | null | null | null | api/middlewares/schemas/misc.js | LuisAlejandro/express-auth-sequelize-docker-template | 80dfe19bb4599a28bda1765dd5a0d64bf3009497 | [
"MIT"
] | null | null | null | const yup = require("yup");
const { phoneRegExp } = require("../../utils");
const stringDateSchema = yup
.string()
.required()
.test(
'date',
'',
(value, context) => {
if (value) {
return new Date(value).toISOString() === value;
}
return context.createError({
message: 'date debe tener el formato correcto',
path: 'date',
});
}
)
.label('Fecha')
.default(new Date().toISOString());
const emailSchema = yup
.string()
.required()
.email()
.label('Correo')
.default('');
const tokenSchema = yup
.string()
.required()
.default('');
const idSchema = yup
.string()
.defined()
.test(
'isId',
'',
(value, context) => {
if (value === '') return true;
const r = new RegExp(/^[0-9a-fA-F]{24}$/);
if (value && value.length === 24 && r.test(value)) return true;
return context.createError({
message: 'Debe ser un id',
});
}
)
.default('');
const nullableIdSchema = yup
.string()
.defined()
.nullable()
.test(
'isId',
'',
(value, context) => {
if (value === '' || value === null) return true;
const r = new RegExp(/^[0-9a-fA-F]{24}$/);
if (value && value.length === 24 && r.test(value)) return true;
return context.createError({
message: 'Debe ser un id',
});
}
)
.default(null);
const genderSchema = yup
.string()
.required()
.oneOf([
'M',
'F'
], '"Género" debe ser uno de los siguientes valores: Masculino, Femenino')
.label('Género')
.default('');
const firstNameSchema = yup
.string()
.required()
.min(1)
.max(256)
.label('Nombres')
.default('');
const lastNameSchema = yup
.string()
.required()
.min(1)
.max(256)
.label('Apellidos')
.default('');
const idTypeSchema = yup
.string()
.required()
.oneOf([
'rut',
'passport'
], '"Tipo de identificación" debe ser uno de los siguientes valores: Rut, Pasaporte')
.label('Tipo de identificación')
.default('');
const idNumberSchema = yup
.string()
.required()
.min(1)
.max(32)
.when('idType', {
is: 'rut',
then: (schema) => schema.label('Rut'),
otherwise: (schema) => schema.label('Pasaporte'),
})
.default('');
const phoneSchema = yup
.string()
.required()
.matches(phoneRegExp, 'Número telefónico no es válido')
.label('Número telefónico')
.default('');
const urlSchema = yup
.string()
.required()
.url()
.default('');
const passwordSchema = yup
.string()
.required()
.min(6)
.max(30)
.default('');
const configSchema = yup
.object({
model: yup
.object({
excludes: yup
.array(yup
.string()
.required()
.default('')
)
.label("Asociaciones de modelo excluídas")
.default([]),
}),
});
module.exports = {
lastNameSchema,
firstNameSchema,
genderSchema,
emailSchema,
tokenSchema,
idSchema,
idTypeSchema,
idNumberSchema,
phoneSchema,
urlSchema,
passwordSchema,
stringDateSchema,
configSchema,
nullableIdSchema
};
| 18.209302 | 87 | 0.560664 |
8d2b52352a072a4de20c2289b08a47d1e1e74b3a | 8,134 | js | JavaScript | bin-debug/core/model/proxy/AllData.js | GitHub-Zjw/h5NiuNiu | 0386cd01047d6bce8e25630abd5c6d7c4437399e | [
"MIT"
] | 1 | 2020-03-04T06:15:18.000Z | 2020-03-04T06:15:18.000Z | bin-debug/core/model/proxy/AllData.js | GitHub-Zjw/h5NiuNiu | 0386cd01047d6bce8e25630abd5c6d7c4437399e | [
"MIT"
] | null | null | null | bin-debug/core/model/proxy/AllData.js | GitHub-Zjw/h5NiuNiu | 0386cd01047d6bce8e25630abd5c6d7c4437399e | [
"MIT"
] | null | null | null | var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var AllData = (function (_super) {
__extends(AllData, _super);
function AllData() {
var _this = _super.call(this) || this;
_this._cardColor = [];
_this._cardNums = [];
_this.ballSource = ["0.1_png", "1_png", "5_png", "10_png", "50_png", "100_png"];
_this._bleckMoneyNum = 0;
_this._redMoneyNum = 0;
_this._redMoneyNum = 0;
_this._otherMoneyNum = 0;
_this._winner = EnumerationType.RegionWinner.redS;
_this._redCardType = EnumerationType.CardType.sanPai;
_this._blackCardType = EnumerationType.CardType.sanPai;
_this._allWinners = [];
_this._betDetailsTypeDatas = [];
_this._betRecordsTypeDatas = [];
_this._gmaeMethItemTypeDatas = [];
return _this;
}
Object.defineProperty(AllData, "instance", {
get: function () {
if (AllData._info == null) {
AllData._info = new AllData();
}
return AllData._info;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "cardColor", {
/**
* 当前卡牌花色
*/
get: function () {
return this._cardColor;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "BetDetailsTypeDatas", {
/**投注详情数据 */
get: function () {
return this._betDetailsTypeDatas;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "BetRecordsTypeDatas", {
/**投注详情数据 */
get: function () {
return this._betRecordsTypeDatas;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "GmaeMethItemTypeDatas", {
/**大奖数据 */
get: function () {
return this._gmaeMethItemTypeDatas;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "Winner", {
/**
* 获取胜利区域
*/
get: function () {
return this._winner;
},
enumerable: true,
configurable: true
});
/**
* 根据胜利区域获取红黑点资源名
*/
AllData.prototype.getPointImgByReion = function (region) {
var imgS = "";
switch (region) {
case EnumerationType.RegionWinner.black:
imgS = "heiSheng";
break;
case EnumerationType.RegionWinner.blackS:
imgS = "heiJia";
break;
case EnumerationType.RegionWinner.red:
imgS = "hongSheng";
break;
case EnumerationType.RegionWinner.redS:
imgS = "hongJia";
break;
default:
break;
}
imgS += "_png";
return imgS;
};
Object.defineProperty(AllData.prototype, "AllWinners", {
/**
* 获取历史胜利
*/
get: function () {
return this._allWinners;
},
enumerable: true,
configurable: true
});
/**
* 获取胜率
*/
AllData.prototype.getWP = function () {
var black = 0;
var red = 0;
var other = 0;
var allNum = this.AllWinners.length;
for (var i = 0; i < allNum; i++) {
var winner = this.AllWinners[i];
switch (winner) {
case EnumerationType.RegionWinner.black:
black++;
break;
case EnumerationType.RegionWinner.blackS:
black++;
other++;
break;
case EnumerationType.RegionWinner.red:
red++;
break;
case EnumerationType.RegionWinner.redS:
red++;
other++;
break;
default:
break;
}
}
black = Math.floor(black / allNum * 10000) / 100;
red = 100 - black;
other = Math.floor(other / allNum * 10000) / 100;
return { black: black, red: red, other: other };
};
Object.defineProperty(AllData.prototype, "BleckMoneyNum", {
/**
* 获取黑色押注
*/
get: function () {
return this._bleckMoneyNum;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "CardTypeB", {
/**
* 黑牌牌型
*/
get: function () {
return this._blackCardType;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "CardTypeR", {
/**
* 红牌牌型
*/
get: function () {
return this._redCardType;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "RedMoneyNum", {
/**
* 获取红色押注
*/
get: function () {
return this._redMoneyNum;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "OtherMoneyNum", {
/**
* 获取特殊押注
*/
get: function () {
return this._otherMoneyNum;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllData.prototype, "cardNums", {
/**
* 当前卡牌数字
*/
get: function () {
return this._cardNums;
},
enumerable: true,
configurable: true
});
/**
* 获取随机整数
*/
AllData.prototype.getRandomInt = function (min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
/**
* 获取随机浮点数
*/
AllData.prototype.getRandomF = function (min, max) {
return Math.random() * (max - min) + min;
};
/**
* 获取两点间的距离
*/
AllData.prototype.getDistance = function (p1, p2) {
var dx = Math.abs(p1.x - p2.x);
var dy = Math.abs(p1.y - p2.y);
return Math.sqrt(dx * dx + dy * dy);
};
AllData.prototype.testSetData = function () {
for (var i = 0; i < 15; i++) {
var cardNum = this.getRandomInt(1, 13);
this._cardNums[i] = cardNum;
var color = this.getRandomInt(1, 4);
this._cardColor[i] = color;
var betData = { playerName: i.toString(), money: this.getRandomF(0, 1000), region: this.getRandomInt(0, 3) };
this._betDetailsTypeDatas.push(betData);
var recordData = { money: this.getRandomInt(100, 1000), isWin: this.getRandomInt(0, 2) == 1, region: this.getRandomInt(0, 3) };
this._betRecordsTypeDatas.push(recordData);
var strs = [i.toString(), EnumerationType.CardType[this.getRandomInt(0, 6)], this.getRandomInt(0, 7) * 100 + " HDAG"];
this._gmaeMethItemTypeDatas.push(strs);
}
this._winner = EnumerationType.RegionWinner.blackS;
this._bleckMoneyNum = this.getRandomInt(1, 1000);
this._redMoneyNum = this.getRandomInt(1, 1000);
this._otherMoneyNum = this.getRandomInt(1, 1000);
console.log("动画数据设置完毕");
};
return AllData;
}(egret.EventDispatcher));
__reflect(AllData.prototype, "AllData");
//# sourceMappingURL=AllData.js.map | 31.527132 | 139 | 0.516597 |
8d2cba355100106a14b0492997b1d2af6e72af19 | 287 | js | JavaScript | src/reducers/select-rover-reducer.js | timtroup/mars-rover-amplified | be46c6b0c985b834bfccfbcb0564fc050719542d | [
"MIT"
] | null | null | null | src/reducers/select-rover-reducer.js | timtroup/mars-rover-amplified | be46c6b0c985b834bfccfbcb0564fc050719542d | [
"MIT"
] | null | null | null | src/reducers/select-rover-reducer.js | timtroup/mars-rover-amplified | be46c6b0c985b834bfccfbcb0564fc050719542d | [
"MIT"
] | null | null | null | import { SELECT_ROVER } from '../actions/select-rover-action'
const selectedRover = (state = 'Curiosity', action) => {
switch (action.type) {
case SELECT_ROVER:
return action.rover;
default:
return state
}
};
export default selectedRover | 23.916667 | 61 | 0.616725 |
8d2cd9a993bdd326478d5de75e1c6cc814eaf387 | 715 | js | JavaScript | src/ThirdPartyPlugins/FileUpload/InsertVideoCommand.js | suheyldroid/ckeditor5-custom-build | 3e032b98f8a97f2ca4305229b21f0a8fbb5b9731 | [
"MIT"
] | null | null | null | src/ThirdPartyPlugins/FileUpload/InsertVideoCommand.js | suheyldroid/ckeditor5-custom-build | 3e032b98f8a97f2ca4305229b21f0a8fbb5b9731 | [
"MIT"
] | null | null | null | src/ThirdPartyPlugins/FileUpload/InsertVideoCommand.js | suheyldroid/ckeditor5-custom-build | 3e032b98f8a97f2ca4305229b21f0a8fbb5b9731 | [
"MIT"
] | null | null | null | import Command from "@ckeditor/ckeditor5-core/src/command";
export default class InsertVideoCommand extends Command {
execute (options) {
const videoUrl = options.url;
this.editor.model.change(writer => {
this.editor.model.insertContent(createVideo(writer, videoUrl));
});
}
refresh () {
const model = this.editor.model;
const selection = model.document.selection;
const allowedIn = model.schema.findAllowedParent(selection.getFirstPosition(), "file");
this.isEnabled = allowedIn !== null;
}
}
function createVideo (writer, url) {
const file = writer.createElement("file");
const fileName = writer.createElement("video", { source: url });
writer.append(fileName, file);
return file;
}
| 26.481481 | 89 | 0.727273 |
8d2cdb700cb12094d0d4652f5d8756c68307d620 | 577 | js | JavaScript | max/SoundworksAPI/code/indict.js | collective-soundworks/soundworks-state-manager-osc | def46a8396cd8fa78d2dd4ab96412d40f5b95a8f | [
"BSD-3-Clause"
] | 1 | 2021-02-08T14:41:47.000Z | 2021-02-08T14:41:47.000Z | max/SoundworksAPI/code/indict.js | collective-soundworks/soundworks-state-manager-osc | def46a8396cd8fa78d2dd4ab96412d40f5b95a8f | [
"BSD-3-Clause"
] | 24 | 2021-09-27T10:12:56.000Z | 2022-03-01T10:47:40.000Z | max/SoundworksAPI/code/indict.js | collective-soundworks/soundworks-state-manager-osc | def46a8396cd8fa78d2dd4ab96412d40f5b95a8f | [
"BSD-3-Clause"
] | 1 | 2021-02-10T15:24:15.000Z | 2021-02-10T15:24:15.000Z | //Si la clé est dans le dictionnaire --> ne rien faire
// Si la clé n'est pas dans le dictionnaire, l'ajouter puis envoyer une attach request.
var keyDict = new Dict('sw_keys');
var idDict = new Dict('sw_id');
function anything() {
var arr = arrayfromargs(messagename, arguments);
var schemaName = arr[0];
var stateId = arr[1];
var nodeId = arr[2];
var uniqKey = arr.join('_');
if (!keyDict.contains(uniqKey)) {
keyDict.replace(uniqKey);
idDict.replace(schemaName + '::stateID', stateId);
idDict.replace(schemaName + '::nodeID', nodeId);
outlet(0,arr);
}
} | 28.85 | 87 | 0.684575 |
8d2e06a87f2f1907defa6ad9f9be22ea4052fb48 | 405 | js | JavaScript | lib/search/binary-ceiling.js | miraclestyle/jsadsl | 086a7d78afef5cbe6ff9bca90f09373bca58093a | [
"MIT"
] | null | null | null | lib/search/binary-ceiling.js | miraclestyle/jsadsl | 086a7d78afef5cbe6ff9bca90f09373bca58093a | [
"MIT"
] | null | null | null | lib/search/binary-ceiling.js | miraclestyle/jsadsl | 086a7d78afef5cbe6ff9bca90f09373bca58093a | [
"MIT"
] | null | null | null | const { defaultCompare } = require('../util');
const search = (array, target, compare = defaultCompare) => {
let low = 0;
let high = array.length - 1;
while (low <= high) {
const mid = low + Math.floor((high - low) / 2);
const cmp = compare(target, array[mid]);
if (cmp < 0) {
high = mid - 1;
} else {
low = mid + 1;
}
}
return low;
};
module.exports = search;
| 21.315789 | 61 | 0.545679 |
8d2e81039c5cd3ffc46de9186aba97ec4418eb78 | 545 | js | JavaScript | app/javascripts/config/config.js | matcgi/tol-velo-client | 6eeb094fba683674dee7a48fe4c2358c4fe0bf7d | [
"MIT"
] | null | null | null | app/javascripts/config/config.js | matcgi/tol-velo-client | 6eeb094fba683674dee7a48fe4c2358c4fe0bf7d | [
"MIT"
] | null | null | null | app/javascripts/config/config.js | matcgi/tol-velo-client | 6eeb094fba683674dee7a48fe4c2358c4fe0bf7d | [
"MIT"
] | null | null | null | 'use strict';
// Declare app level module which depends on filters, and services
angular.module('myAngularApp.config', [])
// from package.json
.constant("appName","tolvelo")
.constant("appVersion","15.6.39")
.constant("appServerUrlLocal","http://localhost:9000/tol-velo")
.constant("appServerUrlRemote", "http://matcgi.koding.io:5984/tol-velo")
.constant("appGAID","UA-63329886-4")
.run(function($route, gettextCatalog){
gettextCatalog.debug = true;
//ie https://github.com/angular/angular.js/issues/1213
$route.reload();
});
| 25.952381 | 72 | 0.713761 |
8d2e9669439cd52a8bd229a6c9b850204ddee393 | 5,820 | js | JavaScript | test/closurebaseline/third_party/closure-library/closure/goog/locale/locale.js | rwaldron/traceur | f7f5cbb7794c11ca9cb1d13d58e33a074faa9046 | [
"Apache-2.0"
] | null | null | null | test/closurebaseline/third_party/closure-library/closure/goog/locale/locale.js | rwaldron/traceur | f7f5cbb7794c11ca9cb1d13d58e33a074faa9046 | [
"Apache-2.0"
] | null | null | null | test/closurebaseline/third_party/closure-library/closure/goog/locale/locale.js | rwaldron/traceur | f7f5cbb7794c11ca9cb1d13d58e33a074faa9046 | [
"Apache-2.0"
] | 1 | 2021-04-06T18:48:46.000Z | 2021-04-06T18:48:46.000Z |
goog.provide('goog.locale');
goog.require('goog.locale.nativeNameConstants');
goog.locale.setLocale = function(localeName) {
localeName = localeName.replace(/-/g, '_');
goog.locale.activeLocale_ = localeName;
};
goog.locale.getLocale = function() {
if(! goog.locale.activeLocale_) {
goog.locale.activeLocale_ = 'en';
}
return goog.locale.activeLocale_;
};
goog.locale.Resource = {
DATE_TIME_CONSTANTS: 'DateTimeConstants',
NUMBER_FORMAT_CONSTANTS: 'NumberFormatConstants',
TIME_ZONE_CONSTANTS: 'TimeZoneConstants',
LOCAL_NAME_CONSTANTS: 'LocaleNameConstants',
TIME_ZONE_SELECTED_IDS: 'TimeZoneSelectedIds',
TIME_ZONE_SELECTED_SHORT_NAMES: 'TimeZoneSelectedShortNames',
TIME_ZONE_SELECTED_LONG_NAMES: 'TimeZoneSelectedLongNames',
TIME_ZONE_ALL_LONG_NAMES: 'TimeZoneAllLongNames'
};
goog.locale.getLanguageSubTag = function(languageCode) {
var result = languageCode.match(/^\w{2,3}([-_]|$)/);
return result ? result[0].replace(/[_-]/g, ''): '';
};
goog.locale.getRegionSubTag = function(languageCode) {
var result = languageCode.match(/[-_]([a-zA-Z]{2}|\d{3})([-_]|$)/);
return result ? result[0].replace(/[_-]/g, ''): '';
};
goog.locale.getScriptSubTag = function(languageCode) {
var result = languageCode.split(/[-_]/g);
return result.length > 1 && result[1].match(/^[a-zA-Z]{4}$/) ? result[1]: '';
};
goog.locale.getVariantSubTag = function(languageCode) {
var result = languageCode.match(/[-_]([a-z]{2,})/);
return result ? result[1]: '';
};
goog.locale.getNativeCountryName = function(countryCode) {
var key = goog.locale.getLanguageSubTag(countryCode) + '_' + goog.locale.getRegionSubTag(countryCode);
return key in goog.locale.nativeNameConstants.COUNTRY ? goog.locale.nativeNameConstants.COUNTRY[key]: countryCode;
};
goog.locale.getLocalizedCountryName = function(languageCode, opt_localeSymbols) {
if(! opt_localeSymbols) {
opt_localeSymbols = goog.locale.getResource('LocaleNameConstants', goog.locale.getLocale());
}
var code = goog.locale.getRegionSubTag(languageCode);
return code in opt_localeSymbols.COUNTRY ? opt_localeSymbols.COUNTRY[code]: languageCode;
};
goog.locale.getNativeLanguageName = function(languageCode) {
var code = goog.locale.getLanguageSubTag(languageCode);
return code in goog.locale.nativeNameConstants.LANGUAGE ? goog.locale.nativeNameConstants.LANGUAGE[code]: languageCode;
};
goog.locale.getLocalizedLanguageName = function(languageCode, opt_localeSymbols) {
if(! opt_localeSymbols) {
opt_localeSymbols = goog.locale.getResource('LocaleNameConstants', goog.locale.getLocale());
}
var code = goog.locale.getLanguageSubTag(languageCode);
return code in opt_localeSymbols.LANGUAGE ? opt_localeSymbols.LANGUAGE[code]: languageCode;
};
goog.locale.registerResource = function(dataObj, resourceName, localeName) {
if(! goog.locale.resourceRegistry_[resourceName]) {
goog.locale.resourceRegistry_[resourceName]= { };
}
goog.locale.resourceRegistry_[resourceName][localeName]= dataObj;
if(! goog.locale.activeLocale_) {
goog.locale.activeLocale_ = localeName;
}
};
goog.locale.isResourceRegistered = function(resourceName, localeName) {
return resourceName in goog.locale.resourceRegistry_ && localeName in goog.locale.resourceRegistry_[resourceName];
};
goog.locale.resourceRegistry_ = { };
goog.locale.registerTimeZoneConstants = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.TIME_ZONE_CONSTANTS, localeName);
};
goog.locale.registerLocaleNameConstants = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.LOCAL_NAME_CONSTANTS, localeName);
};
goog.locale.registerTimeZoneSelectedIds = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.TIME_ZONE_SELECTED_IDS, localeName);
};
goog.locale.registerTimeZoneSelectedShortNames = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.TIME_ZONE_SELECTED_SHORT_NAMES, localeName);
};
goog.locale.registerTimeZoneSelectedLongNames = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.TIME_ZONE_SELECTED_LONG_NAMES, localeName);
};
goog.locale.registerTimeZoneAllLongNames = function(dataObj, localeName) {
goog.locale.registerResource(dataObj, goog.locale.Resource.TIME_ZONE_ALL_LONG_NAMES, localeName);
};
goog.locale.getResource = function(resourceName, opt_locale) {
var locale = opt_locale ? opt_locale: goog.locale.getLocale();
if(!(resourceName in goog.locale.resourceRegistry_)) {
return undefined;
}
return goog.locale.resourceRegistry_[resourceName][locale];
};
goog.locale.getResourceWithFallback = function(resourceName, opt_locale) {
var locale = opt_locale ? opt_locale: goog.locale.getLocale();
if(!(resourceName in goog.locale.resourceRegistry_)) {
return undefined;
}
if(locale in goog.locale.resourceRegistry_[resourceName]) {
return goog.locale.resourceRegistry_[resourceName][locale];
}
var locale_parts = locale.split('_');
if(locale_parts.length > 1 && locale_parts[0]in goog.locale.resourceRegistry_[resourceName]) {
return goog.locale.resourceRegistry_[resourceName][locale_parts[0]];
}
return goog.locale.resourceRegistry_[resourceName]['en'];
};
var registerLocalNameConstants = goog.locale.registerLocaleNameConstants;
var registerTimeZoneSelectedIds = goog.locale.registerTimeZoneSelectedIds;
var registerTimeZoneSelectedShortNames = goog.locale.registerTimeZoneSelectedShortNames;
var registerTimeZoneSelectedLongNames = goog.locale.registerTimeZoneSelectedLongNames;
var registerTimeZoneAllLongNames = goog.locale.registerTimeZoneAllLongNames;
| 48.907563 | 122 | 0.763058 |
8d2e9fd48a6646c71bd555c8f22d6d13810765ad | 1,889 | js | JavaScript | test/CoterieList.test.js | moonline/Lab.Coterie.dapp | 5cdeaf4e5f2c845a4e19c31f357e43b23b4392b4 | [
"MIT"
] | null | null | null | test/CoterieList.test.js | moonline/Lab.Coterie.dapp | 5cdeaf4e5f2c845a4e19c31f357e43b23b4392b4 | [
"MIT"
] | 13 | 2021-10-17T10:27:49.000Z | 2021-12-25T14:34:10.000Z | test/CoterieList.test.js | moonline/Lab.Coterie.dapp | 5cdeaf4e5f2c845a4e19c31f357e43b23b4392b4 | [
"MIT"
] | null | null | null | const assertions = { ...assert, ...require('truffle-assertions') };
const CoterieList = artifacts.require('CoterieList');
const Coterie = artifacts.require('Coterie');
contract('CoterieList with 2 coterie instances', ([userA, userB, userC, userD]) => {
describe('Coteries created by user A and B', () => {
let instance;
let coterie1;
let coterie2;
let contracts;
before(async () => {
instance = await CoterieList.deployed();
coterie1 = await instance.createCoterie('Test club 1', { from: userA });
coterie2 = await instance.createCoterie('Test club 2', { from: userB });
contracts = await instance.getCoteries();
});
it('should have 2 coteries', async () => {
assertions.equal(contracts.length, 2);
});
it('should have testClub1 coterie', async () => {
const testClub1 = await Coterie.at(contracts[0]);
assertions.equal(await testClub1.name(), 'Test club 1');
const members1 = await testClub1.getMembers({ from: userA });
assertions.equal(members1.length, 1);
assertions.equal(members1[0], userA);
});
it('should have testClub2 coterie', async () => {
const testClub2 = await Coterie.at(contracts[1]);
assertions.equal(await testClub2.name(), 'Test club 2');
const members2 = await testClub2.getMembers({ from: userB });
assertions.equal(members2.length, 1);
assertions.equal(members2[0], userB);
});
it('should have emited 2 contractCreated events', async () => {
assertions.eventEmitted(coterie1, 'contractCreated', { coterieAddress: contracts[0] });
assertions.eventEmitted(coterie2, 'contractCreated', { coterieAddress: contracts[1] });
});
});
});
| 37.039216 | 99 | 0.591848 |
8d2ec607087a3190ca6005db96edc4bb4e55b626 | 1,731 | js | JavaScript | tools/docs/jsdoc/typedefs/event_emitters.js | ghalimi/stdlib | 88f50b88aa945875ef053e2f89d26f9150a18c12 | [
"BSL-1.0"
] | 3,428 | 2016-07-14T13:48:46.000Z | 2022-03-31T22:32:13.000Z | tools/docs/jsdoc/typedefs/event_emitters.js | ghalimi/stdlib | 88f50b88aa945875ef053e2f89d26f9150a18c12 | [
"BSL-1.0"
] | 435 | 2016-04-07T18:12:45.000Z | 2022-03-22T15:43:17.000Z | tools/docs/jsdoc/typedefs/event_emitters.js | sthagen/stdlib | 042b6215818db0e2a784e72c7e054167dcefcd2a | [
"BSL-1.0"
] | 188 | 2016-11-29T22:58:11.000Z | 2022-03-17T06:46:43.000Z | /**
* An object which emits events.
*
* @typedef {Object} EventEmitter
*
* @see Node.js EventEmitter [documentation]{@link https://nodejs.org/api/events.html}
*/
/**
* A stream interface for reading from a data source.
*
* @typedef {EventEmitter} ReadableStream
*
* @see Node.js stream [documentation]{@link https://nodejs.org/api/stream.html}
*/
/**
* A stream interface for writing to a destination.
*
* @typedef {EventEmitter} WritableStream
*
* @see Node.js stream [documentation]{@link https://nodejs.org/api/stream.html}
*/
/**
* A stream interface implementing both readable and writable stream interfaces.
*
* @typedef {EventEmitter} DuplexStream
*
* @see Node.js stream [documentation]{@link https://nodejs.org/api/stream.html}
*/
/**
* A duplex stream where the output is causally connected to the input.
*
* @typedef {DuplexStream} TransformStream
*
* @see Node.js stream [documentation]{@link https://nodejs.org/api/stream.html}
*/
/**
* A Node.js stream.
*
* @typedef {(ReadableStream|WritableStream|DuplexStream|TransformStream)} Stream
*
* @see Node.js stream [documentation]{@link https://nodejs.org/api/stream.html}
*/
/**
* An HTTP request object. This object provides access request status, headers, and data and implements the [Readable Stream]{@link https://nodejs.org/api/stream.html} interface.
*
* @typedef {EventEmitter} IncomingMessage
*
* @see Node.js HTTP [documentation]{@link https://nodejs.org/api/http.html}
*/
/**
* An HTTP response object. This object implements, but does not inherit from, the [Writable Stream]{@link https://nodejs.org/api/stream.html} interface.
*
* @typedef {EventEmitter} ServerResponse
*
* @see Node.js HTTP [documentation]{@link https://nodejs.org/api/http.html}
*/
| 27.046875 | 177 | 0.727903 |
8d2f66b4b1389a6ab89dbc31ee014afde9f42d41 | 363 | js | JavaScript | src/App.js | SaegesserSascha/portfolio | 5d6088feaf70df3b8e79306b9c5db13b8ce05321 | [
"MIT"
] | null | null | null | src/App.js | SaegesserSascha/portfolio | 5d6088feaf70df3b8e79306b9c5db13b8ce05321 | [
"MIT"
] | null | null | null | src/App.js | SaegesserSascha/portfolio | 5d6088feaf70df3b8e79306b9c5db13b8ce05321 | [
"MIT"
] | null | null | null | import {
BrowserRouter as Router
} from "react-router-dom";
import './App.scss';
import Navigation from "./components/navigation/Navigation";
import Content from "./components/content/Content";
function App() {
return (
<Router>
<div className="App">
<Navigation />
<Content />
</div>
</Router>
);
}
export default App; | 19.105263 | 60 | 0.630854 |
8d2f8a6f8ef6ec97d9b825fe628dfe5d09ff1457 | 332 | js | JavaScript | src/components/First/index.js | stammbach/jovo-hello-nested-components | 96025365a00ed0f66a0923d3f61401c3821a23de | [
"Apache-2.0"
] | null | null | null | src/components/First/index.js | stammbach/jovo-hello-nested-components | 96025365a00ed0f66a0923d3f61401c3821a23de | [
"Apache-2.0"
] | null | null | null | src/components/First/index.js | stammbach/jovo-hello-nested-components | 96025365a00ed0f66a0923d3f61401c3821a23de | [
"Apache-2.0"
] | null | null | null | const { ComponentPlugin } = require('jovo-framework');
const Nested = require('../Nested');
class First extends ComponentPlugin {
constructor(config) {
super(config);
this.handler = require('./src/handler');
this.config = require('./src/config');
this.useComponents(new Nested());
}
}
module.exports = First; | 22.133333 | 54 | 0.668675 |
8d304c49f6034552af685b3f1aad180ef9b8fb9c | 990 | js | JavaScript | index.js | Akshay7016/cg-node-demo | 04414562c2df907c3b04f68a937a5b70c83f1eb6 | [
"MIT"
] | null | null | null | index.js | Akshay7016/cg-node-demo | 04414562c2df907c3b04f68a937a5b70c83f1eb6 | [
"MIT"
] | null | null | null | index.js | Akshay7016/cg-node-demo | 04414562c2df907c3b04f68a937a5b70c83f1eb6 | [
"MIT"
] | null | null | null | const express = require('express');
const app = express();
const port = 8084;
app.get('/',(request, response) => {
response.send(`Welcome to my first node app.`);
console.log(`Welcome`);
});
app.get('/home',(request, response) => {
response.send(`Welcome to Home.`);
console.log(`Home`);
});
app.get('/register',(request, response) => {
response.send(`Welcome to Registration page.`);
console.log(`Register`);
});
app.get('/login',(request, response) => {
response.send(`Welcome to login page.`);
console.log(`Login`);
});
app.get('/emp', (request, response) => {
axios.get('http://localhost:8082/getallemps')
.then((res) => {
response.send(res.data);
})
.catch((err) => {
response.send(err);
});
console.log(`emp`);
});
//---------------------------------------------------------
app.listen(port, () => {
console.log(`App is running...`);
});
// go to CMD and run -
// NPM start | 22.5 | 59 | 0.528283 |
8d308596d0b4791f790648adb8998f9da696d6b4 | 820 | js | JavaScript | lesson08/app.js | KunYi/learn-nodejs | 648d4e9623c805e335cf4dd5b3d2d4f45ad8b48c | [
"BSD-2-Clause"
] | null | null | null | lesson08/app.js | KunYi/learn-nodejs | 648d4e9623c805e335cf4dd5b3d2d4f45ad8b48c | [
"BSD-2-Clause"
] | null | null | null | lesson08/app.js | KunYi/learn-nodejs | 648d4e9623c805e335cf4dd5b3d2d4f45ad8b48c | [
"BSD-2-Clause"
] | null | null | null | 'use strict';
var express = require( 'express' );
var fibonacci = function (n) {
// for error check
// due to NaN === number type
if (typeof(n) !== 'number' || isNaN(n))
throw new Error('n should be a number');
if (n < 0)
throw new Error('n should >= 0');
if (n > 10)
throw new Error('n should <= 10');
if (n === 0)
return 0;
if (n === 1)
return 1;
return fibonacci( n-1 ) + fibonacci( n-2 );
}
var app = express();
app.get('/fib', (req, res) => {
let v = parseInt(req.query.n, 10);
try {
res.send(String(fibonacci(v)));
} catch (e) {
res
.status(500)
.send(e.message);
}
});
module.exports = app;
app.listen(3000, function () {
console.log('app is listening at port 3000');
}); | 20 | 49 | 0.506098 |
8d30ddecb02dd4926dee45f87b1f33b16d960101 | 894 | js | JavaScript | app/components/Table/index.js | devpao26/hcmwebapp | 39fd535c3d95a6059e2380095c3680a06cafc2df | [
"MIT"
] | 1 | 2019-09-11T14:20:20.000Z | 2019-09-11T14:20:20.000Z | app/components/Table/index.js | devpao26/hcmwebapp | 39fd535c3d95a6059e2380095c3680a06cafc2df | [
"MIT"
] | null | null | null | app/components/Table/index.js | devpao26/hcmwebapp | 39fd535c3d95a6059e2380095c3680a06cafc2df | [
"MIT"
] | null | null | null | import styled from 'styled-components';
const Table = styled.table`
width: 100%;
border-collapse: collaspe;
font-size: 13px;
margin-bottom: 15px;
tbody tr:nth-child(odd) {
background-color: #fbfcfe;
}
tbody tr:hover {
background-color: #f9f9f9;
}
th {
font-weight: 400;
font-size: .9em;
text-align: left;
padding: 5px 10px;
}
td {
padding: 15px 10px;
font-size: .85em;
&.center {
text-align: center;
}
span {
display: block;
font-size: 1.35em;
}
}
td .fa-ellipsis-v {
font-size: 1.4em;
}
td .user-avatar {
display: inline-block;
width: 45px;
height: 45px;
padding: 5px;
border-radius: 50%;
background-color: #5e5d5d;
}
td .option-menu {
position: relative;
z-index: 9;
font-size: 12px;
display: inline-block;
}
`;
export default Table;
| 14.9 | 39 | 0.5783 |
8d315ed146f9d2b27389645655610ef10883971c | 1,519 | js | JavaScript | example/static/main.js | abhinavsingh/tord | 079706c2254c9f9fa9faca3a14b0a6b3618b7dde | [
"BSD-3-Clause"
] | 7 | 2015-03-21T00:55:05.000Z | 2021-11-09T13:14:26.000Z | example/static/main.js | abhinavsingh/tord | 079706c2254c9f9fa9faca3a14b0a6b3618b7dde | [
"BSD-3-Clause"
] | null | null | null | example/static/main.js | abhinavsingh/tord | 079706c2254c9f9fa9faca3a14b0a6b3618b7dde | [
"BSD-3-Clause"
] | 2 | 2016-04-29T17:22:43.000Z | 2018-07-06T03:41:37.000Z | Tord.add_plugin('example', {
// tord channel reference
channel: null,
// plugin initialization callback
initialize: function(channel) {
this.channel = channel;
},
// ws connection established
opened: function() {
this.channel.log('opened');
},
// tord ws session initialized + pubsub channel opened/subscribed
connected: function() {
this.channel.log(this.channel.sid + ' ' + this.channel.tid + ' ' + this.channel.uid);
this.test();
},
// ws connection dropped
closed: function(e) {
this.channel.log('closed ' + e.code);
},
// your own custom plugin method
// here we test against our example app ws api routes
test: function() {
var id1 = this.channel.request('/api/user/1/', {'a':'ç'}, function(msg) {
console.assert(msg._id_ == id1);
console.assert(msg._data_.user_id == '1');
console.assert(msg._path_ == '/api/user/1/');
});
var id2 = this.channel.request('/api/user/1/photo/', {'a':'≈'}, function(msg) {
console.assert(msg._async_ == true);
console.assert(msg._id_ == id2);
console.assert(msg._data_.user_id == '1');
console.assert(msg._path_ == '/api/user/1/photo/');
});
var id3 = this.channel.request('/api/user/1/streaming/', {'a':'√'}, function(msg) {
console.assert(msg._async_ == true);
console.assert(msg._id_ == id3);
if(msg._data_.i < 5)
console.assert(msg._final_ == false);
console.assert(msg._data_.stream == 'streaming');
});
}
});
$(function() {
window.tord = new Tord.Channel();
tord.connect();
});
| 26.649123 | 87 | 0.636603 |
8d31b6eb682899261cdd63bc0f8f6d966ce2983f | 162 | js | JavaScript | learnyounode/baby_steps.js | MGenteluci/nodeschool | d6364ceaf0de1d1c801efe7739e0db8d8d267c47 | [
"MIT"
] | null | null | null | learnyounode/baby_steps.js | MGenteluci/nodeschool | d6364ceaf0de1d1c801efe7739e0db8d8d267c47 | [
"MIT"
] | null | null | null | learnyounode/baby_steps.js | MGenteluci/nodeschool | d6364ceaf0de1d1c801efe7739e0db8d8d267c47 | [
"MIT"
] | null | null | null | const sum = process.argv.filter((value, index) => index > 1)
.map(value => Number(value))
.reduce((number, total) => total += number);
console.log(sum);
| 27 | 60 | 0.623457 |
8d323e436ca83333f32f8945398bf7c87a8cd400 | 690 | js | JavaScript | themes/keycloak-preview/account/resources/node_modules/@patternfly/react-icons/dist/esm/icons/ruler-horizontal-icon.js | malgasm/keycloak-themes | b0de4d59b5349d41daf41dccb9f38e026bfe02a1 | [
"Apache-2.0"
] | 22 | 2017-09-30T10:12:51.000Z | 2022-03-08T07:32:05.000Z | themes/keycloak-preview/account/resources/node_modules/@patternfly/react-icons/dist/esm/icons/ruler-horizontal-icon.js | malgasm/keycloak-themes | b0de4d59b5349d41daf41dccb9f38e026bfe02a1 | [
"Apache-2.0"
] | 7 | 2018-06-20T00:28:36.000Z | 2022-02-13T02:09:59.000Z | themes/keycloak-preview/account/resources/node_modules/@patternfly/react-icons/dist/esm/icons/ruler-horizontal-icon.js | malgasm/keycloak-themes | b0de4d59b5349d41daf41dccb9f38e026bfe02a1 | [
"Apache-2.0"
] | 7 | 2017-09-30T10:12:32.000Z | 2022-03-11T04:46:02.000Z | /* This file is generated by createIcons.js any changes will be lost. */
import createIcon from '../createIcon';
var RulerHorizontalIcon = createIcon({
name: 'RulerHorizontalIcon',
height: 512,
width: 576,
svgPath: 'M544 128h-48v88c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-88h-64v88c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-88h-64v88c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-88h-64v88c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-88h-64v88c0 4.42-3.58 8-8 8H88c-4.42 0-8-3.58-8-8v-88H32c-17.67 0-32 14.33-32 32v192c0 17.67 14.33 32 32 32h512c17.67 0 32-14.33 32-32V160c0-17.67-14.33-32-32-32z',
yOffset: '',
xOffset: '',
transform: ''
});
export default RulerHorizontalIcon; | 49.285714 | 390 | 0.688406 |
8d326faa86a654ed05e097bd5196fb25a9f301cf | 1,331 | js | JavaScript | docs/html/group___app_timestamp.js | luisduraes/BoschXDK | e6d8c6006153e02d81cb3fc1890801d3d323239d | [
"Apache-2.0"
] | 2 | 2020-01-27T16:52:26.000Z | 2020-06-08T15:08:51.000Z | docs/html/group___app_timestamp.js | luisduraes/BoschXDK | e6d8c6006153e02d81cb3fc1890801d3d323239d | [
"Apache-2.0"
] | null | null | null | docs/html/group___app_timestamp.js | luisduraes/BoschXDK | e6d8c6006153e02d81cb3fc1890801d3d323239d | [
"Apache-2.0"
] | 1 | 2020-01-14T15:47:44.000Z | 2020-01-14T15:47:44.000Z | var group___app_timestamp =
[
[ "AppTimestamp.c", "_app_timestamp_8c.html", null ],
[ "AppTimestamp.h", "_app_timestamp_8h.html", null ],
[ "APP_TIMESTAMP_NUM_SNTP_TRIES", "group___app_timestamp.html#gad76c21127d7eebd0ae3f128459c9d624", null ],
[ "APP_TIMESTAMP_STRING_FORMAT", "group___app_timestamp.html#gaf67f7c0ae2ecac4effa7aeb3b4ad7d68", null ],
[ "BCDS_MODULE_ID", "group___app_timestamp.html#gabff8f3a204e79671b98fabaa652198c3", null ],
[ "AppTimestamp_CreateTimestampStr", "group___app_timestamp.html#ga2f47261a602e182b5e901c3939f9c8a3", null ],
[ "AppTimestamp_Enable", "group___app_timestamp.html#gaa9b1eccb05095a9295f085487fbe85c0", null ],
[ "AppTimestamp_GetTimestamp", "group___app_timestamp.html#ga9217e966fecd8b55eb7944b692be94e7", null ],
[ "AppTimestamp_Init", "group___app_timestamp.html#ga15d9f48b3db428bbf76751253d7ce2fd", null ],
[ "AppTimestamp_Setup", "group___app_timestamp.html#ga26cfd10c58787b015cbd9355522dc2bd", null ],
[ "appTimestamp_isEnabled", "group___app_timestamp.html#gab6d3bf9f7ccfc5e96cf5469cd3eff0a5", null ],
[ "appTimestamp_ServerSNTPTimeMillis", "group___app_timestamp.html#gaff77013eb5b0d70749da86a1f4ed66ac", null ],
[ "appTimestamp_ServerSNTPTimeTickOffset", "group___app_timestamp.html#ga90ab36ae4d0468b6cc7f40a67e492387", null ]
]; | 83.1875 | 118 | 0.799399 |
8d333d17186c478e7d84c33d1641cf870410d19c | 12,839 | js | JavaScript | apache/htdocs/vtigerCRM/layouts/vlayout/modules/Reports/resources/ChartDetail.js | trol929/test | 83be14de9edc438eb036c9287f6d65f6f0878201 | [
"Apache-2.0"
] | 9 | 2019-04-30T21:18:12.000Z | 2021-11-19T06:06:57.000Z | apache/htdocs/vtigerCRM/layouts/vlayout/modules/Reports/resources/ChartDetail.js | trol929/test | 83be14de9edc438eb036c9287f6d65f6f0878201 | [
"Apache-2.0"
] | 1 | 2019-10-21T02:15:52.000Z | 2019-10-21T02:15:52.000Z | apache/htdocs/vtigerCRM/layouts/vlayout/modules/Reports/resources/ChartDetail.js | trol929/test | 83be14de9edc438eb036c9287f6d65f6f0878201 | [
"Apache-2.0"
] | 12 | 2019-03-30T04:58:04.000Z | 2021-11-12T04:01:41.000Z | /*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
Reports_Detail_Js("Reports_ChartDetail_Js",{
/**
* Function used to display message when there is no data from the server
*/
displayNoDataMessage : function() {
$('#chartcontent').html('<div>'+app.vtranslate('JS_NO_CHART_DATA_AVAILABLE')+'</div>').css(
{'text-align':'center', 'position':'relative', 'top':'100px'});
},
/**
* Function returns if there is no data from the server
*/
isEmptyData : function() {
var jsonData = jQuery('input[name=data]').val();
var data = JSON.parse(jsonData);
var values = data['values'];
if(jsonData == '' || values == '') {
return true;
}
return false;
}
},{
/**
* Function returns instance of the chart type
*/
getInstance : function() {
var chartType = jQuery('input[name=charttype]').val();
var chartClassName = chartType.toCamelCase();
var chartClass = window["Report_"+chartClassName + "_Js"];
var instance = false;
if(typeof chartClass != 'undefined') {
instance = new chartClass();
instance.postInitializeCalls();
}
return instance;
},
registerSaveOrGenerateReportEvent : function(){
var thisInstance = this;
jQuery('.generateReport').on('click',function(e){
if(!jQuery('#chartDetailForm').validationEngine('validate')) {
e.preventDefault();
return false;
}
var advFilterCondition = thisInstance.calculateValues();
var recordId = thisInstance.getRecordId();
var currentMode = jQuery(e.currentTarget).data('mode');
var postData = {
'advanced_filter': advFilterCondition,
'record' : recordId,
'view' : "ChartSaveAjax",
'module' : app.getModuleName(),
'mode' : currentMode,
'charttype' : jQuery('input[name=charttype]').val(),
'groupbyfield' : jQuery('#groupbyfield').val(),
'datafields' : jQuery('#datafields').val()
};
var reportChartContents = thisInstance.getContentHolder().find('#reportContentsDiv');
var element = jQuery('<div></div>');
element.progressIndicator({
'position':'html',
'blockInfo': {
'enabled' : true,
'elementToBlock' : reportChartContents
}
});
e.preventDefault();
AppConnector.request(postData).then(
function(data){
element.progressIndicator({'mode' : 'hide'});
reportChartContents.html(data);
thisInstance.registerEventForChartGeneration();
}
);
});
},
registerEventForChartGeneration : function() {
var thisInstance = this;
try {
thisInstance.getInstance(); // instantiate the object and calls init function
jQuery('#chartcontent').trigger(Vtiger_Widget_Js.widgetPostLoadEvent);
} catch(error) {
console.log("error");
console.log(error);
Reports_ChartDetail_Js.displayNoDataMessage();
return;
}
},
registerEventForModifyCondition : function() {
jQuery('button[name=modify_condition]').on('click', function() {
var filter = jQuery('#filterContainer');
var icon = jQuery(this).find('i');
var classValue = icon.attr('class');
if(classValue == 'icon-chevron-right') {
icon.removeClass('icon-chevron-right').addClass('icon-chevron-down');
filter.show('slow');
} else {
icon.removeClass('icon-chevron-down').addClass('icon-chevron-right');
filter.hide('slow');
}
return false;
});
},
registerEvents : function(){
this._super();
this.registerEventForModifyCondition();
this.registerEventForChartGeneration();
Reports_ChartEdit3_Js.registerFieldForChosen();
Reports_ChartEdit3_Js.initSelectValues();
jQuery('#chartDetailForm').validationEngine(app.validationEngineOptions);
}
});
Vtiger_Pie_Widget_Js('Report_Piechart_Js',{},{
postInitializeCalls : function() {
var clickThrough = jQuery('input[name=clickthrough]').val();
if(clickThrough != '') {
var thisInstance = this;
this.getContainer().on("jqplotDataClick", function(evt, seriesIndex, pointIndex, neighbor) {
var linkUrl = thisInstance.data['links'][pointIndex];
if(linkUrl) window.location.href = linkUrl;
});
this.getContainer().on("jqplotDataHighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'pointer' );
});
this.getContainer().on("jqplotDataUnhighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'auto' );
});
}
},
postLoadWidget : function() {
if(!Reports_ChartDetail_Js.isEmptyData()) {
this.loadChart();
}else{
this.positionNoDataMsg();
}
},
positionNoDataMsg : function() {
Reports_ChartDetail_Js.displayNoDataMessage();
},
getPlotContainer : function(useCache) {
if(typeof useCache == 'undefined'){
useCache = false;
}
if(this.plotContainer == false || !useCache) {
var container = this.getContainer();
this.plotContainer = jQuery('#chartcontent');
}
return this.plotContainer;
},
init : function() {
this._super(jQuery('#reportContentsDiv'));
},
generateData : function() {
if(Reports_ChartDetail_Js.isEmptyData()) {
Reports_ChartDetail_Js.displayNoDataMessage();
return false;
}
var jsonData = jQuery('input[name=data]').val();
var data = this.data = JSON.parse(jsonData);
var values = data['values'];
var chartData = [];
for(var i in values) {
chartData[i] = [];
chartData[i].push(data['labels'][i]);
chartData[i].push(values[i]);
}
return {'chartData':chartData, 'labels':data['labels'], 'data_labels':data['data_labels'], 'title' : data['graph_label']};
}
});
Vtiger_Barchat_Widget_Js('Report_Verticalbarchart_Js', {},{
postInitializeCalls : function() {
jQuery('table.jqplot-table-legend').css('width','95px');
var thisInstance = this;
this.getContainer().on('jqplotDataClick', function(ev, gridpos, datapos, neighbor, plot) {
var linkUrl = thisInstance.data['links'][neighbor[0]-1];
if(linkUrl) window.location.href = linkUrl;
});
this.getContainer().on("jqplotDataHighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'pointer' );
});
this.getContainer().on("jqplotDataUnhighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'auto' );
});
},
postLoadWidget : function() {
if(!Reports_ChartDetail_Js.isEmptyData()) {
this.loadChart();
}else{
this.positionNoDataMsg();
}
this.postInitializeCalls();
},
positionNoDataMsg : function() {
Reports_ChartDetail_Js.displayNoDataMessage();
},
getPlotContainer : function(useCache) {
if(typeof useCache == 'undefined'){
useCache = false;
}
if(this.plotContainer == false || !useCache) {
var container = this.getContainer();
this.plotContainer = jQuery('#chartcontent');
}
return this.plotContainer;
},
init : function() {
this._super(jQuery('#reportContentsDiv'));
},
generateChartData : function() {
if(Reports_ChartDetail_Js.isEmptyData()) {
Reports_ChartDetail_Js.displayNoDataMessage();
return false;
}
var jsonData = jQuery('input[name=data]').val();
var data = this.data = JSON.parse(jsonData);
var values = data['values'];
var chartData = [];
var yMaxValue = 0;
if(data['type'] == 'singleBar') {
chartData[0] = [];
for(var i in values) {
var multiValue = values[i];
for(var j in multiValue) {
chartData[0].push(multiValue[j]);
if(multiValue[j] > yMaxValue) yMaxValue = multiValue[j];
}
}
} else {
chartData[0] = [];
chartData[1] = [];
chartData[2] = [];
for(var i in values) {
var multiValue = values[i];
var info = [];
for(var j in multiValue) {
chartData[j].push(multiValue[j]);
if(multiValue[j] > yMaxValue) yMaxValue = multiValue[j];
}
}
}
yMaxValue = yMaxValue + (yMaxValue*0.15);
return {'chartData':chartData,
'yMaxValue':yMaxValue,
'labels':data['labels'],
'data_labels':data['data_labels'],
'title' : data['graph_label']
};
}
});
Report_Verticalbarchart_Js('Report_Horizontalbarchart_Js', {},{
generateChartData : function() {
if(Reports_ChartDetail_Js.isEmptyData()) {
Reports_ChartDetail_Js.displayNoDataMessage();
return false;
}
var jsonData = jQuery('input[name=data]').val();
var data = this.data = JSON.parse(jsonData);
var values = data['values'];
var chartData = [];
var yMaxValue = 0;
if(data['type'] == 'singleBar') {
for(var i in values) {
var multiValue = values[i];
chartData[i] = [];
for(var j in multiValue) {
chartData[i].push(multiValue[j]);
chartData[i].push(parseInt(i)+1);
if(multiValue[j] > yMaxValue){
yMaxValue = multiValue[j];
}
}
}
chartData = [chartData];
} else {
chartData = [];
chartData[0] = [];
chartData[1] = [];
chartData[2] = [];
for(var i in values) {
var multiValue = values[i];
for(var j in multiValue) {
chartData[j][i] = [];
chartData[j][i].push(multiValue[j]);
chartData[j][i].push(parseInt(i)+1);
if(multiValue[j] > yMaxValue){
yMaxValue = multiValue[j];
}
}
}
}
yMaxValue = yMaxValue + (yMaxValue*0.15);
return {'chartData':chartData,
'yMaxValue':yMaxValue,
'labels':data['labels'],
'data_labels':data['data_labels'],
'title' : data['graph_label']
};
},
loadChart : function() {
var data = this.generateChartData();
var labels = data['labels'];
jQuery.jqplot('chartcontent', data['chartData'], {
title: data['title'],
animate: !$.jqplot.use_excanvas,
seriesDefaults: {
renderer:$.jqplot.BarRenderer,
showDataLabels: true,
pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
shadowAngle: 135,
rendererOptions: {
barDirection: 'horizontal'
}
},
axes: {
yaxis: {
tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
renderer: jQuery.jqplot.CategoryAxisRenderer,
ticks: labels,
tickOptions: {
angle: -45
}
}
},
legend: {
show: true,
location: 'e',
placement: 'outside',
showSwatch : true,
showLabels : true,
labels:data['data_labels']
}
});
jQuery('table.jqplot-table-legend').css('width','95px');
},
postInitializeCalls : function() {
var thisInstance = this;
this.getContainer().on("jqplotDataClick", function(ev, gridpos, datapos, neighbor, plot) {
var linkUrl = thisInstance.data['links'][neighbor[1]-1];
if(linkUrl) window.location.href = linkUrl;
});
this.getContainer().on("jqplotDataHighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'pointer' );
});
this.getContainer().on("jqplotDataUnhighlight", function(evt, seriesIndex, pointIndex, neighbor) {
$('.jqplot-event-canvas').css( 'cursor', 'auto' );
});
}
});
Report_Verticalbarchart_Js('Report_Linechart_Js', {},{
generateData : function() {
if(Reports_ChartDetail_Js.isEmptyData()) {
Reports_ChartDetail_Js.displayNoDataMessage();
return false;
}
var jsonData = jQuery('input[name=data]').val();
var data = this.data = JSON.parse(jsonData);
var values = data['values'];
var chartData = [];
var yMaxValue = 0;
chartData[1] = []
chartData[2] = []
chartData[0] = []
for(var i in values) {
var value = values[i];
for(var j in value) {
chartData[j].push(value[j]);
}
}
yMaxValue = yMaxValue + yMaxValue*0.15;
return {'chartData':chartData,
'yMaxValue':yMaxValue,
'labels':data['labels'],
'data_labels':data['data_labels'],
'title' : data['graph_label']
};
},
loadChart : function() {
var data = this.generateData();
var plot2 = $.jqplot('chartcontent', data['chartData'], {
title: data['title'],
legend:{
show:true,
labels:data['data_labels'],
location:'ne',
showSwatch : true,
showLabels : true,
placement: 'outside'
},
seriesDefaults: {
pointLabels: {
show: true
}
},
axes: {
xaxis: {
min:0,
pad: 1,
renderer: $.jqplot.CategoryAxisRenderer,
ticks:data['labels'],
tickOptions: {
formatString: '%b %#d'
}
}
},
cursor: {
show: true
}
});
jQuery('table.jqplot-table-legend').css('width','95px');
}
}); | 27.143763 | 124 | 0.631591 |
8d34954f1d723ae98522b9c239f2710e75599cab | 4,617 | js | JavaScript | generators/python/event.js | Suku1989/haniblock-blocks | a53fc04dd0301f0de7aec9e8b6c89858ac5375db | [
"Apache-2.0"
] | null | null | null | generators/python/event.js | Suku1989/haniblock-blocks | a53fc04dd0301f0de7aec9e8b6c89858ac5375db | [
"Apache-2.0"
] | null | null | null | generators/python/event.js | Suku1989/haniblock-blocks | a53fc04dd0301f0de7aec9e8b6c89858ac5375db | [
"Apache-2.0"
] | null | null | null | /**
* Visual Blocks Language
*
* Copyright 2021 Arthur Zheng.
* https://github.com/openblockcc/haniblock-blocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
goog.provide('Blockly.Python.event');
goog.require('Blockly.Python');
Blockly.Python['event_whenmicrobitbegin'] = function(block) {
Blockly.Python.imports_["microbit"] = "from microbit import *";
var code = "";
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
if (!nextBlock) {
code += "pass\n";
}
return code;
};
Blockly.Python['event_whenmicrobitbuttonpressed'] = function(block) {
Blockly.Python.imports_["microbit"] = "from microbit import *";
var key = block.getFieldValue('KEY_OPTION');
var i = '';
while (Blockly.Python.loops_["event_whenmicrobitbegin" + key + i]) {
if (i === '') {
i = 1;
} else {
i++;
}
}
Blockly.Python.loops_["event_whenmicrobitbegin" + key + i] = "if button_" + key + ".is_pressed():\n" +
Blockly.Python.INDENT + Blockly.Python.INDENT + "on_button_" + key + i + "()";
var code = "def on_button_" + key + i + "():\n";
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
if (!nextBlock) {
code += Blockly.Python.INDENT + "pass\n";
} else {
var variablesName = [];
for (var x in Blockly.Python.variables_) {
variablesName.push(Blockly.Python.variables_[x].slice(0, Blockly.Python.variables_[x].indexOf('=') - 1));
}
if (variablesName.length !== 0) {
code += Blockly.Python.INDENT + "global " + variablesName.join(', ') + "\n";
}
code = Blockly.Python.scrub_(block, code);
}
Blockly.Python.libraries_["def on_button_" + key + i] = code;
return null;
};
Blockly.Python['event_whenmicrobitpinbeingtouched'] = function(block) {
Blockly.Python.imports_["microbit"] = "from microbit import *";
var pin = block.getFieldValue('PIN_OPTION');
var i = '';
while (Blockly.Python.loops_["event_whenmicrobitpinbeingtouched" + pin + i]) {
if (i === '') {
i = 1;
} else {
i++;
}
}
Blockly.Python.loops_["event_whenmicrobitpinbeingtouched" + pin + i] = "if pin" + pin + ".is_pressed():\n" +
Blockly.Python.INDENT + Blockly.Python.INDENT + "on_pin" + pin + i + "()";
var code = "def on_pin" + pin + i + "():\n";
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
if (!nextBlock) {
code += Blockly.Python.INDENT + "pass\n";
} else {
var variablesName = [];
for (var x in Blockly.Python.variables_) {
variablesName.push(Blockly.Python.variables_[x].slice(0, Blockly.Python.variables_[x].indexOf('=') - 1));
}
if (variablesName.length !== 0) {
code += Blockly.Python.INDENT + "global " + variablesName.join(', ') + "\n";
}
code = Blockly.Python.scrub_(block, code);
}
Blockly.Python.libraries_["def on_pin" + pin + i] = code;
return null;
};
Blockly.Python['event_whenmicrobitgesture'] = function(block) {
Blockly.Python.imports_["microbit"] = "from microbit import *";
var sta = block.getFieldValue('GESTURE_OPTION');
var i = '';
while (Blockly.Python.loops_["event_whenmicrobitgesture" + sta + i]) {
if (i === '') {
i = 1;
} else {
i++;
}
}
Blockly.Python.loops_["event_whenmicrobitgesture" + sta + i] = "if accelerometer.was_gesture('" + sta + "'):\n" +
Blockly.Python.INDENT + Blockly.Python.INDENT + "on_" + sta + i + "()";
var code = "def on_" + sta + i + "():\n";
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
if (!nextBlock) {
code += Blockly.Python.INDENT + "pass\n";
} else {
var variablesName = [];
for (var x in Blockly.Python.variables_) {
variablesName.push(Blockly.Python.variables_[x].slice(0, Blockly.Python.variables_[x].indexOf('=') - 1));
}
if (variablesName.length !== 0) {
code += Blockly.Python.INDENT + "global " + variablesName.join(', ') + "\n";
}
code = Blockly.Python.scrub_(block, code);
}
Blockly.Python.libraries_["def on_" + sta + i] = code;
return null;
};
| 30.986577 | 115 | 0.640026 |
8d34eef60bb87be7a74cbc847d340dbd36575987 | 458 | js | JavaScript | Babylon.js-2.4.0/src/Mesh/babylon.meshLODLevel.js | Chaseshak/RetroVRCade | 7e999af33941f159f40f8e15f648ae04d66c1f8f | [
"Apache-2.0"
] | 2 | 2016-10-26T17:59:36.000Z | 2021-01-21T13:01:03.000Z | Babylon.js-2.4.0/src/Mesh/babylon.meshLODLevel.js | Chaseshak/RetroVRCade | 7e999af33941f159f40f8e15f648ae04d66c1f8f | [
"Apache-2.0"
] | null | null | null | Babylon.js-2.4.0/src/Mesh/babylon.meshLODLevel.js | Chaseshak/RetroVRCade | 7e999af33941f159f40f8e15f648ae04d66c1f8f | [
"Apache-2.0"
] | null | null | null | var BABYLON;
(function (BABYLON) {
var Internals;
(function (Internals) {
var MeshLODLevel = (function () {
function MeshLODLevel(distance, mesh) {
this.distance = distance;
this.mesh = mesh;
}
return MeshLODLevel;
})();
Internals.MeshLODLevel = MeshLODLevel;
})(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
})(BABYLON || (BABYLON = {}));
| 30.533333 | 66 | 0.539301 |
8d353d34849ac8e8d200abd43c32cc4736e9593a | 2,269 | js | JavaScript | packages/colorizer-three/src/three/TweenSet.js | gouldingken/react-rewire-mobx-starter | aac7902f267bb37ca303205b62f63a488d7d53a7 | [
"MIT"
] | null | null | null | packages/colorizer-three/src/three/TweenSet.js | gouldingken/react-rewire-mobx-starter | aac7902f267bb37ca303205b62f63a488d7d53a7 | [
"MIT"
] | 6 | 2020-09-05T20:25:26.000Z | 2022-02-26T13:32:33.000Z | packages/colorizer-three/src/three/TweenSet.js | gouldingken/react-rewire-mobx-starter | aac7902f267bb37ca303205b62f63a488d7d53a7 | [
"MIT"
] | null | null | null | /**
* Creates a new instance of TweenSet.
* @class
* @returns An instance of TweenSet.
* @example
* var instance = new TweenSet();
*/
export default class TweenSet {
constructor(fromKey, toKey) {
this.tweenDir = 0;
this.displayIndex = 0;
this.meshes = [];
this.fromKey = fromKey;
this.toKey = toKey;
this.visible = false;
};
add(mesh) {
if (mesh) {
mesh.visible = this.visible && this.meshes.length === this.displayIndex;
}
this.meshes.push(mesh);
}
updateVisibility() {
this.meshes.forEach((mesh, i) => {
if (!mesh) {
return;
}//null values can be used as placeholders
mesh.visible = this.visible && i === this.displayIndex;
// console.log(`${mesh.visible}: ${this.visible} ${i === this.displayIndex}`);
});
}
setVisible(val) {
this.visible = val;
this.updateVisibility();
}
display(index) {
this.displayIndex = index;
this.updateVisibility();
}
next(wrap) {
const prevIndex = this.displayIndex;
this.displayIndex++;
if (this.displayIndex >= this.meshes.length) {
if (wrap) {
this.displayIndex = 0;
} else {
this.displayIndex = this.meshes.length - 1;
}
}
this.updateVisibility();
return prevIndex !== this.displayIndex;
}
prev(wrap) {
const prevIndex = this.displayIndex;
this.displayIndex--;
if (this.displayIndex < 0) {
if (wrap) {
this.displayIndex = this.meshes.length - 1;
} else {
this.displayIndex = 0;
}
}
this.updateVisibility();
return prevIndex !== this.displayIndex;
}
setActiveKey(key) {
if (key === this.fromKey) {
this.tweenDir = -1;
}
if (key === this.toKey) {
this.tweenDir = 1;
}
}
tick() {
if (this.tweenDir > 0) {
return this.next(false);
}
if (this.tweenDir < 0) {
return this.prev(false);
}
return false;
}
}
| 24.138298 | 90 | 0.49361 |
8d36716f0405becc85d9527cf606313be65c2bb3 | 22,717 | js | JavaScript | src/main/webapp/resources/js/member_modify.js | DonghwanJwa/Project3rd | 1bcf96dfc129fc1c612aeb96902c588b17c59f39 | [
"MIT"
] | null | null | null | src/main/webapp/resources/js/member_modify.js | DonghwanJwa/Project3rd | 1bcf96dfc129fc1c612aeb96902c588b17c59f39 | [
"MIT"
] | 12 | 2019-11-27T04:53:10.000Z | 2021-12-09T22:21:10.000Z | src/main/webapp/resources/js/member_modify.js | DonghwanJwa/Project3rd | 1bcf96dfc129fc1c612aeb96902c588b17c59f39 | [
"MIT"
] | 11 | 2019-11-18T10:48:35.000Z | 2020-01-16T08:07:34.000Z | /**
* member_modify.js
*/
/*정규식*/
var regExpPw = RegExp(/^(?=.*\d{1,50})(?=.*[~`!@#$%\^&*()\-+=]{1,50})(?=.*[a-zA-Z]{2,50}).{8,50}$/);//비번
var getCheck= RegExp(/^[a-zA-Z0-9]{6,12}$/); //아이디
var getyear= RegExp(/^[0-9]{4}$/); //년
var getmonth_date= RegExp(/^[0-9]{1,2}$/); //월,일
var getName= RegExp(/^[가-힣]+$/); //이름
var emailCheck = RegExp(/^[A-Za-z0-9_\.\-]{5,14}$/); //이메일
var tel_first = RegExp(/^[0-9]{3}$/); //폰번호 3
var tel_second = RegExp(/^[0-9]{3,4}$/); //폰번호 3,4
var tel_third = RegExp(/^[0-9]{4}$/); //폰번호 4
$(document).ready(function(){
//생년월일,전화번호 숫자만 받도록
$(".number2Only").on("focus", function() {//포커스되었을때
var x = $(this).val();
$(this).val(x);
}).on("focusout", function() {//포커스에서 나갔을 때
var x = $(this).val(); //값을 받아오고
if(x && x.length > 0) { //내용물이 입력되었다면
if(!$.isNumeric(x)) { //숫자가 아니라면
x = x.replace(/[^0-9]/g,""); //숫자가 아닌존재들을 지움
}
}
}).on("keyup", function() {//숫자가 눌렸을 때
$(this).val($(this).val().replace(/[^0-9]/g,""));//숫자가 아닌존재들을 지움
});
//이름 유효성 검증
$('#member_modify_name').on("focusout", function() {
if ($.trim($('#member_modify_name').val())=="") {
$('#member_modify_error_name').text('이름을 입력해주세요!');
return false;
}
if (!getName.test($('#member_modify_name').val())) {//이름 정규식
$('#member_modify_error_name').text('이름을 입력해주세요!');
return false;
}
$('#member_modify_error_name').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_name').val())=="") {
$('#member_modify_error_name').text('이름을 입력해주세요!');
return false;
}
if (!getName.test($('#member_modify_name').val())) {//이름 정규식
$('#member_modify_error_name').text('이름을 입력해주세요!');
return false;
}
$('#member_modify_error_name').text('');
if (key.keyCode == 13) {
$('#member_modify_birth_year').focus();
}
});
//생년월일 : 년 유효성 검증
$('#member_modify_birth_year').on("focusout", function() {
if ($.trim($('#member_modify_birth_year').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getyear.test($('#member_modify_birth_year').val())){
$('#member_modify_error_birth').text('년을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_year').val())>2020 || $.trim($('#member_modify_birth_year').val())<1900) {
$('#member_modify_error_birth').text('유효한 년도를 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_birth_year').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getyear.test($('#member_modify_birth_year').val())){
$('#member_modify_error_birth').text('년을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_year').val())>2020 || $.trim($('#member_modify_birth_year').val())<1900) {
$('#member_modify_error_birth').text('유효한 년도를 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
if (key.keyCode == 13) {
$('#member_modify_birth_month').focus();
}
});
//생년월일 : 월 유효성검증
$('#member_modify_birth_month').on("focusout", function() {
if ($.trim($('#member_modify_birth_month').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getmonth_date.test($('#member_modify_birth_month').val())){
$('#member_modify_error_birth').text('월을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_month').val())>12 || $.trim($('#member_modify_birth_month').val())<1) {
$('#member_modify_error_birth').text('유효한 월을 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_birth_month').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getmonth_date.test($('#member_modify_birth_month').val())){
$('#member_modify_error_birth').text('월을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_month').val())>12 || $.trim($('#member_modify_birth_month').val())<1) {
$('#member_modify_error_birth').text('유효한 월을 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
if (key.keyCode == 13) {
$('#member_modify_birth_date').focus();
}
});
//생년월일 : 일 유효성 검증
$('#member_modify_birth_date').on("focusout", function() {
if ($.trim($('#member_modify_birth_date').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getmonth_date.test($('#member_modify_birth_date').val())){
$('#member_modify_error_birth').text('일을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_date').val())>31 || $.trim($('#member_modify_birth_date').val())<1) {
$('#member_modify_error_birth').text('유효한 일을 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_birth_date').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
return false;
}
if(!getmonth_date.test($('#member_modify_birth_date').val())){
$('#member_modify_error_birth').text('일을 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_birth_date').val())>31 || $.trim($('#member_modify_birth_date').val())<1) {
$('#member_modify_error_birth').text('유효한 일을 입력해 주세요!');
return false;
}
$('#member_modify_error_birth').text('');
if (key.keyCode == 13) {
$('#member_modify_select_gender').focus();
}
});
//핸드폰 번호1
$('#member_modify_tel1').on("focusout", function() {
if ($.trim($('#member_modify_tel1').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_first.test($('#member_modify_tel1').val())){
$('#join_membership_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
}).on("keyup", function(key) {
if ($.trim($('#member_modify_tel1').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_first.test($('#member_modify_tel1').val())){
$('#join_membership_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
$('#member_modify_error_tel').text('');
if (key.keyCode == 13) {
$('#member_modify_tel2').focus();
}
});
//핸드폰 번호2
$('#member_modify_tel2').on("focusout", function() {
if ($.trim($('#member_modify_tel2').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_second.test($('#member_modify_tel2').val())){
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
}).on("keyup", function(key) {
if ($.trim($('#member_modify_tel2').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_second.test($('#member_modify_tel2').val())){
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
$('#member_modify_error_tel').text('');
if (key.keyCode == 13) {
$('#member_modify_tel3').focus();
}
});
//핸드폰 번호3
$('#member_modify_tel3').on("focusout", function() {
if ($.trim($('#member_modify_tel3').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_third.test($('#member_modify_tel3').val())){
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
}).on("keyup", function(key) {
if ($.trim($('#member_modify_tel3').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
return false;
}
if(!tel_third.test($('#member_modify_tel3').val())){
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
$('#member_modify_error_tel').text('');
if (key.keyCode == 13) {
$("#member_modify_next_btn").trigger("click");
}
});
//이메일 수정하기 전에 인증버튼 없어짐
$('#member_modify_email').on("focusout", function() {
if ($.trim($('#member_modify_email').val())=="") {
$('#member_modify_error_email_domain').text('이메일을 입력해주세요!');
return false;
}
if($('#member_modify_email').val()==$('#member_modify_original_email').val() && $('#member_modify_email_datalist').val()==$('#member_modify_original_domain').val()){//원래 이메일과 입력한 이메일이 같으면
$('#member_modify_certified_btn').hide();
$('#member_modify_certified_btn').attr("disabled",true);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', false);
}else{
$('#member_modify_certified_btn').show();
$('#member_modify_certified_btn').attr("disabled",false);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', true);
}
$('#member_modify_error_email_domain').text('');
}).on("keyup", function(key) {
if($('#member_modify_email').val()==$('#member_modify_original_email').val() && $('#member_modify_email_datalist').val()==$('#member_modify_original_domain').val()){//원래 이메일과 입력한 이메일이 같으면
$('#member_modify_certified_btn').hide();
$('#member_modify_certified_btn').attr("disabled",true);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', false);
}else{
$('#member_modify_certified_btn').show();
$('#member_modify_certified_btn').attr("disabled",false);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', true);
}
if ($.trim($('#member_modify_email').val())=="") {
$('#member_modify_error_email_domain').text('이메일을 입력해주세요!');
return false;
}
$('#member_modify_error_email_domain').text('');
if (key.keyCode == 13) {
$('#member_modify_email_datalist').focus();
}
});
$('#member_modify_email_datalist').on("focusout", function() {
if ($.trim($('#member_modify_email_datalist').val())=="") {
$('#member_modify_error_email_domain').text('도메인을 입력해주세요!');
return false;
}
if($('#member_modify_email').val()==$('#member_modify_original_email').val() && $('#member_modify_email_datalist').val()==$('#member_modify_original_domain').val()){//원래 이메일과 입력한 이메일이 같으면
$('#member_modify_certified_btn').hide();
$('#member_modify_certified_btn').attr("disabled",true);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', false);
}else{
$('#member_modify_certified_btn').show();
$('#member_modify_certified_btn').attr("disabled",false);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', true);
}
$('#member_modify_error_email_domain').text('');
}).on("keyup", function(key) {
if($('#member_modify_email').val()==$('#member_modify_original_email').val() && $('#member_modify_email_datalist').val()==$('#member_modify_original_domain').val()){//원래 이메일과 입력한 이메일이 같으면
$('#member_modify_certified_btn').hide();
$('#member_modify_certified_btn').attr("disabled",true);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', false);
}else{
$('#member_modify_certified_btn').show();
$('#member_modify_certified_btn').attr("disabled",false);
$('.member_modify_emailcheck_div').hide();
$('#member_modify_emailcheck_btn').attr('disabled', true);
$('#member_modify_next_btn').attr('disabled', true);
}
if ($.trim($('#member_modify_email').val())=="") {
$('#member_modify_error_email_domain').text('이메일을 입력해주세요!');
return false;
}
$('#member_modify_error_email_domain').text('');
if (key.keyCode == 13) {
$("#member_modify_certified_btn").trigger("click");
}
});
// 회원정보수정 페이지에서 이메일 인증 아작스
$(document).on("click", "#member_modify_certified_btn", function(){
var email = $.trim($('#member_modify_email').val()); //이메일값
var domain = $.trim($('#member_modify_email_datalist').val()); //도메인값
$('#member_modify_error_email_domain').text('');
if (email=="") {
$('#member_modify_error_email_domain').text('이메일을 입력해주세요!');
return false;
}
if (domain=="") {
$('#member_modify_error_email_domain').text('도메인을 입력해주세요!');
return false;
}
if (!emailCheck.test($('#member_modify_email_datalist').val())) {
$('#member_modify_error_email_domain').text('도메인을 입력해주세요!');
return false;
}
//이메일 중복체크
$.ajax({
type:"POST",
url : "modify_emailCert",
data : {"email": email,"domain":domain},
datatype:"int",
success : function(data){
if(data==1){
//readonly는 읽기만 가능 값변경 불가능 form으로 값보낼떄는 가능
//readonly false면 값변경이 가능
//disabled 태그 속성 활성화 false 비활성화
//#01ea137a 확인된 곳엔 색 주기
Swal.fire({
icon : 'info',
allowOutsideClick: false,
text : '입력하신 이메일로 인증번호가 발송되었습니다.'
}).then(function(){
$('#member_modify_next_btn').attr('disabled', true);
$('#member_modify_certified_btn').attr("disabled",true);//disabled 태그 속성 활성화 true
$('#member_modify_certified_btn').css('cursor','default');
$('#member_modify_emailcheck').val('');//이메일 인증체크 디브를 공백으로 만들어줌
$('#member_modify_emailcheck').attr('readonly',false);
$('#member_modify_emailcheck_btn').attr('disabled',false);
$(".member_modify_emailcheck_div").show();
});
}
},
beforeSend:function(){
//(이미지 보여주기 처리)
$('.wrap-loading').show();
},
complete:function(){
//(이미지 감추기 처리)
$('.wrap-loading').hide();
$('#member_modify_emailcheck').focus();
},
error: function(data){
alert("에러가 발생했습니다.");
return false;
}
});
});//회원정보수정 페이지에서 이메일 수정 아작스
//이메일 인증번호 입력 후 확인 버튼 클릭 이벤트
$(document).on("click", "#member_modify_emailcheck_btn", function(){
var authCode = $('#member_modify_emailcheck').val();
$.ajax({
type:"post",
url:"modify_emailCert_ok",
data:{"authCode":authCode},
success:function(data){
if(data=="complete"){
Swal.fire({
icon : 'success',
allowOutsideClick: false,
text : '이메일 인증에 성공하셨습니다!'
}).then(function(){
$('#member_modify_next_btn').attr('disabled', false);//수정완료버튼 활성화
$('#member_modify_emailcheck').attr('readonly',true);//이메일 체크 못쓰게함
$('#member_modify_emailcheck_btn').attr('disabled',true);//확인버튼 못쓰게함
$('#member_modify_emailcheck_btn').css('cursor','default');
sessionStorage.removeItem('authCode');
});
//sessionStorage.removeItem('authCode'); 란 세션스토리지에 저장되어 있는 인증번호값을 리무브아이템으로
//세션에 저장된 인증번호 값을 지운다 인증이 다 끝났으니깐 안지우면 다시 받을 때 문제가 될 것 같다.
}else if(data == "false"){
alert("인증번호를 잘못 입력하셨습니다.")
}
},
beforeSend:function(){
//(이미지 보여주기 처리)
$('.wrap-loading').show();
},
complete:function(){
//(이미지 감추기 처리)
$('.wrap-loading').hide();
},
error:function(data){
alert("에러가 발생했습니다.");
}
});
});//이메일 인증번호 입력 후 확인 버튼 클릭 이벤트
$("#member_modify_pwd_modify").click(function(){
if($(".hide_box").css("display") == "none"){
$("#member_modify_pass").attr("name","mem_pwd");
$(".hide_box").show();
}else{
$(".hide_box").hide();
$("#member_modify_pass").removeAttr("name");
}
});//비밀번호 변경 박스
//비밀번호 확인 유효성 검증
$("#member_modify_pass").on("focusout keydown", function(e) {
if(e.type === 'focusout'){
if ($.trim($('#member_modify_pass').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호 확인을 입력해주세요!');
return false;
}
if($.trim($('#member_modify_pass_check').val()) != $.trim($('#member_modify_pass').val())){
$('#member_modify_error_pass_check').text('비밀번호가 같지 않습니다!');
return false;
}
}
if(e.type === 'keydown'){
if(e.keyCode == 32) {
return false;
}
}
$('#member_modify_error_pass_check').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_pass').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호 확인을 입력해주세요!');
return false;
}
if($.trim($('#member_modify_pass_check').val()) != $.trim($('#member_modify_pass').val())){
$('#member_modify_error_pass_check').text('비밀번호가 같지 않습니다!');
return false;
}
$('#member_modify_error_pass_check').text('');
if (key.keyCode == 13) {
$('#member_modify_pass_check').focus();
}
});
$("#member_modify_pass_check").on("focusout keydown", function(e) {
if(e.type === 'focusout'){
if ($.trim($('#member_modify_pass_check').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호 확인을 입력해주세요!');
return false;
}
if($.trim($('#member_modify_pass_check').val()) != $.trim($('#member_modify_pass').val())){
$('#member_modify_error_pass_check').text('비밀번호가 같지 않습니다!');
return false;
}
}
if(e.type === 'keydown'){
if(e.keyCode == 32) {
return false;
}
}
$('#member_modify_error_pass_check').text('');
}).on("keyup", function(key) {
if ($.trim($('#member_modify_pass_check').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호 확인을 입력해주세요!');
return false;
}
if($.trim($('#member_modify_pass_check').val()) != $.trim($('#member_modify_pass').val())){
$('#member_modify_error_pass_check').text('비밀번호가 같지 않습니다!');
return false;
}
$('#member_modify_error_pass_check').text('');
if (key.keyCode == 13) {
$("#member_modify_next_btn").trigger("click");
}
});
document.addEventListener('keydown', function(event) {//엔터키 서브밋 막기 이벤트
if (event.keyCode === 13) {
event.preventDefault();
};
}, true);
});
function updateCheck(){
var member_modify_pass = $("#member_modify_pass").val();
var updateCon = confirm('수정하시겠습니까?');
if(updateCon){
if ($.trim($('#member_modify_name').val())=="") {
$('#member_modify_error_name').text('이름을 입력해주세요!');
$("#member_modify_name").val("").focus();
return false;
}
if (!getName.test($('#member_modify_name').val())) {//이름 정규식
$('#member_modify_error_name').text('이름을 입력해주세요!');
$("#member_modify_name").val("").focus();
return false;
}
//년 공백
if ($.trim($('#member_modify_birth_year').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
$("#member_modify_birth_year").focus();
return false;
}
//년 정규식
if(!getyear.test($('#member_modify_birth_year').val())){
$('#member_modify_error_birth').text('년을 입력해주세요!');
$("#member_modify_birth_year").val("").focus();
return false;
}
//년 1900 ~ 2020사이 체크
if ($.trim($('#member_modify_birth_year').val())>2020 || $.trim($('#member_modify_birth_year').val())<1900) {
$('#member_modify_error_birth').text('유효한 년도를 입력해 주세요!');
$("#member_modify_birth_year").val("").focus();
return false;
}
//월 공백
if ($.trim($('#member_modify_birth_month').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
$("#member_modify_birth_month").focus();
return false;
}
//월 정규식
if(!getmonth_date.test($('#member_modify_birth_month').val())){
$('#member_modify_error_birth').text('월을 입력해주세요!');
$("#member_modify_birth_month").val("").focus();
return false;
}
//월 1 ~ 12사이 체크
if ($.trim($('#member_modify_birth_month').val())>12 || $.trim($('#member_modify_birth_month').val())<1) {
$('#member_modify_error_birth').text('유효한 월을 입력해 주세요!');
$("#member_modify_birth_month").val("").focus();
return false;
}
//일 정규식
if ($.trim($('#member_modify_birth_date').val())=="") {
$('#member_modify_error_birth').text('생년월일을 입력해 주세요!');
$("#member_modify_birth_date").focus();
return false;
}
//일 정규식
if(!getmonth_date.test($('#member_modify_birth_date').val())){
$('#member_modify_error_birth').text('일을 입력해주세요!');
$("#member_modify_birth_date").val("").focus();
return false;
}
//일 1 ~ 30사이 체크
if ($.trim($('#member_modify_birth_date').val())>31 || $.trim($('#member_modify_birth_date').val())<1) {
$('#member_modify_error_birth').text('유효한 일을 입력해 주세요!');
$("#member_modify_birth_date").val("").focus();
return false;
}
if ($.trim($('#member_modify_email').val())=="") {
$('#member_modify_error_email_domain').text('이메일을 입력해주세요!');
$("#member_modify_email").val("").focus();
return false;
}
if ($.trim($('#member_modify_email_datalist').val())=="") {
$('#member_modify_error_email_domain').text('도메인을 입력해주세요!');
$("#member_modify_email_datalist").val("").focus();
return false;
}
//이메일 도메인 정규식
if (!emailCheck.test($('#member_modify_email_datalist').val())) {
$('#member_modify_error_email_domain').text('도메인을 입력해주세요!');
$("#member_modify_email_datalist").val("").focus();
return false;
}
if ($.trim($('#member_modify_tel1').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
$("#member_modify_tel1").focus();
return false;
}
if (!tel_first.test($('#member_modify_tel1').val())) {
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_tel2').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
$("#member_modify_tel2").focus();
return false;
}
if (!tel_second.test($('#member_modify_tel2').val())) {
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
if ($.trim($('#member_modify_tel3').val())=="") {
$('#member_modify_error_tel').text('핸드폰번호를 입력해주세요!');
$("#member_modify_tel3").focus();
return false;
}
if (!tel_third.test($('#member_modify_tel3').val())) {
$('#member_modify_error_tel').text('정확한 번호를 입력해주세요!');
return false;
}
if($("#member_modify_pass").attr("name")=="mem_pwd"){ //비밀번호란이 활성화 되었을때만 유효성 검사
if ($.trim($('#member_modify_pass').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호를 입력해주세요!');
return false;
}
if($.trim($('#member_modify_pass').val()).length<8 || $.trim($('#join_membership_pass').val()).length>50){
$('#member_modify_error_pass_check').text('8자이상으로 설정해주세요!');
return false;
}
if ($.trim($('#member_modify_pass_check').val())=="") {
$('#member_modify_error_pass_check').text('비밀번호 확인을 입력해주세요!');
return false;
}
if(!regExpPw.test($("#member_modify_pass").val())){
$('#member_modify_error_pass_check').text('영문,숫자,특수문자의 조합으로 입력해주세요!');
return false;
}
if($("#member_modify_pass_check").val() != $('#member_modify_pass').val()){
$('#member_modify_error_pass_check').text('비밀번호가 같지 않습니다!');
return false;
}
if($("#member_modify_id").val() == $("#member_modify_pass").val()){
$('#member_modify_error_pass_check').text('아이디와 비밀번호가 같습니다');
return false;
}
}
}else{
return false;
}
}
| 32.828035 | 189 | 0.619756 |
8d370b91644eaf87584d9299e76a2d05310edd46 | 155 | js | JavaScript | webpack.prod.babel.js | seetd/reactjs-webpack-template | 752398c20fd5cc7ecb084f28e5855fe8bcbdfe62 | [
"MIT"
] | null | null | null | webpack.prod.babel.js | seetd/reactjs-webpack-template | 752398c20fd5cc7ecb084f28e5855fe8bcbdfe62 | [
"MIT"
] | 6 | 2021-03-10T02:26:56.000Z | 2022-02-26T21:33:11.000Z | webpack.prod.babel.js | seetd/reactjs-webpack-template | 752398c20fd5cc7ecb084f28e5855fe8bcbdfe62 | [
"MIT"
] | null | null | null | import merge from "webpack-merge";
import common from "./webpack.common";
const config = merge(common, {
mode: "production"
});
export default config;
| 17.222222 | 38 | 0.716129 |
8d3726dcaca4ddefc765fc828ccc36f920fcd69d | 1,214 | js | JavaScript | node_modules/mongodb-extended-json/lib/serialize.js | tronghuy2807/adminMongo | 5dd5c3c152560bba93f0f723bbb2beee7a41a8c0 | [
"MIT"
] | 36 | 2015-03-24T22:04:26.000Z | 2021-08-01T02:37:45.000Z | node_modules/mongodb-extended-json/lib/serialize.js | tronghuy2807/adminMongo | 5dd5c3c152560bba93f0f723bbb2beee7a41a8c0 | [
"MIT"
] | 113 | 2015-03-16T11:55:43.000Z | 2021-07-25T23:28:34.000Z | node_modules/mongodb-extended-json/lib/serialize.js | tronghuy2807/adminMongo | 5dd5c3c152560bba93f0f723bbb2beee7a41a8c0 | [
"MIT"
] | 13 | 2015-03-27T16:02:16.000Z | 2021-01-28T11:33:59.000Z | var strict = require('./modes/strict');
var types = require('./types');
var isObject = types.isObject;
var isFunction = require('lodash.isfunction');
var transform = require('lodash.transform');
var type = types.type;
/* eslint no-use-before-define:0 */
function serializeArray(arr) {
return arr.map(serialize.bind(null));
}
function serializeTransformer(res, val, key) {
res[key] = serialize(val);
return res;
}
function serializeObject(obj) {
var value = obj;
if (isFunction(obj.serialize)) {
value = obj.serialize();
}
return transform(value, serializeTransformer, {});
}
function serializePrimitive(value) {
var t = type(value);
if (strict.serialize.hasOwnProperty(t) === false) {
return value;
}
var caster = strict.serialize[t];
return caster(value);
}
/**
* Format values with extra extended json type data.
*
* @param {Any} value - What to wrap as a `{$<type>: <encoded>}` object.
* @return {Any}
* @api private
*/
function serialize(value) {
if (Array.isArray(value) === true) {
return serializeArray(value);
}
if (isObject(value) === false) {
return serializePrimitive(value);
}
return serializeObject(value);
}
module.exports = serialize;
| 22.072727 | 72 | 0.676277 |
8d3766e1991b26f5fded3d333294bd0a5b08c95b | 664 | js | JavaScript | Section 26/College 293/src/Recipe.js | Seviran/Advanced-Webdev | f67db22c092ae96a9fc8eaac69c8cadd2d4f8475 | [
"MIT"
] | 1 | 2020-04-24T09:25:51.000Z | 2020-04-24T09:25:51.000Z | Section 26/College 293/src/Recipe.js | Seviran/Advanced-Webdev | f67db22c092ae96a9fc8eaac69c8cadd2d4f8475 | [
"MIT"
] | null | null | null | Section 26/College 293/src/Recipe.js | Seviran/Advanced-Webdev | f67db22c092ae96a9fc8eaac69c8cadd2d4f8475 | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import './Recipe.css';
class Recipe extends Component {
render() {
const { title, img, instructions } = this.props;
const ingredients = this.props.ingredients.map((ingredient, idx) => (
<li key={idx}>{ingredient}</li>
));
return (
<div className="recipe-card">
<div className='recipe-card-img'>
<img src={img} alt={title} />
</div>
<div className='recipe-card-content'>
<h3 className='recipe-title'>Recipe {title}</h3>
<h4>Ingredients:</h4>
<ul>{ingredients}</ul>
<h4>Instructions:</h4>
<p>{instructions}</p>
</div>
</div>
);
}
}
export default Recipe;
| 23.714286 | 71 | 0.60994 |
8d37d9219683ffc2e9aa4999f82834c03d346c23 | 132 | js | JavaScript | packages/components/src/IconsProvider/index.js | abdelillah-tech/ui | d544aff8236dbada253eea48b59cd51fb5343373 | [
"Apache-2.0"
] | 140 | 2017-01-24T15:52:42.000Z | 2022-03-23T10:29:07.000Z | packages/components/src/IconsProvider/index.js | abdelillah-tech/ui | d544aff8236dbada253eea48b59cd51fb5343373 | [
"Apache-2.0"
] | 3,451 | 2017-01-24T16:31:50.000Z | 2022-03-31T15:35:10.000Z | packages/components/src/IconsProvider/index.js | abdelillah-tech/ui | d544aff8236dbada253eea48b59cd51fb5343373 | [
"Apache-2.0"
] | 61 | 2017-01-26T08:59:42.000Z | 2022-03-16T04:44:51.000Z | import { IconsProvider } from '@talend/design-system';
IconsProvider.displayName = 'IconsProvider';
export default IconsProvider;
| 22 | 54 | 0.787879 |
8d386d8ae99d23172b4db7da3fb387c030e1730f | 2,240 | js | JavaScript | fake-nosql.js | snowyu/abstract-nosql | d933cd5262b1b92692e52007dd6b812d7680283e | [
"MIT"
] | null | null | null | fake-nosql.js | snowyu/abstract-nosql | d933cd5262b1b92692e52007dd6b812d7680283e | [
"MIT"
] | null | null | null | fake-nosql.js | snowyu/abstract-nosql | d933cd5262b1b92692e52007dd6b812d7680283e | [
"MIT"
] | null | null | null | // Generated by CoffeeScript 1.12.7
(function() {
var AbstractNoSql, FakeDB, FakeIterator, NotFoundError, errors, inherits, isObject, sinon;
AbstractNoSql = require('./');
sinon = require('sinon');
inherits = require('inherits-ex/lib/inherits');
isObject = require('util-ex/lib/is/type/object');
errors = require('abstract-error');
FakeIterator = require('./fake-iterator');
NotFoundError = errors.NotFoundError;
module.exports = FakeDB = (function() {
inherits(FakeDB, AbstractNoSql);
function FakeDB() {
if (!(this instanceof FakeDB)) {
return new FakeDB;
}
FakeDB.__super__.constructor.apply(this, arguments);
}
FakeDB.prototype.IteratorClass = FakeIterator;
FakeDB.prototype._openSync = sinon.spy(function() {
this.data = {};
return true;
});
FakeDB.prototype._closeSync = sinon.spy(function() {
this.data = {};
return true;
});
FakeDB.prototype._isExistsSync = sinon.spy(function(key) {
return this.data.hasOwnProperty(key);
});
FakeDB.prototype._mGetSync = sinon.spy(function() {
return AbstractNoSql.prototype._mGetSync.apply(this, arguments);
});
FakeDB.prototype._getBufferSync = sinon.spy(function() {
return AbstractNoSql.prototype._getBufferSync.apply(this, arguments);
});
FakeDB.prototype._getSync = sinon.spy(function(key, opts) {
if (this.data.hasOwnProperty(key)) {
return this.data[key];
} else {
throw new NotFoundError("NotFound:" + key);
}
});
FakeDB.prototype._putSync = sinon.spy(function(key, value) {
return this.data[key] = value;
});
FakeDB.prototype._delSync = sinon.spy(function(key) {
return delete this.data[key];
});
FakeDB.prototype._batchSync = sinon.spy(function(operations, options) {
var i, len, op;
for (i = 0, len = operations.length; i < len; i++) {
op = operations[i];
if (!isObject(op)) {
continue;
}
if (op.type === 'del') {
delete this.data[op.key];
} else {
this.data[op.key] = op.value;
}
}
return true;
});
return FakeDB;
})();
}).call(this);
| 24.888889 | 92 | 0.608929 |
8d391a5ca3a9d0a4b1d80efc48f947507f6daa31 | 692 | js | JavaScript | test/fibonacci.sequence.spec.js | pedroclayman/fibonacci-ui | d8eb2736c1fe1e600c7c3d4d825b2d9b6a726bee | [
"MIT"
] | null | null | null | test/fibonacci.sequence.spec.js | pedroclayman/fibonacci-ui | d8eb2736c1fe1e600c7c3d4d825b2d9b6a726bee | [
"MIT"
] | null | null | null | test/fibonacci.sequence.spec.js | pedroclayman/fibonacci-ui | d8eb2736c1fe1e600c7c3d4d825b2d9b6a726bee | [
"MIT"
] | null | null | null | (function() {
'use strict'
describe('fibonacci sequence', function() {
var sequence;
beforeEach(function() {
module('fibonacci');
inject([
'fibonacci.sequence',
function(sequenceInj) {
sequence = sequenceInj;
}
]);
});
it('should return a correct fibonacci sequence', function() {
var result = sequence.get(11);
expect(result).toEqual([1,1,2,3,5,8,13,21,34,55,89]);
});
it('should return a sequence of length 0 when executed without args', function() {
var result = sequence.get();
expect(result).toEqual([]);
});
});
})();
| 24.714286 | 88 | 0.521676 |
8d3b773042d2fb80f9302897d2e107360068e2a6 | 265 | js | JavaScript | template/src/router/routes.js | newbeea/vue-mp-web | fcd302038eca2369fd33375b9a658a72c43dccdb | [
"MIT"
] | 9 | 2018-07-03T10:12:14.000Z | 2019-11-07T17:34:18.000Z | template/src/router/routes.js | newbeea/vue-mp-web | fcd302038eca2369fd33375b9a658a72c43dccdb | [
"MIT"
] | 1 | 2018-12-16T03:40:49.000Z | 2019-12-12T07:07:53.000Z | template/src/router/routes.js | newbeea/vue-mp-web | fcd302038eca2369fd33375b9a658a72c43dccdb | [
"MIT"
] | 1 | 2019-07-29T00:57:30.000Z | 2019-07-29T00:57:30.000Z | module.exports = [
{
path: '/pages/home/index',
name: 'home',
alias: '/',
config: {
enablePullDownRefresh: true
}
},
{
path: '/pages/detail/index',
name: 'detail',
config: {
navigationBarTitleText: '详情'
}
}
]
| 14.722222 | 34 | 0.509434 |
8d3b9681f0e7a69096ce65a8e7003ba5ea0e4bde | 1,099 | js | JavaScript | dotjs/api/routes/sign.js | axolo/rbac-baby | 8268c6bed7c1d24c787d4d67486a30bc4568c872 | [
"MIT"
] | null | null | null | dotjs/api/routes/sign.js | axolo/rbac-baby | 8268c6bed7c1d24c787d4d67486a30bc4568c872 | [
"MIT"
] | null | null | null | dotjs/api/routes/sign.js | axolo/rbac-baby | 8268c6bed7c1d24c787d4d67486a30bc4568c872 | [
"MIT"
] | null | null | null | var accounts = require('../models/accounts');
var express = require('express');
var crypto = require('crypto');
var router = express.Router();
router.all('/up', function(req, res) {
var request = req.query;
accounts({
id: request.id,
mail: request.mail,
phone: request.phone,
password: crypto.createHash('sha1').update(request.password).digest('hex'),
token: crypto.createHash('sha1').update(request.password + request.mail).digest('hex'),
name: request.name
}).save(function(err, doc){
res.jsonp(err?err:doc);
});
});
router.all('/in', function(req, res) {
var request = req.query;
accounts
.findOne()
.where({
$or: [
{ id: request.id },
{ name: request.id },
{ mail: request.id },
{ phone: request.id }],
password: crypto.createHash('sha1').update(request.password).digest('hex') })
.exec(function(err, doc){
if(doc){ res.cookie('token', doc.token); }
res.jsonp(err?err:doc);
});
});
router.all('/out', function(req, res) {
res.clearCookie('token');
res.jsonp('signout');
});
module.exports = router; | 25.55814 | 91 | 0.621474 |
8d3bf2073a70ca174cb3a9a106cc57757a2bf3e8 | 1,484 | js | JavaScript | public/app/model/stock.js | Tixinoo/S9_JS_Actions | e1e41f07ff53944ca8df7fbaed16923692765d46 | [
"MIT"
] | null | null | null | public/app/model/stock.js | Tixinoo/S9_JS_Actions | e1e41f07ff53944ca8df7fbaed16923692765d46 | [
"MIT"
] | null | null | null | public/app/model/stock.js | Tixinoo/S9_JS_Actions | e1e41f07ff53944ca8df7fbaed16923692765d46 | [
"MIT"
] | null | null | null | angular.module('stocks_shop').factory('Stock',
['$rootScope', '$http', function($rootScope, $http) {
var Stock = function(reference, description, price) {
this.reference = reference;
this.description = description;
this.price = price;
}
Stock.prototype.buy = function() {
console.log("Achat de l'action dont le symbole est: " + this.reference + " et dont le prix est de: " + this.price);
var data = {
reference : this.reference,
description : this.description,
price : this.price
}
$http.post('http://localhost:3000/stocks', data);
$rootScope.$broadcast('updateStocks');
$rootScope.$broadcast('updateReferenceSums');
}
Stock.prototype.sell = function() {
console.log("Vente d'une action achetée à: " + this.price + " et vendue à: " + this.retailprice);
var val = Number(this.retailprice) - Number(this.price);
var float = parseFloat(val);
console.log("val:"+val);
var data = {
reference : this.reference,
description : this.description,
value : float,
quantity : "1",
date : new Date()
}
console.log(data);
$http.delete('http://localhost:3000/stocks/' + this.id);
$http.post('http://localhost:3000/sales', data);
$rootScope.$broadcast('updateStocks');
$rootScope.$broadcast('updateReferenceSums');
$rootScope.$broadcast('updateChart');
}
return Stock;
}]);
| 32.977778 | 121 | 0.605121 |
8d3c14027a46cb783d0a65b9d4d6f7f8ea02dbe6 | 187 | js | JavaScript | app/serializers/v2/attachment_serializer.js | berkus/pepyatka-server | 33ac22fd54c678685de06f412590d33af4f6668d | [
"MIT"
] | null | null | null | app/serializers/v2/attachment_serializer.js | berkus/pepyatka-server | 33ac22fd54c678685de06f412590d33af4f6668d | [
"MIT"
] | null | null | null | app/serializers/v2/attachment_serializer.js | berkus/pepyatka-server | 33ac22fd54c678685de06f412590d33af4f6668d | [
"MIT"
] | null | null | null | var Serializer = require("../../models").Serializer
exports.addSerializer = function() {
return new Serializer({ select: ["id", "media", "filename", "path", "thumbnail", "size"]});
};
| 31.166667 | 93 | 0.647059 |
8d3c347484d0e93b717fe7c17e3870df642689ab | 7,699 | js | JavaScript | src/plugins/elderjs-plugin-markdown/index.js | Dithn/swyxdotio | 947904d33a3df96b1e4389274ea1a21ae90c801f | [
"MIT"
] | null | null | null | src/plugins/elderjs-plugin-markdown/index.js | Dithn/swyxdotio | 947904d33a3df96b1e4389274ea1a21ae90c801f | [
"MIT"
] | null | null | null | src/plugins/elderjs-plugin-markdown/index.js | Dithn/swyxdotio | 947904d33a3df96b1e4389274ea1a21ae90c801f | [
"MIT"
] | null | null | null | const glob = require('glob');
const path = require('path');
const fs = require('fs');
const grayMatter = require('gray-matter');
// const remark = require('remark');
// const remarkHtml = require('remark-html');
require('dotenv-safe').config(); // have DEV_TO_API_KEY in process.env
const fetch = require('node-fetch');
const yaml = require('js-yaml')
const unified = require('unified')
const vfile = require('vfile')
const report = require('vfile-reporter')
let _preset = {
settings: {},
plugins: [
require('remark-parse'),
require('remark-slug'),
[
require('remark-autolink-headings'),
{
behavior: 'wrap',
linkProperties: { class: 'highlightOnHover' }
// content: {
// type: 'element',
// tagName: 'span',
// properties: { className: ['icon', 'icon-link'] },
// children: [{ type: 'text', value: ' 🔗' }],
// },
},
],
require('remark-toc'),
require('remark-sectionize'),
require('remark-rehype'),
require('rehype-format'),
[require('remark-frontmatter'), ['yaml']],
[require('./rehype-shiki'), { theme: 'material-theme-palenight' }],
require('rehype-stringify'),
require('./remark-replace'),
],
}
async function parseMarkdown({ filePath, markdown }) {
// const result = await remark().use(remarkHtml).process(markdown);
var post_vfile = vfile({ path: filePath, contents: markdown });
const file = await unified()
.use(_preset)
.process(post_vfile)
.catch((err) => {
console.error(report(post_vfile));
throw err;
});
file.extname = '.html';
return file.toString();
}
async function getFromDevTo() {
let allArticles = [];
let page = 0;
let per_page = 300; // can go up to 1000
let latestResult = [];
do {
page += 1; // bump page up by 1 every loop
// var abc = await fetch('https://dev.to/api/articles/me/published', { headers: { 'api-key': 'dxHE3aPVYRDfYs57nGWmDG6P' } })
latestResult = await fetch(`https://dev.to/api/articles/me/published?page=${page}&per_page=${per_page}`, {
headers: {
'api-key': process.env.DEV_TO_API_KEY,
},
})
.then(async (res) => {
try {
return res.json()
} catch (err) {
const text = await res.text()
console.error('err', err); // very basic error handling, customize as needed
console.log('res.json text: ', text.slice(0, 200));
throw err
}
})
.then((x) => (allArticles = allArticles.concat(x)))
.catch((err) => {
console.log({res})
console.error(err); // very basic error handling, customize as needed
throw new Error(`error fetching page ${page}, {err}`);
});
} while (latestResult.length === per_page);
return allArticles;
}
const plugin = {
name: 'elderjs-plugin-markdown',
description:
'Reads and collects markdown content from specified routes. It automatically adds found markdown files as requests on allRequests',
init: (plugin) => {
const { config, settings } = plugin;
// used to store the data in the plugin's closure so it is persisted between loads
plugin.markdown = [];
plugin.requests = [];
plugin.podcasts = yaml.safeLoad(fs.readFileSync(path.resolve('content/podcasts.yml'), 'utf8'));
plugin.talks = yaml.safeLoad(fs.readFileSync(path.resolve('content/talks.yml'), 'utf8'));
if (config && Array.isArray(config.routes) && config.routes.length > 0) {
for (const route of config.routes) {
const mdsInRoute = path.resolve(process.cwd(), route);
const mdFiles = glob.sync(`${mdsInRoute}/*.md`);
const segment = route.split('/').slice(-1)[0]
for (const file of mdFiles) {
const md = fs.readFileSync(file, 'utf-8');
const { data, content } = grayMatter(md);
let fileSlug = file.replace('.md', '').split('/').pop();
if (fileSlug.includes(' ')) {
fileSlug = fileSlug.replace(/ /gim, '-');
}
const categories = data.tag_list || (Array.isArray(data.categories) ? data.categories : [data.categories || 'uncategorized'])
if (data.slug) {
plugin.markdown.push({
slug: data.slug,
data: {
technical: segment === 'technical',
...data,
categories
},
content,
});
plugin.requests.push({ slug: data.slug, route: 'article' });
} else {
plugin.markdown.push({
slug: fileSlug,
data: {
technical: segment === 'technical',
...data,
categories
},
content,
});
plugin.requests.push({ slug: fileSlug, route: 'article' });
}
}
}
}
return plugin;
},
config: {},
hooks: [
{
hook: 'bootstrap',
name: 'addMdFilesToDataObject',
description: 'Add parsed .md content and data to the data object',
priority: 50, // default
run: async ({ data, plugin }) => {
let articles = await getFromDevTo();
articles.forEach((article) => {
let {
data,
content,
} = grayMatter(article.body_markdown);
const slug = data.slug || article.slug
plugin.markdown.push({
slug,
data: {
slug,
disclosure: data.disclosure,
canonical_url: article.canonical_url,
cover_image: article.cover_image,
devto_url: article.url,
date: new Date(data.displayed_publish_date || article.published_at),
title: article.title,
subtitle: data.subtitle,
description: data.desc || article.description,
categories: article.tag_list,
devto_reactions: article.public_reactions_count
},
content,
});
plugin.requests.push({ slug, route: 'article' });
});
// // todo: make simple recommender algo to do related posts feature
// fs.writeFileSync('test.json', JSON.stringify(articles, null, 2))
// console.log('markdown', plugin.markdown.map(x => Object.keys(x.data)))
return {
data: {
...data,
markdown: plugin.markdown,
podcasts: plugin.podcasts,
talks: plugin.talks
},
};
},
},
{
hook: 'allRequests',
name: 'mdFilesToAllRequests',
description: 'Add collected md files to allRequests array.',
priority: 50, // default
run: async ({ allRequests, plugin }) => {
return {
allRequests: [...allRequests, ...plugin.requests],
};
},
},
{
hook: 'data',
name: 'addFrontmatterAndHtmlToDataForRequest',
description: 'Adds parsed frontmatter and html to the data object for the specific request.',
priority: 50,
run: async ({ request, data }) => {
if (data.markdown) {
const markdown = data.markdown.find((m) => m.slug === request.slug);
if (markdown) {
const { content, data: frontmatter } = markdown;
const html = await parseMarkdown({
filePath: frontmatter.slug,
markdown: content
});
return {
data: {
...data,
frontmatter,
html,
},
};
}
}
},
},
],
};
module.exports = plugin;
exports.default = plugin;
| 32.348739 | 135 | 0.546435 |
8d3ca65d650e12398d8afe11f314fec959f83e3c | 232 | js | JavaScript | src/app/universal.constants.js | qirads/glass | 458cdfe7454fc6765f3cc049438f3c39b16f08ca | [
"MIT"
] | null | null | null | src/app/universal.constants.js | qirads/glass | 458cdfe7454fc6765f3cc049438f3c39b16f08ca | [
"MIT"
] | null | null | null | src/app/universal.constants.js | qirads/glass | 458cdfe7454fc6765f3cc049438f3c39b16f08ca | [
"MIT"
] | null | null | null | import angular from 'angular';
import moment from 'moment';
const universal = angular.module('glass.universal', []);
universal
.constant('moment', moment)
.constant('BACKEND_URI', webpackBackendUri);
export default universal; | 23.2 | 56 | 0.75 |
8d3cac092cfba459082e54965fae6b275cba7cca | 822 | js | JavaScript | testing/app.js | fn-code/simfus | ea9662eecbe358c184bd21a0c6afeb4d97f82140 | [
"MIT"
] | 2 | 2017-10-10T12:47:32.000Z | 2019-01-31T09:08:12.000Z | testing/app.js | fn-code/simfus | ea9662eecbe358c184bd21a0c6afeb4d97f82140 | [
"MIT"
] | null | null | null | testing/app.js | fn-code/simfus | ea9662eecbe358c184bd21a0c6afeb4d97f82140 | [
"MIT"
] | null | null | null | let five = require("johnny-five");
let Etherport = require("etherport");
let board = new five.Board();
board.on("ready", function() {
this.pinMode(11, board.MODES.INPUT);
this.digitalWrite(11, 1);
let tetesA = 0;
this.digitalRead(11, function(data) {
let jadiRes = data;
if (jadiRes == 0) {
tetesA++;
console.log(tetesA);
// if (tetesA == 1) {
// setTimeout(() => {
// console.log("Hasil : " + tetesA);
// tetesA = 0;
// }, 60000);
// }
}
});
});
// board.on("close", function() {
// console.log('Board closed')
// board.disconnect();
// setTimeout(() => {
// board.connect();
// // Boardstart()
// }, 10000);
// }) | 20.55 | 56 | 0.448905 |
8d3ce449758ebd9926cb2ee696bd9748c6489e5c | 11,696 | js | JavaScript | browser_machine/v2/ui/assembly/dist.js | l2wilson94/vms | 19bf9833bdeb03c9381e59a32285844118491540 | [
"MIT"
] | 2 | 2020-11-19T21:40:55.000Z | 2020-11-21T09:40:39.000Z | browser_machine/v2/ui/assembly/dist.js | l2wilson94/vms | 19bf9833bdeb03c9381e59a32285844118491540 | [
"MIT"
] | null | null | null | browser_machine/v2/ui/assembly/dist.js | l2wilson94/vms | 19bf9833bdeb03c9381e59a32285844118491540 | [
"MIT"
] | 1 | 2020-11-21T13:58:15.000Z | 2020-11-21T13:58:15.000Z | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
const getNumber = (n) => {
if (n) {
if (n.slice(0, 2) === '0x') {
return parseInt(n, 16)
} else if (n.slice(0, 2) === '0b') {
return parseInt(n, 2)
} else {
return parseInt(n, 10)
}
} else {
return 0
}
}
const assembleInstruction = function(line) {
let words = line.split(` `)
words[1] = getNumber(words[1])
words[2] = getNumber(words[2])
switch (words[0]) {
case 'halt':
return 0
break
case 'noop':
return 0b0110000000000000
break
case 'setn':
return ( ( (0b1 << 4) | words[1] ) << 8 ) | words[2]
break
case 'loadr':
return ( ( ( (0b0100 << 4) | words[1] ) << 4 ) | words[2] ) << 4
break
case 'storer':
return ( ( ( ( (0b0100 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | 1
break
case 'popr':
return ( ( ( ( (0b0100 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | 2
break
case 'pushr':
return ( ( ( ( (0b0100 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | 3
break
case 'setn':
return ( ( (0b0010 << 4) | words[1] ) << 8 ) | words[2]
break
case 'storen':
return ( ( (0b0011 << 4) | words[1] ) << 8 ) | words[2]
break
case 'addn':
return ( ( (0b0101 << 4) | words[1] ) << 8 ) | words[2]
break
case 'copy':
return ( ( ( (0b0110 << 4) | words[1] ) << 4 ) | words[2] ) << 4
break
case 'add':
return ( ( ( ( (0b0110 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | words[3]
break
case 'sub':
return ( ( ( ( (0b0111 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | words[3]
break
case 'mul':
return ( ( ( ( (0b1000 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | words[3]
break
case 'div':
return ( ( ( ( (0b1001 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | words[3]
break
case 'mod':
return ( ( ( ( (0b1010 << 4) | words[1] ) << 4 ) | words[2] ) << 4 ) | words[3]
break
case 'jump':
return ( ( (0b0 << 4) | words[1] ) << 8 ) | 0b11
break
case 'jumpn':
return (0b1011 << 12) | words[1]
break
case 'jeqz':
return ( ( (0b1100 << 4) | words[1] ) << 8 ) | words[2]
break
case 'jnez':
return ( ( (0b1101 << 4) | words[1] ) << 8 ) | words[2]
break
case 'jgtz':
return ( ( (0b1110 << 4) | words[1] ) << 8 ) | words[2]
break
case 'jltz':
return ( ( (0b1111 << 4) | words[1] ) << 8 ) | words[2]
break
case 'call':
return ( ( (0b1011 << 4) | words[1] ) << 8 ) | words[2]
break
default:
return 0
}
}
module.exports = assembleInstruction
},{}],2:[function(require,module,exports){
/**
* Takes bytecode in an `ArrayBuffer` and execute it.
* The virtual machine state consists of program, programPointer, memory,
* memoryPointer, registers and a flag to identify if
* the machine is running or not.
*/
const TRUE = 1
const FALSE = 0
const clone = function(object) {
return Object.assign({}, object)
}
// OPCODES
const nop = function(state, instruction) {
return clone(state)
}
const neg = nop
const jgtz = nop
const jltz = nop
const halt = function(state) {
// Stop!
state.running = false
return clone(state)
}
const read = function(state, instruction) {
// Place user input in register rX
return clone(state)
}
const write = function(state, instruction) {
// Place user input in register rX
return clone(state)
}
const jump = function(state, instruction) {
const rx = getFirstNibble(instruction)
state.programPointer = state.registers[rx]
return clone(state)
}
const setn = function(state, instruction) {
const rx = getFirstNibble(instruction)
state.registers[rx] = getUint8(instruction)
return clone(state)
}
const loadr = function(state, instruction) {
const rx = getFirstNibble(instruction)
const ry = getSecondNibble(instruction)
state.registers[rx] = state.memory[state.registers[ry]]
return clone(state)
}
const storer = function(state, instruction) {
const rx = getFirstNibble(instruction)
const ry = getSecondNibble(instruction)
state.memory[state.registers[ry]] = state.registers[rx]
return clone(state)
}
const popr = function(state, instruction) {
const rx = getFirstNibble(instruction)
const ry = getSecondNibble(instruction)
state.registers[ry] -= 1
state.registers[rx] = state.memory[state.registers[ry]]
return clone(state)
}
const pushr = function(state, instruction) {
const rx = getFirstNibble(instruction)
const ry = getSecondNibble(instruction)
state.memory[state.registers[ry]] = state.registers[rx]
state.registers[ry] += 1
return clone(state)
}
const loadn = function(state, instruction) {
let int8 = getUint8(instruction)
let rx = getFirstNibble(instruction)
state.registers[rx] = state.memory[int8]
return clone(state)
}
const storen = function(state, instruction) {
let int8 = getUint8(instruction)
let rx = getFirstNibble(instruction)
state.memory[int8] = state.registers[rx]
return clone(state)
}
const addn = function(state, instruction) {
let int8 = getUint8(instruction)
let rx = getFirstNibble(instruction)
state.registers[rx] += int8
return clone(state)
}
const copy = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
state.registers[rx] = state.registers[ry]
return clone(state)
}
const add = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
let rz = getThirdNibble(instruction)
state.registers[rx] = state.registers[ry] + state.registers[rz]
return clone(state)
}
const sub = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
let rz = getThirdNibble(instruction)
state.registers[rx] = state.registers[ry] - state.registers[rz]
return clone(state)
}
const mul = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
let rz = getThirdNibble(instruction)
state.registers[rx] = state.registers[ry] * state.registers[rz]
return clone(state)
}
const div = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
let rz = getThirdNibble(instruction)
state.registers[rx] = Math.floor(state.registers[ry] / state.registers[rz])
return clone(state)
}
const mod = function(state, instruction) {
let rx = getFirstNibble(instruction)
let ry = getSecondNibble(instruction)
let rz = getThirdNibble(instruction)
state.registers[rx] = state.registers[ry] % state.registers[rz]
return clone(state)
}
const call = function(state, instruction) {
let rx = getFirstNibble(instruction)
let int8 = getUint8(instruction)
state.registers[rx] = state.programPointer + 1
state.programPointer = int8
return clone(state)
}
const jumpn = function(state, instruction) {
let int8 = getUint8(instruction)
state.programPointer = int8
return clone(state)
}
const jeqz = function(state, instruction) {
let rx = getFirstNibble(instruction)
let int8 = getUint8(instruction)
if (state.registers[rx] == 0) {
state.programPointer = int8
}
return clone(state)
}
const jnez = function(state, instruction) {
let rx = getFirstNibble(instruction)
let int8 = getUint8(instruction)
if (state.registers[rx] != 0) {
state.programPointer = int8
}
return clone(state)
}
// Dictionary between mneumonic and actual function
const opcodes = {
'halt': halt,
'nop': nop,
'read': read,
'write': write,
'setn': setn,
'loadr': loadr,
'storer': storer,
'popr': popr,
'pushr': pushr,
'loadn': loadn,
'storen': storen,
'addn': addn,
'copy': copy,
'add': add,
'neg': neg,
'sub': sub,
'mul': mul,
'div': div,
'mod': mod,
'jump': jump,
'jumpn': jumpn,
'jeqz': jeqz,
'jnez': jnez,
'jgtz': jgtz,
'jltz': jltz,
'call': call
}
// Machine code parser
const getCleanState = function() {
let running = false
let program = new Uint16Array(128)
let programPointer = 0x0000
let memory = new Uint8Array(64)
let memoryPointer = 0x0000
let registers = new Uint8Array(16)
for (let i = 0; i < program.length; i++) {
program[i] = 0x0000
}
for (let i = 0; i < memory.length; i++) {
memory[i] = 0x0000
}
return {
program, programPointer, memory, memoryPointer, registers, running
}
}
const getOpcode = function(instruction) {
switch(instruction >> 12) {
case 0b0000:
switch (instruction & 0b1111) {
case 0b0000:
return 'halt'
case 0b0001:
return 'read'
case 0b0010:
return 'write'
case 0b0011:
return 'jump'
}
case 0b0001:
return 'setn'
case 0b0100:
switch (instruction & 0b1111) {
case 0b0000:
return 'loadr'
case 0b0001:
return 'storer'
case 0b0010:
return 'popr'
case 0b0011:
return 'pushr'
}
case 0b0010:
return 'loadn'
case 0b0011:
return 'storen'
case 0b0101:
return 'addn'
case 0b0110:
if ((instruction & 0xFFF) == 0x000) {
return 'nop'
} else if ((instruction & 0b1111) == 0b0000) {
return 'copy'
} else {
return 'add'
}
case 0b0111:
if (((instruction >> 4) & 0b1111) == 0b0000) {
return 'neg'
} else {
return 'sub'
}
case 0b1000:
return 'mul'
case 0b1001:
return 'div'
case 0b1010:
return 'mod'
case 0b1011:
if(((instruction >> 8) & 0xF) == 0x0) {
return 'jumpn'
} else {
return 'call'
}
case 0b1100:
return 'jeqz'
case 0b1101:
return 'jnez'
case 0b1110:
return 'jgtz'
case 0b1111:
return 'jltz'
default:
}
}
const shiftValues = function(instruction, left, right) {
instruction = instruction >> right
instruction = instruction << left
return instruction
}
const getNibble = function(instruction, shift) {
shift = shift || {}
instruction = shiftValues(instruction, shift.left, shift.right)
return instruction & 0b1111
}
const getFirstNibble = function(instruction) {
return getNibble(instruction, {right: 8})
}
const getSecondNibble = function(instruction) {
return getNibble(instruction, {right: 4})
}
const getThirdNibble = function(instruction) {
return getNibble(instruction)
}
const getInt8 = function(instruction) {
return (instruction & 0xFF) - 128
}
const getUint8 = function(instruction) {
return instruction & 0xFF
}
const vm = {
getCleanState,
getOpcode,
getFirstNibble,
getSecondNibble,
getThirdNibble,
getInt8,
getUint8,
opcodes
}
module.exports = vm
},{}],3:[function(require,module,exports){
const vm = require('../../lib/vm')
const assembleInstruction = require('../../lib/assembler')
const bin = function(n, size) {
let b = (n>>>0).toString(2)
for (let i = b.length; i < size; i++) {
b = `0${b}`
}
return b
}
const int = function(b) {
let n = 0
for (let i = 0; i < b.length; i++) {
n = n << 1
if (b[i] == 1) {
n |= 0b1
}
}
return n
}
window.compile = function() {
let textarea = document.getElementById('screen')
let printer = document.getElementById('printer')
let code = textarea.value.split(`\n`)
code.unshift('noop')
console.log(code.join(' '))
code = code.map((line) => assembleInstruction(line))
console.log(code.map(n => bin(n, 16)).join(' '))
code = code.map((line) => `0x${line.toString(16)}`)
console.log(code.join(' '))
printer.innerText = 'HEX Output: \n'
code.forEach((line, i) => {
printer.innerHTML += line
printer.innerHTML += ` `
})
}
},{"../../lib/assembler":1,"../../lib/vm":2}]},{},[3]);
| 25.991111 | 497 | 0.645092 |
8d3d4211edb3baaaab83053305c26c6fd8b4a97f | 5,975 | js | JavaScript | example/imagery/plugin.js | cheezecakes/openmct | 190ff602ddb70d470d5624bd1ac125e53f4a7fbe | [
"Apache-2.0"
] | 1 | 2020-03-20T15:28:00.000Z | 2020-03-20T15:28:00.000Z | example/imagery/plugin.js | StackNeverFlow/openmct | 11574b7c40142e17861d3f1d68ee3fc56c69cc62 | [
"Apache-2.0"
] | 1 | 2020-04-17T12:35:13.000Z | 2020-04-17T12:35:13.000Z | example/imagery/plugin.js | StackNeverFlow/openmct | 11574b7c40142e17861d3f1d68ee3fc56c69cc62 | [
"Apache-2.0"
] | null | null | null | /*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
], function (
) {
function ImageryPlugin() {
var IMAGE_SAMPLES = [
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18733.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18734.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18735.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18736.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18737.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18738.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18739.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18740.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18741.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18742.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18743.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18744.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18745.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18746.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18747.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
];
function pointForTimestamp(timestamp, name) {
return {
name: name,
utc: Math.floor(timestamp / 5000) * 5000,
url: IMAGE_SAMPLES[Math.floor(timestamp / 5000) % IMAGE_SAMPLES.length]
};
}
var realtimeProvider = {
supportsSubscribe: function (domainObject) {
return domainObject.type === 'example.imagery';
},
subscribe: function (domainObject, callback) {
var interval = setInterval(function () {
callback(pointForTimestamp(Date.now(), domainObject.name));
}, 5000);
return function () {
clearInterval(interval);
};
}
};
var historicalProvider = {
supportsRequest: function (domainObject, options) {
return domainObject.type === 'example.imagery'
&& options.strategy !== 'latest';
},
request: function (domainObject, options) {
var start = options.start;
var end = options.end;
var data = [];
while (start <= end && data.length < 5000) {
data.push(pointForTimestamp(start, domainObject.name));
start += 5000;
}
return Promise.resolve(data);
}
};
var ladProvider = {
supportsRequest: function (domainObject, options) {
return domainObject.type === 'example.imagery' &&
options.strategy === 'latest';
},
request: function (domainObject, options) {
return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]);
}
};
return function install(openmct) {
openmct.types.addType('example.imagery', {
key: 'example.imagery',
name: 'Example Imagery',
cssClass: 'icon-image',
description: 'For development use. Creates example imagery ' +
'data that mimics a live imagery stream.',
creatable: true,
initialize: function (object) {
object.telemetry = {
values: [
{
name: 'Name',
key: 'name'
},
{
name: 'Time',
key: 'utc',
format: 'utc',
hints: {
domain: 1
}
},
{
name: 'Image',
key: 'url',
format: 'image',
hints: {
image: 1
}
}
]
}
}
});
openmct.telemetry.addProvider(realtimeProvider);
openmct.telemetry.addProvider(historicalProvider);
openmct.telemetry.addProvider(ladProvider);
};
}
return ImageryPlugin;
});
| 40.924658 | 91 | 0.490042 |
8d3db24aefe0e79f6e995d979821c7e19730b3a4 | 826 | js | JavaScript | greatCircleDistance.js | lunaticmonk/great-circle-distance | f8d67c7faf3343bf9a8b1967149bed2ed1ce0bf9 | [
"MIT"
] | 7 | 2019-04-15T09:16:31.000Z | 2021-07-28T05:38:09.000Z | greatCircleDistance.js | lunaticmonk/great-circle-distance | f8d67c7faf3343bf9a8b1967149bed2ed1ce0bf9 | [
"MIT"
] | null | null | null | greatCircleDistance.js | lunaticmonk/great-circle-distance | f8d67c7faf3343bf9a8b1967149bed2ed1ce0bf9 | [
"MIT"
] | null | null | null | "use strict";
const PI = Math.PI;
const RADIUS_OF_EARTH = 6371e3;
const greatCircleDistance = options => {
const { lat1, lng1, lat2, lng2 } = options;
const dLat = getRadians(lat2) - getRadians(lat1);
const dLng = getRadians(lng2) - getRadians(lng1);
const φ1 = getRadians(lat1);
const φ2 = getRadians(lat2);
const Δφ = getRadians(lat2 - lat1);
const Δλ = getRadians(lng2 - lng1);
/**
* Havershine's formula
*
*/
const a =
Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const d = RADIUS_OF_EARTH * c;
// distance in kms.
return d / 1000;
};
const getRadians = coordinate => {
return (coordinate * PI) / 180;
};
module.exports = {
greatCircleDistance
};
| 20.65 | 70 | 0.622276 |
8d3e2e928c4f05a87a507bfd1929afb305388d3e | 2,457 | js | JavaScript | jscomp/src/js/runtime/library.js | msridhar/SJS | 2bc945a759c7531ff83a65622f002b733c0d3a2a | [
"Apache-2.0"
] | 34 | 2016-10-30T00:25:17.000Z | 2022-03-17T05:32:38.000Z | jscomp/src/js/runtime/library.js | msridhar/SJS | 2bc945a759c7531ff83a65622f002b733c0d3a2a | [
"Apache-2.0"
] | null | null | null | jscomp/src/js/runtime/library.js | msridhar/SJS | 2bc945a759c7531ff83a65622f002b733c0d3a2a | [
"Apache-2.0"
] | 6 | 2016-10-23T01:02:14.000Z | 2020-01-20T19:38:58.000Z | /*
* Copyright 2015-2016 Samsung Research America, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function Function () {
};
Function.prototype = Function; // placeholder
function Object() {
};
Function.__proto__ = Function.prototype = { }; //@todo fill this up with necessary builtin functions
Object.__proto__ = Function.prototype;
Object.prototype = {}; //@todo fill this up with necessary builtin functions
Function.prototype.__proto__ = Object.prototype;
Object.prototype.__proto__ = null;
console = {};
console.log = function(str) {
"use js: console.log(str);";
};
function Array() {
var ret = [], len, i; //@todo: needs to be implemented properly
if (arguments.length === 1) {
len = arguments[0];
for(i = 0; i<len; i++) {
ret[i] = undefiend;
}
} else if (arguments.length > 1) {
len = arguments.length;
for(i = 0; i<len; i++) {
ret[i] = arguments[i];
}
}
return ret;
}
Array.prototype = {}; //@todo fill this up with necessary builtin functions
function RegExp () {
}
RegExp.prototype = {}; //@todo fill this up with necessary builtin functions
function $ERROR(str) {
"use js: console.log(str);";
}
function String(x) {
var ret;
"use js: ret = ''+x;"
return ret;
}
String.prototype = {};
var Math = {};
Math.max = function(a,b) {
return a>b? a:b;
};
Math.sqrt = function(v) {
var ret;
"use js: ret = Math.sqrt(v);";
return ret;
};
Math.sin = function (v){
var ret;
"use js: ret = Math.sin(v);";
return ret;
};
Math.cos = function (v){
var ret;
"use js: ret = Math.cos(v);";
return ret;
};
Math.round = function (v){
var ret;
"use js: ret = Math.round(v);";
return ret;
};
Math.abs = function (v){
var ret;
"use js: ret = Math.abs(v);";
return ret;
};
(function(){
var ret;
"use js: ret = Math.PI;";
Math.PI = ret;
}());
| 21 | 100 | 0.61742 |
8d3e958ebaaf0536102b8d5a7ebe4ae6cdbb7ae4 | 2,517 | js | JavaScript | SmartRadio/SmartRadio/wwwroot/js/followingActivity.js | Owliie/Smart-Radio | c44257a9d5b95717b1371c8a86096712d17f5961 | [
"MIT"
] | null | null | null | SmartRadio/SmartRadio/wwwroot/js/followingActivity.js | Owliie/Smart-Radio | c44257a9d5b95717b1371c8a86096712d17f5961 | [
"MIT"
] | null | null | null | SmartRadio/SmartRadio/wwwroot/js/followingActivity.js | Owliie/Smart-Radio | c44257a9d5b95717b1371c8a86096712d17f5961 | [
"MIT"
] | null | null | null | var userId = null;
var connection = null;
$(document).ready(function () {
connection = new signalR.HubConnectionBuilder().withUrl("/FollowingActivity").build();
userId = readCookie("userId");
connection.on("DisplayFollowing", function (followingUsers) {
if (followingUsers.length === 0) {
$("#following").append("<li class=\"list-group-item d-flex justify-content-between align-items-center\"><h4>You are not following anybody</h4></li>");
} else {
for (let following of followingUsers) {
$("#following").append(followingInfo(following));
}
}
});
connection.on("UpdateRadioStation", function (followingId, radioStation) {
console.log(followingId);
$(`#fm-${followingId}`).text(radioStation);
});
connection.on("UnFollow", function (id) {
$(`#following-item-${id}`).remove();
});
connection.on("Follow", function (following) {
$("#following").append(followingInfo(following));
$(`#search-result-${following.id}`).remove();
});
connection.start().then(function () {
connection.invoke("JoinRoom", userId).catch(function (err) {
return console.error(err.toString());
});
}).catch(function (err) {
return console.error(err.toString());
});
function followingInfo(following) {
return $(`<li class="list-group-item d-flex justify-content-between align-items-center" id="following-item-${following.id}">
<h5 class="mb-1">${following.userName}</h5>
<div>
<span id="fm-${following.id}" class="badge badge-secondary">${following.radioStation}</span>
<div class="btn-group dropright d-inline">
<span class="more" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
︙
</span>
<div class="dropdown-menu">
<p class="dropdown-item" onclick="unFollow('${following.id}')">Unfollow</p>
</div>
</div>
</div>
</li>`);
}
});
function unFollow(id) {
connection.invoke("UnFollow", userId, id).catch(function (err) {
return console.log(err.toString());
});
}
function follow(id) {
connection.invoke("Follow", userId, id).catch(function (err) {
return console.log(err.toString());
});
} | 36.478261 | 162 | 0.556218 |
8d3ec9f9d6517c04be2179e7ce5c8264cdcb5271 | 5,957 | js | JavaScript | packages/rmw-shell/src/config/locales/de.js | dsoldo/react-most-wanted | aaddf7a19033af8099638a2804b79f4e71a52dba | [
"MIT"
] | 1 | 2020-02-25T04:10:25.000Z | 2020-02-25T04:10:25.000Z | packages/rmw-shell/src/config/locales/de.js | dsoldo/react-most-wanted | aaddf7a19033af8099638a2804b79f4e71a52dba | [
"MIT"
] | null | null | null | packages/rmw-shell/src/config/locales/de.js | dsoldo/react-most-wanted | aaddf7a19033af8099638a2804b79f4e71a52dba | [
"MIT"
] | null | null | null | import { defineMessages } from 'react-intl'
const messages = defineMessages({
current_locale: 'de-DE',
app_name: 'React Meist Gesucht',
dashboard: 'Übersicht',
about: 'Über',
page_not_found_demo: 'Seite nicht gefunden demo',
'404': '404',
warning_404_message: '404 Seite nicht gefunden',
warning_404_description: 'Es tut uns leid aber die angeforderte Seite existiert nicht.',
settings: 'Einstellungen',
language: 'Sprache',
theme: 'Thema',
responsive: 'Responsive',
en: 'Englisch',
de: 'Deutsch',
bs: 'Bosnisch',
ru: 'Russisch',
es: 'Spanische',
fr: 'Französisch',
dark: 'Dark',
light: 'Light',
ics: 'ICS',
sign_out: 'Abmelden',
sign_in: 'Anmelden',
sign_up: 'Registrieren',
sign_in_with_google: 'Mit Google anmelden',
sign_in_with_facebook: 'Mit Facebook anmelden',
sign_in_with_twitter: 'Mit Twitter anmelden',
sign_in_with_github: 'Mit Github anmelden',
'link_with_google.com': 'Mit Google verbinden',
'link_with_facebook.com': 'Mit Facebook verbinden',
'link_with_twitter.com': 'Mit Twitter verbinden',
'link_with_github.com': 'Mit Github verbinden',
my_account: 'Mein Konto',
name: 'Name',
email: 'E-Mail',
password: 'Passwort',
new_password: 'Neues Passwort',
confirm_password: 'Passwort bestätigen',
forgort_password: 'Passwort vergessen?',
reset_password: 'Passwort zurücksetzten',
change_password: 'Passwort ändern',
change_email: 'E-Mail ändern',
change_photo: 'Foto ändern',
reset_password_hint: 'Ihre E-Mail eingeben',
save: 'Speichern',
delete_account: 'Konto löschen',
select_file: 'Datei auswählen',
cancel: 'Abbrechen',
submit: 'Bestätigen',
delete: 'Löschen',
ok: 'OK',
delete_account_dialog_title: 'Konto löschen?',
delete_account_dialog_message: 'Dein Konto wird gelöscht und mit ihm alle Daten!',
email_not_verified: 'E-Mail ist nicht verifiziert!',
email_verified: 'E-Mail ist verifiziert',
send_verification_email: 'Verifizierungs E-Mail senden',
send_verification_email_again: 'Verifizierungs E-Mail wieder senden',
tasks: 'Aufgaben',
create_task: 'Aufgabe erstellen',
edit_task: 'Aufgabe bearbeiten',
users: 'Benutzer',
edit: 'Bearbeiten',
online: 'Online',
offline: 'Offline',
no_connection_warning: 'Keine Verbindung!',
title_label: 'Titel',
title_hint: 'Titel eingeben',
no_connection: 'Keine Verbindung',
delete_task_title: 'Aufgabe löschen?',
delete_task_message: 'Aufgabe wird gelöscht!',
error: 'Fehler!',
companies: 'Unternehmen',
create_company: 'Unternehmen erstellen',
edit_company: 'Unternehmen bearbeiten',
delete_company_title: 'Unternehmen löschen?',
delete_company_message: 'Unternehmen wird gelöscht!',
full_name_label: 'Voller Name',
full_name_hint: 'Vollen Namen eingeben',
vat_label: 'UID',
vat_hint: 'UID eingeben',
description_label: 'Beschreibung',
description_hint: 'Beschreibung eingeben',
name_label: 'Name',
name_hint: 'Name eingeben',
public_chats: 'Öffentlicher Chat',
delete_message_title: 'Nachricht löschen?',
delete_message_message: 'Die Nachrricht wird gelöscht!',
users_count_title: '{number} Benutzer',
user_registrationg_graph_label: 'Benutzer registrierungen',
required: 'Erforderlich',
facebook: 'Facebook',
github: 'Github',
twitter: 'Twitter',
phone: 'Phone',
google: 'Google',
facebook_color: '#303F9F',
github_color: '#263238',
twitter_color: '#36A2EB',
phone_color: '#90A4AE',
google_color: '#EA4335',
password_color: '#4CAF50',
chats: 'Chats',
write_message_hint: 'Nachricht schreiben...',
load_more_label: 'Mehr...',
my_location: 'Mein Standort',
select_user: 'Benutzer auswählen',
operator_like_label: 'wie',
operator_notlike_label: 'nicht wie',
operator_equal_label: 'gleich',
operator_notequal_label: 'nicht equal',
operator_novalue_label: 'kein Wert',
administration: 'Administration',
roles: 'Rollen',
grants: 'Berechtigungen',
private: 'Private',
public: 'Öffentlich',
grant_read_companies: 'Unternehmen lesen',
grant_create_company: 'Unternehmen erstellen',
grant_edit_company: 'Unternehmen bearbeiten',
grant_delete_company: 'Unternehmen löschen',
is_admin_label: 'Administrator',
predefined_messages: 'Vorgefertigte Nachrichten',
delete_predefined_chat_message_title: 'Vorgefertigte Nachricht löschen?',
delete_predefined_chat_message_message: 'Vorgefertigte Nachricht wird gelöscht!',
select_field: 'Feld auswählen',
sorting: 'Sortierung',
filters: 'Filter',
filter: 'Filter',
add_filter: 'Filter hinzufügen',
delete_filter: 'Filter löschen',
change_sort_orientation: 'Anordnung ändern',
enable_case_sensitivity: 'Grosschreibung',
hint_autocomplete: 'Auswählen',
enter_query_text: 'Tekst eingeben',
email_label: 'Email',
close_filter: 'Filter schliesen',
open_filter: 'Filter öffnen',
select_operator: 'Operator auswählen',
not_match_found: 'Nichst gefunden',
edit_user: 'Benutzer bearbeiten',
firestore: 'Firestore',
hot_dog_status: 'Hot dog status',
user_label_search: 'Suchen',
document: 'Document',
collection: 'Collection',
mark_chat_as_unread: 'Als ungelesen markieren',
delete_chat: 'Chat löschen',
search: 'Suchen',
update_available: 'Eine neue Version dieser App ist verfügbar.',
load_update: 'Aktualisieren',
enable_notifications_message: 'Benachrichtigungen aktivieren?',
enable: 'Aktivieren',
no_thanks: 'Nein, danke',
creation_time: 'Erstellungszeit',
night_mode: 'Nachtmodus',
day_mode: 'Tagmodus',
default: 'Standard',
red: 'Rot',
green: 'Grün',
notifications: 'Benachrichtigungen',
disable_notifications_dialog_title: 'Benachrichtigungen abschalten',
disable_notifications_dialog_message: 'Alle Benachrichtigungen auf all deinen Geräten werden abgeschaltet!',
update_title: 'Update verfügbar!',
update_message: 'Für die Aktualisierung hier klicken',
install: 'Installieren',
disable: 'Deaktivieren'
})
export default messages
| 34.433526 | 110 | 0.739634 |
8d3efa8baeb5afc401078beeb0d25179ad96099c | 2,194 | js | JavaScript | src/routes.js | novadwisaptanainseven/e-pekerja | afe47b35ce06ea9fb448bd63a836a65f255ebecd | [
"MIT"
] | 3 | 2021-05-17T16:53:23.000Z | 2021-07-28T02:52:53.000Z | src/routes.js | novadwisaptanainseven/e-pekerja | afe47b35ce06ea9fb448bd63a836a65f255ebecd | [
"MIT"
] | null | null | null | src/routes.js | novadwisaptanainseven/e-pekerja | afe47b35ce06ea9fb448bd63a836a65f255ebecd | [
"MIT"
] | null | null | null | import React from "react";
// Import Dashboard
const Dashboard = React.lazy(() => import("./views/dashboard/Dashboard"));
// Import Data Kepegawaian
const DataKepegawaian = React.lazy(() =>
import("./views/pages/User/DataKepegawaian")
);
const EditPegawai = React.lazy(() =>
import("./views/pages/User/DataKepegawaian/DataDiri/PNS/EditPegawai")
);
const EditPTTH = React.lazy(() =>
import("./views/pages/User/DataKepegawaian/DataDiri/PTTH/EditPTTH")
);
const EditPTTB = React.lazy(() =>
import("./views/pages/User/DataKepegawaian/DataDiri/PTTB/EditPTTB")
);
// Kenaikan Pangkat
const KenaikanPangkat = React.lazy(() =>
import("./views/pages/User/KenaikanPangkat")
);
// Import Akun
const Akun = React.lazy(() => import("./views/pages/User/Akun"));
const EditAkun = React.lazy(() => import("./views/pages/User/Akun/EditAkun"));
const EditPassword = React.lazy(() =>
import("./views/pages/User/Akun/EditPassword")
);
const routes = [
// Dashboard
{ path: "/epekerja/user", exact: true, name: "Home" },
{
path: "/epekerja/user/dashboard",
name: "Dashboard",
component: Dashboard,
},
// Data Kepegawaian
{
path: "/epekerja/user/data-kepegawaian",
name: "Data Kepegawaian",
component: DataKepegawaian,
exact: true,
},
{
path: "/epekerja/user/data-kepegawaian/edit-data-diri/pns",
name: "Edit Data Diri",
component: EditPegawai,
exact: true,
},
{
path: "/epekerja/user/data-kepegawaian/edit-data-diri/ptth",
name: "Edit Data Diri",
component: EditPTTH,
exact: true,
},
{
path: "/epekerja/user/data-kepegawaian/edit-data-diri/pttb",
name: "Edit Data Diri",
component: EditPTTB,
exact: true,
},
// Kenaikan Pangkat
{
path: "/epekerja/user/kenaikan-pangkat",
name: "Kenaikan Pangkat",
component: KenaikanPangkat,
exact: true,
},
// Data Akun
{
path: "/epekerja/user/akun",
name: "Akun",
component: Akun,
},
{
path: "/epekerja/user/akun-edit",
name: "Edit Akun",
component: EditAkun,
},
{
path: "/epekerja/user/akun-edit-password",
name: "Edit Password",
component: EditPassword,
},
];
export default routes;
| 23.340426 | 78 | 0.646764 |
8d407519883c63d968867632f557f80e2976ac30 | 617 | js | JavaScript | dist/plugins/paged.min.js | ameswarb/angular-restmod | 6fd52a26877a99ae9d65fae6cec49ee9fbc45ad0 | [
"MIT"
] | 1 | 2015-09-22T16:24:20.000Z | 2015-09-22T16:24:20.000Z | dist/plugins/paged.min.js | ameswarb/angular-restmod | 6fd52a26877a99ae9d65fae6cec49ee9fbc45ad0 | [
"MIT"
] | null | null | null | dist/plugins/paged.min.js | ameswarb/angular-restmod | 6fd52a26877a99ae9d65fae6cec49ee9fbc45ad0 | [
"MIT"
] | null | null | null | /**
* API Bound Models for AngularJS
* @version v1.0.3 - 2014-09-16
* @link https://github.com/angular-platanus/restmod
* @author Ignacio Baixas <ignacio@platan.us>
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
!function(a,b){"use strict";a.module("restmod").factory("PagedModel",["restmod",function(a){return a.mixin({PAGE_HEADER:"X-Page",PAGE_COUNT_HEADER:"X-Page-Total","~afterFetchMany":function(a){var c=a.headers(this.$getProperty("pageHeader")),d=a.headers(this.$getProperty("pageCountHeader"));this.$page=c!==b?parseInt(c,10):1,this.$pageCount=d!==b?parseInt(d,10):1}})}])}(angular); | 77.125 | 380 | 0.71799 |
8d40a176ffa69c6ba1b7267ac18e8c540c86f0a9 | 1,204 | js | JavaScript | src/icons/lifesaver.js | arthurdenner/akar-icons | a8c419200da96941258c4dfcf4572e0d106b5c3c | [
"MIT"
] | null | null | null | src/icons/lifesaver.js | arthurdenner/akar-icons | a8c419200da96941258c4dfcf4572e0d106b5c3c | [
"MIT"
] | null | null | null | src/icons/lifesaver.js | arthurdenner/akar-icons | a8c419200da96941258c4dfcf4572e0d106b5c3c | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
const Lifesaver = props => {
const { color, size, ...otherProps } = props;
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke={color}
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...otherProps}
id="Lifesaver"
>
<g clipPath="url(#clip0)">
<circle cx="12" cy="12" r="10" transform="rotate(45 12 12)"></circle>
<circle cx="12" cy="12" r="4" transform="rotate(45 12 12)"></circle>
<path d="M19.071 4.929l-4.243 4.243"></path>
<path d="M9.172 14.828l-4.243 4.243"></path>
<path d="M19.071 19.071l-4.243-4.243"></path>
<path d="M9.172 9.172L4.929 4.929"></path>
</g>
<defs>
<clipPath id="clip0">
<rect width="24" height="24"></rect>
</clipPath>
</defs>
</svg>
);
};
Lifesaver.propTypes = {
color: PropTypes.string,
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
Lifesaver.defaultProps = {
color: 'currentColor',
size: '24'
};
export default Lifesaver;
| 25.083333 | 77 | 0.564784 |
8d40d8ab5ee0b61d444bc98b95e8125c8fe0fded | 1,118 | js | JavaScript | lib/constants.js | rocketguys/elemental | 2e1615b7021d04a280d33e490f95d22f44731c21 | [
"MIT"
] | null | null | null | lib/constants.js | rocketguys/elemental | 2e1615b7021d04a280d33e490f95d22f44731c21 | [
"MIT"
] | null | null | null | lib/constants.js | rocketguys/elemental | 2e1615b7021d04a280d33e490f95d22f44731c21 | [
"MIT"
] | 1 | 2018-07-05T13:45:01.000Z | 2018-07-05T13:45:01.000Z | 'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _exports = {};
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
_exports.canUseDOM = canUseDOM;
// breakpoints
_exports.breakpoint = {
xs: 480,
sm: 768,
md: 992,
lg: 1200
};
// border radii
_exports.borderRadius = {
xs: 2,
sm: 4,
md: 8,
lg: 16,
xl: 32
};
// color
_exports.color = {
appDanger: '#d64242',
appInfo: '#56cdfc',
appPrimary: '#1385e5',
appSuccess: '#34c240',
appWarning: '#fa9f47',
brandPrimary: '#31adb8'
};
// spacing
_exports.spacing = {
xs: 5,
sm: 10,
md: 20,
lg: 40,
xl: 80
};
// widths
_exports.width = {
container: 1170,
gutter: 20
};
// fractions (for col widths)
function perc(n) {
return n * 100 + '%';
}
function denominators(n) {
for (var d = 2; d <= 20; d++) {
if (n < d) {
_exports.fractions[n + '/' + d] = perc(n / d);
}
}
}
_exports.fractions = {
'1': '100%'
};
for (var numerator = 1; numerator <= 19; numerator++) {
denominators(numerator);
}
exports.canUseDOM = canUseDOM;
exports['default'] = _exports; | 14.519481 | 102 | 0.615385 |
8d40f67895129635b33737cf78b1dd18bfca4673 | 356 | js | JavaScript | resources/js/api/tokenTransaction.js | Hnsenchristiann/Webcomic-admin | cd03e697c7b1de7bf9ae2e1b7812392479fd7b02 | [
"MIT"
] | null | null | null | resources/js/api/tokenTransaction.js | Hnsenchristiann/Webcomic-admin | cd03e697c7b1de7bf9ae2e1b7812392479fd7b02 | [
"MIT"
] | null | null | null | resources/js/api/tokenTransaction.js | Hnsenchristiann/Webcomic-admin | cd03e697c7b1de7bf9ae2e1b7812392479fd7b02 | [
"MIT"
] | null | null | null | import Resource from '@/api/resource';
import request from '@/utils/request';
class TokenResource extends Resource {
constructor() {
super('tokens');
}
queriedTotalTokensSpent(query){
return request({
url: '/' + this.uri + '/queriedtotal',
method: 'get',
params: query,
});
}
}
export { TokenResource as default };
| 18.736842 | 44 | 0.629213 |
8d418d5df70727d7734dc19d76416e6d5a75dd29 | 1,352 | js | JavaScript | src/services/sonosAuth.js | thomasnordquist/node-sonos-audio-clip | 24ec41393ee82d3c8925b2b46b003bdda2bf0e71 | [
"MIT"
] | null | null | null | src/services/sonosAuth.js | thomasnordquist/node-sonos-audio-clip | 24ec41393ee82d3c8925b2b46b003bdda2bf0e71 | [
"MIT"
] | 4 | 2020-07-28T11:51:49.000Z | 2021-08-17T12:25:56.000Z | src/services/sonosAuth.js | thomasnordquist/node-sonos-audio-clip | 24ec41393ee82d3c8925b2b46b003bdda2bf0e71 | [
"MIT"
] | 2 | 2019-02-02T16:37:42.000Z | 2019-05-10T14:25:10.000Z | const axios = require('axios');
const querystring = require('querystring');
const sonosClientId = process.env.SONOS_CLIENT_ID;
const sonosClientSecret = process.env.SONOS_CLIENT_SECRET;
module.exports = class SonosAuth {
constructor() {
this.client = axios.create({
baseURL: 'https://api.sonos.com/login/v3/oauth/',
headers: {
Authorization: `Basic ${Buffer.from(`${sonosClientId}:${sonosClientSecret}`).toString('base64')}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
});
}
async createAuthorizationToken(code, redirectUri) {
const response = await this.client.post(
'access',
querystring.stringify({
grant_type: 'authorization_code',
code,
redirect_uri: redirectUri,
})
);
return {
accessToken: response.data.access_token,
refreshToken: response.data.refresh_token,
};
}
async refreshAccessToken(refreshToken) {
const response = await this.client.post(
'access',
querystring.stringify({
grant_type: 'refresh_token',
refresh_token: refreshToken,
})
);
return response.data.access_token;
}
};
| 29.391304 | 114 | 0.568787 |
8d4196e6ebf257131faa1e4cd9ce16892d300519 | 466 | js | JavaScript | src/utilities/assets.js | kapseliboi/boxwood | 51e88310cbb9c593345786e0b8f5fc23ec9d256a | [
"MIT"
] | 17 | 2020-04-16T03:54:33.000Z | 2021-04-15T07:59:21.000Z | src/utilities/assets.js | kapseliboi/boxwood | 51e88310cbb9c593345786e0b8f5fc23ec9d256a | [
"MIT"
] | 221 | 2018-11-18T21:17:01.000Z | 2020-03-31T11:48:31.000Z | src/utilities/assets.js | kapseliboi/boxwood | 51e88310cbb9c593345786e0b8f5fc23ec9d256a | [
"MIT"
] | 4 | 2020-04-15T15:43:46.000Z | 2022-02-02T12:08:02.000Z | function mergeAssets (assets) {
const object = {}
assets.forEach(asset => {
const { path, files } = asset
if (!path) return
if (!object[path]) {
object[path] = asset
} else if (object[path].id < asset.id) {
asset.files = [...object[path].files, ...files]
object[path] = asset
} else {
object[path].files = [...object[path].files, ...files]
}
})
return Object.values(object)
}
module.exports = { mergeAssets }
| 24.526316 | 60 | 0.577253 |
8d42f377fbeddd2de982bb5ec15450204444c5d0 | 74 | js | JavaScript | example/api/params_last/:id/get.js | foysavas/apiculator | a05fb43e93ea2a701611c551c4fdebf2a3767b4c | [
"MIT"
] | 1 | 2016-08-08T04:42:14.000Z | 2016-08-08T04:42:14.000Z | example/api/params_last/:id/get.js | foysavas/apiculator | a05fb43e93ea2a701611c551c4fdebf2a3767b4c | [
"MIT"
] | 1 | 2021-05-08T22:08:59.000Z | 2021-05-08T22:08:59.000Z | example/api/params_last/:id/get.js | foysavas/apiculator | a05fb43e93ea2a701611c551c4fdebf2a3767b4c | [
"MIT"
] | null | null | null | module.exports = function(req, res) {
res.send(`matched param :id`);
};
| 18.5 | 37 | 0.648649 |
8d42f40ae834b5b797db4ed8e6a9393c68161da5 | 2,098 | js | JavaScript | src/ui/public/agg_types/param_types/field.js | Bargs/kibana | 62264b70d2abe1be4e964e3c4b61ea4b1f195d79 | [
"Apache-2.0"
] | null | null | null | src/ui/public/agg_types/param_types/field.js | Bargs/kibana | 62264b70d2abe1be4e964e3c4b61ea4b1f195d79 | [
"Apache-2.0"
] | 2 | 2015-09-23T20:51:27.000Z | 2018-03-20T14:52:49.000Z | src/ui/public/agg_types/param_types/field.js | Bargs/kibana | 62264b70d2abe1be4e964e3c4b61ea4b1f195d79 | [
"Apache-2.0"
] | null | null | null | import { SavedObjectNotFound } from 'ui/errors';
import _ from 'lodash';
import editorHtml from 'ui/agg_types/controls/field.html';
import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base';
export default function FieldAggParamFactory(Private) {
let BaseAggParam = Private(AggTypesParamTypesBaseProvider);
_.class(FieldAggParam).inherits(BaseAggParam);
function FieldAggParam(config) {
FieldAggParam.Super.call(this, config);
}
FieldAggParam.prototype.editor = editorHtml;
FieldAggParam.prototype.scriptable = false;
FieldAggParam.prototype.filterFieldTypes = '*';
/**
* Called to serialize values for saving an aggConfig object
*
* @param {field} field - the field that was selected
* @return {string}
*/
FieldAggParam.prototype.serialize = function (field) {
return field.name;
};
/**
* Called to read values from a database record into the
* aggConfig object
*
* @param {string} fieldName
* @return {field}
*/
FieldAggParam.prototype.deserialize = function (fieldName, aggConfig) {
let field = aggConfig.vis.indexPattern.fields.byName[fieldName];
if (!field) {
throw new SavedObjectNotFound('index-pattern-field', fieldName);
}
return field;
};
/**
* Write the aggregation parameter.
*
* @param {AggConfig} aggConfig - the entire configuration for this agg
* @param {object} output - the result of calling write on all of the aggregations
* parameters.
* @param {object} output.params - the final object that will be included as the params
* for the agg
* @return {undefined}
*/
FieldAggParam.prototype.write = function (aggConfig, output) {
let field = aggConfig.getField();
if (!field) {
throw new Error(`"${aggConfig.makeLabel()}" requires a field`);
}
if (field.scripted) {
output.params.script = {
inline: field.script,
lang: field.lang,
};
} else {
output.params.field = field.name;
}
};
return FieldAggParam;
};
| 28.351351 | 90 | 0.664442 |