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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fea774c4ada2ac8027419080a3a6859ec3377d62 | 56 | js | JavaScript | packages/umi/test/fixtures/build/pwa/pages/index.js | wish-init/umi | cd852295ac6a992c78744d3490b4c9369c07538c | [
"MIT"
] | 6 | 2019-09-06T01:29:58.000Z | 2019-09-06T02:47:47.000Z | packages/umi/test/fixtures/build/pwa/pages/index.js | wish-init/umi | cd852295ac6a992c78744d3490b4c9369c07538c | [
"MIT"
] | 24 | 2020-08-12T08:35:07.000Z | 2022-03-23T19:02:07.000Z | packages/umi/test/fixtures/build/pwa/pages/index.js | wish-init/umi | cd852295ac6a992c78744d3490b4c9369c07538c | [
"MIT"
] | 1 | 2022-03-25T17:44:49.000Z | 2022-03-25T17:44:49.000Z | export default () => (
<>
<h1>index</h1>
</>
);
| 9.333333 | 22 | 0.392857 |
fea7abd85f54f29c532ea7fc1ea0168309a19b36 | 823 | js | JavaScript | src/utils/request1.js | yang427626/JunKeNew | c0522a6416783eb64af9f9b13d7d5f9726599856 | [
"MIT"
] | null | null | null | src/utils/request1.js | yang427626/JunKeNew | c0522a6416783eb64af9f9b13d7d5f9726599856 | [
"MIT"
] | null | null | null | src/utils/request1.js | yang427626/JunKeNew | c0522a6416783eb64af9f9b13d7d5f9726599856 | [
"MIT"
] | null | null | null | import axios from 'axios'
// axios.interceptors
const service = axios.create({
// baseURL: '', // url = base url + request url
withCredentials: true, // send cookies when cross-domain requests
timeout: 5000 // request timeout
})
service.interceptors.response.use(
response => {
const res = response.data
if (res.code !== 0) {
return res
} else {
return res
}
},
error => {
// if (error.response.status == 401) {
// return Promise.reject(error)
// window.location = sessionStorage.getItem('mhUrl');
// } else {
return Promise.reject(error)
// }
}
)
service.interceptors.request.use(
config => {
config.headers['token'] = sessionStorage.getItem('token')
return config
},
error => {
return Promise.reject(error)
}
)
export default service
| 22.243243 | 67 | 0.626974 |
fea831f0bb42a8c6bcea56ac59872e819ee1d4ff | 372 | js | JavaScript | client/src/Screen/Chat/Message/ MessageItem.js | ga2631/chatapp | fc2d97ff0ad08f3e74427cf16b6c3577c0648a45 | [
"Apache-2.0"
] | null | null | null | client/src/Screen/Chat/Message/ MessageItem.js | ga2631/chatapp | fc2d97ff0ad08f3e74427cf16b6c3577c0648a45 | [
"Apache-2.0"
] | null | null | null | client/src/Screen/Chat/Message/ MessageItem.js | ga2631/chatapp | fc2d97ff0ad08f3e74427cf16b6c3577c0648a45 | [
"Apache-2.0"
] | null | null | null | import React from "react";
import { Typography } from "@material-ui/core";
const MessageItem = props => {
return (
<div>
<Typography variant="h5" component="p">
{props.message.user}
</Typography>
<Typography variant="body2" component="p">
{props.message.content}
</Typography>
</div>
);
};
export default MessageItem;
| 20.666667 | 48 | 0.610215 |
fea8ccca0d189e1abe14d2ced1be6ce60cbe73d1 | 1,647 | js | JavaScript | docs/html/search/all_a.js | rickkas7/PDMGen3_RK | 1339b49a398df8003090ca7069bae425abedb1da | [
"MIT"
] | 1 | 2019-12-14T01:12:30.000Z | 2019-12-14T01:12:30.000Z | docs/html/search/all_a.js | rickkas7/PDMGen3_RK | 1339b49a398df8003090ca7069bae425abedb1da | [
"MIT"
] | null | null | null | docs/html/search/all_a.js | rickkas7/PDMGen3_RK | 1339b49a398df8003090ca7069bae425abedb1da | [
"MIT"
] | null | null | null | var searchData=
[
['range',['Range',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8d',1,'PDMGen3::Range()'],['../class_p_d_m_gen3.html#a71bcc81f1fd8006cdcd567b3937d6df0',1,'PDMGen3::range()']]],
['range_5f1024',['RANGE_1024',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da40ab4bb56cae55bc6155190717f1c86d',1,'PDMGen3']]],
['range_5f128',['RANGE_128',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8daf9dab2fdacd15340d19c0eddfc7bd0e0',1,'PDMGen3']]],
['range_5f16384',['RANGE_16384',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da31c1d85eecd372e41b20f3d0de873650',1,'PDMGen3']]],
['range_5f2048',['RANGE_2048',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da3bc5fd05092431ab06a7453660490de0',1,'PDMGen3']]],
['range_5f256',['RANGE_256',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da5b5f2f0d2401c3947bd8fd592046a18b',1,'PDMGen3']]],
['range_5f32768',['RANGE_32768',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da1c7f335b29f548a407c97ad15280e021',1,'PDMGen3']]],
['range_5f4096',['RANGE_4096',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8dad577bb0a2f6970c442e27b462e639a17',1,'PDMGen3']]],
['range_5f512',['RANGE_512',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da59933b51b2d567497777e2fae426210a',1,'PDMGen3']]],
['range_5f8192',['RANGE_8192',['../class_p_d_m_gen3.html#a9e4a04f89b8728cdc2583b9b539b9b8da4fc5f67b47f09d3dc6e5c2678fc50429',1,'PDMGen3']]],
['raw_5fsigned_5f16',['RAW_SIGNED_16',['../class_p_d_m_gen3.html#ab2597d30cae13fab7fa5b5d98499e78dabb6351d9fc97ae2b2f76964244dc1cb2',1,'PDMGen3']]]
];
| 109.8 | 190 | 0.802064 |
fea9618937e0e5ded33516407302247e070568a9 | 2,517 | js | JavaScript | build/src/init/performInit.js | Project-Monode/monode-cli | 8349b7bd86647d845bbf4f3a86fa84f262f3ceb7 | [
"MIT"
] | null | null | null | build/src/init/performInit.js | Project-Monode/monode-cli | 8349b7bd86647d845bbf4f3a86fa84f262f3ceb7 | [
"MIT"
] | null | null | null | build/src/init/performInit.js | Project-Monode/monode-cli | 8349b7bd86647d845bbf4f3a86fa84f262f3ceb7 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.performInit = void 0;
const fs = require("fs");
const path = require("path");
const run_cmd_1 = require("../utils/run-cmd");
async function performInit() {
cloneSourceFile({
relativeSourceFilePath: `./templates/package.json`,
relativeExportPath: `package.json`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/monode.json`,
relativeExportPath: `monode.json`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/tsconfig.json`,
relativeExportPath: `tsconfig.json`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/.gitignore`,
relativeExportPath: `.gitignore`,
});
fs.mkdirSync(`./src`);
fs.mkdirSync(`./src/cloud-types`);
cloneSourceFile({
relativeSourceFilePath: `./templates/DynamoDB.ts`,
relativeExportPath: `./src/cloud-types/DynamoDB.ts`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/HttpTriggeredLambda.ts`,
relativeExportPath: `./src/cloud-types/HttpTriggeredLambda.ts`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/S3Bucket.ts`,
relativeExportPath: `./src/cloud-types/S3Bucket.ts`,
});
fs.mkdirSync(`./src/contact-book-microservice`);
cloneSourceFile({
relativeSourceFilePath: `./templates/ContactsTable.ts`,
relativeExportPath: `./src/contact-book-microservice/ContactsTable.ts`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/createContact.ts`,
relativeExportPath: `./src/contact-book-microservice/createContact.ts`,
});
fs.mkdirSync(`./src/more-examples`);
cloneSourceFile({
relativeSourceFilePath: `./templates/ExampleS3Bucket.ts`,
relativeExportPath: `./src/more-examples/ExampleS3Bucket.ts`,
});
cloneSourceFile({
relativeSourceFilePath: `./templates/ExampleStandAloneComponent.ts`,
relativeExportPath: `./src/more-examples/ExampleStandAloneComponent.ts`,
});
(0, run_cmd_1.runCmdAsync)({ command: 'npm i --save' });
}
exports.performInit = performInit;
;
async function cloneSourceFile(args) {
//console.log(path.resolve(__dirname, `../../../src/init`));
let inputPath = path.resolve(path.resolve(__dirname, `../../../src/init`), args.relativeSourceFilePath);
fs.writeFileSync(path.resolve(`./`, args.relativeExportPath), fs.readFileSync(inputPath));
}
| 38.723077 | 108 | 0.672626 |
fea9e91008b5b0e3ce70982c3551166b23319c64 | 219 | js | JavaScript | 03_SRC/hidoc-web/public/config.js | yuzhengyang/Hidoc | 94fc26f865ce35052ced83c66294963ab8bac581 | [
"Apache-2.0"
] | 5 | 2021-09-18T09:39:56.000Z | 2022-03-26T15:03:03.000Z | 03_SRC/hidoc-web/public/config.js | yuzhengyang/Hidoc | 94fc26f865ce35052ced83c66294963ab8bac581 | [
"Apache-2.0"
] | null | null | null | 03_SRC/hidoc-web/public/config.js | yuzhengyang/Hidoc | 94fc26f865ce35052ced83c66294963ab8bac581 | [
"Apache-2.0"
] | 1 | 2021-09-23T08:16:26.000Z | 2021-09-23T08:16:26.000Z | var config = {
author: '*',
environment: 'COM-DEV',
baseServer: 'http://127.0.0.1:24001/',
imageServer: 'http://127.0.0.1:24001/f/d/u/',
hdImageFlag: '#hd.image->',
hdIlinkFlag: '#hd.ilink->'
};
| 24.333333 | 49 | 0.557078 |
feaac4cada36d9dd6663ffdc6f3d376aa9dabeb4 | 349 | js | JavaScript | src/ GetWeatherByGeo.js | Rediet8abere/weather-api-2 | 7a89eaf025ea098bc8e42f89a280cbb7a43b6b42 | [
"MIT"
] | null | null | null | src/ GetWeatherByGeo.js | Rediet8abere/weather-api-2 | 7a89eaf025ea098bc8e42f89a280cbb7a43b6b42 | [
"MIT"
] | null | null | null | src/ GetWeatherByGeo.js | Rediet8abere/weather-api-2 | 7a89eaf025ea098bc8e42f89a280cbb7a43b6b42 | [
"MIT"
] | null | null | null | export default async function getWeatherByGeo(apikey, lat, lon) {
const path = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apikey}`
const res = await fetch(path)
const json = await res.json()
console.log("getWeatherByGeo--->", res)
console.log("getWeatherByGeo.main--->", res.main)
return json
} | 31.727273 | 102 | 0.687679 |
feab6c3136a77ad2ad6a22c4d49473d623d8ed1d | 680 | js | JavaScript | server/api/activity.js | AthenaExplorer/explorer | ef546af4c00885666b9f16f6726c6054a9472771 | [
"MIT"
] | 1 | 2022-01-17T02:57:27.000Z | 2022-01-17T02:57:27.000Z | server/api/activity.js | AthenaExplorer/explorer | ef546af4c00885666b9f16f6726c6054a9472771 | [
"MIT"
] | null | null | null | server/api/activity.js | AthenaExplorer/explorer | ef546af4c00885666b9f16f6726c6054a9472771 | [
"MIT"
] | 1 | 2022-03-02T19:22:19.000Z | 2022-03-02T19:22:19.000Z | var utils = require('../common/utils.js');
var consts = require('../common/consts.js');
module.exports = {
get_lookups(data, req) {
return utils.promiseRequest(
utils.getServerUrl('/activity/api/calculator/viewer/get_lookups'),
data,
utils.getCommonHeaders(req)
)
},
get_pool_miners(data, req) {
return utils.promiseRequest(
utils.getServerUrl(`/data/api/miner/get_miner_list`),
data,
utils.getCommonHeaders(req)
)
},
get_pool_overview(data, req) {
return utils.promiseRequest(
utils.getServerUrl(`/activity/api/dashboard/v2/get_pool_overview`),
data,
utils.getCommonHeaders(req)
)
}
} | 22.666667 | 73 | 0.658824 |
feabd77765097df7904bd6c7854ca8d9ab1d4af6 | 105 | js | JavaScript | server/config.js | neekon91/Ilera-health | 2e01a6861e86ae4ce15134a443fd203a8ea38a60 | [
"MIT"
] | 1 | 2020-07-03T19:42:22.000Z | 2020-07-03T19:42:22.000Z | server/config.js | neekon91/Ilera-health | 2e01a6861e86ae4ce15134a443fd203a8ea38a60 | [
"MIT"
] | 193 | 2016-09-21T06:07:17.000Z | 2021-05-05T16:06:45.000Z | server/config.js | neekon91/Ilera-health | 2e01a6861e86ae4ce15134a443fd203a8ea38a60 | [
"MIT"
] | 9 | 2016-09-21T06:04:39.000Z | 2021-06-25T18:23:30.000Z | //Move to Environment Variable
// module.exports = {
// jwtSecret: 'somesecretkeyforjsonwebtoken'
// } | 21 | 46 | 0.714286 |
feac1fca314c58c466778b7af9b0f8e3046f7663 | 40 | js | JavaScript | tests/unit/resources/app/dist/myapp/nls/root/bundleA.js | wkeese/requirejs-dplugins | 6f6a065504bb96b63f06de71f3174964193e88f1 | [
"BSD-3-Clause"
] | 4 | 2015-02-16T17:43:48.000Z | 2018-04-11T03:16:30.000Z | tests/unit/resources/app/dist/myapp/nls/root/bundleA.js | wkeese/requirejs-dplugins | 6f6a065504bb96b63f06de71f3174964193e88f1 | [
"BSD-3-Clause"
] | 26 | 2015-01-07T17:21:46.000Z | 2020-05-01T00:22:54.000Z | tests/unit/resources/app/dist/myapp/nls/root/bundleA.js | wkeese/requirejs-dplugins | 6f6a065504bb96b63f06de71f3174964193e88f1 | [
"BSD-3-Clause"
] | 6 | 2015-02-09T14:17:26.000Z | 2018-07-21T15:32:48.000Z | define({
MSG: "Text from Bundle A"
});
| 10 | 26 | 0.6 |
fead0d4a9b7c2875780279d63b5db437980e72df | 342 | js | JavaScript | Documentation/html/df/def/class_y_t_music_uploader_1_1_providers_1_1_request_models_1_1_browse_artists_results_context_1_1f9c6108b88a47944329280edb8035c90.js | jamesbrindle/YTMusicUploader | c2c7c7d694275f311932316794d179b44814c4d2 | [
"MIT"
] | 127 | 2020-08-30T16:36:03.000Z | 2022-02-19T19:17:08.000Z | Documentation/html/df/def/class_y_t_music_uploader_1_1_providers_1_1_request_models_1_1_browse_artists_results_context_1_1f9c6108b88a47944329280edb8035c90.js | fcrimins/YTMusicUploader | e90784391398a96e12595dc6fe4dda64ae345cae | [
"MIT"
] | 33 | 2020-08-31T17:17:16.000Z | 2021-10-16T11:41:03.000Z | Documentation/html/df/def/class_y_t_music_uploader_1_1_providers_1_1_request_models_1_1_browse_artists_results_context_1_1f9c6108b88a47944329280edb8035c90.js | fcrimins/YTMusicUploader | e90784391398a96e12595dc6fe4dda64ae345cae | [
"MIT"
] | 22 | 2020-10-10T19:55:56.000Z | 2022-03-08T03:53:59.000Z | var class_y_t_music_uploader_1_1_providers_1_1_request_models_1_1_browse_artists_results_context_1_1f9c6108b88a47944329280edb8035c90 =
[
[ "pageType", "df/def/class_y_t_music_uploader_1_1_providers_1_1_request_models_1_1_browse_artists_results_context_1_1f9c6108b88a47944329280edb8035c90.html#a8367df34ab0641f3eff70cf92c6cebe7", null ]
]; | 85.5 | 202 | 0.915205 |
feadb28972cc25cd80e872c3890e0666f6fc8059 | 119 | js | JavaScript | data/5992.js | stas-vilchik/bdd-ml | 2a254419a7c40c2e9b48625be8ca78721f786d2b | [
"MIT"
] | null | null | null | data/5992.js | stas-vilchik/bdd-ml | 2a254419a7c40c2e9b48625be8ca78721f786d2b | [
"MIT"
] | null | null | null | data/5992.js | stas-vilchik/bdd-ml | 2a254419a7c40c2e9b48625be8ca78721f786d2b | [
"MIT"
] | null | null | null | {
if (x === 155) {
return AdsPopoverLink62(154);
}
if (x === 239) {
return AdsPopoverLink62(238);
}
}
| 11.9 | 33 | 0.521008 |
feadc86d8c7fabe05d5c450b480255befb1e6fbd | 5,634 | js | JavaScript | statics/js/common.js | jonneyless/yii2-admin-asset | 75ff7ae0fd6d7edd659176fa2bd1b76c0d104615 | [
"MIT"
] | null | null | null | statics/js/common.js | jonneyless/yii2-admin-asset | 75ff7ae0fd6d7edd659176fa2bd1b76c0d104615 | [
"MIT"
] | null | null | null | statics/js/common.js | jonneyless/yii2-admin-asset | 75ff7ae0fd6d7edd659176fa2bd1b76c0d104615 | [
"MIT"
] | null | null | null | $(document).ready(function(){
if($(this).width() < 769){
$('body').addClass('body-small');
}else{
$('body').removeClass('body-small');
}
$('#side-menu').metisMenu();
// Collapse ibox function
$(document).on('click', '.collapse-link', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.children('.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$(document).on('click', '.close-link', function () {
var content = $(this).closest('div.ibox');
content.remove();
});
// Fullscreen ibox function
$(document).on('click', '.fullscreen-link', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
$('body').toggleClass('fullscreen-ibox-mode');
button.toggleClass('fa-expand').toggleClass('fa-compress');
ibox.toggleClass('fullscreen');
setTimeout(function () {
$(window).trigger('resize');
}, 100);
});
$('.sidebar-container').slimScroll({
height: '100%',
railOpacity: 0.4,
wheelStep: 10
});
$('.navbar-minimalize').on('click', function(event){
event.preventDefault();
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
function fix_height(){
var navbarheight = $('nav.navbar-default').height();
var wrapperHeight = $('#page-wrapper').height();
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebar-panel").css("min-height", heightWithoutNavbar + "px");
if(navbarheight > wrapperHeight){
$('#page-wrapper').css("min-height", navbarheight + "px");
}
if(navbarheight < wrapperHeight){
$('#page-wrapper').css("min-height", $(window).height() + "px");
}
if($('body').hasClass('fixed-nav')){
if(navbarheight > wrapperHeight){
$('#page-wrapper').css("min-height", navbarheight + "px");
}else{
$('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
}
}
}
fix_height();
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
$(window).bind("resize", function(){
if($(this).width() < 769){
$('body').addClass('body-small');
}else{
$('body').removeClass('body-small');
}
});
$(window).bind("load resize scroll", function(){
if(!$("body").hasClass('body-small')){
fix_height();
}
});
$(document).tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
$("[data-toggle=popover]").popover();
$(document).on('click', "a.btn-ajax", function () {
var btn = $(this);
var url = $(this).attr('href');
$.get(url, function (data) {
if (data.error) {
toastr.error(data.msg);
} else {
if (data.msg) {
toastr.success(data.msg);
}
if (data.btn) {
btn.text(data.btn.text);
btn.attr('title', data.btn.text);
if (data.btn.class) {
btn.attr('class', data.btn.class);
}
if (data.btn.href) {
btn.attr('href', data.btn.href);
}
}
}
}, 'json');
return false;
});
$('.full-height-scroll').slimscroll({
height: '100%'
});
toastr.options = {
"closeButton": true,
"debug": false,
"progressBar": true,
"preventDuplicates": false,
"positionClass": "toast-top-right",
"onclick": null,
"showDuration": "400",
"hideDuration": "1000",
"timeOut": "7000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
$(document).on('click', 'a[rel$=picker]', function () {
var button = $(this);
var type = button.attr('rel');
var input = button.closest('.input-group').children('input');
if (type == 'datetimepicker') {
input.datetimepicker('show');
} else {
input.datepicker('show');
}
});
});
function SmoothlyMenu(){
if(!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')){
// Hide menu in order to smoothly turn on when maximize menu
$('#side-menu').hide();
// For smoothly turn on menu
setTimeout(
function(){
$('#side-menu').fadeIn(400);
}, 200);
}else if($('body').hasClass('fixed-sidebar')){
$('#side-menu').hide();
setTimeout(
function(){
$('#side-menu').fadeIn(400);
}, 100);
}else{
// Remove all inline style from jquery fadeIn function to reset menu state
$('#side-menu').removeAttr('style');
}
} | 30.956044 | 85 | 0.482961 |
feae42ff9d292697471c85b56eeea9b9e120c9a9 | 237 | js | JavaScript | backend/src/server.js | LucaGuidoRegolini/Bluelab | 9ebee8988d7d7bbbec1c0d991014d0eed0af021b | [
"MIT"
] | null | null | null | backend/src/server.js | LucaGuidoRegolini/Bluelab | 9ebee8988d7d7bbbec1c0d991014d0eed0af021b | [
"MIT"
] | null | null | null | backend/src/server.js | LucaGuidoRegolini/Bluelab | 9ebee8988d7d7bbbec1c0d991014d0eed0af021b | [
"MIT"
] | null | null | null | const app = require("./app");
const connection = require("./database/conection");
async function start() {
await connection.migrate.rollback();
await connection.migrate.latest();
app.listen(process.env.PORT || 3333);
}
start();
| 19.75 | 51 | 0.696203 |
feae8acb6bd97d3b6a7b7627221868c017b38bcc | 102 | js | JavaScript | skysail.client.todos.angularjs/webapp/static/js/app.js | evandor/skysail-framework | 480df6f043ab85328ecc6cc38958c501edbc2374 | [
"Apache-2.0"
] | 1 | 2016-02-08T08:57:12.000Z | 2016-02-08T08:57:12.000Z | skysail.client.todos.angularjs/webapp/static/js/app.js | evandor/skysail-framework | 480df6f043ab85328ecc6cc38958c501edbc2374 | [
"Apache-2.0"
] | 3 | 2016-02-15T11:15:06.000Z | 2016-03-01T11:57:56.000Z | skysail.client.todos.angularjs/webapp/static/js/app.js | evandor/skysail-framework | 480df6f043ab85328ecc6cc38958c501edbc2374 | [
"Apache-2.0"
] | null | null | null | var todosProduct = angular.module('todosProduct', ['ui.bootstrap','ngRoute','filters','statuses']);
| 25.5 | 99 | 0.715686 |
feb03449860a817c386976468e7bb982b695c329 | 1,363 | js | JavaScript | server.js | ThorNolan/Friend-Finder | 401be77e9d2c8eef6aa35112fd082b3cbefde921 | [
"MIT"
] | null | null | null | server.js | ThorNolan/Friend-Finder | 401be77e9d2c8eef6aa35112fd082b3cbefde921 | [
"MIT"
] | null | null | null | server.js | ThorNolan/Friend-Finder | 401be77e9d2c8eef6aa35112fd082b3cbefde921 | [
"MIT"
] | null | null | null | //=============================== DEPENDENCIES ==========================================
// require the Express and path node packages
var express = require("express");
var path = require("path");
//============================ EXPRESS CONFIGURATION ====================================
// set up Express server
var app = express();
// Set initial port and host and allow port to be set by Heroku
var PORT = process.env.PORT || 3000;
var HOST = "0.0.0.0";
// Sets up the Express app to handle data parsing with built-in middleware
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Provide server access to my public directory for serving my css and images
app.use(express.static(path.join(__dirname, "./app/public")));
app.use(express.static(path.join(__dirname, "./app/public/assets")));
//=================================== ROUTES =============================================
// Establish routes to my html and api js files from my Express server
require("./app/routing/apiRoutes")(app);
require("./app/routing/htmlRoutes")(app);
//=================================== INITIATION =========================================
// Initiate my server on the specified port
app.listen(PORT, HOST, function() {
// Log with link when server has started
console.log("Server listening on: http://localhost:" + PORT);
});
| 35.868421 | 90 | 0.556126 |
feb05f2a85554632e8ffb9621836b2199495611b | 246 | js | JavaScript | index.js | trotzig/happo-plugin-puppeteer | dbfd07a5d747f35d8eabe8bf5267d8e3790a343d | [
"MIT"
] | 3 | 2019-01-29T06:03:36.000Z | 2019-06-26T16:23:37.000Z | index.js | trotzig/happo-plugin-puppeteer | dbfd07a5d747f35d8eabe8bf5267d8e3790a343d | [
"MIT"
] | 2 | 2021-03-10T22:16:50.000Z | 2021-05-11T17:35:51.000Z | index.js | trotzig/happo-plugin-puppeteer | dbfd07a5d747f35d8eabe8bf5267d8e3790a343d | [
"MIT"
] | 1 | 2021-12-22T07:41:20.000Z | 2021-12-22T07:41:20.000Z | const PuppeteerDomProvider = require('./PuppeteerDomProvider');
module.exports = function happoPluginPuppeteer({ launchOptions = {} } = {}) {
return {
DomProvider: PuppeteerDomProvider.bind(PuppeteerDomProvider, { launchOptions }),
}
};
| 30.75 | 84 | 0.731707 |
feb07bb170ab5676fa7315b77ff79342f89af4b3 | 109 | js | JavaScript | doc/doxygen/html/struct_command.js | vany152/VM5 | ef25328dae8eebdfe73c8ea427042ad45e311f91 | [
"MIT"
] | null | null | null | doc/doxygen/html/struct_command.js | vany152/VM5 | ef25328dae8eebdfe73c8ea427042ad45e311f91 | [
"MIT"
] | null | null | null | doc/doxygen/html/struct_command.js | vany152/VM5 | ef25328dae8eebdfe73c8ea427042ad45e311f91 | [
"MIT"
] | null | null | null | var struct_command =
[
[ "operator()", "struct_command.html#a94f3aa030663e8aedc30ca8228789891", null ]
]; | 27.25 | 83 | 0.733945 |
feb09193915b4020fd9aaa0b96334cb80f85cc2d | 653 | js | JavaScript | docs/html/search/all_a.js | aks010/ClusterDuck-Protocol | e0db961f446ab9f40c93c6ff4842c840a8a4fd25 | [
"Apache-2.0"
] | 165 | 2020-10-15T19:13:31.000Z | 2022-03-25T19:13:31.000Z | docs/html/search/all_a.js | aks010/ClusterDuck-Protocol | e0db961f446ab9f40c93c6ff4842c840a8a4fd25 | [
"Apache-2.0"
] | 100 | 2020-10-09T11:39:46.000Z | 2022-03-18T19:41:19.000Z | docs/html/search/all_a.js | aks010/ClusterDuck-Protocol | e0db961f446ab9f40c93c6ff4842c840a8a4fd25 | [
"Apache-2.0"
] | 77 | 2020-10-09T13:04:33.000Z | 2022-03-27T16:34:02.000Z | var searchData=
[
['main_2emd_96',['main.md',['../main_8md.html',1,'']]],
['mama_97',['MAMA',['../_duck_types_8h.html#ae840cd9270fc5804ad85c80de1686d4aa324f3d8a8abafdef821a168b2c2e3a3e',1,'DuckTypes.h']]],
['mamaduck_2ecpp_98',['MamaDuck.cpp',['../_mama_duck_8cpp.html',1,'']]],
['max_5ftype_99',['MAX_TYPE',['../_duck_types_8h.html#ae840cd9270fc5804ad85c80de1686d4aacde90f0aafc1967e6a602267a564a0cc',1,'DuckTypes.h']]],
['messageid_100',['messageId',['../struct_packet.html#aac492465229163ae5e76e545126ad009',1,'Packet']]],
['messageid_5fb_101',['messageId_B',['../_duck_lora_8h.html#aebcd0cc31b6e3ddad458b2e371d5792b',1,'DuckLora.h']]]
];
| 65.3 | 143 | 0.7366 |
feb0bbdf1989f5a8cbb0f0d9342bfc9827eba965 | 351 | js | JavaScript | .eslintrc.js | Thrashattack/family-classifications | fb0a1e348202f039d09840d0c6c7306a7629bee6 | [
"MIT"
] | null | null | null | .eslintrc.js | Thrashattack/family-classifications | fb0a1e348202f039d09840d0c6c7306a7629bee6 | [
"MIT"
] | null | null | null | .eslintrc.js | Thrashattack/family-classifications | fb0a1e348202f039d09840d0c6c7306a7629bee6 | [
"MIT"
] | null | null | null | module.exports = {
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parserOptions: {
project: './tsconfig.json'
} ,
rules: {
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
]
}
}; | 19.5 | 68 | 0.578348 |
feb199a91c911ec6145bc2b1768a893cec01629e | 291 | js | JavaScript | src/schema/section/legal-comments.test.js | bpdesigns/e-QIP-prototype | ca614c478e856c523c389d88a919d1357508dddd | [
"CC0-1.0"
] | null | null | null | src/schema/section/legal-comments.test.js | bpdesigns/e-QIP-prototype | ca614c478e856c523c389d88a919d1357508dddd | [
"CC0-1.0"
] | null | null | null | src/schema/section/legal-comments.test.js | bpdesigns/e-QIP-prototype | ca614c478e856c523c389d88a919d1357508dddd | [
"CC0-1.0"
] | null | null | null | import { unschema } from '../schema'
import { legalComments } from './legal-comments'
describe('Schema for legal comments', () => {
it('can wrap in schema', () => {
const data = {
Comments: { value: 'Yes' }
}
expect(unschema(legalComments(data))).toEqual(data)
})
})
| 22.384615 | 55 | 0.597938 |
feb1a8cb11d7aceaf9c6f6242dd95fa8b9e3465f | 837 | js | JavaScript | 539 Minimum Time Difference/index.js | Clovin/LeetCode | c218bbad59c4d05c05b0b4b806519c6a8b4e113e | [
"MIT"
] | null | null | null | 539 Minimum Time Difference/index.js | Clovin/LeetCode | c218bbad59c4d05c05b0b4b806519c6a8b4e113e | [
"MIT"
] | null | null | null | 539 Minimum Time Difference/index.js | Clovin/LeetCode | c218bbad59c4d05c05b0b4b806519c6a8b4e113e | [
"MIT"
] | null | null | null | /**
* Created by Clovin on 09/03/2018.
*/
/**
* @param {string[]} timePoints
* @return {number}
*/
var findMinDifference = function (timePoints) {
let tempTime = []
for (let i = 0; i < timePoints.length; i++) {
tempTime.push(timePoints[i].split(':').map(item => parseInt(item)))
}
tempTime.sort((a, b) => a[0] === b[0] ? a[1] - b[1] : a[0] - b[0])
let min = 999999999
for (let i = 1; i < tempTime.length; i++) {
let temp = (tempTime[i][0] - tempTime[i - 1][0]) * 60 + (tempTime[i][1] - tempTime[i - 1][1])
if (temp < min) {
min = temp
}
}
if (0 !== tempTime.length - 1) {
let temp = (tempTime[0][0] + 24 - tempTime[tempTime.length - 1][0]) * 60 + (tempTime[0][1] - tempTime[tempTime.length - 1][1])
if (temp < min) {
min = temp
}
}
return min === 999999999 ? 0 : min
}
| 26.15625 | 130 | 0.53405 |
feb2d54b0ad9489678cba0a5355b266a5949e2bb | 312 | js | JavaScript | utils/proc-man.js | marcosmol204/askii | 4d4766dbbea531b630e6707c54547808a3f61b40 | [
"MIT"
] | null | null | null | utils/proc-man.js | marcosmol204/askii | 4d4766dbbea531b630e6707c54547808a3f61b40 | [
"MIT"
] | null | null | null | utils/proc-man.js | marcosmol204/askii | 4d4766dbbea531b630e6707c54547808a3f61b40 | [
"MIT"
] | null | null | null | const onExit = (err) => {
if (err) {
console.error(err, 'NODE ERROR>>>', 'ERRORS');
} else {
console.log('Node process - no errpr.', 'runner');
}
};
module.exports = () => {
const proc = process;
proc.on('uncaughtException', onExit);
proc.on('exit', onExit);
proc.on('SIGINT', onExit);
};
| 20.8 | 54 | 0.573718 |
feb3057053d09d0a9d23f8cfe08d13b3bdeeec9f | 1,204 | js | JavaScript | Backend/src/controller/UsersController.js | Vini404/FacebookCopy | a368c597e6e42fbceaaa8595c2213476a7c27f4a | [
"MIT"
] | 2 | 2020-07-17T02:53:30.000Z | 2020-08-19T05:37:33.000Z | Backend/src/controller/UsersController.js | Vini404/FacebookCopy | a368c597e6e42fbceaaa8595c2213476a7c27f4a | [
"MIT"
] | 4 | 2021-03-11T01:59:58.000Z | 2022-02-27T08:26:12.000Z | Backend/src/controller/UsersController.js | Vini404/FacebookCopy | a368c597e6e42fbceaaa8595c2213476a7c27f4a | [
"MIT"
] | null | null | null | const knex = require("../database")
const crypto = require("crypto")
module.exports = {
async create(request, response, next) {
try {
const {
nome,
sobrenome,
usuario,
email,
senha
} = request.body
const id = crypto.randomBytes(4).toString("hex")
await knex("users").insert({
id,
nome,
sobrenome,
usuario,
email,
senha
})
return response.status(201).send({id})
} catch (error) {
next(error)
}
},
async index(request, response, next) {
try {
const users = await knex("users")
return response.json(users)
} catch (error) {
next(error)
}
},
async delete(request,response,next){
try {
const{id}=request.params
await knex("users")
.where({id})
.del()
return response.send()
} catch (error) {
next(error)
}
}
}
| 20.40678 | 60 | 0.405316 |
feb4784ee3265252014711c1698a4b9c855c4369 | 1,578 | js | JavaScript | client/src/components/pages/PasswordChange.js | jonathan-white/Surplus | 6b779d5799e39f723eedff8f16e785076b4006d4 | [
"MIT"
] | null | null | null | client/src/components/pages/PasswordChange.js | jonathan-white/Surplus | 6b779d5799e39f723eedff8f16e785076b4006d4 | [
"MIT"
] | 3 | 2021-10-05T19:30:32.000Z | 2022-02-26T04:16:41.000Z | client/src/components/pages/PasswordChange.js | jonathan-white/Surplus | 6b779d5799e39f723eedff8f16e785076b4006d4 | [
"MIT"
] | 1 | 2018-10-01T20:50:29.000Z | 2018-10-01T20:50:29.000Z | import React, { Component } from 'react';
import { Input } from "react-materialize";
import { auth } from '../../firebase';
const INITIAL_STATE = {
passwordOne: '',
passwordTwo: '',
error: null,
};
class PasswordChangeForm extends Component {
constructor(props){
super(props);
this.state = { ...INITIAL_STATE };
}
handleFormSubmit = (event) => {
const { passwordOne } = this.state;
auth.doPasswordUpdate(passwordOne)
.then(() => this.setState({ ...INITIAL_STATE }))
.catch(error => this.setState({ error }));
event.preventDefault();
};
handleInputChange = event => {
const {name, value} = event.target;
this.setState({ [name]: value });
};
render() {
const { passwordOne, passwordTwo, error } = this.state;
const isInvalid = passwordOne !== passwordTwo || passwordOne === '';
return (
<div>
<h5 className="center-align">Change Password</h5>
<div className="login-form">
<form onSubmit={this.handleFormSubmit}>
<Input s={12} type="password" onChange={this.handleInputChange}
label="New Password" value={passwordOne} name="passwordOne"
/>
<Input s={12} type="password" onChange={this.handleInputChange}
label="Confirm New Password" value={passwordTwo} name="passwordTwo"
/>
<button disabled={isInvalid} className="btn">Reset My Password</button>
{ error && <p>{error.message}</p>}
</form>
</div>
</div>
)
}
}
export default PasswordChangeForm;
| 27.684211 | 83 | 0.600127 |
feb4960d500c7ca7e561bc5e09c60b950b47f684 | 7,345 | js | JavaScript | components/inspectit-ocelot-configurationserver-ui/src/components/views/alerting/rules/editor/RulesEditor.js | inspectIT/inspectit-oce | cc6f1ed2795f69ba244562d4b8a57437db45c784 | [
"Apache-2.0"
] | 12 | 2018-12-20T07:05:30.000Z | 2019-03-23T17:47:29.000Z | components/inspectit-ocelot-configurationserver-ui/src/components/views/alerting/rules/editor/RulesEditor.js | inspectIT/inspectit-oce | cc6f1ed2795f69ba244562d4b8a57437db45c784 | [
"Apache-2.0"
] | 80 | 2018-12-03T07:43:47.000Z | 2019-03-25T08:14:45.000Z | inspectit-prometheus-jaeger/configuration-server-ui/src/components/views/alerting/rules/editor/RulesEditor.js | adriannovegil/spring-petclinic-microservices-inspectit | f5e1ac344de6e98d3bcc73745405ac9a3b8e50cc | [
"Apache-2.0"
] | 6 | 2018-12-03T14:40:05.000Z | 2019-03-15T07:52:05.000Z | import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import _, { cloneDeep, remove, extend } from 'lodash';
import DescriptionSection from './DescriptionSection';
import VariableView from './VariableView';
import SelectionInformation from '../../../../editor/SelectionInformation';
import Section from '../../Section';
import dateformat from 'dateformat';
/**
* The RulesEditor component views alerting rules and templates and provides means to edit the content of an alerting rule.
*/
const RulesEditor = ({
availableTopics,
content,
isRule,
hasTopicVariable,
mappedVars,
readOnly,
onContentChanged,
onErrorStatusUpdate,
}) => {
// state variables
const [errornuousVariables, setErrornuousVariables] = useState({});
useEffect(() => {
onErrorStatusUpdate(0);
setErrornuousVariables({});
}, [content]);
if (!content) {
return <SelectionInformation hint="Select a rule or template to start editing." />;
}
const contentName = content.id;
const hasExecutionError = !!content.error;
const format = 'yyyy-mm-dd HH:MM:ss';
const creationDate = content.created ? dateformat(content.created, format) : '-';
const modificationDate = content.modified ? dateformat(content.modified, format) : '-';
const updateAttribute = (attribute, newValue) => {
const newContent = cloneDeep(content);
newContent[attribute] = newValue;
onContentChanged(newContent);
};
const updateVariable = (name, value) => {
var newContent = cloneDeep(content);
if (value === null && newContent.vars) {
remove(newContent.vars, (v) => v.name === name);
} else if (value !== null) {
if (!newContent.vars) {
newContent.vars = [];
}
remove(newContent.vars, (v) => v.name === name);
const defaultVar = mappedVars.find((v) => v.name === name);
const changedVar = { name: name, description: defaultVar.description, value: value, type: defaultVar.type };
newContent.vars = [...newContent.vars, changedVar];
}
onContentChanged(newContent);
};
const updateErrorStatus = (name, errorMessage) => {
setErrornuousVariables(extend(errornuousVariables, { [name]: errorMessage }));
onErrorStatusUpdate(Object.entries(errornuousVariables).filter((keyValPair) => !_.isNil(keyValPair[1])).length);
};
let statusText;
let statusIconClass;
if (isRule) {
if (content.status === 'enabled') {
if (hasExecutionError) {
statusText = 'Execution Error';
statusIconClass = 'pi-times-circle red';
} else {
statusText = 'Enabled';
statusIconClass = 'pi-circle-on green';
}
} else {
statusText = 'Disabled';
statusIconClass = 'pi-circle-off grey';
}
}
return (
<>
<style jsx>{`
.this {
display: flex;
flex-direction: column;
overflow-y: auto;
flex-grow: 1;
}
.this :global(.error.p-col-fixed) {
padding: 0.5rem 0 0;
}
.detail-row {
display: flex;
align-items: center;
}
.detail-row:not(:first-child) {
margin-top: 0.25rem;
}
.detail-row span {
width: 10rem;
display: inline-block;
color: #333;
}
.detail-row .pi {
margin-right: 0.5rem;
}
.error {
font-family: monospace;
}
.green {
color: #4caf50;
}
.grey {
color: #9e9e9e;
}
.red {
color: #f44336;
}
`}</style>
<div className="this">
{hasExecutionError && (
<Section title={'Execution Error'} backgroundColor="#ff8181">
<div className="error">{content.error}</div>
</Section>
)}
<Section title={(isRule ? 'Rule' : 'Template') + ' Details'}>
{isRule && (
<div className="detail-row">
<span>Status:</span> <i className={'pi ' + statusIconClass} /> {statusText}
</div>
)}
<div className="detail-row">
<span>Creation Date:</span> {creationDate}
</div>
<div className="detail-row">
<span>Last Modification:</span> {modificationDate}
</div>
</Section>
<DescriptionSection
value={content.description}
updateValue={(value) => updateAttribute('description', value)}
readOnly={readOnly}
/>
<Section title="Variables">
{isRule && hasTopicVariable && (
<VariableView
options={!availableTopics ? [] : availableTopics.map((topic) => topic.id)}
name={'Notification Channel'}
description={'The destination channel where notifications should be sent to when an alert is triggered by this rule.'}
isNullValueValid={false}
value={content.topic}
type={'selection'}
readOnly={readOnly}
error={errornuousVariables['Notification Channel']}
onErrorStatusUpdate={updateErrorStatus}
onVarUpdate={(name, value) => updateAttribute('topic', value)}
isDefault={!content.topic}
customErrorCheck={(value) => {
const matchResult = value.match(/[\w\-.]*/);
const hasError = !matchResult || matchResult[0] !== value;
return hasError
? 'Notification channel names may only contain the following charaters: letters, numbers, dot, - or _'
: null;
}}
/>
)}
{mappedVars.map((variable) => (
<VariableView
key={contentName + '-' + variable.name}
name={variable.name}
description={variable.description}
value={variable.value !== undefined ? variable.value : variable.defaultValue}
isNullValueValid={!_.isNil(variable.defaultValue)}
type={variable.type}
readOnly={readOnly}
error={isRule ? errornuousVariables[variable.name] : null}
onVarUpdate={updateVariable}
onErrorStatusUpdate={isRule ? updateErrorStatus : null}
isDefault={variable.value === undefined}
/>
))}
</Section>
</div>
</>
);
};
RulesEditor.propTypes = {
/** An array of strings denoting the available notification topics */
availableTopics: PropTypes.array,
/** The rule or template content to show (and edit) in this editor */
content: PropTypes.object,
/** Whether the given content has a topic variable */
hasTopicVariable: PropTypes.bool,
/** Whether the content is a rule content */
isRule: PropTypes.bool,
/** An array of variables mapped with default values from the template. */
mappedVars: PropTypes.array,
/** Whether the content is read only */
readOnly: PropTypes.bool,
/** Callback on content update */
onContentChanged: PropTypes.func,
/** Callback on error status update */
onErrorStatusUpdate: PropTypes.func,
};
RulesEditor.defaultProps = {
availableTopics: [],
isRule: false,
readOnly: false,
onContentChanged: () => {},
onErrorStatusUpdate: () => {},
};
export default RulesEditor;
| 32.356828 | 132 | 0.587338 |
feb4cb2cb934d8c8d2102c097f5416ff5952feb0 | 817 | js | JavaScript | src/store/configureStore.js | broken98/QueryItSmart | 2d6e36acec830c7d0047e138fd5ed35a7a560dc2 | [
"MIT"
] | 92 | 2017-02-23T02:11:18.000Z | 2022-02-01T19:49:55.000Z | src/store/configureStore.js | omar16100/QueryItSmart | 19589b0e913c2a65b696b33c89f18ac70ec00cea | [
"MIT"
] | 50 | 2017-02-23T01:43:59.000Z | 2020-01-20T20:56:58.000Z | src/store/configureStore.js | omar16100/QueryItSmart | 19589b0e913c2a65b696b33c89f18ac70ec00cea | [
"MIT"
] | 17 | 2017-03-08T10:05:48.000Z | 2021-06-13T22:50:04.000Z | import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import rootReducer from '../reducers'
export default function configureStore() {
const middleware = [thunk]
let store
if (process.env.NODE_ENV === 'production') {
// store = createStore(rootReducer, preloadedState)
store = createStore(rootReducer, applyMiddleware(...middleware))
} else {
// For Redux Devtools
store = createStore(rootReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), applyMiddleware(...middleware))
}
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers').default
store.replaceReducer(nextReducer)
})
}
return store
}
| 32.68 | 146 | 0.707466 |
feb4e0cc009e7c96937bd0fcf0e9b50e25b5834d | 6,701 | js | JavaScript | src/index.js | BugCreators/ql-quill | dfceeac963e1f96f62075b6f37edf1418652e682 | [
"MIT"
] | 2 | 2020-09-29T02:52:36.000Z | 2021-05-17T02:02:53.000Z | src/index.js | BugCreators/ql-quill | dfceeac963e1f96f62075b6f37edf1418652e682 | [
"MIT"
] | null | null | null | src/index.js | BugCreators/ql-quill | dfceeac963e1f96f62075b6f37edf1418652e682 | [
"MIT"
] | null | null | null | import Quill from "quill";
import isEqual from "lodash.isequal";
import extend from "extend";
import Dialog from "./modules/dialog";
import BlotFormatter, { ImageSpec } from "./modules/blotFormatter";
import SnowTheme from "./themes/snow";
import ImageBlot from "./blots/image";
import ImageUploader from "./modules/imageUploader";
import WordCount from "./modules/wordCount";
import Import from "./modules/import";
import Question from "./modules/question";
import cleanIcon from "@icons/clean.svg";
import "../assets/index.styl";
const Icons = Quill.import("ui/icons");
Object.assign(Icons, { clean: cleanIcon });
Quill.register(
{
dialog: Dialog,
"modules/imageUploader": ImageUploader,
"modules/wordCount": WordCount,
"modules/question": Question,
"modules/import": Import,
"modules/blotFormatter": BlotFormatter,
"themes/snow": SnowTheme,
},
true
);
Quill.register(ImageBlot, true);
class QlQuill {
static Quill = Quill;
constructor(container, options = {}) {
if (typeof container === "string") {
container = document.querySelector(container);
}
this.container = container;
// 阻止谷歌翻译输入框
this.container.classList.add("notranslate");
this.options = extractConfig(options);
this.instantiateEditor(options);
this.setContents(this.options.value);
}
expandConfig(options) {
options = extend(
true,
{
theme: "snow",
modules: { toolbar: { container: this.options.toolbar } },
custom: this.constructor.CUSTOM_TOOLS.filter(
tool => !!this.options[tool]
),
},
options
);
const { imageResize, formula, image } = this.options;
let modules = {};
if (imageResize || formula) {
modules.blotFormatter = {
specs: [ImageSpec],
resizable: imageResize,
formula: formula && {
onFormulaEdit: this.openFormulaDialog.bind(this),
},
};
}
if (image) modules.imageUploader = image;
options = extend(true, { modules }, options);
return options;
}
// 实例化编辑器
instantiateEditor(options) {
if (this.editor) return;
this.editor = new Quill(this.container, this.expandConfig(options));
this.transformConfig();
this.editor.on(
"editor-change",
(eventName, rangeOrDelta, oldRangeOrDelta, source) => {
if (eventName === "text-change") {
this.onEditorChangeText(
this.editor.root.innerHTML,
rangeOrDelta,
source
);
} else if (eventName === "selection-change") {
this.onEditorChangeSelection(rangeOrDelta, source);
}
}
);
}
transformConfig() {
const toolbar = this.editor.getModule("toolbar");
if (
toolbar.container.querySelector(".ql-question") ||
toolbar.container.querySelector(".ql-option")
) {
this.editor.theme.addModule("question");
}
if (toolbar.container.querySelector(".ql-import")) {
this.editor.theme.addModule("import");
}
const { limit, image, formula } = this.options;
if (limit) {
const wordCount = this.editor.theme.addModule("wordCount");
wordCount.setOptions(this.options);
}
image?.clipboard &&
this.editor.clipboard.addMatcher("IMG", image.clipboard);
formula && toolbar.addHandler("formula", () => this.openFormulaDialog());
}
setContents = value => {
const sel = this.selection;
if (typeof value === "string") {
this.editor.setContents(this.editor.clipboard.convert(value));
} else {
this.editor.setContents(value);
}
postpone(() => this.setEditorSelection(this.editor, sel));
};
getHTML = () => {
return this.editor.root.innerHTML;
};
setEditorSelection(editor, range) {
this.selection = range;
if (range) {
const length = editor.getLength();
range.index = Math.max(0, Math.min(range.index, length - 1));
range.length = Math.max(
0,
Math.min(range.length, length - 1 - range.index)
);
editor.setSelection(range);
}
}
onEditorChangeText(value, delta, source) {
if (!this.editor || this.editor.getModule("wordCount")) return;
this.options.onChange?.(value);
}
onEditorChangeSelection(nextSelection, source) {
if (!this.editor) return;
const currentSelection = this.selection;
const hasGainedFocus = !currentSelection && nextSelection;
const hasLostFocus = currentSelection && !nextSelection;
if (isEqual(nextSelection, currentSelection)) return;
this.selection = nextSelection;
const toolbar = this.editor.getModule("toolbar");
if (hasGainedFocus) {
this.container.classList.add("on-focus");
toolbar.container.classList.add("on-focus");
} else if (hasLostFocus) {
this.container.classList.remove("on-focus");
toolbar.container.classList.remove("on-focus");
}
}
insertImage = (src, latex = "") => {
const imageUploader = this.editor.getModule("imageUploader");
return imageUploader.constructor.insertImage.call(this.editor, src, latex);
};
// 插入公式弹窗
openFormulaDialog(img = null) {
const time = new Date().getTime();
const latex = img ? img.dataset.latex || "" : "";
const Dialog = Quill.import("dialog");
new Dialog({
width: 888,
title: "插入公式",
content: `
<iframe
id="kfEditorContainer-${time}"
src="${this.options.formula}?=${time}"
${latex ? `data-latex="${latex}"` : ""}
style="border:none;height:400px;width:100%;"
></iframe>
`,
onOk: _ => {
if (!window.kfe) return;
window.kfe.execCommand("get.image.data", data => {
const sLatex = window.kfe.execCommand("get.source");
const imageUploader = this.editor.getModule("imageUploader");
imageUploader.uploadImage(data.img, src => {
if (img) {
img.setAttribute("src", src);
if (sLatex) img.dataset.latex = sLatex;
return;
}
this.insertImage(src, sLatex);
});
});
},
});
}
}
QlQuill.CUSTOM_TOOLS = ["import", "option", "formula", "question"];
QlQuill.CUSTOM_OPTIONS = [
"toolbar",
"limit",
"value",
"onLimit",
"image",
"imageResize",
"onChange",
];
function extractConfig(options) {
return QlQuill.CUSTOM_OPTIONS.concat(QlQuill.CUSTOM_TOOLS).reduce(
(memo, option) => {
memo[option] = options[option] || false;
delete options[option];
return memo;
},
{}
);
}
function postpone(fn) {
Promise.resolve().then(fn);
}
export default QlQuill;
| 24.545788 | 79 | 0.615878 |
feb4fd5fb60e12ffe3b3753893786e8ddeab3e52 | 196 | js | JavaScript | src/common/util/auth.js | eastnorthwest/echo | fcee1ce1bf7f13668eddfe6a04d764a84f0b953a | [
"MIT"
] | null | null | null | src/common/util/auth.js | eastnorthwest/echo | fcee1ce1bf7f13668eddfe6a04d764a84f0b953a | [
"MIT"
] | null | null | null | src/common/util/auth.js | eastnorthwest/echo | fcee1ce1bf7f13668eddfe6a04d764a84f0b953a | [
"MIT"
] | null | null | null | export function loginURL(options = {}) {
const redirect = options.redirect ? `?redirect=${encodeURIComponent(options.redirect)}` : ''
return `${process.env.IDM_BASE_URL}/sign-in${redirect}`
}
| 39.2 | 94 | 0.714286 |
feb6c0ce8e97745acb6c0b394cb91dce7d071425 | 11,404 | js | JavaScript | controllers/article.js | jswebguru/blog_wall_node_backend | 18457db0eb4f0ef021964cc733639f335157ca9e | [
"MIT"
] | null | null | null | controllers/article.js | jswebguru/blog_wall_node_backend | 18457db0eb4f0ef021964cc733639f335157ca9e | [
"MIT"
] | null | null | null | controllers/article.js | jswebguru/blog_wall_node_backend | 18457db0eb4f0ef021964cc733639f335157ca9e | [
"MIT"
] | null | null | null | const _ = require('lodash');
const Article = require('../models/article');
const Comment = require('../models/comment');
const User = require('../models/user');
const articlesPerPage = 50;
exports.getArticles = async function (req, res) {
try {
const { page, type } = req.query;
let sort = {
createdAt: -1,
};
if (type === 'popular') {
sort = {
likes: -1,
};
}
const articles = await Article.find()
.populate({
path: 'posted_by',
model: 'User',
select: '_id firstname lastname email',
})
.populate([
{
path: 'comments',
model: 'Comment',
select: '_id content createdAt updatedAt',
options: { sort: { createdAt: -1 } },
populate: {
path: 'commented_by',
select: 'firstname lastname email',
},
},
])
.populate({
path: 'liked_by',
model: 'User',
select: 'firstname lastname email',
})
.sort(sort)
.limit(articlesPerPage)
.skip((parseInt(page) - 1) * articlesPerPage)
.exec();
if (articles) {
res.status(200).json({
success: true,
articles,
});
} else {
res.status(500).json({
success: false,
message: 'Could not get articles',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.getArticle = async function (req, res) {
const articleId = req.params.article_id;
try {
const article = await Article.findOne({ _id: articleId })
.populate({
path: 'posted_by',
model: 'User',
select: '_id firstname lastname email',
})
.populate([
{
path: 'comments',
model: 'Comment',
select: '_id content createdAt updatedAt',
populate: {
path: 'commented_by',
select: 'firstname lastname email',
},
},
])
.populate({
path: 'liked_by',
model: 'User',
select: 'firstname lastname email',
})
.exec();
if (article) {
res.status(200).json({
success: true,
article,
});
} else {
res.status(500).json({
success: false,
message: 'Could not get an article',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.createArticle = async function (req, res) {
const { content, tag } = req.body;
const posted_by = req.user._id;
const newArticle = {
content,
tag,
posted_by,
};
try {
const article = await new Article(newArticle);
const result = await article.save();
const aaa = await Article.findOne({ _id: article._id })
.populate({
path: 'posted_by',
model: 'User',
select: '_id email firstname lastname',
})
.exec();
if (result) {
return res.status(200).json({
success: true,
message: 'Article created successfully',
article: aaa,
});
} else {
res.status(500).json({
success: false,
message: 'Could not create an article',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.editArticle = async function (req, res) {
const articleId = req.params.article_id;
const { content, tag } = req.body;
const newArticle = {
content,
tag,
};
try {
const result = await Article.update({ _id: articleId }, newArticle);
if (result) {
res.status(200).json({
success: true,
message: 'Article updated successfully',
});
} else {
res.status(500).json({
success: false,
message: 'Could not update an article',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.deleteArticle = async function (req, res) {
const articleId = req.params.article_id;
try {
const result = await Article.deleteOne({ _id: articleId });
if (result) {
return res.status(200).json({
success: true,
message: 'Article deleted successfully',
});
} else {
res.status(500).json({
success: false,
message: 'Could not delete an article',
});
}
} catch (error) {
res.status(400).json({
success: false,
message: 'Bad request',
});
}
};
exports.likeArticle = async function (req, res) {
const userId = req.user._id;
const articleId = req.params.article_id;
try {
const article = await Article.findOne({ _id: articleId });
if (article.posted_by.toString() === userId.toString()) {
return res.status(400).json({
success: false,
message: 'You can not like your own post.',
});
}
if (article.liked_by.includes(userId)) {
return res.status(400).json({
success: false,
message: 'You arleady liked this article',
});
}
let likes = article.likes;
let liked_by = article.liked_by;
likes++;
liked_by.push(userId);
const result = await Article.update(
{ _id: articleId },
{ likes, liked_by },
);
if (result) {
return res.status(200).json({
success: true,
message: 'You liked an article',
});
} else {
res.status(500).json({
success: false,
message: 'Could not like an article',
});
}
} catch (error) {
res.status(400).json({
success: false,
message: 'Bad request',
});
}
};
exports.cancelLikeArticle = async function (req, res) {
const { type } = req.body;
const userId = req.user._id;
const articleId = req.params.article_id;
try {
const article = await Article.findOne({ _id: articleId });
if (article.posted_by.toString() === userId.toString()) {
return res.status(400).json({
success: false,
message: 'You can not unlike your own post.',
});
}
if (!article.liked_by.includes(userId)) {
return res.status(400).json({
success: false,
message: 'You already unliked this article',
});
}
let likes = article.likes;
let liked_by = article.liked_by;
likes--;
const result = await Article.update(
{ _id: articleId },
{
likes,
liked_by: liked_by.filter(
item => item.toString() !== userId.toString(),
),
},
);
if (result) {
return res.status(200).json({
success: true,
message: 'You removed this article from as liked',
});
} else {
res.status(500).json({
success: false,
message: 'Could not like an article',
});
}
} catch (error) {
res.status(400).json({
success: false,
message: 'Bad request',
});
}
};
exports.favoriteArticle = async function (req, res) {
const { type } = req.body;
const userId = req.user._id;
const articleId = req.params.article_id;
try {
let result;
if (type) {
result = await User.findOneAndUpdate(
{ _id: userId },
{
$addToSet: { favorites: articleId },
},
);
} else if (!type) {
result = await User.findOneAndUpdate(
{ _id: userId },
{
$pull: { favorites: articleId },
},
);
}
if (result) {
return res.status(200).json({
success: true,
message: type
? 'Added this article as favorite'
: 'Removed this article from favorites',
});
} else {
res.status(500).json({
success: false,
message: type
? 'Could not add this article as favorite'
: 'Could not remove this article from favorites',
});
}
} catch (error) {
res.status(400).json({
success: false,
message: 'Bad request',
});
}
};
exports.getArticleComments = async function (req, res) {
const articleId = req.params.article_id;
try {
const article = await Article.findOne({ _id: articleId })
.populate({
path: 'posted_by',
model: 'User',
select: '_id firstname lastname email',
})
.populate([
{
path: 'comments',
model: 'Comment',
select: '_id content createdAt updatedAt',
populate: {
path: 'commented_by',
select: 'firstname lastname email',
},
},
])
.populate({
path: 'liked_by',
model: 'User',
select: 'firstname lastname email',
})
.exec();
if (article) {
res.status(200).json({
success: true,
article,
});
} else {
res.status(500).json({
success: false,
message: 'Could not get an article',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.createArticleComment = async function (req, res) {
const articleId = req.params.article_id;
const userId = req.user._id;
const { content } = req.body;
const newComment = {
content,
article: articleId,
commented_by: userId,
};
try {
const comment = await new Comment(newComment);
const commentResult = await comment.save();
const result = await Article.findOneAndUpdate(
{ _id: articleId },
{
$addToSet: { comments: commentResult._id },
},
);
const aaa = await Comment.findOne({ _id: comment._id })
.populate({
path: 'commented_by',
model: 'User',
select: '_id email firstname lastname',
})
.exec();
if (result) {
res.status(200).json({
success: true,
message: 'Comment added successfully',
comment: aaa,
});
} else {
res.status(500).json({
success: false,
message: 'Could not add comment',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.editArticleComment = async function (req, res) {
const commentId = req.params.comment_id;
const { content } = req.body;
try {
const result = await Comment.findOneAndUpdate(
{ _id: commentId },
{ content },
);
if (result) {
res.status(200).json({
success: true,
message: 'Comment updated successfully',
});
} else {
res.status(500).json({
success: false,
message: 'Could not update comment',
});
}
} catch (error) {
res.status(400).send({
success: false,
message: 'Bad request',
});
}
};
exports.deleteArticleComment = async function (req, res) {
const commentId = req.params.comment_id;
try {
const result = await Comment.deleteOne({ _id: commentId });
if (result) {
return res.status(200).json({
success: true,
message: 'Comment removed successfully',
});
} else {
res.status(500).json({
success: false,
message: 'Could not remove a comment',
});
}
} catch (error) {
res.status(400).json({
success: false,
message: 'Bad request',
});
}
};
| 22.317025 | 72 | 0.535865 |
feb73528ba3a9264fc3b8e9c4cb3b2c5db6975d2 | 390 | js | JavaScript | server/middleware/cors.js | e-korp/e-korp | b5375190f5a0a4a31e9d6612a3375a4a0f4304fc | [
"MIT"
] | 2 | 2016-04-12T13:14:57.000Z | 2016-04-14T20:07:39.000Z | server/middleware/cors.js | e-korp/e-korp | b5375190f5a0a4a31e9d6612a3375a4a0f4304fc | [
"MIT"
] | 24 | 2016-04-11T19:49:03.000Z | 2016-05-24T10:52:36.000Z | server/middleware/cors.js | e-korp/e-korp | b5375190f5a0a4a31e9d6612a3375a4a0f4304fc | [
"MIT"
] | null | null | null | /**
* Appends headers to allow cross
* @todo test this, do not allow from everywhere
*/
module.exports = (req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS');
res.header(
'Access-Control-Allow-Headers',
'X-Requested-With, Content-Type, X-Access-Token'
);
return next();
};
| 26 | 80 | 0.65641 |
feb884b7634771770ac0e8a2ab2c8c3dd5451f97 | 3,730 | js | JavaScript | public/js/index.js | etoyin/beerbank | 65da5f54f704116cae38371682213c49712476bf | [
"MIT"
] | null | null | null | public/js/index.js | etoyin/beerbank | 65da5f54f704116cae38371682213c49712476bf | [
"MIT"
] | null | null | null | public/js/index.js | etoyin/beerbank | 65da5f54f704116cae38371682213c49712476bf | [
"MIT"
] | null | null | null | var page = 1;
var working = false;
//I dont want to make several api calls
var data = [];
$(document).ready(function(){
$.ajax({
type: "GET",
url: "https://api.punkapi.com/v2/beers?page="+page,
processData: false,
contentType: "application/json",
data: '',
success: function (d) {
//var d = JSON.parse(d);
for (var i = 0; i < d.length; i++) {
$('.flex-container').append("<div class='nopad'><label class='image-checkbox'><span class='star glyphicon glyphicon-star-empty'></span><input type='checkbox' name='image_check[]' value="+ d[i].id +" /></label><img id='beer-img' alt='"+d[i].name+"' class='img-responsive' src='"+d[i].image_url+"'/><h5 style='color:#23ef38; font-size:1.4em;'>"+d[i].name+"</h5><h6 style='font-size:1.1em;'>"+d[i].tagline+"</h6></div>");
//$('.flex-container').append("<option data-img-src='"+ d[i].image_url +"' value='"+ d[i].id +"'>"+d[i].name+"</option>");
}
page += 1;
data = data.concat(d);
},
error: function (d) {
console.log("Something not right!")
}
});
$(".flex-container").on('click', '.star.glyphicon', function() {
$(this).toggleClass("glyphicon-star glyphicon-star-empty");
});
$('#search').on("keyup", function() {
var value = $(this).val().toLowerCase();
$(".flex-container .nopad, .flex-container-2 .nopad").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
//when I click on the image, it should bring a popup
$('.flex-container').on('click', 'img', function() {
var index = data.findIndex(x=> x.name == $(this).attr('alt'));
//alert('yeshhhhhh'+' '+index);
$('.overlay').addClass('active');
var headpopup = "<p style='color:#23ef38; font-size: 2.5vw'>"+data[index].name+"</p>";
var tagline = "<p style='font-size: 1.5vw'>"+data[index].tagline+"</p>";
var servedWith = "<ul style='font-size: 1.3vw;'><li>"+data[index].food_pairing[0]+"</li><li>"+data[index].food_pairing[1]+"</li><li>"+data[index].food_pairing[2]+"</li></ul>";
var description = "<p style='font-size: 1.3vw;'>"+data[index].description+"</p>";
var specs = "<p style='font-size: 1.3vw'><strong>IBU</strong>: "+data[index].ibu+" <strong>ABV</strong>: "+data[index].abv+" <strong>EBC</strong>: "+data[index].ebc+"</p>";
var drink_img = "<div class='col-xs-3'><img class='img-responsive' id='popup-img' src='"+data[index].image_url+"'/></div>";
var about_pop = "<div class='about_pop col-xs-9'>"+headpopup+tagline+specs+description+"<p style='color:#23ef38;'><strong>Best served with: </strong></p>"+servedWith+"</div>";
$('.selected-img').append(drink_img+about_pop);
var yeast = data[index].ingredients.yeast.split(" ").join("_");
$.ajax({
type: "GET",
url: "https://api.punkapi.com/v2/beers?yeast="+yeast,
processData: false,
contentType: "application/json",
data: '',
success: function(d) {
for (var i = 0; i < 3; i++) {
$('.alike-row').append('<div id="alike" class="text-center col-xs-3"><img id="beer-img" class="img-responsive" src="'+d[i].image_url+'"/><p style="font-size: 1.2em">'+d[i].name+'</p></div>');
//alert(alike[i].name);
}
},
error: function() {
console.log("There's an error!");
}
});
});
$('.close').on('click', function(){
$('.overlay').removeClass('active');
$('.selected-img, .alike-row').empty();
});
$('#favorite').click(function() {
$('form').submit();
});
$(document).ajaxStart(function(){
$(".waitLoader").css("display", "block");
});
$(document).ajaxComplete(function(){
$(".waitLoader").css("display", "none");
});
});
| 41.444444 | 426 | 0.573727 |
feb8eeff282fb265389eca0172ea1e26e0c11552 | 268 | js | JavaScript | pages/discovery/discovery.js | XMY-YAN/XIAOMIsc | 70ead6d204eaba4e295aa19bec3893e40716fbd6 | [
"MIT"
] | 5 | 2018-07-21T13:15:08.000Z | 2019-02-23T16:28:27.000Z | pages/discovery/discovery.js | XMY-YAN/XIAOMIsc | 70ead6d204eaba4e295aa19bec3893e40716fbd6 | [
"MIT"
] | 1 | 2019-03-07T10:11:44.000Z | 2019-03-07T10:11:44.000Z | pages/discovery/discovery.js | XMY-YAN/XIAOMIsc | 70ead6d204eaba4e295aa19bec3893e40716fbd6 | [
"MIT"
] | 1 | 2021-09-26T07:28:52.000Z | 2021-09-26T07:28:52.000Z | // pages/discovery/discovery.js
const app = getApp();
Page({
data: {
videos:[],
},
onLoad: function (options) {
// 生命周期函数--监听页面加载
const videos=app.globalData.discovery;
this.setData({
videos
});
}
}) | 17.866667 | 46 | 0.507463 |
feb93dced56c1d12643643089e09eaf5cea9c583 | 321 | js | JavaScript | pages/themes/advanced/MVC_Basics/examples/labs/MVC_TODO_vanillaJS/src/lib/api.js | WWWCourses/IT-Academy-Front-End-Dev | ffa81d849ecd3d2feae9f02e02255a448f674716 | [
"MIT"
] | null | null | null | pages/themes/advanced/MVC_Basics/examples/labs/MVC_TODO_vanillaJS/src/lib/api.js | WWWCourses/IT-Academy-Front-End-Dev | ffa81d849ecd3d2feae9f02e02255a448f674716 | [
"MIT"
] | 4 | 2022-02-16T12:39:18.000Z | 2022-02-28T10:24:10.000Z | pages/themes/advanced/MVC_Basics/examples/labs/MVC_TODO_vanillaJS/src/lib/api.js | WWWCourses/ProgressBG-Front-End-Dev | 623302c3dda2eb5a34ed5bd69a9625a3e0423817 | [
"MIT"
] | null | null | null | class API{
constructor(endpointURL){
this.endpointURL = endpointURL;
}
getTodos() {
console.log(` : ${this.endpointURL}`);
return fetch(this.endpointURL)
.then(res => res.json())
}
getTodo(id) {
return fetch(`${this.endpointURL}/${id}`)
.then(res => res.json());
}
}
export default API; | 18.882353 | 45 | 0.610592 |
feb9500a959fc1ed27d1a81e8833a1802385e043 | 164 | js | JavaScript | src/components/utilities/transitions/index.js | JonathanWFreeman/devPortfolio | 502137a88263ddb97cb4c125dd27b008745b3798 | [
"MIT"
] | null | null | null | src/components/utilities/transitions/index.js | JonathanWFreeman/devPortfolio | 502137a88263ddb97cb4c125dd27b008745b3798 | [
"MIT"
] | 1 | 2021-03-05T20:26:16.000Z | 2021-03-05T20:26:16.000Z | src/components/utilities/transitions/index.js | JonathanWFreeman/devPortfolio | 502137a88263ddb97cb4c125dd27b008745b3798 | [
"MIT"
] | null | null | null | import Transition from './transition';
export * from './fadeTransition';
export * from './swipeTransition';
export * from './transitions';
export { Transition };
| 20.5 | 38 | 0.707317 |
feb9e904afa2d51a04948014e4b0ed01cc8667ab | 136 | js | JavaScript | packages/card/index.js | minteliuwm/ndc-ui | eb5d5763f01892fd604450ab9b732a37911ecdba | [
"MIT"
] | 4 | 2019-05-30T02:02:48.000Z | 2020-09-14T14:00:14.000Z | packages/card/index.js | minteliuwm/ndc-ui | eb5d5763f01892fd604450ab9b732a37911ecdba | [
"MIT"
] | null | null | null | packages/card/index.js | minteliuwm/ndc-ui | eb5d5763f01892fd604450ab9b732a37911ecdba | [
"MIT"
] | 4 | 2019-11-21T07:54:01.000Z | 2020-09-14T14:00:33.000Z | import NdcCard from './src/card.vue';
NdcCard.install = (Vue) => {
Vue.component(NdcCard.name, NdcCard);
};
export default NdcCard;
| 17 | 39 | 0.691176 |
feb9f1f62625d29fdda6ec7accb8dfc45ff160d6 | 882 | js | JavaScript | src/API/index.js | terribedore/gwg-r2-fend-project7-neighborhood-map | 69a0c8f4765b93dbb3863369216b60b3c7132590 | [
"MIT"
] | null | null | null | src/API/index.js | terribedore/gwg-r2-fend-project7-neighborhood-map | 69a0c8f4765b93dbb3863369216b60b3c7132590 | [
"MIT"
] | null | null | null | src/API/index.js | terribedore/gwg-r2-fend-project7-neighborhood-map | 69a0c8f4765b93dbb3863369216b60b3c7132590 | [
"MIT"
] | null | null | null | import React, { Component } from 'react'
import ReactDOM from 'react-dom'
var foursquare = require('react-foursquare')({
clientID: 'G04GDHOHNV44SCN05HBQDM0TACJMTYVR13OWDX4NJ3N3JUWL',
clientSecret: 'KE10VXIQUO1L2FFLOKYWDHTZOKNU23RFRFNXEMYMX1E31QM4'
});
var params = {
"ll": "37.7749,-122.4194",
"query": 'Blue Bottle'
};
export default class FoursquareDemo extends Component {
constructor(props) {
super(props);
this.state = {
items: []
};
}
componentDidMount() {
foursquare.venues.getVenues(params)
.then(res=> {
this.setState({ items: res.response.venues });
});
}
render() {
return (
<div>
<div>Items:</div>
{ this.state.items.map(item=> { return <div key={item.id}>{item.name}</div>}) }
</div>
)
}
}
ReactDOM.render(
<FoursquareDemo />,
document.getElementById('root')
); | 20.511628 | 87 | 0.629252 |
feba78b65d5fef0cc63ff48c517a6766c7aa5ac0 | 953 | js | JavaScript | src/store/reducers/todo.js | wabbits-proj/goodMoney | 99735649d9f01dc1619f61e4fafc86e31ef4b58c | [
"MIT"
] | 2 | 2019-07-10T10:47:14.000Z | 2019-07-10T13:58:09.000Z | src/store/reducers/todo.js | wabbits-proj/goodMoney | 99735649d9f01dc1619f61e4fafc86e31ef4b58c | [
"MIT"
] | 3 | 2020-09-06T10:59:33.000Z | 2021-05-10T00:24:40.000Z | src/store/reducers/todo.js | wabbits-proj/goodMoney | 99735649d9f01dc1619f61e4fafc86e31ef4b58c | [
"MIT"
] | 1 | 2019-08-31T02:35:35.000Z | 2019-08-31T02:35:35.000Z | import React from 'react';
import {
GET_HISTORIC,
INFO_MONEY_DONE,
SET_OBJECTIVE,
SET_CREDIT,
SET_DEBITS_MONTH,
SET_DEBITS_NEXT_MONTH
} from '~/store/actionsTypes/todo';
const INITIAL_STATE = {
getHistoric: 0,
infoMoneyDone: false,
objective: '0',
credit: '0',
debitsMonth: '0',
debitsNextMonth: '0'
}
export default function todo(state = INITIAL_STATE, action){
switch(action.type){
case GET_HISTORIC:
return { ...state, getHistoric: action.payload };
case INFO_MONEY_DONE:
return { ...state, infoMoneyDone: action.payload };
case SET_OBJECTIVE:
return { ...state, objective: action.payload };
case SET_CREDIT:
return { ...state, credit: action.payload };
case SET_DEBITS_MONTH:
return { ...state, debitsMonth: action.payload };
case SET_DEBITS_NEXT_MONTH:
return { ...state, debitsNextMonth: action.payload };
default:
return state;
}
}
| 24.435897 | 61 | 0.665268 |
febc9ec07d55b331bdb5929ca1587ec12f890e6b | 137 | js | JavaScript | app/src/views/pages/category/route.js | meimaonong/mhjboss | d119d570d23a0aec06a19e33b54eceb6d4c73902 | [
"BSD-3-Clause"
] | null | null | null | app/src/views/pages/category/route.js | meimaonong/mhjboss | d119d570d23a0aec06a19e33b54eceb6d4c73902 | [
"BSD-3-Clause"
] | null | null | null | app/src/views/pages/category/route.js | meimaonong/mhjboss | d119d570d23a0aec06a19e33b54eceb6d4c73902 | [
"BSD-3-Clause"
] | null | null | null | import Category from './components/category/category.vue'
export default [
{
path: '/',
component: Category
}
]
| 15.222222 | 57 | 0.591241 |
febf7b9026635971bcb7979e79e4d9f46e30bb29 | 5,464 | js | JavaScript | build/index.js | demimonde/photo-uploader | a3813d88bb3bc6c50290779ab71f7f1eb85e44ce | [
"MIT"
] | 1 | 2019-03-19T16:14:55.000Z | 2019-03-19T16:14:55.000Z | build/index.js | demimonde/photo-uploader | a3813d88bb3bc6c50290779ab71f7f1eb85e44ce | [
"MIT"
] | null | null | null | build/index.js | demimonde/photo-uploader | a3813d88bb3bc6c50290779ab71f7f1eb85e44ce | [
"MIT"
] | null | null | null | import { h } from 'preact'
import { Component } from 'preact'
import { RU_LOCALE, EN_LOCALE } from './locale'
import Photo from './Photo'
import './closure/stylesheet.css'
const loc = {
'RU_LOCALE': RU_LOCALE,
'EN_LOCALE': EN_LOCALE,
}
/**
* The Photo Uploader is the image upload component which has drag and drop functionality to allow adding of files. It renders the list of currently added photos either via dynamic UI interaction or via the input element, and puts photo elements on the page.
*/
export default class PhotoUploader extends Component {
constructor() {
super()
this.state = { files: [] }
/** @type {!_photoUploader.Props} */
this.props = this.props
}
removeFile(file) {
const files = this.state.files.filter(({ file: f }) => f !== file)
this.setState({ files })
if (this.props.onRemove) this.props.onRemove(file)
}
async addFiles(f) {
const [...ff] = f
const files = ff.map(file => ({ file,
pid: Math.floor(Math.random() * 10000) }))
this.setState({
files: [...this.state.files, ...files],
})
if (this.props.onAdded) this.props.onAdded()
}
getChildContext() {
return {
LOCALE: this.LOCALE,
}
}
get LOCALE() {
let { locale = 'en', LOCALE } = this.props
if (!LOCALE) LOCALE = loc[locale.toUpperCase() + `_LOCALE`]
return LOCALE
}
/**
* @param {!_photoUploader.Props} [opts] The photo uploader will create preview elements for each photo and have a hidden input field populated with the `photoId` received when the photo was updated.
* @param {string} [opts.fieldName] The name of the hidden `input` fields. Default `files[]`.
* This is for the second part of the submission, and is different from the image upload field, which is just `image`.
* @param {string} [opts.uploadedResults] The list of photos which were saved and don't need uploading.
* @param {string} opts.uploadUri The URL where to upload files.
* @param {_photoUploader.Locale} [opts.LOCALE] An hash map with locale values.
* @param {string} [opts.locale="en"] A language for existing locales (either `en` or `ru`). Default `en`.
* @param {function(!Object): void} [opts.onRemove] The function to call when a photo was removed.
* @param {function(): void} [opts.onAdded] The function to call when a photo was added.
* @param {function(!Object): void} [opts.onPhotoUploaded] The callback to call when a photo was uploaded with the `result` property of the server response.
*/
render({ fieldName = 'files[]', onPhotoUploaded, uploadedResults, uploadUri }) {
const LOCALE = this.LOCALE
if (!LOCALE) return (h('div',{},`Photo Uploader Error: Unknown Locale`))
const { hid, id } = this.context
let counter = 0
return (h('div',{ 'onDragEnter':(event) => {
event.preventDefault()
counter++
event.currentTarget.style.background = '#E91E63'
}, 'onDragLeave':(event) => {
counter--
if (counter == 0)
event.currentTarget.style.background = ''
}, 'onDrop':(event) => {
event.preventDefault()
event.stopPropagation()
event.currentTarget.style.background = ''
const { dataTransfer: { files } } = event
this.addFiles(files)
}, 'onDragOver':(event) => {
event.preventDefault()
event.stopPropagation()
},'className':'PhotoUploader'},
h('input',{'id':id,'aria-described-by':hid,'onChange':(e) => {
e.preventDefault()
this.addFiles(e.currentTarget.files)
e.currentTarget.value = null
},'accept':"image/*",'type':"file",'multiple':true}),
this.state.addingFiles ? LOCALE.recognition : LOCALE.drop ,
h('br'),
this.state.files.map(({ file, pid }) => {
return (h(Photo,{uploadUri:uploadUri,key:pid,name:file.name,file:file,onRemove:() => {
this.removeFile(file)
},fieldName:fieldName,onUploaded:onPhotoUploaded,uploadedResults:uploadedResults}))
}),
))
}
}
/* documentary types/index.xml */
/**
* @suppress {nonStandardJsDocs}
* @typedef {_photoUploader.Props} Props The photo uploader will create preview elements for each photo and have a hidden input field populated with the `photoId` received when the photo was updated.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {Object} _photoUploader.Props The photo uploader will create preview elements for each photo and have a hidden input field populated with the `photoId` received when the photo was updated.
* @prop {string} [fieldName] The name of the hidden `input` fields. Default `files[]`.
* This is for the second part of the submission, and is different from the image upload field, which is just `image`.
* @prop {string} [uploadedResults] The list of photos which were saved and don't need uploading.
* @prop {string} uploadUri The URL where to upload files.
* @prop {_photoUploader.Locale} [LOCALE] An hash map with locale values.
* @prop {string} [locale="en"] A language for existing locales (either `en` or `ru`). Default `en`.
* @prop {function(!Object): void} [onRemove] The function to call when a photo was removed.
* @prop {function(): void} [onAdded] The function to call when a photo was added.
* @prop {function(!Object): void} [onPhotoUploaded] The callback to call when a photo was uploaded with the `result` property of the server response.
*/
/**
* @suppress {nonStandardJsDocs}
* @typedef {import('./locale').Locale} _photoUploader.Locale
*/ | 45.533333 | 258 | 0.673316 |
febfd01c9c92b7372b22b523ec5c193cb34624e4 | 336 | js | JavaScript | tasks/default.js | hoopoemedia/magento2-frontools-rtl | 971989b851d4a11ad3f381a5397c826a228f23ef | [
"MIT"
] | 491 | 2016-01-27T23:02:57.000Z | 2022-03-29T07:30:45.000Z | tasks/default.js | hoopoemedia/magento2-frontools-rtl | 971989b851d4a11ad3f381a5397c826a228f23ef | [
"MIT"
] | 251 | 2016-02-02T23:50:08.000Z | 2022-03-07T11:31:19.000Z | tasks/default.js | hoopoemedia/magento2-frontools-rtl | 971989b851d4a11ad3f381a5397c826a228f23ef | [
"MIT"
] | 187 | 2016-01-28T08:41:46.000Z | 2022-01-11T21:27:25.000Z | import fs from 'fs-extra'
import marked from 'marked'
import markedTerminal from 'marked-terminal'
import log from 'fancy-log'
export default function(callback) {
// Display formatted readme.md
marked.setOptions({
renderer: new markedTerminal()
})
log.info(marked(fs.readFileSync('./README.md', 'UTF-8')))
callback()
}
| 21 | 59 | 0.717262 |
febfebec7d9a582b309c2fdbaeee4405fc415058 | 2,719 | js | JavaScript | docs/html/search/functions_a.js | sophie-bernier/RemoteOceanAcidificationMonitor | 6a8b799826a2eb9b1d5064883193c61eea0ee310 | [
"Unlicense"
] | 1 | 2021-06-22T23:07:31.000Z | 2021-06-22T23:07:31.000Z | docs/html/search/functions_a.js | sophie-bernier/RemoteOceanAcidificationMonitor | 6a8b799826a2eb9b1d5064883193c61eea0ee310 | [
"Unlicense"
] | null | null | null | docs/html/search/functions_a.js | sophie-bernier/RemoteOceanAcidificationMonitor | 6a8b799826a2eb9b1d5064883193c61eea0ee310 | [
"Unlicense"
] | null | null | null | var searchData=
[
['readbuttons_444',['readButtons',['../_lo_ra_interface_forwarding_test___base_8ino.html#adf3d0f6e1a9dd64fb3ec03ec0e662bfe',1,'readButtons(): LoRaInterfaceForwardingTest_Base.ino'],['../_lo_ra_range_test___base_8ino.html#adf3d0f6e1a9dd64fb3ec03ec0e662bfe',1,'readButtons(): LoRaRangeTest_Base.ino']]],
['readdata_445',['readData',['../class_pro_c_v.html#a0ab9e7ec222665c704335707bc2d58fc',1,'ProCV']]],
['reset_446',['reset',['../classmoving_average.html#aaa78918982c5aac37dcd236df4c57aaf',1,'movingAverage::reset()'],['../classsimple_timer.html#ab4eb941d216b504cf88b489937666545',1,'simpleTimer::reset()']]],
['rf95_447',['rf95',['../_feather9x___r_x_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): Feather9x_RX.ino'],['../_feather9x___t_x_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): Feather9x_TX.ino'],['../_lo_ra_range_test__v1___base_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): LoRaRangeTest_v1_Base.ino'],['../_lo_ra_range_test__v1___endpoint_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): LoRaRangeTest_v1_Endpoint.ino'],['../serial_echo_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): serialEcho.ino'],['../simple_sensor_comms_echo_radio___base_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): simpleSensorCommsEchoRadio_Base.ino'],['../simple_sensor_comms_echo_radio___endpoint_8ino.html#ac63b1a56c422792163e7c9ee194c4bdc',1,'rf95(RFM95_CS, RFM95_INT): simpleSensorCommsEchoRadio_Endpoint.ino']]],
['rhreliabledatagram_448',['rhReliableDatagram',['../_lo_ra_range_test__v1___base_8ino.html#a46864e594950c17885931f94f12d6391',1,'rhReliableDatagram(rf95, RH_RELIABLE_DATAGRAM_ADDR): LoRaRangeTest_v1_Base.ino'],['../_lo_ra_range_test__v1___endpoint_8ino.html#a46864e594950c17885931f94f12d6391',1,'rhReliableDatagram(rf95, RH_RELIABLE_DATAGRAM_ADDR): LoRaRangeTest_v1_Endpoint.ino']]],
['rxind_449',['rxInd',['../_lo_ra_interface_forwarding_test___base_8ino.html#aeedbdbac7fe1886ecc62d5f221c7a0ab',1,'rxInd(message_t const &rxMsg): LoRaInterfaceForwardingTest_Base.ino'],['../_lo_ra_interface_forwarding_test___endpoint_8ino.html#aeedbdbac7fe1886ecc62d5f221c7a0ab',1,'rxInd(message_t const &rxMsg): LoRaInterfaceForwardingTest_Endpoint.ino'],['../_lo_ra_range_test___base_8ino.html#aeedbdbac7fe1886ecc62d5f221c7a0ab',1,'rxInd(message_t const &rxMsg): LoRaRangeTest_Base.ino'],['../_lo_ra_range_test___endpoint_8ino.html#aeedbdbac7fe1886ecc62d5f221c7a0ab',1,'rxInd(message_t const &rxMsg): LoRaRangeTest_Endpoint.ino']]]
];
| 271.9 | 1,002 | 0.821993 |
fec03fadb96c4a009d267537d0e5a4ec2900c6a8 | 1,734 | js | JavaScript | test/ipoker.tourney.fpdb.NLHE-2max-USD-SNG-2000-201210.js | thlorenz/hhp-xml | 76b73612f260b63267941a1e45360e75c0024276 | [
"MIT"
] | null | null | null | test/ipoker.tourney.fpdb.NLHE-2max-USD-SNG-2000-201210.js | thlorenz/hhp-xml | 76b73612f260b63267941a1e45360e75c0024276 | [
"MIT"
] | null | null | null | test/ipoker.tourney.fpdb.NLHE-2max-USD-SNG-2000-201210.js | thlorenz/hhp-xml | 76b73612f260b63267941a1e45360e75c0024276 | [
"MIT"
] | null | null | null | 'use strict'
const file = require('./util/guess-fixture-name')(__filename)
const test = require('tape')
const processFile = require('./util/process-ipoker')
// eslint-disable-next-line no-unused-vars
const ocat = require('ocat').applyRes5Opts()
const spok = require('spok')
test(`ipoker: ${file}`, function(t) {
const res = processFile(file, true)
spok(t, res,
{ seats:
[ { seatno: 3, player: 'Player0', chips: 1500 }
, { seatno: 8, player: 'Hero', chips: 1500 } ]
, info:
{ room: 'ipoker'
, timezone: null
, pokertype: 'holdem'
, limit: 'nolimit'
, currency: '$'
, donation: 2000
, rake: 50
, buyin: 2050
, sb: 10
, bb: 20
, ante: 0
, year: 2012
, month: 10
, day: 21
, hour: 8
, min: 10
, sec: 9
, hero: 'Hero'
, handid: '4335364086'
, gameno: '4335364086'
, gametype: 'tournament' }
, table:
{ tablename: '"TURBO" NLH Heads Up $2,000'
, tableno: 770109371
, maxseats: 2
, button: 3 }
, board: {}
, posts:
[ { player: 'Player0', type: 'sb', amount: 10 }
, { player: 'Hero', type: 'bb', amount: 20 } ]
, preflop:
[ { player: 'Player0', type: 'raise', amount: 40, raiseTo: 40 }
, { player: 'Hero', type: 'raise', amount: 80, raiseTo: 120 }
, { player: 'Player0', type: 'fold' } ]
, flop: []
, turn: []
, river: []
, showdown:
[ { player: 'Hero', type: 'collect', amount: 160 }
, { player: 'Hero', type: 'show', card1: '4c', card2: '4s' } ]
, summary: [ { type: 'pot', single: true, amount: 160 } ]
, hero: 'Hero'
, holecards: { card1: '4c', card2: '4s' } })
t.end()
})
| 27.52381 | 69 | 0.514994 |
fec09e3acfd80b56ff94196f9e63065406fbf493 | 343 | js | JavaScript | app/vendor/@fortawesome/fontawesome-pro-solid/faCommentAltMinus.js | goldylucks/zenwallet | eb58e3960db112b38e32204af80e0551baa51909 | [
"MIT"
] | 25 | 2018-06-27T07:40:00.000Z | 2021-12-27T13:37:02.000Z | app/vendor/@fortawesome/fontawesome-pro-solid/faCommentAltMinus.js | zenprotocol/zenwallet | 158c7b74d2514253fa9cef4710d6e98e7751fb19 | [
"MIT"
] | 36 | 2018-06-07T09:21:40.000Z | 2021-05-08T19:13:21.000Z | webroot/fontawesome/advanced-options/use-with-node-js/fontawesome-pro-solid/faCommentAltMinus.js | sdevore/cakephp-scid-plugin | 75b393903f49972455ee01adacedd32be62c9923 | [
"MIT"
] | 13 | 2018-06-18T10:13:39.000Z | 2019-05-22T16:01:07.000Z | module.exports = { prefix: 'fas', iconName: 'comment-alt-minus', icon: [512, 512, [], "f4a7", "M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 9.8 11.2 15.5 19.1 9.7L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm-80 216c0 8.8-7.2 16-16 16H160c-8.8 0-16-7.2-16-16v-16c0-8.8 7.2-16 16-16h192c8.8 0 16 7.2 16 16v16z"] }; | 343 | 343 | 0.670554 |
fec1dbd5e0c22b0618bf79c46a5b77de3a0675d0 | 49 | js | JavaScript | scripts/portal/enter_agit.js | illuminatixs-newbms/Lidium | a4fb572a2fda7c388cb2190122efb8b54218d0d7 | [
"Apache-2.0"
] | 74 | 2016-12-21T07:49:49.000Z | 2022-03-30T04:52:58.000Z | scripts/portal/enter_agit.js | illuminatixs-newbms/Lidium | a4fb572a2fda7c388cb2190122efb8b54218d0d7 | [
"Apache-2.0"
] | 24 | 2016-12-25T15:33:36.000Z | 2021-01-16T11:21:37.000Z | scripts/portal/enter_agit.js | illuminatixs-newbms/Lidium | a4fb572a2fda7c388cb2190122efb8b54218d0d7 | [
"Apache-2.0"
] | 56 | 2016-12-19T10:50:43.000Z | 2022-01-23T10:11:49.000Z | function enter(pi) {
pi.warp(200100010, 0);
} | 16.333333 | 26 | 0.632653 |
fec1e960aafa2f260e32c276725c78f7b0cfa64f | 8,874 | js | JavaScript | lib/core/config.js | kalabox/kalabox | 21caa17ebf062da84eb7b473830f35678cd7c727 | [
"MIT"
] | 296 | 2015-01-21T20:52:39.000Z | 2020-06-18T21:57:06.000Z | lib/core/config.js | kalabox/kalabox | 21caa17ebf062da84eb7b473830f35678cd7c727 | [
"MIT"
] | 1,461 | 2015-01-02T21:49:28.000Z | 2020-07-15T19:47:02.000Z | lib/core/config.js | kalabox/kalabox | 21caa17ebf062da84eb7b473830f35678cd7c727 | [
"MIT"
] | 75 | 2015-03-04T14:45:23.000Z | 2020-08-17T18:37:32.000Z | /**
* Module for global and app configs.
*
* @name config
*/
'use strict';
require('./deps.js');
var yaml = require('./../util/yaml.js');
var path = require('path');
var os = require('os');
var fs = require('fs');
var env = require('./env.js');
var log = require('./log.js');
var _ = require('lodash');
// Constants
var CONFIG_FILENAME = exports.CONFIG_FILENAME = 'kalabox.yml';
var APP_CONFIG_FILENAME = exports.APP_CONFIG_FILENAME = 'kalabox.yml';
// Default global
var DEFAULT_GLOBAL_CONFIG = {
domain: (process.platform === 'linux') ? 'kbox.host' : 'kbox.site',
engineRepo: 'kalabox',
stats: {
report: true,
url: 'http://stats-v2.kalabox.io'
},
cache: true,
logLevel: 'debug',
logLevelConsole: 'info',
logRoot: ':userConfRoot:/logs',
downloadsRoot: ':userConfRoot:/downloads',
appsRoot: ':home:/Kalabox',
appRegistry: ':userConfRoot:/appRegistry.json',
sysPluginRoot: ':sysConfRoot:',
userPluginRoot: ':userConfRoot:',
configSources: [
'DEFAULT_GLOBAL_CONFIG'
],
};
// Debug info logging function.
var log = require('./log.js').make('CORE CONFIG');
/*
* Looks up a key of the config object and returns it.
*/
var lookupKey = function(config, keyToFind) {
// Recursive function.
var rec = function(o, prefix) {
// Loop through each of the objects properties to find value.
return _.find(o, function(val, key) {
// Build namespaced name.
var name = _.filter([prefix, key]).join('.');
if (typeof val === 'string') {
// If name of string value matches, return it.
return (':' + name + ':') === keyToFind;
} else if (typeof val === 'object') {
// Recursively check object.
return rec(val, name);
} else {
// Not a string or an object so just return false.
return false;
}
});
};
// Init recursive function and return.
return rec(config);
};
/**
* Translate a value.
* @memberof config
*/
var normalizeValue = exports.normalizeValue = function(config, v) {
// Search value for regex matches.
//var params = v.match(/:[a-zA-Z0-9-_]*:/g);
var params;
try {
params = v.match(/:[a-zA-Z0-9-_]*:/g);
}
catch (err) {
throw new Error(typeof v);
}
if (!params) {
// No params were found, so just return original value.
return v;
} else {
// Reduce list of params to final value.
return _.reduce(params, function(acc, param) {
// Get replacement value from config object based on param name.
var replacementValue = lookupKey(config, param);
if (!replacementValue) {
// Replacement value was not found so just return value.
return acc;
} else {
// Replace and return.
return acc.replace(param, replacementValue);
}
}, v);
}
};
/**
* Walk the properties of the top level object, replacing strings
* with other properties values.
* @memberof config
*/
var normalize = exports.normalize = function(config) {
// Recursive funciton.
var rec = function(o) {
// Loop through each property of the object.
_.each(o, function(val, key) {
if (typeof val === 'string') {
// For string values normalize.
o[key] = normalizeValue(config, val);
} else if (typeof val === 'object') {
// For object values recursively normalize.
rec(val);
}
});
};
// Init recursive function with config.
rec(config);
// Return config.
return config;
};
function sort(config) {
var keys = Object.keys(config).sort();
var retVal = {};
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
retVal[key] = config[key];
}
return retVal;
}
// @todo: implement
var KEYS_TO_CONCAT = [
'configSources'
];
function mixIn(a, b) {
for (var key in b) {
var shouldConcat = _.contains(KEYS_TO_CONCAT, key);
if (shouldConcat) {
// Concat.
if (_.isArray(a[key]) && _.isArray(b[key])) {
a[key] = _.uniq(a[key].concat(b[key]));
a[key].sort();
} else {
a[key] = b[key];
}
} else {
// Override.
a[key] = b[key];
}
}
return sort(normalize(a));
}
exports.mixIn = mixIn;
var getPackageJson = function() {
return require(path.join(env.getSourceRoot(), 'package.json'));
};
/**
* Gets the kalabox environment config.
* @returns {Object} config - The kalabox enviroment config.
* @example
* var envConfig = kbox.core.config.getEnvConfig();
* // Print home directory to stdout.
* console.log(envConfig.home);
*/
exports.getEnvConfig = function() {
// Grab version things\
var packageJson = getPackageJson();
var nodeVersion = packageJson.version;
var devMode = nodeVersion.split('-').length > 2;
var imgVersion = (devMode) ? 'v' + nodeVersion : 'latest';
// Check whether we are in a jx core binary or not
var isBinary = (process.isPackaged || process.IsEmbedded) ? true : false;
// Check whether we are in NW or not
var isNw = _.has(process.versions, 'node-webkit');
return {
isBinary: isBinary || isNw,
isNW: isNw,
devMode: devMode,
home: env.getHomeDir(),
os: {
type: os.type(),
platform: os.platform(),
release: os.release(),
arch: os.arch()
},
sysConfRoot: env.getSysConfRoot(),
userConfRoot: env.getUserConfRoot(),
engineId: env.getEngineUserId(),
engineGid: env.getEngineUserGid(),
srcRoot: env.getSourceRoot(),
version: nodeVersion,
imgVersion: imgVersion,
configSources: [
'ENV_CONFIG'
]
};
};
/**
* Gets the default config. The default config is a combination of the
* environment config and a set of default config values.
*
* @returns {Object} config - The kalabox default config.
* @example
* var defaultConfig = kbox.core.config.getDefaultConfig();
* // Print global plugins
* defaultConfig.globalPlugins.forEach(function(plugin) {
* console.log(plugin) ;
* });
*/
exports.getDefaultConfig = function() {
return mixIn(this.getEnvConfig(), DEFAULT_GLOBAL_CONFIG);
};
/**
* Document this
* @memberof config
*/
var getReleaseConfigFilepath = exports.getReleaseConfigFilepath = function() {
return path.join(env.getSourceRoot(), CONFIG_FILENAME);
};
var getSysConfigFilepath = function() {
return path.join(env.getSysConfRoot(), CONFIG_FILENAME);
};
var getUserConfigFilepath = function() {
return path.join(env.getUserConfRoot(), CONFIG_FILENAME);
};
var loadConfigFile = function(configFilepath) {
var loadedConfigFile = yaml.toJson(configFilepath);
loadedConfigFile.configSources = [configFilepath];
return loadedConfigFile;
};
/**
* Gets the global config. The global config is a combination of the
* environment config, the default config, and any values overriden
* in the $HOME/.kalabox/kalabox.json config file.
* @returns {Object} config - The kalabox global config.
* @example
* var globalConfig = kbox.core.config.getGlobalConfig();
* // Print the entire global config.
* console.log(JSON.stringify(globalConfig, null, '\t'));
*/
exports.getGlobalConfig = function() {
var defaultConfig = this.getDefaultConfig();
var filesToLoad = [
getReleaseConfigFilepath(),
getSysConfigFilepath(),
getUserConfigFilepath()
];
var globalConfig = _.reduce(filesToLoad, function(config, fileToLoad) {
if (fs.existsSync(fileToLoad)) {
var loadedConfigFile = loadConfigFile(fileToLoad);
config = mixIn(config, loadedConfigFile);
}
return config;
}, defaultConfig);
return globalConfig;
};
var getAppConfigFilepath = function(dir) {
return path.join(dir, APP_CONFIG_FILENAME);
};
/**
* Gets the app config for an app. The app config is a combination of the
* environment config, the default config, any values overriden in the
* $HOME/.kalabox/kalabox.yml config file, and the kalabox.yml config
* file in the app's root directory.
* @arg {string} app - The name of the app you'd like to get the config for.
* @arg {string} appRoot [optional] - Directory to load the
* app's config file from.
* @returns {Object} config - The app's kalabox app config.
* @example
* var appConfig = kbox.core.config.getAppConfig('myapp');
* // Print the entire app config.
* console.log(JSON.stringify(appConfig, null, '\t'));
*/
exports.getAppConfig = function(dir) {
// Grab the global config
var globalConfig = this.getGlobalConfig();
// Grab some stuff we need
var appConfigFile = loadConfigFile(getAppConfigFilepath(dir));
// Helper to mix in new config vals
var appConfigOverride = function(key, val) {
if (!appConfigFile[key]) {
appConfigFile[key] = val;
}
};
// Add some stuff to our config
appConfigOverride('appRoot', dir);
// Return the config
log.debug('App config loaded.', mixIn(globalConfig, appConfigFile));
return mixIn(globalConfig, appConfigFile);
};
| 24.581717 | 78 | 0.650101 |
fec23f18289e9ce5ac4cea0d84a477d55b183671 | 2,222 | js | JavaScript | lambdas/flux/handlers/auth.js | voteflux/api-v2 | 859138b1b880e442d7a651b663494d393cd75bff | [
"MIT"
] | 1 | 2020-05-01T16:21:13.000Z | 2020-05-01T16:21:13.000Z | lambdas/flux/handlers/auth.js | voteflux/api-v2 | 859138b1b880e442d7a651b663494d393cd75bff | [
"MIT"
] | 2 | 2018-05-28T09:54:59.000Z | 2018-05-28T09:59:39.000Z | lambdas/flux/handlers/auth.js | voteflux/api-v2 | 859138b1b880e442d7a651b663494d393cd75bff | [
"MIT"
] | 1 | 2018-04-18T09:49:55.000Z | 2018-04-18T09:49:55.000Z | const R = require('ramda');
const fail = msg => ({statusCode: 403, body: msg})
const checkAuthOfRole = db => (role, f) => async (event, context) => {
const data = event.body
if (data['s']) {
//pass
} else {
if (!data.authToken) {
return fail('no auth')
} else {
// implement authToken later
return fail('authToken not yet implemented')
}
}
if (R.is(String, data.s) && data.s === data.s.toString()) {
if (data.s.length < 20 || data.s.length > 50) {
return fail('bad auth')
}
} else {
return fail('bad s param')
}
const user = await db.getUserFromS(data.s)
if (user && user.s !== data.s) {
return fail('auth failed')
}
if (role !== 'user') { // special role
// check we have the role
roles = await db.getUserRoles(user._id)
if (roles.includes(role)){
// then we are okay
} else {
return fail('insufficient permissions')
}
}
return await f(event, context, {user})
}
const auth = (db) => ({
user: (f) => checkAuthOfRole(db)('user', f),
role: checkAuthOfRole(db)
// async (event, context) => {
// const data = event.body
// if (data['s']) {
// //pass
// } else {
// if (!data.authToken) {
// return fail('no auth')
// } else {
// // implement authToken later
// return fail('authToken not yet implemented')
// }
// }
// if (R.is(String, data.s) && data.s === data.s.toString()) {
// if (data.s.length < 20 || data.s.length > 50) {
// return fail('bad auth')
// }
// } else {
// return fail('bad s param')
// }
// const user = await db.getUserFromS(data.s)
// if (user && user.s === data.s) {
// return await f(event, context, {user});
// }
// // default if above fails
// return fail('auth failed')
// },
})
module.exports = auth;
| 27.097561 | 71 | 0.448695 |
fec257acb72d68c297f276e491954c10aff94c95 | 516 | js | JavaScript | src/actions/actionCreators.js | msrabbani/jagaraga | 4fbb8ae28ba90d2406b5e747169c95ab6b30b70b | [
"MIT"
] | 1 | 2019-03-28T01:02:04.000Z | 2019-03-28T01:02:04.000Z | src/actions/actionCreators.js | msrabbani/jagaraga | 4fbb8ae28ba90d2406b5e747169c95ab6b30b70b | [
"MIT"
] | null | null | null | src/actions/actionCreators.js | msrabbani/jagaraga | 4fbb8ae28ba90d2406b5e747169c95ab6b30b70b | [
"MIT"
] | null | null | null | import { createAsyncCreator } from '../services/asyncCreators';
import * as api from '../services/api';
import * as types from './types';
export const fetchCurrentWorkout = () => (
createAsyncCreator(
types.FETCH_CURRENT_WORKOUT,
types.FETCH_CURRENT_WORKOUT_COMPLETE,
() => api.get('current_workout')
)
);
export const addExerciseToCurrentWorkout = (exercise) => (
createAsyncCreator(
types.ADD_EXERCISE,
types.ADD_EXERCISE_COMPLETE,
() => api.post('current_workout', exercise)
)
)
| 25.8 | 63 | 0.705426 |
fec2a3ab2ff3f6dcb83940037a871dd2bc4443a3 | 388 | js | JavaScript | expnses-tracker/src/components/icons/Edit.js | Thiernope/Income-Expenses-Tracker | 6e5f30ad804985adef5804079155c721795dff0e | [
"MIT"
] | null | null | null | expnses-tracker/src/components/icons/Edit.js | Thiernope/Income-Expenses-Tracker | 6e5f30ad804985adef5804079155c721795dff0e | [
"MIT"
] | null | null | null | expnses-tracker/src/components/icons/Edit.js | Thiernope/Income-Expenses-Tracker | 6e5f30ad804985adef5804079155c721795dff0e | [
"MIT"
] | null | null | null | import React from 'react'
const Edit = () => {
return (
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
</svg>
)
}
export default Edit | 35.272727 | 156 | 0.664948 |
fec3be908844a9e146587b65806eb308dafdfb9a | 3,674 | js | JavaScript | research/2019-assets/add-to-calendar/add-to-calendar-20200203.js | duboisp/wet-boew-documentation | 79ac49f151da0a25ce04c36049d4231e8ccffc34 | [
"MIT"
] | 4 | 2017-12-31T23:42:16.000Z | 2021-04-01T04:21:36.000Z | research/2019-assets/add-to-calendar/add-to-calendar-20200203.js | duboisp/wet-boew-documentation | 79ac49f151da0a25ce04c36049d4231e8ccffc34 | [
"MIT"
] | 19 | 2017-01-23T17:37:13.000Z | 2020-11-06T03:07:23.000Z | research/2019-assets/add-to-calendar/add-to-calendar-20200203.js | duboisp/wet-boew-documentation | 79ac49f151da0a25ce04c36049d4231e8ccffc34 | [
"MIT"
] | 25 | 2016-07-18T14:51:21.000Z | 2020-10-15T03:36:32.000Z | var elm = document.querySelector(".wb-addcal"),
properties = elm.querySelectorAll("[property]"),
i,
i_len = properties.length,
googleLink = "",
icsLink = "",
eventData = {},
place;
$(document).ready(function(){
//Read and prepare event data to avoid empty properties
for(i=0; i < i_len; i++){
switch(properties[i].getAttribute("property")){
case "location":
googleLink += "&location=";
icsLink += "\nLOCATION:";
place = true;
break;
case "name":
if($(properties[i]).parentsUntil((".wb-addcal"), "[typeof=Place]").length){
eventData.place = properties[i].innerHTML;
googleLink += eventData.place;
icsLink += eventData.place;
}else{
eventData.title = properties[i].innerHTML;
googleLink += "&text=" + eventData.title;
icsLink += "\nSUMMARY:" + eventData.title;
}
break;
case "description":
eventData.description = properties[i].innerText;
googleLink += "&details=" + eventData.description;
icsLink += "\nDESCRIPTION:" + eventData.description;
break;
case "startDate":
eventData.startDate = properties[i].getAttribute("content");
googleLink += "&dates=" + eventData.startDate;
icsLink += "\nDTSTART:" + eventData.startDate;
break;
case "endDate":
eventData.endDate = properties[i].getAttribute("content");
googleLink += "/" + eventData.endDate;
icsLink += "\nDTEND:" + eventData.endDate;
break;
case "streetAddress":
eventData.streetAddress = properties[i].innerText;
googleLink += " " + eventData.streetAddress;
icsLink += " " + eventData.streetAddress;
break;
case "addressLocality":
eventData.addressLocality = properties[i].innerText;
googleLink += " " + eventData.addressLocality;
icsLink += " " + eventData.addressLocality;
break;
case "addressRegion":
eventData.addressRegion = properties[i].innerText;
googleLink += " " + eventData.addressRegion;
icsLink += " " + eventData.addressRegion;
break;
case "postalCode":
eventData.postalCode = properties[i].innerText;
googleLink += " " + eventData.postalCode;
icsLink += " " + eventData.postalCode;
break;
}
}
if(!place){
place = elm.querySelector(".wb-addcal-location").innerText;
googleLink += "&location=" + place;
icsLink += "\nLOCATION:" + place;
}
googleLink = encodeURI("https://www.google.com/calendar/render?action=TEMPLATE" + googleLink);
icsLink = "BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT" + icsLink + "\nEND:VEVENT\nEND:VCALENDAR";
//Create add details summary to the wb-addcal event and initiate the unordered list
$('.wb-addcal').append("<details class='max-content wb-addcal-buttons'><summary>Add to calendar</summary><ul class='list-unstyled mrgn-bttm-0 mrgn-tp-sm'><li><a class='btn btn-link btn-lg mrgn-top-lg' href='" + googleLink + "'><span class='fab fa-google mrgn-rght-md'></span>Google<span class='sr-only'>Calendar</span></a></li><li><button class='btn btn-link btn-lg' data-wb-addcal-ics='" + icsLink + "'><span class='fab fa-apple mrgn-rght-md'></span>Apple<span class='sr-only'>Calendar</span></button></li><li><button class='btn btn-link btn-lg' data-wb-addcal-ics='" + icsLink + "'><span class='fa fa-calendar mrgn-rght-md'></span>Other<span class='sr-only'>Calendar</span></button></li>");
//Set click action on Apple and Other button links
var linkItem = elm.querySelectorAll(".wb-addcal-buttons button");
i_len = linkItem.length;
for(i=0; i < i_len; i++){
linkItem[i].onclick = function(){
wb.download( new Blob( [this.getAttribute("data-wb-addcal-ics")] , { type: "text/calendar;charset=utf-8" } ), "evenement-gc-event.ics" );
}
}
}); | 40.822222 | 693 | 0.666304 |
fec4e094ea674c06fec807dabd3ec128ce7b84d2 | 2,173 | js | JavaScript | test/parse_test_output.js | w33ble/gravy-tap | 272780cfa598a7139e76b7b21cb5217b7fa7ce9c | [
"MIT"
] | 1 | 2018-04-18T20:50:02.000Z | 2018-04-18T20:50:02.000Z | test/parse_test_output.js | w33ble/gravy-tap | 272780cfa598a7139e76b7b21cb5217b7fa7ce9c | [
"MIT"
] | 1 | 2019-01-17T17:17:37.000Z | 2019-01-17T17:17:37.000Z | test/parse_test_output.js | w33ble/gravy-tap | 272780cfa598a7139e76b7b21cb5217b7fa7ce9c | [
"MIT"
] | null | null | null | /* eslint no-console: 0 */
/*
This set of tests runs a real test bundle and checks that the tests
pass (or fail) correctly
*/
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const gravyTap = require('..');
const testBundle = 'test/bundle.js';
const src = fs.readFileSync(path.resolve(process.cwd(), testBundle)).toString();
// describes expected output, keyed by browser
const specs = {
chrome: {
total: 4,
pass: 3,
fail: 1,
},
'internet explorer': {
rejects: /Object.+assign/,
},
};
const failedReject = 'expected to reject, but passed';
Object.keys(specs)
.reduce(
(acc, browser) =>
acc.then(() => {
const spec = specs[browser];
const caps = { browserName: browser };
console.log(`>> Running tests in '${browser}'`);
return gravyTap(src, { capabilities: caps })
.then(results => {
// throw is rejection was expected
if (spec.rejects) throw failedReject;
assert.strictEqual(results.tests, spec.total, `${spec.total} total tests`);
assert.strictEqual(results.passed, spec.pass, `${spec.pass} tests pass`);
assert.strictEqual(results.failed, spec.fail, `${spec.fail} tests fail`);
console.log(`>> PASSED ${browser} assertions`);
})
.catch(err => {
// if there was a reject from gravy-tap, re-throw it
if (!spec.rejects) throw err;
// if reject was due to unexpected pass, throw error
if (err === failedReject) {
console.log(`>> FAILED ${browser} ${failedReject}`);
throw new Error(failedReject);
}
// check reject message, throw new error if it does not match
if (spec.rejects.test(err.message)) {
console.log(`>> PASSED ${browser} rejected with expected error`);
} else {
console.log(`>> FAILED ${browser} rejected with wrong message`);
throw err;
}
});
}),
Promise.resolve()
)
.catch(err => {
console.error(err);
process.exit(1);
});
| 29.767123 | 87 | 0.568339 |
fec50778fdd63bd8e6ad21989a696f6608c8fc06 | 626 | js | JavaScript | src/components/MenuItem/MenuItem.style.js | soyjavi/watchman | ff032d814775ee7e9d48422fc16a7c5d9255a451 | [
"MIT"
] | 1 | 2018-05-14T21:43:17.000Z | 2018-05-14T21:43:17.000Z | src/components/MenuItem/MenuItem.style.js | soyjavi/ranks | ff032d814775ee7e9d48422fc16a7c5d9255a451 | [
"MIT"
] | null | null | null | src/components/MenuItem/MenuItem.style.js | soyjavi/ranks | ff032d814775ee7e9d48422fc16a7c5d9255a451 | [
"MIT"
] | null | null | null | import { StyleSheet } from 'react-native';
import { C } from '../../common';
const { STYLE: { FONT, MENU_ITEM, OFFSET } } = C;
export default StyleSheet.create({
container: {
...MENU_ITEM,
paddingHorizontal: OFFSET,
cursor: 'pointer',
},
hover: {
backgroundColor: 'rgba(255,255,255,0.25)',
},
check: {
width: OFFSET,
marginLeft: -OFFSET * 0.25,
marginRight: OFFSET,
alignItems: 'center',
fontSize: FONT.TINY,
},
disabled: {
opacity: 0.25,
},
text: {
color: 'white',
fontFamily: FONT.FAMILY,
fontSize: FONT.REGULAR,
userSelect: 'none',
},
});
| 16.473684 | 49 | 0.584665 |
fec68eb6ae1f836447e0e0c7610a1d4c3ef24eb6 | 3,438 | js | JavaScript | preload.js | DR-duo/vor-desktop | ab86556168f059373b2f95367008baf5716f4bda | [
"CC0-1.0"
] | null | null | null | preload.js | DR-duo/vor-desktop | ab86556168f059373b2f95367008baf5716f4bda | [
"CC0-1.0"
] | 1 | 2019-11-21T04:10:44.000Z | 2019-11-21T04:10:44.000Z | preload.js | DR-duo/vor-desktop | ab86556168f059373b2f95367008baf5716f4bda | [
"CC0-1.0"
] | null | null | null | // All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const runeterra = require("./app/utils/Runeterra/Runeterra");
const { MOUSE_ACTION_DOUBLE, MOUSE_ACTION_MIDDLE, mouse } = require("./app/utils/Mouse/Mouse");
const Synth = require("./app/utils/Sound/BrowserSynth");
const { langs } = require("./config.js");
const helpWindow = require("./app/HelpWindow");
let isActive = false;
let synth;
// functions for mouse events
async function handleDoubleClick(event) {
const { x, y } = event.detail;
const card = await runeterra.getCardAtCoord(x, y);
if (card) {
synth.say(card.name);
}
}
async function handleMiddleClick() {
const { localCardsCount, localHandCount, opponentCardsCount, opponentHandCount } = await runeterra.getCardState();
synth.say(`You have ${localCardsCount} in play, ${localHandCount} in hand, the opponent has ${opponentCardsCount} in play, and ${opponentHandCount} visible in hand`);
}
function handleMouseClick(event) {
mouse.logEvent(event);
}
// Initial mouse events create custom mouse events
mouse.initialize();
window.addEventListener(MOUSE_ACTION_DOUBLE, handleDoubleClick);
window.addEventListener(MOUSE_ACTION_MIDDLE, handleMiddleClick);
// Setup configuration windows
window.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("vor-button");
const select = document.getElementById("vor-language");
const volume = document.getElementById("vor-volume");
const test = document.getElementById("vor-test");
const help = document.getElementById("vor-help");
button.innerText = "Inactive";
Object.entries(langs).forEach(lang => {
select.add(new Option(lang[1], lang[0]));
});
button.addEventListener("click", () => {
isActive = !isActive;
button.innerText = isActive ? "Active" : "Inactive";
// manage events
if (isActive) {
mouse.registerEvent("mouseclick", handleMouseClick);
mouse.startInterval();
} else {
mouse.unregisterEvent("mouseclick", handleMouseClick);
mouse.stopInterval();
}
button.classList.toggle("btn-on");
button.classList.toggle("btn-off");
});
select.addEventListener("change", () => {
const language = select.options[select.selectedIndex].value;
runeterra.setLanguage(language);
});
volume.addEventListener("change", () => {
const vol = volume.value / 100;
synth.setVolume(vol);
});
test.addEventListener("click", () => {
synth.say("Legends of Runeterra");
});
help.addEventListener("click", () => {
helpWindow();
});
});
window.addEventListener("load", () => {
// syntheic voices take time to load.
// keep checking until voices come
new Promise(resolve => {
const interval = setInterval(() => {
if (window.speechSynthesis.getVoices().length !== 0) {
synth = new Synth();
resolve(synth.getVoices());
clearInterval(interval);
}
}, 10);
}).then(voices => {
// Populating choices
const voicesSelect = document.getElementById("vor-voices");
voices.forEach((voice, index) => {
voicesSelect.add(new Option(voice.name, index));
});
// Change selected voice index when changed
voicesSelect.addEventListener("change", () => {
const voiceIndex = voicesSelect.options[voicesSelect.selectedIndex].value;
synth.setVoice(synth.getVoices()[voiceIndex]);
});
});
});
| 32.742857 | 168 | 0.6847 |
fec70e943086a1a03074ebb7ed1a9028646e9b11 | 405 | js | JavaScript | src/blog/blog.11tydata.js | whitep4nth3r/mk2-p4nth3rblog | f9d6c8b07240f2366751232a5013360f4c8fc1ce | [
"MIT"
] | 5 | 2022-02-09T13:12:33.000Z | 2022-03-31T03:18:44.000Z | src/blog/blog.11tydata.js | whitep4nth3r/mk2-p4nth3rblog | f9d6c8b07240f2366751232a5013360f4c8fc1ce | [
"MIT"
] | 2 | 2022-02-22T13:50:50.000Z | 2022-03-07T17:16:22.000Z | src/blog/blog.11tydata.js | whitep4nth3r/mk2-p4nth3rblog | f9d6c8b07240f2366751232a5013360f4c8fc1ce | [
"MIT"
] | 3 | 2022-02-07T14:32:34.000Z | 2022-02-25T01:56:35.000Z | const ContentfulBlogPosts = require("../../lib/contentfulBlogPosts");
const ContentfulTopics = require("../../lib/contentfulTopics");
module.exports = async function () {
const topics = await ContentfulTopics.getAll();
const postSummaries = await ContentfulBlogPosts.getAllSummaries();
const posts = await ContentfulBlogPosts.getAll();
return {
postSummaries,
posts,
topics,
};
};
| 27 | 69 | 0.718519 |
fec730b8bf848c8a7deffae0d7b93c5530295b4d | 1,935 | js | JavaScript | src/client/app/login/login.route.js | kinkoazc/MeetingRoomsProject | d170e83c98e44ef13af2d9ebc60974aa698bf3cc | [
"MIT"
] | null | null | null | src/client/app/login/login.route.js | kinkoazc/MeetingRoomsProject | d170e83c98e44ef13af2d9ebc60974aa698bf3cc | [
"MIT"
] | null | null | null | src/client/app/login/login.route.js | kinkoazc/MeetingRoomsProject | d170e83c98e44ef13af2d9ebc60974aa698bf3cc | [
"MIT"
] | null | null | null | (function () {
'use strict';
angular
.module('app.login')
.run(appRun);
appRun.$inject = ['$state', '$timeout', 'auth', 'routerHelper'];
/* @ngInject */
function appRun($state, $timeout, auth, routerHelper) {
routerHelper.configureStates(getStates($state, $timeout, auth));
}
function getStates($state, $timeout, auth) {
return [
{
state: 'login',
config: {
url: '/login',
templateUrl: 'app/login/login.html',
controller: 'LoginController',
controllerAs: 'vm',
title: 'Login/Register',
settings: {
nav: 4,
inMainMenu: true,
authLevel: 1,
content: '<i class="fa fa-sign-in"></i> Login/Register'
}
}
},
{
state: 'logout',
config: {
url: '/logout',
templateUrl: 'app/login/logout.html',
controller: 'LoginController',
controllerAs: 'vm',
title: 'Logout',
onEnter: function () {
auth.logOut();
$timeout(function () {
$state.go('login');
});
},
onExit: function () {
},
settings: {
nav: 4,
inMainMenu: true,
authLevel: 2,
content: '<i class="fa fa-sign-in"></i> Logout ' +
'<span ng-bind="vm.auth.currentUser().email"></span>'
}
}
}
];
}
})();
| 31.721311 | 79 | 0.352972 |
fec7448253ac17b6c95c750699931d99f1b884b3 | 640 | js | JavaScript | src/data-grids/frozen-grid-v1/Grid/Row.js | jneander/sandbox.jneander.com | a94144da8e87d55fcc439abfe9b8398fa1af9888 | [
"MIT"
] | null | null | null | src/data-grids/frozen-grid-v1/Grid/Row.js | jneander/sandbox.jneander.com | a94144da8e87d55fcc439abfe9b8398fa1af9888 | [
"MIT"
] | 3 | 2019-07-27T18:28:16.000Z | 2021-05-10T04:24:22.000Z | src/data-grids/frozen-grid-v1/Grid/Row.js | jneander/sandbox.jneander.com | a94144da8e87d55fcc439abfe9b8398fa1af9888 | [
"MIT"
] | null | null | null | import React, {PureComponent} from 'react'
import styles from './styles.css'
import Cell from './Cell'
export default class Row extends PureComponent {
render() {
const style = {
display: 'inline-block',
lineHeight: `${this.props.height}px`,
height: `${this.props.height}px`
}
const classNames = [styles.Row]
classNames.push(this.props.even ? styles.RowEven : styles.RowOdd)
return (
<div className={classNames.join(' ')} style={style}>
{this.props.columns.map(column => (
<Cell column={column} row={this.props.row} key={column.id} />
))}
</div>
)
}
}
| 24.615385 | 71 | 0.607813 |
fec7463ab863968f42974cebcee16be1cc2afd98 | 1,148 | js | JavaScript | test/neo_seo.test.js | neofelisho/NeoSeo | 2430428e0f93e7b11e229572438986141777aae2 | [
"MIT"
] | null | null | null | test/neo_seo.test.js | neofelisho/NeoSeo | 2430428e0f93e7b11e229572438986141777aae2 | [
"MIT"
] | 1 | 2021-05-07T14:28:25.000Z | 2021-05-07T14:28:25.000Z | test/neo_seo.test.js | neofelisho/NeoSeo | 2430428e0f93e7b11e229572438986141777aae2 | [
"MIT"
] | null | null | null | const chai = require('chai')
const os = require('os')
const NeoSeo = require('../lib/neo_seo')
const fileToString = require('../lib/io/file_to_string')
var expect = chai.expect
let detector = new NeoSeo()
let inputFile = './test/testdata.html'
let outputFile = './test/output_file.txt'
let expected = [
'<a /> tag without rel attribute: There are 52 <a> without attribute rel in this HTML, more than 0.',
'No <meta> tag with name="description" attribute in <haed>: There are 0 <meta> with attribute name="descriptions" in <head>, less than 1.',
'No <meta> tag with name="keywords" attribute in <haed>: There are 0 <meta> with attribute name="keywords" in <head>, less than 1.'
]
describe('Test for detector with default configs', () => {
it('Input a html file, and output result as file', () => {
detector.getResult(inputFile, outputFile, (err, result) => {
if (err)console.log(err)
console.log(result)
})
fileToString(outputFile, err => { if (err) console.log(err) })
.then(data => {
let actual = data.split(os.EOL).filter(r => r !== '')
expect(actual).to.be.eql(expected)
})
})
})
| 38.266667 | 141 | 0.650697 |
fec7a984877246ddcb99697dbb8d8d49c34ae2fa | 785 | js | JavaScript | modules/products/services/get-product-by-id.service.js | MaksimGenov/ClothesShopAPI | 1d4aa3da95ca2cbfcb193bd0437015c47b88c638 | [
"MIT"
] | null | null | null | modules/products/services/get-product-by-id.service.js | MaksimGenov/ClothesShopAPI | 1d4aa3da95ca2cbfcb193bd0437015c47b88c638 | [
"MIT"
] | null | null | null | modules/products/services/get-product-by-id.service.js | MaksimGenov/ClothesShopAPI | 1d4aa3da95ca2cbfcb193bd0437015c47b88c638 | [
"MIT"
] | null | null | null | const mongoose = require('mongoose')
const Product = mongoose.model('Product')
const errorMsgGenerator = require('../../../utils/errorMessageGenerator')
module.exports = function getProductById (productId) {
return new Promise(async (resolve, reject) => {
if (!productId || !mongoose.Types.ObjectId.isValid(productId)) {
return reject(new TypeError(errorMsgGenerator.invalidIdMsg('Product', productId)))
}
try {
const product = await Product.findById(productId)
.populate('brand')
.populate('categories')
.populate('images')
if (!product) {
return reject(new ReferenceError(errorMsgGenerator.unexistingModelId('Product', productId)))
}
resolve(product)
} catch (error) {
reject(error)
}
})
}
| 32.708333 | 100 | 0.664968 |
fec86384dc489e4757558d4e9da68c5e1616787a | 1,375 | js | JavaScript | source/client/components/CreateCategory.js | fiher/9GAG | af50a6276db6e1506f09e37d6b7acdfd72dde3d7 | [
"MIT"
] | null | null | null | source/client/components/CreateCategory.js | fiher/9GAG | af50a6276db6e1506f09e37d6b7acdfd72dde3d7 | [
"MIT"
] | 8 | 2017-07-07T22:40:48.000Z | 2017-07-12T16:46:24.000Z | source/client/components/CreateCategory.js | fiher/9GAG | af50a6276db6e1506f09e37d6b7acdfd72dde3d7 | [
"MIT"
] | null | null | null |
import React from 'react'
import CategoryActions from '../actions/CategoryActions'
import CategoryStore from '../stores/CategoryStore'
export default class CreateCategory extends React.Component {
constructor (props) {
super(props)
this.state = CategoryStore.getState()
this.onChange = this.onChange.bind(this)
this.createCategory = this.createCategory.bind(this)
}
componentDidMount () {
CategoryStore.listen(this.onChange)
}
componentWillUnmount () {
CategoryStore.unlisten(this.onChange)
}
onChange (state) {
this.setState(state)
}
createCategory (event) {
event.preventDefault()
CategoryActions.addCategory(this.state.name)
}
render () {
return (
<div>
<div className='has-error'>
{this.state.error}
</div>
<div className='has-success'>
{this.state.success}
</div>
<form>
<div className="inputField">
<label htmlFor='title'>Name</label>
<input
type='text'
name='name'
id='name'
placeholder='name'
onChange={CategoryActions.handleNameChange}
value={this.state.name}/>
</div>
<input type='submit' onClick={this.createCategory.bind(this)} value='Create Category'/>
</form>
</div>
)
}
}
| 26.442308 | 97 | 0.598545 |
fecad4097b6b5df8788b58f691aa18c87a53f7b5 | 517 | js | JavaScript | pleo/src/components/Filter.js | andradaaag/pleo-challenge | b6a57261bb3b656111bcc35860c4f263956dd8d4 | [
"MIT"
] | 2 | 2020-03-02T15:37:41.000Z | 2020-03-03T06:07:34.000Z | pleo/src/components/Filter.js | andradaaag/pleo-challenge | b6a57261bb3b656111bcc35860c4f263956dd8d4 | [
"MIT"
] | null | null | null | pleo/src/components/Filter.js | andradaaag/pleo-challenge | b6a57261bb3b656111bcc35860c4f263956dd8d4 | [
"MIT"
] | null | null | null | import React, { Component } from 'react'
class Filter extends Component {
render() {
return (
<div className="filterInputContainer">
<input type="text" name="filter"
id="filterInput"
placeholder="Filter receipts here"
spellCheck="false"
value={this.props.filter}
onChange={this.props.handleFilter}
/>
</div>
);
}
}
export default Filter | 28.722222 | 54 | 0.485493 |
fecb3d1d7e5c3c8f19e7c0843562ca2aef6303ac | 196 | js | JavaScript | src/public/modules/forms/helpers/csv-response-classes/SingleAnswerResponse.class.js | nyccto-rapicastillo/formsg | e5a433ac7aa38019dcc62a26b6b1c21a827deb79 | [
"MIT"
] | null | null | null | src/public/modules/forms/helpers/csv-response-classes/SingleAnswerResponse.class.js | nyccto-rapicastillo/formsg | e5a433ac7aa38019dcc62a26b6b1c21a827deb79 | [
"MIT"
] | 72 | 2020-11-03T07:10:04.000Z | 2022-03-07T10:40:57.000Z | src/public/modules/forms/helpers/csv-response-classes/SingleAnswerResponse.class.js | nyccto-rapicastillo/formsg | e5a433ac7aa38019dcc62a26b6b1c21a827deb79 | [
"MIT"
] | null | null | null | const Response = require('./Response.class')
module.exports = class SingleAnswerResponse extends Response {
getAnswer() {
return this._data.answer
}
get numCols() {
return 1
}
}
| 16.333333 | 62 | 0.678571 |
fecb697008166126939c61bd3aee423a0c59e06c | 5,776 | js | JavaScript | Tests/Blazorise.Demo.Bootstrap.RC/wwwroot/blazorise.js | Anberm/Blazorise | e41102bd05074a8187af363d773f254b20f1ba0c | [
"MIT"
] | null | null | null | Tests/Blazorise.Demo.Bootstrap.RC/wwwroot/blazorise.js | Anberm/Blazorise | e41102bd05074a8187af363d773f254b20f1ba0c | [
"MIT"
] | null | null | null | Tests/Blazorise.Demo.Bootstrap.RC/wwwroot/blazorise.js | Anberm/Blazorise | e41102bd05074a8187af363d773f254b20f1ba0c | [
"MIT"
] | null | null | null | if (!window.blazorise) {
window.blazorise = {};
}
window.blazorise = {
init: (element, componentReference) => {
return true;
},
// adds a classname to the specified element
addClass: (element, classname) => {
element.classList.add(classname);
return true;
},
// removes a classname from the specified element
removeClass: (element, classname) => {
if (element.classList.contains(classname)) {
element.classList.remove(classname);
}
return true;
},
// toggles a classname on the given element id
toggleClass: (element, classname) => {
if (element) {
if (element.classList.contains(classname)) {
element.classList.remove(classname);
} else {
element.classList.add(classname);
}
}
return true;
},
// adds a classname to the body element
addClassToBody: (classname) => {
return blazorise.addClass(document.body, classname);
},
// removes a classname from the body element
removeClassFromBody: (classname) => {
return blazorise.removeClass(document.body, classname);
},
// indicates if parent node has a specified classname
parentHasClass: (element, classname) => {
if (element && element.parentElement) {
return element.parentElement.classList.contains(classname);
}
return false;
},
setTextValue(element, value) {
element.value = value;
return true;
},
getFilePaths: (element) => {
var paths = [];
if (element) {
var files = element.files;
for (var i = 0; i < files.length; i++) {
paths.push(files[i].name);
}
}
return paths;
},
getSelectedOptions: (elementId) => {
const element = document.getElementById(elementId);
const len = element.options.length;
var opts = [], opt;
for (var i = 0; i < len; i++) {
opt = element.options[i];
if (opt.selected) {
opts.push(opt.value);
}
}
return opts;
},
// holds the list of components that are triggers to close other components
closableComponents: [],
addClosableComponent: (elementId, dotnetAdapter) => {
window.blazorise.closableComponents.push({ elementId: elementId, dotnetAdapter: dotnetAdapter });
},
findClosableComponent: (elementId) => {
for (index = 0; index < window.blazorise.closableComponents.length; ++index) {
if (window.blazorise.closableComponents[index].elementId === elementId)
return window.blazorise.closableComponents[index];
}
return null;
},
findClosableComponentIndex: (elementId) => {
for (index = 0; index < window.blazorise.closableComponents.length; ++index) {
if (window.blazorise.closableComponents[index].elementId === elementId)
return index;
}
return -1;
},
isClosableComponent: (elementId) => {
for (index = 0; index < window.blazorise.closableComponents.length; ++index) {
if (window.blazorise.closableComponents[index].elementId === elementId)
return true;
}
return false;
},
registerClosableComponent: (elementId, dotnetAdapter) => {
if (window.blazorise.isClosableComponent(elementId) !== true) {
window.blazorise.addClosableComponent(elementId, dotnetAdapter);
}
},
unregisterClosableComponent: (elementId) => {
const index = window.blazorise.findClosableComponentIndex(elementId);
if (index !== -1) {
window.blazorise.closableComponents.splice(index, 1);
}
},
tryClose: (closable, targetElementId, isEscapeKey) => {
let request = new Promise((resolve, reject) => {
closable.dotnetAdapter.invokeMethodAsync('SafeToClose', targetElementId, isEscapeKey)
.then((result) => resolve({ elementId: closable.elementId, dotnetAdapter: closable.dotnetAdapter, status: result === true ? 'ok' : 'cancelled' }))
.catch(() => resolve({ elementId: closable.elementId, status: 'error' }));
});
if (request) {
request
.then((response) => {
if (response.status === 'ok') {
response.dotnetAdapter.invokeMethodAsync('Close')
// If the user navigates to another page then it will raise exception because the reference to the component cannot be found.
// In that case just remove the elementId from the list.
.catch(() => window.blazorise.unregisterClosableComponent(response.elementId));
}
});
}
}
};
document.addEventListener('click', function handler(evt) {
if (window.blazorise.closableComponents && window.blazorise.closableComponents.length > 0) {
const lastClosable = window.blazorise.closableComponents[window.blazorise.closableComponents.length - 1];
if (lastClosable) {
window.blazorise.tryClose(lastClosable, evt.target.id, false);
}
}
});
document.addEventListener('keyup', function handler(evt) {
if (evt.keyCode === 27 && window.blazorise.closableComponents && window.blazorise.closableComponents.length > 0) {
const lastClosable = window.blazorise.closableComponents[window.blazorise.closableComponents.length - 1];
if (lastClosable) {
window.blazorise.tryClose(lastClosable, lastClosable.elementId, true);
}
}
}); | 33.777778 | 162 | 0.593317 |
fecc53d685675098a3e319a81be560925400e348 | 431 | js | JavaScript | slack_bot/users.js | DevDeskQ/node-back-end | 8d0d50f567f245d1e2e822be83d567f62d0071a9 | [
"MIT"
] | 1 | 2019-07-15T18:18:08.000Z | 2019-07-15T18:18:08.000Z | slack_bot/users.js | DevDeskQ/node-back-end | 8d0d50f567f245d1e2e822be83d567f62d0071a9 | [
"MIT"
] | 1 | 2019-04-16T09:23:32.000Z | 2019-04-16T09:23:32.000Z | slack_bot/users.js | dev-desk-queue/backend | 19f32cb64a0bfce0489b9b3fde8da2096908305a | [
"MIT"
] | 2 | 2019-04-19T16:24:31.000Z | 2019-12-14T21:35:29.000Z | const qs = require('querystring');
const axios = require('axios');
const find = async (slackUserId) => {
try {
const body = { token: process.env.SLACK_ACCESS_TOKEN, user: slackUserId };
const promise = await axios.post('https://slack.com/api/users.info', qs.stringify(body));
return promise;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}
};
module.exports = { find }; | 26.9375 | 93 | 0.661253 |
fecd781a02efb0c4faf4440cbac2882f3b7830d5 | 464 | js | JavaScript | app/routes/usersRoute.js | AmbroseByamugisha/Node_JS_JWT_Auth | 0c619f671bf09d5234c6b638ff468ac70d6494f6 | [
"PostgreSQL"
] | null | null | null | app/routes/usersRoute.js | AmbroseByamugisha/Node_JS_JWT_Auth | 0c619f671bf09d5234c6b638ff468ac70d6494f6 | [
"PostgreSQL"
] | null | null | null | app/routes/usersRoute.js | AmbroseByamugisha/Node_JS_JWT_Auth | 0c619f671bf09d5234c6b638ff468ac70d6494f6 | [
"PostgreSQL"
] | null | null | null | import express from 'express';
import { createUser, siginUser, searchFirstnameOrLastname, getProfile } from '../controllers/usersController';
import verifyAuth from '../middlewares/verifyAuth';
const router = express.Router();
// users Routes
router.post('/auth/signup', createUser);
router.post('/auth/signin', siginUser);
router.get('/users/first_name', searchFirstnameOrLastname);
router.get('/auth/profile', verifyAuth, getProfile);
export default router;
| 30.933333 | 110 | 0.769397 |
fecefec7ff92cdd974e98dcbd9db477ae0fd9388 | 4,251 | js | JavaScript | src/index.js | Shin-sibainu/rage-sea-udemy | b8e7559ed5b185effbe4fbeb5097cde29962f9db | [
"MIT"
] | null | null | null | src/index.js | Shin-sibainu/rage-sea-udemy | b8e7559ed5b185effbe4fbeb5097cde29962f9db | [
"MIT"
] | null | null | null | src/index.js | Shin-sibainu/rage-sea-udemy | b8e7559ed5b185effbe4fbeb5097cde29962f9db | [
"MIT"
] | null | null | null | import "./style.css";
import * as THREE from "three";
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import vertexShader from "./shader/water/vertexShader";
import fragmentShader from "./shader/water/fragmentShader";
import * as dat from "lil-gui";
import skyImage from "./textures/sky.jpg";
//デバッグ
const gui = new dat.GUI({ width: 300 });
const debugObject = {};
/**
* Sizes
*/
const sizes = {
width: window.innerWidth,
height: window.innerHeight,
};
// Canvas
const canvas = document.querySelector(".webgl");
// Scene
const scene = new THREE.Scene();
// scene.background = new THREE.Color("#ffffff");
scene.fog = new THREE.Fog(0xdfe9f3, 100, 500);
/**
* Textures
*/
const textureLoader = new THREE.TextureLoader();
const skyTexture = textureLoader.load(skyImage);
scene.background = skyTexture;
// Geometry
const geometry = new THREE.PlaneGeometry(15, 15, 512, 512);
//色
debugObject.depthColor = "#2d81ae";
debugObject.surfaceColor = "#66c1f9";
//fog
// const fog = new THREE.Fog("#f5f5f5", 150, 700);
// scene.fog = fog;
// Material
const material = new THREE.ShaderMaterial({
vertexShader: vertexShader,
fragmentShader: fragmentShader,
side: THREE.DoubleSide,
uniforms: {
uTime: { value: 0 },
uBigWavesElevation: { value: 0.2 },
uBigWavesFrequency: { value: new THREE.Vector2(5, 2.5) },
uBigWavesSpeed: { value: 0.75 },
uDepthColor: { value: new THREE.Color(debugObject.depthColor) },
uSurfaceColor: { value: new THREE.Color(debugObject.surfaceColor) },
uColorOffset: { value: 0.03 },
uColorMultiplier: { value: 7.6 },
},
});
//デバッグ
gui
.add(material.uniforms.uBigWavesElevation, "value")
.min(0)
.max(1)
.step(0.001)
.name("uBigWavesElevation");
gui
.add(material.uniforms.uBigWavesFrequency.value, "x")
.min(0)
.max(10)
.step(0.001)
.name("uBigWavesFrequencyX");
gui
.add(material.uniforms.uBigWavesFrequency.value, "y")
.min(0)
.max(10)
.step(0.001)
.name("uBigWavesFrequencyY");
gui
.add(material.uniforms.uBigWavesSpeed, "value")
.min(0)
.max(4)
.step(0.001)
.name("uBigWavesSpeed");
gui.addColor(debugObject, "depthColor").onChange(() => {
material.uniforms.uDepthColor.value.set(debugObject.depthColor);
});
gui.addColor(debugObject, "surfaceColor").onChange(() => {
material.uniforms.uSurfaceColor.value.set(debugObject.surfaceColor);
});
gui
.add(material.uniforms.uColorOffset, "value")
.min(0)
.max(1)
.step(0.001)
.name("uColorOffset");
gui
.add(material.uniforms.uColorMultiplier, "value")
.min(0)
.max(10)
.step(0.001)
.name("uColorMultiplier");
gui.show(true);
// Mesh
const mesh = new THREE.Mesh(geometry, material);
//追加
mesh.rotation.x = -Math.PI * 0.5;
scene.add(mesh);
window.addEventListener("resize", () => {
sizes.width = window.innerWidth;
sizes.height = window.innerHeight;
camera.aspect = sizes.width / sizes.height;
camera.updateProjectionMatrix();
renderer.setSize(sizes.width, sizes.height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
// Camera
const camera = new THREE.PerspectiveCamera(
75,
sizes.width / sizes.height,
0.1,
100
);
//カメラの起点
camera.position.set(0, 0.23, 0);
scene.add(camera);
// Controls
// const controls = new OrbitControls(camera, canvas);
// controls.enableDamping = true;
/**
* Renderer
*/
const renderer = new THREE.WebGLRenderer({
canvas: canvas,
});
renderer.setSize(sizes.width, sizes.height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
/**
* Animate
*/
const clock = new THREE.Clock();
const animate = () => {
//時間取得
const elapsedTime = clock.getElapsedTime();
material.uniforms.uTime.value = elapsedTime;
//カメラを円周上に周回させる。
camera.position.x = Math.sin(elapsedTime * 0.17) * 3.0;
camera.position.z = Math.cos(elapsedTime * 0.17) * 3.0;
camera.lookAt(
Math.cos(elapsedTime),
Math.sin(elapsedTime) * 0.5,
Math.sin(elapsedTime) * 0.4
);
// controls.update();
renderer.render(scene, camera);
window.requestAnimationFrame(animate);
};
animate();
| 23.616667 | 75 | 0.659374 |
fed0ad9effd1de6f61916933de1dd8b0380453d2 | 383 | js | JavaScript | src/components/Label/index.js | serge1peshcoff/desktop-client | 665303b16fee9d2406ac6195060cf55bc485aae8 | [
"Apache-2.0"
] | 47 | 2020-05-14T00:22:44.000Z | 2022-01-06T14:45:06.000Z | src/components/Label/index.js | serge1peshcoff/desktop-client | 665303b16fee9d2406ac6195060cf55bc485aae8 | [
"Apache-2.0"
] | 10 | 2020-10-11T18:42:05.000Z | 2021-07-31T11:28:09.000Z | src/components/Label/index.js | serge1peshcoff/desktop-client | 665303b16fee9d2406ac6195060cf55bc485aae8 | [
"Apache-2.0"
] | 10 | 2020-06-02T14:28:22.000Z | 2022-02-15T01:11:01.000Z | import './index.css';
import * as PropTypes from 'prop-types';
import React from 'react';
const Label = ({
className,
label,
}) => {
return (
<label className={className}>
{label}
</label>
);
};
Label.propTypes = {
className: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
};
export default React.memo(Label);
| 17.409091 | 43 | 0.605744 |
fed0ef5eff067ff3384bf04f74ac9210d7fff4f4 | 2,024 | js | JavaScript | example/food-app/redux/App.js | Progyan1997/brahmos | f8536830ad1615a12312ac69d34e1a388f69f14c | [
"MIT"
] | 551 | 2019-11-11T00:16:16.000Z | 2022-03-28T07:34:24.000Z | example/food-app/redux/App.js | s-yadav/brahmos | e3bffc1f27b164957ed03c98faa7633d35bcb03d | [
"MIT"
] | 39 | 2019-06-23T15:29:09.000Z | 2019-10-15T18:49:06.000Z | example/food-app/redux/App.js | Progyan1997/brahmos | f8536830ad1615a12312ac69d34e1a388f69f14c | [
"MIT"
] | 19 | 2019-11-08T06:49:18.000Z | 2021-09-02T00:52:31.000Z | import { Fragment, useEffect, useState } from 'brahmos';
import { shallowEqual, useSelector, useDispatch } from 'react-redux';
import { ACTIONS } from './redux';
import { MenuList, Message, PaymentFooter } from './Comps';
import { loadFoodData } from '../utils';
export default function App() {
const diet = useSelector((state) => state.diet);
const dispatch = useDispatch();
const stateAPIStatus = useLoadFoodData();
const menuList = useSelector(selectorMenu, shallowEqual);
useEffect(() => {
console.log('SERVER_EVENT: menu list changed');
}, [menuList]);
function handleVegToggle() {
dispatch({
type: ACTIONS.CHANGE_DIET,
});
}
return (
<div className="food-app">
<header>
<h1>Ordux</h1>
<label>
<input
type="checkbox"
className="veg-filter"
name="veg-checkbox"
value={diet}
checked={diet === 'veg'}
onChange={handleVegToggle}
/>
Veg Only
</label>
</header>
<Message status={stateAPIStatus} />
{stateAPIStatus === 'success' && (
<Fragment>
<main>
<MenuList menuList={menuList} />
</main>
<PaymentFooter />
</Fragment>
)}
</div>
);
}
function useLoadFoodData() {
const [stateAPIStatus, setAPIStatus] = useState('idle');
const dispatch = useDispatch();
useEffect(() => {
setAPIStatus('loading');
loadFoodData()
.then((data) => {
dispatch({
type: ACTIONS.LOAD_MENU,
payload: {
menu: data,
},
});
setAPIStatus('success');
})
.catch((error) => {
setAPIStatus('error');
});
}, [dispatch]);
return stateAPIStatus;
}
function selectorMenu(state) {
const { diet, menuIdList, menuById } = state;
const menuId = menuIdList[diet];
const menuList = [];
menuId.forEach((id) => {
menuList.push(menuById[id]);
});
return menuList;
}
| 22.741573 | 69 | 0.558794 |
fed1222870c6ca46dc69864ff69ee7bd1efac2a9 | 3,110 | js | JavaScript | docs/less.fb60008b.js | resistdesign/react-preposition | e4c9b6aff0fda1dea8a307383dde08df5b2d0f03 | [
"MIT"
] | null | null | null | docs/less.fb60008b.js | resistdesign/react-preposition | e4c9b6aff0fda1dea8a307383dde08df5b2d0f03 | [
"MIT"
] | 3 | 2021-05-11T06:44:58.000Z | 2022-02-14T10:00:29.000Z | docs/less.fb60008b.js | resistdesign/react-preposition | e4c9b6aff0fda1dea8a307383dde08df5b2d0f03 | [
"MIT"
] | null | null | null | !function(e,n,r,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a.parcelRequireeb30&&a.parcelRequireeb30,o=s.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(n,r){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequireeb30&&a.parcelRequireeb30;if(!r&&t)return t(n,!0);if(s)return s(n,!0);if(c&&"string"==typeof n)return c(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(r){return e[n][1][r]||r},d.cache={};var u=o[n]=new l.Module(n);e[n][0].call(u.exports,d,u,u.exports,this)}return o[n].exports;function d(e){return l(d.resolve(e))}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.exports={}},l.modules=e,l.cache=o,l.parent=s,l.register=function(n,r){e[n]=[function(e,n){n.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return a.parcelRequireeb30}}),a.parcelRequireeb30=l;for(var u=0;u<n.length;u++)l(n[u])}({"5Skqw":[function(e,n,r){n.exports=function(e){var n="([\\w-]+|@{[\\w-]+})",r=[],t=[],i=function(e){return{className:"string",begin:"~?"+e+".*?"+e}},a=function(e,n,r){return{className:e,begin:n,relevance:r}},s={begin:"\\(",end:"\\)",contains:t,relevance:0};t.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,i("'"),i('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},a("number","#[0-9A-Fa-f]+\\b"),s,a("variable","@@?[\\w-]+",10),a("variable","@{[\\w-]+}"),a("built_in","~?`[^`]*?`"),{className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0},{className:"meta",begin:"!important"});var o=t.concat({begin:"{",end:"}",contains:r}),c={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(t)},l={begin:n+"\\s*:",returnBegin:!0,end:"[;}]",relevance:0,contains:[{className:"attribute",begin:n,end:":",excludeEnd:!0,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:t}}]},u={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",returnEnd:!0,contains:t,relevance:0}},d={className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:o}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:n,end:"{"}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c,a("keyword","all\\b"),a("variable","@{[\\w-]+}"),a("selector-tag",n+"%?",0),a("selector-id","#"+n),a("selector-class","\\."+n,0),a("selector-tag","&",0),{className:"selector-attr",begin:"\\[",end:"\\]"},{className:"selector-pseudo",begin:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{begin:"\\(",end:"\\)",contains:o},{begin:"!important"}]};return r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,u,d,l,b),{case_insensitive:!0,illegal:"[=>'/<($\"]",contains:r}}},{}]},[]);
//# sourceMappingURL=less.fb60008b.js.map
| 1,036.666667 | 3,067 | 0.649518 |
fed127183dd677b16ec4f530627d30698a535105 | 1,572 | js | JavaScript | js/script.js | johanneseppler/me | dab9cb5977a799ba2ea899b89f000259db0d94fe | [
"MIT"
] | 1 | 2020-02-04T18:59:31.000Z | 2020-02-04T18:59:31.000Z | js/script.js | johanneseppler/me | dab9cb5977a799ba2ea899b89f000259db0d94fe | [
"MIT"
] | null | null | null | js/script.js | johanneseppler/me | dab9cb5977a799ba2ea899b89f000259db0d94fe | [
"MIT"
] | null | null | null | //
// toggle collapse arrow
$('.toggler').click(function() {
// toggle selected element
$('i', this).toggleClass('fa-angle-down');
$('i', this).toggleClass('fa-angle-right');
// make sure all others are uncollapsed
$('i', $('.toggler', '#accordion').not(this)).removeClass('fa-angle-down');
$('i', $('.toggler', '#accordion').not(this)).addClass('fa-angle-right');
});
// Particles effect
window.onload = function() {
Particles.init({
// normal options
selector: '.background',
maxParticles: 400,
speed: 0.5,
color: [
'#2ba654', // primary
'#46b469',
'#5ec17d',
'#74cf92',
'#8adda6',
'#ef9a2f' // orange
],
minDistance: 80,
sizeVariations: 4,
connectParticles: true,
// options for breakpoints
responsive: [
{
breakpoint: 992,
options: {
maxParticles: 250,
color: [
'#2ba654', // primary
'#5ec17d',
'#8adda6',
'#ef9a2f' // orange
],
minDistance: 50,
sizeVariations: 3,
connectParticles: true,
}
}, {
breakpoint: 768,
options: {
maxParticles: 100,
color: '#368751',
minDistance: 30,
connectParticles: true
}
}, {
breakpoint: 425,
options: {
maxParticles: 50 // disables particles.js
}
}, {
breakpoint: 320,
options: {
maxParticles: 0 // disables particles.js
}
}
]
});
};
| 21.243243 | 77 | 0.495547 |
fed1c10a961244506c73845463c47129645d3669 | 238 | js | JavaScript | test/add.spec.js | astuanax/fun | 47622c1c55c4e615546cbaee5d7ba7bcd0768a42 | [
"MIT"
] | 2 | 2017-11-26T19:17:40.000Z | 2018-01-19T10:39:49.000Z | test/add.spec.js | astuanax/fun | 47622c1c55c4e615546cbaee5d7ba7bcd0768a42 | [
"MIT"
] | 3 | 2021-03-09T00:43:50.000Z | 2021-05-08T03:57:35.000Z | test/add.spec.js | astuanax/fun | 47622c1c55c4e615546cbaee5d7ba7bcd0768a42 | [
"MIT"
] | 1 | 2018-01-19T10:39:49.000Z | 2018-01-19T10:39:49.000Z | /**
*/
import chai from 'chai'
import { add } from '../lib/fun'
describe('add', function () {
it('returns the sum two arguments', function () {
chai.expect(add(-5, 5)).to.equal(0)
chai.expect(add(5, 5)).to.equal(10)
})
})
| 17 | 51 | 0.579832 |
fed235f5e0f83c1d90fe8a2fe63f717e4a3e6fab | 396 | js | JavaScript | test/util/local-vue.js | isabella232/central-frontend | f5b425cf2516c389896680f601efa3fefb8e19c1 | [
"Apache-2.0"
] | 13 | 2020-05-18T13:48:34.000Z | 2022-03-22T03:10:11.000Z | test/util/local-vue.js | getodk/central-frontend | 5cc6fd79d112ce36d6298c61bb8817689c4c323b | [
"Apache-2.0"
] | 138 | 2020-04-21T22:03:45.000Z | 2022-03-18T16:28:03.000Z | test/util/local-vue.js | isabella232/central-frontend | f5b425cf2516c389896680f601efa3fefb8e19c1 | [
"Apache-2.0"
] | 20 | 2020-04-21T02:02:15.000Z | 2022-03-24T18:23:48.000Z | import VueI18n from 'vue-i18n';
import VueRouter from 'vue-router';
import Vuex from 'vuex';
import { createLocalVue } from '@vue/test-utils';
const withRouter = createLocalVue();
withRouter.use(VueRouter);
withRouter.use(Vuex);
withRouter.use(VueI18n);
const withoutRouter = createLocalVue();
withoutRouter.use(Vuex);
withoutRouter.use(VueI18n);
export default { withRouter, withoutRouter };
| 24.75 | 49 | 0.770202 |
fed3542c8f7a08d37f41321e1111ae389afe5fc2 | 1,647 | js | JavaScript | sphinx_collapse_admonitions/_static/collapse_admonitions.js | stijnvanhoey/sphinx-collapse-admonitions | a45294e57ab89c7b4bf4850da4c30c6d03062ec0 | [
"MIT"
] | null | null | null | sphinx_collapse_admonitions/_static/collapse_admonitions.js | stijnvanhoey/sphinx-collapse-admonitions | a45294e57ab89c7b4bf4850da4c30c6d03062ec0 | [
"MIT"
] | null | null | null | sphinx_collapse_admonitions/_static/collapse_admonitions.js | stijnvanhoey/sphinx-collapse-admonitions | a45294e57ab89c7b4bf4850da4c30c6d03062ec0 | [
"MIT"
] | null | null | null | var initCollapsedAdmonitions = () => {
var admonitions = document.querySelectorAll('div.admonition');
// Add the button to each admonition and hook up a callback to toggle visibility
admonitions.forEach((item, index) => {
var itemTitle = item.querySelector('.admonition-title');
var admonitionID = `admonition-${index}`;
item.setAttribute('id', admonitionID);
var collapseButton = `<button id="button-${admonitionID}" class="admonition-button" data-target="${admonitionID}">+</button>`;
itemTitle.insertAdjacentHTML('afterend', collapseButton);
thisButton = document.getElementById(`button-${admonitionID}`);
thisButton.addEventListener('click', toggleCollapsed);
})
};
// This should simply add / remove the collapsed class and change the button text
var toggleCollapsed = (click) => {
target = click.target.dataset['target']
var admonition = document.getElementById(target);
var button = admonition.querySelector('button.admonition-button');
if (admonition.classList.contains("collapsed")) {
admonition.classList.remove("collapsed");
button.textContent = "-";
} else {
admonition.classList.add("collapsed");
button.textContent = "+";
}
}
// Helper function to run when the DOM is finished
const sphinxAdmonitionRunWhenDOMLoaded = cb => {
if (document.readyState != 'loading') {
cb()
} else if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', cb)
} else {
document.attachEvent('onreadystatechange', function() {
if (document.readyState == 'complete') cb()
})
}
}
sphinxAdmonitionRunWhenDOMLoaded(initCollapsedAdmonitions)
| 38.302326 | 130 | 0.714633 |
fed3f504b488437022b02c7fb4c3b4aa1a5ea7cc | 1,752 | js | JavaScript | public/js/init.js | Jailsonjpo/loja | d0e1cc5ab048a0d61a9c9dc0c53260ef2ee8f86b | [
"MIT"
] | null | null | null | public/js/init.js | Jailsonjpo/loja | d0e1cc5ab048a0d61a9c9dc0c53260ef2ee8f86b | [
"MIT"
] | null | null | null | public/js/init.js | Jailsonjpo/loja | d0e1cc5ab048a0d61a9c9dc0c53260ef2ee8f86b | [
"MIT"
] | null | null | null | //document.addEventListener('DOMContentLoaded', function() {
// var elems = document.querySelectorAll('.slider');
// var instances = M.Slider.init(elems, options);
// });
$(document).ready(function(){
$('.slider').slider({
indicators:false
});
$('.materialboxed').materialbox();
});
//$(document).ready(function () {
//
// $('.materialboxed').materialbox();
//
//
//
//});
function sliderPrev(){
$('.slider').slider('pause');
$('.slider').slider('prev');
}
function sliderNext(){
$('.slider').slider('pause');
$('.slider').slider('next');
}
//var instance = M.Slider.getInstance();
//
//$('.slider').slider(instance.next());
//
//instance.pause();
//instance.start();
//instance.next();
//instance.prev();
//instance.destroy();
// Next slide
//$('.carousel').carousel('next');
//$('.carousel').carousel('next', 3); // Move next n times.
//
//// Previous slide
//$('.carousel').carousel('prev');
//$('.carousel').carousel('prev', 4); // Move prev n times.
//
//// Set to nth slide
//$('.carousel').carousel('set', 4);
//
//// Destroy carousel
//$('.carousel').carousel('destroy');
//$(document).ready(function(){
// $('.sidenav').sidenav();
//// $('.slider').slider({full_width:true});
// $('.carousel.carousel-slider').carousel({fullWidth: true});
// $(".dropdown-trigger").dropdown();
// $('select').formSelect();
//
// });
// function sliderPrev(){
//
// $('.slider').slider('pause');
// $('.slider').slider('prev');
//
//
// }
//
//function sliderNext(){
//
// $('.slider').slider('pause');
// $('.slider').slider('next');
//
// }
| 17.877551 | 62 | 0.517123 |
fed4684471cd4de0e0b5fc8c67ba6218572dee94 | 1,359 | js | JavaScript | mtest/type/test.js | lfdoherty/minnow | 826a57162241dc3f48580070a879c9ed2b798e32 | [
"MIT"
] | 1 | 2022-02-22T09:06:20.000Z | 2022-02-22T09:06:20.000Z | mtest/type/test.js | lfdoherty/minnow | 826a57162241dc3f48580070a879c9ed2b798e32 | [
"MIT"
] | null | null | null | mtest/type/test.js | lfdoherty/minnow | 826a57162241dc3f48580070a879c9ed2b798e32 | [
"MIT"
] | null | null | null |
var minnow = require('./../../client/client')//this is the minnow include
var _ = require('underscorem')
exports.type = function(config, done){
minnow.makeServer(config, function(){
minnow.makeClient(config.port, function(client){
client.view('general', function(err, c){
done.poll(function(){
if(c.has('v') && c.v.value() === 'entity'){
done()
return true
}
})
minnow.makeClient(config.port, function(otherClient){
otherClient.view('general', function(err, v){
v.make('entity')
})
})
})
})
})
}
exports.innerTypeSwitch = function(config, done){
minnow.makeServer(config, function(){
minnow.makeClient(config.port, function(client){
client.view('subs', function(err, c){
done.poll(function(){
console.log(JSON.stringify(c.toJson()))
var json = c.va.toJson()
if(json.length === 2 && json.indexOf('Bill') !== -1 && json.indexOf('anon') !== -1){
done()
return true
}
//if(c.has('va') && c.v.value() === 'entity'){
//done()
//return true
//}
})
minnow.makeClient(config.port, function(otherClient){
otherClient.view('empty', function(err, v){
var e = v.make('entity')
e.subs.addNew('suba', {name: 'Bill'})
e.subs.addNew('subb', {name: 'hidden'})
})
})
})
})
})
}
| 23.033898 | 89 | 0.568065 |
fed5f174939bdf598c804e6f27ce015cade00598 | 622 | js | JavaScript | functions/userExists.js | jamesqquick/gatsby-auth0 | bc186de4e9ba07a4c66097934d01ff0b5d7eb927 | [
"MIT"
] | 2 | 2020-05-16T12:56:53.000Z | 2020-05-17T12:28:13.000Z | functions/userExists.js | jamesqquick/gatsby-auth0 | bc186de4e9ba07a4c66097934d01ff0b5d7eb927 | [
"MIT"
] | null | null | null | functions/userExists.js | jamesqquick/gatsby-auth0 | bc186de4e9ba07a4c66097934d01ff0b5d7eb927 | [
"MIT"
] | 3 | 2020-05-11T14:57:30.000Z | 2021-01-29T01:50:08.000Z | const { doesUserExist } = require("./utils/airtable")
exports.handler = async (event) => {
const params = event.queryStringParameters
const handle = params.handle
if (!params.handle) {
return {
statusCode: 403,
body: JSON.stringify({ err: "No handle included" }),
}
}
try {
const userExists = await doesUserExist(handle)
return {
statusCode: 200,
body: JSON.stringify({ userExists }),
}
} catch (err) {
console.error(err)
return {
statusCode: 500,
body: JSON.stringify({
msg: err.message || "Something went wrong",
}),
}
}
}
| 22.214286 | 58 | 0.593248 |
fed6672b3764f82a88aa916ca0c765e2c553f61a | 2,108 | js | JavaScript | src/GraphQL/roles.js | mollimoll/aginun | d1167fc5d147d7fea76820a62eb5342d08faf612 | [
"MIT"
] | null | null | null | src/GraphQL/roles.js | mollimoll/aginun | d1167fc5d147d7fea76820a62eb5342d08faf612 | [
"MIT"
] | null | null | null | src/GraphQL/roles.js | mollimoll/aginun | d1167fc5d147d7fea76820a62eb5342d08faf612 | [
"MIT"
] | null | null | null | import gql from "graphql-tag";
const RoleSummaryFieldsFragment = gql`
fragment RoleSummaryFields on role {
id
title
timeCommitmentMin
timeCommitmentMax
workingCircle {
title
id
}
localGroup {
title
id
}
}
`;
const RoleFieldsFragment = gql`
fragment RoleFields on role {
id
title
responsibilities
description
requirements
timeCommitmentMin
timeCommitmentMax
email
mattermostId
phone
createdDate
dueDate
workingCircle {
title
id
}
localGroup {
title
id
}
}
`;
export const RolesQuery = gql`
query Roles(
$limit: Int!
$offset: Int!
$localGroupIds: [Int!]
$workingCircleIds: [Int!]
$timeCommitmentMin: Int!
$timeCommitmentMax: Int!
$search: String!
) {
roles(
where: {
_and: [
{ localGroupId: { _in: $localGroupIds } }
{ workingCircleId: { _in: $workingCircleIds } }
{ timeCommitmentMin: { _gte: $timeCommitmentMin } }
{ timeCommitmentMax: { _lte: $timeCommitmentMax } }
{ title: { _ilike: $search } }
]
}
order_by: { createdDate: desc }
limit: $limit
offset: $offset
) {
...RoleSummaryFields
}
}
${RoleSummaryFieldsFragment}
`;
export const RoleQuery = gql`
query Role($roleId: Int!) {
role(id: $roleId) {
...RoleFields
}
}
${RoleFieldsFragment}
`;
export const CreateRoleMutation = gql`
mutation CreateRole($input: [role_insert_input!]!) {
insert_role(objects: $input) {
returning {
...RoleFields
}
}
}
${RoleFieldsFragment}
`;
export const UpdateRoleMutation = gql`
mutation UpdateRole($id: Int!, $input: role_set_input!) {
update_role(where: { id: { _eq: $id } }, _set: $input) {
affected_rows
returning {
...RoleFields
}
}
}
${RoleFieldsFragment}
`;
export const DeleteRoleMutation = gql`
mutation DeleteRole($id: Int!) {
delete_role(where: { id: { _eq: $id } }) {
affected_rows
}
}
`;
| 18.491228 | 61 | 0.581594 |
fed8e0bafd171cd68552a6c71095e2f03a80346a | 147 | js | JavaScript | onos/apis/dir_00a9ed070d4ee44a924e1cf978d9375a.js | onosfw/apis | 3dd33b600bbd73bb1b8e0a71272efe1a45f42458 | [
"Apache-2.0"
] | null | null | null | onos/apis/dir_00a9ed070d4ee44a924e1cf978d9375a.js | onosfw/apis | 3dd33b600bbd73bb1b8e0a71272efe1a45f42458 | [
"Apache-2.0"
] | null | null | null | onos/apis/dir_00a9ed070d4ee44a924e1cf978d9375a.js | onosfw/apis | 3dd33b600bbd73bb1b8e0a71272efe1a45f42458 | [
"Apache-2.0"
] | null | null | null | var dir_00a9ed070d4ee44a924e1cf978d9375a =
[
[ "impl", "dir_2c10b7da97873327485bd4dc726830ae.html", "dir_2c10b7da97873327485bd4dc726830ae" ]
]; | 36.75 | 99 | 0.809524 |
fed90556c6fe65e61833bcfb35575380043cf456 | 3,120 | js | JavaScript | Client/stomp-demo/websocket/ws.js | cnwillz/UniAppSpringBoot | 508eb376554116e224a659ed571e95a6a3feced4 | [
"Apache-2.0"
] | 1 | 2020-12-23T14:49:57.000Z | 2020-12-23T14:49:57.000Z | Client/stomp-demo/websocket/ws.js | cnwillz/UniAppSpringBoot | 508eb376554116e224a659ed571e95a6a3feced4 | [
"Apache-2.0"
] | null | null | null | Client/stomp-demo/websocket/ws.js | cnwillz/UniAppSpringBoot | 508eb376554116e224a659ed571e95a6a3feced4 | [
"Apache-2.0"
] | null | null | null | import { Stomp } from './stomp.js'
import UniWebSocket from './uniWebSocket.js'
import { wsUrl, refreshToken } from '@/config/config.js'
/**
* WebSocket stomp 实例
*/
class Ws {
constructor() {
// 重连间隔
this.reconnectInterval = 10000
// 是否打印debug信息
this.debug = true
// ws地址
if (wsUrl.indexOf('http://') === 0) {
this.url = wsUrl.replace('http://', 'ws://')
} else if (wsUrl.indexOf('https://') === 0) {
this.url = wsUrl.replace('https://', 'wss://')
} else {
this.url = wsUrl
}
// stomp实例
this.client = null
// 重连事件编号
this.reconnectId = null
// 订阅集合
this.subscribes = {}
}
/**
* 创建连接
*/
connect() {
// 如已存在连接则不创建
if (this.client && this.client.connected) {
return
}
// 创建连接,认证token以第二个参数:Sec-WebSocket-Protocol传递到后台,后台需将此头信息原样返回
// 注:如不想在此处进行认证,可考虑在下面的client.connect方法中传递header进行认证
// 从缓存中获取token
let token = uni.getStorageSync('AccessToken')
// let ws = new UniWebSocket(this.url, [token])
let ws = new UniWebSocket(this.url, [])
this.client = Stomp.over(ws)
// 控制是否打印debug信息
if (!this.debug) {
this.client.debug = () => {}
}
this.client.connect({},
frame => {
// 初始化订阅
Object.keys(this.subscribes).forEach(key => {
this.subscribe(key, this.subscribes[key].callback)
})
},
error => {
// 重连
this.reconnectId = setTimeout(() => {
this.reconnect()
}, this.reconnectInterval)
}
)
// 监听WebSocket对象连接状态,如失败,则stomp的connect回调不会触发,应在此重连
ws.onerror = () => {
// 重连
this.reconnectId = setTimeout(() => {
// 刷新token
refreshToken().then(() => {
this.reconnect()
})
}, this.reconnectInterval)
}
}
/**
* 重新连接
*/
reconnect() {
// 订阅状态置false
Object.keys(this.subscribes).forEach(key => {
this.subscribes[key]['subscribed'] = false
})
// 连接
this.connect()
}
/**
* 断开连接
*/
disconnect() {
// 断开连接
if (this.client) {
this.client.disconnect()
}
// 停止重连事件
if (this.reconnectId) {
clearTimeout(this.reconnectId)
this.reconnectId = null
}
// 清空所有除订阅缓存
this.subscribes = {}
}
/**
* 订阅
* @param {Object} destination 主题
* @param {Object} callback 回调
*/
subscribe(destination, callback) {
if (this.subscribes[destination] && this.subscribes[destination]['subscribed']) { // 已订阅
return
} else if (this.client && this.client.connected) { // 已连接:调用订阅,缓存订阅信息
let subscribe = this.client.subscribe(destination, res => callback(res))
this.subscribes[destination] = { callback: callback, subscribed: true, subscribe: subscribe }
} else { // 未连接:缓存订阅信息
this.subscribes[destination] = { callback: callback, subscribed: false }
}
}
/**
* 取消订阅
* @param {Object} destination 主题
*/
unsubscribe(destination) {
if (this.subscribes[destination]) {
// 取消订阅
this.subscribes[destination].subscribe.unsubscribe()
// 删除订阅缓存
delete this.subscribes[destination]
}
}
/**
* 向服务器发送消息
* @param {Object} destination 主题
* @param {Object} message 消息内容
*/
send(destination, message) {
if (this.client) {
this.client.send(destination, null, message)
}
}
}
export default new Ws()
| 21.22449 | 96 | 0.620833 |
fed92d250bf538a5c9cdbaf7b8e2a546a81a4dc3 | 498 | js | JavaScript | test/helpers/createEstateFull.js | SatyrnFinancial/space | 9afd7a1c641f9cd448dea2394cddbe5414c0040f | [
"Apache-2.0"
] | null | null | null | test/helpers/createEstateFull.js | SatyrnFinancial/space | 9afd7a1c641f9cd448dea2394cddbe5414c0040f | [
"Apache-2.0"
] | null | null | null | test/helpers/createEstateFull.js | SatyrnFinancial/space | 9afd7a1c641f9cd448dea2394cddbe5414c0040f | [
"Apache-2.0"
] | null | null | null | export default async function createSectorFull(
contracts,
xs,
ys,
owner,
metadata,
sendParams
) {
const { space, sector } = contracts
if (metadata) {
await space.createSectorWithMetadata(xs, ys, owner, metadata, sendParams)
} else {
await space.createSector(xs, ys, owner, sendParams)
}
const tokenCount = await sector.balanceOf.call(owner)
const token = await sector.tokenOfOwnerByIndex(
owner,
tokenCount.toNumber() - 1
)
return token.toString()
}
| 19.92 | 77 | 0.694779 |
fed93125c73a7ef5b957de777dbbc94adf6a089d | 4,502 | js | JavaScript | repository/distributors/government-distributor.js | kanselarij-vlaanderen/data-migration-service | 08020a263d81dd427477050242e6afaa1fc008f4 | [
"MIT"
] | null | null | null | repository/distributors/government-distributor.js | kanselarij-vlaanderen/data-migration-service | 08020a263d81dd427477050242e6afaa1fc008f4 | [
"MIT"
] | null | null | null | repository/distributors/government-distributor.js | kanselarij-vlaanderen/data-migration-service | 08020a263d81dd427477050242e6afaa1fc008f4 | [
"MIT"
] | null | null | null | import Distributor from '../distributor';
import { runStage } from '../timing';
import { updateTriplestore } from '../triplestore';
import {
ADMIN_GRAPH,
GOVERNMENT_GRAPH,
ACCESS_LEVEL_CABINET,
ACCESS_LEVEL_GOVERNMENT,
ACCESS_LEVEL_PUBLIC,
AGENDA_TYPE,
} from '../../constants';
import { countResources } from '../query-helpers';
import {
collectReleasedAgendas,
collectReleasedAgendaitems,
collectAgendaitemActivities
} from '../collectors/agenda-collection';
import {
collectMeetings,
collectReleasedNewsletter
} from '../collectors/meeting-collection';
import { collectSubcasesAndCases } from '../collectors/case-collection';
import {
collectReleasedAgendaitemTreatments,
collectReleasedNewsitems
} from '../collectors/decision-collection';
import {
collectReleasedDocuments,
collectDocumentContainers,
collectPhysicalFiles
} from '../collectors/document-collection';
/**
* Distributor for government (intern-overheid) profile
*/
export default class GovernmentDistributor extends Distributor {
constructor() {
super({
sourceGraph: ADMIN_GRAPH,
targetGraph: GOVERNMENT_GRAPH
});
this.releaseOptions = {
validateDecisionsRelease: true,
validateDocumentsRelease: true
};
}
async collect(options) {
await runStage('Collect agendas', async () => {
await collectReleasedAgendas(this, options);
}, this.constructor.name);
const nbOfAgendas = await countResources({ graph: this.tempGraph, type: AGENDA_TYPE });
if (nbOfAgendas) {
await runStage('Collect meeting and agendaitems', async () => {
await collectMeetings(this);
await collectReleasedAgendaitems(this);
}, this.constructor.name);
await runStage('Collect meeting newsletter', async () => {
await collectReleasedNewsletter(this);
}, this.constructor.name);
await runStage('Collect activities of agendaitems', async () => {
await collectAgendaitemActivities(this);
}, this.constructor.name);
await runStage('Collect subcases and cases', async () => {
await collectSubcasesAndCases(this);
}, this.constructor.name);
await runStage('Collect released and approved decisions/treatments', async () => {
await collectReleasedAgendaitemTreatments(this);
}, this.constructor.name);
await runStage('Collect newsitems', async () => {
await collectReleasedNewsitems(this);
}, this.constructor.name);
await runStage('Collect released documents', async () => {
await collectReleasedDocuments(this);
}, this.constructor.name);
await runStage('Collect document containers', async () => {
await collectDocumentContainers(this);
}, this.constructor.name);
await runStage('Collect visible files', async () => {
await this.collectVisibleFiles();
}, this.constructor.name);
await runStage('Collect physical files', async () => {
await collectPhysicalFiles(this);
}, this.constructor.name);
}
return nbOfAgendas > 0;
}
/*
* Collect all files related to any of the previously copied released documents
* that are accessible for the government-profile
* I.e. the document has an access level 'Intern overheid' or 'Publiek' and is
* not linked to a case that contains a confidential subcase.
*
* Note: some documents in legacy data don't have any access level and may not be
* distributed. Therefore it's important to ensure the existence
* of the triple `?piece ext:toegangsniveauVoorDocumentVersie ?any`.
*/
async collectVisibleFiles() {
const visibleFileQuery = `
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX dossier: <https://data.vlaanderen.be/ns/dossier#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
INSERT {
GRAPH <${this.tempGraph}> {
?file a nfo:FileDataObject ;
ext:tracesLineageTo ?agenda .
}
} WHERE {
GRAPH <${this.tempGraph}> {
?piece a dossier:Stuk ;
ext:tracesLineageTo ?agenda .
}
GRAPH <${this.sourceGraph}> {
?piece ext:file ?file ;
ext:toegangsniveauVoorDocumentVersie ?accessLevel .
FILTER( ?accessLevel IN (<${ACCESS_LEVEL_GOVERNMENT}>, <${ACCESS_LEVEL_PUBLIC}>) )
}
}`;
await updateTriplestore(visibleFileQuery);
}
}
| 32.861314 | 92 | 0.673701 |
fed95264b99df25ae2cd52a75c6f95f467dc68c0 | 1,305 | js | JavaScript | react-ui/src/App.js | grp06/websockets | 8bc118493bddd29214f91be16f9d52521378edd3 | [
"MIT"
] | null | null | null | react-ui/src/App.js | grp06/websockets | 8bc118493bddd29214f91be16f9d52521378edd3 | [
"MIT"
] | null | null | null | react-ui/src/App.js | grp06/websockets | 8bc118493bddd29214f91be16f9d52521378edd3 | [
"MIT"
] | null | null | null | import React, { useCallback, useEffect, useState } from 'react';
import logo from './logo.svg';
import io from 'socket.io-client';
import './App.css';
class App extends React.Component {
constructor(props) {
super(props)
this.state = { message: ''}
}
componentDidMount() {
fetch('/api')
.then(response => {
if (!response.ok) {
throw new Error(`status ${response.status}`);
}
return response.json();
})
.then(json => {
this.setState({
message: json.message
})
const socket = io();
console.log('socket = ', socket)
}).catch(e => {
console.log('e = ', e)
})
}
render() {
const { message } = this.state
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
{ process.env.NODE_ENV === 'production' ?
<p>
This is a production build from create-react-app.
</p>
: <p>
Edit <code>src/App.js</code> and save to reload.
</p>
}
<p>{'« '}<strong>
{ message}
</strong>{' »'}</p>
</header>
</div>
);
}
}
export default App;
| 21.75 | 65 | 0.48046 |
fed958c6a2e59d402697c10465b6652ff7ce07aa | 126,023 | js | JavaScript | node_modules/click-confirm/dist/click-confirm.js | kindimx/Prueba---JustCreative | 10c7844ef247bb1d12241c8e4c9f1848cc9eac6b | [
"MIT"
] | null | null | null | node_modules/click-confirm/dist/click-confirm.js | kindimx/Prueba---JustCreative | 10c7844ef247bb1d12241c8e4c9f1848cc9eac6b | [
"MIT"
] | 3 | 2020-07-18T10:33:03.000Z | 2021-05-10T16:16:28.000Z | node_modules/click-confirm/dist/click-confirm.js | kindimx/Prueba---JustCreative | 10c7844ef247bb1d12241c8e4c9f1848cc9eac6b | [
"MIT"
] | null | null | null | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["click-confirm"] = factory();
else
root["click-confirm"] = factory();
})(this, function() {
return /******/ (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] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = 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;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var Component = __webpack_require__(40)(
/* script */
__webpack_require__(42),
/* template */
__webpack_require__(83),
/* scopeId */
null,
/* cssModules */
null
)
module.exports = Component.exports
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 2 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(34);
var defined = __webpack_require__(17);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 4 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.5.0' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(6)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 6 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(8);
var createDesc = __webpack_require__(15);
module.exports = __webpack_require__(5) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(11);
var IE8_DOM_DEFINE = __webpack_require__(33);
var toPrimitive = __webpack_require__(27);
var dP = Object.defineProperty;
exports.f = __webpack_require__(5) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(38);
var enumBugKeys = __webpack_require__(18);
module.exports = Object.keys || function keys(O) {
return $keys(O, enumBugKeys);
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(24)('wks');
var uid = __webpack_require__(16);
var Symbol = __webpack_require__(1).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(13);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(1);
var core = __webpack_require__(4);
var ctx = __webpack_require__(54);
var hide = __webpack_require__(7);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && key in exports) continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 14 */
/***/ (function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/* 16 */
/***/ (function(module, exports) {
var id = 0;
var px = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/* 17 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 18 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 19 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 20 */
/***/ (function(module, exports) {
module.exports = true;
/***/ }),
/* 21 */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(8).f;
var has = __webpack_require__(2);
var TAG = __webpack_require__(10)('toStringTag');
module.exports = function (it, tag, stat) {
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(24)('keys');
var uid = __webpack_require__(16);
module.exports = function (key) {
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(1);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
module.exports = function (key) {
return store[key] || (store[key] = {});
};
/***/ }),
/* 25 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(17);
module.exports = function (it) {
return Object(defined(it));
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(13);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(1);
var core = __webpack_require__(4);
var LIBRARY = __webpack_require__(20);
var wksExt = __webpack_require__(29);
var defineProperty = __webpack_require__(8).f;
module.exports = function (name) {
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(10);
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(46);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(45);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ }),
/* 31 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(13);
var document = __webpack_require__(1).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(5) && !__webpack_require__(6)(function () {
return Object.defineProperty(__webpack_require__(32)('div'), 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(31);
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(20);
var $export = __webpack_require__(12);
var redefine = __webpack_require__(39);
var hide = __webpack_require__(7);
var has = __webpack_require__(2);
var Iterators = __webpack_require__(19);
var $iterCreate = __webpack_require__(58);
var setToStringTag = __webpack_require__(22);
var getPrototypeOf = __webpack_require__(66);
var ITERATOR = __webpack_require__(10)('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';
var returnThis = function () { return this; };
module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
$iterCreate(Constructor, NAME, next);
var getMethod = function (kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
case KEYS: return function keys() { return new Constructor(this, kind); };
case VALUES: return function values() { return new Constructor(this, kind); };
} return function entries() { return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator';
var DEF_VALUES = DEFAULT == VALUES;
var VALUES_BUG = false;
var proto = Base.prototype;
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
var $default = $native || getMethod(DEFAULT);
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
var methods, key, IteratorPrototype;
// Fix native
if ($anyNative) {
IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEF_VALUES && $native && $native.name !== VALUES) {
VALUES_BUG = true;
$default = function values() { return $native.call(this); };
}
// Define iterator
if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if (DEFAULT) {
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if (FORCED) for (key in methods) {
if (!(key in proto)) redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(11);
var dPs = __webpack_require__(63);
var enumBugKeys = __webpack_require__(18);
var IE_PROTO = __webpack_require__(23)('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(32)('iframe');
var i = enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
__webpack_require__(56).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(38);
var hiddenKeys = __webpack_require__(18).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return $keys(O, hiddenKeys);
};
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(2);
var toIObject = __webpack_require__(3);
var arrayIndexOf = __webpack_require__(53)(false);
var IE_PROTO = __webpack_require__(23)('IE_PROTO');
module.exports = function (object, names) {
var O = toIObject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7);
/***/ }),
/* 40 */
/***/ (function(module, exports) {
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
scopeId,
cssModules
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
// inject cssModules
if (cssModules) {
var computed = Object.create(options.computed || null)
Object.keys(cssModules).forEach(function (key) {
var module = cssModules[key]
computed[key] = function () { return module }
})
options.computed = computed
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _keys = __webpack_require__(44);
var _keys2 = _interopRequireDefault(_keys);
var _typeof2 = __webpack_require__(30);
var _typeof3 = _interopRequireDefault(_typeof2);
var _tether = __webpack_require__(80);
var _tether2 = _interopRequireDefault(_tether);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var TRIGGER_LISTENERS = {
click: { click: 'toggle' },
hover: { mouseenter: 'show', mouseleave: 'hide' },
focus: { focus: 'show', blur: 'hide' }
};
var PLACEMENT_PARAMS = {
top: 'bottom center',
bottom: 'top center',
left: 'middle right',
right: 'middle left'
};
var TETHER_CLASS_PREFIX = 'bs-tether';
var TETHER_CLASSES = {
element: false,
enabled: false
};
var TRANSITION_DURATION = 150;
exports.default = {
props: {
constraints: {
type: Array,
default: function _default() {
return [];
}
},
content: {
type: String,
default: ''
},
debounce: {
type: [Number],
default: 300,
validator: function validator(value) {
return value >= 0;
}
},
delay: {
type: [Number, Object],
default: 0,
validator: function validator(value) {
if (typeof value === 'number') {
return value >= 0;
} else if (value !== null && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object') {
return typeof value.show === 'number' && typeof value.hide === 'number' && value.show >= 0 && value.hide >= 0;
}
return false;
}
},
offset: {
type: String,
default: '0 0',
validator: function validator(value) {
return (/^((0\s?)|([+-]?[0-9]+(px|%)\s?)){2}$/.test(value)
);
}
},
placement: {
type: String,
default: 'top',
validator: function validator(value) {
return (0, _keys2.default)(PLACEMENT_PARAMS).indexOf(value) !== -1;
}
},
popoverStyle: {
type: Object,
default: null
},
show: {
type: Boolean,
default: null
},
targetOffset: {
type: String,
default: '0 0',
validator: function validator(value) {
return (/^((0\s?)|([+-]?[0-9]+(px|%)\s?)){2}$/.test(value)
);
}
},
title: {
type: String,
default: ''
},
triggers: {
type: [Boolean, String, Array],
default: function _default() {
return ['click', 'focus'];
},
validator: function validator(value) {
if (value === false || value === '') {
return true;
} else if (typeof value === 'string') {
return (0, _keys2.default)(TRIGGER_LISTENERS).indexOf(value) !== -1;
} else if (Array.isArray(value)) {
var keys = (0, _keys2.default)(TRIGGER_LISTENERS);
value.forEach(function (item) {
if (keys.indexOf(item) === -1) {
return false;
}
});
return true;
}
return false;
}
}
},
data: function data() {
return {
triggerState: this.show,
classState: this.show,
lastEvent: null
};
},
computed: {
normalizedTriggers: function normalizedTriggers() {
if (this.triggers === false) {
return [];
} else if (typeof this.triggers === 'string') {
return [this.triggers];
}
return this.triggers;
},
popoverAlignment: function popoverAlignment() {
return !this.placement || this.placement === 'default' ? 'popover-top' : 'popover-' + this.placement;
},
showState: function showState() {
return this.show !== false && (this.triggerState || this.show);
}
},
watch: {
constraints: function constraints() {
this.setOptions();
},
normalizedTriggers: function normalizedTriggers(newTriggers, oldTriggers) {
this.updateListeners(newTriggers, oldTriggers);
},
offset: function offset() {
this.setOptions();
},
placement: function placement() {
this.setOptions();
},
showState: function showState(val) {
var _this = this;
var delay = this.getDelay(val);
clearTimeout(this._timeout);
if (delay) {
this._timeout = setTimeout(function () {
return _this.togglePopover(val);
}, delay);
} else {
this.togglePopover(val);
}
}
},
methods: {
addListener: function addListener(trigger) {
var _this2 = this;
for (var item in TRIGGER_LISTENERS[trigger]) {
this._trigger.addEventListener(item, function (e) {
return _this2.eventHandler(e);
});
}
},
destroyTether: function destroyTether() {
if (this._tether && !this.showState) {
this._tether.destroy();
this._tether = null;
var regx = new RegExp('(^|[^-]\\b)(' + TETHER_CLASS_PREFIX + '\\S*)', 'g');
this._trigger.className = this._trigger.className.replace(regx, '');
}
},
eventHandler: function eventHandler(e) {
if (this.normalizedTriggers.length > 1 && this.debounce > 0 && this.lastEvent !== null && e.timeStamp <= this.lastEvent + this.debounce) {
return;
}
for (var trigger in TRIGGER_LISTENERS) {
for (var event in TRIGGER_LISTENERS[trigger]) {
if (event === e.type) {
var action = TRIGGER_LISTENERS[trigger][event];
if (action === 'toggle' || this.triggerState && action === 'hide' || !this.triggerState && action === 'show') {
this.triggerState = !this.triggerState;
this.lastEvent = e.timeStamp;
}
return;
}
}
}
},
getDelay: function getDelay(state) {
if ((0, _typeof3.default)(this.delay) === 'object') {
return state ? this.delay.show : this.delay.hide;
}
return this.delay;
},
getTetherOptions: function getTetherOptions() {
return {
attachment: PLACEMENT_PARAMS[this.placement],
element: this._popover,
target: this._trigger,
classes: TETHER_CLASSES,
classPrefix: TETHER_CLASS_PREFIX,
offset: this.offset,
constraints: this.constraints,
targetOffset: this.targetOffset
};
},
hidePopover: function hidePopover() {
var _this3 = this;
this.classState = false;
clearTimeout(this._timeout);
this._timeout = setTimeout(function () {
_this3._popover.style.display = 'none';
_this3.destroyTether();
}, TRANSITION_DURATION);
},
refreshPosition: function refreshPosition() {
var _this4 = this;
if (this._tether) {
this.$nextTick(function () {
_this4._tether.position();
});
}
},
removeListener: function removeListener(trigger) {
var _this5 = this;
for (var item in TRIGGER_LISTENERS[trigger]) {
this._trigger.removeEventListener(item, function (e) {
return _this5.eventHandler(e);
});
}
},
setOptions: function setOptions() {
if (this._tether) {
this._tether.setOptions(this.getTetherOptions());
}
},
showPopover: function showPopover() {
var _this6 = this;
clearTimeout(this._timeout);
if (!this._tether) {
this._tether = new _tether2.default(this.getTetherOptions());
}
this._popover.style.display = 'block';
this.refreshPosition();
this.$nextTick(function () {
_this6.classState = true;
});
},
togglePopover: function togglePopover(newShowState) {
this.$emit('showChange', newShowState);
if (newShowState) {
this.showPopover();
this.$root.$emit('shown::popover');
} else {
this.hidePopover();
this.$root.$emit('hidden::popover');
}
},
updateListeners: function updateListeners(triggers) {
var _this7 = this;
var appliedTriggers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var newTriggers = [];
var removeTriggers = [];
triggers.forEach(function (item) {
if (appliedTriggers.indexOf(item) === -1) {
newTriggers.push(item);
}
});
appliedTriggers.forEach(function (item) {
if (triggers.indexOf(item) === -1) {
removeTriggers.push(item);
}
});
newTriggers.forEach(function (item) {
return _this7.addListener(item);
});
removeTriggers.forEach(function (item) {
return _this7.removeListener(item);
});
}
},
created: function created() {
var _this8 = this;
this.$root.$on('hide::popover', function () {
_this8.triggerState = false;
});
},
mounted: function mounted() {
this._trigger = this.$refs.trigger.children[0] || this.$refs.trigger;
this._popover = this.$refs.popover;
this._popover.style.display = 'none';
this._timeout = 0;
this.updateListeners(this.normalizedTriggers);
if (this.showState) {
this.showPopover();
}
},
updated: function updated() {
this.refreshPosition();
},
beforeDestroy: function beforeDestroy() {
var _this9 = this;
this.normalizedTriggers.forEach(function (item) {
return _this9.removeListener(item);
});
clearTimeout(this._timeout);
this.destroyTether();
}
};
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof2 = __webpack_require__(30);
var _typeof3 = _interopRequireDefault(_typeof2);
var _assign = __webpack_require__(43);
var _assign2 = _interopRequireDefault(_assign);
var _popover = __webpack_require__(81);
var _popover2 = _interopRequireDefault(_popover);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var messagesDefault = {
title: 'Are you sure?',
yes: 'Yes',
no: 'No'
};
exports.default = {
components: {
bPopover: _popover2.default
},
data: function data() {
return {
target: null,
allow: false,
localFocus: false,
confirmationAttributes: {}
};
},
props: {
buttonSize: {
type: String,
default: "",
validator: function validator(value) {
return ['lg', '', 'sm'].includes(value);
}
},
copyAttributes: {
type: [String, Array],
default: function _default() {
return ['href', 'target'];
}
},
disabled: {
type: Boolean,
default: false
},
messages: {
type: Object,
default: function _default() {
return messagesDefault;
}
},
noClass: {
type: [String, Array, Object],
default: "btn btn-secondary"
},
noIcon: {
type: [String, Array, Object],
default: "fa fa-times"
},
placement: {
type: String,
default: 'top'
},
yesClass: {
type: [String, Array, Object],
default: "btn btn-primary"
},
yesIcon: {
type: [String, Array, Object],
default: "fa fa-check"
}
},
computed: {
buttonSizeClass: function buttonSizeClass() {
return this.buttonSize ? 'btn-' + this.buttonSize : '';
},
groupFocus: function groupFocus() {
return Boolean(this.localFocus) !== false;
},
messagesMerged: function messagesMerged() {
return (0, _assign2.default)({}, messagesDefault, this.messages);
}
},
watch: {
copyAttributes: function copyAttributes(newValue) {
this.updateConfirmAttributes(newValue);
},
groupFocus: function groupFocus(newValue, oldValue) {
var _this = this;
if (oldValue && !newValue) {
clearTimeout(this._groupFocusTimer);
this._groupFocusTimer = setTimeout(function () {
if (!_this.groupFocus) {
_this.target = null;
}
}, 20);
}
}
},
methods: {
cancelEvent: function cancelEvent() {
this.target = null;
},
clearFocus: function clearFocus(e) {
this.localFocus = false;
},
confirmEvent: function confirmEvent() {
if (this.target !== null) {
this.allow = true;
var mouseClick = new MouseEvent('click', {
bubbles: true,
cancelable: true,
composed: true
});
if (!this.target.dispatchEvent(mouseClick)) console.error('Confirmed event failed to dispatch');
this.allow = false;
}
this.cancelEvent();
},
interceptEvent: function interceptEvent(e) {
if (this.disabled) {
return;
}
if (this.target === null) {
this.target = e.target;
}
this.setFocusOnButtonYes();
if (!this.allow) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
}
},
setFocus: function setFocus(focusName, e) {
this.localFocus = focusName;
},
setFocusOnButtonYes: function setFocusOnButtonYes() {
var _this2 = this;
this.$nextTick(function () {
_this2.$refs.buttonYes.focus();
});
},
updateConfirmAttributes: function updateConfirmAttributes(copyAttributes) {
var _this3 = this;
if ((0, _typeof3.default)(this._trigger) !== 'object') return {};
var attributeValuesArray = typeof copyAttributes === 'string' ? copyAttributes.split(' ') : copyAttributes;
var attributesList = {};
attributeValuesArray.forEach(function (attribute) {
if (_this3._trigger.hasAttribute(attribute)) attributesList[attribute] = _this3._trigger.getAttribute(attribute);
});
this.confirmationAttributes = attributesList;
}
},
mounted: function mounted() {
this._trigger = this.$refs.trigger.children[0];
this.updateConfirmAttributes(this.copyAttributes);
},
beforeDestroy: function beforeDestroy() {
clearTimeout(this._groupFocusTimer);
this._groupFocusTimer = null;
}
};
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(47), __esModule: true };
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(48), __esModule: true };
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(49), __esModule: true };
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(50), __esModule: true };
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(72);
module.exports = __webpack_require__(4).Object.assign;
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(73);
module.exports = __webpack_require__(4).Object.keys;
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(76);
__webpack_require__(74);
__webpack_require__(77);
__webpack_require__(78);
module.exports = __webpack_require__(4).Symbol;
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(75);
__webpack_require__(79);
module.exports = __webpack_require__(29).f('iterator');
/***/ }),
/* 51 */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 52 */
/***/ (function(module, exports) {
module.exports = function () { /* empty */ };
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(3);
var toLength = __webpack_require__(70);
var toAbsoluteIndex = __webpack_require__(69);
module.exports = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(51);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(9);
var gOPS = __webpack_require__(21);
var pIE = __webpack_require__(14);
module.exports = function (it) {
var result = getKeys(it);
var getSymbols = gOPS.f;
if (getSymbols) {
var symbols = getSymbols(it);
var isEnum = pIE.f;
var i = 0;
var key;
while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
} return result;
};
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
var document = __webpack_require__(1).document;
module.exports = document && document.documentElement;
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(31);
module.exports = Array.isArray || function isArray(arg) {
return cof(arg) == 'Array';
};
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(36);
var descriptor = __webpack_require__(15);
var setToStringTag = __webpack_require__(22);
var IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(7)(IteratorPrototype, __webpack_require__(10)('iterator'), function () { return this; });
module.exports = function (Constructor, NAME, next) {
Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ }),
/* 59 */
/***/ (function(module, exports) {
module.exports = function (done, value) {
return { value: value, done: !!done };
};
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(9);
var toIObject = __webpack_require__(3);
module.exports = function (object, el) {
var O = toIObject(object);
var keys = getKeys(O);
var length = keys.length;
var index = 0;
var key;
while (length > index) if (O[key = keys[index++]] === el) return key;
};
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
var META = __webpack_require__(16)('meta');
var isObject = __webpack_require__(13);
var has = __webpack_require__(2);
var setDesc = __webpack_require__(8).f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
return true;
};
var FREEZE = !__webpack_require__(6)(function () {
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
setDesc(it, META, { value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
} });
};
var fastKey = function (it, create) {
// return primitive with prefix
if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return 'F';
// not necessary to add metadata
if (!create) return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function (it, create) {
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return true;
// not necessary to add metadata
if (!create) return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(9);
var gOPS = __webpack_require__(21);
var pIE = __webpack_require__(14);
var toObject = __webpack_require__(26);
var IObject = __webpack_require__(34);
var $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(6)(function () {
var A = {};
var B = {};
// eslint-disable-next-line no-undef
var S = Symbol();
var K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function (k) { B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
var T = toObject(target);
var aLen = arguments.length;
var index = 1;
var getSymbols = gOPS.f;
var isEnum = pIE.f;
while (aLen > index) {
var S = IObject(arguments[index++]);
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
var length = keys.length;
var j = 0;
var key;
while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
} return T;
} : $assign;
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(8);
var anObject = __webpack_require__(11);
var getKeys = __webpack_require__(9);
module.exports = __webpack_require__(5) ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = getKeys(Properties);
var length = keys.length;
var i = 0;
var P;
while (length > i) dP.f(O, P = keys[i++], Properties[P]);
return O;
};
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(14);
var createDesc = __webpack_require__(15);
var toIObject = __webpack_require__(3);
var toPrimitive = __webpack_require__(27);
var has = __webpack_require__(2);
var IE8_DOM_DEFINE = __webpack_require__(33);
var gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(5) ? gOPD : function getOwnPropertyDescriptor(O, P) {
O = toIObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return gOPD(O, P);
} catch (e) { /* empty */ }
if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(3);
var gOPN = __webpack_require__(37).f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return gOPN(it);
} catch (e) {
return windowNames.slice();
}
};
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(2);
var toObject = __webpack_require__(26);
var IE_PROTO = __webpack_require__(23)('IE_PROTO');
var ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function (O) {
O = toObject(O);
if (has(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(12);
var core = __webpack_require__(4);
var fails = __webpack_require__(6);
module.exports = function (KEY, exec) {
var fn = (core.Object || {})[KEY] || Object[KEY];
var exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
};
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(25);
var defined = __webpack_require__(17);
// true -> String#at
// false -> String#codePointAt
module.exports = function (TO_STRING) {
return function (that, pos) {
var s = String(defined(that));
var i = toInteger(pos);
var l = s.length;
var a, b;
if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(25);
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(25);
var min = Math.min;
module.exports = function (it) {
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(52);
var step = __webpack_require__(59);
var Iterators = __webpack_require__(19);
var toIObject = __webpack_require__(3);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(35)(Array, 'Array', function (iterated, kind) {
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function () {
var O = this._t;
var kind = this._k;
var index = this._i++;
if (!O || index >= O.length) {
this._t = undefined;
return step(1);
}
if (kind == 'keys') return step(0, index);
if (kind == 'values') return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(12);
$export($export.S + $export.F, 'Object', { assign: __webpack_require__(62) });
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(26);
var $keys = __webpack_require__(9);
__webpack_require__(67)('keys', function () {
return function keys(it) {
return $keys(toObject(it));
};
});
/***/ }),
/* 74 */
/***/ (function(module, exports) {
/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(68)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(35)(String, 'String', function (iterated) {
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
var O = this._t;
var index = this._i;
var point;
if (index >= O.length) return { value: undefined, done: true };
point = $at(O, index);
this._i += point.length;
return { value: point, done: false };
});
/***/ }),
/* 76 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var global = __webpack_require__(1);
var has = __webpack_require__(2);
var DESCRIPTORS = __webpack_require__(5);
var $export = __webpack_require__(12);
var redefine = __webpack_require__(39);
var META = __webpack_require__(61).KEY;
var $fails = __webpack_require__(6);
var shared = __webpack_require__(24);
var setToStringTag = __webpack_require__(22);
var uid = __webpack_require__(16);
var wks = __webpack_require__(10);
var wksExt = __webpack_require__(29);
var wksDefine = __webpack_require__(28);
var keyOf = __webpack_require__(60);
var enumKeys = __webpack_require__(55);
var isArray = __webpack_require__(57);
var anObject = __webpack_require__(11);
var toIObject = __webpack_require__(3);
var toPrimitive = __webpack_require__(27);
var createDesc = __webpack_require__(15);
var _create = __webpack_require__(36);
var gOPNExt = __webpack_require__(65);
var $GOPD = __webpack_require__(64);
var $DP = __webpack_require__(8);
var $keys = __webpack_require__(9);
var gOPD = $GOPD.f;
var dP = $DP.f;
var gOPN = gOPNExt.f;
var $Symbol = global.Symbol;
var $JSON = global.JSON;
var _stringify = $JSON && $JSON.stringify;
var PROTOTYPE = 'prototype';
var HIDDEN = wks('_hidden');
var TO_PRIMITIVE = wks('toPrimitive');
var isEnum = {}.propertyIsEnumerable;
var SymbolRegistry = shared('symbol-registry');
var AllSymbols = shared('symbols');
var OPSymbols = shared('op-symbols');
var ObjectProto = Object[PROTOTYPE];
var USE_NATIVE = typeof $Symbol == 'function';
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function () {
return _create(dP({}, 'a', {
get: function () { return dP(this, 'a', { value: 7 }).a; }
})).a != 7;
}) ? function (it, key, D) {
var protoDesc = gOPD(ObjectProto, key);
if (protoDesc) delete ObjectProto[key];
dP(it, key, D);
if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
} : dP;
var wrap = function (tag) {
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
sym._k = tag;
return sym;
};
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
return typeof it == 'symbol';
} : function (it) {
return it instanceof $Symbol;
};
var $defineProperty = function defineProperty(it, key, D) {
if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
anObject(it);
key = toPrimitive(key, true);
anObject(D);
if (has(AllSymbols, key)) {
if (!D.enumerable) {
if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
D = _create(D, { enumerable: createDesc(0, false) });
} return setSymbolDesc(it, key, D);
} return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P) {
anObject(it);
var keys = enumKeys(P = toIObject(P));
var i = 0;
var l = keys.length;
var key;
while (l > i) $defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P) {
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key) {
var E = isEnum.call(this, key = toPrimitive(key, true));
if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
it = toIObject(it);
key = toPrimitive(key, true);
if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
var D = gOPD(it, key);
if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it) {
var names = gOPN(toIObject(it));
var result = [];
var i = 0;
var key;
while (names.length > i) {
if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
} return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
var IS_OP = it === ObjectProto;
var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
var result = [];
var i = 0;
var key;
while (names.length > i) {
if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
} return result;
};
// 19.4.1.1 Symbol([description])
if (!USE_NATIVE) {
$Symbol = function Symbol() {
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
var $set = function (value) {
if (this === ObjectProto) $set.call(OPSymbols, value);
if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
};
if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
return wrap(tag);
};
redefine($Symbol[PROTOTYPE], 'toString', function toString() {
return this._k;
});
$GOPD.f = $getOwnPropertyDescriptor;
$DP.f = $defineProperty;
__webpack_require__(37).f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(14).f = $propertyIsEnumerable;
__webpack_require__(21).f = $getOwnPropertySymbols;
if (DESCRIPTORS && !__webpack_require__(20)) {
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
wksExt.f = function (name) {
return wrap(wks(name));
};
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
for (var es6Symbols = (
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
// 19.4.2.1 Symbol.for(key)
'for': function (key) {
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key) {
if (isSymbol(key)) return keyOf(SymbolRegistry, key);
throw TypeError(key + ' is not a symbol!');
},
useSetter: function () { setter = true; },
useSimple: function () { setter = false; }
});
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
stringify: function stringify(it) {
if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
var args = [it];
var i = 1;
var replacer, $replacer;
while (arguments.length > i) args.push(arguments[i++]);
replacer = args[1];
if (typeof replacer == 'function') $replacer = replacer;
if ($replacer || !isArray(replacer)) replacer = function (key, value) {
if ($replacer) value = $replacer.call(this, key, value);
if (!isSymbol(value)) return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
}
});
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(7)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(28)('asyncIterator');
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(28)('observable');
/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(71);
var global = __webpack_require__(1);
var hide = __webpack_require__(7);
var Iterators = __webpack_require__(19);
var TO_STRING_TAG = __webpack_require__(10)('toStringTag');
var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
'TextTrackList,TouchList').split(',');
for (var i = 0; i < DOMIterables.length; i++) {
var NAME = DOMIterables[i];
var Collection = global[NAME];
var proto = Collection && Collection.prototype;
if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
Iterators[NAME] = Iterators.Array;
}
/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! tether 1.4.0 */
(function(root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
module.exports = factory(require, exports, module);
} else {
root.Tether = factory();
}
}(this, function(require, exports, module) {
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var TetherBase = undefined;
if (typeof TetherBase === 'undefined') {
TetherBase = { modules: [] };
}
var zeroElement = null;
// Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
// if the element lies within a nested document (<frame> or <iframe>-like).
function getActualBoundingClientRect(node) {
var boundingRect = node.getBoundingClientRect();
// The original object returned by getBoundingClientRect is immutable, so we clone it
// We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
var rect = {};
for (var k in boundingRect) {
rect[k] = boundingRect[k];
}
if (node.ownerDocument !== document) {
var _frameElement = node.ownerDocument.defaultView.frameElement;
if (_frameElement) {
var frameRect = getActualBoundingClientRect(_frameElement);
rect.top += frameRect.top;
rect.bottom += frameRect.top;
rect.left += frameRect.left;
rect.right += frameRect.left;
}
}
return rect;
}
function getScrollParents(el) {
// In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var computedStyle = getComputedStyle(el) || {};
var position = computedStyle.position;
var parents = [];
if (position === 'fixed') {
return [el];
}
var parent = el;
while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
var style = undefined;
try {
style = getComputedStyle(parent);
} catch (err) {}
if (typeof style === 'undefined' || style === null) {
parents.push(parent);
return parents;
}
var _style = style;
var overflow = _style.overflow;
var overflowX = _style.overflowX;
var overflowY = _style.overflowY;
if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
parents.push(parent);
}
}
}
parents.push(el.ownerDocument.body);
// If the node is within a frame, account for the parent window scroll
if (el.ownerDocument !== document) {
parents.push(el.ownerDocument.defaultView);
}
return parents;
}
var uniqueId = (function () {
var id = 0;
return function () {
return ++id;
};
})();
var zeroPosCache = {};
var getOrigin = function getOrigin() {
// getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
// jitter as the user scrolls that messes with our ability to detect if two positions
// are equivilant or not. We place an element at the top left of the page that will
// get the same jitter, so we can cancel the two out.
var node = zeroElement;
if (!node || !document.body.contains(node)) {
node = document.createElement('div');
node.setAttribute('data-tether-id', uniqueId());
extend(node.style, {
top: 0,
left: 0,
position: 'absolute'
});
document.body.appendChild(node);
zeroElement = node;
}
var id = node.getAttribute('data-tether-id');
if (typeof zeroPosCache[id] === 'undefined') {
zeroPosCache[id] = getActualBoundingClientRect(node);
// Clear the cache when this position call is done
defer(function () {
delete zeroPosCache[id];
});
}
return zeroPosCache[id];
};
function removeUtilElements() {
if (zeroElement) {
document.body.removeChild(zeroElement);
}
zeroElement = null;
};
function getBounds(el) {
var doc = undefined;
if (el === document) {
doc = document;
el = document.documentElement;
} else {
doc = el.ownerDocument;
}
var docEl = doc.documentElement;
var box = getActualBoundingClientRect(el);
var origin = getOrigin();
box.top -= origin.top;
box.left -= origin.left;
if (typeof box.width === 'undefined') {
box.width = document.body.scrollWidth - box.left - box.right;
}
if (typeof box.height === 'undefined') {
box.height = document.body.scrollHeight - box.top - box.bottom;
}
box.top = box.top - docEl.clientTop;
box.left = box.left - docEl.clientLeft;
box.right = doc.body.clientWidth - box.width - box.left;
box.bottom = doc.body.clientHeight - box.height - box.top;
return box;
}
function getOffsetParent(el) {
return el.offsetParent || document.documentElement;
}
var _scrollBarSize = null;
function getScrollBarSize() {
if (_scrollBarSize) {
return _scrollBarSize;
}
var inner = document.createElement('div');
inner.style.width = '100%';
inner.style.height = '200px';
var outer = document.createElement('div');
extend(outer.style, {
position: 'absolute',
top: 0,
left: 0,
pointerEvents: 'none',
visibility: 'hidden',
width: '200px',
height: '150px',
overflow: 'hidden'
});
outer.appendChild(inner);
document.body.appendChild(outer);
var widthContained = inner.offsetWidth;
outer.style.overflow = 'scroll';
var widthScroll = inner.offsetWidth;
if (widthContained === widthScroll) {
widthScroll = outer.clientWidth;
}
document.body.removeChild(outer);
var width = widthContained - widthScroll;
_scrollBarSize = { width: width, height: width };
return _scrollBarSize;
}
function extend() {
var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var args = [];
Array.prototype.push.apply(args, arguments);
args.slice(1).forEach(function (obj) {
if (obj) {
for (var key in obj) {
if (({}).hasOwnProperty.call(obj, key)) {
out[key] = obj[key];
}
}
}
});
return out;
}
function removeClass(el, name) {
if (typeof el.classList !== 'undefined') {
name.split(' ').forEach(function (cls) {
if (cls.trim()) {
el.classList.remove(cls);
}
});
} else {
var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
var className = getClassName(el).replace(regex, ' ');
setClassName(el, className);
}
}
function addClass(el, name) {
if (typeof el.classList !== 'undefined') {
name.split(' ').forEach(function (cls) {
if (cls.trim()) {
el.classList.add(cls);
}
});
} else {
removeClass(el, name);
var cls = getClassName(el) + (' ' + name);
setClassName(el, cls);
}
}
function hasClass(el, name) {
if (typeof el.classList !== 'undefined') {
return el.classList.contains(name);
}
var className = getClassName(el);
return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
}
function getClassName(el) {
// Can't use just SVGAnimatedString here since nodes within a Frame in IE have
// completely separately SVGAnimatedString base classes
if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
return el.className.baseVal;
}
return el.className;
}
function setClassName(el, className) {
el.setAttribute('class', className);
}
function updateClasses(el, add, all) {
// Of the set of 'all' classes, we need the 'add' classes, and only the
// 'add' classes to be set.
all.forEach(function (cls) {
if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
removeClass(el, cls);
}
});
add.forEach(function (cls) {
if (!hasClass(el, cls)) {
addClass(el, cls);
}
});
}
var deferred = [];
var defer = function defer(fn) {
deferred.push(fn);
};
var flush = function flush() {
var fn = undefined;
while (fn = deferred.pop()) {
fn();
}
};
var Evented = (function () {
function Evented() {
_classCallCheck(this, Evented);
}
_createClass(Evented, [{
key: 'on',
value: function on(event, handler, ctx) {
var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
if (typeof this.bindings === 'undefined') {
this.bindings = {};
}
if (typeof this.bindings[event] === 'undefined') {
this.bindings[event] = [];
}
this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
}
}, {
key: 'once',
value: function once(event, handler, ctx) {
this.on(event, handler, ctx, true);
}
}, {
key: 'off',
value: function off(event, handler) {
if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
return;
}
if (typeof handler === 'undefined') {
delete this.bindings[event];
} else {
var i = 0;
while (i < this.bindings[event].length) {
if (this.bindings[event][i].handler === handler) {
this.bindings[event].splice(i, 1);
} else {
++i;
}
}
}
}
}, {
key: 'trigger',
value: function trigger(event) {
if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
var i = 0;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
while (i < this.bindings[event].length) {
var _bindings$event$i = this.bindings[event][i];
var handler = _bindings$event$i.handler;
var ctx = _bindings$event$i.ctx;
var once = _bindings$event$i.once;
var context = ctx;
if (typeof context === 'undefined') {
context = this;
}
handler.apply(context, args);
if (once) {
this.bindings[event].splice(i, 1);
} else {
++i;
}
}
}
}
}]);
return Evented;
})();
TetherBase.Utils = {
getActualBoundingClientRect: getActualBoundingClientRect,
getScrollParents: getScrollParents,
getBounds: getBounds,
getOffsetParent: getOffsetParent,
extend: extend,
addClass: addClass,
removeClass: removeClass,
hasClass: hasClass,
updateClasses: updateClasses,
defer: defer,
flush: flush,
uniqueId: uniqueId,
Evented: Evented,
getScrollBarSize: getScrollBarSize,
removeUtilElements: removeUtilElements
};
/* globals TetherBase, performance */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
if (typeof TetherBase === 'undefined') {
throw new Error('You must include the utils.js file before tether.js');
}
var _TetherBase$Utils = TetherBase.Utils;
var getScrollParents = _TetherBase$Utils.getScrollParents;
var getBounds = _TetherBase$Utils.getBounds;
var getOffsetParent = _TetherBase$Utils.getOffsetParent;
var extend = _TetherBase$Utils.extend;
var addClass = _TetherBase$Utils.addClass;
var removeClass = _TetherBase$Utils.removeClass;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
var flush = _TetherBase$Utils.flush;
var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
var removeUtilElements = _TetherBase$Utils.removeUtilElements;
function within(a, b) {
var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
return a + diff >= b && b >= a - diff;
}
var transformKey = (function () {
if (typeof document === 'undefined') {
return '';
}
var el = document.createElement('div');
var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
for (var i = 0; i < transforms.length; ++i) {
var key = transforms[i];
if (el.style[key] !== undefined) {
return key;
}
}
})();
var tethers = [];
var position = function position() {
tethers.forEach(function (tether) {
tether.position(false);
});
flush();
};
function now() {
if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
return performance.now();
}
return +new Date();
}
(function () {
var lastCall = null;
var lastDuration = null;
var pendingTimeout = null;
var tick = function tick() {
if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
// We voluntarily throttle ourselves if we can't manage 60fps
lastDuration = Math.min(lastDuration - 16, 250);
// Just in case this is the last event, remember to position just once more
pendingTimeout = setTimeout(tick, 250);
return;
}
if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
// Some browsers call events a little too frequently, refuse to run more than is reasonable
return;
}
if (pendingTimeout != null) {
clearTimeout(pendingTimeout);
pendingTimeout = null;
}
lastCall = now();
position();
lastDuration = now() - lastCall;
};
if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
['resize', 'scroll', 'touchmove'].forEach(function (event) {
window.addEventListener(event, tick);
});
}
})();
var MIRROR_LR = {
center: 'center',
left: 'right',
right: 'left'
};
var MIRROR_TB = {
middle: 'middle',
top: 'bottom',
bottom: 'top'
};
var OFFSET_MAP = {
top: 0,
left: 0,
middle: '50%',
center: '50%',
bottom: '100%',
right: '100%'
};
var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
var left = attachment.left;
var top = attachment.top;
if (left === 'auto') {
left = MIRROR_LR[relativeToAttachment.left];
}
if (top === 'auto') {
top = MIRROR_TB[relativeToAttachment.top];
}
return { left: left, top: top };
};
var attachmentToOffset = function attachmentToOffset(attachment) {
var left = attachment.left;
var top = attachment.top;
if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
left = OFFSET_MAP[attachment.left];
}
if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
top = OFFSET_MAP[attachment.top];
}
return { left: left, top: top };
};
function addOffset() {
var out = { top: 0, left: 0 };
for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
offsets[_key] = arguments[_key];
}
offsets.forEach(function (_ref) {
var top = _ref.top;
var left = _ref.left;
if (typeof top === 'string') {
top = parseFloat(top, 10);
}
if (typeof left === 'string') {
left = parseFloat(left, 10);
}
out.top += top;
out.left += left;
});
return out;
}
function offsetToPx(offset, size) {
if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
offset.left = parseFloat(offset.left, 10) / 100 * size.width;
}
if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
offset.top = parseFloat(offset.top, 10) / 100 * size.height;
}
return offset;
}
var parseOffset = function parseOffset(value) {
var _value$split = value.split(' ');
var _value$split2 = _slicedToArray(_value$split, 2);
var top = _value$split2[0];
var left = _value$split2[1];
return { top: top, left: left };
};
var parseAttachment = parseOffset;
var TetherClass = (function (_Evented) {
_inherits(TetherClass, _Evented);
function TetherClass(options) {
var _this = this;
_classCallCheck(this, TetherClass);
_get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
this.position = this.position.bind(this);
tethers.push(this);
this.history = [];
this.setOptions(options, false);
TetherBase.modules.forEach(function (module) {
if (typeof module.initialize !== 'undefined') {
module.initialize.call(_this);
}
});
this.position();
}
_createClass(TetherClass, [{
key: 'getClass',
value: function getClass() {
var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
var classes = this.options.classes;
if (typeof classes !== 'undefined' && classes[key]) {
return this.options.classes[key];
} else if (this.options.classPrefix) {
return this.options.classPrefix + '-' + key;
} else {
return key;
}
}
}, {
key: 'setOptions',
value: function setOptions(options) {
var _this2 = this;
var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
var defaults = {
offset: '0 0',
targetOffset: '0 0',
targetAttachment: 'auto auto',
classPrefix: 'tether'
};
this.options = extend(defaults, options);
var _options = this.options;
var element = _options.element;
var target = _options.target;
var targetModifier = _options.targetModifier;
this.element = element;
this.target = target;
this.targetModifier = targetModifier;
if (this.target === 'viewport') {
this.target = document.body;
this.targetModifier = 'visible';
} else if (this.target === 'scroll-handle') {
this.target = document.body;
this.targetModifier = 'scroll-handle';
}
['element', 'target'].forEach(function (key) {
if (typeof _this2[key] === 'undefined') {
throw new Error('Tether Error: Both element and target must be defined');
}
if (typeof _this2[key].jquery !== 'undefined') {
_this2[key] = _this2[key][0];
} else if (typeof _this2[key] === 'string') {
_this2[key] = document.querySelector(_this2[key]);
}
});
addClass(this.element, this.getClass('element'));
if (!(this.options.addTargetClasses === false)) {
addClass(this.target, this.getClass('target'));
}
if (!this.options.attachment) {
throw new Error('Tether Error: You must provide an attachment');
}
this.targetAttachment = parseAttachment(this.options.targetAttachment);
this.attachment = parseAttachment(this.options.attachment);
this.offset = parseOffset(this.options.offset);
this.targetOffset = parseOffset(this.options.targetOffset);
if (typeof this.scrollParents !== 'undefined') {
this.disable();
}
if (this.targetModifier === 'scroll-handle') {
this.scrollParents = [this.target];
} else {
this.scrollParents = getScrollParents(this.target);
}
if (!(this.options.enabled === false)) {
this.enable(pos);
}
}
}, {
key: 'getTargetBounds',
value: function getTargetBounds() {
if (typeof this.targetModifier !== 'undefined') {
if (this.targetModifier === 'visible') {
if (this.target === document.body) {
return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
} else {
var bounds = getBounds(this.target);
var out = {
height: bounds.height,
width: bounds.width,
top: bounds.top,
left: bounds.left
};
out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
out.height = Math.min(innerHeight, out.height);
out.height -= 2;
out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
out.width = Math.min(innerWidth, out.width);
out.width -= 2;
if (out.top < pageYOffset) {
out.top = pageYOffset;
}
if (out.left < pageXOffset) {
out.left = pageXOffset;
}
return out;
}
} else if (this.targetModifier === 'scroll-handle') {
var bounds = undefined;
var target = this.target;
if (target === document.body) {
target = document.documentElement;
bounds = {
left: pageXOffset,
top: pageYOffset,
height: innerHeight,
width: innerWidth
};
} else {
bounds = getBounds(target);
}
var style = getComputedStyle(target);
var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
var scrollBottom = 0;
if (hasBottomScroll) {
scrollBottom = 15;
}
var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
var out = {
width: 15,
height: height * 0.975 * (height / target.scrollHeight),
left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
};
var fitAdj = 0;
if (height < 408 && this.target === document.body) {
fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
}
if (this.target !== document.body) {
out.height = Math.max(out.height, 24);
}
var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
if (this.target === document.body) {
out.height = Math.max(out.height, 24);
}
return out;
}
} else {
return getBounds(this.target);
}
}
}, {
key: 'clearCache',
value: function clearCache() {
this._cache = {};
}
}, {
key: 'cache',
value: function cache(k, getter) {
// More than one module will often need the same DOM info, so
// we keep a cache which is cleared on each position call
if (typeof this._cache === 'undefined') {
this._cache = {};
}
if (typeof this._cache[k] === 'undefined') {
this._cache[k] = getter.call(this);
}
return this._cache[k];
}
}, {
key: 'enable',
value: function enable() {
var _this3 = this;
var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
if (!(this.options.addTargetClasses === false)) {
addClass(this.target, this.getClass('enabled'));
}
addClass(this.element, this.getClass('enabled'));
this.enabled = true;
this.scrollParents.forEach(function (parent) {
if (parent !== _this3.target.ownerDocument) {
parent.addEventListener('scroll', _this3.position);
}
});
if (pos) {
this.position();
}
}
}, {
key: 'disable',
value: function disable() {
var _this4 = this;
removeClass(this.target, this.getClass('enabled'));
removeClass(this.element, this.getClass('enabled'));
this.enabled = false;
if (typeof this.scrollParents !== 'undefined') {
this.scrollParents.forEach(function (parent) {
parent.removeEventListener('scroll', _this4.position);
});
}
}
}, {
key: 'destroy',
value: function destroy() {
var _this5 = this;
this.disable();
tethers.forEach(function (tether, i) {
if (tether === _this5) {
tethers.splice(i, 1);
}
});
// Remove any elements we were using for convenience from the DOM
if (tethers.length === 0) {
removeUtilElements();
}
}
}, {
key: 'updateAttachClasses',
value: function updateAttachClasses(elementAttach, targetAttach) {
var _this6 = this;
elementAttach = elementAttach || this.attachment;
targetAttach = targetAttach || this.targetAttachment;
var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
// updateAttachClasses can be called more than once in a position call, so
// we need to clean up after ourselves such that when the last defer gets
// ran it doesn't add any extra classes from previous calls.
this._addAttachClasses.splice(0, this._addAttachClasses.length);
}
if (typeof this._addAttachClasses === 'undefined') {
this._addAttachClasses = [];
}
var add = this._addAttachClasses;
if (elementAttach.top) {
add.push(this.getClass('element-attached') + '-' + elementAttach.top);
}
if (elementAttach.left) {
add.push(this.getClass('element-attached') + '-' + elementAttach.left);
}
if (targetAttach.top) {
add.push(this.getClass('target-attached') + '-' + targetAttach.top);
}
if (targetAttach.left) {
add.push(this.getClass('target-attached') + '-' + targetAttach.left);
}
var all = [];
sides.forEach(function (side) {
all.push(_this6.getClass('element-attached') + '-' + side);
all.push(_this6.getClass('target-attached') + '-' + side);
});
defer(function () {
if (!(typeof _this6._addAttachClasses !== 'undefined')) {
return;
}
updateClasses(_this6.element, _this6._addAttachClasses, all);
if (!(_this6.options.addTargetClasses === false)) {
updateClasses(_this6.target, _this6._addAttachClasses, all);
}
delete _this6._addAttachClasses;
});
}
}, {
key: 'position',
value: function position() {
var _this7 = this;
var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
// flushChanges commits the changes immediately, leave true unless you are positioning multiple
// tethers (in which case call Tether.Utils.flush yourself when you're done)
if (!this.enabled) {
return;
}
this.clearCache();
// Turn 'auto' attachments into the appropriate corner or edge
var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
this.updateAttachClasses(this.attachment, targetAttachment);
var elementPos = this.cache('element-bounds', function () {
return getBounds(_this7.element);
});
var width = elementPos.width;
var height = elementPos.height;
if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
var _lastSize = this.lastSize;
// We cache the height and width to make it possible to position elements that are
// getting hidden.
width = _lastSize.width;
height = _lastSize.height;
} else {
this.lastSize = { width: width, height: height };
}
var targetPos = this.cache('target-bounds', function () {
return _this7.getTargetBounds();
});
var targetSize = targetPos;
// Get an actual px offset from the attachment
var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
var manualOffset = offsetToPx(this.offset, { width: width, height: height });
var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
// Add the manually provided offset
offset = addOffset(offset, manualOffset);
targetOffset = addOffset(targetOffset, manualTargetOffset);
// It's now our goal to make (element position + offset) == (target position + target offset)
var left = targetPos.left + targetOffset.left - offset.left;
var top = targetPos.top + targetOffset.top - offset.top;
for (var i = 0; i < TetherBase.modules.length; ++i) {
var _module2 = TetherBase.modules[i];
var ret = _module2.position.call(this, {
left: left,
top: top,
targetAttachment: targetAttachment,
targetPos: targetPos,
elementPos: elementPos,
offset: offset,
targetOffset: targetOffset,
manualOffset: manualOffset,
manualTargetOffset: manualTargetOffset,
scrollbarSize: scrollbarSize,
attachment: this.attachment
});
if (ret === false) {
return false;
} else if (typeof ret === 'undefined' || typeof ret !== 'object') {
continue;
} else {
top = ret.top;
left = ret.left;
}
}
// We describe the position three different ways to give the optimizer
// a chance to decide the best possible way to position the element
// with the fewest repaints.
var next = {
// It's position relative to the page (absolute positioning when
// the element is a child of the body)
page: {
top: top,
left: left
},
// It's position relative to the viewport (fixed positioning)
viewport: {
top: top - pageYOffset,
bottom: pageYOffset - top - height + innerHeight,
left: left - pageXOffset,
right: pageXOffset - left - width + innerWidth
}
};
var doc = this.target.ownerDocument;
var win = doc.defaultView;
var scrollbarSize = undefined;
if (win.innerHeight > doc.documentElement.clientHeight) {
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
next.viewport.bottom -= scrollbarSize.height;
}
if (win.innerWidth > doc.documentElement.clientWidth) {
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
next.viewport.right -= scrollbarSize.width;
}
if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
// Absolute positioning in the body will be relative to the page, not the 'initial containing block'
next.page.bottom = doc.body.scrollHeight - top - height;
next.page.right = doc.body.scrollWidth - left - width;
}
if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
(function () {
var offsetParent = _this7.cache('target-offsetparent', function () {
return getOffsetParent(_this7.target);
});
var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
return getBounds(offsetParent);
});
var offsetParentStyle = getComputedStyle(offsetParent);
var offsetParentSize = offsetPosition;
var offsetBorder = {};
['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
});
offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
// We're within the visible part of the target's scroll parent
var scrollTop = offsetParent.scrollTop;
var scrollLeft = offsetParent.scrollLeft;
// It's position relative to the target's offset parent (absolute positioning when
// the element is moved to be a child of the target's offset parent).
next.offset = {
top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
};
}
}
})();
}
// We could also travel up the DOM and try each containing context, rather than only
// looking at the body, but we're gonna get diminishing returns.
this.move(next);
this.history.unshift(next);
if (this.history.length > 3) {
this.history.pop();
}
if (flushChanges) {
flush();
}
return true;
}
// THE ISSUE
}, {
key: 'move',
value: function move(pos) {
var _this8 = this;
if (!(typeof this.element.parentNode !== 'undefined')) {
return;
}
var same = {};
for (var type in pos) {
same[type] = {};
for (var key in pos[type]) {
var found = false;
for (var i = 0; i < this.history.length; ++i) {
var point = this.history[i];
if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
found = true;
break;
}
}
if (!found) {
same[type][key] = true;
}
}
}
var css = { top: '', left: '', right: '', bottom: '' };
var transcribe = function transcribe(_same, _pos) {
var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
if (gpu !== false) {
var yPos = undefined,
xPos = undefined;
if (_same.top) {
css.top = 0;
yPos = _pos.top;
} else {
css.bottom = 0;
yPos = -_pos.bottom;
}
if (_same.left) {
css.left = 0;
xPos = _pos.left;
} else {
css.right = 0;
xPos = -_pos.right;
}
if (window.matchMedia) {
// HubSpot/tether#207
var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
if (!retina) {
xPos = Math.round(xPos);
yPos = Math.round(yPos);
}
}
css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
if (transformKey !== 'msTransform') {
// The Z transform will keep this in the GPU (faster, and prevents artifacts),
// but IE9 doesn't support 3d transforms and will choke.
css[transformKey] += " translateZ(0)";
}
} else {
if (_same.top) {
css.top = _pos.top + 'px';
} else {
css.bottom = _pos.bottom + 'px';
}
if (_same.left) {
css.left = _pos.left + 'px';
} else {
css.right = _pos.right + 'px';
}
}
};
var moved = false;
if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
css.position = 'absolute';
transcribe(same.page, pos.page);
} else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
css.position = 'fixed';
transcribe(same.viewport, pos.viewport);
} else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
(function () {
css.position = 'absolute';
var offsetParent = _this8.cache('target-offsetparent', function () {
return getOffsetParent(_this8.target);
});
if (getOffsetParent(_this8.element) !== offsetParent) {
defer(function () {
_this8.element.parentNode.removeChild(_this8.element);
offsetParent.appendChild(_this8.element);
});
}
transcribe(same.offset, pos.offset);
moved = true;
})();
} else {
css.position = 'absolute';
transcribe({ top: true, left: true }, pos.page);
}
if (!moved) {
if (this.options.bodyElement) {
this.options.bodyElement.appendChild(this.element);
} else {
var offsetParentIsBody = true;
var currentNode = this.element.parentNode;
while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
if (getComputedStyle(currentNode).position !== 'static') {
offsetParentIsBody = false;
break;
}
currentNode = currentNode.parentNode;
}
if (!offsetParentIsBody) {
this.element.parentNode.removeChild(this.element);
this.element.ownerDocument.body.appendChild(this.element);
}
}
}
// Any css change will trigger a repaint, so let's avoid one if nothing changed
var writeCSS = {};
var write = false;
for (var key in css) {
var val = css[key];
var elVal = this.element.style[key];
if (elVal !== val) {
write = true;
writeCSS[key] = val;
}
}
if (write) {
defer(function () {
extend(_this8.element.style, writeCSS);
_this8.trigger('repositioned');
});
}
}
}]);
return TetherClass;
})(Evented);
TetherClass.modules = [];
TetherBase.position = position;
var Tether = extend(TetherClass, TetherBase);
/* globals TetherBase */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _TetherBase$Utils = TetherBase.Utils;
var getBounds = _TetherBase$Utils.getBounds;
var extend = _TetherBase$Utils.extend;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
function getBoundingRect(tether, to) {
if (to === 'scrollParent') {
to = tether.scrollParents[0];
} else if (to === 'window') {
to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
}
if (to === document) {
to = to.documentElement;
}
if (typeof to.nodeType !== 'undefined') {
(function () {
var node = to;
var size = getBounds(to);
var pos = size;
var style = getComputedStyle(to);
to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
// Account any parent Frames scroll offset
if (node.ownerDocument !== document) {
var win = node.ownerDocument.defaultView;
to[0] += win.pageXOffset;
to[1] += win.pageYOffset;
to[2] += win.pageXOffset;
to[3] += win.pageYOffset;
}
BOUNDS_FORMAT.forEach(function (side, i) {
side = side[0].toUpperCase() + side.substr(1);
if (side === 'Top' || side === 'Left') {
to[i] += parseFloat(style['border' + side + 'Width']);
} else {
to[i] -= parseFloat(style['border' + side + 'Width']);
}
});
})();
}
return to;
}
TetherBase.modules.push({
position: function position(_ref) {
var _this = this;
var top = _ref.top;
var left = _ref.left;
var targetAttachment = _ref.targetAttachment;
if (!this.options.constraints) {
return true;
}
var _cache = this.cache('element-bounds', function () {
return getBounds(_this.element);
});
var height = _cache.height;
var width = _cache.width;
if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
var _lastSize = this.lastSize;
// Handle the item getting hidden as a result of our positioning without glitching
// the classes in and out
width = _lastSize.width;
height = _lastSize.height;
}
var targetSize = this.cache('target-bounds', function () {
return _this.getTargetBounds();
});
var targetHeight = targetSize.height;
var targetWidth = targetSize.width;
var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
this.options.constraints.forEach(function (constraint) {
var outOfBoundsClass = constraint.outOfBoundsClass;
var pinnedClass = constraint.pinnedClass;
if (outOfBoundsClass) {
allClasses.push(outOfBoundsClass);
}
if (pinnedClass) {
allClasses.push(pinnedClass);
}
});
allClasses.forEach(function (cls) {
['left', 'top', 'right', 'bottom'].forEach(function (side) {
allClasses.push(cls + '-' + side);
});
});
var addClasses = [];
var tAttachment = extend({}, targetAttachment);
var eAttachment = extend({}, this.attachment);
this.options.constraints.forEach(function (constraint) {
var to = constraint.to;
var attachment = constraint.attachment;
var pin = constraint.pin;
if (typeof attachment === 'undefined') {
attachment = '';
}
var changeAttachX = undefined,
changeAttachY = undefined;
if (attachment.indexOf(' ') >= 0) {
var _attachment$split = attachment.split(' ');
var _attachment$split2 = _slicedToArray(_attachment$split, 2);
changeAttachY = _attachment$split2[0];
changeAttachX = _attachment$split2[1];
} else {
changeAttachX = changeAttachY = attachment;
}
var bounds = getBoundingRect(_this, to);
if (changeAttachY === 'target' || changeAttachY === 'both') {
if (top < bounds[1] && tAttachment.top === 'top') {
top += targetHeight;
tAttachment.top = 'bottom';
}
if (top + height > bounds[3] && tAttachment.top === 'bottom') {
top -= targetHeight;
tAttachment.top = 'top';
}
}
if (changeAttachY === 'together') {
if (tAttachment.top === 'top') {
if (eAttachment.top === 'bottom' && top < bounds[1]) {
top += targetHeight;
tAttachment.top = 'bottom';
top += height;
eAttachment.top = 'top';
} else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
top -= height - targetHeight;
tAttachment.top = 'bottom';
eAttachment.top = 'bottom';
}
}
if (tAttachment.top === 'bottom') {
if (eAttachment.top === 'top' && top + height > bounds[3]) {
top -= targetHeight;
tAttachment.top = 'top';
top -= height;
eAttachment.top = 'bottom';
} else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
top += height - targetHeight;
tAttachment.top = 'top';
eAttachment.top = 'top';
}
}
if (tAttachment.top === 'middle') {
if (top + height > bounds[3] && eAttachment.top === 'top') {
top -= height;
eAttachment.top = 'bottom';
} else if (top < bounds[1] && eAttachment.top === 'bottom') {
top += height;
eAttachment.top = 'top';
}
}
}
if (changeAttachX === 'target' || changeAttachX === 'both') {
if (left < bounds[0] && tAttachment.left === 'left') {
left += targetWidth;
tAttachment.left = 'right';
}
if (left + width > bounds[2] && tAttachment.left === 'right') {
left -= targetWidth;
tAttachment.left = 'left';
}
}
if (changeAttachX === 'together') {
if (left < bounds[0] && tAttachment.left === 'left') {
if (eAttachment.left === 'right') {
left += targetWidth;
tAttachment.left = 'right';
left += width;
eAttachment.left = 'left';
} else if (eAttachment.left === 'left') {
left += targetWidth;
tAttachment.left = 'right';
left -= width;
eAttachment.left = 'right';
}
} else if (left + width > bounds[2] && tAttachment.left === 'right') {
if (eAttachment.left === 'left') {
left -= targetWidth;
tAttachment.left = 'left';
left -= width;
eAttachment.left = 'right';
} else if (eAttachment.left === 'right') {
left -= targetWidth;
tAttachment.left = 'left';
left += width;
eAttachment.left = 'left';
}
} else if (tAttachment.left === 'center') {
if (left + width > bounds[2] && eAttachment.left === 'left') {
left -= width;
eAttachment.left = 'right';
} else if (left < bounds[0] && eAttachment.left === 'right') {
left += width;
eAttachment.left = 'left';
}
}
}
if (changeAttachY === 'element' || changeAttachY === 'both') {
if (top < bounds[1] && eAttachment.top === 'bottom') {
top += height;
eAttachment.top = 'top';
}
if (top + height > bounds[3] && eAttachment.top === 'top') {
top -= height;
eAttachment.top = 'bottom';
}
}
if (changeAttachX === 'element' || changeAttachX === 'both') {
if (left < bounds[0]) {
if (eAttachment.left === 'right') {
left += width;
eAttachment.left = 'left';
} else if (eAttachment.left === 'center') {
left += width / 2;
eAttachment.left = 'left';
}
}
if (left + width > bounds[2]) {
if (eAttachment.left === 'left') {
left -= width;
eAttachment.left = 'right';
} else if (eAttachment.left === 'center') {
left -= width / 2;
eAttachment.left = 'right';
}
}
}
if (typeof pin === 'string') {
pin = pin.split(',').map(function (p) {
return p.trim();
});
} else if (pin === true) {
pin = ['top', 'left', 'right', 'bottom'];
}
pin = pin || [];
var pinned = [];
var oob = [];
if (top < bounds[1]) {
if (pin.indexOf('top') >= 0) {
top = bounds[1];
pinned.push('top');
} else {
oob.push('top');
}
}
if (top + height > bounds[3]) {
if (pin.indexOf('bottom') >= 0) {
top = bounds[3] - height;
pinned.push('bottom');
} else {
oob.push('bottom');
}
}
if (left < bounds[0]) {
if (pin.indexOf('left') >= 0) {
left = bounds[0];
pinned.push('left');
} else {
oob.push('left');
}
}
if (left + width > bounds[2]) {
if (pin.indexOf('right') >= 0) {
left = bounds[2] - width;
pinned.push('right');
} else {
oob.push('right');
}
}
if (pinned.length) {
(function () {
var pinnedClass = undefined;
if (typeof _this.options.pinnedClass !== 'undefined') {
pinnedClass = _this.options.pinnedClass;
} else {
pinnedClass = _this.getClass('pinned');
}
addClasses.push(pinnedClass);
pinned.forEach(function (side) {
addClasses.push(pinnedClass + '-' + side);
});
})();
}
if (oob.length) {
(function () {
var oobClass = undefined;
if (typeof _this.options.outOfBoundsClass !== 'undefined') {
oobClass = _this.options.outOfBoundsClass;
} else {
oobClass = _this.getClass('out-of-bounds');
}
addClasses.push(oobClass);
oob.forEach(function (side) {
addClasses.push(oobClass + '-' + side);
});
})();
}
if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
eAttachment.left = tAttachment.left = false;
}
if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
eAttachment.top = tAttachment.top = false;
}
if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
_this.updateAttachClasses(eAttachment, tAttachment);
_this.trigger('update', {
attachment: eAttachment,
targetAttachment: tAttachment
});
}
});
defer(function () {
if (!(_this.options.addTargetClasses === false)) {
updateClasses(_this.target, addClasses, allClasses);
}
updateClasses(_this.element, addClasses, allClasses);
});
return { top: top, left: left };
}
});
/* globals TetherBase */
'use strict';
var _TetherBase$Utils = TetherBase.Utils;
var getBounds = _TetherBase$Utils.getBounds;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
TetherBase.modules.push({
position: function position(_ref) {
var _this = this;
var top = _ref.top;
var left = _ref.left;
var _cache = this.cache('element-bounds', function () {
return getBounds(_this.element);
});
var height = _cache.height;
var width = _cache.width;
var targetPos = this.getTargetBounds();
var bottom = top + height;
var right = left + width;
var abutted = [];
if (top <= targetPos.bottom && bottom >= targetPos.top) {
['left', 'right'].forEach(function (side) {
var targetPosSide = targetPos[side];
if (targetPosSide === left || targetPosSide === right) {
abutted.push(side);
}
});
}
if (left <= targetPos.right && right >= targetPos.left) {
['top', 'bottom'].forEach(function (side) {
var targetPosSide = targetPos[side];
if (targetPosSide === top || targetPosSide === bottom) {
abutted.push(side);
}
});
}
var allClasses = [];
var addClasses = [];
var sides = ['left', 'top', 'right', 'bottom'];
allClasses.push(this.getClass('abutted'));
sides.forEach(function (side) {
allClasses.push(_this.getClass('abutted') + '-' + side);
});
if (abutted.length) {
addClasses.push(this.getClass('abutted'));
}
abutted.forEach(function (side) {
addClasses.push(_this.getClass('abutted') + '-' + side);
});
defer(function () {
if (!(_this.options.addTargetClasses === false)) {
updateClasses(_this.target, addClasses, allClasses);
}
updateClasses(_this.element, addClasses, allClasses);
});
return true;
}
});
/* globals TetherBase */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
TetherBase.modules.push({
position: function position(_ref) {
var top = _ref.top;
var left = _ref.left;
if (!this.options.shift) {
return;
}
var shift = this.options.shift;
if (typeof this.options.shift === 'function') {
shift = this.options.shift.call(this, { top: top, left: left });
}
var shiftTop = undefined,
shiftLeft = undefined;
if (typeof shift === 'string') {
shift = shift.split(' ');
shift[1] = shift[1] || shift[0];
var _shift = shift;
var _shift2 = _slicedToArray(_shift, 2);
shiftTop = _shift2[0];
shiftLeft = _shift2[1];
shiftTop = parseFloat(shiftTop, 10);
shiftLeft = parseFloat(shiftLeft, 10);
} else {
shiftTop = shift.top;
shiftLeft = shift.left;
}
top += shiftTop;
left += shiftLeft;
return { top: top, left: left };
}
});
return Tether;
}));
/***/ }),
/* 81 */
/***/ (function(module, exports, __webpack_require__) {
var Component = __webpack_require__(40)(
/* script */
__webpack_require__(41),
/* template */
__webpack_require__(82),
/* scopeId */
null,
/* cssModules */
null
)
module.exports = Component.exports
/***/ }),
/* 82 */
/***/ (function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', [_c('span', {
ref: "trigger"
}, [_vm._t("default")], 2), _vm._v(" "), _c('div', {
ref: "popover",
staticClass: "popover fade",
class: [_vm.classState ? 'show' : '', _vm.popoverAlignment],
style: (_vm.popoverStyle),
attrs: {
"tabindex": "-1"
},
on: {
"focus": function($event) {
_vm.$emit('focus')
},
"blur": function($event) {
_vm.$emit('blur')
}
}
}, [_c('div', {
staticClass: "popover-arrow"
}), _vm._v(" "), (_vm.title) ? _c('h3', {
staticClass: "popover-title",
domProps: {
"innerHTML": _vm._s(_vm.title)
}
}) : _vm._e(), _vm._v(" "), _c('div', {
staticClass: "popover-content"
}, [_c('div', {
staticClass: "popover-content-wrapper"
}, [_vm._t("content", [_c('span', {
domProps: {
"innerHTML": _vm._s(_vm.content)
}
})])], 2)])])])
},staticRenderFns: []}
/***/ }),
/* 83 */
/***/ (function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('b-popover', {
staticClass: "click-confirm",
attrs: {
"triggers": false,
"placement": _vm.placement,
"title": _vm.messages.title,
"show": _vm.target !== null
},
on: {
"focus": function($event) {
_vm.setFocus('popover')
},
"blur": _vm.clearFocus
}
}, [_c('span', {
ref: "trigger",
attrs: {
"tabindex": "-1"
},
on: {
"!click": function($event) {
_vm.interceptEvent($event)
},
"!focus": function($event) {
_vm.setFocus('target')
},
"blur": _vm.clearFocus
}
}, [_vm._t("default")], 2), _vm._v(" "), _c('div', {
staticClass: "text-center",
slot: "content"
}, [_c('a', _vm._b({
ref: "buttonYes",
class: [_vm.yesClass, _vm.buttonSizeClass],
attrs: {
"href": "#"
},
on: {
"click": function($event) {
$event.preventDefault();
_vm.confirmEvent($event)
},
"focus": function($event) {
_vm.setFocus('buttonYes')
},
"blur": _vm.clearFocus
}
}, 'a', _vm.confirmationAttributes, false), [(_vm.yesIcon) ? _c('span', {
class: _vm.yesIcon
}) : _vm._e(), _vm._v(" " + _vm._s(_vm.messages.yes) + "\n ")]), _vm._v(" "), _c('a', {
ref: "buttonNo",
class: [_vm.noClass, _vm.buttonSizeClass],
attrs: {
"href": "#"
},
on: {
"click": function($event) {
$event.preventDefault();
_vm.cancelEvent($event)
},
"focus": function($event) {
_vm.setFocus('buttonNo')
},
"blur": _vm.clearFocus
}
}, [(_vm.noIcon) ? _c('span', {
class: _vm.noIcon
}) : _vm._e(), _vm._v(" " + _vm._s(_vm.messages.no) + "\n ")])])])
},staticRenderFns: []}
/***/ })
/******/ ])
});
; | 30.580684 | 667 | 0.579958 |
fed997324e398fddc535aeaf00758c512ac88e7c | 1,402 | js | JavaScript | frontend/src/controller/like.controller.js | Vedant1202/picstir | ff18f74c66b70ac3aa6eb76d04e9c0319b625930 | [
"MIT"
] | null | null | null | frontend/src/controller/like.controller.js | Vedant1202/picstir | ff18f74c66b70ac3aa6eb76d04e9c0319b625930 | [
"MIT"
] | null | null | null | frontend/src/controller/like.controller.js | Vedant1202/picstir | ff18f74c66b70ac3aa6eb76d04e9c0319b625930 | [
"MIT"
] | null | null | null | /** @format */
const { apiUrl } = require('../util/util');
const sendLike = async (postId, userId, token) => {
const requestOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: token,
},
body: JSON.stringify({ postId, userId }),
};
const response = await fetch(apiUrl + '/likes', requestOptions);
const data = await response.json();
if (!response.ok) {
const error = (data && data.message) || response.status;
return {
success: false,
data: error,
};
} else {
return {
success: true,
data: data,
};
}
};
const sendUnlike = async (postId, userId, token) => {
const requestOptions = {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Authorization: token,
},
body: JSON.stringify({ postId, userId }),
};
const response = await fetch(apiUrl + '/likes', requestOptions);
if (!response.ok) {
const data = await response.json();
const error = (data && data.message) || response.status;
return {
success: false,
data: error,
};
} else {
return {
success: true,
};
}
};
module.exports = { sendLike, sendUnlike };
| 23.762712 | 68 | 0.505706 |
fed9bd7067a8ff0ef86f6539a87575337e5c7bf8 | 683 | js | JavaScript | public/js/main.js | dimitarsi/laravel_download_app | 47548b438d6298c1e0f3fb0029cb1f20646a3ae4 | [
"MIT"
] | null | null | null | public/js/main.js | dimitarsi/laravel_download_app | 47548b438d6298c1e0f3fb0029cb1f20646a3ae4 | [
"MIT"
] | null | null | null | public/js/main.js | dimitarsi/laravel_download_app | 47548b438d6298c1e0f3fb0029cb1f20646a3ae4 | [
"MIT"
] | null | null | null | (function() {
function init() {
const popup = document.querySelector("#popup");
const popupCloseHandler = document.querySelector("#close-handler");
function bind(selector, event, method) {
const domEl = document.querySelector(selector);
if(!domEl) return;
domEl.addEventListener(event, method);
}
function prevent(event) {
if(!event || typeof event.preventDefault != "function") return;
event.preventDefault();
}
function closePopup(event) {
prevent(event);
popup.classList.remove("show");
}
bind("#close-handler", "click", closePopup);
bind(".overlay","click", closePopup);
}
init();
})();
| 25.296296 | 71 | 0.63104 |
fed9c772059cd18843e850623e7a08ffbef7c0d8 | 42 | js | JavaScript | src/components/PhylogenyTree/index.js | thomasstjerne/phylogeny | ec45768897527e06dcf9c17f89133674d62347bc | [
"Apache-2.0"
] | null | null | null | src/components/PhylogenyTree/index.js | thomasstjerne/phylogeny | ec45768897527e06dcf9c17f89133674d62347bc | [
"Apache-2.0"
] | null | null | null | src/components/PhylogenyTree/index.js | thomasstjerne/phylogeny | ec45768897527e06dcf9c17f89133674d62347bc | [
"Apache-2.0"
] | null | null | null | export { default } from './PhylogenyTree'; | 42 | 42 | 0.714286 |
fed9d6461b56d1fd90f80d435d46e1421574069e | 785 | js | JavaScript | src/router/template.js | giangr21/inshop-crm-client | edf24a955c008ae9f5449eb080e515148de874e5 | [
"MIT"
] | 1 | 2019-06-21T16:54:34.000Z | 2019-06-21T16:54:34.000Z | src/router/template.js | giangr21/inshop-crm-client | edf24a955c008ae9f5449eb080e515148de874e5 | [
"MIT"
] | null | null | null | src/router/template.js | giangr21/inshop-crm-client | edf24a955c008ae9f5449eb080e515148de874e5 | [
"MIT"
] | null | null | null | import TemplateList from '../pages/template/List'
import TemplateCreate from '../pages/template/Create'
import TemplateUpdate from '../pages/template/Update'
import TemplateShow from '../pages/template/Show'
export default [
{
name: 'TemplateList',
path: '/templates/',
component: TemplateList,
meta: {
requiresAuth: true
}
},
{
name: 'TemplateCreate',
path: '/templates/create',
component: TemplateCreate,
meta: {
requiresAuth: true
}
},
{
name: 'TemplateUpdate',
path: '/templates/edit/:id',
component: TemplateUpdate,
meta: {
requiresAuth: true
}
},
{
name: 'TemplateShow',
path: '/templates/show/:id',
component: TemplateShow,
meta: {
requiresAuth: true
}
}
]
| 19.625 | 53 | 0.615287 |
fedc07193e55cf2946a71ac03e6ca0a46bc3c15f | 2,682 | js | JavaScript | test/javascript/public/test/form_builders/validateSimpleFormBootstrap.js | lampo/client_side_validations-simple_form | 689f12df76e4db2f7cca5b7a8dbfd9a14169feca | [
"MIT"
] | null | null | null | test/javascript/public/test/form_builders/validateSimpleFormBootstrap.js | lampo/client_side_validations-simple_form | 689f12df76e4db2f7cca5b7a8dbfd9a14169feca | [
"MIT"
] | null | null | null | test/javascript/public/test/form_builders/validateSimpleFormBootstrap.js | lampo/client_side_validations-simple_form | 689f12df76e4db2f7cca5b7a8dbfd9a14169feca | [
"MIT"
] | null | null | null | module('Validate SimpleForm Bootstrap', {
setup: function() {
window.ClientSideValidations.forms['new_user'] = {
type: 'SimpleForm::FormBuilder',
error_class: 'help-inline',
error_tag: 'span',
wrapper_error_class: 'error',
wrapper_tag: 'div',
wrapper_class: 'control-group',
wrapper: 'bootstrap',
validators: {
"user[name]":{"presence":[{"message": "must be present"}], "format":[{"message":"is invalid","with":/\d+/}]}
}
}
$('#qunit-fixture')
.append($('<form />', {
action: '/users',
'data-validate': true,
method: 'post',
id: 'new_user'
}))
.find('form')
.append($('<div />', {
class: 'form-inputs'
}))
.find('div')
.append($('<div />', {
class: 'control-group'
})).find('div')
.append($('<label for="user_name" class="string control-label">Name</label>'))
.append($('<div />', {
class: 'controls'
})).find('div')
.append($('<input />', {
name: 'user[name]',
id: 'user_name',
type: 'text'
}));
$('form#new_user').validate();
}
});
test('Validate error attaching and detaching', function() {
var form = $('form#new_user'), input = form.find('input#user_name');
var label = $('label[for="user_name"]');
input.trigger('focusout');
ok(input.parent().parent().hasClass('error'));
ok(label.parent().hasClass('error'));
ok(input.parent().find('span.help-inline:contains("must be present")')[0]);
input.val('abc')
input.trigger('change')
input.trigger('focusout')
ok(input.parent().parent().hasClass('error'));
ok(label.parent().hasClass('error'));
ok(input.parent().find('span.help-inline:contains("is invalid")')[0]);
input.val('123')
input.trigger('change')
input.trigger('focusout')
ok(!input.parent().parent().hasClass('error'));
ok(!label.parent().hasClass('error'));
ok(!input.parent().find('span.help-inline')[0]);
});
test('Validate pre-existing error blocks are re-used', function() {
var form = $('form#new_user'), input = form.find('input#user_name');
var label = $('label[for="user_name"]');
input.parent().append($('<span class="help-inline">Error from Server</span>'))
ok(input.parent().find('span.help-inline:contains("Error from Server")')[0]);
input.val('abc')
input.trigger('change')
input.trigger('focusout')
ok(input.parent().parent().hasClass('error'));
ok(label.parent().hasClass('error'));
ok(input.parent().find('span.help-inline:contains("is invalid")').size() === 1);
});
| 32.707317 | 116 | 0.566368 |
fedef105041c9f38b4e22521121ddc77bbb18eb4 | 1,049 | js | JavaScript | src/index.js | octoblu/meshblu-connector-factory-service | 8f8cf53bc0fe2754bd376b67bd8970725f0e3893 | [
"MIT"
] | 2 | 2016-07-23T16:42:28.000Z | 2016-07-23T16:42:28.000Z | src/index.js | octoblu/meshblu-connector-factory-service | 8f8cf53bc0fe2754bd376b67bd8970725f0e3893 | [
"MIT"
] | 4 | 2016-07-06T22:02:50.000Z | 2016-07-19T16:07:41.000Z | src/index.js | octoblu/meshblu-connector-factory-service | 8f8cf53bc0fe2754bd376b67bd8970725f0e3893 | [
"MIT"
] | 5 | 2016-05-14T03:46:20.000Z | 2021-12-19T00:33:33.000Z | import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { applyMiddleware, createStore } from 'redux'
import thunkMiddleware from 'redux-thunk'
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'
import { browserHistory } from 'react-router'
import { ravenMiddleware } from './helpers/octoblu-raven'
import AppRoutes from './routes'
import reducers from './reducers'
import es6Promise from 'es6-promise'
es6Promise.polyfill()
const middleware = []
middleware.push(thunkMiddleware)
if (process.env.NODE_ENV !== 'production') {
// middleware.push(createLogger())
} else {
middleware.push(ravenMiddleware())
}
middleware.push(routerMiddleware(browserHistory))
const createStoreWithMiddleware = applyMiddleware(...middleware)
const store = createStore(reducers, createStoreWithMiddleware)
const history = syncHistoryWithStore(browserHistory, store)
render(
<Provider store={store}>
<AppRoutes history={history} />
</Provider>,
document.getElementById('app')
)
| 30.852941 | 75 | 0.767398 |
fedefd91550cedb983daf2417650be9aafe97ea5 | 921 | js | JavaScript | lib/util/regexp.js | hata6502/textlint-rule-preset-JTF-style | 60c0db190459ffaf17447beecd49bf9b64eb2dda | [
"MIT"
] | null | null | null | lib/util/regexp.js | hata6502/textlint-rule-preset-JTF-style | 60c0db190459ffaf17447beecd49bf9b64eb2dda | [
"MIT"
] | null | null | null | lib/util/regexp.js | hata6502/textlint-rule-preset-JTF-style | 60c0db190459ffaf17447beecd49bf9b64eb2dda | [
"MIT"
] | null | null | null | // LICENSE : MIT
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hanKarakanaRegExp = exports.karakanaRegExp = exports.hiraganaRegExp = exports.kanjiRegExp = exports.japaneseRegExp = void 0;
var japaneseRegExp = /(?:[々〇〻\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD87F][\uDC00-\uDFFF]|[ぁ-んァ-ヶ])/; // http://tama-san.com/kanji-regex/ ベース
// "々" は 記号であるため除外
// https://github.com/textlint-ja/textlint-rule-preset-jtf-style/issues/48
exports.japaneseRegExp = japaneseRegExp;
var kanjiRegExp = /(?:[〇〻\u3400-\u9FFF\uF900-\uFAFF]|[\uD840-\uD87F][\uDC00-\uDFFF])/;
exports.kanjiRegExp = kanjiRegExp;
var hiraganaRegExp = /[ぁ-ん]/;
exports.hiraganaRegExp = hiraganaRegExp;
var karakanaRegExp = /[ァ-ヶ]/; // 半角カタカナ
exports.karakanaRegExp = karakanaRegExp;
var hanKarakanaRegExp = /[\uFF65-\uFF9F]/;
exports.hanKarakanaRegExp = hanKarakanaRegExp;
//# sourceMappingURL=regexp.js.map
| 40.043478 | 152 | 0.735071 |
fedf35a39280da0055749a0ee94ef591a15371bb | 10,548 | js | JavaScript | easyDualList.js | lucafornaciari/easyDualList | 86582761a1bd39b8c90c8f4015b59b2925a29f42 | [
"MIT"
] | null | null | null | easyDualList.js | lucafornaciari/easyDualList | 86582761a1bd39b8c90c8f4015b59b2925a29f42 | [
"MIT"
] | null | null | null | easyDualList.js | lucafornaciari/easyDualList | 86582761a1bd39b8c90c8f4015b59b2925a29f42 | [
"MIT"
] | null | null | null | ;(function(global,$){
/***************DEFAULT CONFIGURATION******************
var option={
leftContainer : '#leftContainer',
rightContainer : '#rightContainer',
btnToRight : '#move-right',
btnToLeft : '#move-left',
searchLeftContainer : '#searchLeftContainer',
searchRightContainer : '#searchRightContainer'
}
******************************************************/
// 'new' an object
var DualListContainer = function(options){
var config= options || {};
return new DualListContainer.init(config);
}
// Array with initial situation in Containers
var initialOptionsLeftContainer=[];
var initialOptionsRightContainer=[];
// Current options in containers.
// Array structure: [{value: 'x', text: 'hello'},{value: 'y', text: 'bye'}]
var optionsLeftContainer=[];
var optionsRightContainer=[];
// addListeners is called when easyDualList instantiated.
// adds listener to the search input and containers
function addListeners(component){
// Listeners of Search input
$(component.searchLeftContainer).keyup(function () {
var options = optionsLeftContainer;
$(component.leftContainer).empty();
var rex = new RegExp($(this).val(), 'gi');
$.each(options, function(i) {
var option = options[i];
if(option.text.match(rex) !== null) {
$(component.leftContainer).append(
$('<option>').text(option.text).val(option.value)
);
}
});
});
$(component.searchRightContainer).keyup(function () {
var options = optionsRightContainer;
$(component.rightContainer).empty();
var rex = new RegExp($(this).val(), 'gi');
$.each(options, function(i) {
var option = options[i];
if(option.text.match(rex) !== null) {
$(component.rightContainer).append(
$('<option>').text(option.text).val(option.value)
);
}
});
});
//Listener CLICK btnToRight
$(component.btnToRight).click(function(){
component.moveToRight();
});
//Listener CLICK btnToLeft
$(component.btnToLeft).click(function(){
component.moveToLeft();
});
// Listener CLICK right container
$(component.leftContainer).click(function(){
$(component.rightContainer+" option").removeAttr("selected");
$(component.btnToRight).removeAttr('disabled');
$(component.btnToLeft).attr('disabled','disabled');
});
// Listener CLICK left container
$(component.rightContainer).click(function(){
$(component.leftContainer+" option").removeAttr("selected");
$(component.btnToLeft).removeAttr('disabled');
$(component.btnToRight).attr('disabled','disabled');
});
}
// API easyDualList
DualListContainer.prototype={
// return the current selected voices in left container
getSelectedOptionsLeftContainer: function(){
var optionsSelectedLeft=[];
$(this.leftContainer+" option:selected" ).each(function() {
optionsSelectedLeft.push({value: $(this).val(), text: $(this).text()});
});
return optionsSelectedLeft;
},
// return the current selected voices in right container
getSelectedOptionsRightContainer: function(){
var optionsSelectedRight=[];
$(this.rightContainer+" option:selected" ).each(function() {
optionsSelectedRight.push({value: $(this).val(), text: $(this).text()});
});
return optionsSelectedRight;
},
//sets the optionsLeftContainer array with the current options in left container
setOptionsLeftContainer: function(){
optionsLeftContainer=this.getOptionsLeftContainer();
},
//return array with current options in left container.
getOptionsLeftContainer: function(){
if(!$){
throw 'Jquery not loaded';
}
var optionsLeftContainer=[];
$(this.leftContainer).find('option').each(function() {
//push elements in array
optionsLeftContainer.push({value: $(this).val(), text: $(this).text()});
});
return optionsLeftContainer;
},
//sets the optionsRightContainer array with the current options in left container
setOptionsRightContainer: function(){
optionsRightContainer=this.getOptionsRightContainer();
},
//return array with current options in right container.
getOptionsRightContainer: function(){
if(!$){
throw 'Jquery not loaded';
}
var optionsRightContainer=[];
$(this.rightContainer).find('option').each(function() {
//push elements in array
optionsRightContainer.push({value: $(this).val(), text: $(this).text()});
});
return optionsRightContainer;
},
setOptionsContainers: function(){
this.setOptionsLeftContainer();
this.setOptionsRightContainer();
},
setInitialOptionsContainers: function(){
this.setOptionsContainers();
initialOptionsLeftContainer=this.getOptionsLeftContainer();
initialOptionsRightContainer=this.getOptionsRightContainer();
},
//moveToLeft move selected voices from right container to left container
moveToLeft:function(){
if(!$){
throw 'Jquery not loaded';
}
var selectedOptions=[];
//get selected options in right container
selectedOptions = this.getSelectedOptionsRightContainer();
//delete selected options in right container
this.removeOptionsToContainer('right');
//append selected options in left container
this.addOptionsToContainer(selectedOptions,'left');//mi aggiungi le voci selezionate nel contenitore di sinistra
//set array with the new situation
this.setOptionsContainers();
},
//moveToRight move selected voices from left container to right container
moveToRight: function(){
if(!$){
throw 'Jquery not loaded';
}
var selectedOptions=[];
//get selected options in left container
selectedOptions = this.getSelectedOptionsLeftContainer();
//delete selected options in left container
this.removeOptionsToContainer('left');
//append selected options in right container
this.addOptionsToContainer(selectedOptions,'right');
//set array with the new situation
this.setOptionsContainers();
},
//adds new options to the container
addOptionsToContainer: function(data,type){
var selector;
(type=='left' ? selector=this.leftContainer : selector=this.rightContainer);
$.each(data, function(key,item) {
$(selector).append("<option value='"+item.value+"'>"+item.text+"</option>");
});
},
//remove selected options to the container
removeOptionsToContainer: function(type){
var selector;
(type=='left' ? selector=this.leftContainer : selector=this.rightContainer);
$(selector+" option:selected").each(function(){
this.remove();
});
},
//empty left container
emptyLeftContainer: function(){
$(this.leftContainer+" option").remove();
this.setOptionsLeftContainer();
},
//empty right container
emptyRightContainer: function(){
$(this.rightContainer+" option").remove();
this.setOptionsRightContainer();
},
//empty all containers
emptyContainers: function(){
this.emptyLeftContainer();
this.emptyRightContainer();
},
//return to the initial situation
reset: function(){
this.emptyContainers();
var leftSelector=this.leftContainer;
var rightSelector=this.rightContainer;
//Append initial voices
$.each(initialOptionsLeftContainer, function(key,item) {
$(leftSelector).append("<option value='"+item.value+"'>"+item.text+"</option>");
});
$.each(initialOptionsRightContainer, function(key,item) {
$(rightSelector).append("<option value='"+item.value+"'>"+item.text+"</option>");
});
this.setOptionsContainers();
}
};
// the actual object is created here, allowing us to 'new' an object without calling 'new'
DualListContainer.init = function(config){
var self = this;
self.leftContainer = config.leftContainer || '#leftContainer';
self.rightContainer= config.rightContainer || '#rightContainer';
self.btnToRight = config.btnToRight || '#move-right';
self.btnToLeft = config.btnToLeft || '#move-left';
self.searchLeftContainer = config.searchLeftContainer || '#searchLeftContainer';
self.searchRightContainer = config.searchRightContainer || '#searchRightContainer';
//set array with the current container options
self.setInitialOptionsContainers();
//create listeners
addListeners(self);
};
// trick borrowed from jQuery so we don't have to use the 'new' keyword
DualListContainer.init.prototype = DualListContainer.prototype;
// attach our DualListContainer to the global object, and provide a shorthand 'dualList' for ease our poor fingers
global.DualListContainer = global.dualList = DualListContainer;
})(window,jQuery); | 40.106464 | 124 | 0.561149 |
fedf5eb626f15467c4d520416f6af2e48c9ea25c | 1,048 | js | JavaScript | commands/checkmute.js | AStainlessSteelSink/cobalt | 586e455fd57c7a68aa37dbaefcfacb599987a0a4 | [
"MIT"
] | 1 | 2022-02-22T14:11:21.000Z | 2022-02-22T14:11:21.000Z | commands/checkmute.js | AStainlessSteelSink/cobalt | 586e455fd57c7a68aa37dbaefcfacb599987a0a4 | [
"MIT"
] | 7 | 2021-03-22T00:01:53.000Z | 2022-01-29T23:16:31.000Z | commands/checkmute.js | AStainlessSteelSink/cobalt | 586e455fd57c7a68aa37dbaefcfacb599987a0a4 | [
"MIT"
] | 3 | 2021-03-15T14:19:17.000Z | 2022-02-22T14:11:30.000Z | const timestring = require('timestring');
const prettyMs = require('pretty-ms');
exports.run = async (client, interaction, args, level) => {
let member = interaction.options.getMember("user");
let length = client.getRemainingMuteLength(member);
if (length != null) {
interaction.reply(`:alarm_clock: Remaning time until \`${client.getFullUsername(member)}\` is unmuted: \`${prettyMs(Math.round(length / 1000) * 1000).replace(/\s/g, "")}\`.`);
} else {
interaction.reply(`${client.config.emojis.error} That user is not muted or is not scheduled to be unmuted!`);
}
};
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: "Moderator"
};
exports.options = function(client){
return [
{
name: "user",
type: "USER",
description: "The user to check mute status for.",
required: true
}
]
};
exports.help = {
name: "checkmute",
category: "Moderation",
description: "Checks the length of time remaining until someone is unmuted.",
usage: "checkmute @someone"
};
| 26.871795 | 179 | 0.657443 |
fedf8a93baf72cf3d66d3dd08d404a17f1d903ad | 280 | js | JavaScript | packages/rpc/lib/index.js | MonosOlos/clio | 4150ff64a354dbfe649bf388d770647c7817711f | [
"Apache-2.0"
] | null | null | null | packages/rpc/lib/index.js | MonosOlos/clio | 4150ff64a354dbfe649bf388d770647c7817711f | [
"Apache-2.0"
] | null | null | null | packages/rpc/lib/index.js | MonosOlos/clio | 4150ff64a354dbfe649bf388d770647c7817711f | [
"Apache-2.0"
] | null | null | null | const { PacketParser } = require("./packet");
const { TYPES, SIA_TYPES } = require("./types");
const { Buffer } = require("./buffer");
module.exports.Buffer = Buffer;
module.exports.PacketParser = PacketParser;
module.exports.TYPES = TYPES;
module.exports.SIA_TYPES = SIA_TYPES;
| 31.111111 | 48 | 0.717857 |
fedff1cdc3471383503ae08a6f122603010847e8 | 8,234 | js | JavaScript | docs/searchindex.js | UW-COSMOS/Cosmos | f967a562c2a7a86e1fd6ff9c478720ded3f050d5 | [
"Apache-2.0"
] | 30 | 2019-03-14T08:24:34.000Z | 2022-03-09T06:05:44.000Z | docs/searchindex.js | UW-COSMOS/Cosmos | f967a562c2a7a86e1fd6ff9c478720ded3f050d5 | [
"Apache-2.0"
] | 78 | 2019-02-07T22:14:48.000Z | 2022-03-09T05:59:18.000Z | docs/searchindex.js | UW-COSMOS/Cosmos | f967a562c2a7a86e1fd6ff9c478720ded3f050d5 | [
"Apache-2.0"
] | 11 | 2019-03-02T01:20:06.000Z | 2022-03-25T07:25:46.000Z | Search.setIndex({docnames:["aggregations","docker_builds","existing_es","extraction","getting_started","index","ingest","retrieval","troubleshooting"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["aggregations.rst","docker_builds.rst","existing_es.rst","extraction.rst","getting_started.rst","index.rst","ingest.rst","retrieval.rst","troubleshooting.rst"],objects:{},objnames:{},objtypes:{},terms:{"0":[3,4],"02":8,"09":8,"1":[4,5],"120z":8,"12223023449335744691":8,"14":8,"1920":6,"1920x1920":6,"2":[4,5],"2021":8,"23t05":8,"25":7,"27":4,"3":[4,5],"4":4,"5":4,"777":[4,8],"8":4,"8082":4,"8786":4,"9200":4,"char":4,"class":7,"default":[3,4,7],"do":[2,4,7],"final":[4,6],"float":7,"new":4,"return":[6,7],"short":[3,7],"try":8,"while":[4,5,8],A:4,As:6,For:[4,6,7],If:[1,2,4,6,7],In:[4,7],It:6,Its:4,No:8,On:7,That:6,The:[1,2,4,6],Then:[1,2,6],These:4,To:[4,6,7],With:7,_devic:4,_docker:4,_fasttext:6,_ghostscript:6,_pdfminer:6,_preprint:6,abl:4,about:4,abov:[1,4],access:4,accessdeniedexcept:8,accommod:4,accomplish:4,accord:7,account:6,across:[5,8],addit:[2,4],address:2,after:[0,7],again:6,aggreg:5,algorithm:6,alias:7,all:[4,6,7,8],allow:4,alon:6,along:6,alreadi:[2,4],also:[3,5,6,7],an:[4,5,6],analysi:5,ani:4,ankurgo:4,answer:[3,5,7],api:[2,4,5,8],api_imag:4,api_nam:1,api_tag:1,append:[4,6],appli:5,applic:[4,8],appropri:4,ar:[0,1,4,6,7],architectur:[3,6,7],area:7,ask:7,associ:[6,7],assum:4,attent:6,augment:6,autom:5,automat:6,avail:6,b:8,back:6,balanc:6,base:[3,4,5,7],base_imag:4,base_nam:1,base_tag:1,basic:7,been:4,begin:4,being:4,bert:[3,7],better:7,between:4,bind:8,blob:6,bodi:[6,7],bootstrap:8,both:7,bottom:6,bring:8,browser:4,build:[4,5,6],c:4,calcul:6,call:6,can:[0,3,4,5,6,7],cannot:8,canon:[4,7],canonical_id:7,caption:[6,7],caus:8,cell:6,chang:4,chmod:[4,8],choos:7,cl:7,classif:[5,7],classifi:6,clone:4,cluster:[4,5,8],column:6,combin:7,come:7,command:4,common:4,commonli:5,compat:4,compon:[5,8],compos:[2,4,5,7,8],confid:7,consider:6,contain:4,content:[6,7],context:[5,7],context_from_text:7,convert:6,corpu:[4,6],corpus:6,correct:7,cosmo:[1,7,8],cosmos_birdnest_backend:4,cosmos_front_end_1:4,cosmos_rerank_model_1:4,cosmos_scheduler_1:[4,8],could:4,cpu:4,creat:[4,5,8],createendpoint:8,crop:6,ctrl:4,cuda:4,current:1,cycl:4,d:[4,6],data:[5,6,8],datafram:6,datapath:4,dataset:[4,7],dataset_id:7,declar:4,deep:[6,7],defin:[4,7,8],definit:4,delet:4,denot:4,depend:[1,4],deploi:[1,5,7],deploy:[1,4,8],descript:[0,7],design:6,desir:4,detail:[4,6],detect:[0,6,7],detect_imag:4,detect_proc:4,detect_scor:7,detector:6,develop:6,devic:[4,8],diagram:6,did:6,differ:[4,7,8],dir:4,directori:[1,4],discoveri:5,disk:[6,7],divers:7,divid:6,docid:4,docker:[2,4,5,8],dockerfil:1,document:[4,5,6,7],done:[4,6],downstream:7,drive:4,due:4,duplic:6,dure:8,e:[4,6,7,8],each:[4,6,7],easili:7,edg:6,elastic_address:[2,4],elastic_data_path:[4,8],elasticsearch:[5,8],elasticsearchexcept:8,elasticsearchuncaughtexceptionhandl:8,embed:[4,5],enabl:[4,6],encount:8,end:[6,7],engin:5,enhanc:6,enrich:5,ensur:1,entiti:[5,7],env:[2,4,8],environ:[2,4],equat:0,error:[4,8],es01:[2,4,8],es:[4,8],especi:6,etc:7,even:4,everi:6,exampl:[4,6],except:8,exist:[4,5],expect:[4,6],experiment:7,explain:6,explor:7,expos:3,extract:[4,5,6],extraction_imag:4,extraction_nam:1,extraction_tag:1,f:[1,4,8],fail:8,failur:4,faster:6,featur:6,feedback:7,field:5,figur:[5,6,7],file:[2,4,6,7,8],filesystemexcept:8,filter:7,find:7,finish:4,first:[4,6,7],five:4,focus:5,folder:[4,8],follow:[2,4],found:[5,6,8],four:4,fresh:7,from:[1,3,4,5,6,7],full:6,full_cont:7,g:[4,6,7,8],gener:5,get:[5,7],given:[3,6,7],good:6,gpu:4,grid:5,group:6,guid:4,ha:[4,6],handl:[1,4],hard:4,have:[2,4,7],haven:4,header:[6,7],header_cont:7,here:[4,6],high:6,higher:[0,6,7],highli:4,how:7,hub:1,hundr:7,iaross:4,id:7,ident:4,identifi:7,idl:4,imag:[2,4,5,6,7,8],img_pth:7,includ:[4,6],incorpor:6,index:[5,6],indic:[4,6],inform:[4,5,6,7],ingest:[5,7],ingest_nam:1,ingest_tag:1,initi:[6,7],input:[4,6],input_dir:4,insid:1,instal:4,instead:7,integ:7,intent:5,interest:[6,7],interfac:5,intern:7,intuit:6,invok:4,issu:4,its:[4,6,7],java:8,just:4,keep:4,keyword:7,known:7,label:6,languag:4,larg:7,larger:3,last:7,later:6,latest:4,launch:4,layer:6,learn:[6,7],left:[6,8],level:[0,6,7,8],like:[4,7,8],line:4,link:5,linking_imag:4,list:[6,7],ll:8,local:4,localhost:4,locat:6,log:4,longer:6,look:[2,6],lose:6,lot:6,machin:4,mai:6,main:8,make:4,map:6,marco:7,margin:6,match:1,me:8,medic:4,mention:[4,6,7],metadata:6,might:6,mileag:6,mind:[6,7],mkdir:4,model:[1,3,4,5,6,7],modifi:4,modul:5,more:[6,7],most:[6,7],move:4,ms:7,multiplex:4,must:[4,6],mv:4,n:7,name:[1,4,7,8],namespac:8,navig:4,nearest:6,necessarili:7,need:[4,8],nest:8,network:[6,8],neural:[5,6],newdc:4,newer:4,next:[4,7],nio:8,node:8,non:6,note:[4,8],now:4,number:4,o:8,object:[0,3,4,5,7],obtain:6,ocr:6,onc:4,one:[2,6],onli:[4,7],onlin:4,open:[4,5],option:[5,6],orang:8,order:4,org:8,organ:6,origin:6,other:[4,5,6],our:[4,6,7],out:[4,8],output:[5,6],output_dir:4,over:[4,6],overlap:7,own:4,p:[4,8],packag:5,pad:6,page:[6,7],pagin:7,pane:4,paper:6,parent:7,parquet:[4,6],part:[5,6],pass:6,path:[4,7],pdf:[4,5,7],pdf_name:7,perform:[3,6,7],permiss:4,persist:4,pillow:6,pipelin:[1,4,6],pixel:[6,7],place:4,png:4,point:[4,7],popul:4,postprocess:7,postprocess_scor:7,prebuilt:4,prediciton:7,predict:6,preprocess:6,priorit:7,problem:5,proceed:6,process:[4,5,6,7],produc:6,project:8,propos:5,provid:6,prune:8,ps:4,pull:1,pure:7,qa:1,qualiti:6,queri:[3,5,7],question:[3,5,7],rank:7,rcnn:6,re:[4,8],read:5,recent:[6,7],recogn:4,recognit:4,recov:[0,6],redefin:2,refer:6,region:6,rel:7,relev:[6,7],remain:7,remot:4,remov:[2,8],renam:4,replac:6,repositori:4,requir:4,rerank:[1,5,7],reranking_devic:4,reset:4,resiz:6,resourc:4,respect:6,result:[6,7],retriev:[2,3,4,5],retrieval_imag:4,retrieval_nam:1,retrieval_tag:1,right:6,roadmap:7,root:[1,4,8],row:6,rule:6,run:[1,4,7],s:[4,7],sage:8,save:[4,6],scale:4,schedul:[4,8],scheduler_address:4,scientif:[5,6],scispaci:4,score:7,scroll:7,search:[5,6],section:[0,6,7],see:[4,6],seek:7,semant:[1,5,6],separ:4,sequenc:7,serv:4,server:[4,8],servic:[2,4,8],set:[4,6,7],setup:2,seven:4,sever:4,share:8,shorter:6,should:[4,6],shown:7,side:6,simpl:6,situat:8,six:6,size:[4,7],slightli:[4,7],so:4,solut:[4,8],some:4,sourc:[5,7],space:[4,6,8],span:3,spawn:2,specif:[4,7],specifi:[1,6],sq:7,squad2:3,stack:[4,5],stacktrac:8,stage:[4,7],standard:[3,6],start:5,startupexcept:8,statement:1,step:4,strength:7,structur:[0,6],subspan:5,sudo:[4,8],suffici:[4,6],suggest:4,superclass:6,suppli:4,sure:4,surround:[6,7],syntax:4,system:[4,7,8],t:[1,4],tabl:[5,6,7],tag:1,take:[4,6],task:[6,7],team:6,temporari:4,termin:4,text:[5,6,7],than:6,thei:4,them:4,themselv:6,thi:[4,6,7,8],thing:4,those:[6,7],thread:8,three:5,through:[4,7],thu:7,time:[4,6],timestamp:8,tmp:[4,8],tmp_dir:4,tmux:4,tool:7,top:[6,7],tradit:7,train:[3,6,7],troubleshoot:[4,5],turn:6,two:[4,7],type:[6,7,8],uml:[4,7],uncaught:8,unifi:4,unlik:7,unlink:4,up:[4,7,8],updat:2,upload:[2,4],upload_imag:4,us:[3,4,6,7,8],user:[4,7],usr:8,util:[4,5],uwcosmo:4,uzio31or6rp2lz9v7px9nn9zi:8,v1:4,valid:4,vari:[3,6],variabl:[2,4],varieti:6,version:4,via:4,view:5,visual:6,visualizer_imag:4,visualizer_kb:4,wa:6,wai:7,we:[0,3,4,6,7],well:[4,6],when:[4,8],where:1,which:[1,4,6,7],white:6,window:4,wish:2,within:[4,6,7],without:4,word:[4,5],work:[4,6],worker_imag:4,worker_proc:4,worri:4,write:4,xgboost:6,yml:[2,4,8],you:[2,4,7,8],your:[2,4,6]},titles:["Aggregations","Building the docker images","Reading data into an existing ElasticSearch cluster","Extraction","Getting Started","Cosmos","Ingestion","Retrieval","Troubleshooting"],titleterms:{aggreg:[0,6],an:2,api:1,base:1,build:1,classif:6,cluster:2,content:5,context:6,cosmo:[4,5],data:[2,4],deploi:4,docker:1,elasticsearch:[2,4,7],embed:6,enrich:6,entiti:4,exist:2,extract:[1,3],field:7,get:[4,8],grid:6,imag:1,index:7,ingest:[1,4,6],interfac:4,link:4,object:6,output:4,pdf:6,problem:4,propos:6,read:[2,4,6],retriev:[1,7],search:4,start:[4,8],troubleshoot:8,view:4,word:6}}) | 8,234 | 8,234 | 0.696017 |
fee0436b99938afc7d4c1c880c8984c1332615ca | 58 | js | JavaScript | .eslintrc.js | vitus-labs/docs | b93f00810f174f3c9ecc4988ded3cd8df229f9f1 | [
"CC-BY-3.0"
] | null | null | null | .eslintrc.js | vitus-labs/docs | b93f00810f174f3c9ecc4988ded3cd8df229f9f1 | [
"CC-BY-3.0"
] | 7 | 2021-11-08T15:51:21.000Z | 2022-02-23T19:00:50.000Z | .eslintrc.js | vitus-labs/ui-system | 9016d4a81ef1b3ce8d5111cbdc34805aa4ac3214 | [
"MIT"
] | null | null | null | module.exports = require('@vitus-labs/tools-lint/eslint')
| 29 | 57 | 0.758621 |
fee100470f109b0f36f47ff1366b47b93bc80beb | 297 | js | JavaScript | server/middlewares/validateLogin.js | Niyonsengaeric/Way-Farer | 90cdb0f7dbf2ab772fb38a73660e478f9af9912d | [
"MIT"
] | null | null | null | server/middlewares/validateLogin.js | Niyonsengaeric/Way-Farer | 90cdb0f7dbf2ab772fb38a73660e478f9af9912d | [
"MIT"
] | 5 | 2019-08-06T08:17:49.000Z | 2021-05-10T04:45:29.000Z | server/middlewares/validateLogin.js | Niyonsengaeric/Way-Farer | 90cdb0f7dbf2ab772fb38a73660e478f9af9912d | [
"MIT"
] | null | null | null | import Joi from 'joi';
function validatelogin(user) {
const schema = {
email: Joi.string()
.regex(/^\S*$/)
.max(250)
.email(),
password: Joi.string()
.regex(/^\S*$/)
.min(5)
.max(1024),
};
return Joi.validate(user, schema);
}
export default validatelogin;
| 15.631579 | 36 | 0.572391 |
fee11637e19117758f5c38a1211892f72f23246f | 133 | js | JavaScript | app/components/me-track-row.js | gaslight/me-track-row | 6b26000e2a2480d303465ff1b90b8d47073a1337 | [
"MIT"
] | null | null | null | app/components/me-track-row.js | gaslight/me-track-row | 6b26000e2a2480d303465ff1b90b8d47073a1337 | [
"MIT"
] | null | null | null | app/components/me-track-row.js | gaslight/me-track-row | 6b26000e2a2480d303465ff1b90b8d47073a1337 | [
"MIT"
] | null | null | null | import Ember from 'ember';
import TrackRowComponent from 'me-track-row/components/me-track-row';
export default TrackRowComponent;
| 22.166667 | 69 | 0.804511 |
fee150b4b86b84d210a06420adffd9f9f3540af0 | 163 | js | JavaScript | src/state/dialogs/actions.js | IvanBogdanovich/it-kamasutra | 27592ffccf55d4153829cd253344c6882e1c7b30 | [
"MIT"
] | 6 | 2020-09-10T12:06:11.000Z | 2021-08-08T13:35:43.000Z | src/state/dialogs/actions.js | IvanBogdanovich/it-kamasutra | 27592ffccf55d4153829cd253344c6882e1c7b30 | [
"MIT"
] | null | null | null | src/state/dialogs/actions.js | IvanBogdanovich/it-kamasutra | 27592ffccf55d4153829cd253344c6882e1c7b30 | [
"MIT"
] | null | null | null | // types
import types from './types';
export function addMessage(message) {
return {
type: types.ADD_MESSAGE_DIALOGS,
message: message
}
} | 18.111111 | 40 | 0.638037 |
fee2b24013ada13c6f7800ffc6c2560fda69be42 | 393 | js | JavaScript | src/components/ui/autoCompleteSearch/SearchButton.js | thaydds/Astron | 154c07cc01c9b350379437a1cb9dc1baff909756 | [
"MIT"
] | null | null | null | src/components/ui/autoCompleteSearch/SearchButton.js | thaydds/Astron | 154c07cc01c9b350379437a1cb9dc1baff909756 | [
"MIT"
] | null | null | null | src/components/ui/autoCompleteSearch/SearchButton.js | thaydds/Astron | 154c07cc01c9b350379437a1cb9dc1baff909756 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
const SearchButton = ({ buttonText, handleButtonCLick }) => {
return (
<button onClick={() => handleButtonCLick()} type="submit">
{buttonText}
</button>
);
};
export default SearchButton;
SearchButton.propTypes = {
handleButtonCLick: PropTypes.func.isRequired,
buttonText: PropTypes.string.isRequired,
};
| 21.833333 | 62 | 0.699746 |
fee461cfb128ba393f4f3441ec6c494745635a5f | 3,297 | js | JavaScript | node_modules/checklink/index.js | alenapetsyeva/tut-2 | 4ec3ce843a0614770e430fec61ebc132c72f5f95 | [
"Apache-2.0"
] | 3 | 2015-10-21T05:03:13.000Z | 2015-10-28T08:58:11.000Z | node_modules/checklink/index.js | alenapetsyeva/tut-2 | 4ec3ce843a0614770e430fec61ebc132c72f5f95 | [
"Apache-2.0"
] | 1 | 2016-06-15T20:55:37.000Z | 2016-06-15T20:55:37.000Z | node_modules/checklink/index.js | alenapetsyeva/tut-2 | 4ec3ce843a0614770e430fec61ebc132c72f5f95 | [
"Apache-2.0"
] | null | null | null | /**
* check deadlink
*/
var http = require('http');
var https = require('https');
var url = require('url');
var Promise = require('bluebird');
var _ = require('lodash');
var async = require('async');
var debug = require('debug')('checklink');
/**
* 检查一组链接是否为死链接
*
* @param {Array/String} links
* @param {Number} timeout
* @return {Object}
* {
* isPassed: true/false,
* deadlinks: [{
* url: 'xxxx',
* code: 404,
* message: 'res.statusMessage'
* }]
* }
*/
module.exports = function(links, timeout) {
if (!_.isArray(links)) {
links = [links];
}
timeout = timeout || 30 * 1000;
var uniqLinks = _.uniq(links);
var queueCount = 200;
if (process.platform === 'win32') {
// https urls
var httpsUrls = _.filter(uniqLinks, function(item) {
return /^https:/.test(item);
});
if (httpsUrls.length > 10) {
// windows 下 https 并发数不能超过 10
queueCount = 10;
}
}
return new Promise(function(resolve) {
var results = {
isPassed: true,
count: links.length,
deadlinks: []
};
var queue = async.queue(function(link, callback) {
checkUrl(link, timeout, callback);
}, queueCount);
queue.push(uniqLinks, function(result) {
if (!result.isPassed) {
delete result.isPassed;
results.isPassed = false;
results.deadlinks.push(result);
}
});
// 任务结束
queue.drain = function() {
debug(results);
resolve(results);
};
});
};
/**
* 检查死链接
*
* @param {String} link
* @param {Number} timeout
* @return {Object} result: {url: '', isPassed: false, code: 400, message: ''}
*/
function checkUrl(link, timeout, callback) {
var result = {url: link};
var httpObj = /^https:/.test(link) ? https : http;
var timer;
var USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36';
// 过滤的错误信息: 无法验证的签名 | 证书
var filterErrors = [
'UNABLE TO VERIFY THE FIRST CERTIFICATE',
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
'CERT_HAS_EXPIRED',
'CERTIFICATE HAS EXPIRED',
'DEPTH_ZERO_SELF_SIGNED_CERT',
'FORBIDDEN'
];
var options = _.defaults(url.parse(link), {
headers: {
'User-Agent': USER_AGENT
}
});
var endCallback = function(request) {
clearTimeout(timer);
callback && callback(result);
callback = null;
request.abort();
};
var request = httpObj.get(options, function(res) {
result.code = res.statusCode;
result.isPassed = res.statusCode < 400 || res.statusCode > 520;
result.message = res.statusMessage || '';
if (filterErrors.indexOf(result.message) !== -1) {
result.isPassed = true;
}
endCallback(request);
});
request.on('error', function(err) {
result.message = err.message || err.code || '';
result.isPassed = filterErrors.indexOf(result.message.toUpperCase()) !== -1;
result.code = err.statusCode || err.status || 500;
endCallback(request);
});
timer = setTimeout(function() {
result.code = 404;
result.isPassed = false;
result.message = 'timeout: ' + (timeout / 1000).toFixed(2) + 's';
endCallback(request);
}, timeout);
}
| 21.270968 | 131 | 0.588414 |
fee4ea37f9fc9b1ada7653528bf3163e1f77d59f | 623 | js | JavaScript | frontend/src/main/webapp/resources/js/validation.js | mscrocker/semerusocial | 6ea51a1823ea842ff313834048ae008660d8e3e2 | [
"MIT"
] | null | null | null | frontend/src/main/webapp/resources/js/validation.js | mscrocker/semerusocial | 6ea51a1823ea842ff313834048ae008660d8e3e2 | [
"MIT"
] | 2 | 2020-03-05T12:44:28.000Z | 2022-01-21T23:38:05.000Z | frontend/src/main/webapp/resources/js/validation.js | mscrocker/semerusocial | 6ea51a1823ea842ff313834048ae008660d8e3e2 | [
"MIT"
] | null | null | null | let validation = {
setFieldValid: (field) => {
field.classList.remove("is-invalid");
field.classList.add("is-valid");
},
setFieldInvalid: (field) => {
field.classList.remove("is-valid");
field.classList.add("is-invalid");
},
clearField: (field) => {
field.classList.remove("is-valid");
field.classList.remove("is-invalid");
},
updateField: (field, valid) => {
if ((valid === null) || (valid === undefined)){
validation.clearField(field);
} else if (valid === true){
validation.setFieldValid(field);
} else if (valid === false){
validation.setFieldInvalid(field);
}
},
}; | 20.096774 | 49 | 0.622793 |