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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
731c12b86824225f62be8e32d32c3d542bfd565e | 523 | js | JavaScript | Easy/relative-ranks.js | AonanHe/LeetCode | 9de2cd3e32578b24c71bbcdba7326b208cf18909 | [
"Apache-2.0"
] | null | null | null | Easy/relative-ranks.js | AonanHe/LeetCode | 9de2cd3e32578b24c71bbcdba7326b208cf18909 | [
"Apache-2.0"
] | null | null | null | Easy/relative-ranks.js | AonanHe/LeetCode | 9de2cd3e32578b24c71bbcdba7326b208cf18909 | [
"Apache-2.0"
] | null | null | null | /**
* Problem: Relative Ranks
* Difficulty: Easy
* Runtime: 88 ms
* Date: 2018/12/21
* Author: Aonan He
*/
/**
* @param {number[]} nums
* @return {string[]}
*/
var findRelativeRanks = function(nums) {
const dict = {}
const a = [...nums].sort((a, b) => b - a)
a.forEach((x, index) => {
dict[x] =
index === 0
? 'Gold Medal'
: index === 1
? 'Silver Medal'
: index === 2
? 'Bronze Medal'
: (index + 1).toString()
})
return nums.map((x) => dict[x])
}
| 19.37037 | 43 | 0.491396 |
731c367df5f9303517740a93563a4467030efd02 | 2,570 | js | JavaScript | webapp/src/routes/settings/index.js | MaxChoMac/eos-rate | 1d2e798c37815afa338153982e4d742f6a47c4ad | [
"MIT"
] | null | null | null | webapp/src/routes/settings/index.js | MaxChoMac/eos-rate | 1d2e798c37815afa338153982e4d742f6a47c4ad | [
"MIT"
] | null | null | null | webapp/src/routes/settings/index.js | MaxChoMac/eos-rate | 1d2e798c37815afa338153982e4d742f6a47c4ad | [
"MIT"
] | null | null | null | import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { makeStyles } from '@material-ui/core/styles'
import { useDispatch, useSelector } from 'react-redux'
import List from '@material-ui/core/List'
import ListItem from '@material-ui/core/ListItem'
import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'
import ListItemText from '@material-ui/core/ListItemText'
import { useTranslation } from 'react-i18next'
import Typography from '@material-ui/core/Typography'
import Switch from '@material-ui/core/Switch'
import Language from '@material-ui/icons/Language'
import NotificationsIcon from '@material-ui/icons/Notifications'
const useStyles = makeStyles((theme) => ({
root: {
padding: theme.spacing(3)
}
}))
const Settings = ({ i18n }) => {
const { t } = useTranslation('translations')
const classes = useStyles()
const { language, notifications } = useSelector((state) => state.settings)
const dispatch = useDispatch()
const handleToggle = (value, currentValue) => () => {
if (value === 'language') {
const lang = currentValue === 'en' ? 'es' : 'en'
i18n.changeLanguage(lang)
dispatch.settings.setSettings({ key: value, value: lang })
} else if (value === 'notifications')
dispatch.settings.setSettings({ key: value, value: !currentValue })
}
return (
<div className={classes.root}>
<Typography
variant='h5'
style={{ textAlign: 'center', paddingTop: 20, paddingBottom: 20 }}
>
{t('settingsTitle')}
</Typography>
<List>
<ListItem>
<ListItemIcon>
<Language />
</ListItemIcon>
<ListItemText primary={t('settingsLanguages')} />
<ListItemSecondaryAction>
<Switch
onChange={() => handleToggle('language', language)}
checked={language === 'en'}
/>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<NotificationsIcon />
</ListItemIcon>
<ListItemText primary={t('settingsNotifications')} />
<ListItemSecondaryAction>
<Switch
onChange={() => handleToggle('notifications', notifications)}
checked={notifications}
/>
</ListItemSecondaryAction>
</ListItem>
</List>
</div>
)
}
Settings.propTypes = {
i18n: PropTypes.object.isRequired
}
export default Settings
| 32.125 | 79 | 0.63035 |
731c44e63637adceeab7f68a733b1db34e01e6c6 | 1,315 | js | JavaScript | server/modules/Scraper.js | Denniswegereef/se-scraper | d9a03e02c08640642d7dd4a008a0a5e8759ba578 | [
"MIT"
] | null | null | null | server/modules/Scraper.js | Denniswegereef/se-scraper | d9a03e02c08640642d7dd4a008a0a5e8759ba578 | [
"MIT"
] | 1 | 2022-03-26T02:11:39.000Z | 2022-03-26T02:11:39.000Z | server/modules/Scraper.js | Denniswegereef/se-scraper | d9a03e02c08640642d7dd4a008a0a5e8759ba578 | [
"MIT"
] | 1 | 2020-01-28T10:05:54.000Z | 2020-01-28T10:05:54.000Z | const axios = require('axios');
const chalk = require('chalk');
const FloorDataCleaner = require('../helpers/FloorDataCleaner');
const createTimeStamp = require('../helpers/createTimeStamp');
const LOGS = require('../data/logs.json');
module.exports = class Scraper {
constructor(building) {
this._building = building
}
async start() {
console.log(`${LOGS.START_FETCHCING} ${chalk.green(createTimeStamp())}`);
const scrapedData = await this._startScraping();
return scrapedData
}
async _startScraping() {
console.log(chalk.bgGreen.black(`${LOGS.START_SCRAPE} ${this._building.name}`));
const scrapedPagesPromises = await this._building.floors.map(floor => this._scrapePage(floor));
const scrapedPages = await Promise.all(scrapedPagesPromises);
return {
name: this._building,
timestamp: createTimeStamp(),
floors: scrapedPages.map((floorData, i) => FloorDataCleaner.clean(floorData.data, this._building.floors[i]))
}
}
async _scrapePage(floor) {
console.log(chalk.magentaBright(`${LOGS.SCRAPE_FLOOR} ${floor.name}`));
try {
return axios.get(floor.url);
}
catch (e) {
console.error(chalk.red(e));
}
}
} | 29.222222 | 120 | 0.625856 |
731c45aae069a278024abeb0b1159a73ad0cd2d6 | 1,812 | js | JavaScript | node_modules/@vkontakte/icons/dist/16/info_outline.js | Wokkta/Hackatont_vk | e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9 | [
"MIT"
] | null | null | null | node_modules/@vkontakte/icons/dist/16/info_outline.js | Wokkta/Hackatont_vk | e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9 | [
"MIT"
] | null | null | null | node_modules/@vkontakte/icons/dist/16/info_outline.js | Wokkta/Hackatont_vk | e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _browserSymbol = _interopRequireDefault(require("svg-baker-runtime/browser-symbol"));
var _es6ObjectAssign = require("es6-object-assign");
var _sprite = require("../sprite");
var _SvgIcon = require("../SvgIcon");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// @ts-ignore
// @ts-ignore
var viewBox = '0 0 16 16';
var id = 'info_outline_16';
var content = '<symbol fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="info_outline_16"><clipPath id="info_outline_16_a"><path d="M0 0h16v16H0z" /></clipPath><g clip-path="url(#info_outline_16_a)"><path d="M7.153 7.906a.847.847 0 111.694 0v3.482a.847.847 0 11-1.694 0z" fill="#99a2ad" /><path d="M8 3.765a.941.941 0 100 1.882.941.941 0 000-1.882z" fill="currentColor" /><circle cx="8.02" cy="8" r="7.25" stroke="currentColor" stroke-width="1.5" /></g></symbol>';
var isMounted = false;
function mountIcon() {
if (!isMounted) {
(0, _sprite.addSpriteSymbol)(new _browserSymbol.default({
id: id,
viewBox: viewBox,
content: content
}));
isMounted = true;
}
}
var Icon16InfoOutline = function Icon16InfoOutline(props) {
(0, _sprite.useIsomorphicLayoutEffect)(function () {
mountIcon();
}, []);
return _react.default.createElement(_SvgIcon.SvgIcon, (0, _es6ObjectAssign.assign)({}, props, {
viewBox: viewBox,
id: id,
width: !isNaN(props.width) ? +props.width : 16,
height: !isNaN(props.height) ? +props.height : 16
}));
};
Icon16InfoOutline.mountIcon = mountIcon;
var _default = Icon16InfoOutline;
exports.default = _default;
//# sourceMappingURL=info_outline.js.map | 34.188679 | 485 | 0.68819 |
731c762fef00cc9db6e79391447ff48d0ad6ac64 | 5,578 | js | JavaScript | public/js/sns.js | munehirokusano/mynews2 | c0f22b5b07377f77c58b267e67ad86ba205d476f | [
"MIT"
] | null | null | null | public/js/sns.js | munehirokusano/mynews2 | c0f22b5b07377f77c58b267e67ad86ba205d476f | [
"MIT"
] | 9 | 2020-10-31T12:07:55.000Z | 2022-02-27T04:15:16.000Z | public/js/sns.js | munehirokusano/mynews2 | c0f22b5b07377f77c58b267e67ad86ba205d476f | [
"MIT"
] | 1 | 2020-10-03T15:33:19.000Z | 2020-10-03T15:33:19.000Z | /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./resources/js/sns.js":
/*!*****************************!*\
!*** ./resources/js/sns.js ***!
\*****************************/
/*! no static exports found */
/***/ (function(module, exports) {
// SNSボタンを追加するエリア
var snsArea = document.getElementById('sns-area'); // シェア時に使用する値
var shareUrl = 'http://cly7796.net/wp/'; // 現在のページURLを使用する場合 location.href;
var shareText = 'cly7796.netのトップページです。'; // 現在のページタイトルを使用する場合 document.title;
generate_share_button(snsArea, shareUrl, shareText); // シェアボタンを生成する関数
function generate_share_button(area, url, text) {
// シェアボタンの作成
var twBtn = document.createElement('span');
twBtn.className = 'twitter-btn';
var fbBtn = document.createElement('span');
fbBtn.className = 'facebook-btn'; // 各シェアボタンのリンク先
var twHref = 'https://twitter.com/share?text=' + encodeURIComponent(text) + '&url=' + encodeURIComponent(url);
var fbHref = 'http://www.facebook.com/share.php?u=' + encodeURIComponent(url); // シェアボタンにリンクを追加
var clickEv = 'onclick="popupWindow(this.href); return false;"';
var twLink = '<a href="' + twHref + '" ' + clickEv + '><img src="/images/Twitter_Social_Icon_Circle_Color.png" width="32px" height="32px" alt="ツイッターロゴ"></a>';
var fbLink = '<a href="' + fbHref + '" ' + clickEv + '><img src="/images/f_logo_RGB-Blue_1024.png" width="32px" height="32px" alt="ファイスブックロゴ"></a>';
twBtn.innerHTML = twLink;
fbBtn.innerHTML = fbLink; // シェアボタンを表示
area.appendChild(twBtn);
area.appendChild(fbBtn);
} // クリック時にポップアップで表示させる関数
function popupWindow(url) {
window.open(url, '', 'width=580,height=400,menubar=no,toolbar=no,scrollbars=yes');
}
/***/ }),
/***/ 1:
/*!***********************************!*\
!*** multi ./resources/js/sns.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! C:\Users\mks09\mynews2\resources\js\sns.js */"./resources/js/sns.js");
/***/ })
/******/ }); | 38.736111 | 160 | 0.57189 |
731cc5c9945664228f502bc1bdc614dff316c71e | 853 | js | JavaScript | icons/bee.js | darosh/material-icons-bundle | 3dd1cc534b011fc4fe78e9d71ef919a62096033f | [
"MIT"
] | 11 | 2017-11-02T18:14:44.000Z | 2022-02-08T07:22:44.000Z | icons/bee.js | darosh/material-icons-bundle | 3dd1cc534b011fc4fe78e9d71ef919a62096033f | [
"MIT"
] | 1 | 2021-03-02T15:17:09.000Z | 2021-03-02T15:17:09.000Z | icons/bee.js | darosh/material-icons-bundle | 3dd1cc534b011fc4fe78e9d71ef919a62096033f | [
"MIT"
] | 1 | 2020-03-12T10:40:22.000Z | 2020-03-12T10:40:22.000Z | export default "M17.4 9C17 7.8 16.2 7 15 6.5V5H14V6.4H13.6C12.5 6.4 11.6 6.8 10.8 7.6L10.4 8L9 7.5C8.7 7.4 8.4 7.3 8 7.3C7.4 7.3 6.8 7.5 6.3 7.9C5.7 8.3 5.4 8.8 5.2 9.3C5 10 5 10.6 5.2 11.3C5.5 12 5.8 12.5 6.3 12.8C5.9 14.3 6.2 15.6 7.3 16.7C8.1 17.5 9 17.9 10.1 17.9C10.6 17.9 10.9 17.9 11.2 17.8C11.8 18.6 12.6 19.1 13.6 19.1C13.9 19.1 14.3 19.1 14.6 19C15.2 18.8 15.6 18.4 16 17.9C16.4 17.3 16.6 16.8 16.6 16.2C16.6 15.8 16.6 15.5 16.5 15.2L16 13.6L16.6 13.2C17.4 12.4 17.8 11.3 17.7 10.1H19V9H17.4M7.7 11.3C7.1 11 6.9 10.6 7.1 10C7.3 9.4 7.7 9.2 8.3 9.4L11.5 10.6C9.9 11.4 8.7 11.6 7.7 11.3M14 16.9C13.4 17.1 13 16.9 12.7 16.3C12.4 15.3 12.6 14.1 13.4 12.5L14.6 15.6C14.8 16.3 14.6 16.7 14 16.9M15.2 11.6L14.6 10V9.9L14.3 9.6H14.2L12.6 9C13 8.7 13.4 8.5 13.9 8.5C14.4 8.5 14.9 8.7 15.3 9.1C15.7 9.5 15.9 9.9 15.9 10.4C15.7 10.7 15.5 11.2 15.2 11.6Z" | 853 | 853 | 0.635404 |
731d15a1043f7f2ab0b4d6c561dd0e0344e42657 | 2,647 | js | JavaScript | node_modules/neo.mjs/node_modules/siesta-lite/docs/output/Siesta.Test.UserAgent.KeyCodes.js | dnabusinessintelligence/production | 4da3f443392b20a334a53022c5e1f6e445558e0a | [
"MIT"
] | null | null | null | node_modules/neo.mjs/node_modules/siesta-lite/docs/output/Siesta.Test.UserAgent.KeyCodes.js | dnabusinessintelligence/production | 4da3f443392b20a334a53022c5e1f6e445558e0a | [
"MIT"
] | null | null | null | node_modules/neo.mjs/node_modules/siesta-lite/docs/output/Siesta.Test.UserAgent.KeyCodes.js | dnabusinessintelligence/production | 4da3f443392b20a334a53022c5e1f6e445558e0a | [
"MIT"
] | null | null | null | Ext.data.JsonP.Siesta_Test_UserAgent_KeyCodes({"tagname":"class","name":"Siesta.Test.UserAgent.KeyCodes","autodetected":{},"files":[{"filename":"KeyCodes.js","href":"KeyCodes.html#Siesta-Test-UserAgent-KeyCodes"}],"singleton":true,"members":[],"alternateClassNames":[],"aliases":{},"id":"class-Siesta.Test.UserAgent.KeyCodes","short_doc":"This is a singleton class, containing the mnemonical names for various advanced key codes. ...","component":false,"superclasses":[],"subclasses":[],"mixedInto":[],"mixins":[],"parentMixins":[],"requires":[],"uses":[],"html":"<div><pre class=\"hierarchy\"><h4>Files</h4><div class='dependency'><a href='source/KeyCodes.html#Siesta-Test-UserAgent-KeyCodes' target='_blank'>KeyCodes.js</a></div></pre><div class='doc-contents'><p>This is a singleton class, containing the mnemonical names for various advanced key codes. You can use this names in the <a href=\"#!/api/Siesta.Test.Browser-method-type\" rel=\"Siesta.Test.Browser-method-type\" class=\"docClass\">Siesta.Test.Browser.type</a> method, like this:</p>\n\n<pre><code>t.type(el, 'Foo bar[ENTER]', function () {\n ...\n})\n</code></pre>\n\n<p>Below is the full list:</p>\n\n<ul>\n<li><p><code>BACKSPACE</code></p></li>\n<li><p><code>TAB</code></p></li>\n<li><p><code>ENTER</code> (<code>RETURN</code>)</p></li>\n<li><p><code>SPACE</code></p></li>\n<li><p><code>SHIFT</code></p></li>\n<li><code>CTRL</code></li>\n<li><p><code>ALT</code></p></li>\n<li><p><code>PAUSE-BREAK</code></p></li>\n<li><code>CAPS</code></li>\n<li><code>ESCAPE</code> (<code>ESC</code>)</li>\n<li><code>NUM-LOCK</code></li>\n<li><code>SCROLL-LOCK</code></li>\n<li><p><code>PRINT</code></p></li>\n<li><p><code>PAGE-UP</code></p></li>\n<li><code>PAGE-DOWN</code></li>\n<li><code>END</code></li>\n<li><code>HOME</code></li>\n<li><code>LEFT</code></li>\n<li><code>UP</code></li>\n<li><code>RIGHT</code></li>\n<li><code>DOWN</code></li>\n<li><code>INSERT</code></li>\n<li><p><code>DELETE</code></p></li>\n<li><p><code>NUM0</code></p></li>\n<li><code>NUM1</code></li>\n<li><code>NUM2</code></li>\n<li><code>NUM3</code></li>\n<li><code>NUM4</code></li>\n<li><code>NUM5</code></li>\n<li><code>NUM6</code></li>\n<li><code>NUM7</code></li>\n<li><code>NUM8</code></li>\n<li><p><code>NUM9</code></p></li>\n<li><p><code>F1</code></p></li>\n<li><code>F2</code></li>\n<li><code>F3</code></li>\n<li><code>F4</code></li>\n<li><code>F5</code></li>\n<li><code>F6</code></li>\n<li><code>F7</code></li>\n<li><code>F8</code></li>\n<li><code>F9</code></li>\n<li><code>F10</code></li>\n<li><code>F11</code></li>\n<li><code>F12</code></li>\n</ul>\n\n</div><div class='members'></div></div>","meta":{}}); | 2,647 | 2,647 | 0.640725 |
731e32370a03928789c592bf7eb07ac59e1eb7ff | 548 | js | JavaScript | static/fonts/fontawesome/advanced-options/use-with-node-js/fontawesome-free-solid/faShareAlt.js | jsdelivrbot/arduinodayveracruz | 05c841227c2f6ed4743216cda7bdb90b7c13d843 | [
"Apache-2.0"
] | 1,592 | 2016-08-18T18:24:30.000Z | 2022-03-31T23:04:17.000Z | static/fonts/fontawesome/advanced-options/use-with-node-js/fontawesome-free-solid/faShareAlt.js | jsdelivrbot/arduinodayveracruz | 05c841227c2f6ed4743216cda7bdb90b7c13d843 | [
"Apache-2.0"
] | 1,315 | 2016-07-11T12:15:16.000Z | 2022-03-31T08:21:29.000Z | static/fonts/fontawesome/advanced-options/use-with-node-js/fontawesome-free-solid/faShareAlt.js | jsdelivrbot/arduinodayveracruz | 05c841227c2f6ed4743216cda7bdb90b7c13d843 | [
"Apache-2.0"
] | 2,017 | 2019-05-31T06:16:13.000Z | 2022-03-31T18:02:36.000Z | module.exports = { prefix: 'fas', iconName: 'share-alt', icon: [448, 512, [], "f1e0", "M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"] }; | 548 | 548 | 0.706204 |
731f324a094555c4c5559b7fdd071e949af487c8 | 1,665 | js | JavaScript | src/App.js | MinhoChoi-a/P2-Youtube_Chef | a1569c30c2c732771a089bed16e76d5bf11599d3 | [
"MIT"
] | null | null | null | src/App.js | MinhoChoi-a/P2-Youtube_Chef | a1569c30c2c732771a089bed16e76d5bf11599d3 | [
"MIT"
] | null | null | null | src/App.js | MinhoChoi-a/P2-Youtube_Chef | a1569c30c2c732771a089bed16e76d5bf11599d3 | [
"MIT"
] | null | null | null | import React from 'react';
import { Grid, Container } from '@material-ui/core';
import { VideoDetail, VideoList, Icons } from './components';
import youtube from './api/youtube';
import {apiKey} from './credential/API';
class App extends React.Component {
state = {
videos: [],
selectedVideo: null,
term: null,
size: 12,
}
onVideoSelect = (video) => {
this.setState( {selectedVideo: video, term: "video"});
window.scrollTo({
top:1,
left:0,
behavior: 'smooth'});
}
handleSubmit = async (searchTerm) => {
const response = await youtube.get('search', {
params: {
part: 'snippet',
maxResults: 10,
key: apiKey,
type: 'video',
q: searchTerm
}
});
this.setState({ videos: response.data.items, selectedVideo: response.data.items[0], term: searchTerm, size:8 });
}
render () {
const { selectedVideo, videos, term, size } = this.state;
return(
<Container style={{width: '100%', padding: 0}}>
<Grid container direction="row" justify="center" alignItems="center" spacing={1} style={{width: '100%', height: '100vh'}}>
<Grid item sm={12} xs={12}>
<Icons onFormSubmit={this.handleSubmit}/>
</Grid>
<Grid item sm={size} xs={12}>
<VideoDetail video={selectedVideo} term={term} onSubmit={this.handleSubmit}/>
</Grid>
<Grid item sm={4} xs={12}>
<VideoList videos={videos} onVideoSelect= {this.onVideoSelect}/>
</Grid>
</Grid>
</Container>
)
}
}
export default App;
| 23.125 | 130 | 0.559159 |
731f4aafb6d0aadf1003d47e5bfb842199357d2a | 1,651 | js | JavaScript | modules/personals/server/models/personal.server.model.js | bhuvansalanke/BookingApplication-master | 9dc18ec0993c30a119daea2288fd464448de9166 | [
"MIT"
] | null | null | null | modules/personals/server/models/personal.server.model.js | bhuvansalanke/BookingApplication-master | 9dc18ec0993c30a119daea2288fd464448de9166 | [
"MIT"
] | null | null | null | modules/personals/server/models/personal.server.model.js | bhuvansalanke/BookingApplication-master | 9dc18ec0993c30a119daea2288fd464448de9166 | [
"MIT"
] | null | null | null | //database
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ApptTypeSchema = require('./appt-type.server.model');
var PersonalSchema = new Schema({
created: {
type: Date,
default: Date.now
},
fName: {
type: String,
default: '',
required: 'Please fill your first name',
trim: true
},
lName: {
type: String,
default: '',
required: 'Please fill your last name',
trim: true
},
emailId: {
type: String,
default: '',
required: 'Please fill your email id',
trim: true
},
contact: {
type: String,
default: '',
required: 'Please fill your contact number',
trim: true
},
isConsultant: {
type: Boolean
},
speciality: {
type: String,
default: '',
trim: true
},
qualification: {
type: String,
default: '',
trim: true
},
experience: {
type: String,
default: '',
trim: true
},
rating: {
type: Number,
default: 0,
trim: true
},
treatments: [ApptTypeSchema],
slots: [{
day: {
type: String,
default: '',
required: 'Please fill the day',
trim: true
} ,
starttime: {
type: Date
},
endtime: {
type: Date
},
location: {
type: String
}
}],
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
mongoose.model('Personal', PersonalSchema); | 19.423529 | 57 | 0.461538 |
731f4c614d64c3d1d5b3a25ed0bafc5af16a4c95 | 8,909 | js | JavaScript | public/js/gestioDepartamento.js | maronv64/sisRecomendaciones | 75e707d447661d621f9db69a8c850c3c0d587c5d | [
"MIT"
] | null | null | null | public/js/gestioDepartamento.js | maronv64/sisRecomendaciones | 75e707d447661d621f9db69a8c850c3c0d587c5d | [
"MIT"
] | null | null | null | public/js/gestioDepartamento.js | maronv64/sisRecomendaciones | 75e707d447661d621f9db69a8c850c3c0d587c5d | [
"MIT"
] | null | null | null | window.onload=llenarDepartamento();
function ingresarDepartamento(){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var FrmData = {
descripcionDepartamento:$('#descripcionDepartamento').val(),
}
$.ajax({
url:'Departamento', // Url que se envia para la solicitud
method: 'POST', // Tipo de solicitud que se enviará, llamado como método
data: FrmData, // Datos enviados al servidor, un conjunto de pares clave / valor (es decir, campos de formulario y valores)
dataType: 'json',
success: function(requestData) // Una función a ser llamada si la solicitud tiene éxito
{
llenarDepartamento();
$('#descripcionDepartamento').val("");
},
complete: function(){
}
});
}
function llenarDepartamento(){
$.get('DepartamentoCargar', function (data) {
$('#tablaDepartamento').html(''); // limpia el tbody de la tabla
$.each(data, function(i, item) { // recorremos cada uno de los datos que retorna el objero json n valores
// agregaso uno a uno los valores del objero json como una fila
// append permite agregar codigo en una etiqueta sin remplazar el contenido anterior
$('#tablaDepartamento').append(
'<tr>'+
'<td>'+item.descripcionDepartamento+'</td>'+
'<td>'+
'<button type="button" class="btn btn-warning btn-sm " onclick="editartipoDepartamento('+item.id+')"><i class="fa fa-edit"></i></button>'+
'</td>'+
'<td>'+
' <button type="button" class="btn btn-danger btn-sm" onclick="eliminarDepartamento('+item.id+')"><i class="fa fa-trash"></button>'+
'</td>'+
'<td>'+
' <button type="button" class="btn btn-info btn-sm" onclick="mostrar_cargos_departamento('+item.id+')"><i class="fa fa-building-o"></i></button>'+
'</td>'+
'</tr>'
);
});
});
}
function eliminarDepartamento(id){
$.ajaxSetup({
headers:{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "DELETE",
url:'Departamento/' + id,
success: function (data) {
llenarDepartamento();
},
});
}
function editartipoDepartamento(id){
$.get('Departamento/'+id+'/edit', function (data) {
$('#descripcionDepartamento').val(data.descripcionDepartamento);
$('#btnD').attr('class','btn btn-warning');
$('#btnD').html("modificar");
$('#btnD').attr('onclick','ActualizarDepartamento('+id+')');
});
limpiarDepartamento();
}
function limpiarDepartamento(){
$('#descripcionDepartamento').val("");
}
function ActualizarDepartamento(id){
if ($('#descripcionDepartamento').val()=='') {return;}
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var FrmData = {
descripcionDepartamento: $('#descripcionDepartamento').val(),
}
$.ajax({
url:'Departamento/'+id, // Url que se envia para la solicitud
type: 'PUT', // Tipo de solicitud que se enviará, llamado como método
data: FrmData, // Datos enviados al servidor, un conjunto de pares clave / valor (es decir, campos de formulario y valores)
//dataType: 'json',
success: function(requestData) // Una función a ser llamada si la solicitud tiene éxito
{
llenarDepartamento();
limpiarDepartamento();
$('#btnD').attr('class','btn btn-primary ');
$('#btnD').attr('onclick','ingresarDepartamento()');
$('#btnD').html("Guardar");
}
});
}
function mostrar_cargos_departamento(id){
$('#mostralmodal').modal('show');
$('#idCD').val(id);
llenarCargoDepartamento();
mostrarCargoDepartamento(id);
}
function llenarCargoDepartamento(){
$.get('CargosCargar', function (data) {
$('#tablaasignarcargosaldepartamento').html(''); // limpia el tbody de la tabla
$.each(data, function(i, item) { // recorremos cada uno de los datos que retorna el objero json n valores
// agregaso uno a uno los valores del objero json como una fila
// append permite agregar codigo en una etiqueta sin remplazar el contenido anterior
$('#tablaasignarcargosaldepartamento').append(
'<tr>'+
'<td hidden >'+item.id+'</td>'+
'<td >'+item.descripcionCargo+'</td>'+
'<td hidden id="n'+item.id+'" ></td>'+
'<td>'+
'<input type="checkbox" class="form-check-input" id="exampleCheck2'+item.id+'" onclick="(agregarControlUsuario('+item.id+'))"/>'+
'<label class="form-check-label" for="exampleCheck2" ></label>'+
'</td>'+
'</tr>'
);
});
});
}
function agregarControlUsuario(id){
if( $('#exampleCheck2'+id).is(':checked') ) {
$('#n'+id).html(0);
}
}
function ingresarCargosDepartamento(){
//recorremos la tabla para capturar los datos
$('#tablaasignarcargosaldepartamento tr').each(function () {
control = $(this).find("td").eq(2).html();
idcargo = $(this).find("td").eq(0).html();
iddepartamento=$('#idCD').val();
if (control =='0') {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var FrmData = {
cargos_id:idcargo,
departamento_id:iddepartamento,
}
$.ajax({
url: 'CargoDepartamento', // Url que se envia para la solicitud esta en el web php es la ruta
method: "POST", // Tipo de solicitud que se enviará, llamado como método
data: FrmData, // Datos enviados al servidor, un conjunto de pares clave / valor (es decir, campos de formulario y valores)
success: function (data) // Una función a ser llamada si la solicitud tiene éxito
{
mostrarCargoDepartamento( $('#idCD').val());
//eliminarRecomendacionDepartamento();
},
complete: function(){
}
});
}
});
llenarCargoDepartamento();
}
/*MOSTRAR TODOS LOS DEPARTAMENTO A LOS USUARIOS*/
function mostrarCargoDepartamento(id){
$.get('CargosDepartamentosMostrar/'+id, function (data) {
$("#tabla_DepartamentoCargo").html("");
$.each(data, function(i, item) { //recorre el data
cargartablaCargoDepartamento(item); // carga los datos en la tabla
});
});
}
function eliminarCargoDepartamento(id){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var FrmData ;
$.ajax({
url:'CargoDepartamento/'+id, // Url que se envia para la solicitud esta en el web php es la ruta
method: "DELETE", // Tipo de solicitud que se enviará, llamado como método
data: FrmData, // Datos enviados al servidor, un conjunto de pares clave / valor (es decir, campos de formulario y valores)
success: function (data) // Una función a ser llamada si la solicitud tiene éxito
{
mostrarCargoDepartamento( $('#idCD').val()); // carga los datos en la tabla
}
});
}
/*FUNCIÓN PARA CARGAR LOS TAREA EN LA TABLA*/
function cargartablaCargoDepartamento(data){
//debugger
$("#tabla_DepartamentoCargo").append(
"<tr id='fila_cod"+"'>\
<td>"+ data.cargos_v2.descripcionCargo+"</td>\
<td>"+ data.departamento_v2.descripcionDepartamento+"</td>\
<td class='row'><button type='button' class='btn btn-danger' id='btn-confirm' onClick='eliminarCargoDepartamento("+data.id+")'><i class='fa fa-trash'></i></button></td>\
</tr>"
);
} | 36.215447 | 178 | 0.513975 |
73201036c4942ff1b510aa5d9b52ba2784ad1c16 | 748 | js | JavaScript | src/utils/lights.js | amorino/3js-webpack | 2c75fb5016cc65400f1f8720063170cf673dbdef | [
"MIT"
] | 1 | 2018-11-05T19:14:39.000Z | 2018-11-05T19:14:39.000Z | src/utils/lights.js | amorino/3js-webpack | 2c75fb5016cc65400f1f8720063170cf673dbdef | [
"MIT"
] | 1 | 2021-09-01T06:49:13.000Z | 2021-09-01T06:49:13.000Z | src/utils/lights.js | amorino/3js-webpack | 2c75fb5016cc65400f1f8720063170cf673dbdef | [
"MIT"
] | 1 | 2018-11-05T19:15:05.000Z | 2018-11-05T19:15:05.000Z | import * as THREE from 'three'
export default function lightCircle({ colors, scene, help = false, distance = 50, intensity = 1, r = 1 }) {
if (!scene) return false
return colors.map((color, i, list) => {
const t = i / list.length
const startAngle = Math.PI / 2
const angle = (Math.PI * 2 * t) + startAngle
const pointLight = new THREE.PointLight(color, intensity, distance)
pointLight.position.x = Math.cos(angle) * r
pointLight.position.y = Math.sin(angle) * r
pointLight.position.z = 10
if (help) {
const helper = new THREE.PointLightHelper(pointLight, r)
scene.add(helper)
}
scene.add(pointLight)
return pointLight
})
}
| 35.619048 | 107 | 0.596257 |
73210b73e7f3b1f0c359bc5aaf565683fc4a0650 | 3,159 | js | JavaScript | dist/collection/components/badge/badge.js | MEDGRUPOGIT/med-components | ae0e262ffbf7ccecd878c5df399382f7b9547e04 | [
"MIT"
] | null | null | null | dist/collection/components/badge/badge.js | MEDGRUPOGIT/med-components | ae0e262ffbf7ccecd878c5df399382f7b9547e04 | [
"MIT"
] | null | null | null | dist/collection/components/badge/badge.js | MEDGRUPOGIT/med-components | ae0e262ffbf7ccecd878c5df399382f7b9547e04 | [
"MIT"
] | null | null | null | import { Component, Host, Prop, h } from '@stencil/core';
import { getIonMode } from '../../global/ionic-global';
import { generateMedColor } from '../../utils/med-theme';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*/
export class Badge {
render() {
const { dsColor, dsName, dsSize } = this;
const mode = getIonMode(this);
return (h(Host, { class: generateMedColor(dsColor, {
[mode]: true,
'med-badge': true,
[`med-badge--${dsName}`]: dsName !== undefined,
[`med-badge--${dsSize}`]: dsSize !== undefined,
}) },
h("slot", null)));
}
static get is() { return "ion-badge"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"ios": ["badge.md.scss"],
"md": ["badge.md.scss"]
}; }
static get styleUrls() { return {
"ios": ["badge.md.css"],
"md": ["badge.md.css"]
}; }
static get properties() { return {
"dsColor": {
"type": "string",
"mutable": false,
"complexType": {
"original": "MedColor",
"resolved": "string | undefined",
"references": {
"MedColor": {
"location": "import",
"path": "../../interface"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Define a cor do componente."
},
"attribute": "ds-color",
"reflect": true
},
"dsName": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'secondary'",
"resolved": "\"secondary\" | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Define a varia\u00E7\u00E3o do componente."
},
"attribute": "ds-name",
"reflect": true
},
"dsSize": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'xxs' | 'xs' | 'sm' | 'md' | 'lg'",
"resolved": "\"lg\" | \"md\" | \"sm\" | \"xs\" | \"xxs\" | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Define a varia\u00E7\u00E3o de tamanho do componente."
},
"attribute": "ds-size",
"reflect": true
},
"color": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Color",
"resolved": "string | undefined",
"references": {
"Color": {
"location": "import",
"path": "../../interface"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette.\nDefault options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\nFor more information on colors, see [theming](/docs/theming/basics)."
},
"attribute": "color",
"reflect": false
}
}; }
}
| 28.718182 | 300 | 0.483697 |
732282fda607444491d71f49815f78631ec769f9 | 1,897 | js | JavaScript | src/components/framework/FEditorHeader.js | designstem/style | 60d218711ae380b4abec7d19b41b44c07ded3775 | [
"MIT"
] | 2 | 2019-05-05T11:51:44.000Z | 2020-09-09T02:03:00.000Z | src/components/framework/FEditorHeader.js | designstem/style | 60d218711ae380b4abec7d19b41b44c07ded3775 | [
"MIT"
] | 88 | 2019-06-12T14:47:46.000Z | 2022-01-27T16:04:29.000Z | src/components/framework/FEditorHeader.js | designstem/style | 60d218711ae380b4abec7d19b41b44c07ded3775 | [
"MIT"
] | 2 | 2019-07-19T07:55:55.000Z | 2019-09-06T08:13:08.000Z | import { store } from "../../../fachwerk.js";
export default {
props: {
value: { default: "", type: String },
content: { default: "", type: String },
saveId: { default: "fachwerk", type: String }
},
data: () => ({
state: "idle",
labels: {
idle: " Save locally",
reverted: " Save locally",
// em space
saving: " Saving...",
saved: "● Saved locally"
},
timeout: null
}),
computed: {
isRevertable() {
const storedContent = store.get(`${this.saveId}.editor`);
return storedContent && storedContent !== this.content;
}
},
methods: {
handleSave() {
store.set(`${this.saveId}.editor`, this.value);
this.state = "saving";
this.timeout = setTimeout(() => (this.state = "saved"), 500);
},
handleRevert() {
store.remove(`${this.saveId}.editor`);
this.$emit("input", this.content);
this.state = "reverted";
}
},
mounted() {
if (this.$global) {
this.$global.$on("save", () => this.handleSave());
this.$global.$on("revert", () => this.handleRevert());
}
},
template: `
<div style="
height: var(--base6);
padding: 0 var(--base);
background: var(--paleblue);
display: flex;
align-items: center;
justify-content: space-between;
">
<a
class="quaternary"
@click="$global.$emit('edit')"
title="Close editor"
><f-close-icon /></a>
<div>
<a
v-if="isRevertable && state !== 'reverted'"
class="quaternary"
style="opacity: 0.5"
@click="handleRevert"
title="Revert to original content"
>Revert</a>
<a
class="quaternary"
v-html="labels[state]"
@click="handleSave"
title="Save content [alt + s]"
/>
</div>
</div>
`
};
| 24.960526 | 67 | 0.509225 |
7322f2f60db2a981df7adde06749d575cea82679 | 862 | js | JavaScript | src/store/index.js | weixiaodai1/vue-pc | 84e2c187792e823154a8c0437965b55c491a6e06 | [
"MIT"
] | 1 | 2021-06-24T08:44:08.000Z | 2021-06-24T08:44:08.000Z | src/store/index.js | weixiaodai1/vue-pc | 84e2c187792e823154a8c0437965b55c491a6e06 | [
"MIT"
] | null | null | null | src/store/index.js | weixiaodai1/vue-pc | 84e2c187792e823154a8c0437965b55c491a6e06 | [
"MIT"
] | null | null | null | import Vuex from "vuex";
import Vue from "vue";
//#region 自动导入vuex modules
const files = require.context("./modules", true, /index.js$/);
const modules = {};
files.keys().forEach((key) => {
modules[key.replace(/(\.\/|\/index.js)/g, "")] =
files(key).default || files(key);
});
//#endregion
// import user from "./modules/user";
// const modules = { user };
// 判断环境 vuex提示生产环境中不使用
import createPersistedState from "vuex-persistedstate";
import createLogger from 'vuex/dist/logger'
const debug = process.env.NODE_ENV !== "production";
const createPersisted = createPersistedState({
storage: window.sessionStorage, // 这里把vuex的数据保存在sessionStorage里面,页面关闭后消失
});
Vue.use(Vuex)
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
modules,
plugins: debug ? [createLogger(), createPersisted] : [createPersisted], // vuex持久化
});
| 25.352941 | 84 | 0.687935 |
732366360ea7f9a2410caaf2ddef5338fb51143f | 1,736 | js | JavaScript | data/features.js | madzadev/cropper | 05a93e5b671ef737210aaaf2a9a432e9584565de | [
"MIT"
] | 15 | 2022-02-24T08:52:19.000Z | 2022-03-28T15:07:49.000Z | data/features.js | madzadev/cropper | 05a93e5b671ef737210aaaf2a9a432e9584565de | [
"MIT"
] | null | null | null | data/features.js | madzadev/cropper | 05a93e5b671ef737210aaaf2a9a432e9584565de | [
"MIT"
] | 2 | 2022-03-04T18:36:13.000Z | 2022-03-05T02:40:04.000Z | export const features = [
{
title: "Upload",
description: "Supported formats .PNG and .JPG",
icon: "/graphics/features",
},
{
title: "Presets",
description:
"Currently there are 33 presets from 10 commonly used platforms",
icon: "/graphics/features",
},
{
title: "Custom mode",
description:
"User is allowed to switch to custom resolutions and aspect ratios",
icon: "/graphics/features",
},
{
title: "Move tools",
description: "User can move the image around",
icon: "/graphics/features",
},
{
title: "Zoom tools",
description: "Zoom the image in or out to get the precise crops",
icon: "/graphics/features",
},
{
title: "Rotate image",
description:
"Rotate image clockwise or counter-clockwise by 45 degree increments",
icon: "/graphics/features",
},
{
title: "Transform image",
description: "Swap image on X or Y axis",
icon: "/graphics/features",
},
{
title: "Resolution data",
description: "Updated in real time as you resize the crop window",
icon: "/graphics/features",
},
{
title: "Crop score",
description: "Real-time crop score of the fit for the target use",
icon: "/graphics/features",
},
{
title: "Image Preview",
description: "The user is allowed to preview the crop",
icon: "/graphics/features",
},
{
title: "Reset",
description:
"Reset image and crop windows as they were when the image was uploaded",
icon: "/graphics/features",
},
{
title: "Download",
description: "Download the image as .PNG or .JPG",
icon: "/graphics/features",
},
];
| 25.910448 | 79 | 0.596198 |
732380677569c872b28d1ca3db1d24499ff029fa | 2,192 | js | JavaScript | lib/util.js | handshakecompany/hnskey | cccedbf826a638d85c01fbd62cc2df45d54c2001 | [
"Unlicense",
"MIT"
] | 30 | 2018-08-02T21:57:47.000Z | 2022-01-02T15:58:40.000Z | lib/util.js | handshakecompany/airdropKeys | cccedbf826a638d85c01fbd62cc2df45d54c2001 | [
"Unlicense",
"MIT"
] | 6 | 2018-08-05T11:29:48.000Z | 2022-01-22T02:55:51.000Z | lib/util.js | handshakecompany/airdropKeys | cccedbf826a638d85c01fbd62cc2df45d54c2001 | [
"Unlicense",
"MIT"
] | 7 | 2018-08-05T11:10:58.000Z | 2020-08-20T04:45:04.000Z | /*!
* util.js - utils for hsk
* Copyright (c) 2017-2018, Christopher Jeffrey (MIT License).
* https://github.com/handshakecompany/hsk
*/
'use strict';
const assert = require('assert');
/**
* @exports utils/util
*/
const util = exports;
/**
* Return hrtime (shim for browser).
* @param {Array} time
* @returns {Array} [seconds, nanoseconds]
*/
util.bench = function bench(time) {
if (!process.hrtime) {
const now = Date.now();
if (time) {
const [hi, lo] = time;
const start = hi * 1000 + lo / 1e6;
return now - start;
}
const ms = now % 1000;
// Seconds
const hi = (now - ms) / 1000;
// Nanoseconds
const lo = ms * 1e6;
return [hi, lo];
}
if (time) {
const [hi, lo] = process.hrtime(time);
return hi * 1000 + lo / 1e6;
}
return process.hrtime();
};
/**
* Get current time in unix time (seconds).
* @returns {Number}
*/
util.now = function now() {
return Math.floor(Date.now() / 1000);
};
/**
* Get current time in unix time (milliseconds).
* @returns {Number}
*/
util.ms = function ms() {
return Date.now();
};
/**
* Create a Date ISO string from time in unix time (seconds).
* @param {Number?} time - Seconds in unix time.
* @returns {String}
*/
util.date = function date(time) {
if (time == null)
time = util.now();
return new Date(time * 1000).toISOString().slice(0, -5) + 'Z';
};
/**
* Get unix seconds from a Date string.
* @param {String?} date - Date ISO String.
* @returns {Number}
*/
util.time = function time(date) {
if (date == null)
return util.now();
return new Date(date) / 1000 | 0;
};
/**
* Convert u32 to padded hex.
* @param {Number} num
* @returns {String}
*/
util.hex32 = function hex32(num) {
assert((num >>> 0) === num);
num = num.toString(16);
switch (num.length) {
case 1:
return `0000000${num}`;
case 2:
return `000000${num}`;
case 3:
return `00000${num}`;
case 4:
return `0000${num}`;
case 5:
return `000${num}`;
case 6:
return `00${num}`;
case 7:
return `0${num}`;
case 8:
return `${num}`;
default:
throw new Error();
}
};
| 17.396825 | 64 | 0.563869 |
732606b9759d6ba59318cacc378628bfef6df246 | 493 | js | JavaScript | src/demo/AppMinimumUsage.js | quickshiftin/react-html5-camera-photo | 88ec6970abf76d5234ae07942c8a59afd6f30b0a | [
"MIT"
] | 1 | 2019-11-27T22:16:39.000Z | 2019-11-27T22:16:39.000Z | src/demo/AppMinimumUsage.js | quickshiftin/react-html5-camera-photo | 88ec6970abf76d5234ae07942c8a59afd6f30b0a | [
"MIT"
] | null | null | null | src/demo/AppMinimumUsage.js | quickshiftin/react-html5-camera-photo | 88ec6970abf76d5234ae07942c8a59afd6f30b0a | [
"MIT"
] | 1 | 2021-04-29T04:47:58.000Z | 2021-04-29T04:47:58.000Z | import React, { Component } from 'react';
import Camera, { FACING_MODES } from '../lib';
import './reset.css';
class App extends Component {
onTakePhoto (dataUri) {
// Do stuff with the photo...
console.log('takePhoto');
}
render () {
return (
<div className="App">
<Camera
onTakePhoto = { (dataUri) => { this.onTakePhoto(dataUri); } }
idealFacingMode = {FACING_MODES.ENVIRONMENT}
/>
</div>
);
}
}
export default App;
| 20.541667 | 71 | 0.576065 |
73262a485bbece44ae7731fe637b778deae5a888 | 8,015 | js | JavaScript | packages/ckeditor5-utils/src/ckeditorerror.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | packages/ckeditor5-utils/src/ckeditorerror.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | packages/ckeditor5-utils/src/ckeditorerror.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | /**
* @license Copyright (c) 2003-2022, CKSource - Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module utils/ckeditorerror
*/
/* globals console */
/**
* URL to the documentation with error codes.
*/
export const DOCUMENTATION_URL =
'https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html';
/**
* The CKEditor error class.
*
* You should throw `CKEditorError` when:
*
* * An unexpected situation occurred and the editor (most probably) will not work properly. Such exception will be handled
* by the {@link module:watchdog/watchdog~Watchdog watchdog} (if it is integrated),
* * If the editor is incorrectly integrated or the editor API is used in the wrong way. This way you will give
* feedback to the developer as soon as possible. Keep in mind that for common integration issues which should not
* stop editor initialization (like missing upload adapter, wrong name of a toolbar component) we use
* {@link module:utils/ckeditorerror~logWarning `logWarning()`} and
* {@link module:utils/ckeditorerror~logError `logError()`}
* to improve developers experience and let them see the a working editor as soon as possible.
*
* /**
* * Error thrown when a plugin cannot be loaded due to JavaScript errors, lack of plugins with a given name, etc.
* *
* * @error plugin-load
* * @param pluginName The name of the plugin that could not be loaded.
* * @param moduleName The name of the module which tried to load this plugin.
* * /
* throw new CKEditorError( 'plugin-load', {
* pluginName: 'foo',
* moduleName: 'bar'
* } );
*
* @extends Error
*/
export default class CKEditorError extends Error {
/**
* Creates an instance of the CKEditorError class.
*
* @param {String} errorName The error id in an `error-name` format. A link to this error documentation page will be added
* to the thrown error's `message`.
* @param {Object|null} context A context of the error by which the {@link module:watchdog/watchdog~Watchdog watchdog}
* is able to determine which editor crashed. It should be an editor instance or a property connected to it. It can be also
* a `null` value if the editor should not be restarted in case of the error (e.g. during the editor initialization).
* The error context should be checked using the `areConnectedThroughProperties( editor, context )` utility
* to check if the object works as the context.
* @param {Object} [data] Additional data describing the error. A stringified version of this object
* will be appended to the error message, so the data are quickly visible in the console. The original
* data object will also be later available under the {@link #data} property.
*/
constructor( errorName, context, data ) {
super( getErrorMessage( errorName, data ) );
/**
* @type {String}
*/
this.name = 'CKEditorError';
/**
* A context of the error by which the Watchdog is able to determine which editor crashed.
*
* @type {Object|null}
*/
this.context = context;
/**
* The additional error data passed to the constructor. Undefined if none was passed.
*
* @type {Object|undefined}
*/
this.data = data;
}
/**
* Checks if the error is of the `CKEditorError` type.
* @returns {Boolean}
*/
is( type ) {
return type === 'CKEditorError';
}
/**
* A utility that ensures that the thrown error is a {@link module:utils/ckeditorerror~CKEditorError} one.
* It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case
* of a {@link module:utils/ckeditorerror~CKEditorError} error.
*
* @static
* @param {Error} err The error to rethrow.
* @param {Object} context An object connected through properties with the editor instance. This context will be used
* by the watchdog to verify which editor should be restarted.
*/
static rethrowUnexpectedError( err, context ) {
if ( err.is && err.is( 'CKEditorError' ) ) {
throw err;
}
/**
* An unexpected error occurred inside the CKEditor 5 codebase. This error will look like the original one
* to make the debugging easier.
*
* This error is only useful when the editor is initialized using the {@link module:watchdog/watchdog~Watchdog} feature.
* In case of such error (or any {@link module:utils/ckeditorerror~CKEditorError} error) the watchdog should restart the editor.
*
* @error unexpected-error
*/
const error = new CKEditorError( err.message, context );
// Restore the original stack trace to make the error look like the original one.
// See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.
error.stack = err.stack;
throw error;
}
}
/**
* Logs a warning to the console with a properly formatted message and adds a link to the documentation.
* Use whenever you want to log a warning to the console.
*
* /**
* * There was a problem processing the configuration of the toolbar. The item with the given
* * name does not exist, so it was omitted when rendering the toolbar.
* *
* * @error toolbarview-item-unavailable
* * @param {String} name The name of the component.
* * /
* logWarning( 'toolbarview-item-unavailable', { name } );
*
* See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to throw an error and when to log
* a warning or an error to the console.
*
* @param {String} errorName The error name to be logged.
* @param {Object} [data] Additional data to be logged.
*/
export function logWarning( errorName, data ) {
console.warn( ...formatConsoleArguments( errorName, data ) );
}
/**
* Logs an error to the console with a properly formatted message and adds a link to the documentation.
* Use whenever you want to log an error to the console.
*
* /**
* * There was a problem processing the configuration of the toolbar. The item with the given
* * name does not exist, so it was omitted when rendering the toolbar.
* *
* * @error toolbarview-item-unavailable
* * @param {String} name The name of the component.
* * /
* logError( 'toolbarview-item-unavailable', { name } );
*
* **Note**: In most cases logging a warning using {@link module:utils/ckeditorerror~logWarning} is enough.
*
* See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to use each method.
*
* @param {String} errorName The error name to be logged.
* @param {Object} [data] Additional data to be logged.
*/
export function logError( errorName, data ) {
console.error( ...formatConsoleArguments( errorName, data ) );
}
// Returns formatted link to documentation message.
//
// @private
// @param {String} errorName
// @returns {string}
function getLinkToDocumentationMessage( errorName ) {
return `\nRead more: ${ DOCUMENTATION_URL }#error-${ errorName }`;
}
// Returns formatted error message.
//
// @private
// @param {String} errorName
// @param {Object} [data]
// @returns {string}
function getErrorMessage( errorName, data ) {
const processedObjects = new WeakSet();
const circularReferencesReplacer = ( key, value ) => {
if ( typeof value === 'object' && value !== null ) {
if ( processedObjects.has( value ) ) {
return `[object ${ value.constructor.name }]`;
}
processedObjects.add( value );
}
return value;
};
const stringifiedData = data ? ` ${ JSON.stringify( data, circularReferencesReplacer ) }` : '';
const documentationLink = getLinkToDocumentationMessage( errorName );
return errorName + stringifiedData + documentationLink;
}
// Returns formatted console error arguments.
//
// @private
// @param {String} errorName
// @param {Object} [data]
// @returns {Array}
function formatConsoleArguments( errorName, data ) {
const documentationMessage = getLinkToDocumentationMessage( errorName );
return data ? [ errorName, data, documentationMessage ] : [ errorName, documentationMessage ];
}
| 36.598174 | 130 | 0.708047 |
7326ab5dd44a56ec8208443519c51349b9c2ff46 | 1,693 | js | JavaScript | tail/src/main/resources/static/templates/log/log.js | fuquanlin/fishbone | 3798e981b997606a543c0e93774a4f59eacd85c7 | [
"Apache-2.0"
] | 2 | 2016-10-03T14:34:21.000Z | 2016-10-03T14:34:22.000Z | tail/src/main/resources/static/templates/log/log.js | fuquanlin/fishbone | 3798e981b997606a543c0e93774a4f59eacd85c7 | [
"Apache-2.0"
] | null | null | null | tail/src/main/resources/static/templates/log/log.js | fuquanlin/fishbone | 3798e981b997606a543c0e93774a4f59eacd85c7 | [
"Apache-2.0"
] | null | null | null | (function () {
'use strict';
function config($stateProvider) {
$stateProvider
.state('root.log', {
url:"/log",
templateUrl: 'templates/log/log.tpl.html',
controller: 'LogCtrl'
})
}
function logCtrl($log, $scope,$uibModal,LogService) {
$log.debug("welcome log ctrl");
$scope.paramQuery = angular.copy(Settings.PAGE);
var search = function () {
LogService.queryLog($scope.paramQuery, function (response) {
$scope.logList = response.model.rows;
$scope.paramQuery.pageIndex = response.model.pageInfo.pageIndex;
$scope.paramQuery.pageCount = response.model.pageInfo.pageCount;
});
};
search();
$scope.pageChanged = function () {
search();
};
$scope.showDetail = function (opsLog) {
$uibModal.open({
size: 'lg',
templateUrl: 'opsLog_detail.tpl.html',
controller: function ($scope, LogService, $uibModalInstance) {
$scope.opsLog = opsLog;
$scope.oldValue = JSON.parse(opsLog.oldValue);
$scope.newValue = JSON.parse(opsLog.newValue);
$scope.mixValue = angular.extend({}, $scope.newValue, $scope.oldValue);
$scope.close = function () {
$uibModalInstance.close();
};
}
});
};
}
angular.module('log', ['ui.bootstrap','log.service'])
.config(config)
.controller('LogCtrl', logCtrl)
})(); | 31.351852 | 91 | 0.499114 |
732877bac2f964cb3fd6e23244d1aee8d0f350d5 | 4,011 | js | JavaScript | projects/gnomad/src/client/StructuralVariantList/StructuralVariantFilterControls.js | mamtagiri/gnomad-browser | 6e169d033d8a775a7ad26bc0443da24e40519cfe | [
"MIT"
] | null | null | null | projects/gnomad/src/client/StructuralVariantList/StructuralVariantFilterControls.js | mamtagiri/gnomad-browser | 6e169d033d8a775a7ad26bc0443da24e40519cfe | [
"MIT"
] | null | null | null | projects/gnomad/src/client/StructuralVariantList/StructuralVariantFilterControls.js | mamtagiri/gnomad-browser | 6e169d033d8a775a7ad26bc0443da24e40519cfe | [
"MIT"
] | null | null | null | import PropTypes from 'prop-types'
import React from 'react'
import styled from 'styled-components'
import { QuestionMark } from '@gnomad/help'
import { Checkbox, CategoryFilterControl, SearchInput } from '@gnomad/ui'
import {
svConsequenceCategoryColors,
svConsequenceCategoryLabels,
} from './structuralVariantConsequences'
import { svTypes, svTypeColors } from './structuralVariantTypes'
const CategoryFilterLabel = styled.span`
margin-bottom: 0.5em;
font-weight: bold;
`
const CategoryFiltersWrapper = styled.div`
display: flex;
flex-direction: column;
@media (max-width: 700px) {
align-items: center;
}
#sv-consequence-category-filter,
#sv-type-category-filter {
margin-bottom: 1em;
@media (max-width: 1200px) {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
.category {
border-radius: 0.5em;
margin: 0.25em;
}
}
@media (max-width: 700px) {
display: flex;
flex-direction: column;
align-items: center;
.category {
margin-bottom: 0.5em;
}
}
}
`
const CheckboxWrapper = styled.div`
/* stylelint-ignore-line block-no-empty */
`
const SearchWrapper = styled.div`
/* stylelint-ignore-line block-no-empty */
`
const SettingsWrapper = styled.div`
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
@media (max-width: 700px) {
flex-direction: column;
align-items: center;
}
`
const StructuralVariantFilterControls = ({ onChange, colorKey, value }) => (
<SettingsWrapper>
<CategoryFiltersWrapper>
<CategoryFilterLabel>
Consequences
<QuestionMark topic="SV_docs/sv-effect-overview" />
</CategoryFilterLabel>
<CategoryFilterControl
categories={['lof', 'dup_lof', 'copy_gain', 'other'].map(category => ({
id: category,
label: svConsequenceCategoryLabels[category],
className: 'category',
color: colorKey === 'consequence' ? svConsequenceCategoryColors[category] : 'gray',
}))}
categorySelections={value.includeConsequenceCategories}
id="sv-consequence-category-filter"
onChange={includeConsequenceCategories => {
onChange({ ...value, includeConsequenceCategories })
}}
/>
<CategoryFilterLabel>
Classes
<QuestionMark topic="SV_docs/sv-class-overview" />
</CategoryFilterLabel>
<CategoryFilterControl
categories={svTypes.map(type => ({
id: type,
label: type,
className: 'category',
color: colorKey === 'type' ? svTypeColors[type] : 'gray',
}))}
categorySelections={value.includeTypes}
id="sv-type-category-filter"
onChange={includeTypes => {
onChange({ ...value, includeTypes })
}}
/>
</CategoryFiltersWrapper>
<CheckboxWrapper>
<span>
<Checkbox
checked={value.includeFilteredVariants}
id="sv-qc-filter"
label="Include filtered variants"
onChange={includeFilteredVariants => {
onChange({ ...value, includeFilteredVariants })
}}
/>
</span>
</CheckboxWrapper>
<SearchWrapper>
<SearchInput
placeholder="Search variant table"
onChange={searchText => {
onChange({ ...value, searchText })
}}
value={value.searchText}
/>
</SearchWrapper>
</SettingsWrapper>
)
StructuralVariantFilterControls.propTypes = {
onChange: PropTypes.func.isRequired,
colorKey: PropTypes.oneOf(['consequence', 'type']).isRequired,
value: PropTypes.shape({
includeConsequenceCategories: PropTypes.objectOf(PropTypes.bool).isRequired,
includeTypes: PropTypes.objectOf(PropTypes.bool).isRequired,
includeFilteredVariants: PropTypes.bool.isRequired,
searchText: PropTypes.string.isRequired,
}).isRequired,
}
export default StructuralVariantFilterControls
| 26.74 | 93 | 0.64373 |
73288b0db0559f685f3f0a1fecfc07c877b2603f | 9,661 | js | JavaScript | Test-OpenAddress/functions.js | ipekbensu/HurricaneResilience | 076d8aa82006d9b6db314446ee816b978748dd49 | [
"MIT"
] | null | null | null | Test-OpenAddress/functions.js | ipekbensu/HurricaneResilience | 076d8aa82006d9b6db314446ee816b978748dd49 | [
"MIT"
] | null | null | null | Test-OpenAddress/functions.js | ipekbensu/HurricaneResilience | 076d8aa82006d9b6db314446ee816b978748dd49 | [
"MIT"
] | null | null | null | var functions = {};
functions.readData = function(csv){ // suitable for OpenAddress or Redfin data
// define data structure
var data = {
metadata: [],
data: []
};
// break csv into rows
var csvdata = csv.split('\n');
// loop through each row
csvdata.forEach(function(row, rowIndex){
// breaks each row into cells
if(rowIndex == 0){
row = row.replace(/\s/g, '_');
}
row = row.toUpperCase();
row = row.split(',');
// if first row, assign to metadata
if(rowIndex == 0){
data.metadata = row;
}
// else, assign to data
else{
var itemIndex = rowIndex - 1;
data.data.push({});
data.metadata.forEach(function(cell, cellIndex){
data.data[itemIndex][cell] = row[cellIndex];
});
}
});
return data;
};
functions.nestData = function(oadata){ // suitable for OpenAddress data
// list and sort unique postcodes
var postcodes = oadata.data.map(function(item){
return item.POSTCODE;
});
postcodes = [...new Set(postcodes)];
postcodes = postcodes.sort(function(a, b){
return a - b;
});
// test
// console.log(postcodes);
// console.log(postcodes.length);
// list and sort unique streets
var streets = oadata.data.map(function(item){
return item.STREET;
});
streets = [...new Set(streets)];
streets = streets.sort(function(a, b){
return a - b;
});
// test
// console.log(streets);
// console.log(streets.length);
// define data structure
var nest = [];
postcodes.forEach(function(postcode){
nest[postcode] = [];
streets.forEach(function(street){
nest[postcode][street] = [];
});
});
// nest addresses
oadata.data.forEach(function(item){
nest[item.POSTCODE][item.STREET].push(item);
});
return nest;
};
functions.rfcompare = function(oanest, rfdata){ // suitable for OpenAddress and Redfin data
// define data structure
var rfedit = {
metadata: [
'LON',
'LAT',
'NUMBER', // calculated
'STREET', // calculated
'UNIT', // undefined
'CITY', // undefined
'DISTRICT', // undefined
'REGION', // undefined
'POSTCODE',
'ID', // undefined
'HASH', // undefined
'rfMATCH', // calculated
'rfPROPERTY_TYPE',
'rfPRICE',
'rfBEDS',
'rfBATHS',
'rfSQUARE_FEET',
'rfLOT_SIZE',
'rfYEAR_BUILT',
'oaLATITUDE', // taken to compare
'oaLONGITUDE', // taken to compare
'oaERROR' // calculated
],
data: []
};
rfdata.data.forEach(function(item){
// break down address
var address = item.ADDRESS.split(' ');
var number = address[0];
var street = item.ADDRESS.replace(number, ''); // edit for accuracy
street = street.trim();
// check if match
var match = null;
var oaLAT = null;
var oaLON = null;
var oaERR = null;
if(oanest[item.ZIP_OR_POSTAL_CODE][street]){
oanest[item.ZIP_OR_POSTAL_CODE][street].forEach(function(each){
if(each.NUMBER == number){
match = 'YES';
oaLAT = each.LAT;
oaLON = each.LON;
var err1 = 100*(item.LATITUDE - oaLAT)/oaLAT;
var err2 = 100*(item.LONGITUDE - oaLON)/oaLON;
oaERR = Math.abs((err1 + err2)/2);
}
});
}
// assign info
rfedit.data.push({
LON: item.LONGITUDE,
LAT: item.LATITUDE,
NUMBER: number, // calculated
STREET: street, // calculated
UNIT: null, // undefined
CITY: null, // undefined
DISTRICT: null, // undefined
REGION: null, // undefined
POSTCODE: item.ZIP_OR_POSTAL_CODE,
ID: null, // undefined
HASH: null, // undefined
rfMATCH: match, // calculated
rfPROPERTY_TYPE: item.PROPERTY_TYPE,
rfPRICE: item.PRICE,
rfBEDS: item.BEDS,
rfBATHS: item.BATHS,
rfSQUARE_FEET: item.SQUARE_FEET,
rfLOT_SIZE: item.LOT_SIZE,
rfYEAR_BUILT: item.YEAR_BUILT,
oaLATITUDE: oaLAT, // taken to compare
oaLONGITUDE: oaLON, // taken to compare
oaERROR: oaERR // calculated
});
});
return rfedit;
};
functions.analytics = function(oadata, rfedit){ // suitable for OpenAddress and Redfin data
// count number of buildings
var num = oadata.data.length;
// count number of listings
var numListed = rfedit.data.length;
// count number and percentage of matches
var matched = rfedit.data.filter(function(item){
if(item.rfMATCH == 'YES'){
return true;
}
else{
return false;
}
});
var numMatched = matched.length;
var perMatched = 100*numMatched/numListed;
// sort errors
var error = rfedit.data.map(function(item){
return item.oaERROR;
});
error = error.sort(function(a, b){
return b - a;
});
console.log('Buildings: ', num);
console.log('Listed: ', numListed);
console.log('Matched: ', numMatched);
console.log('Matched (%): ', perMatched);
console.log('Max error (%): ', error[0]);
};
functions.rfanalytics = function(rfedit){
var types = rfedit.data.map(function(item){
var point = {
PROPERTY_TYPE: item.rfPROPERTY_TYPE,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var prices = rfedit.data.map(function(item){
var point = {
PRICE: item.rfPRICE,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var beds = rfedit.data.map(function(item){
var point = {
BEDS: item.rfBEDS,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var baths = rfedit.data.map(function(item){
var point = {
BATHS: item.rfBATHS,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var sqft = rfedit.data.map(function(item){
var point = {
SQUARE_FEET: item.rfSQUARE_FEET,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var lotsqft = rfedit.data.map(function(item){
var point = {
LOT_SIZE: item.rfLOT_SIZE,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var yearbuilt = rfedit.data.map(function(item){
var point = {
YEAR_BUILT: item.rfYEAR_BUILT,
LONGITUDE: item.LON,
LATITUTDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
console.log(types);
console.log(prices);
console.log(beds);
console.log(baths);
console.log(sqft);
console.log(lotsqft);
console.log(yearbuilt);
};
functions.distrTypes = function(oadata, rfedit){
var types = rfedit.data.map(function(item){
var point = {
PROPERTY_TYPE: item.rfPROPERTY_TYPE,
LONGITUDE: item.LON,
LATITUDE: item.LAT,
oaMATCH: item.rfMATCH
};
return point;
});
var uniqueTypes = types.map(function(item){
return item.PROPERTY_TYPE;
});
uniqueTypes = [...new Set(uniqueTypes)];
// test
console.log(uniqueTypes);
var countTypes = {};
uniqueTypes.forEach(function(type){
countTypes[type] = 0;
});
types.forEach(function(type){
countTypes[type.PROPERTY_TYPE] += 1;
});
// test
// console.log(countTypes);
var distrTypes = [];
var onePer = [];
for(var i=0; i<Math.floor(0.01*oadata.data.length); i++){ // OpenAddress data
var index = Math.floor(Math.random()*oadata.data.length);
var point = {
LAT: oadata.data[index].LAT,
LON: oadata.data[index].LON
};
onePer.push(point);
};
// test
// console.log(onePer);
onePer.forEach(function(item){
var rfdist = [];
types.forEach(function(type){
var dist1 = Number(type.LONGITUDE) - Number(item.LON);
var dist2 = Number(type.LATITUDE) - Number(item.LAT);
var dist = Math.sqrt(dist1*dist1 + dist2*dist2);
rfdist.push({
type: type,
dist: dist
});
});
rfdist = rfdist.sort(function(a, b){
return a.dist - b.dist;
});
// var rfclosest = rfdist[0];
var rftype = rfdist[0].type.PROPERTY_TYPE;
distrTypes.push({
// rfDIST: rfdist,
// rfCLOSEST: rfclosest,
rfPROPERTY_TYPE: rftype,
LON: item.LON,
LAT: item.LAT
});
});
// test
// console.log(distrTypes);
return distrTypes;
};
// test in node
// module.exports = functions; | 29.817901 | 91 | 0.524376 |
7328f0171360a2367e3d6d77689851e1a53698fd | 3,912 | js | JavaScript | tools/hermes-parser/js/hermes-parser/src/HermesASTAdapter.js | JoshMarler/hermes | 5eedd64a1b2ec5bbdec0ab6e2e19db5b6777924e | [
"MIT"
] | null | null | null | tools/hermes-parser/js/hermes-parser/src/HermesASTAdapter.js | JoshMarler/hermes | 5eedd64a1b2ec5bbdec0ab6e2e19db5b6777924e | [
"MIT"
] | null | null | null | tools/hermes-parser/js/hermes-parser/src/HermesASTAdapter.js | JoshMarler/hermes | 5eedd64a1b2ec5bbdec0ab6e2e19db5b6777924e | [
"MIT"
] | null | null | null | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
const {
HERMES_AST_VISITOR_KEYS,
NODE_CHILD,
NODE_LIST_CHILD,
} = require('./HermesParserVisitorKeys');
/**
* The base class for transforming the Hermes AST to the desired output format.
* Extended by concrete adapters which output an ESTree or Babel AST.
*/
class HermesASTAdapter {
constructor(options, code) {
this.sourceFilename = options.sourceFilename;
this.sourceType = options.sourceType;
}
/**
* Transform the input Hermes AST to the desired output format.
* This modifies the input AST in place instead of constructing a new AST.
*/
transform(program) {
// Comments are not traversed via visitor keys
const comments = program.comments;
for (let i = 0; i < comments.length; i++) {
const comment = comments[i];
this.fixSourceLocation(comment);
comments[i] = this.mapComment(comment);
}
// The first comment may be an interpreter directive and is stored directly on the program node
program.interpreter =
comments.length > 0 && comments[0].type === 'InterpreterDirective'
? comments.shift()
: null;
// Tokens are not traversed via visitor keys
const tokens = program.tokens;
if (tokens) {
for (let i = 0; i < tokens.length; i++) {
this.fixSourceLocation(tokens[i]);
}
}
return this.mapNode(program);
}
/**
* Transform a Hermes AST node to the output AST format.
*
* This may modify the input node in-place and return that same node, or a completely
* new node may be constructed and returned. Overriden in child classes.
*/
mapNode(node) {
this.fixSourceLocation(node);
return this.mapNodeDefault(node);
}
mapNodeDefault(node) {
const visitorKeys = HERMES_AST_VISITOR_KEYS[node.type];
for (const key in visitorKeys) {
const childType = visitorKeys[key];
if (childType === NODE_CHILD) {
const child = node[key];
if (child != null) {
node[key] = this.mapNode(child);
}
} else if (childType === NODE_LIST_CHILD) {
const children = node[key];
for (let i = 0; i < children.length; i++) {
const child = children[i];
if (child != null) {
children[i] = this.mapNode(child);
}
}
}
}
return node;
}
/**
* Update the source location for this node depending on the output AST format.
* This can modify the input node in-place. Overriden in child classes.
*/
fixSourceLocation(node) {
throw new Error('Implemented in subclasses');
}
getSourceType() {
return this.sourceType ?? 'script';
}
setModuleSourceType() {
if (this.sourceType == null) {
this.sourceType = 'module';
}
}
mapComment(node) {
return node;
}
mapEmpty(node) {
return null;
}
mapImportDeclaration(node) {
if (node.importKind === 'value') {
this.setModuleSourceType();
}
return this.mapNodeDefault(node);
}
mapExportDefaultDeclaration(node) {
this.setModuleSourceType();
return this.mapNodeDefault(node);
}
mapExportNamedDeclaration(node) {
if (node.exportKind === 'value') {
this.setModuleSourceType();
}
return this.mapNodeDefault(node);
}
mapExportAllDeclaration(node) {
if (node.exportKind === 'value') {
this.setModuleSourceType();
}
return this.mapNodeDefault(node);
}
mapPrivateProperty(node) {
throw new SyntaxError(
this.formatError(node, 'Private properties are not supported'),
);
}
formatError(node, message) {
return `${message} (${node.loc.start.line}:${node.loc.start.column})`;
}
}
module.exports = HermesASTAdapter;
| 24.603774 | 99 | 0.639315 |
7328f1509b499f34f5657881a6da4693d6394b42 | 20,267 | js | JavaScript | public/js/custom.js | macmilan97/CarFinder-master | 5db2b7afe0f87dd5a2be16b4cfacc4e3ca2cd131 | [
"MIT"
] | null | null | null | public/js/custom.js | macmilan97/CarFinder-master | 5db2b7afe0f87dd5a2be16b4cfacc4e3ca2cd131 | [
"MIT"
] | 1 | 2021-10-05T21:24:15.000Z | 2021-10-05T21:24:15.000Z | public/js/custom.js | macmilan97/CarFinder-master | 5db2b7afe0f87dd5a2be16b4cfacc4e3ca2cd131 | [
"MIT"
] | null | null | null | /*
Template: Car Dealer - The Best Car Dealer Automotive Responsive HTML5 Template
Author: potenzaglobalsolutions.com
Design and Developed by: potenzaglobalsolutions.com
*/
/*================================================
[ Table of contents ]
================================================
:: Predefined Variables
:: Preloader
:: Mega menu
:: Search Bar
:: Owl carousel
:: Counter
:: Slider range
:: Countdown
:: Tabs
:: Accordion
:: List group item
:: Slick slider
:: Mgnific Popup
:: PHP contact form
:: Placeholder
:: Isotope
:: Scroll to Top
:: POTENZA Window load and functions
======================================
[ End table content ]
======================================*/
//POTENZA var
var POTENZA = {};
(function ($) {
"use strict";
/*************************
Predefined Variables
*************************/
var $window = $(window),
$document = $(document),
$body = $('body'),
$countdownTimer = $('.countdown'),
$counter = $('.counter');
//Check if function exists
$.fn.exists = function () {
return this.length > 0;
};
/*************************
Preloader
*************************/
POTENZA.preloader = function () {
$("#load").fadeOut();
$('#loading').delay(0).fadeOut('slow');
};
/*************************
Mega menu
*************************/
POTENZA.megaMenu = function () {
$('#menu').megaMenu({
// DESKTOP MODE SETTINGS
logo_align: 'left', // align the logo left or right. options (left) or (right)
links_align: 'left', // align the links left or right. options (left) or (right)
socialBar_align: 'left', // align the socialBar left or right. options (left) or (right)
searchBar_align: 'right', // align the search bar left or right. options (left) or (right)
trigger: 'hover', // show drop down using click or hover. options (hover) or (click)
effect: 'fade', // drop down effects. options (fade), (scale), (expand-top), (expand-bottom), (expand-left), (expand-right)
effect_speed: 400, // drop down show speed in milliseconds
sibling: true, // hide the others showing drop downs if this option true. this option works on if the trigger option is "click". options (true) or (false)
outside_click_close: true, // hide the showing drop downs when user click outside the menu. this option works if the trigger option is "click". options (true) or (false)
top_fixed: false, // fixed the menu top of the screen. options (true) or (false)
sticky_header: true, // menu fixed on top when scroll down down. options (true) or (false)
sticky_header_height: 250, // sticky header height top of the screen. activate sticky header when meet the height. option change the height in px value.
menu_position: 'horizontal', // change the menu position. options (horizontal), (vertical-left) or (vertical-right)
full_width: false, // make menu full width. options (true) or (false)
// MOBILE MODE SETTINGS
mobile_settings: {
collapse: true, // collapse the menu on click. options (true) or (false)
sibling: true, // hide the others showing drop downs when click on current drop down. options (true) or (false)
scrollBar: true, // enable the scroll bar. options (true) or (false)
scrollBar_height: 400, // scroll bar height in px value. this option works if the scrollBar option true.
top_fixed: false, // fixed menu top of the screen. options (true) or (false)
sticky_header: false, // menu fixed on top when scroll down down. options (true) or (false)
sticky_header_height: 200 // sticky header height top of the screen. activate sticky header when meet the height. option change the height in px value.
}
});
}
/*************************
Search Bar
*************************/
POTENZA.searchbar = function () {
if ($(".search-top").exists()) {
$('.search-btn').on("click", function () {
$('.search-top').toggleClass("search-top-open");
return false;
});
$("html, body").on('click', function (e) {
if (!$(e.target).hasClass("not-click")) {
}
});
}
}
/*************************
owl carousel
*************************/
POTENZA.carousel = function () {
$(".owl-carousel").each(function () {
var $this = $(this),
$items = ($this.data('items')) ? $this.data('items') : 1,
$loop = ($this.data('loop')) ? $this.data('loop') : true,
$navdots = ($this.data('nav-dots')) ? $this.data('nav-dots') : false,
$navarrow = ($this.data('nav-arrow')) ? $this.data('nav-arrow') : false,
$autoplay = ($this.attr('data-autoplay')) ? $this.data('autoplay') : true,
$space = ($this.attr('data-space')) ? $this.data('space') : 30;
$(this).owlCarousel({
loop: $loop,
items: $items,
responsive: {
0: {items: $this.data('xx-items') ? $this.data('xx-items') : 1},
480: {items: $this.data('xs-items') ? $this.data('xs-items') : 2},
768: {items: $this.data('sm-items') ? $this.data('sm-items') : 3},
980: {items: $this.data('md-items') ? $this.data('md-items') : 4},
1200: {items: $items}
},
dots: $navdots,
margin: $space,
nav: $navarrow,
navText: ["<i class='fa fa-angle-left fa-2x'></i>", "<i class='fa fa-angle-right fa-2x'></i>"],
autoplay: $autoplay,
autoplayHoverPause: true
});
});
}
/*************************
Counter
*************************/
POTENZA.counters = function () {
if ($counter.exists()) {
$counter.each(function () {
var $elem = $(this);
$elem.appear(function () {
$elem.find('.timer').countTo();
});
});
}
};
/*************************
Slider range
*************************/
POTENZA.priceslider = function () {
if ($(".price-slide,.price-slide-2").exists()) {
$("#slider-range,#slider-range-2").slider({
range: true,
min: 0,
max: 50000000,
values: [0, 1000000],
slide: function (event, ui) {
var min = ui.values[0],
max = ui.values[1];
$('#' + this.id).prev().val(nummer_format(min) + " - " + nummer_format(max));
}
});
}
}
function nummer_format(n) {
n += "";
n = new Array(4 - n.length % 3).join("U") + n;
return n.replace(/([0-9U]{3})/g, "$1 ").replace(/U/g, "");
}
/*************************
Countdown
*************************/
POTENZA.countdownTimer = function () {
if ($countdownTimer.exists()) {
$countdownTimer.downCount({
date: '10/05/2019 12:00:00',
offset: 400
});
}
};
/*************************
Tabs
*************************/
POTENZA.tabs = function () {
var $tabsdata = $("#tabs li[data-tabs]"),
$tabscontent = $(".tabcontent"),
$tabsnav = $(".tabs li");
$tabsdata.on('click', function () {
$(this).parent().parent().find('.active').removeClass('active');
$(this).parent().parent().find('.tabcontent').hide();
var tab = $(this).data('tabs');
$(this).addClass('active');
$('#' + tab).fadeIn().show();
});
$tabsnav.on('click', function () {
var cur = $tabsnav.index(this);
var elm = $(this).parent().parent().find('.tabcontent:eq(' + cur + ')');
elm.addClass("pulse");
setTimeout(function () {
elm.removeClass("pulse");
}, 220);
});
$("li[data-tabs]").each(function () {
$(this).parent().parent().find('.tabcontent').hide().filter(':first').show();
});
}
/*************************
Accordion
*************************/
POTENZA.accordion = function () {
var $acpanel = $(".accordion > .accordion-content"),
$acsnav = $(".accordion > .accordion-title > a");
$acsnav.on('click', function () {
var status = $(this).attr('class');
if (status === 'active') {
$acpanel.not($this).slideDown("easeOutExpo");
$(this).parent().next().slideUp("easeInExpo");
$acsnav.removeClass("active");
$(this).addClass("disabled ");
} else {
var $this = $(this).parent().next(".accordion-content");
$acsnav.removeClass("active");
$acsnav.removeClass("disabled");
$(this).addClass("active ");
$acpanel.not($this).slideUp("easeInExpo");
$(this).parent().next().slideDown("easeOutExpo");
}
return false;
});
};
/*************************
List group item
*************************/
POTENZA.featurelist = function () {
var $featurenav = $(".list-group-item a");
$featurenav.on('click', function () {
if (!($(this).hasClass("current"))) {
$featurenav.removeClass("current").next("ul").slideUp();
}
$(this).toggleClass("current");
$(this).next("ul").slideToggle("slow");
return false;
});
}
/*************************
Slick slider
*************************/
POTENZA.slickslider = function () {
if ($(".slider-slick").exists()) {
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
centerMode: true,
focusOnSelect: true
});
}
}
/*************************
NiceScroll
*************************/
POTENZA.pniceScroll = function () {
if ($(".scrollbar").exists()) {
$(".scrollbar").niceScroll({
scrollspeed: 150,
mousescrollstep: 38,
cursorwidth: 5,
cursorborder: 0,
cursorcolor: '#2f3742',
autohidemode: true,
zindex: 99999,
horizrailenabled: false,
cursorborderradius: 0,
});
}
}
/*************************
Magnific Popup
*************************/
POTENZA.mediaPopups = function () {
if ($(".popup-gallery").exists()) {
$('.popup-gallery').magnificPopup({
delegate: 'a.popup-img',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
titleSrc: function (item) {
return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';
}
}
});
}
if ($(".popup-youtube, .popup-vimeo, .popup-gmaps").exists()) {
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
}
}
/*************************
PHP contact form
*************************/
// POTENZA.contactform = function () {
// $( "#contactform" ).submit(function( event ) {
// $("#ajaxloader").show();
// $("#contactform").hide();
// $.ajax({
// url:'php/contact-form.php',
// data:$(this).serialize(),
// type:'post',
// success:function(response){
// $("#ajaxloader").hide();
// $("#contactform").show();
//
// $("#formmessage").html(response).show().delay(2000).fadeOut('slow');
// }
// });
// event.preventDefault();
// });
// }
/*************************
Placeholder
*************************/
POTENZA.placeholder = function () {
var $placeholder = $('[placeholder]');
$placeholder.focus(function () {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function () {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur().parents('form').submit(function () {
$(this).find('[placeholder]').each(function () {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
})
});
}
/*************************
Isotope
*************************/
POTENZA.Isotope = function () {
var $isotope = $(".isotope"),
$itemElement = '.grid-item',
$filters = $('.isotope-filters');
if ($isotope.exists()) {
$isotope.isotope({
resizable: true,
itemSelector: $itemElement,
masonry: {
gutterWidth: 10
}
});
$filters.on('click', 'button', function () {
var $val = $(this).attr('data-filter');
$isotope.isotope({filter: $val});
$filters.find('.active').removeClass('active');
$(this).addClass('active');
});
}
}
// masonry
POTENZA.masonry = function () {
var $masonry = $('.masonry-main .masonry'),
$itemElement = '.masonry-main .masonry-item';
if ($masonry.exists()) {
$masonry.isotope({
resizable: true,
itemSelector: $itemElement,
masonry: {
gutterWidth: 10
}
});
}
}
/*************************
Scroll to Top
*************************/
POTENZA.scrolltotop = function () {
var $scrolltop = $('.car-top');
$scrolltop.on('click', function () {
$('html,body').animate({
scrollTop: 0
}, 800);
$(this).addClass("car-run");
setTimeout(function () {
$scrolltop.removeClass('car-run');
}, 1000);
return false;
});
$window.on('scroll', function () {
if ($window.scrollTop() >= 200) {
$scrolltop.addClass("show");
$scrolltop.addClass("car-down");
} else {
$scrolltop.removeClass("show");
setTimeout(function () {
$scrolltop.removeClass('car-down');
}, 300);
}
});
}
/*************************
Scroll to Top
*************************/
POTENZA.sidebarfixed = function () {
if ($(".listing-sidebar").exists()) {
(function () {
var reset_scroll;
$(function () {
return $("[data-sticky_column]").stick_in_parent({
parent: "[data-sticky_parent]"
});
});
reset_scroll = function () {
var scroller;
scroller = $("body,html");
scroller.stop(true);
if ($(window).scrollTop() !== 0) {
scroller.animate({
scrollTop: 0
}, "fast");
}
return scroller;
};
window.scroll_it = function () {
var max;
max = $(document).height() - $(window).height();
return reset_scroll().animate({
scrollTop: max
}, max * 3).delay(100).animate({
scrollTop: 0
}, max * 3);
};
window.scroll_it_wobble = function () {
var max, third;
max = $(document).height() - $(window).height();
third = Math.floor(max / 3);
return reset_scroll().animate({
scrollTop: third * 2
}, max * 3).delay(100).animate({
scrollTop: third
}, max * 3).delay(100).animate({
scrollTop: max
}, max * 3).delay(100).animate({
scrollTop: 0
}, max * 3);
};
$(window).on("resize", (function (_this) {
return function (e) {
return $(document.body).trigger("sticky_kit:recalc");
};
})(this));
}).call(this);
(function () {
var sticky;
if (window.matchMedia('(min-width: 768px)').matches) {
$(".listing-sidebar").sticky({topSpacing: 0});
}
});
}
}
/****************************************************
POTENZA Window load and functions
****************************************************/
//Window load functions
$window.on("load", function () {
POTENZA.preloader(),
POTENZA.Isotope(),
POTENZA.masonry();
});
//Document ready functions
$document.ready(function () {
POTENZA.megaMenu(),
POTENZA.searchbar(),
POTENZA.counters(),
POTENZA.carousel(),
POTENZA.priceslider(),
POTENZA.tabs(),
POTENZA.accordion(),
POTENZA.featurelist(),
POTENZA.slickslider(),
POTENZA.pniceScroll(),
POTENZA.mediaPopups(),
// POTENZA.contactform(),
POTENZA.placeholder(),
POTENZA.scrolltotop(),
POTENZA.sidebarfixed(),
POTENZA.countdownTimer();
});
})(jQuery);
// $( document ).ready(function() {
// $.ajax({
// // url: 'http://themes.potenzaglobalsolutions.com/top-bar-section.php',
// type: 'post',
// //dataType: 'json',
// data:'action=pgs_top_bar&theme=car-dealer',
// success: function(response){
// $('body').prepend(response);
// },
//
// });
// });
$(document).on('click', 'a.frame-close', function (e) {
$('.header-preview').slideUp();
});
| 35.185764 | 182 | 0.427197 |
73296e5083090f1b73ee8dfe44448da403a6e2b4 | 8,827 | js | JavaScript | src/script.js | taurodonovan/deer-rabit | c923b0266fc7e5c70dd7e5152540ba182add97f3 | [
"MIT"
] | null | null | null | src/script.js | taurodonovan/deer-rabit | c923b0266fc7e5c70dd7e5152540ba182add97f3 | [
"MIT"
] | null | null | null | src/script.js | taurodonovan/deer-rabit | c923b0266fc7e5c70dd7e5152540ba182add97f3 | [
"MIT"
] | null | null | null | var paths = [
{id: '#path5419', d: 'm 574.27172,479 0,-15.65736 -32.82996,4.54569 z'},
{id: '#path4232', d: 'm 574.27172,479 -23.23351,25.75889 -9.59645,-36.87056 z'},
{id: '#path4236', d: 'm 506.33896,522.43656 44.69925,-17.67767 -9.59645,-36.87056 z'},
{id: '#path4240', d: 'm 506.33896,522.43656 18.18275,-51.26524 16.92005,-3.28299 z'},
{id: '#path4244', d: 'm 545.22983,415.36039 -20.70812,55.81093 16.92005,-3.28299 z'},
{id: '#path4248', d: 'm 545.22983,415.36039 -20.70812,55.81093 -29.04189,-24.74873 z'},
{id: '#path4252', d: 'm 506.33896,522.43656 18.18275,-51.26524 -29.86566,-26.49728 z'},
{id: '#path4628', d: 'm 545.22983,415.36039 -61.77955,-47.7605 12.02954,78.8227 z'},
{id: '#path4632', d: 'm 506.33896,522.43656 -23.24582,-0.55095 11.56291,-77.21157 z'},
{id: '#path4634', d: 'm 545.22983,415.36039 -61.77955,-47.7605 46.6724,-16.53444 z'},
{id: '#path4636', d: 'm 463.08697,427.86039 20.36331,-60.2605 12.02954,78.8227 z'},
{id: '#path4644', d: 'm 439.55325,458.86513 43.53989,63.02048 11.56291,-77.21157 z'},
{id: '#path4646', d: 'm 439.55325,458.86513 22.11132,-30.90809 32.99148,16.717 z'},
{id: '#path4648', d: 'm 439.55325,458.86513 43.53989,63.02048 -78.07995,-18.99728 z'},
{id: '#path4656', d: 'm 395.26754,536.00799 87.8256,-14.12238 -78.07995,-18.99728 z'},
{id: '#path4658', d: 'm 395.26754,536.00799 -47.1744,-29.83667 56.92005,-3.28299 z'},
{id: '#path4660', d: 'm 395.26754,536.00799 -47.1744,-29.83667 -20.22281,21.71701 z'},
{id: '#path4662', d: 'm 439.55325,458.86513 -30.74582,10.87762 -3.79424,33.14558 z'},
{id: '#path4672', d: 'm 355.26754,495.2937 53.53989,-25.55095 -3.79424,33.14558 z'},
{id: '#path4674', d: 'm 355.26754,495.2937 53.53989,-25.55095 -60.9371,8.14558 z'},
{id: '#path4676', d: 'm 378.83897,465.2937 29.96846,4.44905 -60.9371,8.14558 z'},
{id: '#path4678', d: 'm 378.83897,465.2937 29.96846,4.44905 -35.9371,-23.99728 z'},
{id: '#path4688', d: 'm 438.83897,458.15084 -30.03154,11.59191 -35.9371,-23.99728 z'},
{id: '#path4690', d: 'm 438.83897,458.15084 22.8256,-29.83666 -88.79424,17.43129 z'},
{id: '#path4692', d: 'm 416.69611,410.2937 44.96846,18.02048 -88.79424,17.43129 z'},
{id: '#path4694', d: 'm 416.69611,410.2937 44.96846,18.02048 21.20576,-60.42585 z'},
{id: '#path4704', d: 'm 499.51554,316.07468 -16.06526,51.52521 46.6724,-16.53444 z'},
{id: '#path4706', d: 'm 499.51554,316.07468 -16.06526,51.52521 -46.89903,-36.53444 z'},
{id: '#path4708', d: 'm 417.37268,408.93182 66.0776,-41.33193 -46.89903,-36.53444 z'},
{id: '#path4729', d: 'm 499.51554,316.07468 -33.20812,-40.61765 -29.75617,55.60842 z'},
{id: '#path4731', d: 'm 400.94411,254.64611 65.36331,20.81092 -29.75617,55.60842 z'},
{id: '#path4733', d: 'm 400.94411,254.64611 -42.49383,99.38235 78.10097,-22.96301 z'},
{id: '#path4735', d: 'm 417.37268,413.21754 -58.9224,-59.18908 78.10097,-22.96301 z'},
{id: '#path4743', d: 'm 417.37268,413.21754 -58.9224,-59.18908 12.38668,89.17985 z'},
{id: '#path4747', d: 'm 308.08697,438.21754 50.36331,-84.18908 12.38668,89.17985 z'},
{id: '#path4749', d: 'm 308.08697,438.21754 50.36331,-84.18908 -48.32761,-19.39158 z'},
{id: '#path4755', d: 'm 400.94411,254.64611 -42.49383,99.38235 2.38668,-65.10587 z'},
{id: '#path4757', d: 'm 309.51554,333.93182 48.93474,20.09664 2.38668,-65.10587 z'},
{id: '#path4776', d: 'm 308.08697,438.21754 -26.06526,-84.18908 28.10096,-19.39158 z'},
{id: '#path4778', d: 'm 309.51554,333.93182 -11.06526,-83.47479 62.38668,38.46556 z'},
{id: '#path4780', d: 'm 235.22983,324.64611 46.79188,29.38235 28.10096,-19.39158 z'},
{id: '#path4799', d: 'm 235.22983,324.64611 46.79188,29.38235 -64.75618,47.75128 z'},
{id: '#path4801', d: 'm 240.94412,431.07468 41.07759,-77.04622 -64.75618,47.75128 z'},
{id: '#path4818', d: 'm 240.94412,431.07468 41.07759,-77.04622 25.24382,84.89414 z'},
{id: '#path4820', d: 'm 240.94412,431.07468 24.64902,30.81092 41.67239,-22.963 z'},
{id: '#path4822', d: 'm 256.65841,508.93182 8.93473,-47.04622 41.67239,-22.963 z'},
{id: '#path4824', d: 'm 240.94412,431.07468 24.64902,30.81092 -41.18475,24.17986 z'},
{id: '#path4858', d: 'm 242.37269,498.21754 23.22045,-36.33194 -41.18475,24.17986 z'},
{id: '#path4860', d: 'm 241.65841,498.21754 23.93473,-36.33194 -9.75618,47.037 z'},
{id: '#path4862', d: 'm 235.58698,508.57468 -10.70813,34.73949 30.95811,-34.39157 z'},
{id: '#path4864', d: 'm 249.51555,534.64611 -24.6367,8.66806 30.95811,-34.39157 z'},
{id: '#path4866', d: 'm 234.8727,508.21754 -9.99385,35.09663 -21.18475,-9.39157 z'},
{id: '#path4878', d: 'm 235.58698,508.57468 6.43473,-9.54622 13.81525,9.89414 z'},
{id: '#path4880', d: 'm 235.58698,508.57468 6.43473,-9.54622 -16.18475,-12.963 z'},
{id: '#path4961', d: 'm 235.58698,508.57468 -37.1367,-12.40336 27.38668,-10.10586 z'},
{id: '#path5128', d: 'm 235.58698,508.57468 -35.70813,4.02521 -1.18475,-15.82014 z'},
{id: '#path5130', d: 'm 188.44412,507.50325 11.43473,5.09664 -1.18475,-15.82014 z'},
{id: '#path5136', d: 'm 400.94411,254.64611 -48.9224,0.81092 8.81525,33.46556 z'},
{id: '#path5138', d: 'm 296.6584,251.07468 55.36331,4.38235 8.81525,33.46556 z'},
{id: '#path5140', d: 'm 309.51554,333.93182 -11.06526,-83.47479 -65.47046,74.17985 z'},
{id: '#path5142', d: 'm 245.94411,238.93182 52.50617,11.52521 -65.47046,74.17985 z'},
{id: '#path5144', d: 'm 235.22983,324.64611 -40.35098,0.81092 22.38668,76.32271 z'},
{id: '#path5166', d: 'm 235.22983,324.64611 -40.35098,0.81092 21.67239,-58.67729 z'},
{id: '#path5168', d: 'm 245.94411,238.93182 -31.06526,30.09664 18.10097,55.60842 z'},
{id: '#path5170', d: 'm 245.94411,238.93182 -31.06526,30.09664 -15.47046,-40.10587 z'},
{id: '#path5172', d: 'm 195.22982,329.64611 19.64903,-60.61765 -15.47046,-40.10587 z'},
{id: '#path5174', d: 'm 195.22982,329.64611 -9.63668,-57.76051 13.81525,-42.96301 z'},
{id: '#path5176', d: 'm 169.51553,212.50325 16.07761,59.38235 13.81525,-42.96301 z'},
{id: '#path5186', d: 'm 169.51553,212.50325 16.07761,59.38235 -50.47046,-45.82015 z'},
{id: '#path5188', d: 'm 169.51553,212.50325 -33.2081,-19.90336 -1.18475,33.46556 z'},
{id: '#path5190', d: 'm 169.51553,212.50325 -33.2081,-19.90336 30.24382,-10.82015 z'},
{id: '#path5200', d: 'm 169.51553,212.50325 28.93476,13.66807 -31.89904,-44.39158 z'},
{id: '#path5202', d: 'm 213.08696,196.78896 -14.63667,29.38236 -31.89904,-44.39158 z'},
{id: '#path5204', d: 'm 213.08696,196.78896 -7.49381,-37.7605 -39.0419,22.75128 z'},
{id: '#path5206', d: 'm 213.08696,196.78896 -7.49381,-37.7605 31.67239,45.60842 z'},
{id: '#path5208', d: 'm 213.08696,196.78896 -14.63667,29.38236 38.81525,-19.39158 z'},
{id: '#path5258', d: 'm 213.08696,196.78896 -7.49381,-37.7605 31.67239,45.60842 z'},
{id: '#path5260', d: 'm 255.9441,158.93182 -50.35095,0.0966 31.67239,45.60842 z'},
{id: '#path5262', d: 'm 245.22982,238.21753 -46.77953,-12.04621 38.81525,-19.39158 z'},
{id: '#path5270', d: 'm 245.22982,238.21753 47.50618,-40.2605 -55.47046,8.82271 z'},
{id: '#path5272', d: 'm 245.22982,238.21753 47.50618,-40.2605 4.1724,52.75128 z'},
{id: '#path5286', d: 'm 255.94411,160.00324 36.79189,37.95379 -55.47046,8.82271 z'},
{id: '#path5288', d: 'm 270.94411,147.86038 21.79189,50.09665 28.81525,-22.24872 z'},
{id: '#path5296', d: 'm 310.58697,148.21752 36.79189,-0.61763 -25.82761,28.10842 z'},
{id: '#path5298', d: 'm 310.58697,148.21752 -40.70811,0.4538 51.67239,27.03699 z'},
{id: '#path5306', d: 'm 310.58697,148.21752 36.79189,-0.61763 -24.75618,-22.96301 z'},
{id: '#path5310', d: 'm 349.1584,132.86038 -1.77954,14.73951 -24.75618,-22.96301 z'},
{id: '#path5316', d: 'm 349.1584,132.86038 -4.63668,-14.18906 -21.89904,5.96556 z'},
{id: '#path5324', d: 'm 270.94411,147.86038 21.79189,50.09665 28.81525,-22.24872 z'},
{id: '#path5341', d: 'm 255.58697,160.00323 14.29189,-11.33191 23.10096,49.89413 z'},
{id: '#path5343', d: 'm 310.58697,148.21752 -40.70811,0.4538 52.38668,-23.6773 z'},
{id: '#path5345', d: 'm 293.08697,96.431806 -23.20811,52.239514 52.38668,-23.6773 z'},
{id: '#path5357', d: 'm 293.08697,96.431806 41.0776,9.739514 -11.89903,18.8227 z'},
{id: '#path5359', d: 'm 293.08697,96.431806 41.0776,9.739514 -12.97046,-43.6773 z'},
{id: '#path5361', d: 'm 345.58697,65.003235 -11.4224,41.168085 -12.97046,-43.6773 z'},
];
var timeline = anime.timeline({ autoplay: true, direction: 'alternate', loop: true });
paths.forEach(function(path, index) {
timeline
.add({
targets: path.id,
d: {
value: path.d,
duration: 1000,
easing: 'easeInOutQuad'
},
offset: 1000 + 10 * index
});
});
timeline
.add({
targets: 'path:first-child',
opacity: {
value: 1,
duration: 1000,
easing: 'easeInOutQuad'
},
offset: 2000 + 10 * paths.length
}); | 71.764228 | 89 | 0.630905 |
73297efdb70b54d29f18a5dc39d0fc46ef88c2f7 | 4,184 | js | JavaScript | public/js/Admin/Main.js | Red-Beard7/suf | d5bbfa19054f73291505ac6f1c0e9f606cb1c980 | [
"MIT"
] | null | null | null | public/js/Admin/Main.js | Red-Beard7/suf | d5bbfa19054f73291505ac6f1c0e9f606cb1c980 | [
"MIT"
] | null | null | null | public/js/Admin/Main.js | Red-Beard7/suf | d5bbfa19054f73291505ac6f1c0e9f606cb1c980 | [
"MIT"
] | null | null | null | const $duration = $("#global_alert").data('duration');
window.setTimeout(function() {
$("#global_alert").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, ($duration * 1000));
$(() => {
/**
* ********************************************************* NAVIGATIONS
*/
//== Nav Elements
const $headerContainer = $('.header_container');
const $sideBar = $('#sidebar');
const $navStateToggle = $('#nav_state_toggle');
const $navLogoName = $('.nav_logo_name');
const $navName = $('.nav_name');
const $navSubtitle = $('.nav_subtitle');
const $navDropdownIcon = $('.nav_dropdown_icon');
let lsKey = 'fixedNav';
let lsVal = '';
/*_____________________ NAV STATE _____________________*/
const $hiddenElements = [$sideBar, $navLogoName, $navName, $navSubtitle, $navDropdownIcon, $headerContainer, $('section')];
const fixedNavState = (state) => {
if(state === 'toggle') {
$($hiddenElements).each(function() {
$(this).toggleClass('fixed');
});
} else if(state === 'remove') {
$($hiddenElements).each(function() {
$(this).removeClass('fixed');
});
} else if(state === 'add') {
$($hiddenElements).each(function() {
$(this).addClass('fixed');
});
}
}
if(localStorage.getItem(lsKey) === 'true') {
fixedNavState('toggle');
$navStateToggle.prop('checked', true);
}
if($(window).width() < 768) {
fixedNavState('remove');
}
$(window).on('resize', () => {
if($(this).width() < 768) {
fixedNavState('remove');
}
})
$navStateToggle.on('change', function() {
if($(this).prop('checked')) {
fixedNavState('toggle');
if($sideBar.hasClass('fixed')) {
lsVal = 'true';
}
localStorage.setItem(lsKey, lsVal);
} else {
fixedNavState('toggle');
localStorage.setItem(lsKey, 'false');
}
});
/*_____________________ SHOW NAVBAR _____________________*/
const showMenu = (headerToggle, navbarId) => {
const toggleBtn = document.getElementById(headerToggle),
nav = document.getElementById(navbarId)
// Validate that variables exist
if(headerToggle && navbarId && $(window).width() < 768){
toggleBtn.addEventListener('click', ()=>{
// We add the show-menu class to the div tag with the nav__menu class
nav.classList.toggle('show_menu')
//Change Icon
toggleBtn.classList.toggle('bx-x');
});
}
}
if($('#header_toggle').length && $sideBar.length) {
showMenu('header_toggle','sidebar');
}
/*_____________________ DROPDOWN _____________________*/
const navDropdown = document.querySelectorAll('.nav_dropdown');
function collapseDropdown() {
navDropdown.forEach(l => l.classList.remove('active'))
this.classList.add('active');
}
navDropdown.forEach(l => l.addEventListener('click', collapseDropdown));
$sideBar.on('mouseleave', () => {
collapseDropdown();
})
/*_____________________ ACTIVE LINK _____________________*/
const linkColor = document.querySelectorAll('.nav_link')
function colorLink() {
linkColor.forEach(l => l.classList.remove('active'))
this.classList.add('active')
}
linkColor.forEach(l => l.addEventListener('click', colorLink));
/**
* ********************************************************* ANIME INPUT
*/
let $animeInput = $('.anime_input');
if($animeInput.val()) {
$animeInput.addClass('dirty_input');
} else {
$animeInput.removeClass('dirty_input');
}
$animeInput.each(function() {
$(this).on('blur', function() {
if($(this).val()) {
$(this).addClass('dirty_input');
} else {
$(this).removeClass('dirty_input');
}
});
});
});
| 28.657534 | 127 | 0.52892 |
732a37274fa61f7afc6d10cf1c0a476ce7ca36ab | 2,503 | js | JavaScript | public/resources/js/dashboard/kickedController.js | mahdanahmad/translator-gator | 9634c89cf7138ffeba7ad826aa86c1fd7ad246e3 | [
"CC0-1.0"
] | null | null | null | public/resources/js/dashboard/kickedController.js | mahdanahmad/translator-gator | 9634c89cf7138ffeba7ad826aa86c1fd7ad246e3 | [
"CC0-1.0"
] | null | null | null | public/resources/js/dashboard/kickedController.js | mahdanahmad/translator-gator | 9634c89cf7138ffeba7ad826aa86c1fd7ad246e3 | [
"CC0-1.0"
] | null | null | null | app.controller('KickedController', ['$scope', '$state', 'localStorageService', '$sce', '$timeout', 'config', 'fetcher', 'messageHelper', 'Notification', function ($scope, $state, localStorageService, $sce, $timeout, config, fetcher, messageHelper, Notification) {
'use strict';
$scope.hour = 0;
$scope.minute = 0;
$scope.second = 0;
$scope.$parent.hideHeader = false;
$scope.$parent.hideNavbar = true;
var countdown;
var onTimeout = function(){
$scope.second--;
if ($scope.second == -1) {
$scope.second = 59;
$scope.minute--;
if ($scope.minute == -2) {
$scope.minute = 58;
$scope.hour--;
}
}
if ($scope.second == 0 && $scope.minute == 0 && $scope.hour == 0) {
stop();
fetcher.getRandomState(function(newPage) {
$scope.$parent.refresh();
$scope.$parent.activePage = newPage;
});
} else {
countdown = $timeout(onTimeout,1000);
}
}
$scope.reconfigure = function (number) {
if (number < 10) {
return "0" + number;
} else {
return "" + number;
}
}
var stop = function(){
$timeout.cancel(countdown);
}
var init = function() {
fetcher.getUser(localStorageService.get('_id'), function(response) {
if ((response.status_code) == "200" && (response.response == "OK")) {
$scope.$parent.backToGame();
} else {
if ((response.status_code == '400') && (response.message == "User doesn't exist")) {
localStorageService.remove('role');
localStorageService.remove('_id');
localStorageService.remove('username');
$state.go('auth.login');
} else {
countdown = $timeout(onTimeout,1000);
$scope.hour = Math.floor(response.result.countdown / 3600);
$scope.minute = Math.floor((response.result.countdown / 60) % 60);
$scope.second = response.result.countdown % 60;
$scope.message = $sce.trustAsHtml(config.kicked_msg.replace('((time))', (response.result.time / 60)));
$scope.$parent.points = response.result.points;
}
}
});
}
init();
}]);
| 32.506494 | 263 | 0.493408 |
732a59e199d50b841aeb0f471187da1254d61b93 | 3,510 | js | JavaScript | app/shared/components/Tools/Keys/Validator.js | apporc/anchor | b415df5637f4a5694f1e57f3d608d67a7dd4fbd7 | [
"MIT"
] | null | null | null | app/shared/components/Tools/Keys/Validator.js | apporc/anchor | b415df5637f4a5694f1e57f3d608d67a7dd4fbd7 | [
"MIT"
] | 1 | 2022-03-25T19:22:22.000Z | 2022-03-25T19:22:22.000Z | app/shared/components/Tools/Keys/Validator.js | apporc/anchor | b415df5637f4a5694f1e57f3d608d67a7dd4fbd7 | [
"MIT"
] | null | null | null | // @flow
import React, { Component } from 'react';
import { withTranslation } from 'react-i18next';
import { Header, Label, List, Message, Segment } from 'semantic-ui-react';
import { PrivateKey } from '@greymass/eosio';
import GlobalFormFieldKeyPrivate from '../../Global/Form/Field/Key/Private';
class ToolsKeysValidator extends Component<Props> {
state = {
checksum: false,
valid: false,
publicKey: ''
};
onChange = (e, { publicKey, valid, value }) => {
try {
PrivateKey.from(value);
this.setState({
checksum: true,
publicKey,
valid
});
} catch (err) {
console.log(err);
this.setState({
checksum: false,
publicKey,
valid
});
}
}
render() {
const { connection, t } = this.props;
const { checksum, publicKey, valid } = this.state;
return (
<Segment color="violet" piled style={{ margin: 0 }}>
<Header
content={t('tools_keys_key_validator_header')}
subheader={t('tools_keys_key_validator_subheader')}
/>
<Segment basic>
<Message
content={t('tools_keys_key_validator_info_content')}
header={t('tools_keys_key_validator_info_header')}
icon="info circle"
info
/>
<GlobalFormFieldKeyPrivate
connection={connection}
label={t('tools_keys_key_validator_private_key')}
name="key"
onChange={this.onChange}
placeholder={t('welcome:welcome_key_compare_placeholder')}
/>
</Segment>
<Segment basic>
<Header
content={t('tools_keys_key_validator_current_header')}
subheader={t('tools_keys_key_validator_current_subheader')}
/>
<List>
{(valid)
? (
<React.Fragment>
<List.Item>
<List.Icon name="checkmark" />
<List.Content>
{(checksum)
? (
<Label
color="green"
content={t('tools_keys_key_validator_key_valid')}
horizontal
/>
)
: (
<Label
color="yellow"
content="Key valid, checksum invalid"
horizontal
/>
)
}
</List.Content>
</List.Item>
<List.Item>
<List.Icon name="key" />
<List.Content>
{t('tools_keys_key_validator_public_key')}: {publicKey}
</List.Content>
</List.Item>
</React.Fragment>
)
: (
<List.Item>
<List.Icon name="x" />
<List.Content>
<Label
color="red"
content={t('tools_keys_key_validator_key_invalid')}
horizontal
/>
</List.Content>
</List.Item>
)
}
</List>
</Segment>
</Segment>
);
}
}
export default withTranslation('tools')(ToolsKeysValidator);
| 30.258621 | 77 | 0.446154 |
732a69a0d30eeedc7991107ef6fe616a2e4e7a81 | 13,251 | js | JavaScript | src/autocomplete-module.js | FluidChains/quill-placeholder-autocomplete | 5b3149bf8b3c7f02e77916209ce05e3950a63ab8 | [
"Apache-2.0"
] | 5 | 2018-01-09T16:32:50.000Z | 2021-12-07T23:01:17.000Z | src/autocomplete-module.js | FluidChains/quill-placeholder-autocomplete | 5b3149bf8b3c7f02e77916209ce05e3950a63ab8 | [
"Apache-2.0"
] | 5 | 2018-08-14T20:25:14.000Z | 2022-01-08T20:22:03.000Z | src/autocomplete-module.js | FluidChains/quill-placeholder-autocomplete | 5b3149bf8b3c7f02e77916209ce05e3950a63ab8 | [
"Apache-2.0"
] | 6 | 2018-09-18T15:29:07.000Z | 2021-07-26T16:07:42.000Z | import FuzzySet from 'fuzzyset.js';
import debounce from 'lodash.debounce';
import { h } from './utils';
import getSuggestBlot from './suggestBlot';
export default (Quill) => {
const Delta = Quill.import('delta');
Quill.register('formats/suggest', getSuggestBlot(Quill));
/**
* Quill Autocomplete for placeholder module
* @export
* @class AutoComplete
*/
class AutoComplete {
/**
* Creates an instance of AutoComplete.
* @param {any} quill the Quill instance
* @param {Object} options module options
* @memberof AutoComplete
*/
constructor(quill, {
onOpen,
onClose,
getPlaceholders,
fetchPlaceholders,
onFetchStarted,
onFetchFinished,
container,
debounceTime = 0,
triggerKey = '#',
endKey
}) {
const bindedUpdateFn = this.update.bind(this);
this.quill = quill;
this.onClose = onClose;
this.onOpen = onOpen;
this.onFetchStarted = onFetchStarted;
this.onFetchFinished = onFetchFinished;
this.getPlaceholders = getPlaceholders;
this.fetchPlaceholders = fetchPlaceholders;
this.triggerKey = triggerKey;
this.endKey = endKey;
if (typeof container === 'string') {
this.container = this.quill.container.parentNode.querySelector(container);
} else if (container === undefined) {
this.container = h('ul', {});
this.quill.container.parentNode.appendChild(this.container);
} else {
this.container = container;
}
this.container.classList.add('ql-autocomplete-menu', 'completions');
this.container.style.position = 'absolute';
this.container.style.display = 'none';
// prepare handlers and bind/unbind them when appropriate
this.onSelectionChange = this.maybeUnfocus.bind(this);
this.onTextChange = debounceTime
? debounce(bindedUpdateFn, debounceTime) : bindedUpdateFn;
this.open = false;
this.quill.suggestsDialogOpen = false;
this.hashIndex = null;
this.focusedButton = null;
this.buttons = [];
this.matchedPlaceholders = [];
this.toolbarHeight = 0;
this.suggestAcceptDownHandler = function(event) {
if (event.key === 'Enter' || this.endKey && event.key === this.endKey) {
const sel = this.quill.getSelection().index;
this.originalQuery = this.quill.getText(this.hashIndex + 1, sel - this.hashIndex - 1);
this.query = this.originalQuery.toLowerCase();
this.handleSuggestAccept();
event.preventDefault();
}
}.bind(this);
quill.suggestHandler = this.onHashKey.bind(this);
this.initBindings();
}
/**
* initialiase main quill editor bindings
*
* @memberof AutoComplete
*/
initBindings() {
const { quill } = this;
// TODO: Once Quill supports using event.key (issue #1091) use that instead of alt-3
// quill.keyboard.addBinding({
// key: 51, // '3' keyCode
// altKey: true,
// ctrlKey: null // both
// }, this.onHashKey.bind(this));
quill.root.addEventListener('keydown', (event) => {
if (event.defaultPrevented)
return; // Do nothing if the event was already processed
if (event.key === this.triggerKey) {
if (!this.toolbarHeight)
this.toolbarHeight = quill.getModule('toolbar').container.offsetHeight;
this.onHashKey(quill.getSelection());
} else
return; // Quit when this doesn't handle the key event.
// Cancel the default action to avoid it being handled twice
event.preventDefault();
}, true);
quill.keyboard.addBinding({
key: 40, // ArrowDown
collapsed: true,
format: [ 'suggest' ]
}, this.handleArrow.bind(this));
quill.keyboard.addBinding({
key: 27, // Escape
collapsed: null,
format: [ 'suggest' ]
}, this.handleEscape.bind(this));
}
/**
* Called when user entered `#`
* prepare editor and open completions list
* @param {Quill.RangeStatic} range concerned region
* @returns {Boolean} can stop event propagation
* @memberof AutoComplete
*/
onHashKey(range) {
// prevent from opening twice
// NOTE: returning true stops event propagation in Quill
if (this.open)
return true;
const { index, length } = range;
if (range.length > 0) {
this.quill.deleteText(index, length, Quill.sources.USER);
}
// insert a temporary SuggestBlot
this.quill.insertText(index, this.triggerKey, 'suggest', '@@placeholder', Quill.sources.API);
const hashSignBounds = this.quill.getBounds(index);
const rest = this.toolbarHeight + 2;
this.quill.setSelection(index + 1, Quill.sources.SILENT);
this.hashIndex = index;
this.container.style.left = hashSignBounds.left + 'px';
this.container.style.top = hashSignBounds.top + hashSignBounds.height + rest + 'px';
this.open = true;
this.quill.suggestsDialogOpen = true;
// binding completions event handler to handle user query
this.quill.on('text-change', this.onTextChange);
// binding event handler to handle user want to quit autocompletions
this.quill.once('selection-change', this.onSelectionChange);
// binding handler to react when user pressed Enter
// when autocomplete UI is in default state
this.quill.root.addEventListener('keydown', this.suggestAcceptDownHandler);
this.update();
this.onOpen && this.onOpen();
}
/**
* Called on first user interaction
* with completions list on open
* @returns {Boolean} eventually stop propagation
* @memberof AutoComplete
*/
handleArrow() {
if (!this.open)
return true;
this.buttons[0].focus();
}
/**
* Called when user accepts suggestion with the
* `Enter` key or `endKey` if provided.
* @returns {Boolean} eventually stop propagation
* @memberof AutoComplete
*/
handleSuggestAccept() {
if (!this.open)
return true;
this.close(this.matchedPlaceholders[0]);
}
/**
* Called when user cancels autocomplete with
* the `Escape` key.
* @returns {Boolean} eventually stop propagation
* @memberof AutoComplete
*/
handleEscape() {
if (!this.open)
return true;
this.close();
}
emptyCompletionsContainer() {
// empty container completely
while (this.container.firstChild)
this.container.removeChild(this.container.firstChild);
}
/**
* Completions updater
* analyze user query && update list and DOM
* @memberof AutoComplete
*/
update() {
// mostly to prevent list being updated if user hits 'Enter'
if (!this.open)
return;
const sel = this.quill.getSelection().index;
const placeholders = this.getPlaceholders();
const labels = placeholders.map(({ label }) => label);
const fs = FuzzySet(labels, false);
// user deleted the '#' character
if (this.hashIndex >= sel) {
this.close(null);
return;
}
this.originalQuery = this.quill.getText(this.hashIndex + 1, sel - this.hashIndex - 1);
this.query = this.originalQuery.toLowerCase();
// handle promise fetching custom placeholders
if (this.fetchPlaceholders && !!this.query.length) {
this.handleAsyncFetching(placeholders, labels, fs)
.then(this.handleUpdateEnd.bind(this));
return;
}
this.handleUpdateEnd({ placeholders, labels, fs });
}
/**
* End of loop for update method:
* use data results to prepare and trigger render of completions list
*
* @param {Object} parsingData { placeholders, labels, fs }
* @memberof AutoComplete
*/
handleUpdateEnd({ placeholders, labels, fs }) {
let labelResults = fs.get(this.query);
// FuzzySet can return a scores array or `null`
labelResults = labelResults
? labelResults.map(([ , label ]) => label)
: labels;
this.matchedPlaceholders = placeholders
.filter(({ label }) => labelResults.indexOf(label) !== -1);
this.renderCompletions(this.matchedPlaceholders);
}
/**
* Async handler:
* try to fetch custom placeholders asynchronously.
* in case of match, add results to internal data
*
* @param {Array} placeholders static placeholders from getter call
* @param {Array} labels labels extracted from labels for caching purpose
* @param {FuzzySet} fs fuzzy set matcher
* @returns {Object} same references passing to callback
* @memberof AutoComplete
*/
handleAsyncFetching(placeholders, labels, fs) {
this.onFetchStarted && this.onFetchStarted(this.query);
return this.fetchPlaceholders(this.query)
.then((results) => {
this.onFetchFinished && this.onFetchFinished(results);
if(results && results.length)
results.forEach((ph) => {
const notExisting = labels.indexOf(ph.label) === -1;
if (notExisting) {
fs.add(ph.label);
placeholders.push(ph);
labels.push(ph.label);
}
});
return { placeholders, labels, fs };
});
}
/**
* Called when user go somewhere else
* than completion list => user changed focus
* @memberof AutoComplete
*/
maybeUnfocus() {
if (this.container.querySelector('*:focus'))
return;
this.close(null);
}
/**
* Render completions List
* @param {Array} placeholders list of placeholders to propose
* @memberof AutoComplete
*/
renderCompletions(placeholders) {
this.emptyCompletionsContainer();
const buttons = Array(placeholders.length);
this.buttons = buttons;
/* eslint complexity: ["error", 13] */
const handler = (i, placeholder) => (event) => {
if (event.key === 'ArrowDown' || event.keyCode === 40) {
event.preventDefault();
buttons[Math.min(buttons.length - 1, i + 1)].focus();
} else if (event.key === 'ArrowUp' || event.keyCode === 38) {
event.preventDefault();
buttons[Math.max(0, i - 1)].focus();
} else if (event.key === 'Enter' || event.keyCode === 13
|| event.key === ' ' || event.keyCode === 32
|| event.key === 'Tab' || event.keyCode === 9) {
event.preventDefault();
this.close(placeholder);
} else if (event.key === 'Escape' || event.keyCode === 27) {
event.preventDefault();
this.close();
}
};
const regex = new RegExp('^(.*)('+this.query+')(.*)$');
// prepare buttons corresponding to each placeholder
placeholders.forEach((placeholder, i) => {
const { label } = placeholder;
const match = label.match(regex) || [ null, label ];
const elements = match.slice(1)
.map((str, i) => {
if (!str.length)
return null;
return h(
'span',
{ className: i === 1 ? 'matched' : 'unmatched' },
str
);
}).filter(elem => elem);
const li = h('li', {},
h('button', { type: 'button' }, ...elements)
);
this.container.appendChild(li);
buttons[i] = li.firstChild;
// event handlers will be garbage-collected with button on each re-render
buttons[i].addEventListener('keydown', handler(i, placeholder));
buttons[i].addEventListener('mousedown', () => this.close(placeholder));
buttons[i].addEventListener('focus', () => this.focusedButton = i);
buttons[i].addEventListener('unfocus', () => this.focusedButton = null);
});
this.container.style.display = 'block';
}
/**
* Adds appropriate placeholder if asked and close the list gracefully
* @param {any} placeholder user chosen placeholder or null
* @memberof AutoComplete
*/
close(placeholder) {
this.container.style.display = 'none';
this.emptyCompletionsContainer();
// detaching event handlers (user query finished)
this.quill.off('selection-change', this.onSelectionChange);
this.quill.off('text-change', this.onTextChange);
this.quill.root.removeEventListener('keydown', this.suggestKeydownHandler);
const delta = new Delta()
.retain(this.hashIndex)
.delete(this.query.length + 1);
// removing user query from before
this.quill.updateContents(delta, Quill.sources.USER);
if (placeholder) {
this.quill.insertEmbed(this.hashIndex, 'placeholder', placeholder, Quill.sources.USER);
this.quill.setSelection(this.hashIndex + 1, 0, Quill.sources.SILENT);
}
this.quill.focus();
this.open = false;
this.quill.suggestsDialogOpen = false;
this.onClose && this.onClose(placeholder || null);
}
}
return AutoComplete;
};
| 33.803571 | 99 | 0.603653 |
732aeba14ee13b5110511c31de4d23e5b7955343 | 9,234 | js | JavaScript | main.js | cryptocracy/electron-node-red-blockstack | 7fdbdd53e3662c56c2eb74074a75e832be670ca6 | [
"CC0-1.0"
] | 5 | 2017-10-02T21:40:37.000Z | 2018-11-07T03:34:13.000Z | main.js | cryptocracy/electron-node-red-blockstack | 7fdbdd53e3662c56c2eb74074a75e832be670ca6 | [
"CC0-1.0"
] | 1 | 2018-05-30T22:41:54.000Z | 2018-06-12T01:01:41.000Z | main.js | cryptocracy/electron-node-red-blockstack | 7fdbdd53e3662c56c2eb74074a75e832be670ca6 | [
"CC0-1.0"
] | 3 | 2018-05-20T14:14:40.000Z | 2019-07-04T07:22:49.000Z |
'use strict';
// Some settings you can edit easily
// Flows file name
const flowfile = 'flows.json';
// Start on the dashboard page
const url = "/ui";
// url for the editor page
const urledit = "/admin";
// tcp port to use
//const listenPort = "18880"; // fix it just because
const listenPort = parseInt(Math.random()*16383+49152) // or random ephemeral port
const os = require('os');
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const {Menu, MenuItem} = electron;
const cors = require("cors");
const cp = require('child_process');
const queryString = require('query-string');
const blockstack = require('blockstack');
// this should be placed at top of main.js to handle squirrel setup events quickly
if (handleSquirrelEvent()) { return; }
var http = require('http');
var express = require("express");
var RED = require("node-red");
// Create an Express app
var red_app = express();
// Add a simple route for static content served from 'public'
//red_app.use("/",express.static("public"));
// Create a server
var server = http.createServer(red_app);
// Start process to serve manifest file
const auth_server = cp.fork(__dirname + '/server.js');
var username;
// Quit server process if main app will quit
app.on('will-quit', () => {
auth_server.send('quit');
});
app.setAsDefaultProtocolClient('nodered');
var userdir;
if (process.argv[1] && (process.argv[1] === "main.js")) {
userdir = __dirname;
}
else { // We set the user directory to be in the users home directory...
const fs = require('fs');
userdir = os.homedir() + '/.node-red';
if (!fs.existsSync(userdir)) {
fs.mkdirSync(userdir);
}
if (!fs.existsSync(userdir+"/"+flowfile)) {
fs.writeFileSync(userdir+"/"+flowfile, fs.readFileSync(__dirname+"/"+flowfile));
}
}
console.log("Setting UserDir to ",userdir);
// Create the settings object - see default settings.js file for other options
var settings = {
verbose: true,
httpAdminRoot:"/admin",
httpNodeRoot: "/",
userDir: userdir,
flowFile: flowfile,
functionGlobalContext: { } // enables global context
};
// Initialise the runtime with a server and settings
RED.init(server,settings);
// Serve the editor UI from /red
red_app.use(settings.httpAdminRoot,RED.httpAdmin);
// Serve the http nodes UI from /api
red_app.use(settings.httpNodeRoot,RED.httpNode);
// Create the Application's main menu
var template = [{
label: "Application",
submenu: [
{ role: 'about' },
{ type: "separator" },
{ role: 'quit' }
]}, {
label: 'Node-RED',
submenu: [
{ label: 'Dashboard',
accelerator: "Shift+CmdOrCtrl+D",
click() { mainWindow.loadURL("http://localhost:"+listenPort+url); }
},
{ label: 'Editor',
accelerator: "Shift+CmdOrCtrl+E",
click() { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
},
{ type: 'separator' },
{ label: 'Documentation',
click() { require('electron').shell.openExternal('http://nodered.org/docs') }
},
{ label: 'Flows and Nodes',
click() { require('electron').shell.openExternal('http://flows.nodered.org') }
},
{ label: 'Google group',
click() { require('electron').shell.openExternal('https://groups.google.com/forum/#!forum/node-red') }
}
]}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]}, {
label: 'View',
submenu: [
{ label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click(item, focusedWindow) { if (focusedWindow) focusedWindow.reload(); }
},
{ label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click(item, focusedWindow) { if (focusedWindow) focusedWindow.webContents.toggleDevTools(); }
},
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' },
{ role: 'minimize' }
]}
];
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
let authWindow;
function createWindow() {
authWindow = new BrowserWindow({
width: 320,
height: 280,
frame: false,
});
// and load the index.html of the app.
authWindow.loadURL(`file://${__dirname}/index.html`);
}
// Called when Electron has finished initialization and is ready to create browser windows.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
function createRed() {
// Start the Node-RED runtime, then load the inital page
RED.start().then(function() {
server.listen(listenPort,"127.0.0.1",function() {
mainWindow.loadURL("http://127.0.0.1:"+listenPort+url);
// console.log("http://127.0.0.1:"+listenPort+url)
});
});
}
///////////////////////////////////////////////////////
// All this Squirrel stuff is for the Windows installer
function handleSquirrelEvent() {
if (process.argv.length === 1) {
return false;
}
const ChildProcess = require('child_process');
const path = require('path');
const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);
const spawn = function(command, args) {
let spawnedProcess, error;
try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}
return spawnedProcess;
};
const spawnUpdate = function(args) {
return spawn(updateDotExe, args);
};
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus
// Install desktop and start menu shortcuts
spawnUpdate(['--createShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
// Remove desktop and start menu shortcuts
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
app.quit();
return true;
}
};
auth_server.on('message', (m) => {
authCallback(m.url)
});
app.on('open-url', function (ev, url) {
ev.preventDefault();
authCallback(url)
});
function authCallback(url) {
if (username == null || username == "") {
// Bring app window to front
authWindow.focus();
const queryDict = queryString.parse(url);
var token = queryDict["nodered://auth?authResponse"] ? queryDict["nodered://auth?authResponse"] : null;
const tokenPayload = blockstack.decodeToken(token).payload
const profileURL = tokenPayload.profile_url
console.log(blockstack.decodeToken(token).payload.username)
username = blockstack.decodeToken(token).payload.username
authWindow.hide()
// Create the browser window.
mainWindow = new BrowserWindow({
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: false
},
title: "dApparatus",
fullscreenable: true,
titleBarStyle: "hidden",
width: 500,
height: 820,
icon: __dirname + "/nodered.png"
});
var webContents = mainWindow.webContents;
webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) {
if ((httpResponseCode == 404) && (newURL == ("http://localhost:"+listenPort+url))) {
setTimeout(webContents.reload, 200);
}
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
});
createRed();
}
}
var info_app = express();
var info_server = info_app.listen(9877);
info_app.use(cors());
info_app.get("/get_username", function (req, res) {
res.send(username);
});
| 29.980519 | 111 | 0.629955 |
732aee947ad18bae614675ebdbf38c62d88ef2e7 | 3,345 | js | JavaScript | node_modules/core-js/internals/number-is-finite_jalangi_.js | cl0udz/Lynx | 19bf847917ff4000f42c49192d14f6c0b0944c17 | [
"MIT"
] | 86 | 2020-08-05T21:04:32.000Z | 2022-02-08T08:55:41.000Z | node_modules/core-js/internals/number-is-finite_jalangi_.js | cl0udz/Lynx | 19bf847917ff4000f42c49192d14f6c0b0944c17 | [
"MIT"
] | 2 | 2021-05-21T12:20:47.000Z | 2021-11-06T00:38:52.000Z | node_modules/core-js/internals/number-is-finite_jalangi_.js | cl0udz/Lynx | 19bf847917ff4000f42c49192d14f6c0b0944c17 | [
"MIT"
] | 16 | 2020-08-24T08:28:58.000Z | 2021-12-14T12:44:36.000Z | J$.iids = {"8":[8,10,8,53],"9":[1,14,1,21],"10":[8,10,8,19],"16":[7,18,9,2],"17":[1,22,1,43],"18":[8,10,8,31],"25":[1,14,1,44],"33":[1,14,1,44],"41":[1,14,1,44],"49":[3,22,3,28],"57":[3,22,3,37],"65":[3,22,3,37],"73":[3,22,3,37],"81":[7,1,7,7],"89":[7,18,7,24],"97":[7,18,7,33],"105":[8,17,8,19],"113":[8,23,8,31],"121":[8,35,8,49],"129":[8,50,8,52],"137":[8,35,8,53],"145":[8,10,8,53],"153":[8,3,8,54],"161":[7,37,9,2],"169":[7,37,9,2],"177":[7,37,9,2],"185":[7,37,9,2],"193":[7,37,9,2],"201":[7,1,9,2],"209":[7,1,9,3],"217":[1,1,9,3],"225":[1,1,9,3],"233":[1,1,9,3],"241":[7,37,9,2],"249":[7,37,9,2],"257":[1,1,9,3],"265":[1,1,9,3],"nBranches":4,"originalCodeFileName":"/home/james/nodejs/HiPar/node_modules/core-js/internals/number-is-finite.js","instrumentedCodeFileName":"/home/james/nodejs/HiPar/node_modules/core-js/internals/number-is-finite_jalangi_.js","code":"var global = require('../internals/global');\n\nvar globalIsFinite = global.isFinite;\n\n// `Number.isFinite` method\n// https://tc39.github.io/ecma262/#sec-number.isfinite\nmodule.exports = Number.isFinite || function isFinite(it) {\n return typeof it == 'number' && globalIsFinite(it);\n};\n"};
jalangiLabel436:
while (true) {
try {
J$.Se(217, '/home/james/nodejs/HiPar/node_modules/core-js/internals/number-is-finite_jalangi_.js', '/home/james/nodejs/HiPar/node_modules/core-js/internals/number-is-finite.js');
J$.N(225, 'global', global, 0);
J$.N(233, 'globalIsFinite', globalIsFinite, 0);
var global = J$.X1(41, J$.W(33, 'global', J$.F(25, J$.R(9, 'require', require, 2), 0)(J$.T(17, '../internals/global', 21, false)), global, 3));
var globalIsFinite = J$.X1(73, J$.W(65, 'globalIsFinite', J$.G(57, J$.R(49, 'global', global, 1), 'isFinite', 0), globalIsFinite, 3));
J$.X1(209, J$.P(201, J$.R(81, 'module', module, 2), 'exports', J$.C(16, J$.G(97, J$.R(89, 'Number', Number, 2), 'isFinite', 0)) ? J$._() : J$.T(193, function isFinite(it) {
jalangiLabel435:
while (true) {
try {
J$.Fe(161, arguments.callee, this, arguments);
arguments = J$.N(169, 'arguments', arguments, 4);
isFinite = J$.N(177, 'isFinite', isFinite, 0);
it = J$.N(185, 'it', it, 4);
return J$.X1(153, J$.Rt(145, J$.C(8, J$.B(18, '==', J$.U(10, 'typeof', J$.R(105, 'it', it, 0)), J$.T(113, 'number', 21, false), 0)) ? J$.F(137, J$.R(121, 'globalIsFinite', globalIsFinite, 1), 0)(J$.R(129, 'it', it, 0)) : J$._()));
} catch (J$e) {
J$.Ex(241, J$e);
} finally {
if (J$.Fr(249))
continue jalangiLabel435;
else
return J$.Ra();
}
}
}, 12, false, 161), 0));
} catch (J$e) {
J$.Ex(257, J$e);
} finally {
if (J$.Sr(265)) {
J$.L();
continue jalangiLabel436;
} else {
J$.L();
break jalangiLabel436;
}
}
}
// JALANGI DO NOT INSTRUMENT
| 79.642857 | 1,168 | 0.481913 |
732b1849ea34c76c5a4976c4be6edc6de0f2f8a9 | 45 | js | JavaScript | src/hocs/ec-with-sorting/index.js | Ebury/chameleon-components | 8de1cc7790db9427e57c2abddf013988741d7ad5 | [
"MIT"
] | 23 | 2019-11-11T08:55:20.000Z | 2022-03-07T10:09:04.000Z | src/hocs/ec-with-sorting/index.js | Ebury/chameleon-components | 8de1cc7790db9427e57c2abddf013988741d7ad5 | [
"MIT"
] | 1,106 | 2019-10-31T13:07:45.000Z | 2022-03-29T04:17:55.000Z | src/hocs/ec-with-sorting/index.js | Ebury/chameleon-components | 8de1cc7790db9427e57c2abddf013988741d7ad5 | [
"MIT"
] | 4 | 2020-03-27T10:06:50.000Z | 2021-10-08T05:13:52.000Z | export { default } from './ec-with-sorting';
| 22.5 | 44 | 0.666667 |
732b880833e9684e1e50f722e8bb97ec8634d903 | 39,905 | js | JavaScript | js/view-action/toolbar.js | stjankovic/evolutility-ui-jquery | 2e2a016bf47b85febf763a55b491a8a08aae46b2 | [
"MIT"
] | 1 | 2021-04-30T02:14:01.000Z | 2021-04-30T02:14:01.000Z | js/view-action/toolbar.js | stjankovic/evolutility-ui-jquery | 2e2a016bf47b85febf763a55b491a8a08aae46b2 | [
"MIT"
] | null | null | null | js/view-action/toolbar.js | stjankovic/evolutility-ui-jquery | 2e2a016bf47b85febf763a55b491a8a08aae46b2 | [
"MIT"
] | null | null | null | /*! ***************************************************************************
*
* evolutility-ui-jquery :: toolbar.js
*
* View "toolbar" (one toolbar instance manages all views for a UI model).
*
* https://github.com/evoluteur/evolutility-ui-jquery
* (c) 2017 Olivier Giulieri
*
*************************************************************************** */
Evol.viewClasses = {
getClass: function(className){
if(this[className]){
return this[className];
}else{
return this.list;
}
}
};
_.forEach([ 'browse', 'edit', 'mini', 'json'],function(vn){
Evol.viewClasses[vn] = Evol.ViewOne[vn==='json'?'JSON':Evol.Format.capitalize(vn)];
});
_.forEach([ 'list', 'cards', 'bubbles', 'charts'],function(vn){
Evol.viewClasses[vn] = Evol.ViewMany[Evol.Format.capitalize(vn)];
});
_.forEach([ 'filter', 'export', 'import'],function(vn){
Evol.viewClasses[vn] = Evol.ViewAction[Evol.Format.capitalize(vn)];
});
if(toastr){
toastr.options = {
hideDuration: 0,
//preventDuplicates: true,
closeButton: true,
progressBar: true
};
}
// toolbar widget which also acts as a controller for all views "one" and "many" as well as actions
Evol.Toolbar = function() {
var dom = Evol.DOM,
i18n = Evol.i18n,
i18nTool = i18n.tools;
return Backbone.View.extend({
events: {
'click .nav a': 'click_toolbar',
'navigate.many >div': 'click_navigate',
'paginate.many >div': 'paginate',
//'selection.many >div': 'click_select',
'click .evo-search>.btn': 'click_search',
'keyup .evo-search>input': 'key_search',
'click .evo-search>.clear-icon': 'clear_search',
'change.tab >div': 'change_tab',
'action >div': 'click_action',
'status >div': 'status_update',
'change.filter >div': 'change_filter',
'close.filter >div': 'hideFilter',
'click .alert-dismissable>button': 'clearMessage',
'message >div':'showMessage'
},
options: {
toolbar: true,
readonly: false,
//router:...,
defaultView: 'list',
defaultViewOne: 'browse',
defaultViewMany: 'list',
style: 'panel-info',
display: 'label', // other possible values: tooltip, text, icon, none
titleSelector: '#title',
pageSize:20,
buttons: {
always:[
{id: 'list', label: i18nTool.bList, icon:'th-list', n:'x'},
{id:'charts', label: i18nTool.bCharts, icon:'stats', n:'x'},
//{id: 'selections', label: i18nTool.Selections, icon:'star', n:'x'},
{id: 'new', label: i18nTool.bNew, icon:'plus', n:'x', readonly:false},
],
actions:[
//{id:'browse', label: i18nTool.bBrowse, icon:'eye', n:'1', readonly:false},
{id:'edit', label: i18nTool.bEdit, icon:'edit', n:'1', readonly:false},
{id:'save', label: i18nTool.bSave, icon:'floppy-disk', n:'1', readonly:false},
{id:'del', label: i18nTool.bDelete, icon:'trash', n:'1', readonly:false},
{id:'filter', label: i18nTool.bFilter, icon:'filter', n:'n'},
{id:'export', label: i18nTool.bExport, icon:'cloud-download',n:'n'},
],
moreActions:[
//{id:'import', label: i18nTool.bImport, icon:'cloud-upload',n:'x'},
//{id:'-'},
//{id:'cog',label: 'Customize', icon:'cog',n:'x'}
],
prevNext:[
{id:'prev', label: i18nTool.prev, icon:'chevron-left', n:'x'},
{id:'next', label: i18nTool.next, icon:'chevron-right', n:'x'}
],
views: [
// -- views ONE ---
{id:'browse', label: i18nTool.bBrowse, icon:'eye-open', n:'1'},// // ReadOnly
{id:'edit', label: i18nTool.bEdit, icon:'edit', n:'1', readonly:false},// // All Fields for editing
{id:'mini', label: i18nTool.bMini, icon:'th-large', n:'1', readonly:false},// // Important Fields only
//{id:'wiz',label: i18nTool.bWizard, icon:'arrow-right',n:'1'},
{id:'json', label: i18nTool.bJSON, icon:'barcode', n:'1', readonly:false},
// -- views MANY ---
{id:'list', label: i18nTool.bList, icon:'th-list', n:'n'},
{id:'cards', label: i18nTool.bCards, icon:'th-large', n:'n'},
{id:'bubbles', label: i18nTool.bBubbles, icon:'adjust', n:'n'},
],
search: true
}
},
initialize: function (opts) {
_.extend(this, this.options, opts);
this.views=[];
this.viewsHash={};
},
render: function() {
this.$el.html(this._toolbarHTML());
this.setView(this.defaultViewMany, false);
//this.$('[data-toggle="tooltip"]').tooltip();
this.$('.dropdown-toggle').dropdown();
return this;
},
_toolbarHTML: function(){
var h,
isReadOnly=this.readonly!==false,
that=this,
itemName=this.uiModel.name||'item',
domm=dom.menu,
tb=this.buttons,
menuDivider='<li class="divider" data-cardi="x"></li>',
menuDividerH='<li class="divider-h"></li>';
function menuItem (m, noLabel){
return domm.hItem(m.id, noLabel?'':((m.label=='New'?'New '+itemName:m.label)), m.icon, m.n);
}
function menuItems (ms, noLabel){
return _.map(ms, function(m){
if(isReadOnly && m.readonly===false){
return null;
}
return menuItem(m, noLabel);
}).join('');
}
h='<div class="evo-toolbar"><ul class="nav nav-pills pull-left" data-id="main">'+
menuItems(tb.always)+menuDividerH;
h+=menuItems(tb.actions);
if(tb.moreActions && tb.moreActions.length){
h+=domm.hBegin('more','li','menu-hamburger', '', 'n');
_.each(tb.moreActions, function(m){
if(m.id==='-'){
h+=menuDivider;
}else{
h+=menuItem(m);
}
});
h+=domm.hEnd('li');
}
if(tb.search){
h+=menuDivider;
h+='<li><div class="input-group evo-search">'+
'<input class="evo-field form-control" type="text" maxlength="100" required>'+
'<div class="clear-icon glyphicon glyphicon-remove"></div>'+
'<span class="btn input-group-addon glyphicon glyphicon-search"></span>'+
'</div></li>';
}
if(this.toolbar){
h+='</ul><ul class="nav nav-pills pull-right" data-id="views">';
h+='<li class="evo-tb-status" data-cardi="n"></li>';
h+=menuItems(tb.prevNext);
//h+=domm.hBegin('views','li','eye-open');
h+=menuDividerH+
menuItems(tb.views, false);
//h+=domm.hItem('customize','','wrench', 'x', 'Customize');
/*
if(this.buttons.customize){
h+=beginMenu('cust','wrench');
link2h('customize','Customize this view','wrench');
h.push(menuDivider);
link2h('new-field','New Field','plus');
link2h('new-panel','New Panel','plus');
h+='</ul></li>';
} */
}
h+='</ul>'+dom.html.clearer+'</div>';
return h;
},
refresh:function(){
if(this.curView && this.curView.cardinality && this.curView.cardinality==='n'){
this.curView.render();
}
return this;
},
clearViews: function(keep){
//div data-vid="evolw-edit"
$('[data-vid=evolw-*]').remove();
},
isDirty:function(){
// -- true if current view had unsaved values
return (this.curView && this.curView.isDirty && this.curView.isDirty())?true:false;
},
_setView:function(viewName, updateRoute, skipIcons){
var $e=this.$el,
eid ='evolw-'+viewName,
$v=this.$('[data-vid="'+eid+'"]'),
vw=this.curView,
config,
collec=this._curCollec();
if(viewName==='new'){
viewName=(this._prevViewOne && this._prevViewOne!='browse' && this._prevViewOne!='json')?this._prevViewOne:'edit';
this.setView(viewName, false, true);
this.model=new this.modelClass();
this.model.collection=collec;
vw.model=this.model;
this.newItem();
this.setIcons('new');
vw.mode='new';
this.hideFilter();
}else{
var ViewClass = Evol.viewClasses.getClass(viewName);
if($v.length){
// -- view already exists and was rendered
this.model=vw.model;
if(vw.model){
//TODO debug
this.model.collection=collec;
}
vw=this.viewsHash[viewName];
if(vw && vw.setCollection){
vw.setCollection(collec);
}
if(this.model && !this.model.isNew()){
if(vw.setModel){
if(!vw.collection){
vw.collection=this.model.collection;
}
vw.setModel(this.model);
}else{
vw.model = this.model;
}
if(vw.setTitle){
vw.setTitle();
}
if(this._tabId && vw.getTab && (this._tabId != vw.getTab())){
vw.setTab(this._tabId);
}
if(vw.cardinality==='n' && vw.setPage && this.pageIndex){
vw.setPage(this.pageIndex);
}
}else if(vw.clear){
vw.clear();
}
this.$('[data-id="views"] > li').removeClass('evo-sel') // TODO optimize
.filter('[data-id="'+viewName+'"]').addClass('evo-sel');
this.curView=vw;
this._keepTab(viewName);
$v.show()
.siblings().not('.evo-toolbar,.evo-filters,.clearfix').hide();
}else{
// -- create new instance of the view
$v=$('<div data-vid="evolw-'+viewName+'"></div>');
$e.children().not('.evo-toolbar,.evo-filters,.clearfix').hide();
$e.append($v);
config = {
el: $v,
mode: viewName,
model: this.model,
collection: collec,
uiModel: this.uiModel,
style: this.style,
pageSize: this.pageSize || 20,
pageIndex: this.pageIndex || 0,
titleSelector: this.titleSelector,
router: this.router//,
//iconsPath: this.iconsPath || ''
};
this.$('[data-id="new"]').show();
this.$('[data-id="views"] > li').removeClass('evo-sel')
.filter('[data-id="'+viewName+'"]').addClass('evo-sel');
if(Evol.Def.isViewMany(viewName)){
//fieldsetFilter
vw = new ViewClass(config)
.render();
this._prevViewMany=viewName;
vw.setTitle();
if(viewName!='charts' && viewName!='bubbles' && this.pageIndex > 0){
vw.setPage(this.pageIndex || 0);
}
}else{
switch(viewName){
// --- actions ---
case 'export':
config.sampleMaxSize = config.pageSize;
vw = new ViewClass(config).render();
break;
case 'import':
config = {
el: $v,
mode: viewName,
uiModel: this.uiModel,
collection: this.collection,
style: this.style,
titleSelector: this.titleSelector,
router: this.router
};
vw = new ViewClass(config).render();
break;
// --- one --- browse, edit, mini, json, wiz
default :
var vwPrev = null,
cData;
if(vw && vw.editable){
vwPrev = vw;
cData=vw.getData();
}
vw = new ViewClass(config).render();
this._prevViewOne=viewName;
this._keepTab(viewName);
break;
}
}
if(_.isUndefined(vw)){
//TODO error tracking (in other places too)
alert('error: invalid route (for toolbar).');
}else{
this.curView=vw;
this.viewsHash[viewName]=vw;
if(!skipIcons){
this.setTitle();
}
}
}
}
this.updateStatus();
if(vw.cardinality==='n'){
this.setRoute('', false);
if(!this._filterOn && this._filterValue){ // TODO do not always change flag
this.showFilter(false);
}
this.updateNav();
}else{
this.hideFilter();
//if(this.curView.viewName==='wizard'){
// this.curView.stepIndex(0);
//}
if(updateRoute){
/*if(!this.model){
alert('Error: Invalid route.');
}*/
this.setRoute(this.model?this.model.id:null, false);
}
this.hideFilter();
this._enableNav();
}
if(!skipIcons){
this.setIcons(viewName);
}
},
setView:function(viewName, updateRoute, skipIcons){
var that=this;
this.proceedIfReady(function(){
that._setView(viewName, updateRoute, skipIcons);
});
return this;
},
getView:function(){
return this.curView;
},
proceedIfReady:function(cbOK, cbCancel){
// -- execute callback if not dirty or after prompt...
var that=this,
i18n=i18n,
msg,
cbs;
if(this.isDirty()){
msg=i18n.unSavedChanges.replace('{0}', this.curView.getTitle())+
'<br><br>'+i18n.warnNoSave;
cbs={
nosave: cbOK,
ok: function(){
if(that.curView.validate().length===0){
that.saveItem(false, true);
cbOK();
}
}
};
if(cbCancel){
cbs.cancel = cbCancel;
}
dom.modal.confirm(
'isDirty',
i18n.unSavedTitle,
msg,
cbs,
[
{id:'nosave', text:i18nTool.bNoSave, class:'btn-default'},
{id:'cancel', text:i18nTool.bCancel, class:'btn-default'},
{id:'ok', text:i18nTool.bSave, class:'btn-primary'}
]
);
}else{
cbOK();
}
return this;
},
_keepTab: function(viewName){
if(this.tabId && (viewName=='browse'||viewName=='edit')){
this.curView.setTab(this.tabId);
}
},
getToolbarButtons: function(){
if(!this._toolbarButtons){
var $tb=this.$('.evo-toolbar'),
lis=$tb.find('>ul>li'),
vw=$tb.find('[data-id="views"]');
this._toolbarButtons = {
ones: lis.filter('li[data-cardi="1"]'),
manys: lis.filter('li[data-cardi="n"]'),
edit: lis.filter('[data-id="main"]>[data-id="edit"]'),
del: lis.filter('[data-id="del"]'),
save: lis.filter('[data-id="save"]'),
prevNext: lis.filter('[data-id="prev"],[data-id="next"]'),
//customize: lis.filter('[data-id="customize"]').parent(),
more: lis.filter('[data-id="more"]'),
views: vw,
viewsIcon: this.$('.glyphicon-eye-open,.glyphicon-eye-close'),
vws: vw.find('ul>li>a')
};
}
return this._toolbarButtons;
},
setIcons: function(mode){
var showOrHide = dom.showOrHide,
importOrExport = mode==='export' || mode==='import';
function oneMany(mode, showOne, showMany){
showOrHide(tbBs.ones, showOne);
showOrHide(tbBs.manys, showMany);
tbBs.vws.removeAttr('style');
tbBs.views.find('[data-id="'+mode+'"]>a').css('color', '#428bca');
}
if(this.$el){
var tbBs=this.getToolbarButtons();
//showOrHide(tbBs.customize, mode!='json');
tbBs.prevNext.hide();//.removeClass('disabled');
showOrHide(tbBs.views, !(importOrExport || mode=='new'));
tbBs.del.hide();
if(Evol.Def.isViewMany(mode)){
this._prevViewMany=mode;
oneMany(mode, false, true);
if(mode!=='charts' && mode!=='bubbles'){
var cSize=this.collection.length,
pSize=this.curView.pageSize;
if(cSize > pSize){
tbBs.prevNext.show();/*
// TODO: finish disabling of paging buttons
// use ui.addRemClass
if(this.curView.pageIndex===0){
tbBs.prevNext.eq(0).addClass('disabled');
}else{
tbBs.prevNext.eq(0).removeClass('disabled');
}
if(this.collection.length/this.pageSize){
tbBs.prevNext.eq(1).addClass('disabled');
}else{
tbBs.prevNext.eq(1).removeClass('disabled');
}*/
}
}
}else if((this.model && this.model.isNew()) || mode==='new' || importOrExport){
oneMany(mode, false, false);
tbBs.del.hide();
tbBs.views.hide();
showOrHide(tbBs.more, importOrExport);
showOrHide(tbBs.save, !importOrExport);
}else{
this._prevViewOne=mode;
oneMany(mode, true, false);
tbBs.prevNext.show();
showOrHide(tbBs.save, mode!=='browse');
showOrHide(tbBs.edit, mode==='browse');
}
}
},
showFilter: function( orCreate){
if(!this._filters){
if(orCreate){
var that=this,
$ff=$(dom.panelEmpty('filters', 'evo-filters', 'info'));
this.$('.evo-toolbar').after($ff);
this._filters = new Evol.ViewAction.Filter({
el: $ff,
uiModel: this.uiModel
}).render();
$ff.on('change.filter', function(){
that.curView.setFilter(that._filters.val());
if(that.curView.viewName!=='bubbles'){
that.curView.render();
}
});
}
}else{
this._filters.$el.show(); //.slideDown();
}
this._filterOn=true;
return this;
},
hideFilter: function(){
if(this._filters){
this._filters.$el.hide(); //.fadeOut(300);
}
this._filterOn=false;
return this;
},
toggleFilter: function(v){
this._filterOn = _.isBoolean(v) ? v : !this._filterOn;
return this._filterOn ? this.showFilter(true) : this.hideFilter();
},
_flagFilterIcon: function(fOn){
dom.addRemClass(this.$('a[data-id="filter"]'), fOn, 'evo-filter-on');
},
setData: function(data){
if(this.curView){
this.curView.setData(data);
}
return this;
},
getData: function(skipReadOnlyFields){
if(this.curView){
return this.curView.getData(skipReadOnlyFields);
}
return null;
},
getCollection:function(){
return this._curCollec();
},
setModelById: function(id, skipNav){
var that = this,
m,
fnSuccess = function(){
// TODO set collection ??
that.model = m;
if(!skipNav){
if(that.curView.cardinality!='1'){
that.setView(that.defaultViewOne);
}
that.curView.setModel(m);
dom.scroll2Top();
}
},
fnError = function(){
alert('Error: Invalid model ID.');
};
if(Evol.Config.localStorage){
m = this.collection.get(id);
if(_.isUndefined(m)){
fnError();
}else{
fnSuccess();
}
}else{
var M = Backbone.Model.extend({
urlRoot: Evol.Config.url+that.uiModel.id
});
m = new M({id:id});
m.fetch({
success: fnSuccess,
error: fnError
});
}
return this;
},
navPrevNext: function(direction){ // direction = "prev" or "next"
var collec=this._curCollec(),
cModel=this.curView.model;
if(cModel && collec && collec.length){
var l=collec.length-1,
idx =_.indexOf(collec.models, cModel);
if(direction==='prev'){
idx=(idx>0)?idx-1:l;
}else{
idx=(idx<l)?idx+1:0;
}
cModel = collec.models[idx];
}else{
cModel = null;
}
this.model = cModel;
this.curView.setModel(cModel);
if(cModel){
this.setRoute(cModel?cModel.id:null, false);
}else{
this.setMessage(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.name), 'error');
}
return this
.clearMessage();
},
setRoute: function(id, triggerRoute, view){
Evol.Dico.setRoute(this.router, this.uiModel.id, view || this.curView.viewName, id, triggerRoute);
Evol.Dico.setPageTitle(this.curView.getTitle());
return this;
},
saveItem: function(saveAndAdd, skipValidation){
var that=this,
vw=this.curView,
msgs=skipValidation?[]:vw.validate();
function fnSuccess(m){
if(saveAndAdd) {
that.newItem();
this._trigger('item.added');
}else{
m.unset(''); // TODO why is there a "" prop?
that.model=m;
if(that._filteredCollection){
that._filteredCollection.add(m);
}
that.setIcons('edit');
vw.setModel(m);
that._trigger('item.saved', {
model:m,
uiModel:that.uiModel
});
}
vw.setTitle();
}
if(msgs.length===0){
var entityName=this.uiModel.name;
if(_.isUndefined(this.model) || (this.model && this.model.isNew())){ // CREATE
if(this.collection){
this.collection.create(this.getData(true), {
success: function(m){
fnSuccess(m);
that.setRoute(m.id, false);
that.setMessage(i18n.getLabel('saved', Evol.Format.capitalize(entityName)), i18n.getLabel('msg.added', entityName, _.escape(vw.getTitle())), 'success');
},
error:function(m, err){
alert('Error in "saveItem"');
}
});
this.mode='edit';
}else{
alert('Can\'t save record b/c no collection is specified.'); //TODO use bootstrap modal
}
}else{ // UPDATE
// TODO fix bug w/ insert when filter applied => dup record
var updatedModel = this.getData(true);
this.model.set(updatedModel);
this.model.save(this.model.changedAttributes(), {
success: function(m){
fnSuccess(m);
that.collection.set(m, {remove:false});
that.setMessage(i18n.getLabel('saved', Evol.Format.capitalize(entityName)), i18n.getLabel('msg.updated', Evol.Format.capitalize(entityName), _.escape(vw.getTitle())), 'success');
},
error: function(m, err){
alert('Error '+err.status+' - '+err.statusText);
}
});
}
}else{
var msg = '<ul><li>'+msgs.join('</li><li>')+'</li></ul>';
this.setMessage(i18n.validation.incomplete, msg, 'warning');
}
return this;
},
newItem: function(){
var vw=this.curView;
if(vw.viewName==='browse'){
if(this._prevViewOne!=='browse' && this._prevViewOne!=='json'){
this.setView(this._prevViewOne);
}else{
this.setView('edit', false, true);
}
}
return this.curView.setDefaults() //.clear()
.setTitle(i18n.getLabel('tools.newEntity', this.uiModel.name, vw.getTitle()));
},
deleteItem: function(skipConfirmation, id, options){
var that=this,
uimId=id || this.uiModel.id,
entityName=this.uiModel.name,
entityValue=(options && options.title) || this.curView.getTitle(),
fnSuccess;
if(id || this.curView.cardinality==='1'){
if(id){
//this.setModelById(id, true);
var mid=Evol.Config.localStorage?''+id:id; // using string or int
this.model=this.collection.findWhere({id: mid});
var t=this.uiModel.fnTitle;
if(t && this.model){
if(_.isString(t)){
entityValue=this.model.get(t);
}else{
entityValue=t(that.model);
}
}
}
fnSuccess = function(){
var collec=that.collection,
delIdx=_.indexOf(collec.models, delModel),
newIdx=delIdx,
newModel=null;
if(collec.length>1){
if(delIdx===0){
newIdx=1;
}else if(delIdx<collec.length-1){
newIdx=delIdx+1;
}else{
newIdx=delIdx-1;
}
newModel = collec.at(newIdx);
}
if(newModel){
newModel.collection = collec;
}
var opts = {
success: function(){
if(newModel===null || collec.length===0){
if(that.curView.clear){
that.curView.clear();
}
}else{
that.model = newModel;
if(!id){
that.setRoute(newModel.id, false);
that.curView.setModel(newModel);
}
}
var eName= Evol.Format.capitalize(entityName);
that.setMessage(i18n.getLabel('deleted1', eName), i18n.getLabel('msg.deleted', eName, entityValue), 'info');
if(options && options.fnSuccess){
options.fnSuccess();
}
that._trigger('item.deleted');
},
error: function(m, err){
alert('error in "deleteItem"');
}
};
if(!(id || Evol.Config.localStorage)){
opts.url=that.model.url();
}
collec.remove(delModel);
delModel.destroy(opts);
};
var delModel = this.model;
if(delModel){
if(skipConfirmation){
fnSuccess();
}else{
dom.modal.confirm(
'delete',
i18n.getLabel('deleteX', entityName),
i18n.getLabel('delete1', entityName, _.escape(entityValue)),
{
'ok': fnSuccess
}
);
}
}
}/*else{
if(that.curView.getSelection){
var selection=that.curView.getSelection();
if(selection.length>0){
if (confirm(i18n.getLabel('deleteN', selection.length, that.uiModel.namePlural))) {
//TODO
}
}
}
}*/
},
setMessage: function(title, content, style){
toastr[style || 'info'](content, title);
return this;
},
clearMessage: function(){
this.$('[data-id="msg"]').remove();
toastr.clear();
return this;
},
showMessage: function(evt, ui){
if(ui){
return this.setMessage(ui.title, ui.content, ui.style);
}else{
return this.clearMessage();
}
},
setTitle: function(){
if(this.curView){
this.curView.setTitle();
}
return this;
},
getStatus: function(){
if(this.curView.cardinality==='n'){
if(this._filteredCollection){
return this._filteredCollection.length+' / '+this.collection.length+' '+this.uiModel.namePlural;
}else{
return this.collection.length+' '+this.uiModel.namePlural;
}
}else{
return '';
}
},
setStatus: function(msg){
this.$('.evo-toolbar .evo-tb-status')
.html(msg);
this.$('.evo-many-summary').html(msg);
},
updateStatus: function(){
this.setStatus(this.getStatus());
},
click_action: function(evt, options){
var actionId;
if(_.isString(options)){
actionId=options;
}else{
actionId=options.id;
}
switch(actionId){
case 'cancel':
window.history.back();
break;
case 'edit':
if(options.mid){
this.setModelById(options.mid);
this.setRoute(options.mid, false, 'edit');
}else{
//todo
this.setView(actionId, true);
}
break;
case 'delete':
if(options.mid){
this.deleteItem(options.skipWarning, options.mid, options);
}
break;
case 'save':
case 'save-add':
this.saveItem(actionId==='save-add');
break;
case 'import':
var d = options.data;
var msg, style;
if(d && d.total){
style = d.errors.length ? (d.inserts.length ? 'warning' : 'error') : 'success';
msg = d.inserts + ' ' + this.uiModel.name + ' added.';
if(d.errors>0){
msg += '<br>' + d.errors.length + ' Errors.';
}
this.setMessage(i18n.import.success, msg, style);
}else{
this.setMessage(i18n.import.empty, '', 'warning');
}
break;
}
},
paginate: function(bId, ui){
if(ui){
bId=ui.id;
}
var pIdx=this.pageIndex || 0;
if(bId==='prev'){
pIdx=(pIdx>0)?pIdx-1:0;
}else if(bId==='next'){
if((pIdx+1)*this.pageSize<this.curView.collection.length){
pIdx++;
}
}else{
var bIdx=parseInt(bId, 10);
if(bIdx>0){
pIdx=bIdx-1;
}
}
this.pageIndex=pIdx;
this.updateNav();
if(this.curView.setPage){
this.curView.setPage(pIdx);
}
return this;
},
updateNav: function(){
var cl=this.curView.collection ? this.curView.collection.length : 0,
cssDisabled='disabled',
pIdx=this.pageIndex||0,
$item=this.$('[data-id="prev"]');
dom.addRemClass($item, pIdx===0, cssDisabled);
dom.addRemClass($item.next(), (pIdx+1)*this.pageSize>cl, cssDisabled);
},
_enableNav: function(){
this.$('[data-id="prev"],[data-id="next"]')
.removeClass('disabled');
},
status_update: function(evt, ui){
this.setStatus(ui);
},
_curCollec: function(){
if (this._filteredCollection){
return this._filteredCollection;
}else{
if(this.collection){
return this.collection;
}else{
return this.model?this.model.collection:new this.collectionClass();
}
}
},
/*
_ok2go: function(){
if(this.curView && this.curView.editable && this.curView.isDirty && this.curView.isDirty()){
if(confirm(i18n.unSavedChanges)){
return true;
}
return false;
}
return true;
},*/
click_toolbar: function(evt, ui){
var $e=$(evt.currentTarget);
if($e.tagName!=='A'){
$e=$e.closest('a');
}
var toolId=$e.data('id');
//evt.preventDefault();
//evt.stopImmediatePropagation();
switch(toolId){
case 'save':
this.saveItem(false);
break;
case 'del':
this.deleteItem(evt.shiftKey);
break;
case 'filter':
this.toggleFilter();
break;
case 'prev':
case 'next':
if(this.curView.cardinality==='1'){
var that=this;
this.proceedIfReady(function(){
that.navPrevNext(toolId);
});
}else if(this.curView.cardinality==='n'){
this.paginate(toolId);
}
break;/*
case 'customize':
this.curView.customize();
break;
case 'new-field':
case 'new-panel':
Evol.Dico.showDesigner('', toolId.substr(4), $e);
break;*/
default:// 'browse', edit', 'mini', 'json', 'list', 'cards', 'bubbles', 'export'
if(toolId && toolId!==''){
this.setView(toolId, true);
}
this.updateStatus();
}
this._trigger('toolbar.'+toolId);
},
_trigger: function(name, ui){
this.$el.trigger(name, ui);
},
click_navigate: function(evt, ui, view){
evt.stopImmediatePropagation();
this.setModelById(ui.id);
if(ui.view){
this.setView(ui.view);
}
this.setRoute(ui.id, false, ui.view);
},
change_tab: function(evt, ui){
if(ui){
this._tabId=ui.id;
}
},
change_filter: function(evt){
if(evt.namespace!=='filter'){
return;
}
var fvs=this._filters.val(),
collec;
if(fvs.length){
var models=this._searchString ? this._filteredCollection.models : this.model.collection.models;
models=Evol.Dico.filterModels(models, fvs);
if(this.collectionClass){
collec=new this.collectionClass(models);
}else{
collec=new Backbone.Collection(models);
}
this._filteredCollection = collec;
this._filterValue = fvs;
}else{
collec=this.collection;
this._filteredCollection = null;
this._filterValue = null;
}
this.updateStatus();
this._flagFilterIcon(fvs.length);
this.pageIndex=0;
this.curView.setCollection(collec);
this.updateNav();
this._trigger('filter.change');
},
click_search: function(evt){
var that=this,
vSearch=this.$('.evo-search>input').val().toLowerCase(),
fnSearch = Evol.Def.fnSearch(this.uiModel, vSearch),
collec;
this._searchString = vSearch;
if(vSearch){
var models=(this.collection||this.model.collection).models
.filter(fnSearch);
if(this.collectionClass){
collec = new this.collectionClass(models);
}else{
collec = new Backbone.Collection(models);
}
this._filteredCollection = collec;
}else{
collec=this.collection;
this._filteredCollection=null;
}
this.updateStatus();
this.pageIndex=0;
if(this.curView.viewType!=='many' && !this.curView.isChart){
this.setView('list', true);
}
this.curView.setCollection(collec);
this.updateNav();
this._trigger('search');
},
key_search: function(evt){
if(evt.keyCode===13){
evt.preventDefault();
this.click_search(evt);
}
},
clear_search: function(evt){
var collec=this.collection;
this._filteredCollection=null;
this.updateStatus();
this.pageIndex=0;
if(this.curView.setCollection){
this.curView.setCollection(collec);
}
this._searchString = null;
this.$('.evo-search>input').val('').focus();
//this.updateNav();
//this._trigger('search');
},
click_selection: function(evt, ui){
var status=this.$('.evo-toolbar .evo-tb-status'),
len=this.$('.list-sel:checked').not('[data-id="cbxAll"]').length,
tbBs=this.getToolbarButtons();
if(len>0){
this.setStatus(i18n.getLabel('selected', len));
tbBs.del.show();
}else{
this.setStatus('');
tbBs.del.hide();
}
}
});
}();
| 35.15859 | 202 | 0.451146 |
732bab2c939cbbd24b2255cb919a48a6c36e56b0 | 320 | js | JavaScript | src/actions/settings.js | jinhojang6/status-podcast | f78cdb29b31b25595366de6c78d2fe9d6479ff83 | [
"MIT"
] | 1 | 2020-02-03T14:43:53.000Z | 2020-02-03T14:43:53.000Z | src/actions/settings.js | status-im/status-media | 705884b6a356142202c012557abaf88158fa58f8 | [
"MIT"
] | 3 | 2020-03-21T14:02:58.000Z | 2021-05-11T03:44:00.000Z | src/actions/settings.js | jinhojang6/status-podcast | f78cdb29b31b25595366de6c78d2fe9d6479ff83 | [
"MIT"
] | null | null | null | export const switchTheme = theme => dispatch => {
localStorage.setItem('theme', theme)
dispatch({
type: 'SWITCH_THEME',
theme
})
}
export const switchDisplay = displayValue => dispatch => {
localStorage.setItem('display', displayValue)
dispatch({
type: 'SWITCH_DISPLAY',
displayValue
})
}
| 17.777778 | 58 | 0.665625 |
732bcf9fbe5885c158d1791cf6b92cf629fd5d9a | 1,383 | js | JavaScript | src/components/DotStepper/DotStepper.test.js | abdusabri/hsds-react | a4ddf6c94eca5932332fa2d7c377c5caa49bbcdd | [
"MIT"
] | 59 | 2018-12-24T14:31:50.000Z | 2022-03-21T04:32:59.000Z | src/components/DotStepper/DotStepper.test.js | abdusabri/hsds-react | a4ddf6c94eca5932332fa2d7c377c5caa49bbcdd | [
"MIT"
] | 631 | 2018-11-15T00:14:17.000Z | 2022-03-24T16:40:32.000Z | src/components/DotStepper/DotStepper.test.js | abdusabri/hsds-react | a4ddf6c94eca5932332fa2d7c377c5caa49bbcdd | [
"MIT"
] | 12 | 2018-11-22T10:45:16.000Z | 2022-02-16T18:27:32.000Z | import React from 'react'
import { mount } from 'enzyme'
import { DotStepperUI, BulletUI, ProgressBulletUI } from './DotStepper.css'
import DotStepper from './'
import Tooltip from '../Tooltip'
describe('className', () => {
test('Has default className', () => {
const wrapper = mount(<DotStepper />)
expect(wrapper.find(DotStepperUI).hasClass('c-DotStepper')).toBeTruthy()
})
test('Can render custom className', () => {
const customClassName = 'clazz'
const wrapper = mount(<DotStepper className={customClassName} />)
expect(wrapper.find(DotStepperUI).hasClass(customClassName)).toBeTruthy()
})
})
describe('Steps', () => {
test('Renders a BulletUI component for each step', () => {
const numSteps = 8
const wrapper = mount(<DotStepper numSteps={numSteps} />)
expect(wrapper.find(BulletUI)).toHaveLength(numSteps)
})
test('Renders a single ProgressBulletUI component', () => {
const numSteps = 8
const wrapper = mount(<DotStepper numSteps={numSteps} />)
expect(wrapper.find(ProgressBulletUI)).toHaveLength(1)
})
})
describe('Tooltip', () => {
test('Should render a Tooltip component', () => {
const numSteps = 8
const step = 4
const wrapper = mount(<DotStepper numSteps={numSteps} step={step} />)
expect(wrapper.find(Tooltip).prop('title')).toEqual(
`Step ${step} of ${numSteps}`
)
})
})
| 31.431818 | 77 | 0.663051 |
732bd9aac832e961cfee076c9690f7fb66a1355c | 72 | js | JavaScript | static/transition.js | emylincon/GridProject | 8a71480746115ac084d72b1519a7ebb903565d49 | [
"CC0-1.0"
] | null | null | null | static/transition.js | emylincon/GridProject | 8a71480746115ac084d72b1519a7ebb903565d49 | [
"CC0-1.0"
] | null | null | null | static/transition.js | emylincon/GridProject | 8a71480746115ac084d72b1519a7ebb903565d49 | [
"CC0-1.0"
] | null | null | null | const swup = new Swup(); // only this line when included with script tag | 72 | 72 | 0.736111 |
732c2dbf875af0048273a380cf6e5b01764c05a2 | 59 | js | JavaScript | src/Config.js | YetLsu/hh | e8711ea06b7b957ac175a8e47e7ab77bb7667def | [
"MIT"
] | null | null | null | src/Config.js | YetLsu/hh | e8711ea06b7b957ac175a8e47e7ab77bb7667def | [
"MIT"
] | null | null | null | src/Config.js | YetLsu/hh | e8711ea06b7b957ac175a8e47e7ab77bb7667def | [
"MIT"
] | null | null | null | export const ALLOW_HOT_DATE = "2018-04-17" //请修改问当前日期加上7天
| 29.5 | 58 | 0.762712 |
732c6898e5dce8a121801b4d81a45209b709ac56 | 16,806 | js | JavaScript | js/background.js | patoshii/xcubicle-layers | 733c6560d0d3fd37aff98a0a25e18834affb914b | [
"BSD-3-Clause"
] | null | null | null | js/background.js | patoshii/xcubicle-layers | 733c6560d0d3fd37aff98a0a25e18834affb914b | [
"BSD-3-Clause"
] | 1 | 2020-12-03T19:58:44.000Z | 2020-12-03T19:58:44.000Z | js/background.js | patoshii/xcubicle-layers | 733c6560d0d3fd37aff98a0a25e18834affb914b | [
"BSD-3-Clause"
] | null | null | null | const defaultNode = 'https://testardor.xcubicle.com';
chrome.runtime.onInstalled.addListener(async function() {
chrome.contextMenus.create({
id: 'pledge-search',
title: 'Search Pledges by URL',
contexts: ['browser_action']
});
chrome.contextMenus.create({
id: 'notes-search',
title: 'Search Notes by URL',
contexts: ['browser_action']
});
chrome.contextMenus.create({
id: 'pledge-history',
title: 'View My Pledge History',
contexts: ['browser_action']
});
chrome.contextMenus.create({
title: 'View My Private Notes',
id: 'private-note',
contexts: ['browser_action']
});
// preset supported domains
const supportedDomains = 'gofundme,patreon,linkedin,github,kickstarter,facebook,twitter,stackoverflow|stackexchange,ebay,youtube,fiverr,google,t';
chrome.storage.local.set({ supportedDomains });
// const supportedTokens = 'btc,ltc,xmr,eos,eth,usdc,usdt';
const supportedTokens = 'btc,eth,usdc,usdt,dai,ignis';
chrome.storage.local.set({ supportedTokens });
try {
const result = await validateNode('https://testardor.xcubicle.com');
if (
result &&
result.blockchainState === 'UP_TO_DATE' &&
result.blockchainState !== 'DOWNLOADING'
) {
chrome.storage.local.set({
activeNode: 'https://testardor.xcubicle.com'
});
chrome.storage.local.set({
testnetNode: 'https://testardor.xcubicle.com'
});
chrome.storage.local.set({ isTestnet: result.isTestnet });
} else {
console.log(
'check testardor.xcubicle node. \nBLOCKCHAINSTATE: ' +
result.blockchainState
);
chrome.storage.local.set({
activeNode: 'https://testardor.jelurida.com'
});
chrome.storage.local.set({
testnetNode: 'https://testardor.jelurida.com'
});
}
} catch (error) {
console.log(error, 'check testardor.xcubicle node.');
chrome.storage.local.set({ activeNode: 'https://testardor.jelurida.com' });
chrome.storage.local.set({ testnetNode: 'https://testardor.jelurida.com' });
}
}); // onInstalled
// chrome.omnibox.onInputEntered.addListener(function (text) {
// chrome.tabs.update({ url: "https://www.google.com/search?q=eos://" + text });
// })
chrome.contextMenus.onClicked.addListener((info, tab) => {
if (
info.menuItemId === 'pledge-history' &&
localStorage.getItem('nxtaddr') != null
) {
chrome.tabs.create({
url: '/html/pledges.html?address=' + localStorage.getItem('nxtaddr')
});
} else if (info.menuItemId === 'pledge-search') {
chrome.tabs.create({ url: '/landing/index.html' });
} else if (info.menuItemId === 'notes-search') {
chrome.tabs.create({ url: '/html/notes.html' });
} else if (info.menuItemId === 'private-note') {
chrome.tabs.create({
url: '/html/private-notes.html'
});
}
});
chrome.tabs.onActivated.addListener(function(activeInfo) {
if (!chrome.runtime.lastError) {
chrome.tabs.sendMessage(activeInfo.tabId, { pageUpdate: 'update' });
chrome.tabs.get(activeInfo.tabId, function(tab) {
if (tab.url && !tab.url.includes('pledgeContainer'))
setSupportedPage(tab.url);
try {
let url = tab.url.replace(/\/$|\/#$|#$/gi, '');
chrome.storage.local.get(
['activeNode', 'accountAddress', 'blocktimestamp'],
async item => {
const node = item.activeNode ? item.activeNode : defaultNode;
const account = item.accountAddress ? item.accountAddress : '';
const customTime = item.blocktimestamp
? item.blocktimestamp
: moment().unix();
const nodeType = await getNodeType(node);
if (url.includes('https://www.google.com/maps')) {
url = getGoogleMapsURL(url);
}
const current_url_hashed_public = await hashUrl(url);
/*
The extension icon should not light up if there are only PUBLIC + Sitewide notes. It should ONLY light up if there is a note on the URL itself that is public.
Add the letter P to the extension if it detects a private note for the URL.
Add the letter PS to the extnsion if it detects a private note or private sitewide note.
*/
const privateUrlHashes = await Promise.all([
hashUrl(getLocalStorage('nxtpass') + getUrlHostName(url)),
hashUrl(getLocalStorage('nxtpass') + url)
]);
const globalUrlHashedPrivate = privateUrlHashes[0];
const currentUrlHashedPrivate = privateUrlHashes[1];
if (
(await checkPledge(
node,
[current_url_hashed_public],
customTime,
nodeType
)) ||
(await checkPublicNote(
node,
[current_url_hashed_public],
customTime,
nodeType
))
) {
setIconView(activeInfo.tabId);
chrome.tabs.sendMessage(activeInfo.tabId, { pageUpdate: 'note-found' });
}
if (
await checkPrivateNote(
[currentUrlHashedPrivate],
account,
node,
customTime,
nodeType
)
) {
setIconText('P', activeInfo.tabId);
}
if (
await checkPrivateNote(
[globalUrlHashedPrivate],
account,
node,
customTime,
nodeType
)
) {
setIconText('PS', activeInfo.tabId);
}
}
);
} catch (error) {
console.log(error);
}
});
}
});
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
if (!chrome.runtime.lastError) {
chrome.tabs.sendMessage(tabId, { pageUpdate: 'update' });
if (changeInfo.status === 'complete') {
chrome.tabs.get(tabId, function(tab) {
if (tab.url && !tab.url.includes('pledgeContainer'))
setSupportedPage(tab.url);
try {
let url = tab.url.replace(/\/$|\/#$|#$/gi, '');
chrome.storage.local.get(
['activeNode', 'accountAddress', 'blocktimestamp'],
async item => {
const node = item.activeNode ? item.activeNode : defaultNode;
const account = item.accountAddress ? item.accountAddress : '';
const customTime = item.blocktimestamp
? item.blocktimestamp
: moment().unix();
const nodeType = await getNodeType(node);
if (url.includes('https://www.google.com/maps')) {
url = getGoogleMapsURL(url);
}
const current_url_hashed_public = await hashUrl(url);
const privateUrlHashes = await Promise.all([
hashUrl(getLocalStorage('nxtpass') + getUrlHostName(url)),
hashUrl(getLocalStorage('nxtpass') + url)
]);
const globalUrlHashedPrivate = privateUrlHashes[0];
const currentUrlHashedPrivate = privateUrlHashes[1];
if (
(await checkPledge(
node,
[current_url_hashed_public],
customTime,
nodeType
)) ||
(await checkPublicNote(
node,
[current_url_hashed_public],
customTime,
nodeType
))
) {
setIconView(tabId);
chrome.tabs.sendMessage(tabId, { pageUpdate: 'note-found' });
}
if (
await checkPrivateNote(
[currentUrlHashedPrivate],
account,
node,
customTime,
nodeType
)
) {
setIconText('P', tabId);
}
if (
await checkPrivateNote(
[globalUrlHashedPrivate],
account,
node,
customTime,
nodeType
)
) {
setIconText('PS', tabId);
}
}
);
} catch (error) {}
});
}
}
});
function setSupportedPage(location) {
if (!location) return;
location = new URL(location);
chrome.storage.local.get('supportedDomains', result => {
const supportedDomains = result['supportedDomains'];
if (
supportedDomainList(supportedDomains, location) &&
(allowedPages(location) || allowedPledge(location))
) {
chrome.storage.local.set({ pageSupported: true });
} else {
chrome.storage.local.set({ pageSupported: false });
}
});
}
async function checkPledge(node, urlHash, customTime, nodeType) {
let found = false;
try {
const searchQueryRequest = `${node}/nxt?requestType=searchTaggedData&chain=ignis&tag=pledge-note,public,recorded&query=${urlHash}`;
const searchResponse = await getRequest(searchQueryRequest);
if (searchResponse.data) {
for (let data of searchResponse.data) {
if (
transactionIsOlderThanSetTime(
nodeType,
customTime,
data.blockTimestamp
)
) {
const tagArray = data.tags.split(',');
if (!data.tags.includes('ARDOR') || !tagArray[3].includes('ARDOR'))
continue;
if (data.name != urlHash) continue;
found = true;
break;
}
}
}
return found;
} catch (error) {
return found;
}
}
async function checkPublicNote(node, queries, customTime, nodeType) {
try {
for (let query of queries) {
const response = await getRequest(
node +
'/nxt?requestType=searchTaggedData&chain=ignis&tag=note&query=' +
query
);
for (let data of response.data) {
if (data && !data.tags.includes('encrypted')) {
if (
transactionIsOlderThanSetTime(
nodeType,
customTime,
data.blockTimestamp
)
) {
return true;
}
}
}
}
return false;
} catch (err) {
return false;
}
}
async function checkPrivateNote(queries, account, node, customTime, nodeType) {
try {
for (let query of queries) {
const response = await getRequest(
node +
`/nxt?requestType=searchTaggedData&chain=ignis&tag=note,encrypted&query=${query}&account=${account}`
);
for (let data of response.data) {
if (data) {
if (
transactionIsOlderThanSetTime(
nodeType,
customTime,
data.blockTimestamp
)
) {
return true;
}
}
}
}
return false;
} catch (err) {
console.log(err);
return false;
}
}
function setIconView(tabId) {
if (!chrome.runtime.lastError) {
chrome.browserAction.setIcon({ path: '../images/icon-1.png', tabId });
}
}
function setIconText(text, tabId) {
if (!chrome.runtime.lastError) {
chrome.browserAction.setBadgeText({ text, tabId });
}
}
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const {
requestType,
node,
chain,
tag,
query,
account,
recipient,
secretPhrase,
asset,
MASTER_ACCOUNT,
coin,
publicKey,
property,
value,
message,
amount,
searchProperty,
} = request;
if (requestType == 'getAccount') {
const url = `${node}/nxt?requestType=getAccount&account=${account}`;
getApiRequest({ url }, sendResponse);
} else if(requestType == 'getBalance') {
const url = `${node}/nxt?requestType=getBalance&chain=${chain}&account=${account}`;
getApiRequest({ url }, sendResponse);
}else if (requestType == 'searchTaggedData') {
const url = `${node}/nxt?requestType=searchTaggedData&chain=${chain}&tag=${tag}&query=${query}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'getTaggedData') {
const url = `${node}/nxt?requestType=getTaggedData&chain=${chain}&transactionFullHash=${query}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'getAliases') {
// const url = `${node}/nxt?requestType=getAliases&chain=${chain}&account=${account}`
// getApiRequest({ url }, sendResponse);
searchAccountAlias(node, account).then(result => sendResponse(result));
} else if (requestType == 'searchAssets') {
const url = `${node}/nxt?requestType=searchAssets&query=${query}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'getAccountPublicKey') {
const url = `${node}/nxt?requestType=getAccountPublicKey&account=${account}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'getAssetProperties') {
const url = `${node}/nxt?requestType=getAssetProperties&asset=${asset}&setter=${MASTER_ACCOUNT}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'getConversionValue') {
const url = `https://layers.xcubicle.com/cryptoconvert.php?coin=${coin}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'sendMoney') {
const url = `${node}/nxt?requestType=sendMoney&chain=IGNIS&recipient=${recipient}&secretPhrase=${secretPhrase}&feeNQT=100000&amountNQT=${amount}`;
getApiRequest({ url, method: 'POST' }, sendResponse);
} else if (requestType == 'activateAccount') {
const url = `https://layers.xcubicle.com/xactivate.php?address=${account}&publicKey=${publicKey}`;
getApiRequest({ url }, sendResponse);
} else if (requestType == 'setAccountProperty') {
const url = `${node}/nxt?requestType=setAccountProperty&chain=IGNIS&recipient=${recipient}&secretPhrase=${secretPhrase}&feeNQT=100000000&property=${property}&value=${value}`;
getApiRequest({ url, method: 'POST' }, sendResponse);
} else if (requestType == 'sendMessage') {
// Send message requires checking weather the user is logged in, by looking at the chrome.storage
const referenceTx = `2:dfe36cf9f8dff41f30f1cde92717ee6f1ac2c5342bba7d691b5e0b75a6bc5204`;
const data = `&recipient=${recipient}&secretPhrase=${secretPhrase}&chain=ignis&message=pledge&messageToEncrypt=${message}&deadline=2&broadcast=true&messageToEncryptIsText=true&encryptedMessageIsPrunable=true&feeNQT=0&referencedTransaction=${referenceTx}`;
const url = `${node}/nxt?requestType=sendMessage${data}`;
userLoggedIn().then(isLoggedIn => {
if(isLoggedIn) {
getApiRequest({ url, method: 'POST' }, sendResponse)
} else {
sendResponse('user not logged in');
}
});
} else if (requestType == 'getTransaction') {
const url = `${node}/nxt?requestType=getTransaction&chain=ignis&fullHash=${query}`;
getApiRequest({ url }, sendResponse);
} else if (request.requestType == 'getEosAccountName') {
getEosAccountName(request.publicKey, sendResponse);
} else if (request.requestType == 'getEOSBalance') {
getEOSBalance(request.accountName, sendResponse);
} else if (request.requestType == 'getAccountPropertyByPropertyName') {
const url = `${node}/nxt?requestType=getAccountProperties&recipient=${account}&property=${searchProperty}&setter=${MASTER_ACCOUNT}`;
getApiRequest({ url }, sendResponse);
} else if (request.action === 'createWindow' && request.url) {
chrome.windows.create({
url: request.url,
top: 0,
left: 0,
type: 'popup',
width: 500,
height: 600,
focused: true
});
}
return true;
});
function userLoggedIn() {
return new Promise(resolve => {
chrome.storage.local.get(null, (result) => {
resolve(result.coins ? true : false);
})
})
}
function getEosAccountName(publicKey, cb) {
return fetch('https://eos.greymass.com:443/v1/history/get_key_accounts', {
method: 'POST', // or 'PUT'
body: `{"public_key":"${publicKey}"}`,
headers: { 'Content-Type': 'application/json' }
})
.then(res => res.json())
.then(r => cb(r.account_names));
}
function getEOSBalance(accountName, cb) {
return fetch('https://eos.greymass.com:443/v1/chain/get_currency_balance', {
method: 'POST', // or 'PUT'
body: `{"account":"${accountName}","code":"eosio.token","symbol":"EOS"}`,
headers: { 'Content-Type': 'application/json' }
})
.then(res => res.json())
.then(r => cb(r.toString() || ''));
}
function getApiRequest({ url, method = 'GET' }, cb) {
fetch(url, { method }).then(res => res.json()).then(res => {
cb(res);
});
}
| 33.612 | 260 | 0.585624 |
732cd5cbd897dc71f124c4ed9b4fb8d97d05191c | 4,431 | js | JavaScript | packages/ckeditor5-ui/src/editableui/editableuiview.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | packages/ckeditor5-ui/src/editableui/editableuiview.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | packages/ckeditor5-ui/src/editableui/editableuiview.js | ScriptBox99/ckeditor5 | 75f0def2c674810cc558daa902cde52fe28b84cc | [
"MIT"
] | null | null | null | /**
* @license Copyright (c) 2003-2022, CKSource - Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module ui/editableui/editableuiview
*/
import View from '../view';
/**
* The editable UI view class.
*
* @extends module:ui/view~View
*/
export default class EditableUIView extends View {
/**
* Creates an instance of EditableUIView class.
*
* @param {module:utils/locale~Locale} [locale] The locale instance.
* @param {module:engine/view/view~View} editingView The editing view instance the editable is related to.
* @param {HTMLElement} [editableElement] The editable element. If not specified, this view
* should create it. Otherwise, the existing element should be used.
*/
constructor( locale, editingView, editableElement ) {
super( locale );
this.setTemplate( {
tag: 'div',
attributes: {
class: [
'ck',
'ck-content',
'ck-editor__editable',
'ck-rounded-corners'
],
lang: locale.contentLanguage,
dir: locale.contentLanguageDirection
}
} );
/**
* The name of the editable UI view.
*
* @member {String} #name
*/
this.name = null;
/**
* Controls whether the editable is focused, i.e. the user is typing in it.
*
* @observable
* @member {Boolean} #isFocused
*/
this.set( 'isFocused', false );
/**
* The element which is the main editable element (usually the one with `contentEditable="true"`).
*
* @private
* @type {HTMLElement}
*/
this._editableElement = editableElement;
/**
* Whether an external {@link #_editableElement} was passed into the constructor, which also means
* the view will not render its {@link #template}.
*
* @private
* @type {Boolean}
*/
this._hasExternalElement = !!this._editableElement;
/**
* The editing view instance the editable is related to. Editable uses the editing
* view to dynamically modify its certain DOM attributes after {@link #render rendering}.
*
* **Note**: The DOM attributes are performed by the editing view and not UI
* {@link module:ui/view~View#bindTemplate template bindings} because once rendered,
* the editable DOM element must remain under the full control of the engine to work properly.
*
* @protected
* @type {module:engine/view/view~View}
*/
this._editingView = editingView;
}
/**
* Renders the view by either applying the {@link #template} to the existing
* {@link #_editableElement} or assigning {@link #element} as {@link #_editableElement}.
*/
render() {
super.render();
if ( this._hasExternalElement ) {
this.template.apply( this.element = this._editableElement );
} else {
this._editableElement = this.element;
}
this.on( 'change:isFocused', () => this._updateIsFocusedClasses() );
this._updateIsFocusedClasses();
}
/**
* @inheritDoc
*/
destroy() {
if ( this._hasExternalElement ) {
this.template.revert( this._editableElement );
}
super.destroy();
}
/**
* Updates the `ck-focused` and `ck-blurred` CSS classes on the {@link #element} according to
* the {@link #isFocused} property value using the {@link #_editingView editing view} API.
*
* @private
*/
_updateIsFocusedClasses() {
const editingView = this._editingView;
if ( editingView.isRenderingInProgress ) {
updateAfterRender( this );
} else {
update( this );
}
function update( view ) {
editingView.change( writer => {
const viewRoot = editingView.document.getRoot( view.name );
writer.addClass( view.isFocused ? 'ck-focused' : 'ck-blurred', viewRoot );
writer.removeClass( view.isFocused ? 'ck-blurred' : 'ck-focused', viewRoot );
} );
}
// In a case of a multi-root editor, a callback will be attached more than once (one callback for each root).
// While executing one callback the `isRenderingInProgress` observable is changing what causes executing another
// callback and render is called inside the already pending render.
// We need to be sure that callback is executed only when the value has changed from `true` to `false`.
// See https://github.com/ckeditor/ckeditor5/issues/1676.
function updateAfterRender( view ) {
editingView.once( 'change:isRenderingInProgress', ( evt, name, value ) => {
if ( !value ) {
update( view );
} else {
updateAfterRender( view );
}
} );
}
}
}
| 28.22293 | 114 | 0.671632 |
732cd7160f25fc10aaf9ca540bb9da77ff46330e | 203 | js | JavaScript | src/Member.js | charles-owen/trello-sprinter | 0270313e1a2ebe83775f89562a6d73dc5803d310 | [
"CC0-1.0"
] | null | null | null | src/Member.js | charles-owen/trello-sprinter | 0270313e1a2ebe83775f89562a6d73dc5803d310 | [
"CC0-1.0"
] | 24 | 2021-06-20T00:51:16.000Z | 2022-03-23T07:32:07.000Z | src/Member.js | charles-owen/trello-sprinter | 0270313e1a2ebe83775f89562a6d73dc5803d310 | [
"CC0-1.0"
] | null | null | null | /*
* Representation of a Trello member in a board
*/
export const Member = function(board, data) {
this.board = board;
this.id = data.id;
this.name = data.fullName;
this.data = data;
} | 20.3 | 47 | 0.635468 |
732cf10fad79dffa04e27a7f45d2b0286b53c8dd | 328 | js | JavaScript | src/pages/success.js | IsaacBukunmi/bloomic | bc03f86360503f5d9ebac2ce1b6108c5aba3eea0 | [
"RSA-MD"
] | null | null | null | src/pages/success.js | IsaacBukunmi/bloomic | bc03f86360503f5d9ebac2ce1b6108c5aba3eea0 | [
"RSA-MD"
] | null | null | null | src/pages/success.js | IsaacBukunmi/bloomic | bc03f86360503f5d9ebac2ce1b6108c5aba3eea0 | [
"RSA-MD"
] | null | null | null | import React from 'react';
import Layout from '../components/Layout';
import ContactSuccess from '../components/ContactSuccess/ContactSuccess';
import Head from '../components/head';
const Success = () => (
<div>
<Head title="Message Sent" />
<ContactSuccess />
</div>
);
export default Success; | 23.428571 | 73 | 0.652439 |
732d0d9eabb0138340164b09ea689c688e2746e7 | 7,257 | js | JavaScript | src/packages/default/CoreWM/panelitems/buttons.js | JamesZEMOURI/OS.js | e0c019d3061bfacc009084452afc794e2c941e4b | [
"BSD-2-Clause"
] | null | null | null | src/packages/default/CoreWM/panelitems/buttons.js | JamesZEMOURI/OS.js | e0c019d3061bfacc009084452afc794e2c941e4b | [
"BSD-2-Clause"
] | null | null | null | src/packages/default/CoreWM/panelitems/buttons.js | JamesZEMOURI/OS.js | e0c019d3061bfacc009084452afc794e2c941e4b | [
"BSD-2-Clause"
] | null | null | null | /*!
* OS.js - JavaScript Cloud/Web Desktop Platform
*
* Copyright (c) 2011-2017, Anders Evenrud <andersevenrud@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Anders Evenrud <andersevenrud@gmail.com>
* @licence Simplified BSD License
*/
/*eslint valid-jsdoc: "off"*/
(function(CoreWM, Panel, PanelItem, Utils, API, GUI, VFS) {
'use strict';
/////////////////////////////////////////////////////////////////////////////
// ITEM
/////////////////////////////////////////////////////////////////////////////
/**
* PanelItem: Buttons
*/
function PanelItemButtons(settings) {
PanelItem.apply(this, ['PanelItemButtons', 'Buttons', settings, {
buttons: [
{
title: API._('LBL_SETTINGS'),
icon: 'categories/applications-system.png',
launch: 'ApplicationSettings'
}
]
}]);
}
PanelItemButtons.prototype = Object.create(PanelItem.prototype);
PanelItemButtons.constructor = PanelItem;
PanelItemButtons.prototype.init = function() {
var self = this;
var root = PanelItem.prototype.init.apply(this, arguments);
this.renderButtons();
var ghost;
var lastTarget;
var removeTimeout;
var lastPadding = null;
function clearGhost() {
removeTimeout = clearTimeout(removeTimeout);
ghost = Utils.$remove(ghost);
lastTarget = null;
if ( lastPadding !== null ) {
self._$container.style.paddingRight = lastPadding;
}
}
function createGhost(target) {
if ( !target || !target.parentNode ) {
return;
}
if ( target.tagName !== 'LI' && target.tagName !== 'UL' ) {
return;
}
if ( lastPadding === null ) {
lastPadding = self._$container.style.paddingRight;
}
if ( target !== lastTarget ) {
clearGhost();
ghost = document.createElement('li');
ghost.className = 'Ghost';
if ( target.tagName === 'LI' ) {
try {
target.parentNode.insertBefore(ghost, target);
} catch ( e ) {}
} else {
target.appendChild(ghost);
}
}
lastTarget = target;
self._$container.style.paddingRight = '16px';
}
GUI.Helpers.createDroppable(this._$container, {
onOver: function(ev, el, args) {
if ( ev.target && !Utils.$hasClass(ev.target, 'Ghost') ) {
createGhost(ev.target);
}
},
onLeave : function() {
clearTimeout(removeTimeout);
removeTimeout = setTimeout(function() {
clearGhost();
}, 1000);
// clearGhost();
},
onDrop : function() {
clearGhost();
},
onItemDropped: function(ev, el, item, args) {
if ( item && item.data && item.data.mime === 'osjs/application' ) {
var appName = item.data.path.split('applications:///')[1];
self.createButton(appName);
}
clearGhost();
},
onFilesDropped: function(ev, el, files, args) {
clearGhost();
}
});
return root;
};
PanelItemButtons.prototype.clearButtons = function() {
Utils.$empty(this._$container);
};
PanelItemButtons.prototype.renderButtons = function() {
var self = this;
var systemButtons = {
applications: function(ev) {
OSjs.Applications.CoreWM.showMenu(ev);
},
settings: function(ev) {
var wm = OSjs.Core.getWindowManager();
if ( wm ) {
wm.showSettings();
}
},
exit: function(ev) {
OSjs.API.signOut();
}
};
this.clearButtons();
(this._settings.get('buttons') || []).forEach(function(btn, idx) {
var menu = [{
title: 'Remove button',
onClick: function() {
self.removeButton(idx);
}
}];
var callback = function() {
API.launch(btn.launch);
};
if ( btn.system ) {
menu = null; //systemMenu;
callback = function(ev) {
ev.stopPropagation();
systemButtons[btn.system](ev);
};
}
self.addButton(btn.title, btn.icon, menu, callback);
});
};
PanelItemButtons.prototype.removeButton = function(index) {
var buttons = this._settings.get('buttons');
buttons.splice(index, 1);
this.renderButtons();
this._settings.save();
};
PanelItemButtons.prototype.createButton = function(appName) {
var pkg = OSjs.Core.getPackageManager().getPackage(appName);
var buttons = this._settings.get('buttons');
buttons.push({
title: appName,
icon: pkg.icon,
launch: appName
});
this.renderButtons();
this._settings.save();
};
PanelItemButtons.prototype.addButton = function(title, icon, menu, callback) {
var sel = document.createElement('li');
sel.title = title;
sel.innerHTML = '<img alt="" src="' + API.getIcon(icon) + '" />';
sel.setAttribute('role', 'button');
sel.setAttribute('aria-label', title);
Utils.$bind(sel, 'mousedown', function(ev) {
ev.preventDefault();
ev.stopPropagation();
});
Utils.$bind(sel, 'click', callback, true);
Utils.$bind(sel, 'contextmenu', function(ev) {
ev.preventDefault();
ev.stopPropagation();
if ( menu ) {
API.createMenu(menu, ev);
}
});
this._$container.appendChild(sel);
};
/////////////////////////////////////////////////////////////////////////////
// EXPORTS
/////////////////////////////////////////////////////////////////////////////
OSjs.Applications = OSjs.Applications || {};
OSjs.Applications.CoreWM = OSjs.Applications.CoreWM || {};
OSjs.Applications.CoreWM.PanelItems = OSjs.Applications.CoreWM.PanelItems || {};
OSjs.Applications.CoreWM.PanelItems.Buttons = PanelItemButtons;
})(OSjs.Applications.CoreWM.Class, OSjs.Applications.CoreWM.Panel, OSjs.Applications.CoreWM.PanelItem, OSjs.Utils, OSjs.API, OSjs.GUI, OSjs.VFS);
| 29.620408 | 145 | 0.592807 |
732da4365c0b10d0c61bcd1c9fd45257808495fd | 262 | js | JavaScript | CMS/CMSScripts/Vendor/jQuery/jquery-1.11.0-amd.js | mzhokh/FilterByCategoryWidget | c6b83215aea4f4df607d070fe4c772bd96ee6a95 | [
"MIT"
] | 26 | 2019-02-26T19:44:44.000Z | 2021-07-19T01:45:37.000Z | CMS/CMSScripts/Vendor/jQuery/jquery-1.11.0-amd.js | mzhokh/FilterByCategoryWidget | c6b83215aea4f4df607d070fe4c772bd96ee6a95 | [
"MIT"
] | 34 | 2018-12-10T09:30:13.000Z | 2020-09-02T11:14:12.000Z | CMS/CMSScripts/Vendor/jQuery/jquery-1.11.0-amd.js | mzhokh/FilterByCategoryWidget | c6b83215aea4f4df607d070fe4c772bd96ee6a95 | [
"MIT"
] | 50 | 2018-12-06T17:32:43.000Z | 2021-11-04T09:48:07.000Z | // This module returns no conflicted version of jQuery.
// The purpose is to permit requiring newest version of jQuery, when
// there are older versions used by legacy code at the same time.
define(['jquery'], function (jq) {
return jq.noConflict(true);
}); | 43.666667 | 68 | 0.732824 |
732da964f01cee36b63f9ed76508a271b1a445f6 | 1,023 | js | JavaScript | routes/public routes/pUserStories.js | goellavish10/eceblog-new | 930a18f3ed3061a88324b54b119ce16395b24305 | [
"MIT"
] | null | null | null | routes/public routes/pUserStories.js | goellavish10/eceblog-new | 930a18f3ed3061a88324b54b119ce16395b24305 | [
"MIT"
] | null | null | null | routes/public routes/pUserStories.js | goellavish10/eceblog-new | 930a18f3ed3061a88324b54b119ce16395b24305 | [
"MIT"
] | null | null | null | const express = require("express");
const router = express.Router();
// Loading Story model for public stories
const Story = require("../../models/Story");
const User = require("../../models/User");
// Route to show the stories posted by a single user
router.get("/user/:userId", async (req, res) => {
try {
const stories = await Story.find({
user: req.params.userId,
status: "public",
})
.populate("user")
.lean();
if (stories.length == 0) {
let user = await User.find({ _id: req.params.userId });
res.send(`<h1>No Stories posted by ${user[0].displayName} </h1>`);
// console.log(user);
} else {
let detail = stories[0].user;
res.render("public/singleUserStory", {
layout: "public",
stories,
headOfPage: `Posts by ${detail.displayName}`,
detail,
});
}
} catch (err) {
console.error(err);
res.render("error/public_error/500");
}
});
module.exports = router;
| 27.648649 | 73 | 0.56696 |
732db55d97a01f306dd686ae5cd810ab22b58975 | 445 | js | JavaScript | rollup.config.js | Brakebein/node-three-gltf | bd4798955b63c32204681fb8e9a221de660aee64 | [
"MIT"
] | 1 | 2022-03-28T20:14:46.000Z | 2022-03-28T20:14:46.000Z | rollup.config.js | Brakebein/node-three-gltf | bd4798955b63c32204681fb8e9a221de660aee64 | [
"MIT"
] | null | null | null | rollup.config.js | Brakebein/node-three-gltf | bd4798955b63c32204681fb8e9a221de660aee64 | [
"MIT"
] | null | null | null | import typescript from '@rollup/plugin-typescript';
import nodeResolve from '@rollup/plugin-node-resolve';
export default {
external: ['draco3dgltf', 'fs/promises', 'jimp', 'jsdom', 'node-fetch', 'path', 'three'],
input: 'src/index.ts',
plugins: [
nodeResolve(),
typescript({
compilerOptions: {
removeComments: true
}
})
],
output: [
{
file: 'build/index.js',
format: 'es'
}
]
};
| 20.227273 | 91 | 0.586517 |
732e4543e327afd5b457e3cd03887c467e630ceb | 1,428 | js | JavaScript | JS-Advanced/UnitTesting/03_RGB_To_Hex/test/rgbToHex_test.js | mk-petrov/JS_study_repo | fa843e1b5967c38fe019fad00b82ab339f826ed4 | [
"MIT"
] | null | null | null | JS-Advanced/UnitTesting/03_RGB_To_Hex/test/rgbToHex_test.js | mk-petrov/JS_study_repo | fa843e1b5967c38fe019fad00b82ab339f826ed4 | [
"MIT"
] | null | null | null | JS-Advanced/UnitTesting/03_RGB_To_Hex/test/rgbToHex_test.js | mk-petrov/JS_study_repo | fa843e1b5967c38fe019fad00b82ab339f826ed4 | [
"MIT"
] | null | null | null | const rgbToHexColor = require('../rgbToHex').rgbToHexColor;
let expect = require('chai').expect;
describe("RGB to Hex Color", () => {
it("Should return #FF9EAA for (255, 158, 170)", ()=> {
expect(rgbToHexColor(255, 158, 170)).to.equal('#FF9EAA');
});
it("Should pad values with zeroes", ()=> {
expect(rgbToHexColor(12, 13, 14)).to.equal('#0C0D0E');
});
it("Should work at lower limit", ()=> {
expect(rgbToHexColor(0, 0, 0)).to.equal('#000000');
});
it("Should work at upper limit", ()=> {
expect(rgbToHexColor(255, 255, 255)).to.equal('#FFFFFF');
});
it("Should return undefined for negative values", ()=> {
expect(rgbToHexColor(-1, -1, -1)).to.be.undefined;
});
it("Should return undefined for values greater than 255", ()=> {
expect(rgbToHexColor(256, 15, 15)).to.be.undefined;
});
it("Should return undefined for values greater than 255", ()=> {
expect(rgbToHexColor(15, 256, 15)).to.be.undefined;
});
it("Should return undefined for values greater than 255", ()=> {
expect(rgbToHexColor(15, 15, 256)).to.be.undefined;
});
it("Should return undefined for fractions", ()=> {
expect(rgbToHexColor(3.14, 2.71, 3.14)).to.be.undefined;
});
it("Should return undefined for invalid data", ()=> {
expect(rgbToHexColor('pesho', {name: 'gosho'}, [])).to.be.undefined;
});
}); | 40.8 | 76 | 0.591036 |
732e5828d666400f08938080afbd99b55eb660a7 | 3,216 | js | JavaScript | src/connectedComponents/FlexboxLayout.js | Do-AI/Viewers | 8914a5fd24f8fafc8707c8c207148e99ef594ed0 | [
"MIT"
] | null | null | null | src/connectedComponents/FlexboxLayout.js | Do-AI/Viewers | 8914a5fd24f8fafc8707c8c207148e99ef594ed0 | [
"MIT"
] | null | null | null | src/connectedComponents/FlexboxLayout.js | Do-AI/Viewers | 8914a5fd24f8fafc8707c8c207148e99ef594ed0 | [
"MIT"
] | 1 | 2019-06-28T04:44:50.000Z | 2019-06-28T04:44:50.000Z | import './FlexboxLayout.css';
import React, { Component } from 'react';
import ConnectedMeasurementTable from './ConnectedMeasurementTable';
import ConnectedStudyBrowser from './ConnectedStudyBrowser.js';
import ConnectedViewerMain from './ConnectedViewerMain.js';
import PropTypes from 'prop-types';
class FlexboxLayout extends Component {
static propTypes = {
studies: PropTypes.array,
leftSidebarOpen: PropTypes.bool.isRequired,
rightSidebarOpen: PropTypes.bool.isRequired,
};
state = {
studiesForBrowser: [],
};
componentDidMount() {
if (this.props.studies) {
const studiesForBrowser = this.getStudiesForBrowser();
this.setState({
studiesForBrowser,
});
}
}
componentDidUpdate(prevProps) {
if (this.props.studies !== prevProps.studies) {
const studiesForBrowser = this.getStudiesForBrowser();
this.setState({
studiesForBrowser,
});
}
}
getStudiesForBrowser = () => {
const { studies } = this.props;
// TODO[react]:
// - Add sorting of display sets
// - Add useMiddleSeriesInstanceAsThumbnail
// - Add showStackLoadingProgressBar option
return studies.map(study => {
const { studyInstanceUid } = study;
const thumbnails = study.displaySets.map(displaySet => {
const {
displaySetInstanceUid,
seriesDescription,
seriesNumber,
instanceNumber,
numImageFrames,
// TODO: This is undefined
// modality,
} = displaySet;
let imageId;
let altImageText = ' '; // modality
if (displaySet.images && displaySet.images.length) {
imageId = displaySet.images[0].getImageId();
} else {
altImageText = 'SR';
}
return {
imageId,
altImageText,
displaySetInstanceUid,
seriesDescription,
seriesNumber,
instanceNumber,
numImageFrames,
};
});
return {
studyInstanceUid,
thumbnails,
};
});
};
render() {
let mainContentClassName = 'main-content';
if (this.props.leftSidebarOpen) {
mainContentClassName += ' sidebar-left-open';
}
if (this.props.rightSidebarOpen) {
mainContentClassName += ' sidebar-right-open';
}
// TODO[react]: Make ConnectedMeasurementTable extension with state.timepointManager
return (
<div className="FlexboxLayout">
<div
className={
this.props.leftSidebarOpen
? 'sidebar-menu sidebar-left sidebar-open'
: 'sidebar-menu sidebar-left'
}
>
<ConnectedStudyBrowser studies={this.state.studiesForBrowser} />
</div>
<div className={mainContentClassName}>
<ConnectedViewerMain studies={this.props.studies} />
</div>
<div
className={
this.props.rightSidebarOpen
? 'sidebar-menu sidebar-right sidebar-open'
: 'sidebar-menu sidebar-right'
}
>
<ConnectedMeasurementTable />
</div>
</div>
);
}
}
export default FlexboxLayout;
| 24.930233 | 88 | 0.596393 |
732e5b384b1562b3f4175422064f5025e4447af5 | 1,015 | js | JavaScript | src/Pages/HireTguidePage/HireTguidePage.js | Charbel-t/Discover-North-Lebanon-website | b8a4f41e494135ec89f7e62bae4ed3f860eea700 | [
"MIT"
] | null | null | null | src/Pages/HireTguidePage/HireTguidePage.js | Charbel-t/Discover-North-Lebanon-website | b8a4f41e494135ec89f7e62bae4ed3f860eea700 | [
"MIT"
] | null | null | null | src/Pages/HireTguidePage/HireTguidePage.js | Charbel-t/Discover-North-Lebanon-website | b8a4f41e494135ec89f7e62bae4ed3f860eea700 | [
"MIT"
] | null | null | null | import React from 'react';
import './HireTguidePage.css';
import HireMeForm from '../../Components/HireMeForm/HireMeForm.js';
import citiesData from '../../MockData/cities.json';
import { PageHeader } from 'antd';
import { useParams } from 'react-router-dom';
export default function HireTguidePage({
Tguide_email = 'gtour180@gmail.com',
}) {
let { name } = useParams();
return (
<div className="hire-me-cont">
<PageHeader
className="site-page-header"
onBack={() => window.history.back()}
title="Back"
/>
<div
data-aos="fade-down"
className="info"
data-aos-offset="500"
data-aos-duration="500"
>
<div className="hire-me-divs">
<div className="hire-me-divs-child">
<HireMeForm
citiesArray={citiesData}
Tguide_email={Tguide_email}
Tguide_name={name}
name={name}
/>
</div>
</div>
</div>
</div>
);
}
| 26.025641 | 67 | 0.557635 |
732ee0770f049d1dbab9aab9a3e44b347afaa448 | 882 | js | JavaScript | src/components/typewriter.js | corgidevs/gabygh | 178caaf7730b48ca2aabd537f62cfbe902464bb0 | [
"MIT"
] | null | null | null | src/components/typewriter.js | corgidevs/gabygh | 178caaf7730b48ca2aabd537f62cfbe902464bb0 | [
"MIT"
] | null | null | null | src/components/typewriter.js | corgidevs/gabygh | 178caaf7730b48ca2aabd537f62cfbe902464bb0 | [
"MIT"
] | 1 | 2019-08-11T06:17:08.000Z | 2019-08-11T06:17:08.000Z | import React from 'react'
import { useState, useEffect, useRef } from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import useTypewriter from 'react-typewriter-hook'
let index = 0;
const TypeWriter = () => {
const data = useStaticQuery(graphql`
query {
site {
siteMetadata {
phrases
}
}
}
`)
const [typing, setTyping] = useState("");
const intervalRef = useRef({});
const name = useTypewriter(typing);
useEffect(
() => {
intervalRef.current = setInterval(() => {
index = index > 2 ? 0 : ++index;
setTyping(data.site.siteMetadata.phrases[index]);
}, 3000);
return function clear() {
clearInterval(intervalRef.current);
};
},
[typing]
);
return (
<div className="landing-text">
<h1>{name}</h1>
</div>
)
}
export default TypeWriter
| 21 | 57 | 0.585034 |
732eef022e045d25c1030b52da76e4dd94ad516e | 1,664 | js | JavaScript | src/FakeConsole.js | Julian-Alberts/Brainfuck-Interpreter | 8679f894a6b307a1feddd0f39abcee54f2fa13b4 | [
"MIT"
] | null | null | null | src/FakeConsole.js | Julian-Alberts/Brainfuck-Interpreter | 8679f894a6b307a1feddd0f39abcee54f2fa13b4 | [
"MIT"
] | null | null | null | src/FakeConsole.js | Julian-Alberts/Brainfuck-Interpreter | 8679f894a6b307a1feddd0f39abcee54f2fa13b4 | [
"MIT"
] | null | null | null | class FakeConsole {
/**
*
* @param {HTMLDivElement} console
*/
constructor(console) {
this.console = console;
this._stdin = '';
this._stdoutLine = document.createElement('pre');
this.console.appendChild(this._stdoutLine);
this.onRead = (_) => {};
this.console.addEventListener('keydown', ev => this._keyDown(ev));
}
/**
*
* @param {string} string
*/
writeToSTDOut(string) {
const lines = string.split('\n');
lines.forEach((line, index) => {
if (index === lines.length - 1) {
this._stdoutLine.innerText += line;
} else {
this._stdoutLine.innerText += line;
this._stdoutLine = document.createElement('pre');
this.console.appendChild(this._stdoutLine);
}
});
}
/**
*
* @param {KeyboardEvent} ev
*/
_keyDown(ev) {
const key = ev.key;
if (key.length > 1) {
switch(key) {
case 'Enter':
this.writeToSTDOut('\n')
this.onRead(this._stdin + '\n');
this._stdin = '';
break;
case 'Backspace':
if (this._stdoutLine.innerText === this._stdin) {
this._stdin = this._stdin.slice(0, -1);
this._stdoutLine.innerText = this._stdin;
}
break;
}
} else {
this._stdin += key;
this._stdoutLine.innerText = this._stdin;
}
}
}
| 27.733333 | 74 | 0.451923 |
732efcf3b8132d5b70fc9d8f85411c973f1f5c16 | 564 | js | JavaScript | docs/src/pages/components/index.js | srinivasdamam/evergreen | 5fa2a3ad5189cb5b802ba80d2de46c7ddcae52c1 | [
"MIT"
] | 3 | 2018-10-11T18:33:32.000Z | 2020-07-31T09:07:49.000Z | docs/src/pages/components/index.js | srinivasdamam/evergreen | 5fa2a3ad5189cb5b802ba80d2de46c7ddcae52c1 | [
"MIT"
] | 18 | 2021-04-16T02:54:15.000Z | 2022-01-12T19:56:15.000Z | docs/src/pages/components/index.js | srinivasdamam/evergreen | 5fa2a3ad5189cb5b802ba80d2de46c7ddcae52c1 | [
"MIT"
] | 1 | 2019-01-05T17:07:14.000Z | 2019-01-05T17:07:14.000Z | import React from 'react'
import Helmet from 'react-helmet'
import TopBar from '../../components/TopBar'
import IA from '../../IA'
import Overview from '../../components/Overview'
import Layout from '../../components/Layout'
import PageFooter from '../../components/PageFooter'
export default () => {
return (
<Layout>
<Helmet>
<title>Components · Evergreen</title>
</Helmet>
<div>
<TopBar />
<main tabIndex={-1}>
<Overview ia={IA} />
</main>
</div>
<PageFooter />
</Layout>
)
}
| 22.56 | 52 | 0.574468 |
732fd94227f39ebc2e8786f517c64bb63ba71df4 | 5,350 | js | JavaScript | external/GLM/doc/api/search/functions_1.js | IKholopov/TierGine | 1a3c7cd2bed460af672d7cd5c33d7e7863043989 | [
"Apache-2.0"
] | 132 | 2019-12-06T23:11:08.000Z | 2022-03-05T06:38:33.000Z | external/GLM/doc/api/search/functions_1.js | IKholopov/TierGine | 1a3c7cd2bed460af672d7cd5c33d7e7863043989 | [
"Apache-2.0"
] | 9 | 2019-07-03T12:31:39.000Z | 2019-07-05T14:30:59.000Z | external/GLM/doc/api/search/functions_1.js | IKholopov/TierGine | 1a3c7cd2bed460af672d7cd5c33d7e7863043989 | [
"Apache-2.0"
] | 36 | 2019-12-10T19:43:28.000Z | 2021-10-30T09:39:02.000Z | var searchData=
[
['backeasein',['backEaseIn',['../a00735.html#ga93cddcdb6347a44d5927cc2bf2570816',1,'glm::backEaseIn(genType const &a)'],['../a00735.html#ga33777c9dd98f61d9472f96aafdf2bd36',1,'glm::backEaseIn(genType const &a, genType const &o)']]],
['backeaseinout',['backEaseInOut',['../a00735.html#gace6d24722a2f6722b56398206eb810bb',1,'glm::backEaseInOut(genType const &a)'],['../a00735.html#ga68a7b760f2afdfab298d5cd6d7611fb1',1,'glm::backEaseInOut(genType const &a, genType const &o)']]],
['backeaseout',['backEaseOut',['../a00735.html#gabf25069fa906413c858fd46903d520b9',1,'glm::backEaseOut(genType const &a)'],['../a00735.html#ga640c1ac6fe9d277a197da69daf60ee4f',1,'glm::backEaseOut(genType const &a, genType const &o)']]],
['ballrand',['ballRand',['../a00717.html#ga7c53b7797f3147af68a11c767679fa3f',1,'glm']]],
['bitcount',['bitCount',['../a00787.html#ga44abfe3379e11cbd29425a843420d0d6',1,'glm::bitCount(genType v)'],['../a00787.html#gaac7b15e40bdea8d9aa4c4cb34049f7b5',1,'glm::bitCount(vec< L, T, Q > const &v)']]],
['bitfielddeinterleave',['bitfieldDeinterleave',['../a00706.html#ga091d934233a2e121df91b8c7230357c8',1,'glm::bitfieldDeinterleave(glm::uint16 x)'],['../a00706.html#ga7d1cc24dfbcdd932c3a2abbb76235f98',1,'glm::bitfieldDeinterleave(glm::uint32 x)'],['../a00706.html#ga8dbb8c87092f33bd815dd8a840be5d60',1,'glm::bitfieldDeinterleave(glm::uint64 x)']]],
['bitfieldextract',['bitfieldExtract',['../a00787.html#ga346b25ab11e793e91a4a69c8aa6819f2',1,'glm']]],
['bitfieldfillone',['bitfieldFillOne',['../a00706.html#ga46f9295abe3b5c7658f5b13c7f819f0a',1,'glm::bitfieldFillOne(genIUType Value, int FirstBit, int BitCount)'],['../a00706.html#ga3e96dd1f0a4bc892f063251ed118c0c1',1,'glm::bitfieldFillOne(vec< L, T, Q > const &Value, int FirstBit, int BitCount)']]],
['bitfieldfillzero',['bitfieldFillZero',['../a00706.html#ga697b86998b7d74ee0a69d8e9f8819fee',1,'glm::bitfieldFillZero(genIUType Value, int FirstBit, int BitCount)'],['../a00706.html#ga0d16c9acef4be79ea9b47c082a0cf7c2',1,'glm::bitfieldFillZero(vec< L, T, Q > const &Value, int FirstBit, int BitCount)']]],
['bitfieldinsert',['bitfieldInsert',['../a00787.html#ga2e82992340d421fadb61a473df699b20',1,'glm']]],
['bitfieldinterleave',['bitfieldInterleave',['../a00706.html#ga24cad0069f9a0450abd80b3e89501adf',1,'glm::bitfieldInterleave(int8 x, int8 y)'],['../a00706.html#ga9a4976a529aec2cee56525e1165da484',1,'glm::bitfieldInterleave(uint8 x, uint8 y)'],['../a00706.html#ga4a76bbca39c40153f3203d0a1926e142',1,'glm::bitfieldInterleave(u8vec2 const &v)'],['../a00706.html#gac51c33a394593f0631fa3aa5bb778809',1,'glm::bitfieldInterleave(int16 x, int16 y)'],['../a00706.html#ga94f3646a5667f4be56f8dcf3310e963f',1,'glm::bitfieldInterleave(uint16 x, uint16 y)'],['../a00706.html#ga406c4ee56af4ca37a73f449f154eca3e',1,'glm::bitfieldInterleave(u16vec2 const &v)'],['../a00706.html#gaebb756a24a0784e3d6fba8bd011ab77a',1,'glm::bitfieldInterleave(int32 x, int32 y)'],['../a00706.html#ga2f1e2b3fe699e7d897ae38b2115ddcbd',1,'glm::bitfieldInterleave(uint32 x, uint32 y)'],['../a00706.html#ga8cb17574d60abd6ade84bc57c10e8f78',1,'glm::bitfieldInterleave(u32vec2 const &v)'],['../a00706.html#ga8fdb724dccd4a07d57efc01147102137',1,'glm::bitfieldInterleave(int8 x, int8 y, int8 z)'],['../a00706.html#ga9fc2a0dd5dcf8b00e113f272a5feca93',1,'glm::bitfieldInterleave(uint8 x, uint8 y, uint8 z)'],['../a00706.html#gaa901c36a842fa5d126ea650549f17b24',1,'glm::bitfieldInterleave(int16 x, int16 y, int16 z)'],['../a00706.html#ga3afd6d38881fe3948c53d4214d2197fd',1,'glm::bitfieldInterleave(uint16 x, uint16 y, uint16 z)'],['../a00706.html#gad2075d96a6640121edaa98ea534102ca',1,'glm::bitfieldInterleave(int32 x, int32 y, int32 z)'],['../a00706.html#gab19fbc739fc0cf7247978602c36f7da8',1,'glm::bitfieldInterleave(uint32 x, uint32 y, uint32 z)'],['../a00706.html#ga8a44ae22f5c953b296c42d067dccbe6d',1,'glm::bitfieldInterleave(int8 x, int8 y, int8 z, int8 w)'],['../a00706.html#ga14bb274d54a3c26f4919dd7ed0dd0c36',1,'glm::bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w)'],['../a00706.html#ga180a63161e1319fbd5a53c84d0429c7a',1,'glm::bitfieldInterleave(int16 x, int16 y, int16 z, int16 w)'],['../a00706.html#gafca8768671a14c8016facccb66a89f26',1,'glm::bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w)']]],
['bitfieldreverse',['bitfieldReverse',['../a00787.html#ga750a1d92464489b7711dee67aa3441b6',1,'glm']]],
['bitfieldrotateleft',['bitfieldRotateLeft',['../a00706.html#ga2eb49678a344ce1495bdb5586d9896b9',1,'glm::bitfieldRotateLeft(genIUType In, int Shift)'],['../a00706.html#gae186317091b1a39214ebf79008d44a1e',1,'glm::bitfieldRotateLeft(vec< L, T, Q > const &In, int Shift)']]],
['bitfieldrotateright',['bitfieldRotateRight',['../a00706.html#ga1c33d075c5fb8bd8dbfd5092bfc851ca',1,'glm::bitfieldRotateRight(genIUType In, int Shift)'],['../a00706.html#ga590488e1fc00a6cfe5d3bcaf93fbfe88',1,'glm::bitfieldRotateRight(vec< L, T, Q > const &In, int Shift)']]],
['bounceeasein',['bounceEaseIn',['../a00735.html#gaac30767f2e430b0c3fc859a4d59c7b5b',1,'glm']]],
['bounceeaseinout',['bounceEaseInOut',['../a00735.html#gadf9f38eff1e5f4c2fa5b629a25ae413e',1,'glm']]],
['bounceeaseout',['bounceEaseOut',['../a00735.html#ga94007005ff0dcfa0749ebfa2aec540b2',1,'glm']]]
];
| 254.761905 | 2,090 | 0.758879 |
7330bf84869ce62f9e3eb3a8c682a8fd15d61743 | 1,177 | js | JavaScript | src/modules/checkout/store/actions.js | levanthieu97/drivy-front-end-cust | c6dae46855a82b9fb138abe680e81adc2d38d360 | [
"MIT"
] | null | null | null | src/modules/checkout/store/actions.js | levanthieu97/drivy-front-end-cust | c6dae46855a82b9fb138abe680e81adc2d38d360 | [
"MIT"
] | null | null | null | src/modules/checkout/store/actions.js | levanthieu97/drivy-front-end-cust | c6dae46855a82b9fb138abe680e81adc2d38d360 | [
"MIT"
] | null | null | null | import checkOutService from './service';
const service = new checkOutService();
export const insertAddress = async (dispatch, param) => {
const result = await service.createAddress(param);
return result;
};
export const getCity = async (dispatch, param) => {
const result = await service.getListCity(param);
return result;
};
export const updateOrderUser = async (dispatch, param) => {
const result = await service.updateOrder(param);
return result;
};
export const renewOrders = async (dispatch, param) => {
const result = await service.renewOrderForUser(param);
return result;
};
export const createPaymentForUser = async (dispatch, param) => {
const result = await service.createPayment(param);
return result;
};
export const updateProduct = async (dispatch, param) => {
const result = await service.updateQuantityProduct(param);
return result;
};
export const updateProductDetail = async (dispatch, param) => {
const result = await service.updateQuantityProductDetail(param);
return result;
};
export const addPaymentSuppliers = async (dispatch, param) => {
const result = await service.addPaymentSupplier(param);
return result;
};
| 26.75 | 66 | 0.73237 |
73316d35dcbc268ffa5684a5c4fcd34d1b3cf8be | 524 | js | JavaScript | scripts/views/error-view.js | KJBook-org/book-list-client | bee389e9c172f45cc644026e91500b4905f6ddcb | [
"MIT"
] | null | null | null | scripts/views/error-view.js | KJBook-org/book-list-client | bee389e9c172f45cc644026e91500b4905f6ddcb | [
"MIT"
] | null | null | null | scripts/views/error-view.js | KJBook-org/book-list-client | bee389e9c172f45cc644026e91500b4905f6ddcb | [
"MIT"
] | null | null | null | 'use strict';
var app = app || {};
( function ( module ) {
const errorView = {};
errorView.initErrorPage = function ( err ) {
$( '.container' ).hide();
app.showOnly( '#error-view' );
$( '#error-message' ).empty();
let errorTemplate = app.render( 'error-template', err );
$( '#error-message' ).append( errorTemplate );
}
errorView.errorCallback = function ( err ) {
console.log( err );
errorView.initErrorPage( err );
}
module.errorView = errorView;
} )( app ); | 24.952381 | 61 | 0.570611 |
7331cc6f762dcfe0daeba03566f945a8278ac146 | 4,715 | js | JavaScript | dist/logger/logger-sass.js | powwowinc/ionic-app-scripts-tiny | 2660e216c01c83b13ee9b9e34a51192e0acbd754 | [
"MIT"
] | null | null | null | dist/logger/logger-sass.js | powwowinc/ionic-app-scripts-tiny | 2660e216c01c83b13ee9b9e34a51192e0acbd754 | [
"MIT"
] | 1 | 2019-12-06T00:56:40.000Z | 2019-12-06T00:56:40.000Z | dist/logger/logger-sass.js | powwowinc/ionic-app-scripts-tiny | 2660e216c01c83b13ee9b9e34a51192e0acbd754 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = require("fs");
var highlight_1 = require("../highlight/highlight");
var helpers_1 = require("../util/helpers");
var logger_1 = require("./logger");
function runSassDiagnostics(context, sassError) {
if (!sassError) {
return [];
}
var d = {
level: 'error',
type: 'sass',
language: 'scss',
header: 'sass error',
code: sassError.status && sassError.status.toString(),
relFileName: null,
absFileName: null,
messageText: sassError.message,
lines: []
};
if (sassError.file) {
d.absFileName = sassError.file;
d.relFileName = logger_1.Logger.formatFileName(context.rootDir, d.absFileName);
d.header = logger_1.Logger.formatHeader('sass', d.absFileName, context.rootDir, sassError.line);
if (sassError.line > -1) {
try {
var sourceText = fs_1.readFileSync(d.absFileName, 'utf8');
var srcLines = helpers_1.splitLineBreaks(sourceText);
var htmlLines = srcLines;
try {
htmlLines = helpers_1.splitLineBreaks(highlight_1.highlight(d.language, sourceText, true).value);
}
catch (e) { }
var errorLine = {
lineIndex: sassError.line - 1,
lineNumber: sassError.line,
text: srcLines[sassError.line - 1],
html: htmlLines[sassError.line - 1],
errorCharStart: sassError.column,
errorLength: 0
};
if (errorLine.html.indexOf('class="hljs') === -1) {
try {
errorLine.html = highlight_1.highlight(d.language, errorLine.text, true).value;
}
catch (e) { }
}
for (var i = errorLine.errorCharStart; i >= 0; i--) {
if (STOP_CHARS.indexOf(errorLine.text.charAt(i)) > -1) {
break;
}
errorLine.errorCharStart = i;
}
for (var j = errorLine.errorCharStart; j <= errorLine.text.length; j++) {
if (STOP_CHARS.indexOf(errorLine.text.charAt(j)) > -1) {
break;
}
errorLine.errorLength++;
}
if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
errorLine.errorLength = 1;
errorLine.errorCharStart--;
}
d.lines.push(errorLine);
if (errorLine.lineIndex > 0) {
var previousLine = {
lineIndex: errorLine.lineIndex - 1,
lineNumber: errorLine.lineNumber - 1,
text: srcLines[errorLine.lineIndex - 1],
html: htmlLines[errorLine.lineIndex - 1],
errorCharStart: -1,
errorLength: -1
};
if (previousLine.html.indexOf('class="hljs') === -1) {
try {
previousLine.html = highlight_1.highlight(d.language, previousLine.text, true).value;
}
catch (e) { }
}
d.lines.unshift(previousLine);
}
if (errorLine.lineIndex + 1 < srcLines.length) {
var nextLine = {
lineIndex: errorLine.lineIndex + 1,
lineNumber: errorLine.lineNumber + 1,
text: srcLines[errorLine.lineIndex + 1],
html: htmlLines[errorLine.lineIndex + 1],
errorCharStart: -1,
errorLength: -1
};
if (nextLine.html.indexOf('class="hljs') === -1) {
try {
nextLine.html = highlight_1.highlight(d.language, nextLine.text, true).value;
}
catch (e) { }
}
d.lines.push(nextLine);
}
}
catch (e) {
logger_1.Logger.debug("sass loadDiagnostic, " + e);
}
}
}
return [d];
}
exports.runSassDiagnostics = runSassDiagnostics;
var STOP_CHARS = ['', '\n', '\r', '\t', ' ', ':', ';', ',', '{', '}', '.', '#', '@', '!', '[', ']', '(', ')', '&', '+', '~', '^', '*', '$'];
| 42.863636 | 140 | 0.447296 |
7331f0eef80c381a61e60d16cd197386d11b8cce | 1,283 | js | JavaScript | src/components/routes/Home.js | kjmcneese/marrying-mcneese | 8a659824970f89c1005303e3540d1c1ce548af62 | [
"MIT"
] | null | null | null | src/components/routes/Home.js | kjmcneese/marrying-mcneese | 8a659824970f89c1005303e3540d1c1ce548af62 | [
"MIT"
] | 18 | 2020-09-25T21:13:13.000Z | 2020-10-27T21:16:51.000Z | src/components/routes/Home.js | kjmcneese/marrying-mcneese | 8a659824970f89c1005303e3540d1c1ce548af62 | [
"MIT"
] | null | null | null | import React from 'react';
import CustomCarousel from './home/CustomCarousel';
import HomeSection from './home/HomeSection';
import weddingSectionImage from '../../images/homepage/Lauren and Kyle _ Madison WI Engagement-103_Cropped.jpg';
import venueSectionImage from '../../images/homepage/tinsmith_Cropped.jpg';
import scheduleSectionImage from '../../images/homepage/Lauren and Kyle _ Madison WI Engagement-151_Cropped.jpg';
import vendorsSectionImage from '../../images/homepage/Lauren and Kyle _ Madison WI Engagement-197_Cropped.jpg';
class Home extends React.Component {
getHomeSections() {
if (this.props.appDataExists) {
const sectionImages = [ weddingSectionImage, venueSectionImage, scheduleSectionImage, vendorsSectionImage ];
return this.props.appData.homeSectionTitles.map( (homeSectionTitle, index) =>
<HomeSection appData={ this.props.appData } sectionTitle={ homeSectionTitle } sectionIndex={ index } sectionImage={ sectionImages[index] } key={ homeSectionTitle } />
);
}
return [];
}
render() {
return (
<div>
<CustomCarousel hashtag={ this.props.appData.hashtag } weddingDate={ this.props.appData.weddingDate }/>
{ this.getHomeSections() }
</div>
);
}
}
export default Home; | 37.735294 | 174 | 0.720187 |
7332aa157e6e7ef8152028838bdaaf857669f60f | 13,848 | js | JavaScript | lib/pipeline.js | tisunov/zombie | 4d33a24b458d143fe5b46f95028dce8fb0212629 | [
"MIT"
] | null | null | null | lib/pipeline.js | tisunov/zombie | 4d33a24b458d143fe5b46f95028dce8fb0212629 | [
"MIT"
] | null | null | null | lib/pipeline.js | tisunov/zombie | 4d33a24b458d143fe5b46f95028dce8fb0212629 | [
"MIT"
] | null | null | null | 'use strict';
var _get = require('babel-runtime/helpers/get')['default'];
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _createClass = require('babel-runtime/helpers/create-class')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _getIterator = require('babel-runtime/core-js/get-iterator')['default'];
var _Promise = require('babel-runtime/core-js/promise')['default'];
var _ = require('lodash');
var assert = require('assert');
var Bluebird = require('bluebird');
var Fetch = require('./fetch');
var File = require('fs');
var _require = require('./fetch');
var Headers = _require.Headers;
var _require2 = require('util');
var isArray = _require2.isArray;
var Path = require('path');
var Request = require('request');
var resourceLoader = require('jsdom/lib/jsdom/browser/resource-loader');
var URL = require('url');
var Utils = require('jsdom/lib/jsdom/utils');
// Pipeline is sequence of request/response handlers that are used to prepare a
// request, make the request, and process the response.
var Pipeline = (function (_Array) {
_inherits(Pipeline, _Array);
function Pipeline(browser) {
_classCallCheck(this, Pipeline);
_get(Object.getPrototypeOf(Pipeline.prototype), 'constructor', this).call(this);
this._browser = browser;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = _getIterator(Pipeline._default), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var handler = _step.value;
this.push(handler);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator['return']) {
_iterator['return']();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
// The default pipeline. All new pipelines are instantiated with this set of
// handlers.
_createClass(Pipeline, [{
key: '_fetch',
value: function _fetch(input, init) {
var request = new Fetch.Request(input, init);
var browser = this._browser;
browser.emit('request', request);
return this._runPipeline(request).then(function (response) {
response.time = Date.now();
response.request = request;
browser.emit('response', request, response);
return response;
})['catch'](function (error) {
browser._debug('Resource error', error.stack);
throw new TypeError(error.message);
});
}
}, {
key: '_runPipeline',
value: function _runPipeline(request) {
var _this = this;
return this._getOriginalResponse(request).then(function (response) {
return _this._prepareResponse(request, response);
});
}
}, {
key: '_getOriginalResponse',
value: function _getOriginalResponse(request) {
var browser = this._browser;
var requestHandlers = this.getRequestHandlers().concat(Pipeline.makeHTTPRequest);
return Bluebird.reduce(requestHandlers, function (lastResponse, requestHandler) {
return lastResponse || requestHandler(browser, request);
}, null).then(function (response) {
assert(response && response.hasOwnProperty('statusText'), 'Request handler must return a response');
return response;
});
}
}, {
key: '_prepareResponse',
value: function _prepareResponse(request, originalResponse) {
var browser = this._browser;
var responseHandlers = this.getResponseHandlers();
return Bluebird.reduce(responseHandlers, function (lastResponse, responseHandler) {
return responseHandler(browser, request, lastResponse);
}, originalResponse).then(function (response) {
assert(response && response.hasOwnProperty('statusText'), 'Response handler must return a response');
return response;
});
}
// -- Handlers --
// Add a request or response handler. This handler will only be used by this
// pipeline instance (browser).
}, {
key: 'addHandler',
value: function addHandler(handler) {
assert(handler.call, 'Handler must be a function');
assert(handler.length === 2 || handler.length === 3, 'Handler function takes 2 (request handler) or 3 (reponse handler) arguments');
this.push(handler);
}
// Remove a request or response handler.
}, {
key: 'removeHandler',
value: function removeHandler(handler) {
assert(handler.call, 'Handler must be a function');
var index = this.indexOf(handler);
if (index > -1) {
this.splice(index, 1);
}
}
// Add a request or response handler. This handler will be used by any new
// pipeline instance (browser).
}, {
key: 'getRequestHandlers',
// Get array of request handlers
value: function getRequestHandlers() {
// N.B. inheriting from an Array is slightly broken, so just iterate manually
var result = [];
for (var i = 0; i < this.length; i++) {
if (this[i].length === 2) result.push(this[i]);
}return result;
}
// Get array of request handlers
}, {
key: 'getResponseHandlers',
value: function getResponseHandlers() {
// N.B. inheriting from an Array is slightly broken, so just iterate manually
var result = [];
for (var i = 0; i < this.length; i++) {
if (this[i].length === 3) result.push(this[i]);
}return result;
}
// -- Prepare request --
// This handler normalizes the request URL.
//
// It turns relative URLs into absolute URLs based on the current document URL
// or base element, or if no document open, based on browser.site property.
}], [{
key: 'addHandler',
value: function addHandler(handler) {
assert(handler.call, 'Handler must be a function');
assert(handler.length === 2 || handler.length === 3, 'Handler function takes 2 (request handler) or 3 (response handler) arguments');
this._default.push(handler);
}
// Remove a request or response handler.
}, {
key: 'removeHandler',
value: function removeHandler(handler) {
assert(handler.call, 'Handler must be a function');
var index = this._default.indexOf(handler);
if (index > -1) {
this._default.splice(index, 1);
}
}
}, {
key: 'normalizeURL',
value: function normalizeURL(browser, request) {
if (browser.document)
// Resolve URL relative to document URL/base, or for new browser, using
// Browser.site
request.url = resourceLoader.resolveResourceUrl(browser.document, request.url);else request.url = Utils.resolveHref(browser.site || 'http://localhost', request.url);
}
// This handler mergers request headers.
//
// It combines headers provided in the request with custom headers defined by
// the browser (user agent, authentication, etc).
//
// It also normalizes all headers by down-casing the header names.
}, {
key: 'mergeHeaders',
value: function mergeHeaders(browser, request) {
if (browser.headers) _.each(browser.headers, function (value, name) {
request.headers.append(name, browser.headers[name]);
});
if (!request.headers.has('User-Agent')) request.headers.set('User-Agent', browser.userAgent);
// Always pass Host: from request URL
var _URL$parse = URL.parse(request.url);
var host = _URL$parse.host;
request.headers.set('Host', host);
// HTTP Basic authentication
var authenticate = { host: host, username: null, password: null };
browser.emit('authenticate', authenticate);
var username = authenticate.username;
var password = authenticate.password;
if (username && password) {
browser.log('Authenticating as ' + username + ':' + password);
var base64 = new Buffer(username + ':' + password).toString('base64');
request.headers.set('authorization', 'Basic ' + base64);
}
}
// -- Retrieve actual resource --
// Used to perform HTTP request (also supports file: resources). This is always
// the last request handler.
}, {
key: 'makeHTTPRequest',
value: function makeHTTPRequest(browser, request) {
var url = request.url;
var _URL$parse2 = URL.parse(url);
var protocol = _URL$parse2.protocol;
var hostname = _URL$parse2.hostname;
var pathname = _URL$parse2.pathname;
if (protocol === 'file:') {
// If the request is for a file:// descriptor, just open directly from the
// file system rather than getting node's http (which handles file://
// poorly) involved.
if (request.method !== 'GET') return new Fetch.Response('', { url: url, status: 405 });
var filename = Path.normalize(decodeURI(pathname));
var exists = File.existsSync(filename);
if (exists) {
var stream = File.createReadStream(filename);
return new Fetch.Response(stream, { url: url, status: 200 });
} else return new Fetch.Response('', { url: url, status: 404 });
}
// We're going to use cookies later when receiving response.
var cookies = browser.cookies;
var cookieHeader = cookies.serialize(hostname, pathname);
if (cookieHeader) request.headers.append('Cookie', cookieHeader);
var consumeBody = /^POST|PUT/.test(request.method) && request._consume() || _Promise.resolve(null);
return consumeBody.then(function (body) {
var httpRequest = new Request({
method: request.method,
uri: request.url,
headers: request.headers.toObject(),
proxy: browser.proxy,
body: body,
jar: false,
followRedirect: false,
strictSSL: browser.strictSSL,
localAddress: browser.localAddress || 0
});
return new _Promise(function (resolve, reject) {
httpRequest.on('response', function (response) {
// Request returns an object where property name is header name,
// property value is either header value, or an array if header sent
// multiple times (e.g. `Set-Cookie`).
var arrayOfHeaders = _.reduce(response.headers, function (headers, value, name) {
if (isArray(value)) {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = _getIterator(value), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var item = _step2.value;
headers.push([name, item]);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2['return']) {
_iterator2['return']();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
} else headers.push([name, value]);
return headers;
}, []);
resolve(new Fetch.Response(response, {
url: request.url,
status: response.statusCode,
headers: new Headers(arrayOfHeaders)
}));
}).on('error', reject);
});
});
}
// -- Handle response --
}, {
key: 'handleHeaders',
value: function handleHeaders(browser, request, response) {
response.headers = new Headers(response.headers);
return response;
}
}, {
key: 'handleCookies',
value: function handleCookies(browser, request, response) {
// Set cookies from response: call update() with array of headers
var _URL$parse3 = URL.parse(request.url);
var hostname = _URL$parse3.hostname;
var pathname = _URL$parse3.pathname;
var newCookies = response.headers.getAll('Set-Cookie');
browser.cookies.update(newCookies, hostname, pathname);
return response;
}
}, {
key: 'handleRedirect',
value: function handleRedirect(browser, request, response) {
var status = response.status;
if (status === 301 || status === 302 || status === 303 || status === 307 || status === 308) {
if (request.redirect === 'error') return Fetch.Response.error();
var _location = response.headers.get('Location');
if (_location === null) return response;
if (request._redirectCount >= 20) return Fetch.Response.error();
browser.emit('redirect', request, response, _location);
++request._redirectCount;
if (status !== 307) {
request.method = 'GET';
request.headers['delete']('Content-Type');
request.headers['delete']('Content-Length');
request.headers['delete']('Content-Transfer-Encoding');
}
// This request is referer for next
request.headers.set('Referer', request.url);
request.url = Utils.resolveHref(request.url, _location);
return browser.pipeline._runPipeline(request);
} else return response;
}
}]);
return Pipeline;
})(Array);
Pipeline._default = [Pipeline.normalizeURL, Pipeline.mergeHeaders, Pipeline.handleHeaders, Pipeline.handleCookies, Pipeline.handleRedirect];
module.exports = Pipeline;
//# sourceMappingURL=pipeline.js.map
| 34.706767 | 173 | 0.620667 |
7332e24caf971a4455374976f74e2bb6cdca49a1 | 3,483 | js | JavaScript | web/themes/custom/businessplus/js/init/slider-revolution-internal-banner-init.js | AdvisorNet/adproclientd8 | ea14a1949622251305ddf6376c380c30b76fedb4 | [
"MIT"
] | null | null | null | web/themes/custom/businessplus/js/init/slider-revolution-internal-banner-init.js | AdvisorNet/adproclientd8 | ea14a1949622251305ddf6376c380c30b76fedb4 | [
"MIT"
] | 1 | 2019-11-03T00:08:42.000Z | 2019-11-03T00:08:42.000Z | web/themes/custom/businessplus/js/init/slider-revolution-internal-banner-init.js | AdvisorNet/adproclientd8 | ea14a1949622251305ddf6376c380c30b76fedb4 | [
"MIT"
] | 1 | 2019-11-03T01:31:13.000Z | 2019-11-03T01:31:13.000Z | (function ($, Drupal, drupalSettings) {
Drupal.behaviors.mtSliderRevolutionInternalBanner = {
attach: function (context, settings) {
if (drupalSettings.businessplus.sliderRevolutionInternalBannerInit.slideshowInternalBannerNavigationStyle == "bullets") {
var bulletsEnable = true,
tabsEnable = false;
} else {
var tabsEnable = true,
bulletsEnable = false;
}
$(context).find('.slideshow-internal .rev_slider').once('mtSliderRevolutionInternalBannerInit').show().revolution({
sliderType:"standard",
sliderLayout:"auto",
gridwidth: [1170,970,750,450],
gridheight: drupalSettings.businessplus.sliderRevolutionInternalBannerInit.slideshowInternalBannerInitialHeight,
delay: drupalSettings.businessplus.sliderRevolutionInternalBannerInit.slideshowInternalBannerEffectTime,
disableProgressBar:'off',
responsiveLevels:[1199,991,767,480],
navigation: {
onHoverStop:"off",
arrows:{
enable:true,
tmp: "<div class='tp-title-wrap'><span class='tp-arr-titleholder'>{{title}}</span></div>",
left:{
h_align:"left",
v_align:"center",
h_offset:0,
v_offset:0
},
right:{
h_align:"right",
v_align:"center",
h_offset:0,
v_offset:0
}
},
bullets:{
style:"",
enable:bulletsEnable,
direction:"horizontal",
space: 5,
h_align: drupalSettings.businessplus.sliderRevolutionInternalBannerInit.slideshowInternalBannerBulletsPosition,
v_align:"bottom",
h_offset: 0,
v_offset: 20,
tmp:"",
},
tabs: {
style:"",
enable:tabsEnable,
width:410,
height:95,
min_width:240,
wrapper_padding: 0,
wrapper_opacity:"1",
tmp:'<div class="tp-tab-content"><span class="tp-tab-title">{{title}}</span></div>',
visibleAmount: 6,
hide_onmobile: false,
hide_onleave: false,
direction:"horizontal",
span: true,
position:"outer-bottom",
space:0,
h_align:"left",
v_align:"bottom",
h_offset:0,
v_offset:0
},
touch:{
touchenabled: drupalSettings.businessplus.sliderRevolutionInternalBannerInit.slideshowInternalBannerTouchSwipe,
swipe_treshold:75,
swipe_min_touches:1,
drag_block_vertical:false,
swipe_direction:"horizontal"
}
}
});
$(context).find('.transparent-background').once('mtSliderRevolutionInternalBannerBG').css("backgroundColor", "rgba(0,0,0," + drupalSettings.businessplus.slideshowBackgroundOpacity + ")");
$(context).find('.tp-caption--transparent-background .tp-caption__title').once('mtSliderRevolutionInternalBannerCaptionBG').css("backgroundColor", "rgba(0,0,0," + drupalSettings.businessplus.slideshowCaptionOpacity + ")");
$(context).find('.tp-caption--transparent-background .tp-caption__text').once('mtSliderRevolutionInternalBannerCaptionBG').css("backgroundColor", "rgba(0,0,0," + drupalSettings.businessplus.slideshowCaptionOpacity + ")");
}
};
})(jQuery, Drupal, drupalSettings);
| 40.5 | 228 | 0.595751 |
7332ef7aced1df9a9d40d72d6c6a6bf13b300de0 | 1,590 | js | JavaScript | frontend/app/components/DashboardDetail/DashboardDetailIcon/DashboardDetailIconPresentation.js | dy2288/fv-web-ui | 7240288091efb3e3f079457599fab9176efb80cf | [
"Apache-2.0"
] | null | null | null | frontend/app/components/DashboardDetail/DashboardDetailIcon/DashboardDetailIconPresentation.js | dy2288/fv-web-ui | 7240288091efb3e3f079457599fab9176efb80cf | [
"Apache-2.0"
] | null | null | null | frontend/app/components/DashboardDetail/DashboardDetailIcon/DashboardDetailIconPresentation.js | dy2288/fv-web-ui | 7240288091efb3e3f079457599fab9176efb80cf | [
"Apache-2.0"
] | null | null | null | import React from 'react'
import PropTypes from 'prop-types'
// TODO: Temp icons until design is finished
import IconPhrase from '@material-ui/icons/ChatOutlined'
import IconWord from '@material-ui/icons/DescriptionOutlined'
import IconStory from '@material-ui/icons/ImportContactsOutlined'
import IconGeneric from '@material-ui/icons/InsertDriveFileOutlined'
import IconSong from '@material-ui/icons/LibraryMusicOutlined'
import IconNew from '@material-ui/icons/NewReleasesTwoTone'
import { WORD, PHRASE, SONG, STORY } from 'common/Constants'
import '!style-loader!css-loader!./DashboardDetailIcon.css'
/**
* @summary DashboardDetailIconPresentation
* @version 1.0.1
* @component
*
* @param {object} props
* @param {integer} props.itemType
* @param {boolean} props.isNew
*
* @returns {node} jsx markup
*/
function DashboardDetailIconPresentation({ itemType, isNew }) {
let Icon = IconGeneric
switch (itemType) {
case WORD:
Icon = IconWord
break
case PHRASE:
Icon = IconPhrase
break
case SONG:
Icon = IconSong
break
case STORY:
Icon = IconStory
break
default:
break
}
return (
<div className="DashboardDetailIcon">
{isNew && <IconNew fontSize="small" className="DashboardDetailIcon__new" />}
<Icon className="DashboardDetailIcon__icon" fontSize="large" />
</div>
)
}
// PROPTYPES
const { bool, oneOf } = PropTypes
DashboardDetailIconPresentation.propTypes = {
itemType: oneOf([WORD, PHRASE, SONG, STORY]),
isNew: bool,
}
export default DashboardDetailIconPresentation
| 26.949153 | 82 | 0.716352 |
733395d574dcbf95ad30abfdef2175e6fab35d99 | 2,703 | js | JavaScript | chrome/renderer/resources/extensions/app_custom_bindings.js | pozdnyakov/chromium-crosswalk | 0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | chrome/renderer/resources/extensions/app_custom_bindings.js | pozdnyakov/chromium-crosswalk | 0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | chrome/renderer/resources/extensions/app_custom_bindings.js | pozdnyakov/chromium-crosswalk | 0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Custom binding for the app API.
var GetAvailability = requireNative('v8_context').GetAvailability;
if (!GetAvailability('app').is_available) {
exports.chromeApp = {};
exports.onInstallStateResponse = function(){};
return;
}
var appNatives = requireNative('app');
var process = requireNative('process');
var extensionId = process.GetExtensionId();
var logActivity = requireNative('activityLogger');
function wrapForLogging(fun) {
var id = extensionId;
return (function() {
// TODO(ataly): We need to make sure we use the right prototype for
// fun.apply. Array slice can either be rewritten or similarly defined.
logActivity.LogAPICall(id, "app." + fun.name,
$Array.slice(arguments));
return $Function.apply(fun, this, arguments);
});
}
// This becomes chrome.app
var app;
if (!extensionId) {
app = {
getIsInstalled: appNatives.GetIsInstalled,
getDetails: appNatives.GetDetails,
getDetailsForFrame: appNatives.GetDetailsForFrame,
runningState: appNatives.GetRunningState
};
} else {
app = {
getIsInstalled: wrapForLogging(appNatives.GetIsInstalled),
getDetails: wrapForLogging(appNatives.GetDetails),
getDetailsForFrame: wrapForLogging(appNatives.GetDetailsForFrame),
runningState: wrapForLogging(appNatives.GetRunningState)
};
}
// Tricky; "getIsInstalled" is actually exposed as the getter "isInstalled",
// but we don't have a way to express this in the schema JSON (nor is it
// worth it for this one special case).
//
// So, define it manually, and let the getIsInstalled function act as its
// documentation.
if (!extensionId)
app.__defineGetter__('isInstalled', appNatives.GetIsInstalled);
else
app.__defineGetter__('isInstalled',
wrapForLogging(appNatives.GetIsInstalled));
// Called by app_bindings.cc.
function onInstallStateResponse(state, callbackId) {
var callback = callbacks[callbackId];
delete callbacks[callbackId];
if (typeof(callback) == 'function')
callback(state);
}
// TODO(kalman): move this stuff to its own custom bindings.
var callbacks = {};
var nextCallbackId = 1;
app.installState = function getInstallState(callback) {
var callbackId = nextCallbackId++;
callbacks[callbackId] = callback;
appNatives.GetInstallState(callbackId);
};
if (extensionId)
app.installState = wrapForLogging(app.installState);
// This must match InstallAppBindings() in
// chrome/renderer/extensions/dispatcher.cc.
exports.chromeApp = app;
exports.onInstallStateResponse = onInstallStateResponse;
| 32.178571 | 76 | 0.740289 |
73339e8c503befbb128247167138fd7daa65e655 | 2,790 | js | JavaScript | test/spec/elements/form.spec.js | parampavar/vuido | def1c232ffc257589293bba8b34a9523b5f01dd9 | [
"MIT"
] | 6,199 | 2018-05-18T18:30:04.000Z | 2022-03-23T10:50:02.000Z | test/spec/elements/form.spec.js | parampavar/vuido | def1c232ffc257589293bba8b34a9523b5f01dd9 | [
"MIT"
] | 59 | 2018-05-19T13:05:07.000Z | 2022-02-13T03:06:02.000Z | test/spec/elements/form.spec.js | subjectdenied/vue-gnome | d010e42c417a047ec3b74db50167ab76b6267572 | [
"MIT"
] | 273 | 2018-05-19T07:51:32.000Z | 2022-03-22T09:44:38.000Z | const expect = require( 'chai' ).expect;
const sinon = require( 'sinon' );
const libui = require( 'libui-node' );
const { TextInput, Form } = require( 'libui-node-dom' );
describe( 'Form', () => {
it( 'default', () => {
const form = new Form( 'Form' );
form._mountWidget();
expect( form.widget ).to.be.an.instanceof( libui.UiForm );
expect( form.widget.visible ).to.be.true;
expect( form.widget.enabled ).to.be.true;
expect( form.widget.padded ).to.be.false;
} );
it( 'with attribute and children', () => {
const form = new Form( 'Form' );
const child1 = new TextInput( 'TextInput' );
const child2 = new TextInput( 'TextInput' );
form.setAttribute( 'padded', true );
form.appendChild( child1 );
form.appendChild( child2 );
child1.setAttribute( 'label', 'foo' );
child2.setAttribute( 'label', 'bar' );
child2.setAttribute( 'stretchy', true );
sinon.spy( libui.UiForm.prototype, 'append' );
form._mountWidget();
expect( form.widget.padded ).to.be.true;
expect( libui.UiForm.prototype.append ).to.have.been.calledOn( form.widget ).and.calledWith( 'foo', child1.widget, false )
.and.calledWith( 'bar', child2.widget, true );
expect( form.widget.children ).to.deep.equal( [ child1.widget, child2.widget ] );
} );
it( 'appendChild', () => {
const form = new Form( 'Form' );
const child = new TextInput( 'TextInput' );
form._mountWidget();
sinon.spy( libui.UiForm.prototype, 'append' );
child.setAttribute( 'label', 'foo' );
form.appendChild( child );
expect( libui.UiForm.prototype.append ).to.have.been.calledOn( form.widget ).and.calledWith( 'foo', child.widget, false );
expect( form.widget.children ).to.deep.equal( [ child.widget ] );
} );
it( 'insertBefore', () => {
const form = new Form( 'Form' );
const child1 = new TextInput( 'TextInput' );
const child2 = new TextInput( 'TextInput' );
child1.setAttribute( 'label', 'foo' );
form.appendChild( child1 );
form._mountWidget();
child2.setAttribute( 'label', 'foo' );
form.insertBefore( child2, child1 );
expect( form.widget.children ).to.deep.equal( [ child2.widget, child1.widget ] );
} );
it( 'removeChild', () => {
const form = new Form( 'Form' );
const child1 = new TextInput( 'TextInput' );
const child2 = new TextInput( 'TextInput' );
child1.setAttribute( 'label', 'foo' );
child2.setAttribute( 'label', 'bar' );
form.appendChild( child1 );
form.appendChild( child2 );
form._mountWidget();
form.removeChild( child1 );
expect( form.widget.children ).to.deep.equal( [ child2.widget ] );
} );
} );
| 29.680851 | 128 | 0.600717 |
733564ea9416ce3a65e80bac57595236bf4b1ecd | 2,555 | js | JavaScript | my-app/src/components/Vision.js | sarang323patil/website_2 | 46024961cb30fbc0705e38a03fc28067310bab77 | [
"MIT"
] | null | null | null | my-app/src/components/Vision.js | sarang323patil/website_2 | 46024961cb30fbc0705e38a03fc28067310bab77 | [
"MIT"
] | null | null | null | my-app/src/components/Vision.js | sarang323patil/website_2 | 46024961cb30fbc0705e38a03fc28067310bab77 | [
"MIT"
] | null | null | null | import React from 'react'
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import '../components/Vision.css';
import mobileImg from '../images/mobile.png';
import cameraImg from '../images/camera.png';
import processorImg from '../images/processor.png';
import displayImg from '../images/display.png';
import batteryImg from '../images/battery.png';
import arrowImg from '../images/battery.png';
// import visionbgImg from '../images/visionbgImg.jpg';
const useStyles = makeStyles((theme) => ({
wrapper:{
height: '100vh',
width: '100vw',
paddingTop:'0%'
},
rightText:{
fontSize:30,
fontFamily:'Pacifico',
textAlign:'center',
paddingRight:50,
paddingLeft:50,
color:'#fff'
},
titleText:{
fontSize:75,
fontFamily:'Pacifico',
textAlign:'center',
paddingRight:50,
paddingLeft:50,
color:'#fff'
}
}));
function Vision() {
const classes = useStyles();
return (
<div className={classes.wrapper} id='vision'>
<div className="overlay"></div>
<div className="title">
<h1 className={classes.titleText}>Our Vision</h1>
</div>
<div className="content">
<p className={classes.rightText}> We as an organization aspire a world with minimal or no mental issues, which can lead to disastrous solution which people think is, is suicide. In our country mental illness is treated like a taboo, but literally it is just like another normal disease which needs a professional treatment. “Peaceful mind, soulful life”, quotes sum up everything.
</p>
<br></br>
<p className={classes.rightText}> There are numerous opportunities hovering around us, but we can see only those which are traversed by people in our surroundings, and that bounds the future for a child, probably waste of thousands of talents and genius minds.
</p>
<br></br>
<p className={classes.rightText}> "Children are like wet cement. Whatever falls on them makes an impression." -Haim Ginott
Just a hand with proper path can lead this force to pull out marvels in universe. We will connect our hands with such prodigies to provide the best possible outcomes this life can lead too.
</p>
</div>
</div>
)
}
export default Vision;
| 35 | 396 | 0.627006 |
73356e17a6af3e164251eeabeca1961325408c04 | 1,032 | js | JavaScript | plugins/springmvc_rest/web/scripts/rest.js | kidylee/rapid-framework | da23328d1efda2de6452b672b9437e190913faf0 | [
"Apache-2.0"
] | 1 | 2018-08-09T01:29:04.000Z | 2018-08-09T01:29:04.000Z | plugins/springmvc_rest/web/scripts/rest.js | kidylee/rapid-framework | da23328d1efda2de6452b672b9437e190913faf0 | [
"Apache-2.0"
] | null | null | null | plugins/springmvc_rest/web/scripts/rest.js | kidylee/rapid-framework | da23328d1efda2de6452b672b9437e190913faf0 | [
"Apache-2.0"
] | null | null | null | /**
* api for RESTful operation
*/
/**
* use case: <a href="/user/12" onclick="doRestDelete(this,'confirm delete?');return false;">delete</a>
*/
function doRestDelete(anchor,confirmMsg) {
if (confirmMsg && confirm(confirmMsg)) {
var f = document.createElement("form");
f.style.display = "none";
anchor.parentNode.appendChild(f);
f.method = "POST";
f.action = anchor.href;
var m = document.createElement("input");
m.setAttribute("type", "hidden");
m.setAttribute("name", "_method");
m.setAttribute("value", "delete");
f.appendChild(m);
f.submit();
}
}
function doRestBatchDelete(action,checkboxName,form) {
if (!hasOneChecked(checkboxName)) {
alert("请选择你要删除的对象!");
return;
}
if (confirm("你确认要删除?")) {
form.action = action;
form.method = 'POST';
var m = document.createElement("input");
m.setAttribute("type", "hidden");
m.setAttribute("name", "_method");
m.setAttribute("value", "delete");
form.appendChild(m);
form.submit();
}
}
| 24 | 104 | 0.628876 |
73366ce8f3be5eb9c632c5f34a745a00b0a42c5c | 2,455 | js | JavaScript | docs/doxygen/html/search/all_7.js | Jou0us/NumCpp | 6d07554a5a737c3b76169d925f33653f254abecb | [
"MIT"
] | 1 | 2021-09-17T08:29:55.000Z | 2021-09-17T08:29:55.000Z | docs/doxygen/html/search/all_7.js | Jou0us/NumCpp | 6d07554a5a737c3b76169d925f33653f254abecb | [
"MIT"
] | null | null | null | docs/doxygen/html/search/all_7.js | Jou0us/NumCpp | 6d07554a5a737c3b76169d925f33653f254abecb | [
"MIT"
] | null | null | null | var searchData=
[
['hasext_460',['hasExt',['../classnc_1_1filesystem_1_1_file.html#a4e8ede3f75b64847964d4d85cd58f123',1,'nc::filesystem::File']]],
['hat_461',['hat',['../namespacenc_1_1linalg.html#a12e16cb9d1a7b09e85b4abbef14ba2ef',1,'nc::linalg::hat(dtype inX, dtype inY, dtype inZ)'],['../namespacenc_1_1linalg.html#ae7ced3680f1ae95af4bc2e6b98a5a517',1,'nc::linalg::hat(const NdArray< dtype > &inVec)'],['../namespacenc_1_1linalg.html#ae9cdb091717a1c74dc659519d77e0048',1,'nc::linalg::hat(const Vec3 &inVec)']]],
['hat_2ehpp_462',['hat.hpp',['../hat_8hpp.html',1,'']]],
['height_463',['height',['../classnc_1_1image_processing_1_1_cluster.html#a71ccd5ee3fea70b4b1b27ba25f4b3fb8',1,'nc::imageProcessing::Cluster']]],
['hermite_464',['hermite',['../namespacenc_1_1polynomial.html#aeea1ebbc592a6a8c533f2230fb0f6f10',1,'nc::polynomial::hermite(uint32 n, dtype x)'],['../namespacenc_1_1polynomial.html#ad88f67a61dad283461c6121958c5af54',1,'nc::polynomial::hermite(uint32 n, const NdArray< dtype > &inArrayX)']]],
['hermite_2ehpp_465',['hermite.hpp',['../hermite_8hpp.html',1,'']]],
['histogram_466',['histogram',['../namespacenc.html#abff7fb8fdafbdd8db4dad38cc5a2267c',1,'nc::histogram(const NdArray< dtype > &inArray, const NdArray< double > &inBinEdges)'],['../namespacenc.html#a9f8af3a8f7adefd20992fe0686837cf6',1,'nc::histogram(const NdArray< dtype > &inArray, uint32 inNumBins=10)']]],
['histogram_2ehpp_467',['histogram.hpp',['../histogram_8hpp.html',1,'']]],
['hours_468',['hours',['../classnc_1_1coordinates_1_1_r_a.html#a52af78880f6c5a5ec8750a7ad20c2e2d',1,'nc::coordinates::RA']]],
['hours_5fper_5fday_469',['HOURS_PER_DAY',['../namespacenc_1_1constants.html#aef903b1f40001bc712b61f5dec7de716',1,'nc::constants']]],
['hstack_470',['hstack',['../namespacenc.html#a80a6677582b65c19750b0d82ac182081',1,'nc']]],
['hstack_2ehpp_471',['hstack.hpp',['../hstack_8hpp.html',1,'']]],
['hypot_472',['hypot',['../namespacenc.html#a4648674053cd83851d9549bbcc7a8481',1,'nc::hypot(dtype inValue1, dtype inValue2) noexcept'],['../namespacenc.html#ad2d90c3dcbe0a1e652b0505b637d973a',1,'nc::hypot(dtype inValue1, dtype inValue2, dtype inValue3) noexcept'],['../namespacenc.html#a66b0aabfaacc7ec12206b4edf6026b12',1,'nc::hypot(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)']]],
['hypot_2ehpp_473',['hypot.hpp',['../hypot_8hpp.html',1,'']]]
];
| 136.388889 | 428 | 0.738493 |
7336dc663e8f681940cea0b6d285c8f30444973e | 639 | js | JavaScript | src/App.js | MirzaabdullayevTest/react-quiz-morning | 5c019ec7eb278bcc168420dac83aaad1988a3b94 | [
"Apache-2.0"
] | null | null | null | src/App.js | MirzaabdullayevTest/react-quiz-morning | 5c019ec7eb278bcc168420dac83aaad1988a3b94 | [
"Apache-2.0"
] | null | null | null | src/App.js | MirzaabdullayevTest/react-quiz-morning | 5c019ec7eb278bcc168420dac83aaad1988a3b94 | [
"Apache-2.0"
] | null | null | null | import Layout from "./hoc/Layout/Layout";
import { Routes, Route } from 'react-router-dom'
import QuizList from "./containers/QuizList/QuizList";
import Auth from "./containers/Auth/Auth";
import QuizCreator from "./containers/QuizCreator/QuizCreator";
import { QuizCb } from "./containers/Quiz/QuizCb";
function App() {
return (
<Layout>
<Routes>
<Route path='/auth' element={<Auth />} />
<Route path='/quiz-creator' element={<QuizCreator />} />
<Route path='/quiz/:id' element={<QuizCb />} />
<Route path='/' element={<QuizList />} />
</Routes>
</Layout>
);
}
export default App;
| 30.428571 | 64 | 0.629108 |
73374a8ee38936b28c9eb81c2adc12d33bd8a6f4 | 461 | js | JavaScript | src/carbon-dating.js | drunich-z/basic-js | cbe0106935d74cacce4ee7888ddc3106373972a4 | [
"MIT"
] | null | null | null | src/carbon-dating.js | drunich-z/basic-js | cbe0106935d74cacce4ee7888ddc3106373972a4 | [
"MIT"
] | null | null | null | src/carbon-dating.js | drunich-z/basic-js | cbe0106935d74cacce4ee7888ddc3106373972a4 | [
"MIT"
] | null | null | null | const CustomError = require("../extensions/custom-error");
const MODERN_ACTIVITY = 15;
const HALF_LIFE_PERIOD = 5730;
module.exports = function dateSample(sampleActivity) {
let k = 0.693 / HALF_LIFE_PERIOD;
let N = parseFloat(sampleActivity);
if (typeof sampleActivity === "string" && N > 0 && N <= MODERN_ACTIVITY ) {
result = Math.log(MODERN_ACTIVITY / N) / k;
result = Math.ceil(result);
return result
} else {
return false;
}
};
| 27.117647 | 77 | 0.67462 |
73374dacf780ff39d237e04e1c77c1e4514d56c8 | 3,043 | js | JavaScript | src/components/people/PeopleComponent.js | cwang100/telebook-frontend | c70bdfe1bf2d60016a90fa3e7a06d99cecbacaf7 | [
"MIT"
] | null | null | null | src/components/people/PeopleComponent.js | cwang100/telebook-frontend | c70bdfe1bf2d60016a90fa3e7a06d99cecbacaf7 | [
"MIT"
] | null | null | null | src/components/people/PeopleComponent.js | cwang100/telebook-frontend | c70bdfe1bf2d60016a90fa3e7a06d99cecbacaf7 | [
"MIT"
] | 1 | 2019-10-24T05:14:23.000Z | 2019-10-24T05:14:23.000Z | import React, { Component } from 'react'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import Tabs, { Tab } from 'material-ui/Tabs'
import { grey } from 'material-ui/colors'
import { push } from 'connected-react-router'
import AppBar from 'material-ui/AppBar'
import Typography from 'material-ui/Typography'
import FindPeople from '../findPeople'
import Following from '../following'
import * as globalActions from '../../actions/globalActions'
const TabContainer = (props) => {
return (
<Typography component='div' style={{ padding: 8 * 3 }}>
{props.children}
</Typography>
)
}
export class PeopleComponent extends Component {
constructor (props) {
super(props)
const {tab} = this.props.match.params
this.state = {
tabIndex: this.getTabIndexByNav(tab)
}
}
handleChangeTab = (event, value) => {
const { goTo, setHeaderTitle} = this.props
this.setState({ tabIndex: value })
switch (value) {
case 0:
goTo('/people')
setHeaderTitle('People')
break
case 1:
goTo('/people/following')
setHeaderTitle('Following')
break
default:
break
}
}
componentWillMount () {
const { setHeaderTitle} = this.props
const {tab} = this.props.match.params
switch (tab) {
case undefined:
case '':
setHeaderTitle('People')
break
case 'following':
setHeaderTitle('Following')
break
default:
break
}
}
render () {
const styles = {
people: {
margin: '0 auto'
},
headline: {
fontSize: 24,
paddingTop: 16,
marginBottom: 12,
fontWeight: 400
},
slide: {
padding: 10
}
}
const {followLoaded} = this.props
const {tabIndex} = this.state
return (
<div style={styles.people}>
<AppBar position='static' color='default'>
<Tabs
indicatorColor={grey[50]}
onChange={this.handleChangeTab}
value={tabIndex} centered
textColor='primary'
>
<Tab label={'All People'} />
<Tab label={'Following'} />
</Tabs>
</AppBar>
{tabIndex === 0 && <TabContainer>{followLoaded ? <FindPeople /> : ''}</TabContainer>}
{tabIndex === 1 && <TabContainer>{followLoaded ? <Following/> : ''}</TabContainer>}
</div>
)
}
getTabIndexByNav(navName) {
let tabIndex = 0
switch (navName) {
case 'following':
return 1
default:
return 0
}
}
}
const mapDispatchToProps = (dispatch, ownProps) => {
return {
goTo: (url) => dispatch(push(url)),
setHeaderTitle : (title) => dispatch(globalActions.setHeaderTitle(title))
}
}
const mapStateToProps = (state, ownProps) => {
return {
uid: state.authorize.get('uid'),
followLoaded: !state.follow.get('followingLoadingStatus')
}
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(PeopleComponent))
| 23.05303 | 93 | 0.594479 |
73375bac014f6eb2eec9ce544b19f3489e7aab20 | 3,082 | js | JavaScript | 2DPhysics/Scripts/Objects.js | Akeal/2DPhysics | 0bd8b2aec17dfb6a9cca3a6c0d986131168c0584 | [
"MIT"
] | 1 | 2017-08-14T14:48:38.000Z | 2017-08-14T14:48:38.000Z | 2DPhysics/Scripts/Objects.js | Akeal/2DPhysics | 0bd8b2aec17dfb6a9cca3a6c0d986131168c0584 | [
"MIT"
] | null | null | null | 2DPhysics/Scripts/Objects.js | Akeal/2DPhysics | 0bd8b2aec17dfb6a9cca3a6c0d986131168c0584 | [
"MIT"
] | null | null | null | function Projection(min, max) {
this.min = min;
this.max = max;
}
function SquareObject(pointA, pointB, pointC, pointD, mass, Vx, Vy, Fx, Fy, restitution, coffStatic, coffKinetic, static, type) {
this.points = [pointA, pointB, pointC, pointD];
//this.x = this.points[0].x;
//this.y = this.points[0].y;
this.angle = 0;
this.Vangular = 0;
this.torque = 0;
this.y = function (amount) {
for (p = 0; p < 4; p++) {
this.points[p].y += amount;
}
}
this.x = function (amount) {
for (p = 0; p < 4; p++) {
this.points[p].x += amount;
}
}
this.mass = mass;
this.Vx = Vx;
this.Vy = Vy;
this.Fx = Fx;
this.Fy = Fy;
this.restitution = restitution;
this.coffStatic = coffStatic;
this.coffKinetic = coffKinetic;
this.static = static;
this.type = type;
this.height = this.points[2].y - this.points[0].y;
this.width = this.points[1].x - this.points[0].x;
this.centerX = function () { return (this.points[0].x + (Math.abs(((this.points[1].x) - Math.abs((this.points[0].x)))) / 2)); }
this.centerY = function () { return (this.points[0].y + (Math.abs(((this.points[2].y) - Math.abs((this.points[0].y)))) / 2)); }
this.rotate = function () {
var sin = Math.sin(this.angle);
var cos = Math.cos(this.angle);
for (p = 0; p < this.points.length; p++) {
//var translated = this.translateCenter(new Point(0, 0));
var translation = new Point(this.centerX(), this.centerY());
//Set to origin
this.points[p].x -= translation.x;
this.points[p].y -= translation.y;
//Rotate and set center back
this.points[p].x = ((this.points[p].x * cos) - (this.points[p].y * sin)) + translation.x;
this.points[p].y = ((this.points[p].x * sin) + (this.points[p].y * cos)) + translation.y;
}
}
this.area = function () { return (this.points[1].x - this.points[0].x) * (this.points[2].y - this.points[0].y) / 10000; }
}
function TriangleObject(pointA, pointB, pointC, mass, Vx, Vy, Fx, Fy, restitution, coffStatic, coffKinetic, static, type) {
this.points = [pointA, pointB, pointC];
this.x = this.points[0].x;
this.y = this.points[0].y;
this.mass = mass;
this.Vx = Vx;
this.Vy = Vy;
this.Fx = Fx;
this.Fy = Fy;
this.restitution = restitution;
this.coffStatic = coffStatic;
this.coffKinetic = coffKinetic;
this.static = static;
this.type = type;
this.height = function () { return this.points[2].y - this.points[0].y; }
this.width = function () { return this.points[1].x - this.points[0].x; }
this.centerX = function () { return ((this.points[0].x) + (this.width() / 2)); }
this.centerY = function () { return ((this.points[0].y) + (this.height() / 2)); }
this.area = function () { return (this.points[1].x - this.points[0].x) * (this.points[2].y - this.points[0].y) / 20000; }
}
| 40.552632 | 132 | 0.553212 |
7337bdfd12f2cacd5ea824245e28f5c0ec18c206 | 1,052 | js | JavaScript | webpack.config.js | sernano/mixi | e86cea68daf227a23a6d19a82931643f6ed15bbf | [
"MIT"
] | 1 | 2020-12-25T20:46:27.000Z | 2020-12-25T20:46:27.000Z | webpack.config.js | sernano/mixi | e86cea68daf227a23a6d19a82931643f6ed15bbf | [
"MIT"
] | null | null | null | webpack.config.js | sernano/mixi | e86cea68daf227a23a6d19a82931643f6ed15bbf | [
"MIT"
] | null | null | null | const isDev = process.env.NODE_ENV === 'development';
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: isDev ? 'development' : 'production',
entry: {
bundle: [
'@babel/polyfill', // enables async-await
'./client/index.js'
],
style: ['./client/style.scss']
},
output: {
path: path.join(__dirname, '/public'),
filename: '[name].js'
},
resolve: {
extensions: ['.js', '.jsx']
},
devtool: 'source-map',
watchOptions: {
ignored: /node_modules/
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'style-loader', 'css-loader']
},
{
test: /\.scss$/,
exclude: [/node_modules/],
use: ['style-loader', 'css-loader', 'sass-loader']
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css'
})
]
};
| 21.469388 | 72 | 0.532319 |
7338202ac18473ff20ec1e6ff7864baabcf0f64f | 1,423 | js | JavaScript | src/game_hang.js | alexandreneves/hubot-games | 0dd699fe1407e89dcfc2e5897d8a939110c79498 | [
"MIT"
] | 2 | 2017-11-23T17:45:14.000Z | 2018-04-10T06:58:33.000Z | src/game_hang.js | alexandreneves/hubot-games | 0dd699fe1407e89dcfc2e5897d8a939110c79498 | [
"MIT"
] | 2 | 2018-07-20T07:41:06.000Z | 2019-05-09T22:25:39.000Z | src/game_hang.js | alexandreneves/hubot-games | 0dd699fe1407e89dcfc2e5897d8a939110c79498 | [
"MIT"
] | null | null | null | // Author:
// aneves, centeno
module.exports = function(robot) {
var messages = require('./games/hang/messages');
var stats = require('./stats/');
var Session = require('./session');
var session = new Session({
game: require('./games/hang'),
timeout: {
time: 5 * 60 * 1000,
callback: function(res) {
res.reply(messages.timeout + session.gameInstance(res).state(res, true));
stats.update('hang', {
player: res.envelope.user.name,
type: 0
});
}
},
interval: {
time: 4 * 60 * 1000,
callback: function(res) {
res.reply(messages.oneminleft);
}
}
});
var r = {
help: /^!hang$/,
start: /^!hang (?:start|s)$/,
play: /^!hang (?:play|p) [a-z]{1}$/,
guess: /^!hang (?:guess|g) [a-z]{2,}$/,
stats: /^!hang stats$/,
};
robot.hear(r.help, function(res) {
if (session.gameInstance(res)) {
var r = session.action('status', res);
res[r[0]](r[1]);
} else {
res.send('```'+ messages.help +'```');
}
});
robot.hear(r.start, function(res) {
var r = session.start(res);
res[r[0]](r[1]);
});
robot.hear(r.play, function(res) {
var r = session.action('play', res);
res[r[0]](r[1]);
});
robot.hear(r.guess, function(res) {
var r = session.action('play', res);
res[r[0]](r[1]);
});
robot.hear(r.stats, function(res) {
res.send(stats.get(res, [0, 2]));
});
}
| 21.892308 | 78 | 0.532677 |
7338203857a000d8963276659b8a77ac18c159b3 | 389 | js | JavaScript | public/mobile/plugin/rem.js | bi38324/newOA | 8506c7e6561a4d42f4dfeefc1a9055b3a859dfdd | [
"MIT"
] | null | null | null | public/mobile/plugin/rem.js | bi38324/newOA | 8506c7e6561a4d42f4dfeefc1a9055b3a859dfdd | [
"MIT"
] | 1 | 2021-02-02T20:29:56.000Z | 2021-02-02T20:29:56.000Z | public/mobile/plugin/rem.js | bi38324/newOA | 8506c7e6561a4d42f4dfeefc1a9055b3a859dfdd | [
"MIT"
] | null | null | null | !function () {
var pageWid = 375;
function a() {
console.log(document.documentElement.clientWidth);
document.documentElement.style.fontSize = document.documentElement.clientWidth/pageWid*1.6/16*1000+"%"
}
var b = null;
window.addEventListener("resize", function () {
clearTimeout(b);
b = setTimeout(a, 100)
}, !1);
a()
}(window); | 29.923077 | 110 | 0.614396 |
733834e9d5273deeb2bf406e142a7624d8b777d6 | 1,015 | js | JavaScript | src/templates/company/companyCategories.js | codexstanford/techlist-frontend-web | 06be56c7f1bbaa34e65ba942a24fe29257ae4b7f | [
"MIT"
] | 29 | 2019-03-31T20:12:09.000Z | 2022-03-03T02:39:47.000Z | src/templates/company/companyCategories.js | codexstanford/techlist-frontend-web | 06be56c7f1bbaa34e65ba942a24fe29257ae4b7f | [
"MIT"
] | 177 | 2019-04-01T11:40:34.000Z | 2019-11-11T21:34:12.000Z | src/templates/company/companyCategories.js | codexstanford/techlist-frontend-web | 06be56c7f1bbaa34e65ba942a24fe29257ae4b7f | [
"MIT"
] | null | null | null | import React from 'react';
import Chip from '@material-ui/core/Chip';
import { formatCategoryName } from './helpers';
export const CompanyCategories = ({ company, wrapper, chip, ...props }) => {
const Wrapper = wrapper;
if (company.categories !== undefined) {
if (company.categories.length > 0) {
return company.categories.map(item => {
return chip ? (
<Chip
color="primary"
key={item.label ? item.value : item.id}
label={formatCategoryName(item.label ? item.label : item.payload)}
style={{ margin: 2 }}
{...props}
/>
) : (
<Wrapper key={item.label ? item.value : item.id}>
<span style={{ whiteSpace: 'nowrap' }}>
{formatCategoryName(item.label ? item.label : item.payload)}
</span>
</Wrapper>
);
});
} else {
return null;
}
} else {
return null;
}
};
CompanyCategories.defaultProps = {
wrapper: 'div',
};
| 26.710526 | 78 | 0.538916 |
73383a63311703be00a0bc0fcbf70fad51580264 | 1,482 | js | JavaScript | src/components/Stats.js | akbar-moghadam/travel-travel | e72db14d0752f09c10d9e8a59f72ae514a37ec2e | [
"RSA-MD"
] | null | null | null | src/components/Stats.js | akbar-moghadam/travel-travel | e72db14d0752f09c10d9e8a59f72ae514a37ec2e | [
"RSA-MD"
] | null | null | null | src/components/Stats.js | akbar-moghadam/travel-travel | e72db14d0752f09c10d9e8a59f72ae514a37ec2e | [
"RSA-MD"
] | null | null | null | import React from 'react'
import styled from 'styled-components'
import {StatsData} from '../data/statsdata'
const Stats=() =>{
return (
<StatsContainer>
<Heading>Why Choose Us?</Heading>
<Wrapper>
{StatsData.map((item,index)=>{
return(
<StatsBox key={index}>
<Icon>{item.icon}</Icon>
<Title>{item.title}</Title>
<Description>{item.desc}</Description>
</StatsBox>
)
})}
</Wrapper>
</StatsContainer>
)
}
export default Stats
const StatsContainer=styled.div`
width:100%;
background:#fff;
color:#000;
display:flex;
flex-direction:column;
justyfy-content:center;
padding:4rem calc((100vw-1300px)/2);
`
const Heading=styled.h1`
text-align:start;
font-size:clamp(1.5rem,5vw,2rem);
margin-bottom:3rem;
padding:0 2rem;
`
const Wrapper=styled.div`
display:grid;
grid-template-columns: repeat(4,1fr);
grid-gap: 10px;
@media screen and (max-width:768px){
grid-template-columns:1fr;
}
@media screen and(max-width:500px){
grid-template-columns:1fr;
}
`
const StatsBox=styled.div`
height:100%;
width:100%;
padding:2rem;
`
const Icon=styled.div`
font-size:3rem;
margin-bottom:1rem;
`
const Title= styled.p`
font-size: clamp(1rem,2.5vw,1.5rem);
margin-bottom:0.5rem;
`
const Description= styled.p`
` | 21.171429 | 66 | 0.587719 |
733904eb43a858487b4b5952a0d52d95289510fd | 4,735 | js | JavaScript | demo/www/runtime-latest.fdcc256dbf52e6ee0e71.js | HashNotAdam/ionic4-auto-complete | 13b29673e8dcc073c1aa923590e2cfe0c3f85d39 | [
"MIT"
] | null | null | null | demo/www/runtime-latest.fdcc256dbf52e6ee0e71.js | HashNotAdam/ionic4-auto-complete | 13b29673e8dcc073c1aa923590e2cfe0c3f85d39 | [
"MIT"
] | null | null | null | demo/www/runtime-latest.fdcc256dbf52e6ee0e71.js | HashNotAdam/ionic4-auto-complete | 13b29673e8dcc073c1aa923590e2cfe0c3f85d39 | [
"MIT"
] | null | null | null | !function(e){function a(a){for(var f,r,t=a[0],n=a[1],o=a[2],i=0,l=[];i<t.length;i++)r=t[i],Object.prototype.hasOwnProperty.call(d,r)&&d[r]&&l.push(d[r][0]),d[r]=0;for(f in n)Object.prototype.hasOwnProperty.call(n,f)&&(e[f]=n[f]);for(u&&u(a);l.length;)l.shift()();return b.push.apply(b,o||[]),c()}function c(){for(var e,a=0;a<b.length;a++){for(var c=b[a],f=!0,t=1;t<c.length;t++)0!==d[c[t]]&&(f=!1);f&&(b.splice(a--,1),e=r(r.s=c[0]))}return e}var f={},d={1:0},b=[];function r(a){if(f[a])return f[a].exports;var c=f[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.e=function(e){var a=[],c=d[e];if(0!==c)if(c)a.push(c[2]);else{var f=new Promise((function(a,f){c=d[e]=[a,f]}));a.push(c[2]=f);var b,t=document.createElement("script");t.charset="utf-8",t.timeout=120,r.nc&&t.setAttribute("nonce",r.nc),t.src=function(e){return r.p+""+({0:"common"}[e]||e)+"-latest."+{0:"480dd4957767d4aa62f7",2:"7762ce36fa8eaa07eccd",3:"c203f93aa32b95d585fc",4:"42bf9f1798b9b72329dc",5:"c1a56aa80ff854d63635",6:"5913edd33964f1a67406",7:"6bf0f66a6646af5ce608",8:"817d7d80a17755b48c76",9:"5f4190061550a665dc97",14:"423d0dc37eba2a5383d1",15:"a7d62a238e16bb4923a4",16:"0f74986fe54f5588e70e",17:"c16b661addc385998608",18:"6f02993db4c022797757",19:"6b3b8b0c1fecbf7ce2e8",20:"e628eeef7df3d5e180df",21:"57df239c91e31ab17407",22:"120a112ed54ed4230c72",23:"c7a9dfbf6fd7a10dc079",24:"64e0cc9342d86ac5716d",25:"8303bb0af9d9512f7075",26:"246d8637b0cf873d6b5f",27:"f4c9ede608ce02a07382",28:"31e5da5ef7ccb17147a1",29:"0a4a1f48bef26a962267",30:"a973a057d5fa187881a8",31:"68d31f9860fc84961ed8",32:"f068740ebd6d981551aa",33:"c15f815d10869acebd55",34:"74f97922b51164efa026",35:"bcf878c78305753a3442",36:"87f2f66e298e9d60fa1f",37:"8fbe1fefadc7e976cee7",38:"f9f0481221a94c2312d1",39:"eb427c713cae66813fa5",40:"181330a511bb403ab354",41:"9ce57378ab4311cc19cd",42:"28cfc03333ee9bae6210",43:"7db6d457493d72ce78ea",44:"7e7748af0651e33ed9a0",45:"6a4594dce54ecf987c48",46:"a9d38944d5ee11549b42",47:"8fdde40b5d7999dd6760",48:"45b8370eef09789576d5",49:"def6979e658a7513465c",50:"a45747e78bf1e384fc16",51:"0815903e4e1a51ab741d",52:"7a220b4dae4a87f3657e",53:"53a78faf8836c4a6dcb9",54:"8d6931fca05278050f36",55:"eee638e9551c1e6c67ef",56:"010a59bbf7c0acc73b24",57:"a2d11e2b4e32e5516d59",58:"0bc250cf1b2b426b224d",59:"e0d37abc4514a1ba3c15",60:"014f6dfbb537ed1f6e0f",61:"c73b84798791d4e55477",62:"f5c0ceec6a999bdd6cd8",63:"3a74ff15cdd9112826e7",64:"797b1a15a75f3942b11f",65:"ecddd56c4ed5f5bccf09",66:"16d595522690e1d0ff13",67:"8a36c9aa2d2ebc1a8414",68:"6fc8393a4e67e52ea749",69:"c36f384fbea978daf63d",70:"1012e730defc2097f515",71:"63d24d2a768379a5b468",72:"64bbce07c0f38e89a143",73:"f8c7a288427bc7b17eaf",74:"a17c96021c69a264d1fd",75:"70cfb122aa8ca6ea9e72",76:"ee0e41bd4f1e1ed3c6a7",77:"2e257b640a3e2534d084",78:"b1624c38c599e95dbea7",79:"b49c37badbc0fa13d369",80:"d407ce8b5180596f5f9f",81:"4caf87dcc4bf006aeb03",82:"adb1ecbd703ffdb3b78a",83:"452f9789bacc0494eb9d",84:"da1646d57ab345234817",85:"00007e96905585c7eca4",86:"88b99e181924a19e8564",87:"3870f781e170a6243f50",88:"fa9d5084ed280dfc2d5a",89:"ec3e44e95b2f3267244b",90:"ba5d99dd7db62b3ca7d3",91:"5787b8fb31b0bddb5fe8",92:"a839b29cc17945734b96",93:"f9c7a26a75239c4b65d4",94:"66659b173ae5043816df",95:"0116fc71e8f440785707",96:"af576dbb505ab86cc102",97:"cf8148977997c8e42d34",98:"44193153dd37858b1bae",99:"645c756b8d9495509d7d"}[e]+".js"}(e);var n=new Error;b=function(a){t.onerror=t.onload=null,clearTimeout(o);var c=d[e];if(0!==c){if(c){var f=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;n.message="Loading chunk "+e+" failed.\n("+f+": "+b+")",n.name="ChunkLoadError",n.type=f,n.request=b,c[1](n)}d[e]=void 0}};var o=setTimeout((function(){b({type:"timeout",target:t})}),12e4);t.onerror=t.onload=b,document.head.appendChild(t)}return Promise.all(a)},r.m=e,r.c=f,r.d=function(e,a,c){r.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:c})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,a){if(1&a&&(e=r(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(r.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var f in e)r.d(c,f,(function(a){return e[a]}).bind(null,f));return c},r.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(a,"a",a),a},r.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},r.p="",r.oe=function(e){throw console.error(e),e};var t=window.webpackJsonp=window.webpackJsonp||[],n=t.push.bind(t);t.push=a,t=t.slice();for(var o=0;o<t.length;o++)a(t[o]);var u=n;c()}([]); | 4,735 | 4,735 | 0.751848 |
73398bab71b79392c956c7128de1fc063f04fb8c | 1,435 | js | JavaScript | node_modules/@blockstack/ui/dist/hooks/use-disclosure.esm.js | seekersapp2013/new | 1e393c593ad30dc1aa8642703dad69b84bad3992 | [
"MIT"
] | null | null | null | node_modules/@blockstack/ui/dist/hooks/use-disclosure.esm.js | seekersapp2013/new | 1e393c593ad30dc1aa8642703dad69b84bad3992 | [
"MIT"
] | null | null | null | node_modules/@blockstack/ui/dist/hooks/use-disclosure.esm.js | seekersapp2013/new | 1e393c593ad30dc1aa8642703dad69b84bad3992 | [
"MIT"
] | null | null | null | import { useState, useCallback } from 'react';
import { useControllableProp } from './use-controllable.esm.js';
import { usePrevious } from './use-previous.esm.js';
function useDisclosure(props) {
if (props === void 0) {
props = {};
}
var _props = props,
onCloseProp = _props.onClose,
onOpenProp = _props.onOpen;
var _React$useState = useState(props.defaultIsOpen || false),
isOpenState = _React$useState[0],
setIsOpen = _React$useState[1];
var _useControllableProp = useControllableProp(props.isOpen, isOpenState),
isControlled = _useControllableProp[0],
isOpen = _useControllableProp[1];
var prevIsOpen = usePrevious(isOpen);
var onClose = useCallback(function () {
if (!isControlled) {
setIsOpen(false);
}
if (onCloseProp) {
onCloseProp();
}
}, [isControlled, onCloseProp]);
var onOpen = useCallback(function () {
if (!isControlled) {
setIsOpen(true);
}
if (onOpenProp) {
onOpenProp();
}
}, [isControlled, onOpenProp]);
var onToggle = useCallback(function () {
var action = isOpen ? onClose : onOpen;
action();
}, [isOpen, onOpen, onClose]);
return {
isOpen: Boolean(isOpen),
prevIsOpen: Boolean(prevIsOpen),
onOpen: onOpen,
onClose: onClose,
onToggle: onToggle,
isControlled: isControlled
};
}
export { useDisclosure };
//# sourceMappingURL=use-disclosure.esm.js.map
| 25.175439 | 76 | 0.651568 |
7339b2a16348eac8fa38dd142a0668f22bec7071 | 3,038 | js | JavaScript | lib/reporters/CLIReporter.js | matthewtrask/dredd | 8de334c9da77cc789cf006f28423553fc3ef304a | [
"MIT"
] | null | null | null | lib/reporters/CLIReporter.js | matthewtrask/dredd | 8de334c9da77cc789cf006f28423553fc3ef304a | [
"MIT"
] | null | null | null | lib/reporters/CLIReporter.js | matthewtrask/dredd | 8de334c9da77cc789cf006f28423553fc3ef304a | [
"MIT"
] | null | null | null | const logger = require('../logger');
const prettifyResponse = require('../prettifyResponse');
function CLIReporter(emitter, stats, tests, inlineErrors, details) {
this.type = 'cli';
this.stats = stats;
this.tests = tests;
this.inlineErrors = inlineErrors;
this.details = details;
this.errors = [];
this.configureEmitter(emitter);
logger.verbose(`Using '${this.type}' reporter.`);
}
CLIReporter.prototype.configureEmitter = function configureEmitter(emitter) {
emitter.on('start', (rawBlueprint, callback) => {
logger.info('Beginning Dredd testing...');
callback();
});
emitter.on('end', (callback) => {
if (!this.inlineErrors) {
if (this.errors.length !== 0) { logger.info('Displaying failed tests...'); }
for (const test of this.errors) {
logger.fail(`${test.title} duration: ${test.duration}ms`);
logger.fail(test.message);
if (test.request) { logger.request(`\n${prettifyResponse(test.request)}\n`); }
if (test.expected) { logger.expected(`\n${prettifyResponse(test.expected)}\n`); }
if (test.actual) { logger.actual(`\n${prettifyResponse(test.actual)}\n\n`); }
}
}
if (this.stats.tests > 0) {
logger.complete(`${this.stats.passes} passing, `
+ `${this.stats.failures} failing, `
+ `${this.stats.errors} errors, `
+ `${this.stats.skipped} skipped, `
+ `${this.stats.tests} total`);
}
logger.complete(`Tests took ${this.stats.duration}ms`);
callback();
});
emitter.on('test pass', (test) => {
logger.pass(`${test.title} duration: ${test.duration}ms`);
if (this.details) {
logger.request(`\n${prettifyResponse(test.request)}\n`);
logger.expected(`\n${prettifyResponse(test.expected)}\n`);
logger.actual(`\n${prettifyResponse(test.actual)}\n\n`);
}
});
emitter.on('test skip', test => logger.skip(test.title));
emitter.on('test fail', (test) => {
logger.fail(`${test.title} duration: ${test.duration}ms`);
if (this.inlineErrors) {
logger.fail(test.message);
if (test.request) { logger.request(`\n${prettifyResponse(test.request)}\n`); }
if (test.expected) { logger.expected(`\n${prettifyResponse(test.expected)}\n`); }
if (test.actual) { logger.actual(`\n${prettifyResponse(test.actual)}\n\n`); }
} else {
this.errors.push(test);
}
});
emitter.on('test error', (error, test) => {
const connectionErrors = [
'ECONNRESET',
'ENOTFOUND',
'ESOCKETTIMEDOUT',
'ETIMEDOUT',
'ECONNREFUSED',
'EHOSTUNREACH',
'EPIPE',
];
if (connectionErrors.indexOf(error.code) > -1) {
test.message = 'Error connecting to server under test!';
}
if (!this.inlineErrors) {
this.errors.push(test);
}
logger.error(`${test.title} duration: ${test.duration}ms`);
if (connectionErrors.indexOf(error.code) > -1) {
return logger.error(test.message);
}
logger.error(error.stack);
});
};
module.exports = CLIReporter;
| 30.686869 | 89 | 0.613562 |
7339cebadff6f44b7f257c5260f5f8f93199cb08 | 1,215 | js | JavaScript | commands/musicCommands/remove.js | TelevisionNinja/Row-Bot | 8403e82a318639bd3da541ee5484afe9efa4f773 | [
"MIT"
] | null | null | null | commands/musicCommands/remove.js | TelevisionNinja/Row-Bot | 8403e82a318639bd3da541ee5484afe9efa4f773 | [
"MIT"
] | null | null | null | commands/musicCommands/remove.js | TelevisionNinja/Row-Bot | 8403e82a318639bd3da541ee5484afe9efa4f773 | [
"MIT"
] | null | null | null | import { default as musicConfig } from './musicConfig.json';
import { default as audio } from '../../lib/audio.js';
import { Constants } from 'discord.js';
const removeConfig = musicConfig.remove;
export default {
interactionData: {
name: removeConfig.names[0],
description: removeConfig.description,
type: Constants.ApplicationCommandOptionTypes.SUB_COMMAND,
options: [
{
name: 'index',
description: 'The index of the song to remove',
required: true,
type: Constants.ApplicationCommandOptionTypes.INTEGER
}
]
},
names: removeConfig.names,
description: removeConfig.description,
argsRequired: true,
argsOptional: false,
vcMemberOnly: true,
usage: '<index>',
execute(msg, args) {
const index = parseInt(args[0]);
if (isNaN(index)) {
msg.channel.send('Please provide a number');
}
else {
audio.remove(msg, index);
}
},
executeInteraction(interaction) {
const index = interaction.options.getInteger('index');
audio.removeInteraction(interaction, index);
}
}
| 28.255814 | 69 | 0.594239 |
733a13083d4edfb3c13739a03904ca263e92c5eb | 272 | js | JavaScript | src/styles/theme/spacing.js | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | null | null | null | src/styles/theme/spacing.js | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | 5 | 2021-06-28T19:28:23.000Z | 2022-02-26T19:07:46.000Z | src/styles/theme/spacing.js | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | null | null | null | export const spacings = {
auto: 'auto',
zero: '0',
xxsm: '.1em',
xsm: '.2em',
md: '.5em',
nm: '1em',
xnm: '2.4em',
lg: '5em',
x: '10em',
xl: '16em',
fw: '100%',
video: '20em',
share: '30em',
inputMargin: '.7em 0',
};
export default spacings;
| 13.6 | 25 | 0.503676 |
733a5b06dc28f00a0538100c82d4615e7072c4d6 | 360 | js | JavaScript | splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/SplunkWebCore/search_mrsparkle/exposed/js/contrib/jg_lib/graphics/Caps.js | livehybrid/addonfactory-ucc-generator | 421c4f9cfb279f02fa8927cc7cf21f4ce48e7af5 | [
"Apache-2.0"
] | null | null | null | splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/SplunkWebCore/search_mrsparkle/exposed/js/contrib/jg_lib/graphics/Caps.js | livehybrid/addonfactory-ucc-generator | 421c4f9cfb279f02fa8927cc7cf21f4ce48e7af5 | [
"Apache-2.0"
] | null | null | null | splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/SplunkWebCore/search_mrsparkle/exposed/js/contrib/jg_lib/graphics/Caps.js | livehybrid/addonfactory-ucc-generator | 421c4f9cfb279f02fa8927cc7cf21f4ce48e7af5 | [
"Apache-2.0"
] | null | null | null | /*!
* Copyright (c) 2007-2016 Jason Gatt
*
* Released under the MIT license:
* http://opensource.org/licenses/MIT
*/
define(function(require, exports, module)
{
var Class = require("../Class");
return Class(module.id, function(Caps)
{
// Public Static Constants
Caps.NONE = "none";
Caps.ROUND = "round";
Caps.SQUARE = "square";
});
});
| 15 | 41 | 0.636111 |
733a6134708992202c3f267c55bc4ee239477388 | 5,529 | js | JavaScript | publish/src/commands/nominate.js | SKYLARMIC25/synthetix | 64b8e58507aef5dcc0c41f5645e51620fbc9ab82 | [
"MIT"
] | 1 | 2021-08-13T19:19:58.000Z | 2021-08-13T19:19:58.000Z | publish/src/commands/nominate.js | SKYLARMIC25/synthetix | 64b8e58507aef5dcc0c41f5645e51620fbc9ab82 | [
"MIT"
] | null | null | null | publish/src/commands/nominate.js | SKYLARMIC25/synthetix | 64b8e58507aef5dcc0c41f5645e51620fbc9ab82 | [
"MIT"
] | null | null | null | 'use strict';
const ethers = require('ethers');
const { gray, yellow, red, cyan } = require('chalk');
const {
getUsers,
constants: { CONFIG_FILENAME, DEPLOYMENT_FILENAME },
} = require('../../..');
const {
ensureNetwork,
getDeploymentPathForNetwork,
ensureDeploymentPath,
loadAndCheckRequiredSources,
loadConnections,
confirmAction,
} = require('../util');
const nominate = async ({
network,
newOwner,
contracts,
useFork = false,
deploymentPath,
gasPrice,
gasLimit,
useOvm,
privateKey,
providerUrl,
yes,
}) => {
ensureNetwork(network);
deploymentPath = deploymentPath || getDeploymentPathForNetwork({ network, useOvm });
ensureDeploymentPath(deploymentPath);
if (!newOwner) {
newOwner = getUsers({ network, useOvm, user: 'owner' }).address;
}
if (!newOwner || !ethers.utils.isAddress(newOwner)) {
console.error(red('Invalid new owner to nominate. Please check the option and try again.'));
process.exit(1);
} else {
newOwner = newOwner.toLowerCase();
}
const { config, deployment } = loadAndCheckRequiredSources({
deploymentPath,
network,
});
contracts.forEach(contract => {
if (!(contract in config)) {
console.error(red(`Contract ${contract} isn't in the config for this deployment!`));
process.exit(1);
}
});
if (!contracts.length) {
// if contracts not supplied, use all contracts except the DappMaintenance (UI control)
contracts = Object.keys(config).filter(contract => contract !== 'DappMaintenance');
}
const { providerUrl: envProviderUrl, privateKey: envPrivateKey } = loadConnections({
network,
useFork,
});
if (!providerUrl) {
if (!envProviderUrl) {
throw new Error('Missing .env key of PROVIDER_URL. Please add and retry.');
}
providerUrl = envProviderUrl;
}
// if not specified, or in a local network, override the private key passed as a CLI option, with the one specified in .env
if (network !== 'local' && !privateKey && !useFork) {
privateKey = envPrivateKey;
}
const provider = new ethers.providers.JsonRpcProvider(providerUrl);
let wallet;
if (!privateKey) {
const account = getUsers({ network, user: 'owner' }).address; // protocolDAO
wallet = provider.getSigner(account);
wallet.address = await wallet.getAddress();
} else {
wallet = new ethers.Wallet(privateKey, provider);
}
const signerAddress = wallet.address;
console.log(gray(`Using account with public key ${signerAddress}`));
if (!yes) {
try {
await confirmAction(
cyan(
`${yellow(
'WARNING'
)}: This action will nominate ${newOwner} as the owner in ${network} of the following contracts:\n- ${contracts.join(
'\n- '
)}`
) + '\nDo you want to continue? (y/n) '
);
} catch (err) {
console.log(gray('Operation cancelled'));
process.exit();
}
}
for (const contract of contracts) {
const { address, source } = deployment.targets[contract];
const { abi } = deployment.sources[source];
const deployedContract = new ethers.Contract(address, abi, wallet);
// ignore contracts that don't support Owned
if (!deployedContract.functions.owner) {
continue;
}
const currentOwner = (await deployedContract.owner()).toLowerCase();
const nominatedOwner = (await deployedContract.nominatedOwner()).toLowerCase();
console.log(
gray(
`${contract} current owner is ${currentOwner}.\nCurrent nominated owner is ${nominatedOwner}.`
)
);
if (signerAddress.toLowerCase() !== currentOwner) {
console.log(cyan(`Cannot nominateNewOwner for ${contract} as you aren't the owner!`));
} else if (currentOwner !== newOwner && nominatedOwner !== newOwner) {
// check for legacy function
const nominationFnc =
'nominateOwner' in deployedContract ? 'nominateOwner' : 'nominateNewOwner';
console.log(yellow(`Invoking ${contract}.${nominationFnc}(${newOwner})`));
const overrides = {
gasLimit,
gasPrice: ethers.utils.parseUnits(gasPrice, 'gwei'),
};
const tx = await deployedContract[nominationFnc](newOwner, overrides);
await tx.wait();
} else {
console.log(gray('No change required.'));
}
}
};
module.exports = {
nominate,
cmd: program =>
program
.command('nominate')
.description('Nominate a new owner for one or more contracts')
.option(
'-d, --deployment-path <value>',
`Path to a folder that has your input configuration file ${CONFIG_FILENAME} and where your ${DEPLOYMENT_FILENAME} files will go`
)
.option('-g, --gas-price <value>', 'Gas price in GWEI', '1')
.option(
'-k, --use-fork',
'Perform the deployment on a forked chain running on localhost (see fork command).',
false
)
.option('-l, --gas-limit <value>', 'Gas limit', parseInt, 15e4)
.option('-n, --network <value>', 'The network to run off.', x => x.toLowerCase(), 'kovan')
.option(
'-o, --new-owner <value>',
'The address of the new owner (please include the 0x prefix)'
)
.option('-z, --use-ovm', 'Target deployment for the OVM (Optimism).')
.option(
'-p, --provider-url <value>',
'Ethereum network provider URL. If default, will use PROVIDER_URL found in the .env file.'
)
.option(
'-v, --private-key [value]',
'The private key to deploy with (only works in local mode, otherwise set in .env).'
)
.option('-y, --yes', 'Dont prompt, just reply yes.')
.option(
'-c, --contracts [value]',
'The list of contracts. Applies to all contract by default',
(val, memo) => {
memo.push(val);
return memo;
},
[]
)
.action(nominate),
};
| 28.353846 | 132 | 0.667209 |
733ad3b32de259d674bbc055936ad4c0f4dca4ae | 5,152 | js | JavaScript | dist/docs/releases/v0.7.2/docs/releases/v0.7.1/docs/releases/v0.7.1/docs/releases/v0.6.3/5.f8a38ce8.js | evilru/vue-material | b802afd4346feb0093fc0a09513e9df9b233b29c | [
"MIT"
] | 1 | 2019-06-03T14:21:38.000Z | 2019-06-03T14:21:38.000Z | node_modules/vue-material/dist/docs/releases/v0.6.3/5.f8a38ce8.js | Alekcy/vacancy-analysis | 0938e90db8827ac33036996b8492df4ebce0ad0c | [
"MIT"
] | 3 | 2020-12-04T18:00:11.000Z | 2022-02-10T17:58:48.000Z | node_modules/vue-material/dist/docs/releases/v0.6.3/5.f8a38ce8.js | Alekcy/vacancy-analysis | 0938e90db8827ac33036996b8492df4ebce0ad0c | [
"MIT"
] | null | null | null | webpackJsonp([5,32],{110:function(e,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.default={data:function(){return{progress:0,progressInterval:null,transition:!0}},methods:{startProgress:function(){var e=this;this.progressInterval=window.setInterval((function(){e.progress+=3,e.progress>100&&window.clearInterval(e.progressInterval)}),100)},restartProgress:function(){var e=this;this.progress=0,this.transition=!1,window.clearInterval(this.progressInterval),window.setTimeout((function(){e.transition=!0,e.startProgress()}),600)}},mounted:function(){this.startProgress()}},e.exports=s.default},232:function(e,s,r){s=e.exports=r(1)(),s.push([e.id,".progress-area[data-v-26399830]{height:44px}.progress-area+.md-button[data-v-26399830]{margin:16px 0 0}.md-progress[data-v-26399830]{margin-bottom:16px}",""])},356:function(e,s,r){var t,a;r(553),t=r(110);var o=r(462);a=t=t||{},"object"!=typeof t.default&&"function"!=typeof t.default||(a=t=t.default),"function"==typeof a&&(a=a.options),a.render=o.render,a.staticRenderFns=o.staticRenderFns,a._scopeId="data-v-26399830",e.exports=t},462:function(e,s){e.exports={render:function(){var e=this,s=e.$createElement,r=e._self._c||s;return r("page-content",{attrs:{"page-title":"Components - Progress"}},[r("docs-component",[r("div",{slot:"description"},[r("p",[e._v("A linear progress indicator should always fill from 0% to 100% and never decrease in value. It should be represented by bars on the edge of a header or sheet that appear and disappear.")]),e._v(" "),r("p",[e._v("The following classes can be applied to change the color palette:")]),e._v(" "),r("ul",{staticClass:"md-body-2"},[r("li",[r("code",[e._v("md-accent")])]),e._v(" "),r("li",[r("code",[e._v("md-warn")])])])]),e._v(" "),r("div",{slot:"api"},[r("api-table",{attrs:{name:"md-progress"}},[r("md-table",{slot:"properties"},[r("md-table-header",[r("md-table-row",[r("md-table-head",[e._v("Name")]),e._v(" "),r("md-table-head",[e._v("Type")]),e._v(" "),r("md-table-head",[e._v("Description")])],1)],1),e._v(" "),r("md-table-body",[r("md-table-row",[r("md-table-cell",[e._v("md-indeterminate")]),e._v(" "),r("md-table-cell",[r("code",[e._v("Boolean")])]),e._v(" "),r("md-table-cell",[e._v("Enable the indeterminate state. Default "),r("code",[e._v("false")])])],1),e._v(" "),r("md-table-row",[r("md-table-cell",[e._v("md-progress")]),e._v(" "),r("md-table-cell",[r("code",[e._v("Number")])]),e._v(" "),r("md-table-cell",[e._v("Define the current progress of the progress. Default "),r("code",[e._v("0")])])],1)],1)],1)],1)],1),e._v(" "),r("div",{slot:"example"},[r("example-box",{attrs:{"card-title":"Determinate"}},[r("div",{staticClass:"progress-demo",slot:"demo"},[r("div",{staticClass:"progress-area"},[e.transition?r("md-progress",{attrs:{"md-progress":e.progress}}):e._e(),e._v(" "),e.transition?r("md-progress",{staticClass:"md-accent",attrs:{"md-progress":e.progress}}):e._e(),e._v(" "),e.transition?r("md-progress",{staticClass:"md-warn",attrs:{"md-progress":e.progress}}):e._e()],1),e._v(" "),r("md-button",{staticClass:"md-primary md-raised",nativeOn:{click:function(s){e.restartProgress(s)}}},[e._v("Restart")])],1),e._v(" "),r("div",{slot:"code"},[r("code-block",{attrs:{lang:"xml"}},[e._v('\n <md-progress :md-progress="progress"></md-progress>\n <md-progress class="md-accent" :md-progress="progress"></md-progress>\n <md-progress class="md-warn" :md-progress="progress"></md-progress>\n ')])],1)]),e._v(" "),r("example-box",{attrs:{"card-title":"Indeterminate"}},[r("div",{staticClass:"progress-demo",slot:"demo"},[r("div",{staticClass:"progress-area"},[e.transition?r("md-progress",{attrs:{"md-indeterminate":""}}):e._e(),e._v(" "),e.transition?r("md-progress",{staticClass:"md-accent",attrs:{"md-indeterminate":""}}):e._e(),e._v(" "),e.transition?r("md-progress",{staticClass:"md-warn",attrs:{"md-indeterminate":""}}):e._e()],1)]),e._v(" "),r("div",{slot:"code"},[r("code-block",{attrs:{lang:"xml"}},[e._v('\n <md-progress md-indeterminate></md-progress>\n <md-progress class="md-accent" md-indeterminate></md-progress>\n <md-progress class="md-warn" md-indeterminate></md-progress>\n ')])],1)]),e._v(" "),r("example-box",{attrs:{"card-title":"Themes"}},[r("div",{staticClass:"progress-demo",slot:"demo"},[r("div",{staticClass:"progress-area"},[e.transition?r("md-progress",{attrs:{"md-theme":"orange","md-indeterminate":""}}):e._e(),e._v(" "),e.transition?r("md-progress",{attrs:{"md-theme":"green","md-progress":e.progress}}):e._e(),e._v(" "),e.transition?r("md-progress",{attrs:{"md-theme":"purple","md-indeterminate":""}}):e._e()],1)]),e._v(" "),r("div",{slot:"code"},[r("code-block",{attrs:{lang:"xml"}},[e._v('\n <md-progress md-theme="orange" md-indeterminate></md-progress>\n <md-progress md-theme="green" :md-progress="progress"></md-progress>\n <md-progress md-theme="purple" md-indeterminate></md-progress>\n ')])],1)])],1)])],1)},staticRenderFns:[]}},553:function(e,s,r){var t=r(232);"string"==typeof t&&(t=[[e.id,t,""]]);r(2)(t,{});t.locals&&(e.exports=t.locals)}}); | 5,152 | 5,152 | 0.639946 |
733aeddc3a6f3f5e43ced02c6a6db7a343701c8b | 278 | js | JavaScript | ormconfig.js | tedroeloffzen/to-do-teddy | c4a8d80319b0d5e69b7d5b6745ae3b43abd943f8 | [
"MIT"
] | null | null | null | ormconfig.js | tedroeloffzen/to-do-teddy | c4a8d80319b0d5e69b7d5b6745ae3b43abd943f8 | [
"MIT"
] | null | null | null | ormconfig.js | tedroeloffzen/to-do-teddy | c4a8d80319b0d5e69b7d5b6745ae3b43abd943f8 | [
"MIT"
] | null | null | null | module.exports = {
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'todo',
password: 'todo',
database: 'todo',
synchronize: false,
logging: ['error', 'query'],
entities: ["dist/**/*.entity{.ts,.js}"],
migrations: ["dist/migrations/*{.ts,.js}"]
};
| 21.384615 | 44 | 0.593525 |
733aee78e6a4d4b0a0fd72d398725a9d69cbff52 | 270 | js | JavaScript | config/dev.env.js | myeasonhost/myweb | f2465b29b7d7c0eb49df25cdf23af3da66aeb7c5 | [
"MIT"
] | null | null | null | config/dev.env.js | myeasonhost/myweb | f2465b29b7d7c0eb49df25cdf23af3da66aeb7c5 | [
"MIT"
] | null | null | null | config/dev.env.js | myeasonhost/myweb | f2465b29b7d7c0eb49df25cdf23af3da66aeb7c5 | [
"MIT"
] | null | null | null | module.exports = {
NODE_ENV: '"development"',
BASE_API: '"https://api-dev"',
APP_ORIGIN: '"https://wz.com"',
ZB_PHP_API: '"http://zb-api.mekxfj.com/api"',
ZB_JAVA_API: '"http://api.hsxssdx.com/api"',
SOCKET_API: '"http://DESKTOP-KED4AR2:8888"'
}
| 30 | 49 | 0.611111 |
733bd6cfadd2d670c5819631012188a5f7e9a3d4 | 611 | js | JavaScript | functions/src/app.js | andrerfarias/firebase-functions-es6 | e1e18717044c7dc6bdcf1f2aa5585eb9b6718d5d | [
"MIT"
] | null | null | null | functions/src/app.js | andrerfarias/firebase-functions-es6 | e1e18717044c7dc6bdcf1f2aa5585eb9b6718d5d | [
"MIT"
] | null | null | null | functions/src/app.js | andrerfarias/firebase-functions-es6 | e1e18717044c7dc6bdcf1f2aa5585eb9b6718d5d | [
"MIT"
] | null | null | null | import * as functions from "firebase-functions"
import express from "express"
import cors from "cors"
const app = express()
app.use(cors({ origin: true }))
app.get("/route1", (request, response) => {
const resp = {message: "Teste get:"+request.url}
response.send(resp)
})
app.post("/postRoute", (request, response) => {
response.send(request.body)
})
app.listen({port:3000})
export let api = functions.https.onRequest((request, response) => {
if (!request.path) {
request.url = `/${request.url}` // prepend '/' no final da url para manter os query params
}
return app(request, response)
}) | 24.44 | 94 | 0.674304 |
733c116a2926374f52bf647847f72c1fcf0237aa | 10,354 | js | JavaScript | frontend/src/core/editor/components/KeyboardShortcuts.js | Pike/pontoon | f8bfbfb2525fd03228de7c43c62d615290e08262 | [
"BSD-3-Clause"
] | 2 | 2020-08-27T13:31:04.000Z | 2021-02-25T14:37:40.000Z | frontend/src/core/editor/components/KeyboardShortcuts.js | flozz/pontoon | 3a2fd10db55aba279055ca42c3893214f002b77c | [
"BSD-3-Clause"
] | null | null | null | frontend/src/core/editor/components/KeyboardShortcuts.js | flozz/pontoon | 3a2fd10db55aba279055ca42c3893214f002b77c | [
"BSD-3-Clause"
] | null | null | null | /* @flow */
import * as React from 'react';
import { Localized } from '@fluent/react';
import { useOnDiscard } from 'core/utils';
import './KeyboardShortcuts.css';
type Props = {};
type State = {|
visible: boolean,
|};
type KeyboardShortcutsProps = {
onDiscard: (e: SyntheticEvent<any>) => void,
};
function KeyboardShortcuts({ onDiscard }: KeyboardShortcutsProps) {
const ref = React.useRef(null);
useOnDiscard(ref, onDiscard);
return (
<div ref={ref} className='overlay' onClick={onDiscard}>
<Localized id='editor-KeyboardShortcuts--overlay-title'>
<h2>KEYBOARD SHORTCUTS</h2>
</Localized>
<table>
<tbody>
<tr>
<Localized id='editor-KeyboardShortcuts--save-translation'>
<td>Save Translation</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--save-translation-shortcut'
elems={{
accel: <span />,
}}
>
<td>{'<accel>Enter</accel>'}</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--cancel-translation'>
<td>Cancel Translation</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--cancel-translation-shortcut'
elems={{
accel: <span />,
}}
>
<td>{'<accel>Esc</accel>'}</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--insert-a-new-line'>
<td>Insert A New Line</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--insert-a-new-line-shortcut'
elems={{
accel: <span />,
mod1: <span />,
}}
>
<td>
{'<mod1>Shift</mod1> + <accel>Enter</accel>'}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--go-to-previous-string'>
<td>Go To Previous String</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--go-to-previous-string-shortcut'
elems={{
accel: <span />,
mod1: <span />,
}}
>
<td>{'<mod1>Alt</mod1> + <accel>Up</accel>'}</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--go-to-next-string'>
<td>Go To Next String</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--go-to-next-string-shortcut'
elems={{
accel: <span />,
mod1: <span />,
}}
>
<td>{'<mod1>Alt</mod1> + <accel>Down</accel>'}</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--copy-from-source'>
<td>Copy From Source</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--copy-from-source-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>C</accel>'
}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--clear-translation'>
<td>Clear Translation</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--clear-translation-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>Backspace</accel>'
}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--search-strings'>
<td>Search Strings</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--search-strings-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>F</accel>'
}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--select-all-strings'>
<td>Select All Strings</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--select-all-strings-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>A</accel>'
}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--copy-from-previous-helper'>
<td>Copy From Previous Helper</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--copy-from-previous-helper-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>Up</accel>'
}
</td>
</Localized>
</tr>
<tr>
<Localized id='editor-KeyboardShortcuts--copy-from-next-helper'>
<td>Copy From Next Helper</td>
</Localized>
<Localized
id='editor-KeyboardShortcuts--copy-from-next-helper-shortcut'
elems={{
accel: <span />,
mod1: <span />,
mod2: <span />,
}}
>
<td>
{
'<mod1>Ctrl</mod1> + <mod2>Shift</mod2> + <accel>Down</accel>'
}
</td>
</Localized>
</tr>
</tbody>
</table>
</div>
);
}
/*
* Shows a list of keyboard shortcuts.
*/
export default class KeyboardShortcutsBase extends React.Component<
Props,
State,
> {
constructor() {
super();
this.state = {
visible: false,
};
}
toggleVisibility: () => void = () => {
this.setState((state) => {
return { visible: !state.visible };
});
};
handleDiscard: () => void = () => {
this.setState({
visible: false,
});
};
render(): React.Element<'div'> {
return (
<div className='keyboard-shortcuts'>
<Localized
id='editor-KeyboardShortcuts--button'
attrs={{ title: true }}
>
<div
className='selector far fa-keyboard'
title='Keyboard Shortcuts'
onClick={this.toggleVisibility}
/>
</Localized>
{this.state.visible && (
<KeyboardShortcuts onDiscard={this.handleDiscard} />
)}
</div>
);
}
}
| 38.779026 | 103 | 0.314468 |
733c4fc5db3328613f3544a33aef5dd20dc55f93 | 923 | js | JavaScript | MovieArtArena.Web/app/public/dist/0.5498e7229cf3f0e4ee72.hot-update.js | cnunezz0911/StarterProject | 53eb01caa446f4910d0ee94cea15fd9cc714bf5a | [
"MIT"
] | null | null | null | MovieArtArena.Web/app/public/dist/0.5498e7229cf3f0e4ee72.hot-update.js | cnunezz0911/StarterProject | 53eb01caa446f4910d0ee94cea15fd9cc714bf5a | [
"MIT"
] | null | null | null | MovieArtArena.Web/app/public/dist/0.5498e7229cf3f0e4ee72.hot-update.js | cnunezz0911/StarterProject | 53eb01caa446f4910d0ee94cea15fd9cc714bf5a | [
"MIT"
] | null | null | null | webpackHotUpdate(0,{
/***/ "./src/Views/Post.js":
/*!***************************!*\
!*** ./src/Views/Post.js ***!
\***************************/
/*! dynamic exports provided */
/*! exports used: default */
/***/ (function(module, __webpack_exports__) {
"use strict";
throw new Error("Module build failed: SyntaxError: C:/StarterProject/MoviePosterArena/StarterProject/MovieArtArena.Web/app/public/src/Views/Post.js: Unexpected token, expected { (4:11)\n\n\u001b[0m \u001b[90m 2 | \u001b[39m\u001b[36mimport\u001b[39m axios from \u001b[32m'axios'\u001b[39m\n \u001b[90m 3 | \u001b[39m\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 4 | \u001b[39m\u001b[36mclass\u001b[39m \u001b[33mPost\u001b[39m \u001b[33mExtends\u001b[39m\u001b[33m.\u001b[39m\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n");
/***/ })
})
//# sourceMappingURL=0.5498e7229cf3f0e4ee72.hot-update.js.map | 54.294118 | 575 | 0.660888 |
733d3a6b19aa869c2d801101439acb7cb66df42c | 404 | js | JavaScript | routes/db.js | iot-platform-for-smart-home/panorama | 418d8d3d5307571497c24ea804e85cfc0521ba39 | [
"MIT"
] | null | null | null | routes/db.js | iot-platform-for-smart-home/panorama | 418d8d3d5307571497c24ea804e85cfc0521ba39 | [
"MIT"
] | 1 | 2021-05-09T04:26:50.000Z | 2021-05-09T04:26:50.000Z | routes/db.js | iot-platform-for-smart-home/panorama | 418d8d3d5307571497c24ea804e85cfc0521ba39 | [
"MIT"
] | null | null | null | var mysql = require('mysql');
var pool = mysql.createPool({
host:'localhost',
user:'root',
port:3306,
password:'123456',
database:'expressjs'
});
function query(sql,callback){
pool.getConnection(function(err,connection){
connection.query(sql,function(err,rows){
callback(err,rows);
connection.release();
});
});
}
exports.query = query; | 23.764706 | 48 | 0.608911 |
733d58366983ba52a37fe0dc8c57941a456f52b8 | 8,318 | js | JavaScript | test/js_validator_tests/assets/validator.js | mickys/rico-poc | c56c67af7bce994f7ab8e25be46b95a02de6f16b | [
"Apache-2.0"
] | 30 | 2019-11-17T06:18:29.000Z | 2021-12-30T05:40:46.000Z | test/js_validator_tests/assets/validator.js | mickys/rico-poc | c56c67af7bce994f7ab8e25be46b95a02de6f16b | [
"Apache-2.0"
] | 23 | 2019-11-27T23:49:31.000Z | 2020-04-10T17:31:21.000Z | test/js_validator_tests/assets/validator.js | mickys/rico-poc | c56c67af7bce994f7ab8e25be46b95a02de6f16b | [
"Apache-2.0"
] | 15 | 2019-11-29T18:43:04.000Z | 2021-09-07T22:49:39.000Z | /*
* The contract validator base class.
*
* @author Micky Socaci <micky@nowlive.ro>, Fabian Vogelsteller <@frozeman>
*/
const { BN, constants } = require("openzeppelin-test-helpers");
const { MAX_UINT256 } = constants;
const web3util = require("web3-utils");
const ether = 1000000000000000000; // 1 ether in wei
const etherBN = new BN(ether.toString());
const solidity = {
ether: ether,
etherBN: etherBN,
gwei: 1000000000
};
class Validator {
// set the defaults
constructor(settings, currentBlock = 0) {
this.block = currentBlock;
this.commitPhaseStartBlock = this.block + settings.rico.startBlockDelay;
this.blocksPerDay = settings.rico.blocksPerDay; // 6450
this.commitPhaseDays = settings.rico.commitPhaseDays; // 22
this.stageCount = settings.rico.stageCount; // 12
this.stageDays = settings.rico.stageDays; // 30
this.commitPhasePrice = new BN(settings.rico.commitPhasePrice); // 0.002
this.stagePriceIncrease = new BN(settings.rico.stagePriceIncrease); // 0.0001
this.stages = [];
this.init();
}
init() {
this.commitPhaseBlockCount = this.blocksPerDay * this.commitPhaseDays;
this.commitPhaseEndBlock = this.commitPhaseStartBlock + this.commitPhaseBlockCount - 1;
this.stageBlockCount = this.blocksPerDay * this.stageDays;
// Generate stage data
this.stages[0] = {
startBlock: this.commitPhaseStartBlock,
endBlock: this.commitPhaseEndBlock,
tokenPrice: this.commitPhasePrice,
};
let lastStageBlockEnd = this.stages[0].endBlock;
for (let i = 1; i <= this.stageCount; i++) {
const startBlock = lastStageBlockEnd + 1;
this.stages[i] = {
startBlock: startBlock,
endBlock: lastStageBlockEnd + this.stageBlockCount,
tokenPrice: this.commitPhasePrice.add(
this.stagePriceIncrease.mul(
new BN(i)
)
),
};
lastStageBlockEnd = this.stages[i].endBlock;
}
// The buy phase starts on the subsequent block of the commitPhase's (stage0) endBlock
this.buyPhaseStartBlock = this.commitPhaseEndBlock + 1;
this.buyPhaseEndBlock = lastStageBlockEnd;
// The duration of buyPhase in blocks
this.buyPhaseBlockCount = lastStageBlockEnd - this.buyPhaseStartBlock + 1;
}
getTokenAmountForEthAtStage(ethValue, stageId) {
if(typeof this.stages[stageId] === "undefined") {
throw "Stage " + stageId + " not found.";
}
return new BN(ethValue.toString()).mul(
new BN("10").pow( new BN("18") )
).div(
this.stages[stageId].tokenPrice
);
}
getEthAmountForTokensAtStage(tokenAmount, stageId) {
if(typeof this.stages[stageId] === "undefined") {
throw "Stage " + stageId + " not found.";
}
return new BN(tokenAmount.toString()).mul(
this.stages[stageId].tokenPrice
).div(
new BN("10").pow( new BN("18") )
);
}
getCurrentGlobalUnlockRatio() {
const currentBlock = new BN( this.getCurrentEffectiveBlockNumber() );
const BuyPhaseStartBlock = new BN( this.buyPhaseStartBlock - 1 );
const BuyPhaseEndBlock = new BN( this.buyPhaseEndBlock );
const precision = new BN(20);
return this.getUnlockPercentage(currentBlock, BuyPhaseStartBlock, BuyPhaseEndBlock, precision);
}
getUnlockPercentage(_currentBlock, _startBlock, _endBlock, _precision) {
const currentBlock = new BN( _currentBlock );
const startBlock = new BN( _startBlock );
const endBlock = new BN( _endBlock );
const precision = new BN( _precision );
if(precision.lt(new BN("2")) && precision.gt(new BN("20"))) {
throw "Precision should be higher than 1 and lower than 20";
}
// currentBlock >= startBlock && currentBlock < endBlock
if(currentBlock.gte(startBlock) && currentBlock.lt(endBlock))
{
const passedBlocks = currentBlock.sub(startBlock);
const blockCount = endBlock.sub(startBlock);
return passedBlocks.mul(
new BN(10).pow(precision)
).div(blockCount);
} else if (currentBlock.gte(endBlock)) {
return new BN(10).pow(precision);
} else {
// lower than or equal to start block
return new BN(0);
}s
}
getCurrentStage() {
return this.getStageAtBlock(this.getCurrentEffectiveBlockNumber());
}
getStageAtBlock(_blockNumber) {
this.require(
_blockNumber >= this.commitPhaseStartBlock && _blockNumber <= this.buyPhaseEndBlock,
"Block outside of rICO period."
);
// Return commit phase (stage 0)
if (_blockNumber <= this.commitPhaseEndBlock) {
return 0;
}
// This is the number of blocks starting from the first stage.
const distance = _blockNumber - (this.commitPhaseEndBlock + 1);
// Get the stageId (1..stageCount), commitPhase is stage 0
// e.g. distance = 5, stageBlockCount = 5, stageID = 2
const stageID = 1 + (distance / this.stageBlockCount);
return Math.floor(stageID);
}
getCurrentPrice() {
return this.getPriceAtSupplyLeft(this.getCurrentEffectiveBlockNumber());
}
getPriceAtSupplyLeft(_blockNumber) {
const stage = this.getStageAtBlock(_blockNumber);
if (stage <= this.stageCount) {
return this.getStage(stage).tokenPrice;
}
return 0;
}
getParticipantReservedTokensAtBlock(_tokenAmount, _blockNumber, _precision = null) {
if(_precision == null) {
_precision = 20;
}
_precision = new BN(_precision);
const tokenAmount = new BN(_tokenAmount);
if(tokenAmount.gt(new BN(0))) {
if(_blockNumber < this.buyPhaseStartBlock) {
// before buy phase.. return full amount
return tokenAmount;
} else if(_blockNumber <= this.buyPhaseEndBlock) {
// in buy phase
const percentage = this.getUnlockPercentage(
_blockNumber,
this.buyPhaseStartBlock - 1, // adjust the period
this.buyPhaseEndBlock,
_precision
);
const unlocked = tokenAmount.mul(percentage).div(
new BN("10").pow(
_precision
)
);
return tokenAmount.sub(unlocked);
}
// after buyPhase's end
return new BN("0");
}
return new BN("0");
}
getUnockedTokensForBoughtAmountAtBlock(_tokenAmount, _blockNumber, precision) {
return new BN(_tokenAmount).sub(
this.getParticipantReservedTokensAtBlock(
_tokenAmount,
_blockNumber,
precision
)
);
}
committableEthAtStageForTokenBalance(_contractTokenBalance, _stage) {
// Multiply the number of tokens held by the contract with the token price
// at the specified stage and perform precision adjustments(div).
return _contractTokenBalance.mul(
this.stages[_stage].tokenPrice
).div(
new BN("10").pow(new BN("18"))
);
}
getStage(id) {
return this.stages[id];
}
setBlockNumber(block) {
this.block = parseInt(block, 10);
}
getCurrentEffectiveBlockNumber() {
return this.block;
}
toEth(amount) {
return web3util.fromWei(amount, "ether");
}
static toEth(amount) {
return web3util.fromWei(amount, "ether");
}
getOneEtherBn() {
return etherBN;
}
require(statement, message) {
if(!statement) {
throw message;
}
}
}
module.exports = Validator;
| 31.507576 | 103 | 0.578625 |
733ecf3e9758ce66fb55bd7f1eff9b79fee75509 | 578 | js | JavaScript | presentation/components/StateExample.js | lukaskroepfl/react-redux-talk | 721c31376cd7b86e3a3abf5de8f89e0bab693ae3 | [
"MIT"
] | null | null | null | presentation/components/StateExample.js | lukaskroepfl/react-redux-talk | 721c31376cd7b86e3a3abf5de8f89e0bab693ae3 | [
"MIT"
] | null | null | null | presentation/components/StateExample.js | lukaskroepfl/react-redux-talk | 721c31376cd7b86e3a3abf5de8f89e0bab693ae3 | [
"MIT"
] | null | null | null | import React from 'react';
import {
Appear,
BlockQuote,
Cite,
Code,
CodePane,
ComponentPlayground,
Deck,
Fill,
Fit,
Heading,
Image,
Layout,
Link,
List,
ListItem,
Markdown,
Quote,
Slide,
Spectacle,
Text
} from 'spectacle';
import stateExample from 'raw-loader!./examples/StateExample';
export default (
<Slide bgColor="primary" maxWidth="1400px" margin={20}>
<Heading textColor="black" size={3}>
Internal Data with State
</Heading>
<br />
<ComponentPlayground theme="dark" code={stateExample} />
</Slide>
);
| 14.820513 | 62 | 0.650519 |
733ee7b3ba9608294b9020d3669788f9fb590ab1 | 40,637 | js | JavaScript | hass_frontend/frontend_latest/chunk.09589ceb8b539b8917c1.js | algar42/ioBroker.lovelace | a3ab4eac1e83ef26006e6231b880b8f779ea7089 | [
"Apache-2.0"
] | 50 | 2019-05-16T23:36:20.000Z | 2022-02-07T08:01:03.000Z | hass_frontend/frontend_latest/chunk.09589ceb8b539b8917c1.js | 5G7K/ioBroker.lovelace | f9c43837b89d4c31b4d53d4b186a701ab71efc4e | [
"Apache-2.0"
] | 238 | 2019-05-29T13:49:55.000Z | 2022-03-20T17:24:26.000Z | hass_frontend/frontend_latest/chunk.09589ceb8b539b8917c1.js | algar42/ioBroker.lovelace | a3ab4eac1e83ef26006e6231b880b8f779ea7089 | [
"Apache-2.0"
] | 40 | 2019-07-14T14:00:22.000Z | 2021-12-28T19:10:39.000Z | /*! For license information please see chunk.09589ceb8b539b8917c1.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6363],{46363:(t,e,o)=>{"use strict";function n(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a}Object.create;Object.create;var r=o(55704),i=o(47765);function a(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a}Object.create;Object.create;var c=o(58014),l=o(78220),s=o(87480),d=o(72774),p={ANIMATING:"mdc-tab-scroller--animating",SCROLL_AREA_SCROLL:"mdc-tab-scroller__scroll-area--scroll",SCROLL_TEST:"mdc-tab-scroller__test"},h={AREA_SELECTOR:".mdc-tab-scroller__scroll-area",CONTENT_SELECTOR:".mdc-tab-scroller__scroll-content"},m=function(t){this.adapter=t};var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,s.__extends)(e,t),e.prototype.getScrollPositionRTL=function(){var t=this.adapter.getScrollAreaScrollLeft(),e=this.calculateScrollEdges().right;return Math.round(e-t)},e.prototype.scrollToRTL=function(t){var e=this.calculateScrollEdges(),o=this.adapter.getScrollAreaScrollLeft(),n=this.clampScrollValue(e.right-t);return{finalScrollPosition:n,scrollDelta:n-o}},e.prototype.incrementScrollRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft(),o=this.clampScrollValue(e-t);return{finalScrollPosition:o,scrollDelta:o-e}},e.prototype.getAnimatingScrollPosition=function(t){return t},e.prototype.calculateScrollEdges=function(){return{left:0,right:this.adapter.getScrollContentOffsetWidth()-this.adapter.getScrollAreaOffsetWidth()}},e.prototype.clampScrollValue=function(t){var e=this.calculateScrollEdges();return Math.min(Math.max(e.left,t),e.right)},e}(m);var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,s.__extends)(e,t),e.prototype.getScrollPositionRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft();return Math.round(t-e)},e.prototype.scrollToRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft(),o=this.clampScrollValue(-t);return{finalScrollPosition:o,scrollDelta:o-e}},e.prototype.incrementScrollRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft(),o=this.clampScrollValue(e-t);return{finalScrollPosition:o,scrollDelta:o-e}},e.prototype.getAnimatingScrollPosition=function(t,e){return t-e},e.prototype.calculateScrollEdges=function(){var t=this.adapter.getScrollContentOffsetWidth();return{left:this.adapter.getScrollAreaOffsetWidth()-t,right:0}},e.prototype.clampScrollValue=function(t){var e=this.calculateScrollEdges();return Math.max(Math.min(e.right,t),e.left)},e}(m);var b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,s.__extends)(e,t),e.prototype.getScrollPositionRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft();return Math.round(e-t)},e.prototype.scrollToRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft(),o=this.clampScrollValue(t);return{finalScrollPosition:o,scrollDelta:e-o}},e.prototype.incrementScrollRTL=function(t){var e=this.adapter.getScrollAreaScrollLeft(),o=this.clampScrollValue(e+t);return{finalScrollPosition:o,scrollDelta:e-o}},e.prototype.getAnimatingScrollPosition=function(t,e){return t+e},e.prototype.calculateScrollEdges=function(){return{left:this.adapter.getScrollContentOffsetWidth()-this.adapter.getScrollAreaOffsetWidth(),right:0}},e.prototype.clampScrollValue=function(t){var e=this.calculateScrollEdges();return Math.min(Math.max(e.right,t),e.left)},e}(m);const g=function(t){function e(o){var n=t.call(this,(0,s.__assign)((0,s.__assign)({},e.defaultAdapter),o))||this;return n.isAnimating=!1,n}return(0,s.__extends)(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return p},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return h},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{eventTargetMatchesSelector:function(){return!1},addClass:function(){},removeClass:function(){},addScrollAreaClass:function(){},setScrollAreaStyleProperty:function(){},setScrollContentStyleProperty:function(){},getScrollContentStyleValue:function(){return""},setScrollAreaScrollLeft:function(){},getScrollAreaScrollLeft:function(){return 0},getScrollContentOffsetWidth:function(){return 0},getScrollAreaOffsetWidth:function(){return 0},computeScrollAreaClientRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},computeScrollContentClientRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},computeHorizontalScrollbarHeight:function(){return 0}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=this.adapter.computeHorizontalScrollbarHeight();this.adapter.setScrollAreaStyleProperty("margin-bottom",-t+"px"),this.adapter.addScrollAreaClass(e.cssClasses.SCROLL_AREA_SCROLL)},e.prototype.getScrollPosition=function(){if(this.isRTL())return this.computeCurrentScrollPositionRTL();var t=this.calculateCurrentTranslateX();return this.adapter.getScrollAreaScrollLeft()-t},e.prototype.handleInteraction=function(){this.isAnimating&&this.stopScrollAnimation()},e.prototype.handleTransitionEnd=function(t){var o=t.target;this.isAnimating&&this.adapter.eventTargetMatchesSelector(o,e.strings.CONTENT_SELECTOR)&&(this.isAnimating=!1,this.adapter.removeClass(e.cssClasses.ANIMATING))},e.prototype.incrementScroll=function(t){0!==t&&this.animate(this.getIncrementScrollOperation(t))},e.prototype.incrementScrollImmediate=function(t){if(0!==t){var e=this.getIncrementScrollOperation(t);0!==e.scrollDelta&&(this.stopScrollAnimation(),this.adapter.setScrollAreaScrollLeft(e.finalScrollPosition))}},e.prototype.scrollTo=function(t){this.isRTL()?this.scrollToImplRTL(t):this.scrollToImpl(t)},e.prototype.getRTLScroller=function(){return this.rtlScrollerInstance||(this.rtlScrollerInstance=this.rtlScrollerFactory()),this.rtlScrollerInstance},e.prototype.calculateCurrentTranslateX=function(){var t=this.adapter.getScrollContentStyleValue("transform");if("none"===t)return 0;var e=/\((.+?)\)/.exec(t);if(!e)return 0;var o=e[1],n=(0,s.__read)(o.split(","),6),r=(n[0],n[1],n[2],n[3],n[4]);n[5];return parseFloat(r)},e.prototype.clampScrollValue=function(t){var e=this.calculateScrollEdges();return Math.min(Math.max(e.left,t),e.right)},e.prototype.computeCurrentScrollPositionRTL=function(){var t=this.calculateCurrentTranslateX();return this.getRTLScroller().getScrollPositionRTL(t)},e.prototype.calculateScrollEdges=function(){return{left:0,right:this.adapter.getScrollContentOffsetWidth()-this.adapter.getScrollAreaOffsetWidth()}},e.prototype.scrollToImpl=function(t){var e=this.getScrollPosition(),o=this.clampScrollValue(t),n=o-e;this.animate({finalScrollPosition:o,scrollDelta:n})},e.prototype.scrollToImplRTL=function(t){var e=this.getRTLScroller().scrollToRTL(t);this.animate(e)},e.prototype.getIncrementScrollOperation=function(t){if(this.isRTL())return this.getRTLScroller().incrementScrollRTL(t);var e=this.getScrollPosition(),o=t+e,n=this.clampScrollValue(o);return{finalScrollPosition:n,scrollDelta:n-e}},e.prototype.animate=function(t){var o=this;0!==t.scrollDelta&&(this.stopScrollAnimation(),this.adapter.setScrollAreaScrollLeft(t.finalScrollPosition),this.adapter.setScrollContentStyleProperty("transform","translateX("+t.scrollDelta+"px)"),this.adapter.computeScrollAreaClientRect(),requestAnimationFrame((function(){o.adapter.addClass(e.cssClasses.ANIMATING),o.adapter.setScrollContentStyleProperty("transform","none")})),this.isAnimating=!0)},e.prototype.stopScrollAnimation=function(){this.isAnimating=!1;var t=this.getAnimatingScrollPosition();this.adapter.removeClass(e.cssClasses.ANIMATING),this.adapter.setScrollContentStyleProperty("transform","translateX(0px)"),this.adapter.setScrollAreaScrollLeft(t)},e.prototype.getAnimatingScrollPosition=function(){var t=this.calculateCurrentTranslateX(),e=this.adapter.getScrollAreaScrollLeft();return this.isRTL()?this.getRTLScroller().getAnimatingScrollPosition(e,t):e-t},e.prototype.rtlScrollerFactory=function(){var t=this.adapter.getScrollAreaScrollLeft();this.adapter.setScrollAreaScrollLeft(t-1);var e=this.adapter.getScrollAreaScrollLeft();if(e<0)return this.adapter.setScrollAreaScrollLeft(t),new f(this.adapter);var o=this.adapter.computeScrollAreaClientRect(),n=this.adapter.computeScrollContentClientRect(),r=Math.round(n.right-o.right);return this.adapter.setScrollAreaScrollLeft(t),r===e?new b(this.adapter):new u(this.adapter)},e.prototype.isRTL=function(){return"rtl"===this.adapter.getScrollContentStyleValue("direction")},e}(d.K);class _ extends l.H{constructor(){super(...arguments),this.mdcFoundationClass=g,this._scrollbarHeight=-1}_handleInteraction(){this.mdcFoundation.handleInteraction()}_handleTransitionEnd(t){this.mdcFoundation.handleTransitionEnd(t)}render(){return r.dy`
<div class="mdc-tab-scroller">
<div class="mdc-tab-scroller__scroll-area"
@wheel="${this._handleInteraction}"
@touchstart="${this._handleInteraction}"
@pointerdown="${this._handleInteraction}"
@mousedown="${this._handleInteraction}"
@keydown="${this._handleInteraction}"
@transitionend="${this._handleTransitionEnd}">
<div class="mdc-tab-scroller__scroll-content"><slot></slot></div>
</div>
</div>
`}createAdapter(){return Object.assign(Object.assign({},(0,l.q)(this.mdcRoot)),{eventTargetMatchesSelector:(t,e)=>(0,c.wB)(t,e),addScrollAreaClass:t=>this.scrollAreaElement.classList.add(t),setScrollAreaStyleProperty:(t,e)=>this.scrollAreaElement.style.setProperty(t,e),setScrollContentStyleProperty:(t,e)=>this.scrollContentElement.style.setProperty(t,e),getScrollContentStyleValue:t=>window.getComputedStyle(this.scrollContentElement).getPropertyValue(t),setScrollAreaScrollLeft:t=>this.scrollAreaElement.scrollLeft=t,getScrollAreaScrollLeft:()=>this.scrollAreaElement.scrollLeft,getScrollContentOffsetWidth:()=>this.scrollContentElement.offsetWidth,getScrollAreaOffsetWidth:()=>this.scrollAreaElement.offsetWidth,computeScrollAreaClientRect:()=>this.scrollAreaElement.getBoundingClientRect(),computeScrollContentClientRect:()=>this.scrollContentElement.getBoundingClientRect(),computeHorizontalScrollbarHeight:()=>(-1===this._scrollbarHeight&&(this.scrollAreaElement.style.overflowX="scroll",this._scrollbarHeight=this.scrollAreaElement.offsetHeight-this.scrollAreaElement.clientHeight,this.scrollAreaElement.style.overflowX=""),this._scrollbarHeight)})}getScrollPosition(){return this.mdcFoundation.getScrollPosition()}getScrollContentWidth(){return this.scrollContentElement.offsetWidth}incrementScrollPosition(t){this.mdcFoundation.incrementScroll(t)}scrollToPosition(t){this.mdcFoundation.scrollTo(t)}}a([(0,r.IO)(".mdc-tab-scroller")],_.prototype,"mdcRoot",void 0),a([(0,r.IO)(".mdc-tab-scroller__scroll-area")],_.prototype,"scrollAreaElement",void 0),a([(0,r.IO)(".mdc-tab-scroller__scroll-content")],_.prototype,"scrollContentElement",void 0),a([(0,r.hO)({passive:!0})],_.prototype,"_handleInteraction",null);const v=r.iv`.mdc-tab-scroller{overflow-y:hidden}.mdc-tab-scroller.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-scroller__test{position:absolute;top:-9999px;width:100px;height:100px;overflow-x:scroll}.mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:touch;display:flex;overflow-x:hidden}.mdc-tab-scroller__scroll-area::-webkit-scrollbar,.mdc-tab-scroller__test::-webkit-scrollbar{display:none}.mdc-tab-scroller__scroll-area--scroll{overflow-x:scroll}.mdc-tab-scroller__scroll-content{position:relative;display:flex;flex:1 0 auto;transform:none;will-change:transform}.mdc-tab-scroller--align-start .mdc-tab-scroller__scroll-content{justify-content:flex-start}.mdc-tab-scroller--align-end .mdc-tab-scroller__scroll-content{justify-content:flex-end}.mdc-tab-scroller--align-center .mdc-tab-scroller__scroll-content{justify-content:center}.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:auto}:host{display:flex}.mdc-tab-scroller{flex:1}`;let y=class extends _{};y.styles=v,y=a([(0,r.Mo)("mwc-tab-scroller")],y);var S=o(14114),A={ARROW_LEFT_KEY:"ArrowLeft",ARROW_RIGHT_KEY:"ArrowRight",END_KEY:"End",ENTER_KEY:"Enter",HOME_KEY:"Home",SPACE_KEY:"Space",TAB_ACTIVATED_EVENT:"MDCTabBar:activated",TAB_SCROLLER_SELECTOR:".mdc-tab-scroller",TAB_SELECTOR:".mdc-tab"},T={ARROW_LEFT_KEYCODE:37,ARROW_RIGHT_KEYCODE:39,END_KEYCODE:35,ENTER_KEYCODE:13,EXTRA_SCROLL_AMOUNT:20,HOME_KEYCODE:36,SPACE_KEYCODE:32},C=new Set;C.add(A.ARROW_LEFT_KEY),C.add(A.ARROW_RIGHT_KEY),C.add(A.END_KEY),C.add(A.HOME_KEY),C.add(A.ENTER_KEY),C.add(A.SPACE_KEY);var E=new Map;E.set(T.ARROW_LEFT_KEYCODE,A.ARROW_LEFT_KEY),E.set(T.ARROW_RIGHT_KEYCODE,A.ARROW_RIGHT_KEY),E.set(T.END_KEYCODE,A.END_KEY),E.set(T.HOME_KEYCODE,A.HOME_KEY),E.set(T.ENTER_KEYCODE,A.ENTER_KEY),E.set(T.SPACE_KEYCODE,A.SPACE_KEY);const R=function(t){function e(o){var n=t.call(this,(0,s.__assign)((0,s.__assign)({},e.defaultAdapter),o))||this;return n.useAutomaticActivation=!1,n}return(0,s.__extends)(e,t),Object.defineProperty(e,"strings",{get:function(){return A},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return T},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{scrollTo:function(){},incrementScroll:function(){},getScrollPosition:function(){return 0},getScrollContentWidth:function(){return 0},getOffsetWidth:function(){return 0},isRTL:function(){return!1},setActiveTab:function(){},activateTabAtIndex:function(){},deactivateTabAtIndex:function(){},focusTabAtIndex:function(){},getTabIndicatorClientRectAtIndex:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},getTabDimensionsAtIndex:function(){return{rootLeft:0,rootRight:0,contentLeft:0,contentRight:0}},getPreviousActiveTabIndex:function(){return-1},getFocusedTabIndex:function(){return-1},getIndexOfTabById:function(){return-1},getTabListLength:function(){return 0},notifyTabActivated:function(){}}},enumerable:!1,configurable:!0}),e.prototype.setUseAutomaticActivation=function(t){this.useAutomaticActivation=t},e.prototype.activateTab=function(t){var e,o=this.adapter.getPreviousActiveTabIndex();this.indexIsInRange(t)&&t!==o&&(-1!==o&&(this.adapter.deactivateTabAtIndex(o),e=this.adapter.getTabIndicatorClientRectAtIndex(o)),this.adapter.activateTabAtIndex(t,e),this.scrollIntoView(t),this.adapter.notifyTabActivated(t))},e.prototype.handleKeyDown=function(t){var e=this.getKeyFromEvent(t);if(void 0!==e)if(this.isActivationKey(e)||t.preventDefault(),this.useAutomaticActivation){if(this.isActivationKey(e))return;var o=this.determineTargetFromKey(this.adapter.getPreviousActiveTabIndex(),e);this.adapter.setActiveTab(o),this.scrollIntoView(o)}else{var n=this.adapter.getFocusedTabIndex();if(this.isActivationKey(e))this.adapter.setActiveTab(n);else{o=this.determineTargetFromKey(n,e);this.adapter.focusTabAtIndex(o),this.scrollIntoView(o)}}},e.prototype.handleTabInteraction=function(t){this.adapter.setActiveTab(this.adapter.getIndexOfTabById(t.detail.tabId))},e.prototype.scrollIntoView=function(t){this.indexIsInRange(t)&&(0!==t?t!==this.adapter.getTabListLength()-1?this.isRTL()?this.scrollIntoViewImplRTL(t):this.scrollIntoViewImpl(t):this.adapter.scrollTo(this.adapter.getScrollContentWidth()):this.adapter.scrollTo(0))},e.prototype.determineTargetFromKey=function(t,e){var o=this.isRTL(),n=this.adapter.getTabListLength()-1,r=t;return e===A.END_KEY?r=n:e===A.ARROW_LEFT_KEY&&!o||e===A.ARROW_RIGHT_KEY&&o?r-=1:e===A.ARROW_RIGHT_KEY&&!o||e===A.ARROW_LEFT_KEY&&o?r+=1:r=0,r<0?r=n:r>n&&(r=0),r},e.prototype.calculateScrollIncrement=function(t,e,o,n){var r=this.adapter.getTabDimensionsAtIndex(e),i=r.contentLeft-o-n,a=r.contentRight-o-T.EXTRA_SCROLL_AMOUNT,c=i+T.EXTRA_SCROLL_AMOUNT;return e<t?Math.min(a,0):Math.max(c,0)},e.prototype.calculateScrollIncrementRTL=function(t,e,o,n,r){var i=this.adapter.getTabDimensionsAtIndex(e),a=r-i.contentLeft-o,c=r-i.contentRight-o-n+T.EXTRA_SCROLL_AMOUNT,l=a-T.EXTRA_SCROLL_AMOUNT;return e>t?Math.max(c,0):Math.min(l,0)},e.prototype.findAdjacentTabIndexClosestToEdge=function(t,e,o,n){var r=e.rootLeft-o,i=e.rootRight-o-n,a=r+i;return r<0||a<0?t-1:i>0||a>0?t+1:-1},e.prototype.findAdjacentTabIndexClosestToEdgeRTL=function(t,e,o,n,r){var i=r-e.rootLeft-n-o,a=r-e.rootRight-o,c=i+a;return i>0||c>0?t+1:a<0||c<0?t-1:-1},e.prototype.getKeyFromEvent=function(t){return C.has(t.key)?t.key:E.get(t.keyCode)},e.prototype.isActivationKey=function(t){return t===A.SPACE_KEY||t===A.ENTER_KEY},e.prototype.indexIsInRange=function(t){return t>=0&&t<this.adapter.getTabListLength()},e.prototype.isRTL=function(){return this.adapter.isRTL()},e.prototype.scrollIntoViewImpl=function(t){var e=this.adapter.getScrollPosition(),o=this.adapter.getOffsetWidth(),n=this.adapter.getTabDimensionsAtIndex(t),r=this.findAdjacentTabIndexClosestToEdge(t,n,e,o);if(this.indexIsInRange(r)){var i=this.calculateScrollIncrement(t,r,e,o);this.adapter.incrementScroll(i)}},e.prototype.scrollIntoViewImplRTL=function(t){var e=this.adapter.getScrollPosition(),o=this.adapter.getOffsetWidth(),n=this.adapter.getTabDimensionsAtIndex(t),r=this.adapter.getScrollContentWidth(),i=this.findAdjacentTabIndexClosestToEdgeRTL(t,n,e,o,r);if(this.indexIsInRange(i)){var a=this.calculateScrollIncrementRTL(t,i,e,o,r);this.adapter.incrementScroll(a)}},e}(d.K);class I extends l.H{constructor(){super(...arguments),this.mdcFoundationClass=R,this.activeIndex=0,this._previousActiveIndex=-1}_handleTabInteraction(t){this.mdcFoundation.handleTabInteraction(t)}_handleKeydown(t){this.mdcFoundation.handleKeyDown(t)}render(){return r.dy`
<div class="mdc-tab-bar" role="tablist"
@MDCTab:interacted="${this._handleTabInteraction}"
@keydown="${this._handleKeydown}">
<mwc-tab-scroller><slot></slot></mwc-tab-scroller>
</div>
`}_getTabs(){return this.tabsSlot.assignedNodes({flatten:!0}).filter((t=>t instanceof i.O))}_getTab(t){return this._getTabs()[t]}createAdapter(){return{scrollTo:t=>this.scrollerElement.scrollToPosition(t),incrementScroll:t=>this.scrollerElement.incrementScrollPosition(t),getScrollPosition:()=>this.scrollerElement.getScrollPosition(),getScrollContentWidth:()=>this.scrollerElement.getScrollContentWidth(),getOffsetWidth:()=>this.mdcRoot.offsetWidth,isRTL:()=>"rtl"===window.getComputedStyle(this.mdcRoot).getPropertyValue("direction"),setActiveTab:t=>this.mdcFoundation.activateTab(t),activateTabAtIndex:(t,e)=>{const o=this._getTab(t);void 0!==o&&o.activate(e),this._previousActiveIndex=t},deactivateTabAtIndex:t=>{const e=this._getTab(t);void 0!==e&&e.deactivate()},focusTabAtIndex:t=>{const e=this._getTab(t);void 0!==e&&e.focus()},getTabIndicatorClientRectAtIndex:t=>{const e=this._getTab(t);return void 0!==e?e.computeIndicatorClientRect():new DOMRect},getTabDimensionsAtIndex:t=>{const e=this._getTab(t);return void 0!==e?e.computeDimensions():{rootLeft:0,rootRight:0,contentLeft:0,contentRight:0}},getPreviousActiveTabIndex:()=>this._previousActiveIndex,getFocusedTabIndex:()=>{const t=this._getTabs(),e=this.getRootNode().activeElement;return t.indexOf(e)},getIndexOfTabById:t=>{const e=this._getTabs();for(let o=0;o<e.length;o++)if(e[o].id===t)return o;return-1},getTabListLength:()=>this._getTabs().length,notifyTabActivated:t=>{this.activeIndex=t,this.dispatchEvent(new CustomEvent(R.strings.TAB_ACTIVATED_EVENT,{detail:{index:t},bubbles:!0,cancelable:!0}))}}}firstUpdated(){}async _getUpdateComplete(){return this.getUpdateComplete()}async getUpdateComplete(){let t;return t=super.getUpdateComplete?super.getUpdateComplete():super._getUpdateComplete(),t.then((()=>this.scrollerElement.updateComplete)).then((()=>{void 0===this.mdcFoundation&&this.createFoundation()}))}scrollIndexIntoView(t){this.mdcFoundation.scrollIntoView(t)}}n([(0,r.IO)(".mdc-tab-bar")],I.prototype,"mdcRoot",void 0),n([(0,r.IO)("mwc-tab-scroller")],I.prototype,"scrollerElement",void 0),n([(0,r.IO)("slot")],I.prototype,"tabsSlot",void 0),n([(0,S.P)((async function(){await this.updateComplete,this.activeIndex!==this._previousActiveIndex&&this.mdcFoundation.activateTab(this.activeIndex)})),(0,r.Cb)({type:Number})],I.prototype,"activeIndex",void 0);const x=r.iv`.mdc-tab-bar{width:100%}.mdc-tab{height:48px}.mdc-tab--stacked{height:72px}:host{display:block}.mdc-tab-bar{flex:1}mwc-tab{--mdc-tab-height: 48px;--mdc-tab-stacked-height: 72px}`;let O=class extends I{};O.styles=x,O=n([(0,r.Mo)("mwc-tab-bar")],O)},47765:(t,e,o)=>{"use strict";o.d(e,{O:()=>R});function n(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a}Object.create;Object.create;var r=o(55704);function i(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a}Object.create;Object.create;var a=o(78220),c=o(87480),l=o(72774),s={ACTIVE:"mdc-tab-indicator--active",FADE:"mdc-tab-indicator--fade",NO_TRANSITION:"mdc-tab-indicator--no-transition"},d={CONTENT_SELECTOR:".mdc-tab-indicator__content"},p=function(t){function e(o){return t.call(this,(0,c.__assign)((0,c.__assign)({},e.defaultAdapter),o))||this}return(0,c.__extends)(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return s},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return d},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},computeContentClientRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},setContentStyleProperty:function(){}}},enumerable:!1,configurable:!0}),e.prototype.computeContentClientRect=function(){return this.adapter.computeContentClientRect()},e}(l.K);const h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,c.__extends)(e,t),e.prototype.activate=function(){this.adapter.addClass(p.cssClasses.ACTIVE)},e.prototype.deactivate=function(){this.adapter.removeClass(p.cssClasses.ACTIVE)},e}(p);const m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,c.__extends)(e,t),e.prototype.activate=function(t){if(t){var e=this.computeContentClientRect(),o=t.width/e.width,n=t.left-e.left;this.adapter.addClass(p.cssClasses.NO_TRANSITION),this.adapter.setContentStyleProperty("transform","translateX("+n+"px) scaleX("+o+")"),this.computeContentClientRect(),this.adapter.removeClass(p.cssClasses.NO_TRANSITION),this.adapter.addClass(p.cssClasses.ACTIVE),this.adapter.setContentStyleProperty("transform","")}else this.adapter.addClass(p.cssClasses.ACTIVE)},e.prototype.deactivate=function(){this.adapter.removeClass(p.cssClasses.ACTIVE)},e}(p);var u=o(81471);class f extends a.H{constructor(){super(...arguments),this.icon="",this.fade=!1}get mdcFoundationClass(){return this.fade?h:m}render(){const t={"mdc-tab-indicator__content--icon":this.icon,"material-icons":this.icon,"mdc-tab-indicator__content--underline":!this.icon};return r.dy`
<span class="mdc-tab-indicator ${(0,u.$)({"mdc-tab-indicator--fade":this.fade})}">
<span class="mdc-tab-indicator__content ${(0,u.$)(t)}">${this.icon}</span>
</span>
`}updated(t){t.has("fade")&&this.createFoundation()}createAdapter(){return Object.assign(Object.assign({},(0,a.q)(this.mdcRoot)),{computeContentClientRect:()=>this.contentElement.getBoundingClientRect(),setContentStyleProperty:(t,e)=>this.contentElement.style.setProperty(t,e)})}computeContentClientRect(){return this.mdcFoundation.computeContentClientRect()}activate(t){this.mdcFoundation.activate(t)}deactivate(){this.mdcFoundation.deactivate()}}i([(0,r.IO)(".mdc-tab-indicator")],f.prototype,"mdcRoot",void 0),i([(0,r.IO)(".mdc-tab-indicator__content")],f.prototype,"contentElement",void 0),i([(0,r.Cb)()],f.prototype,"icon",void 0),i([(0,r.Cb)({type:Boolean})],f.prototype,"fade",void 0);const b=r.iv`.material-icons{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-color:#6200ee;border-color:var(--mdc-theme-primary, #6200ee)}.mdc-tab-indicator .mdc-tab-indicator__content--icon{color:#018786;color:var(--mdc-theme-secondary, #018786)}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-top-width:2px}.mdc-tab-indicator .mdc-tab-indicator__content--icon{height:34px;font-size:34px}.mdc-tab-indicator__content{transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator__content--icon{align-self:center;margin:0 auto}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}.mdc-tab-indicator .mdc-tab-indicator__content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition:150ms opacity linear}.mdc-tab-indicator--active.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition-delay:100ms}`;let g=class extends f{};g.styles=b,g=i([(0,r.Mo)("mwc-tab-indicator")],g);o(66702);var _=o(14114),v=o(98734),y={ACTIVE:"mdc-tab--active"},S={ARIA_SELECTED:"aria-selected",CONTENT_SELECTOR:".mdc-tab__content",INTERACTED_EVENT:"MDCTab:interacted",RIPPLE_SELECTOR:".mdc-tab__ripple",TABINDEX:"tabIndex",TAB_INDICATOR_SELECTOR:".mdc-tab-indicator"};const A=function(t){function e(o){var n=t.call(this,(0,c.__assign)((0,c.__assign)({},e.defaultAdapter),o))||this;return n.focusOnActivate=!0,n}return(0,c.__extends)(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return y},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return S},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},setAttr:function(){},activateIndicator:function(){},deactivateIndicator:function(){},notifyInteracted:function(){},getOffsetLeft:function(){return 0},getOffsetWidth:function(){return 0},getContentOffsetLeft:function(){return 0},getContentOffsetWidth:function(){return 0},focus:function(){}}},enumerable:!1,configurable:!0}),e.prototype.handleClick=function(){this.adapter.notifyInteracted()},e.prototype.isActive=function(){return this.adapter.hasClass(y.ACTIVE)},e.prototype.setFocusOnActivate=function(t){this.focusOnActivate=t},e.prototype.activate=function(t){this.adapter.addClass(y.ACTIVE),this.adapter.setAttr(S.ARIA_SELECTED,"true"),this.adapter.setAttr(S.TABINDEX,"0"),this.adapter.activateIndicator(t),this.focusOnActivate&&this.adapter.focus()},e.prototype.deactivate=function(){this.isActive()&&(this.adapter.removeClass(y.ACTIVE),this.adapter.setAttr(S.ARIA_SELECTED,"false"),this.adapter.setAttr(S.TABINDEX,"-1"),this.adapter.deactivateIndicator())},e.prototype.computeDimensions=function(){var t=this.adapter.getOffsetWidth(),e=this.adapter.getOffsetLeft(),o=this.adapter.getContentOffsetWidth(),n=this.adapter.getContentOffsetLeft();return{contentLeft:e+n,contentRight:e+n+o,rootLeft:e,rootRight:e+t}},e}(l.K);let T=0;class C extends a.H{constructor(){super(...arguments),this.mdcFoundationClass=A,this.label="",this.icon="",this.hasImageIcon=!1,this.isFadingIndicator=!1,this.minWidth=!1,this.isMinWidthIndicator=!1,this.indicatorIcon="",this.stacked=!1,this.focusOnActivate=!0,this._active=!1,this.initFocus=!1,this.shouldRenderRipple=!1,this.rippleElement=null,this.rippleHandlers=new v.A((()=>(this.shouldRenderRipple=!0,this.ripple.then((t=>this.rippleElement=t)),this.ripple)))}get active(){return this._active}connectedCallback(){this.dir=document.dir,super.connectedCallback()}firstUpdated(){super.firstUpdated(),this.id=this.id||"mdc-tab-"+ ++T}render(){const t={"mdc-tab--min-width":this.minWidth,"mdc-tab--stacked":this.stacked};let e=r.dy``;(this.hasImageIcon||this.icon)&&(e=r.dy`
<span class="mdc-tab__icon material-icons"><slot name="icon">${this.icon}</slot></span>`);let o=r.dy``;return this.label&&(o=r.dy`
<span class="mdc-tab__text-label">${this.label}</span>`),r.dy`
<button
@click="${this.handleClick}"
class="mdc-tab ${(0,u.$)(t)}"
role="tab"
aria-selected="false"
tabindex="-1"
@focus="${this.focus}"
@blur="${this.handleBlur}"
@mousedown="${this.handleRippleMouseDown}"
@mouseenter="${this.handleRippleMouseEnter}"
@mouseleave="${this.handleRippleMouseLeave}"
@touchstart="${this.handleRippleTouchStart}"
@touchend="${this.handleRippleDeactivate}"
@touchcancel="${this.handleRippleDeactivate}">
<span class="mdc-tab__content">
${e}
${o}
${this.isMinWidthIndicator?this.renderIndicator():""}
</span>
${this.isMinWidthIndicator?"":this.renderIndicator()}
${this.renderRipple()}
</button>`}renderIndicator(){return r.dy`<mwc-tab-indicator
.icon="${this.indicatorIcon}"
.fade="${this.isFadingIndicator}"></mwc-tab-indicator>`}renderRipple(){return this.shouldRenderRipple?r.dy`
<mwc-ripple primary></mwc-ripple>
`:""}createAdapter(){return Object.assign(Object.assign({},(0,a.q)(this.mdcRoot)),{setAttr:(t,e)=>this.mdcRoot.setAttribute(t,e),activateIndicator:async t=>{await this.tabIndicator.updateComplete,this.tabIndicator.activate(t)},deactivateIndicator:async()=>{await this.tabIndicator.updateComplete,this.tabIndicator.deactivate()},notifyInteracted:()=>this.dispatchEvent(new CustomEvent(A.strings.INTERACTED_EVENT,{detail:{tabId:this.id},bubbles:!0,composed:!0,cancelable:!0})),getOffsetLeft:()=>this.offsetLeft,getOffsetWidth:()=>this.mdcRoot.offsetWidth,getContentOffsetLeft:()=>this._contentElement.offsetLeft,getContentOffsetWidth:()=>this._contentElement.offsetWidth,focus:()=>{this.initFocus?this.initFocus=!1:this.mdcRoot.focus()}})}activate(t){t||(this.initFocus=!0),this.mdcFoundation?(this.mdcFoundation.activate(t),this.setActive(this.mdcFoundation.isActive())):this.updateComplete.then((()=>{this.mdcFoundation.activate(t),this.setActive(this.mdcFoundation.isActive())}))}deactivate(){this.mdcFoundation.deactivate(),this.setActive(this.mdcFoundation.isActive())}setActive(t){const e=this.active;e!==t&&(this._active=t,this.requestUpdate("active",e))}computeDimensions(){return this.mdcFoundation.computeDimensions()}computeIndicatorClientRect(){return this.tabIndicator.computeContentClientRect()}focus(){this.mdcRoot.focus(),this.handleFocus()}handleClick(){this.handleFocus(),this.mdcFoundation.handleClick()}handleFocus(){this.handleRippleFocus()}handleBlur(){this.handleRippleBlur()}handleRippleMouseDown(t){const e=()=>{window.removeEventListener("mouseup",e),this.handleRippleDeactivate()};window.addEventListener("mouseup",e),this.rippleHandlers.startPress(t)}handleRippleTouchStart(t){this.rippleHandlers.startPress(t)}handleRippleDeactivate(){this.rippleHandlers.endPress()}handleRippleMouseEnter(){this.rippleHandlers.startHover()}handleRippleMouseLeave(){this.rippleHandlers.endHover()}handleRippleFocus(){this.rippleHandlers.startFocus()}handleRippleBlur(){this.rippleHandlers.endFocus()}get isRippleActive(){var t;return(null===(t=this.rippleElement)||void 0===t?void 0:t.isActive)||!1}}C.shadowRootOptions={mode:"open",delegatesFocus:!0},n([(0,r.IO)(".mdc-tab")],C.prototype,"mdcRoot",void 0),n([(0,r.IO)("mwc-tab-indicator")],C.prototype,"tabIndicator",void 0),n([(0,r.Cb)()],C.prototype,"label",void 0),n([(0,r.Cb)()],C.prototype,"icon",void 0),n([(0,r.Cb)({type:Boolean})],C.prototype,"hasImageIcon",void 0),n([(0,r.Cb)({type:Boolean})],C.prototype,"isFadingIndicator",void 0),n([(0,r.Cb)({type:Boolean})],C.prototype,"minWidth",void 0),n([(0,r.Cb)({type:Boolean})],C.prototype,"isMinWidthIndicator",void 0),n([(0,r.Cb)({type:Boolean,reflect:!0,attribute:"active"})],C.prototype,"active",null),n([(0,r.Cb)()],C.prototype,"indicatorIcon",void 0),n([(0,r.Cb)({type:Boolean})],C.prototype,"stacked",void 0),n([(0,_.P)((async function(t){await this.updateComplete,this.mdcFoundation.setFocusOnActivate(t)})),(0,r.Cb)({type:Boolean})],C.prototype,"focusOnActivate",void 0),n([(0,r.IO)(".mdc-tab__content")],C.prototype,"_contentElement",void 0),n([(0,r.SB)()],C.prototype,"shouldRenderRipple",void 0),n([(0,r.GC)("mwc-ripple")],C.prototype,"ripple",void 0),n([(0,r.hO)({passive:!0})],C.prototype,"handleRippleTouchStart",null);const E=r.iv`.material-icons{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}.mdc-tab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase);padding-right:24px;padding-left:24px;min-width:90px;position:relative;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;margin:0;padding-top:0;padding-bottom:0;border:none;outline:none;background:none;text-align:center;white-space:nowrap;cursor:pointer;-webkit-appearance:none;z-index:1}.mdc-tab .mdc-tab__text-label{color:rgba(0, 0, 0, 0.6)}.mdc-tab .mdc-tab__icon{color:rgba(0, 0, 0, 0.54);fill:currentColor}.mdc-tab::-moz-focus-inner{padding:0;border:0}.mdc-tab--min-width{flex:0 1 auto}.mdc-tab__content{position:relative;display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab__icon{transition:150ms color linear;width:24px;height:24px;font-size:24px;z-index:2}.mdc-tab--stacked .mdc-tab__content{flex-direction:column;align-items:center;justify-content:center}.mdc-tab--stacked .mdc-tab__text-label{padding-top:6px;padding-bottom:4px}.mdc-tab--active .mdc-tab__text-label{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-tab--active .mdc-tab__icon{color:#6200ee;color:var(--mdc-theme-primary, #6200ee);fill:currentColor}.mdc-tab--active .mdc-tab__text-label,.mdc-tab--active .mdc-tab__icon{transition-delay:100ms}.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label{padding-left:8px;padding-right:0}[dir=rtl] .mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label,.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label[dir=rtl]{padding-left:0;padding-right:8px}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-tab{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-tab .mdc-tab__ripple::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-tab .mdc-tab__ripple::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-tab.mdc-ripple-upgraded--unbounded .mdc-tab__ripple::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-tab.mdc-ripple-upgraded--foreground-activation .mdc-tab__ripple::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-tab.mdc-ripple-upgraded--foreground-deactivation .mdc-tab__ripple::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-tab:hover .mdc-tab__ripple::before,.mdc-tab.mdc-ripple-surface--hover .mdc-tab__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-tab.mdc-ripple-upgraded--background-focused .mdc-tab__ripple::before,.mdc-tab:not(.mdc-ripple-upgraded):focus .mdc-tab__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-tab:not(.mdc-ripple-upgraded) .mdc-tab__ripple::after{transition:opacity 150ms linear}.mdc-tab:not(.mdc-ripple-upgraded):active .mdc-tab__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab__ripple{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;will-change:transform,opacity}:host{outline:none;flex:1 0 auto;display:flex;justify-content:center;-webkit-tap-highlight-color:transparent}.mdc-tab{height:var(--mdc-tab-height, 48px);margin-left:0;margin-right:0;padding-right:var(--mdc-tab-horizontal-padding, 24px);padding-left:var(--mdc-tab-horizontal-padding, 24px)}.mdc-tab--stacked{height:var(--mdc-tab-stacked-height, 72px)}.mdc-tab::-moz-focus-inner{border:0}.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label{padding-left:8px;padding-right:0}[dir=rtl] .mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label,.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label[dir=rtl]{padding-left:0;padding-right:8px}.mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mdc-tab-text-label-color-default, rgba(0, 0, 0, 0.6))}.mdc-tab:not(.mdc-tab--active) .mdc-tab__icon{color:var(--mdc-tab-color-default, rgba(0, 0, 0, 0.54))}`;let R=class extends C{};R.styles=E,R=n([(0,r.Mo)("mwc-tab")],R)}}]);
//# sourceMappingURL=chunk.09589ceb8b539b8917c1.js.map | 766.735849 | 10,033 | 0.773581 |
733eecf4e1656c35e475fb17b4db30c680cb01d0 | 5,107 | js | JavaScript | node_modules/express-ipfilter/lib/ipfilter.js | escacan/smartmirror | a0596b3f759bd3c0d7fafc061d7e304582e4899c | [
"MIT"
] | null | null | null | node_modules/express-ipfilter/lib/ipfilter.js | escacan/smartmirror | a0596b3f759bd3c0d7fafc061d7e304582e4899c | [
"MIT"
] | null | null | null | node_modules/express-ipfilter/lib/ipfilter.js | escacan/smartmirror | a0596b3f759bd3c0d7fafc061d7e304582e4899c | [
"MIT"
] | null | null | null | /*!
* Express - IP Filter
* Copyright(c) 2014 Bradley and Montgomery Inc.
* MIT Licensed
*/
'use strict';
/**
* Module dependencies.
*/
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _ = require('lodash');
var iputil = require('ip');
var rangeCheck = require('range_check');
var IpDeniedError = require('./deniedError');
/**
* express-ipfilter:
*
* IP Filtering middleware;
*
* Examples:
*
* var ipfilter = require('ipfilter'),
* ips = ['127.0.0.1'];
*
* app.use(ipfilter(ips));
*
* Options:
*
* - `mode` whether to deny or grant access to the IPs provided. Defaults to 'deny'.
* - `logF` Function to use for logging.
* - `log` console log actions. Defaults to true.
* - `allowPrivateIPs` whether to allow private IPs.
* - `allowedHeaders` Array of headers to check for forwarded IPs.
* - 'excluding' routes that should be excluded from ip filtering
*
* @param [ips] {Array} IP addresses
* @param [opts] {Object} options
* @api public
*/
module.exports = function ipfilter(ips, opts) {
ips = ips || false;
var logger = function logger(message) {
console.log(message);
};
var settings = _.defaults(opts || {}, {
mode: 'deny',
log: true,
logF: logger,
allowedHeaders: [],
allowPrivateIPs: false,
excluding: [],
detectIp: getClientIp
});
function getClientIp(req) {
var ipAddress;
var headerIp = _.reduce(settings.allowedHeaders, function (acc, header) {
var testIp = req.headers[header];
if (testIp != '') {
acc = testIp;
}
return acc;
}, '');
if (headerIp) {
var splitHeaderIp = headerIp.split(',');
ipAddress = splitHeaderIp[0];
}
if (!ipAddress) {
ipAddress = req.connection.remoteAddress;
}
if (!ipAddress) {
return '';
}
if (iputil.isV6Format(ipAddress) && ~ipAddress.indexOf('::ffff')) {
ipAddress = ipAddress.split('::ffff:')[1];
}
if (iputil.isV4Format(ipAddress) && ~ipAddress.indexOf(':')) {
ipAddress = ipAddress.split(':')[0];
}
return ipAddress;
}
var matchClientIp = function matchClientIp(ip) {
var mode = settings.mode.toLowerCase();
var result = _.invoke(ips, testIp, ip, mode);
if (mode === 'allow') {
return _.some(result);
} else {
return _.every(result);
}
};
var testIp = function testIp(ip, mode) {
var constraint = this;
// Check if it is an array or a string
if (typeof constraint === 'string') {
if (rangeCheck.validRange(constraint)) {
return testCidrBlock(ip, constraint, mode);
} else {
return testExplicitIp(ip, constraint, mode);
}
}
if ((typeof constraint === 'undefined' ? 'undefined' : _typeof(constraint)) === 'object') {
return testRange(ip, constraint, mode);
}
};
var testExplicitIp = function testExplicitIp(ip, constraint, mode) {
if (ip === constraint) {
return mode === 'allow';
} else {
return mode === 'deny';
}
};
var testCidrBlock = function testCidrBlock(ip, constraint, mode) {
if (rangeCheck.inRange(ip, constraint)) {
return mode === 'allow';
} else {
return mode === 'deny';
}
};
var testRange = function testRange(ip, constraint, mode) {
var filteredSet = _.filter(ips, function (constraint) {
if (constraint.length > 1) {
var startIp = iputil.toLong(constraint[0]);
var endIp = iputil.toLong(constraint[1]);
var longIp = iputil.toLong(ip);
return longIp >= startIp && longIp <= endIp;
} else {
return ip === constraint[0];
}
});
if (filteredSet.length > 0) {
return mode === 'allow';
} else {
return mode === 'deny';
}
};
return function (req, res, next) {
if (settings.excluding.length > 0) {
var results = _.filter(settings.excluding, function (exclude) {
var regex = new RegExp(exclude);
return regex.test(req.url);
});
if (results.length > 0) {
if (settings.log && settings.logLevel !== 'deny') {
settings.logF('Access granted for excluded path: ' + results[0]);
}
return next();
}
}
var ip = settings.detectIp(req);
// If no IPs were specified, skip
// this middleware
if (!ips || !ips.length) {
return next();
}
if (matchClientIp(ip, req)) {
// Grant access
if (settings.log && settings.logLevel !== 'deny') {
settings.logF('Access granted to IP address: ' + ip);
}
return next();
}
// Deny access
if (settings.log && settings.logLevel !== 'allow') {
settings.logF('Access denied to IP address: ' + ip);
}
var err = new IpDeniedError('Access denied to IP address: ' + ip);
return next(err);
};
};
//# sourceMappingURL=ipfilter.js.map
| 25.282178 | 269 | 0.586058 |
733fe6a4ee5d5e331a71f3cdde92df6daf60c407 | 4,480 | js | JavaScript | src/client/glov/snapshot.js | Jimbly/worlds-continent-gen | 23900976f22e3c4394626130bd4aa85eac967c55 | [
"MIT"
] | 2 | 2020-10-16T00:20:22.000Z | 2021-11-25T06:59:43.000Z | src/client/glov/snapshot.js | Jimbly/worlds-continent-gen | 23900976f22e3c4394626130bd4aa85eac967c55 | [
"MIT"
] | 4 | 2020-08-14T19:39:17.000Z | 2021-12-11T05:38:42.000Z | src/client/glov/snapshot.js | Jimbly/worlds-continent-gen | 23900976f22e3c4394626130bd4aa85eac967c55 | [
"MIT"
] | null | null | null | // Portions Copyright 2019 Jimb Esser (https://github.com/Jimbly/)
// Released under MIT License: https://opensource.org/licenses/MIT
/* eslint no-bitwise:off */
const assert = require('assert');
const camera2d = require('./camera2d.js');
const { alphaDraw, alphaDrawListSize, alphaListPush, alphaListPop } = require('./draw_list.js');
const effects = require('./effects.js');
const engine = require('./engine.js');
const { framebufferCapture } = require('./framebuffer.js');
const mat4LookAt = require('gl-mat4/lookAt');
const { max, PI, tan } = Math;
const shaders = require('./shaders.js');
const sprites = require('./sprites.js');
const textures = require('./textures.js');
const {
mat4,
vec3,
v3addScale,
v3copy,
vec4,
v4copy,
zaxis,
} = require('glov/vmath.js');
const {
qRotateZ,
qTransformVec3,
quat,
unit_quat
} = require('./quat.js');
export let OFFSET_GOLDEN = vec3(-1 / 1.618, -1, 1 / 1.618 / 1.618);
let snapshot_shader;
let viewport_save = vec4();
export function viewportRenderPrepare(param) {
const { pre, viewport } = param;
v4copy(viewport_save, engine.viewport);
alphaListPush();
sprites.spriteQueuePush();
camera2d.push();
if (pre) {
pre();
}
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
gl.enable(gl.BLEND);
gl.enable(gl.DEPTH_TEST);
gl.depthMask(true);
gl.enable(gl.CULL_FACE);
engine.setViewport(viewport);
camera2d.setNormalized();
gl.enable(gl.SCISSOR_TEST);
gl.scissor(viewport[0], viewport[1], viewport[2], viewport[3]);
}
export function viewportRenderFinish(param) {
const { post } = param;
gl.disable(gl.SCISSOR_TEST);
if (post) {
post();
}
alphaListPop();
camera2d.pop();
sprites.spriteQueuePop();
engine.setViewport(viewport_save);
engine.startSpriteRendering();
}
let view_mat = mat4();
let target_pos = vec3();
let camera_pos = vec3();
let camera_offset_rot = vec3();
let quat_rot = quat();
let capture_uvs = vec4(0, 1, 1, 0);
const FOV = 15 / 180 * PI;
const DIST_SCALE = 0.5 / tan(FOV / 2) * 1.1;
let last_snapshot_idx = 0;
// returns sprite
// { w, h, pos, size, draw(), [rot], [sprite], [snapshot_backdrop] }
export function snapshot(param) {
assert(!engine.had_3d_this_frame); // must be before general 3D init
let camera_offset = param.camera_offset || OFFSET_GOLDEN;
let name = param.name || `snapshot_${++last_snapshot_idx}`;
let auto_unload = param.on_unload;
let texs = param.sprite && param.sprite.texs || [
textures.createForCapture(`${name}(0)`, auto_unload),
textures.createForCapture(`${name}(1)`, auto_unload)
];
param.viewport = [0, 0, param.w, param.h];
viewportRenderPrepare(param);
let max_dim = max(param.size[0], param.size[2]);
let dist = max_dim * DIST_SCALE + param.size[1] / 2;
engine.setupProjection(FOV, param.w, param.h, 0.1, dist * 2);
v3addScale(target_pos, param.pos, param.size, 0.5);
if (param.rot) {
qRotateZ(quat_rot, unit_quat, param.rot);
qTransformVec3(camera_offset_rot, camera_offset, quat_rot);
} else {
v3copy(camera_offset_rot, camera_offset);
}
v3addScale(camera_pos, target_pos, camera_offset_rot, dist);
mat4LookAt(view_mat, camera_pos, target_pos, zaxis);
engine.setGlobalMatrices(view_mat);
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
if (param.snapshot_backdrop) {
gl.depthMask(false);
effects.applyCopy({ source: param.snapshot_backdrop, no_framebuffer: true });
gl.depthMask(true);
}
param.draw();
if (alphaDrawListSize()) {
alphaDraw();
gl.depthMask(true);
}
// TODO: use new framebuffer API here
framebufferCapture(texs[0], param.w, param.h, true, false);
gl.clearColor(1, 1, 1, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
if (param.snapshot_backdrop) {
gl.depthMask(false);
effects.applyCopy({ source: param.snapshot_backdrop, no_framebuffer: true });
gl.depthMask(true);
}
param.draw();
if (alphaDrawListSize()) {
alphaDraw();
gl.depthMask(true);
}
// PERFTODO: we only need to capture the red channel, does that speed things up and use less mem?
framebufferCapture(texs[1], param.w, param.h, true, false);
viewportRenderFinish(param);
if (!param.sprite) {
param.sprite = sprites.create({
texs,
shader: snapshot_shader,
uvs: capture_uvs,
});
}
return param.sprite;
}
export function snapshotStartup() {
snapshot_shader = shaders.create('glov/shaders/snapshot.fp');
}
| 28.176101 | 99 | 0.686607 |
733ffc727b51b9ddfdd3c2d4629c8b9425fa35ce | 1,060 | js | JavaScript | backend/routes/discussions.js | prahasR/IIITB-Hogwarts | 5e1830f2e37bcb4dc9824ba5bceeb22125a69557 | [
"MIT"
] | 9 | 2020-09-17T11:45:11.000Z | 2021-10-05T17:47:37.000Z | backend/routes/discussions.js | prahasR/IIITB-Hogwarts | 5e1830f2e37bcb4dc9824ba5bceeb22125a69557 | [
"MIT"
] | 15 | 2020-09-20T15:59:31.000Z | 2021-11-20T17:30:44.000Z | backend/routes/discussions.js | prahasR/IIITB-Hogwarts | 5e1830f2e37bcb4dc9824ba5bceeb22125a69557 | [
"MIT"
] | 3 | 2020-09-21T07:22:24.000Z | 2021-10-03T17:19:57.000Z | const router = require("express").Router()
const Discussion = require("../models/discussion")
const mongoose = require("mongoose")
router.get('/', (req, res) => {
Discussion.find().sort({_id: -1}).exec()
.then((docs) => {
res.status(200).json({
message: "Successful!",
count: docs.length,
data: docs
})
})
.catch((error) => {
res.status(error.status || 500).json({
message: error.message || "Unknown error!",
error: error
})
})
})
router.post('/', (req, res) => {
const discussion = Discussion({
discussion_title: req.body.title,
banner_url: req.body.banner_url
})
discussion.save()
.then((doc) => {
res.status(200).json({
message: "Successfully created!",
data: doc
})
})
.catch((error) => {
res.status(error.status || 500).json({
message: error.message || "Unknown error!",
error: error
})
})
})
module.exports = router | 25.238095 | 55 | 0.512264 |
7340ecf0e3f7bda3fc92e88789a937f6cf849512 | 2,486 | js | JavaScript | public/static/pay/Public/js/public.js | grayVTouch/payAdmin | d669cf71a3145b3cb12f183abe2d4a76b9a5afc4 | [
"Apache-2.0"
] | null | null | null | public/static/pay/Public/js/public.js | grayVTouch/payAdmin | d669cf71a3145b3cb12f183abe2d4a76b9a5afc4 | [
"Apache-2.0"
] | null | null | null | public/static/pay/Public/js/public.js | grayVTouch/payAdmin | d669cf71a3145b3cb12f183abe2d4a76b9a5afc4 | [
"Apache-2.0"
] | null | null | null | (function(){
'use strict';
// store 对象
let store = new Vuex.Store({
state: {
// 当前位置
pos: {
all: [] ,
top: {} ,
sec: {} ,
cur: {}
} ,
topContext ,
// 上传文件的名称
image: 'image' ,
route: {
// 完整 url
url: '' ,
// host
host: '' ,
// 端口
port: '' ,
// 网络路径
path: '' ,
// 查询字符串
search: '' ,
// hash
hash: '' ,
// 查询字符串
query: {} ,
// mvc
mvc: {
module: '' ,
controller: '' ,
action: ''
}
} ,
// 当前登录用户信息
user: {}
}
});
(function(){
// 查询字符串解析
store.state.route.url = window.location.href;
store.state.route.host = window.location.host;
store.state.route.port = window.location.port;
store.state.route.path = window.location.pathname;
store.state.route.search = window.location.search;
store.state.route.hash = window.location.hash;
store.state.route.query = G.queryString();
let mvc = store.state.route.path.substr(1).split('/');
store.state.route.mvc = {
module: mvc[0] ,
controller: mvc[1] ,
action: mvc[2]
};
})();
// 全局混入对象
Vue.mixin({
store ,
methods: {
// 生成 url
genUrl () {
return genUrl.apply(this , arguments);
} ,
// 跳转到给定链接
toAnchorLink (id) {
return toAnchorLink(id);
} ,
// 返回针对某个值得类名!!
errorClass (val) {
return G.isValid(val) ? 'error' : '';
} ,
// 提示操作成功
layerSucc (msg , option) {
option = G.isObject(option) ? option : {};
option.icon = 1;
return layer.alert(msg , option);
} ,
// 提示操作失败
layerFail (msg) {
return layer.alert(msg , {
icon: 2
});
} ,
// url 解析
getRoute () {
} ,
}
});
})(); | 24.613861 | 62 | 0.345535 |
734136198bf5fecdabc66fd6cbed57559035e665 | 4,540 | js | JavaScript | src/main/resources/static/js/app.c16525d0.js | sjuni1/todayscience | b601b5f997b2aabde4891a9d8a22567e2cd2649a | [
"MIT"
] | null | null | null | src/main/resources/static/js/app.c16525d0.js | sjuni1/todayscience | b601b5f997b2aabde4891a9d8a22567e2cd2649a | [
"MIT"
] | null | null | null | src/main/resources/static/js/app.c16525d0.js | sjuni1/todayscience | b601b5f997b2aabde4891a9d8a22567e2cd2649a | [
"MIT"
] | null | null | null | (function(e){function t(t){for(var r,u,c=t[0],i=t[1],l=t[2],f=0,p=[];f<c.length;f++)u=c[f],Object.prototype.hasOwnProperty.call(a,u)&&a[u]&&p.push(a[u][0]),a[u]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);s&&s(t);while(p.length)p.shift()();return o.push.apply(o,l||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,c=1;c<n.length;c++){var i=n[c];0!==a[i]&&(r=!1)}r&&(o.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},a={app:0},o=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/";var c=window["webpackJsonp"]=window["webpackJsonp"]||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var l=0;l<c.length;l++)t(c[l]);var s=i;o.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("56d7")},"034f":function(e,t,n){"use strict";n("85ec")},"56d7":function(e,t,n){"use strict";n.r(t);n("e260"),n("e6cf"),n("cca6"),n("a79d");var r=n("2b0e"),a=(n("d3b7"),n("bc3a")),o=n.n(a),u={},c=o.a.create(u);c.interceptors.request.use((function(e){return e}),(function(e){return Promise.reject(e)})),c.interceptors.response.use((function(e){return e}),(function(e){return Promise.reject(e)})),Plugin.install=function(e,t){e.axios=c,window.axios=c,Object.defineProperties(e.prototype,{axios:{get:function(){return c}},$axios:{get:function(){return c}}})},r["default"].use(Plugin);Plugin;var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("Header"),n("div",{staticClass:"content",attrs:{id:"content"}},[n("router-view")],1)],1)},l=[],s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("b-navbar",{attrs:{toggleable:"lg",type:"dark",variant:"primary"}},[n("b-navbar-brand",{attrs:{href:"#"}},[e._v("STD")]),n("b-navbar-toggle",{attrs:{target:"nav-collapse"}}),n("b-collapse",{attrs:{id:"nav-collapse","is-nav":""}},[n("b-navbar-nav",[n("b-nav-item",{attrs:{href:"/about"}},[e._v("about")])],1)],1)],1)],1)},f=[],p={name:"Header"},d=p,b=n("2877"),v=Object(b["a"])(d,s,f,!1,null,null,null),h=v.exports,m={name:"App",components:{Header:h}},_=m,g=(n("034f"),Object(b["a"])(_,i,l,!1,null,null,null)),y=g.exports,j=n("8c4f"),w=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"home-card"},[n("h1",{staticClass:"title-home"},[e._v("Science of The Day")]),e._m(0),n("div",{staticStyle:{"margin-top":"2rem"}},[n("b-button",{attrs:{href:"/about",variant:"dark"}},[e._v("더 알아보기")])],1)]),n("div",{staticClass:"home-contents"},[n("h1",[e._v(" 오늘의 키워드 ")]),n("div",[n("b-container",{attrs:{fluid:""}},[n("b-row",[n("b-col",[n("p",[e._v("abcdef")])]),n("b-col",[n("p",[e._v("abcdef")])]),n("b-col",[n("p",[e._v("abcdef")])])],1)],1)],1)])])},O=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("h5",{staticClass:"mini-title-home"},[e._v(" 오늘의 과학은 흥미로운 주제들을 모아 당신에게 전달합니다."),n("br"),e._v(" 최근 가장 떠오르는 연구들을 살펴보세요. ")])}],x={name:"Home"},P=x,S=(n("cccb"),Object(b["a"])(P,w,O,!1,null,null,null)),$=S.exports,E=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},k=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("h1",[e._v("about page")])])}],C={name:"About"},T=C,H=Object(b["a"])(T,E,k,!1,null,null,null),M=H.exports;r["default"].use(j["a"]);var A=new j["a"]({mode:"history",routes:[{path:"/",component:$},{path:"/home",component:$},{path:"/about",component:M}]}),D=A,J=n("5f5b"),q=n("b1e0");n("f9e3"),n("2dd8");r["default"].use(J["a"]),r["default"].use(q["a"]),r["default"].config.productionTip=!1,new r["default"]({router:D,render:function(e){return e(y)}}).$mount("#app")},"5ced":function(e,t,n){},"85ec":function(e,t,n){},cccb:function(e,t,n){"use strict";n("5ced")}});
//# sourceMappingURL=app.c16525d0.js.map | 2,270 | 4,499 | 0.628855 |
7341d3e64e0ad63118db6a4a8524d67bcf39ab48 | 73 | js | JavaScript | app/components/loader-ball-beat.js | kaermorchen/ember-cli-loaders | ff400a437f2ed2fe952a6fbb903021cba97b0004 | [
"MIT"
] | 14 | 2016-06-16T08:24:44.000Z | 2020-04-12T14:49:16.000Z | app/components/loader-ball-beat.js | kaermorchen/ember-cli-loaders | ff400a437f2ed2fe952a6fbb903021cba97b0004 | [
"MIT"
] | 5 | 2017-10-21T06:05:30.000Z | 2020-10-03T15:25:25.000Z | app/components/loader-ball-beat.js | kaermorchen/ember-cli-loaders | ff400a437f2ed2fe952a6fbb903021cba97b0004 | [
"MIT"
] | 2 | 2017-10-16T16:42:27.000Z | 2018-03-28T17:54:00.000Z | export { default } from 'ember-cli-loaders/components/loader-ball-beat';
| 36.5 | 72 | 0.767123 |
7342533cafb711d4aac1897c9b5d90197a60667c | 123 | js | JavaScript | src/pages/index.js | frankmalafronte/Twilight-assess | 740d0bd8d38af7c454c7a05cecc97f7f5e47062c | [
"MIT"
] | null | null | null | src/pages/index.js | frankmalafronte/Twilight-assess | 740d0bd8d38af7c454c7a05cecc97f7f5e47062c | [
"MIT"
] | 6 | 2021-03-09T01:05:59.000Z | 2022-02-17T20:18:54.000Z | src/pages/index.js | frankmalafronte/Twilight-assess | 740d0bd8d38af7c454c7a05cecc97f7f5e47062c | [
"MIT"
] | null | null | null | import React from "react";
import List from "../components/List";
export default () => (
<div>
<List />
</div>
);
| 13.666667 | 38 | 0.577236 |
734271736ff7e994ba917fc7fcff90247b787ba3 | 913 | js | JavaScript | tests/unit/utils/sanitize-test.js | dbouwman/ember-sanitize | e68d19d92f04535d3cf976e8294f8fff509cfe34 | [
"MIT"
] | null | null | null | tests/unit/utils/sanitize-test.js | dbouwman/ember-sanitize | e68d19d92f04535d3cf976e8294f8fff509cfe34 | [
"MIT"
] | null | null | null | tests/unit/utils/sanitize-test.js | dbouwman/ember-sanitize | e68d19d92f04535d3cf976e8294f8fff509cfe34 | [
"MIT"
] | null | null | null | import { sanitize } from 'ember-sanitize/utils/sanitize';
import { module, test } from 'qunit';
module('SanitizeHelper', function() {
test('sanitizes with the defaults', function(assert) {
var result = sanitize("some <b>html</b> here");
assert.equal(result, "some html here");
});
test('sanitizes with a custom config', function(assert) {
var config = { elements: ['i'] };
var result = sanitize("some <b>html</b> <i>here</i>", config);
assert.equal(result, "some html <i>here</i>");
});
test("doesn't execute code whilst sanitizing", function(assert) {
var done = assert.async();
var executed = false;
window.oops = function() {
executed = true;
};
sanitize(`<img src='' onerror='oops()'>`);
setTimeout(function() {
assert.ok(!executed, "should not have executed the code");
window.oops = undefined;
done();
}, 0);
});
});
| 27.666667 | 67 | 0.610077 |
734309176f38d79666bd18eb38a4980cd839100e | 1,794 | js | JavaScript | src/editingWidgets/jquery.Midgard.midgardEditableEditorCKEditor.js | AlphaT7/create | 1763e1c09d2bc957c9c7d9aac9e81033f349e8f1 | [
"MIT"
] | 629 | 2015-01-01T18:53:56.000Z | 2022-03-08T03:04:22.000Z | src/editingWidgets/jquery.Midgard.midgardEditableEditorCKEditor.js | AlphaT7/create | 1763e1c09d2bc957c9c7d9aac9e81033f349e8f1 | [
"MIT"
] | 27 | 2015-01-19T09:50:29.000Z | 2022-03-31T16:57:00.000Z | src/editingWidgets/jquery.Midgard.midgardEditableEditorCKEditor.js | AlphaT7/create | 1763e1c09d2bc957c9c7d9aac9e81033f349e8f1 | [
"MIT"
] | 123 | 2015-01-07T05:52:22.000Z | 2021-09-08T09:57:04.000Z | /*
// Create.js - On-site web editing interface
// (c) 2012 Tobias Herrmann, IKS Consortium
// Create may be freely distributed under the MIT license.
// For all details and documentation:
*/
(function (jQuery, undefined) {
// Run JavaScript in strict mode
/*global jQuery:false _:false document:false CKEDITOR:false */
'use strict';
// # CKEditor editing widget
//
// This widget allows editing textual content areas with the
// [CKEditor](http://ckeditor.com/) rich text editor.
jQuery.widget('Midgard.ckeditorWidget', jQuery.Midgard.editWidget, {
options: {
editorOptions: {},
disabled: true,
vie: null
},
enable: function () {
this.element.attr('contentEditable', 'true');
this.editor = CKEDITOR.inline(this.element.get(0));
this.options.disabled = false;
var widget = this;
this.editor.on('focus', function () {
widget.options.activated();
});
this.editor.on('blur', function () {
widget.options.deactivated();
widget.options.changed(widget.editor.getData());
});
this.editor.on('change', function () {
widget.options.changed(widget.editor.getData());
});
this.editor.on('configLoaded', function() {
if (widget.options.editorOptions !== undefined) {
jQuery.each(widget.options.editorOptions, function(optionName, option) {
widget.editor.config[optionName] = option;
});
}
});
},
disable: function () {
if (!this.editor) {
return;
}
this.element.attr('contentEditable', 'false');
this.editor.destroy();
this.editor = null;
},
_initialize: function () {
CKEDITOR.disableAutoInline = true;
}
});
})(jQuery);
| 29.409836 | 82 | 0.605909 |
734325d2e7e2ada522fdd3856e9bf53471d74022 | 8,671 | js | JavaScript | lib/kadira.js | chatr/monti-apm-agent | d3a2d3b4726dcc07fa51dbd94f1247c265f4f43b | [
"MIT"
] | null | null | null | lib/kadira.js | chatr/monti-apm-agent | d3a2d3b4726dcc07fa51dbd94f1247c265f4f43b | [
"MIT"
] | null | null | null | lib/kadira.js | chatr/monti-apm-agent | d3a2d3b4726dcc07fa51dbd94f1247c265f4f43b | [
"MIT"
] | null | null | null | import HttpModel from "./models/http";
import packageMap from './.meteor-package-versions';
var hostname = Npm.require('os').hostname();
var logger = Npm.require('debug')('kadira:apm');
var Fibers = Npm.require('fibers');
var KadiraCore = Npm.require('monti-apm-core').Kadira;
Kadira.models = {};
Kadira.options = {};
Kadira.env = {
currentSub: null, // keep current subscription inside ddp
kadiraInfo: new Meteor.EnvironmentVariable(),
};
Kadira.waitTimeBuilder = new WaitTimeBuilder();
Kadira.errors = [];
Kadira.errors.addFilter = Kadira.errors.push.bind(Kadira.errors);
Kadira.models.methods = new MethodsModel();
Kadira.models.pubsub = new PubsubModel();
Kadira.models.system = new SystemModel();
Kadira.models.http = new HttpModel();
Kadira.docSzCache = new DocSzCache(100000, 10);
Kadira.connect = function(appId, appSecret, options) {
options = options || {};
options.appId = appId;
options.appSecret = appSecret;
options.payloadTimeout = options.payloadTimeout || 1000 * 20;
options.endpoint = options.endpoint || "https://engine.montiapm.com";
options.clientEngineSyncDelay = options.clientEngineSyncDelay || 10000;
options.thresholds = options.thresholds || {};
options.isHostNameSet = !!options.hostname;
options.hostname = options.hostname || hostname;
options.proxy = options.proxy || null;
options.recordIPAddress = options.recordIPAddress || 'full';
options.eventStackTrace = options.eventStackTrace || false;
if(options.documentSizeCacheSize) {
Kadira.docSzCache = new DocSzCache(options.documentSizeCacheSize, 10);
}
// remove trailing slash from endpoint url (if any)
if(_.last(options.endpoint) === '/') {
options.endpoint = options.endpoint.substr(0, options.endpoint.length - 1);
}
// error tracking is enabled by default
if(options.enableErrorTracking === undefined) {
options.enableErrorTracking = true;
}
// uploading sourcemaps is enabled by default in production
if (options.uploadSourceMaps === undefined && Meteor.isProduction) {
options.uploadSourceMaps = true;
}
Kadira.options = options;
Kadira.options.authHeaders = {
'KADIRA-APP-ID': Kadira.options.appId,
'KADIRA-APP-SECRET': Kadira.options.appSecret
};
if (appId && appSecret) {
options.appId = options.appId.trim();
options.appSecret = options.appSecret.trim();
Kadira.coreApi = new KadiraCore({
appId: options.appId,
appSecret: options.appSecret,
endpoint: options.endpoint,
hostname: options.hostname,
agentVersion: packageMap['montiapm:agent'] || '<unknown>'
});
Kadira.coreApi._checkAuth()
.then(function () {
logger('connected to app: ', appId);
console.log('Monti APM: Successfully connected');
Kadira._sendAppStats();
Kadira._schedulePayloadSend();
})
.catch(function (err) {
if (err.message === "Unauthorized") {
console.log('Monti APM: authentication failed - check your appId & appSecret')
} else {
console.log('Monti APM: unable to connect. ' + err.message);
}
});
} else {
throw new Error('Monti APM: required appId and appSecret');
}
Kadira.syncedDate = new Ntp(options.endpoint);
Kadira.syncedDate.sync();
Kadira.models.error = new ErrorModel(appId);
// handle pre-added filters
var addFilterFn = Kadira.models.error.addFilter.bind(Kadira.models.error);
Kadira.errors.forEach(addFilterFn);
Kadira.errors = Kadira.models.error;
// setting runtime info, which will be sent to kadira
__meteor_runtime_config__.kadira = {
appId: appId,
endpoint: options.endpoint,
clientEngineSyncDelay: options.clientEngineSyncDelay,
recordIPAddress: options.recordIPAddress,
};
if(options.enableErrorTracking) {
Kadira.enableErrorTracking();
} else {
Kadira.disableErrorTracking();
}
// start tracking errors
Meteor.startup(function () {
TrackUncaughtExceptions();
TrackUnhandledRejections();
TrackMeteorDebug();
})
Meteor.publish(null, function () {
var options = __meteor_runtime_config__.kadira;
this.added('kadira_settings', Random.id(), options);
this.ready();
});
// notify we've connected
Kadira.connected = true;
};
//track how many times we've sent the data (once per minute)
Kadira._buildPayload = function () {
var payload = {host: Kadira.options.hostname, clientVersions: getClientVersions()};
var buildDetailedInfo = Kadira._isDetailedInfo();
_.extend(payload, Kadira.models.methods.buildPayload(buildDetailedInfo));
_.extend(payload, Kadira.models.pubsub.buildPayload(buildDetailedInfo));
_.extend(payload, Kadira.models.system.buildPayload());
_.extend(payload, Kadira.models.http.buildPayload());
if(Kadira.options.enableErrorTracking) {
_.extend(payload, Kadira.models.error.buildPayload());
}
return payload;
}
Kadira._countDataSent = 0;
Kadira._detailInfoSentInterval = Math.ceil((1000*60) / Kadira.options.payloadTimeout);
Kadira._isDetailedInfo = function () {
return (Kadira._countDataSent++ % Kadira._detailInfoSentInterval) == 0;
}
Kadira._sendAppStats = function () {
var appStats = {};
appStats.release = Meteor.release;
appStats.protocolVersion = '1.0.0';
appStats.packageVersions = [];
appStats.clientVersions = getClientVersions();
_.each(Package, function (v, name) {
appStats.packageVersions.push({
name: name,
version: packageMap[name] || null
});
});
Kadira.coreApi.sendData({
startTime: new Date(),
appStats: appStats
}).then(function(body) {
handleApiResponse(body);
}).catch(function(err) {
console.error('Monti APM Error on sending appStats:', err.message);
});
}
Kadira._schedulePayloadSend = function () {
setTimeout(function () {
Kadira._schedulePayloadSend();
Kadira._sendPayload();
}, Kadira.options.payloadTimeout);
}
Kadira._sendPayload = function () {
new Fibers(function() {
var payload = Kadira._buildPayload();
Kadira.coreApi.sendData(payload)
.then(function (body) {
handleApiResponse(body);
})
.catch(function(err) {
console.log('Monti APM Error:', err.message);
});
}).run();
}
// this return the __kadiraInfo from the current Fiber by default
// if called with 2nd argument as true, it will get the kadira info from
// Meteor.EnvironmentVariable
//
// WARNNING: returned info object is the reference object.
// Changing it might cause issues when building traces. So use with care
Kadira._getInfo = function(currentFiber, useEnvironmentVariable) {
currentFiber = currentFiber || Fibers.current;
if(currentFiber) {
if(useEnvironmentVariable) {
return Kadira.env.kadiraInfo.get();
}
return currentFiber.__kadiraInfo;
}
};
// this does not clone the info object. So, use with care
Kadira._setInfo = function(info) {
Fibers.current.__kadiraInfo = info;
};
Kadira.startContinuousProfiling = function () {
MontiProfiler.startContinuous(function onProfile({ profile, startTime, endTime }) {
Kadira.coreApi.sendData({ profiles: [{profile, startTime, endTime }]}).catch(e => console.log('Monti: err sending cpu profile', e));
});
}
Kadira.enableErrorTracking = function () {
__meteor_runtime_config__.kadira.enableErrorTracking = true;
Kadira.options.enableErrorTracking = true;
};
Kadira.disableErrorTracking = function () {
__meteor_runtime_config__.kadira.enableErrorTracking = false;
Kadira.options.enableErrorTracking = false;
};
Kadira.trackError = function (type, message, options) {
if(Kadira.options.enableErrorTracking && type && message) {
options = options || {};
options.subType = options.subType || 'server';
options.stacks = options.stacks || '';
var error = {message: message, stack: options.stacks};
var trace = {
type: type,
subType: options.subType,
name: message,
errored: true,
at: Kadira.syncedDate.getTime(),
events: [['start', 0, {}], ['error', 0, {error: error}]],
metrics: {total: 0}
};
Kadira.models.error.trackError(error, trace);
}
}
Kadira.ignoreErrorTracking = function (err) {
err._skipKadira = true;
}
Kadira.startEvent = function (name, data = {}) {
var kadiraInfo = Kadira._getInfo();
if(kadiraInfo) {
return Kadira.tracer.event(kadiraInfo.trace, 'custom', data, { name });
}
return false
}
Kadira.endEvent = function (event, data) {
var kadiraInfo = Kadira._getInfo();
// The event could be false if it could not be started.
// Handle it here instead of requiring the app to.
if (kadiraInfo && event) {
Kadira.tracer.eventEnd(kadiraInfo.trace, event, data);
}
}
| 30.967857 | 136 | 0.697036 |