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
6a083a2d22f25340e776d7f5e00cd363cb8e0939
2,393
js
JavaScript
service.house.registry/house.js
Olili2017/tenant-management-system
64c3b0a73a90f57989cafb9e9c6fa621bca8b345
[ "MIT" ]
null
null
null
service.house.registry/house.js
Olili2017/tenant-management-system
64c3b0a73a90f57989cafb9e9c6fa621bca8b345
[ "MIT" ]
3
2020-08-12T08:06:28.000Z
2021-05-10T20:56:32.000Z
service.house.registry/house.js
Olili2017/tenant-management-system
64c3b0a73a90f57989cafb9e9c6fa621bca8b345
[ "MIT" ]
null
null
null
// const Database = require('./database') const axios = require('axios') const Database = require('./database') const service = { config : { url : "http://localhost:3000" } } class House { constructor(){ this.database = null } async getDatabase(){ if (this.database) return this.database //get config await axios.post(`${service.config.url}/serve/db`, {name : "houses"},{ headers: { "Content-Type": "application/json" }}). then(response => { if (response.data.message == "200 OK"){ const {host,username,pass,bucket} = response.data.data this.database = new Database({host,username,pass}).bucket(bucket) } }). then(error => { if(error){ // TODO: fix error } }) return this.database } create(house){ let isHouseCreated = false this.getDatabase().then((bucket) => { bucket.insert(`${this.landlord}:${Math.ceil(Math.random() * 1000)}`,house, (err,res) => { if(err){ console.log("error while creating new house"); return } else { console.log("created new house"); isHouseCreated = true return } }) }) return isHouseCreated } remove (id){ let isHouseRemoved = false this.getDatabase().then((bucket) => { bucket.remove(id, (err, res) => { if(err){ return } else { isHouseRemoved = true return } }) }) return isHouseRemoved } edit (id, newHouse){ let isHouseRemoved = false this.getDatabase().then((bucket) => { bucket.replace(id,newHouse,(err, res) => { if (err){ return }else { isHouseRemoved = true return } }) }) return isHouseRemoved } setLandlord(landlordId){ this.landlord = landlordId } } module.exports = House
24.927083
101
0.437526
6a08f02466c1bcff099a5d1bdebc22504cf98b1c
9
js
JavaScript
scripts/build-html.js
NathanNeelis/progressive-web-apps-2021
3fff5acd3a396c6f67dc5ee1f0b6c8a50f2bd7ae
[ "MIT" ]
null
null
null
scripts/build-html.js
NathanNeelis/progressive-web-apps-2021
3fff5acd3a396c6f67dc5ee1f0b6c8a50f2bd7ae
[ "MIT" ]
1
2021-03-19T08:46:19.000Z
2021-03-19T08:46:19.000Z
scripts/build-html.js
NathanNeelis/progressive-web-apps-2021
3fff5acd3a396c6f67dc5ee1f0b6c8a50f2bd7ae
[ "MIT" ]
null
null
null
// TO DO
9
9
0.444444
6a096c5562df84227ce09ce75db4dd69c40226cc
1,952
js
JavaScript
overlays/holo-nixpkgs/hpos-holochain-api/src/utils.js
pjkundert/holo-nixpkgs
814f8d110ad4560854698c24a0ccbade041df5d8
[ "MIT" ]
null
null
null
overlays/holo-nixpkgs/hpos-holochain-api/src/utils.js
pjkundert/holo-nixpkgs
814f8d110ad4560854698c24a0ccbade041df5d8
[ "MIT" ]
null
null
null
overlays/holo-nixpkgs/hpos-holochain-api/src/utils.js
pjkundert/holo-nixpkgs
814f8d110ad4560854698c24a0ccbade041df5d8
[ "MIT" ]
null
null
null
const tmp = require('tmp') const request = require('request') const fs = require('fs') // Download from url to tmp file // return tmp file path const downloadFile = async (downloadUrl) => { console.log('Downloading url: ', downloadUrl) const fileName = tmp.tmpNameSync() const file = fs.createWriteStream(fileName) // Clean up url const urlObj = new URL(downloadUrl) urlObj.protocol = 'https' downloadUrl = urlObj.toString() return new Promise((resolve, reject) => { request({ uri: downloadUrl }) .pipe(file) .on('finish', () => { // console.log(`Downloaded file from ${downloadUrl} to ${fileName}`); resolve(fileName) }) .on('error', (error) => { reject(error) }) }) } const parsePreferences = (p, key) => { const mtbi = typeof p.max_time_before_invoice === 'string' ? JSON.parse(p.max_time_before_invoice) : p.max_time_before_invoice return { max_fuel_before_invoice: toInt(p.max_fuel_before_invoice), max_time_before_invoice: [toInt(mtbi[0]), toInt(mtbi[1])], price_compute: toInt(p.price_compute), price_storage: toInt(p.price_storage), price_bandwidth: toInt(p.price_bandwidth), provider_pubkey: key } } const formatBytesByUnit = (bytes, decimals = 2) => { if (bytes === 0) return { size: 0, unit: 'Bytes' } const units = ['Bytes', 'KB', 'MB', 'GB'] const dm = decimals < 0 ? 0 : decimals const i = Math.floor(Math.log(bytes) / Math.log(1024)) return { size: parseFloat((bytes / Math.pow(1024, i)).toFixed(dm)), unit: units[i] } } const toInt = i => { if (typeof i === 'string') return parseInt(i) else return i } const isusageTimeInterval = value => { if (value === null) return false const keys = Object.keys(value) return keys.includes('duration_unit') && keys.includes('amount') } module.exports = { parsePreferences, formatBytesByUnit, downloadFile, isusageTimeInterval }
26.378378
128
0.650615
6a0a2a90c75343986682e9749779f27f878cd7a5
571
js
JavaScript
routes/tasks.js
yiJiaWang/node
38b522a9ea10d244e890d8b0c196edf490363870
[ "MIT" ]
113
2020-06-22T02:25:12.000Z
2022-03-31T05:44:08.000Z
routes/tasks.js
yiJiaWang/node
38b522a9ea10d244e890d8b0c196edf490363870
[ "MIT" ]
4
2020-08-02T18:34:26.000Z
2021-02-19T01:49:50.000Z
routes/tasks.js
yiJiaWang/node
38b522a9ea10d244e890d8b0c196edf490363870
[ "MIT" ]
40
2020-06-24T23:15:40.000Z
2022-03-16T08:15:47.000Z
/** * 描述: 任务路由模块 * 作者: Jack Chen * 日期: 2020-06-20 */ const express = require('express'); const router = express.Router(); const service = require('../services/taskService'); // 任务清单接口 router.get('/queryTaskList', service.queryTaskList); // 添加任务接口 router.post('/addTask', service.addTask); // 编辑任务接口 router.put('/editTask', service.editTask); // 操作任务状态接口 router.put('/updateTaskStatus', service.updateTaskStatus); // 点亮红星标记接口 router.put('/updateMark', service.updateMark); // 删除任务接口 router.delete('/deleteTask', service.deleteTask); module.exports = router;
17.30303
58
0.705779
6a0a3cd112550c4970165d2f74d3bf8c90e86a40
1,951
js
JavaScript
Server/controllers/category.js
Satwikan/2nd-hand-mbm
9d97de57a477afd787abe1a269872e1214319f58
[ "MIT" ]
7
2021-05-16T10:36:56.000Z
2022-01-31T03:09:47.000Z
Server/controllers/category.js
Rajat-Jain29/MBM-Project
6dfe160aafd1d2c593c4fd18172f9612a7c4657b
[ "MIT" ]
1
2021-10-29T19:44:31.000Z
2021-10-29T19:44:31.000Z
Server/controllers/category.js
Rajat-Jain29/MBM-Project
6dfe160aafd1d2c593c4fd18172f9612a7c4657b
[ "MIT" ]
2
2021-05-21T05:21:26.000Z
2021-05-22T05:31:50.000Z
const Category = require("../models/category"); const Sub = require("../models/sub"); const slugify = require('slugify'); // const { ObjectId } = require("bson"); const Product = require("../models/product") exports.create = async(req, res) => { try{ const {name} = req.body; console.log(name); const category = await new Category({name, slug : slugify(name) }).save(); res.json(category); }catch(err){ res.status(400).send("Create category failed"); } } exports.list = async(req, res) => { const up = await Category.find({}).sort({ createdAt: -1}).exec(); res.json(up); } // exports.read = async(req, res) => { // let category = await Category.findOne({slug: req.params.slug}).exec() // // res.json(category); // const products = Product.find({category}).populate('category').exec(); // res.json({ // category, // products // }) // } exports.read = async (req, res) => { let category = await Category.findOne({ slug: req.params.slug }).exec(); // res.json(category); const products = await Product.find({ category }).populate("category").exec(); res.json({ category, products, }); }; exports.update = async (req, res) => { const {name} = req.body; try{ const updated = await Category.findOneAndUpdate({slug: req.params.slug}, {name, slug : slugify(name)},{new: true} ) res.json(updated); }catch(err){ res.status(400).send("update category failed"); } } exports.remove = async(req, res) => { try{ const deleted = await Category.findOneAndDelete({slug: req.params.slug}); res.json(deleted); }catch(err){ res.status(400).send("delete category failed"); } } exports.getSubss = (req, res) => { Sub.find({ parent: req.params._id }).exec((err, subs) => { if (err) console.log(err); res.json(subs); }); };
27.871429
121
0.578165
6a0a6b66bcd324acadc977d51be1baaf3131b8f7
4,481
js
JavaScript
statusboard/src/components/Map/Map.js
rkiddy/brigade-project-index-statusboard
f3b879dd61c8f94c4b489a8babd095a5705550e4
[ "Apache-2.0" ]
4
2020-04-02T03:20:04.000Z
2021-04-10T20:35:34.000Z
statusboard/src/components/Map/Map.js
rkiddy/brigade-project-index-statusboard
f3b879dd61c8f94c4b489a8babd095a5705550e4
[ "Apache-2.0" ]
178
2020-02-12T18:31:45.000Z
2022-03-28T13:24:01.000Z
statusboard/src/components/Map/Map.js
mmazanec22/brigade-project-index-statusboard
fc0b079f254f02f1e84fecedd3e048dbe2136be7
[ "Apache-2.0" ]
18
2020-02-19T03:13:05.000Z
2021-07-22T09:54:25.000Z
import React, { useEffect, useState } from 'react'; import { renderToString } from 'react-dom/server'; import PropTypes from 'prop-types'; import L from 'leaflet'; import { Map as LeafletMap, TileLayer, Marker, Popup } from 'react-leaflet'; import { ReactComponent as Circle } from './Icon.svg'; import { Button } from '..'; import 'leaflet/dist/leaflet.css'; import './Map.scss'; // TODO: improve keyboard interactivity by putting the tabindex on the groups and using arrow keys for brigades and states // Make focused state and focused brigade states so that a user can go back to the map without tabbing through everything again export default function Map({ brigadeData, filterOpts, setFilterOpts }) { const defaultZoom = 2; const defaultCenter = [44.967243, -104.771556]; const [zoom, setZoom] = useState(defaultZoom); const [center, setCenter] = useState(defaultCenter); const { name: selectedBrigadeName } = filterOpts.selectedBrigade || {}; useEffect(() => { if (filterOpts.selectedBrigade) { // Set that brigade as the center setZoom(8); const { latitude, longitude } = filterOpts.selectedBrigade || {}; setCenter([latitude, longitude]); } else { setZoom(defaultZoom); setCenter(defaultCenter); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedBrigadeName]); return ( <div className="map leaflet-container"> <LeafletMap // TODO: WHY IS FOCUS STYLING NOT WORKING ON ZOOM BUTTONS?? zoom={zoom} center={center} onMoveend={(e) => { const { _zoom: newZoom, _lastCenter } = e.target || {}; const { lat: newLat, lng: newLon } = _lastCenter || {}; setFilterOpts({ ...filterOpts, bounds: e.target.getBounds() }); if (newZoom) { setZoom(newZoom); } if (_lastCenter) { setCenter([newLat, newLon]); } }} > {/* TODO: ADD STATE OVERLAY? https://leafletjs.com/reference-1.6.0.html#svgoverlay */} {brigadeData.map((b) => { if (!b.latitude || !b.longitude) return <React.Fragment key={b.name} />; const myIcon = L.divIcon({ html: renderToString(<Circle />), className: b.name === selectedBrigadeName ? 'brigade-point selected' : 'brigade-point', title: b.name, riseOnHover: true, }); return ( // TODO: DIFFERENT MARKER FOR SELECTED BRIGADE // TODO: center the dot-- it's off from the cities <Marker position={[+b.latitude, +b.longitude]} key={b.name} icon={myIcon} > <Popup> <div>{b.name}</div> <div>{`${b.projects.length}`}</div> {b.name !== selectedBrigadeName ? ( <Button onClick={() => setFilterOpts({ selectedBrigade: b })} type="button" text={`Show only ${b.name} projects`} linkButton /> ) : ( <> <div>{`Showing only ${b.name} projects`}</div> <Button onClick={() => setFilterOpts({})} type="button" text="Show all projects" linkButton /> </> )} </Popup> </Marker> ); })} <TileLayer attribution='&amp;copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> </LeafletMap> <Button className="reset-button" onClick={() => { setZoom(defaultZoom); setCenter(defaultCenter); setFilterOpts({}); }} text="Reset" disabled={zoom === defaultZoom && center[0] === defaultCenter[0]} /> </div> ); } Map.defaultProps = { brigadeData: [], }; export const filterOptsPropType = PropTypes.shape({ selectedBrigade: PropTypes.shape(), state: PropTypes.string, boundingBox: PropTypes.array, }); Map.propTypes = { brigadeData: PropTypes.arrayOf(PropTypes.any), filterOpts: filterOptsPropType.isRequired, setFilterOpts: PropTypes.func.isRequired, };
33.94697
127
0.54229
6a0ab3928144dce5d83179d80c6db369fa43c19a
1,203
js
JavaScript
private/events/users/handleStripeAutoUnsubscribe/handleDeletedSubscription.js
rohithreddy/MoonMail
6190be3b69b3790d403917b3c26a70765d612042
[ "MIT" ]
1
2019-04-15T12:04:13.000Z
2019-04-15T12:04:13.000Z
private/events/users/handleStripeAutoUnsubscribe/handleDeletedSubscription.js
rohithreddy/MoonMail
6190be3b69b3790d403917b3c26a70765d612042
[ "MIT" ]
null
null
null
private/events/users/handleStripeAutoUnsubscribe/handleDeletedSubscription.js
rohithreddy/MoonMail
6190be3b69b3790d403917b3c26a70765d612042
[ "MIT" ]
null
null
null
import Promise from 'bluebird'; import { strip } from 'eskimo-stripper'; import { User } from '../../../lib/models/user'; const stripe = require('stripe')(process.env.STRIPE_API_KEY); // https://www.masteringmodernpayments.com/stripe-webhook-event-cheatsheet // https://stripe.com/docs/api#event_types export default function handleDeletedSubscription(streamEvent) { return Promise.map(streamEvent.Records .filter(record => record.eventName === 'INSERT') .map(record => strip(record.dynamodb.NewImage)) .filter(paymentEvent => isTargetEvent(paymentEvent)), updateUser); } function isTargetEvent(event) { return event.eventType === 'customer.subscription.deleted'; } function updateUser(event) { return fetchCustomerInformation(event) .then(stripeCustomer => User.findByEmail(stripeCustomer.email)) .then((user) => { if (user.plan === gotoPlan(user.plan)) return {}; return User.update({ plan: gotoPlan(user.plan) }, user.id); }); } function fetchCustomerInformation(event) { return stripe.customers.retrieve(event.event.data.object.customer); } function gotoPlan(currentPlan) { if (currentPlan.match(/_ses/)) return 'free_ses'; return 'free'; }
31.657895
74
0.72153
6a0ac950601d650139b08d85991b6f0efc1153ec
29,674
js
JavaScript
blahhhhh/romaji-name.js
chieko1/kaiju
249a34c908bdfc1e57ce7e6a17442470b9fcb39f
[ "MIT" ]
null
null
null
blahhhhh/romaji-name.js
chieko1/kaiju
249a34c908bdfc1e57ce7e6a17442470b9fcb39f
[ "MIT" ]
3
2021-07-26T02:16:43.000Z
2021-08-09T18:36:28.000Z
blahhhhh/romaji-name.js
chieko1/kaiju
249a34c908bdfc1e57ce7e6a17442470b9fcb39f
[ "MIT" ]
1
2021-07-23T01:32:36.000Z
2021-07-23T01:32:36.000Z
// The MIT License (MIT) // Copyright (c) 2013 John Resig import enamdict from "enamdict" import hepburn from "hepburn" import "bulk-replace" // Thanks to Jed Schmidt! // https://twitter.com/jedschmidt/status/368179809551388672 // https://ja.wikipedia.org/wiki/%E5%A4%A7%E5%AD%97_(%E6%95%B0%E5%AD%97) var generations = [ /([11一壱壹初](?:代目|代|世|sei|daime)|\b1\b|\bI(\s|$)|[^0-9]1[^0-9])/i, /([22二弐貮貳](?:代目|代|世|sei|daime)|nidaime|\b(?:2|II|ll)\b|Ⅱ|[^0-9]2[^0-9])/i, /([33三参參](?:代目|代|世|sei|daime)|sandaime|\b(?:3|III)\b|[^0-9]3[^0-9])/i, /([44四肆](?:代目|代|世|sei|daime)|yodaime|\b(?:4|IV)\b|[^0-9]4[^0-9])/i, /([55五伍](?:代目|代|世|sei|daime)|godaime|\b(?:5\b|V(\s|$))|[^0-9]5[^0-9])/i, /([66六陸](?:代目|代|世|sei|daime)|\b(?:6|VI)\b|[^0-9]6[^0-9])/i, /([77七柒漆質](?:代目|代|世|sei|daime)|\b(?:7|VII)\b|[^0-9]7[^0-9])/i, /([88八捌](?:代目|代|世|sei|daime)|\b(?:8|VIII)\b|[^0-9]8[^0-9])/i, /([99九玖](?:代目|代|世|sei|daime)|\b(?:9|IX)\b|[^0-9]9[^0-9])/i, /((?:10|10|[十拾])(?:代目|代|世|sei|daime)|\b(?:10\b|[^0-9]10[^0-9]|X(\s|$)))/i ]; var generationMap = [ "", "", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"]; // Punctuation // (Both ASCII and Japanese) // http://www.localizingjapan.com/blog/2012/01/20/regular-expressions-for-japanese-text/ // Include full width characters? // Exclude the ' and - marks, they're used in some names var puncRegex = /[!"#$%&*+,._?\/:;<=>@[\\\]^`{|}~\u3000-\u303F]|(?:^|\s)[\—\-](?:\s|$)/ig; var aposRegex = /(^|[^nm])'/ig; // Stop words var stopRegex = /\b(?:^.*\bby|formerly|et al|can be read|signed|signature|may be translated as|seal|possibly|illustrations|professor|artists other two|born|artist)\b/ig; // Extract an, at least, 2 character long kanji string var kanjiRegex = /[\u4e00-\u9faf\u3041-\u3096\u30A0-\u30FF][\u4e00-\u9faf\u3041-\u3096\u30A0-\u30FF\s\d\(\)()々]*[\u4e00-\u9faf\u3041-\u3096\u30A0-\u30FF☆?々](?:\s+[ivxIVX]+\b)?/g; // Detect unknown artists var unknownRegex = /unread|unbekannt|no\s+signature|not\s+identified|ansigned|unsigned|numerous|various.*artists|mixed.*artists|anonymous|unknown|unidentified|unidentied|not\s*read|not\s+signed|none|無落款|落款欠|不明|なし/i; // Detect after var afterRegex = /\bafter\b|in the style of|of style the in|original|imitator of|fake/i; // Detect attributed var attrRegex = /to attributed|attributed to|to atributed|atributed to|attributed|\batt\b/ig; // Detect school var schoolRegex = /of school|school of|a pupil of|of pupil a|([\w']+)\s+(?:school|schule|umkreis)/ig; // Name split var nameSplitRegex = /\/| with | or | and | & |・/ig; // Typos and entities to convert var fixTypos = { "&#x02bc;": "'", "shegeharu": "shigeharu", "kasamastu": "kasamatsu", "kunimasav": "kunimasa v", "ktasukawa": "katsukawa", "katuskawa": "katsukawa", "kumyiski": "kumyoshi", "hiroshgie": "hiroshige", "shunkwaku": "shunkaku", "yackhyo": "yachiyo" }; // All the conceivable bad accents that people could use instead of the typical // Romaji stress mark. The first character in each list has the proper accent. var letterToAccents = { 'a': 'āâáàăắặấåäǟãą', 'e': 'ēêéèềěëėę', 'i': 'īîíìïį', 'o': 'ōôóòöőõȭȯȱøỏ', 'u': 'ūûúùŭůüųűư' }; // The formatting for when the full names are generated var localeFormatting = { "": "given middle surname generation", "ja": "surname middle given generation" }; // Build up the maps for later replacements var accentToLetter = {}; var accentToASCII = {}; var accentToGoodAccent = {}; var asciiToAccent = {}; var asciiToLetter = {}; Object.keys(letterToAccents).forEach(function(letter) { var accents = letterToAccents[letter]; var goodAccent = accents.slice(0, 1); var letterPair = letter + letter; accents.split("").forEach(function(accent) { accentToLetter[accent] = letter; accentToASCII[accent] = letterPair; accentToGoodAccent[accent] = goodAccent; accent = accent.toUpperCase(); accentToLetter[accent] = letter.toUpperCase(); accentToASCII[accent] = letter.toUpperCase() + letter; accentToGoodAccent[accent] = goodAccent.toUpperCase(); }); // The use of 'ii' is commonly accepted, no accent is used if (letter !== "i") { asciiToAccent[letterPair] = goodAccent; } // Hack for usage of "ou", treat the same as "oo" if (letter === "o") { asciiToAccent["ou"] = goodAccent; asciiToLetter["ou"] = letter; } }); // Cached settings var defaultSettings = { fixedNames: { given: [], surname: [] } }; var settings = defaultSettings; module.exports = { // Location of the default settings file settingsFile: __dirname + "/settings.json", init: function(extraSettings, callback) { if (arguments.length === 1) { callback = extraSettings; extraSettings = defaultSettings; } enamdict.init(); return this; }, parseName: function(name, options) { // Fallback options object options = options || {}; // Assume that we're re-parsing a name object if (typeof name === "object") { if (name.settings) { for (var prop in name.settings) { if (!(prop in options)) { options[prop] = name.settings[prop]; } } } name = name.original || name.name; } // Fallback to an empty string if no name is provided name = name || ""; var nameObj = { original: name, locale: "ja" }; if (Object.keys(options).length > 0) { nameObj.settings = options; } // Simplify the processing by starting in lowercase var cleaned = name.toLowerCase(); // Fix up the punctuation and whitespace before processing cleaned = this.cleanWhitespace(cleaned); cleaned = this.fixTypos(cleaned); // Optionally remove everything enclosed in parentheses if (options.stripParens) { cleaned = this.stripParens(cleaned); } // Bail if it's an unknown artist cleaned = this.extractUnknown(cleaned, nameObj); // Remove other artists // TODO: Find a way to expose the other artist names cleaned = this.stripExtraNames(cleaned); // Extract extra information (unknown, kanji, generation, etc.) cleaned = this.extractAfter(cleaned, nameObj); cleaned = this.extractAttributed(cleaned, nameObj); cleaned = this.extractSchool(cleaned, nameObj); cleaned = this.extractKanji(cleaned, nameObj); cleaned = this.extractGeneration(cleaned, nameObj); // Clean up the string cleaned = this.repairName(cleaned); cleaned = this.stripParens(cleaned); cleaned = this.flipName(cleaned); cleaned = this.stripPunctuation(cleaned); cleaned = this.stripStopWords(cleaned); // Fix some other things we don't care about cleaned = cleaned.trim(); var uncorrectedName = cleaned; // Fix lots of bad Romaji usage cleaned = this.correctAccents(cleaned); cleaned = this.stripAccentsToASCII(cleaned); cleaned = this.correctBadRomaji(cleaned); // Make sure that ASCII characters are left to convert! if (/([a-z][a-z'-]*)\s*([a-z' -]*)\s*/.test(cleaned)) { if (RegExp.$2) { var surname = RegExp.$1; var given = RegExp.$2; } else { var surname = ""; var given = RegExp.$1; } // The kanji represents a different name (alias?) if (nameObj.differs) { delete nameObj.kanji; delete nameObj.given_kanji; delete nameObj.surname_kanji; delete nameObj.generation; } // Make sure the names are valid romaji before continuing if ((surname && !this.toKana(surname) && surname.length > 1) || (given && !this.toKana(given) && given.length > 1)) { // If one of them is not valid then we assume that we're // dealing with a western name so we just leave it as-is. var parts = uncorrectedName.split(/\s+/); nameObj.locale = ""; nameObj.given = parts[0]; nameObj.surname = ""; if (parts.length === 2) { nameObj.surname = parts[1]; } else if (parts.length > 2) { var middle = parts.slice(1, parts.length - 1); nameObj.middle = middle.map(function(name) { return name.length === 1 ? name + "." : name; }).join(" "); nameObj.surname = parts[parts.length - 1]; } else if (parts.length === 1) { // If only one name is provided then it's likely the // surname, which is more common in non-Japanese locales. nameObj.surname = nameObj.given; nameObj.given = ""; } if (options.flipNonJa && nameObj.surname) { var tmp = nameObj.given; nameObj.given = nameObj.surname; nameObj.surname = tmp; } // Use the built-in name fixes as a first list of defense if (settings.fixedNames.given.indexOf((nameObj.surname || "").toLowerCase()) >= 0 || settings.fixedNames.surname.indexOf(nameObj.given.toLowerCase()) >= 0) { var tmp = nameObj.given; nameObj.given = nameObj.surname; nameObj.surname = tmp; } this.injectFullName(nameObj); return nameObj; } else { var parts = given.split(/\s+/); if (parts.length > 1) { var middle = parts.slice(0, parts.length - 1); nameObj.middle = middle.join(" "); given = parts[parts.length - 1]; } } // If givenFirst is specified then we assume that the given // name is always first. This doesn't matter for non-Japanese // names (like above) but does matter for Japanese names, // which are expected to be surname first. if (options.givenFirst && surname && given) { var tmp = surname; surname = given; given = tmp; // Use the built-in name fixes as a first list of defense } else if (settings.fixedNames.given.indexOf(surname) >= 0 || settings.fixedNames.surname.indexOf(given) >= 0) { var tmp = given; given = surname; surname = tmp; } var allowSwap = settings.fixedNames.given.indexOf(given) < 0 && settings.fixedNames.surname.indexOf(surname) < 0; // Look up the two parts of the name in ENAMDICT var givenEntries = enamdict.find(given); var surnameEntries = enamdict.find(surname); if (nameObj.given_kanji || nameObj.surname_kanji) { allowSwap = false; // Assume that the Kanji version of the name is in the right // order. Make sure that the romaji name matches the Kanji. if (given && surname && (givenEntries && givenEntries.kanji().indexOf(nameObj.surname_kanji) >= 0 || surnameEntries && surnameEntries.kanji().indexOf(nameObj.given_kanji) >= 0)) { var tmp = surnameEntries; surnameEntries = givenEntries; givenEntries = tmp; tmp = surname; surname = given; given = tmp; } } if (given && surname && (givenEntries || surnameEntries)) { // Fix cases where only one of the two names was found if (allowSwap && (!givenEntries || !surnameEntries)) { if (givenEntries) { // Swap the names if they're in the wrong place if (givenEntries.type() === "surname") { var tmp = surname; surname = given; given = tmp; surnameEntries = givenEntries; givenEntries = null; } } else { // Swap the names if they're in the wrong place if (surnameEntries.type() === "given") { var tmp = given; given = surname; surname = tmp; givenEntries = surnameEntries; surnameEntries = null; } } // Otherwise both parts of the name were found // Fix the case where the names are reversed } else if (allowSwap && (surnameEntries.type() === "given" || givenEntries.type() === "surname") && surnameEntries.type() !== givenEntries.type()) { var tmp = surnameEntries; surnameEntries = givenEntries; givenEntries = tmp; } // Get the romaji names, if they exist in ENAMDICT // If not, fall back to what was provided var givenRomaji = this.correctBadRomaji(givenEntries ? givenEntries.romaji() : given); var surnameRomaji = this.correctBadRomaji(surnameEntries ? surnameEntries.romaji() : surname); // Generate our own kana using hepburn var givenKana = this.toKana(givenRomaji || ""); var surnameKana = this.toKana(surnameRomaji || ""); if (givenRomaji) { nameObj.given = this.convertRepeatedVowel(givenRomaji); nameObj.given_kana = givenKana; } if (surnameRomaji) { nameObj.surname = this.convertRepeatedVowel(surnameRomaji); nameObj.surname_kana = surnameKana; } this.splitKanjiByName(nameObj, givenEntries, surnameEntries); this.injectFullName(nameObj); } else { if (surname) { nameObj.surname = this.convertRepeatedVowel(surname); nameObj.surname_kana = this.toKana(surname); } nameObj.given = this.convertRepeatedVowel(given); nameObj.given_kana = this.toKana(given); this.splitKanjiByName(nameObj, givenEntries); this.injectFullName(nameObj); } // Otherwise there was only kanji left and we haven't already // detected which characters belong to the surname or given name } else if (nameObj.kanji && !nameObj.given_kanji) { this.splitKanji(nameObj); this.injectFullName(nameObj); // Otherwise we need to build the full kanji from the parts } else if (nameObj.given_kanji) { this.injectFullName(nameObj); } // Handle when there's no parseable name if (!nameObj.name && !nameObj.given && !nameObj.surname && !nameObj.kanji) { nameObj.unknown = true; } delete nameObj.differs; return nameObj; }, splitKanjiByName: function(nameObj, givenEntries, surnameEntries) { // Figure out how the kanji name relates to which name part if (!nameObj.kanji || nameObj.given_kanji) { return; } var nameKanji = nameObj.kanji; var givenKanji = givenEntries && givenEntries.kanji(); var surnameKanji = surnameEntries && surnameEntries.kanji(); if (!givenKanji && !surnameKanji) { this.splitKanji(nameObj); return; } if (givenKanji) { var foundNames = givenKanji.filter(function(kanji) { return nameKanji.indexOf(kanji) >= 0; }); // Hopefully only one name is found if (foundNames.length > 0) { nameObj.given_kanji = foundNames[0]; } } if (surnameKanji) { var foundNames = surnameKanji.filter(function(kanji) { return nameKanji.indexOf(kanji) >= 0; }); // Hopefully only one name is found if (foundNames.length > 0) { nameObj.surname_kanji = foundNames[0]; } } // If only one of the kanji is found if (nameObj.given_kanji !== nameObj.surname_kanji) { if (nameObj.given_kanji && nameObj.given_kanji !== nameKanji) { nameObj.surname_kanji = nameKanji .replace(nameObj.given_kanji, ""); } else if (nameObj.surname_kanji && nameObj.surname_kanji !== nameKanji) { nameObj.given_kanji = nameKanji .replace(nameObj.surname_kanji, ""); } } }, splitKanji: function(nameObj) { if (nameObj.kanji.length <= 2) { // If it's very short then it's probably not a full // name, just the given name. nameObj.given_kanji = nameObj.kanji; } else if (nameObj.kanji.length <= 3 && enamdict.findKanji(nameObj.kanji)) { // Assume that if we have an exact match that it's // a valid given name (the surname, alone, is almost never // specified). nameObj.given_kanji = nameObj.kanji; } else if (nameObj.kanji.length === 4) { // Almost always a name of length 4 means that there is // a surname of length 2 and a given name of length 2 nameObj.surname_kanji = nameObj.kanji.substr(0, 2); nameObj.given_kanji = nameObj.kanji.substr(2); } else { // For everything else we need to slice-and-dice the // name to make sure that we have the correct name parts var complete = []; var partial = []; // Split name 1 .. n for (var pos = 2; pos < nameObj.kanji.length - 1; pos++) { var surname = nameObj.kanji.substr(0, pos); var given = nameObj.kanji.substr(pos); var match = { diff: Math.abs(surname.length - given.length), surname: enamdict.findKanji(surname), given: enamdict.findKanji(given) }; if (match.surname && match.given) { complete.push(match); } else if (match.surname || match.given) { partial.push(match); } } if (complete.length > 0) { // Find the name with the least-dramatic difference in // size (e.g. AABB is more likely than ABBB) complete = complete.sort(function(a, b) { return Math.abs(a.surname.length - a.given.length) - Math.abs(b.surname.length - b.given.length); }); nameObj.surname_kanji = complete[0].surname.kanji(); nameObj.given_kanji = complete[0].given.kanji(); // Otherwise if there are an odd number of partial matches then // we guess and go for the one that evenly splits the name } else if (partial.length > 0) { partial = partial.filter(function(name) { return name.diff === 0; }); if (partial.length > 0) { var partialSurname = partial[0].surname && partial[0].surname.kanji(); var partialGiven = partial[0].given && partial[0].given.kanji(); if (partialSurname) { partialGiven = nameObj.kanji .replace(partialSurname, ""); } else { partialSurname = nameObj.kanji .replace(partialGiven, ""); } nameObj.surname_kanji = partialSurname; nameObj.given_kanji = partialGiven; } } // Anything else is going to be too ambiguous } }, genFullName: function(nameObj) { var name = ""; var formatting = localeFormatting[nameObj.locale] || ""; formatting.split(/\s+/).forEach(function(part) { var value = nameObj[part]; if (part === "generation") { value = generationMap[value]; } // Only add something if the part is empty and don't add // a generation if it's just 1 (since it's superflous) if (value) { name += (name ? " " : "") + value; } }); return name.trim(); }, injectFullName: function(nameObj) { this.capitalizeNames(nameObj); var name = this.genFullName(nameObj); if ((nameObj.locale === "ja" ? nameObj.given : nameObj.surname) && name) { nameObj.name = name; if (nameObj.locale === "ja") { nameObj.ascii = this.genFullName({ locale: nameObj.locale, given: this.stripAccentsToASCII(nameObj.given || ""), surname: this.stripAccentsToASCII(nameObj.surname || ""), middle: this.stripAccentsToASCII(nameObj.middle || ""), generation: nameObj.generation }); } else { nameObj.ascii = nameObj.name; } nameObj.plain = this.genFullName({ locale: nameObj.locale, given: this.stripAccents(nameObj.given || ""), surname: this.stripAccents(nameObj.surname || ""), middle: this.stripAccents(nameObj.middle || ""), generation: nameObj.generation }); } if (nameObj.given_kana) { nameObj.kana = (nameObj.surname_kana || "") + nameObj.given_kana; } var kanjiGeneration = (nameObj.generation ? " " + nameObj.generation + "世" : ""); if (nameObj.given_kanji) { nameObj.kanji = (nameObj.surname_kanji ? nameObj.surname_kanji + " " : "") + nameObj.given_kanji + kanjiGeneration; } else if (nameObj.kanji) { nameObj.kanji += kanjiGeneration; } return nameObj; }, capitalizeNames: function(nameObj) { if (nameObj.given) { nameObj.given = this.capitalize(nameObj.given); } if (nameObj.middle) { nameObj.middle = this.capitalize(nameObj.middle); } if (nameObj.surname) { nameObj.surname = this.capitalize(nameObj.surname); } }, capitalize: function(name) { return name.toLowerCase().replace(/(?:^|\s)./g, function(all) { return all.toUpperCase(); }); }, cleanWhitespace: function(name) { return name.replace(/\r?\n/g, " ").trim(); }, fixTypos: function(name) { return bulkReplace(name, fixTypos); }, flipName: function(name, split) { split = split || /,\s*/; return name.split(split).reverse().join(" "); }, repairName: function(name) { // Placeholder characters that will be replaced in a name // This almost always happens on poorly formatted web sites. name = name.replace(/([aeiou])_/g, "$1$1"); // This is definitely a hack but it seems to be the case // for many of these particular problems. return name.replace(/[?_]/g, "o"); }, stripStopWords: function(name) { return name.replace(stopRegex, ""); }, stripExtraNames: function(name) { return name.split(nameSplitRegex)[0]; }, stripPunctuation: function(name) { return name .replace(puncRegex, " ") .replace(aposRegex, function(all, before) { return before; }).trim(); }, stripAccents: function(name) { return bulkReplace(name, accentToLetter); }, stripAccentsToASCII: function(name) { return bulkReplace(name, accentToASCII); }, correctAccents: function(name) { return bulkReplace(name, accentToGoodAccent); }, correctBadRomaji: function(name) { return hepburn.cleanRomaji(name).toLowerCase(); }, convertRepeatedVowel: function(name) { return bulkReplace(name, asciiToAccent); }, stripParens: function(name) { // Start by removing parens and the contents inside of them return name.replace(/\s*[\((][^\))]*[\))]\s*/g, " ") // Strip any remaining parens separately .replace(/[\((\))]/g, ""); }, extractAttributed: function(name, nameObj) { name = name.replace(attrRegex, function(all) { nameObj.attributed = true; return ""; }); return name; }, extractAfter: function(name, nameObj) { name = name.replace(afterRegex, function(all) { nameObj.after = true; return ""; }); return name; }, extractSchool: function(name, nameObj) { var self = this; name = name.replace(schoolRegex, function(all) { nameObj.school = true; if (RegExp.$1) { name = ""; nameObj.surname = RegExp.$1; self.injectFullName(nameObj); } return ""; }); return name; }, extractUnknown: function(name, nameObj) { if (unknownRegex.test(name)) { name = ""; nameObj.unknown = true; nameObj.locale = ""; } return name; }, fixRepeatedKanji: function(name) { return name.replace(/(.)々/g, "$1$1"); }, extractKanji: function(name, nameObj) { var self = this; var kanji = ""; name = name.replace(kanjiRegex, function(all) { if (!kanji) { kanji = self.stripParens(self.stripPunctuation( self.fixRepeatedKanji(all))).trim(); } return ""; }); if (kanji) { // Extract generation info from kanji if it exists kanji = this.extractGeneration(kanji, nameObj).trim(); // Strip extraneous whitespace from the kanji kanji = kanji.replace(/\s+/g, " ").trim(); var parts = kanji.split(/\s+/); // Surname and given name are already specified if (parts.length === 2) { // Handle case where there are multiple space-separated names if (parts[0].length >= 4 && parts[1].length >= 4) { kanji = parts[0]; nameObj.kanji = kanji; } else { nameObj.surname_kanji = parts[0]; nameObj.given_kanji = parts[1]; } } else { nameObj.kanji = kanji; } } return name; }, extractGeneration: function(name, nameObj) { var generation; // Don't look for the generation inside parens var trimName = this.stripParens(name); generations.forEach(function(genRegex, i) { if (!generation && genRegex.test(trimName)) { generation = i + 1; // Handle the case where the name is written: // Given Generation Surname var invertedName = new RegExp("([a-z'-]+)\\s+" + RegExp.$1 + "\\s+([a-z'-]+)", "i"); if (invertedName.test(name)) { name = name.replace(invertedName, "$2 $1"); } else { name = name.replace(genRegex, function(all, name, extra) { return typeof extra === "string" && extra || ""; }); } } }); // Specifying 1st generation is redundant if (generation === 1) { generation = undefined; } // The kanji represents a different name (alias?) if (nameObj.kanji && nameObj.generation !== generation) { nameObj.differs = true; } if (generation) { nameObj.generation = generation; } return name; }, toKana: function(name) { // TODO: Should oo -> ou to match the conventions of ENAMDICT? var ret = hepburn.toHiragana(name.replace(/-/g, "")); return /[a-z]/i.test(ret) ? "" : ret; } };
35.11716
215
0.520422
6a0c1f5cfdfe87d4a2134d300c7ec8875e616994
5,193
js
JavaScript
app/containers/DashboardManageUsers/DashboardManageUsersAddUserForm/index.js
ngkhoawork/study-web
d9011a6a10951b27b6823e5631797eaafb8e6b55
[ "MIT" ]
null
null
null
app/containers/DashboardManageUsers/DashboardManageUsersAddUserForm/index.js
ngkhoawork/study-web
d9011a6a10951b27b6823e5631797eaafb8e6b55
[ "MIT" ]
1
2020-07-19T13:41:05.000Z
2020-07-19T13:41:05.000Z
app/containers/DashboardManageUsers/DashboardManageUsersAddUserForm/index.js
starsoftdev/study-web
d9011a6a10951b27b6823e5631797eaafb8e6b55
[ "MIT" ]
null
null
null
import _ from 'lodash'; import React, { PropTypes } from 'react'; import { Field, reduxForm, blur } from 'redux-form'; import { connect } from 'react-redux'; import { createStructuredSelector } from 'reselect'; import { normalizePhoneDisplay } from '../../../../app/common/helper/functions'; import Input from '../../../components/Input'; import ReactSelect from '../../../components/Input/ReactSelect'; import LoadingSpinner from '../../../components/LoadingSpinner'; import formValidator from './validator'; const formName = 'dashboardAddClientAdminsForm'; function mapDispatchToProps(dispatch) { return { blur: (field, value) => dispatch(blur(formName, field, value)), }; } @reduxForm({ form: formName, validate: formValidator }) @connect(null, mapDispatchToProps) export class AddUserForm extends React.Component { // eslint-disable-line react/prefer-stateless-function static propTypes = { blur: PropTypes.func.isRequired, isEdit: PropTypes.bool, handleSubmit: PropTypes.func, saving: PropTypes.bool, deleting: PropTypes.bool, roles: PropTypes.object, onDelete: PropTypes.func, initialValues: PropTypes.object, } constructor(props) { super(props); this.onPhoneBlur = this.onPhoneBlur.bind(this); } onPhoneBlur(event) { const { blur } = this.props; const formattedPhoneNumber = normalizePhoneDisplay(event.target.value); blur('phone', formattedPhoneNumber); } render() { const options = []; _.forEach(this.props.roles.details, (item) => { let roleName = item.name; switch (roleName) { case 'sm': roleName = 'AD OPERATION'; break; case 'bd': roleName = 'BUSINESS DEVELOPMENT'; break; case 'ae': roleName = 'PROJECT MANAGER'; break; case 'cc': roleName = 'CALL CENTER'; break; case 'callCenterManager': roleName = 'CALL CENTER MANAGER'; break; default: roleName = item.name.toUpperCase(); // return roleName as is (e.g. TEST) } options.push({ label: roleName, value: item.id, }); }); return ( <form className="form-lightbox dashboard-lightbox" onSubmit={this.props.handleSubmit} noValidate="novalidate" > <div className="field-row"> <strong className="label required"> <label className="add-exposure-level">Name</label> </strong> <div className="field"> <div className="row"> <div className="col pull-left"> <Field name="firstName" component={Input} type="text" placeholder="First Name" /> </div> <div className="col pull-right"> <Field name="lastName" component={Input} type="text" placeholder="Last Name" /> </div> </div> </div> </div> <div className="field-row"> <strong className="label required"> <label className="add-exposure-level">Email</label> </strong> <div className="field"> <Field name="email" component={Input} type="text" /> </div> </div> <div className="field-row"> <strong className="label"> <label className="add-exposure-level">Phone</label> </strong> <div className="field"> <Field name="phone" component={Input} type="text" onBlur={this.onPhoneBlur} /> </div> </div> <div className="field-row"> <strong className="label required"> <label className="add-exposure-level">Role</label> </strong> <div className="field"> <Field name="role" component={ReactSelect} placeholder="Select Role" options={options} /> </div> </div> <div className="field-row text-right no-margins"> {this.props.isEdit && <a className="btn btn-gray-outline" onClick={() => { this.props.onDelete(this.props.initialValues.user_id); }}> {this.props.deleting ? <span><LoadingSpinner showOnlyIcon size={20} className="saving-user" /></span> : <span>{'Delete'}</span> } </a> } <button type="submit" className="btn btn-primary"> {this.props.saving ? <span><LoadingSpinner showOnlyIcon size={20} className="saving-user" /></span> : <span>{this.props.isEdit ? 'Update' : 'Submit'}</span> } </button> </div> </form> ); } } const mapStateToProps = createStructuredSelector({ }); export default connect( mapStateToProps, mapDispatchToProps )(AddUserForm);
28.222826
123
0.536684
6a0c42f4a8a856f28b5af7507aedb608999c8a67
260
js
JavaScript
api/models/BlackList.js
kanitelk/minter-scoring
602fef335ae06f98a753ab33aa141bb889199cfa
[ "MIT" ]
null
null
null
api/models/BlackList.js
kanitelk/minter-scoring
602fef335ae06f98a753ab33aa141bb889199cfa
[ "MIT" ]
1
2019-11-13T17:54:18.000Z
2020-04-22T09:17:52.000Z
api/models/BlackList.js
kanitelk/minter-scoring
602fef335ae06f98a753ab33aa141bb889199cfa
[ "MIT" ]
null
null
null
const mongoose = require("mongoose"); const BlackListSchema = mongoose.Schema( { _id: String, description: String, from: String }, { timestamps: true, _id: false } ); module.exports = mongoose.model("BlackList", BlackListSchema);
16.25
62
0.653846
6a0d040210eadf4b5a1b4a55ce57218694a3e1bc
11,830
js
JavaScript
samples/core/com/zoho/crm/api/sample/threading/multi_thread.js
zoho/zohocrm-typescript-sdk-2.0
e26bae952f801707168b3cefa0f956510a28b428
[ "Apache-2.0" ]
null
null
null
samples/core/com/zoho/crm/api/sample/threading/multi_thread.js
zoho/zohocrm-typescript-sdk-2.0
e26bae952f801707168b3cefa0f956510a28b428
[ "Apache-2.0" ]
null
null
null
samples/core/com/zoho/crm/api/sample/threading/multi_thread.js
zoho/zohocrm-typescript-sdk-2.0
e26bae952f801707168b3cefa0f956510a28b428
[ "Apache-2.0" ]
1
2022-01-15T21:53:50.000Z
2022-01-15T21:53:50.000Z
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const user_signature_1 = require("@zohocrm/typescript-sdk-2.0/routes/user_signature"); const sdk_config_builder_1 = require("@zohocrm/typescript-sdk-2.0/routes/sdk_config_builder"); const file_store_1 = require("@zohocrm/typescript-sdk-2.0/models/authenticator/store/file_store"); const logger_1 = require("@zohocrm/typescript-sdk-2.0/routes/logger/logger"); const log_builder_1 = require("@zohocrm/typescript-sdk-2.0/routes/logger/log_builder"); const us_data_center_1 = require("@zohocrm/typescript-sdk-2.0/routes/dc/us_data_center"); const oauth_builder_1 = require("@zohocrm/typescript-sdk-2.0/models/authenticator/oauth_builder"); const initialize_builder_1 = require("@zohocrm/typescript-sdk-2.0/routes/initialize_builder"); const record_operations_1 = require("@zohocrm/typescript-sdk-2.0/core/com/zoho/crm/api/record/record_operations"); const response_wrapper_1 = require("@zohocrm/typescript-sdk-2.0/core/com/zoho/crm/api/record/response_wrapper"); const parameter_map_1 = require("@zohocrm/typescript-sdk-2.0/routes/parameter_map"); const header_map_1 = require("@zohocrm/typescript-sdk-2.0/routes/header_map"); class SampleRecord { static async call() { /* * Create an instance of Logger Class that takes two parameters * level -> Level of the log messages to be logged. Can be configured by typing Levels "." and choose any level from the list displayed. * filePath -> Absolute file path, where messages need to be logged. */ let logger = new log_builder_1.LogBuilder() .level(logger_1.Levels.INFO) .filePath("/Users/username/Documents/final-logs.log") .build(); /* * Create an UserSignature instance that takes user Email as parameter */ let user1 = new user_signature_1.UserSignature("abc@zoho.com"); /* * Configure the environment * which is of the pattern Domain.Environment * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter * Available Environments: PRODUCTION(), DEVELOPER(), SANDBOX() */ let environment1 = us_data_center_1.USDataCenter.PRODUCTION(); /* * Create a Token instance * clientId -> OAuth client id. * clientSecret -> OAuth client secret. * grantToken -> OAuth Grant Token. * refreshToken -> OAuth Refresh Token token. * redirectURL -> OAuth Redirect URL. */ let token1 = new oauth_builder_1.OAuthBuilder() .clientId("clientId") .clientSecret("clientSecret") .refreshToken("refreshToken") .redirectURL("redirectURL") .build(); /* * Create an instance of TokenStore. * host -> DataBase host name. Default "localhost" * databaseName -> DataBase name. Default "zohooauth" * userName -> DataBase user name. Default "root" * password -> DataBase password. Default "" * portNumber -> DataBase port number. Default "3306" * tableName -> DataBase table name. Default "oauthtoken" */ // let tokenstore: DBStore = new DBBuilder() // .host("hostName") // .databaseName("databaseName") // .userName("userName") // .portNumber(3306) // .tableName("tableName") // .password("password") // .build(); /* * Create an instance of FileStore that takes absolute file path as parameter */ let store = new file_store_1.FileStore("/Users/username/ts_sdk_tokens.txt"); /* * autoRefreshFields * if true - all the modules' fields will be auto-refreshed in the background, every hour. * if false - the fields will not be auto-refreshed in the background. The user can manually delete the file(s) or refresh the fields using methods from ModuleFieldsHandler(utils/util/module_fields_handler.js) * * pickListValidation * A boolean field that validates user input for a pick list field and allows or disallows the addition of a new value to the list. * True - the SDK validates the input. If the value does not exist in the pick list, the SDK throws an error. * False - the SDK does not validate the input and makes the API request with the user’s input to the pick list */ let sdkConfig = new sdk_config_builder_1.SDKConfigBuilder().pickListValidation(false).autoRefreshFields(true).build(); /* * The path containing the absolute directory path to store user specific JSON files containing module fields information. */ let resourcePath = "/Users/user_name/Documents/ts-app"; /* * Call the static initialize method of Initializer class that takes the following arguments * user -> UserSignature instance * environment -> Environment instance * token -> Token instance * store -> TokenStore instance * SDKConfig -> SDKConfig instance * resourcePath -> resourcePath * logger -> Logger instance */ try { (await new initialize_builder_1.InitializeBuilder()) .user(user1) .environment(environment1) .token(token1) .store(store) .SDKConfig(sdkConfig) .resourcePath(resourcePath) .logger(logger) .initialize(); } catch (error) { console.log(error); } await SampleRecord.getRecords("leads"); // await Initializer.removeUserConfiguration(user1, environment1); // let user2: UserSignature = new UserSignature("abc2@zoho.eu"); // let environment2: Environment = EUDataCenter.SANDBOX(); // let token2: OAuthToken = new OAuthBuilder() // .clientId("clientId") // .clientSecret("clientSecret") // .grantToken("grantToken") // .refreshToken("refreshToken") // .redirectURL("https://www.zoho.com") // .build(); // let sdkConfig2: SDKConfig = new SDKConfigBuilder() // .pickListValidation(true) // .autoRefreshFields(true) // .build(); // (await new InitializeBuilder()) // .user(user2) // .environment(environment2) // .token(token2) // .SDKConfig(sdkConfig2) // // .requestProxy(requestProxy) // .switchUser(); // await SampleRecord.getRecords("Leads"); } static async getRecords(moduleAPIName) { try { let moduleAPIName = "Leads"; //Get instance of RecordOperations Class let recordOperations = new record_operations_1.RecordOperations(); let paramInstance = new parameter_map_1.ParameterMap(); await paramInstance.add(record_operations_1.GetRecordsParam.APPROVED, "both"); let headerInstance = new header_map_1.HeaderMap(); await headerInstance.add(record_operations_1.GetRecordsHeader.IF_MODIFIED_SINCE, new Date("2020-01-01T00:00:00+05:30")); //Call getRecords method that takes paramInstance, headerInstance and moduleAPIName as parameters let response = await recordOperations.getRecords(moduleAPIName, paramInstance, headerInstance); if (response != null) { //Get the status code from response console.log("Status Code: " + response.getStatusCode()); if ([204, 304].includes(response.getStatusCode())) { console.log(response.getStatusCode() == 204 ? "No Content" : "Not Modified"); return; } //Get the object from response let responseObject = response.getObject(); if (responseObject != null) { //Check if expected ResponseWrapper instance is received if (responseObject instanceof response_wrapper_1.ResponseWrapper) { //Get the array of obtained Record instances let records = responseObject.getData(); for (let record of records) { //Get the ID of each Record console.log("Record ID: " + record.getId()); //Get the createdBy User instance of each Record let createdBy = record.getCreatedBy(); //Check if createdBy is not null if (createdBy != null) { //Get the ID of the createdBy User console.log("Record Created By User-ID: " + createdBy.getId()); //Get the name of the createdBy User console.log("Record Created By User-Name: " + createdBy.getName()); //Get the Email of the createdBy User console.log("Record Created By User-Email: " + createdBy.getEmail()); } //Get the CreatedTime of each Record console.log("Record CreatedTime: " + record.getCreatedTime()); //Get the modifiedBy User instance of each Record let modifiedBy = record.getModifiedBy(); //Check if modifiedBy is not null if (modifiedBy != null) { //Get the ID of the modifiedBy User console.log("Record Modified By User-ID: " + modifiedBy.getId()); //Get the name of the modifiedBy User console.log("Record Modified By User-Name: " + modifiedBy.getName()); //Get the Email of the modifiedBy User console.log("Record Modified By User-Email: " + modifiedBy.getEmail()); } //Get the ModifiedTime of each Record console.log("Record ModifiedTime: " + record.getModifiedTime()); //Get the list of Tag instance each Record let tags = record.getTag(); //Check if tags is not null if (tags != null) { tags.forEach(tag => { //Get the Name of each Tag console.log("Record Tag Name: " + tag.getName()); //Get the Id of each Tag console.log("Record Tag ID: " + tag.getId()); }); } //To get particular field value console.log("Record Field Value: " + record.getKeyValue("Last_Name")); // FieldApiName console.log("Record KeyValues: "); let keyValues = record.getKeyValues(); let keyArray = Array.from(keyValues.keys()); for (let keyName of keyArray) { let value = keyValues.get(keyName); console.log(keyName + " : " + value); } } } } } } catch (error) { console.log(error); } } } SampleRecord.call(); //# sourceMappingURL=multi_thread.js.map
53.772727
216
0.563229
6a0d5a0619672313c8a9a480245f5e85d7ff9f50
820
js
JavaScript
Code/commands/puzzles/connect-four/game/connect-4-show-game.js
jojo2357/jojos-bot
8b4556b9d9d41ce4e74d3e416f90559c722ba1e5
[ "MIT" ]
104
2020-10-08T15:10:47.000Z
2020-12-03T23:17:26.000Z
Code/commands/puzzles/connect-four/game/connect-4-show-game.js
jojo2357/jojos-bot
8b4556b9d9d41ce4e74d3e416f90559c722ba1e5
[ "MIT" ]
null
null
null
Code/commands/puzzles/connect-four/game/connect-4-show-game.js
jojo2357/jojos-bot
8b4556b9d9d41ce4e74d3e416f90559c722ba1e5
[ "MIT" ]
2
2020-10-25T23:42:38.000Z
2020-11-21T19:13:55.000Z
const Manager = require('./connect-4-game-holder.js'); module.exports = { commands: ['show'], minArgs: 0, maxArgs: 0, callback: (message) => { if (Manager.usersGame('<@' + message.author + '>') != null) if (Manager.usersGame('<@' + message.author + '>').channel[Manager.usersGame('<@' + message.author + '>').turn - 1].id == message.channel.id) Manager.usersGame('<@' + message.author + '>').sysoutBoard(); else message.reply("somethin sus, here's a suggestion: " + Manager.usersGame('<@' + message.author + '>').channel[Manager.usersGame('<@' + message.author + '>').players.indexOf('<@' + message.author + '>')]) else message.channel.send("You don't have a game in progress! Use `=connect-4` to start one!"); } }
51.25
218
0.565854
6a0d88da43f6f9cfb98369271156e200384c4a65
3,829
js
JavaScript
machine_learning/flappy bird/neuralnetwork.js
willigro/Self-Challenges
67d35afebd9ac8acb910ec0af6ee217d55af40de
[ "Apache-2.0" ]
null
null
null
machine_learning/flappy bird/neuralnetwork.js
willigro/Self-Challenges
67d35afebd9ac8acb910ec0af6ee217d55af40de
[ "Apache-2.0" ]
3
2020-04-18T17:43:58.000Z
2020-04-18T17:53:47.000Z
machine_learning/flappy bird/neuralnetwork.js
willigro/Self-Challenges
67d35afebd9ac8acb910ec0af6ee217d55af40de
[ "Apache-2.0" ]
null
null
null
class Brain { constructor() { this.inputLayer = [] this.hiddenLayer = [] this.hiddenLayer2 = [] this.outputLayer = [] this.bias = [] this.chanceToChange = .3 this.resultInput this.resultHidden this.resultHidden2 this.resultOutput this.learningRate = 0.03 for (let i = 0; i < 3; i++) { this.bias.push(this.newBias()) } for (let i = 0; i < 2; i++) { this.inputLayer.push(this.random()) } for (let i = 0; i < 3; i++) { this.hiddenLayer.push(this.random()) } for (let i = 0; i < 1; i++) { this.outputLayer.push(this.random()) } } newBias() { return Math.random() > .5 ? 1 : 0 // return 1 } log() { console.log("inputLayer", this.inputLayer) console.log("hiddenLayer", this.hiddenLayer) console.log("outputLayer", this.outputLayer) } copy(brain, keep) { if (!keep) { for (let i in this.bias) { this.bias[i] = this.newBias() } } this.inputLayer = brain.inputLayer.slice() this.hiddenLayer = brain.hiddenLayer.slice() this.outputLayer = brain.outputLayer.slice() if (keep) return for (let i in this.inputLayer) { this.inputLayer[i] = this.newWeight(this.inputLayer[i]) } for (let i in this.hiddenLayer) { this.hiddenLayer[i] = this.newWeight(this.hiddenLayer[i]) } for (let i in this.outputLayer) { this.outputLayer[i] = this.newWeight(this.outputLayer[i]) } } predict(input) { // console.log(input) this.resultInput = [] for (let h in this.inputLayer) { let sum = 0 for (let i in input) { sum += input[i] * this.inputLayer[h] } this.resultInput.push(this.activation(sum + this.bias[0])) } this.resultHidden = [] for (let h in this.hiddenLayer) { let sum = 0 for (let i in this.resultInput) { sum += this.resultInput[i] * this.hiddenLayer[h] } this.resultHidden.push(this.activation(sum + this.bias[1])) } this.resultOutput = [] for (let o in this.outputLayer) { let sum = 0 for (let r in this.resultHidden) { sum += this.resultHidden[r] * this.outputLayer[o] } this.resultOutput.push(this.activation(sum + this.bias[2])) } return this.resultOutput } activation(x) { // return x return ((x < 0) ? 0 : x); // return 1 / (1 + Math.exp(-x)) } newWeight(x) { // return Math.random() > .5 ? x - this.learningRate : x + this.learningRate // return x - this.learningRate return this.random() } random() { const r = Math.random() return Math.random() > .5 ? r * -1 : r } } class Genetic { constructor() { this.best = null } envolve(dinos) { this.best = null for (let i in dinos) { if (this.best) { if (dinos[i].score > this.best.score) this.best = dinos[i] } else { this.best = dinos[i] } } // this.best.log() const newBirds = [] var bird = new Bird() bird.copy(this.best, true) newBirds.push(bird) for (let i = 0; i < POPULATION - 1; i++) { bird = new Bird() if (Math.random() > .1) bird.copy(this.best) newBirds.push(bird) } return newBirds } }
25.190789
84
0.480282
6a0df1d7b69a376b065b08a183ad11e60aacca6e
2,498
js
JavaScript
packages/integration-karma/test/template/directive-for-each/index.spec.js
swanaselja/lwc
7efada0df77ce28d8536ef4859c31fb12c0d783a
[ "MIT" ]
1
2020-04-08T16:53:32.000Z
2020-04-08T16:53:32.000Z
packages/integration-karma/test/template/directive-for-each/index.spec.js
swanaselja/lwc
7efada0df77ce28d8536ef4859c31fb12c0d783a
[ "MIT" ]
3
2022-02-14T22:02:42.000Z
2022-03-08T23:38:21.000Z
packages/integration-karma/test/template/directive-for-each/index.spec.js
swanaselja/lwc
7efada0df77ce28d8536ef4859c31fb12c0d783a
[ "MIT" ]
null
null
null
import { createElement } from 'lwc'; import XTest from 'x/test'; import ArrayNullPrototype from 'x/arrayNullPrototype'; function testForEach(type, obj) { it(`should render ${type}`, () => { const elm = createElement('x-test', { is: XTest }); document.body.appendChild(elm); expect(elm.shadowRoot.querySelector('ul').childElementCount).toBe(0); elm.items = obj; return Promise.resolve() .then(() => { const ul = elm.shadowRoot.querySelector('ul'); expect(ul.childElementCount).toBe(3); expect(ul.children[0].textContent).toBe('one'); expect(ul.children[1].textContent).toBe('two'); expect(ul.children[2].textContent).toBe('three'); elm.items = []; }) .then(() => { expect(elm.shadowRoot.querySelector('ul').childElementCount).toBe(0); }); }); } testForEach('Array', [ { key: 1, value: 'one' }, { key: 2, value: 'two' }, { key: 3, value: 'three' }, ]); function* itemGenerator() { yield { key: 1, value: 'one' }; yield { key: 2, value: 'two' }; yield { key: 3, value: 'three' }; } testForEach('Generator', { [Symbol.iterator]: itemGenerator }); function iterator() { let index = 0; const items = ['one', 'two', 'three']; return { next() { index++; return index > 3 ? { done: true } : { value: { key: index, value: items[index - 1] }, done: false, }; }, }; } testForEach('Iterator', { [Symbol.iterator]: iterator }); // TODO: #1285 - revisit xit('should throw an error when the passing a non iterable', () => { const elm = createElement('x-test', { is: XTest }); elm.items = {}; // TODO: #1283 - Improve this error message. The vm should not be exposed and the message is not helpful. expect(() => document.body.appendChild(elm)).toThrowError( /Invalid template iteration for value `\[object Object\]` in \[object:vm undefined \(\d+\)\]. It must be an array-like object and not `null` nor `undefined`./ ); }); it('should render an array of objects with null prototype', () => { const elm = createElement('x-array-null-prototype', { is: ArrayNullPrototype }); document.body.appendChild(elm); expect(elm.shadowRoot.querySelector('span').textContent).toBe('text'); });
32.025641
166
0.555244
6a0e0fc964d1b1ac9a9f2a5ea01fe91ba80dd936
319
js
JavaScript
src/packets/PacketSubtitles.js
DanielHuisman/transportstream.js
7faa36ff64c07a8a9f8c906d6fb0c3cbac2fecd6
[ "ISC" ]
6
2017-01-23T11:39:02.000Z
2018-10-05T12:18:34.000Z
src/packets/PacketSubtitles.js
hsg210/transportstream.js
b7cedb8edf9bfccb7a6ec57dd61a6847f5c319f4
[ "ISC" ]
1
2018-03-13T03:37:53.000Z
2018-03-13T12:57:40.000Z
src/packets/PacketSubtitles.js
hsg210/transportstream.js
b7cedb8edf9bfccb7a6ec57dd61a6847f5c319f4
[ "ISC" ]
2
2017-01-04T18:32:21.000Z
2018-03-13T06:24:45.000Z
import Packet from './Packet'; export class SubtitleSegment { type = 0; pageId = 0; length = 0; data = null; parsedData = null; }; export default class PacketSubtitles extends Packet { identifier = 0; streamId = 0; segments = []; constructor(data) { super(data); } };
15.95
53
0.586207
6a0e2ee9892991290331b8c3152ec24810bcfc00
2,147
js
JavaScript
slashCommands/Settings/defaultautoplay.js
peter00704/zenebotv13slashcommand
63f6e2ef7bcd3f563422b9b965151c23cf1d4b3b
[ "MIT" ]
null
null
null
slashCommands/Settings/defaultautoplay.js
peter00704/zenebotv13slashcommand
63f6e2ef7bcd3f563422b9b965151c23cf1d4b3b
[ "MIT" ]
null
null
null
slashCommands/Settings/defaultautoplay.js
peter00704/zenebotv13slashcommand
63f6e2ef7bcd3f563422b9b965151c23cf1d4b3b
[ "MIT" ]
null
null
null
const { MessageEmbed } = require("discord.js"); const config = require("../../botconfig/config.json"); const ee = require("../../botconfig/embed.json"); const settings = require("../../botconfig/settings.json"); module.exports = { name: "defaultautoplay", //the command name for execution & for helpcmd [OPTIONAL] cooldown: 10, //the command cooldown for execution & for helpcmd [OPTIONAL] description: "Defines if Autoplay should be enabled on default or not!", //the command description for helpcmd [OPTIONAL] memberpermissions: ["MANAGE_GUILD "], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] run: async (client, interaction) => { try { //things u can directly access in an interaction! const { member, channelId, guildId, applicationId, commandName, deferred, replied, ephemeral, options, id, createdTimestamp } = interaction; const { guild } = member; client.settings.ensure(guild.id, { defaultvolume: 50, defaultautoplay: false, defaultfilters: [`bassboost6`, `clear`] }); client.settings.set(guild.id, !client.settings.get(guild.id, "defaultautoplay"), "defaultautoplay"); return interaction.reply({ embeds: [ new MessageEmbed() .setColor(ee.color) .setFooter(ee.footertext, ee.footericon) .setTitle(`${client.allEmojis.check_mark} **The Default-Autoplay got __\`${client.settings.get(guild.id, "defaultautoplay") ? "Enabled" : "Disabled"}\`__!**`) ], }) } catch (e) { console.log(String(e.stack).bgRed) } } } /** * @INFO * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template * @INFO * Work for Milrato Development | https://milrato.eu * @INFO * Please mention Him / Milrato Development, when using this Code! * @INFO */
34.629032
168
0.6381
6a0e51bbf7c38ae9617bee570799c454ae508194
2,101
js
JavaScript
saleor/static/dashboard/js/components/image-gallery.js
tanjibpa/alrawaa
c28fbe7becd43b9de1575346fe8c29cee5f36de1
[ "BSD-3-Clause" ]
null
null
null
saleor/static/dashboard/js/components/image-gallery.js
tanjibpa/alrawaa
c28fbe7becd43b9de1575346fe8c29cee5f36de1
[ "BSD-3-Clause" ]
1
2022-02-10T08:53:52.000Z
2022-02-10T08:53:52.000Z
saleor/static/dashboard/js/components/image-gallery.js
BiaoLiu/saleor
d3de4d8ee69208d73539194b71449498f8e5e81f
[ "BSD-3-Clause" ]
1
2020-09-29T14:21:31.000Z
2020-09-29T14:21:31.000Z
import Dropzone from 'dropzone'; import Sortable from 'sortablejs'; export default $(document).ready((e) => { $('#product-image-form').dropzone({ paramName: 'image_0', maxFilesize: 20, previewsContainer: '.product-gallery', thumbnailWidth: 400, thumbnailHeight: 400, previewTemplate: $('#template').html(), method: 'POST', clickable: '.dropzone-message', init: function () { this.on('success', function (e, response) { $(e.previewElement).find('.product-gallery-item-desc').html(response.image); $(e.previewElement).attr('data-id', response.id); let editLinkHref = $(e.previewElement).find('.card-action-edit').attr('href'); editLinkHref = editLinkHref.split('/'); editLinkHref[editLinkHref.length - 2] = response.id; $(e.previewElement).find('.card-action-edit').attr('href', editLinkHref.join('/')); $(e.previewElement).find('.card-action-edit').show(); let deleteLinkHref = $(e.previewElement).find('.card-action-delete').attr('data-href'); deleteLinkHref = deleteLinkHref.split('/'); deleteLinkHref[deleteLinkHref.length - 3] = response.id; $(e.previewElement).find('.card-action-delete').attr('data-href', deleteLinkHref.join('/')); $(e.previewElement).find('.card-action-delete').show(); $('.no-images').addClass('hide'); }); } }); let el = document.getElementById('product-gallery'); if (el) { Sortable.create(el, { handle: '.sortable__drag-area', onUpdate: function () { let orderedImages = (function() { let postData = []; $(el).find('.product-gallery-item[data-id]').each(function() { postData.push($(this).data('id')); }); return postData; })(); $.ajax({ method: 'POST', url: $(el).data('post-url'), data: {ordered_images: orderedImages}, traditional: true, headers: { 'X-CSRFToken': $('[name=csrfmiddlewaretoken]').val() } }); } }); } });
36.224138
100
0.578296
6a0eb09245de8d00458577f36ac818602d5276bd
5,915
js
JavaScript
lib/UsersClient/index.js
davidmus/symphony-api-client-node
e75797422108a14500617b4110e57c9eb60faf49
[ "MIT" ]
null
null
null
lib/UsersClient/index.js
davidmus/symphony-api-client-node
e75797422108a14500617b4110e57c9eb60faf49
[ "MIT" ]
null
null
null
lib/UsersClient/index.js
davidmus/symphony-api-client-node
e75797422108a14500617b4110e57c9eb60faf49
[ "MIT" ]
null
null
null
const https = require('https') const Q = require('kew') const SymConfigLoader = require('../SymConfigLoader') const SymBotAuth = require('../SymBotAuth') var UsersClient = {} // Look up user with a username via https://rest-api.symphony.com/reference#user-lookup UsersClient.getUserFromUsername = (username) => { var defer = Q.defer() var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': '/pod/v2/user?username=' + username, 'method': 'GET', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/getUserFromUsername/str', str) } defer.resolve(JSON.parse(str)) }) }) req.end() return defer.promise } // Look up user with an email via https://rest-api.symphony.com/reference#user-lookup UsersClient.getUserFromEmail = (email, local) => { var defer = Q.defer() var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': '/pod/v2/user?email=' + email + '&local=' + (local ? 'true' : 'false'), 'method': 'GET', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/getUserFromEmail/str', str) } defer.resolve(JSON.parse(str)) }) }) req.end() return defer.promise } // Look up user with an email via https://rest-api.symphony.com/reference#users-lookup-v3 UsersClient.getUserFromEmailV3 = (email, local) => { var defer = Q.defer() var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': '/pod/v3/users?email=' + email + '&local=' + (local ? 'true' : 'false'), 'method': 'GET', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/getUserFromEmailV3/str', str) } defer.resolve(JSON.parse(str)) }) }) req.end() return defer.promise } // Look up user with a userID via https://rest-api.symphony.com/reference#users-lookup-v3 UsersClient.getUserFromIdV3 = (id, local) => { var defer = Q.defer() var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': '/pod/v3/users?uid=' + id + '&local=' + (local ? 'true' : 'false'), 'method': 'GET', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/getUserFromIdV3/str', str) } defer.resolve(JSON.parse(str)) }) }) req.end() return defer.promise } // Look up multiple users with an email via https://rest-api.symphony.com/reference#users-lookup-v3 UsersClient.getUsersFromEmailList = (emailList, local) => { return UsersClient.getUsersV3(emailList, '', local) } // Look up multiple users with userIDs via https://rest-api.symphony.com/reference#users-lookup-v3 UsersClient.getUsersFromIdList = (idList, local) => { return UsersClient.getUsersV3('', idList, local) } UsersClient.getUsersV3 = (emailList, idList, local) => { var defer = Q.defer() var listPart = (emailList ? `email=${emailList}` : `uid=${idList}`); var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': `/pod/v3/users${listPart}&local=${(local ? 'true' : 'false')}`, 'method': 'GET', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/getUsersV3/str', str) } defer.resolve(JSON.parse(str)) }) }) req.end() return defer.promise } // Search for users using https://rest-api.symphony.com/reference#search-users UsersClient.searchUsers = (query, local, skip, limit, filter) => { var defer = Q.defer() var options = { 'hostname': SymConfigLoader.SymConfig.podHost, 'port': SymConfigLoader.SymConfig.podPort, 'path': '/pod/v1/user/search?local=' + (local ? 'true' : 'false') + '&skip=' + skip + '&limit=' + limit, 'method': 'POST', 'headers': { 'sessionToken': SymBotAuth.sessionAuthToken }, 'agent': SymConfigLoader.SymConfig.proxy } var body = { 'query': query, 'filter': filter } var req = https.request(options, function (res) { var str = '' res.on('data', function (chunk) { str += chunk }) res.on('end', function () { if (SymBotAuth.debug) { console.log('[DEBUG]', 'UsersClient/searchUsers/str', str) } defer.resolve(JSON.parse(str)) }) }) req.write(body) req.end() return defer.promise } module.exports = UsersClient
26.644144
108
0.623669
6a0ec921fe53c0b73333d26b4e6551b187e33bb5
1,152
js
JavaScript
dist/esm/internal/operators/take.js
openforis/rxjs
b73928f43da982b0a0dfc6742c291957c345b513
[ "Apache-2.0" ]
null
null
null
dist/esm/internal/operators/take.js
openforis/rxjs
b73928f43da982b0a0dfc6742c291957c345b513
[ "Apache-2.0" ]
null
null
null
dist/esm/internal/operators/take.js
openforis/rxjs
b73928f43da982b0a0dfc6742c291957c345b513
[ "Apache-2.0" ]
null
null
null
import { Subscriber } from '../Subscriber'; import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError'; import { EMPTY } from '../observable/empty'; export function take(count) { if (isNaN(count)) { throw new TypeError(`'count' is not a number`); } if (count < 0) { throw new ArgumentOutOfRangeError; } return (source) => (count === 0) ? EMPTY : source.lift(new TakeOperator(count)); } class TakeOperator { constructor(count) { this.count = count; } call(subscriber, source) { return source.subscribe(new TakeSubscriber(subscriber, this.count)); } } class TakeSubscriber extends Subscriber { constructor(destination, count) { super(destination); this.count = count; this._valueCount = 0; } _next(value) { const total = this.count; const count = ++this._valueCount; if (count <= total) { this.destination.next(value); if (count === total) { this.destination.complete(); this.unsubscribe(); } } } } //# sourceMappingURL=take.js.map
29.538462
84
0.58941
6a0f2bb727449c0d5011b3f994500074424a57e4
2,210
js
JavaScript
src/store/index.js
peterkshultz/karrot-frontend-1
42678a87805199984a5f1c6a2797a53d79666d51
[ "MIT" ]
null
null
null
src/store/index.js
peterkshultz/karrot-frontend-1
42678a87805199984a5f1c6a2797a53d79666d51
[ "MIT" ]
null
null
null
src/store/index.js
peterkshultz/karrot-frontend-1
42678a87805199984a5f1c6a2797a53d79666d51
[ "MIT" ]
null
null
null
import Vue from 'vue' import Vuex from 'vuex' import conversationsPlugin from './plugins/conversations' import persistedState from './plugins/persistedState' import i18nPlugin from './plugins/i18n' import router from './plugins/router' import loadingProgressReporter from './plugins/loadingProgressReporter' import dependentState from './plugins/dependentState' // Alphabetical import about from './modules/about' import agreements from './modules/agreements' import alerts from './modules/alerts' import auth from './modules/auth' import breadcrumbs from './modules/breadcrumbs' import conversations from './modules/conversations' import currentGroup from './modules/currentGroup' import deleteAccount from './modules/deleteAccount' import fcm, { plugin as fcmPlugin } from './modules/fcm' import feedback from './modules/feedback' import groups from './modules/groups' import history from './modules/history' import i18n from './modules/i18n' import invitations from './modules/invitations' import loadingprogress from './modules/loadingprogress' import pickups from './modules/pickups' import pickupSeries from './modules/pickupSeries' import presence from './modules/presence' import route from './modules/route' import routeError from './modules/routeError' import search from './modules/search' import sidenavBoxes from './modules/sidenavBoxes' import stores from './modules/stores' import timezones from './modules/timezones' import users from './modules/users' import verifymail from './modules/verifymail' Vue.use(Vuex) const debug = process.env.NODE_ENV !== 'production' export default new Vuex.Store({ modules: { // Alphabetical, too about, agreements, alerts, auth, breadcrumbs, conversations, currentGroup, deleteAccount, fcm, feedback, groups, history, i18n, invitations, loadingprogress, pickups, pickupSeries, presence, route, routeError, search, sidenavBoxes, stores, timezones, users, verifymail, }, plugins: [ conversationsPlugin, i18nPlugin, persistedState, router, loadingProgressReporter, dependentState, fcmPlugin, ], strict: debug, })
26.309524
71
0.737104
6a0f7102fdb04faabb56015ff4d63c9b94861b6a
326
js
JavaScript
test/react/ModalTitle.spec.js
AkivaGubbay/onap-ui-react
b620732010022fe3bd1117f0bc3b6c8328373dbd
[ "MIT" ]
null
null
null
test/react/ModalTitle.spec.js
AkivaGubbay/onap-ui-react
b620732010022fe3bd1117f0bc3b6c8328373dbd
[ "MIT" ]
13
2019-06-19T08:48:25.000Z
2022-02-26T11:56:57.000Z
test/react/ModalTitle.spec.js
AkivaGubbay/onap-ui-react
b620732010022fe3bd1117f0bc3b6c8328373dbd
[ "MIT" ]
3
2019-02-10T11:07:17.000Z
2019-07-10T08:23:36.000Z
import React from 'react'; import ModalTitle from '../../src/components/ModalTitle.js'; import renderer from 'react-test-renderer'; describe('ModalTitle', () => { test('basic test', () => { const header = renderer.create(<ModalTitle>Title</ModalTitle>).toJSON(); expect(header).toMatchSnapshot(); }); });
29.636364
85
0.656442
6a100d519d45cc5b15e7456b5b6fa862569b7e84
12,599
es6
JavaScript
app/assets/javascripts/discourse/models/post.js.es6
threefoldtech/threefold-forums
bf999696fdf5a96c37aed0134af8115ccd9a79ab
[ "Apache-2.0" ]
null
null
null
app/assets/javascripts/discourse/models/post.js.es6
threefoldtech/threefold-forums
bf999696fdf5a96c37aed0134af8115ccd9a79ab
[ "Apache-2.0" ]
5
2020-04-02T10:09:47.000Z
2021-07-05T12:59:51.000Z
app/assets/javascripts/discourse/models/post.js.es6
threefoldtech/threefold-forums
bf999696fdf5a96c37aed0134af8115ccd9a79ab
[ "Apache-2.0" ]
null
null
null
import discourseComputed from "discourse-common/utils/decorators"; import { computed, get } from "@ember/object"; import { isEmpty } from "@ember/utils"; import { equal, and, or, not } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; import { popupAjaxError } from "discourse/lib/ajax-error"; import ActionSummary from "discourse/models/action-summary"; import { propertyEqual } from "discourse/lib/computed"; import Quote from "discourse/lib/quote"; import { postUrl } from "discourse/lib/utilities"; import { cookAsync } from "discourse/lib/text"; import { userPath } from "discourse/lib/url"; import Composer from "discourse/models/composer"; import { Promise } from "rsvp"; import Site from "discourse/models/site"; import User from "discourse/models/user"; import showModal from "discourse/lib/show-modal"; const Post = RestModel.extend({ // TODO: Remove this once one instantiate all `Discourse.Post` models via the store. siteSettings: computed({ get() { return Discourse.SiteSettings; }, // prevents model created from json to overridde this property set() { return Discourse.SiteSettings; } }), @discourseComputed("url") shareUrl(url) { const user = User.current(); const userSuffix = user ? `?u=${user.username_lower}` : ""; if (this.firstPost) { return this.get("topic.url") + userSuffix; } else { return url + userSuffix; } }, new_user: equal("trust_level", 0), firstPost: equal("post_number", 1), // Posts can show up as deleted if the topic is deleted deletedViaTopic: and("firstPost", "topic.deleted_at"), deleted: or("deleted_at", "deletedViaTopic"), notDeleted: not("deleted"), @discourseComputed("name", "username") showName(name, username) { return ( name && name !== username && Discourse.SiteSettings.display_name_on_posts ); }, @discourseComputed("firstPost", "deleted_by", "topic.deleted_by") postDeletedBy(firstPost, deletedBy, topicDeletedBy) { return firstPost ? topicDeletedBy : deletedBy; }, @discourseComputed("firstPost", "deleted_at", "topic.deleted_at") postDeletedAt(firstPost, deletedAt, topicDeletedAt) { return firstPost ? topicDeletedAt : deletedAt; }, @discourseComputed("post_number", "topic_id", "topic.slug") url(post_number, topic_id, topicSlug) { return postUrl( topicSlug || this.topic_slug, topic_id || this.get("topic.id"), post_number ); }, // Don't drop the /1 @discourseComputed("post_number", "url") urlWithNumber(postNumber, baseUrl) { return postNumber === 1 ? `${baseUrl}/1` : baseUrl; }, @discourseComputed("username") usernameUrl: userPath, topicOwner: propertyEqual("topic.details.created_by.id", "user_id"), updatePostField(field, value) { const data = {}; data[field] = value; return ajax(`/posts/${this.id}/${field}`, { type: "PUT", data }) .then(() => this.set(field, value)) .catch(popupAjaxError); }, @discourseComputed("link_counts.@each.internal") internalLinks() { if (isEmpty(this.link_counts)) return null; return this.link_counts.filterBy("internal").filterBy("title"); }, @discourseComputed("actions_summary.@each.can_act") flagsAvailable() { // TODO: Investigate why `this.site` is sometimes null when running // Search - Search with context if (!this.site) { return []; } return this.site.flagTypes.filter(item => this.get(`actionByName.${item.name_key}.can_act`) ); }, afterUpdate(res) { if (res.category) { this.site.updateCategory(res.category); } }, updateProperties() { return { post: { raw: this.raw, edit_reason: this.editReason }, image_sizes: this.imageSizes }; }, createProperties() { // composer only used once, defer the dependency const data = this.getProperties(Composer.serializedFieldsForCreate()); data.reply_to_post_number = this.reply_to_post_number; data.image_sizes = this.imageSizes; const metaData = this.metaData; // Put the metaData into the request if (metaData) { data.meta_data = {}; Object.keys(metaData).forEach( key => (data.meta_data[key] = metaData[key]) ); } return data; }, // Expands the first post's content, if embedded and shortened. expand() { return ajax(`/posts/${this.id}/expand-embed`).then(post => { this.set( "cooked", `<section class="expanded-embed">${post.cooked}</section>` ); }); }, // Recover a deleted post recover() { const initProperties = this.getProperties( "deleted_at", "deleted_by", "user_deleted", "can_delete" ); this.setProperties({ deleted_at: null, deleted_by: null, user_deleted: false, can_delete: false }); return ajax(`/posts/${this.id}/recover`, { type: "PUT", cache: false }) .then(data => { this.setProperties({ cooked: data.cooked, raw: data.raw, user_deleted: false, can_delete: true, version: data.version }); }) .catch(error => { popupAjaxError(error); this.setProperties(initProperties); }); }, /** Changes the state of the post to be deleted. Does not call the server, that should be done elsewhere. **/ setDeletedState(deletedBy) { let promise; this.set("oldCooked", this.cooked); // Moderators can delete posts. Users can only trigger a deleted at message, unless delete_removed_posts_after is 0. if ( deletedBy.staff || Discourse.SiteSettings.delete_removed_posts_after === 0 ) { this.setProperties({ deleted_at: new Date(), deleted_by: deletedBy, can_delete: false, can_recover: true }); } else { const key = this.post_number === 1 ? "topic.deleted_by_author" : "post.deleted_by_author"; promise = cookAsync( I18n.t(key, { count: Discourse.SiteSettings.delete_removed_posts_after }) ).then(cooked => { this.setProperties({ cooked: cooked, can_delete: false, version: this.version + 1, can_recover: true, can_edit: false, user_deleted: true }); }); } return promise || Promise.resolve(); }, /** Changes the state of the post to NOT be deleted. Does not call the server. This can only be called after setDeletedState was called, but the delete failed on the server. **/ undoDeleteState() { if (this.oldCooked) { this.setProperties({ deleted_at: null, deleted_by: null, cooked: this.oldCooked, version: this.version - 1, can_recover: false, can_delete: true, user_deleted: false }); } }, destroy(deletedBy) { return this.setDeletedState(deletedBy).then(() => { return ajax("/posts/" + this.id, { data: { context: window.location.pathname }, type: "DELETE" }); }); }, /** Updates a post from another's attributes. This will normally happen when a post is loading but is already found in an identity map. **/ updateFromPost(otherPost) { Object.keys(otherPost).forEach(key => { let value = otherPost[key], oldValue = this[key]; if (!value) { value = null; } if (!oldValue) { oldValue = null; } let skip = false; if (typeof value !== "function" && oldValue !== value) { // wishing for an identity map if (key === "reply_to_user" && value && oldValue) { skip = value.username === oldValue.username || get(value, "username") === get(oldValue, "username"); } if (!skip) { this.set(key, value); } } }); }, expandHidden() { return ajax(`/posts/${this.id}/cooked.json`).then(result => { this.setProperties({ cooked: result.cooked, cooked_hidden: false }); }); }, rebake() { return ajax(`/posts/${this.id}/rebake`, { type: "PUT" }); }, unhide() { return ajax(`/posts/${this.id}/unhide`, { type: "PUT" }); }, toggleBookmark() { let bookmarkedTopic; this.toggleProperty("bookmarked"); if (this.bookmarked && !this.get("topic.bookmarked")) { this.set("topic.bookmarked", true); bookmarkedTopic = true; } // need to wait to hear back from server (stuff may not be loaded) return Post.updateBookmark(this.id, this.bookmarked) .then(result => { this.set("topic.bookmarked", result.topic_bookmarked); this.appEvents.trigger("page:bookmark-post-toggled", this); }) .catch(error => { this.toggleProperty("bookmarked"); if (bookmarkedTopic) { this.set("topic.bookmarked", false); } throw new Error(error); }); }, toggleBookmarkWithReminder() { this.toggleProperty("bookmarked_with_reminder"); if (this.bookmarked_with_reminder) { let controller = showModal("bookmark", { model: { postId: this.id }, title: "post.bookmarks.create", modalClass: "bookmark-with-reminder" }); controller.setProperties({ onCloseWithoutSaving: () => { this.toggleProperty("bookmarked_with_reminder"); this.appEvents.trigger("post-stream:refresh", { id: this.id }); }, afterSave: reminderAtISO => { this.set("bookmark_reminder_at", reminderAtISO); this.appEvents.trigger("post-stream:refresh", { id: this.id }); } }); } else { this.set("bookmark_reminder_at", null); return Post.destroyBookmark(this.id) .then(() => this.appEvents.trigger("page:bookmark-post-toggled", this)) .catch(error => { this.toggleProperty("bookmarked_with_reminder"); throw new Error(error); }); } }, updateActionsSummary(json) { if (json && json.id === this.id) { json = Post.munge(json); this.set("actions_summary", json.actions_summary); } }, revertToRevision(version) { return ajax(`/posts/${this.id}/revisions/${version}/revert`, { type: "PUT" }); } }); Post.reopenClass({ munge(json) { if (json.actions_summary) { const lookup = EmberObject.create(); // this area should be optimized, it is creating way too many objects per post json.actions_summary = json.actions_summary.map(a => { a.actionType = Site.current().postActionTypeById(a.id); a.count = a.count || 0; const actionSummary = ActionSummary.create(a); lookup[a.actionType.name_key] = actionSummary; if (a.actionType.name_key === "like") { json.likeAction = actionSummary; } return actionSummary; }); json.actionByName = lookup; } if (json && json.reply_to_user) { json.reply_to_user = User.create(json.reply_to_user); } return json; }, updateBookmark(postId, bookmarked) { return ajax(`/posts/${postId}/bookmark`, { type: "PUT", data: { bookmarked } }); }, destroyBookmark(postId) { return ajax(`/posts/${postId}/bookmark`, { type: "DELETE" }); }, deleteMany(post_ids, { agreeWithFirstReplyFlag = true } = {}) { return ajax("/posts/destroy_many", { type: "DELETE", data: { post_ids, agree_with_first_reply_flag: agreeWithFirstReplyFlag } }); }, mergePosts(post_ids) { return ajax("/posts/merge_posts", { type: "PUT", data: { post_ids } }); }, loadRevision(postId, version) { return ajax(`/posts/${postId}/revisions/${version}.json`).then(result => EmberObject.create(result) ); }, hideRevision(postId, version) { return ajax(`/posts/${postId}/revisions/${version}/hide`, { type: "PUT" }); }, showRevision(postId, version) { return ajax(`/posts/${postId}/revisions/${version}/show`, { type: "PUT" }); }, loadQuote(postId) { return ajax(`/posts/${postId}.json`).then(result => { const post = Post.create(result); return Quote.build(post, post.raw, { raw: true, full: true }); }); }, loadRawEmail(postId) { return ajax(`/posts/${postId}/raw-email.json`); } }); export default Post;
26.749469
120
0.609017
6a106b74574e428caa48a4c75127d1ed7d699691
8,839
js
JavaScript
app/main.js
banuelosj/express-map-jsapi
30d6d6f0aed108b6d4fe78ddc8adfea27e8784a4
[ "Apache-2.0" ]
null
null
null
app/main.js
banuelosj/express-map-jsapi
30d6d6f0aed108b6d4fe78ddc8adfea27e8784a4
[ "Apache-2.0" ]
null
null
null
app/main.js
banuelosj/express-map-jsapi
30d6d6f0aed108b6d4fe78ddc8adfea27e8784a4
[ "Apache-2.0" ]
1
2020-04-06T02:41:17.000Z
2020-04-06T02:41:17.000Z
var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; define(["require", "exports", "esri/Map", "esri/views/MapView", "esri/layers/GraphicsLayer", "esri/widgets/Sketch/SketchViewModel", "./models/CustomSketch"], function (require, exports, Map_1, MapView_1, GraphicsLayer_1, SketchViewModel_1, CustomSketch_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Map_1 = __importDefault(Map_1); MapView_1 = __importDefault(MapView_1); GraphicsLayer_1 = __importDefault(GraphicsLayer_1); SketchViewModel_1 = __importDefault(SketchViewModel_1); var drawPointButtonNumber = document.getElementById("pointButtonNumber"); var drawPinBtn = document.getElementById("pinBtn"); var drawPolylineBtn = document.getElementById("polylineBtn"); var drawPolygonBtn = document.getElementById("polygonBtn"); var deleteBtn = document.getElementById("deleteBtn"); var drawArrowBtn = document.getElementById("arrowBtn"); // HTMLInputElement allows us to use the disabled property var undoBtn = document.getElementById("undoBtn"); undoBtn.disabled = true; var redoBtn = document.getElementById("redoBtn"); redoBtn.disabled = true; var graphicsLayer = new GraphicsLayer_1.default(); var numberIndex = 1; var selectedBtn; var selectedGraphic = null; var isGraphicClick = false; var isArrowDrawEnabled = false; var sketchViewModel = null; var customSketch = null; var map = new Map_1.default({ basemap: "gray-vector", layers: [graphicsLayer], }); var mapView = new MapView_1.default({ map: map, container: "viewDiv", center: [-118, 34], zoom: 4, highlightOptions: { color: "orange", haloOpacity: 0.8, fillOpacity: 0.2, }, }); mapView.when(function () { // const sketch = new Sketch({ // layer: graphicsLayer, // view: mapView, // container: "topbar", // availableCreateTools: ["rectangle", "circle"], // }); // mapView.ui.add(sketch, "top-right"); sketchViewModel = new SketchViewModel_1.default({ view: mapView, layer: graphicsLayer, }); customSketch = new CustomSketch_1.CustomSketch(graphicsLayer); sketchViewModel.on("update", function (evt) { //console.log("updating...."); // console.log("event: ", evt); // selectedGraphics = evt.graphics; }); sketchViewModel.watch("state", function (state) { if (state === "active") { undoBtn.disabled = false; } }); sketchViewModel.on("undo", function (event) { // enable the redo button redoBtn.disabled = false; }); sketchViewModel.on("create", function (evt) { if (selectedBtn instanceof HTMLElement) { customSketch.addGraphic(evt, selectedBtn.id, numberIndex); if (selectedBtn.id === CustomSketch_1.CurrentSelectedBtn.CirclePointBtn) { numberIndex++; // setting the circle text button to the next number // helps user know what the next number is without having // to look for the largest number drawPointButtonNumber.innerHTML = numberIndex.toString(); } } }); //sketchViewModel.create("point"); //setActiveButton(drawPointButtonNumber); drawPointButtonNumber.onclick = function () { // set the sketch to create a point geometry selectedBtn = this; sketchViewModel.create("point"); //setActiveButton(this); //pointType = "number"; }; drawPinBtn.onclick = function () { selectedBtn = this; sketchViewModel.create("point"); //setActiveButton(this); }; drawPolylineBtn.onclick = function () { selectedBtn = this; sketchViewModel.create("polyline"); //setActiveButton(this); }; drawPolygonBtn.onclick = function () { selectedBtn = this; sketchViewModel.create("polygon"); //setActiveButton(this); }; drawArrowBtn.onclick = function () { selectedBtn = this; isArrowDrawEnabled = true; }; // reset button deleteBtn.onclick = function () { // just want to remove the currently selected graphics if (selectedGraphic !== null) { // TODO: this code works if the ability to delete multiple // graphics is added graphicsLayer.removeMany([selectedGraphic]); mapView.graphics.removeAll(); } deleteBtn.style.visibility = "hidden"; if (selectedGraphic.symbol.type === "cim") { numberIndex = getCimNumber(selectedGraphic); } //selectedBtn = this; //setActiveButton(this); //numberIndex = numbersIndex - 1; //cimSymbol.setIndex(1); }; // TODO: work on removing the any type here to use CIMSymbol function getCimNumber(graphic) { return parseInt(graphic.symbol.data.symbolLayers[0].markerGraphics[0].symbol.textString); } function setActiveButton(selectedButton) { mapView.focus(); var elements = document.getElementsByClassName("active"); for (var i = 0; i < elements.length; i++) { elements[i].classList.remove("active"); } if (selectedButton) { selectedButton.classList.add("active"); } } }); undoBtn.onclick = function () { if (sketchViewModel.state !== "active") { undoBtn.disabled = true; } else { sketchViewModel.undo(); } }; redoBtn.onclick = function () { sketchViewModel.redo(); }; // loading client side graphics from a graphics layer // feature layer also works here (clientLayer: GraphicsLayer || FeatureLayer) var loadClientLayer = function (view, clientLayer) { view .when() .then(function () { return clientLayer.when(); }) .then(function (layer) { return view.whenLayerView(layer); }) .then(function (layerView) { view.on("pointer-move", eventHandler); view.on("pointer-down", eventHandler); // view.on("drag", function (e) { // console.log(e); // // e.stopPropagation(); // }); view.on("drag", function (e) { if (isArrowDrawEnabled) { dragEventHandler(e, view); } }); function eventHandler(event) { // using the hitTest() of the MapView to identify graphics on the screen isGraphicClick = event.type === "pointer-down" ? true : false; view.hitTest(event).then(getGraphics); } //let highlight = layerView.highlight(); var highlight = null; function getGraphics(response) { if (highlight) { highlight.remove(); highlight = null; //return; } // obtaining the topmost graphic if (response.results.length) { var graphic = response.results.filter(function (result) { return result.graphic.layer === clientLayer; })[0].graphic; highlight = layerView.highlight(graphic); // display the trash can to delete the currently selected graphic if (isGraphicClick) { deleteBtn.style.visibility = "visible"; selectedGraphic = graphic; } } } }); }; function dragEventHandler(e, view) { e.stopPropagation(); if (e.origin.x !== e.x && e.origin.y !== e.y) { var arrow = customSketch.drawArrow(e.origin, { x: e.x, y: e.y }, view); view.graphics.removeAll(); view.graphics.addMany(arrow); if (e.action === "end") { graphicsLayer.addMany(arrow); isArrowDrawEnabled = false; } } } loadClientLayer(mapView, graphicsLayer); }); //# sourceMappingURL=main.js.map
39.995475
257
0.547573
6a10aa1af7fb0600261eab29579128aae14569fc
237
js
JavaScript
web/key.js
axl3blaz3/Botx2
f10c1791410df9fcbdba3b058536128eca604dda
[ "Apache-2.0" ]
null
null
null
web/key.js
axl3blaz3/Botx2
f10c1791410df9fcbdba3b058536128eca604dda
[ "Apache-2.0" ]
null
null
null
web/key.js
axl3blaz3/Botx2
f10c1791410df9fcbdba3b058536128eca604dda
[ "Apache-2.0" ]
null
null
null
function handle(e) { var go = document.getElementById("go"); var key=e.keycode || e.which; if (key ==13 && go.value != ""){ eel.name_entry(go.value) } } eel.expose(vPassInput); function vPassInput(x) { alert(x); }
15.8
41
0.599156
6a11bbc73c4f3fe2e626703a92ec9ee9a8589d50
24,432
js
JavaScript
mods/gen2/scripts.js
glitchboyl/Pokemon-Showdown
31cb2e5343dd0414cfd66742c6febb1db66ab354
[ "MIT" ]
1
2021-05-08T09:35:01.000Z
2021-05-08T09:35:01.000Z
mods/gen2/scripts.js
glitchboyl/Pokemon-Showdown
31cb2e5343dd0414cfd66742c6febb1db66ab354
[ "MIT" ]
null
null
null
mods/gen2/scripts.js
glitchboyl/Pokemon-Showdown
31cb2e5343dd0414cfd66742c6febb1db66ab354
[ "MIT" ]
null
null
null
'use strict'; /** * Gen 2 scripts. */ /**@type {ModdedBattleScriptsData} */ let BattleScripts = { inherit: 'gen3', gen: 2, // BattlePokemon scripts. pokemon: { getStat: function (statName, unboosted, unmodified) { statName = toId(statName); if (statName === 'hp') return this.maxhp; // base stat let stat = this.stats[statName]; // Stat boosts. if (!unboosted) { let boost = this.boosts[statName]; if (boost > 6) boost = 6; if (boost < -6) boost = -6; if (boost >= 0) { let boostTable = [1, 1.5, 2, 2.5, 3, 3.5, 4]; stat = Math.floor(stat * boostTable[boost]); } else { let numerators = [100, 66, 50, 40, 33, 28, 25]; stat = Math.floor(stat * numerators[-boost] / 100); } } if (this.status === 'par' && statName === 'spe') { stat = Math.floor(stat / 4); } if (!unmodified) { // Burn attack drop is checked when you get the attack stat upon switch in and used until switch out. if (this.status === 'brn' && statName === 'atk') { stat = Math.floor(stat / 2); } } // Gen 2 caps stats at 999 and min is 1. stat = this.battle.clampIntRange(stat, 1, 999); // Screens if (!unboosted) { if ((this.side.sideConditions['reflect'] && statName === 'def') || (this.side.sideConditions['lightscreen'] && statName === 'spd')) { stat *= 2; } } // Treat here the items. if ((['Cubone', 'Marowak'].includes(this.species) && this.item === 'thickclub' && statName === 'atk') || (this.species === 'Pikachu' && this.item === 'lightball' && statName === 'spa')) { stat *= 2; } else if (this.species === 'Ditto' && this.item === 'metalpowder' && ['def', 'spd'].includes(statName)) { // what. the. fuck. stop playing pokémon stat *= 1.5; } return stat; }, }, // Battle scripts. runMove: function (move, pokemon, targetLoc, sourceEffect) { let target = this.getTarget(pokemon, move, targetLoc); if (!sourceEffect && toId(move) !== 'struggle') { let changedMove = this.runEvent('OverrideAction', pokemon, target, move); if (changedMove && changedMove !== true) { move = changedMove; target = null; } } move = this.getMove(move); if (!target && target !== false) target = this.resolveTarget(pokemon, move); this.setActiveMove(move, pokemon, target); if (pokemon.moveThisTurn) { // THIS IS PURELY A SANITY CHECK // DO NOT TAKE ADVANTAGE OF THIS TO PREVENT A POKEMON FROM MOVING; // USE this.cancelMove INSTEAD this.debug('' + pokemon.id + ' INCONSISTENT STATE, ALREADY MOVED: ' + pokemon.moveThisTurn); this.clearActiveMove(true); return; } if (!this.runEvent('BeforeMove', pokemon, target, move)) { this.runEvent('MoveAborted', pokemon, target, move); this.clearActiveMove(true); // This is only run for sleep and fully paralysed. this.runEvent('AfterMoveSelf', pokemon, target, move); return; } if (move.beforeMoveCallback) { if (move.beforeMoveCallback.call(this, pokemon, target, move)) { this.clearActiveMove(true); return; } } pokemon.lastDamage = 0; let lockedMove = this.runEvent('LockMove', pokemon); if (lockedMove === true) lockedMove = false; if (!lockedMove) { if (!pokemon.deductPP(move, null, target) && (move.id !== 'struggle')) { this.add('cant', pokemon, 'nopp', move); this.clearActiveMove(true); return; } } pokemon.moveUsed(move); this.useMove(move, pokemon, target, sourceEffect); this.singleEvent('AfterMove', move, null, pokemon, target, move); if (!move.selfSwitch && target && target.hp > 0) this.runEvent('AfterMoveSelf', pokemon, target, move); }, tryMoveHit: function (target, pokemon, move) { let positiveBoostTable = [1, 1.33, 1.66, 2, 2.33, 2.66, 3]; let negativeBoostTable = [1, 0.75, 0.6, 0.5, 0.43, 0.36, 0.33]; let doSelfDestruct = true; /**@type {number | false} */ let damage = 0; let hitResult = true; if (move.selfdestruct && doSelfDestruct) { this.faint(pokemon, pokemon, move); } hitResult = this.singleEvent('PrepareHit', move, {}, target, pokemon, move); if (!hitResult) { if (hitResult === false) this.add('-fail', target); return false; } this.runEvent('PrepareHit', pokemon, target, move); if (!this.singleEvent('Try', move, null, pokemon, target, move)) { return false; } if (move.ignoreImmunity === undefined) { move.ignoreImmunity = (move.category === 'Status'); } if ((!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) && !target.runImmunity(move.type, true)) { return false; } hitResult = this.runEvent('TryHit', target, pokemon, move); if (!hitResult) { if (hitResult === false) this.add('-fail', target); return false; } /**@type {number | true} */ let accuracy = move.accuracy; if (move.alwaysHit) { accuracy = true; } else { accuracy = this.runEvent('Accuracy', target, pokemon, move, accuracy); } // Now, let's calculate the accuracy. if (accuracy !== true) { accuracy = Math.floor(accuracy * 255 / 100); if (move.ohko) { if (pokemon.level >= target.level) { accuracy += (pokemon.level - target.level) * 2; accuracy = Math.min(accuracy, 255); } else { this.add('-immune', target, '[ohko]'); return false; } } if (!move.ignoreAccuracy) { if (pokemon.boosts.accuracy > 0) { accuracy *= positiveBoostTable[pokemon.boosts.accuracy]; } else { accuracy *= negativeBoostTable[-pokemon.boosts.accuracy]; } } if (!move.ignoreEvasion) { if (target.boosts.evasion > 0 && !move.ignorePositiveEvasion) { accuracy *= negativeBoostTable[target.boosts.evasion]; } else if (target.boosts.evasion < 0) { accuracy *= positiveBoostTable[-target.boosts.evasion]; } } accuracy = Math.min(Math.floor(accuracy), 255); accuracy = Math.max(accuracy, 1); } else { accuracy = this.runEvent('Accuracy', target, pokemon, move, accuracy); } accuracy = this.runEvent('ModifyAccuracy', target, pokemon, move, accuracy); if (accuracy !== true) accuracy = Math.max(accuracy, 0); if (move.alwaysHit) { accuracy = true; } else { accuracy = this.runEvent('Accuracy', target, pokemon, move, accuracy); } if (accuracy !== true && accuracy !== 255 && !this.randomChance(accuracy, 256)) { this.attrLastMove('[miss]'); this.add('-miss', pokemon); damage = false; return damage; } move.totalDamage = 0; pokemon.lastDamage = 0; if (move.multihit) { let hits = move.multihit; if (Array.isArray(hits)) { if (hits[0] === 2 && hits[1] === 5) { hits = this.sample([2, 2, 2, 3, 3, 3, 4, 5]); } else { hits = this.random(hits[0], hits[1] + 1); } } hits = Math.floor(hits); let nullDamage = true; /**@type {number | false} */ let moveDamage; let isSleepUsable = move.sleepUsable || this.getMove(move.sourceEffect).sleepUsable; let i; for (i = 0; i < hits && target.hp && pokemon.hp; i++) { if (pokemon.status === 'slp' && !isSleepUsable) break; moveDamage = this.moveHit(target, pokemon, move); if (moveDamage === false) break; if (nullDamage && (moveDamage || moveDamage === 0 || moveDamage === undefined)) nullDamage = false; damage = (moveDamage || 0); move.totalDamage += damage; this.eachEvent('Update'); } if (i === 0) return 1; if (nullDamage) damage = false; this.add('-hitcount', target, i); } else { damage = this.moveHit(target, pokemon, move); move.totalDamage = damage; } if (move.category !== 'Status') { // FIXME: The stored damage should be calculated ignoring Substitute. // https://github.com/Zarel/Pokemon-Showdown/issues/2598 target.gotAttacked(move, damage, pokemon); } if (move.ohko) this.add('-ohko'); if (!move.negateSecondary) { this.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move); this.runEvent('AfterMoveSecondary', target, pokemon, move); } if (move.recoil && move.totalDamage) { this.damage(this.calcRecoilDamage(move.totalDamage, move), pokemon, target, 'recoil'); } return damage; }, moveHit: function (target, pokemon, move, moveData, isSecondary, isSelf) { let damage; move = this.getMoveCopy(move); if (!moveData) moveData = move; /**@type {?boolean | number} */ let hitResult = true; if (move.target === 'all' && !isSelf) { hitResult = this.singleEvent('TryHitField', moveData, {}, target, pokemon, move); } else if ((move.target === 'foeSide' || move.target === 'allySide') && !isSelf) { hitResult = this.singleEvent('TryHitSide', moveData, {}, (target ? target.side : null), pokemon, move); } else if (target) { hitResult = this.singleEvent('TryHit', moveData, {}, target, pokemon, move); } if (!hitResult) { if (hitResult === false) this.add('-fail', target); return false; } if (target && !isSecondary && !isSelf) { hitResult = this.runEvent('TryPrimaryHit', target, pokemon, moveData); if (hitResult === 0) { // special Substitute flag hitResult = true; target = null; } } if (target && isSecondary && !moveData.self) { hitResult = true; } if (!hitResult) { return false; } if (target) { /**@type {?boolean | number} */ let didSomething = false; damage = this.getDamage(pokemon, target, moveData); if ((damage || damage === 0) && !target.fainted) { if (move.noFaint && damage >= target.hp) { damage = target.hp - 1; } damage = this.damage(damage, target, pokemon, move); if (!(damage || damage === 0)) { this.debug('damage interrupted'); return false; } didSomething = true; } if (damage === false || damage === null) { if (damage === false && !isSecondary && !isSelf) { this.add('-fail', target); } this.debug('damage calculation interrupted'); return false; } if (moveData.boosts && !target.fainted) { if (pokemon.volatiles['lockon'] && target === pokemon.volatiles['lockon'].source && target.isSemiInvulnerable() && !isSelf) { if (!isSecondary) this.add('-fail', target); return false; } hitResult = this.boost(moveData.boosts, target, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.heal && !target.fainted) { let d = target.heal(Math.round(target.maxhp * moveData.heal[0] / moveData.heal[1])); if (!d && d !== 0) { this.add('-fail', target); this.debug('heal interrupted'); return false; } this.add('-heal', target, target.getHealth); didSomething = true; } if (moveData.status) { hitResult = target.trySetStatus(moveData.status, pokemon, move); if (!hitResult && move.status) return hitResult; didSomething = didSomething || hitResult; } if (moveData.forceStatus) { hitResult = target.setStatus(moveData.forceStatus, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.volatileStatus) { hitResult = target.addVolatile(moveData.volatileStatus, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.sideCondition) { hitResult = target.side.addSideCondition(moveData.sideCondition, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.weather) { hitResult = this.setWeather(moveData.weather, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.pseudoWeather) { hitResult = this.addPseudoWeather(moveData.pseudoWeather, pokemon, move); didSomething = didSomething || hitResult; } if (moveData.forceSwitch) { if (this.canSwitch(target.side)) didSomething = true; // at least defer the fail message to later } if (moveData.selfSwitch) { if (this.canSwitch(pokemon.side)) didSomething = true; // at least defer the fail message to later } // Hit events // These are like the TryHit events, except we don't need a FieldHit event. // Scroll up for the TryHit event documentation, and just ignore the "Try" part. ;) hitResult = null; if (move.target === 'all' && !isSelf) { if (moveData.onHitField) hitResult = this.singleEvent('HitField', moveData, {}, target, pokemon, move); } else if ((move.target === 'foeSide' || move.target === 'allySide') && !isSelf) { if (moveData.onHitSide) hitResult = this.singleEvent('HitSide', moveData, {}, target.side, pokemon, move); } else { if (moveData.onHit) hitResult = this.singleEvent('Hit', moveData, {}, target, pokemon, move); if (!isSelf && !isSecondary) { this.runEvent('Hit', target, pokemon, move); } if (moveData.onAfterHit) hitResult = this.singleEvent('AfterHit', moveData, {}, target, pokemon, move); } if (!hitResult && !didSomething && !moveData.self && !moveData.selfdestruct) { if (!isSelf && !isSecondary) { if (hitResult === false || didSomething === false) this.add('-fail', target); } this.debug('move failed because it did nothing'); return false; } } if (moveData.self) { let selfRoll; // @ts-ignore if (!isSecondary && moveData.self.boosts) selfRoll = this.random(100); // This is done solely to mimic in-game RNG behaviour. All self drops have a 100% chance of happening but still grab a random number. // @ts-ignore if (typeof moveData.self.chance === 'undefined' || selfRoll < moveData.self.chance) { // @ts-ignore this.moveHit(pokemon, pokemon, move, moveData.self, isSecondary, true); } } if (moveData.secondaries && this.runEvent('TrySecondaryHit', target, pokemon, moveData)) { for (const secondary of moveData.secondaries) { // We check here whether to negate the probable secondary status if it's burn or freeze. // In the game, this is checked and if true, the random number generator is not called. // That means that a move that does not share the type of the target can status it. // This means tri-attack can burn fire-types and freeze ice-types. // Unlike gen 1, though, paralysis works for all unless the target is immune to direct move (ie. ground-types and t-wave). if (!(secondary.status && ['brn', 'frz'].includes(secondary.status) && target && target.hasType(move.type))) { // @ts-ignore let effectChance = Math.floor(secondary.chance * 255 / 100); if (typeof secondary.chance === 'undefined' || this.randomChance(effectChance, 256)) { // @ts-ignore this.moveHit(target, pokemon, move, secondary, true, isSelf); } } } } if (target && target.hp > 0 && pokemon.hp > 0 && moveData.forceSwitch && this.canSwitch(target.side)) { hitResult = this.runEvent('DragOut', target, pokemon, move); if (hitResult) { this.dragIn(target.side, target.position); } else if (hitResult === false) { this.add('-fail', target); } } if (move.selfSwitch && pokemon.hp) { pokemon.switchFlag = move.fullname; } return damage; }, getDamage: function (pokemon, target, move, suppressMessages) { // First of all, we get the move. if (typeof move === 'string') { move = this.getMove(move); } else if (typeof move === 'number') { // @ts-ignore move = { basePower: move, type: '???', category: 'Physical', willCrit: false, flags: {}, }; } move = /**@type {Move} */ (move); // eslint-disable-line no-self-assign // Let's test for immunities. if (!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) { if (!target.runImmunity(move.type, true)) { return false; } } // Is it an OHKO move? if (move.ohko) { return target.maxhp; } // We edit the damage through move's damage callback if (move.damageCallback) { return move.damageCallback.call(this, pokemon, target); } // We take damage from damage=level moves if (move.damage === 'level') { return pokemon.level; } // If there's a fix move damage, we run it if (move.damage) { return move.damage; } // We check the category and typing to calculate later on the damage move.category = this.getCategory(move); if (!move.defensiveCategory) move.defensiveCategory = move.category; // '???' is typeless damage: used for Struggle and Confusion etc if (!move.type) move.type = '???'; let type = move.type; // We get the base power and apply basePowerCallback if necessary let basePower = move.basePower; if (move.basePowerCallback) { basePower = move.basePowerCallback.call(this, pokemon, target, move); } // We check for Base Power if (!basePower) { if (basePower === 0) return; // Returning undefined means not dealing damage return basePower; } basePower = this.clampIntRange(basePower, 1); // Checking for the move's Critical Hit ratio move.critRatio = this.clampIntRange(move.critRatio, 0, 5); let critMult = [0, 16, 8, 4, 3, 2]; move.crit = move.willCrit || false; if (typeof move.willCrit === 'undefined') { if (move.critRatio) { move.crit = this.randomChance(1, critMult[move.critRatio]); } } if (move.crit) { move.crit = this.runEvent('CriticalHit', target, null, move); } // Happens after crit calculation if (basePower) { // confusion damage if (move.isSelfHit) { // @ts-ignore move.type = move.baseMoveType; basePower = this.runEvent('BasePower', pokemon, target, move, basePower, true); move.type = '???'; } else { basePower = this.runEvent('BasePower', pokemon, target, move, basePower, true); } if (move.basePowerModifier) { basePower *= move.basePowerModifier; } } if (!basePower) return 0; basePower = this.clampIntRange(basePower, 1); // We now check for attacker and defender let level = pokemon.level; // Using Beat Up if (move.allies) { this.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies[0].name); level = move.allies[0].level; } let attacker = pokemon; let defender = target; if (move.useTargetOffensive) attacker = target; if (move.useSourceDefensive) defender = pokemon; let atkType = (move.category === 'Physical') ? 'atk' : 'spa'; let defType = (move.defensiveCategory === 'Physical') ? 'def' : 'spd'; let unboosted = false; let noburndrop = false; // The move is a critical hit. Several things happen here. if (move.crit) { // Level is doubled for damage calculation. level *= 2; if (!suppressMessages) this.add('-crit', target); // Stat level modifications are ignored if they are neutral to or favour the defender. // Reflect and Light Screen defensive boosts are only ignored if stat level modifications were also ignored as a result of that. if (attacker.boosts[atkType] <= defender.boosts[defType]) { unboosted = true; noburndrop = true; } } // Get stats now. let attack = attacker.getStat(atkType, unboosted, noburndrop); let defense = defender.getStat(defType, unboosted); // Using Beat Up if (move.allies) { attack = move.allies[0].template.baseStats.atk; move.allies.shift(); defense = defender.template.baseStats.def; } // Moves that ignore offense and defense respectively. if (move.ignoreOffensive) { this.debug('Negating (sp)atk boost/penalty.'); // The attack drop from the burn is only applied when attacker's attack level is higher than defender's defense level. attack = attacker.getStat(atkType, true, true); } if (move.ignoreDefensive) { this.debug('Negating (sp)def boost/penalty.'); defense = target.getStat(defType, true, true); } // Gen 2 Present has a glitched damage calculation using the secondary types of the Pokemon for the Attacker's Level and Defender's Defense. if (move.id === 'present') { const typeIndexes = {"Normal": 0, "Fighting": 1, "Flying": 2, "Poison": 3, "Ground": 4, "Rock": 5, "Bug": 7, "Ghost": 8, "Steel": 9, "Fire": 20, "Water": 21, "Grass": 22, "Electric": 23, "Psychic": 24, "Ice": 25, "Dragon": 26, "Dark": 27}; attack = 10; const attackerLastType = attacker.getTypes().slice(-1)[0]; const defenderLastType = defender.getTypes().slice(-1)[0]; defense = typeIndexes[attackerLastType] || 1; level = typeIndexes[defenderLastType] || 1; if (move.crit) { level *= 2; } } // When either attack or defense are higher than 256, they are both divided by 4 and moded by 256. // This is what cuases the roll over bugs. if (attack >= 256 || defense >= 256) { attack = this.clampIntRange(Math.floor(attack / 4) % 256, 1); defense = this.clampIntRange(Math.floor(defense / 4) % 256, 1); } // Self destruct moves halve defense at this point. if (move.selfdestruct && defType === 'def') { defense = this.clampIntRange(Math.floor(defense / 2), 1); } // Let's go with the calculation now that we have what we need. // We do it step by step just like the game does. let damage = level * 2; damage = Math.floor(damage / 5); damage += 2; damage *= basePower; damage *= attack; damage = Math.floor(damage / defense); damage = this.clampIntRange(Math.floor(damage / 50), 1, 997); damage += 2; // Weather modifiers if ((this.isWeather('raindance') && type === 'Water') || (this.isWeather('sunnyday') && type === 'Fire')) { damage = Math.floor(damage * 1.5); } else if ((this.isWeather('raindance') && (type === 'Fire' || move.id === 'solarbeam')) || (this.isWeather('sunnyday') && type === 'Water')) { damage = Math.floor(damage / 2); } // STAB damage bonus, the "???" type never gets STAB if (type !== '???' && pokemon.hasType(type)) { damage += Math.floor(damage / 2); } // Type effectiveness let totalTypeMod = this.getEffectiveness(type, target); // Super effective attack if (totalTypeMod > 0) { if (!suppressMessages) this.add('-supereffective', target); damage *= 2; if (totalTypeMod >= 2) { damage *= 2; } } // Resisted attack if (totalTypeMod < 0) { if (!suppressMessages) this.add('-resisted', target); damage = Math.floor(damage / 2); if (totalTypeMod <= -2) { damage = Math.floor(damage / 2); } } // Apply random factor is damage is greater than 1, except for Flail and Reversal if (!move.noDamageVariance && damage > 1) { damage *= this.random(217, 256); damage = Math.floor(damage / 255); } // If damage is less than 1, we return 1 if (basePower && !Math.floor(damage)) { return 1; } // We are done, this is the final damage return damage; }, damage: function (damage, target, source, effect) { if (this.event) { if (!target) target = this.event.target; if (!source) source = this.event.source; if (!effect) effect = this.effect; } if (!target || !target.hp) return 0; effect = this.getEffect(effect); if (!(damage || damage === 0)) return damage; if (damage !== 0) damage = this.clampIntRange(damage, 1); if (effect.id !== 'struggle-recoil') { // Struggle recoil is not affected by effects if (effect.effectType === 'Weather' && !target.runStatusImmunity(effect.id)) { this.debug('weather immunity'); return 0; } damage = this.runEvent('Damage', target, source, effect, damage); if (!(damage || damage === 0)) { this.debug('damage event failed'); return damage; } } if (damage !== 0) damage = this.clampIntRange(damage, 1); damage = target.damage(damage, source, effect); if (source) source.lastDamage = damage; let name = effect.fullname; if (name === 'tox') name = 'psn'; switch (effect.id) { case 'partiallytrapped': this.add('-damage', target, target.getHealth, '[from] ' + this.effectData.sourceEffect.fullname, '[partiallytrapped]'); break; default: if (effect.effectType === 'Move') { this.add('-damage', target, target.getHealth); } else if (source && source !== target) { this.add('-damage', target, target.getHealth, '[from] ' + effect.fullname, '[of] ' + source); } else { this.add('-damage', target, target.getHealth, '[from] ' + name); } break; } if (effect.drain && source) { this.heal(Math.ceil(damage * effect.drain[0] / effect.drain[1]), source, target, 'drain'); } if (target.fainted || target.hp <= 0) { this.debug('instafaint: ' + this.faintQueue.map(entry => entry.target).map(pokemon => pokemon.name)); this.faintMessages(true); target.faint(); } else { damage = this.runEvent('AfterDamage', target, source, effect, damage); } return damage; }, }; exports.BattleScripts = BattleScripts;
33.980529
242
0.638179
6a11c6149c90b5a39dfc8a17dd2fdd544702c44c
656
js
JavaScript
src/code-worker/executor/CodeExecutionRequest.js
dininski/learn-code-project
bba4419cb37b3cfcc9dfb4c21788be8f133e619f
[ "MIT" ]
null
null
null
src/code-worker/executor/CodeExecutionRequest.js
dininski/learn-code-project
bba4419cb37b3cfcc9dfb4c21788be8f133e619f
[ "MIT" ]
null
null
null
src/code-worker/executor/CodeExecutionRequest.js
dininski/learn-code-project
bba4419cb37b3cfcc9dfb4c21788be8f133e619f
[ "MIT" ]
null
null
null
"use strict"; var CodeExecutionRequest = function (initOptions) { this.executionId = 0; this.language = ''; this.options = {}; this.timeLimit = 0; this.stdin = ''; this.userCode = ''; this.executorId = 0; }; CodeExecutionRequest.prototype = { init: function (initOptions) { this.executionId = +initOptions.executionId; this.timeLimit = +initOptions.timeLimit; this.stdin = initOptions.stdin; this.userCode = initOptions.userCode; this.executorId = +initOptions.executorId; this.executionFolder = initOptions.executionFolder; } }; module.exports = CodeExecutionRequest;
26.24
59
0.657012
6a11cf992a3944d4024653f8e8bd46491513c15e
60
js
JavaScript
public/js/script.js
Viva10/Otimetable
87bb65871a688d8e20211632bb94149b3dd688a1
[ "MIT" ]
null
null
null
public/js/script.js
Viva10/Otimetable
87bb65871a688d8e20211632bb94149b3dd688a1
[ "MIT" ]
null
null
null
public/js/script.js
Viva10/Otimetable
87bb65871a688d8e20211632bb94149b3dd688a1
[ "MIT" ]
null
null
null
window.onload = function(){ $("#accordion").accordion(); };
20
29
0.633333
6a120259d02f7e815829ac0a77689d674b3e6b40
13,175
js
JavaScript
www/lib/ionic/js/angular/controller/sideMenuController.js
mounir1/v2beta
16c9b9233eab29d71238b95f3c4edf9d56394d33
[ "Apache-2.0" ]
146
2017-06-01T09:02:15.000Z
2022-01-04T12:50:34.000Z
www/lib/ionic/js/angular/controller/sideMenuController.js
mounir1/v2beta
16c9b9233eab29d71238b95f3c4edf9d56394d33
[ "Apache-2.0" ]
193
2017-06-01T18:35:38.000Z
2021-12-01T11:22:46.000Z
www/lib/ionic/js/angular/controller/sideMenuController.js
mounir1/v2beta
16c9b9233eab29d71238b95f3c4edf9d56394d33
[ "Apache-2.0" ]
163
2017-05-31T16:14:52.000Z
2022-03-10T15:25:04.000Z
IonicModule .controller('$ionicSideMenus', [ '$scope', '$attrs', '$ionicSideMenuDelegate', '$ionicPlatform', '$ionicBody', '$ionicHistory', '$ionicScrollDelegate', 'IONIC_BACK_PRIORITY', '$rootScope', function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate, IONIC_BACK_PRIORITY, $rootScope) { var self = this; var rightShowing, leftShowing, isDragging; var startX, lastX, offsetX, isAsideExposed; var enableMenuWithBackViews = true; self.$scope = $scope; self.initialize = function(options) { self.left = options.left; self.right = options.right; self.setContent(options.content); self.dragThresholdX = options.dragThresholdX || 10; $ionicHistory.registerHistory(self.$scope); }; /** * Set the content view controller if not passed in the constructor options. * * @param {object} content */ self.setContent = function(content) { if (content) { self.content = content; self.content.onDrag = function(e) { self._handleDrag(e); }; self.content.endDrag = function(e) { self._endDrag(e); }; } }; self.isOpenLeft = function() { return self.getOpenAmount() > 0; }; self.isOpenRight = function() { return self.getOpenAmount() < 0; }; /** * Toggle the left menu to open 100% */ self.toggleLeft = function(shouldOpen) { if (isAsideExposed || !self.left.isEnabled) return; var openAmount = self.getOpenAmount(); if (arguments.length === 0) { shouldOpen = openAmount <= 0; } self.content.enableAnimation(); if (!shouldOpen) { self.openPercentage(0); $rootScope.$emit('$ionicSideMenuClose', 'left'); } else { self.openPercentage(100); $rootScope.$emit('$ionicSideMenuOpen', 'left'); } }; /** * Toggle the right menu to open 100% */ self.toggleRight = function(shouldOpen) { if (isAsideExposed || !self.right.isEnabled) return; var openAmount = self.getOpenAmount(); if (arguments.length === 0) { shouldOpen = openAmount >= 0; } self.content.enableAnimation(); if (!shouldOpen) { self.openPercentage(0); $rootScope.$emit('$ionicSideMenuClose', 'right'); } else { self.openPercentage(-100); $rootScope.$emit('$ionicSideMenuOpen', 'right'); } }; self.toggle = function(side) { if (side == 'right') { self.toggleRight(); } else { self.toggleLeft(); } }; /** * Close all menus. */ self.close = function() { self.openPercentage(0); $rootScope.$emit('$ionicSideMenuClose', 'left'); $rootScope.$emit('$ionicSideMenuClose', 'right'); }; /** * @return {float} The amount the side menu is open, either positive or negative for left (positive), or right (negative) */ self.getOpenAmount = function() { return self.content && self.content.getTranslateX() || 0; }; /** * @return {float} The ratio of open amount over menu width. For example, a * menu of width 100 open 50 pixels would be open 50% or a ratio of 0.5. Value is negative * for right menu. */ self.getOpenRatio = function() { var amount = self.getOpenAmount(); if (amount >= 0) { return amount / self.left.width; } return amount / self.right.width; }; self.isOpen = function() { return self.getOpenAmount() !== 0; }; /** * @return {float} The percentage of open amount over menu width. For example, a * menu of width 100 open 50 pixels would be open 50%. Value is negative * for right menu. */ self.getOpenPercentage = function() { return self.getOpenRatio() * 100; }; /** * Open the menu with a given percentage amount. * @param {float} percentage The percentage (positive or negative for left/right) to open the menu. */ self.openPercentage = function(percentage) { var p = percentage / 100; if (self.left && percentage >= 0) { self.openAmount(self.left.width * p); } else if (self.right && percentage < 0) { self.openAmount(self.right.width * p); } // add the CSS class "menu-open" if the percentage does not // equal 0, otherwise remove the class from the body element $ionicBody.enableClass((percentage !== 0), 'menu-open'); self.content.setCanScroll(percentage == 0); }; /* function freezeAllScrolls(shouldFreeze) { if (shouldFreeze && !self.isScrollFreeze) { $ionicScrollDelegate.freezeAllScrolls(shouldFreeze); } else if (!shouldFreeze && self.isScrollFreeze) { $ionicScrollDelegate.freezeAllScrolls(false); } self.isScrollFreeze = shouldFreeze; } */ /** * Open the menu the given pixel amount. * @param {float} amount the pixel amount to open the menu. Positive value for left menu, * negative value for right menu (only one menu will be visible at a time). */ self.openAmount = function(amount) { var maxLeft = self.left && self.left.width || 0; var maxRight = self.right && self.right.width || 0; // Check if we can move to that side, depending if the left/right panel is enabled if (!(self.left && self.left.isEnabled) && amount > 0) { self.content.setTranslateX(0); return; } if (!(self.right && self.right.isEnabled) && amount < 0) { self.content.setTranslateX(0); return; } if (leftShowing && amount > maxLeft) { self.content.setTranslateX(maxLeft); return; } if (rightShowing && amount < -maxRight) { self.content.setTranslateX(-maxRight); return; } self.content.setTranslateX(amount); leftShowing = amount > 0; rightShowing = amount < 0; if (amount > 0) { // Push the z-index of the right menu down self.right && self.right.pushDown && self.right.pushDown(); // Bring the z-index of the left menu up self.left && self.left.bringUp && self.left.bringUp(); } else { // Bring the z-index of the right menu up self.right && self.right.bringUp && self.right.bringUp(); // Push the z-index of the left menu down self.left && self.left.pushDown && self.left.pushDown(); } }; /** * Given an event object, find the final resting position of this side * menu. For example, if the user "throws" the content to the right and * releases the touch, the left menu should snap open (animated, of course). * * @param {Event} e the gesture event to use for snapping */ self.snapToRest = function(e) { // We want to animate at the end of this self.content.enableAnimation(); isDragging = false; // Check how much the panel is open after the drag, and // what the drag velocity is var ratio = self.getOpenRatio(); if (ratio === 0) { // Just to be safe self.openPercentage(0); return; } var velocityThreshold = 0.3; var velocityX = e.gesture.velocityX; var direction = e.gesture.direction; // Going right, less than half, too slow (snap back) if (ratio > 0 && ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) { self.openPercentage(0); } // Going left, more than half, too slow (snap back) else if (ratio > 0.5 && direction == 'left' && velocityX < velocityThreshold) { self.openPercentage(100); } // Going left, less than half, too slow (snap back) else if (ratio < 0 && ratio > -0.5 && direction == 'left' && velocityX < velocityThreshold) { self.openPercentage(0); } // Going right, more than half, too slow (snap back) else if (ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) { self.openPercentage(-100); } // Going right, more than half, or quickly (snap open) else if (direction == 'right' && ratio >= 0 && (ratio >= 0.5 || velocityX > velocityThreshold)) { self.openPercentage(100); } // Going left, more than half, or quickly (span open) else if (direction == 'left' && ratio <= 0 && (ratio <= -0.5 || velocityX > velocityThreshold)) { self.openPercentage(-100); } // Snap back for safety else { self.openPercentage(0); } }; self.enableMenuWithBackViews = function(val) { if (arguments.length) { enableMenuWithBackViews = !!val; } return enableMenuWithBackViews; }; self.isAsideExposed = function() { return !!isAsideExposed; }; self.exposeAside = function(shouldExposeAside) { if (!(self.left && self.left.isEnabled) && !(self.right && self.right.isEnabled)) return; self.close(); isAsideExposed = shouldExposeAside; if ((self.left && self.left.isEnabled) && (self.right && self.right.isEnabled)) { self.content.setMarginLeftAndRight(isAsideExposed ? self.left.width : 0, isAsideExposed ? self.right.width : 0); } else if (self.left && self.left.isEnabled) { // set the left marget width if it should be exposed // otherwise set false so there's no left margin self.content.setMarginLeft(isAsideExposed ? self.left.width : 0); } else if (self.right && self.right.isEnabled) { self.content.setMarginRight(isAsideExposed ? self.right.width : 0); } self.$scope.$emit('$ionicExposeAside', isAsideExposed); }; self.activeAsideResizing = function(isResizing) { $ionicBody.enableClass(isResizing, 'aside-resizing'); }; // End a drag with the given event self._endDrag = function(e) { if (isAsideExposed) return; if (isDragging) { self.snapToRest(e); } startX = null; lastX = null; offsetX = null; }; // Handle a drag event self._handleDrag = function(e) { if (isAsideExposed || !$scope.dragContent) return; // If we don't have start coords, grab and store them if (!startX) { startX = e.gesture.touches[0].pageX; lastX = startX; } else { // Grab the current tap coords lastX = e.gesture.touches[0].pageX; } // Calculate difference from the tap points if (!isDragging && Math.abs(lastX - startX) > self.dragThresholdX) { // if the difference is greater than threshold, start dragging using the current // point as the starting point startX = lastX; isDragging = true; // Initialize dragging self.content.disableAnimation(); offsetX = self.getOpenAmount(); } if (isDragging) { self.openAmount(offsetX + (lastX - startX)); //self.content.setCanScroll(false); } }; self.canDragContent = function(canDrag) { if (arguments.length) { $scope.dragContent = !!canDrag; } return $scope.dragContent; }; self.edgeThreshold = 25; self.edgeThresholdEnabled = false; self.edgeDragThreshold = function(value) { if (arguments.length) { if (isNumber(value) && value > 0) { self.edgeThreshold = value; self.edgeThresholdEnabled = true; } else { self.edgeThresholdEnabled = !!value; } } return self.edgeThresholdEnabled; }; self.isDraggableTarget = function(e) { //Only restrict edge when sidemenu is closed and restriction is enabled var shouldOnlyAllowEdgeDrag = self.edgeThresholdEnabled && !self.isOpen(); var startX = e.gesture.startEvent && e.gesture.startEvent.center && e.gesture.startEvent.center.pageX; var dragIsWithinBounds = !shouldOnlyAllowEdgeDrag || startX <= self.edgeThreshold || startX >= self.content.element.offsetWidth - self.edgeThreshold; var backView = $ionicHistory.backView(); var menuEnabled = enableMenuWithBackViews ? true : !backView; if (!menuEnabled) { var currentView = $ionicHistory.currentView() || {}; return (dragIsWithinBounds && (backView.historyId !== currentView.historyId)); } return ($scope.dragContent || self.isOpen()) && dragIsWithinBounds && !e.gesture.srcEvent.defaultPrevented && menuEnabled && !e.target.tagName.match(/input|textarea|select|object|embed/i) && !e.target.isContentEditable && !(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll') == 'true'); }; $scope.sideMenuContentTranslateX = 0; var deregisterBackButtonAction = noop; var closeSideMenu = angular.bind(self, self.close); $scope.$watch(function() { return self.getOpenAmount() !== 0; }, function(isOpen) { deregisterBackButtonAction(); if (isOpen) { deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction( closeSideMenu, IONIC_BACK_PRIORITY.sideMenu ); } }); var deregisterInstance = $ionicSideMenuDelegate._registerInstance( self, $attrs.delegateHandle, function() { return $ionicHistory.isActiveScope($scope); } ); $scope.$on('$destroy', function() { deregisterInstance(); deregisterBackButtonAction(); self.$scope = null; if (self.content) { self.content.setCanScroll(true); self.content.element = null; self.content = null; } }); self.initialize({ left: { width: 275 }, right: { width: 275 } }); }]);
29.21286
148
0.635142
6a13bab10adfd57ff8aa2932fdad9364bafd20e8
23,418
js
JavaScript
lib/src/AccessControl.js
songchiva/role-acl
1265d5ef3e7c0407c75bd86ccf613e6c38736a6e
[ "MIT" ]
null
null
null
lib/src/AccessControl.js
songchiva/role-acl
1265d5ef3e7c0407c75bd86ccf613e6c38736a6e
[ "MIT" ]
null
null
null
lib/src/AccessControl.js
songchiva/role-acl
1265d5ef3e7c0407c75bd86ccf613e6c38736a6e
[ "MIT" ]
null
null
null
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("./utils/"); var core_1 = require("./core"); var conditions_1 = require("./conditions"); /** * @classdesc * AccessControl class that implements RBAC (Role-Based Access Control) basics * and ABAC (Attribute-Based Access Control) <i>resource</i> and <i>action</i> * attributes. * * Construct an `AccessControl` instance by either passing a grants object (or * array fetched from database) or simple omit `grants` parameter if you are * willing to build it programmatically. * * <p><pre><code> var grants = { * role1: { * grants: [ * { * resource: 'resource1', * action: 'create' * attributes: ['*'] * }, * { * resource: 'resource1', * action: 'read' * attributes: ['*'] * }, * { * resource: 'resource2', * action: 'create' * attributes: ['*'] * } * ] * }, * role2: { ... } * }; * var ac = new AccessControl(grants);</code></pre></p> * * The `grants` object can also be an array, such as a flat list * fetched from a database. * * <p><pre><code> var flatList = [ * { role: "role1", resource: "resource1", action: "create", attributes: [ attrs ] }, * { role: "role1", resource: "resource1", action: "read", attributes: [ attrs ] }, * { role: "role2", ... }, * ... * ];</code></pre></p> * * We turn this list into a hashtable for better performance. We aggregate * the list by roles first, resources second. * * Below are equivalent: * <p><pre><code> var grants = { role: "role1", resource: "resource1", action: "create", attributes: [ attrs ] } * var same = { role: "role1", resource: "resource1", action: "create", attributes: [ attrs ] }</code></pre></p> * * So we can also initialize with this flat list of grants: * <p><pre><code> var ac = new AccessControl(flatList); * console.log(ac.getGrants());</code></pre></p> * * @author Onur Yıldırım <onur@cutepilot.com> * @license MIT * * @class * @global * */ var AccessControl = /** @class */ (function () { /** * Initializes a new instance of `AccessControl` with the given grants. * * @param {Object|Array} grants - A list containing the access grant * definitions. See the structure of this object in the examples. * * @param {Object} customConditionFns - custom condition functions */ function AccessControl(grants, customConditionFns) { if (grants === void 0) { grants = {}; } if (customConditionFns === void 0) { customConditionFns = {}; } conditions_1.ConditionUtil.resetCustomConditionFunctions(); conditions_1.ConditionUtil.setCustomConditionFunctions(customConditionFns); this.setGrants(grants); } // ------------------------------- // PUBLIC METHODS // ------------------------------- /** * Gets the internal grants object that stores all current grants. * * @return {Object} - Hash-map of grants. */ AccessControl.prototype.getGrants = function () { return this._grants; }; /** * Sets all access grants at once, from an object or array. * Note that this will reset the object and remove all previous grants. * @chainable * * @param {Object|Array} grantsObject - A list containing the access grant * definitions. * * @returns {AccessControl} - `AccessControl` instance for chaining. */ AccessControl.prototype.setGrants = function (grantsObject) { var _this = this; this._grants = {}; var type = utils_1.CommonUtil.type(grantsObject); if (type === "object") { this._grants = utils_1.CommonUtil.normalizeGrantsObject(grantsObject); } else if (type === "array") { grantsObject.filter((function (grant) { return !grant.extend || !grant.extend.length; })) .forEach(function (item) { return utils_1.CommonUtil.commitToGrants(_this._grants, item); }); grantsObject.filter((function (item) { return item.extend && item.extend.length; })) .forEach(function (item) { return utils_1.CommonUtil.extendRole(_this._grants, item.role, item.extend); }); } return this; }; /** * Resets the internal grants object and removes all previous grants. * @chainable * * @returns {AccessControl} - `AccessControl` instance for chaining. */ AccessControl.prototype.reset = function () { this._grants = {}; conditions_1.ConditionUtil.resetCustomConditionFunctions(); return this; }; /** * Extends the given role(s) with privileges of one or more other roles. * @chainable * * @param {String|Array<String>} roles * Role(s) to be extended. * Single role as a `String` or multiple roles as an `Array`. * Note that if a role does not exist, it will be automatically * created. * * @param {String|Array<String>} extenderRoles * Role(s) to inherit from. * Single role as a `String` or multiple roles as an `Array`. * Note that if a extender role does not exist, it will throw. * * @returns {AccessControl} - `AccessControl` instance for chaining. * * @throws {Error} * If a role is extended by itself or a non-existent role. */ AccessControl.prototype.extendRole = function (roles, extenderRoles, condition) { // When extending role we are not checking for conditions so we can use sync method return this.extendRoleSync(roles, extenderRoles, condition); }; AccessControl.prototype.extendRoleSync = function (roles, extenderRoles, condition) { utils_1.CommonUtil.extendRoleSync(this._grants, roles, extenderRoles, condition); return this; }; /** * Removes all the given role(s) and their granted permissions, at once. * @chainable * * @param {String|Array<String>} roles - An array of roles to be removed. * Also accepts a string that can be used to remove a single role. * * @returns {AccessControl} - `AccessControl` instance for chaining. */ AccessControl.prototype.removeRoles = function (roles) { var _this = this; var rolesToRemove = utils_1.ArrayUtil.toStringArray(roles).sort(); // Remove these roles from $extend list of each remaining role. this._each(function (role, roleItem) { if (roleItem.$extend) { // Adjust scores and remove rolesToRemove.forEach(function (role) { if (roleItem.$extend[role]) { roleItem.score -= _this._grants[role].score; delete roleItem.$extend[role]; } }); } }); rolesToRemove.forEach(function (role) { delete _this._grants.role; }); return this; }; /** * Gets all the unique roles that have at least one access information. * * @returns {Array<String>} * * @example * ac.grant('admin, user').createAny('video').grant('user').readOwn('profile'); * console.log(ac.getRoles()); // ["admin", "user"] */ AccessControl.prototype.getRoles = function () { return Object.keys(this._grants); }; /** * Checks whether any permissions are granted to the given role. * * @param {String} role - Role to be checked. * * @returns {Boolean} */ AccessControl.prototype.hasRole = function (role) { return this._grants.hasOwnProperty(role); }; /** * Get allowed grants when conditions are skipped return CommonUtil.getUnionGrantsOfRoles(this._grants, query); * @returns {IAccessInfo[]} - grants */ AccessControl.prototype.allowedGrants = function (query) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, utils_1.CommonUtil.getUnionGrantsOfRoles(this._grants, query)]; }); }); }; AccessControl.prototype.allowedGrantsSync = function (query) { return utils_1.CommonUtil.getUnionGrantsOfRolesSync(this._grants, query); }; /** * Get roles which allow this permission * @param {IQueryInfo} query - permission query object we want to check * * @returns {String[]} - roles */ AccessControl.prototype.allowingRoles = function (query) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, utils_1.CommonUtil.getAllowingRoles(this._grants, query)]; }); }); }; AccessControl.prototype.allowingRolesSync = function (query) { return utils_1.CommonUtil.getAllowingRolesSync(this._grants, query); }; /** * Get allowed actions of resource when conditions are skipped * @param {IQueryInfo} query - permission query object we want to check * * @returns {String[]} - actions */ AccessControl.prototype.allowedActions = function (query) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, utils_1.CommonUtil.getUnionActionsOfRoles(this._grants, query)]; }); }); }; AccessControl.prototype.allowedActionsSync = function (query) { return utils_1.CommonUtil.getUnionActionsOfRolesSync(this._grants, query); }; /** * Get allowed resources when conditions are skipped * @param {IQueryInfo} query - permission query object we want to check * * @returns {String[]} - resources */ AccessControl.prototype.allowedResources = function (query) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, utils_1.CommonUtil.getUnionResourcesOfRoles(this._grants, query)]; }); }); }; AccessControl.prototype.allowedResourcesSync = function (query) { return utils_1.CommonUtil.getUnionResourcesOfRolesSync(this._grants, query); }; /** * Gets an instance of `Query` object. This is used to check whether * the defined access is allowed for the given role(s) and resource. * This object provides chainable methods to define and query the access * permissions to be checked. * @name AccessControl#can * @alias AccessControl#access * @function * @chainable * * @param {String|Array|IQueryInfo} role - A single role (as a string), * a list of roles (as an array) or an {@link ?api=ac#AccessControl~IQueryInfo|`IQueryInfo` object} * that fully or partially defines the access to be checked. * * @returns {Query} - The returned object provides chainable * methods to define and query the access permissions to be checked. * See {@link ?api=ac#AccessControl~Query|`Query` inner class}. * * @example * var ac = new AccessControl(grants); * * ac.can('admin').create('profile'); * // equivalent to: * ac.can().role('admin').create('profile'); * // equivalent to: * ac.can().role('admin').resource('profile').createA(); * * // To check for multiple roles: * ac.can(['admin', 'user']).createOwn('profile'); * // Note: when multiple roles checked, acquired attributes are union (merged). */ AccessControl.prototype.can = function (role) { return new core_1.Query(this._grants, role); }; /** * Alias of `can()`. * @private */ AccessControl.prototype.access = function (role) { return this.can(role); }; /** * Gets an instance of `Permission` object that checks and defines * the granted access permissions for the target resource and role. * Normally you would use `AccessControl#can()` method to check for * permissions but this is useful if you need to check at once by passing * a `IQueryInfo` object; instead of chaining methods * (as in `.can(<role>).<action>(<resource>)`). * * @param {IQueryInfo} queryInfo * A fulfilled {@link ?api=ac#AccessControl~IQueryInfo|`IQueryInfo` object}. * * @returns {Permission} - An object that provides properties * and methods that defines the granted access permissions. See * {@link ?api=ac#AccessControl~Permission|`Permission` inner class}. * * @example * var ac = new AccessControl(grants); * var permission = ac.permission({ * role: "user", * action: "update", * resource: "profile" * }); * permission.granted; // Boolean * permission.attributes; // Array e.g. [ 'username', 'password', 'company.*'] * permission.filter(object); // { username, password, company: { name, address, ... } } */ AccessControl.prototype.permission = function (queryInfo) { return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = core_1.Permission.bind; _b = [void 0, queryInfo]; return [4 /*yield*/, utils_1.CommonUtil.getUnionAttrsOfRoles(this._grants, queryInfo)]; case 1: return [2 /*return*/, new (_a.apply(core_1.Permission, _b.concat([_c.sent()])))()]; } }); }); }; AccessControl.prototype.permissionSync = function (queryInfo) { return new core_1.Permission(queryInfo, utils_1.CommonUtil.getUnionAttrsOfRolesSync(this._grants, queryInfo)); }; /** * Gets an instance of `Grant` (inner) object. This is used to grant access * to specified resource(s) for the given role(s). * @name AccessControl#grant * @alias AccessControl#allow * @function * @chainable * * @param {String|Array<String>|IAccessInfo} role * A single role (as a string), a list of roles (as an array) or an * {@link ?api=ac#AccessControl~IAccessInfo|`IAccessInfo` object} * that fully or partially defines the access to be granted. * * @return {Access} * The returned object provides chainable properties to build and * define the access to be granted. See the examples for details. * See {@link ?api=ac#AccessControl~Access|`Access` inner class}. * * @example * var ac = new AccessControl(), * attributes = ['*']; * * ac.grant('admin').createAny('profile', attributes); * // equivalent to: * ac.grant().role('admin').createAny('profile', attributes); * // equivalent to: * ac.grant().role('admin').resource('profile').createAny(null, attributes); * // equivalent to: * ac.grant({ * role: 'admin', * resource: 'profile', * }).createAny(null, attributes); * // equivalent to: * ac.grant({ * role: 'admin', * resource: 'profile', * action: 'create:any', * attributes: attributes * }); * // equivalent to: * ac.grant({ * role: 'admin', * resource: 'profile', * action: 'create', * attributes: attributes * }); * * // To grant same resource and attributes for multiple roles: * ac.grant(['admin', 'user']).createOwn('profile', attributes); * * // Note: when attributes is omitted, it will default to `['*']` * // which means all attributes (of the resource) are allowed. */ AccessControl.prototype.grant = function (role) { return new core_1.Access(this._grants, role); }; /** * Alias of `grant()`. */ AccessControl.prototype.allow = function (role) { return this.grant(role); }; /** * Converts grants object to JSON format */ AccessControl.prototype.toJSON = function () { return utils_1.CommonUtil.toExtendedJSON({ grants: this._grants, customConditionFunctions: conditions_1.ConditionUtil.getCustomConditionFunctions() }); }; AccessControl.prototype.registerConditionFunction = function (funtionName, fn) { conditions_1.ConditionUtil.registerCustomConditionFunction(funtionName, fn); return this; }; // ------------------------------- // PRIVATE METHODS // ------------------------------- /** * @private */ AccessControl.prototype._each = function (callback) { var _this = this; utils_1.CommonUtil.eachKey(this._grants, function (role) { return callback(role, _this._grants[role]); }); }; Object.defineProperty(AccessControl, "Error", { /** * Documented separately in AccessControlError * @private */ get: function () { return core_1.AccessControlError; }, enumerable: true, configurable: true }); // ------------------------------- // PUBLIC STATIC METHODS // ------------------------------- /** * A utility method for deep cloning the given data object(s) while * filtering its properties by the given attribute (glob) notations. * Includes all matched properties and removes the rest. * * Note that this should be used to manipulate data / arbitrary objects * with enumerable properties. It will not deal with preserving the * prototype-chain of the given object. * * @param {Object|Array} data - A single or array of data objects * to be filtered. * @param {Array|String} attributes - The attribute glob notation(s) * to be processed. You can use wildcard stars (*) and negate * the notation by prepending a bang (!). A negated notation * will be excluded. Order of the globs do not matter, they will * be logically sorted. Loose globs will be processed first and * verbose globs or normal notations will be processed last. * e.g. `[ "car.model", "*", "!car.*" ]` * will be sorted as: * `[ "*", "!car.*", "car.model" ]`. * Passing no parameters or passing an empty string (`""` or `[""]`) * will empty the source object. * * @returns {Object|Array} - Returns the filtered data object or array * of data objects. * * @example * var assets = { notebook: "Mac", car: { brand: "Ford", model: "Mustang", year: 1970, color: "red" } }; * * var filtered = AccessControl.filter(assets, [ "*", "!car.*", "car.model" ]); * console.log(assets); // { notebook: "Mac", car: { model: "Mustang" } } * * filtered = AccessControl.filter(assets, "*"); // or AccessControl.filter(assets, ["*"]); * console.log(assets); // { notebook: "Mac", car: { model: "Mustang" } } * * filtered = AccessControl.filter(assets); // or AccessControl.filter(assets, ""); * console.log(assets); // {} */ AccessControl.filter = function (data, attributes) { return utils_1.CommonUtil.filterAll(data, attributes); }; /** * Checks whether the given object is an instance of `AccessControl.Error`. * @name AccessControl.isACError * @alias AccessControl.isAccessControlError * @function * * @param {Any} object * Object to be checked. * * @returns {Boolean} */ AccessControl.isACError = function (object) { return object instanceof core_1.AccessControlError; }; /** * Alias of `isACError` * @private */ AccessControl.isAccessControlError = function (object) { return AccessControl.isACError(object); }; /** * Prepare AccessControl from JSON * @param aclJSON JSON generated from toJSON method. */ AccessControl.fromJSON = function (aclJSON) { var aclObj = utils_1.CommonUtil.fromExtendedJSON(aclJSON); return new AccessControl(aclObj.grants, aclObj.customConditionFunctions); }; return AccessControl; }()); exports.AccessControl = AccessControl;
40.940559
169
0.572295
6a14dd2c72fea64cdc2505f5720e3a5f1d9aad54
361
js
JavaScript
Generate user links.js
Dnmrk4/codewars-8kyu
c2f1eb4d77dc4b6eb87c8e619d2068baa9a3a32a
[ "MIT" ]
70
2019-02-20T01:21:23.000Z
2022-03-05T19:11:40.000Z
Generate user links.js
Dnmrk4/codewars-8kyu
c2f1eb4d77dc4b6eb87c8e619d2068baa9a3a32a
[ "MIT" ]
null
null
null
Generate user links.js
Dnmrk4/codewars-8kyu
c2f1eb4d77dc4b6eb87c8e619d2068baa9a3a32a
[ "MIT" ]
51
2019-02-28T07:54:42.000Z
2022-03-22T01:01:59.000Z
/* Description: Generate user links Your task is to create userlinks for the url, you will be given a username and must return a valid link. Example generate_link('matt c') http://www.codewars.com/users/matt%20c reference use this as a reference encoding */ function generateLink(user) { return `http://www.codewars.com/users/${encodeURIComponent(user)}` }
22.5625
104
0.764543
6a16169cf5693f351e30603d8261990e462d4c13
126
js
JavaScript
convertjQueryObject/app.js
GhulamMustafaGM/jquery-practices-apps
0b386adab5d4a5ff8a944a62ac50bfbf899ed2d5
[ "MIT" ]
null
null
null
convertjQueryObject/app.js
GhulamMustafaGM/jquery-practices-apps
0b386adab5d4a5ff8a944a62ac50bfbf899ed2d5
[ "MIT" ]
null
null
null
convertjQueryObject/app.js
GhulamMustafaGM/jquery-practices-apps
0b386adab5d4a5ff8a944a62ac50bfbf899ed2d5
[ "MIT" ]
null
null
null
var element = $( '<h1></h1>', { text: "jQuery", class: "test" } ); $( '#output' ).text( element.get( 0 ).outerHTML );
21
50
0.5
6a1690069ff462279da97437d84f77b4e0f7b5de
387
js
JavaScript
src/components/atom/Typography/Typography.stories.js
juicycleff/chatql-ui-react
4f1da072615165b1a82398026a36a8322a801182
[ "MIT" ]
1
2019-01-10T07:06:39.000Z
2019-01-10T07:06:39.000Z
src/components/atom/Typography/Typography.stories.js
juicycleff/chatql-ui-react
4f1da072615165b1a82398026a36a8322a801182
[ "MIT" ]
null
null
null
src/components/atom/Typography/Typography.stories.js
juicycleff/chatql-ui-react
4f1da072615165b1a82398026a36a8322a801182
[ "MIT" ]
1
2020-01-08T15:27:52.000Z
2020-01-08T15:27:52.000Z
import { storiesOf } from "@storybook/react"; import React, { Fragment } from "react"; import { withDocs } from "storybook-readme"; import Typography from "./Typography"; import readme from "./README.md"; storiesOf("Typography", module) .addDecorator(withDocs(readme)) .add("a simple typography", () => <Fragment> <Typography>Headline Text</Typography> </Fragment>);
27.642857
45
0.689922
6a17791c1089fd035bd531fcd06cdb5de56b392d
2,515
js
JavaScript
client/src/Pages/Single/Single.test.js
gfpaiva/socketpo
ba36c8bd287948807c6dcdb6faa3b0f4b4be86d6
[ "MIT" ]
5
2018-10-16T15:28:29.000Z
2019-05-15T16:23:21.000Z
client/src/Pages/Single/Single.test.js
gfpaiva/socketpo
ba36c8bd287948807c6dcdb6faa3b0f4b4be86d6
[ "MIT" ]
15
2019-05-09T23:21:57.000Z
2022-02-17T17:57:08.000Z
client/src/Pages/Single/Single.test.js
gfpaiva/socketpo
ba36c8bd287948807c6dcdb6faa3b0f4b4be86d6
[ "MIT" ]
3
2017-04-05T22:15:07.000Z
2020-04-04T20:30:00.000Z
import React from 'react'; import { mount } from 'enzyme'; import { BrowserRouter as Router } from 'react-router-dom'; import { MockedProvider } from 'react-apollo/test-utils'; import wait from 'waait'; import Single from './Single'; import { getGame, gameSub } from '../../Utils/graphqlAPI'; import { fakeGame, fakePlayer, fakeRound } from '../../Utils/testUtils'; const game = fakeGame( true, fakePlayer(), [ fakeRound(), fakeRound({ winner: fakePlayer({ id: 'player02', name: 'Player 02' }) }), fakeRound({ isDraw: true }) ], { status: 1 } ); const player = fakePlayer(); const mocks = [ { request: { query: getGame, variables: { hash: game.hash } }, result: { data: { GameByHash: { ...game } } }, }, { request: { query: gameSub, variables: { hash: game.hash } }, result: { data: { gameSubscription: { __typename: "GameSub", game : { ...game }, message: '', hash: game.hash, player: player.name } } }, }, { request: { query: gameSub, variables: { hash: game.hash } }, result: { data: { gameSubscription: { __typename: "GameSub", game : { ...game }, message: '', hash: game.hash, player: player.name } } }, }, { request: { query: gameSub, variables: { hash: game.hash } }, result: { data: { gameSubscription: { __typename: "GameSub", game : { ...game }, message: '', hash: game.hash, player: player.name } } }, }, { request: { query: gameSub, variables: { hash: game.hash } }, result: { data: { gameSubscription: { __typename: "GameSub", game : { ...game }, message: '', hash: game.hash, player: player.name } } }, }, { request: { query: gameSub, variables: { hash: game.hash } }, result: { data: { gameSubscription: { __typename: "GameSub", game : { ...game }, message: '', hash: game.hash, player: player.name } } }, }, ]; describe('<Single />', () => { it('should mount properly', async () => { const wrapper = mount( <Router> <MockedProvider mocks={mocks}> <Single match={{params: {hash: game.hash}}} /> </MockedProvider> </Router> ); const SingleInstance = wrapper.find('Single').instance(); SingleInstance.currentPlayer = player; await wait(); wrapper.update(); expect(wrapper.find('.single__split').length).toBe(1); }); });
18.224638
75
0.54672
6a17a1840f66c36be2d507f320e24b5a7dcae8f2
380
js
JavaScript
cli.js
Richienb/supervillains-cli
adc63f7cc76ce0b4748da175e99c1d5ed6ffb0e5
[ "MIT" ]
38
2018-07-14T12:47:04.000Z
2022-01-15T02:30:57.000Z
cli.js
Richienb/supervillains-cli
adc63f7cc76ce0b4748da175e99c1d5ed6ffb0e5
[ "MIT" ]
1
2018-07-29T14:49:59.000Z
2018-07-29T14:49:59.000Z
cli.js
Richienb/supervillains-cli
adc63f7cc76ce0b4748da175e99c1d5ed6ffb0e5
[ "MIT" ]
7
2018-07-29T09:41:49.000Z
2021-01-01T14:34:31.000Z
#!/usr/bin/env node 'use strict'; const meow = require('meow'); const supervillains = require('supervillains'); const cli = meow(` Examples $ supervillains Mud Pack $ supervillains --all Abattoir Able Crown ... Options --all Get all names instead of a random name `); console.log(cli.flags.all ? supervillains.all.join('\n') : supervillains.random());
18.095238
83
0.671053
6a17bc3e31c78ec1494ba863bbf2b555a92cf153
3,091
js
JavaScript
libs/hana/doc/html/search/all_5.js
anarthal/boost-unix-mirror
8c34eb2fe471d6c3113c680c1fbef29e7a8063a0
[ "BSL-1.0" ]
1
2020-04-28T15:15:28.000Z
2020-04-28T15:15:28.000Z
libs/hana/doc/html/search/all_5.js
anarthal/boost-unix-mirror
8c34eb2fe471d6c3113c680c1fbef29e7a8063a0
[ "BSL-1.0" ]
4
2021-10-21T12:42:04.000Z
2022-02-03T08:41:31.000Z
Libs/boost_1_76_0/libs/hana/doc/html/search/all_5.js
Antd23rus/S2DE
47cc7151c2934cd8f0399a9856c1e54894571553
[ "MIT" ]
8
2015-11-03T14:12:19.000Z
2020-09-22T19:20:54.000Z
var searchData= [ ['ebo_2ehpp_168',['ebo.hpp',['../ebo_8hpp.html',1,'']]], ['embedding_169',['embedding',['../structboost_1_1hana_1_1embedding.html',1,'boost::hana']]], ['embedding_3c_20is_5fembedded_3c_20c_3a_3avalue_5ftype_2c_20t_20_3e_3a_3avalue_20_3e_170',['embedding&lt; is_embedded&lt; C::value_type, T &gt;::value &gt;',['../structboost_1_1hana_1_1embedding.html',1,'boost::hana']]], ['embedding_3c_20is_5fembedded_3c_20from_3a_3avalue_5ftype_2c_20to_20_3e_3a_3avalue_20_3e_171',['embedding&lt; is_embedded&lt; From::value_type, To &gt;::value &gt;',['../structboost_1_1hana_1_1embedding.html',1,'boost::hana']]], ['embedding_3c_20sequence_3c_20f_20_3e_3a_3avalue_20_3e_172',['embedding&lt; Sequence&lt; F &gt;::value &gt;',['../structboost_1_1hana_1_1embedding.html',1,'boost::hana']]], ['embedding_3c_3e_173',['embedding&lt;&gt;',['../structboost_1_1hana_1_1embedding.html',1,'boost::hana']]], ['empty_174',['empty',['../group__group-_monad_plus.html#gaa6be1e83ad72b9d69b43b4bada0f3a75',1,'boost::hana']]], ['empty_2ehpp_175',['empty.hpp',['../empty_8hpp.html',1,'(Global Namespace)'],['../fwd_2empty_8hpp.html',1,'(Global Namespace)']]], ['equal_176',['equal',['../group__group-_comparable.html#gacaf1ebea6b3ab96ac9dcb82f0e64e547',1,'boost::hana']]], ['equal_2ehpp_177',['equal.hpp',['../equal_8hpp.html',1,'(Global Namespace)'],['../fwd_2equal_8hpp.html',1,'(Global Namespace)']]], ['erase_5fkey_178',['erase_key',['../structboost_1_1hana_1_1map.html#af856f7bf77f69cdf1b8fd4e566eaef9b',1,'boost::hana::map::erase_key()'],['../structboost_1_1hana_1_1set.html#af856f7bf77f69cdf1b8fd4e566eaef9b',1,'boost::hana::set::erase_key()']]], ['erase_5fkey_2ehpp_179',['erase_key.hpp',['../erase__key_8hpp.html',1,'(Global Namespace)'],['../fwd_2erase__key_8hpp.html',1,'(Global Namespace)']]], ['euclidean_5fring_2ehpp_180',['euclidean_ring.hpp',['../concept_2euclidean__ring_8hpp.html',1,'(Global Namespace)'],['../fwd_2concept_2euclidean__ring_8hpp.html',1,'(Global Namespace)']]], ['eval_181',['eval',['../structboost_1_1hana_1_1lazy.html#aae2998c08f1f80ed52a6acf57c4eec6c',1,'boost::hana::lazy']]], ['eval_2ehpp_182',['eval.hpp',['../eval_8hpp.html',1,'(Global Namespace)'],['../fwd_2eval_8hpp.html',1,'(Global Namespace)']]], ['eval_5fif_183',['eval_if',['../group__group-_logical.html#gab64636f84de983575aac0208f5fa840c',1,'boost::hana']]], ['eval_5fif_2ehpp_184',['eval_if.hpp',['../eval__if_8hpp.html',1,'(Global Namespace)'],['../fwd_2eval__if_8hpp.html',1,'(Global Namespace)']]], ['extend_2ehpp_185',['extend.hpp',['../extend_8hpp.html',1,'(Global Namespace)'],['../fwd_2extend_8hpp.html',1,'(Global Namespace)']]], ['extract_2ehpp_186',['extract.hpp',['../extract_8hpp.html',1,'(Global Namespace)'],['../fwd_2extract_8hpp.html',1,'(Global Namespace)']]], ['euclidean_20ring_187',['Euclidean Ring',['../group__group-_euclidean_ring.html',1,'']]], ['experimental_20features_188',['Experimental features',['../group__group-experimental.html',1,'']]], ['external_20adapters_189',['External adapters',['../group__group-ext.html',1,'']]] ];
118.884615
250
0.72242
6a17c3f8a8fda2505311170775fa7ff9fe8c2682
148
js
JavaScript
misc/deprecated/deprecate-ext-react/src/ExtMenu.js
msgimanila/EXT-React-MSG
9e78cceedc85204d28584849d64214e638f2b6f6
[ "Apache-2.0" ]
94
2018-08-29T15:23:23.000Z
2022-01-30T07:46:28.000Z
misc/deprecated/deprecate-ext-react/src/ExtMenu.js
msgimanila/EXT-React-MSG
9e78cceedc85204d28584849d64214e638f2b6f6
[ "Apache-2.0" ]
49
2018-08-21T22:44:33.000Z
2021-08-11T21:08:29.000Z
misc/deprecated/deprecate-ext-react/src/ExtMenu.js
msgimanila/EXT-React-MSG
9e78cceedc85204d28584849d64214e638f2b6f6
[ "Apache-2.0" ]
46
2018-08-08T17:12:19.000Z
2021-11-11T10:00:49.000Z
import reactize from './reactize.js'; import EWCMenu from '@sencha/ext-web-components/src/ext-menu.component.js'; export default reactize(EWCMenu);
37
75
0.783784
6a180de161d7c77ba802343374d103a40bd2c057
883
js
JavaScript
test/setup.js
appfolio/react-big-calendar
40a740acabac703898e44bd63885183344e443d4
[ "MIT" ]
null
null
null
test/setup.js
appfolio/react-big-calendar
40a740acabac703898e44bd63885183344e443d4
[ "MIT" ]
9
2017-06-15T20:25:39.000Z
2022-02-10T18:34:33.000Z
test/setup.js
appfolio/react-big-calendar
40a740acabac703898e44bd63885183344e443d4
[ "MIT" ]
null
null
null
/* setup.js */ // Set up jsdom for enzyme testing const { JSDOM } = require('jsdom'); const jsdom = new JSDOM('<!doctype html><html><body></body></html>'); const { window } = jsdom; function copyProps(src, target) { const props = Object.getOwnPropertyNames(src) .filter(prop => typeof target[prop] === 'undefined') .map(prop => Object.getOwnPropertyDescriptor(src, prop)); Object.defineProperties(target, props); } global.window = window; global.document = window.document; global.navigator = { userAgent: 'node.js' }; copyProps(window, global); // Set up Chai expectations to use "dirty-chai" and "chai-enzyme". // See https://github.com/prodatakey/dirty-chai // https://github.com/producthunt/chai-enzyme // import chai from 'chai'; import dirtyChai from 'dirty-chai'; chai.use(dirtyChai); chai.use(require('chai-enzyme')()); chai.use(require('chai-moment'));
29.433333
69
0.699887
6a18688d08a3cd1222849eef7fcd96e496116fb7
1,032
js
JavaScript
dashboard/src/services/http.js
masonwoodford/restqa
c1172414db74330fcecf32d769a190cec5ef8973
[ "MIT" ]
null
null
null
dashboard/src/services/http.js
masonwoodford/restqa
c1172414db74330fcecf32d769a190cec5ef8973
[ "MIT" ]
null
null
null
dashboard/src/services/http.js
masonwoodford/restqa
c1172414db74330fcecf32d769a190cec5ef8973
[ "MIT" ]
null
null
null
import axios from "axios"; export class ForbiddenError extends Error { constructor(message) { super(message); this.name = "ForbiddenError"; } } export class ValidationError extends Error { constructor(message) { super(message); this.name = "ValidationError"; } } function client() { let baseURL = ""; if ("development" === process.env.NODE_ENV) { baseURL = "http://localhost:8081"; } const instance = axios.create({ baseURL }); instance.interceptors.response.use( function (response) { return Promise.resolve(response); }, function (error) { if (error.response && error.response.status) { switch (error.response.status) { case 403: error = new ForbiddenError(error.response.data.message); break; case 406: error = new ValidationError(error.response.data.message); break; } } return Promise.reject(error); } ); return instance; } export default client;
20.235294
69
0.611434
6a18899f9e15442878d263af54dae664b1d5c709
459
js
JavaScript
bookshelf.js
kevinmrpvision/hapi
e1a4898390696de398b7a72f50df686bbdf6fcc7
[ "MIT" ]
32
2017-05-17T10:38:57.000Z
2021-03-02T16:54:37.000Z
bookshelf.js
kevinmrpvision/hapi
e1a4898390696de398b7a72f50df686bbdf6fcc7
[ "MIT" ]
13
2017-06-25T12:33:49.000Z
2021-03-02T03:22:57.000Z
bookshelf.js
kevinmrpvision/hapi
e1a4898390696de398b7a72f50df686bbdf6fcc7
[ "MIT" ]
12
2017-05-17T07:04:14.000Z
2021-09-10T08:06:11.000Z
'use strict'; const connection = require('./knexfile'); const Knex = require('knex')(connection); const Bookshelf = require('bookshelf')(Knex); // Bookshelf supported plugins. Bookshelf.plugin('registry'); Bookshelf.plugin('visibility'); // Community plugins. Bookshelf.plugin(require('bookshelf-paranoia'), {field: 'deletedAt'}); Bookshelf.plugin(require('bookshelf-scopes')); Bookshelf.plugin(require('bookshelf-eloquent')); module.exports = Bookshelf;
27
70
0.747277
6a18d4197b764fc83f8f65b99c0f8daca2db05af
23,135
js
JavaScript
node_modules/@ng-bootstrap/ng-bootstrap/esm2015/accordion/accordion.js
ManuelPortero/Angularcalendar
caa0f2a079b7e9f419978236d63323a67aa3bd6b
[ "MIT" ]
null
null
null
node_modules/@ng-bootstrap/ng-bootstrap/esm2015/accordion/accordion.js
ManuelPortero/Angularcalendar
caa0f2a079b7e9f419978236d63323a67aa3bd6b
[ "MIT" ]
7
2020-09-07T22:56:45.000Z
2022-03-02T07:19:11.000Z
node_modules/@ng-bootstrap/ng-bootstrap/esm2015/accordion/accordion.js
ManuelPortero/Angularcalendar
caa0f2a079b7e9f419978236d63323a67aa3bd6b
[ "MIT" ]
null
null
null
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ import { Component, ContentChildren, Directive, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core'; import { isString } from '../util/util'; import { NgbAccordionConfig } from './accordion-config'; /** @type {?} */ let nextId = 0; /** * This directive should be used to wrap accordion panel titles that need to contain HTML markup or other directives. */ export class NgbPanelTitle { /** * @param {?} templateRef */ constructor(templateRef) { this.templateRef = templateRef; } } NgbPanelTitle.decorators = [ { type: Directive, args: [{ selector: 'ng-template[ngbPanelTitle]' },] }, ]; /** @nocollapse */ NgbPanelTitle.ctorParameters = () => [ { type: TemplateRef } ]; if (false) { /** @type {?} */ NgbPanelTitle.prototype.templateRef; } /** * This directive must be used to wrap accordion panel content. */ export class NgbPanelContent { /** * @param {?} templateRef */ constructor(templateRef) { this.templateRef = templateRef; } } NgbPanelContent.decorators = [ { type: Directive, args: [{ selector: 'ng-template[ngbPanelContent]' },] }, ]; /** @nocollapse */ NgbPanelContent.ctorParameters = () => [ { type: TemplateRef } ]; if (false) { /** @type {?} */ NgbPanelContent.prototype.templateRef; } /** * The NgbPanel directive represents an individual panel with the title and collapsible * content */ export class NgbPanel { constructor() { /** * A flag determining whether the panel is disabled or not. * When disabled, the panel cannot be toggled. */ this.disabled = false; /** * An optional id for the panel. The id should be unique. * If not provided, it will be auto-generated. */ this.id = `ngb-panel-${nextId++}`; /** * A flag telling if the panel is currently open */ this.isOpen = false; } /** * @return {?} */ ngAfterContentChecked() { // We are using @ContentChildren instead of @ContantChild as in the Angular version being used // only @ContentChildren allows us to specify the {descendants: false} option. // Without {descendants: false} we are hitting bugs described in: // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240 this.titleTpl = this.titleTpls.first; this.contentTpl = this.contentTpls.first; } } NgbPanel.decorators = [ { type: Directive, args: [{ selector: 'ngb-panel' },] }, ]; NgbPanel.propDecorators = { disabled: [{ type: Input }], id: [{ type: Input }], title: [{ type: Input }], type: [{ type: Input }], titleTpls: [{ type: ContentChildren, args: [NgbPanelTitle, { descendants: false },] }], contentTpls: [{ type: ContentChildren, args: [NgbPanelContent, { descendants: false },] }] }; if (false) { /** * A flag determining whether the panel is disabled or not. * When disabled, the panel cannot be toggled. * @type {?} */ NgbPanel.prototype.disabled; /** * An optional id for the panel. The id should be unique. * If not provided, it will be auto-generated. * @type {?} */ NgbPanel.prototype.id; /** * A flag telling if the panel is currently open * @type {?} */ NgbPanel.prototype.isOpen; /** * The title for the panel. * @type {?} */ NgbPanel.prototype.title; /** * Accordion's types of panels to be applied per panel basis. * Bootstrap recognizes the following types: "primary", "secondary", "success", "danger", "warning", "info", "light" * and "dark" * @type {?} */ NgbPanel.prototype.type; /** @type {?} */ NgbPanel.prototype.titleTpl; /** @type {?} */ NgbPanel.prototype.contentTpl; /** @type {?} */ NgbPanel.prototype.titleTpls; /** @type {?} */ NgbPanel.prototype.contentTpls; } /** * The payload of the change event fired right before toggling an accordion panel * @record */ export function NgbPanelChangeEvent() { } /** * Id of the accordion panel that is toggled * @type {?} */ NgbPanelChangeEvent.prototype.panelId; /** * Whether the panel will be opened (true) or closed (false) * @type {?} */ NgbPanelChangeEvent.prototype.nextState; /** * Function that will prevent panel toggling if called * @type {?} */ NgbPanelChangeEvent.prototype.preventDefault; /** * The NgbAccordion directive is a collection of panels. * It can assure that only one panel can be opened at a time. */ export class NgbAccordion { /** * @param {?} config */ constructor(config) { /** * An array or comma separated strings of panel identifiers that should be opened */ this.activeIds = []; /** * Whether the closed panels should be hidden without destroying them */ this.destroyOnHide = true; /** * A panel change event fired right before the panel toggle happens. See NgbPanelChangeEvent for payload details */ this.panelChange = new EventEmitter(); this.type = config.type; this.closeOtherPanels = config.closeOthers; } /** * Programmatically toggle a panel with a given id. * @param {?} panelId * @return {?} */ toggle(panelId) { /** @type {?} */ const panel = this.panels.find(p => p.id === panelId); if (panel && !panel.disabled) { /** @type {?} */ let defaultPrevented = false; this.panelChange.emit({ panelId: panelId, nextState: !panel.isOpen, preventDefault: () => { defaultPrevented = true; } }); if (!defaultPrevented) { panel.isOpen = !panel.isOpen; if (this.closeOtherPanels) { this._closeOthers(panelId); } this._updateActiveIds(); } } } /** * @return {?} */ ngAfterContentChecked() { // active id updates if (isString(this.activeIds)) { this.activeIds = this.activeIds.split(/\s*,\s*/); } // update panels open states this.panels.forEach(panel => panel.isOpen = !panel.disabled && this.activeIds.indexOf(panel.id) > -1); // closeOthers updates if (this.activeIds.length > 1 && this.closeOtherPanels) { this._closeOthers(this.activeIds[0]); this._updateActiveIds(); } } /** * @param {?} panelId * @return {?} */ _closeOthers(panelId) { this.panels.forEach(panel => { if (panel.id !== panelId) { panel.isOpen = false; } }); } /** * @return {?} */ _updateActiveIds() { this.activeIds = this.panels.filter(panel => panel.isOpen && !panel.disabled).map(panel => panel.id); } } NgbAccordion.decorators = [ { type: Component, args: [{ selector: 'ngb-accordion', exportAs: 'ngbAccordion', host: { 'class': 'accordion', 'role': 'tablist', '[attr.aria-multiselectable]': '!closeOtherPanels' }, template: ` <ng-template ngFor let-panel [ngForOf]="panels"> <div class="card"> <div role="tab" id="{{panel.id}}-header" [class]="'card-header ' + (panel.type ? 'bg-'+panel.type: type ? 'bg-'+type : '')"> <h5 class="mb-0"> <button class="btn btn-link" (click)="!!toggle(panel.id)" [disabled]="panel.disabled" [class.collapsed]="!panel.isOpen" [attr.aria-expanded]="panel.isOpen" [attr.aria-controls]="panel.id"> {{panel.title}}<ng-template [ngTemplateOutlet]="panel.titleTpl?.templateRef"></ng-template> </button> </h5> </div> <div id="{{panel.id}}" role="tabpanel" [attr.aria-labelledby]="panel.id + '-header'" class="collapse" [class.show]="panel.isOpen" *ngIf="!destroyOnHide || panel.isOpen"> <div class="card-body"> <ng-template [ngTemplateOutlet]="panel.contentTpl?.templateRef"></ng-template> </div> </div> </div> </ng-template> ` },] }, ]; /** @nocollapse */ NgbAccordion.ctorParameters = () => [ { type: NgbAccordionConfig } ]; NgbAccordion.propDecorators = { panels: [{ type: ContentChildren, args: [NgbPanel,] }], activeIds: [{ type: Input }], closeOtherPanels: [{ type: Input, args: ['closeOthers',] }], destroyOnHide: [{ type: Input }], type: [{ type: Input }], panelChange: [{ type: Output }] }; if (false) { /** @type {?} */ NgbAccordion.prototype.panels; /** * An array or comma separated strings of panel identifiers that should be opened * @type {?} */ NgbAccordion.prototype.activeIds; /** * Whether the other panels should be closed when a panel is opened * @type {?} */ NgbAccordion.prototype.closeOtherPanels; /** * Whether the closed panels should be hidden without destroying them * @type {?} */ NgbAccordion.prototype.destroyOnHide; /** * Accordion's types of panels to be applied globally. * Bootstrap recognizes the following types: "primary", "secondary", "success", "danger", "warning", "info", "light" * and "dark * @type {?} */ NgbAccordion.prototype.type; /** * A panel change event fired right before the panel toggle happens. See NgbPanelChangeEvent for payload details * @type {?} */ NgbAccordion.prototype.panelChange; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3JkaW9uLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nLWJvb3RzdHJhcC9uZy1ib290c3RyYXAvIiwic291cmNlcyI6WyJhY2NvcmRpb24vYWNjb3JkaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBRUwsU0FBUyxFQUNULGVBQWUsRUFDZixTQUFTLEVBQ1QsWUFBWSxFQUNaLEtBQUssRUFDTCxNQUFNLEVBQ04sU0FBUyxFQUNULFdBQVcsRUFDWixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sY0FBYyxDQUFDO0FBRXRDLE9BQU8sRUFBQyxrQkFBa0IsRUFBQyxNQUFNLG9CQUFvQixDQUFDOztBQUV0RCxJQUFJLE1BQU0sR0FBRyxDQUFDLENBQUM7Ozs7QUFNZixNQUFNOzs7O0lBQ0osWUFBbUIsV0FBNkI7UUFBN0IsZ0JBQVcsR0FBWCxXQUFXLENBQWtCO0tBQUk7OztZQUZyRCxTQUFTLFNBQUMsRUFBQyxRQUFRLEVBQUUsNEJBQTRCLEVBQUM7Ozs7WUFaakQsV0FBVzs7Ozs7Ozs7O0FBcUJiLE1BQU07Ozs7SUFDSixZQUFtQixXQUE2QjtRQUE3QixnQkFBVyxHQUFYLFdBQVcsQ0FBa0I7S0FBSTs7O1lBRnJELFNBQVMsU0FBQyxFQUFDLFFBQVEsRUFBRSw4QkFBOEIsRUFBQzs7OztZQXBCbkQsV0FBVzs7Ozs7Ozs7OztBQThCYixNQUFNOzs7Ozs7d0JBS2dCLEtBQUs7Ozs7O2tCQU1YLGFBQWEsTUFBTSxFQUFFLEVBQUU7Ozs7c0JBSzVCLEtBQUs7Ozs7O0lBb0JkLHFCQUFxQjs7Ozs7UUFLbkIsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQztRQUNyQyxJQUFJLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsS0FBSyxDQUFDO0tBQzFDOzs7WUE1Q0YsU0FBUyxTQUFDLEVBQUMsUUFBUSxFQUFFLFdBQVcsRUFBQzs7O3VCQU0vQixLQUFLO2lCQU1MLEtBQUs7b0JBVUwsS0FBSzttQkFPTCxLQUFLO3dCQUtMLGVBQWUsU0FBQyxhQUFhLEVBQUUsRUFBQyxXQUFXLEVBQUUsS0FBSyxFQUFDOzBCQUNuRCxlQUFlLFNBQUMsZUFBZSxFQUFFLEVBQUMsV0FBVyxFQUFFLEtBQUssRUFBQzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUE2RHhELE1BQU07Ozs7SUE4QkosWUFBWSxNQUEwQjs7Ozt5QkF4QkUsRUFBRTs7Ozs2QkFVakIsSUFBSTs7OzsyQkFZTCxJQUFJLFlBQVksRUFBdUI7UUFHN0QsSUFBSSxDQUFDLElBQUksR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDO1FBQ3hCLElBQUksQ0FBQyxnQkFBZ0IsR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDO0tBQzVDOzs7Ozs7SUFLRCxNQUFNLENBQUMsT0FBZTs7UUFDcEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLE9BQU8sQ0FBQyxDQUFDO1FBRXRELEVBQUUsQ0FBQyxDQUFDLEtBQUssSUFBSSxDQUFDLEtBQUssQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDOztZQUM3QixJQUFJLGdCQUFnQixHQUFHLEtBQUssQ0FBQztZQUU3QixJQUFJLENBQUMsV0FBVyxDQUFDLElBQUksQ0FDakIsRUFBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLFNBQVMsRUFBRSxDQUFDLEtBQUssQ0FBQyxNQUFNLEVBQUUsY0FBYyxFQUFFLEdBQUcsRUFBRSxHQUFHLGdCQUFnQixHQUFHLElBQUksQ0FBQyxFQUFFLEVBQUMsQ0FBQyxDQUFDO1lBRXRHLEVBQUUsQ0FBQyxDQUFDLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDO2dCQUN0QixLQUFLLENBQUMsTUFBTSxHQUFHLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQztnQkFFN0IsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQztvQkFDMUIsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsQ0FBQztpQkFDNUI7Z0JBQ0QsSUFBSSxDQUFDLGdCQUFnQixFQUFFLENBQUM7YUFDekI7U0FDRjtLQUNGOzs7O0lBRUQscUJBQXFCOztRQUVuQixFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUM3QixJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1NBQ2xEOztRQUdELElBQUksQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDLE1BQU0sR0FBRyxDQUFDLEtBQUssQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUM7O1FBR3RHLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsTUFBTSxHQUFHLENBQUMsSUFBSSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDO1lBQ3ZELElBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3JDLElBQUksQ0FBQyxnQkFBZ0IsRUFBRSxDQUFDO1NBQ3pCO0tBQ0Y7Ozs7O0lBRU8sWUFBWSxDQUFDLE9BQWU7UUFDbEMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLEVBQUU7WUFDMUIsRUFBRSxDQUFDLENBQUMsS0FBSyxDQUFDLEVBQUUsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDO2dCQUN6QixLQUFLLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQzthQUN0QjtTQUNGLENBQUMsQ0FBQzs7Ozs7SUFHRyxnQkFBZ0I7UUFDdEIsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLEtBQUssQ0FBQyxNQUFNLElBQUksQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFDOzs7O1lBNUd4RyxTQUFTLFNBQUM7Z0JBQ1QsUUFBUSxFQUFFLGVBQWU7Z0JBQ3pCLFFBQVEsRUFBRSxjQUFjO2dCQUN4QixJQUFJLEVBQUUsRUFBQyxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsNkJBQTZCLEVBQUUsbUJBQW1CLEVBQUM7Z0JBQ25HLFFBQVEsRUFBRTs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CVDthQUNGOzs7O1lBdkhPLGtCQUFrQjs7O3FCQXlIdkIsZUFBZSxTQUFDLFFBQVE7d0JBS3hCLEtBQUs7K0JBS0wsS0FBSyxTQUFDLGFBQWE7NEJBS25CLEtBQUs7bUJBT0wsS0FBSzswQkFLTCxNQUFNIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtcbiAgQWZ0ZXJDb250ZW50Q2hlY2tlZCxcbiAgQ29tcG9uZW50LFxuICBDb250ZW50Q2hpbGRyZW4sXG4gIERpcmVjdGl2ZSxcbiAgRXZlbnRFbWl0dGVyLFxuICBJbnB1dCxcbiAgT3V0cHV0LFxuICBRdWVyeUxpc3QsXG4gIFRlbXBsYXRlUmVmXG59IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5pbXBvcnQge2lzU3RyaW5nfSBmcm9tICcuLi91dGlsL3V0aWwnO1xuXG5pbXBvcnQge05nYkFjY29yZGlvbkNvbmZpZ30gZnJvbSAnLi9hY2NvcmRpb24tY29uZmlnJztcblxubGV0IG5leHRJZCA9IDA7XG5cbi8qKlxuICogVGhpcyBkaXJlY3RpdmUgc2hvdWxkIGJlIHVzZWQgdG8gd3JhcCBhY2NvcmRpb24gcGFuZWwgdGl0bGVzIHRoYXQgbmVlZCB0byBjb250YWluIEhUTUwgbWFya3VwIG9yIG90aGVyIGRpcmVjdGl2ZXMuXG4gKi9cbkBEaXJlY3RpdmUoe3NlbGVjdG9yOiAnbmctdGVtcGxhdGVbbmdiUGFuZWxUaXRsZV0nfSlcbmV4cG9ydCBjbGFzcyBOZ2JQYW5lbFRpdGxlIHtcbiAgY29uc3RydWN0b3IocHVibGljIHRlbXBsYXRlUmVmOiBUZW1wbGF0ZVJlZjxhbnk+KSB7fVxufVxuXG4vKipcbiAqIFRoaXMgZGlyZWN0aXZlIG11c3QgYmUgdXNlZCB0byB3cmFwIGFjY29yZGlvbiBwYW5lbCBjb250ZW50LlxuICovXG5ARGlyZWN0aXZlKHtzZWxlY3RvcjogJ25nLXRlbXBsYXRlW25nYlBhbmVsQ29udGVudF0nfSlcbmV4cG9ydCBjbGFzcyBOZ2JQYW5lbENvbnRlbnQge1xuICBjb25zdHJ1Y3RvcihwdWJsaWMgdGVtcGxhdGVSZWY6IFRlbXBsYXRlUmVmPGFueT4pIHt9XG59XG5cbi8qKlxuICogVGhlIE5nYlBhbmVsIGRpcmVjdGl2ZSByZXByZXNlbnRzIGFuIGluZGl2aWR1YWwgcGFuZWwgd2l0aCB0aGUgdGl0bGUgYW5kIGNvbGxhcHNpYmxlXG4gKiBjb250ZW50XG4gKi9cbkBEaXJlY3RpdmUoe3NlbGVjdG9yOiAnbmdiLXBhbmVsJ30pXG5leHBvcnQgY2xhc3MgTmdiUGFuZWwgaW1wbGVtZW50cyBBZnRlckNvbnRlbnRDaGVja2VkIHtcbiAgLyoqXG4gICAqICBBIGZsYWcgZGV0ZXJtaW5pbmcgd2hldGhlciB0aGUgcGFuZWwgaXMgZGlzYWJsZWQgb3Igbm90LlxuICAgKiAgV2hlbiBkaXNhYmxlZCwgdGhlIHBhbmVsIGNhbm5vdCBiZSB0b2dnbGVkLlxuICAgKi9cbiAgQElucHV0KCkgZGlzYWJsZWQgPSBmYWxzZTtcblxuICAvKipcbiAgICogIEFuIG9wdGlvbmFsIGlkIGZvciB0aGUgcGFuZWwuIFRoZSBpZCBzaG91bGQgYmUgdW5pcXVlLlxuICAgKiAgSWYgbm90IHByb3ZpZGVkLCBpdCB3aWxsIGJlIGF1dG8tZ2VuZXJhdGVkLlxuICAgKi9cbiAgQElucHV0KCkgaWQgPSBgbmdiLXBhbmVsLSR7bmV4dElkKyt9YDtcblxuICAvKipcbiAgICogQSBmbGFnIHRlbGxpbmcgaWYgdGhlIHBhbmVsIGlzIGN1cnJlbnRseSBvcGVuXG4gICAqL1xuICBpc09wZW4gPSBmYWxzZTtcblxuICAvKipcbiAgICogIFRoZSB0aXRsZSBmb3IgdGhlIHBhbmVsLlxuICAgKi9cbiAgQElucHV0KCkgdGl0bGU6IHN0cmluZztcblxuICAvKipcbiAgICogIEFjY29yZGlvbidzIHR5cGVzIG9mIHBhbmVscyB0byBiZSBhcHBsaWVkIHBlciBwYW5lbCBiYXNpcy5cbiAgICogIEJvb3RzdHJhcCByZWNvZ25pemVzIHRoZSBmb2xsb3dpbmcgdHlwZXM6IFwicHJpbWFyeVwiLCBcInNlY29uZGFyeVwiLCBcInN1Y2Nlc3NcIiwgXCJkYW5nZXJcIiwgXCJ3YXJuaW5nXCIsIFwiaW5mb1wiLCBcImxpZ2h0XCJcbiAgICogYW5kIFwiZGFya1wiXG4gICAqL1xuICBASW5wdXQoKSB0eXBlOiBzdHJpbmc7XG5cbiAgdGl0bGVUcGw6IE5nYlBhbmVsVGl0bGUgfCBudWxsO1xuICBjb250ZW50VHBsOiBOZ2JQYW5lbENvbnRlbnQgfCBudWxsO1xuXG4gIEBDb250ZW50Q2hpbGRyZW4oTmdiUGFuZWxUaXRsZSwge2Rlc2NlbmRhbnRzOiBmYWxzZX0pIHRpdGxlVHBsczogUXVlcnlMaXN0PE5nYlBhbmVsVGl0bGU+O1xuICBAQ29udGVudENoaWxkcmVuKE5nYlBhbmVsQ29udGVudCwge2Rlc2NlbmRhbnRzOiBmYWxzZX0pIGNvbnRlbnRUcGxzOiBRdWVyeUxpc3Q8TmdiUGFuZWxDb250ZW50PjtcblxuICBuZ0FmdGVyQ29udGVudENoZWNrZWQoKSB7XG4gICAgLy8gV2UgYXJlIHVzaW5nIEBDb250ZW50Q2hpbGRyZW4gaW5zdGVhZCBvZiBAQ29udGFudENoaWxkIGFzIGluIHRoZSBBbmd1bGFyIHZlcnNpb24gYmVpbmcgdXNlZFxuICAgIC8vIG9ubHkgQENvbnRlbnRDaGlsZHJlbiBhbGxvd3MgdXMgdG8gc3BlY2lmeSB0aGUge2Rlc2NlbmRhbnRzOiBmYWxzZX0gb3B0aW9uLlxuICAgIC8vIFdpdGhvdXQge2Rlc2NlbmRhbnRzOiBmYWxzZX0gd2UgYXJlIGhpdHRpbmcgYnVncyBkZXNjcmliZWQgaW46XG4gICAgLy8gaHR0cHM6Ly9naXRodWIuY29tL25nLWJvb3RzdHJhcC9uZy1ib290c3RyYXAvaXNzdWVzLzIyNDBcbiAgICB0aGlzLnRpdGxlVHBsID0gdGhpcy50aXRsZVRwbHMuZmlyc3Q7XG4gICAgdGhpcy5jb250ZW50VHBsID0gdGhpcy5jb250ZW50VHBscy5maXJzdDtcbiAgfVxufVxuXG4vKipcbiAqIFRoZSBwYXlsb2FkIG9mIHRoZSBjaGFuZ2UgZXZlbnQgZmlyZWQgcmlnaHQgYmVmb3JlIHRvZ2dsaW5nIGFuIGFjY29yZGlvbiBwYW5lbFxuICovXG5leHBvcnQgaW50ZXJmYWNlIE5nYlBhbmVsQ2hhbmdlRXZlbnQge1xuICAvKipcbiAgICogSWQgb2YgdGhlIGFjY29yZGlvbiBwYW5lbCB0aGF0IGlzIHRvZ2dsZWRcbiAgICovXG4gIHBhbmVsSWQ6IHN0cmluZztcblxuICAvKipcbiAgICogV2hldGhlciB0aGUgcGFuZWwgd2lsbCBiZSBvcGVuZWQgKHRydWUpIG9yIGNsb3NlZCAoZmFsc2UpXG4gICAqL1xuICBuZXh0U3RhdGU6IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIEZ1bmN0aW9uIHRoYXQgd2lsbCBwcmV2ZW50IHBhbmVsIHRvZ2dsaW5nIGlmIGNhbGxlZFxuICAgKi9cbiAgcHJldmVudERlZmF1bHQ6ICgpID0+IHZvaWQ7XG59XG5cbi8qKlxuICogVGhlIE5nYkFjY29yZGlvbiBkaXJlY3RpdmUgaXMgYSBjb2xsZWN0aW9uIG9mIHBhbmVscy5cbiAqIEl0IGNhbiBhc3N1cmUgdGhhdCBvbmx5IG9uZSBwYW5lbCBjYW4gYmUgb3BlbmVkIGF0IGEgdGltZS5cbiAqL1xuQENvbXBvbmVudCh7XG4gIHNlbGVjdG9yOiAnbmdiLWFjY29yZGlvbicsXG4gIGV4cG9ydEFzOiAnbmdiQWNjb3JkaW9uJyxcbiAgaG9zdDogeydjbGFzcyc6ICdhY2NvcmRpb24nLCAncm9sZSc6ICd0YWJsaXN0JywgJ1thdHRyLmFyaWEtbXVsdGlzZWxlY3RhYmxlXSc6ICchY2xvc2VPdGhlclBhbmVscyd9LFxuICB0ZW1wbGF0ZTogYFxuICAgIDxuZy10ZW1wbGF0ZSBuZ0ZvciBsZXQtcGFuZWwgW25nRm9yT2ZdPVwicGFuZWxzXCI+XG4gICAgICA8ZGl2IGNsYXNzPVwiY2FyZFwiPlxuICAgICAgICA8ZGl2IHJvbGU9XCJ0YWJcIiBpZD1cInt7cGFuZWwuaWR9fS1oZWFkZXJcIiBbY2xhc3NdPVwiJ2NhcmQtaGVhZGVyICcgKyAocGFuZWwudHlwZSA/ICdiZy0nK3BhbmVsLnR5cGU6IHR5cGUgPyAnYmctJyt0eXBlIDogJycpXCI+XG4gICAgICAgICAgPGg1IGNsYXNzPVwibWItMFwiPlxuICAgICAgICAgICAgPGJ1dHRvbiBjbGFzcz1cImJ0biBidG4tbGlua1wiIChjbGljayk9XCIhIXRvZ2dsZShwYW5lbC5pZClcIiBbZGlzYWJsZWRdPVwicGFuZWwuZGlzYWJsZWRcIiBbY2xhc3MuY29sbGFwc2VkXT1cIiFwYW5lbC5pc09wZW5cIlxuICAgICAgICAgICAgICBbYXR0ci5hcmlhLWV4cGFuZGVkXT1cInBhbmVsLmlzT3BlblwiIFthdHRyLmFyaWEtY29udHJvbHNdPVwicGFuZWwuaWRcIj5cbiAgICAgICAgICAgICAge3twYW5lbC50aXRsZX19PG5nLXRlbXBsYXRlIFtuZ1RlbXBsYXRlT3V0bGV0XT1cInBhbmVsLnRpdGxlVHBsPy50ZW1wbGF0ZVJlZlwiPjwvbmctdGVtcGxhdGU+XG4gICAgICAgICAgICA8L2J1dHRvbj5cbiAgICAgICAgICA8L2g1PlxuICAgICAgICA8L2Rpdj5cbiAgICAgICAgPGRpdiBpZD1cInt7cGFuZWwuaWR9fVwiIHJvbGU9XCJ0YWJwYW5lbFwiIFthdHRyLmFyaWEtbGFiZWxsZWRieV09XCJwYW5lbC5pZCArICctaGVhZGVyJ1wiXG4gICAgICAgICAgICAgY2xhc3M9XCJjb2xsYXBzZVwiIFtjbGFzcy5zaG93XT1cInBhbmVsLmlzT3BlblwiICpuZ0lmPVwiIWRlc3Ryb3lPbkhpZGUgfHwgcGFuZWwuaXNPcGVuXCI+XG4gICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmQtYm9keVwiPlxuICAgICAgICAgICAgICAgPG5nLXRlbXBsYXRlIFtuZ1RlbXBsYXRlT3V0bGV0XT1cInBhbmVsLmNvbnRlbnRUcGw/LnRlbXBsYXRlUmVmXCI+PC9uZy10ZW1wbGF0ZT5cbiAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgPC9kaXY+XG4gICAgICA8L2Rpdj5cbiAgICA8L25nLXRlbXBsYXRlPlxuICBgXG59KVxuZXhwb3J0IGNsYXNzIE5nYkFjY29yZGlvbiBpbXBsZW1lbnRzIEFmdGVyQ29udGVudENoZWNrZWQge1xuICBAQ29udGVudENoaWxkcmVuKE5nYlBhbmVsKSBwYW5lbHM6IFF1ZXJ5TGlzdDxOZ2JQYW5lbD47XG5cbiAgLyoqXG4gICAqIEFuIGFycmF5IG9yIGNvbW1hIHNlcGFyYXRlZCBzdHJpbmdzIG9mIHBhbmVsIGlkZW50aWZpZXJzIHRoYXQgc2hvdWxkIGJlIG9wZW5lZFxuICAgKi9cbiAgQElucHV0KCkgYWN0aXZlSWRzOiBzdHJpbmcgfCBzdHJpbmdbXSA9IFtdO1xuXG4gIC8qKlxuICAgKiAgV2hldGhlciB0aGUgb3RoZXIgcGFuZWxzIHNob3VsZCBiZSBjbG9zZWQgd2hlbiBhIHBhbmVsIGlzIG9wZW5lZFxuICAgKi9cbiAgQElucHV0KCdjbG9zZU90aGVycycpIGNsb3NlT3RoZXJQYW5lbHM6IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIFdoZXRoZXIgdGhlIGNsb3NlZCBwYW5lbHMgc2hvdWxkIGJlIGhpZGRlbiB3aXRob3V0IGRlc3Ryb3lpbmcgdGhlbVxuICAgKi9cbiAgQElucHV0KCkgZGVzdHJveU9uSGlkZSA9IHRydWU7XG5cbiAgLyoqXG4gICAqICBBY2NvcmRpb24ncyB0eXBlcyBvZiBwYW5lbHMgdG8gYmUgYXBwbGllZCBnbG9iYWxseS5cbiAgICogIEJvb3RzdHJhcCByZWNvZ25pemVzIHRoZSBmb2xsb3dpbmcgdHlwZXM6IFwicHJpbWFyeVwiLCBcInNlY29uZGFyeVwiLCBcInN1Y2Nlc3NcIiwgXCJkYW5nZXJcIiwgXCJ3YXJuaW5nXCIsIFwiaW5mb1wiLCBcImxpZ2h0XCJcbiAgICogYW5kIFwiZGFya1xuICAgKi9cbiAgQElucHV0KCkgdHlwZTogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBBIHBhbmVsIGNoYW5nZSBldmVudCBmaXJlZCByaWdodCBiZWZvcmUgdGhlIHBhbmVsIHRvZ2dsZSBoYXBwZW5zLiBTZWUgTmdiUGFuZWxDaGFuZ2VFdmVudCBmb3IgcGF5bG9hZCBkZXRhaWxzXG4gICAqL1xuICBAT3V0cHV0KCkgcGFuZWxDaGFuZ2UgPSBuZXcgRXZlbnRFbWl0dGVyPE5nYlBhbmVsQ2hhbmdlRXZlbnQ+KCk7XG5cbiAgY29uc3RydWN0b3IoY29uZmlnOiBOZ2JBY2NvcmRpb25Db25maWcpIHtcbiAgICB0aGlzLnR5cGUgPSBjb25maWcudHlwZTtcbiAgICB0aGlzLmNsb3NlT3RoZXJQYW5lbHMgPSBjb25maWcuY2xvc2VPdGhlcnM7XG4gIH1cblxuICAvKipcbiAgICogUHJvZ3JhbW1hdGljYWxseSB0b2dnbGUgYSBwYW5lbCB3aXRoIGEgZ2l2ZW4gaWQuXG4gICAqL1xuICB0b2dnbGUocGFuZWxJZDogc3RyaW5nKSB7XG4gICAgY29uc3QgcGFuZWwgPSB0aGlzLnBhbmVscy5maW5kKHAgPT4gcC5pZCA9PT0gcGFuZWxJZCk7XG5cbiAgICBpZiAocGFuZWwgJiYgIXBhbmVsLmRpc2FibGVkKSB7XG4gICAgICBsZXQgZGVmYXVsdFByZXZlbnRlZCA9IGZhbHNlO1xuXG4gICAgICB0aGlzLnBhbmVsQ2hhbmdlLmVtaXQoXG4gICAgICAgICAge3BhbmVsSWQ6IHBhbmVsSWQsIG5leHRTdGF0ZTogIXBhbmVsLmlzT3BlbiwgcHJldmVudERlZmF1bHQ6ICgpID0+IHsgZGVmYXVsdFByZXZlbnRlZCA9IHRydWU7IH19KTtcblxuICAgICAgaWYgKCFkZWZhdWx0UHJldmVudGVkKSB7XG4gICAgICAgIHBhbmVsLmlzT3BlbiA9ICFwYW5lbC5pc09wZW47XG5cbiAgICAgICAgaWYgKHRoaXMuY2xvc2VPdGhlclBhbmVscykge1xuICAgICAgICAgIHRoaXMuX2Nsb3NlT3RoZXJzKHBhbmVsSWQpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX3VwZGF0ZUFjdGl2ZUlkcygpO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIG5nQWZ0ZXJDb250ZW50Q2hlY2tlZCgpIHtcbiAgICAvLyBhY3RpdmUgaWQgdXBkYXRlc1xuICAgIGlmIChpc1N0cmluZyh0aGlzLmFjdGl2ZUlkcykpIHtcbiAgICAgIHRoaXMuYWN0aXZlSWRzID0gdGhpcy5hY3RpdmVJZHMuc3BsaXQoL1xccyosXFxzKi8pO1xuICAgIH1cblxuICAgIC8vIHVwZGF0ZSBwYW5lbHMgb3BlbiBzdGF0ZXNcbiAgICB0aGlzLnBhbmVscy5mb3JFYWNoKHBhbmVsID0+IHBhbmVsLmlzT3BlbiA9ICFwYW5lbC5kaXNhYmxlZCAmJiB0aGlzLmFjdGl2ZUlkcy5pbmRleE9mKHBhbmVsLmlkKSA+IC0xKTtcblxuICAgIC8vIGNsb3NlT3RoZXJzIHVwZGF0ZXNcbiAgICBpZiAodGhpcy5hY3RpdmVJZHMubGVuZ3RoID4gMSAmJiB0aGlzLmNsb3NlT3RoZXJQYW5lbHMpIHtcbiAgICAgIHRoaXMuX2Nsb3NlT3RoZXJzKHRoaXMuYWN0aXZlSWRzWzBdKTtcbiAgICAgIHRoaXMuX3VwZGF0ZUFjdGl2ZUlkcygpO1xuICAgIH1cbiAgfVxuXG4gIHByaXZhdGUgX2Nsb3NlT3RoZXJzKHBhbmVsSWQ6IHN0cmluZykge1xuICAgIHRoaXMucGFuZWxzLmZvckVhY2gocGFuZWwgPT4ge1xuICAgICAgaWYgKHBhbmVsLmlkICE9PSBwYW5lbElkKSB7XG4gICAgICAgIHBhbmVsLmlzT3BlbiA9IGZhbHNlO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG5cbiAgcHJpdmF0ZSBfdXBkYXRlQWN0aXZlSWRzKCkge1xuICAgIHRoaXMuYWN0aXZlSWRzID0gdGhpcy5wYW5lbHMuZmlsdGVyKHBhbmVsID0+IHBhbmVsLmlzT3BlbiAmJiAhcGFuZWwuZGlzYWJsZWQpLm1hcChwYW5lbCA9PiBwYW5lbC5pZCk7XG4gIH1cbn1cbiJdfQ==
75.358306
13,394
0.82399
6a194b5efd752e8eaecb4b0a021b28ee49a6971a
833
js
JavaScript
packages/framework/src/Resources/scripts/admin/validation/form/freeTransportAndPayment.js
machicek/shopsys
bd0ccc5acafbfa7b16ba3a24303480fd3c09269f
[ "PostgreSQL" ]
1
2019-04-08T12:22:41.000Z
2019-04-08T12:22:41.000Z
packages/framework/src/Resources/scripts/admin/validation/form/freeTransportAndPayment.js
machicek/shopsys
bd0ccc5acafbfa7b16ba3a24303480fd3c09269f
[ "PostgreSQL" ]
87
2019-11-20T00:42:17.000Z
2022-03-26T23:58:06.000Z
packages/framework/src/Resources/scripts/admin/validation/form/freeTransportAndPayment.js
machicek/shopsys
bd0ccc5acafbfa7b16ba3a24303480fd3c09269f
[ "PostgreSQL" ]
1
2018-12-20T09:01:27.000Z
2018-12-20T09:01:27.000Z
(function ($) { $(document).ready(function () { $('.js-free-transport-and-payment-price-limit').each(function () { var $priceLimitForm = $(this); $priceLimitForm.jsFormValidator({ 'groups': function () { var groups = [Shopsys.constant('\\Shopsys\\FrameworkBundle\\Form\\ValidationGroup::VALIDATION_GROUP_DEFAULT')]; if ($priceLimitForm.find('.js-free-transport-and-payment-price-limit-enabled').is(':checked')) { groups.push(Shopsys.constant('\\Shopsys\\FrameworkBundle\\Form\\Admin\\TransportAndPayment\\FreeTransportAndPaymentPriceLimitsFormType::VALIDATION_GROUP_PRICE_LIMIT_ENABLED')); } return groups; } }); }); }); })(jQuery);
39.666667
200
0.565426
6a194cf5e69392af5c09401c724493f635d553cf
1,178
js
JavaScript
public/js/checkUser.js
perriea/SCC-SII-Assurance
80c79a1ddbc58a5aed2132171939b31459318da3
[ "MIT" ]
1
2021-07-06T23:29:17.000Z
2021-07-06T23:29:17.000Z
public/js/checkUser.js
perriea/SCC-SII-Assurance
80c79a1ddbc58a5aed2132171939b31459318da3
[ "MIT" ]
null
null
null
public/js/checkUser.js
perriea/SCC-SII-Assurance
80c79a1ddbc58a5aed2132171939b31459318da3
[ "MIT" ]
null
null
null
/** * Created by loquet_j on 16/02/2017. */ $(document).ready(function () { var rq = $.ajax({ url: '/isLog', method: 'GET' }); rq.success(function (result) { console.log(result.error); if (!result.error) { $("li#in").hide(); $("li#registration").hide(); $("li#out").show(); $("li#train").show(); $("li#profile").show(); } else { $("li#in").show(); $("li#registration").show(); $("li#out").hide(); $("li#train").hide(); $("li#profile").hide(); } }); rq.error(function (jqXHR) { $("li#in").show(); $("li#registration").show(); $("li#out").hide(); $("li#train").hide(); $("li#profile").hide(); }); $('#outLink').on('click', function () { console.log('#outLink'); var rq = $.ajax({ url: '/api/auth/logout', method: 'GET' }); rq.success(function () { location.href = '/'; }); rq.error(function (jqXHR) { console.log(jqXHR); }); }); });
25.06383
43
0.398132
6a19c966fe9d150e1b82163d652e680611840085
5,761
js
JavaScript
components/mip-custom/novel-feature.js
tancygithun/mip2-extensions
89c78f71fab85079f511a3ba250056e38c6f0f9b
[ "MIT" ]
28
2018-05-31T06:52:07.000Z
2021-03-15T11:50:46.000Z
components/mip-custom/novel-feature.js
tancygithun/mip2-extensions
89c78f71fab85079f511a3ba250056e38c6f0f9b
[ "MIT" ]
667
2018-05-29T09:22:51.000Z
2020-08-03T09:07:27.000Z
components/mip-custom/novel-feature.js
tancygithun/mip2-extensions
89c78f71fab85079f511a3ba250056e38c6f0f9b
[ "MIT" ]
118
2018-06-02T14:52:53.000Z
2020-11-25T05:04:18.000Z
/** * @file 搜索合作页小说特性 novel-feature * @author liujing chenyongle * */ const {util} = MIP let globalCustomElementInstance let initElement /** * 获取当前定制化页面的 window * * @returns {window} 当前 iframe 的 window */ function getCurrentWindow () { let pageId = window.MIP.viewer.page.currentPageId || '' let pageInfo = window.MIP.viewer.page.getPageById(pageId) return pageInfo.targetWindow } /** * 获取当前定制化页面的 root window * * @returns {window} 当前 iframe 的 root window */ function getRootWindow () { let win = getCurrentWindow() return win.MIP.viewer.page.isRootPage ? win : win.parent } /** * 根据当前 window 获取小说实例 * * @param {window} win 当前 window * @returns {Object} 小说实例 */ function getNovelInstance (win) { return win.MIP.viewer.page.isRootPage ? win.MIP.novelInstance : win.parent.MIP.novelInstance } /** * showAdvertising 事件处理 * * @param {Event} e event */ function handler (e) { let me = globalCustomElementInstance let detailData = (e && e.detail && e.detail[0]) || {} let win = getCurrentWindow() let novelInstance = getNovelInstance(win) let adsCache = novelInstance.adsCache || {} me.customId = detailData.customId me.novelData = detailData.novelData if (detailData.fromSearch) { me.fromSearch = detailData.fromSearch } if (me.customId === win.MIP.viewer.page.currentPageId && me.element.querySelector('.mip-custom-placeholder')) { win.MIP.setCommonFetch = true initElement.apply(me) win.removeEventListener('showAdvertising', handler) } if (me.customId === win.MIP.viewer.page.currentPageId && adsCache.ignoreSendLog) { initElement.apply(me) } } /** * 监听小说 shell 的事件,进行相应的处理,再调回调进行渲染 * * @param {Function} cb 回调函数 */ function addNovelListener (cb) { let me = this let win = getCurrentWindow() globalCustomElementInstance = this initElement = cb win.addEventListener('ignoreSendLogFetch', e => { let detailData = (e && e.detail && e.detail[0]) || {} me.customId = detailData.customId me.novelData = detailData.novelData initElement.apply(me) }) // 监听小说shell播放的广告请求的事件 win.addEventListener('showAdvertising', handler) // 当小说shell优先加载时——向小说shell发送custom已经ready的状态以方便后续事件的执行 let shellWindow = getRootWindow() // 定制化再加确认事件事件防止 win.addEventListener('customReadyConfirm', function () { win.MIP.viewer.page.emitCustomEvent(shellWindow, false, { name: 'customReady', data: { customPageId: win.MIP.viewer.page.currentPageId } }) }) win.MIP.viewer.page.emitCustomEvent(shellWindow, false, { name: 'customReady', data: { customPageId: win.MIP.viewer.page.currentPageId } }) } /** * 添加小说需要的特殊参数 * * @param {string} urlParam url * @param {Object} novelData 小说传给 server 的参数 * @param {string} fromSearch 小说需要的参数 * @returns {string} 增加参数后的 url */ function addNovelData (urlParam, novelData, fromSearch) { let url = urlParam if (novelData) { url = url + '&novelData=' + encodeURIComponent(JSON.stringify(novelData)) } if (fromSearch) { url = url + '&fromSearch=' + fromSearch } return url } /** * 根据 common 请求返回的数据,进行处理,然后 resolve 成 mip-custom 可以渲染的数据 * * @param {Object} data common 请求返回的数据 * @param {Promise.resolve} resolve Promise 的 resolve */ function renderWithNovelData (data, resolve) { let win = getCurrentWindow() let shellWindow = getRootWindow() let novelInstance = getNovelInstance(win) let adsCache = novelInstance.adsCache || {} let rendered = false if (JSON.stringify(adsCache) === '{}') { data.data.adTime = +new Date() win.addEventListener('showAdStrategyCache', e => { let adData = (e && e.detail && e.detail[0]) || {} // 模板的前端渲染 rendered = true resolve && resolve(adData) }) win.MIP.viewer.page.emitCustomEvent(shellWindow, false, { name: 'adDataReady', data: { pageId: win.MIP.viewer.page.currentPageId, adData: data.data } }) } // 将各种情况统一,这里需谨慎 if ((!rendered && adsCache.directRender != null && !adsCache.ignoreSendLog) || (!rendered && adsCache.noAdsRender != null && adsCache.noAdsRender) ) { renderWithNoCache(data, resolve) } } /** * 给 renderCacheDataByTpl 套一层事件,让 mip-custom 等待小说的 nocache 返回的数据 * * @param {Object} data common 返回数据 * @param {Promise.resolve} resolve promise */ function renderWithNoCache (data, resolve) { let win = getCurrentWindow() let shellWindow = getRootWindow() // 自测的时候发现不知道为啥会调用多次 let once = true win.addEventListener('addNoCacheAds', function () { once && (renderCacheDataByTpl(data, resolve)) once = false }) win.MIP.viewer.page.emitCustomEvent(shellWindow, false, { name: 'noCacheAdDataReady', data: { pageId: win.MIP.viewer.page.currentPageId, adData: data.data } }) } /** * 获取当前定制化页面的window——小说垂类 * * @param {Object} data fetch返回的数据 * @param {Promise.resolve} resolve promise */ function renderCacheDataByTpl (data, resolve) { let currentWindow = getCurrentWindow() let novelInstance = getNovelInstance(currentWindow) let adsCache = novelInstance.adsCache || {} let novelAds = (adsCache.adStrategyCacheData && adsCache.adStrategyCacheData.template) || [] // 对小说传入的广告数据中的template进行遍历,把请求回来的tpl拼入 if (novelAds) { novelAds.map(value => { // 由于template的结构是数组嵌套数组 if (Array.isArray(value)) { value.map(ad => { if (ad.tpl == null && data.data.template[ad.tplName]) { ad.tpl = data.data.template[ad.tplName] } }) } }) util.fn.extend(adsCache.fetchedData.adData.template, data.data.template) } resolve && resolve(adsCache.adStrategyCacheData) } export default { addNovelListener, addNovelData, renderWithNovelData }
25.71875
94
0.675404
6a19ca3f7bf994ad54f1950839d5f2d45211c357
1,303
js
JavaScript
node_modules/async/applyEachSeries.js
ai-man-123/MDyoobotz
ed54a8cacdf93710cb248237444052dab908b1c4
[ "MIT" ]
6
2022-03-29T13:20:23.000Z
2022-03-31T17:30:03.000Z
node_modules/async/applyEachSeries.js
ai-man-123/MDyoobotz
ed54a8cacdf93710cb248237444052dab908b1c4
[ "MIT" ]
35
2022-02-05T00:45:20.000Z
2022-03-31T05:36:20.000Z
node_modules/async/applyEachSeries.js
ai-man-123/MDyoobotz
ed54a8cacdf93710cb248237444052dab908b1c4
[ "MIT" ]
19
2022-03-29T11:44:06.000Z
2022-03-31T17:29:52.000Z
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _applyEach = require('./internal/applyEach.js'); var _applyEach2 = _interopRequireDefault(_applyEach); var _mapSeries = require('./mapSeries.js'); var _mapSeries2 = _interopRequireDefault(_mapSeries); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. * * @name applyEachSeries * @static * @memberOf module:ControlFlow * @method * @see [async.applyEach]{@link module:ControlFlow.applyEach} * @category Control Flow * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all * call with the same arguments * @param {...*} [args] - any number of separate arguments to pass to the * function. * @param {Function} [callback] - the final argument should be the callback, * called when all functions have completed processing. * @returns {AsyncFunction} - A function, that when called, is the result of * appling the `args` to the list of functions. It takes no args, other than * a callback. */ exports.default = (0, _applyEach2.default)(_mapSeries2.default); module.exports = exports['default'];
35.216216
114
0.729087
6a1a4424a4c9fc1ddd9a839d89d3ed95f2656408
3,506
js
JavaScript
src/services/patientService.js
lf-achyutpkl/patient-info-api
66a7e51a15fec5c922d76f7a834815a51a8b0593
[ "MIT" ]
null
null
null
src/services/patientService.js
lf-achyutpkl/patient-info-api
66a7e51a15fec5c922d76f7a834815a51a8b0593
[ "MIT" ]
null
null
null
src/services/patientService.js
lf-achyutpkl/patient-info-api
66a7e51a15fec5c922d76f7a834815a51a8b0593
[ "MIT" ]
null
null
null
import Patient from '../models/patient'; import Annotation from '../models/annotation'; import Tags from '../models/tags'; import AnnotationTags from '../models/annotationsTags'; import AnnotationBatches from '../models/annotationsBatches'; import Batches from '../models/batches'; import fs from 'fs'; import queue from 'async/queue'; export function createPatient(patient) { let annotations = patient.annotations; return new Patient({ firstName: patient.firstName, lastName: patient.lastName, gender: patient.gender, age: patient.age, address: patient.address }) .save() .then(patient => { patient.refresh(); for (let i = 0; i < annotations.length; i++) { new Annotation({ patientId: patient.id, imageName: annotations[i].imageName, annotationInfo: annotations[i].annotationInfo }) .save() .then(annotation => { annotation.refresh(); patient.images.push(annotation); }); } return patient; }); } export function getAllPatients(queryParams) { return Patient.fetchPage({ pageSize: queryParams.pageSize, page: queryParams.page, withRelated: ['annotations'] }); } /** * { * tags: [], * annotations: [ * { * imageName: ..., * annotationInfo: ..., * fileInfo: {originalName: 54_right.png} * } * ] * } * */ export async function saveBatchUpload() { // return; // REMOVE THIS, only to aviod accidently uploading file let files = []; let batchLimit = 350; let count = 0; let q = queue(async (file, cb) => { let [dummyPatientName, tag] = file.split('_'); tag = tag.split('.')[0]; let patient = await new Patient({ firstName: dummyPatientName }).fetch(); if (!patient) { patient = await new Patient({ firstName: dummyPatientName.trim(), lastName: dummyPatientName, gender: 'female' }) .save() .then(patient => { patient.refresh(); return patient; }); } let tagObj = await new Tags({ tagName: tag }).fetch(); if (!tagObj) { tagObj = await new Tags({ tagName: tag.trim() }) .save() .then(tag => { tag.refresh(); return tag; }); } let batchName = 'Kaggle Batch - ' + Math.ceil((count + 1) / batchLimit); let batchesObj = await new Batches({ batchName: batchName.trim() }).fetch(); if (!batchesObj) { batchesObj = await new Batches({ batchName: batchName, isCompleted: false }) .save() .then(branch => { branch.refresh(); return branch; }); } let annotation = await new Annotation({ patientId: patient.id, imageName: file, remarks: tag }) .save() .then(annotation => { annotation.refresh(); return annotation; }); await new AnnotationTags({ tagId: tagObj.id, annotationId: annotation.id }).save(); await new AnnotationBatches({ batchId: batchesObj.id, annotationId: annotation.id }).save(); // console.log('finished processing ', file); count++; cb(); }, 1); fs.readdirSync('./uploads').forEach(file => { if (file.includes('_')) { files.push(file); } }); q.push(files); q.drain = function() { // console.log('all images uploaded'); }; return; }
22.189873
80
0.563035
6a1ab51e833de48d42558e8bb540b836f3a5fea2
1,781
js
JavaScript
Docs/node_modules/@styled-icons/fa-solid/CarAlt/CarAlt.js
moonreporter/GodSaveTheLPs
fbcc024ea03ccadce625a902d1e56d4f0468e5c5
[ "MIT" ]
2
2021-10-17T02:32:38.000Z
2022-01-20T20:04:16.000Z
Docs/node_modules/@styled-icons/fa-solid/CarAlt/CarAlt.js
moonreporter/GodSaveTheLPs
fbcc024ea03ccadce625a902d1e56d4f0468e5c5
[ "MIT" ]
1
2021-10-06T13:02:21.000Z
2021-10-06T13:02:21.000Z
Docs/node_modules/@styled-icons/fa-solid/CarAlt/CarAlt.js
moonreporter/GodSaveTheLPs
fbcc024ea03ccadce625a902d1e56d4f0468e5c5
[ "MIT" ]
3
2021-10-06T13:00:51.000Z
2021-10-17T06:38:40.000Z
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.CarAltDimensions = exports.CarAlt = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var React = _interopRequireWildcard(require("react")); var _styledIcon = require("@styled-icons/styled-icon"); var CarAlt = /*#__PURE__*/React.forwardRef(function (props, ref) { var attrs = { "fill": "currentColor", "xmlns": "http://www.w3.org/2000/svg" }; return /*#__PURE__*/React.createElement(_styledIcon.StyledIconBase, (0, _extends2.default)({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 480 512" }, props, { ref: ref }), /*#__PURE__*/React.createElement("path", { fill: "currentColor", d: "m438.66 212.33-11.24-28.1-19.93-49.83C390.38 91.63 349.57 64 303.5 64h-127c-46.06 0-86.88 27.63-103.99 70.4l-19.93 49.83-11.24 28.1C17.22 221.5 0 244.66 0 272v48c0 16.12 6.16 30.67 16 41.93V416c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32v-32h256v32c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32v-54.07c9.84-11.25 16-25.8 16-41.93v-48c0-27.34-17.22-50.5-41.34-59.67zm-306.73-54.16c7.29-18.22 24.94-30.17 44.57-30.17h127c19.63 0 37.28 11.95 44.57 30.17L368 208H112l19.93-49.83zM80 319.8c-19.2 0-32-12.76-32-31.9S60.8 256 80 256s48 28.71 48 47.85-28.8 15.95-48 15.95zm320 0c-19.2 0-48 3.19-48-15.95S380.8 256 400 256s32 12.76 32 31.9-12.8 31.9-32 31.9z" })); }); exports.CarAlt = CarAlt; CarAlt.displayName = 'CarAlt'; var CarAltDimensions = { height: 512, width: 480 }; exports.CarAltDimensions = CarAltDimensions;
44.525
666
0.708591
6a1af35ddf5e421fdcf55013b78bac9366b95b6f
586
js
JavaScript
spec/assertSnapshot.js
featurist/codesandbox-example-links
686e975ea96398ff3f8d597091a549447326b74d
[ "MIT" ]
14
2019-04-04T13:21:05.000Z
2020-04-27T18:55:33.000Z
spec/assertSnapshot.js
featurist/codesandbox-example-links
686e975ea96398ff3f8d597091a549447326b74d
[ "MIT" ]
5
2019-04-04T17:40:09.000Z
2022-02-12T06:55:22.000Z
spec/assertSnapshot.js
featurist/codesandbox-example-links
686e975ea96398ff3f8d597091a549447326b74d
[ "MIT" ]
2
2020-01-09T15:46:58.000Z
2020-09-27T06:42:00.000Z
const path = require('path') const fs = require('fs') const assert = require('assert').strict const snapshotsPath = path.join(__dirname, 'snapshots') module.exports = function assertSnapshot (name, actual) { const {name: base, ext} = path.parse(name) const actualPath = `${snapshotsPath}/${base}_actual${ext}` fs.writeFileSync(actualPath, actual) try { const expected = fs.readFileSync(`${snapshotsPath}/${base}_expected${ext}`, {encoding: 'utf-8'}) assert.equal(actual, expected) } catch (e) { console.info(`Generated actual: ${actualPath}`) throw e } }
29.3
100
0.6843
6a1af50374149e3bbfeebbf3eedcd8e3c053f538
816
js
JavaScript
src/ui/scripts/loaders/devicesLoader.js
shareworks/stats-microservice
ff82c09384ec09399a9586ee9574e48ce8432f70
[ "MIT" ]
3
2021-04-18T16:00:14.000Z
2021-04-19T04:06:03.000Z
src/ui/scripts/loaders/devicesLoader.js
shareworks/stats-microservice
ff82c09384ec09399a9586ee9574e48ce8432f70
[ "MIT" ]
17
2021-02-02T11:11:25.000Z
2022-03-29T04:07:21.000Z
src/ui/scripts/loaders/devicesLoader.js
shareworks/stats-microservice
ff82c09384ec09399a9586ee9574e48ce8432f70
[ "MIT" ]
null
null
null
import { createElement as h } from 'react' import RendererList from '../components/renderers/RendererList' import enhanceDevices from '../enhancers/enhanceDevices' import createWidgetId from '../utils/createWidgetId' export default (domainId, opts) => { const id = createWidgetId('fetchDevices', domainId, opts) const query = ` domain(id: "${ domainId }") { statistics { devices(sorting: ${ opts.sorting }, type: ${ opts.type }, range: ${ opts.range }) { id count created } } } ` const variables = { domainId, sorting: opts.sorting, type: opts.type, range: opts.range } const selector = (data, entryName = 'domain') => data[entryName].statistics.devices return { id, Renderer: RendererList, query, variables, selector, enhancer: enhanceDevices } }
19.902439
87
0.667892
6a1b376c950922bee78050eab6cc4f1ff281599b
275
js
JavaScript
lib/templates_helpers/at_message.js
cheesington/useraccounts-core
18a0cca02f431784ed2b6269990dbd8cbb87c1e0
[ "MIT" ]
null
null
null
lib/templates_helpers/at_message.js
cheesington/useraccounts-core
18a0cca02f431784ed2b6269990dbd8cbb87c1e0
[ "MIT" ]
null
null
null
lib/templates_helpers/at_message.js
cheesington/useraccounts-core
18a0cca02f431784ed2b6269990dbd8cbb87c1e0
[ "MIT" ]
2
2021-01-20T19:36:50.000Z
2021-04-15T11:02:15.000Z
var T9n = require('meteor-accounts-t9n').T9n; AT.prototype.atMessageHelpers = { message: function() { var messageText = AccountsTemplates.state.form.get("message"); if (messageText) return T9n.get(messageText, markIfMissing=false); }, };
27.5
70
0.650909
6a1b3a0f0b557da13b1b0ce7f7b4cfb5f6f969e2
216
js
JavaScript
packages/pro/src/colors.js
motific/mixxx-launchpad
420520404a40efe6261fdab1ca263167a03eec4f
[ "MIT" ]
12
2018-04-02T23:40:55.000Z
2022-02-04T19:45:26.000Z
packages/pro/src/colors.js
motific/mixxx-launchpad
420520404a40efe6261fdab1ca263167a03eec4f
[ "MIT" ]
43
2018-03-31T17:53:02.000Z
2022-03-04T17:32:03.000Z
packages/pro/src/colors.js
motific/mixxx-launchpad
420520404a40efe6261fdab1ca263167a03eec4f
[ "MIT" ]
3
2017-03-28T04:31:25.000Z
2018-03-10T20:03:01.000Z
/* @flow */ 'use strict' module.exports = { black: 0, lo_red: 7, hi_red: 5, lo_green: 19, hi_green: 17, lo_amber: 43, hi_amber: 41, hi_orange: 84, lo_orange: 61, hi_yellow: 13, lo_yellow: 15 }
12.705882
18
0.601852
6a1bbc77b1fc77eb3989339ba3b29543a44b74a7
141
js
JavaScript
client/app/modules/home/services.js
Epotignano/japan-demo-grunt
368818e104b95df06e141d8a0def43c7b607e3dd
[ "MIT" ]
null
null
null
client/app/modules/home/services.js
Epotignano/japan-demo-grunt
368818e104b95df06e141d8a0def43c7b607e3dd
[ "MIT" ]
null
null
null
client/app/modules/home/services.js
Epotignano/japan-demo-grunt
368818e104b95df06e141d8a0def43c7b607e3dd
[ "MIT" ]
null
null
null
'use strict'; var homeService = function($http, apiBaseUrl) { }; angular .module('homeModule') .service('homeService', homeService)
11.75
47
0.687943
6a1dbb03e316615a1abe0abad535afccb26660ad
886
js
JavaScript
app/routes/cancel.js
dwp/ms-ui-submission
986c969dc4e9e091972ffa64c3a35a93c12ac39e
[ "MIT" ]
null
null
null
app/routes/cancel.js
dwp/ms-ui-submission
986c969dc4e9e091972ffa64c3a35a93c12ac39e
[ "MIT" ]
8
2020-11-03T13:35:41.000Z
2022-03-24T12:46:02.000Z
app/routes/cancel.js
shehir12/ms-ui-submission
7bbbb39f23aced3c10b6092d8e58cdd54ca9f5a6
[ "MIT" ]
2
2020-10-15T12:41:35.000Z
2021-04-10T22:13:21.000Z
const Logger = require('../lib/Logger'); const { genericDataUtils } = require('../lib/data-utils'); const appLogger = Logger(); module.exports = (router, csrf) => { router.post('/cancel', csrf, (req, res) => { if (typeof req.session.editPage !== 'undefined' && typeof req.session[`${req.session.editSection}Gather`] !== 'undefined' && typeof req.session[`${req.session.editSection}Gather`][req.session.editIndex] !== 'undefined') { appLogger.info('Determine section from which to cancel'); genericDataUtils.cancelEdit(req); appLogger.info('Cancelled edit: redirecting to check-your-answers'); req.session.save(() => { res.status(302).redirect('/check-your-answers'); }); } else { appLogger.info('Cannot cancel edit: redirecting to next page'); res.status(302).redirect('/check-your-answers'); } }); };
38.521739
107
0.636569
6a1df960145489f9b3b12e98fbcc21cdaa2fc5e8
6,546
js
JavaScript
tests/en/level1.js
nicompte/edtfy
5158dc80022a30413843833629569879c66c7e8d
[ "MIT" ]
9
2015-07-20T09:34:38.000Z
2021-02-01T21:56:55.000Z
tests/en/level1.js
nicompte/edtfy
5158dc80022a30413843833629569879c66c7e8d
[ "MIT" ]
33
2015-07-30T11:50:21.000Z
2020-09-02T02:37:45.000Z
tests/en/level1.js
nicompte/edtfy
5158dc80022a30413843833629569879c66c7e8d
[ "MIT" ]
2
2016-06-30T08:53:04.000Z
2019-02-19T19:33:39.000Z
var should = require('chai').should(), edtfy = require('../../dist/edtfy'); describe('EN - Level 1', function () { beforeEach(function() { edtfy.locale('en'); }); describe('uncertain/approximate: the parser', function() { it('should parse year uncertain', function() { edtfy('1988?').should.equal('1988?'); }); it('should parse season uncertain', function() { edtfy('winter 1988?').should.equal('1988-24?'); edtfy('autumn 1988?').should.equal('1988-23?'); }); it('should parse month uncertain', function() { edtfy('03/1988?').should.equal('1988-03?'); edtfy('3/1988?').should.equal('1988-03?'); edtfy('march 1988?').should.equal('1988-03?'); edtfy('mar 1988?').should.equal('1988-03?'); }); it('should parse day uncertain', function() { edtfy('03/29/1988?').should.equal('1988-03-29?'); edtfy('03/29/1988 ?').should.equal('1988-03-29?'); edtfy('the 03/29/1988?').should.equal('1988-03-29?'); edtfy('3/29/1988?').should.equal('1988-03-29?'); edtfy('march 29 1988?').should.equal('1988-03-29?'); edtfy('march 29th 1988?').should.equal('1988-03-29?'); edtfy('mar 29 1988?').should.equal('1988-03-29?'); edtfy('june 2003 ?').should.equal('2003-06?'); }); it('should parse year approximate', function() { edtfy('around 1988').should.equal('1988~'); edtfy('about 1988').should.equal('1988~'); edtfy('circa 1988').should.equal('1988~'); edtfy('ca 1988').should.equal('1988~'); edtfy('c. 1988').should.equal('1988~'); edtfy('1988~').should.equal('1988~'); }); it('should parse season approximate', function() { edtfy('around winter 1988').should.equal('1988-24~'); edtfy('about autumn 1988').should.equal('1988-23~'); edtfy('autumn 1988~').should.equal('1988-23~'); }); it('should parse month approximate', function() { edtfy('around 03/1988').should.equal('1988-03~'); edtfy('around 3/1988').should.equal('1988-03~'); edtfy('around march 1988').should.equal('1988-03~'); edtfy('around mar 1988').should.equal('1988-03~'); edtfy('mar 1988~').should.equal('1988-03~'); }); it('should parse day approximate', function() { edtfy('about 03/29/1988').should.equal('1988-03-29~'); edtfy('about 03/29/1988').should.equal('1988-03-29~'); edtfy('about 3/29/1988').should.equal('1988-03-29~'); edtfy('about march the 29th 1988').should.equal('1988-03-29~'); edtfy('about march 29 1988').should.equal('1988-03-29~'); edtfy('abt mar 29 1988').should.equal('1988-03-29~'); edtfy('mar 29 1988~').should.equal('1988-03-29~'); }); it('should parse year approximate and uncertain', function() { edtfy('around 1988?').should.equal('1988?~'); edtfy('about 1988?').should.equal('1988?~'); edtfy('1988?~').should.equal('1988?~'); }); it('should parse season approximate and uncertain', function() { edtfy('around winter 1988?').should.equal('1988-24?~'); edtfy('around autumn 1988?').should.equal('1988-23?~'); edtfy('autumn 1988?~').should.equal('1988-23?~'); }); it('should parse month approximate and uncertain', function() { edtfy('around 03/1988?').should.equal('1988-03?~'); edtfy('around 3/1988?').should.equal('1988-03?~'); edtfy('around march 1988?').should.equal('1988-03?~'); edtfy('mar 1988?~').should.equal('1988-03?~'); }); it('should parse day approximate and uncertain', function() { edtfy('around 03/29/1988?').should.equal('1988-03-29?~'); edtfy('around the 03/29/1988?').should.equal('1988-03-29?~'); edtfy('around 3/29/1988?').should.equal('1988-03-29?~'); edtfy('around march 29 1988?').should.equal('1988-03-29?~'); edtfy('around march the 29 1988?').should.equal('1988-03-29?~'); edtfy('mar 29 1988?~').should.equal('1988-03-29?~'); }); }); describe('unspecified: the parser', function() { it('should parse year unspecified', function() { edtfy('198u').should.equal('198u'); edtfy('19uu').should.equal('19uu'); edtfy('198*').should.equal('198u'); edtfy('19**').should.equal('19uu'); }); it('should parse month unspecified', function() { edtfy('1u/1988').should.equal('1988-1u'); edtfy('uu/1988').should.equal('1988-uu'); edtfy('u/1988').should.equal('1988-uu'); edtfy('1*/1988').should.equal('1988-1u'); edtfy('**/1988').should.equal('1988-uu'); edtfy('*/1988').should.equal('1988-uu'); }); it('should parse day unspecified', function() { edtfy('01/1u/1988').should.equal('1988-01-1u'); edtfy('1/1u/1988').should.equal('1988-01-1u'); edtfy('01/uu/1988').should.equal('1988-01-uu'); edtfy('01/1*/1988').should.equal('1988-01-1u'); edtfy('1/1*/1988').should.equal('1988-01-1u'); edtfy('01/**/1988').should.equal('1988-01-uu'); }); }); describe('L1 extended interval: the parser', function() { it('should parse intervals with unknown dates', function() { edtfy('unknown - 1988').should.equal('unknown/1988'); edtfy('1988 - unknown').should.equal('1988/unknown'); }); it('should parse intervals with open dates', function() { edtfy('1988 - open').should.equal('1988/open'); }); it('should parse various intervals', function() { edtfy('uu/1988 - around 2005').should.equal('1988-uu/2005~'); edtfy('march 1988 - winter 2005?').should.equal('1988-03/2005-24?'); edtfy('from around sep 10 1988? to unknown').should.equal('1988-09-10?~/unknown'); edtfy('around sep 10 1988? - unknown').should.equal('1988-09-10?~/unknown'); }); }); describe('year exceeding four digits: the parser', function() { it('should handthe them', function() { edtfy('21988').should.equal('y21988'); edtfy('-21988').should.equal('y-21988'); edtfy('march 3 -21988').should.equal('y-21988-03-03'); edtfy('2/-21988').should.equal('y-21988-02'); edtfy('11/10/21988').should.equal('y21988-11-10'); edtfy('march 3 -21988').should.equal('y-21988-03-03'); }); }); describe('season: the parser', function() { it('should parse seasons', function() { edtfy('spring 1988').should.equal('1988-21'); edtfy('summer 1988').should.equal('1988-22'); edtfy('autumn 1988').should.equal('1988-23'); edtfy('fall 1988').should.equal('1988-23'); edtfy('winter 1988').should.equal('1988-24'); }); }); });
45.144828
88
0.595936
6a1e2f561d30a52d8eae0ba5e162e5084fc1e952
3,470
js
JavaScript
desktop/core/src/desktop/js/api/cancellablePromise.js
maulikjs/hue
59ac879b55bb6fb26ecb4e85f4c70836fc21173f
[ "Apache-2.0" ]
1
2020-05-17T06:40:33.000Z
2020-05-17T06:40:33.000Z
desktop/core/src/desktop/js/api/cancellablePromise.js
zks888/hue
93a8c370713e70b216c428caa2f75185ef809deb
[ "Apache-2.0" ]
4
2021-03-11T04:02:00.000Z
2022-03-27T08:31:56.000Z
desktop/core/src/desktop/js/api/cancellablePromise.js
zks888/hue
93a8c370713e70b216c428caa2f75185ef809deb
[ "Apache-2.0" ]
1
2017-11-09T09:31:28.000Z
2017-11-09T09:31:28.000Z
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. 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. import $ from 'jquery'; import apiHelper from 'api/apiHelper'; class CancellablePromise { constructor(deferred, request, otherCancellables) { const self = this; self.cancelCallbacks = []; self.deferred = deferred; self.request = request; self.otherCancellables = otherCancellables; self.cancelled = false; self.cancelPrevented = false; } /** * A promise might be shared across multiple components in the UI, in some cases cancel is not an option and calling * this will prevent that to happen. * * One example is autocompletion of databases while the assist is loading the database tree, closing the autocomplete * results would make the assist loading fail if cancel hasn't been prevented. * * @returns {CancellablePromise} */ preventCancel() { const self = this; self.cancelPrevented = true; return self; } cancel() { const self = this; if (self.cancelPrevented || self.cancelled || self.state() !== 'pending') { return $.Deferred() .resolve() .promise(); } self.cancelled = true; if (self.request) { apiHelper.cancelActiveRequest(self.request); } if (self.state && self.state() === 'pending' && self.deferred.reject) { self.deferred.reject(); } const cancelPromises = []; if (self.otherCancellables) { self.otherCancellables.forEach(cancellable => { if (cancellable.cancel) { cancelPromises.push(cancellable.cancel()); } }); } while (self.cancelCallbacks.length) { self.cancelCallbacks.pop()(); } return $.when(cancelPromises); } onCancel(callback) { const self = this; if (self.cancelled) { callback(); } else { self.cancelCallbacks.push(callback); } return self; } then() { const self = this; self.deferred.then.apply(self.deferred, arguments); return self; } done(callback) { const self = this; self.deferred.done.apply(self.deferred, arguments); return self; } fail(callback) { const self = this; self.deferred.fail.apply(self.deferred, arguments); return self; } always(callback) { const self = this; self.deferred.always.apply(self.deferred, arguments); return self; } pipe(callback) { const self = this; self.deferred.pipe.apply(self.deferred, arguments); return self; } progress(callback) { const self = this; self.deferred.progress.apply(self.deferred, arguments); return self; } state() { const self = this; return self.deferred.state && self.deferred.state(); } } export default CancellablePromise;
26.48855
119
0.665706
6a1eb72706d112da4a68f06b95177037a3bfabac
546
js
JavaScript
src/contexts/Progress.js
hojunlee-hj/2021-1-OSSP2-SaJoChamChi-4
41c856aeb62498624ef896fde107ca863d189588
[ "MIT" ]
1
2021-04-16T09:36:14.000Z
2021-04-16T09:36:14.000Z
src/contexts/Progress.js
hojunlee-hj/2021-1-OSSP2-SaJoChamChi-4
41c856aeb62498624ef896fde107ca863d189588
[ "MIT" ]
3
2021-06-01T15:08:15.000Z
2021-06-04T15:51:49.000Z
src/contexts/Progress.js
hojunlee-hj/2021-1-OSSP2-SaJoChamChi-4
41c856aeb62498624ef896fde107ca863d189588
[ "MIT" ]
3
2021-06-03T15:01:10.000Z
2022-01-14T12:01:45.000Z
import React, { useState, createContext } from 'react'; const ProgressContext = createContext({ inProgress: false, spinner: () => {}, }); const ProgressProvider = ({ children }) => { const [inProgress, setInProgress] = useState(false); const spinner = { start: () => setInProgress(true), stop: () => setInProgress(false), }; const value = { inProgress, spinner }; return ( <ProgressContext.Provider value={value}> {children} </ProgressContext.Provider> ); }; export { ProgressContext, ProgressProvider };
23.73913
55
0.652015
6a1f05f37b70de9a5a9dd24628bb021b5fe5a47a
21,425
js
JavaScript
packages/jest-diff/src/__tests__/diff.test.js
incleaf/jest
8d3de491eae9d3a8d495fa37bd11a1a0cd1bc849
[ "MIT" ]
2
2018-06-08T06:30:15.000Z
2019-03-08T06:27:01.000Z
packages/jest-diff/src/__tests__/diff.test.js
incleaf/jest
8d3de491eae9d3a8d495fa37bd11a1a0cd1bc849
[ "MIT" ]
2
2018-02-22T10:57:36.000Z
2020-04-30T22:50:24.000Z
packages/jest-diff/src/__tests__/diff.test.js
incleaf/jest
8d3de491eae9d3a8d495fa37bd11a1a0cd1bc849
[ "MIT" ]
1
2021-06-02T20:03:09.000Z
2021-06-02T20:03:09.000Z
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow */ const stripAnsi = require('strip-ansi'); const diff = require('../'); const NO_DIFF_MESSAGE = 'Compared values have no visual difference.'; const stripped = (a, b, options) => stripAnsi(diff(a, b, options)); const unexpanded = {expand: false}; const expanded = {expand: true}; const elementSymbol = Symbol.for('react.element'); describe('different types', () => { [ [1, 'a', 'number', 'string'], [{}, 'a', 'object', 'string'], [[], 2, 'array', 'number'], [null, undefined, 'null', 'undefined'], [() => {}, 3, 'function', 'number'], ].forEach(values => { const a = values[0]; const b = values[1]; const typeA = values[2]; const typeB = values[3]; test(`'${String(a)}' and '${String(b)}'`, () => { expect(stripped(a, b)).toBe( ' Comparing two different types of values. ' + `Expected ${typeA} but received ${typeB}.`, ); }); }); }); describe('no visual difference', () => { [ ['a', 'a'], [{}, {}], [[], []], [[1, 2], [1, 2]], [11, 11], [() => {}, () => {}], [null, null], [undefined, undefined], [{a: 1}, {a: 1}], [{a: {b: 5}}, {a: {b: 5}}], ].forEach(values => { test(`'${JSON.stringify(values[0])}' and '${JSON.stringify( values[1], )}' (unexpanded)`, () => { expect(stripped(values[0], values[1], unexpanded)).toBe(NO_DIFF_MESSAGE); }); test(`'${JSON.stringify(values[0])}' and '${JSON.stringify( values[1], )}' (expanded)`, () => { expect(stripped(values[0], values[1], expanded)).toBe(NO_DIFF_MESSAGE); }); }); test('Map key order should be irrelevant', () => { const arg1 = new Map([[1, 'foo'], [2, 'bar']]); const arg2 = new Map([[2, 'bar'], [1, 'foo']]); expect(stripped(arg1, arg2)).toBe(NO_DIFF_MESSAGE); }); test('Set value order should be irrelevant', () => { const arg1 = new Set([1, 2]); const arg2 = new Set([2, 1]); expect(stripped(arg1, arg2)).toBe(NO_DIFF_MESSAGE); }); }); test('oneline strings', () => { // oneline strings don't produce a diff currently. expect(diff('ab', 'aa')).toBe(null); expect(diff('123456789', '234567890')).toBe(null); // if either string is oneline expect(diff('oneline', 'multi\nline')).toBe(null); expect(diff('multi\nline', 'oneline')).toBe(null); }); describe('falls back to not call toJSON', () => { describe('if serialization has no differences', () => { const toJSON = function toJSON() { return 'it’s all the same to me'; }; test('but then objects have differences', () => { const a = {line: 1, toJSON}; const b = {line: 2, toJSON}; expect(diff(a, b)).toMatchSnapshot(); }); test('and then objects have no differences', () => { const a = {line: 2, toJSON}; const b = {line: 2, toJSON}; expect(stripped(a, b)).toBe(NO_DIFF_MESSAGE); }); }); describe('if it throws', () => { const toJSON = function toJSON() { throw new Error('catch me if you can'); }; test('and then objects have differences', () => { const a = {line: 1, toJSON}; const b = {line: 2, toJSON}; expect(diff(a, b)).toMatchSnapshot(); }); test('and then objects have no differences', () => { const a = {line: 2, toJSON}; const b = {line: 2, toJSON}; expect(stripped(a, b)).toBe(NO_DIFF_MESSAGE); }); }); }); // Some of the following assertions seem complex, but compare to alternatives: // * toMatch instead of toMatchSnapshot: // * to avoid visual complexity of escaped quotes in expected string // * to omit Expected/Received heading which is an irrelevant detail // * join lines of expected string instead of multiline string: // * to avoid ambiguity about indentation in diff lines describe('multiline strings', () => { const a = `line 1 line 2 line 3 line 4`; const b = `line 1 line 2 line 3 line 4`; const expected = [ ' line 1', '- line 2', '+ line 2', ' line 3', ' line 4', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('objects', () => { const a = {a: {b: {c: 5}}}; const b = {a: {b: {c: 6}}}; const expected = [ ' Object {', ' "a": Object {', ' "b": Object {', '- "c": 5,', '+ "c": 6,', ' },', ' },', ' }', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); test('numbers', () => { const result = diff(123, 234); expect(result).toBe(null); }); test('booleans', () => { const result = diff(true, false); expect(result).toBe(null); }); describe('multiline string non-snapshot', () => { // For example, CLI output // toBe or toEqual for a string isn’t enclosed in double quotes. const a = ` Options: --help, -h Show help [boolean] --bail, -b Exit the test suite immediately upon the first failing test. [boolean] `; const b = ` Options: --help, -h Show help [boolean] --bail, -b Exit the test suite immediately upon the first failing test. [boolean] `; const expected = [ ' Options:', '- --help, -h Show help [boolean]', '- --bail, -b Exit the test suite immediately upon the first', '- failing test. [boolean]', '+ --help, -h Show help [boolean]', '+ --bail, -b Exit the test suite immediately upon the first', '+ failing test. [boolean]', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('multiline string snapshot', () => { // For example, CLI output // A snapshot of a string is enclosed in double quotes. const a = ` " Options: --help, -h Show help [boolean] --bail, -b Exit the test suite immediately upon the first failing test. [boolean]" `; const b = ` " Options: --help, -h Show help [boolean] --bail, -b Exit the test suite immediately upon the first failing test. [boolean]" `; const expected = [ ' "', ' Options:', '- --help, -h Show help [boolean]', '- --bail, -b Exit the test suite immediately upon the first', '- failing test. [boolean]"', '+ --help, -h Show help [boolean]', '+ --bail, -b Exit the test suite immediately upon the first', '+ failing test. [boolean]"', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('React elements', () => { const a = { $$typeof: elementSymbol, props: { children: 'Hello', className: 'fun', }, type: 'div', }; const b = { $$typeof: elementSymbol, props: { children: 'Goodbye', className: 'fun', }, type: 'div', }; const expected = [ ' <div', ' className="fun"', ' >', '- Hello', '+ Goodbye', ' </div>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('multiline string as value of object property', () => { const expected = [ ' Object {', ' "id": "J",', ' "points": "0.5,0.460', '+ 0.5,0.875', ' 0.25,0.875",', ' }', ].join('\n'); describe('(non-snapshot)', () => { const a = { id: 'J', points: '0.5,0.460\n0.25,0.875', }; const b = { id: 'J', points: '0.5,0.460\n0.5,0.875\n0.25,0.875', }; test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('(snapshot)', () => { const a = [ 'Object {', ' "id": "J",', ' "points": "0.5,0.460', '0.25,0.875",', '}', ].join('\n'); const b = [ 'Object {', ' "id": "J",', ' "points": "0.5,0.460', '0.5,0.875', '0.25,0.875",', '}', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); }); describe('indentation in JavaScript structures', () => { const searching = ''; const object = { descending: false, fieldKey: 'what', }; const a = { searching, sorting: object, }; const b = { searching, sorting: [object], }; describe('from less to more', () => { const expected = [ ' Object {', ' "searching": "",', '- "sorting": Object {', '+ "sorting": Array [', '+ Object {', // following 3 lines are unchanged, except for more indentation ' "descending": false,', ' "fieldKey": "what",', ' },', '+ ],', ' }', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('from more to less', () => { const expected = [ ' Object {', ' "searching": "",', '- "sorting": Array [', '- Object {', '+ "sorting": Object {', // following 3 lines are unchanged, except for less indentation ' "descending": false,', ' "fieldKey": "what",', ' },', '- ],', ' }', ].join('\n'); test('(unexpanded)', () => { expect(stripped(b, a, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(b, a, expanded)).toMatch(expected); }); }); }); describe('color of text', () => { const searching = ''; const object = { descending: false, fieldKey: 'what', }; const a = { searching, sorting: object, }; const b = { searching, sorting: [object], }; const received = diff(a, b, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { // Expect same result, unless diff is long enough to require patch marks. expect(diff(a, b, unexpanded)).toBe(received); }); }); describe('indentation in React elements (non-snapshot)', () => { const leaf = { $$typeof: elementSymbol, props: { children: ['text'], }, type: 'span', }; const a = { $$typeof: elementSymbol, props: { children: [leaf], }, type: 'span', }; const b = { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: [leaf], }, type: 'strong', }, ], }, type: 'span', }; describe('from less to more', () => { const expected = [ ' <span>', '+ <strong>', // following 3 lines are unchanged, except for more indentation ' <span>', ' text', ' </span>', '+ </strong>', ' </span>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('from more to less', () => { const expected = [ ' <span>', '- <strong>', // following 3 lines are unchanged, except for less indentation ' <span>', ' text', ' </span>', '- </strong>', ' </span>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(b, a, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(b, a, expanded)).toMatch(expected); }); }); }); describe('indentation in React elements (snapshot)', () => { // prettier-ignore const a = [ '<span>', ' <span>', ' text', ' </span>', '</span>', ].join('\n'); const b = [ '<span>', ' <strong>', ' <span>', ' text', ' </span>', ' </strong>', '</span>', ].join('\n'); describe('from less to more', () => { // We intend to improve snapshot diff in the next version of Jest. const expected = [ ' <span>', '- <span>', '- text', '- </span>', '+ <strong>', '+ <span>', '+ text', '+ </span>', '+ </strong>', ' </span>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('from more to less', () => { // We intend to improve snapshot diff in the next version of Jest. const expected = [ ' <span>', '- <strong>', '- <span>', '- text', '- </span>', '- </strong>', '+ <span>', '+ text', '+ </span>', ' </span>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(b, a, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(b, a, expanded)).toMatch(expected); }); }); }); describe('outer React element (non-snapshot)', () => { const a = { $$typeof: elementSymbol, props: { children: 'Jest', }, type: 'h1', }; const b = { $$typeof: elementSymbol, props: { children: [ a, { $$typeof: elementSymbol, props: { children: 'Delightful JavaScript Testing', }, type: 'h2', }, ], }, type: 'header', }; describe('from less to more', () => { const expected = [ '+ <header>', // following 3 lines are unchanged, except for more indentation ' <h1>', ' Jest', ' </h1>', '+ <h2>', '+ Delightful JavaScript Testing', '+ </h2>', '+ </header>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('from more to less', () => { const expected = [ '- <header>', // following 3 lines are unchanged, except for less indentation ' <h1>', ' Jest', ' </h1>', '- <h2>', '- Delightful JavaScript Testing', '- </h2>', '- </header>', ].join('\n'); test('(unexpanded)', () => { expect(stripped(b, a, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(b, a, expanded)).toMatch(expected); }); }); }); describe('trailing newline in multiline string not enclosed in quotes', () => { const a = ['line 1', 'line 2', 'line 3'].join('\n'); const b = a + '\n'; describe('from less to more', () => { const expected = [' line 1', ' line 2', ' line 3', '+ '].join('\n'); test('(unexpanded)', () => { expect(stripped(a, b, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(a, b, expanded)).toMatch(expected); }); }); describe('from more to less', () => { const expected = [' line 1', ' line 2', ' line 3', '- '].join('\n'); test('(unexpanded)', () => { expect(stripped(b, a, unexpanded)).toMatch(expected); }); test('(expanded)', () => { expect(stripped(b, a, expanded)).toMatch(expected); }); }); }); describe('background color of spaces', () => { const baseline = { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: [''], }, type: 'span', }, ], }, type: 'div', }; const lines = [ 'following string consists of a space:', ' ', ' line has preceding space only', ' line has both preceding and following space ', 'line has following space only ', ]; const examples = { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: lines, }, type: 'span', }, ], }, type: 'div', }; const unchanged = { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: lines, }, type: 'p', }, ], }, type: 'div', }; const inchanged = { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: [ { $$typeof: elementSymbol, props: { children: [lines], }, type: 'span', }, ], }, type: 'p', }, ], }, type: 'div', }; // Expect same results, unless diff is long enough to require patch marks. describe('cyan for inchanged', () => { const received = diff(examples, inchanged, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { expect(diff(examples, inchanged, unexpanded)).toBe(received); }); }); describe('green for removed', () => { const received = diff(examples, baseline, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { expect(diff(examples, baseline, unexpanded)).toBe(received); }); }); describe('red for added', () => { const received = diff(baseline, examples, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { expect(diff(baseline, examples, unexpanded)).toBe(received); }); }); describe('yellow for unchanged', () => { const received = diff(examples, unchanged, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { expect(diff(examples, unchanged, unexpanded)).toBe(received); }); }); }); describe('highlight only the last in odd length of leading spaces', () => { const pre5 = { $$typeof: elementSymbol, props: { children: [ 'attributes.reduce(function (props, attribute) {', ' props[attribute.name] = attribute.value;', // 3 leading spaces ' return props;', // 2 leading spaces ' }, {});', // 1 leading space ].join('\n'), }, type: 'pre', }; const pre6 = { $$typeof: elementSymbol, props: { children: [ 'attributes.reduce((props, {name, value}) => {', ' props[name] = value;', // from 3 to 2 leading spaces ' return props;', // unchanged 2 leading spaces '}, {});', // from 1 to 0 leading spaces ].join('\n'), }, type: 'pre', }; const received = diff(pre5, pre6, expanded); test('(expanded)', () => { expect(received).toMatchSnapshot(); }); test('(unexpanded)', () => { expect(diff(pre5, pre6, unexpanded)).toBe(received); }); }); test('collapses big diffs to patch format', () => { const result = diff( {test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}, {test: [1, 2, 3, 4, 5, 6, 7, 8, 10, 9]}, unexpanded, ); expect(result).toMatchSnapshot(); }); describe('context', () => { const testDiffContextLines = (contextLines?: number) => { test(`number of lines: ${ typeof contextLines === 'number' ? contextLines : 'null' } ${ typeof contextLines !== 'number' || contextLines < 0 ? '(5 default)' : '' }`, () => { const result = diff( {test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}, {test: [1, 2, 3, 4, 5, 6, 7, 8, 10, 9]}, { contextLines, expand: false, }, ); expect(result).toMatchSnapshot(); }); }; testDiffContextLines(); // 5 by default testDiffContextLines(2); testDiffContextLines(1); testDiffContextLines(0); testDiffContextLines(-1); // Will use default });
25.146714
79
0.490548
6a1f98ab409f0b7483ef471a481624cc958c6cd4
768
js
JavaScript
public/js/tasks.js
HeatMarie/poggers
4eabcdd7ccda4aa322c5daab241ff9ff3cff6e69
[ "MIT" ]
null
null
null
public/js/tasks.js
HeatMarie/poggers
4eabcdd7ccda4aa322c5daab241ff9ff3cff6e69
[ "MIT" ]
1
2021-07-25T02:04:44.000Z
2021-07-25T02:05:46.000Z
public/js/tasks.js
HeatMarie/poggers
4eabcdd7ccda4aa322c5daab241ff9ff3cff6e69
[ "MIT" ]
3
2021-08-01T23:29:31.000Z
2021-09-04T12:58:56.000Z
const taskHandler = async (event) => { event.preventDefault(); const description = document.querySelector('#task-desc').value; if (description) { const path = window.location.pathname; const response = await fetch(`/api/tasks/${path.substring(path.lastIndexOf("/") + 1)}`, { method: 'POST', body: JSON.stringify({ description }), headers: { 'Content-Type': 'application/json', }, }); if (response.ok) { document.location.replace('/'); } else { console.log("This is what a task description should say", description); alert('Failed to post task'); } } }; document .querySelector('.task') .addEventListener('submit', taskHandler);
29.538462
95
0.578125
6a1fd4b88fb6f591954f7b865d41895bba2828b6
106
js
JavaScript
test/integration/route-indexes/pages/sub/[id].js
blomqma/next.js
7db6aa2fde34699cf319d30980c2ee38bb53f20d
[ "MIT" ]
51,887
2016-10-25T15:48:01.000Z
2020-05-27T17:47:07.000Z
test/integration/route-indexes/pages/sub/[id].js
blomqma/next.js
7db6aa2fde34699cf319d30980c2ee38bb53f20d
[ "MIT" ]
13,333
2020-05-27T18:15:25.000Z
2022-03-31T23:48:59.000Z
test/integration/route-indexes/pages/sub/[id].js
blomqma/next.js
7db6aa2fde34699cf319d30980c2ee38bb53f20d
[ "MIT" ]
14,796
2020-05-27T18:07:16.000Z
2022-03-31T23:55:30.000Z
const page = () => 'hello from sub id' page.getInitialProps = () => ({ hello: 'hi' }) export default page
26.5
46
0.622642
6a202e2889b1015c62b96db67c205c72fcfd44c2
341
js
JavaScript
src/app/reducers/tabs_index_reducer.js
KenzoM/Pinterest-Clone-Firebase
dad29aa2df08038140fa953920d9ca3323ab897b
[ "MIT" ]
1
2017-11-09T22:32:41.000Z
2017-11-09T22:32:41.000Z
src/app/reducers/tabs_index_reducer.js
KenzoM/Pinterest-Clone-Firebase
dad29aa2df08038140fa953920d9ca3323ab897b
[ "MIT" ]
null
null
null
src/app/reducers/tabs_index_reducer.js
KenzoM/Pinterest-Clone-Firebase
dad29aa2df08038140fa953920d9ca3323ab897b
[ "MIT" ]
null
null
null
import { TAB_INDEX } from '../actions/types'; const INITIAL = { tab_index: 0} //This reducer is for keeping track of active tabs in Material UI export default function(state = INITIAL, action){ switch (action.type){ case TAB_INDEX: const { payload } = action; return {...state, tab_index: payload} } return state; }
24.357143
65
0.671554
6a20dbae5bf71461d5ac4925d8c2be539c30a715
309
js
JavaScript
src/ui/public/filter_bar/lib/map_missing.js
IBMResearch/kibana-bluemix
a07267965791f2582a978e8c7190a2af8d43e159
[ "Apache-2.0" ]
546
2015-09-14T17:51:46.000Z
2021-11-02T00:48:01.000Z
src/ui/public/filter_bar/lib/map_missing.js
IBMResearch/kibana-bluemix
a07267965791f2582a978e8c7190a2af8d43e159
[ "Apache-2.0" ]
102
2015-09-28T14:14:32.000Z
2020-07-21T21:23:20.000Z
src/ui/public/filter_bar/lib/map_missing.js
IBMResearch/kibana-bluemix
a07267965791f2582a978e8c7190a2af8d43e159
[ "Apache-2.0" ]
144
2015-09-13T16:41:41.000Z
2020-06-26T20:32:33.000Z
export function FilterBarLibMapMissingProvider(Promise) { return function (filter) { if (filter.missing) { const type = 'missing'; const key = filter.missing.field; const value = type; return Promise.resolve({ type, key, value }); } return Promise.reject(filter); }; }
25.75
57
0.644013
6a20eedda9fbbb96596fd1738d36bbd24319759e
349
js
JavaScript
test/test.0001.js
g-stefan/quantum-script-extension-example
31e5a4958eaa50b5de286abc7c039a7e839d97aa
[ "MIT", "Unlicense" ]
null
null
null
test/test.0001.js
g-stefan/quantum-script-extension-example
31e5a4958eaa50b5de286abc7c039a7e839d97aa
[ "MIT", "Unlicense" ]
null
null
null
test/test.0001.js
g-stefan/quantum-script-extension-example
31e5a4958eaa50b5de286abc7c039a7e839d97aa
[ "MIT", "Unlicense" ]
null
null
null
// Public domain // http://unlicense.org/ Script.requireExtension("Console"); Script.requireExtension("Example"); Script.requireExtension("JSON"); Example.print(Example.process(function(x) { return x + " world!\r\n"; })); Console.writeLn(JSON.encodeWithIndentation(Script.getExtensionList())); Console.writeLn("-> test 0001 ok");
23.266667
72
0.704871
6a211f7e73531877462e665e2271c0585d42d4a7
60,641
js
JavaScript
zm-admin-console/WebRoot/js/zimbraAdmin/domains/view/ZaTaskAutoProvDialog.js
hernad/zimbra9
cf61ffa40d9600ab255ef4516ca25029fff6603b
[ "Apache-2.0" ]
null
null
null
zm-admin-console/WebRoot/js/zimbraAdmin/domains/view/ZaTaskAutoProvDialog.js
hernad/zimbra9
cf61ffa40d9600ab255ef4516ca25029fff6603b
[ "Apache-2.0" ]
null
null
null
zm-admin-console/WebRoot/js/zimbraAdmin/domains/view/ZaTaskAutoProvDialog.js
hernad/zimbra9
cf61ffa40d9600ab255ef4516ca25029fff6603b
[ "Apache-2.0" ]
null
null
null
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Web Client * Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc. * * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: https://www.zimbra.com/license * The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 * have been added to cover use of software over a computer network and provide for limited attribution * for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and limitations under the License. * The Original Code is Zimbra Open Source Web Client. * The Initial Developer of the Original Code is Zimbra, Inc. All rights to the Original Code were * transferred by Zimbra, Inc. to Synacor, Inc. on September 14, 2015. * * All portions of the code are Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc. All Rights Reserved. * ***** END LICENSE BLOCK ***** */ /** * Created by IntelliJ IDEA. * User: qinan * Date: 8/24/11 * Time: 4:29 PM * To change this template use File | Settings | File Templates. */ ZaTaskAutoProvDialog = function(parent, title, width, height) { if (arguments.length == 0) return; var applyButton = new DwtDialog_ButtonDescriptor(ZaTaskAutoProvDialog.APPLY_BUTTON, ZaMsg.LBL_ApplyButton, DwtDialog.ALIGN_RIGHT, new AjxCallback(this, this._applyButtonListener)); var helpButton = new DwtDialog_ButtonDescriptor(ZaXWizardDialog.HELP_BUTTON, ZaMsg.TBB_Help, DwtDialog.ALIGN_LEFT, new AjxCallback(this, this._helpButtonListener)); this._standardButtons = [DwtDialog.OK_BUTTON, DwtDialog.CANCEL_BUTTON]; this._extraButtons = [helpButton, applyButton]; this._width = width || "680px"; this._height = height || "390px"; ZaXDialog.call(this, parent, null, title, this._width, this._height, null, ZaId.DLG_AUTPROV_MANUAL+"_ENHANCE"); this._containedObject = {}; this.initForm(ZaDomain.myXModel,this.getMyXForm()); this._helpURL = ZaTaskAutoProvDialog.helpURL; this._forceApplyMessageDialog = new ZaMsgDialog(ZaApp.getInstance().getAppCtxt().getShell(), null, [DwtDialog.YES_BUTTON, DwtDialog.NO_BUTTON],null,ZaId.CTR_PREFIX + ZaId.VIEW_DMLIST + "_forceApplyConfirm"); this._forceApplyMessageDialog.registerCallback(DwtDialog.YES_BUTTON, ZaTaskAutoProvDialog.prototype._forceApplyCallback, this); this._localXForm.addListener(DwtEvent.XFORMS_FORM_DIRTY_CHANGE, new AjxListener(this, ZaTaskAutoProvDialog.prototype.handleXFormChange)); this._localXForm.addListener(DwtEvent.XFORMS_VALUE_ERROR, new AjxListener(this, ZaTaskAutoProvDialog.prototype.handleXFormChange)); } ZaTaskAutoProvDialog.prototype = new ZaXDialog; ZaTaskAutoProvDialog.prototype.constructor = ZaTaskAutoProvDialog; ZaTaskAutoProvDialog.prototype.supportMinimize = true; ZaTaskAutoProvDialog.helpURL = location.pathname + ZaUtil.HELP_URL + "managing_domain/autoprov_manual_config.htm?locid="+AjxEnv.DEFAULT_LOCALE; ZaTaskAutoProvDialog.APPLY_BUTTON = ++DwtDialog.LAST_BUTTON; ZaTaskAutoProvDialog.prototype.getCacheName = function(){ return "ZaTaskAutoProvDialog"; } ZaTaskAutoProvDialog.prototype.setObject = function(entry) { this._containedObject = new ZaDomain(); ZaItem.prototype.copyTo.call(entry,this._containedObject,true,4); this._containedObject[ZaDomain.A2_zimbraAutoProvSearchActivated] = entry[ZaDomain.A2_zimbraAutoProvSearchActivated] || "TRUE"; if(entry.attrs[ZaDomain.A_zimbraAutoProvAttrMap] && (typeof entry.attrs[ZaDomain.A_zimbraAutoProvAttrMap] == "string")) this._containedObject.attrs[ZaDomain.A_zimbraAutoProvAttrMap] = [entry.attrs[ZaDomain.A_zimbraAutoProvAttrMap]]; // auto provisioning object backup this._backupLdapObj(this._containedObject); this._containedObject[ZaDomain.A2_zimbraAutoProvAccountPool] = entry[ZaDomain.A2_zimbraAutoProvAccountPool] || []; this._containedObject[ZaDomain.A2_zimbraAutoProvAccountTargetPool] = entry[ZaDomain.A2_zimbraAutoProvAccountTargetPool] || []; this._separateConfigureValues(this._containedObject); //ZaXDialog.prototype.setObject.call(this,entry); this._containedObject._uuid = entry._extid || entry._uuid; this._containedObject._editObject = entry._editObject; this._localXForm.setInstance(this._containedObject); this._button[DwtDialog.OK_BUTTON].setEnabled(false); this._button[ZaTaskAutoProvDialog.APPLY_BUTTON].setEnabled(false); } ZaTaskAutoProvDialog.prototype.finishWizard = function(ev) { try { if(!this._checkGeneralConfig() || !this._checkEagerConfig() || !this._checkLazyConfig()) { return; } this._combineConfigureValues(this._containedObject); ZaDomain.modifyAutoPovSettings.call(this._containedObject._editObject,this._containedObject); ZaApp.getInstance().getDomainListController()._fireDomainChangeEvent(this._containedObject._editObject); this.popdown(); ZaApp.getInstance().getDomainListController()._notifyAllOpenTabs(); } catch (ex) { this._handleException(ex, "ZaDomainListController.prototype._finishAutoProvButtonListener", null, false); } return; } ZaTaskAutoProvDialog.prototype.handleXFormChange = function() { if(this._localXForm.hasErrors()) { this._button[DwtDialog.OK_BUTTON].setEnabled(false); this._button[ZaTaskAutoProvDialog.APPLY_BUTTON].setEnabled(false); } else { this._button[DwtDialog.OK_BUTTON].setEnabled(true); this._button[ZaTaskAutoProvDialog.APPLY_BUTTON].setEnabled(true); } // check modification this.tabClickHandler(); } ZaTaskAutoProvDialog.prototype.getMyXForm = function() { this.tabChoices = new Array(); this.TAB_INDEX = 0; var _tab1, _tab2, _tab3, _tab4, _tab5; _tab1 = ++this.TAB_INDEX; this.tabChoices.push({value:_tab1, label:ZaMsg.TBB_AUTOPROV_GENERAL}); _tab2 = ++this.TAB_INDEX; this.tabChoices.push({value:_tab2, label:ZaMsg.TBB_AUTOPROV_EAGER}); _tab3 = ++this.TAB_INDEX; this.tabChoices.push({value:_tab3, label:ZaMsg.TBB_AUTOPROV_LAZY}); this.TAB_STEP_MANUAL = _tab4 = ++this.TAB_INDEX; this.tabChoices.push({value:_tab4, label:ZaMsg.TBB_AUTOPROV_MANUAL}); _tab5 = ++this.TAB_INDEX; this.tabChoices.push({value:_tab5, label:ZaMsg.TBB_zimbraAutoProvEmailSetting}); var cases = []; var case1={type:_ZATABCASE_, numCols:2,colSizes:["150px","490px"], caseKey:_tab1, id:"auto_provision_config_general", getCustomWidth:ZaTaskAutoProvDialog.getCustomWidth, getCustomHeight:ZaTaskAutoProvDialog.getCustomHeight, items: [ {type: _SPACER_, height: 10 }, {type:_GROUPER_, colSpan:"*", width: "100%",label:"LDAP Configuration", containerCssStyle: "padding-top:5px", enableDisableChecks:[], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled, ZaDomain.A2_zimbraAutoProvModeLAZYEnabled, ZaDomain.A2_zimbraAutoProvModeMANUALEnabled], items: [ {type:_GROUP_, numCols:6, label:" ", labelLocation:_LEFT_, visibilityChecks: [], visibilityChangeEventSources:[], items: [ {type:_OUTPUT_, label:null, labelLocation:_NONE_, value:" ", width:"35px"}, {type:_OUTPUT_, label:null, labelLocation:_NONE_, value:ZaMsg.Domain_AuthLDAPServerName, width:"200px"}, {type:_OUTPUT_, label:null, labelLocation:_NONE_, value:" ", width:"5px"}, {type:_OUTPUT_, label:null, labelLocation:_NONE_, value:ZaMsg.Domain_AuthLDAPServerPort, width:"40px"}, {type:_OUTPUT_, label:null, labelLocation:_NONE_, value:ZaMsg.Domain_AuthLDAPUseSSL, width:"80px"} ] }, {ref:ZaDomain.A_zimbraAutoProvLdapURL, type:_LDAPURL_, label:ZaMsg.LBL_zimbraAutoProvLdapURL, ldapSSLPort:"636",ldapPort:"389", labelLocation:_LEFT_, label: ZaMsg.LBL_zimbraAutoProvLdapURL }, {ref:ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvLdapStartTlsEnabled, subLabel:"", align:_RIGHT_, trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {ref:ZaDomain.A_zimbraAutoProvLdapAdminBindDn, type:_INPUT_, label:ZaMsg.LBL_zimbraAutoProvLdapAdminBindDn, labelLocation:_LEFT_, enableDisableChecks:[], enableDisableChangeEventSources:[] }, {ref:ZaDomain.A_zimbraAutoProvLdapAdminBindPassword, type:_SECRET_, label:ZaMsg.LBL_zimbraAutoProvLdapAdminBindPassword, labelLocation:_LEFT_ }, {ref:ZaDomain.A_zimbraAutoProvLdapSearchFilter, type:_TEXTAREA_, width:350, height:40, label:ZaMsg.LBL_zimbraAutoProvLdapSearchFilter, labelLocation:_LEFT_, textWrapping:"soft" }, {ref:ZaDomain.A_zimbraAutoProvLdapSearchBase, type:_TEXTAREA_, width:350, height:40, label:ZaMsg.LBL_zimbraAutoProvLdapSearchBase, labelLocation:_LEFT_, textWrapping:"soft" }, {ref:ZaDomain.A_zimbraAutoProvLdapBindDn, type:_INPUT_, label:ZaMsg.LBL_zimbraAutoProvLdapBindDn, labelLocation:_LEFT_ } ]}, {type: _SPACER_, height: 10 }, {ref:ZaDomain.A_zimbraAutoProvNotificationFromAddress, type:_TEXTFIELD_, label:ZaMsg.LBL_zimbraAutoProvNotificationFromAddress, labelLocation:_LEFT_, width:250, onChange:ZaDomainXFormView.onFormFieldChanged }, {ref:ZaDomain.A_zimbraAutoProvAccountNameMap, type:_TEXTFIELD_, label:ZaMsg.LBL_zimbraAutoProvAccountNameMap, labelLocation:_LEFT_, width:250, onChange:ZaDomainXFormView.onFormFieldChanged }, {ref:ZaDomain.A_zimbraAutoProvAttrMap, type:_REPEAT_, label:ZaMsg.LBL_zimbraAutoProvAttrMap, repeatInstance:"", showAddButton:true, showRemoveButton:true, addButtonLabel:ZaMsg.NAD_Add, showAddOnNextRow:true, removeButtonLabel:ZaMsg.NAD_Remove, items: [ {ref:".", type:_TEXTFIELD_, label:null, enableDisableChecks:[], visibilityChecks:[], onChange:ZaDomainXFormView.onFormFieldChanged} ] } ] }; cases.push(case1); var case2={type:_ZATABCASE_, numCols:2,colSizes:["45px","*"], caseKey:_tab2, //cssStyle:"width:550px;",//width: "650px", id:"auto_provision_config_eager", getCustomWidth:ZaTaskAutoProvDialog.getCustomWidth, getCustomHeight:ZaTaskAutoProvDialog.getCustomHeight, items: [ {type: _SPACER_, height: 20 }, {ref:ZaDomain.A2_zimbraAutoProvModeEAGEREnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvModeEAGER, subLabel:"", align:_RIGHT_, trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {type: _SPACER_, height: 20 }, {type:_GROUPER_, colSpan:"*", width: "100%",label:"Configuration", containerCssStyle: "padding-top:5px", colSizes:["175px","*"], numCols:2, enableDisableChecks:[[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeEAGEREnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled], items: [ {ref:ZaDomain.A_zimbraAutoProvBatchSize, type:_TEXTFIELD_, label:ZaMsg.LBL_zimbraAutoProvBatchSize, autoSaveValue:true, labelLocation:_LEFT_, enableDisableChecks: [[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeEAGEREnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled], cssClass:"admin_xform_number_input" }, {ref:ZaDomain.A2_zimbraAutoProvPollingInterval, type:_LIFETIME_, colSizes:["80px","100px","*"], label:ZaMsg.LBL_zimbraAutoProvPollingInterval, labelLocation:_LEFT_, enableDisableChecks: [[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeEAGEREnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] }, {type: _DWT_LIST_, ref: ZaDomain.A2_zimbraAutoProvServerList, width: 250, height: 50, label:ZaMsg.LBL_zimbraAutoProvServerList, labelLocation:_LEFT_, labelCssStyle:"vertical-align:top", nowrap:false,labelWrap:true, forceUpdate: true, widgetClass: ZaServerOptionList, multiselect: true, preserveSelection: true, enableDisableChecks: [[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeEAGEREnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled], onSelection: ZaTaskAutoProvDialog.filterSelectionListener } ]}, {type:_GROUPER_, colSpan:"*", width: "100%",label:"Note", containerCssStyle: "padding-top:15px", numCols:1, items: [ {type:_OUTPUT_,value:ZaMsg.MSG_AUTOPROV_DLG_EAGER} ]} ] }; cases.push(case2); var case3={type:_ZATABCASE_, numCols:2,colSizes:["45px","*"], caseKey:_tab3, id:"auto_provision_config_lazy", getCustomWidth:ZaTaskAutoProvDialog.getCustomWidth, getCustomHeight:ZaTaskAutoProvDialog.getCustomHeight, items: [ {type: _SPACER_, height: 20 }, {ref:ZaDomain.A2_zimbraAutoProvModeLAZYEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvModeLAZY, subLabel:"", align:_RIGHT_, trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {type: _SPACER_, height: 20 }, {type:_GROUPER_, colSpan:"*", width: "100%",label:"Configuration", containerCssStyle: "padding-top:5px", colSizes:["200px","*"], numCols:2, items: [ {type:_GROUP_, numCols:2, label:ZaMsg.LBL_zimbraAutoProvAuthMech, labelLocation:_LEFT_, colSizes:["20px","150px"],labelCssStyle:"vertical-align:top", nowrap:false,labelWrap:true, enableDisableChecks:[[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeLAZYEnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeLAZYEnabled], items: [ {ref:ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvAuthMechLDAP, subLabel:"", trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {ref:ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvAuthMechPREAUTH, subLabel:"", trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {ref:ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvAuthMechKRB5, subLabel:"", trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ }, {ref:ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvAuthMechSPNEGO, subLabel:"", trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_ } ] } ]}, {type:_GROUPER_, colSpan:"*", width: "100%",label:"Note", containerCssStyle: "padding-top:15px", numCols:1, items: [ {type:_OUTPUT_,value:ZaMsg.MSG_AUTOPROV_DLG_LAZY} ]} ] }; cases.push(case3); var case4={type:_ZATABCASE_, numCols:2,colSizes:["45px","*"], caseKey:_tab4, id:"auto_provision_config_lazy", getCustomWidth:ZaTaskAutoProvDialog.getCustomWidth, getCustomHeight:ZaTaskAutoProvDialog.getCustomHeight, items: [ {type: _SPACER_, height: 20 }, {ref:ZaDomain.A2_zimbraAutoProvModeMANUALEnabled, type:_CHECKBOX_, label:ZaMsg.LBL_zimbraAutoProvModeMANUAL, subLabel:"", align:_RIGHT_, trueValue:"TRUE", falseValue:"FALSE",labelLocation:_RIGHT_, onChange: ZaTaskAutoProvDialog.onFormFieldChanged }, {type: _SPACER_, height: 20 }, {type:_GROUPER_, colSpan:"*", width: "100%",label:"Find & Provisioning", enableDisableChecks:[[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvModeMANUALEnabled,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvModeMANUALEnabled], containerCssStyle: "padding-top:5px", items: [ {type:_GROUP_, colSpan:2, numCols:3, width:"100%", colSizes:["180px","85px","180px"], cellspacing:"5px", items:[ {type:_TEXTFIELD_, cssClass:"admin_xform_name_input",width:"185px", ref:ZaSearch.A_query, label:null, elementChanged: function(elementValue,instanceValue, event) { var charCode = event.charCode; if (charCode == 13 || charCode == 3) { ZaTaskAutoProvDialog.srchButtonHndlr.call(this); } else { this.getForm().itemChanged(this, elementValue, event); } }, visibilityChecks:[],enableDisableChecks:[] }, {type:_DWT_BUTTON_, label:ZaMsg.DLXV_ButtonSearch, width:"80px", onActivate:ZaTaskAutoProvDialog.srchButtonHndlr,align:_CENTER_, enableDisableChecks:[[XForm.checkInstanceValue,ZaDomain.A2_zimbraAutoProvSearchActivated,"TRUE"]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvSearchActivated] }, {type:_OUTPUT_, value:ZaMsg.LBL_ManualProvAccount,visibilityChecks:[]}, {ref:ZaDomain.A2_zimbraAutoProvAccountPool, type:_DWT_LIST_, height:"180px", width:"180px", cssClass: "DLSource", widgetClass:ZaAccMiniListView, rowSpan:4, onSelection:ZaTaskAutoProvDialog.accPoolSelectionListener, visibilityChecks:[],enableDisableChecks:[] }, {type:_DWT_BUTTON_, label:AjxMsg.addAll, width:"80px", onActivate:ZaTaskAutoProvDialog.addAllButtonHndlr, enableDisableChecks:[[XForm.checkInstanceValueNotEmty,ZaDomain.A2_zimbraAutoProvAccountPool]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountPool] }, {ref: ZaDomain.A2_zimbraAutoProvAccountTargetPool, type:_DWT_LIST_, height:"180px", width:"180px", cssClass: "DLSource", widgetClass:ZaAccMiniListView, rowSpan:4, onSelection:ZaTaskAutoProvDialog.accTargetSelectionListener, visibilityChecks:[],enableDisableChecks:[] }, {type:_DWT_BUTTON_, label:AjxMsg.add, width:"80px", onActivate:ZaTaskAutoProvDialog.addButtonHndlr, enableDisableChecks:[[XForm.checkInstanceValueNotEmty,ZaDomain.A2_zimbraAutoProvAccountSrcSelectedPool]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountSrcSelectedPool] }, {type:_DWT_BUTTON_, label:AjxMsg.remove, width:"80px", onActivate:ZaTaskAutoProvDialog.removeButtonHndlr, enableDisableChecks:[[XForm.checkInstanceValueNotEmty,ZaDomain.A2_zimbraAutoProvAccountTgtSelectedPool]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountTgtSelectedPool] }, {type:_DWT_BUTTON_, label:AjxMsg.removeAll, width:"80px", onActivate:ZaTaskAutoProvDialog.removeAllButtonHndlr, enableDisableChecks:[[XForm.checkInstanceValueNotEmty,ZaDomain.A2_zimbraAutoProvAccountTargetPool]], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountTargetPool] }, {type:_GROUP_,numCols:3,colSizes:["90px","*","90px"], items:[ {type:_SPACER_, colSpan:3}, {type:_DWT_BUTTON_, label:ZaMsg.Previous, width:75, id:"backButton", icon:"LeftArrow", disIcon:"LeftArrowDis", onActivate:ZaTaskAutoProvDialog.backPoolButtonHndlr,align:_CENTER_, enableDisableChecks:[ZaTaskAutoProvDialog.backBtnEnabled], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountPoolPageNum,ZaDomain.A2_zimbraAutoProvSearchActivated] }, {type:_CELLSPACER_}, {type:_DWT_BUTTON_, label:ZaMsg.Next, width:75, id:"fwdButton", icon:"RightArrow", disIcon:"RightArrowDis", onActivate:ZaTaskAutoProvDialog.fwdPoolButtonHndlr,align:_CENTER_, enableDisableChecks:[ZaTaskAutoProvDialog .forwardBtnEnabled], enableDisableChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountPoolPageNum,ZaDomain.A2_zimbraAutoProvSearchActivated] } ] }, {type:_CELLSPACER_} ] } ]} ] }; cases.push(case4); var case5={type:_ZATABCASE_, numCols:1,width:"98%", caseKey:_tab5, id:"auto_provision_email_setting", getCustomWidth:ZaTaskAutoProvDialog.getCustomWidth, getCustomHeight:ZaTaskAutoProvDialog.getCustomHeight, items: [ {type: _SPACER_, height: 20 }, {type:_GROUPER_, colSpan:"*", width: "100%",label:ZaMsg.LBL_zimbraAutoProvConfiguration, containerCssStyle: "padding-top:5px", colSizes:["100px","auto"], numCols:2, items: [ {ref:ZaDomain.A_zimbraAutoProvNotificationSubject, type:_SUPER_TEXTFIELD_, colSpan:2, label:ZaMsg.LBL_zimbraAutoProvEmailSubject, labelLocation:_LEFT_, textFieldCssStyle:"width:300; margin-right:5", onChange:ZaTaskAutoProvDialog.onFormFieldChanged, resetToSuperLabel:ZaMsg.NAD_ResetToGlobal}, {ref:ZaDomain.A_zimbraAutoProvNotificationBody, type:_SUPER_TEXTAREA_, colSpan:2, label:ZaMsg.LBL_zimbraAutoProvEmailBody, labelLocation:_LEFT_, textAreaCssStyle:"width:300; margin-right:5", onChange:ZaTaskAutoProvDialog.onFormFieldChanged, resetToSuperLabel:ZaMsg.NAD_ResetToGlobal} ]} ] }; cases.push(case5); var xFormObject = { numCols:1, items:[ {type:_TAB_BAR_, ref:ZaModel.currentTab,choices:this.tabChoices,cssClass:"ZaTabBar", id:"xform_tabbar"}, {type:_SWITCH_, align:_LEFT_, valign:_TOP_, items:cases} ] }; return xFormObject; } ZaTaskAutoProvDialog.onFormFieldChanged = function (value, event, form) { var ref = this.getRefPath(); if (ref == ZaDomain.A_zimbraAutoProvNotificationSubject || ref == ZaDomain.A_zimbraAutoProvNotificationBody) { this.setInstanceValue(value); return; } var instance = this.getInstance(); instance[ZaDomain.A2_zimbraAutoProvSearchActivated] = "TRUE"; this.setInstanceValue(value); return value; } ZaTaskAutoProvDialog.prototype._forceApplyCallback = function() { this._applyButtonListener(); } ZaTaskAutoProvDialog.prototype._confirmPasswordSettingCallback = function() { if(this._confirmPasswordSettingDialog) this._confirmPasswordSettingDialog.popdown(); var obj = this.getObject(); if(obj[ZaDomain.A2_zimbraAutoProvAccountPasswordInDlg]) obj[ZaDomain.A2_zimbraAutoProvAccountPassword] = obj[ZaDomain.A2_zimbraAutoProvAccountPasswordInDlg] } ZaTaskAutoProvDialog.getCustomWidth = function() { return "100%"; } ZaTaskAutoProvDialog.getCustomHeight = function() { return "100%"; } ZaTaskAutoProvDialog.prototype._applyButtonListener = function() { if(this._forceApplyMessageDialog) this._forceApplyMessageDialog.popdown(); try { var controller = ZaApp.getInstance().getCurrentController(); if(this._checkGeneralConfig() && this._checkEagerConfig() && this._checkLazyConfig()) { var savedObj = this.getObject(); this._combineConfigureValues(savedObj); ZaDomain.modifyAutoPovSettings.call(this._containedObject,savedObj); controller._notifyAllOpenTabs(); if(savedObj.currentTab == 4) { if(this._checkManualConfig()) this.finishConfig(); else return; } this._button[DwtDialog.OK_BUTTON].setEnabled(false); this._button[ZaTaskAutoProvDialog.APPLY_BUTTON].setEnabled(false); this._backupLdapObj(savedObj); } } catch (ex) { ZaApp.getInstance().getCurrentController()._handleException(ex, "ZaTaskAutoProvDialog.prototype._applyButtonListener", null, false); } } ZaTaskAutoProvDialog.prototype._checkGeneralConfig = function() { var isError = false; var errorMsg = ""; if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapURL] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapURL] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapURL); } else if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapAdminBindDn); } else if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapAdminBindPassword); } else if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapSearchBase); } if(!isError && this._containedObject[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] == "TRUE") { if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapSearchFilter); } else if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvLdapBindDn); } } if(isError) { ZaApp.getInstance().getCurrentController().popupErrorDialog(errorMsg); return false; } else return true; } ZaTaskAutoProvDialog.prototype._checkEagerConfig = function() { var isError = false; var errorMsg = ""; if(!isError && this._containedObject[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] == "TRUE") { if(!this._containedObject.attrs[ZaDomain.A_zimbraAutoProvBatchSize] || this._containedObject.attrs[ZaDomain.A_zimbraAutoProvBatchSize] == "") { isError = true; errorMsg = AjxMessageFormat.format(ZaMsg.ERROR_AUTOPROV,ZaMsg.MSG_zimbraAutoProvBatchSize); } } if(isError) { ZaApp.getInstance().getCurrentController().popupErrorDialog(errorMsg); return false; } else return true; } ZaTaskAutoProvDialog.prototype._checkLazyConfig = function() { if(this._containedObject[ZaDomain.A2_zimbraAutoProvModeLAZYEnabled] == "TRUE" && (!this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled] || this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled] == "FALSE") && (!this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled] || this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled] == "FALSE") && (!this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled] || this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled] == "FALSE") && (!this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled] || this._containedObject[ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled] == "FALSE")) { ZaApp.getInstance().getCurrentController().popupErrorDialog(ZaMsg.ERROR_AUTOPROV_LAZYAUTH); return false; } else return true; } ZaTaskAutoProvDialog.prototype._checkManualConfig = function() { var attrMaps = this._containedObject.attrs[ZaDomain.A_zimbraAutoProvAttrMap]; var obj = this.getObject(); var isGiven = false; if(attrMaps) { if(!(attrMaps instanceof Array)) attrMaps = [attrMaps]; for(var i = 0; i < attrMaps.length && !isGiven; i ++ ) { var kv = attrMaps[i].split("="); if(kv.length > 0 && kv[0].indexOf("userPassword") == 0) isGiven = true; } } if(obj[ZaDomain.A2_zimbraAutoProvAccountPassword]) return true; else if(!isGiven) { if(!this._confirmPasswordSettingDialog) { var height = "220px" if (AjxEnv.isIE) { height = "245px"; } this._confirmPasswordSettingDialog = new ZaConfirmPasswordDialog(ZaApp.getInstance().getAppCtxt().getShell(), "450px", height, ZaMsg.DLG_TITILE_MANUAL_PROV); } this._confirmPasswordSettingDialog.registerCallback(DwtDialog.OK_BUTTON, ZaTaskAutoProvDialog.prototype._confirmPasswordSettingCallback, this, null); this._confirmPasswordSettingDialog.setObject(this._containedObject); this._confirmPasswordSettingDialog.popup(); } return isGiven; } ZaTaskAutoProvDialog.prototype._separateConfigureValues = function(entry) { if(entry.attrs[ZaDomain.A_zimbraAutoProvMode]) { if(entry.attrs[ZaDomain.A_zimbraAutoProvMode] instanceof Array) { for(var mode = 0; mode < entry.attrs[ZaDomain.A_zimbraAutoProvMode].length; mode ++){ if(entry.attrs[ZaDomain.A_zimbraAutoProvMode][mode] == "EAGER") entry[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvMode][mode] == "LAZY") entry[ZaDomain.A2_zimbraAutoProvModeLAZYEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvMode][mode] == "MANUAL") entry[ZaDomain.A2_zimbraAutoProvModeMANUALEnabled] = "TRUE"; } } else { if(entry.attrs[ZaDomain.A_zimbraAutoProvMode] == "EAGER") entry[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvMode] == "LAZY") entry[ZaDomain.A2_zimbraAutoProvModeLAZYEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvMode] == "MANUAL") entry[ZaDomain.A2_zimbraAutoProvModeMANUALEnabled] = "TRUE"; } } if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech]) { if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] instanceof Array) { for(var mode = 0; mode < entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech].length; mode ++){ if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech][mode] == "LDAP") entry[ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech][mode] == "PREAUTH") entry[ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech][mode] == "KRB5") entry[ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech][mode] == "SPNEGO") entry[ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled] = "TRUE"; } } else { if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] == "LDAP") entry[ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] == "PREAUTH") entry[ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] == "KRB5") entry[ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled] = "TRUE"; else if(entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] == "SPNEGO") entry[ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled] = "TRUE"; } } entry[ZaDomain.A2_zimbraAutoProvServerList] = ZaApp.getInstance().getServerList(true).getArray(); entry[ZaDomain.A2_zimbraAutoProvSelectedServerList] = new AjxVector (); for(var i = 0; i < entry[ZaDomain.A2_zimbraAutoProvServerList].length; i++) { var server = entry[ZaDomain.A2_zimbraAutoProvServerList][i]; var scheduledDomains = server.attrs[ZaServer.A_zimbraAutoProvScheduledDomains]; for(var j = 0; scheduledDomains && j < scheduledDomains.length; j++) { if(scheduledDomains[j] == entry.name) { entry[ZaDomain.A2_zimbraAutoProvSelectedServerList].add(server.name); server["checked"] = true; if(server.attrs[ZaServer.A_zimbraAutoProvPollingInterval]) entry[ZaDomain.A2_zimbraAutoProvPollingInterval] = server.attrs[ZaServer.A_zimbraAutoProvPollingInterval]; } } } } ZaTaskAutoProvDialog.prototype._combineConfigureValues = function(entry) { entry.attrs[ZaDomain.A_zimbraAutoProvMode] = []; if(entry[ZaDomain.A2_zimbraAutoProvModeEAGEREnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvMode].push("EAGER"); if(entry[ZaDomain.A2_zimbraAutoProvModeLAZYEnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvMode].push("LAZY"); if(entry[ZaDomain.A2_zimbraAutoProvModeMANUALEnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvMode].push("MANUAL"); entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech] = []; if(entry[ZaDomain.A2_zimbraAutoProvAuthMechLDAPEnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech].push("LDAP"); if(entry[ZaDomain.A2_zimbraAutoProvAuthMechPREAUTHEnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech].push("PREAUTH"); if(entry[ZaDomain.A2_zimbraAutoProvAuthMechKRB5Enabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech].push("KRB5"); if(entry[ZaDomain.A2_zimbraAutoProvAuthMechSPNEGOEnabled] == "TRUE") entry.attrs[ZaDomain.A_zimbraAutoProvAuthMech].push("SPNEGO"); } ZaTaskAutoProvDialog.prototype._backupLdapObj = function(entry) { if(!this._autoprovLdapObject) this._autoprovLdapObject = {}; if(!entry || !entry.attrs) return; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapURL]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapURL] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapURL]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapURL] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapSearchBase] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapSearchBase] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapSearchFilter] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapSearchFilter] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapBindDn] = entry.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvLdapBindDn] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvNotificationSubject]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvNotificationSubject] = entry.attrs[ZaDomain.A_zimbraAutoProvNotificationSubject]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvNotificationSubject] = null; if(entry.attrs[ZaDomain.A_zimbraAutoProvNotificationBody]) this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvNotificationBody] = entry.attrs[ZaDomain.A_zimbraAutoProvNotificationBody]; else this._autoprovLdapObject[ZaDomain.A_zimbraAutoProvNotificationBody] = null; } ZaTaskAutoProvDialog.prototype._checkModified = function() { var newObj = this.getObject(); var oldObj = this._autoprovLdapObject; if((oldObj[ZaDomain.A_zimbraAutoProvLdapURL] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapURL] || !oldObj[ZaDomain.A_zimbraAutoProvLdapURL] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapURL]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled] || !oldObj[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapStartTlsEnabled]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] || !oldObj[ZaDomain.A_zimbraAutoProvLdapAdminBindDn] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindDn]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] || !oldObj[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapAdminBindPassword]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapSearchBase] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase] || !oldObj[ZaDomain.A_zimbraAutoProvLdapSearchBase] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapSearchBase]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapSearchFilter] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter] || !oldObj[ZaDomain.A_zimbraAutoProvLdapSearchFilter] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapSearchFilter]) && (oldObj[ZaDomain.A_zimbraAutoProvLdapBindDn] == newObj.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn] || !oldObj[ZaDomain.A_zimbraAutoProvLdapBindDn] && !newObj.attrs[ZaDomain.A_zimbraAutoProvLdapBindDn]) && (oldObj[ZaDomain.A_zimbraAutoProvNotificationSubject] == newObj.attrs[ZaDomain.A_zimbraAutoProvNotificationSubject] || !oldObj[ZaDomain.A_zimbraAutoProvNotificationSubject] && !newObj.attrs[ZaDomain.A_zimbraAutoProvNotificationSubject]) && (oldObj[ZaDomain.A_zimbraAutoProvNotificationBody] == newObj.attrs[ZaDomain.A_zimbraAutoProvNotificationBody] || !oldObj[ZaDomain.A_zimbraAutoProvNotificationBody] && !newObj.attrs[ZaDomain.A_zimbraAutoProvNotificationBody])) return false; else return true; } ZaTaskAutoProvDialog.prototype.tabClickHandler = function() { if(this.getObject().currentTab != this.TAB_STEP_MANUAL) return; if(this._checkModified()) { var dlgMsg = ZaMsg.MSG_LDAP_CHANGED; this._forceApplyMessageDialog.setMessage(dlgMsg, DwtMessageDialog.INFO_STYLE); this._forceApplyMessageDialog.popup(); } } /////////////////// ZaTaskAutoProvDialog.srchButtonHndlr = function() { var instance = this.getForm().getInstance(); var formParent = this.getForm().parent; if(!formParent._checkGeneralConfig()) return; var soapDoc = AjxSoapDoc.create("SearchAutoProvDirectoryRequest", ZaZimbraAdmin.URN, null); soapDoc.getMethod().setAttribute("keyAttr","name"); var attr = soapDoc.set("domain", instance.id); attr.setAttribute("by", "id"); var query = "(|(mail=*)(zimbraMailAlias=*)(uid=*))"; if(instance[ZaSearch.A_query]) { query = ZaSearch.getSearchByNameQuery (instance[ZaSearch.A_query]); } soapDoc.set("query", query); var limit = ZaSettings.RESULTSPERPAGE; if(!instance[ZaDomain.A2_zimbraAutoProvAccountPoolPageNum]) { instance[ZaDomain.A2_zimbraAutoProvAccountPoolPageNum] = 0; } var offset = instance[ZaDomain.A2_zimbraAutoProvAccountPoolPageNum]*ZaSettings.RESULTSPERPAGE; var attrs = [ZaAccount.A_name, ZaAccount.A_mail, ZaItem.A_zimbraId,ZaAccount.A_displayname].join(","); soapDoc.getMethod().setAttribute("keyAttr","name"); soapDoc.getMethod().setAttribute("offset", offset); soapDoc.getMethod().setAttribute("limit", limit); soapDoc.getMethod().setAttribute("attrs", attrs); soapDoc.getMethod().setAttribute("refresh", "1"); this.getModel().setInstanceValue(this.getInstance(),ZaDomain.A2_zimbraAutoProvSearchActivated,"FALSE"); var params = {}; params.soapDoc = soapDoc; params.asyncMode = false; var reqMgrParams = { controller : ZaApp.getInstance().getCurrentController(), busyMsg : ZaMsg.BUSY_AUTOPROV_GETACCT } try { var resp = ZaRequestMgr.invoke(params, reqMgrParams); this.getModel().setInstanceValue(this.getInstance(),ZaDomain.A2_zimbraAutoProvSearchActivated,"TRUE"); if(!resp || resp.Body.SearchAutoProvDirectoryResponse.Fault) return; if(!resp.Body.SearchAutoProvDirectoryResponse || !resp.Body.SearchAutoProvDirectoryResponse.entry) return; var provAcctList = []; var objs = resp.Body.SearchAutoProvDirectoryResponse.entry; var searchTotal = resp.Body.SearchAutoProvDirectoryResponse.searchTotal; for(var i = 0; objs && i < objs.length; i++) { var obj = objs[i]; var acct = new Object(); acct.dn = obj.dn; var len = obj.a.length; acct.attrs = new Array(); for(var ix = 0; ix < len; ix ++) { if(!acct.attrs[[obj.a[ix].n]]) { acct.attrs[[obj.a[ix].n]] = obj.a[ix]._content; } else { if(!(acct.attrs[[obj.a[ix].n]] instanceof Array)) { acct.attrs[[obj.a[ix].n]] = [acct.attrs[[obj.a[ix].n]]]; } acct.attrs[[obj.a[ix].n]].push(obj.a[ix]._content); } } acct.name = acct.attrs[ZaAccount.A_mail]; provAcctList.push(acct); } this.getModel().setInstanceValue(this.getInstance(),ZaDomain.A2_zimbraAutoProvAccountPool,provAcctList); var poolTotalPages = Math.ceil(searchTotal/ZaSettings.RESULTSPERPAGE); this.getModel().setInstanceValue(this.getInstance(),ZaDomain.A2_zimbraAutoProvAccountPoolPageTotal,poolTotalPages); } catch(ex) { ZaApp.getInstance().getCurrentController()._handleException(ex, "ZaTaskAutoProvDialog.srchButtonHndlr", null, false); } } ZaTaskAutoProvDialog.accPoolSelectionListener = function() { var arr = this.widget.getSelection(); if(arr && arr.length) { arr.sort(); this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountSrcSelectedPool, arr); } else { this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountSrcSelectedPool, null); } } ZaTaskAutoProvDialog.addButtonHndlr = function (ev) { var form = this.getForm(); var instance = form.getInstance(); var sourceListItems = form.getItemsById(ZaDomain.A2_zimbraAutoProvAccountPool); if(sourceListItems && (sourceListItems instanceof Array) && sourceListItems[0] && sourceListItems[0].widget) { var selection = sourceListItems[0].widget.getSelection(); var currentTargetList = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] ? instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] : []; var list = (selection instanceof AjxVector) ? selection.getArray() : (selection instanceof Array) ? selection : [selection]; if(list) { list.sort(ZaItem.compareNamesDesc); var tmpTargetList = []; var cnt2 = currentTargetList.length; for(var i=0;i<cnt2;i++) tmpTargetList.push(currentTargetList[i]); tmpTargetList.sort(ZaItem.compareNamesDesc); var tmpList = []; var cnt = list.length; for(var i=cnt-1; i>=0; i--) { var dup = false; cnt2 = tmpTargetList.length; for(var j = cnt2-1; j >=0; j--) { if(list[i].name==tmpTargetList[j].name) { dup=true; tmpTargetList.splice(j,cnt2-j); break; } } if(!dup) { currentTargetList.push(list[i]) } } this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountTargetPool, currentTargetList); } } if(currentTargetList.length > 0) { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(true); } else { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(false); } } ZaTaskAutoProvDialog.accTargetSelectionListener = function() { var arr = this.widget.getSelection(); if(arr && arr.length) { arr.sort(); this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountTgtSelectedPool, arr); } else { this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountTgtSelectedPool, null); } } ZaTaskAutoProvDialog.addAllButtonHndlr = function (ev) { var form = this.getForm(); var instance = form.getInstance(); var oldArr = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] ? instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] : []; var arr = instance[ZaDomain.A2_zimbraAutoProvAccountPool]; var arr2 = new Array(); if(arr) { var cnt = arr.length; var oldCnt = oldArr.length; for(var ix=0; ix< cnt; ix++) { var found = false; for(var j = oldCnt-1;j>=0;j-- ) { if(oldArr[j].name == arr[ix].name) { found = true; break; } } if(!found) arr2.push(arr[ix]); } } arr2 = arr2.concat(oldArr); this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountTargetPool, arr2); //this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountPool, new Array()); var instance = form.getInstance(); var currentTargetList = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] ? instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] : []; if(currentTargetList.length > 0) { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(true); } else { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(false); } } ZaTaskAutoProvDialog.removeButtonHndlr = function (ev) { var form = this.getForm(); var instance = form.getInstance(); var targetListItems = form.getItemsById(ZaDomain.A2_zimbraAutoProvAccountTargetPool); if(targetListItems && (targetListItems instanceof Array) && targetListItems[0] && targetListItems[0].widget) { var selection = targetListItems[0].widget.getSelection(); var currentTargetList = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] ? instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] : []; currentTargetList.sort(ZaItem.compareNamesDesc); var tmpTargetList = []; var list = (selection instanceof AjxVector) ? selection.getArray() : (selection instanceof Array) ? selection : [selection]; if(list) { list.sort(ZaItem.compareNamesDesc); var cnt = list.length; var cnt2 = currentTargetList.length; for(var i=0;i<cnt2;i++) tmpTargetList.push(currentTargetList[i]); for(var i=cnt-1; i>=0; i--) { var cnt2 = tmpTargetList.length; for(var j = cnt2-1; j >=0; j--) { if(list[i].name==tmpTargetList[j].name) { currentTargetList.splice(j,1); tmpTargetList.splice(j,cnt2-j); } } } this.getModel().setInstanceValue(this.getInstance(), ZaDomain.A2_zimbraAutoProvAccountTargetPool, currentTargetList); } } if(currentTargetList.length > 0) { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(true); } else { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(false); } } ZaTaskAutoProvDialog.removeAllButtonHndlr = function (ev) { var form = this.getForm(); var instance = form.getInstance(); instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] = new Array(); var currentTargetList = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] ? instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool] : []; if(currentTargetList.length > 0) { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(true); } else { form.parent._button[DwtDialog.OK_BUTTON].setEnabled(false); } this.getForm().setInstance(instance); } ZaTaskAutoProvDialog.backPoolButtonHndlr = function(evt) { var currentPageNum = parseInt(this.getInstanceValue("/poolPagenum"))-1; this.setInstanceValue(currentPageNum,"/poolPagenum"); ZaTaskAutoProvDialog.srchButtonHndlr.call(this, evt); } ZaTaskAutoProvDialog.fwdPoolButtonHndlr = function(evt) { var currentPageNum = parseInt(this.getInstanceValue("/poolPagenum")); this.setInstanceValue(currentPageNum+1,"/poolPagenum"); ZaTaskAutoProvDialog.srchButtonHndlr.call(this, evt); } ZaTaskAutoProvDialog.forwardBtnEnabled = function () { return (parseInt(this.getInstanceValue(ZaDomain.A2_zimbraAutoProvAccountPoolPageNum)) < (parseInt(this.getInstanceValue(ZaDomain.A2_zimbraAutoProvAccountPoolPageTotal))-1) && this.getInstanceValue(ZaDomain.A2_zimbraAutoProvSearchActivated)=="TRUE"); }; ZaTaskAutoProvDialog.backBtnEnabled = function () { return (parseInt(this.getInstanceValue(ZaDomain.A2_zimbraAutoProvAccountPoolPageNum)) > 0 && this.getInstanceValue(ZaDomain.A2_zimbraAutoProvSearchActivated)== "TRUE"); }; ZaTaskAutoProvDialog.prototype.finishConfig = function () { var instance = this.getObject(); var acctlist = instance[ZaDomain.A2_zimbraAutoProvAccountTargetPool];//this.getModel().getInstanceValue(instance,ZaDomain.A2_zimbraAutoProvAccountTargetPool); if(!acctlist || acctlist.length < 1) return; var soapDoc = AjxSoapDoc.create("BatchRequest", "urn:zimbra"); soapDoc.setMethodAttribute("onerror", "continue"); for(var i = 0; i < acctlist.length; i++) { var autoProvDoc = soapDoc.set("AutoProvAccountRequest", null, null, ZaZimbraAdmin.URN); var attr = soapDoc.set("domain", instance.id, autoProvDoc); attr.setAttribute("by", "id"); attr = soapDoc.set("principal", acctlist[i].dn, autoProvDoc); attr.setAttribute("by", "dn"); if(instance[ZaDomain.A2_zimbraAutoProvAccountPassword]) { attr = soapDoc.set("password", instance[ZaDomain.A2_zimbraAutoProvAccountPassword], autoProvDoc); } } var params = new Object(); params.soapDoc = soapDoc; var reqMgrParams ={ controller:ZaApp.getInstance().getCurrentController(), busyMsg : ZaMsg.BUSY_CREATING_GALDS, showBusy:true } ZaRequestMgr.invoke(params, reqMgrParams); } ZaTaskAutoProvDialog.filterSelectionListener = function (value) { var targetEl = value.target ; if (targetEl.type && targetEl.type == "checkbox") { var item = targetEl.value ; var form = this.getForm (); var instance = form.getInstance (); var checkedFiltersVector = null ; checkedFiltersVector = instance[ZaDomain.A2_zimbraAutoProvSelectedServerList]; if (targetEl.checked) { checkedFiltersVector.remove(item); }else{ checkedFiltersVector.add(item); } } } ///////////////////////////// ZaServerOptionList = function(parent,className) { DwtListView.call(this, parent, null);//, Dwt.ABSOLUTE_STYLE); } ZaServerOptionList.prototype = new DwtListView; ZaServerOptionList.prototype.constructor = ZaServerOptionList; ZaServerOptionList.prototype.toString = function() { return "ZaServerOptionList"; } ZaServerOptionList.prototype._createItemHtml = function(item, params, asHtml, count) { var html = new Array(10); var div = document.createElement("div"); div[DwtListView._STYLE_CLASS] = "Row"; div[DwtListView._SELECTED_STYLE_CLASS] = div[DwtListView._STYLE_CLASS] + "-" + DwtCssStyle.SELECTED; div.className = div[DwtListView._STYLE_CLASS]; this.associateItemWithElement(item, div, DwtListView.TYPE_LIST_ITEM); var idx = 0; var checked = ""; if(item.checked) checked = "checked"; html[idx++] = "<table width='100%' cellspacing='0' cellpadding='0' ><tr><td width=20>" if(this.initializeDisable) html[idx++] = "<input id='"+this._htmlElId+"_schedule_"+count+"' disabled type=checkbox value='" + item + "' " + checked + "/></td>" ; else html[idx++] = "<input id='"+this._htmlElId+"_schedule_"+count+"' type=checkbox value='" + item + "' " + checked + "/></td>" ; html[idx++] = "<td>"+ item + "</td></tr></table>"; div.innerHTML = html.join(""); return div; } ///////////////////////////// ZaConfirmPasswordDialog = function(parent, w, h, title) { if (arguments.length == 0) return; this._standardButtons = [DwtDialog.OK_BUTTON, DwtDialog.CANCEL_BUTTON]; ZaXDialog.call(this, parent, null, title, w, h, null, ZaId.DLG_AUTPROV_MANUAL_PWD); this._containedObject = {}; this.initForm(ZaAlias.myXModel,this.getMyXForm()); this._helpURL = ZaConfirmPasswordDialog.helpURL; this._localXForm.addListener(DwtEvent.XFORMS_FORM_DIRTY_CHANGE, new AjxListener(this, ZaConfirmPasswordDialog.prototype.handleXFormChange)); } ZaConfirmPasswordDialog.prototype = new ZaXDialog; ZaConfirmPasswordDialog.prototype.constructor = ZaConfirmPasswordDialog; ZaConfirmPasswordDialog.helpURL = location.pathname + ZaUtil.HELP_URL + "managing_domain/autoprov_manual_config.htm?locid="+AjxEnv.DEFAULT_LOCALE; ZaConfirmPasswordDialog.prototype.popup = function(loc){ ZaXDialog.prototype.popup.call(this, loc); //this._button[DwtDialog.OK_BUTTON].setEnabled(false); //if we don't allow empty password, should switch to this this._button[DwtDialog.OK_BUTTON].setEnabled(true); this._localXForm.setInstanceValue(false, ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning); } ZaConfirmPasswordDialog.prototype.handleXFormChange = function ( ) { var xformObj = this._localXForm; if(!xformObj || xformObj.hasErrors() || !xformObj.getInstance()){ return; } var pw = xformObj.getInstanceValue(ZaDomain.A2_zimbraAutoProvAccountPasswordInDlg); var pwAgain = xformObj.getInstanceValue(ZaDomain.A2_zimbraAutoProvAccountPasswordAgainInDlg); if (pw == pwAgain){ xformObj.setInstanceValue(false, ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning); this._button[DwtDialog.OK_BUTTON].setEnabled(true); } else { var is1stTime = AjxUtil.isEmpty(pwAgain); //we show the warning msg until user start to input pwAgain xformObj.setInstanceValue(!is1stTime, ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning); this._button[DwtDialog.OK_BUTTON].setEnabled(false); } } ZaConfirmPasswordDialog.prototype.getMyXForm = function() { var xFormObject = { items:[ {type:_GROUP_, numCols:2, colSizes:["200px","*"], colSpan:"*", items: [ {type:_DWT_ALERT_, style:DwtAlert.WARNING, iconVisible:true, content:ZaMsg.MSG_AUTOPROV_MANUAL_PASSSET, width:"100%", colSpan:"*" }, {type:_SPACER_, height:10, colSpan:"*"}, { ref:ZaDomain.A2_zimbraAutoProvAccountPasswordInDlg, type:_SECRET_, msgName:ZaMsg.LBL_provisionedAccountPassword, label:ZaMsg.LBL_provisionedAccountPassword, labelLocation:_LEFT_, width:"190px", cssClass:"admin_xform_name_input" }, {type:_SPACER_, height:10, colSpan:"*"}, { ref:ZaDomain.A2_zimbraAutoProvAccountPasswordAgainInDlg, type:_SECRET_, msgName:ZaMsg.NAD_ConfirmPassword, label:ZaMsg.NAD_ConfirmPassword, labelLocation:_LEFT_, width:"190px", cssClass:"admin_xform_name_input" }, { ref:ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning, type:_DWT_ALERT_, style: DwtAlert.CRITICAL, iconVisible: false, label:"", labelLocation:_LEFT_, width:"180px", colSpan:"1", content: ZaMsg.ERROR_PASSWORD_MISMATCH, visibilityChecks:[[XForm.checkInstanceValue, ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning, true]], visibilityChangeEventSources:[ZaDomain.A2_zimbraAutoProvAccountPasswordUnmatchedWarning] } ] } ] }; return xFormObject; } ///////////////////////////// ZaServerOptionList.prototype.setEnabled = function(enabled) { DwtListView.prototype.setEnabled.call(this, enabled); // this.initializeDisable=!enabled; if(!AjxUtil.isEmpty(this._list)){ for(var i=0;i<this._list.size();i++){ document.getElementById(this._htmlElId+"_schedule_"+i).disabled=!enabled; } } }
50.660819
208
0.673142
6a2125d2182414108973927c14961e84c3bfeab0
1,659
js
JavaScript
packages/@vueneue/ssr-core/utils/hmr.js
vueneue/vueneue
3319f4ce9afa0229e0e6338bb0e7a43125e0aa33
[ "MIT" ]
114
2018-06-30T16:49:22.000Z
2021-05-07T15:58:29.000Z
packages/@vueneue/ssr-core/utils/hmr.js
vueneue/vueneue
3319f4ce9afa0229e0e6338bb0e7a43125e0aa33
[ "MIT" ]
58
2018-07-06T11:14:22.000Z
2019-08-06T14:12:33.000Z
packages/@vueneue/ssr-core/utils/hmr.js
vueneue/vueneue
3319f4ce9afa0229e0e6338bb0e7a43125e0aa33
[ "MIT" ]
17
2018-07-03T14:23:28.000Z
2019-08-06T13:48:09.000Z
import errorHandler from './errorHandler'; import { handleMiddlewares } from './middlewares'; import { applyAsyncData, sanitizeComponent } from './asyncData'; import { getContext } from './context'; const findAsyncDataComponents = (parent, components = []) => { for (const child of parent.$children) { if (child.$vnode.data.routerView) { components.push(child); } if (child.$children.length) { findAsyncDataComponents(child, components); } } return components; }; export const addHotReload = context => { if (!module.hot) return; const { app, router } = context; const components = findAsyncDataComponents(app); for (const depth in components) { const component = components[depth]; const _forceUpdate = component.$forceUpdate.bind(component.$parent); component.$vnode.context.$forceUpdate = async () => { const routeComponents = router.getMatchedComponents(router.currentRoute); const Component = sanitizeComponent(routeComponents[depth]); try { if (Component && Component.options.asyncData) { const data = await Component.options.asyncData(getContext(context)); applyAsyncData(Component, data); } } catch (err) { component.$error(err); } return _forceUpdate(); }; } }; export const handleHMRMiddlewares = async context => { onHotReload(() => { handleMiddlewares(context).catch(error => errorHandler(context, { error })); }); }; const onHotReload = callback => { if (process.client && module.hot) { module.hot.addStatusHandler(status => { if (status === 'idle') callback(); }); } };
28.118644
80
0.65642
6a218efa0fbe523c5abd87e36d22f57a137699d5
352
js
JavaScript
cli.js
markdalgleish/lanyrd-doorprize
9347086ef03cd741b187b9fa45926c7335cc024b
[ "MIT" ]
null
null
null
cli.js
markdalgleish/lanyrd-doorprize
9347086ef03cd741b187b9fa45926c7335cc024b
[ "MIT" ]
null
null
null
cli.js
markdalgleish/lanyrd-doorprize
9347086ef03cd741b187b9fa45926c7335cc024b
[ "MIT" ]
null
null
null
#!/usr/bin/env node var doorprize = require('./'); var opn = require('opn'); var args = process.argv.splice(2); doorprize(args[0], function(err, winner) { if (err) { process.stdout.write(err + '\n'); return; } if (args[1] === '-o' || args[1] === '--open') { opn(winner); } else { process.stdout.write(winner + '\n'); } });
18.526316
49
0.545455
6a21d0beb3daaafd5f4fa7ceeee49facb3cdcb40
5,548
js
JavaScript
web/test/WebWorldWind/src/util/Font.js
ShadowEditor/ShadowEditor
ea50677544ea7573e3c1fe6c77fef07eb3e19e39
[ "MIT" ]
1
2022-03-24T09:14:39.000Z
2022-03-24T09:14:39.000Z
web/test/WebWorldWind/src/util/Font.js
ShadowEditor/ShadowEditor
ea50677544ea7573e3c1fe6c77fef07eb3e19e39
[ "MIT" ]
null
null
null
web/test/WebWorldWind/src/util/Font.js
ShadowEditor/ShadowEditor
ea50677544ea7573e3c1fe6c77fef07eb3e19e39
[ "MIT" ]
null
null
null
/* * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the * National Aeronautics and Space Administration. All rights reserved. * * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @exports Font */ import Color from '../util/Color'; /** * Construct a font descriptor. See the individual attribute descriptions below for possible parameter values. * @param {Number} size The size of font. * @param {String} style The style of the font. * @param {String} variant The variant of the font. * @param {String} weight The weight of the font. * @param {String} family The family of the font. * @param {String} horizontalAlignment The vertical alignment of the font. * @alias Font * @constructor * @classdesc Holds attributes controlling the style, size and other attributes of {@link Text} shapes and * the textual features of {@link Placemark} and other shapes. The values used for these attributes are those * defined by the [CSS Font property]{@link http://www.w3schools.com/cssref/pr_font_font.asp}. */ function Font(size, style, variant, weight, family, horizontalAlignment) { /* * All properties of Font are intended to be private and must be accessed via public getters and setters. */ if(size > 0) { this._size = size; } this.style = style || "normal"; this.variant = variant || "normal"; this.weight = weight || "normal"; this.family = family || "sans-serif"; this.horizontalAlignment = horizontalAlignment || "center"; } Object.defineProperties(Font.prototype, { /** * The font size. * @memberof Font.prototype * @type Number */ size: { get: function () { return this._size; }, set: function (value) { this._fontString = null; this._size = value; } }, /** * The font style. * See [CSS font-style]{@link http://www.w3schools.com/cssref/pr_font_font-style.asp} for defined values. * @memberof Font.prototype * @type {String} * @default "normal" */ style: { get: function () { return this._style; }, set: function (value) { this._fontString = null; this._style = value; } }, /** * The font variant. * See [CSS font-variant]{@link http://www.w3schools.com/cssref/pr_font_font-variant.asp} for defined values. * @memberof Font.prototype * @type {String} * @default "normal" */ variant: { get: function () { return this._variant; }, set: function (value) { this._fontString = null; this._variant = value; } }, /** * The font weight. * See [CSS font-weight]{@link http://www.w3schools.com/cssref/pr_font_weight.asp} for defined values. * @memberof Font.prototype * @type {String} * @default "normal" */ weight: { get: function () { return this._weight; }, set: function (value) { this._fontString = null; this._weight = value; } }, /** * The font family. * See [CSS font-family]{@link http://www.w3schools.com/cssref/pr_font_font-family.asp} for defined values. * @memberof Font.prototype * @type {String} * @default "sans-serif" */ family: { get: function () { return this._family; }, set: function (value) { this._fontString = null; this._family = value; } }, /** * The horizontal alignment of the font. * Recognized values are "left", "center" and "right". * @memberof Font.prototype * @type {String} * @default "center" */ horizontalAlignment: { get: function () { return this._horizontalAlignment; }, set: function (value) { this._toString = null; this._horizontalAlignment = value; } }, /** * A string representing this font's style, weight, size and family properties, suitable for * passing directly to a 2D canvas context. * @memberof Font.prototype */ fontString: { get: function () { if (!this._fontString) { this._fontString = this._style + " " + this.variant + " " + this._weight + " " + this._size.toString() + "px " + this._family; } return this._fontString; } } }); /** * Returns a string representation of this object. * @returns {String} A string representation of this object. */ Font.prototype.toString = function () { if (!this._toString || !this._fontString) { this._toString = this.fontString + " " + this.horizontalAlignment; } return this._toString; }; export default Font;
30.822222
113
0.593187
6a21e474fe59190486cd5e963acfd4f69db18b7d
15,475
js
JavaScript
appengine/monorail/static_src/shared/typedef.js
allaparthi/monorail
e18645fc1b952a5a6ff5f06e0c740d75f1904473
[ "BSD-3-Clause" ]
null
null
null
appengine/monorail/static_src/shared/typedef.js
allaparthi/monorail
e18645fc1b952a5a6ff5f06e0c740d75f1904473
[ "BSD-3-Clause" ]
null
null
null
appengine/monorail/static_src/shared/typedef.js
allaparthi/monorail
e18645fc1b952a5a6ff5f06e0c740d75f1904473
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @fileoverview Shared file for specifying common types used in type * annotations across Monorail. */ // TODO(zhangtiff): Find out if there's a way we can generate typedef's for // API object from .proto files. /** * Types used in the app that don't come from any Proto files. */ /** * A HotlistItem with the Issue flattened into the top-level, * containing the intersection of the fields of HotlistItem and Issue. * * @typedef {Issue & HotlistItem} HotlistIssue * @property {User=} adder */ /** * A String containing the data necessary to identify an IssueRef. An IssueRef * can reference either an issue in Monorail or an external issue in another * tracker. * * Examples of valid IssueRefStrings: * - monorail:1234 * - chromium:1 * - 1234 * - b/123456 * * @typedef {string} IssueRefString */ /** * An Object for specifying what to display in a single entry in the * dropdown list. * * @typedef {Object} MenuItem * @property {string=} text The text to display in the menu. * @property {string=} icon A Material Design icon shown left of the text. * @property {Array<MenuItem>=} items A specification for a nested submenu. * @property {function=} handler An optional click handler for an item. * @property {string=} url A link for the menu item to navigate to. */ /** * An Object containing the metadata associated with tracking async requests * through Redux. * * @typedef {Object} ReduxRequestState * @property {boolean=} requesting Whether a request is in flight. * @property {Error=} error An Error Object returned by the request. */ /** * Resource names used in our resource-oriented API. * @see https://aip.dev/122 */ /** * Resource name of a Project. * * Examples of valid Project resource names: * - projects/monorail * - projects/test-project-1 * * @typedef {string} ProjectName */ /** * Resource name of a User. * * Examples of valid User resource names: * - users/test@example.com * - users/1234 * * @typedef {string} UserName */ /** * Resource name of a ProjectMember. * * Examples of valid ProjectMember resource names: * - projects/monorail/members/1234 * - projects/test-xyz/members/5678 * * @typedef {string} ProjectMemberName */ /** * Types defined in common.proto. */ /** * A ComponentRef Object returned by the pRPC API common.proto. * * @typedef {Object} ComponentRef * @property {string} path * @property {boolean=} isDerived */ /** * An Enum representing the type that a custom field uses. * * @typedef {string} FieldType */ /** * A FieldRef Object returned by the pRPC API common.proto. * * @typedef {Object} FieldRef * @property {number} fieldId * @property {string} fieldName * @property {FieldType} type * @property {string=} approvalName */ /** * A LabelRef Object returned by the pRPC API common.proto. * * @typedef {Object} LabelRef * @property {string} label * @property {boolean=} isDerived */ /** * A StatusRef Object returned by the pRPC API common.proto. * * @typedef {Object} StatusRef * @property {string} status * @property {boolean=} meansOpen * @property {boolean=} isDerived */ /** * An IssueRef Object returned by the pRPC API common.proto. * * @typedef {Object} IssueRef * @property {string=} projectName * @property {number=} localId * @property {string=} extIdentifier */ /** * A UserRef Object returned by the pRPC API common.proto. * * @typedef {Object} UserRef * @property {string=} displayName * @property {number=} userId */ /** * A HotlistRef Object returned by the pRPC API common.proto. * * @typedef {Object} HotlistRef * @property {string=} name * @property {UserRef=} owner */ /** * A SavedQuery Object returned by the pRPC API common.proto. * * @typedef {Object} SavedQuery * @property {number} queryId * @property {string} name * @property {string} query * @property {Array<string>} projectNames */ /** * Types defined in issue_objects.proto. */ /** * An Approval Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} Approval * @property {FieldRef} fieldRef * @property {Array<UserRef>} approverRefs * @property {ApprovalStatus} status * @property {number} setOn * @property {UserRef} setterRef * @property {PhaseRef} phaseRef */ /** * An Enum representing the status of an Approval. * * @typedef {string} ApprovalStatus */ /** * An Amendment Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} Amendment * @property {string} fieldName * @property {string} newOrDeltaValue * @property {string} oldValue */ /** * An Attachment Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} Attachment * @property {number} attachmentId * @property {string} filename * @property {number} size * @property {string} contentType * @property {boolean} isDeleted * @property {string} thumbnailUrl * @property {string} viewUrl * @property {string} downloadUrl */ /** * A Comment Object returned by the pRPC API issue_objects.proto. * * Note: This Object is called "Comment" in the backend but is named * "IssueComment" here to avoid a collision with an internal JSDoc Intellisense * type. * * @typedef {Object} IssueComment * @property {string} projectName * @property {number} localId * @property {number=} sequenceNum * @property {boolean=} isDeleted * @property {UserRef=} commenter * @property {number=} timestamp * @property {string=} content * @property {string=} inboundMessage * @property {Array<Amendment>=} amendments * @property {Array<Attachment>=} attachments * @property {FieldRef=} approvalRef * @property {number=} descriptionNum * @property {boolean=} isSpam * @property {boolean=} canDelete * @property {boolean=} canFlag */ /** * A FieldValue Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} FieldValue * @property {FieldRef} fieldRef * @property {string} value * @property {boolean=} isDerived * @property {PhaseRef=} phaseRef */ /** * An Issue Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} Issue * @property {string} projectName * @property {number} localId * @property {string=} summary * @property {StatusRef=} statusRef * @property {UserRef=} ownerRef * @property {Array<UserRef>=} ccRefs * @property {Array<LabelRef>=} labelRefs * @property {Array<ComponentRef>=} componentRefs * @property {Array<IssueRef>=} blockedOnIssueRefs * @property {Array<IssueRef>=} blockingIssueRefs * @property {Array<IssueRef>=} danglingBlockedOnRefs * @property {Array<IssueRef>=} danglingBlockingRefs * @property {IssueRef=} mergedIntoIssueRef * @property {Array<FieldValue>=} fieldValues * @property {boolean=} isDeleted * @property {UserRef=} reporterRef * @property {number=} openedTimestamp * @property {number=} closedTimestamp * @property {number=} modifiedTimestamp * @property {number=} componentModifiedTimestamp * @property {number=} statusModifiedTimestamp * @property {number=} ownerModifiedTimestamp * @property {number=} starCount * @property {boolean=} isSpam * @property {number=} attachmentCount * @property {Array<Approval>=} approvalValues * @property {Array<PhaseDef>=} phases */ /** * A IssueDelta Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} IssueDelta * @property {string=} status * @property {UserRef=} ownerRef * @property {Array<UserRef>=} ccRefsAdd * @property {Array<UserRef>=} ccRefsRemove * @property {Array<ComponentRef>=} compRefsAdd * @property {Array<ComponentRef>=} compRefsRemove * @property {Array<LabelRef>=} labelRefsAdd * @property {Array<LabelRef>=} labelRefsRemove * @property {Array<FieldValue>=} fieldValsAdd * @property {Array<FieldValue>=} fieldValsRemove * @property {Array<FieldRef>=} fieldsClear * @property {Array<IssueRef>=} blockedOnRefsAdd * @property {Array<IssueRef>=} blockedOnRefsRemove * @property {Array<IssueRef>=} blockingRefsAdd * @property {Array<IssueRef>=} blockingRefsRemove * @property {IssueRef=} mergedIntoRef * @property {string=} summary */ /** * An PhaseDef Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} PhaseDef * @property {PhaseRef} phaseRef * @property {number} rank */ /** * An PhaseRef Object returned by the pRPC API issue_objects.proto. * * @typedef {Object} PhaseRef * @property {string} phaseName */ /** * An Object returned by the pRPC v3 API from feature_objects.proto. * * @typedef {Object} IssuesListColumn * @property {string} column */ /** * Types defined in permission_objects.proto. */ /** * A Permission string returned by the pRPC API permission_objects.proto. * * @typedef {string} Permission */ /** * A PermissionSet Object returned by the pRPC API permission_objects.proto. * * @typedef {Object} PermissionSet * @property {string} resource * @property {Array<Permission>} permissions */ /** * Types defined in project_objects.proto. */ /** * An Enum representing the role a ProjectMember has. * * @typedef {string} ProjectRole */ /** * An Enum representing how a ProjectMember shows up in autocomplete. * * @typedef {string} AutocompleteVisibility */ /** * A ProjectMember Object returned by the pRPC API project_objects.proto. * * @typedef {Object} ProjectMember * @property {ProjectMemberName} name * @property {ProjectRole} role * @property {Array<Permission>=} standardPerms * @property {Array<string>=} customPerms * @property {string=} notes * @property {AutocompleteVisibility=} includeInAutocomplete */ /** * A Project Object returned by the pRPC API project_objects.proto. * * @typedef {Object} Project * @property {string} name * @property {string} summary * @property {string=} description */ /** * A Project Object returned by the v0 pRPC API project_objects.proto. * * @typedef {Object} ProjectV0 * @property {string} name * @property {string} summary * @property {string=} description */ /** * A StatusDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} StatusDef * @property {string} status * @property {boolean} meansOpen * @property {number} rank * @property {string} docstring * @property {boolean} deprecated */ /** * A LabelDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} LabelDef * @property {string} label * @property {string=} docstring * @property {boolean=} deprecated */ /** * A ComponentDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} ComponentDef * @property {string} path * @property {string} docstring * @property {Array<UserRef>} adminRefs * @property {Array<UserRef>} ccRefs * @property {boolean} deprecated * @property {number} created * @property {UserRef} creatorRef * @property {number} modified * @property {UserRef} modifierRef * @property {Array<LabelRef>} labelRefs */ /** * A FieldDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} FieldDef * @property {FieldRef} fieldRef * @property {string=} applicableType * @property {boolean=} isRequired * @property {boolean=} isNiche * @property {boolean=} isMultivalued * @property {string=} docstring * @property {Array<UserRef>=} adminRefs * @property {boolean=} isPhaseField * @property {Array<UserRef>=} userChoices * @property {Array<LabelDef>=} enumChoices */ /** * A ApprovalDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} ApprovalDef * @property {FieldRef} fieldRef * @property {Array<UserRef>} approverRefs * @property {string} survey */ /** * A Config Object returned by the pRPC API project_objects.proto. * * @typedef {Object} Config * @property {string} projectName * @property {Array<StatusDef>=} statusDefs * @property {Array<StatusRef>=} statusesOfferMerge * @property {Array<LabelDef>=} labelDefs * @property {Array<string>=} exclusiveLabelPrefixes * @property {Array<ComponentDef>=} componentDefs * @property {Array<FieldDef>=} fieldDefs * @property {Array<ApprovalDef>=} approvalDefs * @property {boolean=} restrictToKnown */ /** * A PresentationConfig Object returned by the pRPC API project_objects.proto. * * @typedef {Object} PresentationConfig * @property {string=} projectThumbnailUrl * @property {string=} projectSummary * @property {string=} customIssueEntryUrl * @property {string=} defaultQuery * @property {Array<SavedQuery>=} savedQueries * @property {string=} revisionUrlFormat * @property {string=} defaultColSpec * @property {string=} defaultSortSpec * @property {string=} defaultXAttr * @property {string=} defaultYAttr */ /** * A TemplateDef Object returned by the pRPC API project_objects.proto. * * @typedef {Object} TemplateDef * @property {string} templateName * @property {string=} content * @property {string=} summary * @property {boolean=} summaryMustBeEdited * @property {UserRef=} ownerRef * @property {StatusRef=} statusRef * @property {Array<LabelRef>=} labelRefs * @property {boolean=} membersOnly * @property {boolean=} ownerDefaultsToMember * @property {Array<UserRef>=} adminRefs * @property {Array<FieldValue>=} fieldValues * @property {Array<ComponentRef>=} componentRefs * @property {boolean=} componentRequired * @property {Array<Approval>=} approvalValues * @property {Array<PhaseDef>=} phases */ /** * Types defined in features_objects.proto. */ /** * A Hotlist Object returned by the pRPC API features_objects.proto. * * @typedef {Object} HotlistV0 * @property {UserRef=} ownerRef * @property {string=} name * @property {string=} summary * @property {string=} description * @property {string=} defaultColSpec * @property {boolean=} isPrivate */ /** * A Hotlist Object returned by the pRPC v3 API from feature_objects.proto. * * @typedef {Object} Hotlist * @property {string} name * @property {string=} displayName * @property {string=} owner * @property {Array<string>=} editors * @property {string=} summary * @property {string=} description * @property {Array<IssuesListColumn>=} defaultColumns * @property {string=} hotlistPrivacy */ /** * A HotlistItem Object returned by the pRPC API features_objects.proto. * * @typedef {Object} HotlistItemV0 * @property {Issue=} issue * @property {number=} rank * @property {UserRef=} adderRef * @property {number=} addedTimestamp * @property {string=} note */ /** * A HotlistItem Object returned by the pRPC v3 API from feature_objects.proto. * * @typedef {Object} HotlistItem * @property {string=} name * @property {string=} issue * @property {number=} rank * @property {string=} adder * @property {string=} createTime * @property {string=} note */ /** * Types defined in user_objects.proto. */ /** * A User Object returned by the pRPC API user_objects.proto. * * @typedef {Object} UserV0 * @property {string=} displayName * @property {number=} userId * @property {boolean=} isSiteAdmin * @property {string=} availability * @property {UserRef=} linkedParentRef * @property {Array<UserRef>=} linkedChildRefs */ /** * A User Object returned by the pRPC v3 API from user_objects.proto. * * @typedef {Object} User * @property {string=} name * @property {string=} displayName * @property {string=} availabilityMessage */
25.877926
79
0.707205
6a23100beb470240e803795ca248480e4d58af04
3,104
js
JavaScript
lib/stein.min.js
Milanzor/stein.js
25fdf45715f128277c3c9d74b3143211f1a4c704
[ "MIT" ]
null
null
null
lib/stein.min.js
Milanzor/stein.js
25fdf45715f128277c3c9d74b3143211f1a4c704
[ "MIT" ]
null
null
null
lib/stein.min.js
Milanzor/stein.js
25fdf45715f128277c3c9d74b3143211f1a4c704
[ "MIT" ]
null
null
null
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("stein",[],t):"object"==typeof exports?exports.stein=t():e.stein=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});/*! * Authored by Milan van As * Released under the MIT license * * Mediator pattern taken from https://gist.github.com/TCotton/d85e879fdbf856ddae3511652f9260f0 * With a bit of own magic */ var r=t.Mediator=function(){var e=function e(t,n){return Array.isArray(t)?t.map(function(t){return e(t,n)}):(r.events[t]||(r.events[t]=[]),r.events[t].push({context:this,callback:n})),this},t=function(e){if(!r.events[e])return!1;for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var i=!0,u=!1,c=void 0;try{for(var f,s=r.events[e][Symbol.iterator]();!(i=(f=s.next()).done);i=!0){var a=f.value,l=a;l.callback.apply(l.context,n)}}catch(e){u=!0,c=e}finally{try{!i&&s.return&&s.return()}finally{if(u)throw c}}return this};return{events:{},publish:t,subscribe:e,installTo:function(n){n.subscribe=e,n.publish=t}}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);Object.defineProperty(t,"Mediator",{enumerable:!0,get:function(){return r.Mediator}});var o=n(2);Object.defineProperty(t,"Dispatch",{enumerable:!0,get:function(){return o.Dispatch}});var i=n(5);Object.defineProperty(t,"DefaultModule",{enumerable:!0,get:function(){return i.DefaultModule}})},function(e,t,n){(function(t){e.exports=t.Router=n(4)}).call(t,n(3))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.Dispatch=function(e){if(Array.isArray(e))e.forEach(function(t,n){new e[n]});else if("object"===(void 0===e?"undefined":r(e)))Object.getOwnPropertyNames(e).foreach(function(t){new e[t]});else if("function"==typeof e){var t={c:e};new t.c}}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultModule=void 0;var o=n(0);t.DefaultModule=function e(){r(this,e),o.Mediator.installTo(this),"function"==typeof this.subscriptions&&this.subscriptions()}}])});
388
2,111
0.704253
6a2353e94ff5057bfe64d0e29416b71f45713d53
1,587
js
JavaScript
src/components/pages/SigninPage.test.js
peterzimon/members.js
e18e6217a53f85490c7fb547c509511bd046d531
[ "MIT" ]
null
null
null
src/components/pages/SigninPage.test.js
peterzimon/members.js
e18e6217a53f85490c7fb547c509511bd046d531
[ "MIT" ]
null
null
null
src/components/pages/SigninPage.test.js
peterzimon/members.js
e18e6217a53f85490c7fb547c509511bd046d531
[ "MIT" ]
null
null
null
import React from 'react'; import {render, fireEvent} from 'test-utils'; import SigninPage from './SigninPage'; const setup = (overrides) => { const {mockOnActionFn, ...utils} = render( <SigninPage />, { overrideContext: { member: null } } ); const emailInput = utils.getByLabelText(/email/i); const submitButton = utils.queryByRole('button', {name: 'Send login link'}); const signupButton = utils.queryByRole('button', {name: 'Sign up'}); return { emailInput, submitButton, signupButton, mockOnActionFn, ...utils }; }; describe('SigninPage', () => { test('renders', () => { const {emailInput, submitButton, signupButton} = setup(); expect(emailInput).toBeInTheDocument(); expect(submitButton).toBeInTheDocument(); expect(signupButton).toBeInTheDocument(); }); test('can call signin action with email', () => { const {emailInput, submitButton, mockOnActionFn} = setup(); fireEvent.change(emailInput, {target: {value: 'member@example.com'}}); expect(emailInput).toHaveValue('member@example.com'); fireEvent.click(submitButton); expect(mockOnActionFn).toHaveBeenCalledWith('signin', {email: 'member@example.com'}); }); test('can call swithPage for signup', () => { const {signupButton, mockOnActionFn} = setup(); fireEvent.click(signupButton); expect(mockOnActionFn).toHaveBeenCalledWith('switchPage', {page: 'signup'}); }); });
30.519231
93
0.608066
6a23f8e6de41d19a36ee75bf412eb0e0804930e8
736
js
JavaScript
node_modules/discord.js/src/client/actions/ThreadDelete.js
Godlander/botlander
83c1644fbbb3b28340dce84d1cf06dbe263a4993
[ "MIT" ]
19,349
2018-01-18T19:44:22.000Z
2022-03-31T23:33:53.000Z
node_modules/discord.js/src/client/actions/ThreadDelete.js
Godlander/botlander
83c1644fbbb3b28340dce84d1cf06dbe263a4993
[ "MIT" ]
3,734
2018-01-19T01:27:05.000Z
2022-03-31T08:06:46.000Z
node_modules/discord.js/src/client/actions/ThreadDelete.js
Godlander/botlander
83c1644fbbb3b28340dce84d1cf06dbe263a4993
[ "MIT" ]
5,774
2018-01-18T22:14:52.000Z
2022-03-31T21:09:19.000Z
'use strict'; const Action = require('./Action'); const { Events } = require('../../util/Constants'); class ThreadDeleteAction extends Action { handle(data) { const client = this.client; const thread = client.channels.cache.get(data.id); if (thread) { client.channels._remove(thread.id); thread.deleted = true; for (const message of thread.messages.cache.values()) { message.deleted = true; } /** * Emitted whenever a thread is deleted. * @event Client#threadDelete * @param {ThreadChannel} thread The thread that was deleted */ client.emit(Events.THREAD_DELETE, thread); } return { thread }; } } module.exports = ThreadDeleteAction;
23.741935
66
0.629076
6a2431cfb04a384a8c2df7ebb9df896138947323
312
js
JavaScript
wildfire-tracker/src/components/Header.js
LightLordYT/Traversy-Courses
fa95ea9154cd0bc836d0c0734a1ea550ce6a1633
[ "Apache-2.0" ]
1
2021-04-05T20:09:27.000Z
2021-04-05T20:09:27.000Z
wildfire-tracker/src/components/Header.js
LightLordYT/Traversy-Courses
fa95ea9154cd0bc836d0c0734a1ea550ce6a1633
[ "Apache-2.0" ]
5
2020-06-01T11:50:22.000Z
2022-01-22T11:58:50.000Z
wildfire-tracker/src/components/Header.js
LightLordYT/Traversy-Courses
fa95ea9154cd0bc836d0c0734a1ea550ce6a1633
[ "Apache-2.0" ]
2
2021-04-05T20:09:29.000Z
2021-09-25T02:41:23.000Z
import { Icon } from '@iconify/react'; import locationIcon from '@iconify/icons-mdi/fire-alert'; const Header = () => { return ( <header className='header'> <h1> <Icon icon={locationIcon} /> Wildfire Tracker (Powered By NASA) </h1> </header> ); }; export default Header;
20.8
57
0.599359
6a248b6c979feb1146780281c8c75bb705b2e7fa
496
js
JavaScript
online-shop-api/users/routes.js
pkkoev/simple-online-shop
77d52b0ef3df56e144ecf5cda5631d99e98fc647
[ "MIT" ]
null
null
null
online-shop-api/users/routes.js
pkkoev/simple-online-shop
77d52b0ef3df56e144ecf5cda5631d99e98fc647
[ "MIT" ]
null
null
null
online-shop-api/users/routes.js
pkkoev/simple-online-shop
77d52b0ef3df56e144ecf5cda5631d99e98fc647
[ "MIT" ]
null
null
null
const router = require("express").Router(); const userController = require("./controller.js"); const verifyToken = require('../serverAuth.js').verifyToken; router.get('/', userController.getUsers); router.post('/', userController.createUser); router.get('/:userId',verifyToken, userController.getUser); router.put('/:userId',verifyToken, userController.updateUser); router.post('/login',userController.loginUser); router.post('/:userId',userController.removeUser); module.exports = router;
29.176471
62
0.754032
6a24b33034f107585503f0e97e82360ebfb74230
3,216
js
JavaScript
app/global-styles.js
Serninator/hackchat-client
9a0d808ac46d3d326867030de58641e3cec88040
[ "WTFPL" ]
null
null
null
app/global-styles.js
Serninator/hackchat-client
9a0d808ac46d3d326867030de58641e3cec88040
[ "WTFPL" ]
null
null
null
app/global-styles.js
Serninator/hackchat-client
9a0d808ac46d3d326867030de58641e3cec88040
[ "WTFPL" ]
null
null
null
/** * Root style sheet for the ui */ import { createGlobalStyle } from 'styled-components'; const GlobalStyle = createGlobalStyle` html, body { height: 100%; width: 100%; background-color: #2a2949; --scrollbarBG: #2a2a49; --thumbBG: #9740dd; } body { font-family: 'DejaVu Sans Mono', monospace, sans-serif; scrollbar-width: thin; scrollbar-color: var(--thumbBG) var(--scrollbarBG); } body::-webkit-scrollbar { width: 11px; } body::-webkit-scrollbar-track { background: var(--scrollbarBG); } body::-webkit-scrollbar-thumb { background-color: var(--thumbBG) ; border-radius: 6px; border: 3px solid var(--scrollbarBG); } #app { background-color: #2a2a49; color: #f5f5f7; height: 100%; width: 100%; font-size: 11px; } .modal-content { background-color: rgba(0, 0, 0, 0) !important; border: none !important; } .form-control:focus { outline: 0; box-shadow: none !important; } textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { color: #f5f5f7 !important; background-color: #343a40 !important; } textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus, .uneditable-input:focus { background: linear-gradient(to right, #3e444c, #343a40) !important; } .dropdown-divider { border-image: linear-gradient(to right,#3b7ed0,#9740dd) !important; border-image-slice: 1 !important; } p { margin-bottom: 0; } pre { display: block; padding: 4.5px; padding-left: 8.5px; margin-bottom: 0 !important; font-size: 13px; line-height: 1.42857143; color: #adb5bd; word-break: break-all; word-wrap: break-word; background-color: #1c1c31; border: 1px solid #131320; border-radius: 4px; } code { padding: 2px 4px; font-size: 90%; color: #adb5bd; background-color: #1c1c31; border-radius: 4px; } hr { background: linear-gradient(to right,#3b7ed0 0%,#9740dd 100%); height: 1px; } mark { background-color: #3b7ed0; background-image: linear-gradient(to right,#3b7ed0 0%,#9740dd 100%); background-size: 100%; -webkit-background-clip: text; /* stylelint-disable-line */ -moz-background-clip: text; /* stylelint-disable-line */ -webkit-text-fill-color: transparent; -moz-text-fill-color: transparent; } blockquote { padding: 5px 10px; border-left: 4px solid #1c1c31; } a { color: #FFF; } h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { margin-bottom: 0; } `; export default GlobalStyle;
25.52381
430
0.63495
6a24bca0b2f344cf661e947eb1b9a2d9db3e4b17
1,611
js
JavaScript
src/components/Forms/Tick.js
mdtanrikulu/ens-app
6ef916818afeb4ec6e8d08fa7acf0b84b981b8b3
[ "BSD-2-Clause" ]
2
2021-03-05T23:50:24.000Z
2021-03-05T23:50:35.000Z
src/components/Forms/Tick.js
mdtanrikulu/ens-app
6ef916818afeb4ec6e8d08fa7acf0b84b981b8b3
[ "BSD-2-Clause" ]
null
null
null
src/components/Forms/Tick.js
mdtanrikulu/ens-app
6ef916818afeb4ec6e8d08fa7acf0b84b981b8b3
[ "BSD-2-Clause" ]
1
2020-09-27T07:06:56.000Z
2020-09-27T07:06:56.000Z
import React from 'react' import styled from '@emotion/styled' const activeColourSwitch = props => (props.active ? '#5284FF' : '#B0BECF') const TickContainer = styled('div')` display: flex; justify-content: center; align-items: center; height: 23px; width: 23px; border-radius: 5px; border: 2px solid ${activeColourSwitch}; ` const TickContainerDouble = styled('div')` display: flex; justify-content: center; align-items: center; height: 20px; width: 20px; border-radius: 3px; box-shadow: 0 0 0 2px ${activeColourSwitch}, -5px -5px 0 0 white, -5px -5px 0 2px ${activeColourSwitch}; ` const Svg = styled('svg')` margin-top: 2px; path { fill: ${activeColourSwitch}; opacity: ${props => (props.active || props.hover ? '1' : '0')}; } ` const Tick = ({ active, className, hover }) => ( <TickContainer className={className} active={active}> <Svg width="11" height="8" xmlns="http://www.w3.org/2000/svg" active={active} hover={hover} > <path d="M9.63 0L4.537 5.202 1.37 1.967 0 3.367 4.537 8 11 1.399z" fillRule="evenodd" /> </Svg> </TickContainer> ) export default Tick export const DoubleBorderTick = ({ active, className, hover }) => ( <TickContainerDouble className={className} active={active}> <Svg width="11" height="8" xmlns="http://www.w3.org/2000/svg" active={active} hover={hover} > <path d="M9.63 0L4.537 5.202 1.37 1.967 0 3.367 4.537 8 11 1.399z" fillRule="evenodd" /> </Svg> </TickContainerDouble> )
22.068493
74
0.61018
6a24d1b2ef7d7aca4804daf5d16da40a26abed16
1,071
js
JavaScript
public/scripts/nav/navController.js
gunderm2/RetrospectiveTool
0ed5432c18aef9798b55e8fdccc13be064ad7e45
[ "Unlicense", "MIT" ]
3
2016-03-03T16:57:09.000Z
2016-11-29T14:43:39.000Z
public/scripts/nav/navController.js
gunderm2/RetrospectiveTool
0ed5432c18aef9798b55e8fdccc13be064ad7e45
[ "Unlicense", "MIT" ]
null
null
null
public/scripts/nav/navController.js
gunderm2/RetrospectiveTool
0ed5432c18aef9798b55e8fdccc13be064ad7e45
[ "Unlicense", "MIT" ]
null
null
null
(function () { "use strict"; angular.module('startapp').controller('navController', function ($scope, $rootScope, $location, app_constants, sessionUtils) { 'use strict' $scope.canRetropect = sessionUtils.isSessionIdSet(app_constants.sessionStorageId); //console.log('navController canRetrospect :', $scope.canRetropect); $rootScope.$on('canRetrospect', function (event, mass) { console.log('mass :', mass); $scope.canRetropect = mass; }); $scope.goHome = function () { $location.path('/home'); }; $scope.goAbout = function () { $location.path('/about'); }; $scope.goContact = function () { $location.path('/contact'); }; $scope.goRetrospect = function () { if (sessionUtils.isSessionIdSet(app_constants.sessionStorageId)) { $location.path('/retrospective/' + sessionUtils.getSessionAttribute(app_constants.sessionStorageId).sessionId); } }; }); })();
34.548387
130
0.577965
6a24e7e892aff5f04f56179e13ddc9ab4c29a98f
2,584
js
JavaScript
src/extension/features/accounts/right-click-to-edit/index.js
heylookltsme/toolkit-for-ynab
7ca6999bbe5ad104bb096cde51486fc094c7441b
[ "MIT" ]
1
2020-01-03T14:23:53.000Z
2020-01-03T14:23:53.000Z
src/extension/features/accounts/right-click-to-edit/index.js
7immyH/toolkit-for-ynab
c09fa487bcec11b125d8e2694c5f48b0b33732ce
[ "MIT" ]
null
null
null
src/extension/features/accounts/right-click-to-edit/index.js
7immyH/toolkit-for-ynab
c09fa487bcec11b125d8e2694c5f48b0b33732ce
[ "MIT" ]
null
null
null
import { Feature } from 'toolkit/extension/features/feature'; import { isCurrentRouteAccountsPage } from 'toolkit/extension/utils/ynab'; export class RightClickToEdit extends Feature { isCurrentlyRunning = false; injectCSS() { return require('./index.css'); } shouldInvoke() { return isCurrentRouteAccountsPage(); } displayContextMenu(event) { let $element = $(this); // check for a right click on a split transaction if ($element.hasClass('ynab-grid-body-sub')) { // select parent transaction $element = $element.prevAll('.ynab-grid-body-parent:first'); } if (!$element.hasClass('is-checked')) { // clear existing, then check current $('.ynab-checkbox-button.is-checked').click(); $element.find('.ynab-checkbox-button').click(); } // make context menu appear $('.accounts-toolbar-edit-transaction').click(); // determine if modal needs to be positioned above or below clicked element let height = $('.modal-account-edit-transaction-list .modal').outerHeight(); let below = event.pageY + height > $(window).height() ? false : true; // eslint-disable-line no-unneeded-ternary // sometimes, offset is undefined -- if this is the case, just show the normal un-positioned edit menu let offset = $element.offset(); // move context menu if (!offset) { return; } if (below) { // position below $('.modal-account-edit-transaction-list .modal') .addClass('modal-below') .css('left', event.pageX - 115) .css('top', offset.top + 41); } else { // position above $('.modal-account-edit-transaction-list .modal') .addClass('modal-above') .css('left', event.pageX - 115) .css('top', offset.top - height - 8); } return false; } hideContextMenu() { return false; // ignore right clicks } invoke() { this.isCurrentlyRunning = true; Ember.run.next(this, function() { $('.ynab-grid').off('contextmenu', '.ynab-grid-body-row', this.displayContextMenu); $('.ynab-grid').on('contextmenu', '.ynab-grid-body-row', this.displayContextMenu); $('body').off('contextmenu', '.modal-account-edit-transaction-list', this.hideContextMenu); $('body').on('contextmenu', '.modal-account-edit-transaction-list', this.hideContextMenu); this.isCurrentlyRunning = false; }); } observe(changedNodes) { if (!this.shouldInvoke() || this.isCurrentlyRunning) return; if (changedNodes.has('ynab-grid-body')) { this.invoke(); } } }
30.4
116
0.634675
6a254eb30118787e2016051b84294a1aaf30fc85
1,378
js
JavaScript
out/common/secrets.js
ScriptBox99/rest-book
9d1c297793f490f642487702a2029a191af7e27a
[ "MIT" ]
205
2021-02-23T09:11:16.000Z
2022-03-22T22:08:51.000Z
out/common/secrets.js
ScriptBox99/rest-book
9d1c297793f490f642487702a2029a191af7e27a
[ "MIT" ]
72
2020-12-09T22:11:08.000Z
2022-03-25T06:30:29.000Z
out/common/secrets.js
ScriptBox99/rest-book
9d1c297793f490f642487702a2029a191af7e27a
[ "MIT" ]
22
2020-12-09T23:10:08.000Z
2022-03-22T22:08:44.000Z
var stringify = require('json-stringify-safe'); const SECRETS_KEY = 'rest-book-secrets'; var extContext; export var SECRETS = {}; export function hasNoSecrets() { return Object.keys(SECRETS).length === 0; } export function initializeSecretsRegistry(context) { extContext = context; context.secrets.get(SECRETS_KEY).then((contents) => { try { SECRETS = JSON.parse(contents); } catch { SECRETS = {}; } }); } export function getNamesOfSecrets() { return Object.keys(SECRETS); } export function getSecret(name) { return SECRETS[name]; } export function addSecret(name, value) { SECRETS[name] = value; _saveSecrets(); } export function deleteSecret(name) { delete SECRETS[name]; _saveSecrets(); } function _saveSecrets() { extContext.secrets.store(SECRETS_KEY, stringify(SECRETS)); } export function cleanForSecrets(text) { if (typeof text === 'string') { let ret = text; for (let key of Object.keys(SECRETS)) { ret = ret.replace(SECRETS[key], `[SECRET ${key}]`); } return ret; } if (typeof text === 'number') { for (let key of Object.keys(SECRETS)) { if (text === SECRETS[key]) { return `[SECRET ${key}]`; } } } return text; } //# sourceMappingURL=secrets.js.map
26
63
0.598694
6a28290d91324bb2ee4d88b9e21f5d118b442f55
645
js
JavaScript
index.js
michaelandrewrm/channel-messaging
a1a349cc57aff63e6fd91163d1e78fc7cca9ef73
[ "MIT" ]
null
null
null
index.js
michaelandrewrm/channel-messaging
a1a349cc57aff63e6fd91163d1e78fc7cca9ef73
[ "MIT" ]
null
null
null
index.js
michaelandrewrm/channel-messaging
a1a349cc57aff63e6fd91163d1e78fc7cca9ef73
[ "MIT" ]
null
null
null
window.addEventListener('DOMContentLoaded', () => { const message = document.getElementById('message'); const sendButton = document.getElementById('send-message'); const iframe = document.querySelector('iframe'); const channel = new MessageChannel(); const port1 = channel.port1; const { log } = console; function onMessage(e) { log(e.data); } function onClick() { port1.postMessage(message.value); } function onLoad() { sendButton.addEventListener('click', onClick); port1.onmessage = onMessage; iframe.contentWindow.postMessage({ name: 'init' }, '*', [channel.port2]); } iframe.addEventListener('load', onLoad); });
25.8
75
0.708527
6a283eeb24a3c4fd742d68d9f7780e01d08dd218
4,874
js
JavaScript
packages/material-ui/src/MenuItem/MenuItem.test.js
MichaelDuo/material-ui
a9e5aecabb16605cbf16f06b83f43f2ea282438e
[ "MIT" ]
null
null
null
packages/material-ui/src/MenuItem/MenuItem.test.js
MichaelDuo/material-ui
a9e5aecabb16605cbf16f06b83f43f2ea282438e
[ "MIT" ]
31
2021-01-14T22:36:12.000Z
2021-07-12T10:13:40.000Z
packages/material-ui/src/MenuItem/MenuItem.test.js
MichaelDuo/material-ui
a9e5aecabb16605cbf16f06b83f43f2ea282438e
[ "MIT" ]
null
null
null
// @ts-check import * as React from 'react'; import { expect } from 'chai'; import { spy } from 'sinon'; import { createMount, describeConformanceV5, createClientRender, fireEvent, screen, } from 'test/utils'; import MenuItem, { menuItemClasses as classes } from '@material-ui/core/MenuItem'; import ListItem from '@material-ui/core/ListItem'; import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; describe('<MenuItem />', () => { const mount = createMount(); const render = createClientRender(); describeConformanceV5(<MenuItem />, () => ({ classes, inheritComponent: ListItem, mount, refInstanceof: window.HTMLLIElement, testComponentPropWith: 'a', muiName: 'MuiMenuItem', testVariantProps: { disableGutters: true }, skip: ['componentsProp'], })); it('should render a focusable menuitem', () => { render(<MenuItem />); const menuitem = screen.getByRole('menuitem'); expect(menuitem).to.have.property('tabIndex', -1); }); it('has a ripple when clicked', () => { render(<MenuItem TouchRippleProps={{ classes: { rippleVisible: 'ripple-visible' } }} />); const menuitem = screen.getByRole('menuitem'); // ripple starts on mousedown fireEvent.mouseDown(menuitem); expect(menuitem.querySelectorAll('.ripple-visible')).to.have.length(1); }); it('should render with the selected class but not aria-selected when `selected`', () => { render(<MenuItem selected />); const menuitem = screen.getByRole('menuitem'); expect(menuitem).to.have.class(classes.selected); expect(menuitem).not.to.have.attribute('aria-selected'); }); it('can have a role of option', () => { render(<MenuItem role="option" aria-selected={false} />); expect(screen.queryByRole('option')).not.to.equal(null); }); describe('event callbacks', () => { /** * @type {Array<keyof typeof fireEvent>} */ const events = ['click', 'mouseDown', 'mouseEnter', 'mouseLeave', 'mouseUp', 'touchEnd']; events.forEach((eventName) => { it(`should fire ${eventName}`, () => { const handlerName = `on${eventName[0].toUpperCase()}${eventName.slice(1)}`; const handler = spy(); render(<MenuItem {...{ [handlerName]: handler }} />); fireEvent[eventName](screen.getByRole('menuitem')); expect(handler.callCount).to.equal(1); }); }); it(`should fire focus, keydown, keyup and blur`, () => { const handleFocus = spy(); const handleKeyDown = spy(); const handleKeyUp = spy(); const handleBlur = spy(); render( <MenuItem onFocus={handleFocus} onKeyDown={handleKeyDown} onKeyUp={handleKeyUp} onBlur={handleBlur} />, ); const menuitem = screen.getByRole('menuitem'); menuitem.focus(); expect(handleFocus.callCount).to.equal(1); fireEvent.keyDown(menuitem); expect(handleKeyDown.callCount).to.equal(1); fireEvent.keyUp(menuitem); expect(handleKeyUp.callCount).to.equal(1); menuitem.blur(); expect(handleKeyDown.callCount).to.equal(1); }); it('should fire onTouchStart', function touchStartTest() { // only run in supported browsers if (typeof Touch === 'undefined') { this.skip(); } const handleTouchStart = spy(); render(<MenuItem onTouchStart={handleTouchStart} />); const menuitem = screen.getByRole('menuitem'); const touch = new Touch({ identifier: 0, target: menuitem, clientX: 0, clientY: 0 }); fireEvent.touchStart(menuitem, { touches: [touch] }); expect(handleTouchStart.callCount).to.equal(1); }); }); // Regression test for #10452. // Kept for backwards compatibility. // In the future we should have a better pattern for this UI. it('should not fail with a li > li error message', () => { const { rerender } = render( <MenuItem> <ListItemSecondaryAction> <div /> </ListItemSecondaryAction> </MenuItem>, ); expect(document.querySelectorAll('li')).to.have.length(1); rerender( <MenuItem button={false}> <ListItemSecondaryAction> <div /> </ListItemSecondaryAction> </MenuItem>, ); expect(document.querySelectorAll('li')).to.have.length(1); }); it('can be disabled', () => { render(<MenuItem disabled />); const menuitem = screen.getByRole('menuitem'); expect(menuitem).to.have.attribute('aria-disabled', 'true'); }); describe('prop: ListItemClasses', () => { it('should be able to change the style of ListItem', () => { render(<MenuItem ListItemClasses={{ disabled: 'bar' }} disabled />); const menuitem = screen.getByRole('menuitem'); expect(menuitem).to.have.class('bar'); }); }); });
28.670588
93
0.623923
6a28f33c3274385bab561bd56cfae7b0067d12a4
169
js
JavaScript
report/slate-react/files/packages_slate_react_src_components_text_tsx/report.history.js
kbrandonle/slate
cfbf8f4d46c037f50cec861de9aaa2364349e8c9
[ "MIT" ]
1
2020-10-25T02:13:03.000Z
2020-10-25T02:13:03.000Z
report/slate-react/files/packages_slate_react_src_components_text_tsx/report.history.js
kbrandonle/slate
cfbf8f4d46c037f50cec861de9aaa2364349e8c9
[ "MIT" ]
null
null
null
report/slate-react/files/packages_slate_react_src_components_text_tsx/report.history.js
kbrandonle/slate
cfbf8f4d46c037f50cec861de9aaa2364349e8c9
[ "MIT" ]
null
null
null
__history = [{"date":"Mon, 30 Nov 2020 01:51:44 GMT","sloc":76,"lloc":34,"functions":3,"deliveredBugs":0.365,"maintainability":61.553,"lintErrors":26,"difficulty":24.7}]
169
169
0.698225
6a29958082ad76d964967d75d09b55b6f0c80419
8,892
js
JavaScript
test/unit/mocks/adapters/wallet.js
Permissionless-Software-Foundation/avax-dex
65e1ce8c366dd49bca8581a8798538e00a9e6155
[ "MIT" ]
null
null
null
test/unit/mocks/adapters/wallet.js
Permissionless-Software-Foundation/avax-dex
65e1ce8c366dd49bca8581a8798538e00a9e6155
[ "MIT" ]
17
2021-11-24T22:08:11.000Z
2022-02-19T04:04:35.000Z
test/unit/mocks/adapters/wallet.js
Permissionless-Software-Foundation/avax-dex
65e1ce8c366dd49bca8581a8798538e00a9e6155
[ "MIT" ]
null
null
null
/* Mock data for the wallet.adapter.unit.js test file. */ const BCHJS = require('@psf/bch-js') const AvaxWallet = require('minimal-avax-wallet') const mockWallet = { mnemonic: 'course abstract aerobic deer try switch turtle diet fence affair butter top', privateKey: 'L5D2UAam8tvo3uii5kpgaGyjvVMimdrXu8nWGQSQjuuAix6ji1YQ', publicKey: '0379433ffc401483ade310469953c1cba77c71af904f07c15bde330d7198b4d6dc', cashAddress: 'bitcoincash:qzl0d3gcqeypv4cy7gh8rgdszxa9vvm2acv7fqtd00', address: 'bitcoincash:qzl0d3gcqeypv4cy7gh8rgdszxa9vvm2acv7fqtd00', slpAddress: 'simpleledger:qzl0d3gcqeypv4cy7gh8rgdszxa9vvm2acq9zm7d33', legacyAddress: '1JQj1KcQL7GPKzc1D2PvdUSgw3MbDtrHzi', hdPath: "m/44'/245'/0'/0/0", nextAddress: 1 } class MockBchWallet { constructor () { this.walletInfoPromise = true this.walletInfo = mockWallet this.bchjs = new BCHJS() this.burnTokens = async () => { return { success: true, txid: 'txid' } } this.sendTokens = async () => { return 'fakeTxid' } this.getUtxos = async () => { } // Environment variable is used by wallet-balance.unit.js to force an error. if (process.env.NO_UTXO) { this.utxos = {} } else { this.utxos = { utxoStore: { address: 'bitcoincash:qqetvdnlt0p8g27dr44cx7h057kpzly9xse9huc97z', bchUtxos: [ { height: 700685, tx_hash: '1fc577caaff5626a8477162581e57bae1b19dc6aa6c10638013c2b1ba14dc654', tx_pos: 0, value: 1000, txid: '1fc577caaff5626a8477162581e57bae1b19dc6aa6c10638013c2b1ba14dc654', vout: 0, isValid: false }, { height: 700685, tx_hash: '1fc577caaff5626a8477162581e57bae1b19dc6aa6c10638013c2b1ba14dc654', tx_pos: 2, value: 19406, txid: '1fc577caaff5626a8477162581e57bae1b19dc6aa6c10638013c2b1ba14dc654', vout: 2, isValid: false } ], nullUtxos: [], slpUtxos: { type1: { mintBatons: [], tokens: [ { height: 700522, tx_hash: 'bb5691b50930816be78dad76d203a1c97ac94c03f6051b2fa0159c71c43aa3d0', tx_pos: 1, value: 546, txid: 'bb5691b50930816be78dad76d203a1c97ac94c03f6051b2fa0159c71c43aa3d0', vout: 1, utxoType: 'token', transactionType: 'send', tokenId: 'a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2', tokenTicker: 'TROUT', tokenName: "Trout's test token", tokenDocumentUrl: 'troutsblog.com', tokenDocumentHash: '', decimals: 2, tokenType: 1, isValid: true, tokenQty: '4.25' }, { height: 0, tx_hash: 'c0ac066ce6efa1fa4763bf85a91c738e57c12b8765731bd07f0d8f5a55ce582f', tx_pos: 1, value: 546, txid: 'c0ac066ce6efa1fa4763bf85a91c738e57c12b8765731bd07f0d8f5a55ce582f', vout: 1, utxoType: 'token', transactionType: 'send', tokenId: '38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0', tokenTicker: 'PSF', tokenName: 'Permissionless Software Foundation', tokenDocumentUrl: 'psfoundation.cash', tokenDocumentHash: '', decimals: 8, tokenType: 1, isValid: true, tokenQty: '1' } ] }, nft: { groupMintBatons: [], groupTokens: [], tokens: [] } } } } } } } class AvalancheWallet { constructor (keypair) { const avax = new AvaxWallet(keypair, { noUpdate: true }) this.walletInfoPromise = avax.walletInfoPromise.then(() => { if (keypair) { this.walletInfo = avax.walletInfo } return true }) this.tokens = avax.tokens this.create = avax.create this.ava = avax.ava this.bintools = avax.bintools this.utxos = avax.utxos this.sendAvax = avax.sendAvax this.BN = avax.BN this.ar = avax.ar this.walletInfo = { type: 'mnemonic', mnemonic: 'stove off mirror shallow rigid language stairs rate mirror other cup aerobic arch brief tower click hand icon parent employ treat animal debate core', address: 'X-avax192g35v4jmnarjzczpdqxzvwlx44cfg4p0yk4qd', privateKey: 'PrivateKey-8NFb6YinvHtjtfHW3JRm3qoDdQceXEuTRcLRvj3BAxNg3dX7y', publicKey: '5iwDpFGJdZXwhNjhC8VinAHT3T7ny3HiYLN2mdJUqK9Z2gorQj', avax: 0, description: '' } if (process.env.NO_UTXO) { this.utxos.utxoStore = [] this.utxos.assets = [] } else { this.setUtxos() } this.ar.issueTx = (baseTx) => 'txid' } setUtxos () { this.utxos.utxoStore = [ { txid: '3LxJXtS6FYkSpcRLPu1EeGZDdFBY41J4YxH1Nwohxs2evUo1U', outputIdx: '00000001', amount: 1, assetID: '2jgTFB6MM4vwLzUNWFYGPfyeQfpLaEqj4XWku6FoW7vaGrrEd5', typeID: 6 }, { txid: 'Fy3NFR7DrriWWNBpogrsgXoAmZpdYcoRHz6n7uW17nRHBVcm3', outputIdx: '00000001', amount: 380, assetID: '2jgTFB6MM4vwLzUNWFYGPfyeQfpLaEqj4XWku6FoW7vaGrrEd5', typeID: 7 }, { txid: 'Fy3NFR7DrriWWNBpogrsgXoAmZpdYcoRHz6n7uW17nRHBVcm3', outputIdx: '00000000', amount: 18000000, assetID: 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z', typeID: 7 } ] this.utxos.assets = [ { assetID: 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z', name: 'Avalanche', symbol: 'AVAX', denomination: 9, amount: 18000000 }, { assetID: '2jgTFB6MM4vwLzUNWFYGPfyeQfpLaEqj4XWku6FoW7vaGrrEd5', name: 'Arepa Token', symbol: 'ARP', denomination: 2, amount: 380 } ] } async getUtxos () { if (process.env.NO_UPDATE) { return [] } this.utxos = { utxoStore: [ { txid: 'Fy3NFR7DrriWWNBpogrsgXoAmZpdYcoRHz6n7uW17nRHBVcm3', outputIdx: '00000000', amount: 18000000, assetID: 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z', typeID: 7 } ], assets: [ { assetID: 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z', name: 'Avalanche', symbol: 'AVAX', denomination: 9, amount: 18000000 } ] } return [] } async send (outputs) { // just for the sake of tests this.outputs = outputs return 'someid' } async burnTokens (amount, assetID) { // just for the sake of tests this.outputs = [{ amount, assetID }] return 'someburnid' } async listAssets () { return [ { assetID: 'Avax', name: 'Avalanche', symbol: 'AVAX', denomination: 9, amount: 18000000 }, { assetID: '2jgTFB6MM4vwLzUNWFYGPfyeQfpLaEqj4XWku6FoW7vaGrrEd5', name: 'Arepa Token', symbol: 'ARP', denomination: 2, amount: 380 } ] } } // UTXOS and UTXOSets const emptyUTXOSet = { getUTXO: () => null } const assetUTXOSet = { getUTXO: () => true } const txString = '111111111GYfFgEkzZP3Csh3c5srhDny6S23q96YQvnKPzg4DmyzVdw9hKQhsttPmn237U' + 'JdFPFPvfTpN2v8HoKP3TUTRiPmGvvjXn9E9fqV3v9NVPa4ce4spCgS8L8AmG5t2wbhn9Js' + 'gui2Z6mdXf7ftP7c8grp2qjd6v5rKyQn6V5FtRpNRMvGGpYK5VZb5XsHcgwaGVBp4htSCP' + 'iiahCnuePHzRdjz6dtzjUJtZMueAwHPMjxJRzw2oE7eTdPWy4Ln6XKXrWGQqzXM3oGg8s3' + 'k22d2JwKdpEKL3Wb5yGSft72iBbsRgRHE29kNGUirBAqpMzURQCRAdgUAVqxzP3TzyfX6q' + 'UvTTdbFzX82kLk76jUh9KCBa8zrFzH5jvJWAzaV4rkEuMKASFxqPYyrKJ6SQYWBgdDdQFM' + 'C7DeD3R9TEM7fLfqWywe2GMmH24mYKYG1sKokqjoyUdL3moTbzfdUwY1kpNMH23jSLBu5e' + 'vzyvNrFQ9MLG1bYFaHzf6z2M6KtV4kyhk6dXgDktBECxXzkEZq4WEBrtVexoCVaqJfSzE1' + 'gmXCs3Ym9D9Y2rc1oA8tn9QneZUvdJQmWZ7Ce58ZtJnFZQ9ZAaymPy2qgsLbdE9pQhKNBS' + 'rVriCdvWqokTGL4a5PiNrCBmqCsrg78DLNGyJZ97cdboUwQQ54RE67x2TBNfufUfo4wS7h' + 'uKYi1MCbjcKbowsRBKMoWDWhyK4Lk7gVC8W8Ncx9ecc3W6bUuewErdmaaRAUtQtismxucz' + '8wZbWe8PmGxEUTruPzo8nVpz4CXniE1FG342t8ey6YHUqBUHqpeHsGbWMc9rQyFHUV8joF' + '3Nchxt2s' module.exports = { MockBchWallet, mockWallet, AvalancheWallet, txString, emptyUTXOSet, assetUTXOSet }
29.838926
167
0.599753
6a29b9def8c3cd528c53390e750cab631bd91e16
5,120
js
JavaScript
lib/locale/lang/zh-HK.min.js
ZHONG007/vxe-table
0b30735e7a23338d6d56d19c735f65c8d7acd664
[ "MIT" ]
null
null
null
lib/locale/lang/zh-HK.min.js
ZHONG007/vxe-table
0b30735e7a23338d6d56d19c735f65c8d7acd664
[ "MIT" ]
null
null
null
lib/locale/lang/zh-HK.min.js
ZHONG007/vxe-table
0b30735e7a23338d6d56d19c735f65c8d7acd664
[ "MIT" ]
null
null
null
!function(e,t){if("function"==typeof define&&define.amd)define("vxe-table-lang.zh-HK",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var l={};t(l),e.vxeTableLangZhHK=l}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default={vxe:{error:{groupFixed:"如果使用分組表頭,固定列必須按組設定",groupMouseRange:'分组表頭與 "{0}" 不能同時使用,這可能會出現錯誤',groupTag:'分組列頭應該使用 "{0}" 而不是 "{1}",這可能會出現錯誤',scrollErrProp:'啟用虛擬滾動後不支持該參數 "{0}"',scrollXNotGroup:'橫向虛擬滾動不支持分組表頭,需要設定 "scroll-x.enabled=false" 參數,否則可能會導致出現錯誤',errConflicts:'參數 "{0}" 與 "{1}" 有衝突',unableInsert:"無法插入到指定位置,請檢查參數是否正確",useErr:'安裝 "{0}" 模組時發生錯誤,可能順序不正確,依賴的模組需要在Table之前安裝',barUnableLink:"工具欄無法關聯表格",expandContent:"展開行的插槽應該是 “content”,請檢查是否正確",reqModule:'缺少 "{0}" 模組',reqProp:'缺少必要的 "{0}" 參數,可能會導致出現錯誤',emptyProp:'參數 "{0}" 不允許為空',errProp:'不支持的參數 "{0}",可能為 "{1}"',colRepet:'column.{0}="{1}" 重複了,這可能會導致某些功能無法使用',notFunc:'方法 "{0}" 不存在',notSlot:'插槽 "{0}" 不存在',noTree:"樹狀結構不支援 {0}",notProp:'不支持的參數 "{0}"',coverProp:'"{0}" 的參數 "{1}" 被覆蓋,這可能會出現錯誤',delFunc:'方法 "{0}" 已停用,請使用 "{1}"',delProp:'參數 "{0}" 已停用,請使用 "{1}"',delEvent:'事件 "{0}" 已停用,請使用 "{1}"',removeProp:'參數 "{0}" 已停用,不建議使用,這可能會導致出現錯誤',errFormat:'全域的格式化內容應該使用 "VXETable.formats" 定義,掛載 "formatter={0}" 的管道已不建議使用',notType:'不支持的檔案類型 "{0}"',notExp:"該瀏覽器不支持導入/匯出功能",impFields:"導入失敗,請檢查欄位名和數據格式是否正確",treeNotImp:"樹狀表格不支持導入"},renderer:{search:"蒐索",cases:{equal:"等於",unequal:"不等於",gt:"大於",ge:"大於或等於",lt:"小於",le:"小於或等於",begin:"開頭是",notbegin:"開頭不是",endin:"結尾是",notendin:"結尾不是",include:"包含",exclude:"不包含",between:"介於",custom:"自定義篩選",insensitive:"不區分大小寫",isSensitive:"區分大小寫"},combination:{menus:{sortAsc:"昇冪",sortDesc:"降序",fixedColumn:"鎖定列",fixedGroup:"鎖定組",cancelFixed:"取消鎖定",fixedLeft:"鎖定左側",fixedRight:"鎖定右側",clearFilter:"清除篩選",textOption:"文字篩選",numberOption:"數值篩選"},popup:{title:"自定義篩選的管道",currColumnTitle:"當前列:",and:"與",or:"或",describeHtml:"用 ? 代表單個字元<br/>用 * 代表任意多個字元"},empty:"(空白)",notData:"無匹配項"}},pro:{area:{mergeErr:"無法對合併儲存格進行該操作",multiErr:"無法對多重選擇區域進行該操作",extendErr:"如果延伸的區域包含被合併的儲存格,所有合併的儲存格需大小相同"},fnr:{title:"查找和替換",findLabel:"查找",replaceLabel:"替換",findTitle:"查找內容:",replaceTitle:"替換為:",tabs:{find:"查找",replace:"替換"},filter:{re:"規則運算式",whole:"全詞匹配",sensitive:"區分大小寫"},btns:{findNext:"查找下一個",findAll:"查找全部",replace:"替换",replaceAll:"替换全部",cancel:"取消"},header:{seq:"#",cell:"儲存格",value:"值"},empty:"(空值)",reError:"無效的規則運算式",recordCount:"已找到 {0} 個儲存格",notCell:"找不到匹配的儲存格",replaceSuccess:"成功替換 {0} 個儲存格"}},table:{emptyText:"暫無資料",allTitle:"全選/取消",seqTitle:"#",confirmFilter:"篩選",resetFilter:"重置",allFilter:"全部",sortAsc:"按低到高排序",sortDesc:"按高到低排序",filter:"對所選的列啟用篩選",impSuccess:"成功導入 {0} 條記錄",expLoading:"正在匯出中",expSuccess:"匯出成功",expOriginFilename:"匯出_{0}",expSrcFilename:"匯出_從_{0}",customTitle:"列設定",customAll:"全部",customConfirm:"確認",customRestore:"還原"},grid:{selectOneRecord:"請至少選擇一條記錄!",deleteSelectRecord:"您確定要刪除所選記錄嗎?",removeSelectRecord:"您確定要移除所選記錄嗎?",dataUnchanged:"資料未更改! ",delSuccess:"成功删除所選記錄!",saveSuccess:"保存成功!",operError:"發生錯誤,操作失敗!"},select:{emptyText:"暫無資料"},pager:{goto:"前往",pagesize:"{0}項/頁",total:"共 {0} 項記錄",pageClassifier:"頁",prevPage:"上一頁",nextPage:"下一頁",prevJump:"向上跳頁",nextJump:"向下跳頁"},alert:{title:"訊息提示"},button:{confirm:"確認",cancel:"取消"},import:{modes:{covering:"覆盖",insert:"新增"},impTitle:"導入數據",impFile:"檔名",impSelect:"選擇檔案",impType:"檔案類型",impOpts:"參數設置",impConfirm:"導入",impCancel:"取消"},export:{types:{csv:"CSV (逗号分隔)(*.csv)",html:"網頁(*.html)",xml:"XML 文件(*.xml)",txt:"文本文件(制表符分隔)(*.txt)",xls:"Excel 97-2003 工作簿(*.xls)",xlsx:"Excel 工作簿(*.xlsx)",pdf:"PDF (*.pdf)"},modes:{current:"當前數據(當前頁的數據)",selected:"選中數據(當前頁選中的數據)",all:"全量數據(包括所有分頁的數據)"},printTitle:"列印數據",expTitle:"匯出數據",expName:"檔名",expNamePlaceholder:"請輸入檔名",expSheetName:"標題",expSheetNamePlaceholder:"請輸入標題",expType:"保存類型",expMode:"選擇數據",expCurrentColumn:"全部欄位",expColumn:"選擇欄位",expOpts:"參數設置",expOptHeader:"表頭",expHeaderTitle:"是否需要表頭",expOptFooter:"表尾",expFooterTitle:"是否需要表尾",expOptColgroup:"分组表头",expColgroupTitle:"如果存在,則支持帶有分組結構的表頭",expOptMerge:"合併",expMergeTitle:"如果存在,則支持帶有合併結構的儲存格",expOptAllExpand:"展開層級",expAllExpandTitle:"如果存在,則支持將帶有樹結構的數據全部展開",expOptUseStyle:"樣式",expUseStyleTitle:"如果存在,則支持帶樣式的儲存格",expOptOriginal:"源數據",expOriginalTitle:"如果為源數據,則支持導入到表格中",expPrint:"列印",expConfirm:"匯出",expCancel:"取消"},modal:{zoomIn:"最大化",zoomOut:"還原",close:"關閉"},form:{folding:"收起",unfolding:"展開"},toolbar:{import:"導入",export:"匯出",print:"列印",refresh:"刷新",zoomIn:"全螢幕",zoomOut:"還原",custom:"列設定",customAll:"全部",customConfirm:"確認",customRestore:"還原"},input:{date:{m1:"01 月",m2:"02 月",m3:"03 月",m4:"04 月",m5:"05 月",m6:"06 月",m7:"07 月",m8:"08 月",m9:"09 月",m10:"10 月",m11:"11 月",m12:"12 月",quarterLabel:"{0} 年",monthLabel:"{0} 年",dayLabel:"{0} 年 {1}",labelFormat:{date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss",week:"yyyy 年第 WW 周",month:"yyyy-MM",quarter:"yyyy 年第 q 季度",year:"yyyy"},weeks:{w:"周",w0:"周日",w1:"周一",w2:"周二",w3:"周三",w4:"周四",w5:"周五",w6:"周六"},months:{m0:"一月",m1:"二月",m2:"三月",m3:"四月",m4:"五月",m5:"六月",m6:"七月",m7:"八月",m8:"九月",m9:"十月",m10:"十一月",m11:"十二月"},quarters:{q1:"第一季度",q2:"第二季度",q3:"第三季度",q4:"第四季度"}}}}}});
5,120
5,120
0.712109
6a2a994243c6ec9d595d2757cf9f5cc05c08a7e9
2,791
js
JavaScript
src/scripts/widget/category-widget.js
maurimiranda/geodashboard
7af827f6de7f316c2a847c484c6a8600c5a74a64
[ "MIT" ]
15
2017-04-03T04:25:30.000Z
2021-06-22T12:21:29.000Z
src/scripts/widget/category-widget.js
maurimiranda/geo-dashboard
7af827f6de7f316c2a847c484c6a8600c5a74a64
[ "MIT" ]
4
2016-11-23T20:53:15.000Z
2016-12-23T20:28:34.000Z
src/scripts/widget/category-widget.js
maurimiranda/geo-dashboard
7af827f6de7f316c2a847c484c6a8600c5a74a64
[ "MIT" ]
3
2019-12-03T03:34:17.000Z
2020-11-09T12:23:27.000Z
import AggregateWidget from './aggregate-widget'; import template from '../../templates/widget/category-widget.hbs'; /** * Widget that shows grouped data fetched using WPS Aggregate * @extends AggregateWidget */ class CategoryWidget extends AggregateWidget { /** * @param {Object} config - Configuration object * @param {String} config.title - Widget title * @param {String} config.server - URL of map server * @param {Object} config.namespace - Namespace object * @param {String} config.namespace.name - Namespace to use * @param {String} config.namespace.url - Namespace URL * @param {String} config.layerName - Name of the layer to query * @param {String} config.property - Field to use in aggregate function * @param {String} [config.totalLabel='Total'] - Label to be shown within total count * @param {Object} config.categories - Categories configuration * @param {String} config.categories.property - Property that defines the style to use * @param {Object} config.style.values - Object with possible values * and their correspoding style * @param {Function} [config.format] - Function to parse and transform data fetched from server. * This function should return a human friendly value as it will be shown as * the widget current value. */ constructor(config) { super(config); this.categories = config.categories; this.labels = Object.getOwnPropertyNames(this.categories.values || {}); this.colors = this.labels.map((label => this.categories.values[label].color)); this.function = 'Count'; this.template = template; this.className = 'category-widget'; this.totalLabel = config.totalLabel || 'Total'; } /** * Processes the widget value and returns a human friendly version. * @returns {Object} - Current widget value prepared to be shown * @protected */ format() { return this.value; } /** * Parses data fetched from server and sets widget value to an easily readable format * @param {Object} value - JSON data fetched from server * @protected */ parseResponse(value) { this.value = { totalLabel: this.totalLabel, }; this.value.total = value.AggregationResults.reduce((accumulator, current) => ( accumulator + current[1] ), 0); let categoryValue; this.value.values = this.labels.map((category, index) => { const categoryResult = value.AggregationResults.filter(result => result[0] === category); categoryValue = categoryResult.length ? categoryResult[0][1] : 0; return { category, value: categoryValue, percentage: Math.round((categoryValue / this.value.total) * 100) || 0, color: this.colors[index], }; }); } } export default CategoryWidget;
36.246753
98
0.682193
6a2ae92b75de682ddd0992bda48de886e1e625e3
2,412
js
JavaScript
server/pipes/nlu-pipe-interface.js
servo-ai/servo-platform
dc5db0521aaeb9fd8c0c6bcd00654bd379793ee3
[ "MIT" ]
55
2019-01-24T21:46:07.000Z
2022-01-11T21:38:06.000Z
server/pipes/nlu-pipe-interface.js
autocare/servo-platform
dc5db0521aaeb9fd8c0c6bcd00654bd379793ee3
[ "MIT" ]
5
2019-09-26T06:26:46.000Z
2021-07-04T17:40:07.000Z
server/pipes/nlu-pipe-interface.js
servo-ai/servo-platform
dc5db0521aaeb9fd8c0c6bcd00654bd379793ee3
[ "MIT" ]
23
2019-02-16T13:52:05.000Z
2022-01-11T21:38:19.000Z
var PipeInterface = require("./pipe-interface"); var _ = require('underscore'); var dblogger = require('utils/dblogger'); /*** * @typedef IntentEntitiesObject * @property {Array} entities - an object with the message entities from NLU * @property {string} intent * @property {number} score - of the intent, or average entities score if no intent */ /** * NLUPipeInterface is the base object for any NLU API * */ class NLUPipeInterface extends PipeInterface { /** * resolves a {IntentEntitiesObject} * @param {*} text * @return {Promise} */ process(text) { var self = this; return new Promise(function (resolve, reject) { self.run(text).then(function (response) { var intentObj = self.extractIntent(response); let entities = {}; var entitiesObj = self.extractEntities(response, "", entities); entitiesObj.entities = entities; var score = intentObj && intentObj.score; if (_.isUndefined(score)) { score = entitiesObj && entitiesObj.score; } dblogger.flow("Intent/entities:", intentObj && intentObj.intent, entitiesObj && entitiesObj.entities, 'score', score); resolve({ intent: intentObj && intentObj.intent, score: score, entities: entitiesObj.entities }); }).catch(function (err) { dblogger.error(err, text); reject(err); }); }); } /** * train the engine with a new intent/entity * @param {{ text:, entities: [ { entity: 'intent', value, }, ], }) sample */ train(sample) { throw "stub!"; } /** * overridable * @param {*} text * @return {*} */ run(text) { throw 'stub!'; } /** * overridable * @param {*} response * @return {*} */ extractIntent(response) { throw 'stub!'; } /** * overridable * @param {*} response * @param {string} key pref * @param {*} entities object * @return {any} */ extractEntities(response, keyPref, entities) { //should return dictionary of array with values throw 'stub!'; } /** * None intent * @return {{intent:'None',score:1}} */ noIntent() { return { intent: "None", score: 1 }; } } module.exports = NLUPipeInterface;
24.12
126
0.554726
6a2b3c38edd8cdd24b95a0238b55b0dd1341940f
2,332
js
JavaScript
jquery.flot.topbar.js
jasonroman/flot-topbar
dd9bafbba51fd3667c120dade3dd7495de1cf685
[ "MIT" ]
1
2015-03-10T07:33:53.000Z
2015-03-10T07:33:53.000Z
jquery.flot.topbar.js
jasonroman/flot-topbar
dd9bafbba51fd3667c120dade3dd7495de1cf685
[ "MIT" ]
null
null
null
jquery.flot.topbar.js
jasonroman/flot-topbar
dd9bafbba51fd3667c120dade3dd7495de1cf685
[ "MIT" ]
null
null
null
/** * Flot plugin for specifying bar chart series that should only display the * top line of the bar and not fill in the area below; disabled by default * * Note: This likely does not make sense to use in combination with stacking bar data * * The plugin supports setting all bars or no bars to a topbar (default false): * * series: { * bars: { * topbar: boolean * } * } * * The topbar can also be turned on or off for a specific series: * * $.plot($("#placeholder"), [{ * data: [ ... ], * bars: { topbar: boolean } * }]) * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * (c) Jason Roman <j@jayroman.com> */ (function($) { "use strict"; // default each series to have the top bar feature turned off var options = { series: { bars: { topbar: false } } }; /** * Converts a bar to just display the top line if the option is enabled * * @param {function} plot - the Flot plot function * @param {Object} series * @param {Object} datapoints */ function topbarSeries(plot, series, datapoints) { var i, offset; // make sure this is a bar chart with the topbar option enabled if (!(series.bars.show && series.bars.topbar)) { return; } // determine whether to match the bottom of the bar to the x or y value offset = (series.bars.horizontal) ? 2 : 1; // datapoints format is (x, y, b), and b must be equal to x or y depending on chart orientation // so that the bar appears as a single line at the top (b is typically 0, or the axis beginning) for (i = 2; i < datapoints.points.length; i += 3) { datapoints.points[i] = datapoints.points[i - offset]; } } /** * Initialize the hook on processing the data points * * @param {function} plot - the Flot plot function */ function init(plot) { plot.hooks.processDatapoints.push(topbarSeries); } // push as an available plugin to Flot $.plot.plugins.push({ init: init, options: options, name: 'topbar', version: '1.0' }); })(jQuery);
27.435294
104
0.581475
6a2bb87357550d7296dfb524c11cc12b577870c3
6,253
js
JavaScript
packages/sentiment/src/sentiment-analyzer.js
igorjos/nlp.js
77c0b80d27ba58de31bce56c5762cc0a95eb81a6
[ "MIT" ]
4,883
2018-07-31T14:05:34.000Z
2022-03-31T15:08:03.000Z
packages/sentiment/src/sentiment-analyzer.js
igorjos/nlp.js
77c0b80d27ba58de31bce56c5762cc0a95eb81a6
[ "MIT" ]
1,081
2018-08-20T11:18:47.000Z
2022-03-29T11:33:44.000Z
packages/sentiment/src/sentiment-analyzer.js
igorjos/nlp.js
77c0b80d27ba58de31bce56c5762cc0a95eb81a6
[ "MIT" ]
542
2018-07-31T14:39:25.000Z
2022-03-24T20:36:45.000Z
/* * Copyright (c) AXA Group Operations Spain S.A. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ const { Clonable } = require('@nlpjs/core'); class SentimentAnalyzer extends Clonable { constructor(settings = {}, container) { super( { settings: {}, container: settings.container || container, }, container ); this.applySettings(this.settings, settings); if (!this.settings.tag) { this.settings.tag = 'sentiment-analyzer'; } this.registerDefault(); this.applySettings( this.settings, this.container.getConfiguration(this.settings.tag) ); this.applySettings(this, { pipelinePrepare: this.getPipeline(`${this.settings.tag}-prepare`), pipelineProcess: this.getPipeline(`${this.settings.tag}-process`), }); } registerDefault() { this.container.registerConfiguration('sentiment-analyzer', {}, false); } prepare(locale, text, settings, stemmed) { const pipeline = this.getPipeline(`${this.settings.tag}-prepare`); if (pipeline) { const input = { text, locale, settings: settings || this.settings, }; return this.runPipeline(input, pipeline); } if (stemmed) { const stemmer = this.container.get(`stemmer-${locale}`) || this.container.get(`stemmer-en`); if (stemmer) { return stemmer.tokenizeAndStem(text); } } const tokenizer = this.container.get(`tokenizer-${locale}`) || this.container.get(`tokenizer-en`); if (tokenizer) { return tokenizer.tokenize(text, true); } const normalized = text .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') .toLowerCase(); return normalized.split(/[\s,.!?;:([\]'"¡¿)/]+/).filter((x) => x); } async getDictionary(srcInput) { const input = srcInput; const dictionaries = this.container.get(`sentiment-${input.locale}`); let type; if (dictionaries) { if (dictionaries.senticon) { type = 'senticon'; } else if (dictionaries.pattern) { type = 'pattern'; } else if (dictionaries.afinn) { type = 'afinn'; } } if (!type) { input.sentimentDictionary = { type, dictionary: undefined, negations: [], stemmed: false, }; return input; } input.sentimentDictionary = { type, dictionary: dictionaries[type], negations: dictionaries.negations.words, stemmed: dictionaries.stemmed === undefined ? false : dictionaries.stemmed, }; return input; } async getTokens(srcInput) { const input = srcInput; if (!input.tokens && input.sentimentDictionary.type) { input.tokens = await this.prepare( input.locale, input.utterance || input.text, input.settings, input.sentimentDictionary.stemmed ); } return input; } calculate(srcInput) { const input = srcInput; if (input.sentimentDictionary.type) { const tokens = Array.isArray(input.tokens) ? input.tokens : Object.keys(input.tokens); if (!input.sentimentDictionary.dictionary) { input.sentiment = { score: 0, numWords: tokens.length, numHits: 0, average: 0, type: input.sentimentDictionary.type, locale: input.locale, }; } else { const { dictionary } = input.sentimentDictionary; const { negations } = input.sentimentDictionary; let score = 0; let negator = 1; let numHits = 0; for (let i = 0; i < tokens.length; i += 1) { const token = tokens[i].toLowerCase(); if (negations.indexOf(token) !== -1) { negator = -1; numHits += 1; } else if (dictionary[token] !== undefined) { score += negator * dictionary[token]; numHits += 1; } } input.sentiment = { score, numWords: tokens.length, numHits, average: score / tokens.length, type: input.sentimentDictionary.type, locale: input.locale, }; } } else { input.sentiment = { score: 0, numWords: 0, numHits: 0, average: 0, type: input.sentimentDictionary.type, locale: input.locale, }; } if (input.sentiment.score > 0) { input.sentiment.vote = 'positive'; } else if (input.sentiment.score < 0) { input.sentiment.vote = 'negative'; } else { input.sentiment.vote = 'neutral'; } return input; } async defaultPipelineProcess(input) { let output = await this.getDictionary(input); output = await this.getTokens(output); output = await this.calculate(output); delete output.sentimentDictionary; return output; } process(srcInput, settings) { const input = srcInput; input.settings = input.settings || settings || this.settings; if (this.pipelineProcess) { return this.runPipeline(input, this.pipelineProcess); } return this.defaultPipelineProcess(input); } } module.exports = SentimentAnalyzer;
29.91866
74
0.612346
6a2bf3fc647d522dea6d57d31585d83ce8bb00d0
47,304
js
JavaScript
static/js/127.379ac78717e1fe1e3e01.js
liefswanson/liefswanson.github.io
9ba651e40bf3b24cd387f3be1b335d1ca64f6fc0
[ "MIT" ]
null
null
null
static/js/127.379ac78717e1fe1e3e01.js
liefswanson/liefswanson.github.io
9ba651e40bf3b24cd387f3be1b335d1ca64f6fc0
[ "MIT" ]
20
2018-05-23T05:46:11.000Z
2022-02-26T03:48:08.000Z
static/js/127.379ac78717e1fe1e3e01.js
liefswanson/liefswanson.github.io
9ba651e40bf3b24cd387f3be1b335d1ca64f6fc0
[ "MIT" ]
null
null
null
webpackJsonp([127],{"2Us0":function(b,n){b.exports='�RCopyright 1990-2009 Adobe Systems Incorporated.\nAll rights reserved.\nSee ./LICENSE\0\0���\0\0��<�N\0\0S\0�\n\0�*\0�{\0�v\0�9\0�\n\0�e\0�W\0\0�n\0�c�L�\n\0u\0��V�E�T�c�\0�\0��\0�\n�%�$89R�a9�,�S�r�1V� ��4�i�e�v�\r\0�\0�\0>�L\0.\0\b\0�\0�I\0�\0\0�I\0�<�h!�0@��}��0�\n�����`N��"\0�\0�\0�7\0� ��e��b�#rIC�0M�\b(0r\0\0\0\0\0�=0��"�\tW\0�h!A>�b\0�\f�3:0\n\f\f5\n\n9����#�G��\r|�\f\0\0��X��9\0=�d\0�i\0�N\0�U\0��~\0����\0�2�\n�0��O\v��XB��n��u�����;\0\0:\0�\t��\v�FJ>�5����\t�\b�"\0*\0�\0\0��!��$\0��=\0�C���*�\f��<uK$��,���!�\0�~\0�\0<\0�\f�\0���JV8�\b�X�!\b�2�\r�"\0D\0A\0.�\0�w\0�|\0\0��i\0��p���] ���TeN��r�X��v���4��e��V�[�3��M�l��q�p����E�Y�r�a�-���T�p�%�6���q��.��]�V�&��`��|�\n��}�UH���V�P�\b�8X��*^�@�D�b�h�(@��b��&��(�<�$H���M�r��$��%��_�`�`��*�\r�j�;�F��]�\\�F�|�4�2��8���p��h^�4��a1�&��Z�\b�J��s��X��E��S���P�-��)�0�x�@��-�y�x�j��d���c��r�L�G�x��W�(�r�\0�\\�$� �f�tj�b�X�\n�J��R�\b���w�p�<��t��?��4��N��I�C�O��:�&�^��b�\0���(�r�\n�\b�v�R��h�4�\n��t�~��e�$�:���Y�hl�4�6�>�z�^�x��,�j�(�*=�j��G�h�H��o�\f�T���!�T���@�z�`�~�J�F��Q��Q�L1�F]�X��2�\n�b�hT�^��(2�*�L�n�,�`�z��RRP�d�n9�$�����|�z�N��)��\r�F�P��B�R�.�\0��\b���������\v�V�~�`�^|�Re�Z��z�P����7��\f�p�6�r�\\�^�&�"��c��Y��.�G�~�D�"�2�X�:�z��4�h� ����v���m�6��~�������.�\t��l��`�\\n�0�.�R�j�`�(������\\�c��\b�k�&���,��]�[�T�$�v�����h�f��a��H���H�<����5���L�\\�R�^��c����\r�D�V���;��x�?��Q�\b�8�b���&�C��v�J��,\f�R�v��4�8�\f�\\��L�(���h�%�T�N�N�f�B�~���r�X��n�(�0�<�0�� ��Z�(�!��A�d��&�8�D�^�\'���>�j����/�D�T��"���t��v�b��B��G�x�V�4�_�(�"�J���K�8�~���"��6��(� �\b�V�Z��y�x��$��$� �V��J�`�j�B�"�\0�f��\t��:�*��/\r�N�P���.��e��.��3�Z��n�j�j��]X���p�Z�j�H�"�V�V�\b^�`�(��dn�2�"9�N��f�A��D�Rp�\f�r�,�V�4��o�H��f��e��O�O�\b�`�j��\\��\v�\b�:g�:�V�\0�,�:�*$�H@8�b�r�b�j�\0T����\n�P�R�:�.���U�X��&�V�[�b��&�s�`��y�<�D�l��N���|2�l�v��|�\\�$�d�>�2�.�~��e��@��G�0�\\�W�8�|�$�x��,��7�D����]����\t�8��f�z��\'�P����-��\f���@�\'�o�A��z�\r�W�0�?��4��u�P���N�_�P�&��w��B����v�$���2�x�?�\n� B�`�\0����b��$� �$�,�z� ��b�>�Dv��t�4��,�8�h�/�*�2��C�.�F�x��0��1�a��2�2�>�6�^�D��7�%�\'|�,�vT��N�j�\f�Z�n�\n�t�|�R��&\\��J�4��[�8�B���^� �"�\b�4�z�H��k�6&��T�h�h�f�r�\b�f��r�*���x�0�.�z�,�$��r�v� ��R�L�r�r�R�\'~��:�p�@���>�V���t�t�\0�`�8(�z��L��L�8\n�$�0��e��T��K�.d�R�dD�d2�\b�6�Z�t�� �4�,b�*�\0,8�@�r�r��\0��&�\f�\0�`�p�f�j�f�&�|�\n�Z�(�(�H�$�@H$�\n�$�F%�V�Dt�4�N�r(�r�\f�2��T�v�e�x�N�P�n�&�|�D��A�� ��B�P��h�2��]�^��d���l�P�b���w�L�?�)�8�����@��1��<��s�J�f�2�6��<��d�n�\n�:�H�f�&��O�h�p�x�P�l��:�2���\n�o���,��m�@�d�o�(�8�h�p�F�&�6�j�(�h����( �\f�?�B�V�H��"��o��N�2�l��[���N��a��R���6�%��0��H��=�Z�\0�d�R�V�@��"����\'�� ��i��A��X�N�,�nn�\f��\\�N����\n����r�H��Y�[���R�\\�l�R� �v�\f�F�0�f�T�$�Z�.�8�.��I�|�>�m�J�\b�t�z\r�`�n��>j� �x�hP�V�\n�R�N�\'�$T�h�\b0�&�j��n�l@"�l�>�`�D�J�B�0(�^�^���I�`� ��\f�D��p�\0�<�R�!��|�,�X�p�"L�l�R�����\\��a���$��c�z��W��:��Q�Z�\n�r�.�4�H�j�\f�n�V����@�A��]��P��y��P�Y�^��k�T�F��z���"��0�Z�.�X�F�O�D���4�~�0�P�p�,�v�D�\r��G�\\��}�4�b��J�0�<�l��x�n�\\���\t�\b�$�(��`�d�&��M��2�\\�2�X�a�$�x�f��l��\b�4b�`�j�V�:�F�t��2@�2�U��9��j�v�"�t�\n�X��.��L�j��_�\b�J�"�� �\'��;�@�K��0�8��M�`�R�\f�l�p�D��s�F���2�R�D��2�*�g��&�"�|��Al�D� ��\0�I�6�>�u�l��\0���^�2�6�\0�\b���~��[�N�z�L�H�v�:+�J� �*�z�p� �R\n�*��\b�,�`+�\b@���F�x*�\f��\0��F-�\0�>�r�6�F�F��^`�*�"�8�~�h�z�&�*�V8.<�Z�x�\n��.�2��v��*p�~�0�:�J�.�*�*��p�D�Z�b�x�^�(�r�\n�N��_�����#�>��,�L�D�t�f�p��6��m��PY�"�0�x�2��@�\0�4�D�X�8�p��\n�J�|���^��t�~��`�^�,�T�R��\f��b�l�<��;�� �v�t�:���R�p�M��_���\\��=��D���*�,�R�(��"�"�v�l��c��J��{�B�\f�b��\n�d��[�4��V�"�/��u���E��*�`�]�W�b�V�`�Z�J�P�\\h�T�(�z�9��B�X�X�v�D�.��M����@n�"�h�~\f��!�\b�n�h���\\�z��\\�v�D�2�~�`��B�n�x�z�m��E�"��8�U��(�U�x�V�z�i�*�x��a�\\�t8��<&�\f�@�P�D@�(�v]�\t��b\\�e�f�Z�X�^�:�"�@:�X��>�L��j9�b�T��C�l�f�z���8��:�K���\b�,��&�8�|�j�~���n�F��X�\f�5�|��s��,*�3�@��@�Z�e�0��\n�PL�\t�v�"�6��-�R^�.���9��>��4��^g�\b�N�&��|��T� �V�R�\b�j����l��\b�B�$�.��;�`�$�V�v�2�*��\f�V���\f��V��w�������A��W$�<������\r��\n�@��\'�,���D�Z�f�A��T��F��+�d�n��"��?�z�*�4�T�P��`�Z�^�`�(�l�X�Z�6� ���q��l��\b�@�|�X��9��)�`�\0�$�\nh���d�h�@��o�x�\r��#�� ���G���I��\r��\f��i�X�(��K��8�������d��o�<�Z�>�<�8��N�$�r�"�~��t� ���\b��\n��q�F�l�\\�P�R�h����G��\0��k�T��(�J�&�J�&�\n�F�X�Z�U�[�8�.�d��O�P�F��+�<��\'�\b�L�\f�8�|�h�l����$�H�8��s���x�^�.��]�\b�\b�~�R�@8��$@j��z�<� �t� �F�N�~�r�\b|�z�8�P�Z�L�8��D��A�"�8�?�d�\b�j�T�\b����b�z��`�8��|���N��\f�q�P�)��D�+�e�>��+�`�\r��h��~��A��0� ���@�0���4��-�6�j��n.�N�X�P�\b�*�<� �\f�\f�x�(�L�t�F�:��H�h�T�j��S���$�|��,��N��/��\f�T��P�>�,���d�z�V��F�&�g�>�J�p��E��9�B�b�|����[��HB�(�f�b�\b�\b�\b�2�F��L�P��Q(��!�v��(�:���"@d���|�z�@�(�`�0�.��"�pD�n��,�)�&�0�k�\b�<�"��4����d�\n�t�R�j���f��8�l��1����l�j��0�l�~�(�b����b��K��L���.6�P�8�R�6�H�%�2�\0��U�:�S����U��V���M����W�M�l�.�<�J��L�"���j��\n��\v��4��=�q�8��\\�h�m�=�� ��S��"�a���A���|���\r�#�^�&��0��O����^��u�J�e�b�8�x��\\��g����~�Y���w���\r�u�{�\0�\n�<�P�(��+�p�c� �u�\f�2��^j��d�7�g��a�*�D��2��!�T�6�n�z�]��\\�n�|��s��2�h�\b�.�&�o�~%�\\�F���V�0�d�Z�`�0�r��\v��Z��#�5�7�{���u�j�h�d��t�d�,�\0�@��L����J�(��*�H��S��f��\n���A���T�w��k��l��-�Z�8�$��5��>�)�d�*���_�<���.���^�J��T�J�H�Z�|�r�L�z�L�X�T�x�~�K���;��P�8��e�V�\0�r�V�d�T��\tL�(�8��h�j�,^b�H��n�J�v�D�\f�d�V�Z�\n����<�x��!�X��?�H�^�0� �8�&�\b�X��c���=��"��B����l�&�3��9��8�F�j��+�y�^��h�%�Z��o�h�\\�:��>�\n�~�X�F��5�^�j��\b� m�-� �~��Y�T�>��p�"V�N��Y�L��S����t�J�I�4�0�r�>�\0^�\f�~��^�R��|���\n��NN��-�x�t�n���z��O�"��(�]�8���>�r�I���R��|�#�=�z�D�S��2��P���h�p�|�`��V�Y��4�(x�(��S�,��\v�6�~��D�,�r�=��,��"�Q���\r�\n�(� ����~�V���o�r�z�~�@�"2�p����>�.��V��!��r�$��O�"�&��`�n�%��G�f��h�F�<�b�R��\rW��\0�T�.�&�$r�X�4�j�,�t�"��.�p�p�d�(�0�>�*��.�>�6�V�T�j�p��;�"�V��f�:�(��1jb?�h�L�h������z�.�d�|�f��%����+��\f����d�|�>�>��G�:�7�\r��q�.���5��H�;�|��V�L��a�Z�Z�d�f�K�^�\t��\f���(��Y��&��k�o�x�H�`�b�~��0��/��~��"��q�4�:�T�N��A�l��4��%�B�S�M��*�%�\f�{�f��_��f�y�����|�z�v��r��-��O�g�N�^� � �.�@�6���d�1�q�v�jX�j�.���P�@��}�4�v�~�,�~�H���O�j��`��W��G��\n��C�,��b��C�L�(�h���E�,�J�:�v�.��S�x��=�h��N�\f�2���G�t�H���`�0�4����=�0�8��2�.�D�B�&�d� ��7��ou1�<�\b��b�\f�F��o��q�� ���t�j� ��G��M�D�|�B>�\f�4�Z��d�T�:�&�\f�4�j��~�n�>�P�4�.����$�@� �`�.^�y�\b�h�z��\'���\v��9�\n�6�X��s��4�f�L�B�>�r��}�J�*�P�2�:�x�<�X"�T�*�U��[�v����]�\b��9�n�4�X��"�L�f�U��`��/�n�,��,��-N�V�s�T�B�T�N�t�D�D�T�\\���D�R�$�J�D��{��j��M�X�|�f�\b�D�h��p�f����?�.�*�\\��u�"�(�V�r��B�*��,�@�|&����y��;��H�r��s��\b�$�J�h�j�t�|�h���U��X��9�j�p�X���}��r�$�H.�*�H�$�2�`�&�x����C��J���\f�L�9��S�<��H���2�{��m���"��3��n�K�U�3�Q�z�0�z���y\b(\f\b\n&R��J��C����\v��)N�.\t(\f."� UT\r!\\"\f;%\f@E,��\t#�:P)*\vA�S�2T]Bx�v�]\v"\t*2+\\�\vZP�&\f\t&�\tgQ\n\f0\b�rQR\0\r\0\0\0��*�\tyQn"�*�\n��Q�\0\0\t ��Q�\b"\b��h��Y\b\n\f\r0\b\n*��R^*\fC,��,�\f�R�\f\b��\f��$�/�S��^��W\n\b\b\n�]�b�o�\b�R�;\t&\n\n���\f��u�8�b�\r\b\fv�"�T<`�\x0050_"\nB/\b�\0K*\'\f.A,=26�U\b/1�,\fD/=Z/�O,U8\vRv3�#�4(I2\ne\fJE@b+27.!~;<1:E�(��W\t\ndkx6\r*\v*\r\b\n,\f\b\b\n\b��(�}WN\'\b2�,qO:$\n\n$�%�X\niN�(�#�\0/H��]+vf5FG,\n\v��Y\0\0\n\0\0�\0���Y2\n\n��&��{\v\f\b6���n&B��\t�Z%\r\' JVG�\r�Zb^B\vJ\'�\r�[\f6�E�2\b\v �[e\f��\nD"\t&\t\t\f\n\b\n"�#\\\r\0\n\0\0\0\n�K*\\A\b\b�=�t��&$\b�s�\v\n\v"&�<�E@�\b{\tf\n\t@\f >\v[L\b\n\b\f*�\nw^D;�\f�^z\0��\0��{\0@N\0\0\0\f\0\0\r\b\0��^�\b\n\b\n�&�#\n\b$\f?B�>�_Y\n,\v\b2H/&)�*�iB|�07D-\r*\v/T>3P1+\t\f*A@ER%N�2�I,-,��`�(9�*SN?�\t�#D�hq�\0a\0\0\0\n\0\0:\0M\0�\taG-D!\b\\�(ak\v%BFH1\n!\f2:Z_\v �Z�Y0$\r�\tDb\r\f�\vObA\b\b&\n\f�T\\b�z�# �\r-&^s��&!\bYZ�=jK\n3\n�4%���\fTkX)\r**��(TS\n85Fe�":]$�L�\r 3�.\fQ�6�+"Cf:8-\\�B��b��lxm\n4/<�\r�e7�$�\n(\n�\rӋ���_\v\n��e�\0�\0\0�Q\0\0\0�n�\t�f41d\b8\f��f_$\b\n\v\v&\bF:\n�C�L\f\b.\f�\v�8�� .��!g�3p[%B4\v9bnwnsjcV\r\bk(@�h�}N;,76�H�Z&>!:31�T�k�\v�\0+2�(��oza��\vT\f$%�@I[�Y3p!�7�d76/R!kto6S`F/�\tB#"+�M�B$E9�\f�;\t<R209��#:�)�XcLS<�\\�=!`q�Jy�c4=!-�Z$9�$�j��~�9\vbk^ � �9.��4��%0�H�G��h��O\t\n\f\v\f��k�\0\0\0\0\0\0\n��k�\b\b\t����m�glt.32;-<fX=-2%._\t@&- h�Z�/"\v?6C\r�,^_<Ah\f��?�f6�+"<]J%6-hC(|�\0�+�0\'C7���S]F&U�4�E4�N%`%6-(%�xln�*8G�Ba�t�A\n�\0�|���M�bW9�#)�.�\r(\rIj`�9�!(9h,10\'Z#,!#8�M�P\v\f <"j8��\v\v\v`)"\t^<�!dE\t-*D�V�o $T=\b&\r"\v\f\n\b��rF\b6\n\b" �\r�r���Q��"\r\f,\v\r\t0�1\r�؁�$\n�+4\'\bH!��;�R�[r4->\r14\f\f$D\b\b�G�\\\b�@t�\f\n"+&\v�^ut*"\n<\v6\f\v�wu�\0\b\0#\0 \0\0\t\0*\0\0\0\t\0\0*\0\t��vg\b\b��v�\0��v�\t�\b�iH\v\r��w��wG$!2\v(\n"\n\n�<�w�\n\f\n�&�\r��K�5":,"\bB\b-\bB\vD$$(>\v\vL\b$��F��C\b�\by�\0\0"\0\b\0\0\0H\0\b�\nz �?�`&�&zi��f��[$<1\n\v��y\n�\t@z�\0\f\0\0"\0\0\v\0\t\0X�M{,2R�m���\0^!��^{l\\\v\f%\fevb7",N]�t�A\fA>/X." \v\f\b\f&\f\b*\r\n�0�\t2t\n; X;F\n?&^]f%:<""%�"�7XI3 N\b\f\r8#F\b0<%-,F>W\r\vX�\n�~y$�]�N�`�_�\v~�\0\n\0\n\0�R\0\0\0\0�g \b\b\f�p�\r1�\b\n�D�-\f\f�4@�\b\f,\t\t\n\b\n\n\b*\f$��;��6\\3*\td5R\r6�~�\v(�+�h�v�t\b:�\tf*\f\b\r\b!"����,���\n$\v0\b\b\b\n���.\0��"��~\b06h\tB\f�0�!7NUXa�6=6,-\t�F׃�(�g�Tp�T/<�<Q;\\\nWd�jO"4(�G�t���b�"�:�-�&3G5��\t�(�Q�,\nAr%<\bk�~E�8�,1�D!�\0�oTF9:wL\f��G(K\f"p(-,\b8 \t6*��q��|B�D[��(-0�2�qP\t&D*) R-�\n0YJ; \n+\r\f�4�G;X6�\n�W0#&f%\\�%��y|\b\b%&\f\b*>Sn�(\v6++,�Ȉԑˈ�6\r"^K\f�ۉA\v&_�\b\b\f\b\b\b\n���ڑ���$\r\t 2fDF!�0��@. Di(3`\v$sh\r\f$�n�\v\b$-0\v\b \b�L���O�:\f\b\f\t\b�a��\x001\x006\0��w\0��\0\0$\0\0"\0\0D\0\0\0D�v�\n�z�w�\r�\f� \n.P\t\t(\t!����\0\x000�F��D\v* \tmp@\t\b\n\f\b *+\f0!$\v\f\r\t2\t\b�⏜D\b�.�\' �\f�) 6��1�t.\n\f\f�b�m\v\n0\fX��9��$L\f020>\v\n�\b5��\0\0\b\0\n\0\0\0\r\0@�*?�?(./\t�%49��-\b�\r��h-bJ+�-+,\v\n@61�2�k��\0H�*o��+26j\r!J)0\f ,\b\t��\f\b\nGB�\b����\n\b��)��\n\b|\f���B\tV7\f\r@$�ǖ�\0\0�̖���`qF\v\f\n\n��D\r\f$��-��0\n\b\b����\0\0\0�\0�� �B�;�\'�,2V)*\n\t>��tl\b\bD.\n�,�$\0\t\0\0&\0\f\0\t\0\0\v\0\0�,\0D\0\t\0\0\v\0�J��Gl"\v,\t\b��\fo��\t\n\n"\b�}�%\0"\0\0\0\f\x006\0<\0!\0,\0\0\0\0#\0\0�7���!�0�H\r\rR\',+&6\n\f�\\\b0;.F\t��\tH_\\�֝d\'0,Fy>\b"\r,\rH%\f���\0�,\0\0\0\0\f�\v���\t��T�\t\v��\b\f\b����\tv���:"�\r*�l\v<\f��c�.��"�k��E��3IkTkId4\n�0<��3�\0G\0�\t\0\0�\0�l\0�Y�\v�29�\b�;��\v�>�\b�U^\0��*\0��%\0��\0��\t\0��,\0��K\0�i���c�ݑ�VB����9�J�\0�c��\t�Z�*��a��7�P��W���B\v��]���O�<�u��t��!���~���\\Q\0��D\0�g\0�5���V�t��~k\0�4���c����P&�J�J�������B��,�)���j��{�\v�F�X�!�y�3�`����~�ܑ&p|�H�R��e��\'��/����n��\0��V��.�-�o�M��D�c��y�D�t\\�`��E��(��Y�<�(�d�j�\'�6��/�T��K��%�6�~܄�7����K��Z���@�8�+�7��h����j��\0��6����m��h��p��K�J�~�w�6K�ߤ��+��0��*��.�M���"�a�+�m�m���M���k����4�O��>��i�i����H��C�� ���j��W��[�1�y�X����B�D����$��(����7�G�V���p����\0��t\0����~���Q����~��\0�w��U9\0\r\0�`\0�\0�d\0�J\0�d���F��\f�\\[��d�"�8�6�@�D�&�@�>���P��\0����/�s΄j�z�P�h��V��\t�l:�X$�h�2�<�\b� �"�BL���n�H�\\�D�0\\��,�8_��!��p�r�3�v �d��P�4�n�b�\n� >����x�O\v��\r��u�����[\0�����F2>\f$2>\f�3IkTkId4\n�0<�=�����+�U�^�O�*���I��8�G��a��Z�U��6�{����V�x�\r��i��&�\b�T���N�b�~�\f�4��T�\n��p�l�hy�\f�&��l�;\v�J�0��r�\b\r�z�X3�\0�\t\0�\b\x004\0\0\0�b3�w�}�i%>f+w`*S�D��=�X�N-��o\b�}\x000\0.��2Q�$�2C\r\v\n\t\n\b\r�j\t\n7*%$301�[��_��h��g�\t��8\0��&\0�\0��\0\0��D\0\0��\0s\0e\0c\0�����k�%�2��R\0�7\0��\0��\f\0\0�A�1\0�,\0\b\0\0�\0\0�r\0�_��5\0\0��^\b�c\0\0\0\0\0\03\0\0?\0\0\0�\0\0+\0��\t J�"�O�� �F��D��S��I� W \0\0\r\0\x000\0��P\0�x� g\0X\0I\0I\0I� h\0X\0I\0V� i\0X\0V� l\0x\0i\0i\0i� m\0x\0i\0v� n\0x\0v� o!\0�k\0� r\0T\0B� s!;\0�\0�}� x!�!�� }Y\'\0�N\0��e\0��� �g\t�POy>\0˗�����v� �3{\0� �g\t�POy>\0˗�����v�w �334Y#Z4�(F:+?.w:8-��0�"�V��Y��\'��b��,��`��}�m�;�p4j8v\rp�d=G<NR]�"�>9�b2p@ZP�\f24H\f8�@<T����%<�*�\f�$�\f6��q���&�0�\n�\0*�6�R�\\�/��&tbV����`T�\\!\0]Ѕ $d�L�|N\b�&�]<J�N�t�$��Tx`�~�b(H!\n�\0����@J\f"t&��(�,�%�\0����y��(��)����tKX�F�b�P8R/�TR�1L*DP\rxDk(��X~@�8J�F�.�!^�A��$!_q�x�d�J����@�\n#h%`\bfL*�B�Z�$2����\\��/��bX**�j�!�y���s��~�j*��h��c�d��|��+&�4/j�v�h�2��x��;�@8�\\�"�V�<\n"��f��_�!���Z�8H�Z,@����Y�8V�`:�F��X��)�\b!��g\0�l\0��\0��#\0"\0�d\0\0\f�\f!ƒ\r^\n\t"1Z~�\'!Ԓ�!��,��%�"\tM��X��?:7�Z3�B.2p&��f��D��"���!��\'��\b���^��08B�\b�^\v����)�n��4�!�"L\0�\0\0S\0�\n\0�*\0�{\0�v\0�9\0�\n\0�e\0�W\0\0�n\0�c�L�\n"�\0��V�E�T�c�"�\0��"�\n�%�$89R�a9�,�S�r�1V� ��4�i�e�v�"�\0�\0�\t"�`.\b��I�\0�I��"�#2\0��#T >��}��b���eh!A>�#d\0�\f�3:0\n\f\f5\n\n9�G��v�!�#�0�\n���#��`��b�#rIC�#�0M�\b$\x000r\0\0\0\0\0�$0��"�\b$1\0[\0\b�h\0��eL��"\0�\r\0�r��M�\n$�R~�1r�R~�1r�$� p�G\0�g�$�\0E\n�$��\0�[�$�\0I\n�$�(\0�P�$�\0O\n�$��\0�K\0\r\0�J\0�g�$�\0e\n�$��\0�[�$�1\n�$�)\0�P�$�\0o\n�\r$�ԁK\r�N�>�g�/�Z\b�$�Z�\v$�s�w�Y�R,\n��% \0�\0\0S\0�\n\0�*\0�{\0�v\0�9\0�\n\0�e\0�W\0\0�n\0�c�L�\n%X\0��V�E�T�c�%d\0��%h\n�%�$89R�a9�,�S�r�1V� ��4�i�e�v�%�\0�\0�\n%�`.\b��I�\0�I���v�r�%��\0�\n%�R~�1r�R~�1r�%� p�G\0�g�%�\0E\n�%��\0�[�%�\0I\n�%�(\0�P�%�\0O\n�%��\0�K\0\r\0�J\0�g�&\0\0e\n�&�\0�[�&1\n�&)\0�P�&\0o\n�\r&�\0�K\0\r\n�\0�\0\0#�\0�\0\0#�\0�h�&4\x000\0/\x003�&7\0��\f&>\x001\0/\x007\0����~\0����~\0����~\0����~\0����~�����}\0����~\0����~\0����~\0����~\0����~�\r&N\x001\0/\x001\x000�������~�������~�������~�������������~������~������~������~������~������~������~������~�&[\x001\x000\0/\x001\x001�&\\\x001\0/\x001\x002\0�������~\0�������~�&_\x001\x001\0/\x001\x002\0��������&a\x000\0/\x003����|\0����~��������~��������~����~����~��������~��������~����~����~����~����~���������~����~����~���������~����~����~����~����~�\r&}\x001\0/\x001\x000�������~�������~�������~�������������~������~������~������~������~������~������~������~�&�\x001\x000\0/\x001\x001�&�\x001\0/\x001\x002\0�������~\0�������~�&�\x001\x001\0/\x001\x002\0��������&�\x000\0��d�Y&�\x000\x000\0\0\0\0\0\0\0\0\0��n\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�&�\x001\x000\x000�\'\0x\0i\0i\0i�\'\0x\0i\0v�\'\0x\0v�\'\0X\0I\0I\0I�\'\0X\0I\0V�\'\0X\0V�\'.0B\0\0\0�\'40M�\n\'H0r\0\0\0\0\v6\0\0\0�\'d0��\'x0�\0\0\0\0�\n\'�SAN\0���"��0�U�N�˧�9�\'�U�\0�]\0�D\0�9\0��\b\0���=\'�0c��R��\r�p���"��0�U�N��F��u�p���"��0�U�N��F��u�p���"��0�U�N��s��P����"��0�U�N��F��u�p���"��0�U�N��F���!�>5�\'�\0(\0)\0��\f�D(\x003\x002\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�(H\x001\x000\x000�(}0B\0\0\0�(�0M�(�0r\0\0\0\0:�X\n�8��\\\0��A\0�\0�V\0�\0�\f\0�M\0��\f�(�2��D�=��d�c���\b����^��_��d)\b\x000\x000\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�)l\x001\x000\x000�)�0B\0\0\0�)�0M�\n)�0r\0\0\0\0\v6\0\0\0�)�0��)�0�\0\0\0\0�\r*\x000��b�D�D�o���P��e�!��\b����y��?�*\r\x000\x000�*\x001�*\x000\x001�*\x002�*\x000\x002�*\x003�*\x000\x003�*\x004�*\x000\x004�*\x005�*\x000\x005�*\x006�*\x000\x006�*\x007�*\x000\x007�*\x008�*\x000\x008�*\x009�[*\x000\x009��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�*z\x001\x000\x000�*�0B\0\0\0�*�0M�\n*�0r\0\0\0\0\v6\0\0\0�*�0��*�0�\0\0\0\0�+e�D�D�o���P��e��\0���b��\b����[���c�+\x000\x000�+\x001�+ \x000\x001�+!\x002�+"\x000\x002�+#\x003�+$\x000\x003�+%\x004�+&\x000\x004�+\'\x005�+(\x000\x005�+)\x006�+*\x000\x006�++\x007�+,\x000\x007�+-\x008�+.\x000\x008�+/\x009�[+0\x000\x009��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�+�\x001\x000\x000�+�0B\0\0\0�+�0M�\n+�0r\0\0\0\0\v6\0\0\0�+�0��,\n0�\0\0\0\0�\f, e�D�D�o���P��e�!��\b����W��a�,,\x000\x000�,-\x001�,.\x000\x001�,/\x002�,0\x000\x002�,1\x003�,2\x000\x003�,3\x004�,4\x000\x004�,5\x005�,6\x000\x005�,7\x006�,8\x000\x006�,9\x007�,:\x000\x007�,;\x008�,<\x000\x008�,=\x009�[,>\x000\x009��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�,�\x001\x000\x000�,�0B\0\0\0�,�0M�\n,�0r\0\0\0\0\v6\0\0\0�-0��-0�\0\0\0\0�\v-.e�D�D�o���P��e�!��\b����7�-9\x000\x000�-:\x001�-;\x000\x001�-<\x002�-=\x000\x002�->\x003�-?\x000\x003�-@\x004�-A\x000\x004�-B\x005�-C\x000\x005�-D\x006�-E\x000\x006�-F\x007�-G\x000\x007�-H\x008�-I\x000\x008�-J\x009�[-K\x000\x009��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�-�\x001\x000\x000�-�0B\0\0\0�-�0M�\n-�0r\0\0\0\0\v6\0\0\0�.0��.%0�\0\0\0\0�.;e�D�D�o���P��e�!��\b����W�B�o�.I\0P\0H�.J3�\0�.N\0V\0S�.O!\0\0��.Q\0c\0/\0c�\t.R3���"ML�\v�r\v�.[\0m\0/\0m\0����~�._0U0X\0\0��^�.d3\0�.f0�0�0��.g3\b�.h0�0�0��.i3\0�.k0�0�0�0�0�0�0�0��.l3\t�.m0�0�0�0�.n3\v�.o0�0�0ׁ.p3\f�.w0�0�0�0�0�0�.x3�.y0�0�0�0��.z3�.{0�0�0�0�0Ɂ.�3$�.�0�0��.�3%�.�0�0�.�0�0�0�0ޅ.�0�0�0ā.�3-�.�0�0�0�0�.�0�0�0�.�32�.�0�0�0�0�\0�����|�.�3<�.�0�0�0ȍ.�0�0�0�0�0�0�0�.�0�0�0��.�37�.�0�0��.�38\0\0\0\f�.�0�0�0�.�0�0Ɂ.�3R\0�.�0�0�0�\0���P�.�3S�.�0�0ȁ.�3\0�.�0�0�0��.�3\b�.�0�0�0��.�3\0�.�0�0�0�0�0�0�0�0��.�3\t�.�0�0�0�0�.�3\v�.�0�0�0ׁ.�3\f�.�0�0�0�0�0�0�.�3�.�0�0�0�0��.�3�.�0�0�0�0�0Ɂ.�3$�.�0�0��.�3%�.�0�0�.�0�0�0�0ޅ.�0�0�0ā.�3-�.�0�0�0�0�.�0�0�0�.�32�.�0�0�0�0�\0�����|�.�3<�.�0�0�0ȍ.�0�0�0�0�0�0�0�.�0�0�0��.�37�.�0�0��.�38\0\0\0\f�/\x000�0�0�/0�0Ɂ/3R\0�/0�0�0�\0���P�/3ST\0\0\0�/\rS;vBl�N���������~��������e��������~����ڝ��j������ʶ������v����������������x���ߡ���{��������~��������e��������~����ڝ��j������ʶ������v����������������x�\t/\0-\0\0��\n\0�x\0\0� \0��W\0\v�/8\0J\0A\0S�\b/9!5\0�K\0�r\0�w\0��5\0�>\0\n\0�/A��t�/D&l\0��%\0�\0\0\b\0\0��\0�\0\0��Q\0��4\0\0�\0�/U\0\\\0\\�/V"\0�\0;�.\b\0\0\0\b\0\0\b\0\0\0\b\0\0\b\0\0\0\b\0\0��\0��p�/�\'�tW���Z��\r�4\f��[�!3y�/�!�\0w\0\0�/�%�R�S�P�S�P�S�P�S�P�S�p�=�\n/�%��^�\'�/�%�\v4/�[�f�/�0S\0\0�>\0\f=\0G�J\n\0U�C\0D�N\n\0K\b\0��c\0��`\0�\0\0\v\0-\0!�D\0�\f1�0A\n">\f�1�0�\0C�+\0\0\0\0�\n2>0�>\f��V��y�r�2J�\0�\n2MR~�1r�R~�1r�2] p�G\0�g�2p\0E\n�2q�\0�[�2s\0I\n�2t(\0�P�2v\0O\n�2w�\0�K\0\r\0�J\0�g�2|\0e\n�2}�\0�[�21\n�2�)\0�P�2�\0o\n�\r2�ԁK\r�N�)�/�Z\b�2�Z�\v2�[�c�@�R,\n��2�\0�\0\0S\0�\n\0�*\0�{\0�v\0�9\0�\n\0�e\0�W\0\0�n\0�c�L�\n3\0��V�E�T�c�3 \0��3$\n�%�$89R�a9�,�S�r�1V� ��4�i�e�v�3>\0�\0�\n3~`.\b��I�\0�I���v�r�3��\0�\n3�R~�1r�R~�1r�3� p�G\0�g�3�\0E\n�3��\0�[�3�\0I\n�3�(\0�P�3�\0O\n�3��\0�K\0\r\0�J\0�g�3�\0e\n�3��\0�[�3�1\n�3�)\0�P�3�\0o\n�3��\0�K\0\r\n�\0�\0\0#�\0�\0\0#�\0�\0\0��\n\0�x\0\0� \0�4\0\'\v�w\v����>��1��3+��V���)3��g��k\\���8�\b��w�I�8&3�4\'�Q\0\0,\0��\\\0�l\0�e�4-�~�E��%4.�V\r?��L��GJ��.��\rN��*��k��%��H��M��N$I(��\0��K*0G#��\b��y\r��b��W��(��;����_�e�|�M��F����j�`��A������r����.���Z�O��3��J�J��Y��D�c��K���6�5�v���%�h�2�p�3����?��\b��C��6�=��O�m��D���(��x��S�U���X��b�H�p� ��-�d��W�d�,��&���9��@��7�.�^�[�c��@��/�V�0�R�d�.��)�&�l�U�"��%��\n��a�?��f�r�|��\r����\t��~��\v�Y��,�y��H��A�,�\f�t�Z�Z�c���i�Z�^�H�"�(�g��}�N�<�S�T�%u��[��&�v�Q��s���4��B���4�S@��0��a�.��:�\\�6��p��2�T�~�H�\0�R�L���D�T��z�w�l�8��n��Z\'~�\0�J�X�\0V�J�n�-�J�<�v�8�\0�R�.�pd�p\b&\n�8lT.�H�D�~�\b�6�Nr6l\\\b�Z�N�|�{�`�\t�BJ^\v\n�x�@�HD �4�L����Z4�,�\f�p��/�J���&�bH��^��5��$��\\�\0�]�(�z��w�z�5X�~���\r5YqY�\f�t��?�y��\0����t��;��4�B�(�J�5f�~ݕ�\b5g��\0�\0��1\0�h\0�{\0�h\0\0�5o�~��5pi�\0�)\0��Q\0���5t�~�"�5u�D����g�:�p����\0�w��O�_��v�H�v�~��.�T�5��B߷�\n5�U���H�j��y�Z�X�h�e�R���5��g�K\0\0���N�5�_:\0�*\0�`�5��M�:\0�5�����.��-��1��N��A��n��e��L�I���Y�����V�b��L��{��>�Y����~�v�5��~ܬ�5�gC\0�J\0�^\0��5��B�d�\f5������ �>��i�N�����L�p�B�F�5��~�� 5�n/�J�|�z��@��{��n��?�T��e����_��n� �R��Q�z�Q��.��U�\f�~��\\�0��M�5��~�\v�5�s��5��Bߟ�5�ch\0�f\0���5��~�(�5�r5�5��~�!�5�L\0��7\0�m\0�6\0�`�5��~�?�5�}B��f�T��E���8����&��k�n�\v�-�P�\\�6\b�~�s�6\v\\\0�\\\0�(\0�p�6�@�\v�6[��6�~�R�\f6`ţ#����c���s�����\\�N��=��@�6�~�G�6�2\0��o�6!�@ݢ�\t6"R���|�t�+�"��G��6+�~ܲ�$6,vۥt�R�>T� �/�\0�h�]��R�~�+�� ��.�|��U�K�4�f�\\�� �V���-��(�+���K�6P�O���\v6Q�\0Z�6� ��i����~��"���e�(�6\\�~��\v6]�����e���K��7��D�|��?�l��N�6h�~ܚ�6i_�\0�x\0�T�6l�~��6m����?�s��@8��a��p��7�(�Z��H�y��e�[��\n�5��3�6��D�=\0���8�+6�U����?�>�|�@��E��\b��k�-�<��B��-�2��~��"��%�r��v��A��R�L�!�V��!��2��>��{�^�J�v��W�2�v��#��������t�s�6��~�b�"6��U��y�V�?� �l�b��\'��p��[��,��\f����0�V�p���u�F��2�L�p�d�Z�2�,�\\���6�!6�b?�6��,�"��5��\f��V�L��E�y��k������"�o�u� �.��g�i��B�H�9��h�y���\'�s�q�6��~��\0�6�R�\0�\0�X�6��U��6��J��]��K����}^�r��P��N��\n��j��z���$�f���I��L��Z��m��x�T�7�Yް�7P�\0�\0r\0�\0\0��\0��\n\0��7�@܊\0���B�\v75>�@�8��`��T�p�D�J�f�7)�~�m�7*\\\0��e\0��\0�Z\0�\0�4\0�f�71�~ܶ�72b�\0�\0�-\0�B�76�Zݙ�77c\0�\0\0\0�"�7<�~�ۑ\'7=h�!�P�a�=�$� �\b�u�\0�]�`�\f�0����^�ZH�\n�l�B��;��p|�,$��n��;�(�a�\0��a��V�Z�7d�~�l�7e~"\0\0J\0\'\0\0��\b�7n�X�p�7q�\0�.\0��]\0��\b\0@�\t7x���U��@�\n�G�l����B�X�7��@ܰ�+7��7����p����.�l�:�D6�0J��g��*�H�.�F,4��p�7��b݇�7���\0�<�7��c��7����R�8�b.\nv\n�x�,\n�P�\f�R�8Lv�0�7��i�\0���Y\0�\b7ˉ\0��)\0�\0�m\0�\v\0�\0�\0���7��~��7�js�7��Oܾ\0��[�7׊��g\0�7�ND*HD,8�KJ�7�O�\0L\0 \0Z�7�P\fP_�&\f\n^2\n0\b�\0�4B\n�8R\0j\0.\0\b\0X\0h\0N�8S>*|\\bJ0\b0\n\f\f�\x008(�8:U�\0\n\0�r\\\0\0\0\0\0,\0\0\nJ\0\b,\0.\0&\0\f\0J\0\0\08\0F\x006\0\x006\0Z\0\f�8`W�,"�PH\nD.b�8�8vZ,F >\b\fX>0&t�8�[��0\bd\n$�\fB^8�\b\fn."�\t8�^\0*\0R�\0@\0\f\0h\0\f�8�_"\n\b\bH$\b.40Z:<\n48�8�a�> "28j&2\n\b\b�Zn@�8�ce\fdX\f"b\f"�8�d�""Z>2xZr>�9faXFF0>(R\bh�\fE,v�\v9%h[,\b@:\n"\b�92h�\0(\0\0B\0\n\x006\0\0f\0\f\0�\0\0\n\0$\0\0\0\f \0\b\0N\0\n\0�9Rj�\bb\n BvD<D\b<8\b\ff�!9ol�68P\f\f8x\b\n$p\\�j\\8\bL4\b\n�9�o�\0F\0\x004\0~\0\0\0\0\0"\0\0&\0B�9�p�T0 000@.R8"�\r9�r\\\0`\0>\0\f\0$\0fX\0\0"\0P\0\0\f"�\f9�s�\b\b$\f\n�9�t$\0\0�\v9�t9\n\b\n�9�t�\b"�^T�:u�\0^\0(\0\f\0�\v:\tv\b2�:v�\0\f\0>\0\0n\0\0J�\t:wr.(v"6�:*x0\0\b\0d\0j\0R\0\0\0*\0\b\0\0j\0\0\f\0\0�:>y�>P\n\f N�:VzƁ\0$*\f"\b<:Nb \n\b4\f��:t|�\0\0\0�\t:{}\n:"\n8�:�}�<\nL4\b2\f�V�:�a\0^\0Z\0\0 \0\n\0\f�:��&&F P\b�:��Bh^4R: "\b|>\fn�\b`\f\b\n �:Ӄ�HpVb\f ZNR`N,C�H,P $\f�\v:��\n\b*d, �:���@(&\br\bf"�;��\0\0T�;�\'x�0*\nV`�hT.�$;+�T��P<`h,\n8�. >*fT@.6\b:H:<�^�;Q��2"R.�\f"D\n,D\b($\nR�;o��f\f@\b �B�&;��Z>$\bZ<#..."H**\f�\nZ8�F,V>\bP�;��~���\v;��� \f� \bL�\t;���\b**\b$�;��Y\0$\0�\0\0\b\0\x008�4\0\0\0\0�".\0p\0&\0\0\0\0"\0�D\0\x008�<;��s\nZ2\n6"\f�~\b6\n$F"@�\ft\fB\b*" 4��e�W�<�~��<V \0�T\0��m\0���<!�M�:�<"k$�(�\'�����B�4�X��%��^����V���\n,�$�d�:�X��b�,�x��H�F�<>�L���<?s�\0��k\0�1\0�`\0��<D�M�ā\b<E��\0��T\0��W\0��8\0�q\0��K\0��x\0�O�<M�g�=�<NFe\0�E\0�\0�4\0�M�<S�I�\t�)<W�z\0\b��\0\0�j\0�9�\0*\0�c\0�v\0�A\0�/\0<\0A\0\tg\0\0V\08\0�\b\0�G\0\b\0�2\0q\0D\0A\0.X\0?\0\0�i\0�|\0�=\0M\0.\0�p�<�0K0�\0��~\0��~\0��~\0��~V���~\0��~\0��~\0��~\0��~\0��~\0��~\0��~\n���~�=k0S\0�>�=\0��v=u��1�&�78\n(�m�*�;8�V�Q\n(�D�CQ�%lg\nh.�%lg\nd.�j�#&N�G&N�2%e8\b+$T[ �5�Z]b�-� XI��(@c<4M%tQx�v/\'�r�3\b�Z�a�=���\0��y�=�%\0\f\0\0;@\0)\0\n\0�#\0�\n\0\0\0!\0�&\0\0�>�\r>\rj \b�>"\n\0\f\x006�\n>!"�\n��e�\n�>�p��9>/��1p8\n(�mp8\n(Q�%lg\nh.�%lg\nd.�7&N�G&N�>l0\0\0�j\0\0�A�>�0K0�\0��~\0��~\0��~\0��~V���~\0��~\0��~\0��~\0��~\0��~\0��~\0��~\n���~�\f??0S\0�>\0�\0�\0�\0�5�\0�&\0�1\0�p\0��\r?Q0K0���~��~��~��~���~��~��~��~��~��~��~��~�?^�\f��\\�?v1�0��?� >\0��\0��&\0�w\0�\0�+��U\0�X\0�\f\x008\0<\0\x002�\v�\0��?�1�0��\r?�0K0���~��~��~��~���~��~��~��~��~��~��~��~�?�1�0��\r?�0K0���~��~��~��~���~��~��~��~��~��~��~��~�@1�0��@)�\0�3�\r@0K0���~��~��~��~���~��~��~��~��~��~��~��~�@51�0��@@0S\0�>�@L1�0��&@S0S\0�>\0�\'�\0*\0�c\0�\b\0<\0A\0\tg\0\0V\08\0�\b\0�G\0\b\0�2\0q\0D\0A\0.X\0?\0\0�i\0�|\0�=\0M\0.\0�p�\0��v@���1�&�78\n(�m�*�;8�V�Q\n(�D�CQ�%lg\nh.�%lg\nd.�j�#&N�G&N�2%e8\b+$T[ �5�Z]b�-� XI��(@c<4M%tQx�v/\'�r�3\b�Z�a�A��\0��y�A%\0\f\0\0;@\0)\0\n\0�#\0�\n\0\0\0!\0�&\0\0�>�\rA0j \b�A?"\n\0\f\x006�\nAD"�\n��e�\n�>�p��^AR��1p8\n(�mp8\n(Q�%lg\nh.�%lg\nd.�7&N�G&N��4,�BP�`Ejb>�E�(.�h�hH@�\fr�h�X�`V@�X�D�\b�A��D��A�W�\0(\0�~\0H�A��E�n�\vA�X���@��m\f`��&~�A��Fܽ�A�[}\0*\0�|\0��-�A��E޴�A�\\z\0(\0\0\0\f\0J�A��G�4�*A�]\rrrDF�$�4\f@2,P�\f8"�*l�� �Pn(�L�J�P�&��0�f�81\b(�A��L�đA�f�Z>�<r"\b�@@�\n�L|�B\t�M�ā\bB\niB\0B\0�\0\0R\0��3\0\0��J\0�B�M�?�Bj;�B�M�c�5Bj� ��-�� t�RN\n�\\F�Dk�T\n0v*`�L2�$��8&6J�:L\\~�\fD,8d� ��-��6�BJ�Q��BKs\'P*v�46p>j.��K��6f\n�686.\n"0�Biwz\0\n\0&\0��Bm�U܎�BnxC\0T\0��Bq�U��\bBrx�\0�$\x006\0"\0\n\0"\0d\0��Bz�U�q�B{y�\0\0\0\0�.�B��V�ā\bB�z�\0\\\0(\x004\0\0f\0�"\0b�B��Wݡ�B�|m*\bh�6TLD6�J�\\��2�$*$�X�B��m\0�\0\0\0��y\0��\b\0&�B��Z���B����B���**NBjRN>\b�0 "06�B��[�@�\nB…2) h*"*PB"�BΆ�B��\\���\rBІ><��\v��.�����;��>\n�z�B��]ބ�Bމ2\f\f�&�B� *&�4�j$f�V<�\fB\n�2z�B��`�w�B�HD\0��j\0F\0\0L�B��`�́B���\0\n\x002\0H\0�R\x006\0\0N\0H\00\0\b\0�\0�Z\0�.�.C��vH\\,0�8 (\b��G��Z�\f��<�\f0\f"�t� �`�T�zV\n��c��*`:\n&^,$T�\bCA�e�:\0\0n\0\0R\0)\0�CK�hݐ�CL��\0>\0�,\0 \0�N�CQ�@܉�CRN\0\0\0,\0\b\x000�CX�@ܢ�CYNQ\0��C[�@ܤ�C\\Nif�c�\f\bD#,@�[\f2�Ck�@��CnO��@i$\n\f�Q�@b\b~7�C�P�\0(�C��@�+�C�P�$\0\0V�C��@߁�C�P΃C��@�q�C�P�\0\0��C��@���C�Q�C��A�J�C�Q`�C��A�\t�\bC�Qs\0\0\0�\0�6\0\0\0�M�C��A�ցC�Q�\0<\0�C��A�O�C�RU\0\f\0\0\0\0�C��B��C�R��C��B�:�C�R�J\0\f�C��Bܹ�C�R�\0z\0�C��B�|\0@�C�Sg\0$\0R\0�C��B�ӁC�S�\0�C��B��C�S��e� ^�u�(<P\n�C��C�E�\vC�T�\0\0\0*\0d\0\b\0�7\0�@\0�?\0�v�C��C��C�U}\0\b\0\0�\0���C��Cޕ\0Q�C�U�\0\0\0\b\0\0��\0���C��C�d�C�U�\0|�C��C�_�C�V>��y��\f,��Q�� $"�D�D�\0�&�D\bW)�D\t�D�{�D\fWM�D\r�D�t�DWh\0\f�D�D��\0�DW�\0\\�D�D���DW̃D�D�6\0�\nDW�"��M��Z\f2"�D)�D�ā\bD*XI\0\x004J\f\0\0\0\f�D6�E�m�D7X�\0\0(T\0\f�D@�E�ׁDA6�\0��V\0��I\0��X\0��a�DF�[�)�DGY_�DH�E�G�\tDKY|D\b \f�DT�E�\0v�\tDV6ρ�z\nn( �DaZ�\b\b4\f$8.\n*\f"�Du�F�ÁDv[�\0*�\tDz[���U��\n����J�D��G�V�D�\\_ �D��G�-\0.\0d\0-�D�\\�\0\0���D��Gݡ\0\v�D�\\�\0\0\b�D��Gݒ�D�\\�\0�D��Gݷ�D�\\ɃD��G��\0�$�\fD�]4 ��#��p��m��v�D��G��D�7�\0��\0��\0��,\x000\0�D��G�v�D�]�\0\n�D��G���\vD�]�\b��u\f��<<��[��r��k�D��H�{�D�^�\0\f\0\0\0$�D��H��D�^�\0�D��H߭�\tD�_P6 $H�\tD�_� \0��9\0��\0\0��\0��b\0�\0$�D��I��D�`� (\f4\b6����"\b2�D��J�[�D�a�\0\0�D��Jܫ�D�a�\0\0.�D��Jݏ�\tD�b#\\,\nJv�E�J޸�\bEb�\0\n\0B\0\0\0�E�J�F�EcY�E�K�\0��o�Ecl\0X�E�K�$�Ec�\0PD�\fEc�V\f\nT*�E,d�\0�E.�K��E/d�4��#��@\b��C��T&",\nN\f��}��D04��I�EN�L��\0b\0�EQfj�\rETf{\b��\t��<��7�\v��R �Ea�L�r�Ebg�Ec�L��\0�EegM\0\f\0�Eh�L��\0&\0�Ekgt�El�L�ځEmg��En�L�߁Eo�c\0�\'\0�\0\b\0\0\x006�Ev�M�J\0\f\0\r�Eyh\0\f\0�E|�M�e�E}h3\f��A��f\n\n��S�E�h�.\0\f\0~�E��M��\0�j�\tE�h�\0\0\f\0$\0\0\0\0���E��Mݔ�\rE�;���pD.��]��b2 �E��M�9\0\0�\bE�i�\0��M\0��L\0\0$\0\0�E��M��E�j?\0\0`\0Y\0\0"�E��M�\f�E�j�\0��7\0��`�E��M�d�E�j�\0"\0\0\0\t\0�E��M��\x001�E�j��E��N�$�E�k\v�E��N�=�\vE�k��c��4&\b\f2$�E��Nޘ�E�k�8&\0&\0\0\0N�E��O��E�lM",\b��\r�� *(��a���F�O�\0�\fFm\0\0F�{\0�\0\0<\0\b\02\0\0\0\f�F�O�@\0�r\0\0M�\rFm�\n��&\n ,~1����@�F+nO�F.nW��\v��h&�b� \n�F?�O�~�\vF@oR\bN\nN?\n���FMo�FN�Pܖ�FOo�\0\0\x000�FS�P��\vFTp:��c��\b �F_�P�ƁF`p�\0"�Fb�P���Fcp�E\fb����\\@����-4\b�Fw�P߼�\tFxq�T����\\\b(�F��Q�)�F�rx\0\f\0�F��Qޥ�\vF�r� ��C��V��M��\f�\bF�>�\0��j\0\0\f\0\0(\0��}\0��,�F��Rܖ�F�sq&\n\n\n*\n"23\f�"\'F\f�F��R�M�\fF�t�\b\b6$�F��R�V�F�t��F��R�o�F�u \0\0\n\0��\'�F��S��F�u@\0\0\0\0>\0\0"\0��/\0��X\0��W\0��p\0\f\0\0\0\0\f\0\0"\0(\0#\0\0��C�F��S��F�v�F��S�7�F�v%\0\0&\0�F��S�j�F�?�\0��n�F��Sދ�\bF�vI\0\0��}\0��,\0L\0\0�G�T�J�GvɃG�T�U�G\bv�G\t�T�"�G\nw\0\0$\0�G�Tݩ�G@9�G�T��\x001�GwX�G�T��Gw|�G�T�L�\tG@X\0��\0\b\0\0~\0\n\0\0�G!�U�.�G"x\0\0\0\0$\x004\0D�G)�U�ف\tG*x�\0\0\0\0\x006\x002\0 .�G5�Uݧ�G6yH��\'��BD\b�GFy�\0���GH�Uߩ\0�GJAO��t\n��q��(\n6�G\\�V�ԁG]A�\0��\b\0\b\0��\0��\x006\0�Gd�V��\0\0�Gg{=\0\'�\nGkA���}��\'��LF+�Gu�V߲�\bGvB\0��\0\0��\0��L\0\f\0\0\b�G~�W�K\x000�G�{�\n$l\b\f\n�G��W�.\0N\0�G�|��G��W�b�j�G�|ăG��W�G�|̓G��W��\0t�G�|�G��W�\\�G�|�\0\0��{\0��\0�G��W��\0�G�}@\0\f�G��X�\f\0��#�G�B�\0��\0\0\n\0��\'\0��B�G��X��G�}�\0�G��X�`�\tG�}�,��I�G��X��\tG��X��\f\n\b0^�\bG�C+\0��\\\0��/\0��p\0\0\0\b\0���G��X�p\0*�G�mD\0��+�G��O��G��\0\n\0 �G��Y��G��&.*$D(: �G��Y�~�\rG�� L1\n����\f/��]��f\b�G��Y��\rG��=��k��@��%\b��P��G��j2$\b�H\f�Z�݁H\r��H�Z��H��\0 \0�H�Z�o�H��H�Z�݁H�\0�H�Z��H�<\0\0\t�H�Z�X�HDv\0\0��8�H�Zތ�H �\\\0\f�H"�Z޷�\rH#D�\0��V\0\0\0\f\0<\0\0\n\0\0J\0\n\0�\vH4�\f�s$$��3*C�\tHA��V\f&6�HJ�[�s�HK�\0B\0*�HS�[�ݑ\tHT�e$\b��i��.��m�H_�ӃH`�[�e�\vHa��\0\0\b\0\0\0@\0F\0>\0��Y\0���Hp�[ߔ�\bHq�{\0\0\0\0\b\0\0\0�Hy�[���H|��\0\0�\nH���\b �H��\\�\r�H��9\0�H��\\�9�H��@\0$\0\0@\0\0�H�����]��\f\n\f�H��r\0�H��\\��\0�H���\0=\0\0\0�H��\\���H�E�\0��0�H��]��H���\0\0 �H��]�I�H���\tHć�P(\n��[��t�H��]�\0�Hψi�H��]�1�Hшo\0`\x006\0�H��]ޓ�Hֈ�\0\0��%\0��~�H��]��Hۉ7�H��]�#�H݉B\0\0�H��]�R�H�bL\f \f@$����"��!��B�H��^݅�\vH�!&\f�*=L>H�H��^ބ�\vH��\n\v ��C��\b.�I\n�9�I\v�^߳�I\f�=�I\r�^߾\0�I�E\0\0\0"\0�I�_ܸ�I��\0\0\f\0��k\0��l\0t\0�I�_ݠ�I��I�_��\bI�\t\0\b\0�r\0 \0d\0��\0��~\0�I\'�`܊�I(�\0 �I-�`ܻ�\vI.H��>4P\n,\n�I9�`ނ�I:HN�I;�`��I<�\0\0\0D\0(\0\0�IB�a�\f�IC��\0�IE�a�U�\fIF��\b��:��5\n6\n T�IR�a�k�IS�C\x002�\tIW��\f ��Y��t\n\b�I`�a�ׁIa��\0�Ic�a���Id��\0\t\0\0+0\0\0"\0\n\x000\0:\0\x004\0\b\0\0Z\0�I{�b�I\0�I}��\0(�I��b�k�I��B\0\0\0\0\0�I��b݈�\fI��\0\0\0\0\0\n\0\f&\0\0,\0V�I��b�\0�I���\0b�I��b�q\0]�I��Q\0\0 \0\n\0\0Z�I��bޙ\0f�I���\0\0\0\0�,�I��b��\0�\bI���\0U\0(\0\0B\0l\0�I��b��\0Z�I��m\0\0�\0�I��c�\0�@�IĕȃI��c��\0F�Iǖ,�I��c�6�I˖<\0H�I��cމ�IΖ��I��c��IЖ��I��c�2�I�I�\0��\0\f\0\0���I��c���\rIؖ���3����u��\n�I��dޠ\0 �I痖\0�\fI뗾\b$\f��5�I��eܐ�I��%\0B\0<\0�\b\0\0�J\0�e�ρ\nJ��\0\b\0\0*\0\0\f\0(\0���J�e��Pl�J�1�\fJ�A\b"�, \b\b�J\'�f�ƑJ(��\f\n $��-��X��K��X��K��L�J9�f�r�J:��\bD\n"��;��T.�JP��\0\n�JR�g�ۑ\tJS��\n\nh7\b\b�J\\�g�\0�h\0��J_�\f\0\b\0\f�Jf�g�āJg�1\0\n\0\0,�Jk�g���\vJo�T\0\0\0\0$\0\0\b\0�V\0\x000�J�g�ׁJ���J��h�/�J�LăJ��h��J��2\0��C\0��p\0(\0�J��h��\0�o�J��s�J���(: \n��9���<�J��H��J���\0\b\0*�J��hߌ�J����J��i�7�\vJ���>����l�J��i��J��]�J��i��J��i\0\0�J��i޲�\vJ�.��N�0�<��B�"�Z�r�P�T�J�Ny�r0"�$20�~$(,@H�\tJ�Q3\bvf\f�\vJ�Q�\0\f\0J\0@\0\0\0\f\0:\0\n\0�J�R��("\bN\b*\b \b\f�KS�\0d\0,\0\f� KTL�4\f$6""4(P  \b�K;V,&\f`2\f (*\b�KOW\0\0�DKTW_&,L"J0L",F�Dj>:.V"\f�r\nbH,�|>|D �^Fd6H\b�b\\JN&�.K�_M�<z8�$�&p&N\n,:4F\n6Rx*.b2B&\b:�K�c�\fK�d\n\n$(6�K�d�\frT4,b<\n�<� K�f��*>T$�R�:�HB6\bD�j�0"z�Lk\0n\0�Lk��\f\b<:Hd:�4xl�(Zd�\fL0o&\f�,* �*$P�.�L>qE\0�X\0�\0D\0\0F�\fLFrZ\n�\b6$�3LTsM�x^\b\f4:<t8\b\b( (\n\b(�6"\b\f&\n\f\b\f\b\b\n\b.�L�w� \f.�\nHB2*p$�!L�y?", \\0J.Fv\n@�\0X�Pn\n<\f$�L�|r,6\f�B h(\n,(�\vL�~/\fT�v:�L��\0,�L�\n 4�\n�\0\b0\f\b&0L..\bX�M��\0\0\f\0\0�&M�>P,\b0\n>2\b\f�>B�~�6t:z�\fN$�R�r�&F: �M6��\b  z"\n\f\b&�MI��\0$\0�7MN�&H\bP\f0�f,>$ f4\f2�VN|2&\b�"D\fD"�M���\0\0\x004\0�M��M\b"\f\b\bt, \b\b�#M����<,&8(\b""L(>h$\f4\bt2�$.@�MҒ��<BL` 2$�M�.\0:\0�v\x000\0:\0\f\0�$M��z\f\b,>\f\n.�(.\n\0\nj\f2\n&$.<�N�� x>$�T$:�N$�\0\0�N)�6$$.\n$l20"\f�X �R�\f�\nNH��f,\n\b\f\f�NT�4\0J\0(\0\\\0\f�\nNY�@������Z��\0���B`�$|�p�Nc5�\0��C\0\0\0�Nh�h޲�NiN\0.�Nk�@�X�NlOs\0�D\0�,\0�z�Np�Aݱ�NqQ�\0<�Ns�A��NtRd�4\0(\0�V�Nz�C�X�N{U��:�H">�N�L6�j�n�~0l�N��V�̑\vN�^C�Fv�(�Pv�\b��\n��)&�N��K�B�N�d�\0� \0��5�N��K��N�e�\0�N��^ݴ�"N�e���\f��*�\n\f�$4��/��t�@�Dz�t@�L�,��S��\b�p�\f�b�"N��g��,�R�0\n�~�N��P�K�%N�r>��}�?��P�d�>�<8\\�6\b�<�\\�\f�P��B�^�p�P��D`�H�<d>�DH�<tr�@�N��[ܞ�\rN�Q"�V�|&N�nh��(\n��{�N��_�<�\fN��j� �8����H�\0�\0B�\0�O\v���H�6��*�\\�$�8�Z�.�,j� \n�6,r�`�2�j��O&�N�=�0O\'{\b�3���A���w�*�Q�b�,�\v�G����h���&��E��+�l���\f�~��5��r��7�)�\t���2��U�6�P�H��\t��j��k��@��k���0�J�OW�X�L�OX�\0�N\0�R�O[�g�=\0��8�2O_\0�!��V��\r*6g\b:�;\f 6�H\t�C�W�:�-\f 6�l�.�O�%ʑ2O�\0�!��V��\r*6g\b:�;\f 6�H\t�C�W�:�-\f 6�l�.�O�%�\0��\tF\0=\0\x008\x009t\0ut\x007\0:��\0\0\0\0\n\0��6\0��u�P\0C\0L�P\0K\0C\0L\0������P\0A\0S\0\r�Pk�\0��\0T\t��_�\nP+\x000\0ׇ�~��~��~��~��~��~��~��~��~�\fPI^t��M��4�9�D�^�a�G�|�j�o��O�PU0{0K�\tPVR��`��T��s�X���X�y�P_\0P\0V\0���PaS̃Pb\0S\0S\0E\0\0\0\0�Pf0ǃPg\0H\0V�Ph \0\0�<Pm\x000\x000\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�dP�\0\'\x000\x000\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�dQ\r\x000\x000\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�2Qq\x001\x000\x000\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0��l\0\0\0\0\0\0\0\0\0�Q�\0.\x000\0\0\0\0\0\0\0\0\0��\0\0\0\0\0\0\0\0\0�Q�\0p\0p\0b\0�Q�\0\'\0S\0���<\0��~\0�\n\0��\0��r�Q�\0J\0r\0.\0������Q�0�0�Q�0�0�0��Q�0�0�0�0ʉQ�0�0�0�0�0ȇQ�0�0�0�0�\0�������~\0�������~�Q�0�0�0�\0�����~\0����~�Q�0�0�0�0�Q�0�0��Q�0�0�0ɉQ�0�0�0�0�0ȃQ�0�0�Q�0�0�0��Q�0�0�0�0ʉQ�0�0�0�0�0ȇQ�0�0�0�0�\0�������~\0�������~�Q�0�0�0�\0�����~\0����~�Q�0�0�0�0�Q�0�0��Q�0�0�0ɉQ�0�0�0�0�0ȁQ���\0�Q�00\r\0�2Q�\0�!��V��\r*6g\b:�;\f 6�H\t�C�W�:�-\f 6�l�.�R%ʑ2R\0�!��V��\r*6g\b:�;\f 6�H\t�C�W�:�-\f 6�l�.�\tRN%ʂ�.��EA��C��L\f\b�RYN�.V\f\n\f\n\b6�RjOR \n\n2�\fR}O�\n\n$�R�P5\0\0\b\0\f\0\f\0\n\0\0\b\0\0\n\0:\0\0\0$\0\0\0"\0\0\0L�R�Q/\b\b.`\b@D$\f@\b�R�R�\0\0\0�R�R�\f\b*\f\b\f�\fR�S0\0\x008\0\0\0:\0$\0&\0\0\b\0"�R�S�\f4.\f(\n�\nST�T**�SU2\0\0\0\0\0L\0&\0\0\0:\0$\0@\0\n\0\b\0\x002\0\0\b\b�\tS9Vu\f6$\b�SGW\0\0�!SLW*($\b\f\b$\b\n"&>(\b\bOT" \b$�SoX�\0\0:\0\0\n\0\0\f\0\0H,\0\0\f\0\0�S�Y? \f"\n\fT\n\n�S�ZH8(B\fZ�$.�\bS�[�0\0\0\0\b\0\0�\tS�[�\b.H�\tS�\\{(D,�\bS�]\0 \x006\0\0\0\t \0�S�]\n.Z\n$T�S�^\\&:&4\f\n4$�T\v_.\0\0\0\b\0,\0\b\0\0\0$\0\0\f\08�\fT_�\n$�T-`q\n\b�\f�{"�T?`�,\n\b\bD\n\n�\bTSa�\0 \0\0f\0\0\n\0�\rTaa�"0\f,@�Tqb�\f�-Twb�6"\f*8\f8\b\f&\n\b>,J4\bB\n(�T�d�\0"\0$\0\0�T�eC:4\bD\f�T�f\r�T�f\f\n\n(\r�T�f�\0�<�T�f�\n0(6\fL.�T�g�$\b\b:\b,�\bUhy\0\0\x000\0\0\b\0D\0�\vU\fh�\f\f\n4&.�Ui{"&,j8$:(,�U*j�0.F\0\0\n�\fU8k\t<,\b("�UHk�\0l\0\\\0\f\0\n�*UUl.6. 4*$\flT\b>\nD\bl,\b\nH\f�U�n�\0\0\b\0\0\b\0�*U�o\b\b>B,$(D(2.\b|\b0�\n\nB��b*�U�q�\0\0:�\tU�r\f*\n�\vU�r�\0\0(^\0\f\0<\0\0\n\0<\0\0@�U�si\f$0\n\f �U�t\x006�\0\0@\0\0\0&�U�t�\b\b(�V\tu�\0\0\f\0:\0�.\0 \0\n,\0\0(\0V2B\0\0\0\0*\0\0\0"\0\0\b\0:�V.w�(D*\n@\n�1VBxcV0\n\b\f&\f."\b\f>\f2\n�VuzH0\nT"\bF\n\f�\fV�{j\x002\0\b\0\b\0\0\0\0\f\0\b\0\n\0$�\tV�|\n\f�V�|F\b\n$R&\b(J\bF\n \n(�V�~\0=B \n\f\n^�V�?82,>L�!V�.\n>&n\b\b6" 6*,8�\fW\r��4\b &�W��\0\0\0\0r\0\n\0\0f\0\0\0\b\0\0\n\0\b�W3�p(\n"�W�(`�Y�*\n\n(�WR��\0J\0\b�\fWW�\f\n\b �\tWg�y(\b�Ws��\0.\0\n\0\0\08\0\x004\0\0>\f\0\b\0\0>\0\0\f\0\b\0\f�W���\n\n\b�?�v>�W��E\0\0&\0�W���\b,\n\b\b"\b�\vWÈK\n \b<"�WЈ�\0\0\0*�W։ \b\n\b\b�Wꉠ\0&\0\0@\0"\0\0H\0\0\0\0\0\0\0\0\0\n\0�X��\b\n\n�X��$"\n\n\b**�P\n$\f\t�X/�f.\0\b�X9��\b\f�J2\n\b\b i�XX�\0B4\0:B\0\0\b\0.\0\f\n\0(\0"\0\0\n\0\0(&\0\b\0\n\0\n\0\0\0�\vX��en4\n\b 42�\bX��?\0D\0\0\n\0B\0,\0L\0�X���\'j\b\n\b\n\f2\n\b�X���\0\0\b\x0002*\0\0\nJ\0\0\f\0 \0\0\0\0\0\0\0\0\0\0\0\n\0�X��\b&\n0\b\n\b�\bY\0��\0\b\0\0\0\0\b\0\0�Y\r��\n\n:\f\n*\f\n*�t\n�\bY&��\0<\0\0\0|\0(4�Y4�n$\fF\b4(P�YF�{\0\b\0\0\0@\0\0\0\0\0\0\f\0\n\0\f�"YX��<\n\n\f0�:2 .\b\b"~ :\f�Y��\0\f\0$\0\0 \0\0"�Y��T�\f\b�\vY���\0\b\0:\0\0\0(\0\n\0�Y��x\f\n\f\n\b&P*(\n8�vD$�YΝ:\0\0>\0:\0\0\f(\0\0 \0&\0\0\0\0\0�`\0\0*\0\b\0$\0\0\0�\vY���0\b\b"\0�\vZ�G\0\0\0\0\b\0\f\0\0"\f\0\0�?\0;\0 \0]\b\0� 9\0� \n\0�\0�\0\0�\0\0�\0\0�\0\0�\0\0�\0\0�\b\0 \0"\x009 \0]?�`0�0�\00�\00�\00�\00�0\0K%\00\b\00\000J0j0~0�0�0p\00s\00v\00y\00|\t\0�0\0�0�0�\00�0\n \0 \0�\b\00\t0\b\t"f 2\0�!�"�\0"�"\'\f"j"+ �\v\f\t��!�AR0AU0�\f�������\'*6�T�M�\\N��O_؁1s6�oN�)O�P�\vQ\tQ?Qi\tQ�Q�Q�RKR�\fR�/T,"T�UVOW7W�%X�Y,Y�\tZ5\rZ�\r[Z\\\\8K^6\n^u^�^�^�_V>`�`�a\raX(b\b\tb2\vb�Td�e4\re�\re�f5\tfgg&\vgc�j�$kx\0kk�lgn�xr;\0r?r�\rsN1t�u�u�u�v vGva\0vhv�v�w%w7w�<y�\bz\nzaz�z�\b{{p�~Y\n~�~�~�L\0P_\0h�\r�4�e������j�w"�F�8��\0��D��%�����*������0��������\b��\0����\b�F�b��\f�O\0�Q1��\b��*����*���.�����=�����o��=�Q������\0����\0��\0��\f�"�\'\0�.�M��\0����7�]���\v��\t����\0�\t�_\0�f\rK%\0\0$`\0\t!`3�\03�2�\021\v")�0��L0\n�\b\00\0�G\t0\b0�0\00�=3�3�\b$�\0$t\t!p\0\t2R\0$�$#�#�\v3�2*+&\0&!j%�%�\0%m%�%q\00�\t \0 \b\'v!z\n!�0��]�\\qF%�� �$\b��\0��\f�w\'�*;\0 \0]\b\0� 9\0� \n\0�\0�\0\0�\0\0�\0\0�\0\0�\0\0�\0\0�\t\b\0!\x001\0* \0]\0�?�`\00�0�\00�\00�\00�\00�0J0j0~0�0�0p\00s\00v\00y\00|\000\b\00K%\0 2�\n![\0!S t\0\t �"YZ\v\0 \0\0<\0]\b\0� 9\0� \n\0�\0�\0\0�\0\0�\0\0�\0\0�\0\0�\0\0�\n 2�\n![\0!S t\0\t �\t\x000\0(\0\0.\0\0:\0\t\x000\0(\0\0.\0\0:!S!U![H\t\x000\\\t!p\0!z\v!`\0A0J0j0~0�\00�0�0�0�0�\00�\0\t2 \t\x000\0\t\x000?$`\0$eE$�\0$�0J0j0~0�\00�\0.2�\t2�2�\b2�u\0a\0\0A0J0j0~0�\00�0�0�0�0�\00�{\0a\0\0A0J0j0~0�\00�0�0�0�\00�0�\00�}\0a\0\0A0J0j0~0�\00�0�0�0�0�\00�z\0a\0\0A0J0j0~0�\00�0�0�0�0�\00�y\0a\0\0A0J0j0~0�\00�0�0�0�0�\00�!!3�3\r33\033(3.34\n3>\03C3K\03O3U3\r33\033(3.34\n3>\03C3K\03O3U0\f\00\00\0�\b\00\0 \0 \f&h\b03�\t/Y"r0\f00�_0\f00�_��3/p#�#�#�0\0 \0 !�\0!�!�!�%�\n%�0\b\00\b\00\n0�\0\t0A0K\00M0Q\0A0S\00�\t0�0�0�\0A0�\00�\00�\0\t0A0K0Q\0@0S0�\t0�0�0�\0A0�\00�\0�E\b0�\00�\0�\b\00\0�\b\00\0\t\x000\0\n0A0LB0R\f\n0�0�\v0�\x0060�0�\n 2�\n![\0!S t\0\t �"YZ\v;\0 \0]\b\0� 9\0� \n\0�\0�\0\0�\0\0�\0\0�\0\0�\0\0�\0\0�\n 2�\n![\0!S t\0\t �\t\x000\0(\0\0.\0\0:\0\t\x000\0(\0\0.\0\0:\b0\f\00\00\0�\b\00\0 \0 �[�b.��F_�&s6pP�.�`NN/\0N@O}P\0RS\nU`V\bVqV�\bW3W�Y�[~^^k^�_acBd�f[h0\vh�\bii�jPj�l�!o�\bp]p�rUss�s�\ftt/\vt�u�v\vv�w_\tx-\bx�\by[z�|�}\t}�R�������\v��������C$������2��\t�R�2���-���3t�`0�\00�"f"�\0"�"�\0"�#\0"\'"�\0"%"j"+"vU0A0�\0M0�\b\t1�1�\00�"�>\0�v�\b\0:b\r�"r\n>\0�90�\00�U0A30�\0!0�\b\t1�1�\00�0)4)�\t$�\0&\t1�1�\0#�%�\0 G1�"v\0"�\0"�\0"�\0#�\0\v&r\00�0\t1�1�\0#�\r\t1�1�\r\t1�1�\t1�1�\00�\t1�1�"f"�\0"�"�\0"�#\0"\'"�\0"%"j"+"v"�>\0�v�\b\0:b\r�"r\n>\0��\'fwlwM5�g\t��!�4���"�d.�O�(OwP�P�%R�5]U\0.V�WEWsW�X�X�\bX�\0Y\vYuZ�7a\v\\g6^m_�_�a��E�J�O�/E\vc;\fc�c�\fd�&fl9h�h�\th�i�\bj2j�kk�k�m&m�nH\0nKnSo�(q�\vrns\tsn-u=u}u�u�\nvv�w�x�y�#{.(|�}=!~�\nc}Q���\v��\r�Q\0�Y\v��\b�$�a�Hz�[���H�����d��D�� �!�IU�a�ȡIh���F���\b�|�I��bݺ��I����\t���3��\r�2\b�������:1�k\0�v�\t�I�i\0�m\b�\v�v5N#Q\f\tQ�R1RxS�T4 VWW=D^�.c�c�\fd�f� j�k}n�\fp�rO\fs:3w�y\'!|R\0|[}�\v����&�����7���@��#���\r��$�b���\r��\n�*!Rq)e]g��R�2"d�2"d���\n\0\0\nR\0^\00�0�0�\00�\0\0A\n\b\x001\v\t\x000\0\t\x000"$��t�2"d�2"d\tNtOKO�\0O�\fP2PQP�P�\0P�P�QQ\'\0Q,R�R�S\'\0S+S�S�Tm\nU\fUZU�\bVCVa\tV�\0WW$!X�X�\bYY5ZD[�[�[�[�\t\\t\t\\�]_]y^P_+_t_�_�\f`V`�\0`�a�\0a�a�\0a�a�\rb�b�b�-d�e\be<e�\0e�ff�f�g�hp\bh�\vipj�j�j�j�k\fk�\0k�k�\0k�l&*n�n�*q�r\b\tr{r�\bs]s�tgt�u{v9v�v�wwVwsx`1z4{?\b{�{�\0{�\t|9}�\0}�~��!��\f�����\n\0��M��\0���\f�\\\0�_\t���\r�X�`\b���<���H\v�������+\b�v\0�z���c�u������7�]������ �R\0�]\v�(\0�3\b�����������\0�$\0�.\0�5�\\�n��\b����\b��\0�����%�9�V�w����"��\0��\0���J����\0��9�V�m�3�S���������\b��\v�C\b��'}}); //# sourceMappingURL=127.379ac78717e1fe1e3e01.js.map
23,652
47,251
0.308092
6a2c04e57c833819096370de97e2e62992c018b7
564
js
JavaScript
src/TwilioVideoLocalView.web.js
JackCai1206/react-native-twilio-video-webrtc
8149b9b138d6dd3d8d65d38057b80b511618e6c1
[ "MIT" ]
null
null
null
src/TwilioVideoLocalView.web.js
JackCai1206/react-native-twilio-video-webrtc
8149b9b138d6dd3d8d65d38057b80b511618e6c1
[ "MIT" ]
null
null
null
src/TwilioVideoLocalView.web.js
JackCai1206/react-native-twilio-video-webrtc
8149b9b138d6dd3d8d65d38057b80b511618e6c1
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import PropTypes from 'prop-types' import TWLocalVideoView from '../web/TWLocalVideoView' class TwilioVideoLocalView extends Component { static propTypes = { /** * Indicate if video feed is enabled. */ enabled: PropTypes.bool.isRequired } render () { const scalesType = this.props.scaleType === 'fit' ? 1 : 2 return ( <TWLocalVideoView scalesType={scalesType} {...this.props}> {this.props.children} </TWLocalVideoView> ) } } export default TwilioVideoLocalView
22.56
64
0.66844
6a2ca91c3f00665bfbe31d66de01e76b189c53fb
352
js
JavaScript
src/assets/plugins/element.js
lee84233/vue-demo
bb1f430f72dd1dcc5e4221d3c61a32a1de9949d9
[ "Apache-2.0" ]
5
2018-02-13T06:31:44.000Z
2019-09-09T06:02:19.000Z
src/assets/plugins/element.js
lee84233/vue-demo
bb1f430f72dd1dcc5e4221d3c61a32a1de9949d9
[ "Apache-2.0" ]
null
null
null
src/assets/plugins/element.js
lee84233/vue-demo
bb1f430f72dd1dcc5e4221d3c61a32a1de9949d9
[ "Apache-2.0" ]
2
2018-01-26T01:35:39.000Z
2018-08-11T03:25:48.000Z
/** * Element UI * 默认使用中文 * 官网:https://element.eleme.cn/#/zh-CN */ import Vue from 'vue'; import Element from 'element-ui'; // Element 国际化 import zhCN from 'element-ui/lib/locale/lang/zh-CN'; // import en from 'element-ui/lib/locale/lang/en'; // Element 自定义主题 import '@/assets/css/element-variables.scss'; Vue.use(Element, { locale: zhCN });
17.6
52
0.676136
6a2cc50195034df695eee89e7b60aa8db04ba36e
612
js
JavaScript
app-frontend/src/pages/homepage/homepage.test.js
Tanvir-rahman/phone-catalog-app
e40789fd9208ba3752c7e48f3abfb4d019a9d4a9
[ "MIT" ]
null
null
null
app-frontend/src/pages/homepage/homepage.test.js
Tanvir-rahman/phone-catalog-app
e40789fd9208ba3752c7e48f3abfb4d019a9d4a9
[ "MIT" ]
null
null
null
app-frontend/src/pages/homepage/homepage.test.js
Tanvir-rahman/phone-catalog-app
e40789fd9208ba3752c7e48f3abfb4d019a9d4a9
[ "MIT" ]
null
null
null
import React from 'react'; import { shallow } from 'enzyme'; import { HomePage } from './homepage.component'; describe('Homepage component', () => { let wrapper; let mockfetchPhoneList; beforeEach(() => { mockfetchPhoneList= jest.fn(); const mockProps = { fetchPhoneList: mockfetchPhoneList }; wrapper = shallow(<HomePage {...mockProps} />); }); it('should render Homepage component', () => { expect(wrapper).toMatchSnapshot(); }); it('should render title in Title Container', () => { expect(wrapper.find('.title').text()).toBe(' Phone Catalog App '); }); });
22.666667
70
0.627451
6a2cca54e61436381d2051c5f6188af1101eb925
3,653
js
JavaScript
node_modules/eregistrations/model/dynamic-currency.js
egovernment/eregistrations-starter
a07043b0aaf832009a3e7f1fd1a32b2f903a7e23
[ "MIT" ]
1
2019-06-27T08:49:36.000Z
2019-06-27T08:49:36.000Z
node_modules/eregistrations/model/dynamic-currency.js
egovernment/eregistrations-starter
a07043b0aaf832009a3e7f1fd1a32b2f903a7e23
[ "MIT" ]
1
2017-06-07T09:57:09.000Z
2017-06-07T09:57:09.000Z
node_modules/eregistrations/model/dynamic-currency.js
egovernment/eregistrations-starter
a07043b0aaf832009a3e7f1fd1a32b2f903a7e23
[ "MIT" ]
null
null
null
// Creates a new dynamic currency type and sets up a currency type choice property on target. // // @param Target {object} - the target object for type choice property // @param typeName {string} - name for new dynamic currency type // @param currencies {arrat} - array of supported currency types // // @returns {object} - new dynamic currency type // // Example: // // var defineCurrency = require('eregistrations/model/dynamic-currency'); // // var CapitalCurrency = defineCurrency(BusinessProcess, 'CapitalCurrency', [ // require('dbjs-ext/number/currency/us-dollar')(db), // require('dbjs-ext/number/currency/guatemalan-quetzal')(db) // ]); // // BusinessProcess.prototype.defineProperties({ // sharesCapital: { // type: CapitalCurrency // nested: true // }, // investmentCapital: { // type: CapitalCurrency // nested: true // } // }); 'use strict'; var validDbType = require('dbjs/valid-dbjs-type') , endsWith = require('es5-ext/string/#/ends-with') , defineStringLine = require('dbjs-ext/string/string-line') , defineCreateEnum = require('dbjs-ext/create-enum') , defineConstrained = require('./constrained-value') , uncapitalize = require('es5-ext/string/#/uncapitalize') , ensureIterable = require('es5-ext/iterable/validate-object') , aFrom = require('es5-ext/array/from') , Map = require('es6-map'); module.exports = function (Target, typeName, currencies) { var db = validDbType(Target).database , currenciesMap = [] , Currency = db.Currency , StringLine, currencyChoiceTypeName, currencyChoicePropertyName; // Validate typeName ends with Currency if (!endsWith.call(typeName, 'Currency')) { throw new TypeError(typeName + " dynamic currency class misses \'Currency\' postfix."); } if (!Currency) { throw new TypeError("Currency type not defined. Did you include currencies array?"); } // Prepare currenciesMap aFrom(ensureIterable(currencies)).forEach(function (CurrencyType) { if (!Currency.isPrototypeOf(validDbType(CurrencyType))) { throw new TypeError(CurrencyType + " is not a Currency."); } currenciesMap.push([ uncapitalize.call(CurrencyType.__id__), { label: CurrencyType.symbol } ]); }); StringLine = defineStringLine(db); defineCreateEnum(db); // Prepare currency choice type and property name currencyChoiceTypeName = typeName + 'TypeChoice'; currencyChoicePropertyName = uncapitalize.call(typeName) + 'Type'; // Define enum for currency choice property var CurrencyTypeChoice = StringLine.createEnum(currencyChoiceTypeName, new Map(currenciesMap)); // Define currency choice property on target Target.prototype.define(currencyChoicePropertyName, { type: CurrencyTypeChoice, required: true }); // Create new type for use by target. var CurrencyType = db.Object.extend(typeName, {}, { currencyChoicePropertyName: { value: currencyChoicePropertyName } }); defineConstrained(CurrencyType.prototype, Currency, { dynamicConstraints: { toString: function (value) { var choicePropName = this.constructor.currencyChoicePropertyName , typeName = this.master.resolveSKeyPath(choicePropName).value , resolvedValue = this.resolvedValue , Type; if (resolvedValue == null) return ''; if (typeName) { Type = this.database[typeName[0].toUpperCase() + typeName.slice(1)]; } else { Type = this.database.Currency; } return Type.getObjectValue(resolvedValue, this).toString(this); } }, staticConstraints: { step: 1, min: 0 } }); return CurrencyType; };
31.491379
96
0.690939
6a2d2b97769229730dd328c6f2bf33c706592d8b
227
js
JavaScript
app/containers/AudioConverter/constants.js
Congtrinh097/utilities
3857cfdffea7843fbf19fbf75d5754611a36124f
[ "MIT" ]
null
null
null
app/containers/AudioConverter/constants.js
Congtrinh097/utilities
3857cfdffea7843fbf19fbf75d5754611a36124f
[ "MIT" ]
5
2020-04-06T06:56:18.000Z
2022-03-24T19:31:14.000Z
app/containers/AudioConverter/constants.js
Congtrinh097/utilities
3857cfdffea7843fbf19fbf75d5754611a36124f
[ "MIT" ]
null
null
null
/* * * AudioConverter constants * */ export const DEFAULT_ACTION = 'app/AudioConverter/DEFAULT_ACTION'; export const CHANGE_TEXT = 'app/AudioConverter/CHANGE_TEXT'; export const GET_AUDIO = 'app/AudioConverter/GET_AUDIO';
22.7
66
0.770925
6a2d57905d03372c7319a89ad0561d6c98bd2a37
1,375
js
JavaScript
tests/tests/number/test.js
chemdrew/antd-schema-form
cf232e51b689546741c690bebb227cc70592d1d7
[ "MIT" ]
null
null
null
tests/tests/number/test.js
chemdrew/antd-schema-form
cf232e51b689546741c690bebb227cc70592d1d7
[ "MIT" ]
null
null
null
tests/tests/number/test.js
chemdrew/antd-schema-form
cf232e51b689546741c690bebb227cc70592d1d7
[ "MIT" ]
null
null
null
import describe from 'describe'; import it from 'it'; import { renderDefault, renderRadio } from './componentRendering'; import { componentHasDefaultValue, componentHastValue, radioHasDefaultValue, radioHastValue, theValueOfTheComponentOverridesTheDefaultValue } from './hasValue'; import { componentPlaceholder, componentReadOnly } from './attrs'; import { componentNoverification, componentRequired, componentEnum, componentInteger, componentIntegerTrue, componentMinimum, componentMaximum } from './verification'; describe('数字类型组件', function() { /* 组件渲染 */ describe('组件渲染', function() { it('渲染默认组件', renderDefault); it('渲染单选组件', renderRadio); }); /* 交互测试 */ describe('交互测试', function() { it('组件有默认值', componentHasDefaultValue); it('组件有值', componentHastValue); it('单选框有默认值', radioHasDefaultValue); it('单选框有值', radioHastValue); it('组件的值会覆盖默认值', theValueOfTheComponentOverridesTheDefaultValue); }); describe('组件的属性', function() { it('组件只读', componentReadOnly); it('组件的placeholder属性', componentPlaceholder); }); describe('表单验证', function() { it('组件值没有验证', componentNoverification); it('表单必填', componentRequired); it('组件的枚举', componentEnum); it('组件值是整数', componentInteger); it('组件值是整数', componentIntegerTrue); it('组件的最小值', componentMinimum); it('组件的最大值', componentMaximum); }); });
31.25
118
0.711273
6a2d93ddc29f89180a94cf85e9134228a9f95ecd
12,941
js
JavaScript
Includes/ColorPicker/ColorPicker.js
epdubi/News-Articles
65590ff275a6f0267027986dafe7ee47c5890dc7
[ "MIT" ]
41
2017-07-21T13:55:40.000Z
2022-02-02T14:49:27.000Z
Includes/ColorPicker/ColorPicker.js
epdubi/News-Articles
65590ff275a6f0267027986dafe7ee47c5890dc7
[ "MIT" ]
66
2017-10-18T11:46:52.000Z
2022-02-02T13:37:08.000Z
Includes/ColorPicker/ColorPicker.js
epdubi/News-Articles
65590ff275a6f0267027986dafe7ee47c5890dc7
[ "MIT" ]
24
2017-08-10T00:38:17.000Z
2022-02-01T05:41:39.000Z
/* jQuery ColorPicker Written by Virgil Reboton(vreboton@gmail.com) ColorPicker function structures and attahcment is base on jQuery UI Date Picker v3.3beta by Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au). ColorPicker render data is base on http://www.mattkruse.com/javascript/colorpicker/ by Matt Kruse */ (function($) { // hide the namespace function colorPicker() { this._nextId = 0; // Next ID for a time picker instance this._inst = []; // List of instances indexed by ID this._curInst = null; // The current instance in use this._colorpickerShowing = false; this._colorPickerDiv = $('<div id="colorPickerDiv"></div>'); } $.extend(colorPicker.prototype, { /* Class name added to elements to indicate already configured with a time picker. */ markerClassName: 'hasColorPicker', /* Register a new time picker instance - with custom settings. */ _register: function(inst) { var id = this._nextId++; this._inst[id] = inst; return id; }, /* Retrieve a particular time picker instance based on its ID. */ _getInst: function(id) { return this._inst[id] || id; }, /* Handle keystrokes. */ _doKeyDown: function(e) { var inst = $.colorPicker._getInst(this._colId); if ($.colorPicker._colorpickerShowing) { switch (e.keyCode) { case 9: // hide on tab out $.colorPicker.hideColorPicker(); break; case 27: // hide on escape $.colorPicker.hideColorPicker(); break; } } else if (e.keyCode == 40) { // display the time picker on down arrow key $.colorPicker.showFor(this); } }, /* Handle keystrokes. */ _resetSample: function(e) { var inst = $.colorPicker._getInst(this._colId); inst._sampleSpan.css('background-color', inst._input.value); alert(inst._input.value); }, /* Does this element have a particular class? */ _hasClass: function(element, className) { var classes = element.attr('class'); return (classes && classes.indexOf(className) > -1); }, /* Pop-up the time picker for a given input field. @param control element - the input field attached to the time picker or string - the ID or other jQuery selector of the input field or object - jQuery object for input field @return the manager object */ showFor: function(control) { control = (control.jquery ? control[0] : (typeof control == 'string' ? $(control)[0] : control)); var input = (control.nodeName && control.nodeName.toLowerCase() == 'input' ? control : this); if ($.colorPicker._lastInput == input) { return; } if ($.colorPicker._colorpickerShowing) { return; } var inst = $.colorPicker._getInst(input._colId); $.colorPicker.hideColorPicker(); $.colorPicker._lastInput = input; if (!$.colorPicker._pos) { // position below input $.colorPicker._pos = $.colorPicker._findPos(input); $.colorPicker._pos[1] += input.offsetHeight; // add the height } var isFixed = false; $(input).parents().each(function() { isFixed |= $(this).css('position') == 'fixed'; }); if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled $.colorPicker._pos[0] -= document.documentElement.scrollLeft; $.colorPicker._pos[1] -= document.documentElement.scrollTop; } inst._colorPickerDiv.css('position', ($.blockUI ? 'static' : (isFixed ? 'fixed' : 'absolute'))).css('left', $.colorPicker._pos[0] + 'px').css('top', $.colorPicker._pos[1]+1 + 'px'); $.colorPicker._pos = null; $.colorPicker._showColorPicker(inst); return this; }, /* Find an object's position on the screen. */ _findPos: function(obj) { while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { obj = obj.nextSibling; } var curleft = curtop = 0; if (obj && obj.offsetParent) { curleft = obj.offsetLeft; curtop = obj.offsetTop; while (obj = obj.offsetParent) { var origcurleft = curleft; curleft += obj.offsetLeft; if (curleft < 0) { curleft = origcurleft; } curtop += obj.offsetTop; } } return [curleft,curtop]; }, /* Close time picker if clicked elsewhere. */ _checkExternalClick: function(event) { if (!$.colorPicker._curInst) { return; } var target = $(event.target); if ((target.parents("#colorPickerDiv").length == 0) && $.colorPicker._colorpickerShowing && !($.blockUI)) { if (target.text() != $.colorPicker._curInst._colorPickerDiv.text()) $.colorPicker.hideColorPicker(); } }, /* Hide the time picker from view. @param speed string - the speed at which to close the time picker @return void */ hideColorPicker: function(s) { var inst = this._curInst; if (!inst) { return; } if (this._colorpickerShowing) { this._colorpickerShowing = false; this._lastInput = null; this._colorPickerDiv.css('position', 'absolute').css('left', '0px').css('top', '-1000px'); if ($.blockUI) { $.unblockUI(); $('body').append(this._colorPickerDiv); } this._curInst = null; } if (inst._input[0].value != $.css(inst._sampleSpan,'background-color')) { inst._sampleSpan.css('background-color',inst._input[0].value); } }, /* Attach the time picker to an input field. */ _connectColorPicker: function(target, inst) { var input = $(target); if (this._hasClass(input, this.markerClassName)) { return; } $(input).attr('autocomplete', 'OFF'); // Disable browser autocomplete inst._input = $(input); // Create sample span inst._sampleSpan = $('<span class="ColorPickerDivSample" style="background-color:' + inst._input[0].value + ';height:' + inst._input[0].offsetHeight + ';">&nbsp;</span>'); input.after(inst._sampleSpan); inst._sampleSpan.click(function() { input.focus(); }); input.focus(this.showFor); input.addClass(this.markerClassName).keydown(this._doKeyDown); input[0]._colId = inst._id; }, /* Construct and display the time picker. */ _showColorPicker: function(id) { var inst = this._getInst(id); this._updateColorPicker(inst); inst._colorPickerDiv.css('width', inst._startTime != null ? '10em' : '6em'); inst._colorPickerDiv.show('fast'); if (inst._input[0].type != 'hidden') { inst._input[0].focus(); } this._curInst = inst; this._colorpickerShowing = true; }, /* Generate the time picker content. */ _updateColorPicker: function(inst) { inst._colorPickerDiv.empty().append(inst._generateColorPicker()); if (inst._input && inst._input[0].type != 'hidden') { inst._input[0].focus(); $("td.color", inst._timePickerDiv).unbind().mouseover(function() { inst._sampleSpan.css('background-color', $.css(this,'background-color')); }).click(function() { inst._setValue(this); }); } } }); /* Individualised settings for time picker functionality applied to one or more related inputs. Instances are managed and manipulated through the TimePicker manager. */ function ColorPickerInstance() { this._id = $.colorPicker._register(this); this._input = null; this._colorPickerDiv = $.colorPicker._colorPickerDiv; this._sampleSpan = null; } $.extend(ColorPickerInstance.prototype, { /* Get a setting value, defaulting if necessary. */ _get: function(name) { return (this._settings[name] != null ? this._settings[name] : $.colorPicker._defaults[name]); }, _getValue: function () { if (this._input && this._input[0].type != 'hidden' && this._input[0].value != "") { return this._input[0].value; } return null; }, _setValue: function (sel) { // Update input field if (this._input && this._input[0].type != 'hidden') { this._input[0].value = $.attr(sel,'title'); $(this._input[0]).change(); } // Hide picker $.colorPicker.hideColorPicker(); }, /* Generate the HTML for the current state of the time picker. */ _generateColorPicker: function() { // Code to populate color picker window var colors = new Array("#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC", "#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099", "#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066", "#FF0099","#FF00CC","#FF00FF","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333", "#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300", "#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF", "#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#006600","#006633","#006666","#006699","#0066CC", "#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699", "#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666", "#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#009900","#009933", "#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900", "#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF", "#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC", "#FF99FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99", "#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66", "#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33", "#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00", "#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF", "#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC", "#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#EEEEEE","#111111","#222222","#333333","#444444", "#555555","#666666","#777777","#888888","#999999","#A5A5A5","#AAAAAA","#BBBBBB","#C3C3C3","#CCCCCC","#D2D2D2", "#DDDDDD","#E1E1E1","#FFFFFF"); var total = colors.length; var width = 18; var html = "<table border='1px' cellspacing='0' cellpadding='0'>"; for (var i=0; i<total; i++) { if ((i % width) == 0) { html += "<tr>"; } html += '<td class="color" title="' + colors[i] + '" style="background-color:' + colors[i] + '"><label>&nbsp;&nbsp;&nbsp;</label></td>'; if ( ((i+1)>=total) || (((i+1) % width) == 0)) { html += "</tr>"; } } html += '<tr><td title="" style="background-color:#999" class="color" colspan="' + width + '" align="center"><label>No Color</label></td></tr>' html += "</table>"; return html } }); /* Attach the time picker to a jQuery selection. @param settings object - the new settings to use for this time picker instance (anonymous) @return jQuery object - for chaining further calls */ $.fn.attachColorPicker = function() { return this.each(function() { var nodeName = this.nodeName.toLowerCase(); if (nodeName == 'input') { var inst = new ColorPickerInstance(); $.colorPicker._connectColorPicker(this, inst); } }); }; $.fn.getValue = function() { var inst = (this.length > 0 ? $.colorPicker._getInst(this[0]._colId) : null); return (inst ? inst._getValue() : null); }; $.fn.setValue = function(value) { var inst = (this.length > 0 ? $.colorPicker._getInst(this[0]._colId) : null); if (inst) inst._setValue(value); }; /* Initialise the time picker. */ $(document).ready(function() { $.colorPicker = new colorPicker(); // singleton instance $(document.body).append($.colorPicker._colorPickerDiv).mousedown($.colorPicker._checkExternalClick); }); })(jQuery);
36.2493
187
0.591222
6a2eb8f8fa7ad7e17fe37e5579abf9947761a65b
1,912
js
JavaScript
public/library/js/ng/client_types.controllers.js
iramgutierrez/vitem
c31194d605f74fb0e73bf68f924469b0c48e4150
[ "MIT" ]
null
null
null
public/library/js/ng/client_types.controllers.js
iramgutierrez/vitem
c31194d605f74fb0e73bf68f924469b0c48e4150
[ "MIT" ]
null
null
null
public/library/js/ng/client_types.controllers.js
iramgutierrez/vitem
c31194d605f74fb0e73bf68f924469b0c48e4150
[ "MIT" ]
null
null
null
(function () { angular.module('client_types.controllers', []) .controller('ClientTypesController', ['$scope', '$filter' , 'ClientTypeService' , function ($scope , $filter , ClientTypeService ) { $scope.sort = 'id'; $scope.reverse = false; $scope.client_types = []; ClientTypeService.API('all').then(function (data) { $scope.client_types = data; }); $scope.addClientType = function(event , valid) { $scope.addclienttypeForm.submitted = true; event.preventDefault(); if(valid) { ClientTypeService.add({ 'id' : $scope.id, 'name' : $scope.name, }) .then(function(data){ if(data.hasOwnProperty('success')) { if(!$scope.id) $scope.client_types.push(data.client_type); else $scope.client_types[$scope.key] = data.client_type; $scope.id = ''; $scope.key = ''; $scope.name = ''; $scope.new = false; $scope.addclienttypeForm.submitted = false; } }) } } $scope.updateClientType = function (key , client_type) { $scope.key = key; $scope.id = client_type.id; $scope.name = client_type.name; $scope.new = true; $scope.button = 'Actualizar' } $scope.newClientType = function () { $scope.id = ''; $scope.key = ''; $scope.name = ''; $scope.new = true; $scope.button = 'Registrar' } }]); })();
20.55914
137
0.418933
6a2eef29d605d32b323cec32e5c352e41610b656
567
js
JavaScript
js/res.js
thefourthone/slorgans
76729dc53672677b64e99dd45e25542eb72ecbee
[ "MIT" ]
null
null
null
js/res.js
thefourthone/slorgans
76729dc53672677b64e99dd45e25542eb72ecbee
[ "MIT" ]
null
null
null
js/res.js
thefourthone/slorgans
76729dc53672677b64e99dd45e25542eb72ecbee
[ "MIT" ]
null
null
null
var imgs = []; imgs.i = 0; imgs.n = 0; imgs.load = function(ar){ imgs.n += ar.length; for(var i = 0; i < ar.length; i++){ imgs[imgs.length] = new Image(); imgs[imgs.length-1].onload = imgs.loader; imgs[imgs.length-1].src = ar[i]; } }; imgs.loader = function(){ imgs.onload(); }; imgs.onload = function(){ imgs.i++; if(imgs.i === imgs.n){ draw(); } }; imgs.load(['img/sloth.png','img/heart.png','img/lungs.png','img/stomach.png', 'img/intestines.png','img/muscle.png','img/brain.png', 'img/bone.png','img/fur.png']);
24.652174
77
0.566138
6a2f1cf4fe1d6551f3bb89fe51b2f8f963d754a0
7,010
js
JavaScript
public/modules/forms/admin/config/i18n/german.js
wodka/ohmyform
990898d88e89f80925a6e100c2c4cb5ee89d1368
[ "MIT" ]
1
2021-04-16T12:37:37.000Z
2021-04-16T12:37:37.000Z
public/modules/forms/admin/config/i18n/german.js
wodka/ohmyform
990898d88e89f80925a6e100c2c4cb5ee89d1368
[ "MIT" ]
null
null
null
public/modules/forms/admin/config/i18n/german.js
wodka/ohmyform
990898d88e89f80925a6e100c2c4cb5ee89d1368
[ "MIT" ]
3
2020-05-04T13:28:54.000Z
2021-02-01T15:05:34.000Z
'use strict'; angular.module('forms').config(['$translateProvider', function ($translateProvider) { $translateProvider.translations('de', { // Konfigurieren der Formularregisterkarte ADVANCED_SETTINGS: 'Erweiterte Einstellungen', FORM_NAME: 'Ihr tellform heißt', FORM_STATUS: 'Status', PUBLIC: 'Öffentlich', PRIVATE: 'Privat', GA_TRACKING_CODE: 'Google Analytics Tracking-Code', DISPLAY_FOOTER: 'Fußzeile', SAVE_CHANGES: 'Änderungen speichern', CANCEL: 'Abbrechen', DISPLAY_START_PAGE: 'Startseite', DISPLAY_END_PAGE: 'Benutzerdefinierte Endseite', GENERAL_TAB: 'Allgemein', SELF_NOTIFICATIONS_TAB: 'Selbstbenachrichtigungen', RESPONDANT_NOTIFICATIONS_TAB: 'Beantwortungsbenachrichtigungen', SEND_NOTIFICATION_TO: 'Senden an', NO_EMAIL_FIELD_WARNING: 'Fehler: Sie benötigen ein E-Mail-Feld in Ihrem Formular, um die E-Mail an Ihr Formular zu senden.', REPLY_TO: 'Antworten auf', EMAIL_SUBJECT: "Betreff", EMAIL_MESSAGE: 'Nachricht', ENABLE_RESPONDENT_NOTIFICATIONS: 'Antwortbenachrichtigungen sind derzeit', ENABLE_SELF_NOTIFICATIONS: 'Selbstbenachrichtigungen sind derzeit', TOGGLE_ENABLED: 'Aktiviert', TOGGLE_DISABLED: 'Deaktiviert', ADD_VARIABLE_BUTTON: 'Variable hinzufügen', // Listenformularansicht CREATE_A_NEW_FORM: 'Erstelle ein neues Formular', CREATE_FORM: 'Formular erstellen', CREATED_ON: 'Erstellt am', MY_FORMS: 'Meine Formulare', NAME: 'Name', SPRACHE: 'Sprache', FORM_PAUSED: 'Formular pausiert', // Feld Modal bearbeiten EDIT_FIELD: 'Dieses Feld bearbeiten', SAVE_FIELD: 'Speichern', ON: 'ON', AUS: 'AUS', REQUIRED_FIELD: 'Erforderlich', LOGIC_JUMP: 'Logischer Sprung', SHOW_BUTTONS: 'Zusätzliche Schaltflächen', SAVE_START_PAGE: 'Speichern', ADD_OPTIONS_PLACEHOLDER: 'Fügen Sie eine Auswahl pro Zeile hinzu. Mindestens eine Wahl ist erforderlich.', // Admin-Formularansicht ARE_YOU_SURE: "Bist du ABSOLUT sicher?", READ_WARNING: 'Unerwartete schlimme Dinge werden passieren, wenn Sie das nicht lesen!', DELETE_WARNING1: 'Diese Aktion kann NICHT rückgängig gemacht werden. Dies wird dauerhaft die "', DELETE_WARNING2: '"Formular und entferne alle verknüpften Formulareinreichungen.', DELETE_CONFIRM: 'Bitte geben Sie den Namen des zu bestätigenden Formulars ein.', I_UNDERSTAND: "Ich verstehe die Konsequenzen, lösche dieses Formular.", DELETE_FORM_SM: 'Löschen', DELETE_FORM_MD: 'Formular löschen', DELETE: 'Löschen', FORM: 'Formular', VIEW_MY_TELLFORM: 'Mein tellform anzeigen', LIVE: 'Leben', PREVIEW: 'Vorschau', //Share Tab COPIED_LABEL: 'Kopiert', COPY: 'Kopieren', COPY_AND_PASTE: 'Kopieren und einfügen, um Ihre TellForm auf Ihrer Website hinzuzufügen', POWERED_BY: 'Unterstützt von', TELLFORM_URL: "Ihr TellForm ist dauerhaft unter dieser URL", // Formularansicht bearbeiten DISABLED: 'Deaktiviert', JA: 'JA', NO: 'NEIN', ADD_LOGIC_JUMP: 'Logic Jump hinzufügen', ADD_FIELD_LG: 'Klicken Sie auf Neues Feld hinzufügen', ADD_FIELD_MD: 'Neues Feld hinzufügen', ADD_FIELD_SM: 'Feld hinzufügen', EDIT_START_PAGE: 'Startseite bearbeiten', EDIT_END_PAGE: 'Endseite bearbeiten', WELCOME_SCREEN: 'Startseite', END_SCREEN: 'Ende Seite', INTRO_TITLE: 'Titel', INTRO_PARAGRAPH: "Absatz", INTRO_BTN: 'Start Knopf', TITLE: "Titel", PARAGRAPH: "Absatz", BTN_TEXT: 'Zurück Button', TASTEN: 'Knöpfe', BUTTON_TEXT: 'Text', BUTTON_LINK: 'Link', ADD_BUTTON: 'Schaltfläche hinzufügen', PREVIEW_FIELD: 'Vorschaufrage', QUESTION_TITLE: 'Titel', QUESTION_DESCRIPTION: 'Beschreibung', OPTIONS: 'Optionen', ADD_OPTION: 'Option hinzufügen', NUM_OF_STEPS: 'Anzahl der Schritte', CLICK_FIELDS_FOOTER: 'Klicken Sie auf Felder, um sie hier hinzuzufügen', IF_THIS_FIELD: 'Wenn dieses Feld', IS_EQUAL_TO: 'ist gleich', IS_NOT_EQUAL_TO: 'ist nicht gleich', IS_GREATER_THAN: 'ist größer als', IS_GREATER_OR_EQUAL_THAN: 'ist größer oder gleich', IS_SMALLER_THAN: 'ist kleiner als', IS_SMALLER_OR_EQUAL_THAN: 'ist kleiner oder gleich', CONTAINS: 'enthält', DOES_NOT_CONTAINS: 'enthält nicht', ENDS_WITH: 'endet mit', DOES_NOT_END_WITH: 'endet nicht mit', STARTS_WITH: 'beginnt mit', DOES_NOT_START_WITH: 'beginnt nicht mit', THEN_JUMP_TO: 'Springe dann zu', // Bearbeiten der Einreichungsansicht TOTAL_VIEWS: 'Gesamtzahl eindeutiger Besuche', RESPONSES: 'Antworten', COMPLETION_RATE: 'Abschlussrate', AVERAGE_TIME_TO_COMPLETE: 'avg. Fertigstellungszeit', DESKTOP_AND_LAPTOP: 'Desktops', TABLETS: "Tabletten", PHONES: 'Telefone', OTHER: 'Andere', UNIQUE_VISITS: 'Eindeutige Besuche', FIELD_TITLE: 'Feldtitel', FIELD_VIEWS: 'Feld Ansichten', FIELD_DROPOFF: 'Feldabschluss', FIELD_RESPONSES: 'Feldantworten', DELETE_SELECTED: 'Ausgewählte löschen', EXPORT_TO_EXCEL: 'Export nach Excel', EXPORT_TO_CSV: 'In CSV exportieren', EXPORT_TO_JSON: 'Export nach JSON', PERCENTAGE_COMPLETE: 'Prozent abgeschlossen', TIME_ELAPSED: 'Zeit verstrichen', DEVICE: 'Gerät', LOCATION: 'Ort', IP_ADDRESS: 'IP-Adresse', DATE_SUBMITTED: 'Eingereichtes Datum', // Entwurfsansicht BACKGROUND_COLOR: 'Hintergrundfarbe', DESIGN_HEADER: 'Ändern Sie, wie Ihr Formular aussieht', QUESTION_TEXT_COLOR: 'Fragetextfarbe', ANSWER_TEXT_COLOR: 'Textfarbe beantworten', BTN_BACKGROUND_COLOR: 'Schaltfläche Hintergrundfarbe', BTN_TEXT_COLOR: 'Schaltfläche Textfarbe', // Freigabeansicht EMBED_YOUR_FORM: 'Einbetten Ihres Formulars', SHARE_YOUR_FORM: 'Teilen Sie Ihr Formular', // Admin-Registerkarten CREATE_TAB: 'Erstellen', DESIGN_TAB: 'Entwurf', CONFIGURE_TAB: 'Konfigurieren', ANALYZE_TAB: 'Analysieren', SHARE_TAB: 'Freigeben', // Feldtypen SHORT_TEXT: 'Kurztext', EMAIL: 'Email', MULTIPLE_CHOICE: 'Mehrfachauswahl', DROPDOWN: 'Dropdown-Liste', DATE: 'Datum', PARAGRAPH_FIELD: "Absatz", YES_NO: 'Ja / Nein', LEGAL: "Rechtliche", RATING: 'Bewertung', NUMBERS: 'Zahlen', SIGNATURE: "Unterschrift", FILE_UPLOAD: 'Datei-Upload', OPTION_SCALE: 'Optionsskala', ZAHLUNG: "Zahlung", STATEMENT: 'Anweisung', LINK: 'Link', // Formularvorschau FORM_SUCCESS: 'Formulareintrag erfolgreich gesendet!', REVIEW: 'Überprüfung', BACK_TO_FORM: 'Gehe zurück zu Formular', EDIT_FORM: 'Bearbeiten Sie diese TellForm', ADVANCEMENT: '{{done}} von {{total}} wurde beantwortet', CONTINUE_FORM: 'Weiter zum Formular', REQUIRED: 'erforderlich', COMPLETING_NEEDED: '{{answers_not_completed}} Antwort (en) müssen ausgefüllt werden', OPTIONAL: 'optional', ERROR_EMAIL_INVALID: 'Geben Sie eine gültige E-Mail-Adresse ein', ERROR_NOT_A_NUMBER: 'Bitte nur gültige Nummern eingeben', ERROR_URL_INVALID: 'Bitte eine gültige URL', OK: 'OK', ENTER: 'ENTER drücken', NEWLINE: 'Drücken Sie UMSCHALT + EINGABETASTE, um eine neue Zeile zu erstellen', CONTINUE: 'Weiter', LEGAL_ACCEPT: "Ich akzeptiere", LEGAL_NO_ACCEPT: "Ich akzeptiere nicht", SUBMIT: 'Senden', UPLOAD_FILE: 'Hochladen Ihrer Datei' }); }]);
33.701923
126
0.742511
6a30bbf1c0e95f712b923fdd8d176d029443be9e
5,019
js
JavaScript
assets/js/0-plugins/maintain-animation.js
cedric-91/Audify-Landing-Page
6f8bfc2003eacde1fd06e8b09de545472089ab29
[ "MIT" ]
null
null
null
assets/js/0-plugins/maintain-animation.js
cedric-91/Audify-Landing-Page
6f8bfc2003eacde1fd06e8b09de545472089ab29
[ "MIT" ]
null
null
null
assets/js/0-plugins/maintain-animation.js
cedric-91/Audify-Landing-Page
6f8bfc2003eacde1fd06e8b09de545472089ab29
[ "MIT" ]
null
null
null
(function (lib, img, cjs, ss, an) { var p; // shortcut to reference prototypes lib.webFontTxtInst = {}; var loadedTypekitCount = 0; var loadedGoogleCount = 0; var gFontsUpdateCacheList = []; var tFontsUpdateCacheList = []; lib.ssMetadata = []; lib.updateListCache = function (cacheList) { for(var i = 0; i < cacheList.length; i++) { if(cacheList[i].cacheCanvas) cacheList[i].updateCache(); } }; lib.addElementsToCache = function (textInst, cacheList) { var cur = textInst; while(cur != exportRoot) { if(cacheList.indexOf(cur) != -1) break; cur = cur.parent; } if(cur != exportRoot) { var cur2 = textInst; var index = cacheList.indexOf(cur); while(cur2 != cur) { cacheList.splice(index, 0, cur2); cur2 = cur2.parent; index++; } } else { cur = textInst; while(cur != exportRoot) { cacheList.push(cur); cur = cur.parent; } } }; lib.gfontAvailable = function(family, totalGoogleCount) { lib.properties.webfonts[family] = true; var txtInst = lib.webFontTxtInst && lib.webFontTxtInst[family] || []; for(var f = 0; f < txtInst.length; ++f) lib.addElementsToCache(txtInst[f], gFontsUpdateCacheList); loadedGoogleCount++; if(loadedGoogleCount == totalGoogleCount) { lib.updateListCache(gFontsUpdateCacheList); } }; lib.tfontAvailable = function(family, totalTypekitCount) { lib.properties.webfonts[family] = true; var txtInst = lib.webFontTxtInst && lib.webFontTxtInst[family] || []; for(var f = 0; f < txtInst.length; ++f) lib.addElementsToCache(txtInst[f], tFontsUpdateCacheList); loadedTypekitCount++; if(loadedTypekitCount == totalTypekitCount) { lib.updateListCache(tFontsUpdateCacheList); } }; // symbols: // helper functions: function mc_symbol_clone() { var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop)); clone.gotoAndStop(this.currentFrame); clone.paused = this.paused; clone.framerate = this.framerate; return clone; } function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) { var prototype = cjs.extend(symbol, cjs.MovieClip); prototype.clone = mc_symbol_clone; prototype.nominalBounds = nominalBounds; prototype.frameBounds = frameBounds; return prototype; } (lib.Tween5 = function(mode,startPosition,loop) { this.initialize(mode,startPosition,loop,{}); // Layer 1 this.shape = new cjs.Shape(); this.shape.graphics.f().s("#FFFFFC").ss(2).p("AhjhjIDHDH"); this.shape.setTransform(26.8,29.2); this.shape_1 = new cjs.Shape(); this.shape_1.graphics.f().s("#C7CF43").ss(2).p("Ai8hGIB1h2IA7AMIAABGIC8C8QAOAOAAAVQAAAVgOAOIgYAYQgOAOgVAAQgVAAgOgOIi8i8IhHAAg"); this.shape_1.setTransform(23.9,26.3); this.shape_2 = new cjs.Shape(); this.shape_2.graphics.f().s("#C7CF43").ss(2).p("ACRDAIixiyIg7gLIheiNIAvgvICMBeIAMA7ICyCx"); this.shape_2.setTransform(-23.5,-21.2); this.shape_3 = new cjs.Shape(); this.shape_3.graphics.f().s("#C7CF43").ss(2).p("AgUhDIBRBRIgwAvIhQhR"); this.shape_3.setTransform(7.2,9.5); this.shape_4 = new cjs.Shape(); this.shape_4.graphics.f().s("#FFFFFC").ss(2).p("ADyjxIniHi"); this.shape_4.setTransform(-8.5,6.7); this.shape_5 = new cjs.Shape(); this.shape_5.graphics.f().s("#FFFFFC").ss(2).p("AALAMIgWgX"); this.shape_5.setTransform(-36.2,34.4); this.shape_6 = new cjs.Shape(); this.shape_6.graphics.f().s("#C7CF43").ss(2).p("AGflBIheBeQgFAFgHAAQgHAAgFgFIhGhHQgFgFAAgGQAAgHAFgFIBeheQgtgYgrAGQgqAHgjAiIgjAkQgyAxAnBpIoRIRQgPAOAAAVQAAAVAPAOIAXAYQAPAOAVAAQAUAAAPgOIIRoRQBlAmAzgzIAkgjQAigjAHgpQAHgsgZgtg"); this.shape_6.setTransform(0,-1.7); this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_6},{t:this.shape_5},{t:this.shape_4},{t:this.shape_3},{t:this.shape_2},{t:this.shape_1},{t:this.shape}]}).wait(1)); }).prototype = p = new cjs.MovieClip(); p.nominalBounds = new cjs.Rectangle(-44.4,-48.7,93.6,95.1); (lib.maintainicon2 = function(mode,startPosition,loop) { this.initialize(mode,startPosition,loop,{}); // Layer 1 this.instance = new lib.Tween5("synched",0); this.instance.parent = this; this.timeline.addTween(cjs.Tween.get(this.instance).wait(1)); }).prototype = getMCSymbolPrototype(lib.maintainicon2, new cjs.Rectangle(-44.4,-48.7,93.6,95.1), null); // stage content: (lib.maintainanimation = function(mode,startPosition,loop) { if (loop == null) { loop = false; } this.initialize(mode,startPosition,loop,{}); // FlashAICB this.instance = new lib.maintainicon2(); this.instance.parent = this; this.instance.setTransform(67.3,63.8,1,1,0,0,0,2.3,-1.2); this.timeline.addTween(cjs.Tween.get(this.instance).to({regX:0,regY:0,rotation:360,x:65,y:65},24,cjs.Ease.get(-0.9)).wait(1)); }).prototype = p = new cjs.MovieClip(); p.nominalBounds = new cjs.Rectangle(85.6,81.3,93.6,95.1); // library properties: lib.properties = { width: 130, height: 130, fps: 24, color: "#CC00FF", opacity: 0.00, webfonts: {}, manifest: [], preloads: [] }; })(lib = lib||{}, images = images||{}, createjs = createjs||{}, ss = ss||{}, AdobeAn = AdobeAn||{}); var lib, images, createjs, ss, AdobeAn;
29.875
224
0.709305
6a31125aa3fc69c51969d87caa1a47eaae4870f8
261
js
JavaScript
public/src/scripts/app.js
davidvalentin12/unicorn-pointing-poker
e52f109895455bcfbce2072fd5b0cf73b6fd7dc5
[ "MIT" ]
null
null
null
public/src/scripts/app.js
davidvalentin12/unicorn-pointing-poker
e52f109895455bcfbce2072fd5b0cf73b6fd7dc5
[ "MIT" ]
null
null
null
public/src/scripts/app.js
davidvalentin12/unicorn-pointing-poker
e52f109895455bcfbce2072fd5b0cf73b6fd7dc5
[ "MIT" ]
null
null
null
(function() { 'use strict'; /** * @ngdoc overview * @name * * @description * */ angular.module( 'pointingPoker', // DEPENDENCIES [ 'firebase', 'ui.router', //'dvm.templates' ]); }());
11.863636
25
0.425287
6a31ae056a0e6ab66f9607404a1179437b0e33e6
336
js
JavaScript
keeping-action/array/array_forEach.js
suencc/d3-playground
bebd2fe1bc43e2f0220d7b8db4a48fdc1054d987
[ "BSD-3-Clause" ]
null
null
null
keeping-action/array/array_forEach.js
suencc/d3-playground
bebd2fe1bc43e2f0220d7b8db4a48fdc1054d987
[ "BSD-3-Clause" ]
null
null
null
keeping-action/array/array_forEach.js
suencc/d3-playground
bebd2fe1bc43e2f0220d7b8db4a48fdc1054d987
[ "BSD-3-Clause" ]
null
null
null
title = '数组'; d3.select('title').html(title); d3.select('body').append('h1').html(title); function print_array(array){ var ul=d3.select('body').append('ul'); array.forEach(function(item,index){ ul.append('li').html(item); }); } nums=[1,2,3]; print_array(nums); language=['JAVA','C','C++','PHP']; print_array(language);
19.764706
43
0.630952
6a31c68e82545c4538dc758c7046847037f6b712
294
js
JavaScript
customers-app/src/helpers/setPropsAsInitial.js
soker90/react-redux
3823d6088c06a398cdbcb235eef5c38f9b857ebf
[ "MIT" ]
null
null
null
customers-app/src/helpers/setPropsAsInitial.js
soker90/react-redux
3823d6088c06a398cdbcb235eef5c38f9b857ebf
[ "MIT" ]
null
null
null
customers-app/src/helpers/setPropsAsInitial.js
soker90/react-redux
3823d6088c06a398cdbcb235eef5c38f9b857ebf
[ "MIT" ]
null
null
null
import React, { Component } from 'react' export const setPropsAsInitial = WrappedComponent => ( class extends Component { render() { return <WrappedComponent {...this.props} initialValues={this.props} enableReinitialize /> } } )
26.727273
54
0.581633