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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c1e093d5185ee5892709dbbd40a2ce6564ff5d5d | 349 | js | JavaScript | index.js | paulsmithkc/express-async-catch | 0334a0cacd767167b7f91e32082bda7cb2fbe85b | [
"MIT"
] | null | null | null | index.js | paulsmithkc/express-async-catch | 0334a0cacd767167b7f91e32082bda7cb2fbe85b | [
"MIT"
] | null | null | null | index.js | paulsmithkc/express-async-catch | 0334a0cacd767167b7f91e32082bda7cb2fbe85b | [
"MIT"
] | null | null | null | const { RequestHandler } = require('express');
/**
* Wraps an async middleware in a try-catch block.
* @param {RequestHandler} middleware
* @returns {RequestHandler} wrapped middleware
*/
function asyncCatch(middleware) {
return (req, res, next) =>
Promise.resolve(middleware(req, res, next)).catch(next);
}
module.exports = asyncCatch;
| 24.928571 | 60 | 0.710602 |
c1e0b85135d1b127742ae7b7e6d17627b84a5f7f | 4,511 | js | JavaScript | public/main.js | sadhvika1059/vc | 529212d3395ec8d65cd6303685412b19896dee3d | [
"MIT"
] | 1 | 2021-08-11T08:36:03.000Z | 2021-08-11T08:36:03.000Z | public/main.js | sadhvika1059/vc | 529212d3395ec8d65cd6303685412b19896dee3d | [
"MIT"
] | null | null | null | public/main.js | sadhvika1059/vc | 529212d3395ec8d65cd6303685412b19896dee3d | [
"MIT"
] | null | null | null |
let Peer = require('simple-peer')
let socket = io()
const video = document.querySelector('video')
const filter = document.querySelector('#filter')
const checkboxTheme = document.querySelector('#theme')
let client = {}
let currentFilter
//get stream
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => {
socket.emit('NewClient')
video.srcObject = stream
video.play()
filter.addEventListener('change', (event) => {
currentFilter = event.target.value
video.style.filter = currentFilter
SendFilter(currentFilter)
event.preventDefault
})
//used to initialize a peer
function InitPeer(type) {
let peer = new Peer({ initiator: (type == 'init') ? true : false, stream: stream, trickle: false })
peer.on('stream', function (stream) {
CreateVideo(stream)
})
//This isn't working in chrome; works perfectly in firefox.
// peer.on('close', function () {
// document.getElementById("peerVideo").remove();
// peer.destroy()
// })
peer.on('data', function (data) {
let decodedData = new TextDecoder('utf-8').decode(data)
let peervideo = document.querySelector('#peerVideo')
peervideo.style.filter = decodedData
})
return peer
}
//for peer of type init
function MakePeer() {
client.gotAnswer = false
let peer = InitPeer('init')
peer.on('signal', function (data) {
if (!client.gotAnswer) {
socket.emit('Offer', data)
}
})
client.peer = peer
}
//for peer of type not init
function FrontAnswer(offer) {
let peer = InitPeer('notInit')
peer.on('signal', (data) => {
socket.emit('Answer', data)
})
peer.signal(offer)
client.peer = peer
}
function SignalAnswer(answer) {
client.gotAnswer = true
let peer = client.peer
peer.signal(answer)
}
function CreateVideo(stream) {
CreateDiv()
let video = document.createElement('video')
video.id = 'peerVideo'
video.srcObject = stream
video.setAttribute('class', 'embed-responsive-item')
document.querySelector('#peerDiv').appendChild(video)
video.play()
//wait for 1 sec
setTimeout(() => SendFilter(currentFilter), 1000)
video.addEventListener('click', () => {
if (video.volume != 0)
video.volume = 0
else
video.volume = 1
})
}
function SessionActive() {
document.write('Session Active. Please come back later')
}
function SendFilter(filter) {
if (client.peer) {
client.peer.send(filter)
}
}
function RemovePeer() {
document.getElementById("peerVideo").remove();
document.getElementById("muteText").remove();
if (client.peer) {
client.peer.destroy()
}
}
socket.on('BackOffer', FrontAnswer)
socket.on('BackAnswer', SignalAnswer)
socket.on('SessionActive', SessionActive)
socket.on('CreatePeer', MakePeer)
socket.on('Disconnect', RemovePeer)
})
.catch(err => document.write(err))
checkboxTheme.addEventListener('click', () => {
if (checkboxTheme.checked == true) {
document.body.style.backgroundColor = '#212529'
if (document.querySelector('#muteText')) {
document.querySelector('#muteText').style.color = "#fff"
}
}
else {
document.body.style.backgroundColor = '#fff'
if (document.querySelector('#muteText')) {
document.querySelector('#muteText').style.color = "#212529"
}
}
}
)
function CreateDiv() {
let div = document.createElement('div')
div.setAttribute('class', "centered")
div.id = "muteText"
div.innerHTML = "Click to Mute/Unmute"
document.querySelector('#peerDiv').appendChild(div)
if (checkboxTheme.checked == true)
document.querySelector('#muteText').style.color = "#ffff"
}
| 31.326389 | 111 | 0.539127 |
c1e0d77026992e251cf486ebe2c549ebd3eaf7b8 | 4,475 | js | JavaScript | perun-apps/apps/alt-passwords/js/AlternativePassword.js | licehammer/perun | f78cb54eb0b41a23f65db4401781d8c38a6242b4 | [
"BSD-2-Clause"
] | 49 | 2015-03-30T12:30:10.000Z | 2022-02-16T21:51:42.000Z | perun-apps/apps/alt-passwords/js/AlternativePassword.js | licehammer/perun | f78cb54eb0b41a23f65db4401781d8c38a6242b4 | [
"BSD-2-Clause"
] | 686 | 2015-01-06T15:46:46.000Z | 2022-03-30T13:36:09.000Z | perun-apps/apps/alt-passwords/js/AlternativePassword.js | licehammer/perun | f78cb54eb0b41a23f65db4401781d8c38a6242b4 | [
"BSD-2-Clause"
] | 64 | 2015-01-09T08:50:32.000Z | 2022-02-08T15:43:55.000Z | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function entryPoint(user) {
callPerun("attributesManager", "getAttribute", {user: user.id, attributeName: "urn:perun:user:attribute-def:def:login-namespace:einfra"}, function(login) {
if (!login.value) {
(staticMessager.newMessage("Can't set alternative passwords", "You don't have eInfra login", "danger")).draw();
return;
} else {
$("#passSubmit").removeAttr('disabled');
loadAlternativePasswords(user);
}
});
}
$(document).ready(function() {
$("#createAltPassword").submit(function(event) {
event.preventDefault();
var loadImage = new LoadImage($('#createAltPassword'), "20px");
var password = randomPassword(16);
var description = $("#altPasswordDescription").val();
$("#altPasswordDescription").val("");
callPerunPost("usersManager", "createAlternativePassword", {user: user.id, description: description, loginNamespace: "einfra", password: password},
function() {
loadAlternativePasswords(user);
showPassword(description, password);
(flowMessager.newMessage("Alternative password", "was created successfully", "success")).draw();
}, null,
function() {
loadImage.hide();
}
);
});
});
function loadAlternativePasswords(user) {
if (!user) {
(flowMessager.newMessage("Alternative Passwords", "can't be loaded because user isn't loaded.", "danger")).draw();
return;
}
var loadImage = new LoadImage($('#altPasswordsTable'), "64px");
callPerun("attributesManager", "getAttribute", {user: user.id, attributeName: "urn:perun:user:attribute-def:def:altPasswords:einfra"}, function(altPasswords) {
if (!altPasswords) {
(flowMessager.newMessage("Alternative passwords", "can't be loaded.", "danger")).draw();
return;
}
fillAlternativePasswords(altPasswords);
loadImage.hide();
//(flowMessager.newMessage("User data", "was loaded successfully.", "success")).draw();
});
}
function fillAlternativePasswords(altPasswords) {
if (!altPasswords) {
(flowMessager.newMessage("Alternative Passwords", "can't be fill.", "danger")).draw();
return;
}
var altPasswordsTable = new PerunTable();
altPasswordsTable.addColumn({type: "number", title: "#"});
altPasswordsTable.addColumn({type: "text", title: "Description", name: "key"});
altPasswordsTable.addColumn({type: "button", title: "", btnText: "delete", btnType: "danger", btnName: "deleteAltPassword", btnId: "value"});
altPasswordsTable.setList(altPasswords.value);
var tableHtml = altPasswordsTable.draw();
$("#altPasswordsTable").html(tableHtml);
$("#altPasswordsTable button[id^='deleteAltPassword-']").click(function() {
var loadImage = new LoadImage($('#altPasswordsTable'), "40px");
var passwordId = $(this).attr("id").split('-')[1];
callPerunPost("usersManager", "deleteAlternativePassword", {user: user.id, loginNamespace: "einfra", passwordId: passwordId}, function() {
loadAlternativePasswords(user);
loadImage.hide();
(flowMessager.newMessage("Alternative password", "was deleted successfully", "success")).draw();
});
});
}
function randomPassword(length) {
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
pass = "";
for (x = 0; x < length; x++)
{
i = Math.floor(Math.random() * chars.length);
pass += chars.charAt(i);
}
return pass;
}
function showPassword(description, password) {
$("#showPassword .description").text(description);
$("#showPassword .password").html(splitStringToHtml(password, 4));
$("#showPassword").modal();
}
$('#showPassword').on('hidden.bs.modal', function (e) {
$("#showPassword .password").text("...");
});
function splitStringToHtml(string, number) {
var splitHtml = "<span>";
for(var id in string) {
if ((id % number === 0)
&& (id !== "0")) {
splitHtml += "</span><span>";
}
splitHtml += string[id];
}
splitHtml += "</span>";
return splitHtml;
} | 35.23622 | 163 | 0.618547 |
c1e1643c3a01df5debe7e7916c42c716cb5850dc | 751 | js | JavaScript | resources/js/app.js | AssemALi94/laravel-hotel-system | 36e4208962d6790d4e36a51783ee7918435dacd0 | [
"MIT"
] | null | null | null | resources/js/app.js | AssemALi94/laravel-hotel-system | 36e4208962d6790d4e36a51783ee7918435dacd0 | [
"MIT"
] | null | null | null | resources/js/app.js | AssemALi94/laravel-hotel-system | 36e4208962d6790d4e36a51783ee7918435dacd0 | [
"MIT"
] | null | null | null |
require('./bootstrap');
// Sweetalert
window.swal= require('sweetalert2')
window.swal = swal.mixin({
confirmButtonColor: 'var(--primary)',
cancelButtonColor: 'var(--secondary)',
});
const toast = swal.mixin({
toast: true,
position: 'top',
icon: 'success',
showConfirmButton: false,
timer: 5000,
timerProgressBar: true,
onOpen: (toast) => {
toast.addEventListener('mouseenter', swal.stopTimer);
toast.addEventListener('mouseleave', swal.resumeTimer)
}
});
window.toast = toast;
// Data tables
require('datatables.net-bs4');
require('datatables.net-buttons-bs4');
// select2
require('select2/dist/js/select2.full.min');
$('.select2').select2();
$('[data-toggle="tooltip"]').tooltip()
| 18.317073 | 62 | 0.652463 |
c1e1a8617b6f0f9175f61666080186ac27098834 | 1,103 | js | JavaScript | layers/trafficFlow.js | CartoDB/cloud-next | 307bd1b2593b9ee1c5ae51d081b865169c2826a0 | [
"MIT"
] | 5 | 2021-10-13T09:23:11.000Z | 2022-03-10T22:44:28.000Z | layers/trafficFlow.js | CartoDB/cloud-next | 307bd1b2593b9ee1c5ae51d081b865169c2826a0 | [
"MIT"
] | 4 | 2021-09-07T14:28:41.000Z | 2022-02-27T17:11:58.000Z | layers/trafficFlow.js | CartoDB/cloud-next | 307bd1b2593b9ee1c5ae51d081b865169c2826a0 | [
"MIT"
] | 2 | 2021-09-23T15:35:51.000Z | 2021-11-19T21:05:07.000Z | import FlowmapLayer from './flowmap';
import DeferredLoadLayer from './deferredLoadLayer';
import Blending from './blending';
import {flows, locations} from '../data/od_texas';
const flowmapStyle = {
animate: true,
colors: {
flows: {
scheme: [
'rgb(253, 230, 219)',
'rgb(248, 163, 171)',
'rgb(241, 77, 143)',
'rgb(182, 0, 119)',
'rgb(101, 0, 100)'
]
},
locationCircles: {outgoing: '#fff'},
outlineColor: 'rgba(255, 255, 255, 0.5)'
},
locationTotalsExtent: [12004, 1568915],
maxFlowThickness: 16,
maxLocationCircleSize: 15,
showOnlyTopFlows: 5000,
showTotals: true,
diffMode: false
};
const _TrafficFlowLayer = DeferredLoadLayer(() => {
return new FlowmapLayer({
locations,
flows,
...flowmapStyle,
getFlowMagnitude: flow => flow.count || 0,
getFlowOriginId: flow => flow.origin,
getFlowDestId: flow => flow.dest,
getLocationId: loc => loc.id,
getLocationCentroid: loc => [loc.lon, loc.lat]
});
});
export const TrafficFlowLayer = new _TrafficFlowLayer({
id: 'traffic-flow'
});
| 24.511111 | 55 | 0.628286 |
c1e212a0ae6f91cee5857450a152b85cbd842e48 | 546 | js | JavaScript | snapshots/client.js | RedGuy12/scratchblocks | 95d1d8440326704a68f73425b637175e4f52a6b5 | [
"MIT"
] | null | null | null | snapshots/client.js | RedGuy12/scratchblocks | 95d1d8440326704a68f73425b637175e4f52a6b5 | [
"MIT"
] | null | null | null | snapshots/client.js | RedGuy12/scratchblocks | 95d1d8440326704a68f73425b637175e4f52a6b5 | [
"MIT"
] | null | null | null | const scratchblocks = require("../browser")
scratchblocks.loadLanguages({
de: require("../locales/de.json"),
})
window.render = function(source, options, scale) {
var doc = scratchblocks.parse(source, {
languages: options.lang ? ["en", options.lang] : ["en"],
})
var view = scratchblocks.newView(doc, {
style: options.style,
scale: options.scale,
})
var svg = view.render()
return new Promise(function(resolve) {
view.toCanvas(function(canvas) {
resolve(canvas.toDataURL("image/png"))
}, scale)
})
}
| 22.75 | 60 | 0.650183 |
c1e23bcf601a36f205cc9b8969e758dcb6c7ccd6 | 146 | js | JavaScript | bin/sunnels.js | taoyuan/sunnels | 47b1f0390ed9fd7519eb85e8774d07f068403ab2 | [
"MIT"
] | 1 | 2021-02-21T21:44:02.000Z | 2021-02-21T21:44:02.000Z | bin/sunnels.js | taoyuan/sunnels | 47b1f0390ed9fd7519eb85e8774d07f068403ab2 | [
"MIT"
] | 1 | 2019-09-08T10:39:52.000Z | 2019-09-08T10:39:52.000Z | bin/sunnelc.js | taoyuan/sunnelc | e64976564d19204e7409b9f985a4d879f011f8f2 | [
"MIT"
] | null | null | null | #!/usr/bin/env node
const {run} = require('../lib/cli');
process.on("uncaughtException", err => {
console.error(err);
});
run(process.argv);
| 14.6 | 40 | 0.630137 |
c1e311ffc14fc4fd6f3165c4fb0cfdb3aa9861b5 | 3,182 | js | JavaScript | espnow-mqtt/src/app.js | cmmakerclub/resinos-nodejs-parser | 78eed6884b142c2859d0f3d1be4e579e8503e0aa | [
"Apache-2.0"
] | null | null | null | espnow-mqtt/src/app.js | cmmakerclub/resinos-nodejs-parser | 78eed6884b142c2859d0f3d1be4e579e8503e0aa | [
"Apache-2.0"
] | null | null | null | espnow-mqtt/src/app.js | cmmakerclub/resinos-nodejs-parser | 78eed6884b142c2859d0f3d1be4e579e8503e0aa | [
"Apache-2.0"
] | null | null | null | export default (a, b) => a + b
const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://mqtt.cmmc.io')
const moment = require('moment')
let checksum = (message) => {
let calculatedSum = 0
let checkSum = message[message.length - 1]
for (let i = 0; i < message.length - 1; i++) {
let v = message[i]
calculatedSum ^= v
}
console.log(`calculated sum = ${calculatedSum.toString(16)}`)
console.log(`check sum = ${checkSum.toString(16)}`)
return calculatedSum === checkSum
}
client.on('connect', function () {
client.subscribe('CMMC/espnow/#')
})
client.on('message', function (topic, message) {
console.log('================')
if (message[message.length - 1] === 0x0d) {
message = message.slice(0, message.length - 1)
}
console.log(message)
console.log('================')
console.log(message.length)
let statusObject = {}
if (checksum(message)) {
let mac1, mac2
if (message[0] === 0xfc && message[1] === 0xfd) {
console.log(message)
mac1 = message.slice(2, 2 + 6)
mac2 = message.slice(2 + 6, 2 + 6 + 6)
let len = message[2 + 6 + 6]
let payload = message.slice(2 + 6 + 6 + 1, message.length - 1)
console.log(`len = ${len}, payload = ${payload.toString('hex')}`)
// if (checksum(payload)) {
// console.log('YAY!')
// }
if (payload[0] === 0xff && payload[1] === 0xfa) {
let type = payload.slice(2, 5)
let name = payload.slice(5, 11)
let mac1String = mac1.toString('hex')
let mac2String = mac2.toString('hex')
let [val1, val2, val3, batt] = [
payload.readUInt32LE(11) || 0,
payload.readUInt32LE(15) || 0,
payload.readUInt32LE(19) || 0,
payload.readUInt32LE(23) || 0
]
console.log(`type = `, type)
console.log(`name = `, name.toString())
console.log(`val1 = `, val1)
console.log(`val2 = `, val2)
console.log(`val3 = `, val3)
console.log(`batt = `, batt)
console.log(`[master] mac1 = `, mac1String)
console.log(`[ slave] mac2 = `, mac2String)
statusObject.myName = name.toString()
statusObject.type = type.toString('hex')
statusObject.sensor = type.toString('hex')
statusObject.val1 = parseInt(val1.toString())
statusObject.val2 = parseInt(val2.toString())
statusObject.val3 = parseInt(val3.toString())
statusObject.batt = parseInt(batt.toString())
statusObject.mac1 = mac1String
statusObject.mac2 = mac2String
statusObject.updated = moment().unix().toString()
statusObject.updatedText = moment().format('MMMM Do YYYY, h:mm:ss a')
client.publish(`CMMC/espnow/${mac1String}/${mac2String}/batt`, batt.toString(), {retain: true})
client.publish(`CMMC/espnow/${mac1String}/${mac2String}/status`, JSON.stringify(statusObject), {retain: true})
client.publish(`CMMC/espnow/${mac1String}/${name.toString()}/status`, JSON.stringify(statusObject), {retain: true})
} else {
console.log('invalid header')
}
}
} else {
console.log('invalid checksum')
}
})
console.log('started')
| 34.967033 | 123 | 0.589881 |
c1e422883c7dbc3c396bbecf74529a36a942f781 | 920 | js | JavaScript | web/src/views/AddNewPost.js | tradium-app/tradium-web | 8c3bcbb308db4ec66942a419f963798985a278e1 | [
"MIT"
] | null | null | null | web/src/views/AddNewPost.js | tradium-app/tradium-web | 8c3bcbb308db4ec66942a419f963798985a278e1 | [
"MIT"
] | 5 | 2020-06-21T20:10:38.000Z | 2022-02-27T05:45:14.000Z | web/src/views/AddNewPost.js | tradium-app/tradium-web | 8c3bcbb308db4ec66942a419f963798985a278e1 | [
"MIT"
] | null | null | null | import React from 'react'
import { Container, Row, Col } from 'shards-react'
import PageTitle from '../components/common/PageTitle'
import Editor from '../components/add-new-post/Editor'
import SidebarActions from '../components/add-new-post/SidebarActions'
import SidebarCategories from '../components/add-new-post/SidebarCategories'
const AddNewPost = () => (
<Container fluid className="main-content-container px-4 pb-4">
{/* Page Header */}
<Row noGutters className="page-header py-4">
<PageTitle
sm="4"
title="Add New Post"
subtitle="Blog Posts"
className="text-sm-left"
/>
</Row>
<Row>
{/* Editor */}
<Col lg="9" md="12">
<Editor />
</Col>
{/* Sidebar Widgets */}
<Col lg="3" md="12">
<SidebarActions />
<SidebarCategories />
</Col>
</Row>
</Container>
)
export default AddNewPost
| 24.864865 | 76 | 0.607609 |
c1e43a8529771c4d5e53340d210740d55b3cf1f8 | 865 | js | JavaScript | test/mixSignCheckTest.js | the-labo/the-controller-sign | ce0787fb4f7ea8f34c4aaa19c081f594c1bb7483 | [
"MIT"
] | null | null | null | test/mixSignCheckTest.js | the-labo/the-controller-sign | ce0787fb4f7ea8f34c4aaa19c081f594c1bb7483 | [
"MIT"
] | null | null | null | test/mixSignCheckTest.js | the-labo/the-controller-sign | ce0787fb4f7ea8f34c4aaa19c081f594c1bb7483 | [
"MIT"
] | null | null | null | /**
* Test for mixSignCheck.
* Runs with mocha.
*/
'use strict'
const mixSignCheck = require('../lib/mixSignCheck')
const { TheCtrl } = require('the-controller-base')
const { ok, equal } = require('assert')
describe('mix-sign-check', () => {
before(() => {
})
after(() => {
})
it('Do test', async () => {
let Ctrl = mixSignCheck(class extends TheCtrl {
foo () {
return 'This is foo'
}
bar () {
return 'This is bar'
}
}, { only: [ 'foo' ] })
let ctrl = new Ctrl({
app: {},
session: {}
})
await Ctrl.beforeInvocation({
target: ctrl,
action: 'bar'
})
let caught = await Ctrl.beforeInvocation({
target: ctrl,
action: 'foo'
}).catch((err) => err)
equal(caught.name, 'UnauthorizedError')
})
})
/* global describe, before, after, it */
| 18.020833 | 51 | 0.528324 |
c1e473b69ffe2689e53578ad0a064942fbfcd6fa | 5,263 | js | JavaScript | git-pull.js | SmilyBorg/bitburner-scripts | 2d9231afdbbbcaafb16b609cbc8c4a905d10d84f | [
"MIT"
] | null | null | null | git-pull.js | SmilyBorg/bitburner-scripts | 2d9231afdbbbcaafb16b609cbc8c4a905d10d84f | [
"MIT"
] | null | null | null | git-pull.js | SmilyBorg/bitburner-scripts | 2d9231afdbbbcaafb16b609cbc8c4a905d10d84f | [
"MIT"
] | null | null | null | let options;
const argsSchema = [
['github', 'SmilyBorg'],
['repository', 'bitburner-scripts'],
['branch', 'main'],
['download', []], // By default, all supported files in the repository will be downloaded. Override with just a subset of files here
['new-file', []], // If a repository listing fails, only files returned by ns.ls() will be downloaded. You can add additional files to seek out here.
['subfolder', ''], // Can be set to download to a sub-folder that is not part of the remote repository structure
['extension', ['.js', '.ns', '.txt', '.script']], // Files to download by extension
['omit-folder', ['/Temp/']], // Folders to omit
];
export function autocomplete(data, args) {
data.flags(argsSchema);
const lastFlag = args.length > 1 ? args[args.length - 2] : null;
if (["--download", "--subfolder", "--omit-folder"].includes(lastFlag))
return data.scripts;
return [];
}
/** @param {NS} ns
* Will try to download a fresh version of every file on the current server.
* You are responsible for:
* - Backing up your save / scripts first (try `download *` in the terminal)
* - Ensuring you have no local changes that you don't mind getting overwritten
* TODO: Some way to list all files in the repository and/or download them all. **/
export async function main(ns) {
options = ns.flags(argsSchema);
if (options.subfolder && !options.subfolder.startsWith('/'))
options.subfolder = '/' + options.subfolder; // Game requires folders to have a leading slash. Add one if it's missing.
const baseUrl = `https://raw.githubusercontent.com/${options.github}/${options.repository}/${options.branch}/`;
const filesToDownload = options['new-file'].concat(options.download.length > 0 ? options.download : await repositoryListing(ns));
for (const localFilePath of filesToDownload) {
let fullLocalFilePath = pathJoin(options.subfolder, localFilePath);
const remoteFilePath = baseUrl + localFilePath;
ns.print(`Trying to update "${fullLocalFilePath}" from ${remoteFilePath} ...`);
if (await ns.wget(`${remoteFilePath}?ts=${new Date().getTime()}`, fullLocalFilePath) && await rewriteFileForSubfolder(ns, fullLocalFilePath))
ns.tprint(`SUCCESS: Updated "${localFilePath}" to the latest from ${remoteFilePath}`);
else
ns.tprint(`WARNING: "${localFilePath}" was not updated. (Currently running or not located at ${remoteFilePath} )`)
}
}
/** Joins all arguments as components in a path, e.g. pathJoin("foo", "bar", "/baz") = "foo/bar/baz" **/
function pathJoin(...args) {
return args.filter(s => !!s).join('/').replace(/\/\/+/g, '/');
}
/** @param {NS} ns
* Rewrites a file with path substitions to handle downloading to a subfolder. **/
export async function rewriteFileForSubfolder(ns, path) {
if (!options.subfolder || path.includes('git-pull.js'))
return true;
let contents = ns.read(path);
// Replace subfolder reference in helpers.js getFilePath:
contents = contents.replace(`const subfolder = ''`, `const subfolder = '${options.subfolder}/'`);
// Replace any imports, which can't use getFilePath:
contents = contents.replace(/from '(\.\/)?(.*)'/g, `from '${pathJoin(options.subfolder, '$2')}'`);
await ns.write(path, contents, 'w');
return true;
}
/** @param {NS} ns
* Gets a list of files to download, either from the github repository (if supported), or using a local directory listing **/
async function repositoryListing(ns, folder = '') {
// Note: Limit of 60 free API requests per day, don't over-do it
const listUrl = `https://api.github.com/repos/${options.github}/${options.repository}/contents/${folder}?ref=${options.branch}`
let response = null;
try {
response = await fetch(listUrl); // Raw response
// Expect an array of objects: [{path:"", type:"[file|dir]" },{...},...]
response = await response.json(); // Deserialized
// Sadly, we must recursively retrieve folders, which eats into our 60 free API requests per day.
const folders = response.filter(f => f.type == "dir").map(f => f.path);
let files = response.filter(f => f.type == "file").map(f => f.path)
.filter(f => options.extension.some(ext => f.endsWith(ext)));
ns.print(`The following files exist at ${listUrl}\n${files.join(", ")}`);
for (const folder of folders)
files = files.concat((await repositoryListing(ns, folder))
.map(f => `/${f}`)); // Game requires folders to have a leading slash
return files;
} catch (error) {
if (folder !== '') throw error; // Propagate the error if this was a recursive call.
ns.tprint(`WARNING: Failed to get a repository listing (GitHub API request limit of 60 reached?): ${listUrl}` +
`\nResponse Contents (if available): ${JSON.stringify(response ?? '(N/A)')}\nError: ${String(error)}`);
// Fallback, assume the user already has a copy of all files in the repo, and use it as a directory listing
return ns.ls('home').filter(name => options.extension.some(ext => f.endsWith(ext)) &&
!options['omit-folder'].some(dir => name.startsWith(dir)));
}
}
| 57.835165 | 153 | 0.649249 |
c1e4c3cf7f11a39e3025f36263174352e5673995 | 1,286 | js | JavaScript | source/importers/KDBXImporter.js | ocjojo/buttercup-importer | 8622b3ce2f744c7cb632a653be1c32fb8f81fe40 | [
"MIT"
] | null | null | null | source/importers/KDBXImporter.js | ocjojo/buttercup-importer | 8622b3ce2f744c7cb632a653be1c32fb8f81fe40 | [
"MIT"
] | null | null | null | source/importers/KDBXImporter.js | ocjojo/buttercup-importer | 8622b3ce2f744c7cb632a653be1c32fb8f81fe40 | [
"MIT"
] | null | null | null | "use strict";
var fs = require("fs"),
kdbxweb = require("kdbxweb");
var Buttercup = require("buttercup"),
KeePass2XMLImporter = require("./KeePass2XMLImporter.js");
function toArrayBuffer(buffer) {
var ab = new ArrayBuffer(buffer.length);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
view[i] = buffer[i];
}
return ab;
}
function KDBXImporter(filename) {
this._filename = filename;
}
KDBXImporter.prototype.export = function(password) {
var filename = this._filename;
return new Promise(function(resolve, reject) {
fs.readFile(filename, function(err, data) {
if (err) {
return reject(err);
}
resolve(data);
});
})
.then(function(kdbxRaw) {
var credentials = new kdbxweb.Credentials(
kdbxweb.ProtectedValue.fromString(password)
);
return kdbxweb.Kdbx.load(toArrayBuffer(kdbxRaw), credentials);
})
.then(function(db) {
return db.saveXml();
})
.then(function(xmlString) {
var xmlImporter = new KeePass2XMLImporter(xmlString);
return xmlImporter.exportArchive();
});
};
module.exports = KDBXImporter;
| 26.791667 | 74 | 0.585537 |
c1e5193fd59d33c3d4591c458470a15b8d03aed1 | 1,620 | js | JavaScript | TamTam.UI.Web.TestSite/scripts/movieMain.js | pciccio/tamtam | 6c4aa1314f3a9df4a60234ca96c165385aefed6b | [
"MIT"
] | null | null | null | TamTam.UI.Web.TestSite/scripts/movieMain.js | pciccio/tamtam | 6c4aa1314f3a9df4a60234ca96c165385aefed6b | [
"MIT"
] | null | null | null | TamTam.UI.Web.TestSite/scripts/movieMain.js | pciccio/tamtam | 6c4aa1314f3a9df4a60234ca96c165385aefed6b | [
"MIT"
] | null | null | null | var uri = 'http://tamtamapi.azurewebsites.net/movies/';
function findByTitle() {
var title = $("#title1").val();
$.getJSON(uri + "getbytitle/" + title)
.done(function (data) {
buildHtmlContent(data);
})
.fail(function (jqXHR, textStatus, err) {
alert("Error: " + err);
});
};
function findByTitleAndYear() {
var title = $("#title2").val();
var year = $("#year").val();
$.getJSON(uri + "getbytitleandyear/" + title + "/" + year)
.done(function (data) {
buildHtmlContent(data);
})
.fail(function (jqXHR, textStatus, err) {
alert("Error: " + err);
});
};
function buildHtmlContent(data) {
var $tbody = $('<p>Not found.</p>');
if (data.Movie.Title != null) {
$tbody = $('<table class="table table-condensed"><thead><tr><th></th><th></th><th></th></tr></thead>');
var aux = 0;
$.each(data.Movie, function (k, v) {
if (aux === 1) {
var movie = "<td rowspan=19>";
if (data.Movie.Poster !== "N/A")
movie += "<img height='250' width='200' src=" + data.Movie.Poster + "></img>";
if (data.Video.items.length > 0)
movie += data.Video.items[0].id.embed + "</td>";
else
movie += "Trailer not found.</td>";
}
$tbody.append('<tr><td>' + k + '</td><td>' + v + '</td>' + movie + '</tr>');
aux++;
});
$tbody.append('<tbody></tbody></table><br/>');
}
$("#content").prepend($tbody);
}; | 25.714286 | 111 | 0.467284 |
c1e57199c22e230cd8eeacaa58f9592884261db2 | 128 | js | JavaScript | studioactions/tablet/p2kwiet20606288545994_tbxSearchORE_onTextChange_seq0.js | konySamplesAppFactory/KSApp | bc308258611d84ec696b826e93bdeb08aa23e95b | [
"MIT"
] | null | null | null | studioactions/tablet/p2kwiet20606288545994_tbxSearchORE_onTextChange_seq0.js | konySamplesAppFactory/KSApp | bc308258611d84ec696b826e93bdeb08aa23e95b | [
"MIT"
] | null | null | null | studioactions/tablet/p2kwiet20606288545994_tbxSearchORE_onTextChange_seq0.js | konySamplesAppFactory/KSApp | bc308258611d84ec696b826e93bdeb08aa23e95b | [
"MIT"
] | null | null | null | function p2kwiet20606288545994_tbxSearchORE_onTextChange_seq0(eventobject, changedtext) {
return displaySearch.call(this);
} | 42.666667 | 89 | 0.851563 |
c1e5b130a51c4c623090a243a462086d121fd487 | 2,578 | js | JavaScript | site-source/js/Uize/Widget/FormElementWarning.js | baiyanghese/UIZE-JavaScript-Framework | 3004ad0ebdfddd57e10bb8d17bfb0c17b5697902 | [
"MIT"
] | 1 | 2015-11-06T05:40:22.000Z | 2015-11-06T05:40:22.000Z | site-source/js/Uize/Widget/FormElementWarning.js | baiyanghese/UIZE-JavaScript-Framework | 3004ad0ebdfddd57e10bb8d17bfb0c17b5697902 | [
"MIT"
] | null | null | null | site-source/js/Uize/Widget/FormElementWarning.js | baiyanghese/UIZE-JavaScript-Framework | 3004ad0ebdfddd57e10bb8d17bfb0c17b5697902 | [
"MIT"
] | null | null | null | /*______________
| ______ | U I Z E J A V A S C R I P T F R A M E W O R K
| / / | ---------------------------------------------------
| / O / | MODULE : Uize.Widget.FormElementWarning Class
| / / / |
| / / / /| | ONLINE : http://www.uize.com
| /____/ /__/_| | COPYRIGHT : (c)2010-2014 UIZE
| /___ | LICENSE : Available under MIT License or GNU General Public License
|_______________| http://www.uize.com/license.html
*/
/* Module Meta Data
type: Class
importance: 5
codeCompleteness: 80
testCompleteness: 0
docCompleteness: 3
*/
/*?
Introduction
The =Uize.Widget.FormElementWarning= widget provides functionality for displaying a warning/error message for a form element
*DEVELOPERS:* `Ben Ilegbodu`, original code contributed by `Zazzle Inc.`
*/
Uize.module ({
name:'Uize.Widget.FormElementWarning',
required:'Uize.Dom.Classes',
builder:function (_superclass) {
'use strict';
/*** Private Instance Methods ***/
function _updateUiFocused (m) {
m.isWired
&& Uize.Dom.Classes.setState(
m.getNode(),
['', m._cssClassFocused],
m._focused
)
;
}
function _updateUiMessage (m) { m.isWired && m.setNodeInnerHtml('text', m.getMessage()) }
function _updateUiShown (m) { m.isWired && m.displayNode('', m._shown) }
return _superclass.subclass ({
instanceMethods:{
getMessage:function () {
var _message = this._message;
return Uize.isFunction (_message) ? _message() : _message;
},
updateUi:function () {
var m = this;
if (m.isWired) {
_updateUiMessage(m);
_updateUiShown(m);
_updateUiFocused(m);
_superclass.doMy (m,'updateUi');
}
},
wireUi:function () {
var m = this;
if (!m.isWired) {
var _focus = function (_focused) { m.set({ _focused: _focused }) };
m.wireNode (
'',
{
mouseover:function () { _focus(true) },
mouseout:function () { _focus(false) }
}
);
m._message == null
&& m.set({_message:m.getNodeValue('text')})
;
_superclass.doMy (m,'wireUi');
}
}
},
stateProperties:{
_cssClassFocused:'cssClassFocused',
_focused:{
name:'focused',
onChange:function () {_updateUiFocused (this)},
value:false
},
_message:{
name:'message',
onChange:function () {_updateUiMessage (this)}
},
_shown:{
name:'shown',
onChange:function () {_updateUiShown (this)},
value:false
}
}
});
}
});
| 23.436364 | 126 | 0.572149 |
c1e60198066335a3edc989f963cdb15ad67aa697 | 110 | js | JavaScript | app/modules/item-handler/itemhandler.module.js | dendriel/npc-data-manager-front | e0e8112a9447147ddca424ec3aa5eb7989ca31d3 | [
"MIT"
] | 1 | 2021-03-08T22:38:50.000Z | 2021-03-08T22:38:50.000Z | app/modules/item-handler/itemhandler.module.js | dendriel/npc-data-manager-front | e0e8112a9447147ddca424ec3aa5eb7989ca31d3 | [
"MIT"
] | 1 | 2022-02-14T02:41:13.000Z | 2022-02-14T02:41:13.000Z | app/modules/item-handler/itemhandler.module.js | dendriel/npc-data-manager-front | e0e8112a9447147ddca424ec3aa5eb7989ca31d3 | [
"MIT"
] | null | null | null | 'use string';
angular
.module('itemhandler', [
'core',
'sharedcomponents'
]);
| 13.75 | 29 | 0.481818 |
c1e605cb0ecc747f32b9575ed713533267544da7 | 340 | js | JavaScript | plugins/markdown/src/03-paragraph.js | niebert/wtf_wikipedia | 4acb61f74432312b26945062699718d022330b0c | [
"MIT"
] | 2 | 2020-08-13T00:34:05.000Z | 2020-08-23T16:52:48.000Z | plugins/markdown/src/03-paragraph.js | niebert/wtf_wikipedia | 4acb61f74432312b26945062699718d022330b0c | [
"MIT"
] | null | null | null | plugins/markdown/src/03-paragraph.js | niebert/wtf_wikipedia | 4acb61f74432312b26945062699718d022330b0c | [
"MIT"
] | null | null | null | const defaults = {
sentences: true
}
const toMarkdown = function(options) {
options = Object.assign({}, defaults, options)
let md = ''
if (options.sentences === true) {
md += this.sentences().reduce((str, s) => {
str += s.markdown(options) + '\n'
return str
}, {})
}
return md
}
module.exports = toMarkdown
| 20 | 48 | 0.594118 |
c1e61dc1d239c46b7ca991f4a702d7140f468d09 | 5,322 | js | JavaScript | data/quests/17393.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | 4 | 2020-03-08T19:13:49.000Z | 2021-07-04T10:48:07.000Z | data/quests/17393.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | null | null | null | data/quests/17393.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | null | null | null | g_db.quests[17393]={id:17393,name:"Enter Arena Room",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:1,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:1,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:0,recommended_level:0,show_quest_title:0,show_as_gold_quest:0,start_npc:21157,finish_npc:0,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:0,req_npc_type:0,parent_quest:0,previous_quest:0,next_quest:0,sub_quest_first:17395,dialogue:{},on_success:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,tp:{world:132,x:-275.00000000,y:2.00000000,z:277.00000000,},ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[
{id:17395,name:"Return Red Leader Tag (01)",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:1,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:0,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:0,finish_npc:0,is_craft_skill_quest:0,can_be_found:1,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:2,req_npc_type:0,parent_quest:17393,previous_quest:0,next_quest:17396,sub_quest_first:0,dialogue:{},on_success:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[{chosen_randomly:0,items:[{id:22522,is_common:1,amount:1,probability:1.00000000,},]},],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},
{id:17396,name:"Return Blue Leader Tag (01)",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:1,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:0,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:0,finish_npc:0,is_craft_skill_quest:0,can_be_found:1,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:2,req_npc_type:0,parent_quest:17393,previous_quest:17395,next_quest:0,sub_quest_first:0,dialogue:{},on_success:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[{chosen_randomly:0,items:[{id:22531,is_common:1,amount:1,probability:1.00000000,},]},],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},]};
| 1,330.5 | 1,782 | 0.853626 |
c1e67717183cd6b9ada4f233047aa2c43f13cece | 19,642 | js | JavaScript | plugins/ti.es6/1.3.0/Titanium/UI/Android.js | appcelerator/ti.es6 | c50cd3d5dd8aced3354ab2626f71c027e91b46f6 | [
"Apache-2.0"
] | 14 | 2018-03-03T08:07:27.000Z | 2020-10-22T01:33:51.000Z | plugins/ti.es6/1.3.0/Titanium/UI/Android.js | appcelerator/ti.es6 | c50cd3d5dd8aced3354ab2626f71c027e91b46f6 | [
"Apache-2.0"
] | 1 | 2019-02-08T15:21:33.000Z | 2019-02-08T15:40:23.000Z | plugins/ti.es6/1.3.0/Titanium/UI/Android.js | appcelerator/ti.es6 | c50cd3d5dd8aced3354ab2626f71c027e91b46f6 | [
"Apache-2.0"
] | 1 | 2019-02-12T17:09:41.000Z | 2019-02-12T17:09:41.000Z | import { default as Window } from './Window';
export { default as CardView } from './Android/CardView';
import { default as CardView } from './Android/CardView';
export { default as DrawerLayout } from './Android/DrawerLayout';
import { default as DrawerLayout } from './Android/DrawerLayout';
export { default as ProgressIndicator } from './Android/ProgressIndicator';
import { default as ProgressIndicator } from './Android/ProgressIndicator';
export { default as SearchView } from './Android/SearchView';
import { default as SearchView } from './Android/SearchView';
export default class Android {
constructor (object) {
if (object && object.apiName && object.apiName.endsWith('.UI.Android')) {
this._object = object;
} else {
this._object = undefined;
}
}
// constants
static get apiName () {
return Titanium.UI.Android.apiName;
}
static get GRAVITY_AXIS_CLIP () {
return Titanium.UI.Android.GRAVITY_AXIS_CLIP;
}
static get GRAVITY_AXIS_PULL_AFTER () {
return Titanium.UI.Android.GRAVITY_AXIS_PULL_AFTER;
}
static get GRAVITY_AXIS_PULL_BEFORE () {
return Titanium.UI.Android.GRAVITY_AXIS_PULL_BEFORE;
}
static get GRAVITY_AXIS_SPECIFIED () {
return Titanium.UI.Android.GRAVITY_AXIS_SPECIFIED;
}
static get GRAVITY_AXIS_X_SHIFT () {
return Titanium.UI.Android.GRAVITY_AXIS_X_SHIFT;
}
static get GRAVITY_AXIS_Y_SHIFT () {
return Titanium.UI.Android.GRAVITY_AXIS_Y_SHIFT;
}
static get GRAVITY_BOTTOM () {
return Titanium.UI.Android.GRAVITY_BOTTOM;
}
static get GRAVITY_CENTER () {
return Titanium.UI.Android.GRAVITY_CENTER;
}
static get GRAVITY_CENTER_HORIZONTAL () {
return Titanium.UI.Android.GRAVITY_CENTER_HORIZONTAL;
}
static get GRAVITY_CENTER_VERTICAL () {
return Titanium.UI.Android.GRAVITY_CENTER_VERTICAL;
}
static get GRAVITY_CLIP_HORIZONTAL () {
return Titanium.UI.Android.GRAVITY_CLIP_HORIZONTAL;
}
static get GRAVITY_CLIP_VERTICAL () {
return Titanium.UI.Android.GRAVITY_CLIP_VERTICAL;
}
static get GRAVITY_DISPLAY_CLIP_HORIZONTAL () {
return Titanium.UI.Android.GRAVITY_DISPLAY_CLIP_HORIZONTAL;
}
static get GRAVITY_DISPLAY_CLIP_VERTICAL () {
return Titanium.UI.Android.GRAVITY_DISPLAY_CLIP_VERTICAL;
}
static get GRAVITY_END () {
return Titanium.UI.Android.GRAVITY_END;
}
static get GRAVITY_FILL () {
return Titanium.UI.Android.GRAVITY_FILL;
}
static get GRAVITY_FILL_HORIZONTAL () {
return Titanium.UI.Android.GRAVITY_FILL_HORIZONTAL;
}
static get GRAVITY_FILL_VERTICAL () {
return Titanium.UI.Android.GRAVITY_FILL_VERTICAL;
}
static get GRAVITY_HORIZONTAL_GRAVITY_MASK () {
return Titanium.UI.Android.GRAVITY_HORIZONTAL_GRAVITY_MASK;
}
static get GRAVITY_LEFT () {
return Titanium.UI.Android.GRAVITY_LEFT;
}
static get GRAVITY_NO_GRAVITY () {
return Titanium.UI.Android.GRAVITY_NO_GRAVITY;
}
static get GRAVITY_RELATIVE_HORIZONTAL_GRAVITY_MASK () {
return Titanium.UI.Android.GRAVITY_RELATIVE_HORIZONTAL_GRAVITY_MASK;
}
static get GRAVITY_RELATIVE_LAYOUT_DIRECTION () {
return Titanium.UI.Android.GRAVITY_RELATIVE_LAYOUT_DIRECTION;
}
static get GRAVITY_RIGHT () {
return Titanium.UI.Android.GRAVITY_RIGHT;
}
static get GRAVITY_START () {
return Titanium.UI.Android.GRAVITY_START;
}
static get GRAVITY_TOP () {
return Titanium.UI.Android.GRAVITY_TOP;
}
static get GRAVITY_VERTICAL_GRAVITY_MASK () {
return Titanium.UI.Android.GRAVITY_VERTICAL_GRAVITY_MASK;
}
static get LINKIFY_ALL () {
return Titanium.UI.Android.LINKIFY_ALL;
}
static get LINKIFY_EMAIL_ADDRESSES () {
return Titanium.UI.Android.LINKIFY_EMAIL_ADDRESSES;
}
static get LINKIFY_MAP_ADDRESSES () {
return Titanium.UI.Android.LINKIFY_MAP_ADDRESSES;
}
static get LINKIFY_PHONE_NUMBERS () {
return Titanium.UI.Android.LINKIFY_PHONE_NUMBERS;
}
static get LINKIFY_WEB_URLS () {
return Titanium.UI.Android.LINKIFY_WEB_URLS;
}
static get OVER_SCROLL_ALWAYS () {
return Titanium.UI.Android.OVER_SCROLL_ALWAYS;
}
static get OVER_SCROLL_IF_CONTENT_SCROLLS () {
return Titanium.UI.Android.OVER_SCROLL_IF_CONTENT_SCROLLS;
}
static get OVER_SCROLL_NEVER () {
return Titanium.UI.Android.OVER_SCROLL_NEVER;
}
static get PIXEL_FORMAT_A_8 () {
return Titanium.UI.Android.PIXEL_FORMAT_A_8;
}
static get PIXEL_FORMAT_LA_88 () {
return Titanium.UI.Android.PIXEL_FORMAT_LA_88;
}
static get PIXEL_FORMAT_L_8 () {
return Titanium.UI.Android.PIXEL_FORMAT_L_8;
}
static get PIXEL_FORMAT_OPAQUE () {
return Titanium.UI.Android.PIXEL_FORMAT_OPAQUE;
}
static get PIXEL_FORMAT_RGBA_4444 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGBA_4444;
}
static get PIXEL_FORMAT_RGBA_5551 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGBA_5551;
}
static get PIXEL_FORMAT_RGBA_8888 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGBA_8888;
}
static get PIXEL_FORMAT_RGBX_8888 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGBX_8888;
}
static get PIXEL_FORMAT_RGB_332 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGB_332;
}
static get PIXEL_FORMAT_RGB_565 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGB_565;
}
static get PIXEL_FORMAT_RGB_888 () {
return Titanium.UI.Android.PIXEL_FORMAT_RGB_888;
}
static get PIXEL_FORMAT_TRANSLUCENT () {
return Titanium.UI.Android.PIXEL_FORMAT_TRANSLUCENT;
}
static get PIXEL_FORMAT_TRANSPARENT () {
return Titanium.UI.Android.PIXEL_FORMAT_TRANSPARENT;
}
static get PIXEL_FORMAT_UNKNOWN () {
return Titanium.UI.Android.PIXEL_FORMAT_UNKNOWN;
}
static get PROGRESS_INDICATOR_DIALOG () {
return Titanium.UI.Android.PROGRESS_INDICATOR_DIALOG;
}
static get PROGRESS_INDICATOR_STATUS_BAR () {
return Titanium.UI.Android.PROGRESS_INDICATOR_STATUS_BAR;
}
static get PROGRESS_INDICATOR_INDETERMINANT () {
return Titanium.UI.Android.PROGRESS_INDICATOR_INDETERMINANT;
}
static get PROGRESS_INDICATOR_DETERMINANT () {
return Titanium.UI.Android.PROGRESS_INDICATOR_DETERMINANT;
}
static get SOFT_INPUT_ADJUST_PAN () {
return Titanium.UI.Android.SOFT_INPUT_ADJUST_PAN;
}
static get SOFT_INPUT_ADJUST_RESIZE () {
return Titanium.UI.Android.SOFT_INPUT_ADJUST_RESIZE;
}
static get SOFT_INPUT_ADJUST_UNSPECIFIED () {
return Titanium.UI.Android.SOFT_INPUT_ADJUST_UNSPECIFIED;
}
static get SOFT_INPUT_STATE_ALWAYS_HIDDEN () {
return Titanium.UI.Android.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
}
static get SOFT_INPUT_STATE_ALWAYS_VISIBLE () {
return Titanium.UI.Android.SOFT_INPUT_STATE_ALWAYS_VISIBLE;
}
static get SOFT_INPUT_STATE_HIDDEN () {
return Titanium.UI.Android.SOFT_INPUT_STATE_HIDDEN;
}
static get SOFT_INPUT_STATE_UNSPECIFIED () {
return Titanium.UI.Android.SOFT_INPUT_STATE_UNSPECIFIED;
}
static get SOFT_INPUT_STATE_VISIBLE () {
return Titanium.UI.Android.SOFT_INPUT_STATE_VISIBLE;
}
static get SOFT_KEYBOARD_DEFAULT_ON_FOCUS () {
return Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS;
}
static get SOFT_KEYBOARD_HIDE_ON_FOCUS () {
return Titanium.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS;
}
static get SOFT_KEYBOARD_SHOW_ON_FOCUS () {
return Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS;
}
static get SWITCH_STYLE_CHECKBOX () {
return Titanium.UI.Android.SWITCH_STYLE_CHECKBOX;
}
static get SWITCH_STYLE_TOGGLEBUTTON () {
return Titanium.UI.Android.SWITCH_STYLE_TOGGLEBUTTON;
}
static get SWITCH_STYLE_SWITCH () {
return Titanium.UI.Android.SWITCH_STYLE_SWITCH;
}
static get WEBVIEW_PLUGINS_OFF () {
return Titanium.UI.Android.WEBVIEW_PLUGINS_OFF;
}
static get WEBVIEW_PLUGINS_ON () {
return Titanium.UI.Android.WEBVIEW_PLUGINS_ON;
}
static get WEBVIEW_PLUGINS_ON_DEMAND () {
return Titanium.UI.Android.WEBVIEW_PLUGINS_ON_DEMAND;
}
static get WEBVIEW_LOAD_DEFAULT () {
return Titanium.UI.Android.WEBVIEW_LOAD_DEFAULT;
}
static get WEBVIEW_LOAD_NO_CACHE () {
return Titanium.UI.Android.WEBVIEW_LOAD_NO_CACHE;
}
static get WEBVIEW_LOAD_CACHE_ONLY () {
return Titanium.UI.Android.WEBVIEW_LOAD_CACHE_ONLY;
}
static get WEBVIEW_LOAD_CACHE_ELSE_NETWORK () {
return Titanium.UI.Android.WEBVIEW_LOAD_CACHE_ELSE_NETWORK;
}
static get TRANSITION_EXPLODE () {
return Titanium.UI.Android.TRANSITION_EXPLODE;
}
static get TRANSITION_FADE_IN () {
return Titanium.UI.Android.TRANSITION_FADE_IN;
}
static get TRANSITION_FADE_OUT () {
return Titanium.UI.Android.TRANSITION_FADE_OUT;
}
static get TRANSITION_SLIDE_TOP () {
return Titanium.UI.Android.TRANSITION_SLIDE_TOP;
}
static get TRANSITION_SLIDE_RIGHT () {
return Titanium.UI.Android.TRANSITION_SLIDE_RIGHT;
}
static get TRANSITION_SLIDE_BOTTOM () {
return Titanium.UI.Android.TRANSITION_SLIDE_BOTTOM;
}
static get TRANSITION_SLIDE_LEFT () {
return Titanium.UI.Android.TRANSITION_SLIDE_LEFT;
}
static get TRANSITION_CHANGE_BOUNDS () {
return Titanium.UI.Android.TRANSITION_CHANGE_BOUNDS;
}
static get TRANSITION_CHANGE_CLIP_BOUNDS () {
return Titanium.UI.Android.TRANSITION_CHANGE_CLIP_BOUNDS;
}
static get TRANSITION_CHANGE_TRANSFORM () {
return Titanium.UI.Android.TRANSITION_CHANGE_TRANSFORM;
}
static get TRANSITION_CHANGE_IMAGE_TRANSFORM () {
return Titanium.UI.Android.TRANSITION_CHANGE_IMAGE_TRANSFORM;
}
static get TRANSITION_NONE () {
return Titanium.UI.Android.TRANSITION_NONE;
}
// properties
get apiName () {
return this._object.apiName;
}
get bubbleParent () {
return this._object.bubbleParent;
}
set bubbleParent (value) {
this._object.bubbleParent = value;
}
get lifecycleContainer () {
return new Window(this._object.lifecycleContainer);
}
set lifecycleContainer (value) {
this._object.lifecycleContainer = value;
}
get GRAVITY_AXIS_CLIP () {
return this._object.GRAVITY_AXIS_CLIP;
}
get GRAVITY_AXIS_PULL_AFTER () {
return this._object.GRAVITY_AXIS_PULL_AFTER;
}
get GRAVITY_AXIS_PULL_BEFORE () {
return this._object.GRAVITY_AXIS_PULL_BEFORE;
}
get GRAVITY_AXIS_SPECIFIED () {
return this._object.GRAVITY_AXIS_SPECIFIED;
}
get GRAVITY_AXIS_X_SHIFT () {
return this._object.GRAVITY_AXIS_X_SHIFT;
}
get GRAVITY_AXIS_Y_SHIFT () {
return this._object.GRAVITY_AXIS_Y_SHIFT;
}
get GRAVITY_BOTTOM () {
return this._object.GRAVITY_BOTTOM;
}
get GRAVITY_CENTER () {
return this._object.GRAVITY_CENTER;
}
get GRAVITY_CENTER_HORIZONTAL () {
return this._object.GRAVITY_CENTER_HORIZONTAL;
}
get GRAVITY_CENTER_VERTICAL () {
return this._object.GRAVITY_CENTER_VERTICAL;
}
get GRAVITY_CLIP_HORIZONTAL () {
return this._object.GRAVITY_CLIP_HORIZONTAL;
}
get GRAVITY_CLIP_VERTICAL () {
return this._object.GRAVITY_CLIP_VERTICAL;
}
get GRAVITY_DISPLAY_CLIP_HORIZONTAL () {
return this._object.GRAVITY_DISPLAY_CLIP_HORIZONTAL;
}
get GRAVITY_DISPLAY_CLIP_VERTICAL () {
return this._object.GRAVITY_DISPLAY_CLIP_VERTICAL;
}
get GRAVITY_END () {
return this._object.GRAVITY_END;
}
get GRAVITY_FILL () {
return this._object.GRAVITY_FILL;
}
get GRAVITY_FILL_HORIZONTAL () {
return this._object.GRAVITY_FILL_HORIZONTAL;
}
get GRAVITY_FILL_VERTICAL () {
return this._object.GRAVITY_FILL_VERTICAL;
}
get GRAVITY_HORIZONTAL_GRAVITY_MASK () {
return this._object.GRAVITY_HORIZONTAL_GRAVITY_MASK;
}
get GRAVITY_LEFT () {
return this._object.GRAVITY_LEFT;
}
get GRAVITY_NO_GRAVITY () {
return this._object.GRAVITY_NO_GRAVITY;
}
get GRAVITY_RELATIVE_HORIZONTAL_GRAVITY_MASK () {
return this._object.GRAVITY_RELATIVE_HORIZONTAL_GRAVITY_MASK;
}
get GRAVITY_RELATIVE_LAYOUT_DIRECTION () {
return this._object.GRAVITY_RELATIVE_LAYOUT_DIRECTION;
}
get GRAVITY_RIGHT () {
return this._object.GRAVITY_RIGHT;
}
get GRAVITY_START () {
return this._object.GRAVITY_START;
}
get GRAVITY_TOP () {
return this._object.GRAVITY_TOP;
}
get GRAVITY_VERTICAL_GRAVITY_MASK () {
return this._object.GRAVITY_VERTICAL_GRAVITY_MASK;
}
get LINKIFY_ALL () {
return this._object.LINKIFY_ALL;
}
get LINKIFY_EMAIL_ADDRESSES () {
return this._object.LINKIFY_EMAIL_ADDRESSES;
}
get LINKIFY_MAP_ADDRESSES () {
return this._object.LINKIFY_MAP_ADDRESSES;
}
get LINKIFY_PHONE_NUMBERS () {
return this._object.LINKIFY_PHONE_NUMBERS;
}
get LINKIFY_WEB_URLS () {
return this._object.LINKIFY_WEB_URLS;
}
get OVER_SCROLL_ALWAYS () {
return this._object.OVER_SCROLL_ALWAYS;
}
get OVER_SCROLL_IF_CONTENT_SCROLLS () {
return this._object.OVER_SCROLL_IF_CONTENT_SCROLLS;
}
get OVER_SCROLL_NEVER () {
return this._object.OVER_SCROLL_NEVER;
}
get PIXEL_FORMAT_A_8 () {
return this._object.PIXEL_FORMAT_A_8;
}
get PIXEL_FORMAT_LA_88 () {
return this._object.PIXEL_FORMAT_LA_88;
}
get PIXEL_FORMAT_L_8 () {
return this._object.PIXEL_FORMAT_L_8;
}
get PIXEL_FORMAT_OPAQUE () {
return this._object.PIXEL_FORMAT_OPAQUE;
}
get PIXEL_FORMAT_RGBA_4444 () {
return this._object.PIXEL_FORMAT_RGBA_4444;
}
get PIXEL_FORMAT_RGBA_5551 () {
return this._object.PIXEL_FORMAT_RGBA_5551;
}
get PIXEL_FORMAT_RGBA_8888 () {
return this._object.PIXEL_FORMAT_RGBA_8888;
}
get PIXEL_FORMAT_RGBX_8888 () {
return this._object.PIXEL_FORMAT_RGBX_8888;
}
get PIXEL_FORMAT_RGB_332 () {
return this._object.PIXEL_FORMAT_RGB_332;
}
get PIXEL_FORMAT_RGB_565 () {
return this._object.PIXEL_FORMAT_RGB_565;
}
get PIXEL_FORMAT_RGB_888 () {
return this._object.PIXEL_FORMAT_RGB_888;
}
get PIXEL_FORMAT_TRANSLUCENT () {
return this._object.PIXEL_FORMAT_TRANSLUCENT;
}
get PIXEL_FORMAT_TRANSPARENT () {
return this._object.PIXEL_FORMAT_TRANSPARENT;
}
get PIXEL_FORMAT_UNKNOWN () {
return this._object.PIXEL_FORMAT_UNKNOWN;
}
get PROGRESS_INDICATOR_DIALOG () {
return this._object.PROGRESS_INDICATOR_DIALOG;
}
get PROGRESS_INDICATOR_STATUS_BAR () {
return this._object.PROGRESS_INDICATOR_STATUS_BAR;
}
get PROGRESS_INDICATOR_INDETERMINANT () {
return this._object.PROGRESS_INDICATOR_INDETERMINANT;
}
get PROGRESS_INDICATOR_DETERMINANT () {
return this._object.PROGRESS_INDICATOR_DETERMINANT;
}
get SOFT_INPUT_ADJUST_PAN () {
return this._object.SOFT_INPUT_ADJUST_PAN;
}
get SOFT_INPUT_ADJUST_RESIZE () {
return this._object.SOFT_INPUT_ADJUST_RESIZE;
}
get SOFT_INPUT_ADJUST_UNSPECIFIED () {
return this._object.SOFT_INPUT_ADJUST_UNSPECIFIED;
}
get SOFT_INPUT_STATE_ALWAYS_HIDDEN () {
return this._object.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
}
get SOFT_INPUT_STATE_ALWAYS_VISIBLE () {
return this._object.SOFT_INPUT_STATE_ALWAYS_VISIBLE;
}
get SOFT_INPUT_STATE_HIDDEN () {
return this._object.SOFT_INPUT_STATE_HIDDEN;
}
get SOFT_INPUT_STATE_UNSPECIFIED () {
return this._object.SOFT_INPUT_STATE_UNSPECIFIED;
}
get SOFT_INPUT_STATE_VISIBLE () {
return this._object.SOFT_INPUT_STATE_VISIBLE;
}
get SOFT_KEYBOARD_DEFAULT_ON_FOCUS () {
return this._object.SOFT_KEYBOARD_DEFAULT_ON_FOCUS;
}
get SOFT_KEYBOARD_HIDE_ON_FOCUS () {
return this._object.SOFT_KEYBOARD_HIDE_ON_FOCUS;
}
get SOFT_KEYBOARD_SHOW_ON_FOCUS () {
return this._object.SOFT_KEYBOARD_SHOW_ON_FOCUS;
}
get SWITCH_STYLE_CHECKBOX () {
return this._object.SWITCH_STYLE_CHECKBOX;
}
get SWITCH_STYLE_TOGGLEBUTTON () {
return this._object.SWITCH_STYLE_TOGGLEBUTTON;
}
get SWITCH_STYLE_SWITCH () {
return this._object.SWITCH_STYLE_SWITCH;
}
get WEBVIEW_PLUGINS_OFF () {
return this._object.WEBVIEW_PLUGINS_OFF;
}
get WEBVIEW_PLUGINS_ON () {
return this._object.WEBVIEW_PLUGINS_ON;
}
get WEBVIEW_PLUGINS_ON_DEMAND () {
return this._object.WEBVIEW_PLUGINS_ON_DEMAND;
}
get WEBVIEW_LOAD_DEFAULT () {
return this._object.WEBVIEW_LOAD_DEFAULT;
}
get WEBVIEW_LOAD_NO_CACHE () {
return this._object.WEBVIEW_LOAD_NO_CACHE;
}
get WEBVIEW_LOAD_CACHE_ONLY () {
return this._object.WEBVIEW_LOAD_CACHE_ONLY;
}
get WEBVIEW_LOAD_CACHE_ELSE_NETWORK () {
return this._object.WEBVIEW_LOAD_CACHE_ELSE_NETWORK;
}
get TRANSITION_EXPLODE () {
return this._object.TRANSITION_EXPLODE;
}
get TRANSITION_FADE_IN () {
return this._object.TRANSITION_FADE_IN;
}
get TRANSITION_FADE_OUT () {
return this._object.TRANSITION_FADE_OUT;
}
get TRANSITION_SLIDE_TOP () {
return this._object.TRANSITION_SLIDE_TOP;
}
get TRANSITION_SLIDE_RIGHT () {
return this._object.TRANSITION_SLIDE_RIGHT;
}
get TRANSITION_SLIDE_BOTTOM () {
return this._object.TRANSITION_SLIDE_BOTTOM;
}
get TRANSITION_SLIDE_LEFT () {
return this._object.TRANSITION_SLIDE_LEFT;
}
get TRANSITION_CHANGE_BOUNDS () {
return this._object.TRANSITION_CHANGE_BOUNDS;
}
get TRANSITION_CHANGE_CLIP_BOUNDS () {
return this._object.TRANSITION_CHANGE_CLIP_BOUNDS;
}
get TRANSITION_CHANGE_TRANSFORM () {
return this._object.TRANSITION_CHANGE_TRANSFORM;
}
get TRANSITION_CHANGE_IMAGE_TRANSFORM () {
return this._object.TRANSITION_CHANGE_IMAGE_TRANSFORM;
}
get TRANSITION_NONE () {
return this._object.TRANSITION_NONE;
}
// static properties
static get bubbleParent () {
return Titanium.UI.Android.bubbleParent;
}
static set bubbleParent (value) {
Titanium.UI.Android.bubbleParent = value;
}
// methods
addEventListener (name, callback) {
if (!callback) {
return new Promise(resolve => this._object.addEventListener(name, resolve));
}
return this._object.addEventListener(name, callback);
}
applyProperties (props) {
props = normalize(props);
return this._object.applyProperties(props);
}
fireEvent (name, event) {
event = normalize(event);
return this._object.fireEvent(name, event);
}
removeEventListener (name, callback) {
if (!callback) {
return new Promise(resolve => this._object.removeEventListener(name, resolve));
}
return this._object.removeEventListener(name, callback);
}
hideSoftKeyboard () {
return this._object.hideSoftKeyboard();
}
openPreferences () {
return this._object.openPreferences();
}
getApiName () {
return this._object.getApiName();
}
getBubbleParent () {
return this._object.getBubbleParent();
}
setBubbleParent (bubbleParent) {
return this._object.setBubbleParent(bubbleParent);
}
getLifecycleContainer () {
return new Window(this._object.getLifecycleContainer());
}
setLifecycleContainer (lifecycleContainer) {
lifecycleContainer = normalize(lifecycleContainer);
return this._object.setLifecycleContainer(lifecycleContainer);
}
// static methods
static addEventListener (name, callback) {
if (!callback) {
return new Promise(resolve => this._object.addEventListener(name, resolve));
}
return this._object.addEventListener(name, callback);
}
static applyProperties (props) {
props = normalize(props);
return this._object.applyProperties(props);
}
static fireEvent (name, event) {
event = normalize(event);
return this._object.fireEvent(name, event);
}
static removeEventListener (name, callback) {
if (!callback) {
return new Promise(resolve => this._object.removeEventListener(name, resolve));
}
return this._object.removeEventListener(name, callback);
}
static hideSoftKeyboard () {
return this._object.hideSoftKeyboard();
}
static openPreferences () {
return this._object.openPreferences();
}
static getApiName () {
return this._object.getApiName();
}
static getBubbleParent () {
return this._object.getBubbleParent();
}
static setBubbleParent (bubbleParent) {
return this._object.setBubbleParent(bubbleParent);
}
// modules
static get CardView () {
return CardView;
}
static get DrawerLayout () {
return DrawerLayout;
}
static get ProgressIndicator () {
return ProgressIndicator;
}
static get SearchView () {
return SearchView;
}
};
Object.freeze(Android);
function normalize (object) {
if (typeof object === 'object') {
if (object._object) {
return object._object;
}
for (let key in object) {
if (typeof object[key] === 'object') {
if (object[key]._object) {
object[key] = object[key]._object;
}
}
}
}
return object;
} | 28.885294 | 82 | 0.772376 |
c1e7ff251ea47a9afc85a64343890fd0438aa453 | 736 | js | JavaScript | src/components/Todo/data.js | vUnAmp/gatsby-chess-dnd | 28383ca9f71bf41861808d992b2aac4014b392dd | [
"RSA-MD"
] | null | null | null | src/components/Todo/data.js | vUnAmp/gatsby-chess-dnd | 28383ca9f71bf41861808d992b2aac4014b392dd | [
"RSA-MD"
] | null | null | null | src/components/Todo/data.js | vUnAmp/gatsby-chess-dnd | 28383ca9f71bf41861808d992b2aac4014b392dd | [
"RSA-MD"
] | null | null | null | const initialData = {
tasks: {
'task-1': { id: 'task-1', content: 'Take out the garbage' },
'task-2': { id: 'task-2', content: 'Watch my favorite show' },
'task-3': { id: 'task-3', content: 'Charge my phone' },
'task-4': { id: 'task-4', content: 'Cook dinner' },
},
columns: {
'column-1': {
id: 'column-1',
title: 'To do',
taskIds: ['task-1', 'task-2', 'task-3', 'task-4'],
},
'column-2': {
id: 'column-2',
title: 'In progress',
taskIds: [],
},
'column-3': {
id: 'column-3',
title: 'Done',
taskIds: [],
},
},
// Facilitate reordering of the columns
columnOrder: ['column-1', 'column-2', 'column-3'],
}
export default initialData
| 24.533333 | 66 | 0.506793 |
c1e82b135f8fcf70c968ef25a623199ba1880785 | 5,590 | js | JavaScript | app/views/Template/Template.js | RcKeller/mern-stack | 0e7eba12f64a15463b29d01b793dd24ffb9aff9f | [
"Apache-2.0"
] | 6 | 2017-07-09T05:03:30.000Z | 2019-07-03T21:05:03.000Z | app/views/Template/Template.js | RcKeller/mern-stack | 0e7eba12f64a15463b29d01b793dd24ffb9aff9f | [
"Apache-2.0"
] | 7 | 2017-06-17T15:37:31.000Z | 2017-09-01T23:48:10.000Z | app/views/Template/Template.js | RcKeller/mern-stack | 0e7eba12f64a15463b29d01b793dd24ffb9aff9f | [
"Apache-2.0"
] | 2 | 2017-06-16T20:39:41.000Z | 2019-02-26T01:16:20.000Z | import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import Helmet from 'react-helmet'
// NOTE: Antd is based on rc-components, fyi
import Drawer from 'rc-drawer-menu'
import { Loading } from '../../components'
/*
Locale Information:
Antd is actually a chinese library by AliBaba, the chinese equiv. of Amazon
Locale Provider cascades context down to components, providing
english messages for things like "No Data" in tables
*/
import { Link } from 'react-router'
import enUS from 'antd/lib/locale-provider/en_US'
import { LocaleProvider, Layout, Icon } from 'antd'
const { Header } = Layout
import Menu from './Menu/Menu'
// Importing images for usage in styling (made possible by webpack loaders)
import favicon from '../../images/favicon.ico'
import mobileLogo from '../../images/mobileLogo.png'
import desktopLogo from '../../images/desktopLogo.png'
import WordmarkWhite from '../../images/WordmarkWhite.png'
// Metadata for SEO - don't change this much!
const meta = [
{ charset: 'utf-8' },
// Meta descriptions are commonly used on search engine result pages to
// display preview snippets for a given page.
{ name: 'Student Tech Fee - UW', content: 'Driving change and enriching learning environments one project, one proposal at a time.' },
// Setting IE=edge tells Internet Explorer to use the latest engine to
// render the page and execute Javascript
{ 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' },
// Using the viewport tag allows you to control the width and scaling of
// the browser's viewport:
// - include width=device-width to match the screen's width in
// device-independent pixels
// - include initial-scale=1 to establish 1:1 relationship between css pixels
// and device-independent pixels
// - ensure your page is accessible by not disabling user scaling.
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
// Disable tap highlight on IE
{ name: 'msapplication-tap-highlight', content: 'no' },
// Add to homescreen for Chrome on Android
{ name: 'mobile-web-app-capable', content: 'yes' },
// Add to homescreen for Safari on IOS
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black' },
{ name: 'apple-mobile-web-app-title', content: 'UW STF' }
]
// Add to homescreen for Chrome on Android
const link = [{ rel: 'icon', href: favicon }]
import Login from './Login/Login'
/*
TEMPLATE:
The core UI for the website
Keeps track of many things like page nav, admin status, etc
Views adjust as necessary
*/
import '../../css/main'
import styles from './Template.css'
@connect(state => ({
// Using redux-responsive for JS based media queries
screen: state.screen,
// Nextlocation is the route of new pages router is transitioning to.
nextLocation: state.routing.locationBeforeTransitions
? state.routing.locationBeforeTransitions.pathname
: '1',
links: state.config.links,
stf: (state.user && state.user.stf) || {},
mobile: state.screen ? !state.screen.greaterThan.medium : false
}))
class Template extends React.Component {
static propTypes = {
children: PropTypes.object.isRequired,
screen: PropTypes.object,
router: PropTypes.object,
nextLocation: PropTypes.string
}
constructor (props) {
super(props)
this.state = { open: false }
}
// Toggle menu view
handleToggle = () => this.setState({ open: !this.state.open })
// Changed pages? Close the nav
componentWillReceiveProps (nextProps) {
if (this.state.open) {
if (this.props.nextLocation !== nextProps.nextLocation) {
this.setState({ open: false })
}
}
}
shouldComponentUpdate () {
return true
}
render (
{ children, screen, nextLocation, router, stf, links, mobile } = this.props,
{ open } = this.state
) {
return (
<LocaleProvider locale={enUS}>
<div>
<Helmet
titleTemplate='%s - UW Student Tech'
meta={meta} link={link}
/>
<Header>
{screen.lessThan.large
? <Icon
style={{fontSize: 32, lineHeight: 'inherit', color: 'white', marginRight: 16}}
type={this.state.open ? 'menu-unfold' : 'menu-fold'}
onClick={this.handleToggle}
/>
: <a href='http://www.washington.edu/'>
<img src={WordmarkWhite} className={styles['uw-logo']} />
</a>
}
<Link to='/'>
<img src={screen.lessThan.medium ? mobileLogo : desktopLogo} className={styles['stf-logo']} />
</Link>
<Login />
</Header>
{mobile
? <Drawer
width='240px'
open={mobile && open}
onMaskClick={this.handleToggle}
iconChild={false}
level={null}
>
<Menu mobile={mobile} router={router} />
</Drawer>
: <div style={{ marginBottom: 16 }}>
<Menu mobile={false} router={router} />
</div>
}
<div className={styles['body']}>
<Loading render={children}
title='This Page'
>
{children}
</Loading>
</div>
</div>
</LocaleProvider>
)
}
}
export default Template
| 35.379747 | 137 | 0.60805 |
c1e9a07a263cd907ac80bdccad3a52bd523d78a2 | 2,527 | js | JavaScript | src/components/QuestionToolbar/QuestionToolbar.js | wombats-writing-code/assessment-editor | c8b730788197c48e38dd434834bda1e67e35d850 | [
"MIT"
] | null | null | null | src/components/QuestionToolbar/QuestionToolbar.js | wombats-writing-code/assessment-editor | c8b730788197c48e38dd434834bda1e67e35d850 | [
"MIT"
] | null | null | null | src/components/QuestionToolbar/QuestionToolbar.js | wombats-writing-code/assessment-editor | c8b730788197c48e38dd434834bda1e67e35d850 | [
"MIT"
] | null | null | null | import React, {Component} from 'react'
import './QuestionToolbar.scss'
class QuestionToolbar extends Component {
constructor(props) {
super(props);
this.state = {
isConfirmDeleteVisible: false,
confirmDeleteValue: ''
}
}
_validateConfirmDelete(value) {
if (value == this.props.question.id) {
this.props.onConfirmDelete(this.props.question)
}
}
render() {
let props = this.props;
let confirmDelete = (
<div>
<input className="input confirm-delete-input" placeholder="Paste in the question ID to confirm you want to delete"
value={this.state.confirmDeleteValue} onChange={(e) => this.setState({confirmDeleteValue: e.target.value})}/>
<div className="flex-container">
<button className="button small confirm-delete-button" onClick={() => this.setState({isConfirmDeleteVisible: false})}>Cancel</button>
<button className="button small warning confirm-delete-button" disabled={props.isDeleteQuestionInProgress}
onClick={() => this._validateConfirmDelete(this.state.confirmDeleteValue)}>
{props.isDeleteQuestionInProgress ? 'Working...' : 'Confirm delete'}
</button>
</div>
</div>
)
return (
<div className="question-toolbar" style={props.styles}>
<div className="flex-container space-between">
<div className="flex-container">
<button className="button question__bar__button flex-container space-between align-center"
onClick={() => props.onClickEdit(props.question)}>
Edit
<img src={require('./assets/pencil.png')}/>
</button>
<button className="button question__bar__button flex-container space-between align-center"
onClick={() => props.onClickCopy(props.question)}>
Copy
<img src={require('./assets/copy.png')}/>
</button>
<button className="button question__bar__button flex-container space-between align-center"
onClick={() => this.setState({isConfirmDeleteVisible: true})}>
Delete
<img src={require('./assets/delete.png')}/>
</button>
</div>
<p className="mute small no-bottom-margin">ID: <b>{props.question.id}</b></p>
</div>
{this.state.isConfirmDeleteVisible ? confirmDelete : null}
</div>
)
}
}
export default QuestionToolbar
| 35.591549 | 143 | 0.61298 |
c1e9c6b21ef127fa4ba40d61e60cf11033d89b64 | 19,550 | js | JavaScript | easy-comment/jquery.easy-comment.js | marianalfr/monica-y-boris | 8c5e44121429b107a79436f009f8ad29f177ec16 | [
"Unlicense"
] | null | null | null | easy-comment/jquery.easy-comment.js | marianalfr/monica-y-boris | 8c5e44121429b107a79436f009f8ad29f177ec16 | [
"Unlicense"
] | null | null | null | easy-comment/jquery.easy-comment.js | marianalfr/monica-y-boris | 8c5e44121429b107a79436f009f8ad29f177ec16 | [
"Unlicense"
] | null | null | null | /*
Copyright (c) 2011, Yubo Dong @ www.jswidget.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the jswidget.com nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL JSWIDGET.COM BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function EasyComment(){
this.commentUL = null;
}
EasyComment.prototype.init = function(container,path,moderate,nHeight,bHasSubject, bEmail, bSite, nMaxReply,countPerPage){
this.moderate = moderate ? 1 : 0;
this.maxReply = nMaxReply;
this.currentPage = 0;
this.countPerPage = countPerPage; // 0: no paging
this.path = path;
if ( container ){
this.container = container;
}else{
$("body").append(this.container = $("<div id='ec-page'></div>")[0]); ///// #ec-page
}
if ( nHeight !== null ){
if ( nHeight === "" || isNaN(nHeight) ){
$(this.container).css("height","auto");
}else{
$(this.container).css("height",nHeight + "px");
}
}
this.hasSubject = (bHasSubject === true)?true:false;
this.hasEmail = (bEmail === true)?true:false;
this.hasSite = (bSite === true)?true:false;
$(this.container).addClass("ec-comment-pane") ///// .ec-comment-pane
.append(
this.totalComment = $("<div class='ec-total'></div>").html("Sé la primera persona en dejar una nota")[0] ///// .ec-total
);
if ( this.countPerPage > 0 ){
$(this.container).append(this.paging = $("<div class='ec-paging'></div>")[0]); ///// .ec-paging
}
this.addCmtForm();
this.addReplyForm();
var w = $(this.commentForm).width();
if ( w > 300 ){///////////////////////////////////////////AQUIIIIIII///////////////<-------------------------
$(this.commentForm).width(300);
$(this.replyForm).width(300);
}
this.loadComment(0);
$(this.container).append(
this.commentUL = $("<ul></ul>").addClass("ec-comment-list")[0] ///// .ec-comment-list
);
var _this = this;
$(this.container).find("button[name=reply]").live("click",function(){
var id = $(this).attr("id").split("_")[1];
$(_this.replyFormContainer).find("button[name=submit_reply]")
.data("reply_id",id);
var pos = $(this).offset(),h = $(this).outerHeight();
var left = pos.left, top = pos.top + h;
_this.showReplyForm(left,top);
});
};
EasyComment.prototype._getFormFields = function(){ /////////////////////////////////////campos del formulario
return '<fieldset>'+
'<legend>Tu nombre:<span title="Required field" style="color:#63655D;">*</span></legend>'+
'<input type="text" style="width:100%" value="" name="name">'+
'</fieldset>'+
(( this.hasSubject )?(
'<fieldset>'+
'<legend><span style="color:red;margin-right:5px;"></span>Subject:</legend>'+
'<input type="text" style="width:100%" value="" name="subject">'+
'</fieldset>'):"")+
(( this.hasEmail )?(
'<fieldset>'+
'<legend><span style="color:red;margin-right:5px;"></span>Email:</legend>'+
'<input type="email" style="width:100%" value="" name="email">'+
'</fieldset>'):"")+
(( this.hasSite )?(
'<fieldset>'+
'<legend><span style="color:red;margin-right:5px;"></span>Web Site:</legend>'+
'<input type="url" style="width:100%" value="" name="site">'+
'</fieldset>'):"")+
'<fieldset>'+
'<legend>Tu mensaje:<span title="Required field" style="color:#63655D;margin-right:5px;">*</span></legend>'+
'<div style="vertical-align:top;">'+
'<textarea style="width:100%;height:180px;" name="message" type="text"></textarea>'+
'</div>'+
'</fieldset>';
};
EasyComment.prototype.addCmtForm = function(){
var _this = this;
var arrForm = [
'<div class="ec-comment-form">',
'<form method="post" name="ec-comment-form">',
'<fieldset>',
//'<legend class="title">Deja aquí tu mensaje</legend>',
this._getFormFields(),
'<div style="text-align:right;position:relative;">',
'<button name="submit">Enviar</button> ',
'</div>',
'</fieldset>',
'</form>',
'</div>'
];
$(this.container).append(arrForm.join(""));
this.commentForm = $(this.container).find(".ec-comment-form form[name=ec-comment-form]")[0];
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// $(this.commentForm).find("button[name=submit]").click(function(){
// _this.submitMessage(_this.commentForm,false,"");
// return false;
// });
// return this;
//};
///////////////////////////////////////////////////////////////////////////////////////////////////////////
$(this.commentForm).find("button[name=submit]").click(function confirmSubmit(){
if (confirm("Una vez que tu mensaje haya sido enviado no lo podrás borrar. ¿Estás seguro de que quieres enviarlo?")) {
_this.submitMessage(_this.commentForm,false,"");
}
return false;
});
return this;
};
EasyComment.prototype.addReplyForm = function(){
var arrForm = [
'<div class="ec-comment-form ec-comment-reply-form" style="display:none;">',
'<div class="close_button"></div>',
'<form method="post" name="ec-comment-reply-form">',
'<fieldset>',
this._getFormFields(),
'<div style="text-align:right;position:relative;">',
'<button name="submit_reply">Reply</button> ',
'<button class="close_button">Close</button> ',
'</div>',
'</fieldset>',
'</form>',
'</div>'
];
$("body").append(this.replyFormContainer = $(arrForm.join(""))[0]);
this.replyForm = $(this.replyFormContainer).find("form[name=ec-comment-reply-form]")[0];
var _this = this;
$(this.replyFormContainer).find(".close_button").click(function(){
_this.hideReplyForm();
return false;
});
$(this.replyFormContainer).find("button[name=submit_reply]").click(function(){
var id = $(this).data("reply_id");
_this.submitMessage(_this.replyForm,true,id);
return false;
});
return this;
};
EasyComment.prototype._renderComment = function(arrLI,parent_id){
var i;
/*if ( !this.commentUL ){
$(this.paging).after(
this.commentUL = $("<ul></ul>").addClass("ec-comment-list")[0]
);
for ( i = 0; i < arrLI.length; i ++ ){
$(this.commentUL).append(arrLI[i]);
}
}else{*/
var _this = this;
for ( i = 0; i < arrLI.length; i ++ ){
if ( parent_id === "" ){
$(this.commentUL).prepend(
arrLI[i]
);
}else{
//look for nested ul
var ul = $(this.commentUL).find("#" + parent_id + " ul")[0];
if ( !ul ){
$(this.commentUL).find("#" + parent_id).append(ul = $("<ul></ul>").addClass("ec-comment-list")[0]); ///// .ec-comment-list
}
$(ul).prepend(arrLI[i]);
}
}
//}
};
EasyComment.prototype._registerReply = function(btn){
var _this = this;
$(btn).live("click",function(){
var id = $(this).attr("id").split("_")[1];
$(_this.replyFormContainer).find("button[name=submit_reply]")
.data("reply_id",id);
var pos = $(this).offset(),h = $(this).outerHeight();
var left = pos.left, top = pos.top + h;
_this.showReplyForm(left,top);
});
};
EasyComment.prototype.showReplyForm = function(left,top){
$(this.replyFormContainer)
.css({"left":left + "px",
"top":top + "px",
"opacity":0,
"display":""})
.animate({"opacity":1},300);
};
EasyComment.prototype.hideReplyForm = function(){
$(this.replyFormContainer)
.animate({"opacity":0},300,function(){$(this).css("display","none");});
};
EasyComment.prototype.submitMessage = function(form,bReply,parent_id){
var data = {
flag : "1",
domid : $(this.container).attr("id"),
title : document.title,
id : bReply ? parent_id : "",
moderate : this.moderate,
max : this.maxReply,
path : this.path,
url : this.getPageURL(),
name : $.trim($(form).find("input[name=name]").val()),
subject : (this.hasSubject)?$.trim($(form).find("input[name=subject]").val()):"",
email : (this.hasEmail)?$.trim($(form).find("input[name=email]").val()):"",
site : (this.hasSite)?$.trim($(form).find("input[name=site]").val()):"",
message : $.trim($(form).find("textarea[name=message]").val())
};
if ( data.name === "" ){
$(form).find("input[name=name]").focus();
return;
}
if ( data.message === "" ){
$(form).find("textarea[name=message]").focus();
return;
}
var _this = this;
$.ajax({
url:this.path + "ec-comment.php",
data:data,
dataType:"json",
type:"POST",
cache:false,
success:function(data){
if ( data ){
_this._renderComment([data.comment],parent_id);
var tc = $(_this.totalComment).data('total-comment');
if ( parent_id === "" ){
tc ++;
}else{
_this.hideReplyForm();
}
_this.showTotalComment(tc);
}
},
error:function(s){
}
});
};
EasyComment.prototype.getPageURL = function(){
var sURL = location.href;
//
// to avoid confusion
//
sURL = sURL.replace(/www\./,"");
if ( sURL.indexOf("#") != -1 ){
var s = sURL.split("#");
sURL = s[0];
}
if ( sURL.indexOf("?") != -1 ){
var s = sURL.split("?");
sURL = s[0];
}
return sURL;
};
EasyComment.prototype.loadComment = function(pageNo){
var data = {
flag : "2",
max : this.maxReply,
domid : $(this.container).attr("id"),
url : this.getPageURL(),
pageno : (pageNo)?pageNo:0,
pagecount : this.countPerPage
};
this.currentPage = pageNo;
var _this = this;
$.ajax({
url:this.path + "ec-comment.php",
data:data,
dataType:"json",
type:"POST",
cache:false,
success:function(data){
if ( data ){
if ( data.total_comment > 0 ){
$(_this.commentUL).empty();
_this._renderComment(data.comments,"");
}
_this.showTotalComment(data.total_comment);
_this.showPaging(data.total_comment);
}
},
error:function(s){
}
});
};
EasyComment.prototype.showTotalComment = function(nTotal){
var sHTML = nTotal + " Comments ";
$(this.totalComment).html(sHTML)
.data("total-comment",nTotal);
};
EasyComment.prototype.showPaging = function(nTotal){
if ( this.countPerPage > 0 && nTotal > this.countPerPage ){
$(this.paging).empty();
var total_page = Math.ceil(nTotal / this.countPerPage);
var _this = this;
var nRest = nTotal - (this.currentPage+1) * this.countPerPage;
var sNext = "";
if ( nRest > this.countPerPage ){
sNext = "Next " + this.countPerPage + " comments";
}else{
if ( nRest < 0 ){nRest = this.countPerPage;}
sNext = "Next " + nRest + " comments";
}
//if ( this.currentPage != 0 ){
$(this.paging)
.append(
$("<button></button>").html("Previous " + this.countPerPage + " comments")
.data("page_no",this.currentPage)
.attr("disabled",(this.currentPage == 0))
.click(function(){
_this.loadComment($(this).data("page_no")-1);return false;
})
);
//}
//if ( this.currentPage < total_page - 1 ){
$(this.paging)
.append(
$("<button></button>").html(sNext)
.data("page_no",this.currentPage)
.attr("disabled",(this.currentPage == total_page - 1))
.click(function(){
_this.loadComment($(this).data("page_no")+1);return false;
})
);
//}
}
};
(function($){ ///////////////////////////////////////////////////////////OPTIONS
$.fn.EasyComment = function(options){
var settings = {
path : "/easy-comment/",
maxReply : 5,
moderate : false,
height : null,
hasSubject : false,
hasEmail : false,
hasSite : false,
countPerPage : 10
};
if ( options ) {
$.extend( settings, options );
}
addStyle(settings.path);
return this.each(function(){
var cp = new EasyComment()
.init(
this,
settings.path,
settings.moderate,
settings.height,
settings.hasSubject,
settings.hasEmail,
settings.hasSite,
settings.maxReply,
settings.countPerPage
);
});
function addStyle(path){
if ( $.fn.EasyComment.StyleReady ){
return;
}
$.fn.EasyComment.StyleReady = true;
var arrStyle = [
"<style type='text/css'>",
"@font-face{ font-family: Titulo; src: url('../c/Tit.otf'); font-style: normal; font-weight: normal !important;}",
"@font-face{ font-family: Regular; src: url('../c/Reg.otf'); font-style: normal; font-weight: normal !important;}",
"@font-face{ font-family: Cursiva; src: url('../c/It.otf'); font-style: normal; font-weight: normal !important;}",
"@font-face{ font-family: NegritaCursiva; src: url('BoIt.otf'); font-style: normal; font-weight: normal !important;}",
"a:link {color:#63655D; text-decoration: none;}",
"a:visited {color:#63655D; text-decoration: none;}",
"a:hover {color:#c5c7b9; text-decoration: none;}",
"a:active {color:#63655D; text-decoration: none}",
"body{ width: 100%; margin:0 auto; font-family: Regular, serif; font-size: 12px;}",
".ec-comment-pane{position:relative; padding-left:10px; margin:5px 0; overflow:auto}",
".ec-comment-pane div.ec-total{font:10px; font-family:Regular; height:24px; line-height:24px}",
".ec-comment-pane div.ec-paging{height:30px; line-height:30px;text-align:right;}",
".ec-comment-pane div.ec-paging>button{font:10px; font-family:Regular; height:30px; line-height:30px;margin-right:10px;}",
".ec-comment-pane ul.ec-comment-list{position:relative; width:300px; margin-bottom:0px; font-family:Cursiva,serif; font-size:12px; line-height:16px; list-style-type:none; padding-right:20px; background-color:#FFF; border:0px solid #14a1cc; border-radius:0px; overflow:auto; text-align: right;}",
".ec-comment-pane ul.ec-comment-list li.ec-comment{position:relative; min-height:48px; min-width:48px; padding:4px 4px 12px 56px; margin-bottom:8px; border-radius:0px; font-size:8pt font-family:Cursiva}",
".ec-comment-pane ul.ec-comment-list li.ec-comment:last-child{border:none; padding-bottom:0px}",
".ec-comment-pane ul.ec-comment-list li.ec-comment button{font:11px font-family:Regular}",
".ec-comment-pane ul.ec-comment-list li.ec-comment a, ",
".ec-comment-pane ul.ec-comment-list li.ec-comment .author{font-family:Regular; color:#63655D; text-decoration:none}",
".ec-comment-pane ul.ec-comment-list li.ec-comment a:hover{text-decoration:underline}",
".ec-comment-pane ul.ec-comment-list li.ec-comment div.avatar{position:absolute; top:0px; left:0px; width:48px; height:48px; border:none; margin-top:6px; margin-left:2px; border-radius04px; text-overflow:ellipsis; /*background:url(" + path + "ec-comment.png*/)}",
".ec-comment-pane ul.ec-comment-list li.ec-comment span.user-name{font-weight:bold; margin-right:0.5em; text-overflow:ellipsis}",
".ec-comment-pane ul.ec-comment-list li.ec-comment span.comment-time{display:none; font-size:11px; color:#999; line-height:16px; text-overflow:ellipsis}",
".ec-comment-form{font:1em; font-family:Regular;}",
".ec-comment-form form{margin:0; padding:0}",
".ec-comment-form form input, .ec-comment-form form textarea, .ec-comment-form form button{font:10px; font-family:Regular;}",
".ec-comment-form fieldset{ }",
".ec-comment-form fieldset legend{ padding:0px 5px; border-radius:0px; border:0px solid #ccc}",
".ec-comment-form .title{ font-size:10px; color:#63655D; line-height:30px}",
".ec-comment-form fieldset{ border-radius:0px}",
".ec-comment-form fieldset fieldset{ border:none; background:none; filter:none}",
".ec-comment-form fieldset fieldset legend{ background:none; border:none; filter:none}",
".ec-comment-reply-form{position:absolute; left:0px; top:0px; height:400px;}",
".ec-comment-reply-form div.close_button{ position:absolute; right:-18px; top:-18px; width:36px; height:36px; background:url(" + path + "ec-close_box.png) no-repeat; cursor:pointer}",
"</style>"
];
$(arrStyle.join("")).appendTo("head");
}
};
})(jQuery);
| 40.814196 | 308 | 0.543785 |
c1ea2b393c1da8de81c4d7acdd03bc4696c6bb9a | 2,818 | js | JavaScript | src/index.js | lucamamprin/vue-dynamic-form-schema | 40429dfa2b794115eef11255d021e5ff59de6267 | [
"MIT"
] | null | null | null | src/index.js | lucamamprin/vue-dynamic-form-schema | 40429dfa2b794115eef11255d021e5ff59de6267 | [
"MIT"
] | 156 | 2021-01-10T14:50:24.000Z | 2022-03-28T04:10:12.000Z | src/index.js | lucamamprin/vue-dynamic-form-schema | 40429dfa2b794115eef11255d021e5ff59de6267 | [
"MIT"
] | 1 | 2021-04-11T23:13:31.000Z | 2021-04-11T23:13:31.000Z | import DynamicForm from "./components/DynamicForm"
import InputCheckbox from "./components/FormElements/InputCheckbox"
import InputGeneric from "./components/FormElements/InputGeneric"
import InputRadioGroup from "./components/FormElements/InputRadioGroup"
import InputSelect from "./components/FormElements/InputSelect"
import InputTextarea from "./components/FormElements/InputTextarea"
export default {
install (Vue) {
Vue.component("DynamicForm", DynamicForm)
Vue.component("InputCheckbox", InputCheckbox)
Vue.component("InputGeneric", InputGeneric)
Vue.component("InputRadioGroup", InputRadioGroup)
Vue.component("InputSelect", InputSelect)
Vue.component("InputTextarea", InputTextarea)
Vue.mixin({
methods: {
errorMessageManual (reference, key, errorMessages) {
const input = reference[key]
const params = Object.keys(input.$params)
const messageKeys = params.map(x => {
return {
[x]: input[x],
}
})
const activeMessage = messageKeys.filter(m => {
const key = Object.keys(m)[0]
return !m[key]
})
// no errors apply
if (!activeMessage.length) return ""
const activeKey = Object.keys(activeMessage[0])[0]
return errorMessages[key][activeKey]
},
goToFirstError (errorMessages = {}, nameSpace) {
const errors = Object.keys(errorMessages)
const firstError = errors[0]
if (firstError) {
const element = document.getElementById(`${nameSpace}-${firstError}`)
const role = element.getAttribute("role")
// if it is a radio group
if (role === "radiogroup") {
//TODO: test if it is actually always the first element and not just a ruse
const focusOn = element.getElementsByTagName("input")[0] // get first radio input
focusOn.focus()
return
}
document.getElementById(`${nameSpace}-${firstError}`).focus()
}
},
// gets status and error messages, reverses the array and finds the first input within the form to focus on.
focusOnFirstForm (statusObj, errorMessages) {
// reverse the object to prevent scrolling to the last DynamicForm instance
const reverseObj = obj => Object.assign([
], obj).reverse()
for (const status in reverseObj(statusObj)) {
if (statusObj[status].invalid) {
this.goToFirstError(errorMessages[status], status)
return
}
}
},
getInvalidForm (statuses) {
return !!Object.values(statuses).find(status => status.invalid)
},
},
})
},
}
| 35.225 | 116 | 0.607878 |
c1ea311c8be687613452e82dc247e772dae47cf9 | 234 | js | JavaScript | Exercises/Syntax-Functions-and-Statements/02-greatestCommonDivisor.js | kStoykow/JS-Advanced | 98eba4beea3a5a332a9f096f86923b0881351aea | [
"MIT"
] | null | null | null | Exercises/Syntax-Functions-and-Statements/02-greatestCommonDivisor.js | kStoykow/JS-Advanced | 98eba4beea3a5a332a9f096f86923b0881351aea | [
"MIT"
] | null | null | null | Exercises/Syntax-Functions-and-Statements/02-greatestCommonDivisor.js | kStoykow/JS-Advanced | 98eba4beea3a5a332a9f096f86923b0881351aea | [
"MIT"
] | null | null | null | function solve(x, y) {
let gcd = 0;
for (let i = Math.max(x, y); i > 0; i -= 1) {
if (x % i == 0 && y % i == 0) {
gcd = i;
break;
}
}
return gcd;
}
console.log(solve(2154, 458)); | 21.272727 | 49 | 0.384615 |
c1ea54ffd2e301242b0f8a5a39cab5bc9fa36f1d | 233 | js | JavaScript | ecmascript/minifier/tests/terser/compress/reduce_vars/redefine_arguments_3/input.js | vjpr/swc | 97514a754986eaf3a227cab95640327534aa183f | [
"Apache-2.0",
"MIT"
] | 21,008 | 2017-04-01T04:06:55.000Z | 2022-03-31T23:11:05.000Z | ecmascript/minifier/tests/terser/compress/reduce_vars/redefine_arguments_3/input.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 2,309 | 2018-01-14T05:54:44.000Z | 2022-03-31T15:48:40.000Z | ecmascript/minifier/tests/terser/compress/reduce_vars/redefine_arguments_3/input.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 768 | 2018-01-14T05:15:43.000Z | 2022-03-30T11:29:42.000Z | function f() {
var arguments;
return typeof arguments;
}
function g() {
var arguments = 42;
return typeof arguments;
}
function h(x) {
var arguments = x;
return typeof arguments;
}
console.log(f(), g(), h());
| 16.642857 | 28 | 0.613734 |
c1ea8ee82dc7378de24c775fcff398e3f56daf85 | 392 | js | JavaScript | gun.js | anhoppe/Tanx | 52b8fb31992abbcdfb4002073b0fe481f40b7fa5 | [
"Apache-2.0"
] | null | null | null | gun.js | anhoppe/Tanx | 52b8fb31992abbcdfb4002073b0fe481f40b7fa5 | [
"Apache-2.0"
] | 1 | 2022-01-19T15:54:38.000Z | 2022-01-19T15:54:38.000Z | gun.js | anhoppe/Tanx | 52b8fb31992abbcdfb4002073b0fe481f40b7fa5 | [
"Apache-2.0"
] | null | null | null | class Gun extends Weapon
{
constructor(template)
{
super("gun", template)
}
emitShot(physics, xFrom, yFrom, xTo, yTo)
{
var sprite = physics.add.sprite(xFrom, yFrom, 'round')
physics.moveTo(sprite, xTo, yTo, this.stats["roundSpeed"].value)
var startPos = new Phaser.Math.Vector2(xFrom, yFrom)
return [[startPos, sprite]]
}
}
| 21.777778 | 72 | 0.604592 |
c1ebe3b1803f3de12cafae6c5e5e6a765baf0c7d | 5,227 | js | JavaScript | public/de2d8f53-2e4c-4857-9ed2-98d6b6277260/projectzip/project/dgt/biz/phone_list.js | sandofsuro/react-web-dgt | 1914317f2b8a0310746f67c87d09192134debba4 | [
"BSD-3-Clause"
] | null | null | null | public/de2d8f53-2e4c-4857-9ed2-98d6b6277260/projectzip/project/dgt/biz/phone_list.js | sandofsuro/react-web-dgt | 1914317f2b8a0310746f67c87d09192134debba4 | [
"BSD-3-Clause"
] | null | null | null | public/de2d8f53-2e4c-4857-9ed2-98d6b6277260/projectzip/project/dgt/biz/phone_list.js | sandofsuro/react-web-dgt | 1914317f2b8a0310746f67c87d09192134debba4 | [
"BSD-3-Clause"
] | null | null | null | /**
* 东管头村APP
* @author nectar
* Mon Jan 09 10:34:10 CST 2017
*/
'use strict';
import React, { Component, PropTypes } from 'react';
import { View, Text, TouchableHighlight, TouchableOpacity, StyleSheet, TextInput, Dimensions, Image, Alert, Platform, Navigator, ListView, RefreshControl } from 'react-native';
import AKCommunications from '../components/AKCommunications.js';
export default class PhoneList extends Component {
constructor(props) {
super(props);
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
refreshing: false,
dataSource: ds.cloneWithRows([]),
};
}
componentWillMount() {
client.getContacts(function(result) {
if(result.success == true) {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(result.data),
});
} else {
console.log(result.err);
}
}.bind(this));
}
_onRefresh() {
this.setState({refreshing: true});
client.getContacts(function(result) {
if(result.success == true) {
this.setState({
refreshing: false,
dataSource: this.state.dataSource.cloneWithRows(result.data),
});
} else {
console.log(result.err);
}
}.bind(this));
}
dial(data) {
AKCommunications.phonecall(data, true);
}
renderRow(rowData) {
return (
<TouchableHighlight underlayColor={'#ccc'} onPress={() => {this.dial(rowData.number);}}>
<View style={styles.row}>
<Text style={styles.rowText} numberOfLines={1}>{rowData.name}</Text>
<Image source={{uri: GLOBAL.WebRoot + 'web/img/home/phone@2x.png'}} style={styles.iconImage} />
</View>
</TouchableHighlight>
);
}
renderScene(route, navigator) {
return (
<View style={styles.container}>
<ListView
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)}
contentContainerStyle={styles.list}
enableEmptySections = {true}
/>
</View>
);
}
renderNavTitle(route, navigator) {
return (
<Text style={styles.navBarTitleText}>
电话黄页
</Text>
);
}
renderNavLeftButton(route, navigator) {
var title = "返回";
return (
<TouchableOpacity
onPress={() => this.props.navigator.pop()}
style={styles.navBarLeftButton}>
<Image source={{uri: GLOBAL.WebRoot + 'web/img/register/Arrow@2x.png'}} style={styles.backImage} />
<Text style={styles.navBarButtonText}>
{title}
</Text>
</TouchableOpacity>
);
}
renderNavRightButton(route, navigator) {
var title = "";
return (
<TouchableOpacity
style={styles.navBarRightButton}>
<Text style={styles.navBarButtonText}>
{title}
</Text>
</TouchableOpacity>
);
}
render() {
var bar = (
<Navigator.NavigationBar
routeMapper={{
LeftButton:this.renderNavLeftButton.bind(this),
RightButton:this.renderNavRightButton.bind(this),
Title:this.renderNavTitle.bind(this),
}}
style={styles.navBar}
/>
);
return (
<Navigator style={styles.navigator}
navigationBar={bar}
renderScene={this.renderScene.bind(this)}
initialRoute={{title:'电话黄页'}}
/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop:Platform.OS == 'ios' ? 74 : 68,
backgroundColor: '#f5f5f5',
justifyContent: 'flex-start',
alignItems: 'center',
},
navigator: {
flex:1,
justifyContent: 'center',
alignItems: 'stretch',
},
navBar: {
backgroundColor: '#ff5558',
justifyContent: 'center',
},
navBarTitleText: {
fontSize:20,
fontWeight: '400',
marginVertical: 12,
width: 3 * (Dimensions.get('window').width) / 5,
textAlign: 'center',
color: '#ffffff',
},
navBarButtonText: {
fontSize:15,
color: '#ffffff',
},
navBarLeftButton: {
flex: 1,
flexDirection: 'row',
paddingLeft: 10,
alignItems: 'center',
},
navBarRightButton: {
paddingRight: 10,
justifyContent: 'center',
},
backImage: {
width: 23 / 2,
height: 41 / 2,
marginRight: 5,
},
list: {
},
row: {
height: 50,
width: Dimensions.get('window').width,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: 'white',
borderBottomWidth: 1,
borderBottomColor: '#e3e3e3',
paddingLeft: 15,
paddingRight: 15,
},
rowText: {
color: '#333',
fontSize: 36 / 2,
},
iconImage: {
width: 28,
height: 28,
}
}); | 25.373786 | 176 | 0.55022 |
c1ec67a3a26702827782ef5049fed7e87eda3714 | 7,965 | js | JavaScript | assets/js/dnp/honto/BrowserPush.js | nw-web-d/d_book_clone | c4067519455facaf0879703dbb82287335829845 | [
"MIT"
] | null | null | null | assets/js/dnp/honto/BrowserPush.js | nw-web-d/d_book_clone | c4067519455facaf0879703dbb82287335829845 | [
"MIT"
] | 11 | 2020-04-12T01:34:16.000Z | 2020-05-11T08:17:25.000Z | assets/js/dnp/honto/BrowserPush.js | nw-web-d/d_book_clone | c4067519455facaf0879703dbb82287335829845 | [
"MIT"
] | null | null | null | /**
* @fileOverview ブラウザPUSH共通スクリプト.
* @name BrowserPush.js
*/
jQuery.noConflict()
/**
* Load時に以下の処理を行う。
*
* ・ブラウザが通知に対応しているか
* ・対応している場合、既に許可 or ブロックしているか。している場合、通知許諾は出さない
* ・特定のcookieが設定されている場合、許諾スキップを実行したとみなし、通知許諾は一定期間出さない
* ・通知許諾を出すと判断された場合、許可フラグを立て、ほしい本ページに訴求ボタンを表示する
*/
window.addEventListener('load', function() {
// 訴求ボタン表示
notificationPermission.displayTooltip()
})
var notificationPermission = {
/**
* 訴求ボタン表示.
*
* ・前提条件をチェックし、訴求ボタンを表示する
* @param pageBlockId プラグインブロックID
*/
displayTooltip(pageBlockId) {
// 前提条件チェック
if (!this.checkPrecondition()) {
return
}
let tooltipWapper = '#dy_stTooltip02-wrapper'
if (pageBlockId) {
tooltipWapper = tooltipWapper + '_' + pageBlockId
}
// 訴求ボタン表示
jQuery(tooltipWapper).removeClass('stHide')
},
/**
* 前提条件チェック.
*
* ・WebPush対応ブラウザであること
* ・通知許可 or ブロック状態でないこと
* ・スキップ設定していないこと(対象cookieなし)
*
* @return true:前提条件クリア、false:前提条件NG
*/
checkPrecondition() {
if (!'Notification' in window) {
// 通知未対応ブラウザ
console.log('This browser does not support notifications.')
return false
}
// 通知許可状態
try {
const permission = Notification.permission
if (permission === 'denied' || permission === 'granted') {
// 既に許可 or ブロックしているので処理を抜ける
return false
}
} catch (e) {
// Notificationオブジェクトが利用不可ブラウザの場合は処理を抜ける
return false
}
if (document.cookie.includes('notification_permission_skip')) {
// cookieに書き込みあり(スキップボタン押下)
return false
}
return true
},
/**
* cookie有効期限(expires)(30日).
*
* @return cookieのexpiresに設定する値
*/
getExpires() {
const expires = new Date()
expires.setMonth(expires.getMonth() + 1)
return expires
},
/**
* cookie有効期限(max-age)(30日).
*
* @return cookieのmax-ageに設定する値
*/
getMaxAge() {
return 60 * 60 * 24 * 30 // 単位は秒
},
/**
* 通知許諾を一定期間行わないようにcookieにフラグを立てる.
*/
skipPermission() {
// cookie設定
document.cookie =
'notification_permission_skip=1; path=/; expires=' +
this.getExpires() +
'; max-age=' +
this.getMaxAge()
// フローティングバナーを閉じる
this.closeFloatingBanner()
},
/**
* フローティングバナー(回遊時許諾)を閉じる.
*
*/
closeFloatingBanner() {
jQuery('#dy_MigrationFloatingBanner').addClass('stHide')
},
/**
* 許諾前のワンクッションバナーを表示.
*
* サイト回遊時の通知許諾ダイアログ表示前のフローティングバナー表示
*
*/
showBanner() {
// 既に通知許可/通知ブロック or スキップしている場合は離脱
if (!this.checkPrecondition()) return
// フローティングバナー表示
jQuery('#dy_MigrationFloatingBanner').removeClass('stHide')
},
/**
* 許諾前のワンクッションダイアログを閉じる.
*
* ダイアログを閉じ、かつ許諾訴求ボタンも非表示にする
*
*/
closePopup() {
// 許諾訴求ボタンを非表示
jQuery('[id ^= dy_stTooltip02-wrapper').each(function(index, element) {
jQuery(element).addClass('stHide')
})
// ワンクッションダイアログを閉じる
jQuery('#dy_consentAppeal_button').click() // SP
jQuery('#fancybox-close').click() // PC
},
/**
* ツールチップを閉じる.
*
* 区切り線も消す
*
*/
closeTooltip() {
// 許諾訴求ボタンを非表示
jQuery('#dy_stTooltip02-wrapper').addClass('stHide')
// 区切り線を非表示(ほしい本)
jQuery('#dy_stSingleLink01').addClass('stBorderBottomNone')
}
}
var browserPushAjax = {
/**
* 二重サブミット制御フラグ.
* true:サブミット中、false:サブミットなし
*/
isSubmitted: false,
/**
* FCM Messageオブジェクト格納用.
*/
msg: '',
/**
* PUSH通知許可処理.
*/
pushPermission() {
if (browserPushAjax.isSubmitted) {
return
}
const pageBlockId = jQuery('#dy_footerPageBlockId').attr('value')
if (!this.msg) {
firebase.initializeApp(browserPushConfig.config)
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js')
} else {
console.info('serviceWorker NG')
return
}
this.msg = firebase.messaging()
this.msg.onMessage(function(payload) {
console.log('Message received. ', payload)
})
}
// 多重実行を防止
browserPushAjax.isSubmitted = true
// 許諾ポップアップ後、メンバ変数クリアされたのでローカル変数に退避
const msglocal = this.msg
msglocal
.requestPermission()
.then(function() {
// 通知許諾ダイアログで許可が押された場合
msglocal
.getToken()
.then(function(curToken) {
console.log('token:' + curToken)
if (pageBlockId == null) {
console.error('Cannot get pageBlockId at pushPermission.')
browserPushAjax.isSubmitted = false
return // 取得出来ない場合はスキップ
}
localStorage.setItem('honto.fcm.token', curToken)
// リクエストパラメータ作成
const param = { fcmId: curToken }
// Ajax通信
HC.Ajax.json(pageBlockId, null, param, false, null, null)
browserPushAjax.isSubmitted = false
})
.catch(function(err) {
browserPushAjax.isSubmitted = false
console.error(err)
})
})
.catch(function(err) {
// ブロックまたは無視された場合
browserPushAjax.isSubmitted = false
console.log(err)
})
},
/**
* tokenクリア処理.
*
* @param alias エイリアス
*/
clearToken(alias) {
if (browserPushAjax.isSubmitted) {
return
}
const pageBlockId = jQuery('#dy_footerPageBlockId').attr('value')
if (pageBlockId == null) {
console.error('Can not get pageBlockId at clearToken.')
return // 取得出来ない場合はスキップ
}
if (!this.msg) {
firebase.initializeApp(browserPushConfig.config)
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js')
} else {
console.info('serviceWorker NG')
return
}
this.msg = firebase.messaging()
}
// 多重実行を防止
browserPushAjax.isSubmitted = true
const curToken = localStorage.getItem('honto.fcm.token')
if (curToken == null) {
browserPushAjax.isSubmitted = false
return
}
localStorage.removeItem('honto.fcm.token')
// ローカル変数に退避
const msglocal = this.msg
msglocal
.deleteToken(curToken)
.then(function() {
msglocal.getToken().then(function(newToken) {
if (newToken) {
localStorage.setItem('honto.fcm.token', newToken)
}
// リクエストパラメータ作成
const param = { fcmId: curToken, alias, fcmIdToTopic: newToken }
// Ajax通信
HC.Ajax.json(pageBlockId, null, param, false, null, null)
browserPushAjax.isSubmitted = false
})
})
.catch(function(err) {
// 許諾取ってない場合
browserPushAjax.isSubmitted = false
})
},
/**
* トークン取得処理.
*
* ローカルストレージに保持しているトークンを引数として投げる(Ajax)
* 渡したトークンを元にtopic購読解除を行う
*
* @param alias エイリアス
*/
getTokenFromStorage(alias) {
const curToken = localStorage.getItem('honto.fcm.token')
const pageBlockId = jQuery('#dy_footerPageBlockId').attr('value')
if (pageBlockId == null) {
return
}
if (!this.msg) {
firebase.initializeApp(browserPushConfig.config)
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js')
} else {
console.info('serviceWorker NG')
return
}
this.msg = firebase.messaging()
}
// ローカル変数に退避
const msglocal = this.msg
msglocal
.deleteToken(curToken)
.then(function() {
msglocal.getToken().then(function(newToken) {
if (newToken) {
localStorage.setItem('honto.fcm.token', newToken)
} else {
newToken = ''
}
// リクエストパラメータ作成
const param = {
fcmIdFromStorage: curToken,
alias,
fcmIdToUser: newToken
}
// Ajax通信
HC.Ajax.json(pageBlockId, null, param, false, null, null)
})
})
.catch(function(err) {
// 許諾取ってない場合
})
}
}
| 21.41129 | 75 | 0.589579 |
c1ed53569dacf4f3ca0f7ad06f016ee52f22cf9a | 5,875 | js | JavaScript | packages/taro/src/hooks.js | yy1300326388/taro | 489001e8bff83e5425f526f733ad70d0008d496c | [
"MIT"
] | 1 | 2021-04-02T02:38:55.000Z | 2021-04-02T02:38:55.000Z | packages/taro/src/hooks.js | yy1300326388/taro | 489001e8bff83e5425f526f733ad70d0008d496c | [
"MIT"
] | null | null | null | packages/taro/src/hooks.js | yy1300326388/taro | 489001e8bff83e5425f526f733ad70d0008d496c | [
"MIT"
] | null | null | null | import { isFunction, isUndefined, isArray, isNullOrUndef, defer, objectIs } from './util'
import { Current } from './current'
export function forceUpdateCallback () {
//
}
function getHooks (index) {
if (Current.current === null) {
throw new Error(`invalid hooks call: hooks can only be called in a stateless component.`)
}
const hooks = Current.current.hooks
if (index >= hooks.length) {
hooks.push({})
}
return hooks[index]
}
export function useState (initialState) {
if (isFunction(initialState)) {
initialState = initialState()
}
const hook = getHooks(Current.index++)
if (!hook.state) {
hook.component = Current.current
hook.state = [
initialState,
(action) => {
hook.state[0] = isFunction(action) ? action(hook.state[0]) : action
hook.component._disable = false
hook.component.setState({}, forceUpdateCallback)
}
]
}
return hook.state
}
function usePageLifecycle (callback, lifecycle) {
const hook = getHooks(Current.index++)
hook.component = Current.current
if (!hook.marked) {
hook.marked = true
const originalLifecycle = hook.component[lifecycle]
hook.component[lifecycle] = function () {
originalLifecycle && originalLifecycle(...arguments)
callback.call(hook.component, ...arguments)
}
}
}
export function useDidShow (callback) {
usePageLifecycle(callback, 'componentDidShow')
}
export function useDidHide (callback) {
usePageLifecycle(callback, 'componentDidHide')
}
export function usePullDownRefresh (callback) {
usePageLifecycle(callback, 'onPullDownRefresh')
}
export function useReachBottom (callback) {
usePageLifecycle(callback, 'onReachBottom')
}
export function usePageScroll (callback) {
usePageLifecycle(callback, 'onPageScroll')
}
export function useResize (callback) {
usePageLifecycle(callback, 'onResize')
}
export function useShareAppMessage (callback) {
usePageLifecycle(callback, 'onShareAppMessage')
}
export function useTabItemTap (callback) {
usePageLifecycle(callback, 'onTabItemTap')
}
export function useRouter () {
const hook = getHooks(Current.index++)
if (!hook.router) {
hook.component = Current.current
hook.router = hook.component.$router
}
return hook.router
}
export function useReducer (
reducer,
initialState,
initializer
) {
if (isFunction(initialState)) {
initialState = initialState()
}
const hook = getHooks(Current.index++)
if (!hook.state) {
hook.component = Current.current
hook.state = [
isUndefined(initializer) ? initialState : initializer(initialState),
(action) => {
hook.state[0] = reducer(hook.state[0], action)
hook.component._disable = false
hook.component.setState({}, forceUpdateCallback)
}
]
}
return hook.state
}
function areDepsChanged (prevDeps, deps) {
if (isNullOrUndef(prevDeps) || isNullOrUndef(deps)) {
return true
}
return deps.some((d, i) => !objectIs(d, prevDeps[i]))
}
export function invokeEffects (component, delay) {
const effects = delay ? component.effects : component.layoutEffects
effects.forEach((hook) => {
if (isFunction(hook.cleanup)) {
hook.cleanup()
}
const result = hook.effect()
if (isFunction(result)) {
hook.cleanup = result
}
})
if (delay) {
component.effects = []
} else {
component.layoutEffects = []
}
}
let scheduleEffectComponents = []
function invokeScheduleEffects (component) {
if (!component._afterScheduleEffect) {
component._afterScheduleEffect = true
scheduleEffectComponents.push(component)
if (scheduleEffectComponents.length === 1) {
defer(() => {
setTimeout(() => {
scheduleEffectComponents.forEach((c) => {
c._afterScheduleEffect = false
invokeEffects(c, true)
})
scheduleEffectComponents = []
}, 0)
})
}
}
}
function useEffectImpl (effect, deps, delay) {
const hook = getHooks(Current.index++)
if (Current.current._disableEffect || !Current.current.__isReady) {
return
}
if (areDepsChanged(hook.deps, deps)) {
hook.effect = effect
hook.deps = deps
if (delay) {
Current.current.effects = Current.current.effects.concat(hook)
invokeScheduleEffects(Current.current)
} else {
Current.current.layoutEffects = Current.current.layoutEffects.concat(hook)
}
}
}
export function useEffect (effect, deps) {
useEffectImpl(effect, deps, true)
}
export function useLayoutEffect (effect, deps) {
useEffectImpl(effect, deps)
}
export function useRef (initialValue) {
const hook = getHooks(Current.index++)
if (!hook.ref) {
hook.ref = {
current: initialValue
}
}
return hook.ref
}
export function useMemo (factory, deps) {
const hook = getHooks(Current.index++)
if (areDepsChanged(hook.deps, deps)) {
hook.deps = deps
hook.callback = factory
hook.value = factory()
}
return hook.value
}
export function useCallback (callback, deps) {
return useMemo(() => callback, deps)
}
export function useImperativeHandle (ref, init, deps) {
useLayoutEffect(() => {
if (isFunction(ref)) {
ref(init())
return () => ref(null)
} else if (!isUndefined(ref)) {
ref.current = init()
return () => {
delete ref.current
}
}
}, isArray(deps) ? deps.concat([ref]) : undefined)
}
export function useContext ({ context }) {
const emiter = context.emiter
if (emiter === null) {
return context._defaultValue
}
const hook = getHooks(Current.index++)
if (isUndefined(hook.context)) {
hook.context = true
hook.component = Current.current
emiter.on(_ => {
if (hook.component) {
hook.component._disable = false
hook.component.setState({})
}
})
}
return emiter.value
}
| 24.176955 | 93 | 0.662638 |
c1ed7f9e6fe73507fa1779e48aae24ffe4c80ede | 179 | js | JavaScript | source/is-object.js | koiketakayuki/ameba-util | fa3d787e17933f2673f4e690396a857e2bc77178 | [
"MIT"
] | null | null | null | source/is-object.js | koiketakayuki/ameba-util | fa3d787e17933f2673f4e690396a857e2bc77178 | [
"MIT"
] | null | null | null | source/is-object.js | koiketakayuki/ameba-util | fa3d787e17933f2673f4e690396a857e2bc77178 | [
"MIT"
] | null | null | null | const isFunction = require('./is-function');
function isObject(item) {
return item === Object(item) && !Array.isArray(item) && !isFunction(item);
}
module.exports = isObject;
| 22.375 | 76 | 0.687151 |
c1ee12c0d2aa953f5d28472309ddc8111c0d1193 | 1,246 | js | JavaScript | demos/basic/app.js | csantero/osmd-audio-player | 0fab1a752c9572a7ceb0629211a3c3da495eca56 | [
"MIT"
] | null | null | null | demos/basic/app.js | csantero/osmd-audio-player | 0fab1a752c9572a7ceb0629211a3c3da495eca56 | [
"MIT"
] | null | null | null | demos/basic/app.js | csantero/osmd-audio-player | 0fab1a752c9572a7ceb0629211a3c3da495eca56 | [
"MIT"
] | null | null | null | import { OpenSheetMusicDisplay } from "opensheetmusicdisplay";
import AudioPlayer from "osmd-audio-player";
import axios from "axios";
(async () => {
const osmd = new OpenSheetMusicDisplay(document.getElementById("score"));
const audioPlayer = new AudioPlayer();
const scoreXml = await axios.get(
"https://opensheetmusicdisplay.github.io/demo/sheets/MuzioClementi_SonatinaOpus36No3_Part1.xml"
);
await osmd.load(scoreXml.data);
await osmd.render();
await audioPlayer.loadScore(osmd);
hideLoadingMessage();
registerButtonEvents(audioPlayer);
})();
function hideLoadingMessage() {
document.getElementById("loading").style.display = "none";
}
function registerButtonEvents(audioPlayer) {
document.getElementById("btn-play").addEventListener("click", () => {
if (audioPlayer.state === "STOPPED" || audioPlayer.state === "PAUSED") {
audioPlayer.play();
}
});
document.getElementById("btn-pause").addEventListener("click", () => {
if (audioPlayer.state === "PLAYING") {
audioPlayer.pause();
}
});
document.getElementById("btn-stop").addEventListener("click", () => {
if (audioPlayer.state === "PLAYING" || audioPlayer.state === "PAUSED") {
audioPlayer.stop();
}
});
}
| 29.666667 | 99 | 0.687801 |
c1ee1fd80c6eed0a9c127a3ac80d156b8a212b43 | 86,012 | js | JavaScript | app/assets/javascripts/publish_elf/sir-trevor.min.js | t-zubyak/publish_elf | c28c5eaeeda1ddc3355a7e041de490bfe1e833f5 | [
"MIT"
] | null | null | null | app/assets/javascripts/publish_elf/sir-trevor.min.js | t-zubyak/publish_elf | c28c5eaeeda1ddc3355a7e041de490bfe1e833f5 | [
"MIT"
] | null | null | null | app/assets/javascripts/publish_elf/sir-trevor.min.js | t-zubyak/publish_elf | c28c5eaeeda1ddc3355a7e041de490bfe1e833f5 | [
"MIT"
] | null | null | null | !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SirTrevor=t()}}(function(){var t;return function e(t,n,o){function i(r,a){if(!n[r]){if(!t[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(s)return s(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[r]={exports:{}};t[r][0].call(d.exports,function(e){var n=t[r][1][e];return i(n?n:e)},d,d.exports,e,t,n,o)}return n[r].exports}for(var s="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(t,e){e.exports=t("./src/")},{"./src/":95}],2:[function(){!function(){if(!Array.prototype.find){var t=function(t){var e=Object(this),n=e.length<0?0:e.length>>>0;if(0===n)return void 0;if("function"!=typeof t||"[object Function]"!==Object.prototype.toString.call(t))throw new TypeError("Array#find: predicate must be a function");for(var o,i=arguments[1],s=0;n>s;s++)if(o=e[s],t.call(i,o,s,e))return o;return void 0};if(Object.defineProperty)try{Object.defineProperty(Array.prototype,"find",{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){}Array.prototype.find||(Array.prototype.find=t)}}(this)},{}],3:[function(e,n,o){!function(e,i){"function"==typeof t&&t.amd?t("eventable",function(){return e.Eventable=i()}):"undefined"!=typeof o?n.exports=i():e.Eventable=i()}(this,function(){function t(t){var e,n=2;return function(){return--n>0?e=t.apply(this,arguments):t=null,e}}function e(t,e){i[t]=function(t,n,o){var i=this._listeners||(this._listeners={}),s=t._listenerId||(t._listenerId=(new Date).getTime());return i[s]=t,"object"==typeof n&&(o=this),t[e](n,o,this),this}}var n=[],o=n.slice,i={on:function(t,e,n){if(!r(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var o=this._events[t]||(this._events[t]=[]);return o.push({callback:e,context:n,ctx:n||this}),this},once:function(e,n,o){if(!r(this,"once",e,[n,o])||!n)return this;var i=this,s=t(function(){i.off(e,s),n.apply(this,arguments)});return s._callback=n,this.on(e,s,o)},off:function(t,e,n){var o,i,s,a,l,c,d,u;if(!this._events||!r(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events={},this;for(a=t?[t]:Object.keys(this._events),l=0,c=a.length;c>l;l++)if(t=a[l],s=this._events[t]){if(this._events[t]=o=[],e||n)for(d=0,u=s.length;u>d;d++)i=s[d],(e&&e!==i.callback&&e!==i.callback._callback||n&&n!==i.context)&&o.push(i);o.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!r(this,"trigger",t,e))return this;var n=this._events[t],i=this._events.all;return n&&a(n,e),i&&a(i,arguments),this},stopListening:function(t,e,n){var o=this._listeners;if(!o)return this;var i=!e&&!n;"object"==typeof e&&(n=this),t&&((o={})[t._listenerId]=t);for(var s in o)o[s].off(e,n,this),i&&delete this._listeners[s];return this}},s=/\s+/,r=function(t,e,n,o){if(!n)return!0;if("object"==typeof n){for(var i in n)t[e].apply(t,[i,n[i]].concat(o));return!1}if(s.test(n)){for(var r=n.split(s),a=0,l=r.length;l>a;a++)t[e].apply(t,[r[a]].concat(o));return!1}return!0},a=function(t,e){var n,o=-1,i=t.length,s=e[0],r=e[1],a=e[2];switch(e.length){case 0:for(;++o<i;)(n=t[o]).callback.call(n.ctx);return;case 1:for(;++o<i;)(n=t[o]).callback.call(n.ctx,s);return;case 2:for(;++o<i;)(n=t[o]).callback.call(n.ctx,s,r);return;case 3:for(;++o<i;)(n=t[o]).callback.call(n.ctx,s,r,a);return;default:for(;++o<i;)(n=t[o]).callback.apply(n.ctx,e)}};return e("listenTo","on"),e("listenToOnce","once"),i.bind=i.on,i.unbind=i.off,i})},{}],4:[function(t,e){function n(t){var e=!0;if(!t)return e;var n=d.call(t),c=t.length;return n==r||n==l||n==s||n==a&&"number"==typeof c&&i(t.splice)?!c:(o(t,function(){return e=!1}),e)}var o=t("lodash.forown"),i=t("lodash.isfunction"),s="[object Arguments]",r="[object Array]",a="[object Object]",l="[object String]",c=Object.prototype,d=c.toString;e.exports=n},{"lodash.forown":5,"lodash.isfunction":28}],5:[function(t,e){var n=t("lodash._basecreatecallback"),o=t("lodash.keys"),i=t("lodash._objecttypes"),s=function(t,e,s){var r,a=t,l=a;if(!a)return l;if(!i[typeof a])return l;e=e&&"undefined"==typeof s?e:n(e,s,3);for(var c=-1,d=i[typeof a]&&o(a),u=d?d.length:0;++c<u;)if(r=d[c],e(a[r],r,t)===!1)return l;return l};e.exports=s},{"lodash._basecreatecallback":6,"lodash._objecttypes":24,"lodash.keys":25}],6:[function(t,e){function n(t,e,n){if("function"!=typeof t)return i;if("undefined"==typeof e||!("prototype"in t))return t;var d=t.__bindData__;if("undefined"==typeof d&&(r.funcNames&&(d=!t.name),d=d||!r.funcDecomp,!d)){var u=c.call(t);r.funcNames||(d=!a.test(u)),d||(d=l.test(u),s(t,d))}if(d===!1||d!==!0&&1&d[1])return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,o){return t.call(e,n,o)};case 3:return function(n,o,i){return t.call(e,n,o,i)};case 4:return function(n,o,i,s){return t.call(e,n,o,i,s)}}return o(t,e)}var o=t("lodash.bind"),i=t("lodash.identity"),s=t("lodash._setbinddata"),r=t("lodash.support"),a=/^\s*function[ \n\r\t]+\w/,l=/\bthis\b/,c=Function.prototype.toString;e.exports=n},{"lodash._setbinddata":7,"lodash.bind":10,"lodash.identity":21,"lodash.support":22}],7:[function(t,e){var n=t("lodash._isnative"),o=t("lodash.noop"),i={configurable:!1,enumerable:!1,value:null,writable:!1},s=function(){try{var t={},e=n(e=Object.defineProperty)&&e,o=e(t,t,t)&&e}catch(i){}return o}(),r=s?function(t,e){i.value=e,s(t,"__bindData__",i)}:o;e.exports=r},{"lodash._isnative":8,"lodash.noop":9}],8:[function(t,e){function n(t){return"function"==typeof t&&s.test(t)}var o=Object.prototype,i=o.toString,s=RegExp("^"+String(i).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");e.exports=n},{}],9:[function(t,e){function n(){}e.exports=n},{}],10:[function(t,e){function n(t,e){return arguments.length>2?o(t,17,i(arguments,2),null,e):o(t,1,null,null,e)}var o=t("lodash._createwrapper"),i=t("lodash._slice");e.exports=n},{"lodash._createwrapper":11,"lodash._slice":20}],11:[function(t,e){function n(t,e,a,d,u,h){var f=1&e,p=2&e,b=4&e,m=16&e,g=32&e;if(!p&&!s(t))throw new TypeError;m&&!a.length&&(e&=-17,m=a=!1),g&&!d.length&&(e&=-33,g=d=!1);var v=t&&t.__bindData__;if(v&&v!==!0)return v=r(v),v[2]&&(v[2]=r(v[2])),v[3]&&(v[3]=r(v[3])),!f||1&v[1]||(v[4]=u),!f&&1&v[1]&&(e|=8),!b||4&v[1]||(v[5]=h),m&&l.apply(v[2]||(v[2]=[]),a),g&&c.apply(v[3]||(v[3]=[]),d),v[1]|=e,n.apply(null,v);var k=1==e||17===e?o:i;return k([t,e,a,d,u,h])}var o=t("lodash._basebind"),i=t("lodash._basecreatewrapper"),s=t("lodash.isfunction"),r=t("lodash._slice"),a=[],l=a.push,c=a.unshift;e.exports=n},{"lodash._basebind":12,"lodash._basecreatewrapper":16,"lodash._slice":20,"lodash.isfunction":28}],12:[function(t,e){function n(t){function e(){if(a){var t=r(a);l.apply(t,arguments)}if(this instanceof e){var s=o(n.prototype),d=n.apply(s,t||arguments);return i(d)?d:s}return n.apply(c,t||arguments)}var n=t[0],a=t[2],c=t[4];return s(e,t),e}var o=t("lodash._basecreate"),i=t("lodash.isobject"),s=t("lodash._setbinddata"),r=t("lodash._slice"),a=[],l=a.push;e.exports=n},{"lodash._basecreate":13,"lodash._setbinddata":7,"lodash._slice":20,"lodash.isobject":29}],13:[function(t,e){(function(n){function o(t){return s(t)?r(t):{}}var i=t("lodash._isnative"),s=t("lodash.isobject"),r=(t("lodash.noop"),i(r=Object.create)&&r);r||(o=function(){function t(){}return function(e){if(s(e)){t.prototype=e;var o=new t;t.prototype=null}return o||n.Object()}}()),e.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":14,"lodash.isobject":29,"lodash.noop":15}],14:[function(t,e){e.exports=t(8)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash._isnative/index.js":8}],15:[function(t,e){e.exports=t(9)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":9}],16:[function(t,e){function n(t){function e(){var t=p?h:this;if(d){var s=r(d);l.apply(s,arguments)}if((u||m)&&(s||(s=r(arguments)),u&&l.apply(s,u),m&&s.length<f))return c|=16,n([a,g?c:-4&c,s,null,h,f]);if(s||(s=arguments),b&&(a=t[v]),this instanceof e){t=o(a.prototype);var k=a.apply(t,s);return i(k)?k:t}return a.apply(t,s)}var a=t[0],c=t[1],d=t[2],u=t[3],h=t[4],f=t[5],p=1&c,b=2&c,m=4&c,g=8&c,v=a;return s(e,t),e}var o=t("lodash._basecreate"),i=t("lodash.isobject"),s=t("lodash._setbinddata"),r=t("lodash._slice"),a=[],l=a.push;e.exports=n},{"lodash._basecreate":17,"lodash._setbinddata":7,"lodash._slice":20,"lodash.isobject":29}],17:[function(t,e){e.exports=t(13)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/node_modules/lodash._basecreate/index.js":13,"lodash._isnative":18,"lodash.isobject":29,"lodash.noop":19}],18:[function(t,e){e.exports=t(8)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash._isnative/index.js":8}],19:[function(t,e){e.exports=t(9)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash.noop/index.js":9}],20:[function(t,e){function n(t,e,n){e||(e=0),"undefined"==typeof n&&(n=t?t.length:0);for(var o=-1,i=n-e||0,s=Array(0>i?0:i);++o<i;)s[o]=t[e+o];return s}e.exports=n},{}],21:[function(t,e){function n(t){return t}e.exports=n},{}],22:[function(t,e){(function(n){var o=t("lodash._isnative"),i=/\bthis\b/,s={};s.funcDecomp=!o(n.WinRTError)&&i.test(function(){return this}),s.funcNames="string"==typeof Function.name,e.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":23}],23:[function(t,e){e.exports=t(8)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash._isnative/index.js":8}],24:[function(t,e){var n={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1};e.exports=n},{}],25:[function(t,e){var n=t("lodash._isnative"),o=t("lodash.isobject"),i=t("lodash._shimkeys"),s=n(s=Object.keys)&&s,r=s?function(t){return o(t)?s(t):[]}:i;e.exports=r},{"lodash._isnative":26,"lodash._shimkeys":27,"lodash.isobject":29}],26:[function(t,e){e.exports=t(8)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash._isnative/index.js":8}],27:[function(t,e){var n=t("lodash._objecttypes"),o=Object.prototype,i=o.hasOwnProperty,s=function(t){var e,o=t,s=[];if(!o)return s;if(!n[typeof t])return s;for(e in o)i.call(o,e)&&s.push(e);return s};e.exports=s},{"lodash._objecttypes":24}],28:[function(t,e){function n(t){return"function"==typeof t}e.exports=n},{}],29:[function(t,e){function n(t){return!(!t||!o[typeof t])}var o=t("lodash._objecttypes");e.exports=n},{"lodash._objecttypes":30}],30:[function(t,e){e.exports=t(24)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._objecttypes/index.js":24}],31:[function(t,e){function n(t){return"string"==typeof t||t&&"object"==typeof t&&s.call(t)==o||!1}var o="[object String]",i=Object.prototype,s=i.toString;e.exports=n},{}],32:[function(t,e){function n(t){return"undefined"==typeof t}e.exports=n},{}],33:[function(t,e){function n(t,e){if(t){var n=t[e];return o(n)?t[e]():n}}var o=t("lodash.isfunction");e.exports=n},{"lodash.isfunction":28}],34:[function(t,e){function n(t,e,n){var b=a.imports._.templateSettings||a;t=String(t||""),n=o({},n,b);var m,g=o({},n.imports,b.imports),v=s(g),k=l(g),_=0,y=n.interpolate||f,w="__p += '",x=RegExp((n.escape||f).source+"|"+y.source+"|"+(y===r?h:f).source+"|"+(n.evaluate||f).source+"|$","g");t.replace(x,function(e,n,o,s,r,a){return o||(o=s),w+=t.slice(_,a).replace(p,i),n&&(w+="' +\n__e("+n+") +\n'"),r&&(m=!0,w+="';\n"+r+";\n__p += '"),o&&(w+="' +\n((__t = ("+o+")) == null ? '' : __t) +\n'"),_=a+e.length,e}),w+="';\n";var $=n.variable,B=$;B||($="obj",w="with ("+$+") {\n"+w+"\n}\n"),w=(m?w.replace(c,""):w).replace(d,"$1").replace(u,"$1;"),w="function("+$+") {\n"+(B?"":$+" || ("+$+" = {});\n")+"var __t, __p = '', __e = _.escape"+(m?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+w+"return __p\n}";try{var j=Function(v,"return "+w).apply(void 0,k)}catch(C){throw C.source=w,C}return e?j(e):(j.source=w,j)}var o=t("lodash.defaults"),i=(t("lodash.escape"),t("lodash._escapestringchar")),s=t("lodash.keys"),r=t("lodash._reinterpolate"),a=t("lodash.templatesettings"),l=t("lodash.values"),c=/\b__p \+= '';/g,d=/\b(__p \+=) '' \+/g,u=/(__e\(.*?\)|\b__t\)) \+\n'';/g,h=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,f=/($^)/,p=/['\n\r\t\u2028\u2029\\]/g;e.exports=n},{"lodash._escapestringchar":35,"lodash._reinterpolate":36,"lodash.defaults":37,"lodash.escape":39,"lodash.keys":44,"lodash.templatesettings":48,"lodash.values":49}],35:[function(t,e){function n(t){return"\\"+o[t]}var o={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};e.exports=n},{}],36:[function(t,e){var n=/<%=([\s\S]+?)%>/g;e.exports=n},{}],37:[function(t,e){var n=t("lodash.keys"),o=t("lodash._objecttypes"),i=function(t,e,i){var s,r=t,a=r;if(!r)return a;for(var l=arguments,c=0,d="number"==typeof i?2:l.length;++c<d;)if(r=l[c],r&&o[typeof r])for(var u=-1,h=o[typeof r]&&n(r),f=h?h.length:0;++u<f;)s=h[u],"undefined"==typeof a[s]&&(a[s]=r[s]);return a};e.exports=i},{"lodash._objecttypes":38,"lodash.keys":44}],38:[function(t,e){e.exports=t(24)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._objecttypes/index.js":24}],39:[function(t,e){function n(t){return null==t?"":String(t).replace(i,o)}var o=t("lodash._escapehtmlchar"),i=(t("lodash.keys"),t("lodash._reunescapedhtml"));e.exports=n},{"lodash._escapehtmlchar":40,"lodash._reunescapedhtml":42,"lodash.keys":44}],40:[function(t,e){function n(t){return o[t]}var o=t("lodash._htmlescapes");e.exports=n},{"lodash._htmlescapes":41}],41:[function(t,e){var n={"&":"&","<":"<",">":">",'"':""","'":"'"};e.exports=n},{}],42:[function(t,e){var n=t("lodash._htmlescapes"),o=t("lodash.keys"),i=RegExp("["+o(n).join("")+"]","g");e.exports=i},{"lodash._htmlescapes":43,"lodash.keys":44}],43:[function(t,e){e.exports=t(41)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.template/node_modules/lodash.escape/node_modules/lodash._escapehtmlchar/node_modules/lodash._htmlescapes/index.js":41}],44:[function(t,e){e.exports=t(25)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash.keys/index.js":25,"lodash._isnative":45,"lodash._shimkeys":46,"lodash.isobject":29}],45:[function(t,e){e.exports=t(8)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._basecreatecallback/node_modules/lodash._setbinddata/node_modules/lodash._isnative/index.js":8}],46:[function(t,e){e.exports=t(27)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash.keys/node_modules/lodash._shimkeys/index.js":27,"lodash._objecttypes":47}],47:[function(t,e){e.exports=t(24)},{"/Users/andrewwalker/sites/sir-trevor-js/node_modules/lodash.isempty/node_modules/lodash.forown/node_modules/lodash._objecttypes/index.js":24}],48:[function(t,e){var n=t("lodash.escape"),o=t("lodash._reinterpolate"),i={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:o,variable:"",imports:{_:{escape:n}}};e.exports=i},{"lodash._reinterpolate":36,"lodash.escape":39}],49:[function(t,e){function n(t){for(var e=-1,n=o(t),i=n.length,s=Array(i);++e<i;)s[e]=t[n[e]];return s}var o=t("lodash.keys");e.exports=n},{"lodash.keys":44}],50:[function(t,e){function n(t){var e=++o;return String(null==t?"":t)+e}var o=0;e.exports=n},{}],51:[function(t,e){"use strict";var n=t("object-keys"),o=function(t){return"undefined"!=typeof t&&null!==t},i=function(t){if(!o(t))throw new TypeError("target must be an object");var e,i,s,r,a=Object(t);for(e=1;e<arguments.length;++e)for(i=Object(arguments[e]),r=n(i),s=0;s<r.length;++s)a[r[s]]=i[r[s]];return a};i.shim=function(){return Object.assign||(Object.assign=i),Object.assign||i},e.exports=i},{"object-keys":52}],52:[function(t,e){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=t("./isArguments"),s=!{toString:null}.propertyIsEnumerable("toString"),r=function(){}.propertyIsEnumerable("prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=null!==t&&"object"==typeof t,l="[object Function]"===o.call(t),c=i(t),d=e&&"[object String]"===o.call(t),u=[];if(!e&&!l&&!c)throw new TypeError("Object.keys called on a non-object");var h=r&&l;if(d&&t.length>0&&!n.call(t,0))for(var f=0;f<t.length;++f)u.push(String(f));if(c&&t.length>0)for(var p=0;p<t.length;++p)u.push(String(p));else for(var b in t)h&&"prototype"===b||!n.call(t,b)||u.push(String(b));if(s)for(var m=t.constructor,g=m&&m.prototype===t,p=0;p<a.length;++p)g&&"constructor"===a[p]||!n.call(t,a[p])||u.push(a[p]);return u};l.shim=function(){return Object.keys||(Object.keys=l),Object.keys||l},e.exports=l},{"./isArguments":53}],53:[function(t,e){"use strict";var n=Object.prototype.toString;e.exports=function o(t){var e=n.call(t),o="[object Arguments]"===e;return o||(o="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),o}},{}],54:[function(e,n,o){!function(e,i){"object"==typeof o?n.exports=i():"function"==typeof t&&t.amd?t(i):e.Spinner=i()}(this,function(){"use strict";function t(t,e){var n,o=document.createElement(t||"div");for(n in e)o[n]=e[n];return o}function e(t){for(var e=1,n=arguments.length;n>e;e++)t.appendChild(arguments[e]);return t}function n(t,e,n,o){var i=["opacity",e,~~(100*t),n,o].join("-"),s=.01+n/o*100,r=Math.max(1-(1-t)/e*(100-s),t),a=c.substring(0,c.indexOf("Animation")).toLowerCase(),l=a&&"-"+a+"-"||"";return u[i]||(h.insertRule("@"+l+"keyframes "+i+"{0%{opacity:"+r+"}"+s+"%{opacity:"+t+"}"+(s+.01)+"%{opacity:1}"+(s+e)%100+"%{opacity:"+t+"}100%{opacity:"+r+"}}",h.cssRules.length),u[i]=1),i}function o(t,e){var n,o,i=t.style;for(e=e.charAt(0).toUpperCase()+e.slice(1),o=0;o<d.length;o++)if(n=d[o]+e,void 0!==i[n])return n;return void 0!==i[e]?e:void 0}function i(t,e){for(var n in e)t.style[o(t,n)||n]=e[n];return t}function s(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)void 0===t[o]&&(t[o]=n[o])}return t}function r(t,e){return"string"==typeof t?t:t[e%t.length]}function a(t){this.opts=s(t||{},a.defaults,f)}function l(){function n(e,n){return t("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',n)}h.addRule(".spin-vml","behavior:url(#default#VML)"),a.prototype.lines=function(t,o){function s(){return i(n("group",{coordsize:d+" "+d,coordorigin:-c+" "+-c}),{width:d,height:d})}function a(t,a,l){e(h,e(i(s(),{rotation:360/o.lines*t+"deg",left:~~a}),e(i(n("roundrect",{arcsize:o.corners}),{width:c,height:o.width,left:o.radius,top:-o.width>>1,filter:l}),n("fill",{color:r(o.color,t),opacity:o.opacity}),n("stroke",{opacity:0}))))}var l,c=o.length+o.width,d=2*c,u=2*-(o.width+o.length)+"px",h=i(s(),{position:"absolute",top:u,left:u});if(o.shadow)for(l=1;l<=o.lines;l++)a(l,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(l=1;l<=o.lines;l++)a(l);return e(t,h)},a.prototype.opacity=function(t,e,n,o){var i=t.firstChild;o=o.shadow&&o.lines||0,i&&e+o<i.childNodes.length&&(i=i.childNodes[e+o],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}}var c,d=["webkit","Moz","ms","O"],u={},h=function(){var n=t("style",{type:"text/css"});return e(document.getElementsByTagName("head")[0],n),n.sheet||n.styleSheet}(),f={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};a.defaults={},s(a.prototype,{spin:function(e){this.stop();{var n=this,o=n.opts,s=n.el=i(t(0,{className:o.className}),{position:o.position,width:0,zIndex:o.zIndex});o.radius+o.length+o.width}if(i(s,{left:o.left,top:o.top}),e&&e.insertBefore(s,e.firstChild||null),s.setAttribute("role","progressbar"),n.lines(s,n.opts),!c){var r,a=0,l=(o.lines-1)*(1-o.direction)/2,d=o.fps,u=d/o.speed,h=(1-o.opacity)/(u*o.trail/100),f=u/o.lines;!function p(){a++;for(var t=0;t<o.lines;t++)r=Math.max(1-(a+(o.lines-t)*f)%u*h,o.opacity),n.opacity(s,t*o.direction+l,r,o);n.timeout=n.el&&setTimeout(p,~~(1e3/d))}()}return n},stop:function(){var t=this.el;return t&&(clearTimeout(this.timeout),t.parentNode&&t.parentNode.removeChild(t),this.el=void 0),this},lines:function(o,s){function a(e,n){return i(t(),{position:"absolute",width:s.length+s.width+"px",height:s.width+"px",background:e,boxShadow:n,transformOrigin:"left",transform:"rotate("+~~(360/s.lines*d+s.rotate)+"deg) translate("+s.radius+"px,0)",borderRadius:(s.corners*s.width>>1)+"px"})}for(var l,d=0,u=(s.lines-1)*(1-s.direction)/2;d<s.lines;d++)l=i(t(),{position:"absolute",top:1+~(s.width/2)+"px",transform:s.hwaccel?"translate3d(0,0,0)":"",opacity:s.opacity,animation:c&&n(s.opacity,s.trail,u+d*s.direction,s.lines)+" "+1/s.speed+"s linear infinite"}),s.shadow&&e(l,i(a("#000","0 0 4px #000"),{top:"2px"})),e(o,e(l,a(r(s.color,d),"0 0 1px rgba(0,0,0,.1)")));return o},opacity:function(t,e,n){e<t.childNodes.length&&(t.childNodes[e].style.opacity=n)}});var p=i(t("group"),{behavior:"url(#default#VML)"});return!o(p,"transform")&&p.adj?l():c=o(p,"animation"),a})},{}],55:[function(t,e){"use strict";var n=t("./lodash"),o=t("./blocks"),i=function(t){this.type=t,this.block_type=o[this.type].prototype,this.can_be_rendered=this.block_type.toolbarEnabled,this._ensureElement()};Object.assign(i.prototype,t("./function-bind"),t("./renderable"),t("./events"),{tagName:"a",className:"st-block-control",attributes:function(){return{"data-type":this.block_type.type}},render:function(){return this.$el.html('<span class="st-icon">'+n.result(this.block_type,"icon_name")+"</span>"+n.result(this.block_type,"title")),this}}),e.exports=i},{"./blocks":73,"./events":83,"./function-bind":92,"./lodash":97,"./renderable":99}],56:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./blocks"),r=t("./block-control"),a=t("./event-bus"),l=function(t,e){this.available_types=t||[],this.mediator=e,this._ensureElement(),this._bindFunctions(),this._bindMediatedEvents(),this.initialize()};Object.assign(l.prototype,t("./function-bind"),t("./mediated-events"),t("./renderable"),t("./events"),{bound:["handleControlButtonClick"],block_controls:null,className:"st-block-controls",eventNamespace:"block-controls",mediatedEvents:{render:"renderInContainer",show:"show",hide:"hide"},initialize:function(){for(var t in this.available_types)if(s.hasOwnProperty(t)){var e=new r(t);e.can_be_rendered&&this.$el.append(e.render().$el)}this.$el.delegate(".st-block-control","click",this.handleControlButtonClick),this.mediator.on("block-controls:show",this.renderInContainer)},show:function(){this.$el.addClass("st-block-controls--active"),a.trigger("block:controls:shown")},hide:function(){this.removeCurrentContainer(),this.$el.removeClass("st-block-controls--active"),a.trigger("block:controls:hidden")},handleControlButtonClick:function(t){t.stopPropagation(),this.mediator.trigger("block:create",i(t.currentTarget).attr("data-type"))},renderInContainer:function(t){this.removeCurrentContainer(),t.append(this.$el.detach()),t.addClass("with-st-controls"),this.currentContainer=t,this.show()},removeCurrentContainer:function(){o.isUndefined(this.currentContainer)||(this.currentContainer.removeClass("with-st-controls"),this.currentContainer=void 0)}}),e.exports=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./block-control":55,"./blocks":73,"./event-bus":82,"./events":83,"./function-bind":92,"./lodash":97,"./mediated-events":98,"./renderable":99}],57:[function(t,e){"use strict";var n=function(){this._ensureElement(),this._bindFunctions()};Object.assign(n.prototype,t("./function-bind"),t("./renderable"),{tagName:"a",className:"st-block-ui-btn st-block-ui-btn--delete st-icon",attributes:{html:"delete","data-icon":"bin"}}),e.exports=n},{"./function-bind":92,"./renderable":99}],58:[function(t,e){"use strict";var n=t("./lodash"),o=t("./utils"),i=t("./config"),s=t("./event-bus"),r=t("./blocks"),a=function(t,e,n){this.options=t,this.instance_scope=e,this.mediator=n,this.blocks=[],this.blockCounts={},this.blockTypes={},this._setBlocksTypes(),this._setRequired(),this._bindMediatedEvents(),this.initialize()};Object.assign(a.prototype,t("./function-bind"),t("./mediated-events"),t("./events"),{eventNamespace:"block",mediatedEvents:{create:"createBlock",remove:"removeBlock",rerender:"rerenderBlock"},initialize:function(){},createBlock:function(t,e){if(t=o.classify(t),this.canCreateBlock(t)){var n=new r[t](e,this.instance_scope,this.mediator);this.blocks.push(n),this._incrementBlockTypeCount(t),this.mediator.trigger("block:render",n),this.triggerBlockCountUpdate(),this.mediator.trigger("block:limitReached",this.blockLimitReached()),o.log("Block created of type "+t)}},removeBlock:function(t){var e=this.findBlockById(t),n=o.classify(e.type);this.mediator.trigger("block-controls:reset"),this.blocks=this.blocks.filter(function(t){return t.blockID!==e.blockID}),this._decrementBlockTypeCount(n),this.triggerBlockCountUpdate(),this.mediator.trigger("block:limitReached",this.blockLimitReached()),s.trigger("block:remove")},rerenderBlock:function(t){var e=this.findBlockById(t);n.isUndefined(e)||e.isEmpty()||!e.drop_options.re_render_on_reorder||e.beforeLoadingData()},triggerBlockCountUpdate:function(){this.mediator.trigger("block:countUpdate",this.blocks.length)},canCreateBlock:function(t){return this.blockLimitReached()?(o.log("Cannot add any more blocks. Limit reached."),!1):this.isBlockTypeAvailable(t)?this.canAddBlockType(t)?!0:(o.log("Block Limit reached for type "+t),!1):(o.log("Block type not available "+t),!1)},validateBlockTypesExist:function(t){return i.skipValidation||!t?!1:void(this.required||[]).forEach(function(t){if(this.isBlockTypeAvailable(t))if(0===this._getBlockTypeCount(t))o.log("Failed validation on required block type "+t),this.mediator.trigger("errors:add",{text:i18n.t("errors:type_missing",{type:t})});else{var e=this.getBlocksByType(t).filter(function(t){return!t.isEmpty()});if(e.length>0)return!1;this.mediator.trigger("errors:add",{text:i18n.t("errors:required_type_empty",{type:t})}),o.log("A required block type "+t+" is empty")}},this)},findBlockById:function(t){return this.blocks.find(function(e){return e.blockID===t})},getBlocksByType:function(t){return this.blocks.filter(function(e){return o.classify(e.type)===t})},getBlocksByIDs:function(t){return this.blocks.filter(function(e){return t.includes(e.blockID)})},blockLimitReached:function(){return 0!==this.options.blockLimit&&this.blocks.length>=this.options.blockLimit},isBlockTypeAvailable:function(t){return!n.isUndefined(this.blockTypes[t])},canAddBlockType:function(t){var e=this._getBlockTypeLimit(t);return!(0!==e&&this._getBlockTypeCount(t)>=e)},_setBlocksTypes:function(){this.blockTypes=o.flatten(n.isUndefined(this.options.blockTypes)?r:this.options.blockTypes)},_setRequired:function(){this.required=!1,Array.isArray(this.options.required)&&!n.isEmpty(this.options.required)&&(this.required=this.options.required)},_incrementBlockTypeCount:function(t){this.blockCounts[t]=n.isUndefined(this.blockCounts[t])?1:this.blockCounts[t]+1},_decrementBlockTypeCount:function(t){this.blockCounts[t]=n.isUndefined(this.blockCounts[t])?1:this.blockCounts[t]-1},_getBlockTypeCount:function(t){return n.isUndefined(this.blockCounts[t])?0:this.blockCounts[t]},_blockLimitReached:function(){return 0!==this.options.blockLimit&&this.blocks.length>=this.options.blockLimit},_getBlockTypeLimit:function(t){return this.isBlockTypeAvailable(t)?parseInt(n.isUndefined(this.options.blockTypeLimits[t])?0:this.options.blockTypeLimits[t],10):0}}),e.exports=a},{"./blocks":73,"./config":79,"./event-bus":82,"./events":83,"./function-bind":92,"./lodash":97,"./mediated-events":98,"./utils":103}],59:[function(t,e){"use strict";var n=["<div class='st-block-positioner__inner'>","<span class='st-block-positioner__selected-value'></span>","<select class='st-block-positioner__select'></select>","</div>"].join("\n"),o=function(t,e){this.mediator=e,this.$block=t,this._ensureElement(),this._bindFunctions(),this.initialize()};Object.assign(o.prototype,t("./function-bind"),t("./renderable"),{total_blocks:0,bound:["onBlockCountChange","onSelectChange","toggle","show","hide"],className:"st-block-positioner",visibleClass:"st-block-positioner--is-visible",initialize:function(){this.$el.append(n),this.$select=this.$(".st-block-positioner__select"),this.$select.on("change",this.onSelectChange),this.mediator.on("block:countUpdate",this.onBlockCountChange)},onBlockCountChange:function(t){t!==this.total_blocks&&(this.total_blocks=t,this.renderPositionList())},onSelectChange:function(){var t=this.$select.val();0!==t&&(this.mediator.trigger("block:changePosition",this.$block,t,1===t?"before":"after"),this.toggle())},renderPositionList:function(){for(var t="<option value='0'>"+i18n.t("general:position")+"</option>",e=1;e<=this.total_blocks;e++)t+="<option value="+e+">"+e+"</option>";this.$select.html(t)},toggle:function(){this.$select.val(0),this.$el.toggleClass(this.visibleClass)},show:function(){this.$el.addClass(this.visibleClass)},hide:function(){this.$el.removeClass(this.visibleClass)}}),e.exports=o},{"./function-bind":92,"./renderable":99}],60:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./event-bus"),r=function(t,e){this.$block=t,this.blockID=this.$block.attr("id"),this.mediator=e,this._ensureElement(),this._bindFunctions(),this.initialize()};Object.assign(r.prototype,t("./function-bind"),t("./renderable"),{bound:["onMouseDown","onDragStart","onDragEnd","onDrop"],className:"st-block-ui-btn st-block-ui-btn--reorder st-icon",tagName:"a",attributes:function(){return{html:"reorder",draggable:"true","data-icon":"move"}},initialize:function(){this.$el.bind("mousedown touchstart",this.onMouseDown).bind("dragstart",this.onDragStart).bind("dragend touchend",this.onDragEnd),this.$block.dropArea().bind("drop",this.onDrop)},blockId:function(){return this.$block.attr("id")},onMouseDown:function(){this.mediator.trigger("block-controls:hide"),s.trigger("block:reorder:down")},onDrop:function(t){t.preventDefault();var e=this.$block,n=t.originalEvent.dataTransfer.getData("text/plain"),r=i("#"+n);o.isUndefined(n)||o.isEmpty(r)||e.attr("id")===n||e.attr("data-instance")!==r.attr("data-instance")||e.after(r),this.mediator.trigger("block:rerender",n),s.trigger("block:reorder:dropped",n)},onDragStart:function(t){var e=i(t.currentTarget).parent();t.originalEvent.dataTransfer.setDragImage(this.$block[0],e.position().left,e.position().top),t.originalEvent.dataTransfer.setData("Text",this.blockId()),s.trigger("block:reorder:dragstart"),this.$block.addClass("st-block--dragging")
},onDragEnd:function(){s.trigger("block:reorder:dragend"),this.$block.removeClass("st-block--dragging")},render:function(){return this}}),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event-bus":82,"./function-bind":92,"./lodash":97,"./renderable":99}],61:[function(t,e){"use strict";var n=t("./lodash"),o=t("./utils"),i=t("./event-bus");e.exports={blockStorage:{},createStore:function(t){this.blockStorage={type:o.underscored(this.type),data:t||{}}},save:function(){var t=this._serializeData();n.isEmpty(t)||this.setData(t)},getData:function(){return this.save(),this.blockStorage},getBlockData:function(){return this.save(),this.blockStorage.data},_getData:function(){return this.blockStorage.data},setData:function(t){o.log("Setting data for block "+this.blockID),Object.assign(this.blockStorage.data,t||{})},setAndLoadData:function(t){this.setData(t),this.beforeLoadingData()},_serializeData:function(){},loadData:function(){},beforeLoadingData:function(){o.log("loadData for "+this.blockID),i.trigger("editor/block/loadData"),this.loadData(this._getData())},_loadData:function(){o.log("_loadData is deprecated and will be removed in the future. Please use beforeLoadingData instead."),this.beforeLoadingData()},checkAndLoadData:function(){n.isEmpty(this._getData())||this.beforeLoadingData()}}},{"./event-bus":82,"./lodash":97,"./utils":103}],62:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./utils"),r=function(t){var e=t.attr("data-st-name")||t.attr("name");return e||(e="Field"),s.capitalize(e)};e.exports={errors:[],valid:function(){return this.performValidations(),0===this.errors.length},performValidations:function(){this.resetErrors();var t=this.$(".st-required");t.each(function(t,e){this.validateField(e)}.bind(this)),this.validations.forEach(this.runValidator,this),this.$el.toggleClass("st-block--with-errors",this.errors.length>0)},validations:[],validateField:function(t){t=i(t);var e=t.attr("contenteditable")?t.text():t.val();0===e.length&&this.setError(t,i18n.t("errors:block_empty",{name:r(t)}))},runValidator:function(t){o.isUndefined(this[t])||this[t].call(this)},setError:function(t,e){var n=this.addMessage(e,"st-msg--error");t.addClass("st-error"),this.errors.push({field:t,reason:e,msg:n})},resetErrors:function(){this.errors.forEach(function(t){t.field.removeClass("st-error"),t.msg.remove()}),this.$messages.removeClass("st-block__messages--is-visible"),this.errors=[]}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lodash":97,"./utils":103}],63:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./config"),r=t("./utils"),a=t("./to-html"),l=t("./to-markdown"),c=t("./block_mixins"),d=t("./simple-block"),u=t("./block-reorder"),h=t("./block-deletion"),f=t("./block-positioner"),p=t("./formatters"),b=t("./event-bus"),m=t("spin.js"),g=function(){d.apply(this,arguments)};g.prototype=Object.create(d.prototype),g.prototype.constructor=g;var v=["<div class='st-block__ui-delete-controls'>","<label class='st-block__delete-label'>","<%= i18n.t('general:delete') %>","</label>","<a class='st-block-ui-btn st-block-ui-btn--confirm-delete st-icon' data-icon='tick'></a>","<a class='st-block-ui-btn st-block-ui-btn--deny-delete st-icon' data-icon='close'></a>","</div>"].join("\n"),k={html:['<div class="st-block__dropzone">','<span class="st-icon"><%= _.result(block, "icon_name") %></span>','<p><%= i18n.t("general:drop", { block: "<span>" + _.result(block, "title") + "</span>" }) %>',"</p></div>"].join("\n"),re_render_on_reorder:!1},_={html:['<input type="text" placeholder="<%= i18n.t("general:paste") %>"',' class="st-block__paste-input st-paste-block">'].join("")},y={html:['<div class="st-block__upload-container">','<input type="file" type="st-file-upload">','<button class="st-upload-btn"><%= i18n.t("general:upload") %></button>',"</div>"].join("\n")};s.defaults.Block={drop_options:k,paste_options:_,upload_options:y},Object.assign(g.prototype,d.fn,t("./block-validations"),{bound:["_handleContentPaste","_onFocus","_onBlur","onDrop","onDeleteClick","clearInsertedStyles","getSelectionForFormatter","onBlockRender"],className:"st-block st-icon--add",attributes:function(){return Object.assign(d.fn.attributes.call(this),{"data-icon-after":"add"})},icon_name:"default",validationFailMsg:function(){return i18n.t("errors:validation_fail",{type:this.title()})},editorHTML:'<div class="st-block__editor"></div>',toolbarEnabled:!0,availableMixins:["droppable","pastable","uploadable","fetchable","ajaxable","controllable"],droppable:!1,pastable:!1,uploadable:!1,fetchable:!1,ajaxable:!1,drop_options:{},paste_options:{},upload_options:{},formattable:!0,_previousSelection:"",initialize:function(){},toMarkdown:function(t){return t},toHTML:function(t){return t},withMixin:function(t){if(o.isObject(t)){var e="initialize"+t.mixinName;o.isUndefined(this[e])&&(Object.assign(this,t),this[e]())}},render:function(){if(this.beforeBlockRender(),this._setBlockInner(),this.$editor=this.$inner.children().first(),this.droppable||this.pastable||this.uploadable){var t=i("<div>",{"class":"st-block__inputs"});this.$inner.append(t),this.$inputs=t}return this.hasTextBlock&&this._initTextBlocks(),this.availableMixins.forEach(function(t){this[t]&&this.withMixin(c[r.classify(t)])},this),this.formattable&&this._initFormatting(),this._blockPrepare(),this},remove:function(){this.ajaxable&&this.resolveAllInQueue(),this.$el.remove()},loading:function(){o.isUndefined(this.spinner)||this.ready(),this.spinner=new m(s.defaults.spinner),this.spinner.spin(this.$el[0]),this.$el.addClass("st--is-loading")},ready:function(){this.$el.removeClass("st--is-loading"),o.isUndefined(this.spinner)||(this.spinner.stop(),delete this.spinner)},_serializeData:function(){r.log("toData for "+this.blockID);var t={};if(this.hasTextBlock()){var e=this.getTextBlock().html();e.length>0&&(t.text=l(e,this.type))}return this.$(":input").not(".st-paste-block").length>0&&this.$(":input").each(function(e,n){n.getAttribute("name")&&(t[n.getAttribute("name")]=n.value)}),t},focus:function(){this.getTextBlock().focus()},blur:function(){this.getTextBlock().blur()},onFocus:function(){this.getTextBlock().bind("focus",this._onFocus)},onBlur:function(){this.getTextBlock().bind("blur",this._onBlur)},_onFocus:function(){this.trigger("blockFocus",this.$el)},_onBlur:function(){},onBlockRender:function(){this.focus()},onDrop:function(){},onDeleteClick:function(t){t.preventDefault();var e=function(t){t.preventDefault(),this.mediator.trigger("block:remove",this.blockID),this.remove()},n=function(t){t.preventDefault(),this.$el.removeClass("st-block--delete-active"),i.remove()};if(this.isEmpty())return void e.call(this,new Event("click"));this.$inner.append(o.template(v)),this.$el.addClass("st-block--delete-active");var i=this.$inner.find(".st-block__ui-delete-controls");this.$inner.on("click",".st-block-ui-btn--confirm-delete",e.bind(this)).on("click",".st-block-ui-btn--deny-delete",n.bind(this))},pastedMarkdownToHTML:function(t){return a(l(t,this.type),this.type)},onContentPasted:function(t,e){e.html(this.pastedMarkdownToHTML(e[0].innerHTML)),this.getTextBlock().caretToEnd()},beforeLoadingData:function(){this.loading(),(this.droppable||this.uploadable||this.pastable)&&(this.$editor.show(),this.$inputs.hide()),d.fn.beforeLoadingData.call(this),this.ready()},_handleContentPaste:function(t){setTimeout(this.onContentPasted.bind(this,t,i(t.currentTarget)),0)},_getBlockClass:function(){return"st-block--"+this.className},_initUIComponents:function(){var t=new f(this.$el,this.mediator);this._withUIComponent(t,".st-block-ui-btn--reorder",t.toggle),this._withUIComponent(new u(this.$el,this.mediator)),this._withUIComponent(new h,".st-block-ui-btn--delete",this.onDeleteClick),this.onFocus(),this.onBlur()},_initFormatting:function(){var t;for(var e in p)p.hasOwnProperty(e)&&(t=p[e],o.isUndefined(t.keyCode)||t._bindToBlock(this.$el))},_initTextBlocks:function(){this.getTextBlock().bind("paste",this._handleContentPaste).bind("keyup",this.getSelectionForFormatter).bind("mouseup",this.getSelectionForFormatter).bind("DOMNodeInserted",this.clearInsertedStyles)},getSelectionForFormatter:function(){var t=this;setTimeout(function(){var e=window.getSelection(),n=e.toString().trim(),o="formatter:"+(""===n?"hide":"position");t.mediator.trigger(o,t),b.trigger(o,t)},1)},clearInsertedStyles:function(t){var e=t.target;e.removeAttribute("style")},hasTextBlock:function(){return this.getTextBlock().length>0},getTextBlock:function(){return o.isUndefined(this.text_block)&&(this.text_block=this.$(".st-text-block")),this.text_block},isEmpty:function(){return o.isEmpty(this.getBlockData())}}),g.extend=t("./helpers/extend"),e.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./block-deletion":57,"./block-positioner":59,"./block-reorder":60,"./block-validations":62,"./block_mixins":68,"./config":79,"./event-bus":82,"./formatters":91,"./helpers/extend":94,"./lodash":97,"./simple-block":100,"./to-html":101,"./to-markdown":102,"./utils":103,"spin.js":54}],64:[function(t,e){"use strict";var n=t("../utils");e.exports={mixinName:"Ajaxable",ajaxable:!0,initializeAjaxable:function(){this._queued=[]},addQueuedItem:function(t,e){n.log("Adding queued item for "+this.blockID+" called "+t),this._queued.push({name:t,deferred:e})},removeQueuedItem:function(t){n.log("Removing queued item for "+this.blockID+" called "+t),this._queued=this._queued.filter(function(e){return e.name!==t})},hasItemsInQueue:function(){return this._queued.length>0},resolveAllInQueue:function(){this._queued.forEach(function(t){n.log("Aborting queued request: "+t.name),t.deferred.abort()},this)}}},{"../utils":103}],65:[function(t,e){(function(n){"use strict";var o="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,i=t("../utils");e.exports={mixinName:"Controllable",initializeControllable:function(){i.log("Adding controllable to block "+this.blockID),this.$control_ui=o("<div>",{"class":"st-block__control-ui"}),Object.keys(this.controls).forEach(function(t){this.addUiControl(t,this.controls[t].bind(this))},this),this.$inner.append(this.$control_ui)},getControlTemplate:function(t){return o("<a>",{"data-icon":t,"class":"st-icon st-block-control-ui-btn st-block-control-ui-btn--"+t})},addUiControl:function(t,e){this.$control_ui.append(this.getControlTemplate(t)),this.$control_ui.on("click",".st-block-control-ui-btn--"+t,e)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":103}],66:[function(t,e){(function(n){"use strict";var o=t("../lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("../config"),r=t("../utils"),a=t("../event-bus");e.exports={mixinName:"Droppable",valid_drop_file_types:["File","Files","text/plain","text/uri-list"],initializeDroppable:function(){r.log("Adding droppable to block "+this.blockID),this.drop_options=Object.assign({},s.defaults.Block.drop_options,this.drop_options);var t=i(o.template(this.drop_options.html,{block:this,_:o}));this.$editor.hide(),this.$inputs.append(t),this.$dropzone=t,this.$dropzone.dropArea().bind("drop",this._handleDrop.bind(this)),this.$inner.addClass("st-block__inner--droppable")},_handleDrop:function(t){t.preventDefault(),t=t.originalEvent;var e=i(t.target),n=t.dataTransfer.types;e.removeClass("st-dropzone--dragover"),n&&n.some(function(t){return this.valid_drop_file_types.includes(t)},this)&&this.onDrop(t.dataTransfer),a.trigger("block:content:dropped",this.blockID)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../config":79,"../event-bus":82,"../lodash":97,"../utils":103}],67:[function(t,e){(function(n){"use strict";var o=t("../lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null;e.exports={mixinName:"Fetchable",initializeFetchable:function(){this.withMixin(t("./ajaxable"))},fetch:function(t,e,n){var s=o.uniqueId(this.blockID+"_fetch"),r=i.ajax(t);return this.resetMessages(),this.addQueuedItem(s,r),o.isUndefined(e)||r.done(e.bind(this)),o.isUndefined(n)||r.fail(n.bind(this)),r.always(this.removeQueuedItem.bind(this,s)),r}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lodash":97,"./ajaxable":64}],68:[function(t,e){"use strict";e.exports={Ajaxable:t("./ajaxable.js"),Controllable:t("./controllable.js"),Droppable:t("./droppable.js"),Fetchable:t("./fetchable.js"),Pastable:t("./pastable.js"),Uploadable:t("./uploadable.js")}},{"./ajaxable.js":64,"./controllable.js":65,"./droppable.js":66,"./fetchable.js":67,"./pastable.js":69,"./uploadable.js":70}],69:[function(t,e){(function(n){"use strict";var o=t("../lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("../config"),r=t("../utils");e.exports={mixinName:"Pastable",initializePastable:function(){r.log("Adding pastable to block "+this.blockID),this.paste_options=Object.assign({},s.defaults.Block.paste_options,this.paste_options),this.$inputs.append(o.template(this.paste_options.html,this)),this.$(".st-paste-block").bind("click",function(){i(this).select()}).bind("paste",this._handleContentPaste).bind("submit",this._handleContentPaste)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../config":79,"../lodash":97,"../utils":103}],70:[function(t,e){"use strict";var n=t("../lodash"),o=t("../config"),i=t("../utils"),s=t("../extensions/file-uploader");e.exports={mixinName:"Uploadable",uploadsCount:0,initializeUploadable:function(){i.log("Adding uploadable to block "+this.blockID),this.withMixin(t("./ajaxable")),this.upload_options=Object.assign({},o.defaults.Block.upload_options,this.upload_options),this.$inputs.append(n.template(this.upload_options.html,this))},uploader:function(t,e,n){return s(this,t,e,n)}}},{"../config":79,"../extensions/file-uploader":85,"../lodash":97,"../utils":103,"./ajaxable":64}],71:[function(t,e){"use strict";var n=t("../block"),o=t("../to-html");e.exports=n.extend({type:"Heading",title:function(){return i18n.t("blocks:heading:title")},editorHTML:'<div class="st-required st-text-block st-text-block--heading" contenteditable="true"></div>',icon_name:"heading",loadData:function(t){this.getTextBlock().html(o(t.text,this.type))}})},{"../block":63,"../to-html":101}],72:[function(t,e){(function(n){"use strict";var o="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,i=t("../block");e.exports=i.extend({type:"image",title:function(){return i18n.t("blocks:image:title")},droppable:!0,uploadable:!0,icon_name:"image",loadData:function(t){this.$editor.html(o("<img>",{src:t.file.url}))},onBlockRender:function(){this.$inputs.find("button").bind("click",function(t){t.preventDefault()}),this.$inputs.find("input").on("change",function(t){this.onDrop(t.currentTarget)}.bind(this))},onDrop:function(t){var e=t.files[0],n="undefined"!=typeof URL?URL:"undefined"!=typeof webkitURL?webkitURL:null;/image/.test(e.type)&&(this.loading(),this.$inputs.hide(),this.$editor.html(o("<img>",{src:n.createObjectURL(e)})).show(),this.uploader(e,function(t){this.setData(t),this.ready()},function(){this.addMessage(i18n.t("blocks:image:upload_error")),this.ready()}))}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../block":63}],73:[function(t,e){"use strict";e.exports={Text:t("./text"),Quote:t("./quote"),Image:t("./image"),Heading:t("./heading"),List:t("./list"),Tweet:t("./tweet"),Video:t("./video")}},{"./heading":71,"./image":72,"./list":74,"./quote":75,"./text":76,"./tweet":77,"./video":78}],74:[function(t,e){"use strict";var n=t("../lodash"),o=t("../block"),i=t("../to-html"),s='<div class="st-text-block st-required" contenteditable="true"><ul><li></li></ul></div>';e.exports=o.extend({type:"list",title:function(){return i18n.t("blocks:list:title")},icon_name:"list",editorHTML:function(){return n.template(s,this)},loadData:function(t){this.getTextBlock().html("<ul>"+i(t.text,this.type)+"</ul>")},onBlockRender:function(){this.checkForList=this.checkForList.bind(this),this.getTextBlock().on("click keyup",this.checkForList),this.focus()},checkForList:function(){0===this.$("ul").length&&document.execCommand("insertUnorderedList",!1,!1)},toMarkdown:function(t){return t.replace(/<\/li>/gm,"\n").replace(/<\/?[^>]+(>|$)/g,"").replace(/^(.+)$/gm," - $1")},toHTML:function(t){return t=t.replace(/^ - (.+)$/gm,"<li>$1</li>").replace(/\n/gm,"")},onContentPasted:function(t,e){this.$("ul").html(this.pastedMarkdownToHTML(e[0].innerHTML)),this.getTextBlock().caretToEnd()},isEmpty:function(){return n.isEmpty(this.getBlockData().text)}})},{"../block":63,"../lodash":97,"../to-html":101}],75:[function(t,e){"use strict";var n=t("../lodash"),o=t("../block"),i=t("../to-html"),s=n.template(['<blockquote class="st-required st-text-block" contenteditable="true"></blockquote>','<label class="st-input-label"> <%= i18n.t("blocks:quote:credit_field") %></label>','<input maxlength="140" name="cite" placeholder="<%= i18n.t("blocks:quote:credit_field") %>"',' class="st-input-string st-required js-cite-input" type="text" />'].join("\n"));e.exports=o.extend({type:"quote",title:function(){return i18n.t("blocks:quote:title")},icon_name:"quote",editorHTML:function(){return s(this)},loadData:function(t){this.getTextBlock().html(i(t.text,this.type)),this.$(".js-cite-input").val(t.cite)},toMarkdown:function(t){return t.replace(/^(.+)$/gm,"> $1")}})},{"../block":63,"../lodash":97,"../to-html":101}],76:[function(t,e){"use strict";var n=t("../block"),o=t("../to-html");e.exports=n.extend({type:"text",title:function(){return i18n.t("blocks:text:title")},editorHTML:'<div class="st-required st-text-block" contenteditable="true"></div>',icon_name:"text",loadData:function(t){this.getTextBlock().html(o(t.text,this.type))}})},{"../block":63,"../to-html":101}],77:[function(t,e){(function(n){"use strict";var o=t("../lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("../utils"),r=t("../block"),a=o.template(["<blockquote class='twitter-tweet' align='center'>","<p><%= text %></p>","— <%= user.name %> (@<%= user.screen_name %>)","<a href='<%= status_url %>' data-datetime='<%= created_at %>'><%= created_at %></a>","</blockquote>",'<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'].join("\n"));e.exports=r.extend({type:"tweet",droppable:!0,pastable:!0,fetchable:!0,drop_options:{re_render_on_reorder:!0},title:function(){return i18n.t("blocks:tweet:title")},fetchUrl:function(t){return"/tweets/?tweet_id="+t},icon_name:"twitter",loadData:function(t){o.isUndefined(t.status_url)&&(t.status_url=""),this.$inner.find("iframe").remove(),this.$inner.prepend(a(t))},onContentPasted:function(t){var e=i(t.target),n=e.val();this.handleTwitterDropPaste(n)},handleTwitterDropPaste:function(t){if(!this.validTweetUrl(t))return void s.log("Invalid Tweet URL");var e=t.match(/[^\/]+$/);if(!o.isEmpty(e)){this.loading(),e=e[0];var n={url:this.fetchUrl(e),dataType:"json"};this.fetch(n,this.onTweetSuccess,this.onTweetFail)}},validTweetUrl:function(t){return s.isURI(t)&&-1!==t.indexOf("twitter")&&-1!==t.indexOf("status")},onTweetSuccess:function(t){var e={user:{profile_image_url:t.user.profile_image_url,profile_image_url_https:t.user.profile_image_url_https,screen_name:t.user.screen_name,name:t.user.name},id:t.id_str,text:t.text,created_at:t.created_at,entities:t.entities,status_url:"https://twitter.com/"+t.user.screen_name+"/status/"+t.id_str};this.setAndLoadData(e),this.ready()},onTweetFail:function(){this.addMessage(i18n.t("blocks:tweet:fetch_error")),this.ready()},onDrop:function(t){var e=t.getData("text/plain");this.handleTwitterDropPaste(e)}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../block":63,"../lodash":97,"../utils":103}],78:[function(t,e){"use strict";var n=t("../lodash"),o=t("../utils"),i=t("../block");e.exports=i.extend({providers:{vimeo:{regex:/(?:http[s]?:\/\/)?(?:www.)?vimeo.com\/(.+)/,html:'<iframe src="<%= protocol %>//player.vimeo.com/video/<%= remote_id %>?title=0&byline=0" width="580" height="320" frameborder="0"></iframe>'},youtube:{regex:/(?:http[s]?:\/\/)?(?:www.)?(?:(?:youtube.com\/watch\?(?:.*)(?:v=))|(?:youtu.be\/))([^&].+)/,html:'<iframe src="<%= protocol %>//www.youtube.com/embed/<%= remote_id %>" width="580" height="320" frameborder="0" allowfullscreen></iframe>'}},type:"video",title:function(){return i18n.t("blocks:video:title")},droppable:!0,pastable:!0,icon_name:"video",loadData:function(t){if(this.providers.hasOwnProperty(t.source)){var e=this.providers[t.source],o="file:"===window.location.protocol?"http:":window.location.protocol,i=e.square?"with-square-media":"with-sixteen-by-nine-media";this.$editor.addClass("st-block__editor--"+i).html(n.template(e.html,{protocol:o,remote_id:t.remote_id,width:this.$editor.width()}))}},onContentPasted:function(t){this.handleDropPaste(t.target.value)},matchVideoProvider:function(t,e,o){var i=t.regex.exec(o);return null==i||n.isUndefined(i[1])?{}:{source:e,remote_id:i[1]}},handleDropPaste:function(t){if(o.isURI(t))for(var e in this.providers)this.providers.hasOwnProperty(e)&&this.setAndLoadData(this.matchVideoProvider(this.providers[e],e,t))},onDrop:function(t){var e=t.getData("text/plain");this.handleDropPaste(e)}})},{"../block":63,"../lodash":97,"../utils":103}],79:[function(t,e){"use strict";e.exports={debug:!1,skipValidation:!1,version:"0.4.0",language:"en",instances:[],defaults:{defaultType:!1,spinner:{className:"st-spinner",lines:9,length:8,width:3,radius:6,color:"#000",speed:1.4,trail:57,shadow:!1,left:"50%",top:"50%"},blockLimit:0,blockTypeLimits:{},required:[],uploadUrl:"/attachments",baseImageUrl:"/sir-trevor-uploads/",errorsContainer:void 0}}},{}],80:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./config"),r=t("./utils"),a=t("./events"),l=t("./event-bus"),c=t("./form-events"),d=t("./block-controls"),u=t("./block-manager"),h=t("./floating-block-controls"),f=t("./format-bar"),p=t("./extensions/editor-store"),b=t("./error-handler"),m=function(t){this.initialize(t)};Object.assign(m.prototype,t("./function-bind"),t("./events"),{bound:["onFormSubmit","hideAllTheThings","changeBlockPosition","removeBlockDragOver","renderBlock","resetBlockControls","blockLimitReached"],events:{"block:reorder:dragend":"removeBlockDragOver","block:content:dropped":"removeBlockDragOver"},initialize:function(t){return r.log("Init SirTrevor.Editor"),this.options=Object.assign({},s.defaults,t||{}),this.ID=o.uniqueId("st-editor-"),this._ensureAndSetElements()?(!o.isUndefined(this.options.onEditorRender)&&o.isFunction(this.options.onEditorRender)&&(this.onEditorRender=this.options.onEditorRender),this.mediator=Object.assign({},a),this._bindFunctions(),s.instances.push(this),this.build(),void c.bindFormSubmit(this.$form)):!1},build:function(){this.$el.hide(),this.errorHandler=new b(this.$outer,this.mediator,this.options.errorsContainer),this.store=new p(this.$el.val(),this.mediator),this.block_manager=new u(this.options,this.ID,this.mediator),this.block_controls=new d(this.block_manager.blockTypes,this.mediator),this.fl_block_controls=new h(this.$wrapper,this.ID,this.mediator),this.formatBar=new f(this.options.formatBar,this.mediator),this.mediator.on("block:changePosition",this.changeBlockPosition),this.mediator.on("block-controls:reset",this.resetBlockControls),this.mediator.on("block:limitReached",this.blockLimitReached),this.mediator.on("block:render",this.renderBlock),this.dataStore="Please use store.retrieve();",this._setEvents(),this.$wrapper.prepend(this.fl_block_controls.render().$el),i(document.body).append(this.formatBar.render().$el),this.$outer.append(this.block_controls.render().$el),i(window).bind("click",this.hideAllTheThings),this.createBlocks(),this.$wrapper.addClass("st-ready"),o.isUndefined(this.onEditorRender)||this.onEditorRender()},createBlocks:function(){var t=this.store.retrieve();t.data.length>0?t.data.forEach(function(t){this.mediator.trigger("block:create",t.type,t.data)},this):this.options.defaultType!==!1&&this.mediator.trigger("block:create",this.options.defaultType,{})},destroy:function(){this.formatBar.destroy(),this.fl_block_controls.destroy(),this.block_controls.destroy(),this.blocks.forEach(function(){this.mediator.trigger("block:remove",this.block.blockID)},this),this.mediator.stopListening(),this.stopListening(),s.instances=s.instances.filter(function(t){return t.ID!==this.ID},this),this.store.reset(),this.$outer.replaceWith(this.$el.detach())},reinitialize:function(t){this.destroy(),this.initialize(t||this.options)},resetBlockControls:function(){this.block_controls.renderInContainer(this.$wrapper),this.block_controls.hide()},blockLimitReached:function(t){this.$wrapper.toggleClass("st--block-limit-reached",t)},_setEvents:function(){Object.keys(this.events).forEach(function(t){l.on(t,this[this.events[t]],this)},this)},hideAllTheThings:function(){this.block_controls.hide(),this.formatBar.hide()},store:function(t,e){return r.log("The store method has been removed, please call store[methodName]"),this.store[t].call(this,e||{})},renderBlock:function(t){this._renderInPosition(t.render().$el),this.hideAllTheThings(),this.scrollTo(t.$el),t.trigger("onRender")},scrollTo:function(t){i("html, body").animate({scrollTop:t.position().top},300,"linear")},removeBlockDragOver:function(){this.$outer.find(".st-drag-over").removeClass("st-drag-over")},changeBlockPosition:function(t,e){e-=1;var n=this.getBlockPosition(t),o=this.$wrapper.find(".st-block").eq(e),i=n>e?"Before":"After";o&&o.attr("id")!==t.attr("id")&&(this.hideAllTheThings(),t["insert"+i](o),this.scrollTo(t))},_renderInPosition:function(t){this.block_controls.currentContainer?this.block_controls.currentContainer.after(t):this.$wrapper.append(t)},validateAndSaveBlock:function(t,e){if((!s.skipValidation||e)&&!t.valid())return this.mediator.trigger("errors:add",{text:o.result(t,"validationFailMsg")}),void r.log("Block "+t.blockID+" failed validation");var n=t.getData();r.log("Adding data for block "+t.blockID+" to block store:",n),this.store.addData(n)},onFormSubmit:function(t){return t=t===!1?!1:!0,r.log("Handling form submission for Editor "+this.ID),this.mediator.trigger("errors:reset"),this.store.reset(),this.validateBlocks(t),this.block_manager.validateBlockTypesExist(t),this.mediator.trigger("errors:render"),this.$el.val(this.store.toString()),this.errorHandler.errors.length},validateBlocks:function(t){var e=this;this.$wrapper.find(".st-block").each(function(n,s){var r=e.block_manager.findBlockById(i(s).attr("id"));o.isUndefined(r)||e.validateAndSaveBlock(r,t)})},findBlockById:function(t){return this.block_manager.findBlockById(t)},getBlocksByType:function(t){return this.block_manager.getBlocksByType(t)},getBlocksByIDs:function(t){return this.block_manager.getBlocksByIDs(t)},getBlockPosition:function(t){return this.$wrapper.find(".st-block").index(t)},_ensureAndSetElements:function(){if(o.isUndefined(this.options.el)||o.isEmpty(this.options.el))return r.log("You must provide an el"),!1;this.$el=this.options.el,this.el=this.options.el[0],this.$form=this.$el.parents("form");var t=i("<div>").attr({id:this.ID,"class":"st-outer",dropzone:"copy link move"}),e=i("<div>").attr({"class":"st-blocks"});return this.$el.wrap(t).wrap(e),this.$outer=this.$form.find("#"+this.ID),this.$wrapper=this.$outer.find(".st-blocks"),!0}}),e.exports=m}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./block-controls":56,"./block-manager":58,"./config":79,"./error-handler":81,"./event-bus":82,"./events":83,"./extensions/editor-store":84,"./floating-block-controls":87,"./form-events":88,"./format-bar":89,"./function-bind":92,"./lodash":97,"./utils":103}],81:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=function(t,e,n){this.$wrapper=t,this.mediator=e,this.$el=n,o.isUndefined(this.$el)&&(this._ensureElement(),this.$wrapper.prepend(this.$el)),this.$el.hide(),this._bindFunctions(),this._bindMediatedEvents(),this.initialize()};Object.assign(s.prototype,t("./function-bind"),t("./mediated-events"),t("./renderable"),{errors:[],className:"st-errors",eventNamespace:"errors",mediatedEvents:{reset:"reset",add:"addMessage",render:"render"},initialize:function(){var t=i("<ul>");this.$el.append("<p>"+i18n.t("errors:title")+"</p>").append(t),this.$list=t},render:function(){return 0===this.errors.length?!1:(this.errors.forEach(this.createErrorItem,this),void this.$el.show())},createErrorItem:function(t){var e=i("<li>",{"class":"st-errors__msg",html:t.text});this.$list.append(e)},addMessage:function(t){this.errors.push(t)},reset:function(){return 0===this.errors.length?!1:(this.errors=[],this.$list.html(""),void this.$el.hide())}}),e.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./function-bind":92,"./lodash":97,"./mediated-events":98,"./renderable":99}],82:[function(t,e){"use strict";e.exports=Object.assign({},t("./events"))},{"./events":83}],83:[function(t,e){"use strict";e.exports=t("eventablejs")},{eventablejs:3}],84:[function(t,e){"use strict";var n=t("../lodash"),o=t("../utils"),i=function(t,e){this.mediator=e,this.initialize(t?t.trim():"")};Object.assign(i.prototype,{initialize:function(t){this.store=this._parseData(t)||{data:[]}},retrieve:function(){return this.store},toString:function(t){return JSON.stringify(this.store,void 0,t)},reset:function(){o.log("Resetting the EditorStore"),this.store={data:[]}},addData:function(t){return this.store.data.push(t),this.store},_parseData:function(t){var e;if(0===t.length)return e;try{var o=JSON.parse(t);n.isUndefined(o.data)||(e=o)}catch(i){this.mediator.trigger("errors:add",{text:i18n.t("errors:load_fail")}),this.mediator.trigger("errors:render"),console.log("Sorry there has been a problem with parsing the JSON"),console.log(i)}return e}}),e.exports=i},{"../lodash":97,"../utils":103}],85:[function(t,e){(function(n){"use strict";var o=t("../lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=(t("../config"),t("../utils")),r=t("../event-bus");e.exports=function(t,e,n,a){var l,c,d;return r.trigger("onUploadStart"),d=[t.blockID,(new Date).getTime(),"raw"].join("-"),t.resetMessages(),c=function(){s.log("Upload callback called"),r.trigger("onUploadStop"),!o.isUndefined(n)&&o.isFunction(n)&&(t.setData({file:{url:this.url}}),n.apply(t,arguments))},l=function(e,n){return s.log("Upload callback error called"),r.trigger("onUploadStop"),!o.isUndefined(a)&&o.isFunction(a)?a.call(t,n):void 0},i.ajax({url:"/blog/sign_s3",data:{file_name:e.name,file_type:e.type},type:"GET",error:l,success:function(n){var o;return o=i.ajax({url:n.url,contentType:e.type,crossDomain:!0,data:e,processData:!1,headers:{"Content-MD5":e.md5,Authorization:n.signature,"x-amz-date":n.date,"x-amz-acl":"public-read"},type:"PUT",success:c}),t.addQueuedItem(d,o),o.done(c).fail(l).always(t.removeQueuedItem.bind(t,d)),o}})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../config":79,"../event-bus":82,"../lodash":97,"../utils":103}],86:[function(t,e){(function(n){"use strict";var o="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,i=t("../utils"),s=t("../event-bus"),r=function(t){this.$form=t,this.intialize()
};Object.assign(r.prototype,{intialize:function(){this.submitBtn=this.$form.find("input[type='submit']");var t=[];this.submitBtn.each(function(e,n){t.push(o(n).attr("value"))}),this.submitBtnTitles=t,this.canSubmit=!0,this.globalUploadCount=0,this._bindEvents()},setSubmitButton:function(t,e){this.submitBtn.attr("value",e)},resetSubmitButton:function(){var t=this.submitBtnTitles;this.submitBtn.each(function(e,n){o(n).attr("value",t[e])})},onUploadStart:function(){this.globalUploadCount++,i.log("onUploadStart called "+this.globalUploadCount),1===this.globalUploadCount&&this._disableSubmitButton()},onUploadStop:function(){this.globalUploadCount=this.globalUploadCount<=0?0:this.globalUploadCount-1,i.log("onUploadStop called "+this.globalUploadCount),0===this.globalUploadCount&&this._enableSubmitButton()},onError:function(){i.log("onError called"),this.canSubmit=!1},_disableSubmitButton:function(t){this.setSubmitButton(null,t||i18n.t("general:wait")),this.submitBtn.attr("disabled","disabled").addClass("disabled")},_enableSubmitButton:function(){this.resetSubmitButton(),this.submitBtn.removeAttr("disabled").removeClass("disabled")},_events:{disableSubmitButton:"_disableSubmitButton",enableSubmitButton:"_enableSubmitButton",setSubmitButton:"setSubmitButton",resetSubmitButton:"resetSubmitButton",onError:"onError",onUploadStart:"onUploadStart",onUploadStop:"onUploadStop"},_bindEvents:function(){Object.keys(this._events).forEach(function(t){s.on(t,this[this._events[t]],this)},this)}}),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../event-bus":82,"../utils":103}],87:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./event-bus"),r=function(t,e,n){this.$wrapper=t,this.instance_id=e,this.mediator=n,this._ensureElement(),this._bindFunctions(),this.initialize()};Object.assign(r.prototype,t("./function-bind"),t("./renderable"),t("./events"),{className:"st-block-controls__top",attributes:function(){return{"data-icon":"add"}},bound:["handleBlockMouseOut","handleBlockMouseOver","handleBlockClick","onDrop"],initialize:function(){this.$el.on("click",this.handleBlockClick).dropArea().bind("drop",this.onDrop),this.$wrapper.on("mouseover",".st-block",this.handleBlockMouseOver).on("mouseout",".st-block",this.handleBlockMouseOut).on("click",".st-block--with-plus",this.handleBlockClick)},onDrop:function(t){t.preventDefault();var e=this.$el,n=t.originalEvent.dataTransfer.getData("text/plain"),r=i("#"+n);o.isUndefined(n)||o.isEmpty(r)||e.attr("id")===n||this.instance_id!==r.attr("data-instance")||e.after(r),s.trigger("block:reorder:dropped",n)},handleBlockMouseOver:function(t){var e=i(t.currentTarget);e.hasClass("st-block--with-plus")||e.addClass("st-block--with-plus")},handleBlockMouseOut:function(t){var e=i(t.currentTarget);e.hasClass("st-block--with-plus")&&e.removeClass("st-block--with-plus")},handleBlockClick:function(t){t.stopPropagation(),this.mediator.trigger("block-controls:render",i(t.currentTarget))}}),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event-bus":82,"./events":83,"./function-bind":92,"./lodash":97,"./renderable":99}],88:[function(t,e){"use strict";var n=t("./config"),o=t("./utils"),i=t("./event-bus"),s=t("./extensions/submittable"),r=!1,a={bindFormSubmit:function(t){r||(new s(t),t.bind("submit",this.onFormSubmit),r=!0)},onBeforeSubmit:function(t){var e=0;return n.instances.forEach(function(n){e+=n.onFormSubmit(t)}),o.log("Total errors: "+e),e},onFormSubmit:function(t){var e=a.onBeforeSubmit();e>0&&(i.trigger("onError"),t.preventDefault())}};e.exports=a},{"./config":79,"./event-bus":82,"./extensions/submittable":86,"./utils":103}],89:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,s=t("./config"),r=t("./formatters"),a=function(t,e){this.options=Object.assign({},s.defaults.formatBar,t||{}),this.mediator=e,this._ensureElement(),this._bindFunctions(),this._bindMediatedEvents(),this.initialize.apply(this,arguments)};Object.assign(a.prototype,t("./function-bind"),t("./mediated-events"),t("./events"),t("./renderable"),{className:"st-format-bar",bound:["onFormatButtonClick","renderBySelection","hide"],eventNamespace:"formatter",mediatedEvents:{position:"renderBySelection",show:"show",hide:"hide"},initialize:function(){var t,e,n;this.$btns=[];for(t in r)r.hasOwnProperty(t)&&(e=r[t],n=i("<button>",{"class":"st-format-btn st-format-btn--"+t+" "+(e.iconName?"st-icon":""),text:e.text,"data-type":t,"data-cmd":e.cmd}),this.$btns.push(n),n.appendTo(this.$el));this.$b=i(document),this.$el.bind("click",".st-format-btn",this.onFormatButtonClick)},hide:function(){this.$el.removeClass("st-format-bar--is-ready")},show:function(){this.$el.addClass("st-format-bar--is-ready")},remove:function(){this.$el.remove()},renderBySelection:function(){var t=window.getSelection(),e=t.getRangeAt(0),n=e.getBoundingClientRect(),o={};o.top=n.top+20+window.pageYOffset-this.$el.height()+"px",o.left=(n.left+n.right)/2-this.$el.width()/2+"px",this.highlightSelectedButtons(),this.show(),this.$el.css(o)},highlightSelectedButtons:function(){var t;this.$btns.forEach(function(e){t=r[e.attr("data-type")],e.toggleClass("st-format-btn--is-active",t.isActive())},this)},onFormatButtonClick:function(t){t.stopPropagation();var e=i(t.target),n=r[e.attr("data-type")];return o.isUndefined(n)?!1:(!o.isUndefined(n.onClick)&&o.isFunction(n.onClick)?n.onClick():document.execCommand(e.attr("data-cmd"),!1,n.param),this.highlightSelectedButtons(),!1)}}),e.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./config":79,"./events":83,"./formatters":91,"./function-bind":92,"./lodash":97,"./mediated-events":98,"./renderable":99}],90:[function(t,e){"use strict";var n=t("./lodash"),o=function(t){this.formatId=n.uniqueId("format-"),this._configure(t||{}),this.initialize.apply(this,arguments)},i=["title","className","cmd","keyCode","param","onClick","toMarkdown","toHTML"];Object.assign(o.prototype,{title:"",className:"",cmd:null,keyCode:null,param:null,toMarkdown:function(t){return t},toHTML:function(t){return t},initialize:function(){},_configure:function(t){this.options&&(t=Object.assign({},this.options,t));for(var e=0,n=i.length;n>e;e++){var o=i[e];t[o]&&(this[o]=t[o])}this.options=t},isActive:function(){return document.queryCommandState(this.cmd)},_bindToBlock:function(t){var e=this,n=!1;t.on("keyup",".st-text-block",function(t){(17===t.which||224===t.which||91===t.which)&&(n=!1)}).on("keydown",".st-text-block",{formatter:e},function(t){(17===t.which||224===t.which||91===t.which)&&(n=!0),t.which===t.data.formatter.keyCode&&n===!0&&(document.execCommand(t.data.formatter.cmd,!1,!0),t.preventDefault(),n=!1)})}}),o.extend=t("./helpers/extend"),e.exports=o},{"./helpers/extend":94,"./lodash":97}],91:[function(t,e,n){"use strict";var o=t("./formatter"),i=o.extend({title:"bold",cmd:"bold",keyCode:66,text:"B"}),s=o.extend({title:"italic",cmd:"italic",keyCode:73,text:"i"}),r=o.extend({title:"link",iconName:"link",cmd:"CreateLink",text:"link",onClick:function(){var t=window.prompt(i18n.t("general:link")),e=/((ftp|http|https):\/\/.)|mailto(?=\:[-\.\w]+@)/;t&&t.length>0&&(e.test(t)||(t="http://"+t),document.execCommand(this.cmd,!1,t))},isActive:function(){var t,e=window.getSelection();return e.rangeCount>0&&(t=e.getRangeAt(0).startContainer.parentNode),t&&"A"===t.nodeName}}),a=o.extend({title:"unlink",iconName:"link",cmd:"unlink",text:"link"});n.Bold=new i,n.Italic=new s,n.Link=new r,n.Unlink=new a},{"./formatter":90}],92:[function(t,e){"use strict";e.exports={bound:[],_bindFunctions:function(){this.bound.forEach(function(t){this[t]=this[t].bind(this)},this)}}},{}],93:[function(){(function(t){"use strict";function e(t){t.preventDefault()}function n(t){t.originalEvent.dataTransfer.dropEffect="copy",i(t.currentTarget).addClass("st-drag-over"),t.preventDefault()}function o(t){i(t.currentTarget).removeClass("st-drag-over"),t.preventDefault()}var i="undefined"!=typeof window?window.$:"undefined"!=typeof t?t.$:null;i.fn.dropArea=function(){return this.bind("dragenter",e).bind("dragover",n).bind("dragleave",o),this},i.fn.noDropArea=function(){return this.unbind("dragenter").unbind("dragover").unbind("dragleave"),this},i.fn.caretToEnd=function(){var t,e;return t=document.createRange(),t.selectNodeContents(this[0]),t.collapse(!1),e=window.getSelection(),e.removeAllRanges(),e.addRange(t),this}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],94:[function(t,e){"use strict";e.exports=function(t,e){var n,o=this;n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return o.apply(this,arguments)},Object.assign(n,o,e);var i=function(){this.constructor=n};return i.prototype=o.prototype,n.prototype=new i,t&&Object.assign(n.prototype,t),n.__super__=o.prototype,n}},{}],95:[function(t,e){"use strict";var n=t("./lodash");t("object.assign").shim(),t("array.prototype.find"),t("./vendor/array-includes"),t("./helpers/event");var o={config:t("./config"),log:t("./utils").log,Locales:t("./locales"),Events:t("./events"),EventBus:t("./event-bus"),EditorStore:t("./extensions/editor-store"),Submittable:t("./extensions/submittable"),FileUploader:t("./extensions/file-uploader"),BlockMixins:t("./block_mixins"),BlockPositioner:t("./block-positioner"),BlockReorder:t("./block-reorder"),BlockDeletion:t("./block-deletion"),BlockValidations:t("./block-validations"),BlockStore:t("./block-store"),BlockManager:t("./block-manager"),SimpleBlock:t("./simple-block"),Block:t("./block"),Formatter:t("./formatter"),Formatters:t("./formatters"),Blocks:t("./blocks"),BlockControl:t("./block-control"),BlockControls:t("./block-controls"),FloatingBlockControls:t("./floating-block-controls"),FormatBar:t("./format-bar"),Editor:t("./editor"),toMarkdown:t("./to-markdown"),toHTML:t("./to-html"),setDefaults:function(t){Object.assign(o.config.defaults,t||{})},getInstance:function(t){return n.isUndefined(t)?this.config.instances[0]:n.isString(t)?this.config.instances.find(function(e){return e.ID===t}):this.config.instances[t]},setBlockOptions:function(t,e){var i=o.Blocks[t];n.isUndefined(i)||Object.assign(i.prototype,e||{})},runOnAllInstances:function(t){if(o.Editor.prototype.hasOwnProperty(t)){var e=Array.prototype.slice.call(arguments,1);Array.prototype.forEach.call(o.config.instances,function(n){n[t].apply(null,e)})}else o.log("method doesn't exist")}};Object.assign(o,t("./form-events")),e.exports=o},{"./block":63,"./block-control":55,"./block-controls":56,"./block-deletion":57,"./block-manager":58,"./block-positioner":59,"./block-reorder":60,"./block-store":61,"./block-validations":62,"./block_mixins":68,"./blocks":73,"./config":79,"./editor":80,"./event-bus":82,"./events":83,"./extensions/editor-store":84,"./extensions/file-uploader":85,"./extensions/submittable":86,"./floating-block-controls":87,"./form-events":88,"./format-bar":89,"./formatter":90,"./formatters":91,"./helpers/event":93,"./locales":96,"./lodash":97,"./simple-block":100,"./to-html":101,"./to-markdown":102,"./utils":103,"./vendor/array-includes":104,"array.prototype.find":2,"object.assign":51}],96:[function(t,e){"use strict";var n=t("./lodash"),o=t("./config"),i=t("./utils"),s={en:{general:{"delete":"Delete?",drop:"Drag __block__ here",paste:"Or paste URL here",upload:"...or choose a file",close:"close",position:"Position",wait:"Please wait...",link:"Enter a link"},errors:{title:"You have the following errors:",validation_fail:"__type__ block is invalid",block_empty:"__name__ must not be empty",type_missing:"You must have a block of type __type__",required_type_empty:"A required block type __type__ is empty",load_fail:"There was a problem loading the contents of the document"},blocks:{text:{title:"Text"},list:{title:"List"},quote:{title:"Quote",credit_field:"Credit"},image:{title:"Image",upload_error:"There was a problem with your upload"},video:{title:"Video"},tweet:{title:"Tweet",fetch_error:"There was a problem fetching your tweet"},embedly:{title:"Embedly",fetch_error:"There was a problem fetching your embed",key_missing:"An Embedly API key must be present"},heading:{title:"Heading"}}}};void 0===window.i18n?(i.log("Using i18n stub"),window.i18n={t:function(t,e){var i,r,a,l,c=t.split(":");for(r=s[o.language],l=0;l<c.length;l++)a=c[l],n.isUndefined(r[a])||(r=r[a]);return i=r,n.isString(i)?(i.indexOf("__")>=0&&Object.keys(e).forEach(function(t){i=i.replace("__"+t+"__",e[t])}),i):""}}):(i.log("Using i18next"),i18n.init({resStore:s,fallbackLng:o.language,ns:{namespaces:["general","blocks"],defaultNs:"general"}})),e.exports=s},{"./config":79,"./lodash":97,"./utils":103}],97:[function(t,e,n){"use strict";n.isEmpty=t("lodash.isempty"),n.isFunction=t("lodash.isfunction"),n.isObject=t("lodash.isobject"),n.isString=t("lodash.isstring"),n.isUndefined=t("lodash.isundefined"),n.result=t("lodash.result"),n.template=t("lodash.template"),n.uniqueId=t("lodash.uniqueid")},{"lodash.isempty":4,"lodash.isfunction":28,"lodash.isobject":29,"lodash.isstring":31,"lodash.isundefined":32,"lodash.result":33,"lodash.template":34,"lodash.uniqueid":50}],98:[function(t,e){"use strict";e.exports={mediatedEvents:{},eventNamespace:null,_bindMediatedEvents:function(){Object.keys(this.mediatedEvents).forEach(function(t){var e=this.mediatedEvents[t];t=this.eventNamespace?this.eventNamespace+":"+t:t,this.mediator.on(t,this[e].bind(this))},this)}}},{}],99:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null;e.exports={tagName:"div",className:"sir-trevor__view",attributes:{},$:function(t){return this.$el.find(t)},render:function(){return this},destroy:function(){o.isUndefined(this.stopListening)||this.stopListening(),this.$el.remove()},_ensureElement:function(){if(this.el)this._setElement(this.el);else{var t,e=Object.assign({},o.result(this,"attributes"));this.id&&(e.id=this.id),this.className&&(e["class"]=this.className),e.html&&(t=e.html,delete e.html);var n=i("<"+this.tagName+">").attr(e);t&&n.html(t),this._setElement(n)}},_setElement:function(t){return this.$el=i(t),this.el=this.$el[0],this}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lodash":97}],100:[function(t,e){(function(n){"use strict";var o=t("./lodash"),i=t("./utils"),s="undefined"!=typeof window?window.$:"undefined"!=typeof n?n.$:null,r=t("./block-reorder"),a=function(t,e,n){this.createStore(t),this.blockID=o.uniqueId("st-block-"),this.instanceID=e,this.mediator=n,this._ensureElement(),this._bindFunctions(),this.initialize.apply(this,arguments)};Object.assign(a.prototype,t("./function-bind"),t("./events"),t("./renderable"),t("./block-store"),{focus:function(){},valid:function(){return!0},className:"st-block",block_template:o.template("<div class='st-block__inner'><%= editor_html %></div>"),attributes:function(){return{id:this.blockID,"data-type":this.type,"data-instance":this.instanceID}},title:function(){return i.titleize(this.type.replace(/[\W_]/g," "))},blockCSSClass:function(){return this.blockCSSClass=i.toSlug(this.type),this.blockCSSClass},type:"","class":function(){return i.classify(this.type)},editorHTML:"",initialize:function(){},onBlockRender:function(){},beforeBlockRender:function(){},_setBlockInner:function(){var t=o.result(this,"editorHTML");this.$el.append(this.block_template({editor_html:t})),this.$inner=this.$el.find(".st-block__inner"),this.$inner.bind("click mouseover",function(t){t.stopPropagation()})},render:function(){return this.beforeBlockRender(),this._setBlockInner(),this._blockPrepare(),this},_blockPrepare:function(){this._initUI(),this._initMessages(),this.checkAndLoadData(),this.$el.addClass("st-item-ready"),this.on("onRender",this.onBlockRender),this.save()},_withUIComponent:function(t,e,n){this.$ui.append(t.render().$el),e&&n&&this.$ui.on("click",e,n)},_initUI:function(){var t=s("<div>",{"class":"st-block__ui"});this.$inner.append(t),this.$ui=t,this._initUIComponents()},_initMessages:function(){var t=s("<div>",{"class":"st-block__messages"});this.$inner.prepend(t),this.$messages=t},addMessage:function(t,e){var n=s("<span>",{html:t,"class":"st-msg "+e});return this.$messages.append(n).addClass("st-block__messages--is-visible"),n},resetMessages:function(){this.$messages.html("").removeClass("st-block__messages--is-visible")},_initUIComponents:function(){this._withUIComponent(new r(this.$el))}}),a.fn=a.prototype,a.extend=t("./helpers/extend"),e.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./block-reorder":60,"./block-store":61,"./events":83,"./function-bind":92,"./helpers/extend":94,"./lodash":97,"./renderable":99,"./utils":103}],101:[function(t,e){"use strict";var n=t("./lodash"),o=t("./utils");e.exports=function(e,i){var s=t("./blocks"),r=t("./formatters");i=o.classify(i);var a=e,l="Text"===i;n.isUndefined(l)&&(l=!1),l&&(a="<div>"+a),a=a.replace(/\[([^\]]+)\]\(([^\)]+)\)/gm,function(t,e,n){return"<a href='"+n+"'>"+e.replace(/\n/g,"")+"</a>"}),a=o.reverse(o.reverse(a).replace(/_(?!\\)((_\\|[^_])*)_(?=$|[^\\])/gm,function(t,e){return">i/<"+e.replace(/\n/g,"").replace(/[\s]+$/,"")+">i<"}).replace(/\*\*(?!\\)((\*\*\\|[^\*\*])*)\*\*(?=$|[^\\])/gm,function(t,e){return">b/<"+e.replace(/\n/g,"").replace(/[\s]+$/,"")+">b<"})),a=a.replace(/^\> (.+)$/gm,"$1");var c,d;for(c in r)r.hasOwnProperty(c)&&(d=r[c],!n.isUndefined(d.toHTML)&&n.isFunction(d.toHTML)&&(a=d.toHTML(a)));var u;return s.hasOwnProperty(i)&&(u=s[i],!n.isUndefined(u.prototype.toHTML)&&n.isFunction(u.prototype.toHTML)&&(a=u.prototype.toHTML(a))),l&&(a=a.replace(/\n\n/gm,"</div><div><br></div><div>"),a=a.replace(/\n/gm,"</div><div>")),a=a.replace(/\t/g," ").replace(/\n/g,"<br>").replace(/\*\*/,"").replace(/__/,""),a=a.replace(/\\\*/g,"*").replace(/\\\[/g,"[").replace(/\\\]/g,"]").replace(/\\\_/g,"_").replace(/\\\(/g,"(").replace(/\\\)/g,")").replace(/\\\-/g,"-"),l&&(a+="</div>"),a}},{"./blocks":73,"./formatters":91,"./lodash":97,"./utils":103}],102:[function(t,e){"use strict";var n=t("./lodash"),o=t("./utils");e.exports=function(e,i){function s(t,e,o){return n.isUndefined(o)&&(o=""),"**"+e.replace(/<(.)?br(.)?>/g,"")+"**"+o}function r(t,e,o){return n.isUndefined(o)&&(o=""),"_"+e.replace(/<(.)?br(.)?>/g,"")+"_"+o}var a=t("./blocks"),l=t("./formatters");i=o.classify(i);var c=e;c=c.replace(/ /g," "),c=c.replace(/( class=(")?Mso[a-zA-Z]+(")?)/g,"").replace(/<!--(.*?)-->/g,"").replace(/\/\*(.*?)\*\//g,"").replace(/<(\/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>/gi,"");var d,u,h=["style","script","applet","embed","noframes","noscript"];for(u=0;u<h.length;u++)d=new RegExp("<"+h[u]+".*?"+h[u]+"(.*?)>","gi"),c=c.replace(d,"");c=c.replace(/\*/g,"\\*").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\_/g,"\\_").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/\-/g,"\\-");var f=["em","i","strong","b"];for(u=0;u<f.length;u++)d=new RegExp("<"+f[u]+"><br></"+f[u]+">","gi"),c=c.replace(d,"<br>");c=c.replace(/<(\w+)(?:\s+\w+="[^"]+(?:"\$[^"]+"[^"]+)?")*>\s*<\/\1>/gim,"").replace(/\n/gm,"").replace(/<a.*?href=[""'](.*?)[""'].*?>(.*?)<\/a>/gim,function(t,e,n){return"["+n.trim().replace(/<(.)?br(.)?>/g,"")+"]("+e+")"}).replace(/<strong>(?:\s*)(.*?)(\s)*?<\/strong>/gim,s).replace(/<b>(?:\s*)(.*?)(\s*)?<\/b>/gim,s).replace(/<em>(?:\s*)(.*?)(\s*)?<\/em>/gim,r).replace(/<i>(?:\s*)(.*?)(\s*)?<\/i>/gim,r);var p,b;for(p in l)l.hasOwnProperty(p)&&(b=l[p],!n.isUndefined(b.toMarkdown)&&n.isFunction(b.toMarkdown)&&(c=b.toMarkdown(c)));c=c.replace(/([^<>]+)(<div>)/g,"$1\n$2").replace(/<div><div>/g,"\n<div>").replace(/(?:<div>)([^<>]+)(?:<div>)/g,"$1\n").replace(/(?:<div>)(?:<br>)?([^<>]+)(?:<br>)?(?:<\/div>)/g,"$1\n").replace(/<\/p>/g,"\n\n").replace(/<(.)?br(.)?>/g,"\n").replace(/</g,"<").replace(/>/g,">");var m;return a.hasOwnProperty(i)&&(m=a[i],!n.isUndefined(m.prototype.toMarkdown)&&n.isFunction(m.prototype.toMarkdown)&&(c=m.prototype.toMarkdown(c))),c=c.replace(/<\/?[^>]+(>|$)/g,"")}},{"./blocks":73,"./formatters":91,"./lodash":97,"./utils":103}],103:[function(t,e){"use strict";var n=t("./lodash"),o=t("./config"),i=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/,s={log:function(){!n.isUndefined(console)&&o.debug&&console.log.apply(console,arguments)},isURI:function(t){return i.test(t)},titleize:function(t){return null===t?"":(t=String(t).toLowerCase(),t.replace(/(?:^|\s|-)\S/g,function(t){return t.toUpperCase()}))},classify:function(t){return s.titleize(String(t).replace(/[\W_]/g," ")).replace(/\s/g,"")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()},flatten:function(t){var e={};return(Array.isArray(t)?t:Object.keys(t)).forEach(function(t){e[t]=!0}),e},underscored:function(t){return t.trim().replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},reverse:function(t){return t.split("").reverse().join("")},toSlug:function(t){return t.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-")}};e.exports=s},{"./config":79,"./lodash":97}],104:[function(){"use strict";[].includes||(Array.prototype.includes=function(t){if(void 0===this||null===this)throw new TypeError("Cannot convert this value to object");var e=Object(this),n=parseInt(e.length)||0;if(0===n)return!1;var o,i=parseInt(arguments[1])||0;for(i>=0?o=i:(o=n+i,0>o&&(o=0));n>o;){var s=e[o];if(t===s||t!==t&&s!==s)return!0;o++}return!1})},{}]},{},[1])(1)});
| 21,503 | 32,205 | 0.701379 |
c1eeaf1e33d22da8645cedaf681e31d6065c7afc | 2,329 | js | JavaScript | website/pages/en/help.js | team-alembic/react-native-elements | 1570126cea67da8f87f00940f07cd3d404da6418 | [
"MIT"
] | 5 | 2019-02-09T20:27:05.000Z | 2021-05-14T20:49:09.000Z | website/pages/en/help.js | team-alembic/react-native-elements | 1570126cea67da8f87f00940f07cd3d404da6418 | [
"MIT"
] | 22 | 2020-01-09T07:20:06.000Z | 2021-06-25T15:30:58.000Z | website/pages/en/help.js | team-alembic/react-native-elements | 1570126cea67da8f87f00940f07cd3d404da6418 | [
"MIT"
] | 4 | 2020-03-29T08:01:23.000Z | 2022-01-01T15:24:23.000Z | const React = require('react');
const { Container, GridBlock } = require('../../core/CompLibrary');
const Help = props => {
const { config: siteConfig, language = '' } = props;
const { baseUrl, docsUrl } = siteConfig;
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
const langPart = `${language ? `${language}/` : ''}`;
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
const supportLinks = [
{
content: `Learn more using the [documentation on this site.](${docUrl(
'getting_started.html'
)})`,
title: 'Browse Docs',
},
{
content:
'Ask questions about the documentation and project in our [Slack.](https://reactnativetraining.herokuapp.com/)',
title: 'Join the community',
},
{
content: `Find out what's new for each release by checking the [releases tab on the Github repo.](https://github.com/react-native-training/react-native-elements/releases)`,
title: 'Stay up to date',
},
];
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer documentContainer postContainer">
<div className="post">
<header className="postHeader">
<h2>Need help?</h2>
</header>
<p>
Even with the great documentation, you're likely to get stuck at
some point. If you've encountered a bug with React Native Elements,
please{' '}
<a
href="https://github.com/react-native-training/react-native-elements/issues/new"
target="_blank"
rel="noopener noreferrer"
>
post an issue
</a>{' '}
and one of our maintainers will happily reach out to you. No
question's too silly to ask but we recommend checking the
documentation and{' '}
<a
href="https://github.com/react-native-training/react-native-elements/issues?utf8=✓&q="
target="_blank"
rel="noopener noreferrer"
>
existing issues
</a>{' '}
before opening and a new one.
</p>
<GridBlock contents={supportLinks} layout="threeColumn" />
</div>
</Container>
</div>
);
};
module.exports = Help;
| 34.761194 | 178 | 0.568914 |
c1eedb06f8d9c408acc360f0b08848446d530a79 | 5,793 | js | JavaScript | public/js/rss.js | Hyeonsj/rss | 1bd61308fb6856e3b609582b952b078f0e646902 | [
"Apache-2.0"
] | null | null | null | public/js/rss.js | Hyeonsj/rss | 1bd61308fb6856e3b609582b952b078f0e646902 | [
"Apache-2.0"
] | 7 | 2015-06-03T03:43:50.000Z | 2015-06-03T03:53:52.000Z | public/js/rss.js | Hyeonsj/rss | 1bd61308fb6856e3b609582b952b078f0e646902 | [
"Apache-2.0"
] | null | null | null | /**
* Created by hyeonseungjae on 15. 5. 30..
*/
jQuery(function($){
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
if($("#wrapper").hasClass("toggled")){
$("#container_warpper").css("margin-left", "8.5%");
}
else{
$("#container_warpper").css("margin-left", "0");
}
});
});
jQuery(document).ready(function($){
$('#menu').metisMenu({
toggle: false
});
$(document).on('click', ".dropdown-menu li a", function(){
var $selected_type = $(this).attr("data-menu-type");
var $rss_url = $(document).find("#page-content-wrapper .container #container_warpper .rss_url").val();
var $tag_i = $(this).closest(".dropdown-menu").siblings(".dropdown-toggle").find(".fa");
if($selected_type == "list"){
$tag_i.removeClass("fa-th").removeClass("fa-th-list").addClass("fa-bars");
}
else if($selected_type == "gally"){
$tag_i.removeClass("fa-th-list").removeClass("fa-bars").addClass("fa-th");
}
else if($selected_type == "blog"){
$tag_i.removeClass("fa-th").removeClass("fa-bars").addClass("fa-th-list");
}
$.ajax({
url:"/rss/getContent/",
data: "rss_url="+$rss_url+"&view_type="+$selected_type,
type:"post",
dataType:'json',
success:function(json){
if(json.status=='success') {
var $data = json.data;
console.log(json.data);
if($data.view_type == "blog"){
$("#rss_content").removeClass("list-group").removeClass("gally").addClass("blog-group");
}
else if($data.view_type == "gally"){
$("#rss_content").removeClass("list-group").removeClass("blog-group").addClass("gally");
}
else if($data.view_type == "list"){
$("#rss_content").removeClass("gally").removeClass("blog-group").addClass("list-group");
}
$("#rss_content").html($data.html);
var $content_img = $("#rss_content .item .rss_img");
for(var $index = 1; $index <=$content_img.length; $index++){
if($data.image_list[$index-1] != ""){
$content_img.eq($index).attr("src", $data.image_list[$index-1]);
}
else{
$content_img.eq($index).css("display", "none");
}
}
}
else {
alert(json.message);
}
},
error:function(data){
alert("error");
}
});
});
$("#menu ul.collapse a").on("click", function(){
var $rss_url = $(this).attr("data-rss-url");
$(document).find("#page-content-wrapper .container #container_warpper .rss_url").val($rss_url);
$.ajax({
url:"/rss/getContent/",
data: "rss_url="+$rss_url+"",
type:"post",
dataType:'json',
success:function(json){
if(json.status=='success') {
var $data = json.data;
console.log($data);
if($data.view_type == "blog"){
$("#rss_content").removeClass("list-group").removeClass("gally").addClass("blog-group");
}
else if($data.view_type == "gally"){
$("#rss_content").removeClass("list-group").removeClass("blog-group").addClass("gally");
}
else if($data.view_type == "list"){
$("#rss_content").removeClass("gally").removeClass("blog-group").addClass("list-group");
}
$("#rss_content").html($data.html);
var $content_img = $("#rss_content .item .rss_img");
for(var $index = 1; $index <=$content_img.length; $index++){
if($data.image_list[$index-1] != ""){
$content_img.eq($index).attr("src", $data.image_list[$index-1]);
}
else{
$content_img.eq($index).css("display", "none");
}
}
}
else {
alert(json.message);
}
},
error:function(data){
alert("error");
}
});
});
$("#upload-rss").change(function(){
var $formFile = $(this);
var $form = $formFile.parents("form");
$form.ajaxSubmit({
url:"/rss/upload",
dataType:'json',
type:'post',
iframe:true,
target:'#hidden-iframe',
success:function(json) {
if(json.status == "success") {
$("#menu1").html(json.data);
console.log(json.data);
}
else if(json.status == "failure") {
alert(json.message);
}
},
error:function(data) {
alert("error");
},
complete:function () {
//if ($.browser.msie) {
// $formFile.replaceWith($formFile.clone());
//}
//else {
// $formFile.val('');
//}
}
});
return false;
});
}); | 34.89759 | 112 | 0.425686 |
c1ef3a8ccb902fb6816d9005fc0b92fd4a5ab72f | 108 | js | JavaScript | server/index.js | GrantJenk/ShieldBattery | 3aa04204f295778decc2895787d7eb4d0d2fb35e | [
"MIT"
] | null | null | null | server/index.js | GrantJenk/ShieldBattery | 3aa04204f295778decc2895787d7eb4d0d2fb35e | [
"MIT"
] | null | null | null | server/index.js | GrantJenk/ShieldBattery | 3aa04204f295778decc2895787d7eb4d0d2fb35e | [
"MIT"
] | null | null | null | require('dotenv').config()
process.env.BABEL_ENV = 'node'
require('../babel-register')
require('./app.js')
| 18 | 30 | 0.685185 |
c1ef6249f68a4bb057502aad59c5aedf9039c684 | 1,152 | js | JavaScript | src/BreadCrumb/__stories__/BreadCrumb.stories.js | gurubamal/Stardust | c10a5f56b6de9cf27a18e9319a86c75d09adf6c0 | [
"Apache-2.0"
] | 15 | 2018-12-17T09:39:02.000Z | 2021-01-19T00:38:10.000Z | src/BreadCrumb/__stories__/BreadCrumb.stories.js | gurubamal/Stardust | c10a5f56b6de9cf27a18e9319a86c75d09adf6c0 | [
"Apache-2.0"
] | 453 | 2018-11-06T14:00:19.000Z | 2022-02-26T09:53:39.000Z | src/BreadCrumb/__stories__/BreadCrumb.stories.js | gurubamal/Stardust | c10a5f56b6de9cf27a18e9319a86c75d09adf6c0 | [
"Apache-2.0"
] | 4 | 2018-12-14T12:54:24.000Z | 2022-02-09T13:38:27.000Z | import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs, optionsKnob } from '@storybook/addon-knobs';
import withDocs from 'storybook-readme/with-docs';
import Wrapper from '../../Wrapper';
import BreadCrumb from '..';
import BreadCrumbReadme from '../README.md';
storiesOf('BreadCrumb', module)
.addDecorator(withKnobs)
.addDecorator(withDocs(BreadCrumbReadme)) // Show readme around story
.addParameters({
readme: {
includePropTables: [BreadCrumb], // won't work right now because of wrapped styled-comp https://github.com/tuchk4/storybook-readme/issues/177
},
})
.add('with customizable properties', () => {
const paths = { path: 'path', to: 'to', the: 'the', current: 'current', page: 'page' };
const pathsToDisplay = optionsKnob(
'Paths to display',
paths,
Object.values(paths),
{ display: 'multi-select' },
'State',
);
return (
<Wrapper>
<BreadCrumb>
{pathsToDisplay.map(path => (
<BreadCrumb.Item key={path}>{path}</BreadCrumb.Item>
))}
</BreadCrumb>
</Wrapper>
);
});
| 29.538462 | 147 | 0.628472 |
c1ef88a1ec7aca309fb73e3aa5f541e9db796127 | 11,054 | js | JavaScript | packages/wizzi.proto/express/packi/static/webpack/packi/vendors-node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js.92743511a58c984f1cb5.chunk.js | stfnbssl/wizzi | d05d2e6b39f6425112942d8de9a4556e0ad99ba7 | [
"MIT"
] | null | null | null | packages/wizzi.proto/express/packi/static/webpack/packi/vendors-node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js.92743511a58c984f1cb5.chunk.js | stfnbssl/wizzi | d05d2e6b39f6425112942d8de9a4556e0ad99ba7 | [
"MIT"
] | null | null | null | packages/wizzi.proto/express/packi/static/webpack/packi/vendors-node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js.92743511a58c984f1cb5.chunk.js | stfnbssl/wizzi | d05d2e6b39f6425112942d8de9a4556e0ad99ba7 | [
"MIT"
] | null | null | null | (self["webpackChunkwizzi_editor"] = self["webpackChunkwizzi_editor"] || []).push([["vendors-node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js"],{
/***/ "./node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js":
/*!**********************************************************************!*\
!*** ./node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "conf": () => (/* binding */ conf),
/* harmony export */ "language": () => (/* binding */ language)
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var conf = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/']
},
brackets: [
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: "'", close: "'", notIn: ['string', 'comment'] },
{ open: '"', close: '"', notIn: ['string', 'comment'] }
],
surroundingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '<', close: '>' },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
]
};
var language = {
defaultToken: '',
tokenPostfix: '.ecl',
ignoreCase: true,
brackets: [
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.square' },
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
{ open: '<', close: '>', token: 'delimiter.angle' }
],
pounds: [
'append',
'break',
'declare',
'demangle',
'end',
'for',
'getdatatype',
'if',
'inmodule',
'loop',
'mangle',
'onwarning',
'option',
'set',
'stored',
'uniquename'
].join('|'),
keywords: [
'__compressed__',
'after',
'all',
'and',
'any',
'as',
'atmost',
'before',
'beginc',
'best',
'between',
'case',
'cluster',
'compressed',
'compression',
'const',
'counter',
'csv',
'default',
'descend',
'embed',
'encoding',
'encrypt',
'end',
'endc',
'endembed',
'endmacro',
'enum',
'escape',
'except',
'exclusive',
'expire',
'export',
'extend',
'fail',
'few',
'fileposition',
'first',
'flat',
'forward',
'from',
'full',
'function',
'functionmacro',
'group',
'grouped',
'heading',
'hole',
'ifblock',
'import',
'in',
'inner',
'interface',
'internal',
'joined',
'keep',
'keyed',
'last',
'left',
'limit',
'linkcounted',
'literal',
'little_endian',
'load',
'local',
'locale',
'lookup',
'lzw',
'macro',
'many',
'maxcount',
'maxlength',
'min skew',
'module',
'mofn',
'multiple',
'named',
'namespace',
'nocase',
'noroot',
'noscan',
'nosort',
'not',
'noxpath',
'of',
'onfail',
'only',
'opt',
'or',
'outer',
'overwrite',
'packed',
'partition',
'penalty',
'physicallength',
'pipe',
'prefetch',
'quote',
'record',
'repeat',
'retry',
'return',
'right',
'right1',
'right2',
'rows',
'rowset',
'scan',
'scope',
'self',
'separator',
'service',
'shared',
'skew',
'skip',
'smart',
'soapaction',
'sql',
'stable',
'store',
'terminator',
'thor',
'threshold',
'timelimit',
'timeout',
'token',
'transform',
'trim',
'type',
'unicodeorder',
'unordered',
'unsorted',
'unstable',
'update',
'use',
'validate',
'virtual',
'whole',
'width',
'wild',
'within',
'wnotrim',
'xml',
'xpath'
],
functions: [
'abs',
'acos',
'aggregate',
'allnodes',
'apply',
'ascii',
'asin',
'assert',
'asstring',
'atan',
'atan2',
'ave',
'build',
'buildindex',
'case',
'catch',
'choose',
'choosen',
'choosesets',
'clustersize',
'combine',
'correlation',
'cos',
'cosh',
'count',
'covariance',
'cron',
'dataset',
'dedup',
'define',
'denormalize',
'dictionary',
'distribute',
'distributed',
'distribution',
'ebcdic',
'enth',
'error',
'evaluate',
'event',
'eventextra',
'eventname',
'exists',
'exp',
'fail',
'failcode',
'failmessage',
'fetch',
'fromunicode',
'fromxml',
'getenv',
'getisvalid',
'global',
'graph',
'group',
'hash',
'hash32',
'hash64',
'hashcrc',
'hashmd5',
'having',
'httpcall',
'httpheader',
'if',
'iff',
'index',
'intformat',
'isvalid',
'iterate',
'join',
'keydiff',
'keypatch',
'keyunicode',
'length',
'library',
'limit',
'ln',
'loadxml',
'local',
'log',
'loop',
'map',
'matched',
'matchlength',
'matchposition',
'matchtext',
'matchunicode',
'max',
'merge',
'mergejoin',
'min',
'nofold',
'nolocal',
'nonempty',
'normalize',
'nothor',
'notify',
'output',
'parallel',
'parse',
'pipe',
'power',
'preload',
'process',
'project',
'pull',
'random',
'range',
'rank',
'ranked',
'realformat',
'recordof',
'regexfind',
'regexreplace',
'regroup',
'rejected',
'rollup',
'round',
'roundup',
'row',
'rowdiff',
'sample',
'sequential',
'set',
'sin',
'sinh',
'sizeof',
'soapcall',
'sort',
'sorted',
'sqrt',
'stepped',
'stored',
'sum',
'table',
'tan',
'tanh',
'thisnode',
'topn',
'tounicode',
'toxml',
'transfer',
'transform',
'trim',
'truncate',
'typeof',
'ungroup',
'unicodeorder',
'variance',
'wait',
'which',
'workunit',
'xmldecode',
'xmlencode',
'xmltext',
'xmlunicode'
],
typesint: ['integer', 'unsigned'].join('|'),
typesnum: ['data', 'qstring', 'string', 'unicode', 'utf8', 'varstring', 'varunicode'],
typesone: [
'ascii',
'big_endian',
'boolean',
'data',
'decimal',
'ebcdic',
'grouped',
'integer',
'linkcounted',
'pattern',
'qstring',
'real',
'record',
'rule',
'set of',
'streamed',
'string',
'token',
'udecimal',
'unicode',
'unsigned',
'utf8',
'varstring',
'varunicode'
].join('|'),
operators: ['+', '-', '/', ':=', '<', '<>', '=', '>', '\\', 'and', 'in', 'not', 'or'],
symbols: /[=><!~?:&|+\-*\/\^%]+/,
// escape sequences
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
[/@typesint[4|8]/, 'type'],
[/#(@pounds)/, 'type'],
[/@typesone/, 'type'],
[
/[a-zA-Z_$][\w-$]*/,
{
cases: {
'@functions': 'keyword.function',
'@keywords': 'keyword',
'@operators': 'operator'
}
}
],
// whitespace
{ include: '@whitespace' },
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[
/@symbols/,
{
cases: {
'@operators': 'delimiter',
'@default': ''
}
}
],
// numbers
[/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?/, 'number.float'],
[/0[xX][0-9a-fA-F_]+/, 'number.hex'],
[/0[bB][01]+/, 'number.hex'],
[/[0-9_]+/, 'number'],
// delimiter: after number because of .\d floats
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid'],
[/"/, 'string', '@string'],
// characters
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
whitespace: [
[/[ \t\v\f\r\n]+/, ''],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment']
],
comment: [
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment']
],
string: [
[/[^\\']+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/'/, 'string', '@pop']
]
}
};
/***/ })
}]);
//# sourceMappingURL=vendors-node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js.92743511a58c984f1cb5.chunk.js.map | 23.222689 | 156 | 0.363126 |
c1efeccd66dbdee5a5ef162f1696bda1d043e4b7 | 12,262 | js | JavaScript | settings.js | MrChen131217/dsp-calculator | 23151c8f0e65c98cda42ef9debb482d7b067cd91 | [
"Apache-2.0"
] | 2 | 2021-02-03T10:32:56.000Z | 2021-02-27T05:45:19.000Z | settings.js | MrChen131217/dsp-calculator | 23151c8f0e65c98cda42ef9debb482d7b067cd91 | [
"Apache-2.0"
] | 1 | 2021-02-08T13:50:10.000Z | 2021-02-08T13:50:10.000Z | settings.js | MrChen131217/dsp-calculator | 23151c8f0e65c98cda42ef9debb482d7b067cd91 | [
"Apache-2.0"
] | 6 | 2021-02-20T07:22:09.000Z | 2022-02-15T07:30:24.000Z | /*Copyright 2019 Kirk McDonald
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.*/
import {DEFAULT_RATE, DEFAULT_RATE_PRECISION, DEFAULT_COUNT_PRECISION, longRateNames} from "./align.js"
import {dropdown} from "./dropdown.js"
import {DEFAULT_TAB, clickTab} from "./events.js"
import {spec, resourcePurities, DEFAULT_BELT, DEFAULT_ASSEMBLER} from "./factory.js"
import {Rational} from "./rational.js"
// There are several things going on with this control flow. Settings should
// work like this:
// 1) Settings are parsed from the URL fragment into the settings Map.
// 2) Each setting's `render` function is called.
// 3) If the setting is not present in the map, a default value is used.
// 4) The setting is applied.
// 5) The setting's GUI is placed into a consistent state.
// Remember to add the setting to fragment.js, too!
// tab
function renderTab(settings) {
let tabName = DEFAULT_TAB
if (settings.has("tab")) {
tabName = settings.get("tab")
}
clickTab(tabName)
}
// build targets
function renderTargets(settings) {
spec.buildTargets = []
d3.select("#targets li.target").remove()
let targetSetting = settings.get("items")
if (targetSetting !== undefined && targetSetting !== "") {
let targets = targetSetting.split(",")
for (let targetString of targets) {
let parts = targetString.split(":")
let itemKey = parts[0]
let target = spec.addTarget(itemKey)
let type = parts[1]
if (type === "f") {
target.setBuildings(parts[2])
} else if (type === "r") {
target.setRate(parts[2])
} else {
throw new Error("unknown target type")
}
}
} else {
spec.addTarget()
}
}
// ignore
function renderIgnore(settings) {
spec.ignore.clear()
// UI will be rendered later, as part of the solution.
let ignoreSetting = settings.get("ignore")
if (ignoreSetting !== undefined && ignoreSetting !== "") {
let ignore = ignoreSetting.split(",")
for (let recipeKey of ignore) {
let recipe = spec.recipes.get(recipeKey)
spec.ignore.add(recipe)
}
}
}
// overclock
function renderOverclock(settings) {
spec.overclock.clear()
// UI will be rendered later, as part of the solution.
let overclockSetting = settings.get("overclock")
if (overclockSetting !== undefined && overclockSetting !== "") {
let overclock = overclockSetting.split(",")
for (let pair of overclock) {
let [recipeKey, percentString] = pair.split(":")
let recipe = spec.recipes.get(recipeKey)
let percent = Rational.from_string(percentString).div(Rational.from_float(100))
spec.setOverclock(recipe, percent)
}
}
}
// display rate
function rateHandler() {
spec.format.setDisplayRate(this.value)
spec.updateSolution()
}
function renderRateOptions(settings) {
let rateName = DEFAULT_RATE
if (settings.has("rate")) {
rateName = settings.get("rate")
}
spec.format.setDisplayRate(rateName)
let rates = []
for (let [rateName, longRateName] of longRateNames) {
rates.push({rateName, longRateName})
}
let form = d3.select("#display_rate")
form.selectAll("*").remove()
let rateOption = form.selectAll("span")
.data(rates)
.join("span")
rateOption.append("input")
.attr("id", d => d.rateName + "_rate")
.attr("type", "radio")
.attr("name", "rate")
.attr("value", d => d.rateName)
.attr("checked", d => d.rateName === rateName ? "" : null)
.on("change", rateHandler)
rateOption.append("label")
.attr("for", d => d.rateName + "_rate")
.text(d => "items/" + d.longRateName)
rateOption.append("br")
}
// precisions
function renderPrecisions(settings) {
spec.format.ratePrecision = DEFAULT_RATE_PRECISION
if (settings.has("rp")) {
spec.format.ratePrecision = Number(settings.get("rp"))
}
d3.select("#rprec").attr("value", spec.format.ratePrecision)
spec.format.countPrecision = DEFAULT_COUNT_PRECISION
if (settings.has("cp")) {
spec.format.countPrecision = Number(settings.get("cp"))
}
d3.select("#cprec").attr("value", spec.format.countPrecision)
}
// belt
function beltHandler(belt) {
spec.belt = belt
spec.updateSolution()
}
function renderBelts(settings) {
let beltKey = DEFAULT_BELT
if (settings.has("belt")) {
beltKey = settings.get("belt")
}
spec.belt = spec.belts.get(beltKey)
let belts = []
for (let [beltKey, belt] of spec.belts) {
belts.push(belt)
}
let form = d3.select("#belt_selector")
form.selectAll("*").remove()
let beltOption = form.selectAll("span")
.data(belts)
.join("span")
beltOption.append("input")
.attr("id", d => "belt." + d.key)
.attr("type", "radio")
.attr("name", "belt")
.attr("value", d => d.key)
.attr("checked", d => d === spec.belt ? "" : null)
.on("change", beltHandler)
beltOption.append("label")
.attr("for", d => "belt." + d.key)
.append("img")
.classed("icon", true)
.attr("src", d => d.iconPath())
.attr("width", 32)
.attr("height", 32)
.attr("title", d => d.name)
}
// assembler
function assemblerHandler(assembler) {
spec.assembler = assembler
spec.updateSolution()
}
function renderAssemblers(settings) {
let assemblerKey = DEFAULT_ASSEMBLER
if (settings.has("assembler")) {
assemblerKey = settings.get("assembler")
}
spec.assembler = spec.assemblers.get(assemblerKey)
let assemblers = []
for (let [assemblerKey, assembler] of spec.assemblers) {
assemblers.push(assembler)
}
let form = d3.select("#assembler_selector")
form.selectAll("*").remove()
let assemblerOption = form.selectAll("span")
.data(assemblers)
.join("span")
assemblerOption.append("input")
.attr("id", d => "assembler." + d.key)
.attr("type", "radio")
.attr("name", "assembler")
.attr("value", d => d.key)
.attr("checked", d => d === spec.assembler ? "" : null)
.on("change", assemblerHandler)
assemblerOption.append("label")
.attr("for", d => "assembler." + d.key)
.append("img")
.classed("icon", true)
.attr("src", d => d.iconPath())
.attr("width", 32)
.attr("height", 32)
.attr("title", d => d.name)
}
// alternate recipes
function changeAltRecipe(recipe) {
spec.setRecipe(recipe)
spec.updateSolution()
}
function renderIngredient(ingSpan) {
ingSpan.classed("ingredient", true)
.attr("title", d => d.item.name)
.append("img")
.classed("icon", true)
.attr("src", d => d.item.iconPath())
ingSpan.append("span")
.classed("count", true)
.text(d => spec.format.count(d.amount))
}
function renderAltRecipes(settings) {
spec.altRecipes = new Map()
if (settings.has("alt")) {
let alt = settings.get("alt").split(",")
for (let recipeKey of alt) {
let recipe = spec.recipes.get(recipeKey)
spec.setRecipe(recipe)
}
}
let items = []
for (let tier of spec.itemTiers) {
for (let item of tier) {
if (item.recipes.length > 1) {
items.push(item)
}
}
}
let div = d3.select("#alt_recipe_settings")
div.selectAll("*").remove()
let dropdowns = div.selectAll("div")
.data(items)
.enter().append("div")
let recipeLabel = dropdown(
dropdowns,
d => d.recipes,
d => `altrecipe-${d.product.item.key}`,
d => spec.getRecipe(d.product.item) === d,
changeAltRecipe,
)
let productSpan = recipeLabel.append("span")
.selectAll("span")
.data(d => [d.product])
.join("span")
renderIngredient(productSpan)
recipeLabel.append("span")
.classed("arrow", true)
.text("\u21d0")
let ingredientSpan = recipeLabel.append("span")
.selectAll("span")
.data(d => d.ingredients)
.join("span")
renderIngredient(ingredientSpan)
}
// miners
function mineHandler(d) {
spec.setMiner(d.recipe, d.miner, d.purity)
spec.updateSolution()
}
function renderResources(settings) {
spec.initMinerSettings()
if (settings.has("miners")) {
let miners = settings.get("miners").split(",")
for (let minerString of miners) {
let [recipeKey, minerKey, purityKey] = minerString.split(":")
let recipe = spec.recipes.get(recipeKey)
let miner = spec.miners.get(minerKey)
let purity = resourcePurities[Number(purityKey)]
spec.setMiner(recipe, miner, purity)
}
}
let div = d3.select("#resource_settings")
div.selectAll("*").remove()
let resources = []
for (let [recipe, {miner, purity}] of spec.minerSettings) {
let minerDefs = spec.buildings.get(recipe.category)
let purities = []
for (let purityDef of resourcePurities) {
let miners = []
for (let minerDef of spec.buildings.get(recipe.category)) {
let selected = miner === minerDef && purity === purityDef
miners.push({
recipe: recipe,
purity: purityDef,
miner: minerDef,
selected: selected,
id: `miner.${recipe.key}.${purityDef.key}.${minerDef.key}`
})
}
purities.push({miners, purityDef})
}
resources.push({recipe, purities, minerDefs})
}
let resourceTable = div.selectAll("table")
.data(resources)
.join("table")
.classed("resource", true)
let header = resourceTable.append("tr")
header.append("th")
.append("img")
.classed("icon", true)
.attr("src", d => d.recipe.iconPath())
.attr("width", 32)
.attr("height", 32)
.attr("title", d => d.recipe.name)
header.selectAll("th")
.filter((d, i) => i > 0)
.data(d => d.minerDefs)
.join("th")
.append("img")
.classed("icon", true)
.attr("src", d => d.iconPath())
.attr("width", 32)
.attr("height", 32)
.attr("title", d => d.name)
let purityRow = resourceTable.selectAll("tr")
.filter((d, i) => i > 0)
.data(d => d.purities)
.join("tr")
purityRow.append("td")
.text(d => d.purityDef.name)
let cell = purityRow.selectAll("td")
.filter((d, i) => i > 0)
.data(d => d.miners)
.join("td")
cell.append("input")
.attr("id", d => d.id)
.attr("type", "radio")
.attr("name", d => d.recipe.key)
.attr("checked", d => d.selected ? "" : null)
.on("change", mineHandler)
cell.append("label")
.attr("for", d => d.id)
.append("svg")
.attr("viewBox", "0,0,32,32")
.style("width", 32)
.style("height", 32)
.append("rect")
.attr("x", 0)
.attr("y", 0)
.attr("width", 32)
.attr("height", 32)
.attr("rx", 4)
.attr("ry", 4)
}
export function renderSettings(settings) {
renderTargets(settings)
renderIgnore(settings)
renderOverclock(settings)
renderRateOptions(settings)
renderPrecisions(settings)
renderBelts(settings)
renderAssemblers(settings)
renderAltRecipes(settings)
renderResources(settings)
renderTab(settings)
}
| 30.578554 | 103 | 0.582205 |
c1f066e4216854f636f7cf106b8e866ddccaf6f4 | 3,466 | js | JavaScript | src/js/ws_config.js | plenteum/plenteum-wallet-electron | f3f37717b3a3457d312fe402dec8ae7701aaa363 | [
"0BSD"
] | 2 | 2019-03-22T07:45:22.000Z | 2021-04-14T19:33:15.000Z | src/js/ws_config.js | plenteum/plenteum-wallet-electron | f3f37717b3a3457d312fe402dec8ae7701aaa363 | [
"0BSD"
] | 2 | 2021-05-08T09:43:17.000Z | 2022-03-25T18:39:05.000Z | src/js/ws_config.js | plenteum/plenteum-wallet-electron | f3f37717b3a3457d312fe402dec8ae7701aaa363 | [
"0BSD"
] | 6 | 2019-03-22T07:45:38.000Z | 2021-07-25T15:22:26.000Z | var config = {};
// self explanatory, your application name, descriptions, etc
config.appName = 'PlenteumWallet';
config.appDescription = 'Plenteum Wallet';
config.appSlogan = 'Transaction Fees, Eat our Dust!';
config.appId = 'com.plenteum.walletelectron';
config.appGitRepo = 'https://github.com/plenteum/plenteum-wallet-electron';
// default port number for your daemon (e.g. Plenteumd)
config.daemonDefaultRpcPort = 44016;
// wallet file created by this app will have this extension
config.walletFileDefaultExt = 'ple';
// change this to match your wallet service executable filename
config.walletServiceBinaryFilename = 'wallet-service';
// version of the bundled service (wallet-service)
config.walletServiceBinaryVersion = "v0.4.8";
// config file format supported by wallet service, possible values:
// ini --> for wallet service (or its forks) version <= v0.8.3
// json --> for wallet service (or its forks) version >= v0.8.4
config.walletServiceConfigFormat = "json";
// default port number for your wallet service (e.g. turtle-service)
config.walletServiceRpcPort = 8070;
// block explorer url, the [[TX_HASH]] will be substituted w/ actual transaction hash
config.blockExplorerUrl = 'http://block-explorer.plenteum.com/?hash=[[TX_HASH]]#blockchain_transaction';
// default remote node to connect to, set this to a known reliable node for 'just works' user experience
config.remoteNodeDefaultHost = 'two.public.plenteum.com';
// remote node list update url, set to null if you don't have one
config.remoteNodeListUpdateUrl = null;
// set to false if using raw/unfiltered node list
config.remoteNodeListFiltered = false;
// fallback remote node list, in case fetching update failed, fill this with known to works remote nodes
config.remoteNodeListFallback = [
'two.public.plenteum.com:44016',
'three.public.plenteum.com:44016'
];
// your currency name
config.assetName = 'Plenteum';
// your currency ticker
config.assetTicker = 'PLE';
// your currency address prefix, for address validation
config.addressPrefix = 'PLe';
// standard wallet address length, for address validation
config.addressLength = 98;
// integrated wallet address length, for address validation. Added length is length of payment ID encoded in base58.
config.integratedAddressLength = config.addressLength + ((64 * 11) / 8);
// minimum fee for sending transaction
config.minimumFee = 0.01;
// minimum amount for sending transaction
config.mininumSend = 0.1;
// default mixin/anonimity for transaction
config.defaultMixin = 3;
// to represent human readable value
config.decimalPlaces = 2;
// to convert from atomic unit
config.decimalDivisor = 100000000;
// obfuscate address book entries, set to false if you want to save it in plain json file.
// not for security because the encryption key is attached here
config.addressBookObfuscateEntries = true;
// key use to obfuscate address book contents
config.addressBookObfuscationKey = '79009fb00ca1b7130832a42de45142cf6c4b7f333fe6fba5';
// initial/sample entries to fill new address book
config.addressBookSampleEntries = [
{
name: 'Plenteum Wallet Donation',
address: 'PLearxtECBsKFLLeX3edPMEk4ncvZGkJQ7FpPyG3ADGtYbFj7FC5ELWXS2B7wRDfjwSqEwZVp7pwjbWCAhmGJp7z94TQzpNUkP',
paymentId: '',
}
];
// cipher config for private address book
config.addressBookCipherConfig = {
algorithm: 'aes-256-gcm',
saltLenght: 128,
pbkdf2Rounds: 10000,
pbkdf2Digest: 'sha512'
};
module.exports = config;
| 37.268817 | 118 | 0.768898 |
c1f0bfc3d8866d3cd9ce6e1dc8dcfe394858c47c | 4,246 | js | JavaScript | routes/index.js | RyanGladstone/screenshot-as-a-service | eb7ad99884721f6eb049a227012e0d703f8a8aa0 | [
"Unlicense",
"MIT"
] | 503 | 2015-01-03T19:40:48.000Z | 2022-02-11T16:40:50.000Z | routes/index.js | RyanGladstone/screenshot-as-a-service | eb7ad99884721f6eb049a227012e0d703f8a8aa0 | [
"Unlicense",
"MIT"
] | 16 | 2015-01-03T20:17:06.000Z | 2018-03-21T22:18:16.000Z | routes/index.js | RyanGladstone/screenshot-as-a-service | eb7ad99884721f6eb049a227012e0d703f8a8aa0 | [
"Unlicense",
"MIT"
] | 159 | 2015-01-08T23:35:37.000Z | 2021-12-26T02:01:52.000Z | var utils = require('../lib/utils');
var join = require('path').join;
var fs = require('fs');
var path = require('path');
var request = require('request');
module.exports = function(app, useCors) {
var rasterizerService = app.settings.rasterizerService;
var fileCleanerService = app.settings.fileCleanerService;
// routes
app.get('/', function(req, res, next) {
if (!req.param('url', false)) {
return res.redirect('/usage.html');
}
var url = utils.url(req.param('url'));
// required options
var options = {
uri: 'http://localhost:' + rasterizerService.getPort() + '/',
headers: { url: url }
};
['width', 'height', 'clipRect', 'javascriptEnabled', 'loadImages', 'localToRemoteUrlAccessEnabled', 'userAgent', 'userName', 'password', 'delay'].forEach(function(name) {
if (req.param(name, false)) options.headers[name] = req.param(name);
});
var filename = 'screenshot_' + utils.md5(url + JSON.stringify(options)) + '.png';
options.headers.filename = filename;
var filePath = join(rasterizerService.getPath(), filename);
var callbackUrl = req.param('callback', false) ? utils.url(req.param('callback')) : false;
if (fs.existsSync(filePath)) {
console.log('Request for %s - Found in cache', url);
processImageUsingCache(filePath, res, callbackUrl, function(err) { if (err) next(err); });
return;
}
console.log('Request for %s - Rasterizing it', url);
processImageUsingRasterizer(options, filePath, res, callbackUrl, function(err) { if(err) next(err); });
});
app.get('*', function(req, res, next) {
// for backwards compatibility, try redirecting to the main route if the request looks like /www.google.com
res.redirect('/?url=' + req.url.substring(1));
});
// bits of logic
var processImageUsingCache = function(filePath, res, url, callback) {
if (url) {
// asynchronous
res.send('Will post screenshot to ' + url + ' when processed');
postImageToUrl(filePath, url, callback);
} else {
// synchronous
sendImageInResponse(filePath, res, callback);
}
}
var processImageUsingRasterizer = function(rasterizerOptions, filePath, res, url, callback) {
if (url) {
// asynchronous
res.send('Will post screenshot to ' + url + ' when processed');
callRasterizer(rasterizerOptions, function(error) {
if (error) return callback(error);
postImageToUrl(filePath, url, callback);
});
} else {
// synchronous
callRasterizer(rasterizerOptions, function(error) {
if (error) return callback(error);
sendImageInResponse(filePath, res, callback);
});
}
}
var callRasterizer = function(rasterizerOptions, callback) {
request.get(rasterizerOptions, function(error, response, body) {
if (error || response.statusCode != 200) {
console.log('Error while requesting the rasterizer: %s', error.message);
rasterizerService.restartService();
return callback(new Error(body));
}
else if (body.indexOf('Error: ') == 0) {
var errmsg = body.substring(7);
console.log('Error while requesting the rasterizer: %s', errmsg);
return callback(new Error(errmsg));
}
callback(null);
});
}
var postImageToUrl = function(imagePath, url, callback) {
console.log('Streaming image to %s', url);
var fileStream = fs.createReadStream(imagePath);
fileStream.on('end', function() {
fileCleanerService.addFile(imagePath);
});
fileStream.on('error', function(err){
console.log('Error while reading file: %s', err.message);
callback(err);
});
fileStream.pipe(request.post(url, function(err) {
if (err) console.log('Error while streaming screenshot: %s', err);
callback(err);
}));
}
var sendImageInResponse = function(imagePath, res, callback) {
console.log('Sending image in response');
if (useCors) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Expose-Headers", "Content-Type");
}
res.sendfile(imagePath, function(err) {
fileCleanerService.addFile(imagePath);
callback(err);
});
}
};
| 34.803279 | 174 | 0.640838 |
c1f1007dc60544f97931ac197e4f8822bd241512 | 1,544 | js | JavaScript | crawlers/weis.js | carols10cents/pennsylvania-vaccines | 48f36e33b33e5ee2ab5c7599fc29075b9bed5548 | [
"MIT"
] | null | null | null | crawlers/weis.js | carols10cents/pennsylvania-vaccines | 48f36e33b33e5ee2ab5c7599fc29075b9bed5548 | [
"MIT"
] | null | null | null | crawlers/weis.js | carols10cents/pennsylvania-vaccines | 48f36e33b33e5ee2ab5c7599fc29075b9bed5548 | [
"MIT"
] | null | null | null | const fetch = require('node-fetch');
const dotenv = require('dotenv');
const {IncomingWebhook} = require('@slack/webhook');
const renderStaticSlackMessage = require('../utils/renderStaticSlackMessage');
dotenv.config();
const dataURL = 'https://c.ateb.com/8d8feb6dce7d4d598f753362d06d1e64/';
const scheduleURL = dataURL;
const name = 'Weis'
const url = process.env.SLACK_WEBHOOK_URL;
const webhook = new IncomingWebhook(url);
const options = {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "en-US,en;q=0.9",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1",
"User-Agent": process.env.USER_AGENT
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors"
};
const checkWeis = async () => {
console.log(`Checking ${name} for vaccines...`);
try {
(async () => {
try {
const response = await fetch(dataURL, options);
data = await response.text();
if (!data.includes('Appointments Full')) {
console.log(`${name} content: \n${data}`);
await webhook.send(renderStaticSlackMessage(scheduleURL, name));
}
} catch (e) {
console.error(e);
}
})();
} catch (e) {
console.error(e);
}
};
module.exports = checkWeis;
| 29.132075 | 152 | 0.626295 |
c1f106005fb3318d6bc4914f2c4b394b4f1f87a4 | 3,527 | js | JavaScript | src/diff/children.js | amnhh/virtual-dom-realization | b81b6d0f8dd2e7951b016c347d63ef39e0d76fe9 | [
"MIT"
] | null | null | null | src/diff/children.js | amnhh/virtual-dom-realization | b81b6d0f8dd2e7951b016c347d63ef39e0d76fe9 | [
"MIT"
] | null | null | null | src/diff/children.js | amnhh/virtual-dom-realization | b81b6d0f8dd2e7951b016c347d63ef39e0d76fe9 | [
"MIT"
] | null | null | null | const childrenResolver = require('./childrenResolver')
/**
* children diff 算法
* O(n) 复杂度对比两个 list
*/
module.exports = function childrenDiff (left, right, currentPatch, patch, idx) {
let listDiff = reorder(left.children, right.children)
}
function reorder (left, right) {
// 检测 right 里面是否都是无 key 节点
let rightChildIdx = childrenResolver(right)
let rightKeys = rightChildIdx.keysMap
let rightFree = rightChildIdx.freeList
// 如果说target树全是无 key 的节点,则没必要 reorder 了,完全重建就好了。。
if (rightFree.length === right.length) {
return {
children : right,
moves : null
}
}
// 检测 left 里是否都是无 key 节点
let leftChildIdx = childrenResolver(left)
let leftKeys = leftChildIdx.keysMap
let leftFree = leftChildIdx.freeList
// 如果说old树里全都是无 key 节点的话
// 则原来的那棵树没有利用价值,全部依据 target 树重建
if (leftFree.length === left.length) {
return {
children : right,
moves : null
}
}
// 新的子节点列表
let newChildList = []
// free 节点的起始 idx
// 用于左树中的节点没有 key 的时候
// 向 newChildList 中按顺序添加右树中的 free 节点
let freeIdx = 0
// free 节点的总个数
let freeCount = rightFree.length
// 删除的 items 的个数
let deletedItems = 0
for (let i = 0; i < left.length; i ++) {
// 把左树中当前循环的 item 索引取出来
let leftItem = left[i]
let itemIdx
// 如果说这个节点,是一个有 key 的节点
if (leftItem.key) {
// 如果说在右树中,也含有相同的 key
// 则这个节点,是需要的
// 则从右树中,把这个节点的引用拿到
// push 到新的子节点列表中
if (rightKeys.hasOwnProperty(leftItem.key)) {
itemIdx = rightKeys[leftItem.key]
newChildList.push(right[itemIdx])
} else {
// 如果没有在右树中,则这个节点是需要丢弃的节点
// 我们首先让 deletedItems 自增
// 然后向 newChildList 中 push null
deletedItems ++
newChildList.push(null)
}
} else {
// 如果说没有 key 的话,则向 newChildList 中 push 的是 free 节点
// 如果说当前右树中的 free 节点没有超过右树中的 free 节点的总数
// 则按顺序往里面放
if (freeIdx < freeCount) {
itemIdx = rightFree[freeIdx ++]
newChildList.push(right[itemIdx])
} else {
// 如果说右树中的 free 节点已经全部填放完毕
// 则不会继续向里面继续放节点了
// 对左树里面的这次循环的 child
// 做删除处理
deletedItems ++
newChildList.push(null)
}
}
}
// 记录下当前的剩下的 freeIdx 的位置
// 如果已经全部填充进 newChildList 了,则赋值为 right.length
// 如果没有,则赋值为剩下的 free item 的第一个节点的索引
let lastFreeIdx = freeIdx < freeCount
? rightFree[freeIdx]
: right.length
// 遍历右树
for (let i = 0; i < right.length; i ++) {
var newItem = right[i]
// 如果说右树中的这个节点有 key, 且不在左树中存在同名 key
// 则我们将其 push 到 newChildList 中
if (newItem.key) {
if (!leftKeys.hasOwnProperty(newItem.key)) {
newChildList.push(newItem)
}
} else {
// 在之前循环中,所有没用到的 free item
// 全部都 push 进来
// 现在在 newChildList 中存在的节点分别为:
// 1. 左树中,与右树中有同名 key 的节点
// 2. 右树中的 free item (左树中遍历无 key 节点时,填充的右树的 free item)
// 3. 右树中的有 key 节点,且在左树中没有同 key 节点
// 4. 右树中的其他 free item(保证 newChildList 中的 free item 个数,一定和右树相同)
if (i >= lastFreeIdx) {
newChildList.push(newItem)
}
}
}
} | 28.674797 | 80 | 0.534449 |
c1f110ce5a538fa69f9accb024318a1335ccc216 | 155 | js | JavaScript | app/assets/vue-resource/src/http/client/default.js | sameg14/pagekit | 803731ed95f0d849a1e043e70485d0bf31fcc215 | [
"MIT"
] | null | null | null | app/assets/vue-resource/src/http/client/default.js | sameg14/pagekit | 803731ed95f0d849a1e043e70485d0bf31fcc215 | [
"MIT"
] | null | null | null | app/assets/vue-resource/src/http/client/default.js | sameg14/pagekit | 803731ed95f0d849a1e043e70485d0bf31fcc215 | [
"MIT"
] | null | null | null | /**
* Default client.
*/
var xhrClient = require('./xhr');
module.exports = function (request) {
return (request.client || xhrClient)(request);
};
| 15.5 | 50 | 0.632258 |
c1f1b13b21b5a685641739a8e8ef3eb9479059d4 | 13,022 | js | JavaScript | src/visitors/heapRestore.js | txvnt/regenerator | 804ff412b5459471d821c0919f81feb4e0cc3ea6 | [
"MIT"
] | null | null | null | src/visitors/heapRestore.js | txvnt/regenerator | 804ff412b5459471d821c0919f81feb4e0cc3ea6 | [
"MIT"
] | null | null | null | src/visitors/heapRestore.js | txvnt/regenerator | 804ff412b5459471d821c0919f81feb4e0cc3ea6 | [
"MIT"
] | null | null | null | const t = require('babel-types');
function shallowCopy(object) {
return object;
}
module.exports = {
MemberExpression(path) {
if (
path.node.object &&
path.node.property &&
path.node.object.name == 'delorean' &&
(path.node.property.name == 'insertTimepoint' ||
path.node.property.name == 'insertBreakpoint')
) {
var snapshotCall = path.findParent((path) => path.isCallExpression());
var itIsInLoop = false;
parent = path.context.parentPath;
while (parent) {
parent = parent.context.parentPath;
if (parent) {
if (
parent.node.type == 'ForStatement' ||
parent.node.type == 'DoWhileStatement' ||
parent.node.type == 'WhileStatement'
) {
itIsInLoop = true;
break;
}
}
}
let copy = 'ldDeepCopy';
if (
document.getElementsByClassName('swtich-options selected-switch')[0].innerHTML ==
'Shallow Copy'
)
copy = shallowCopy;
//Stores all dependant variables in a temp global object.
/*
heap.dependencies.map(dependecy => {
if (eval('typeof ' + dependecy.name.toString() + '!=\'undefined\'')) {
tempValueStore[dependecy.name.toString()] = eval(dependecy.name.toString());
} else {
tempValueStore[dependecy.name.toString()] = undefined;
}
});
*/
snapshotCall.insertBefore(
t.expressionStatement(
t.callExpression(
t.memberExpression(
t.memberExpression(t.identifier('heap'), t.identifier('dependencies'), false),
t.identifier('map'),
false,
),
[
t.arrowFunctionExpression(
[t.identifier('dependecy')],
t.blockStatement(
[
t.ifStatement(
t.callExpression(t.identifier('eval'), [
t.binaryExpression(
'+',
t.binaryExpression(
'+',
t.stringLiteral('typeof '),
t.callExpression(
t.memberExpression(
t.memberExpression(
t.identifier('dependecy'),
t.identifier('name'),
false,
),
t.identifier('toString'),
false,
),
[],
),
),
t.stringLiteral("!='undefined'"),
),
]),
t.blockStatement([
t.expressionStatement(
t.assignmentExpression(
'=',
t.memberExpression(
t.identifier('tempValueStore'),
t.callExpression(
t.memberExpression(
t.memberExpression(
t.identifier('dependecy'),
t.identifier('name'),
false,
),
t.identifier('toString'),
false,
),
[],
),
true,
),
t.callExpression(t.identifier('eval'), [
t.callExpression(
t.memberExpression(
t.memberExpression(
t.identifier('dependecy'),
t.identifier('name'),
false,
),
t.identifier('toString'),
false,
),
[],
),
]),
),
),
]),
t.blockStatement([
t.expressionStatement(
t.assignmentExpression(
'=',
t.memberExpression(
t.identifier('tempValueStore'),
t.callExpression(
t.memberExpression(
t.memberExpression(
t.identifier('dependecy'),
t.identifier('name'),
false,
),
t.identifier('toString'),
false,
),
[],
),
true,
),
t.identifier('undefined'),
),
),
]),
),
],
[],
),
),
],
),
),
);
// Restores variables when coming back form the future.
/*
if (fromTheFuture) {
let snapshot = restoreHeap(startFrom);
dependencies.map(key => {
auxSnapshotValue = ldDeepCopy(snapshot[key.name]);
if (typeof auxSnapshotValue == 'object') {
updatedObj = updateProp(key.name, auxSnapshotValue);
eval(key.name + ' = updatedObj');
} else {
eval(key.name + ' = document.getElementById(\'input-' + key.name + '\').value || undefined || auxSnapshotValue;');
}
});
fromTheFuture = false;
}
*/
snapshotCall.insertAfter(
t.ifStatement(
t.identifier('fromTheFuture'),
t.blockStatement(
[
t.variableDeclaration('let', [
t.variableDeclarator(
t.identifier('snapshot'),
t.callExpression(t.identifier('restoreHeap'), [t.identifier('startFrom')]),
),
]),
t.expressionStatement(
t.callExpression(
t.memberExpression(t.identifier('dependencies'), t.identifier('map'), false),
[
t.arrowFunctionExpression(
[t.identifier('key')],
t.blockStatement([
t.ifStatement(
t.binaryExpression(
'!=',
t.unaryExpression(
'typeof',
t.memberExpression(
t.identifier('snapshot'),
t.memberExpression(
t.identifier('key'),
t.identifier('name'),
false,
),
true,
),
true,
),
t.stringLiteral('function'),
),
t.expressionStatement(
t.assignmentExpression(
'=',
t.identifier('auxSnapshotValue'),
t.callExpression(t.identifier(copy), [
t.memberExpression(
t.identifier('snapshot'),
t.memberExpression(
t.identifier('key'),
t.identifier('name'),
false,
),
true,
),
]),
),
),
t.expressionStatement(
t.assignmentExpression(
'=',
t.identifier('auxSnapshotValue'),
t.memberExpression(
t.identifier('snapshot'),
t.memberExpression(
t.identifier('key'),
t.identifier('name'),
false,
),
true,
),
),
),
),
t.ifStatement(
t.binaryExpression(
'==',
t.unaryExpression('typeof', t.identifier('auxSnapshotValue'), true),
t.stringLiteral('object'),
),
t.blockStatement(
[
t.expressionStatement(
t.assignmentExpression(
'=',
t.identifier('updatedObj'),
t.callExpression(t.identifier('updateProp'), [
t.identifier('key.name'),
t.identifier('auxSnapshotValue'),
]),
),
),
t.expressionStatement(
t.callExpression(t.identifier('eval'), [
t.binaryExpression(
'+',
t.memberExpression(t.identifier('key'), t.identifier('name')),
t.stringLiteral(' = updatedObj'),
),
]),
),
],
[],
),
t.blockStatement(
[
t.expressionStatement(
t.callExpression(t.identifier('eval'), [
t.binaryExpression(
'+',
t.binaryExpression(
'+',
t.binaryExpression(
'+',
t.memberExpression(
t.identifier('key'),
t.identifier('name'),
false,
),
t.stringLiteral(" = document.getElementById('input-"),
),
t.memberExpression(
t.identifier('key'),
t.identifier('name'),
false,
),
),
t.stringLiteral("').value || undefined || auxSnapshotValue;"),
),
]),
),
],
[],
),
),
]),
false,
),
],
),
),
t.expressionStatement(
t.assignmentExpression('=', t.identifier('fromTheFuture'), t.booleanLiteral(false)),
),
],
[],
),
null,
),
);
}
},
};
| 40.69375 | 142 | 0.294655 |
c1f231179b9c031324abd565d70e9b1ce1a3aec7 | 74 | js | JavaScript | sites/honkify/src/gatsby-theme-docs/scope.js | mhughdo/gatsby-intermediate | 4511f52ee52a49ef795ecbee09413e8e478d610f | [
"MIT"
] | null | null | null | sites/honkify/src/gatsby-theme-docs/scope.js | mhughdo/gatsby-intermediate | 4511f52ee52a49ef795ecbee09413e8e478d610f | [
"MIT"
] | 8 | 2021-03-10T11:00:17.000Z | 2022-02-27T01:14:32.000Z | sites/honkify/src/gatsby-theme-docs/scope.js | mhughdo/gatsby-intermediate | 4511f52ee52a49ef795ecbee09413e8e478d610f | [
"MIT"
] | null | null | null | import Button from '../components/button'
export default {
Button,
}
| 12.333333 | 41 | 0.689189 |
c1f31539b59692744d7eb8bfcef21912271bfc08 | 2,931 | js | JavaScript | osc-ui/src/main/webapp/VAADIN/widgetsets/org.osc.core.broker.view.AppWidgetSet/deferredjs/245447C530606D8016B70631DA41BE0D/5.cache.js | lakodali/osc-core | 5f006a1a543d79695dd86485cc15a016f2ea015e | [
"Apache-2.0"
] | null | null | null | osc-ui/src/main/webapp/VAADIN/widgetsets/org.osc.core.broker.view.AppWidgetSet/deferredjs/245447C530606D8016B70631DA41BE0D/5.cache.js | lakodali/osc-core | 5f006a1a543d79695dd86485cc15a016f2ea015e | [
"Apache-2.0"
] | null | null | null | osc-ui/src/main/webapp/VAADIN/widgetsets/org.osc.core.broker.view.AppWidgetSet/deferredjs/245447C530606D8016B70631DA41BE0D/5.cache.js | lakodali/osc-core | 5f006a1a543d79695dd86485cc15a016f2ea015e | [
"Apache-2.0"
] | null | null | null | $wnd.org_osc_core_broker_view_AppWidgetSet.runAsyncCallback5("function Inc(){}\nfunction Knc(){}\nfunction Mnc(){}\nfunction Onc(){}\nfunction Iyc(a,b){a.c=b}\nfunction Jyc(a,b){a.d=b}\nfunction tdd(){odd.call(this);this.a=xB(pUb(zab,this),2330)}\nfunction Hyc(a){a.c!=null&&(Xnb(a.a).style[QHe]=a.c,undefined)}\nfunction Kyc(){fob(this,(Ekb(),Hn($doc)));Ck(this.bc,THe);this.b=new wub;Wnb(this.b,joe);this.b._e('');this.a=new wub;lob(this.a,vob(this.bc)+'-area');Mj(this.bc,Xnb(this.b));Mj(this.bc,Xnb(this.a));Kob(this,this,(Zu(),Zu(),Yu))}\nfunction Enc(c){var d={setter:function(a,b){a.a=b},getter:function(a){return a.a}};c.yj(Aab,aoe,d);var d={setter:function(a,b){a.b=b.Ln()},getter:function(a){return _Ud(a.b)}};c.yj(Aab,Hve,d);var d={setter:function(a,b){a.c=b.Ln()},getter:function(a){return _Ud(a.c)}};c.yj(Aab,NHe,d)}\nHgb(1712,1,gne);_.vc=function Hnc(){bpc(this.b,Aab,u9);Toc(this.b,wse,H2);Voc(this.b,H2,Ase,new Inc);Voc(this.b,Aab,Ase,new Knc);_oc(this.b,H2,wpe,new Loc(YY));_oc(this.b,H2,Ene,new Loc(Aab));Voc(this.b,YY,OHe,new Mnc);Voc(this.b,YY,PHe,new Onc);Enc(this.b);Zoc(this.b,Aab,aoe,new Loc(mdb));Zoc(this.b,Aab,Hve,new Loc(Ocb));Zoc(this.b,Aab,NHe,new Loc(Ocb));Uoc(this.b,Aab,aoe,OHe);Uoc(this.b,Aab,Hve,PHe);Roc(this.b,H2,new Boc(LX,Fse,qB(mB(mdb,1),Kge,2,4,[Tve])));H6b((!A6b&&(A6b=new M6b),A6b),this.a.d)};Hgb(1714,1,Gwe,Inc);_.sj=function Jnc(a,b){return new tdd};var VW=HVd(Xqe,'ConnectorBundleLoaderImpl/5/1/1',1714);Hgb(1715,1,Gwe,Knc);_.sj=function Lnc(a,b){return new KPd};var WW=HVd(Xqe,'ConnectorBundleLoaderImpl/5/1/2',1715);Hgb(1716,1,Gwe,Mnc);_.sj=function Nnc(a,b){Iyc(xB(a,287),zB(b[0]));return null};var XW=HVd(Xqe,'ConnectorBundleLoaderImpl/5/1/3',1716);Hgb(1717,1,Gwe,Onc);_.sj=function Pnc(a,b){Jyc(xB(a,287),xB(b[0],164).a);return null};var YW=HVd(Xqe,'ConnectorBundleLoaderImpl/5/1/4',1717);Hgb(287,9,{49:1,52:1,15:1,7:1,13:1,14:1,132:1,108:1,12:1,16:1,11:1,9:1,287:1},Kyc);_.Cd=function Lyc(a){return Kob(this,a,(Zu(),Zu(),Yu))};_.xe=function Myc(a){var b;b=(Ekb(),smb((Xk(),a).type));switch(b){case 1:Tkb(Xnb(this.a),Wk.Rc(a))&&Oob(this,a);break;default:Oob(this,a);}};_.yd=function Nyc(a){Jyc(this,!this.d)};_.zf=function Oyc(a){this.b.zf(a)};_.Xe=function Pyc(a){this.a.Xe(a)};_.Ze=function Qyc(a){Dob((Ekb(),this.bc),a);lob(this.a,vob(this.bc)+'-area')};_.Af=function Ryc(a){this.b.Af(a)};_._e=function Syc(a){this.a._e(a)};_.c=null;_.d=false;var YY=HVd(Fne,'VColorPickerArea',287);Hgb(1713,740,RHe,tdd);_.yi=function udd(){return new Kyc};_.Wg=function vdd(){return !this.L&&(this.L=new Kyc),xB(this.L,287)};_.yd=function wdd(a){Xec(this.a,(!this.L&&(this.L=new Kyc),xB(this.L,287)).d)};_.Dl=function xdd(){Hyc((!this.L&&(this.L=new Kyc),xB(this.L,287)))};_.El=function ydd(a){tMb((!this.L&&(this.L=new Kyc),xB(this.L,287)),(!this.U&&(this.U=xHb(this)),xB(xB(this.U,6),212)))};var H2=HVd(SHe,Zwe,1713);xge(Th)(5);\n//# sourceURL=org.osc.core.broker.view.AppWidgetSet-5.js\n")
| 1,465.5 | 2,930 | 0.676902 |
c1f360a1bd944a669d5bd6870579206072f11a79 | 3,211 | js | JavaScript | node_modules/caniuse-lite/data/regions/PT.js | victorfconti/SIF | f744a6327fcd8798e8b913fc9116cb04e359d07d | [
"MIT"
] | 482 | 2019-03-07T17:45:28.000Z | 2022-03-31T15:46:03.000Z | node_modules/caniuse-lite/data/regions/PT.js | victorfconti/SIF | f744a6327fcd8798e8b913fc9116cb04e359d07d | [
"MIT"
] | 28 | 2019-10-31T13:15:27.000Z | 2022-03-30T23:13:59.000Z | node_modules/caniuse-lite/data/regions/PT.js | victorfconti/SIF | f744a6327fcd8798e8b913fc9116cb04e359d07d | [
"MIT"
] | 460 | 2019-03-09T19:07:05.000Z | 2022-03-31T22:52:58.000Z | module.exports={D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.007453,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.014906,"23":0,"24":0,"25":0,"26":0.007453,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.014906,"35":0,"36":0.007453,"37":0.007453,"38":0.037265,"39":0.007453,"40":0.007453,"41":0,"42":0,"43":0.208684,"44":0,"45":0,"46":0.007453,"47":0.007453,"48":0.007453,"49":0.655864,"50":0.007453,"51":0.007453,"52":0.007453,"53":0.037265,"54":0.014906,"55":0.022359,"56":0.022359,"57":0.014906,"58":0.037265,"59":0.014906,"60":0.037265,"61":0.07453,"62":0.037265,"63":0.07453,"64":0.07453,"65":0.104342,"66":0.07453,"67":0.193778,"68":0.22359,"69":0.134154,"70":0.268308,"71":14.704769,"72":20.771511,"73":0.059624,"74":0.014906,"75":0},C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.007453,"39":0,"40":0,"41":0,"42":0,"43":0.007453,"44":0,"45":0.007453,"46":0,"47":0.014906,"48":0.037265,"49":0.007453,"50":0.007453,"51":0.007453,"52":0.193778,"53":0.007453,"54":0.014906,"55":0.007453,"56":0.022359,"57":0.007453,"58":0.007453,"59":0.014906,"60":0.089436,"61":0.014906,"62":0.014906,"63":0.052171,"64":0.52171,"65":2.884311,"66":0.022359,"67":0,"3.5":0,"3.6":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0.022359,"37":0,"38":0.014906,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0.007453,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0.424821,"58":0.558975,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},E:{"4":0,"5":0,"6":0,"7":0.007453,"8":0.007453,"9":0.044718,"10":0.029812,"11":0.081983,"12":2.839593,_:"0","3.1":0,"3.2":0,"5.1":0.007453,"6.1":0.275761,"7.1":0,"9.1":0.089436,"10.1":0.171419,"11.1":0.432274,"12.1":0.007453},G:{"8":0.34599479665766,"3.2":0.0049251928349845,"4.0-4.1":0.0036938946262384,"4.2-4.3":0.0036938946262384,"5.0-5.1":0.013544280296207,"6.0-6.1":0.0086190874612229,"7.0-7.1":0.028319858801161,"8.1-8.4":0.067721401481037,"9.0-9.2":0.035707648053638,"9.3":0.26349781667167,"10.0-10.2":0.16499395997198,"10.3":0.34230090203142,"11.0-11.2":0.44696124977484,"11.3-11.4":1.0712294416091,"12.0-12.1":9.457601541379,"12.2":0.045558033723607},I:{"3":0.00054529078014184,"4":0.072523673758865,_:"67","2.1":0,"2.2":0,"2.3":0.011996397163121,"4.1":0.02072104964539,"4.2-4.3":0.10960344680851,"4.4":0,"4.4.3-4.4.4":0.24592614184397},A:{"6":0,"7":0,"8":0.045147980769231,"9":0.052672644230769,"10":0.022573990384615,"11":2.2273003846154,"5.5":0},B:{"12":0.014906,"13":0.014906,"14":0.052171,"15":0.07453,"16":0.119248,"17":1.684378,_:"18"},K:{_:"0 10 11 12 11.1 11.5 12.1"},P:{"4":0.20473337579618,"5.0-5.4":0.010236668789809,"6.2-6.4":0.040946675159236,_:"7.2-7.4 8.2"},N:{"10":0,"11":0.053487},J:{"7":0.0010188,"10":0.0040752},R:{_:"0"},M:{"0":0.132444},O:{"0":0.387144},Q:{_:"1.2"},H:{"0":0.12297808762887},L:{"0":31.083447}};
| 1,605.5 | 3,210 | 0.579259 |
c1f395d2fe84449476bc2859d51fd84fd4065316 | 1,467 | js | JavaScript | client/styleguide.config.js | bensellak/galaxy | 020b145c8c0ee5f61543e87e5d1867ae717a6871 | [
"CC-BY-3.0"
] | 1 | 2016-04-15T11:52:45.000Z | 2016-04-15T11:52:45.000Z | client/styleguide.config.js | bensellak/galaxy | 020b145c8c0ee5f61543e87e5d1867ae717a6871 | [
"CC-BY-3.0"
] | 5 | 2018-12-03T21:09:19.000Z | 2019-07-17T20:19:47.000Z | client/styleguide.config.js | bensellak/galaxy | 020b145c8c0ee5f61543e87e5d1867ae717a6871 | [
"CC-BY-3.0"
] | 1 | 2018-06-01T15:15:30.000Z | 2018-06-01T15:15:30.000Z | let path = require("path");
let glob = require("glob");
let webpackConfig = require("./webpack.config.js");
// We don't use webpack for our sass files in the main app, but use it here
// so we get rebuilds
webpackConfig.module.rules.push({
test: /\.scss$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
alias: {
"../images": path.resolve(__dirname, "../static/images"),
".": path.resolve(__dirname, "../static/style/blue")
}
}
},
{
loader: "sass-loader",
options: {
sourceMap: true
}
}
]
});
webpackConfig.module.rules.push({ test: /\.(png|jpg|gif|eot|ttf|woff|woff2|svg)$/, use: ["file-loader"] });
sections = []
glob("./galaxy/docs/galaxy-*.md", (err, files) => {
files.forEach( file => {
name = file.match( /galaxy-(\w+).md/ )[1]
sections.push({ name: "Galaxy " + name, content: file })
});
}),
sections.push( ...[
{
name: "Basic Bootstrap Styles",
content: "./galaxy/docs/bootstrap.md"
},
// This will require additional configuration
// {
// name: 'Components',
// components: './galaxy/scripts/components/*.vue'
// }
])
module.exports = {
webpackConfig,
sections,
require: ["./galaxy/style/scss/base.scss"]
};
| 24.45 | 107 | 0.503067 |
c1f39b976d28497cf2dcbd3dcbc393c41b151d17 | 366 | js | JavaScript | src/components/Typography/HeadingOne.js | thealbertyang/inhertia | 60eee1b6ac90aa7fb4dd8e733b04d6fbbb6456c5 | [
"MIT"
] | null | null | null | src/components/Typography/HeadingOne.js | thealbertyang/inhertia | 60eee1b6ac90aa7fb4dd8e733b04d6fbbb6456c5 | [
"MIT"
] | 1 | 2021-05-09T07:44:02.000Z | 2021-05-09T07:44:02.000Z | src/components/Typography/HeadingOne.js | thealbertyang/inhertia | 60eee1b6ac90aa7fb4dd8e733b04d6fbbb6456c5 | [
"MIT"
] | null | null | null | import React from 'react'
import { connect } from 'react-redux'
import { getLocation } from '../../actions/index'
export default class HeadingOne extends React.Component {
constructor(props){
super(props);
}
render() {
let { props } = this
let { location, dispatch } = props
return [
<h1 className={props.className}>{props.children}</h1>
]
}
}
| 18.3 | 57 | 0.663934 |
c1f43e1965492174d6341631e006a514c5234c97 | 1,097 | js | JavaScript | src/components/Auth/useFormValidation.js | chloeloveall/likeness | 9864cb10d941fd08e37471e3845b2fbf0a1300f5 | [
"Ruby"
] | null | null | null | src/components/Auth/useFormValidation.js | chloeloveall/likeness | 9864cb10d941fd08e37471e3845b2fbf0a1300f5 | [
"Ruby"
] | 1 | 2021-07-26T09:12:22.000Z | 2021-07-26T09:12:22.000Z | src/components/Auth/useFormValidation.js | chloeloveall/likeness | 9864cb10d941fd08e37471e3845b2fbf0a1300f5 | [
"Ruby"
] | null | null | null | import { useState, useEffect } from "react";
function useFormValidation(initialState, validate, authenticate) {
const [values, setValues] = useState(initialState);
const [errors, setErrors] = useState({});
const [isSubmitting, setSubmitting] = useState(false);
useEffect(() => {
if (isSubmitting) {
const noErrors = Object.keys(errors).length === 0;
if (noErrors) {
authenticate();
setSubmitting(false);
} else {
setSubmitting(false);
}
}
}, [errors])
function handleChange(event) {
event.persist();
setValues(previousValues => ({
...previousValues,
[event.target.name]: event.target.value
}));
};
function handleBlur() {
const validationErrors = validate(values);
setErrors(validationErrors);
}
function handleSubmit(event) {
event.preventDefault();
const validationErrors = validate(values);
setErrors(validationErrors);
setSubmitting(true);
};
return { handleBlur, handleChange, handleSubmit, values, errors, isSubmitting }
};
export default useFormValidation; | 26.119048 | 81 | 0.660893 |
c1f566250c5d87058708b598f94bf3f1ffdb6c7e | 739 | js | JavaScript | src/util/shipping.js | XanderJL/whats-your-average | 788b8d1c5976df8dc469947e96994d7b8818896b | [
"RSA-MD"
] | 1 | 2021-04-28T05:05:06.000Z | 2021-04-28T05:05:06.000Z | src/util/shipping.js | danydodson/whats-your-average | 9397336ede2bb903d388d7b8ee5972f6761b8952 | [
"RSA-MD"
] | null | null | null | src/util/shipping.js | danydodson/whats-your-average | 9397336ede2bb903d388d7b8ee5972f6761b8952 | [
"RSA-MD"
] | 1 | 2021-04-24T00:54:57.000Z | 2021-04-24T00:54:57.000Z | import shippingRates from "@/lib/shippingRates"
const shipping = (isoCode, cartCount) => {
/**
* 1) ingest isoCode from shipping details, get line_items from cartDetails
* 2) for first item in cart, apply first_product price
* 3) for every concurrent item, apply the additional_product price
* 4) return a total for shipping and add it to the cart to adjust totalPrice
*/
if (cartCount === 1) {
return shippingRates[isoCode].first_product
} else if (cartCount > 1) {
const initItem = shippingRates[isoCode].first_product
const additionalItems =
(cartCount - 1) * shippingRates[isoCode].additional_product
return initItem + additionalItems
} else {
return 0
}
}
export default shipping
| 30.791667 | 79 | 0.711773 |
c1f58b35c326ed4b08e32677d7fcb448cf7b63b9 | 1,999 | js | JavaScript | index.js | edmevang/ocean-backend-nuvem-04-02-2021 | 8d1dabcfced3dc9bf12adcf14223a95e76ad8434 | [
"MIT"
] | null | null | null | index.js | edmevang/ocean-backend-nuvem-04-02-2021 | 8d1dabcfced3dc9bf12adcf14223a95e76ad8434 | [
"MIT"
] | null | null | null | index.js | edmevang/ocean-backend-nuvem-04-02-2021 | 8d1dabcfced3dc9bf12adcf14223a95e76ad8434 | [
"MIT"
] | null | null | null | const express = require('express');
const bodyParser = require('body-parser');
const { MongoClient, ObjectId } = require('mongodb');
(async () => {
const url = 'mongodb+srv://admin:2aZUX5c2qFkFTjd@cluster0.dqzxj.mongodb.net/ocean_db?retryWrites=true&w=majority';
const dbName = 'ocean_db';
console.info('Conectando ao banco de dados...');
const client = await MongoClient.connect(url, { useUnifiedTopology: true });
console.info('MongoDB conectado com sucesso!');
const db = client.db(dbName);
const app = express()
app.use(bodyParser.json());
const port = process.env.PORT || 3000;
/*
Create, Read (All/Single), Update & Delete
Criar, Ler (Tudo ou Individual), Atualizar e Remover
*/
const mensagens = db.collection('mensagens');
app.get('/', (req, res) => {
res.send('Hello World!');
});
// Criar (Create)
app.post('/mensagens', async (req, res) => {
const mensagem = req.body;
await mensagens.insertOne(mensagem);
res.send(mensagem);
});
// Ler Tudo (Read All)
app.get('/mensagens', async (req, res) => {
res.send(await mensagens.find().toArray());
});
// Ler Individual (Read Single)
app.get('/mensagens/:id', async (req, res) => {
const id = req.params.id;
const mensagem = await mensagens.findOne({ _id: ObjectId(id) });
res.send(mensagem);
});
// Atualizar (Update)
app.put('/mensagens/:id', async (req, res) => {
const id = req.params.id;
const mensagem = req.body;
await mensagens.updateOne(
{ _id: ObjectId(id) },
{
$set: mensagem
}
);
res.send('Mensagem editada com sucesso.');
});
// Remoção (Delete)
app.delete('/mensagens/:id', async (req, res) => {
const id = req.params.id;
await mensagens.deleteOne({ _id: ObjectId(id) });
res.send('Mensagem removida com sucesso.');
});
app.listen(port, () => {
console.info('Servidor rodando em http://localhost:' + port);
});
})();
| 22.715909 | 118 | 0.609805 |
c1f61391b5ca5d3c73ececa641d840eb05c5eb0a | 2,243 | js | JavaScript | js/setphoto.js | majie1306410136/personweb | 4aafadd7cf730b17d259b275990714f8ce91e9a0 | [
"Apache-2.0"
] | null | null | null | js/setphoto.js | majie1306410136/personweb | 4aafadd7cf730b17d259b275990714f8ce91e9a0 | [
"Apache-2.0"
] | null | null | null | js/setphoto.js | majie1306410136/personweb | 4aafadd7cf730b17d259b275990714f8ce91e9a0 | [
"Apache-2.0"
] | null | null | null | //var img = new Image();
var width;
var height;
var x;
var y;
var rows;
var col;
var divArr;
var posArr;
var pArr;
var bArr;
var num = 10;
function reset(index){
//width = img.width;
//height = img.height;
//rows = height/num;
//col = width/num;
//img.src = url;
document.getElementsByClassName('pic')[index].onmousemove=function(event){
x = event.offsetX+event.target.offsetLeft;
y = event.offsetY+event.target.offsetTop;
}
rows = 400/num;
col = 300/num;
divArr = [];
posArr = [];
pArr = [];
bArr = [];
for (var i = 0; i < rows; i++) {
divArr[i] = [];
posArr[i] = [];
pArr[i] = [];
bArr[i] = [];
for (var j = 0; j < col; j++) {
var div = document.createElement("div");
div.setAttribute("class","box");
posArr[i][j]=[j*num+300,i*num+1];
pArr[i][j] = [10+Math.random()*900,10+Math.random()*300];
div.style.backgroundPosition = (-j)*num+"px "+(-i)*num+"px";
divArr[i][j] = div;
bArr[i][j] = true;
document.getElementsByClassName("pic")[index].appendChild(div);
}
}
for (var i = 0; i <rows; i++) {
for (var j = 0; j<col; j++) {
divArr[i][j].style.left = pArr[i][j][0]+"px";
divArr[i][j].style.top = pArr[i][j][1]+"px";
}
}
setTimeout(update,800);
}
function update(){
for (var i = 0; i <rows; i++) {
for (var j = 0; j<col; j++) {
if (Math.abs(posArr[i][j][0]-x)<=40&&Math.abs(posArr[i][j][1]-y)<=40) {
pArr[i][j][0] = posArr[i][j][0] + Math.random()*600-300;
pArr[i][j][1] = posArr[i][j][1] + Math.random()*600-300;
bArr[i][j] = true;
}
}
}
for (var i = 0; i <rows; i++) {
for (var j = 0; j<col; j++) {
divArr[i][j].style.left = pArr[i][j][0]+"px";
divArr[i][j].style.top = pArr[i][j][1]+"px";
}
}
for (var i = 0; i <rows; i++) {
for (var j = 0; j <col; j++) {
if(bArr[i][j]) {
var xDistance = pArr[i][j][0]-posArr[i][j][0];
var yDistance = pArr[i][j][1]-posArr[i][j][1];
if(Math.abs(xDistance) <=10&&Math.abs(yDistance)<=10) {
pArr[i][j][0] = posArr[i][j][0];
pArr[i][j][1] = posArr[i][j][1];
bArr[i][j] = false;
} else {
pArr[i][j][0] = divArr[i][j].offsetLeft - xDistance/20;
pArr[i][j][1] = divArr[i][j].offsetTop - yDistance/20;
}
}
}
}
requestAnimationFrame(update);
}
| 25.781609 | 75 | 0.541239 |
c1f62087cb4a1e18ffd78416a071689fad9902c1 | 210 | js | JavaScript | js/utils/slugify.js | wdmih/Hillel-Project | 74cc0eef41afb7a8aa9ccc63ba50840c0b4ac739 | [
"MIT"
] | null | null | null | js/utils/slugify.js | wdmih/Hillel-Project | 74cc0eef41afb7a8aa9ccc63ba50840c0b4ac739 | [
"MIT"
] | null | null | null | js/utils/slugify.js | wdmih/Hillel-Project | 74cc0eef41afb7a8aa9ccc63ba50840c0b4ac739 | [
"MIT"
] | null | null | null | /// this code was taken from stackoverflow
export default function slugify(string) {
return string
.toString()
.toLowerCase()
.trim()
.replace(/&/g, '-and-')
.replace(/[\s\W-]+/g, '-');
}
| 21 | 42 | 0.585714 |
c1f693072a4a0a98ca7a1cea5ef9c806c988a7b6 | 1,003 | js | JavaScript | src/Views/Product.js | cynthiachen7/react-data-project | 714778fcc0f47c7d8d71ee41cd03a13c6143b285 | [
"MIT"
] | null | null | null | src/Views/Product.js | cynthiachen7/react-data-project | 714778fcc0f47c7d8d71ee41cd03a13c6143b285 | [
"MIT"
] | null | null | null | src/Views/Product.js | cynthiachen7/react-data-project | 714778fcc0f47c7d8d71ee41cd03a13c6143b285 | [
"MIT"
] | null | null | null | import React from 'react'
import { useParams } from 'react-router-dom'
import { useAxiosGet } from '../Hooks/HttpRequests'
function Product(){
const { id } = useParams()
const url = `https://5e9623dc5b19f10016b5e31f.mockapi.io/api/v1/products/${id}`
let product = useAxiosGet(url)
let content = null
if(product.data){
content =
<div>
<h1 className="text-2xl font-bold mb-3">
{product.data.name}
</h1>
<div>
<img
src={product.data.images[0].imageUrl}
alt={product.data.name}
/>
</div>
<div className="font-bold text-xl mb-3">
$ {product.data.price}
</div>
<div>
{product.data.description}
</div>
</div>
}
return (
<div className="container mx-auto">
{content}
</div>
)
}
export default Product | 24.463415 | 83 | 0.48654 |
c1f6eb20184a9f83bd563af2c4b750930ce94ed7 | 1,646 | js | JavaScript | src/views/customer/CustomerListView/index.js | Kushagra-ag/ebeautyAdmin | 3a5606c38b12f68ca7b23771f94696eaacab3049 | [
"MIT"
] | null | null | null | src/views/customer/CustomerListView/index.js | Kushagra-ag/ebeautyAdmin | 3a5606c38b12f68ca7b23771f94696eaacab3049 | [
"MIT"
] | null | null | null | src/views/customer/CustomerListView/index.js | Kushagra-ag/ebeautyAdmin | 3a5606c38b12f68ca7b23771f94696eaacab3049 | [
"MIT"
] | 1 | 2021-05-12T15:32:54.000Z | 2021-05-12T15:32:54.000Z | import React, { useEffect, useState } from 'react';
import {
Box,
Container,
makeStyles
} from '@material-ui/core';
import Page from 'src/components/Page';
import Results from './Results';
import Toolbar from './Toolbar';
import data from './data';
import { getUsers } from 'src/methods/userMethods';
const useStyles = makeStyles((theme) => ({
root: {
backgroundColor: theme.palette.background.dark,
minHeight: '100%',
paddingBottom: theme.spacing(3),
paddingTop: theme.spacing(3)
}
}));
const CustomerListView = () => {
const classes = useStyles();
const [customers, updateCustomers] = useState(null);
const [page, setPage] = useState(0);
const [error, setError] = useState(null);
const searchUsers = (type='all', query='') => {
let data = null;
console.log('type ', type);
data = type !== 'all' ? (type == 'beauticians' ? {isSeller: true} : {isSeller: false}) : null;
data = {...data, query: query};
console.log(data);
const success = (data) => {
setError(null);
updateCustomers(data.content.hits);
}
const failure = () => {
setError("Could not fetch users");
}
getUsers(data, page, type, success, failure);
}
useEffect(() => {
searchUsers();
}, [])
return (
<Page
className={classes.root}
title="Customers"
>
<Container maxWidth={false}>
<Toolbar searchUsers={searchUsers} />
<Box mt={3}>
{ customers &&
<Results customers={customers} page={page} setPage={setPage} />
}
</Box>
</Container>
</Page>
);
};
export default CustomerListView;
| 23.183099 | 98 | 0.600243 |
c1f78e8dd4bef6ebc8b9efedafe73d42599b071f | 294 | js | JavaScript | node_modules/bizcharts/demo/component/relation/index.js | lsabella/baishu-admin | 4fa931a52ec7c6990daf1cec7aeea690bb3aa68a | [
"MIT"
] | 2 | 2021-09-01T08:52:19.000Z | 2022-03-13T03:09:02.000Z | node_modules/bizcharts/demo/component/relation/index.js | lsabella/baishu-admin | 4fa931a52ec7c6990daf1cec7aeea690bb3aa68a | [
"MIT"
] | 34 | 2020-09-28T07:24:42.000Z | 2022-02-26T14:29:57.000Z | node_modules/bizcharts/demo/component/relation/index.js | lsabella/baishu-admin | 4fa931a52ec7c6990daf1cec7aeea690bb3aa68a | [
"MIT"
] | 1 | 2019-11-11T14:25:53.000Z | 2019-11-11T14:25:53.000Z | import React, { Component } from 'react';
import Arc from './arc';
export default class RelationChart extends Component {
render() {
return (
<div className='relation-charts'>
<div className='relation-chart-demo'>
<Arc />
</div>
</div>
);
}
} | 19.6 | 54 | 0.571429 |
c1f7f69d510814d98fd46487a13b9b206df358fa | 723 | js | JavaScript | deployment/testnet/10.deploy_nft.js | veigajoao/crypto_game_boilerplate | a8df3d7f12c12e054e9ba41b64ffb780ac8b8ffb | [
"MIT"
] | null | null | null | deployment/testnet/10.deploy_nft.js | veigajoao/crypto_game_boilerplate | a8df3d7f12c12e054e9ba41b64ffb780ac8b8ffb | [
"MIT"
] | null | null | null | deployment/testnet/10.deploy_nft.js | veigajoao/crypto_game_boilerplate | a8df3d7f12c12e054e9ba41b64ffb780ac8b8ffb | [
"MIT"
] | null | null | null | import {deploy, web3, provider} from './_deploy_script.js';
import path from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const contractPathERC721 = path.resolve(__dirname, '../../bin/contracts/nft_creation', 'CryptoMonkeyChars.json');
const compiledERC721 = JSON.parse(fs.readFileSync(contractPathERC721, 'utf8'));
const accounts = await web3.eth.getAccounts();
const contractInstance = await deploy(compiledERC721, accounts[0],
[process.env.ERC20ADDRESS, "1", "1", "1", web3.utils.toWei("3000", "ether"), "https://cryptomonkeys.me/"]
);
//print contract locations
console.log(`ERC-721 at ${contractInstance.options.address}`); | 40.166667 | 113 | 0.738589 |
c1f8084c2f9f09fe31b7d6629c99464cfc6ac792 | 2,234 | js | JavaScript | src/containers/Innstillinger/Innstillinger.js | telemark/portalen-web | 3131677b82c4ea3bc326287949b599eff7d1fd32 | [
"MIT"
] | null | null | null | src/containers/Innstillinger/Innstillinger.js | telemark/portalen-web | 3131677b82c4ea3bc326287949b599eff7d1fd32 | [
"MIT"
] | 197 | 2017-02-16T10:07:41.000Z | 2020-03-28T06:47:57.000Z | src/containers/Innstillinger/Innstillinger.js | telemark/portalen-web | 3131677b82c4ea3bc326287949b599eff7d1fd32 | [
"MIT"
] | null | null | null | import React, {Component} from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
import Helmet from 'react-helmet'
import {Card, CardText, CardTitle} from 'react-toolbox/lib/card'
import Checkbox from 'react-toolbox/lib/checkbox'
import Button from 'react-toolbox/lib/button'
import {Grid, Row, Col} from 'react-flexbox-grid'
import {addSubscription, removeSubscription} from 'redux/modules/info'
import {Loading, Warning} from 'components'
import style from './style'
@connect(
(state) => ({
info: state.info.data
}),
{addSubscription, removeSubscription}
)
export default class Innstillinger extends Component {
handleChange = (field, value) => {
if (value) {
this.props.addSubscription(field)
} else {
this.props.removeSubscription(field)
}
}
render () {
const {roles, loadingSubscription, error} = this.props.info
return (
<Grid fluid>
<Grid>
<Helmet title='Innstillinger' />
<Row>
<Col xs={12}>
<p className={style.buttonHolder}>
<Link to='/'>
<Button label='Tilbake til forsiden' raised />
</Link>
</p>
<h3 className={style.mainTitle}>Innstillinger for informasjon</h3>
<Card className={style.card}>
<CardTitle title={'Meldinger'} subtitle='Velg hvilke grupper du vil abonnere på meldinger fra' className={style.cardTitle} />
<CardText>
{loadingSubscription && (
<Loading title='Lagrer innstillinger' />
)}
{error && (
<Warning title={error} />
)}
{roles && roles.map((item, i) => {
return (
<div key={i} className={style.fieldHolder}>
<Checkbox checked={item.subscription} label={item.name} disabled={item.required} onChange={this.handleChange.bind(this, item.id)} />
</div>
)
})}
</CardText>
</Card>
</Col>
</Row>
</Grid>
</Grid>
)
}
}
| 33.343284 | 156 | 0.540734 |
c1f82be71c9fc34104e96706cf64fd726ca3d4f6 | 3,951 | js | JavaScript | src.js | alchemistt/resume | bb2336e1b7e95c28d136a742ecc9a4ff13189d91 | [
"MIT"
] | null | null | null | src.js | alchemistt/resume | bb2336e1b7e95c28d136a742ecc9a4ff13189d91 | [
"MIT"
] | null | null | null | src.js | alchemistt/resume | bb2336e1b7e95c28d136a742ecc9a4ff13189d91 | [
"MIT"
] | null | null | null | var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onreadystatechange = handler;
script.onload = handler;
// Fire the loading
head.appendChild(script);
function handler() {
console.log('jquery added :)');
}
mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function toggle(i) {
var burger = document.getElementById("togglebuttonburger");
var close = document.getElementById("togglebuttonclose");
var conatiner = document.getElementById("conatiner");
if (i == 1) {
console.log(false);
burger.style.display = "none";
conatiner.style.paddingTop = "200px"
close.style.display = "block";
// console.log(elmnt);
} else {
conatiner.style.paddingTop = "100px"
close.style.display = "none";
burger.style.display = "block";
console.log(true);
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
function skillset() {
// var elmnt = document.getElementById("skillset");
// console.log("element" + elmnt);
// document.body.scrollTop = 0;
// elmnt.scrollIntoView();
console.log(window.scrollY);
var w = window.innerWidth;
}
// window.onload =
function graph() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
// text: "Desktop Search Engine Market Share - 2016"
},
data: [{
type: "pie",
startAngle: 240,
// yValueFormatString: "##0.00\"%\"",
// indexLabel: "{label} {y}",
dataPoints: [
{ y: 22.45, label: "HTML" },
{ y: 23.31, label: "CSS" },
{ y: 16.06, label: "Bootstrap" },
{ y: 20.91, label: "JavaScript " },
{ y: 16.26, label: "PHP" },
{ y: 10.26, label: "Angular " },
{ y: 18.26, label: "API " },
// HTML, CSS, JS, Bootstrap
]
}]
});
chart.render();
}
window.addEventListener('scroll', function() {
var body = document.body,
html = document.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight);
// var w = window.innerWidth;
progress = ((window.pageYOffset / height) * 100);
document.getElementById('pageprogress').style.width = (progress) + "%"
if (progress > 17 && progress < 19) {
tablechange();
graph();
}
if (progress > 45) {
document.getElementById('pageprogress').style.width = (progress + 15) + "%"
}
if (progress > 70) {
document.getElementById('pageprogress').style.width = (progress + 30) + "%"
}
// console.log(progress);
});
function tablechange() {
var old = document.getElementById("old");
var neww = document.getElementById("new");
if (neww.style.display != "block") {
bar();
}
neww.style.display = "block"
old.style.display = "none"
}
function bar() {
$(".python").animate({
width: "70%"
}, 2500);
$(".php").animate({
width: "75%"
}, 3000);
$(".java").animate({
width: "80%"
}, 3500);
$(".c").animate({
width: "60%"
}, 1500);
} | 25.165605 | 83 | 0.574791 |
c1f8ddd89068a86b615c0fd79410a5b11f2750fc | 2,112 | js | JavaScript | .history/football_front end_src/src/api/request_20220328162516.js | ArrButterfly/jeecg-boot-parent | c07c329f7827ad312053bd37b38d295e7c91eff7 | [
"MIT"
] | null | null | null | .history/football_front end_src/src/api/request_20220328162516.js | ArrButterfly/jeecg-boot-parent | c07c329f7827ad312053bd37b38d295e7c91eff7 | [
"MIT"
] | null | null | null | .history/football_front end_src/src/api/request_20220328162516.js | ArrButterfly/jeecg-boot-parent | c07c329f7827ad312053bd37b38d295e7c91eff7 | [
"MIT"
] | null | null | null | import axios from 'axios';
import store from "@/store/loading/index"
import nprogress from 'nprogress'
/* 引用进度条和样式 start 开始 done 结束*/
import 'nprogress/nprogress.css'
/* 设置时间 */
//在main.js设置全局的请求次数,请求的间隙
axios.defaults.retry = 4;
axios.defaults.retryDelay = 1000;
axios.interceptors.response.use(undefined, function axiosRetryInterceptor(err) {
var config = err.config;
// If config does not exist or the retry option is not set, reject
if (!config || !config.retry) return Promise.reject(err);
// Set the variable for keeping track of the retry count
config.__retryCount = config.__retryCount || 0;
// Check if we've maxed out the total number of retries
if (config.__retryCount >= config.retry) {
// Reject with the error
return Promise.reject(err);
}
// Increase the retry count
config.__retryCount += 1;
// Create new promise to handle exponential backoff
var backoff = new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, config.retryDelay || 1);
});
// Return the promise in which recalls axios to retry the request
return backoff.then(function () {
return axios(config);
});
});
export const requests = axios.create({
// baseURL: process.env.NODE_ENV === "development" ? "/spring/user":'http://52.14.102.178:8071/spring/user',
baseURL: process.env.VUE_APP_BASE_API,
// baseURL:'http://52.14.102.178:8071/spring/user',
/* baseURL: process.env.NODE_ENV === "development" ? "http://52.14.102.178:8071/spring/user":'http://52.14.102.178:8071/spring/user/spring/user', */
timeout: 25000,
})
//axios设置请求拦截器
requests.interceptors.request.use(config => {
store.commit("updateApiCount", "add");
return config
}, err => {
store.commit("updateApiCount", "sub")
console.log(err)
})
//axios设置响应拦截器
requests.interceptors.response.use(response => {
nprogress.done()
store.commit("updateApiCount", "sub")
return response.data //拦截处理响应结果,直接返回需要的数据
}, err => {
store.commit("updateApiCount", "sub")
console.log(err)
}) | 30.608696 | 153 | 0.669034 |
c1f8e0251b95fad09d8cbe9f48b8003516857914 | 549 | js | JavaScript | test/widget-textarea.js | yaronn/blessed-patch-temp | 59be0e75c761ee14c870678a96b1df7bac6f76c5 | [
"MIT"
] | 1 | 2018-08-31T15:50:19.000Z | 2018-08-31T15:50:19.000Z | test/widget-textarea.js | yaronn/blessed-patch-temp | 59be0e75c761ee14c870678a96b1df7bac6f76c5 | [
"MIT"
] | null | null | null | test/widget-textarea.js | yaronn/blessed-patch-temp | 59be0e75c761ee14c870678a96b1df7bac6f76c5 | [
"MIT"
] | null | null | null | var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/textarea.log',
fullUnicode: true
});
var box = blessed.textarea({
parent: screen,
// Possibly support:
// align: 'center',
style: {
bg: 'blue'
},
height: 'half',
width: 'half',
top: 'center',
left: 'center',
tags: true
});
screen.render();
screen.key('q', function() {
process.exit(0);
});
screen.key('i', function() {
box.readInput(function() {});
});
screen.key('e', function() {
box.readEditor(function() {});
});
| 15.25 | 41 | 0.582878 |
c1f8ee17f0d859c6afc104214d5c0ff960159d6c | 2,225 | js | JavaScript | docs/html/search/files_5.js | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 118 | 2019-10-02T14:30:43.000Z | 2022-03-25T10:31:04.000Z | docs/html/search/files_5.js | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 58 | 2019-08-21T15:30:41.000Z | 2022-03-04T02:42:14.000Z | docs/html/search/files_5.js | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 49 | 2019-09-08T15:44:00.000Z | 2022-03-20T22:42:41.000Z | var searchData=
[
['radio_2ecpp_2472',['radio.cpp',['../radio_8cpp.html',1,'']]],
['radio_2eh_2473',['radio.h',['../radio_8h.html',1,'']]],
['rak4630_5fmod_2ecpp_2474',['RAK4630_MOD.cpp',['../_r_a_k4630___m_o_d_8cpp.html',1,'']]],
['region_2ecpp_2475',['Region.cpp',['../_region_8cpp.html',1,'']]],
['region_2eh_2476',['Region.h',['../_region_8h.html',1,'']]],
['regionas923_2ecpp_2477',['RegionAS923.cpp',['../_region_a_s923_8cpp.html',1,'']]],
['regionas923_2eh_2478',['RegionAS923.h',['../_region_a_s923_8h.html',1,'']]],
['regionau915_2ecpp_2479',['RegionAU915.cpp',['../_region_a_u915_8cpp.html',1,'']]],
['regionau915_2eh_2480',['RegionAU915.h',['../_region_a_u915_8h.html',1,'']]],
['regioncn470_2ecpp_2481',['RegionCN470.cpp',['../_region_c_n470_8cpp.html',1,'']]],
['regioncn470_2eh_2482',['RegionCN470.h',['../_region_c_n470_8h.html',1,'']]],
['regioncn779_2ecpp_2483',['RegionCN779.cpp',['../_region_c_n779_8cpp.html',1,'']]],
['regioncn779_2eh_2484',['RegionCN779.h',['../_region_c_n779_8h.html',1,'']]],
['regioncommon_2ecpp_2485',['RegionCommon.cpp',['../_region_common_8cpp.html',1,'']]],
['regioncommon_2eh_2486',['RegionCommon.h',['../_region_common_8h.html',1,'']]],
['regioneu433_2ecpp_2487',['RegionEU433.cpp',['../_region_e_u433_8cpp.html',1,'']]],
['regioneu433_2eh_2488',['RegionEU433.h',['../_region_e_u433_8h.html',1,'']]],
['regioneu868_2ecpp_2489',['RegionEU868.cpp',['../_region_e_u868_8cpp.html',1,'']]],
['regioneu868_2eh_2490',['RegionEU868.h',['../_region_e_u868_8h.html',1,'']]],
['regionin865_2ecpp_2491',['RegionIN865.cpp',['../_region_i_n865_8cpp.html',1,'']]],
['regionin865_2eh_2492',['RegionIN865.h',['../_region_i_n865_8h.html',1,'']]],
['regionkr920_2ecpp_2493',['RegionKR920.cpp',['../_region_k_r920_8cpp.html',1,'']]],
['regionkr920_2eh_2494',['RegionKR920.h',['../_region_k_r920_8h.html',1,'']]],
['regionru864_2ecpp_2495',['RegionRU864.cpp',['../_region_r_u864_8cpp.html',1,'']]],
['regionru864_2eh_2496',['RegionRU864.h',['../_region_r_u864_8h.html',1,'']]],
['regionus915_2ecpp_2497',['RegionUS915.cpp',['../_region_u_s915_8cpp.html',1,'']]],
['regionus915_2eh_2498',['RegionUS915.h',['../_region_u_s915_8h.html',1,'']]]
];
| 71.774194 | 92 | 0.669213 |
c1f92bd2a40ca4e49917594ff93a41aa09c35b74 | 374 | js | JavaScript | node_modules/@iconify/icons-mdi/baseball-diamond.js | Ehtisham-Ayaan/aoo-ghr-bnain-update | fb857ffe2159f59d11cfb1faf4e7889a778dceca | [
"MIT"
] | 1 | 2021-05-15T00:26:49.000Z | 2021-05-15T00:26:49.000Z | node_modules/@iconify/icons-mdi/baseball-diamond.js | Ehtisham-Ayaan/aoo-ghr-bnain-update | fb857ffe2159f59d11cfb1faf4e7889a778dceca | [
"MIT"
] | null | null | null | node_modules/@iconify/icons-mdi/baseball-diamond.js | Ehtisham-Ayaan/aoo-ghr-bnain-update | fb857ffe2159f59d11cfb1faf4e7889a778dceca | [
"MIT"
] | null | null | null | var data = {
"body": "<path d=\"M5.79 12.79L2 9s4-6 10-6s10 6 10 6l-3.79 3.79L12 6.59l-6.21 6.2M13.5 18h-3v2l1.5 1l1.5-1v-2m3.29-3.79L14.2 16.8c-.6-.49-1.36-.8-2.2-.8s-1.6.31-2.2.8l-2.59-2.59L12 9.41l4.79 4.8M13 14c0-.55-.45-1-1-1s-1 .45-1 1s.45 1 1 1s1-.45 1-1z\" fill=\"currentColor\"/>",
"width": 24,
"height": 24
};
exports.__esModule = true;
exports.default = data;
| 46.75 | 278 | 0.625668 |
c1f92dbe1450553ff21eb65ed0eaa424ffe6ec12 | 18,197 | js | JavaScript | apps/image-editor/tests/action.spec.js | pkmclean/tui.image-editor | 29038561176e76664264047a2a685531cfcf5f43 | [
"MIT"
] | 2 | 2021-08-03T05:52:05.000Z | 2021-09-07T13:53:46.000Z | apps/image-editor/tests/action.spec.js | pkmclean/tui.image-editor | 29038561176e76664264047a2a685531cfcf5f43 | [
"MIT"
] | null | null | null | apps/image-editor/tests/action.spec.js | pkmclean/tui.image-editor | 29038561176e76664264047a2a685531cfcf5f43 | [
"MIT"
] | 1 | 2021-06-22T02:25:12.000Z | 2021-06-22T02:25:12.000Z | /**
* @author NHN. FE Development Team <dl_javascript@nhn.com>
* @fileoverview Test cases of "src/js/action.js"
*/
import snippet from 'tui-code-snippet';
import ImageEditor from '@/imageEditor';
import action from '@/action';
import { Promise } from '@/util';
describe('UI', () => {
let actions;
let imageEditorMock;
beforeEach(() => {
action.mixin(ImageEditor);
imageEditorMock = new ImageEditor(document.createElement('div'), {
includeUI: {
loadImage: false,
initMenu: 'flip',
menuBarPosition: 'bottom',
applyCropSelectionStyle: true,
},
});
actions = imageEditorMock.getActions();
spyOn(snippet, 'imagePing');
});
afterEach(() => {
imageEditorMock.destroy();
});
describe('mainAction', () => {
let mainAction;
beforeEach(() => {
mainAction = actions.main;
});
it('LoadImageFromURL() API should be executed When the initLoadImage action occurs', (done) => {
const promise = new Promise((resolve) => {
resolve(300);
});
spyOn(imageEditorMock, 'loadImageFromURL').and.returnValue(promise);
spyOn(imageEditorMock, 'clearUndoStack');
spyOn(imageEditorMock.ui, 'resizeEditor');
mainAction.initLoadImage('path', 'imageName').then(() => {
expect(imageEditorMock.clearUndoStack).toHaveBeenCalled();
expect(imageEditorMock.ui.resizeEditor).toHaveBeenCalled();
expect(imageEditorMock.loadImageFromURL).toHaveBeenCalled();
done();
});
});
it('Undo() API should be executed When the undo action occurs', () => {
spyOn(imageEditorMock, 'isEmptyUndoStack').and.returnValue(false);
spyOn(imageEditorMock, 'undo').and.returnValue({ then: () => {} });
mainAction.undo();
expect(imageEditorMock.undo).toHaveBeenCalled();
});
it('Redo() API should be executed When the redo action occurs', () => {
spyOn(imageEditorMock, 'isEmptyRedoStack').and.returnValue(false);
spyOn(imageEditorMock, 'redo').and.returnValue({ then: () => {} });
mainAction.redo();
expect(imageEditorMock.redo).toHaveBeenCalled();
});
it('removeObject() API should be executed When the delete action occurs', () => {
imageEditorMock.activeObjectId = 10;
spyOn(imageEditorMock, 'removeActiveObject');
mainAction['delete']();
expect(imageEditorMock.removeActiveObject).toHaveBeenCalled();
expect(imageEditorMock.activeObjectId).toBe(null);
});
it('clearObjects() API should be run and the enabled state should be changed When the deleteAll action occurs', () => {
spyOn(imageEditorMock, 'clearObjects');
spyOn(imageEditorMock.ui, 'changeHelpButtonEnabled');
mainAction.deleteAll();
const changeHelpButtonCalls = imageEditorMock.ui.changeHelpButtonEnabled.calls;
expect(imageEditorMock.clearObjects).toHaveBeenCalled();
expect(changeHelpButtonCalls.argsFor(0)[0]).toBe('delete');
expect(changeHelpButtonCalls.argsFor(1)[0]).toBe('deleteAll');
});
it('loadImageFromFile() API should be executed When the load action occurs', (done) => {
const promise = new Promise((resolve) => {
resolve();
});
spyOn(imageEditorMock, 'loadImageFromFile').and.returnValue(promise);
spyOn(imageEditorMock, 'clearUndoStack');
spyOn(imageEditorMock.ui, 'resizeEditor');
window.URL = {
createObjectURL: jasmine.createSpy('URL'),
};
mainAction.load();
promise.then(() => {
expect(imageEditorMock.loadImageFromFile).toHaveBeenCalled();
expect(imageEditorMock.clearUndoStack).toHaveBeenCalled();
expect(imageEditorMock.ui.resizeEditor).toHaveBeenCalled();
done();
});
});
});
describe('shapeAction', () => {
let shapeAction;
beforeEach(() => {
shapeAction = actions.shape;
});
it('changeShape() API should be executed When the changeShape action occurs', () => {
imageEditorMock.activeObjectId = 10;
spyOn(imageEditorMock, 'changeShape');
shapeAction.changeShape({
strokeWidth: '#000000',
});
expect(imageEditorMock.changeShape).toHaveBeenCalled();
});
it('setDrawingShape() API should be executed When the setDrawingShape action occurs', () => {
spyOn(imageEditorMock, 'setDrawingShape');
shapeAction.setDrawingShape();
expect(imageEditorMock.setDrawingShape).toHaveBeenCalled();
});
});
describe('cropAction', () => {
let cropAction;
beforeEach(() => {
cropAction = actions.crop;
});
it('getCropzoneRect(), stopDrawingMode(), ui.resizeEditor(), ui.changeMenu() API should be executed When the crop action occurs', (done) => {
const promise = new Promise((resolve) => {
resolve();
});
spyOn(imageEditorMock, 'crop').and.returnValue(promise);
spyOn(imageEditorMock, 'getCropzoneRect').and.returnValue(true);
spyOn(imageEditorMock, 'stopDrawingMode');
spyOn(imageEditorMock.ui, 'resizeEditor');
spyOn(imageEditorMock.ui, 'changeMenu');
cropAction.crop();
expect(imageEditorMock.getCropzoneRect).toHaveBeenCalled();
expect(imageEditorMock.crop).toHaveBeenCalled();
promise.then(() => {
expect(imageEditorMock.stopDrawingMode).toHaveBeenCalled();
expect(imageEditorMock.ui.resizeEditor).toHaveBeenCalled();
expect(imageEditorMock.ui.changeMenu).toHaveBeenCalled();
done();
});
});
it('stopDrawingMode() API should be executed When the cancel action occurs', () => {
spyOn(imageEditorMock, 'stopDrawingMode');
spyOn(imageEditorMock.ui, 'changeMenu');
cropAction.cancel();
expect(imageEditorMock.stopDrawingMode).toHaveBeenCalled();
expect(imageEditorMock.ui.changeMenu).toHaveBeenCalled();
});
});
describe('flipAction', () => {
let flipAction;
beforeEach(() => {
flipAction = actions.flip;
});
it('{flipType}() API should be executed When the flip(fliptype) action occurs', () => {
spyOn(imageEditorMock, 'flipX');
spyOn(imageEditorMock, 'flipY');
flipAction.flip('flipX');
expect(imageEditorMock.flipX).toHaveBeenCalled();
flipAction.flip('flipY');
expect(imageEditorMock.flipY).toHaveBeenCalled();
});
});
describe('rotateAction', () => {
let rotateAction;
beforeEach(() => {
rotateAction = actions.rotate;
});
it('rotate() API should be executed When the rotate action occurs', () => {
spyOn(imageEditorMock, 'rotate');
spyOn(imageEditorMock.ui, 'resizeEditor');
rotateAction.rotate(30);
expect(imageEditorMock.rotate).toHaveBeenCalled();
expect(imageEditorMock.ui.resizeEditor).toHaveBeenCalled();
});
it('setAngle() API should be executed When the setAngle action occurs', () => {
spyOn(imageEditorMock, 'setAngle');
spyOn(imageEditorMock.ui, 'resizeEditor');
rotateAction.setAngle(30);
expect(imageEditorMock.setAngle).toHaveBeenCalled();
expect(imageEditorMock.ui.resizeEditor).toHaveBeenCalled();
});
});
describe('textAction', () => {
let textAction;
beforeEach(() => {
textAction = actions.text;
});
it('changeTextStyle() API should be executed When the changeTextStyle action occurs', () => {
imageEditorMock.activeObjectId = 10;
spyOn(imageEditorMock, 'changeTextStyle');
textAction.changeTextStyle({ fontSize: 10 });
expect(imageEditorMock.changeTextStyle.calls.mostRecent().args[0]).toBe(10);
expect(imageEditorMock.changeTextStyle.calls.mostRecent().args[1]).toEqual({ fontSize: 10 });
});
});
describe('maskAction', () => {
let maskAction;
beforeEach(() => {
maskAction = actions.mask;
});
it('applyFilter() API should be executed When the applyFilter action occurs', () => {
imageEditorMock.activeObjectId = 10;
spyOn(imageEditorMock, 'applyFilter');
maskAction.applyFilter();
expect(imageEditorMock.applyFilter.calls.mostRecent().args[1]).toEqual({ maskObjId: 10 });
});
});
describe('drawAction', () => {
let drawAction, expected;
beforeEach(() => {
drawAction = actions.draw;
});
it('startDrawingMode("FREE_DRAWING") API should be executed When the setDrawMode("free") action occurs', () => {
spyOn(imageEditorMock, 'startDrawingMode');
drawAction.setDrawMode('free');
expected = imageEditorMock.startDrawingMode.calls.mostRecent().args[0];
expect(expected).toBe('FREE_DRAWING');
});
it('setBrush() API should be executed When the setColor() action occurs', () => {
spyOn(imageEditorMock, 'setBrush');
drawAction.setColor('#000000');
expected = imageEditorMock.setBrush.calls.mostRecent().args[0].color;
expect(expected).toBe('#000000');
});
});
describe('iconAction', () => {
let iconAction;
beforeEach(() => {
iconAction = actions.icon;
});
it('when the add icon occurs, the drawing mode should be run.', () => {
spyOn(imageEditorMock, 'startDrawingMode');
spyOn(imageEditorMock, 'setDrawingIcon');
iconAction.addIcon('iconTypeA', '#fff');
expect(imageEditorMock.startDrawingMode).toHaveBeenCalled();
expect(imageEditorMock.setDrawingIcon).toHaveBeenCalled();
});
});
describe('filterAction', () => {
let filterAction;
beforeEach(() => {
filterAction = actions.filter;
});
it('removeFilter() API should be executed When the type of applyFilter is false', () => {
spyOn(imageEditorMock, 'removeFilter');
spyOn(imageEditorMock, 'hasFilter').and.returnValue(true);
filterAction.applyFilter(false, {});
expect(imageEditorMock.removeFilter).toHaveBeenCalled();
});
it('applyFilter() API should be executed When the type of applyFilter is true', () => {
spyOn(imageEditorMock, 'applyFilter');
filterAction.applyFilter(true, {});
expect(imageEditorMock.applyFilter).toHaveBeenCalled();
});
});
describe('commonAction', () => {
it('Each action returned to the getActions method must contain commonAction.', () => {
const submenus = [
'shape',
'crop',
'flip',
'rotate',
'text',
'mask',
'draw',
'icon',
'filter',
];
snippet.forEach(submenus, (submenu) => {
expect(actions[submenu].modeChange).toBeDefined();
expect(actions[submenu].deactivateAll).toBeDefined();
expect(actions[submenu].changeSelectableAll).toBeDefined();
expect(actions[submenu].discardSelection).toBeDefined();
expect(actions[submenu].stopDrawingMode).toBeDefined();
});
});
describe('modeChange()', () => {
let commonAction;
beforeEach(() => {
commonAction = actions.main;
});
it('_changeActivateMode("TEXT") API should be executed When the modeChange("text") action occurs', () => {
spyOn(imageEditorMock, '_changeActivateMode');
commonAction.modeChange('text');
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});
it('startDrawingMode() API should be executed When the modeChange("crop") action occurs', () => {
spyOn(imageEditorMock, 'startDrawingMode');
commonAction.modeChange('crop');
expect(imageEditorMock.startDrawingMode).toHaveBeenCalled();
});
it('stopDrawingMode(), setDrawingShape(), _changeActivateMode() API should be executed When the modeChange("shape") action occurs', () => {
spyOn(imageEditorMock, 'setDrawingShape');
spyOn(imageEditorMock, '_changeActivateMode');
commonAction.modeChange('shape');
expect(imageEditorMock.setDrawingShape).toHaveBeenCalled();
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});
});
});
describe('reAction', () => {
beforeEach(() => {
imageEditorMock.setReAction();
spyOn(imageEditorMock.ui, 'changeHelpButtonEnabled');
});
describe('undoStackChanged', () => {
it('If the undo stack has a length greater than zero, the state of changeUndoButtonStatus, changeResetButtonStatus should be true.', () => {
imageEditorMock.fire('undoStackChanged', 1);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(0)).toEqual(['undo', true]);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(1)).toEqual([
'reset',
true,
]);
});
it('If the undo stack has a length of 0, the state of changeUndoButtonStatus, changeResetButtonStatus should be false.', () => {
imageEditorMock.fire('undoStackChanged', 0);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(0)).toEqual([
'undo',
false,
]);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(1)).toEqual([
'reset',
false,
]);
});
});
describe('redoStackChanged', () => {
it('If the redo stack is greater than zero length, the state of changeRedoButtonStatus should be true.', () => {
imageEditorMock.fire('redoStackChanged', 1);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(0)).toEqual(['redo', true]);
});
it('If the redo stack has a length of zero, the state of changeRedoButtonStatus should be false.', () => {
imageEditorMock.fire('redoStackChanged', 0);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(0)).toEqual([
'redo',
false,
]);
});
});
describe('objectActivated', () => {
it('When objectActivated occurs, the state of the delete button should be enabled.', () => {
imageEditorMock.fire('objectActivated', { id: 1 });
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(0)).toEqual([
'delete',
true,
]);
expect(imageEditorMock.ui.changeHelpButtonEnabled.calls.argsFor(1)).toEqual([
'deleteAll',
true,
]);
});
it("When objectActivated's target is cropzone, changeApplyButtonStatus should be enabled.", () => {
spyOn(imageEditorMock.ui.crop, 'changeApplyButtonStatus');
imageEditorMock.fire('objectActivated', {
id: 1,
type: 'cropzone',
});
expect(imageEditorMock.ui.crop.changeApplyButtonStatus.calls.mostRecent().args[0]).toBe(
true
);
});
it('If the target of objectActivated is shape and the existing menu is not shpe, the menu should be changed to shape.', () => {
imageEditorMock.ui.submenu = 'crop';
spyOn(imageEditorMock.ui, 'changeMenu');
spyOn(imageEditorMock.ui.shape, 'setShapeStatus');
spyOn(imageEditorMock.ui.shape, 'setMaxStrokeValue');
imageEditorMock.fire('objectActivated', {
id: 1,
type: 'circle',
});
expect(imageEditorMock.ui.changeMenu.calls.mostRecent().args[0]).toBe('shape');
expect(imageEditorMock.ui.shape.setMaxStrokeValue).toHaveBeenCalled();
});
it('If the target of objectActivated is text and the existing menu is not text, the menu should be changed to text.', () => {
imageEditorMock.ui.submenu = 'crop';
spyOn(imageEditorMock.ui, 'changeMenu');
imageEditorMock.fire('objectActivated', {
id: 1,
type: 'i-text',
});
expect(imageEditorMock.ui.changeMenu.calls.mostRecent().args[0]).toBe('text');
});
it('If the target of objectActivated is icon and the existing menu is not icon, the menu should be changed to icon.', () => {
imageEditorMock.ui.submenu = 'crop';
spyOn(imageEditorMock.ui, 'changeMenu');
spyOn(imageEditorMock.ui.icon, 'setIconPickerColor');
imageEditorMock.fire('objectActivated', {
id: 1,
type: 'icon',
});
expect(imageEditorMock.ui.changeMenu.calls.mostRecent().args[0]).toBe('icon');
expect(imageEditorMock.ui.icon.setIconPickerColor).toHaveBeenCalled();
});
});
describe('addObjectAfter', () => {
it("When addObjectAfter occurs, the shape's maxStrokeValue should be changed to match the size of the added object.", () => {
spyOn(imageEditorMock.ui.shape, 'setMaxStrokeValue');
spyOn(imageEditorMock.ui.shape, 'changeStandbyMode');
imageEditorMock.fire('addObjectAfter', {
type: 'circle',
width: 100,
height: 200,
});
expect(imageEditorMock.ui.shape.setMaxStrokeValue.calls.mostRecent().args[0]).toBe(100);
expect(imageEditorMock.ui.shape.changeStandbyMode).toHaveBeenCalled();
});
});
describe('objectScaled', () => {
it('If objectScaled occurs on an object of type text, fontSize must be changed.', () => {
imageEditorMock.ui.text.fontSize = 0;
imageEditorMock.fire('objectScaled', {
type: 'i-text',
fontSize: 20,
});
expect(imageEditorMock.ui.text.fontSize).toBe(20);
});
it('If objectScaled is for a shape type object and strokeValue is greater than the size of the object, the value should change.', () => {
spyOn(imageEditorMock.ui.shape, 'getStrokeValue').and.returnValue(20);
spyOn(imageEditorMock.ui.shape, 'setStrokeValue');
imageEditorMock.fire('objectScaled', {
type: 'rect',
width: 10,
height: 10,
});
expect(imageEditorMock.ui.shape.setStrokeValue.calls.mostRecent().args[0]).toBe(10);
});
});
describe('selectionCleared', () => {
it('If selectionCleared occurs in the text menu state, the menu should be closed.', () => {
imageEditorMock.ui.submenu = 'text';
spyOn(imageEditorMock, 'changeCursor');
imageEditorMock.fire('selectionCleared');
expect(imageEditorMock.changeCursor.calls.mostRecent().args[0]).toBe('text');
});
});
});
});
| 34.398866 | 146 | 0.635984 |
c1f97870f40a1127d8c6e3ff8024b975a343b5c8 | 1,529 | js | JavaScript | src/components/Monitoring/MonitoringVideo/index.js | smarthome-project/frontend | 9c03f9bf0307cea04a38f27bd26c1a782aba131d | [
"MIT"
] | null | null | null | src/components/Monitoring/MonitoringVideo/index.js | smarthome-project/frontend | 9c03f9bf0307cea04a38f27bd26c1a782aba131d | [
"MIT"
] | null | null | null | src/components/Monitoring/MonitoringVideo/index.js | smarthome-project/frontend | 9c03f9bf0307cea04a38f27bd26c1a782aba131d | [
"MIT"
] | null | null | null | import React from 'react'
import ReactDom from 'react-dom'
import PropTypes from 'prop-types'
import _ from 'lodash'
import videoPlayerStyle from './style.scss'
import { Link } from 'react-router-dom'
import { Icon } from '../../shared/Icon'
import { PageHeader, Panel, Button, Image, Grid, Row, Col } from 'react-bootstrap'
class MonitoringVideo extends React.Component {
constructor(props) {
super(props)
}
render() {
const camId = this.props.match.params.id
const cameraIndex = _.findIndex(this.props.cameras, c => c.id == camId)
const camera = (cameraIndex > -1) ? this.props.cameras[cameraIndex] : null
if (!camera)
return <PageHeader>
Błąd
<small> Nie prawidłowy ID</small>
</PageHeader>
let room = _.find(this.props.rooms, r => r.id == camera.room_id) || null
room = (room) ? room[0] : null
let header = (
<PageHeader>
{camera.name}
<small> {room && room.name}</small>
</PageHeader>
)
const addr = `http://${camera.ip}/video.mp4?line=1&inst=2&rec=0&rnd=34078&vrf=${(new Date()).getTime()}`
return (
<div id="monitoringVideo">
{header}
<div className="pos_wraper">
<div className="video_wraper">
<video className="video_player" autoPlay controls src={addr}>
Your browser does not support the video.
</video>
</div>
</div>
</div>
)
}
}
MonitoringVideo.propTypes = {
rooms: PropTypes.array,
cameras: PropTypes.array,
camerasCallbacks: PropTypes.object
}
export default MonitoringVideo | 22.820896 | 106 | 0.654676 |
c1fa14f33be7c60ddddc8a05d598f2262516b4ac | 1,427 | js | JavaScript | app/components/AutoUpdate/AutoUpdate.js | thecoag/GDLauncher | 59a69ae5d3e217c6957b201c57804075356cd15b | [
"MIT"
] | null | null | null | app/components/AutoUpdate/AutoUpdate.js | thecoag/GDLauncher | 59a69ae5d3e217c6957b201c57804075356cd15b | [
"MIT"
] | null | null | null | app/components/AutoUpdate/AutoUpdate.js | thecoag/GDLauncher | 59a69ae5d3e217c6957b201c57804075356cd15b | [
"MIT"
] | 1 | 2020-08-16T10:04:07.000Z | 2020-08-16T10:04:07.000Z | import React, { useState, useEffect } from 'react';
import { Progress } from 'antd';
import { ipcRenderer } from 'electron';
import { THEMES } from '../../constants';
import store from '../../localStore';
import shader from '../../utils/colors';
import background from '../../assets/images/login_background.jpg';
import styles from './AutoUpdate.scss';
export default props => {
const [colors, setColors] = useState(
store.get('settings') ? store.get('settings').theme : THEMES.default
);
const [percentage, setPercentage] = useState(0);
useEffect(() => {
store.set('showChangelogs', true);
ipcRenderer.on('download-progress', (ev, data) => {
setPercentage(data);
});
ipcRenderer.on('update-downloaded', () => {
ipcRenderer.send('apply-updates');
});
ipcRenderer.send('download-updates');
}, []);
return (
<div
className={styles.content}
style={{
background: `linear-gradient( ${colors['secondary-color-2']}8A, ${
colors['secondary-color-2']
}8A), url(${background})`
}}
>
<div className={styles.inside_content}>
<h1>CoAGLauncher Autoupdater</h1>
We are currently updating the launcher, depending on your connection it
may take a while. Go grab a cup of coffee while we finish this for you
<Progress style={{ marginTop: 70 }} percent={percentage} />
</div>
</div>
);
};
| 31.711111 | 79 | 0.624387 |
c1fae6fdd3cde87d841d10bd1076ad875a79349e | 1,338 | js | JavaScript | src/cluster/helpers.js | dazejs/framework | 44a706af8a972be8cf4d3b65bfba70905b58bf7b | [
"MIT"
] | 13 | 2019-06-19T15:09:37.000Z | 2019-09-19T10:00:18.000Z | src/cluster/helpers.js | czewail/framework | 44a706af8a972be8cf4d3b65bfba70905b58bf7b | [
"MIT"
] | 1 | 2019-08-19T14:49:36.000Z | 2019-08-19T14:49:36.000Z | src/cluster/helpers.js | czewail/framework | 44a706af8a972be8cf4d3b65bfba70905b58bf7b | [
"MIT"
] | 3 | 2019-08-19T02:56:43.000Z | 2019-09-28T02:43:33.000Z | /**
* Copyright (c) 2018 Chan Zewail
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
const cpus = require('os').cpus().length;
const cluster = require('cluster');
const { WORKER_DYING } = require('./const');
/**
* Analyze the parameters of Cluster module
* Adds the number of work processes to the parameters
* 解析 Cluster 模块的参数
* 添加工作进程数量数量到参数中
* @param {object} opts worker or master class constructor parameters
*/
exports.parseOpts = function parseOpts(opts = {}) {
opts.workers = opts.workers || cpus;
return opts;
};
/**
* Capture the surviving work process
* Return an array
* 获取存活的工作进程
* 返回一个数组
*/
exports.getAlivedWorkers = function getAlivedWorkers() {
const workers = [];
for (const id in cluster.workers) {
if (Object.prototype.hasOwnProperty.call(cluster.workers, id)) {
const worker = cluster.workers[id];
if (exports.isAliveWorker(worker)) {
workers.push(worker);
}
}
}
return workers;
};
/**
* Determine if the work process is alive
* 判断工作进程是否存活状态
* @param {object} worker worker process
*/
exports.isAliveWorker = function isAliveWorker(worker) {
if (worker.state === 'disconnected' || worker.state === 'dead' || worker.isDead()) return false;
if (worker[WORKER_DYING]) return false;
return true;
};
| 25.245283 | 98 | 0.683109 |
c1fbba06f17a942c1e8dbda6fc84e4e1982c0881 | 3,583 | js | JavaScript | src/containers/Timer/index.js | jumpvin/demo | 2ca58fa7f15c0e6ceb62e5f466654bd64340ad11 | [
"MIT"
] | null | null | null | src/containers/Timer/index.js | jumpvin/demo | 2ca58fa7f15c0e6ceb62e5f466654bd64340ad11 | [
"MIT"
] | 1 | 2022-03-25T18:57:39.000Z | 2022-03-25T18:57:39.000Z | src/containers/Timer/index.js | jumpvin/demo | 2ca58fa7f15c0e6ceb62e5f466654bd64340ad11 | [
"MIT"
] | null | null | null | import React, { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { updateClock, numToMin, getFromArray } from '../../api/helpers';
import './timer.css';
import Sprints from '../../components/Sprints';
import Round from '../../components/Round';
const Timer = () => {
const id = useSelector( state => state.defaultPom.defaultPom);
const pomodoros = useSelector ( state => state.allPoms.pomodoros)
const showClass = useSelector( state => state.toggleWindow.display);
const [ pomodoro, setPomodoro] = useState({});
const [ time, setTime ] = useState({ timer: '00:00' });
const [ sprint, setSprint ] = useState({ last: 'work' });
const [ length, setLength ] = useState({ round: 1 });
const [ timeId, setTimeId ] = useState(0);
useEffect( () => {
if(id){
const pomodoro = getFromArray(id, pomodoros);
setTime({ ...time, timer: numToMin(pomodoro.work) });
updateSprint('work', pomodoro.work );
setLength({ ...length, round: 1 });
setPomodoro(pomodoro);
}
}, [ id ])
const startTimer = (currentTime, sprint, round, e) => {
const newTimeId = setTimeout( () => {
const updatedTime = updateTime(currentTime, sprint, round);
startTimer(updatedTime.currentTime, updatedTime.sprint, updatedTime.round);
}, 1000);
setTimeId(newTimeId);
if(!pomodoro.auto && currentTime === numToMin(pomodoro[sprint]) && !(e && e.target)) {
endTimer(newTimeId);
};
};
const updateTime = (currentTime, sprint, round) => {
if(currentTime === '00:00'){
if(sprint === 'short' || sprint === 'long') {
updateSprint('work');
if(sprint === 'short') {
const newRound = round+1;
setLength({ ...length, round: newRound })
};
currentTime = numToMin(pomodoro.work);
sprint = 'work';
}
else if ( sprint === 'work' && round < pomodoro.length) {
updateSprint('short');
currentTime = numToMin(pomodoro.short);
sprint = 'short';
round = round+1;
}
else {
updateSprint('long');
setLength({ ...length, round: 1 });
currentTime = numToMin(pomodoro.long);
sprint = 'long';
round = 0;
}
} else {
setTime({...time, timer: updateClock(currentTime) });
currentTime = updateClock(currentTime);
}
return { currentTime, sprint, round };
}
const endTimer = (argId = null) => {
let chosenId = typeof argId === 'number' ? argId : timeId;
clearTimeout(chosenId);
setTimeId(0);
};
const updateSprint = (sprint, time = false ) => {
setTime({ ...time, timer: numToMin(time ? time : pomodoro[sprint]) });
setSprint({...sprint, last: sprint});
};
const displayRounds = () => {
const lengthArray = new Array(length.round).fill(true);
return lengthArray.map( (el, i) => <Round key = {i} />);
}
return (
<div className= { !showClass ? 'timer' : ' timer hide-window' }>
<div className = 'display-default-pom'>
{ pomodoro.name }
</div>
<Sprints sprint = { sprint.last } updateSprint = { updateSprint } />
<div className= 'timer-display'>
{ time.timer ? time.timer: '' }
</div>
<div className = 'rounds'>
{ displayRounds() }
</div>
{
timeId ?
<div className='button red' onClick={endTimer}>End</div>
:
<div className='button blue' onClick={(e) => time.timer? startTimer(time.timer, sprint.last, length.round, e): ''}>Start</div>
}
</div>
)
};
export default Timer; | 32.572727 | 135 | 0.586101 |
c1fbc724623ebdddefbb91469e3f90a4cc9fe08c | 3,057 | js | JavaScript | components/__tests__/locale-chooser.js | andrew-codes/glamorous-website | 3ef92a5d22cb2b05f3ba45f54c944ce8913fddc0 | [
"MIT"
] | 105 | 2017-05-25T20:41:32.000Z | 2022-01-01T10:39:43.000Z | components/__tests__/locale-chooser.js | andrew-codes/glamorous-website | 3ef92a5d22cb2b05f3ba45f54c944ce8913fddc0 | [
"MIT"
] | 271 | 2017-05-25T16:43:04.000Z | 2018-12-06T20:08:27.000Z | components/__tests__/locale-chooser.js | andrew-codes/glamorous-website | 3ef92a5d22cb2b05f3ba45f54c944ce8913fddc0 | [
"MIT"
] | 121 | 2017-05-25T15:06:27.000Z | 2022-02-25T15:56:34.000Z | import React from 'react'
import {mount} from 'enzyme'
import {ThemeProvider} from 'glamorous'
import GlobalStyles from '../../styles/global-styles'
import LocaleChooser from '../locale-chooser'
const {supportedLocales, fallbackLocale} = require('../../config.json')
test('a closed locale-chooser', () => {
setHost()
const wrapper = mountLocaleChooser()
testClosedState(wrapper)
})
test('an open locale-chooser', () => {
setHost()
const wrapper = mountLocaleChooser()
const toggle = wrapper.find('button')
const selector = wrapper.find('ul')
toggle.simulate('click')
expect(toggle.getDOMNode().getAttribute('aria-expanded')).toEqual('true')
expect(selector.getDOMNode().getAttribute('aria-hidden')).toEqual('false')
expect(
selector.childAt(0).find('a').getDOMNode() === document.activeElement,
).toBe(true)
})
test('pressing the escape key closes the locale-selector', () => {
setHost()
const wrapper = mountLocaleChooser()
const toggle = wrapper.find('button')
toggle.simulate('click')
document.dispatchEvent(new KeyboardEvent('keydown', {keyCode: 27}))
testClosedState(wrapper)
})
test('an outside click closes the locale-selector', () => {
setHost()
const wrapper = mountLocaleChooser()
const toggle = wrapper.find('button')
toggle.simulate('click')
document.dispatchEvent(new Event('click'))
testClosedState(wrapper)
})
test('creates localization links', () => {
supportedLocales.forEach(l => {
setHost(l)
testLocalizationLinks()
})
})
function mountLocaleChooser() {
return mount(
<ThemeProvider theme={GlobalStyles}>
<LocaleChooser />
</ThemeProvider>,
)
}
const host = 'glamorous.rocks'
function setHost(lang = fallbackLocale) {
process.env.LOCALE = lang
// why can't we just do window.location.host = 'foo'?
// https://github.com/facebook/jest/issues/890
Object.defineProperty(window.location, 'host', {
writable: true,
value: `${lang === fallbackLocale ? '' : `${lang}.`}${host}`,
})
Object.defineProperty(window.location, 'protocol', {
writable: true,
value: 'https:',
})
Object.defineProperty(window.location, 'pathname', {
writable: true,
value: '/',
})
}
function testClosedState(wrapper) {
const toggle = wrapper.find('button')
const selector = wrapper.find('ul')
expect(toggle.getDOMNode().getAttribute('aria-expanded')).toEqual('false')
expect(selector.getDOMNode().getAttribute('aria-hidden')).toEqual('true')
}
function testLocalizationLinks() {
const wrapper = mountLocaleChooser()
const links = wrapper.find('a')
expect(links.length).toBe(supportedLocales.length + 1)
supportedLocales.forEach((l, i) => {
const prefix = l === fallbackLocale ? '' : `${l}.`
expect(links.at(i).getDOMNode().getAttribute('href')).toEqual(
`https://${prefix}${host}/`,
)
})
expect(
links.at(supportedLocales.length).getDOMNode().getAttribute('href'),
).toEqual(
'https://github.com/kentcdodds/glamorous-website/blob/master/other/CONTRIBUTING_DOCUMENTATION.md',
)
}
| 27.540541 | 102 | 0.686621 |
c1fd00e3046e5ad02a5969f3080e1a748f1d01db | 943 | js | JavaScript | node_modules/react-icons/io/steam.js | antarikshray/websiterudra | 7043525ac75866c829f065b63645bdd95ae98138 | [
"MIT"
] | 2 | 2020-01-14T14:00:46.000Z | 2022-01-06T04:46:01.000Z | node_modules/react-icons/io/steam.js | antarikshray/websiterudra | 7043525ac75866c829f065b63645bdd95ae98138 | [
"MIT"
] | 26 | 2020-07-21T06:38:39.000Z | 2022-03-26T23:23:58.000Z | node_modules/react-icons/io/steam.js | antarikshray/websiterudra | 7043525ac75866c829f065b63645bdd95ae98138 | [
"MIT"
] | 5 | 2018-03-30T14:14:30.000Z | 2020-10-20T21:50:21.000Z |
import React from 'react'
import Icon from 'react-icon-base'
const IoSteam = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m37.5 16.3c0 1.5-1.2 2.8-2.9 2.8-1.6 0-2.9-1.2-2.9-2.8 0-1.6 1.3-2.9 2.9-2.9 1.6 0 2.9 1.3 2.9 2.9z m-2.9-5.4c3 0 5.4 2.4 5.4 5.4s-2.4 5.4-5.4 5.4l-5.2 3.8c-0.2 2-1.9 3.6-4 3.6-2 0-3.6-1.4-4-3.2l-15.3-6.1c-0.6 0.4-1.3 0.6-2 0.6-2.2 0-4.1-1.9-4.1-4.1s1.9-4 4.1-4c1.9 0 3.5 1.4 3.9 3.2l15.3 6.1c0.6-0.3 1.3-0.6 2.1-0.6 0.1 0 0.2 0.1 0.4 0.1l3.3-4.9c0-2.9 2.5-5.3 5.5-5.3z m0 1.8c-2 0-3.7 1.5-3.7 3.6s1.7 3.6 3.7 3.6 3.6-1.6 3.6-3.6-1.6-3.6-3.6-3.6z m-30.5 0.7c-1.7 0-3 1.3-3 2.9s1.3 3 3 3c0.2 0 0.4 0 0.6-0.1l-1.3-0.5c-1.1-0.5-1.7-1.8-1.2-3s1.9-1.8 3-1.3l1.5 0.5c-0.5-0.9-1.5-1.5-2.6-1.5z m21.3 8.7c-0.2 0-0.5 0.1-0.7 0.1l1.2 0.5c1.3 0.4 1.8 1.8 1.4 3.1s-1.8 1.8-3.1 1.3c-0.4-0.2-1-0.5-1.5-0.6 0.5 0.9 1.5 1.5 2.7 1.5 1.6 0 3-1.3 3-2.9s-1.4-3-3-3z"/></g>
</Icon>
)
export default IoSteam
| 78.583333 | 772 | 0.550371 |
c1fd7fd2499f71bb764feac39b621129e0d304a8 | 811 | js | JavaScript | lib/resource/topic_translation.js | Datahero/desk.js | 0f6d752677c5a7e1304e943f034dfe69015b4844 | [
"MIT",
"Unlicense"
] | 5 | 2015-07-29T18:31:03.000Z | 2017-03-22T06:54:12.000Z | lib/resource/topic_translation.js | Datahero/desk.js | 0f6d752677c5a7e1304e943f034dfe69015b4844 | [
"MIT",
"Unlicense"
] | 11 | 2015-01-15T18:32:36.000Z | 2018-01-25T19:28:33.000Z | lib/resource/topic_translation.js | Datahero/desk.js | 0f6d752677c5a7e1304e943f034dfe69015b4844 | [
"MIT",
"Unlicense"
] | 6 | 2015-04-09T13:22:41.000Z | 2018-02-23T17:26:16.000Z | /*!
* Module dependencies
*/
var util = require('util')
, Resource = require('./')
, updateMixin = require('../mixins/update')
, destroyMixin = require('../mixins/destroy')
;
/*!
* Expose `TopicTranslation()`.
*/
exports = module.exports = TopicTranslation;
/**
* Initialize a new `TopicTranslation` with the given `parent` and `definition`.
*
* @param {Function} parent The parent this resource is attached to.
* @param {Object} definition The resource definition.
* @api private
*/
function TopicTranslation(parent, definition) {
var key;
for (key in updateMixin) {
this[key] = updateMixin[key];
}
this.destroy = destroyMixin;
TopicTranslation.super_.apply(this, arguments);
}
util.inherits(TopicTranslation, Resource);
TopicTranslation.create = require('../mixins/create'); | 25.34375 | 80 | 0.692972 |
c1fdb5f09447e07c4d80280fa72ee277cb0a6545 | 3,213 | js | JavaScript | frontend/src/pages/HomePage/postSharing/receivedURL.js | solitariaa/CMPUT404-project-socialdistribution | f9e23a10e209f8bf7ed062e105f44038751f7c74 | [
"W3C-20150513"
] | 1 | 2022-03-01T03:03:40.000Z | 2022-03-01T03:03:40.000Z | frontend/src/pages/HomePage/postSharing/receivedURL.js | solitariaa/CMPUT404-project-socialdistribution | f9e23a10e209f8bf7ed062e105f44038751f7c74 | [
"W3C-20150513"
] | 51 | 2022-02-09T06:18:27.000Z | 2022-03-28T19:01:54.000Z | frontend/src/pages/HomePage/postSharing/receivedURL.js | solitariaa/CMPUT404-project-socialdistribution | f9e23a10e209f8bf7ed062e105f44038751f7c74 | [
"W3C-20150513"
] | 2 | 2022-03-13T20:58:10.000Z | 2022-03-19T06:29:56.000Z | import * as React from 'react';
import PropTypes from 'prop-types';
import Button from '@mui/material/Button';
import { styled } from '@mui/material/styles';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
import DialogContent from '@mui/material/DialogContent';
import DialogActions from '@mui/material/DialogActions';
import IconButton from '@mui/material/IconButton';
import CloseIcon from '@mui/icons-material/Close';
import Typography from '@mui/material/Typography';
import TextField from '@mui/material/TextField';
import GetAppIcon from '@mui/icons-material/GetApp';
import { getUnlistedPost } from "../../../Services/posts";
import UnlistedFeed from "./unlistedFeed";
import Collapse from '@mui/material/Collapse';
const BootstrapDialog = styled(Dialog)(({ theme }) => ({
'& .MuiDialogContent-root': {
padding: theme.spacing(2),
},
'& .MuiDialogActions-root': {
padding: theme.spacing(1),
},
}));
const BootstrapDialogTitle = (props) => {
const { children, onClose, ...other } = props;
return (
<DialogTitle sx={{ m: 0, p: 2 }} {...other}>
{children}
{onClose ? (
<IconButton
aria-label="close"
onClick={onClose}
sx={{
position: 'absolute',
right: 8,
top: 8,
color: (theme) => theme.palette.grey[500],
}}
>
<CloseIcon />
</IconButton>
) : null}
</DialogTitle>
);
};
BootstrapDialogTitle.propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
};
export default function ReceivedURLDialogs({open, onClose, alertSuccess, alertError}) {
//state hook for URL
const[id, setId] = React.useState("");
//state hook for unlisted post
const[unlistedPost, setUnlistedPost] = React.useState({});
//state hook for expand view
const [expanded, setExpanded] = React.useState(false);
const clickClose = () => {
setExpanded(false);
onClose();
}
//Handler for get post from URL
const handleGet = () => {
getUnlistedPost(id)
.then( res => {
console.log(res.data);
setUnlistedPost(res.data)
setExpanded(true);
alertSuccess("Success: Retrieved Post!");
})
.catch( err => {console.log(err)
alertError("Error: Could Not Retrieved Post!");
});
};
return (
<div>
<BootstrapDialog onClose={clickClose} aria-labelledby="customized-dialog-title" open={open} fullWidth >
<BootstrapDialogTitle id="customized-dialog-title" onClose={clickClose}> Retrieved Unlisted Post </BootstrapDialogTitle>
<DialogContent dividers>
<TextField id="outlined-basic" label="Input the URL here" variant="outlined" sx={{width:"80%"}} onChange={(e) => {setId(e.target.value)}}/>
<Button variant="contained" endIcon={<GetAppIcon />} sx={{height: 56, width:"20%"}} onClick={handleGet}> Get </Button>
</DialogContent>
<Collapse in={expanded} timeout="auto" unmountOnExit>
<UnlistedFeed post={unlistedPost} />
</Collapse>
</BootstrapDialog>
</div>
);
}
| 31.5 | 147 | 0.626829 |
c1fdc5dbd20efe4f4c6f46cec26d2d036f09c283 | 4,895 | js | JavaScript | src/js/original/action/open-license-validator-action.js | google-admin/beautiful-audio-editor | 41a04ed849965e05f9e2611c2d7953c26be2c582 | [
"Apache-2.0"
] | 76 | 2017-01-14T19:13:44.000Z | 2022-02-21T16:31:49.000Z | src/js/original/action/open-license-validator-action.js | emtee40/beautiful-audio-editor | 4815a3564f3e167ef412fbf67f70c94afcf3c093 | [
"Apache-2.0"
] | 5 | 2017-02-01T01:12:33.000Z | 2022-02-12T04:20:47.000Z | src/js/original/action/open-license-validator-action.js | isabella232/beautiful-audio-editor | 4815a3564f3e167ef412fbf67f70c94afcf3c093 | [
"Apache-2.0"
] | 29 | 2017-02-17T18:46:01.000Z | 2022-03-15T00:21:14.000Z | /**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
goog.provide('audioCat.action.OpenLicenseValidatorAction');
goog.require('audioCat.action.Action');
goog.require('audioCat.ui.dialog.DialogText');
goog.require('audioCat.ui.dialog.EventType');
goog.require('audioCat.ui.message.MessageType');
goog.require('goog.asserts');
goog.require('goog.dom.classes');
/**
* Creates an empty track.
* @param {!audioCat.utility.dialog.DialogManager} dialogManager Manages
* dialogs.
* @param {!audioCat.ui.message.MessageManager} messageManager Issues requests
* to display messages to the user.
* @param {!audioCat.utility.IdGenerator} idGenerator Generates IDs unique
* throughout one instance of the application.
* @param {!audioCat.utility.DomHelper} domHelper Facilitates DOM interactions.
* @param {!audioCat.service.ServiceManager} serviceManager Integrates with
* other services such as Google Drive.
* @param {!audioCat.state.LicenseManager} licenseManager Manages licensing.
* @constructor
* @extends {audioCat.action.Action}
*/
audioCat.action.OpenLicenseValidatorAction = function(
dialogManager,
messageManager,
idGenerator,
domHelper,
serviceManager,
licenseManager) {
goog.base(this);
/**
* @private {!audioCat.utility.dialog.DialogManager}
*/
this.dialogManager_ = dialogManager;
/**
* @private {!audioCat.ui.message.MessageManager}
*/
this.messageManager_ = messageManager;
/**
* @private {!audioCat.utility.IdGenerator}
*/
this.idGenerator_ = idGenerator;
/**
* @private {!audioCat.utility.DomHelper}
*/
this.domHelper_ = domHelper;
/**
* @private {!audioCat.service.ServiceManager}
*/
this.serviceManager_ = serviceManager;
/**
* @private {!audioCat.state.LicenseManager}
*/
this.licenseManager_ = licenseManager;
};
goog.inherits(audioCat.action.OpenLicenseValidatorAction,
audioCat.action.Action);
/** @override */
audioCat.action.OpenLicenseValidatorAction.prototype.doAction = function() {
goog.asserts.assert(!this.licenseManager_.getRegistered(),
'We should not register if the user is already registered.');
var content = this.domHelper_.createDiv(goog.getCssName('topBufferedDialog'));
var innerContent =
this.domHelper_.createDiv(goog.getCssName('innerContentWrapper'));
var warningBox = this.domHelper_.createDiv(goog.getCssName('warningBox'));
this.domHelper_.appendChild(innerContent, warningBox);
var instructions =
this.domHelper_.createDiv(goog.getCssName('innerParagraphContent'));
this.domHelper_.setRawInnerHtml(instructions,
'Register by inputting the license you got from the Beautiful Audio ' +
'Editor website.');
this.domHelper_.appendChild(innerContent, instructions);
var licenseArea = this.domHelper_.createElement('textarea');
this.domHelper_.appendChild(innerContent, licenseArea);
var registerButton = this.dialogManager_.obtainButton('Register license.');
var latestTryToRegisterTimeout;
registerButton.performOnUpPress(goog.bind(function() {
var licenseKeyToTry = licenseArea.value.trim();
this.messageManager_.issueMessage('Verifying license ...',
audioCat.ui.message.MessageType.INFO);
this.licenseManager_.sendPretendRequest(licenseKeyToTry);
latestTryToRegisterTimeout = goog.global.setTimeout(goog.bind(function() {
if (this.licenseManager_.tryToRegister(licenseKeyToTry)) {
// Successfully registered.
this.dialogManager_.hideDialog(dialog);
this.messageManager_.issueMessage('Thank you for registering!',
audioCat.ui.message.MessageType.SUCCESS);
} else {
this.domHelper_.setRawInnerHtml(
warningBox, 'Invalid license.');
}
latestTryToRegisterTimeout = 0;
}, this), 1300);
}, this));
this.domHelper_.appendChild(innerContent, registerButton.getDom());
this.domHelper_.appendChild(content, innerContent);
var dialog = this.dialogManager_.obtainDialog(
content, audioCat.ui.dialog.DialogText.CLOSE);
dialog.listenOnce(audioCat.ui.dialog.EventType.BEFORE_HIDDEN, function() {
this.dialogManager_.putBackButton(registerButton);
if (latestTryToRegisterTimeout) {
goog.global.clearTimeout(latestTryToRegisterTimeout);
}
}, false, this);
this.dialogManager_.showDialog(dialog);
};
| 37.083333 | 80 | 0.737079 |
c1fe01e40ed007f8b6815da58409b5b87d90cff3 | 560 | js | JavaScript | tests/src/components/layout/Spinner.js | sn00pee/vue-keys-translations-manager | 098bbe5791c937f1f2b68533dd0c2331f4309c80 | [
"MIT"
] | 93 | 2016-04-11T17:13:42.000Z | 2022-03-21T12:42:32.000Z | tests/src/components/layout/Spinner.js | sn00pee/vue-keys-translations-manager | 098bbe5791c937f1f2b68533dd0c2331f4309c80 | [
"MIT"
] | 36 | 2016-04-12T13:45:53.000Z | 2021-06-15T20:38:04.000Z | tests/src/components/layout/Spinner.js | sn00pee/vue-keys-translations-manager | 098bbe5791c937f1f2b68533dd0c2331f4309c80 | [
"MIT"
] | 22 | 2016-04-12T13:43:40.000Z | 2022-02-24T04:33:48.000Z | import Spinner from '../../../../src/components/layout/Spinner'
function setup() {
const wrapper = shallow(<Spinner/>)
return wrapper
}
describe('(component) Spinner', () => {
it('should render as a styled <div>', () => {
const wrapper = setup()
expect(wrapper.type()).to.eql('div');
expect(wrapper.prop('style')).to.have.property('textAlign');
});
describe('child: i', () => {
it('should have an icon font', () => {
const wrapper = setup()
expect(wrapper.find("i").hasClass("fa-spinner")).to.be.true;
});
});
});
| 25.454545 | 64 | 0.585714 |
c1fe994db87f3855db4d94415f692ab03c017fe7 | 16,562 | js | JavaScript | lib/modules/goal-module/public/js/goal_add_edit_common.js | vidhyavid/myfiels | f0c1174232a2e9dfbd270ec1ded0e36cad18a380 | [
"MIT"
] | null | null | null | lib/modules/goal-module/public/js/goal_add_edit_common.js | vidhyavid/myfiels | f0c1174232a2e9dfbd270ec1ded0e36cad18a380 | [
"MIT"
] | 1 | 2022-01-22T13:18:05.000Z | 2022-01-22T13:18:05.000Z | lib/modules/goal-module/public/js/goal_add_edit_common.js | vidhyavid/myfiels | f0c1174232a2e9dfbd270ec1ded0e36cad18a380 | [
"MIT"
] | null | null | null | // has functions common for add and edit
// -- html generators
// functions for building new step form
// these are split because debugging a function that
// returns html is a nightmare!
function getNameAndHowOftenHTML(id) {
var html = '<div class="space-input">'+
'<label class="label-head"><strong>What steps will I take to complete my goal?</strong></label>'+
'<div class="flex-end"><a class="delete-link" href="javascript:void(0);" onclick="deleteStep('+id+')">Delete</a></div>'+
'<div class="flex-sb-c">'+
'<div class="step-count-box mb-2">'+id+'</div>'+
'<input type="text" class="sm-font-14" placeholder="Go for a 5k run" id="step_name__'+id+'">'+
// '<a class="bin-icon" href="javascript:void(0);" onclick="deleteStep('+id+')"><i class="fas fa-trash-alt"></i></a>'+
'</div>'+
'</div>';
html += '<div class="space-input">'+
'<label class="label-head"><strong>How often will I take this step?</strong><br></label>'+
'<div class="flex-div">'+
'<div class="maia-day-group sm-select mrg-rt-15">'+
'<input type="radio" class="how_often_radios" id="once_a_day__'+id+'" name="how_often__'+id+'" value="once_a_day" />'+
'<label class="sm-font-14" for="once_a_day__'+id+'">ONCE A DAY<br /></label>'+
'</div>'+
'<div class="maia-day-group sm-select ">'+
'<input type="radio" class="how_often_radios" id="other__'+id+'" name="how_often__'+id+'" value="other" />'+
'<label class="sm-font-14" for="other__'+id+'">OTHER<br /></label>'+
'</div>'+
'</div>'+
'</div>';
return html;
}
function getOnceADayOptions(id) {
var html = '<div id="once_a_day-options-container__'+id+'" class="d-none">'+
'<div class="space-input">'+
'<label class="label-head"><strong>What time will I take this step?</strong></label>'+
'<label class="calenderdiv time">'+
'<input type="text" class="sm-font-14 timepicker" placeholder="Select a time" id="once_a_day-time__'+id+'">'+
'<span class="material-icons time-calender">query_builder</span>'+
'</label>'+
'</div>';
html += '<div class="space-input"><label class="label-head"><strong>Do I want to be reminded?</strong><br></label>'+
'<div class="flex-div">'+
'<div class="maia-day-group sm-select mrg-rt-20">'+
'<input type="radio" id="once_a_day__do-remind__yes__'+id+'" class="do_remind_radios" name="once_a_day-do-remind__'+id+'" value="yes" />'+
'<label class="sm-font-14" for="once_a_day__do-remind__yes__'+id+'">YES<br /></label>'+
'</div>'+
'<div class="maia-day-group sm-select">'+
'<input type="radio" id="once_a_day__do-remind__no__'+id+'" name="once_a_day-do-remind__'+id+'" class="do_remind_radios" value="no" />'+
'<label class="sm-font-14" for="once_a_day__do-remind__no__'+id+'">NO<br /></label>'+
'</div>'+
'</div>'+
'</div>';
html += '<div class="space-input d-none" id="once_a_day__reminder-container__'+id+'">'+
'<label class="label-head"><strong>Set reminder</strong><br></label>'+
'<div class="flex-div">'+
'<div class="maia-select">'+
'<select required id="once_a_day__reminder-value__'+id+'">'+
'<option value="15" selected>15 minutes before goal starts</option>'+
'<option value="30">30 minutes before goal starts</option>'+
'<option value="45">45 minutes before goal starts</option>'+
'<option value="60">1 hour before goal starts</option>'+
'<option value="75">1 hour 15 minutes before goal starts</option>'+
'<option value="90">1 hour 30 minutes before goal starts</option>'+
'<option value="120">2 hours before goal starts</option>'+
'<option value="150">2 hours 30 minutes before goal starts</option>'+
'</select>'+
'</div>'+
'</div>'+
'</div>';
html += '</div>';
return html;
}
function getOtherOptions(id) {
var html = '<div id="other-options-container__'+id+'" class="d-none">';
var days = [
{name: 'MONDAY', val: 'mon'},
{name: 'TUESDAY', val: 'tues'},
{name: 'WEDNESDAY', val: 'wed'},
{name: 'THURSDAY', val: 'thur'},
{name: 'FRIDAY', val: 'fri'},
{name: 'SATURDAY', val: 'sat'},
{name: 'SUNDAY', val: 'sun'},
];
html += '<div class="space-input">'+
'<label class="label-head"><strong>Which days will I take this step?</strong><br></label>'+
'<div class="row">';
for (var i=0; i<days.length; i++) {
var day_html = '<div class="col-5 col-sm-4 col-md-3 col-lg-3 mrg-bt-15">'+
'<div class="maia-day-group">'+
'<input type="checkbox" id="days-checkbox__'+days[i]['val']+'__'+id+'" value="'+days[i]['val']+'">'+
'<label class="sm-font-14" for="days-checkbox__'+days[i]['val']+'__'+id+'">'+
'<strong>'+days[i]['name']+'</strong><br>'+
' </label>'+
'</div>'+
'</div>';
html += day_html;
}
html += '</div>'; // row
html += '<div></div>';
html += '</div>'; // space input
html += '<div class="space-input" id="other__time-container__'+id+'">'+
'<label class="label-head"><strong>What time will I take this step?</strong></label>'+
'<input type="number" class="d-none" value="1" id="other__time-box-count__'+id+'">'+
'<label class="calenderdiv time">'+
'<div id="other__time-box__'+id+'__1">'+
'<input type="text" class="sm-font-14 timepicker" placeholder="Select a time" id="other__time__'+id+'__1">'+
'<span class="material-icons time-calender">query_builder</span>'+
'</div>'+
'</label>'+
'</div>'+
'<div class="add-another-div"><a class="add-another-time" id="add_time__'+id+'" href="javascript:void(0);">Add another time</a></div>';
html += '<div class="space-input">'+
'<label class="label-head"><strong>How long will I do this for?</strong><br></label>'+
'<div class="flex-div">'+
'<div class="space-input w--inherit mrg-rt-20">'+
'<input type="number" class="sm-font-14" placeholder="3" id="other__how_long_value__'+id+'__1">'+
'</div>'+
'<div class="maia-select">'+
'<select id="other__how_long_type__'+id+'__1">'+
'<option value="days" selected>Days</option>'+
'<option value="weeks">Weeks</option>'+
'<option value="months">Months</option>'+
'</select>'+
'</div>'+
'</div>'+
'</div>';
html += '<div class="space-input"><label class="label-head"><strong>Do I want to be reminded?</strong><br></label>'+
'<div class="flex-div">'+
'<div class="maia-day-group sm-select mrg-rt-20">'+
'<input type="radio" id="other__do-remind__yes__'+id+'" class="do_remind_radios" name="other-do-remind__'+id+'" value="yes" />'+
'<label class="sm-font-14" for="other__do-remind__yes__'+id+'">YES<br /></label>'+
'</div>'+
'<div class="maia-day-group sm-select">'+
'<input type="radio" id="other__do-remind__no__'+id+'" name="other-do-remind__'+id+'" class="do_remind_radios" value="no" />'+
'<label class="sm-font-14" for="other__do-remind__no__'+id+'">NO<br /></label>'+
'</div>'+
'</div>'+
'</div>';
html += '<div class="space-input d-none" id="other__reminder-container__'+id+'">'+
'<label class="label-head"><strong>Set reminder</strong><br></label>'+
'<div class="flex-div">'+
'<div class="maia-select mrg-rt-20">'+
'<select required id="other__reminder-value__'+id+'">'+
'<option value="15" selected>15 minutes before goal starts</option>'+
'<option value="30">30 minutes before goal starts</option>'+
'<option value="45">45 minutes before goal starts</option>'+
'<option value="60">1 hour before goal starts</option>'+
'<option value="75">1 hour 15 minutes before goal starts</option>'+
'<option value="90">1 hour 30 minutes before goal starts</option>'+
'<option value="120">2 hours before goal starts</option>'+
'<option value="150">2 hours 30 minutes before goal starts</option>'+
'</select>'+
'</div>'+
'</div>'+
'</div>';
html += '</div>' // other container
return html;
}
// -- end of html generators
function setupHowOftenAndReminderRadios() {
$('.how_often_radios').unbind().change(function(e) {
var id = e.target.id;
var splits = id.split('__');
var option = splits[0];
var step_id = splits[1];
// once_a_day-options-container__1
$('#'+option+'-options-container__'+step_id).removeClass('d-none');
var other_option = 'once_a_day';
if (option == 'once_a_day') {
other_option = 'other';
}
$('#'+other_option+'-options-container__'+step_id).addClass('d-none');
// update our global var
var index = -1;
for (var i=0; i<steps.length; i++) {
if (steps[i]['id'] == step_id) {
index = i;
}
}
if (index != -1) {
steps[index]['meta_how_often'] = option;
}
return;
});
$('.do_remind_radios').unbind().change(function(e) {
var id = e.target.id;
// once_a_day__do-remind__yes__1
var splits = id.split('__');
var option = splits[0];
var yn = splits[2];
var step_id = splits[3];
if (yn == 'yes') {
// once_a_day__reminder-container__1
$('#'+option+'__reminder-container__'+step_id).removeClass('d-none');
} else {
$('#'+option+'__reminder-container__'+step_id).addClass('d-none');
}
return;
})
}
function setupAddTimeBoxes() {
$('.add-another-time').unbind().click(function(e) {
var id = e.target.id;
// add_time__1
var splits = id.split('__');
var step_id = splits[1];
// other__time-box-count__1
var current_timebox_count = $('#other__time-box-count__'+step_id).val();
current_timebox_count = parseInt(current_timebox_count);
var next_count = current_timebox_count + 1;
var html = '<span class="calenderdiv goal-add-icon" id="other__time-box__'+step_id+'__'+next_count+'"><div class="goal-add-another">'+
'<input type="text" class="sm-font-14 timepicker" placeholder="Select a time" id="other__time__'+step_id+'__'+next_count+'"><span class="material-icons time-calender">query_builder</span>'+
'</div><a class="bin-icon" href="javascript:void(0);"><i class="fas fa-trash-alt" onclick="deleteTimeBox(\''+step_id+'__'+next_count+'\')"></i></a></span>';
// <button class="delete-btn-icon" onclick="deleteTimeBox(\''+step_id+'__'+next_count+'\')">Delete</button></label>';
// '<div class="flex-sb-c">'+
// '<input type="text" class="sm-font-14" placeholder="Go for a 5k run" id="step_name__1">'+
// '<a class="bin-icon" href="javascript:void(0);"><i class="fas fa-trash-alt"></i></a>'+
// '</div>';
// other__time-container__1
$('#other__time-container__'+step_id).append(html);
$('#other__time-box-count__'+step_id).val(next_count);
$('.timepicker').unbind().timepicki();
return;
})
}
function getYYYMMDD(d) {
var splits = d.split('/');
return splits[2]+'-'+splits[1]+'-'+splits[0];
}
function getDateArray(start, end) {
var
arr = new Array(),
dt = new Date(start);
while (dt <= end) {
let datem = moment(new Date(dt)).format('dddd');
let daychange = (datem == "Monday") ? "mon" : (datem == "Tuesday") ? "tues" : (datem == "Wednesday") ? "wed" : (datem == "Thursday") ? "thur" : (datem == "Friday") ? "fri" : (datem == "Saturday") ? "sat" : "sun";
arr.push(daychange);
dt.setDate(dt.getDate() + 1);
}
return arr;
}
function deleteTimeBox(id) {
$('#other__time-box__'+id).remove();
}
function clearErrorMsg() {
$('#error-msgs').html('')
$('#error-msgs').addClass('d-none')
}
function setAndShowErrorMsg(msg) {
$('#error-msgs').html(msg)
$('#error-msgs').removeClass('d-none')
scrollTop();
}
function scrollTop() {
$(window).scrollTop($(".error_show").offset().top);
}
function payloadOK(payload) {
if (!payload.name) {
setAndShowErrorMsg('Goal name cannot be empty');
return false;
}
if (!payload.description) {
setAndShowErrorMsg('Goal description cannot be empty');
return false;
}
if (!payload.from_date) {
setAndShowErrorMsg('Goal from date cannot be empty');
return false;
}
if (!payload.to_date) {
setAndShowErrorMsg('Goal to date cannot be empty');
return false;
}
if ( moment(payload.from_date).isSameOrAfter( moment(payload.to_date) ) ) {
setAndShowErrorMsg('Goal to date needs to be after from date');
return false;
}
if (!payload.steps.length) {
setAndShowErrorMsg('Please add some steps to your goal');
return false;
}
for (var i=0; i<payload.steps.length; i++) {
var step = payload.steps[i];
if (!step.name) {
setAndShowErrorMsg('Please add a title to step '+ (i+1));
return false;
}
if (!step.meta_how_often) {
setAndShowErrorMsg('Please choose how often you want to do step '+ (i+1));
return false;
}
if (!step.meta_times.length) {
setAndShowErrorMsg('Please choose a time to do step '+ (i+1));
return false;
}
// yes!! this is a weird condition
// if (step.meta_has_reminder != true || step.meta_has_reminder != false) {
// console.log(step.meta_has_reminder)
// setAndShowErrorMsg('Please choose yes or no for reminder to step '+ (i+1));
// return false;
// }
if (step.meta_has_reminder) {
if ([15, 30, 45, 60, 75, 90, 120, 150].indexOf(step.meta_reminder_minutes) == -1) {
setAndShowErrorMsg('Please choose when you like to be reminded in step '+ (i+1));
return false;
}
}
if (step.meta_how_often == 'other') {
let dateArr = getDateArray(moment(getYYYMMDD(payload.from_date)), moment(getYYYMMDD(payload.to_date)));
let differenceday = $(payload.steps[i].meta_days).not(dateArr).get();
if (!step.meta_days.length) {
setAndShowErrorMsg('Please choose the days to do step '+ (i+1));
return false;
}
if(differenceday.length > 0){
setAndShowErrorMsg('You must be choosen wrong days between start & end date in step '+ (i+1));
return false;
}
if (!step.meta_do_this_for_type || !step.meta_do_this_for_value) {
setAndShowErrorMsg('Please choose how long you want to do step '+ (i+1) + ' for' );
return false;
}
if (step.meta_do_this_for_type == 'days') {
var day_count = step.meta_days.length;
var goal_day_count = moment(payload.to_date).diff(moment(payload.from_date), 'days')
if (parseInt(step.meta_do_this_for_value) > goal_day_count) {
setAndShowErrorMsg('You can only enter '+goal_day_count+' days for step '+ (i+1));
return false;
}
if (day_count > goal_day_count) {
setAndShowErrorMsg('You can only choose '+goal_day_count+' days for step '+ (i+1));
return false;
}
if (goal_day_count <= 7) {
if (parseInt(step.meta_do_this_for_value) != day_count) {
setAndShowErrorMsg('Please choose the '+goal_day_count+' days for step '+ (i+1));
return false;
}
}
}
}
}
return true;
}
| 41.508772 | 216 | 0.550115 |
c1fee043dcb136e5e323ceac67b2157009bef25f | 904 | js | JavaScript | node_modules/@material-ui/icons/esm/SwipeRounded.js | adastra-react/OnlineArcadeAdminPanel | 167c69d1477fb159f016c9a3f367a9dbd576fdfd | [
"MIT"
] | null | null | null | node_modules/@material-ui/icons/esm/SwipeRounded.js | adastra-react/OnlineArcadeAdminPanel | 167c69d1477fb159f016c9a3f367a9dbd576fdfd | [
"MIT"
] | null | null | null | node_modules/@material-ui/icons/esm/SwipeRounded.js | adastra-react/OnlineArcadeAdminPanel | 167c69d1477fb159f016c9a3f367a9dbd576fdfd | [
"MIT"
] | null | null | null | import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M21.15 2.85l-1.02 1.02C18.69 2.17 15.6 1 12 1S5.31 2.17 3.87 3.87L2.85 2.85c-.31-.31-.85-.09-.85.36V6.5c0 .28.22.5.5.5h3.29c.45 0 .67-.54.35-.85L4.93 4.93c1-1.29 3.7-2.43 7.07-2.43s6.07 1.14 7.07 2.43l-1.22 1.22c-.31.31-.09.85.36.85h3.29c.28 0 .5-.22.5-.5V3.21c0-.45-.54-.67-.85-.36z"
}), /*#__PURE__*/_jsx("path", {
d: "M14.5 12.71c-.28-.14-.58-.21-.89-.21H13v-6c0-.83-.67-1.5-1.5-1.5S10 5.67 10 6.5v10.74l-3.44-.72c-.37-.08-.76.04-1.03.31-.43.44-.43 1.14.01 1.58l4.01 4.01c.37.37.88.58 1.41.58h6.41c1 0 1.84-.73 1.98-1.72l.63-4.46c.12-.85-.32-1.69-1.09-2.07l-4.39-2.04z"
})]
}), 'SwipeRounded'); | 82.181818 | 292 | 0.632743 |
c1ff38d5cae3c99e89bdb571547ff48c0a45e853 | 556 | js | JavaScript | public/js/lang-en.8de533643027096faa7f.js | MegaMaid/MegaMaid | 51ced558826e8c429335685ecf70ac2874559c11 | [
"MIT"
] | null | null | null | public/js/lang-en.8de533643027096faa7f.js | MegaMaid/MegaMaid | 51ced558826e8c429335685ecf70ac2874559c11 | [
"MIT"
] | 1 | 2020-07-07T20:55:23.000Z | 2020-07-07T20:55:23.000Z | public/js/lang-en.8de533643027096faa7f.js | MegaMaid/MegaMaid | 51ced558826e8c429335685ecf70ac2874559c11 | [
"MIT"
] | null | null | null | webpackJsonp([2],{
/***/ 82:
/***/ (function(module, exports) {
eval("throw new Error(\"Module build failed: SyntaxError: Unexpected token } in JSON at position 4118\\n at JSON.parse (<anonymous>)\\n at Object.module.exports (/sites/megamaid.test/node_modules/json-loader/index.js:4:49)\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiI4Mi5qcyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///82\n");
/***/ })
}); | 55.6 | 475 | 0.744604 |
c1ff5227aaeff04fc2f9eb275fdda35b35d73a8f | 152 | js | JavaScript | models/index.js | Konado22/Social-Network-API | ebbf0308d829d8bbade73b216fb4787ebf98e169 | [
"MIT"
] | null | null | null | models/index.js | Konado22/Social-Network-API | ebbf0308d829d8bbade73b216fb4787ebf98e169 | [
"MIT"
] | null | null | null | models/index.js | Konado22/Social-Network-API | ebbf0308d829d8bbade73b216fb4787ebf98e169 | [
"MIT"
] | null | null | null | const Users = require("./User");
const Thoughts = require("./Thought");
// const Reactions = require('./Reactions')
module.exports = {Users, Thoughts};
| 30.4 | 43 | 0.684211 |
c1ff633749b7478bd3d1812b1e502e44309b8bcf | 11,327 | js | JavaScript | static/assets/echarts/js/d8e3348cd154a9a034befd4777206224.js | tblxdezhu/STP | db3db2183a70b39e155a0b3a061dc5d3e29e6c9f | [
"MIT"
] | null | null | null | static/assets/echarts/js/d8e3348cd154a9a034befd4777206224.js | tblxdezhu/STP | db3db2183a70b39e155a0b3a061dc5d3e29e6c9f | [
"MIT"
] | null | null | null | static/assets/echarts/js/d8e3348cd154a9a034befd4777206224.js | tblxdezhu/STP | db3db2183a70b39e155a0b3a061dc5d3e29e6c9f | [
"MIT"
] | null | null | null | (function (root, factory) {if (typeof define === 'function' && define.amd) {define(['exports', 'echarts'], factory);} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {factory(exports, require('echarts'));} else {factory({}, root.echarts);}}(this, function (exports, echarts) {var log = function (msg) {if (typeof console !== 'undefined') {console && console.error && console.error(msg);}};if (!echarts) {log('ECharts is not Loaded');return;}if (!echarts.registerMap) {log('ECharts Map is not loaded');return;}echarts.registerMap('宜州市', {"type":"FeatureCollection","features":[{"type":"Feature","id":"451281","properties":{"name":"宜州市","cp":[108.636414,24.485214],"childNum":1},"geometry":{"type":"Polygon","coordinates":["@@AABCC@BCDA@ABC@AABACAABEC@AAA@AAAABCBAD@@AA@@CAABAAC@ACA@CAADC@C@A@CAAC@BADEDACC@BAAC@CAEAA@CCAAA@@@ABCD@@@@@@CBA@@B@B@@A@A@AB@BC@A@AB@@C@@@@@ABAB@B@@AB@@E@A@A@A@CDAD@@AAAB@@A@AAA@AAA@A@AAAA@BC@A@C@A@AD@@@BADAB@D@BAB@B@B@BA@@BB@AB@BBB@B@DBD@D@@@@@BA@CBA@C@A@@BAB@@@@AB@@BB@B@@ADAB@B@@@@ABA@@B@BA@@@@BB@@@@B@@AB@@BB@@B@DA@BB@B@DA@@@@B@@@@@@B@B@D@D@BAB@B@@B@@@B@@B@@@BBB@B@@@@AB@@A@A@AB@@AB@@@@@B@@A@@@A@@BAB@@CBC@@B@@@B@@BB@@@B@@AB@@@BBF@@@@A@A@@@C@@@AB@@@B@@AB@B@B@B@@@D@B@B@BABA@@B@@BB@B@@A@@B@@A@A@CAACA@A@A@@BA@A@@@@@@B@BB@@B@@@F@BAD@@A@ABA@AB@BA@AAA@@@CDA@@BA@@@E@AA@@@B@@@B@@@B@D@@ABAB@@AA@@C@@@A@A@ABCBABAAA@@A@CAA@A@AC@@ACIAAC@CAABIBCDAB@BGDADC@CAECA@@CGACB@B@BA@@B@B@BABABA@CB@BAB@BBB@BBBBB@@A@@D@BA@@BA@A@@@C@AAAA@CAA@@B@@@AA@CAC@@AAA@A@A@A@@@AAA@AE@@@@A@CEA@AAAABA@CCCB@AAAA@@@@C@@C@ABC@@B@@@@@B@@A@@@A@ACA@AAAC@@AA@@A@A@@CG@@@A@@@AA@ABAC@A@@@A@A@@@AB@DB@@@@B@@C@@@AB@B@@AB@BA@@B@@@@@@@BA@A@@B@@@@@@@@ABB@A@@@@@A@@BBBA@@BA@A@A@CA@BABA@AB@AAA@A@@@AA@@B@@A@AA@@@A@A@AAA@A@@@AB@AA@AA@C@@@@@A@A@AAA@@@@@@CAAAA@@A@@AA@@AA@@@AC@A@ACA@CBA@A@BA@@AA@AA@ABAAAAA@CAA@@AA@CAA@A@@@@BC@@@AA@@ABA@AB@@@@A@@@A@AAA@@AA@A@@@A@@@AD@@AB@@AB@BABA@@AAAAA@A@A@@A@CBA@@@AA@@@A@A@A@@A@EB@@AAE@@@@C@A@@BA@@@C@A@@BA@A@@@A@@@A@@@ALEB@@ABC@@AA@@B@J@B@BAFA@AACA@@A@ABA@A@@B@B@B@@@@ABA@@@@@@CAA@C@A@@@A@@@@ABA@A@@BA@@AAAA@@AA@@CC@@@A@@@AAAAA@AA@@A@AB@@AB@@@BA@@@AB@BA@A@@@@AA@@@@FABA@BB@B@B@D@@@BABAFAB@BA@@B@B@AA@CAA@@C@@@@@@@A@@@AAA@@@@@@@@A@@@A@@AA@AA@@@@AAC@@@@A@@A@@@A@@@@AC@@@A@@@A@CA@@@AC@A@@@AAA@AA@C@@@AA@@@A@@BA@@@@@@AA@@@@@A@A@@B@@A@@@@@A@AA@@@@A@A@@@A@@A@@@@A@@@AA@@A@A@@@A@@BA@A@@@ABAB@@@@A@@AA@A@@@AA@AA@@A@A@AA@@@@AC@AA@DEB@@@@A@AB@@ABA@@BAB@@@@A@AB@@CAC@A@@BAD@@@@A@ABA@AA@AA@@@AA@@BA@@@A@AB@@A@AA@A@@@AAC@@@C@@AAAA@AACA@@@A@@BE@A@@@AB@@A@@@A@@@@@AB@BA@AAA@@AA@CACAB@@A@A@@BA@@B@B@@AACB@A@@AA@@@AA@AA@AA@A@@A@@@C@CB@@@@@@AB@@CBA@@BC@@@A@@@@@CCA@CBABAB@@AB@@@BA@@@@AAA@@A@A@A@A@E@AAEAA@A@@@@@ACA@@A@@CA@@@@C@@@A@BB@@@B@DA@A@@BA@@@@DA@AA@@A@@@@AAB@A@@@@@@BA@@@AABAA@F@@@@@BA@@@@@ABAA@@A@@AAB@@@@@@@@A@@@A@@BA@@B@BAB@B@B@@E@A@A@@@AC@A@A@@@A@@@AAAAAAA@@@A@AA@@@@@@C@@B@@@CEAC@@@A@@@A@C@A@A@A@AD@B@@@@@BB@@@B@B@B@@@B@BB@@@B@B@B@@@BABA@@AA@@@A@@@A@@@AB@@@B@@@AA@@@AA@@@A@A@@@AAA@A@@ACBA@@@@@@AAAAA@@@@@AB@B@@@@A@@ACAA@A@CBE@@@A@@BABA@@@AA@@@@AA@@@A@@@@ACA@@@@@A@AA@@AA@@A@AAA@@AA@@@AA@@@AADAB@@@B@@@BA@@D@@@@@B@@AA@@A@@AA@@@@@ABA@@@@B@B@@AB@@@AA@AAA@A@@@AAC@@@@@ABA@ABA@@B@B@DA@@DC@@BA@@@A@@AA@@@AAA@A@C@CBA@@@@@ABAA@BC@C@A@@BA@A@@@A@ABA@@A@@@A@@AC@EA@@@@@AB@@AAA@AA@AA@@A@BAA@@@A@@@@AAA@@AA@@C@@@C@@@C@@@A@CBA@@@@@A@AA@BA@AB@@AB@B@D@@A@C@A@A@@@A@ABAB@BA@EB@A@A@@@C@A@A@A@@@A@AB@BAB@@@B@BA@A@@@AA@@AAA@C@@@@BA@@B@BAB@@ABA@@@A@@@CA@@A@@@A@AB@@A@@@A@@AA@A@@BA@@@A@@@ABA@@@@AA@@@AA@@AA@@@C@A@AA@@AA@@AA@A@@AA@@CA@@C@E@A@A@A@ABA@@@AA@@@ACAA@A@@@A@A@AAAB@@AB@@AB@@AB@BA@AA@ACA@@A@CD@@@@CA@AA@@@ABCB@@C@@@C@A@@@@@@D@@AB@@@BA@CB@@@@ABAB@@A@C@@@ABA@@B@@@@BBB@BB@BCBA@AF@BA@B@@BA@@B@B@B@BFB@B@@BBBB@BB@@@BB@BCB@@@B@BAB@@@B@@@@AD@@@BB@DB@@@B@B@B@@A@@BAD@@BB@@@B@B@B@@@BABABABCB@DBD@DAB@F@BE@A@ABEB@B@BAJA@A@AB@DEJCB@BBBDBCF@BBFADADADC@@DFBBBB@HB@@B@B@@@D@@@B@BBB@BA@BB@B@@@B@@BB@@B@@@@@BA@@B@AABA@@@A@ABA@@AA@@@CB@B@@@@@@@BAB@@A@A@ABC@@@A@@B@@@B@@AB@@B@@@BB@@@@@B@@AD@@A@C@@@A@@@@B@@AB@@ADABA@@@ABA@AB@@AB@BB@@BBD@B@B@BA@A@@B@@@BAB@BAB@@AB@@@BAB@@@BB@@B@@AB@@@B@BA@@@AD@B@@AB@@B@@B@B@B@B@B@B@@@@A@ABCDH@@@@B@D@BFHB@DHBD@@BB@BDFADBBDB@BADABBDD@LADAB@BBBB@DBBABCBABCAC@CBBBBBBB@D@BCBADCBABABBFA@ABBB@D@BFBDDAHA@C@@DBBDDBD@DBBBB@DBBABA@@DDF@F@BADABGF@DCB@FAD@DA@EBADADC@@BCD@B@@@@@B@@@DAHCFADGBGDA@AA@DE@@@C@A@CAC@@@A@A@CBCDAHBB@B@D@@@BABA@@BAD@B@BCBABC@@@@D@@@BAB@@A@CAEAEB@BABABC@@@@@@A@C@A@C@AB@@@BA@@@CA@AA@ABAB@@AB@@@CA@AA@B@@A@@@A@ACA@@ABAB@@A@@@@@@AA@@BA@A@@@@@@BCAG@@A@@@@A@@@A@C@A@A@C@@@@@@AABA@A@AACCABA@A@@@A@C@ABABCBCAC@A@@@@@ABAB@B@@AB@@B@BB@@BD@D@@@B@B@@@B@@B@@@@B@@BB@@BBDAB@@@@@@A@@@A@@D@@@B@@@@@@@BA@BBB@@@BBB@@@@A@A@@B@@CB@@@B@BA@@@@@AB@B@D@@@BB@@B@@@B@BB@BB@BBABBB@B@@B@B@@D@B@@@@B@B@B@@BBBD@@@B@@@B@@@@A@A@@BAAA@A@@AA@C@@@@@AA@@@A@@CBABEDA@@@@B@@CAAA@@@A@AAA@@@@A@A@@@AB@@A@A@@BAB@@@BA@@@AB@@A@A@@@AB@@AB@@@@EAC@@B@@@D@@@@@B@@BB@@@B@@@D@B@@@B@@EAA@A@AB@BA@@@CAAA@@@BA@@@A@@@@@AB@@@@A@@@A@AAA@A@@@A@@@AAA@A@@@A@@@@AC@@@@A@AAAA@AA@@@@AB@BA@AB@@A@AB@@@@@BBBBB@@@@@@@B@@AB@@AB@@BBDBBBB@@BBFBDBD@@B@DBB@@@AB@@@B@B@@C@@B@@A@@@@A@@CAA@ABA@A@@BA@C@@@@BAB@BAB@@@@A@@A@@@A@AAA@@A@A@@@A@@BAB@@@@AB@B@@BB@@@B@@BBB@@@@@@B@@@B@@@@@B@@@@BB@D@B@@B@@AB@B@B@B@BB@@B@@@@B@B@@@@@D@@A@CBA@@BE@@DCD@@CD@@AD@BAF@BABABDDCD@@CDC@@BAAABA@@@CBA@AB@@BCAC@A@AB@@ABAB@CCC@G@ABA@@BB@@D@@AB@B@@ABA@AB@@AA@BAB@B@@E@AA@@EAACAACB@BCBAFABC@CFCDEB@B@@AF@DI@CAAAAABA@C@AC@@A@@@A@AAAEC@@@@AAAE@AAACCCBC@@B@@@@AD@BABC@@@A@AACBA@CAC@ABAB@@@BAD@@EB@BCAA@C@@BA@EAA@AD@@A@ABCF@BABAD@BGDEFADCFBHGDG@E@AAAAA@ABAAC@@CBABAF@D@BA@A@CACACACCCAC@AB@@@ACBA@CD@BADA@CFADCD@BACA@ADBHAAA@C@CAC@@ACA@CA@CC@@@EACA@AA@E@@BGBABABEBA@CBC@A@AACAG@EB@DA@EACACCC@CAC@ABA@EBA@ADA@EBADEBCDE@EBBFABGBC@CBCB@@CB@DABADBBD@FDBBCBBBDDBBADAB@D@BCBIACDA@AD@BDBCDABCBABA@C@C@IF@AA@C@AAAFADABCB@@@@AB@@@@@DABABABADCDADCDCB@BADAB@B@@@@DFBBBD@B@DCBAB@B@@BDBB@DABDBHBBB@BABADAD@DHFFDFBAHDB@DABBBCBAB@B@FABCBA@CBCACAA@ABE@CFDBBBCBEDC@CD@DG@@D@DAAAB@@@@A@@B@B@@A@A@AB@@ABBBA@@B@B@@C@@@A@@@@@AB@@ABA@C@@@@B@B@@@B@B@@BB@@D@@@@@BB@BBB@@DB@BB@@@@BB@B@@BB@@@BBD@D@B@BB@@DBB@@@FDBBB@BBBD@BBB@@DA@@BA@ABBB@@AB@B@BAD@@@@AB@@ADCB@BC@@BABAB@@@B@@A@@B@@A@@@C@@@A@@AA@A@A@@@AEAB@@AB@@A@@B@@@@@BB@@B@@@D@@@B@@A@@@ADA@AB@BAB@@@B@ABBBB@@BB@@B@@@B@@BBBB@@B@@ADAB@@@DD@@@BB@@B@@BBBBB@BBBA@@B@@@B@@@B@@ABA@@B@B@B@BA@BBB@D@B@F@BBBABD@@@@@B@@@BD@@@B@@@@BAB@B@BAB@@@BABCB@B@@@@@BA@@@A@ABA@@BAB@FABADABA@@DCBABA@@@@@A@@B@@AB@@@B@B@DB@@@@B@@@BA@E@@DAF@D@@@@@B@@@B@BABA@AF@B@F@B@B@@@BD@@DD@@BA@@B@B@B@B@@@DAB@B@BBDBB@B@B@B@BA@@@@B@BAB@@D@D@@BDBB@@BB@B@B@D@@@@@@A@@@@@CA@@@@@BA@@BB@@@@@B@@@@@@B@@@@@@@@A@B@@@@@@@@B@AAB@@@@@@B@@@@@B@@@@@@@@ADB@@B@BA@BAB@@@@AB@D@@@BB@BBB@BBBAB@D@B@@BB@BB@@DBBB@D@B@@@B@B@@@BBB@@@D@BBB@B@@@B@@@@BBAB@DBD@DBD@BBD@BBDB@@@B@B@@@B@@B@@BB@BA@@BA@A@A@AB@@@B@BAB@@A@AD@@BBB@BD@@ABAB@B@@AB@B@@AB@@@B@@A@A@CB@@AB@BA@ABCBA@CFCDGDCBABAB@BAH@DAD@BBDBD@B@DAB@BEH@@@BEFABCHABCB@@ABABABEDABAB@B@JABAB@@@@@@@BDBBB@@DF@@@BB@FDB@D@BB@BBB@BB@@B@@BBB@@@B@@@DC@@BA@@D@@BB@@@B@B@@@@BBB@B@@@B@B@B@@@BBB@@BB@B@@@B@@BAB@B@D@@AB@BA@@BAB@B@B@B@BB@@D@B@B@B@@@@B@@@@BB@B@BBB@B@@C@A@ABE@A@AB@B@B@B@B@@@@@B@BBB@@B@@@@B@B@@A@@@@B@@@@@@BBBB@@B@@@BBB@BB@BAB@F@BAFAB@B@B@@@@ABABA@CD@@@B@D@@BBB@@B@B@@@B@@BB@@B@@BAB@B@@AD@B@@@BABAB@@@BBB@B@B@B@@ABAB@B@@@BB@BB@B@@DABAB@@B@B@@@BDB@@DB@@@D@AB@BA@@@@B@B@@@B@@AB@B@@@BABA@@BABA@@D@B@B@B@@@DAB@B@D@@AB@@@B@@@BABAB@@@B@B@BAB@B@@@B@B@B@@@@@B@B@@A@@BADA@A@@@A@@B@BA@@B@B@B@@@DAB@@@BBBABBB@@@@@@@@@@D@@@B@@@@@@D@B@@@DAB@B@@BB@@@BBB@@BBDB@B@B@B@@B@@B@D@B@@@@@B@@@B@B@@@BC@@BBBB@@BB@@BB@@@B@@AB@@D@B@BBB@@@B@@@BC@@@ABA@@BC@ABAB@BAFABA@A@@@@@A@@A@BA@@@AB@@A@A@@BAB@BAB@B@B@B@BB@@@@DD@B@B@BDBB@@@@@B@BAB@BAD@B@D@@@B@D@B@D@@ABAB@BB@@BAB@D@B@@@B@@@B@@BB@@BB@@@BBBBB@@@DB@AFE@@@ABABA@C@ADAB@@AB@@@B@BBB@@BB@@B@@BB@@BB@@B@BAD@B@B@D@@@BBB@@@@@ABBBAB@@ABA@@@@BBB@BA@B@BB@@@@@FBDB@DB@BBBB@@@B@@@DDB@B@DDBBB@BBFBBBFDDBBB@B@BADFDFD@@BBB@DA@BBBB@@@BB@@@BB@BB@BBBB@@BBF@@A@@BA@ABADB@B@@@B@B@DBBAD@@B@BBB@@@BA@AB@@@B@@AB@@A@@@@B@@AB@B@@@BA@@@BBDB@@@BA@@B@@@D@BAB@BAB@@A@A@@BB@BBBB@B@@AB@@A@A@A@@@@@BFB@BB@BB@B@@@B@BBBAB@@ABBB@BB@@DB@BBB@@BBBB@@@B@@AD@B@@A@CB@@AB@@@BA@@@@@AB@BA@B@@B@B@BA@AB@BA@@@@@@B@@B@@BBB@@@BABAB@BA@@B@@ABCB@B@@B@@BA@@B@@A@CB@B@@@@@B@@@B@BAB@B@D@B@B@B@D@@ABBB@BBBB@BBB@@@@@@@D@@@@@D@B@BCB@B@BA@@BA@@B@@AB@B@B@@@BB@BBBBDDD@@B@@BB@@@DADAB@B@B@BA@@BA@@@@B@@AB@@@@@@@B@B@@@B@@@BA@@B@D@@@B@@A@@@@@AB@@@D@@@B@BADA@AB@BBB@BBFLB@@BBBB@DAF@B@@@BBBABA@@@@@@AA@@@A@@@ABA@A@@@@@AB@@AA@@AA@@A@@@AB@@A@@C@@AAA@@B@@@AC@@@A@A@@@@B@B@BAAA@@@AC@@A@@@C@A@A@A@E@@B@@@BC@@B@BAB@@@AA@@AAA@BC@@BAB@BAB@FABA@@@A@@BC@ACA@AAA@@@AB@@ABAAC@@BA@@@A@A@@BA@@D@@@BA@@BA@@BC@@BBD@BBD@@@B@B@B@@@B@BA@@DB@@B@B@@ABCAA@A@ABA@AB@@@BBB@B@B@@@B@B@B@AA@A@A@AAA@A@C@ABC@@@A@A@@@AB@D@@@@A@@AAGA@@AAAA@@B@@AB@@@B@@A@@B@B@@@B@@@BA@@@CAA@A@@@AA@A@CA@@AA@@@AA@@@A@@AA@A@@AAA@AAAAA@A@@@@DABA@@BA@@@ABA@A@@@ADC@@B@AC@@AA@@B@@ABA@AB@@@B@@@DAB@B@B@D@@@@@BBB@@@@@@@@ABA@@BB@@FABAB@B@@@@ABA@@B@@A@A@A@A@A@A@@@@@A@A@@AA@A@@B@@ADB@@BA@@@AB@@@@AB@BADBD@@@DA@A@@@A@@AA@@BA@@@@B@@@@A@@AC@A@C@AAA@@@A@@BAB@B@@A@@@@@C@@BABAD@BAB@BAHC@B@@B@@BB@@@BBBBBBDBDDBB@B@@BD@BD@BB@DB@@BB@@D@D@BBBFB@@B@B@D@@@BABAB@DBB@BB@B@@@B@BBD@B@B@@AB@@B@DBBAB@B@BABAB@B@B@B@@CAA@ABABABA@AF@BAB@B@DA@@@BBBDBFB@BBB@BBBBB@BBBDBBB@BDDBDB@@@B@BBD@B@B@@BB@B@B@B@HBBDBB@BBBBB@@@@@A@CBAAABA@AAE@A@@BADAB@DBB@@@BA@AAA@EBC@ABABA@AD@DB@@@@@AB@@A@A@@BABA@@AA@@AAAAAC@AAC@EBE@A@CBABA@@BAD@BABA@@B@@@BC@@ACA@AC@CAE@@CC@AAAAEBAAC@C@C@A@A@@@@BABBB@@B@@D@BA@@B@BA@@AA@A@CDC@A@A@@@AAA@A@A@A@A@A@A@@@C@@@ACC@@@@BA@@@CBCBA@@DC@A@@A@@ABA@@@A@@@A@@@CAC@C@ABC@AB@BA@A@AD@HAD@D@D@BBBBB@DBBBB@B@BBB@BAD@DDBA@ABC@ABCAA@@BAB@BEBBDAD@@@@ADCBAD@BBDBB@FABB@@B@FA@ADBBABD@@@BAB@B@D@BBB@BDDBBB@BB@F@BBBBD@BFBD@BBD@B@DDBB@BBD@BB@D@D@BBBF@@B@B@@@BB@BD@BB@ABABAHCFBBDB@@B@@DCB@BA@@BA@@BA@B@AB@BC@@BAB@@ADA@ABABC@@@CC@CA@@@A@@@A@A@C@@@C@A@ABAACBA@@BA@@BCD@D@BABD@@D@DBD@DABABBBABCDB@@B@B@DAB@BAB@B@D@DCBCFDDDBBB@D@B@DBBABAF@BBD@HDBAB@BABBBBJCDDDABABC@ABCBABABBB@D@BEBCDBFDJBFDB@PJBAFA@@BA@@@A@A@@@@A@@@@@A@@AA@BA@@A@@ACA@@@A@@@A@A@AAA@AB@B@B@@@B@@@B@@@@@B@B@B@B@BAB@@A@A@EBA@@@AD@@@BA@CBC@C@@AAAAEA@@CAA@A@@@@A@A@@A@CA@@CAA@AAAAAA@@@@AA@@CA@@A@@AA@AACAA@A@@@ABE@CA@@AAC@GCCAA@ABA@AA@A@@AB@@A@@B@@A@A@A@AAA@@@A@AA@@AAABC@@@A@@AAAABABA@A@@ABAACCCCA@@BA@AAAAACA@A@AB@@ABAB@BCBC@ABA@@@AA@A@@A@AA@A@CAA@@A@@A@@ACA@ADC@@CC@AA@@AB@A@@AA@AA@@@A@AFAJ@JAD@FCD@B@BEBAB@AC@AA@@EBGFC@ADHB@@B@@BBBBD@D@BB@DB@BABBBB@BDAF@BAD@BCB@BAAA@C@@DBD@B@DCBB@@@BD@B@@@B@@C@AAAA@A@A@A@@@A@AA@@AAA@AA@@@AB@@@BA@@@@@A@@@@A@@A@@@@@A@AB@D@BBDA@@B@DA@ABCDABADBB@D@D@NDDAB@BABA@ABCBABABAFKDCBAFAB@BABA@E@C@@@CB@@AB@@AB@D@B@B@DAF@D@D@D@D@FB@@BBDFBB@@@B@B@@@B@@B@@B@@B@@BAB@BA@AB@@BB@@B@@@B@@@@B@@B@@@D@BB@@@AB@B@@@B@BBD@@@BA@@B@@@D@@@D@B@B@DBB@DBH@B@B@B@B@@A@@BA@CBC@@@@DAD@D@D@BBB@B@D@J@B@B@B@B@BAB@@@BA@ABADABA@@B@@@FDDB@@@@@ABABABA@CA@A@ACBA@AB@@A@A@C@ABAB@@@@BB@BABAFAD@DA@@B@D@B@@AAABABA@AA@A@@@AAAA@A@@@AA@AAAAAE@A@A@A@@AA@@AA@A@EC@A@ABCDCAA@A@C@A@@AAA@@A@ABC@A@@C@@@AAC@AAA@@BA@AA@AAA@ABAEC@C@@A@CAACAAAA@C@@@AA@@@A@ABA@@@EBBFC@@@AAA@AB@@ABBDAD@@@BACC@AB@@AAAAEF@@C@@AA@@A@ACA@AAA@AA@AACA@A@ABA@@AAA@@@AAA@ABA@A@A@ABCACCB@AAA@ABA@ABAAAAAA@ADA@CBDBABA@C@A@@ACDCB@D@JC@A@ABABCACBAA@ABAA@@A@AA@C@ACA@AA@@@A@@@CAAA@EACBCBAD@@C@GBC@CAE@CA@AAAC@A@@@AAAA@@AA@@ABA@@@@@AB@B@B@@A@CBA@@@A@BA@@@AA@@A@@@@@A@AA@BAA@@A@@@A@@@ABA@@@@@A@A@@B@@@@@@AA@@@C@@AA@A@A@A@@@A@@A@@AAAA@@@@BABA@C@A@A@AA@BA@AA@@ABGB@B@BAB@BABCBA@@@A@CGC@AAAAC@A@A@@AA@A@A@@BABCBABCB@@@B@@@BABC@@@A@@@@CA@@A@@@@@@@@A@C@@A@A@A@@@A@AA@@@@@A@@DA@@@@@C@A@@AA@@@@AA@@CA"],"encodeOffsets":[[111538,24892]]}}],"UTF8Encoding":true});})); | 11,327 | 11,327 | 0.546747 |
de00d327f2f7542e47d9303df2127393f4b748ba | 612 | js | JavaScript | assets/src/redux/utils/configureStore.js | hahatiantang/scaffolding | 520d819638eb22192b2a83cc7dfecf53db4bbec9 | [
"Apache-2.0"
] | null | null | null | assets/src/redux/utils/configureStore.js | hahatiantang/scaffolding | 520d819638eb22192b2a83cc7dfecf53db4bbec9 | [
"Apache-2.0"
] | 1 | 2020-07-16T01:47:12.000Z | 2020-07-16T01:47:12.000Z | assets/src/redux/utils/configureStore.js | hahatiantang/scaffolding | 520d819638eb22192b2a83cc7dfecf53db4bbec9 | [
"Apache-2.0"
] | null | null | null | /**
* 文件说明: 配置reducer
* 详细描述:
* 创建者: 余成龙
* 创建时间: 2016/6/28
* 变更记录:
*/
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import RootReducer from '../reducers';
module.exports = function (rootReducer = RootReducer, initialState = {}) {
//const store = createStoreWithMiddleware(rootReducer, initialState);
const store = createStore(rootReducer, initialState, compose(
applyMiddleware(thunk)
//applyMiddleware(createLogger())
//window.devToolsExtension ? window.devToolsExtension() : f => f
));
return store;
}; | 29.142857 | 74 | 0.723856 |
de013d43532071dd7a2194d3ebc1cd731e97c66f | 10,495 | js | JavaScript | node_modules/tiktok-scraper-without-watermark/src/function/index.js | DABOZE/Queen-Alexa | d24743fd7b48e6e68d08b74c56f00eb73035d1c0 | [
"MIT"
] | 4 | 2021-10-30T14:04:32.000Z | 2021-10-30T15:01:11.000Z | node_modules/tiktok-scraper-without-watermark/src/function/index.js | DABOZE/Queen-Alexa | d24743fd7b48e6e68d08b74c56f00eb73035d1c0 | [
"MIT"
] | null | null | null | node_modules/tiktok-scraper-without-watermark/src/function/index.js | DABOZE/Queen-Alexa | d24743fd7b48e6e68d08b74c56f00eb73035d1c0 | [
"MIT"
] | 9 | 2022-01-13T00:02:35.000Z | 2022-02-21T09:45:33.000Z | const { default: Axios } = require('axios')
const cheerio = require('cheerio')
const qs = require('qs')
const FormData = require('form-data')
function ssstik(url) {
return new Promise((resolve, reject) => {
var BASEurl = 'https://ssstik.io'
Axios.request({
url: BASEurl,
method: 'get',
headers: {
'cookie': '__cfduid=deb9cec7a40793d1abe009bb9961a92d41617497572; PHPSESSID=7ivsp9hc6askg1qocpi8lfpn7n; __cflb=02DiuEcwseaiqqyPC5q2cQqNGembhyZ5QaychuqFzev83; _ga=GA1.2.131585469.1617497575; _gid=GA1.2.1629908100.1617497575; _gat_UA-3524196-6=1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36',
'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"'
}
})
.then(({ data }) => {
const $ = cheerio.load(data)
const urlPost = $('form[data-hx-target="#target"]').attr('data-hx-post')
const tokenJSON = $('form[data-hx-target="#target"]').attr('include-vals')
const tt = tokenJSON.replace(/'/g, '').replace('tt:', '').split(',')[0]
const ts = tokenJSON.split('ts:')[1]
// console.log({ pst: urlPost, tt: tt, ts: ts })
var config = {
headers: {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'cookie': '__cfduid=deb9cec7a40793d1abe009bb9961a92d41617497572; PHPSESSID=7ivsp9hc6askg1qocpi8lfpn7n; __cflb=02DiuEcwseaiqqyPC5q2cQqNGembhyZ5QaychuqFzev83; _ga=GA1.2.131585469.1617497575; _gid=GA1.2.1629908100.1617497575; _gat_UA-3524196-6=1',
'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36',
},
dataPost: {
'id': url,
'locale': 'en',
'tt': tt,
'ts': ts
}
}
Axios.post(BASEurl + urlPost, qs.stringify(config.dataPost), { headers: config.headers })
.then(({ data }) => {
// return console.log(data)
const $ = cheerio.load(data)
const result = {
status: true,
text: $('div > p').text(),
videonowm: BASEurl + $('div > a.without_watermark').attr('href'),
videonowm2: $('div > a.without_watermark_direct').attr('href'),
music: $('div > a.music').attr('href')
}
if ($('div > a.without_watermark_direct').attr('href') !== undefined) {
resolve(result)
} else {
reject({ status: false, message: 'Tautan ini telah terunduh sebelumnya' })
}
})
.catch(reject)
})
.catch(reject)
})
}
// function snaptik(url) {
// return new Promise((resolve, reject) => {
// Axios.get('https://tiktokdownload.online/', {
// headers: {
// 'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',
// 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36'
// }
// }).then(({ data }) => {
// return console.log(data)
// const fd = new FormData()
// fd.append('url', url)
// Axios({
// url: 'http://snaptik.app/action-2021.php?lang=ID',
// data: fd,
// headers: {
// 'Content-Type': `application/x-www-form-urlencoded; charset=UTF-8`,
// 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
// 'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"'
// }
// }).then(({ data }) => {
// return console.log(data)
// const $ = cheerio.load(data)
// let url = []
// $('div > a.abutton.is-success').get().map(rest => {
// url.push($(rest).attr('href'))
// })
// resolve({ status: true, result: url })
// }).catch((e) => reject(e))
// })
// })
// }
function musicallydown(url) {
return new Promise((resolve, reject) => {
Axios.get('https://musicallydown.com', {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'cookie': '__cfduid=d1a03c762459f64f87734977f474142fe1618464905; session_data=ac6a59adeffddbf12d71d4d9e368fee9; _ga=GA1.2.1692872429.1618464910; _gid=GA1.2.371863113.1618464910; __atuvc=2%7C15; __atuvs=6077d08d902cbf1a001; __atssc=google%3B2',
}
})
.then(({ data }) => {
// return console.log(data)
const $ = cheerio.load(data)
let keyInput = []
$('form > div > div > input').get().map(rest => {
keyInput.push({
name: $(rest).attr('name'),
value: $(rest).attr('value')
})
})
const form = new FormData()
form.append(keyInput[0].name, url)
form.append(keyInput[1].name, keyInput[1].value)
form.append(keyInput[2].name, keyInput[2].value)
Axios({
method: 'POST',
url: 'https://musicallydown.com/download',
data: form,
headers: {
'Content-Type': `multipart/form-data; boundary=${form._boundary}`,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
'cookie': '__cfduid=d1a03c762459f64f87734977f474142fe1618464905; session_data=ac6a59adeffddbf12d71d4d9e368fee9; _ga=GA1.2.1692872429.1618464910; _gid=GA1.2.371863113.1618464910; __atuvc=2%7C15; __atuvs=6077d08d902cbf1a001; __atssc=google%3B2',
'origin': 'https://musicallydown.com',
'referer': 'https://musicallydown.com/'
}
}).then(({ data }) => {
const result = {
status: true,
message: 'Created By MRHRTZ',
title: $('div.row > div > h2 > b').text(),
preview: $('div.row > div > h1.cushead.white-text > video#video').attr('poster'),
download: $('div.row > div > a:nth-child(4)'),
download_direct: $('div.row > div > a:nth-child(5)')
}
resolve(data)
})
})
})
}
function keeptiktok(url) {
return new Promise((resolve, reject) => {
Axios.get('https://keeptiktok.com/?lang=ID', {
headers: {
'Cookie': '__cfduid=d5db462e7efb9bb76bcf89765dbd896c91617891082; PHPSESSID=5a017bebc34ef170ddec3b7c71a0bbe8; _ga=GA1.2.1193000489.1617891094; _gid=GA1.2.408908588.1617891094; ads=ok; __atuvc=3|14; __atuvs=606f0f171d8ce8a1002; __atssc=google;2'
}
})
.then(({ data }) => {
const $ = cheerio.load(data)
const token = $('input#token').attr('value')
const fd = new FormData()
fd.append('url', url)
fd.append('token', token)
Axios({
method: 'POST',
url: 'https://keeptiktok.com/index.php',
data: fd,
headers: {
'Content-Type': `multipart/form-data; boundary=${fd._boundary}`,
'Cookie': '__cfduid=d5db462e7efb9bb76bcf89765dbd896c91617891082; PHPSESSID=5a017bebc34ef170ddec3b7c71a0bbe8; _ga=GA1.2.1193000489.1617891094; _gid=GA1.2.408908588.1617891094; ads=ok; __atuvc=3|14; __atuvs=606f0f171d8ce8a1002; __atssc=google;2'
}
}).then(({ data }) => {
const $ = cheerio.load(data)
const text = $('div.download-info > div.video_des').text()
Axios.get('https://keeptiktok.com/dl.php', {
responseType: 'arraybuffer',
headers: {
'referer': $('link[rel="canonical"]').attr('href'),
'Cookie': '__cfduid=d5db462e7efb9bb76bcf89765dbd896c91617891082; PHPSESSID=5a017bebc34ef170ddec3b7c71a0bbe8; _ga=GA1.2.1193000489.1617891094; _gid=GA1.2.408908588.1617891094; ads=ok; __atuvc=3|14; __atuvs=606f0f171d8ce8a1002; __atssc=google;2'
}
}).then(({ data }) => {
const base64 = Buffer.from(data)
resolve({ status: true, result: { text: text, base64: base64.toString('base64') } })
})
}).catch((e) => reject({ status: false, message: e.message }))
})
})
}
module.exports.keeptiktok = keeptiktok
module.exports.musicallydown = musicallydown
module.exports.ssstik = ssstik | 56.72973 | 278 | 0.468699 |
de01512f1ac4d12849d76377f3f3b7b2baeaa050 | 408 | js | JavaScript | backend/server.js | webmasterdro/whitelist-fivem | 34553d09af26b39c0f8727a15484807ff27c9861 | [
"MIT"
] | 6 | 2019-08-31T21:25:21.000Z | 2021-02-23T23:38:36.000Z | backend/server.js | brunohccz/whitelist-fivem | 00f84953735a5f6a25f25d01278f0b3f69fe1e4b | [
"MIT"
] | null | null | null | backend/server.js | brunohccz/whitelist-fivem | 00f84953735a5f6a25f25d01278f0b3f69fe1e4b | [
"MIT"
] | 7 | 2019-09-02T17:23:07.000Z | 2022-01-27T14:11:00.000Z | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const router = require('./router/routes');
const app = express()
app.disable('x-powered-by');
app.use(bodyParser.json());
app.use(cors())
app.use('/api', router);
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`API Server listening on ${port}`)
}); | 24 | 49 | 0.642157 |
de01c5109d89a0e992de8aef4ca5d7409388859f | 616 | js | JavaScript | TSDemoDemo/DemoApp/DemoNormalPage.js | dvlproad/001-UIKit-CQDemo-ReactNative | 24a3d8e26f4ce99af8736f85984b33ad1f82d78e | [
"MIT"
] | null | null | null | TSDemoDemo/DemoApp/DemoNormalPage.js | dvlproad/001-UIKit-CQDemo-ReactNative | 24a3d8e26f4ce99af8736f85984b33ad1f82d78e | [
"MIT"
] | 2 | 2021-05-11T15:18:20.000Z | 2022-02-10T18:23:31.000Z | TSDemoDemo/DemoApp/DemoNormalPage.js | dvlproad/001-UIKit-CQDemo-ReactNative | 24a3d8e26f4ce99af8736f85984b33ad1f82d78e | [
"MIT"
] | null | null | null | import React, {Component} from 'react';
import { View, Button } from "react-native";
export default class DemoNormalPage extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={{flex: 1, justifyContent: "center", backgroundColor:"#F5F5F5"}}>
<Button
style={{height: 60, marginTop:40, backgroundColor:"green"}}
title={"返回首页"}
onPress={()=>{this.props.navigation && this.props.navigation.navigate('main')}}
/>
</View>
)
}
}
| 28 | 99 | 0.521104 |
de01fcaaeccb035e13f5e713db2fa0cfc1747dd0 | 259 | js | JavaScript | external/mlsl/l_mlsl_2018.1.005/doc/api/search/all_71.js | donghn/intel-caffe | 4109ca69ec64e6b6f02fcad98e72ea43d1079db0 | [
"Intel",
"BSD-2-Clause"
] | 94 | 2017-11-11T04:11:57.000Z | 2021-08-13T09:37:44.000Z | external/mlsl/l_mlsl_2018.1.005/doc/api/search/all_71.js | donghn/intel-caffe-old | 4109ca69ec64e6b6f02fcad98e72ea43d1079db0 | [
"Intel",
"BSD-2-Clause"
] | 18 | 2017-11-28T09:50:18.000Z | 2020-01-14T07:00:28.000Z | external/mlsl/l_mlsl_2018.1.005/doc/api/search/all_71.js | donghn/intel-caffe-old | 4109ca69ec64e6b6f02fcad98e72ea43d1079db0 | [
"Intel",
"BSD-2-Clause"
] | 41 | 2017-11-18T21:51:08.000Z | 2022-01-31T03:46:09.000Z | var searchData=
[
['quant_5fbuffer_5ffunc_5fname',['quant_buffer_func_name',['../structMLSL_1_1QuantParams.html#a350a858ed5502252435fa7608edda416',1,'MLSL::QuantParams']]],
['quantparams',['QuantParams',['../structMLSL_1_1QuantParams.html',1,'MLSL']]]
];
| 43.166667 | 156 | 0.760618 |
de0296d3c465c058064af1d1f9f8c777e84247b8 | 22,525 | js | JavaScript | SealSelenium/einy9uds.selenium/extensions/cpmanager@mozillaonline.com/pfs/content/plugins/pluginInstallerWizard.js | lintyleo/seleniumpro | feb643143b6b19a0f1d99151c74504edf736d110 | [
"MIT"
] | 10 | 2017-04-05T19:57:51.000Z | 2020-12-04T06:36:46.000Z | SealPySelenium/abcapz7b.weekend/extensions/cpmanager@mozillaonline.com/pfs/content/plugins/pluginInstallerWizard.js | lintyleo/seleniumpro | feb643143b6b19a0f1d99151c74504edf736d110 | [
"MIT"
] | null | null | null | SealPySelenium/abcapz7b.weekend/extensions/cpmanager@mozillaonline.com/pfs/content/plugins/pluginInstallerWizard.js | lintyleo/seleniumpro | feb643143b6b19a0f1d99151c74504edf736d110 | [
"MIT"
] | 6 | 2017-11-01T00:54:50.000Z | 2019-12-18T05:26:47.000Z | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function nsPluginInstallerWizard(){
// create the request array
this.mPluginRequests = new Map();
// create the plugin info array.
// a hash indexed by plugin id so we don't install
// the same plugin more than once.
this.mPluginInfoArray = new Object();
this.mPluginInfoArrayLength = 0;
// holds plugins we couldn't find
this.mPluginNotFoundArray = new Object();
this.mPluginNotFoundArrayLength = 0;
// array holding pids of plugins that require a license
this.mPluginLicenseArray = new Array();
// how many plugins are to be installed
this.pluginsToInstallNum = 0;
this.mBrowser = null;
this.mSuccessfullPluginInstallation = 0;
this.mNeedsRestart = false;
// arguments[0] is an object that contains two items:
// a mimetype->pluginInfo map of missing plugins,
// a reference to the browser that needs them,
// so we can notify which browser can be reloaded.
if ("arguments" in window) {
for (let [mimetype, pluginInfo] of window.arguments[0].plugins){
this.mPluginRequests.set(mimetype, new nsPluginRequest(pluginInfo));
}
this.mBrowser = window.arguments[0].browser;
}
this.WSPluginCounter = 0;
this.licenseAcceptCounter = 0;
this.prefBranch = null;
}
nsPluginInstallerWizard.prototype.getPluginData = function (){
// for each mPluginRequests item, call the datasource
this.WSPluginCounter = 0;
// initiate the datasource call
var rdfUpdater = new nsRDFItemUpdater(this.getOS(), this.getChromeLocale());
for (let [mimetype, pluginRequest] of this.mPluginRequests) {
rdfUpdater.checkForPlugin(pluginRequest);
}
}
// aPluginInfo is null if the datasource call failed, and pid is -1 if
// no matching plugin was found.
nsPluginInstallerWizard.prototype.pluginInfoReceived = function (aPluginRequestItem, aPluginInfo){
this.WSPluginCounter++;
if (aPluginInfo && (aPluginInfo.pid != -1) ) {
// hash by id
this.mPluginInfoArray[aPluginInfo.pid] = new PluginInfo(aPluginInfo);
this.mPluginInfoArrayLength++;
} else {
this.mPluginNotFoundArray[aPluginRequestItem.mimetype] = aPluginRequestItem;
this.mPluginNotFoundArrayLength++;
}
var progressMeter = document.getElementById("ws_request_progress");
if (progressMeter.getAttribute("mode") == "undetermined")
progressMeter.setAttribute("mode", "determined");
progressMeter.setAttribute("value",
((this.WSPluginCounter / this.mPluginRequests.size) * 100) + "%");
if (this.WSPluginCounter == this.mPluginRequests.size) {
// check if no plugins were found
if (this.mPluginInfoArrayLength == 0) {
this.advancePage("lastpage");
} else {
this.advancePage(null);
}
} else {
// process more.
}
}
nsPluginInstallerWizard.prototype.showPluginList = function (){
var myPluginList = document.getElementById("pluginList");
var hasPluginWithInstallerUI = false;
// clear children
for (var run = myPluginList.childNodes.length; run > 0; run--)
myPluginList.removeChild(myPluginList.childNodes.item(run));
this.pluginsToInstallNum = 0;
for (var pluginInfoItem in this.mPluginInfoArray){
// [plugin image] [Plugin_Name Plugin_Version]
var pluginInfo = this.mPluginInfoArray[pluginInfoItem];
// create the checkbox
var myCheckbox = document.createElement("checkbox");
myCheckbox.setAttribute("checked", "true");
myCheckbox.addEventListener("command", (evt) => {
gPluginInstaller.toggleInstallPlugin(pluginInfo.pid, evt.target);
});
// XXXlocalize (nit)
myCheckbox.setAttribute("label", pluginInfo.name + " " + (pluginInfo.version ? pluginInfo.version : ""));
myCheckbox.setAttribute("src", pluginInfo.IconUrl);
myPluginList.appendChild(myCheckbox);
if (pluginInfo.InstallerShowsUI == "true")
hasPluginWithInstallerUI = true;
// keep a running count of plugins the user wants to install
this.pluginsToInstallNum++;
}
if (hasPluginWithInstallerUI)
document.getElementById("installerUI").hidden = false;
this.canAdvance(true);
this.canRewind(false);
}
nsPluginInstallerWizard.prototype.toggleInstallPlugin = function (aPid, aCheckbox) {
this.mPluginInfoArray[aPid].toBeInstalled = aCheckbox.checked;
// if no plugins are checked, don't allow to advance
this.pluginsToInstallNum = 0;
for (var pluginInfoItem in this.mPluginInfoArray){
if (this.mPluginInfoArray[pluginInfoItem].toBeInstalled)
this.pluginsToInstallNum++;
}
if (this.pluginsToInstallNum > 0)
this.canAdvance(true);
else
this.canAdvance(false);
}
nsPluginInstallerWizard.prototype.canAdvance = function (aBool){
document.getElementById("plugin-installer-wizard").canAdvance = aBool;
}
nsPluginInstallerWizard.prototype.canRewind = function (aBool){
document.getElementById("plugin-installer-wizard").canRewind = aBool;
}
nsPluginInstallerWizard.prototype.canCancel = function (aBool){
document.documentElement.getButton("cancel").disabled = !aBool;
}
nsPluginInstallerWizard.prototype.showLicenses = function (){
this.canAdvance(false);
this.canRewind(false);
// only add if a license is provided and the plugin was selected to
// be installed
for (var pluginInfoItem in this.mPluginInfoArray){
var myPluginInfoItem = this.mPluginInfoArray[pluginInfoItem];
if (myPluginInfoItem.toBeInstalled && myPluginInfoItem.licenseURL && (myPluginInfoItem.licenseURL != ""))
this.mPluginLicenseArray.push(myPluginInfoItem.pid);
}
if (this.mPluginLicenseArray.length == 0) {
// no plugins require licenses
this.advancePage(null);
} else {
this.licenseAcceptCounter = 0;
// add a nsIWebProgress listener to the license iframe.
var docShell = document.getElementById("licenseIFrame").docShell;
var iiReq = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
var webProgress = iiReq.getInterface(Components.interfaces.nsIWebProgress);
webProgress.addProgressListener(gPluginInstaller.progressListener,
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.showLicense();
}
}
nsPluginInstallerWizard.prototype.enableNext = function (){
// if only one plugin exists, don't enable the next button until
// the license is accepted
if (gPluginInstaller.pluginsToInstallNum > 1)
gPluginInstaller.canAdvance(true);
document.getElementById("licenseRadioGroup1").disabled = false;
document.getElementById("licenseRadioGroup2").disabled = false;
}
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
nsPluginInstallerWizard.prototype.progressListener = {
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
if ((aStateFlags & nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)) {
// iframe loaded
gPluginInstaller.enableNext();
}
},
onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress,
aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
{},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{},
QueryInterface : function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
}
}
nsPluginInstallerWizard.prototype.showLicense = function (){
var pluginInfo = this.mPluginInfoArray[this.mPluginLicenseArray[this.licenseAcceptCounter]];
this.canAdvance(false);
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
document.getElementById("licenseIFrame").webNavigation.loadURI(pluginInfo.licenseURL, loadFlags, null, null, null);
document.getElementById("pluginLicenseLabel").firstChild.nodeValue =
this.getFormattedString("pluginLicenseAgreement.label", [pluginInfo.name]);
document.getElementById("licenseRadioGroup1").disabled = true;
document.getElementById("licenseRadioGroup2").disabled = true;
document.getElementById("licenseRadioGroup").selectedIndex =
pluginInfo.licenseAccepted ? 0 : 1;
}
nsPluginInstallerWizard.prototype.showNextLicense = function (){
var rv = true;
if (this.mPluginLicenseArray.length > 0) {
this.storeLicenseRadioGroup();
this.licenseAcceptCounter++;
if (this.licenseAcceptCounter < this.mPluginLicenseArray.length) {
this.showLicense();
rv = false;
this.canRewind(true);
}
}
return rv;
}
nsPluginInstallerWizard.prototype.showPreviousLicense = function (){
this.storeLicenseRadioGroup();
this.licenseAcceptCounter--;
if (this.licenseAcceptCounter > 0)
this.canRewind(true);
else
this.canRewind(false);
this.showLicense();
// don't allow to return from the license screens
return false;
}
nsPluginInstallerWizard.prototype.storeLicenseRadioGroup = function (){
var pluginInfo = this.mPluginInfoArray[this.mPluginLicenseArray[this.licenseAcceptCounter]];
pluginInfo.licenseAccepted = !document.getElementById("licenseRadioGroup").selectedIndex;
}
nsPluginInstallerWizard.prototype.licenseRadioGroupChange = function(aAccepted) {
// only if one plugin is to be installed should selection change the next button
if (this.pluginsToInstallNum == 1)
this.canAdvance(aAccepted);
}
nsPluginInstallerWizard.prototype.advancePage = function (aPageId){
this.canAdvance(true);
document.getElementById("plugin-installer-wizard").advance(aPageId);
}
nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
this.canAdvance(false);
this.canRewind(false);
var installerPlugins = [];
var xpiPlugins = [];
for (var pluginInfoItem in this.mPluginInfoArray){
var pluginItem = this.mPluginInfoArray[pluginInfoItem];
if (pluginItem.toBeInstalled && pluginItem.licenseAccepted) {
if (pluginItem.InstallerLocation)
installerPlugins.push(pluginItem);
else if (pluginItem.XPILocation)
xpiPlugins.push(pluginItem);
}
}
if (installerPlugins.length > 0 || xpiPlugins.length > 0)
PluginInstallService.startPluginInstallation(installerPlugins,
xpiPlugins);
else
this.advancePage(null);
}
/*
0 starting download
1 download finished
2 starting installation
3 finished installation
4 all done
*/
nsPluginInstallerWizard.prototype.pluginInstallationProgress = function (aPid, aProgress, aError) {
var statMsg = null;
var pluginInfo = gPluginInstaller.mPluginInfoArray[aPid];
switch (aProgress) {
case 0:
statMsg = this.getFormattedString("pluginInstallation.download.start", [pluginInfo.name]);
break;
case 1:
statMsg = this.getFormattedString("pluginInstallation.download.finish", [pluginInfo.name]);
break;
case 2:
statMsg = this.getFormattedString("pluginInstallation.install.start", [pluginInfo.name]);
var progressElm = document.getElementById("plugin_install_progress");
progressElm.setAttribute("mode", "undetermined");
break;
case 3:
if (aError) {
statMsg = this.getFormattedString("pluginInstallation.install.error", [pluginInfo.name, aError]);
pluginInfo.error = aError;
} else {
statMsg = this.getFormattedString("pluginInstallation.install.finish", [pluginInfo.name]);
pluginInfo.error = null;
}
break;
case 4:
statMsg = this.getString("pluginInstallation.complete");
break;
}
if (statMsg)
document.getElementById("plugin_install_progress_message").value = statMsg;
if (aProgress == 4) {
this.advancePage(null);
}
}
nsPluginInstallerWizard.prototype.pluginInstallationProgressMeter = function (aPid, aValue, aMaxValue){
var progressElm = document.getElementById("plugin_install_progress");
if (progressElm.getAttribute("mode") == "undetermined")
progressElm.setAttribute("mode", "determined");
progressElm.setAttribute("value", Math.ceil((aValue / aMaxValue) * 100) + "%")
}
nsPluginInstallerWizard.prototype.addPluginResultRow = function (aImgSrc, aName, aNameTooltip, aStatus, aStatusTooltip, aManualUrl){
var myRows = document.getElementById("pluginResultList");
var myRow = document.createElement("row");
myRow.setAttribute("align", "center");
// create the image
var myImage = document.createElement("image");
myImage.setAttribute("src", aImgSrc);
myImage.setAttribute("height", "16px");
myImage.setAttribute("width", "16px");
myRow.appendChild(myImage)
// create the labels
var myLabel = document.createElement("label");
myLabel.setAttribute("value", aName);
if (aNameTooltip)
myLabel.setAttribute("tooltiptext", aNameTooltip);
myRow.appendChild(myLabel);
if (aStatus) {
myLabel = document.createElement("label");
myLabel.setAttribute("value", aStatus);
myRow.appendChild(myLabel);
}
// manual install
if (aManualUrl) {
var myButton = document.createElement("button");
var manualInstallLabel = this.getString("pluginInstallationSummary.manualInstall.label");
var manualInstallTooltip = this.getString("pluginInstallationSummary.manualInstall.tooltip");
myButton.setAttribute("label", manualInstallLabel);
myButton.setAttribute("tooltiptext", manualInstallTooltip);
myRow.appendChild(myButton);
// XXX: XUL sucks, need to add the listener after it got added into the document
if (aManualUrl)
myButton.addEventListener("command", function() { gPluginInstaller.loadURL(aManualUrl) }, false);
}
myRows.appendChild(myRow);
}
nsPluginInstallerWizard.prototype.showPluginResults = function (){
var myRows = document.getElementById("pluginResultList");
// clear children
for (var run = myRows.childNodes.length; run--; run > 0)
myRows.removeChild(myRows.childNodes.item(run));
for (var pluginInfoItem in this.mPluginInfoArray){
// [plugin image] [Plugin_Name Plugin_Version] [Success/Failed] [Manual Install (if Failed)]
var myPluginItem = this.mPluginInfoArray[pluginInfoItem];
if (myPluginItem.toBeInstalled) {
var statusMsg;
var statusTooltip;
if (myPluginItem.error){
statusMsg = this.getString("pluginInstallationSummary.failed");
statusTooltip = myPluginItem.error;
} else if (!myPluginItem.licenseAccepted) {
statusMsg = this.getString("pluginInstallationSummary.licenseNotAccepted");
} else if (!myPluginItem.XPILocation && !myPluginItem.InstallerLocation) {
statusMsg = this.getString("pluginInstallationSummary.notAvailable");
} else {
this.mSuccessfullPluginInstallation++;
statusMsg = this.getString("pluginInstallationSummary.success");
// only check needsRestart if the plugin was successfully installed.
if (myPluginItem.needsRestart)
this.mNeedsRestart = true;
}
// manual url - either returned from the webservice or the pluginspage attribute
var manualUrl;
if ((myPluginItem.error || (!myPluginItem.XPILocation && !myPluginItem.InstallerLocation)) &&
(myPluginItem.manualInstallationURL || this.mPluginRequests.get(myPluginItem.requestedMimetype).pluginsPage)){
manualUrl = myPluginItem.manualInstallationURL ? myPluginItem.manualInstallationURL : this.mPluginRequests.get(myPluginItem.requestedMimetype).pluginsPage;
}
this.addPluginResultRow(
myPluginItem.IconUrl,
myPluginItem.name + " " + (myPluginItem.version ? myPluginItem.version : ""),
null,
statusMsg,
statusTooltip,
manualUrl);
}
}
// handle plugins we couldn't find
for (pluginInfoItem in this.mPluginNotFoundArray){
var pluginRequest = this.mPluginNotFoundArray[pluginInfoItem];
// if there is a pluginspage, show UI
if (pluginRequest.pluginsPage) {
this.addPluginResultRow(
"",
this.getFormattedString("pluginInstallation.unknownPlugin", [pluginInfoItem]),
null,
null,
null,
pluginRequest.pluginsPage);
}
}
// no plugins were found, so change the description of the final page.
if (this.mPluginInfoArrayLength == 0) {
var noPluginsFound = this.getString("pluginInstallation.noPluginsFound");
document.getElementById("pluginSummaryDescription").setAttribute("value", noPluginsFound);
} else if (this.mSuccessfullPluginInstallation == 0) {
// plugins found, but none were installed.
var noPluginsInstalled = this.getString("pluginInstallation.noPluginsInstalled");
document.getElementById("pluginSummaryDescription").setAttribute("value", noPluginsInstalled);
}
document.getElementById("pluginSummaryRestartNeeded").hidden = !this.mNeedsRestart;
var app = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
if (this.mNeedsRestart) {
var cancel = document.getElementById("plugin-installer-wizard").getButton("cancel");
cancel.label = this.getString("pluginInstallation.close.label");
cancel.accessKey = this.getString("pluginInstallation.close.accesskey");
var finish = document.getElementById("plugin-installer-wizard").getButton("finish");
finish.label = this.getFormattedString("pluginInstallation.restart.label", [app.name]);
finish.accessKey = this.getString("pluginInstallation.restart.accesskey");
this.canCancel(true);
}
else {
this.canCancel(false);
}
this.canAdvance(true);
this.canRewind(false);
}
nsPluginInstallerWizard.prototype.loadURL = function (aUrl){
// Check if the page where the plugin came from can load aUrl before
// loading it, and do *not* allow loading URIs that would inherit our
// principal.
var pluginPagePrincipal =
window.opener.content.document.nodePrincipal;
const nsIScriptSecurityManager =
Components.interfaces.nsIScriptSecurityManager;
var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
.getService(nsIScriptSecurityManager);
secMan.checkLoadURIStrWithPrincipal(pluginPagePrincipal, aUrl,
nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
window.opener.open(aUrl);
}
nsPluginInstallerWizard.prototype.getString = function (aName){
return document.getElementById("pluginWizardString").getString(aName);
}
nsPluginInstallerWizard.prototype.getFormattedString = function (aName, aArray){
return document.getElementById("pluginWizardString").getFormattedString(aName, aArray);
}
nsPluginInstallerWizard.prototype.getOS = function (){
var httpService = Components.classes["@mozilla.org/network/protocol;1?name=http"]
.getService(Components.interfaces.nsIHttpProtocolHandler);
return httpService.oscpu;
}
nsPluginInstallerWizard.prototype.getChromeLocale = function (){
var chromeReg = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
return chromeReg.getSelectedLocale("global");
}
nsPluginInstallerWizard.prototype.getPrefBranch = function (){
if (!this.prefBranch)
this.prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
return this.prefBranch;
}
function nsPluginRequest(aPlugRequest){
this.mimetype = encodeURI(aPlugRequest.mimetype);
this.pluginsPage = aPlugRequest.pluginsPage;
}
function PluginInfo(aResult) {
this.name = aResult.name;
this.pid = aResult.pid;
this.version = aResult.version;
this.IconUrl = aResult.IconUrl;
this.InstallerLocation = aResult.InstallerLocation;
this.InstallerHash = aResult.InstallerHash;
this.XPILocation = aResult.XPILocation;
this.XPIHash = aResult.XPIHash;
this.InstallerShowsUI = aResult.InstallerShowsUI;
this.manualInstallationURL = aResult.manualInstallationURL;
this.requestedMimetype = aResult.requestedMimetype;
this.licenseURL = aResult.licenseURL;
this.needsRestart = (aResult.needsRestart == "true");
this.error = null;
this.toBeInstalled = true;
// no license provided, make it accepted
this.licenseAccepted = this.licenseURL ? false : true;
}
var gPluginInstaller;
function wizardInit(){
gPluginInstaller = new nsPluginInstallerWizard();
gPluginInstaller.canAdvance(false);
gPluginInstaller.getPluginData();
}
function wizardFinish(){
if (gPluginInstaller.mNeedsRestart) {
// Notify all windows that an application quit has been requested.
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
.createInstance(Components.interfaces.nsISupportsPRBool);
os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
// Something aborted the quit process.
if (!cancelQuit.data) {
var nsIAppStartup = Components.interfaces.nsIAppStartup;
var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]
.getService(nsIAppStartup);
appStartup.quit(nsIAppStartup.eAttemptQuit | nsIAppStartup.eRestart);
return true;
}
}
// don't refresh if no plugins were found or installed
if ((gPluginInstaller.mSuccessfullPluginInstallation > 0) &&
(gPluginInstaller.mPluginInfoArray.length != 0)) {
// reload plugins so JS detection works immediately
try {
var ph = Components.classes["@mozilla.org/plugin/host;1"]
.getService(Components.interfaces.nsIPluginHost);
ph.reloadPlugins(false);
}
catch (e) {
// reloadPlugins throws an exception if there were no plugins to load
}
if (gPluginInstaller.mBrowser) {
// notify listeners that a plugin is installed,
// so that they can reset the UI and update the browser.
var event = document.createEvent("Events");
event.initEvent("NewPluginInstalled", true, true);
gPluginInstaller.mBrowser.dispatchEvent(event);
}
}
return true;
}
| 34.814529 | 163 | 0.724306 |
de03155e7e16d9fb773e879dfa893e71b537784c | 1,094 | js | JavaScript | node_modules/css-vendor/tests/index.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 153 | 2017-11-05T01:42:39.000Z | 2022-03-02T08:24:36.000Z | node_modules/css-vendor/tests/index.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 212 | 2018-03-08T05:24:03.000Z | 2018-06-15T16:55:38.000Z | node_modules/css-vendor/tests/index.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 42 | 2018-01-21T15:57:18.000Z | 2021-08-16T10:03:22.000Z | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.supportedValue = exports.supportedProperty = exports.prefix = undefined;
var _prefix = require('./prefix');
var _prefix2 = _interopRequireDefault(_prefix);
var _supportedProperty = require('./supported-property');
var _supportedProperty2 = _interopRequireDefault(_supportedProperty);
var _supportedValue = require('./supported-value');
var _supportedValue2 = _interopRequireDefault(_supportedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = {
prefix: _prefix2['default'],
supportedProperty: _supportedProperty2['default'],
supportedValue: _supportedValue2['default']
}; /**
* CSS Vendor prefix detection and property feature testing.
*
* @copyright Oleg Slobodskoi 2015
* @website https://github.com/jsstyles/css-vendor
* @license MIT
*/
exports.prefix = _prefix2['default'];
exports.supportedProperty = _supportedProperty2['default'];
exports.supportedValue = _supportedValue2['default']; | 30.388889 | 97 | 0.745887 |
de0339fa63e81eba3d0c93e718381eb4232b90f1 | 294 | js | JavaScript | web/next.config.js | jswildcards/logicall | 1a1f0fe11dbe9cb2a41146c9f0ea6b21aa9adb8f | [
"MIT"
] | 9 | 2020-10-08T01:07:19.000Z | 2022-01-04T13:16:56.000Z | web/next.config.js | jswildcards/logicall | 1a1f0fe11dbe9cb2a41146c9f0ea6b21aa9adb8f | [
"MIT"
] | 7 | 2020-11-20T11:43:02.000Z | 2021-01-14T00:49:00.000Z | web/next.config.js | jswildcards/logicall | 1a1f0fe11dbe9cb2a41146c9f0ea6b21aa9adb8f | [
"MIT"
] | 3 | 2020-09-25T06:51:05.000Z | 2021-02-21T12:33:48.000Z | const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
module.exports = (phase) => {
if (phase === PHASE_DEVELOPMENT_SERVER) {
return {
env: {
SERVER_HOST: "localhost:3000",
},
};
}
return {
env: {
SERVER_HOST: "localhost",
},
};
};
| 16.333333 | 63 | 0.544218 |
de03a3d783f7f914d02452c439f33d7b69050465 | 189 | js | JavaScript | jest.integration.js | marionebl/geomap | 46df60e54a2f8c78a31488cd119cedad7537f9d7 | [
"Apache-2.0"
] | 6 | 2018-10-29T10:19:23.000Z | 2020-02-09T10:02:05.000Z | jest.integration.js | marionebl/geomap | 46df60e54a2f8c78a31488cd119cedad7537f9d7 | [
"Apache-2.0"
] | 34 | 2018-10-10T10:15:46.000Z | 2022-02-26T09:55:37.000Z | jest.integration.js | marionebl/geomap | 46df60e54a2f8c78a31488cd119cedad7537f9d7 | [
"Apache-2.0"
] | 7 | 2018-10-10T07:49:51.000Z | 2020-02-09T10:02:08.000Z | const ts = require('ts-jest');
const puppeteer = require('jest-puppeteer/jest-preset');
module.exports = {
...ts.jestPreset,
...puppeteer,
testMatch: ['<rootDir>/test/*.test.ts']
};
| 21 | 56 | 0.656085 |
de03dcee2af0d99ec92b59948d4f8326f88ce3dd | 2,510 | js | JavaScript | cypress/integration/lotto.spec.js | Suppplier/js-lotto | b421e64c773a29746d1a18d1b71c7733824c3ec7 | [
"MIT"
] | null | null | null | cypress/integration/lotto.spec.js | Suppplier/js-lotto | b421e64c773a29746d1a18d1b71c7733824c3ec7 | [
"MIT"
] | null | null | null | cypress/integration/lotto.spec.js | Suppplier/js-lotto | b421e64c773a29746d1a18d1b71c7733824c3ec7 | [
"MIT"
] | null | null | null | import { contentType } from "mime-types";
import { MESSAGE } from "../../src/js/constant.js";
import { inputMoneyActivity } from "./cypressFunc/inputMoneyActivity.js";
import { inputLottoNumbers } from "./cypressFunc/inputLottoNumber.js";
import {
checkLottoDisplay,
checkToggleButton,
} from "./cypressFunc/checkLottoDisplay.js";
import { pressRestartButton } from "./cypressFunc/pressRestartButton.js";
import { checkModalDisplay } from "./cypressFunc/checkModalDisplay.js";
describe("racing", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:5500/");
});
const buyTickets = (amount) => {
inputMoneyActivity(amount, 0, 1);
checkLottoDisplay(amount);
checkToggleButton("inline");
checkToggleButton("none");
};
let amount;
describe("금액 입력 관련", () => {
it("Case 1 - 금액이 1000 원 보다 낮은 경우", () => {
amount = "100";
inputMoneyActivity(amount, 0, 0);
});
it("Case 2 - 금액이 100000 원 보다 높은 경우", () => {
amount = "120000";
inputMoneyActivity(amount, 0, 0);
});
it("Case 3 - 금액이 범위에 맞지만 1000원 단위로 나누어 떨어지지 않는 경우", () => {
amount = "5500";
inputMoneyActivity(amount, 1, 0);
});
it("Case 4 - 숫자가 아닌 값을 입력하는 경우", () => {
amount = "ABC";
inputMoneyActivity(amount, 0, 0);
});
it("Case 5 - 정상적인 숫자를 입력하는 경우", () => {
amount = "7000";
inputMoneyActivity(amount, 0, 1);
});
});
describe("로또 구매 후 출력 체크", () => {
it("Case 1 - 1000원 어치 구매", () => {
amount = "1000";
buyTickets(amount);
checkModalDisplay(1, [2, 18, 24, 30, 32, 45, 14]);
pressRestartButton();
});
it("Case 2 - 8000원 어치 구매", () => {
amount = "8000";
buyTickets(amount);
checkModalDisplay(1, [2, 18, 24, 30, 32, 45, 14]);
pressRestartButton();
});
it("Case 3 - 30000원 어치 구매", () => {
amount = "30000";
buyTickets(amount);
checkModalDisplay(1, [2, 18, 24, 30, 32, 45, 14]);
pressRestartButton();
});
it("Case 4 - 100000원 어치 구매", () => {
amount = "100000";
buyTickets(amount);
checkModalDisplay(1, [2, 18, 24, 30, 32, 45, 14]);
pressRestartButton();
});
it("Case 5 - 중복된 번호를 입력하는 경우", () => {
amount = "1000";
buyTickets(amount);
inputLottoNumbers([2, 18, 24, 30, 32, 45]);
cy.get(".bonus-number").type(32);
cy.get(".open-result-modal-button").click();
cy.get("@windowAlert").should("be.calledWith", MESSAGE.NUM_DUP);
});
});
});
| 25.612245 | 73 | 0.561355 |
de0457f3097f215378ed4581ec19d155f5a38877 | 345 | js | JavaScript | icons/line_style_sharp.js | Justineo/vue-awesome-material | 4012d957674fbb907e00a5694b98695de17f238e | [
"MIT"
] | 10 | 2018-09-13T16:32:14.000Z | 2021-01-01T19:41:24.000Z | icons/line_style_sharp.js | Justineo/vue-awesome-material | 4012d957674fbb907e00a5694b98695de17f238e | [
"MIT"
] | 4 | 2021-03-08T21:52:04.000Z | 2022-02-26T05:45:53.000Z | icons/line_style_sharp.js | Justineo/vue-awesome-material-icons | 4012d957674fbb907e00a5694b98695de17f238e | [
"MIT"
] | null | null | null | import Icon from 'vue-awesome/components/Icon'
Icon.register({
line_style_sharp: {
paths: [
{
d: 'M3 16h5v-2H3v2zm6.5 0h5v-2h-5v2zm6.5 0h5v-2h-5v2zM3 20h2v-2H3v2zm4 0h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM3 12h8v-2H3v2zm10 0h8v-2h-8v2zM3 4v4h18V4H3z'
}
],
width: '24',
height: '24'
}
})
| 24.642857 | 181 | 0.655072 |
de049d31554ecc5fc74ab44459d41c447541ec34 | 22,668 | js | JavaScript | dist/sprestlib-ui.js | csoren/SpRestLib | 3f0626dbada05519df86b84b1edf18eab7d701f7 | [
"MIT"
] | null | null | null | dist/sprestlib-ui.js | csoren/SpRestLib | 3f0626dbada05519df86b84b1edf18eab7d701f7 | [
"MIT"
] | null | null | null | dist/sprestlib-ui.js | csoren/SpRestLib | 3f0626dbada05519df86b84b1edf18eab7d701f7 | [
"MIT"
] | null | null | null | /*\
|*| :: SpRestLib-UI.js ::
|*|
|*| JavaScript Library for SharePoint Web Serices
|*| https://github.com/gitbrent/SpRestLib
|*|
|*| This library is released under the MIT Public License (MIT)
|*|
|*| SpRestLib (C) 2016-2018 Brent Ely -- https://github.com/gitbrent
|*|
|*| 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.
\*/
(function(){
// APP VERSION/BUILD
var APP_VER = "1.0.0";
var APP_BLD = "20180216";
var SPRLIB_REQ = "1.4.0+";
var DEBUG = false; // (verbose mode/lots of logging)
// APP MESSAGE STRINGS (Internationalization)
var APP_STRINGS = {
"de": {
"false" : "Nein",
"noRows": "(Keine zeilen)",
"true" : "Ja"
},
"en": {
"false" : "No",
"noRows": "(No rows)",
"true" : "Yes"
},
"es": {
"false" : "No",
"noRows": "(No hay filas)",
"true" : "Sí"
},
"fr": {
"false" : "Non",
"noRows": "(Aucune ligne)",
"true" : "Oui"
},
"in": {
"false" : "नहीं",
"noRows": "(कोई पंक्तियाँ)",
"true" : "हाँ"
},
"jp": {
"false" : "偽",
"noRows": "(行がありません)",
"true" : "真実"
}
};
var APP_CSS = {
updatingBeg: { 'background-color':'#e2e9ec' },
updatingErr: { 'background-color':'#e2999c', 'color':'#fff' },
updatingEnd: { 'background-color':'', 'color':'' }
};
var APP_DATE_FORMATS = {
"US": "Ex: 02/14/2018 09:15:01",
"DATE": "",
"TIME": "",
"YYYYMMDD": "",
"INTLTIME": "",
"INTL": "",
"ISO": ""
};
// SPRESTLIB-UI Setup
sprLib.ui = {};
sprLib.ui.version = APP_VER+'-'+APP_BLD;
/* TODO:
* Add On-demand/Ad-hoc support (enable parsing/population *after* page is loaded)
* Add support for callback, so users can do things after the element is populated (Select a default, show a total somewhere, etc.)
* Add `Intl` (i18n) support (its supported in IE11!!) - Date and Currency formats are awesome (add Direction for our R->L users too?)
*/
/* ===============================================================================================
|
# #
# # ###### # ##### ###### ##### ####
# # # # # # # # # #
####### ##### # # # ##### # # ####
# # # # ##### # ##### #
# # # # # # # # # #
# # ###### ###### # ###### # # ####
|
==================================================================================================
*/
function formatCurrency(n, c, d, t) {
var c = isNaN(c = Math.abs(c)) ? 2 : c,
d = (d == undefined) ? "." : d,
t = (t == undefined) ? "," : t,
s = (n < 0) ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = ((j = i.length) > 3) ? (j % 3) : 0;
return APP_OPTS.currencyChar + s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
function formatDate(inDate, inType) {
var MONTHS = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
// REALITY-CHECK:
if ( !inDate ) return '';
var dateTemp = new Date(inDate);
dateMM = dateTemp.getMonth() + 1; dateDD = dateTemp.getDate(); dateYY = dateTemp.getFullYear();
h = dateTemp.getHours(); m = dateTemp.getMinutes(); s = dateTemp.getSeconds();
//
if (inType == "US") {
strFinalDate = (dateMM<=9 ? '0' + dateMM : dateMM) + "/" + (dateDD<=9 ? '0' + dateDD : dateDD) + "/" + dateYY + " " + (h<=9 ? '0' + h : h) + ":" + (m<=9 ? '0' + m : m) + ":" + (s<=9 ? '0' + s : s);
}
else if (inType == "DATE") {
strFinalDate = (dateMM<=9 ? '0' + dateMM : dateMM) + "/" + (dateDD<=9 ? '0' + dateDD : dateDD) + "/" + dateYY;
}
else if (inType == "TIME") {
strFinalDate = (h<=9 ? '0' + h : h) + ":" + (m<=9 ? '0' + m : m) + ":" + (s<=9 ? '0' + s : s);
}
else if (inType == "YYYYMMDD") {
strFinalDate = dateYY +"-"+ (dateMM<=9 ? '0' + dateMM : dateMM) +"-"+ (dateDD<=9 ? '0' + dateDD : dateDD) + " " + (h<=9 ? '0' + h : h) + ":" + (m<=9 ? '0' + m : m) + ":" + (s<=9 ? '0' + s : s);
}
else if (inType == "INTLTIME") {
strFinalDate = MONTHS[dateTemp.getMonth()] + " " + (dateDD<=9 ? '0' + dateDD : dateDD) + ", " + dateYY + " " + (h<=9 ? '0' + h : h) + ":" + (m<=9 ? '0' + m : m) + ":" + (s<=9 ? '0' + s : s);
}
else if (inType == "INTL") {
strFinalDate = MONTHS[dateTemp.getMonth()] + " " + (dateDD<=9 ? '0' + dateDD : dateDD) + ", " + dateYY;
}
else if (inType == "ISO") {
strFinalDate = dateYY +"-"+ (dateMM<=9 ? '0' + dateMM : dateMM) +"-"+ (dateDD<=9 ? '0' + dateDD : dateDD) +"T"+ (h<=9 ? '0' + h : h) + ":" + (m<=9 ? '0' + m : m) + ":" + (s<=9 ? '0' + s : s) + ".000Z";
}
if ( strFinalDate && (strFinalDate.indexOf("NaN") > -1 || strFinalDate.indexOf("undefined") > -1) ) return '';
return strFinalDate;
}
/* ===============================================================================================
|
###### # #######
# # # # # ##### # # # #### # # #### ##### # # ####
# # # ## # # # # ## # # # # # # # # # ## ## #
###### # # # # # # # # # # # # ##### # # # # # ## # ####
# # # # # # # # # # # # # ### # # # # ##### # # #
# # # # ## # # # # ## # # # # # # # # # # # #
###### # # # ##### # # # #### # # #### # # # # ####
|
==================================================================================================
*/
// TODO: Unimplemented/undocumented/undemoed... need to: Validate/Update/Document
function doParseFormIntoJson(inModel, inEleId) {
var objReturn = {
jsonSpData: {},
jsonFormat: {}
};
var strCol = "";
// STEP 1: REALITY-CHECK:
if ( $('#'+inEleId).length == 0 ) {
var strTemp = 'parseForm ERROR:\n\n'+ inEleId +' does not exist!';
( inModel.onFail ) ? inModel.onFail(strTemp) : console.error(strTemp);
return null;
}
// STEP 2: Parse all form fields into SP-JSON and Formatted values
$('#'+inEleId+' [data-bind]').each(function(i,tag){
// A: Get column name for this field
// Determine which type of binding we are dealing with:
// CASE 1: <input type="text" data-bind='{"col":"firstName"}'>
if ( $(this).data('bind').col )
strCol = $(this).data('bind').col;
// CASE 2: <input type="text" data-bind='{"text":{"model":"Employees", "cols":["firstName"]}}'>
else if ( $(this).data('bind')[Object.keys($(this).data('bind'))[0]].cols && $.isArray($(this).data('bind')[Object.keys($(this).data('bind'))[0]].cols) )
strCol = $(this).data('bind')[Object.keys($(this).data('bind'))[0]].cols[0];
else return;
// B: Handle fields not in Model (user may want some additional info inserted, etc.)
var dataName = ( inModel.listCols[strCol] ? inModel.listCols[strCol].dataName : strCol );
// C: Handle various element types
{
// CASE: <checkbox>
if ( $(this).is(':checkbox') ) {
objReturn.jsonSpData[dataName] = $(this).prop('checked');
objReturn.jsonFormat[strCol] = APP_STRINGS[APP_OPTS.language][$(this).prop('checked').toString()];
}
// CASE: <jquery-ui datepicker>
else if ( $(this).val() && $(this).hasClass('hasDatepicker') ) {
objReturn.jsonSpData[dataName] = $(this).datepicker('getDate').toISOString();
objReturn.jsonFormat[strCol] = ( inModel.listCols[strCol].dateFormat ? bdeLib.localDateStrFromSP(null,$(this).datepicker('getDate'),inModel.listCols[strCol].dateFormat) : $(this).datepicker('getDate').toISOString() );
}
// CASE: <select:single>
else if ( $(this).val() && $(this).prop('type') == 'select-one' ) {
objReturn.jsonSpData[dataName] = ($(this).data('type') && ($(this).data('type') == 'num' || $(this).data('type') == 'pct')) ? Number($(this).val()) : $(this).val().toString();
objReturn.jsonFormat[strCol] = objReturn.jsonSpData[dataName];
}
// CASE: <select:multiple>
else if ( $(this).val() && $(this).prop('type') == 'select-multiple' ) {
// TODO: This is for multi-lookup! Multi-choice w/b different - add code!
// EX: (SP2013/16): { "SkillsId": { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":[1,2,3] } }
var arrIds = [];
$.each($(this).val(), function(i,val){ arrIds.push( Number(val) ); });
objReturn.jsonSpData[dataName] = { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":arrIds };
objReturn.jsonFormat[strCol] = arrIds.toString();
}
// CASE: <radiobutton>
else if ( $(this).val() && $(this).is(':radio') ) {
// TODO: FUTURE: Add radiobutton, get value by name or whatever
}
// CASE: <textarea>
else if ( $(this).text() && $(this).prop('tagName').toUpperCase() == 'TEXTAREA' ) {
objReturn.jsonSpData[dataName] = $(this).text();
objReturn.jsonFormat[strCol] = $(this).text();
}
// CASE: (everything else - excluding buttons)
else if ( $(this).val() && $(this).prop('type') != 'submit' && $(this).prop('type') != 'reset' && $(this).prop('type') != 'button' ) {
objReturn.jsonSpData[dataName] = $(this).val();
objReturn.jsonFormat[strCol] = $(this).val();
}
// CASE: No value
else {
objReturn.jsonFormat[strCol] = '';
}
}
// D: Special Cases:
if ( $(this).val() && inModel.listCols[strCol] && inModel.listCols[strCol].isNumPct ) {
objReturn.jsonFormat[strCol] = ( Number( $(this).val() ) * 100 ) + '%';
}
});
// LAST:
return objReturn;
}
function doShowBusySpinners() {
// STEP 1: TABLE
$('table[data-bind]').each(function(i,tag){
if ( $(this).data('bind').options && $(this).data('bind').options.showBusySpinner ) {
$(this).append('<tbody class="sprlibuiTemp"><tr><td style="text-align:center">'+ APP_OPTS.busySpinnerHtml +'</td></tr></tbody>');
}
});
// STEP 2: TBODY
$('tbody[data-bind]').each(function(i,tag){
if ( $(this).data('bind').options && $(this).data('bind').options.showBusySpinner ) {
$(this).append('<tr class="sprlibuiTemp"><td colspan="'+ ($(this).parents('table').find('thead th').length || 1) +'" style="text-align:center">'+ APP_OPTS.busySpinnerHtml +'</td></tr>');
}
});
}
/**
* Find all page elements with `data-sprlib` property and populate them
*
* @example - `<table data-sprlib='{ "list":"Departments", "cols":["Title"], "showBusy":true }'></table>`
* @example - `<span data-sprlib='{ "list":"Employees", "value":"name", "filter":{"col":"Badge_x0020_Number", "op":"eq", "val":"666"} }'></span>`
* @example - `<select data-sprlib='{ "list":"Employees", "value":"Title", "text":"Id" }'></select>`
*/
function doPopulatePageElements() {
var objFilter = {}, objTable = null;
// Loop over all HTML tags with sprlib data properties
$('[data-sprlib]').each(function(idx,tag){
if (DEBUG) { console.log('--------------------'); console.log('Found tag: '+$(tag).prop('tagName')+' - id: '+$(tag).prop('id')); }
var arrColNames = [];
var objTagData = {};
// STEP 1: Parse `data-sprlib` from this tag
try {
// A: Retrieve object (NOTE: jQuery returns an JSON-type object automatically (no JSON.parse required))
objTagData = $(tag).data('sprlib');
// B: Ignore garbage tags or tags w/o a `list`
if ( typeof objTagData !== 'object' || !objTagData.list ) {
console.log('**Warning** this tag has `data-sprlib` but is defective: its data is not an object, or it lacks the `list` prop');
console.log(objTagData);
console.log(typeof objTagData);
console.log(objTagData.list ? objTagData.list : '!objTagData.list does not exist!');
return;
}
}
catch(ex) {
console.log('Unable to ingest data-sprlib!' + '\n' );
console.log('tag.: ' + $(tag)[0].outerHTML + '\n' );
console.log('data: ' );
console.log($(tag).data('sprlib') );
/* TODO: better err msg?
var strTemp = 'PARSE ERROR:\n\n(text requires "model"/"cols")\n'
+ 'Your code:\n'+ $(tag)['context'].outerHTML.replace(/\"\;/gi,'"') +'\n\n'
+ 'Should look like this:\n<'+ $(tag).prop('tagName') + ' data-bind:\'{"text":{"model":"Emps", "cols":"firstName"}}\'>';
*/
return;
}
// STEP 2: Set/Validate options
if ( objTagData.cols ) {
// 1:
if ( Array.isArray(objTagData.cols) ) {
objTagData.cols.forEach(function(col,idx){
if ( typeof col === 'string' ) arrColNames.push(col);
else if ( typeof col === 'object' ) {
if ( !col.hasOwnProperty('name') ) {
// TODO: better error msg (show in tag, etc.)
console.error("Error: column object lacks `name` property. Ex:`cols: [{name:'HireDate'}]`");
console.error(col);
}
else {
arrColNames.push(col.name);
}
}
});
}
}
// If a column is in a [select] text/value, then those 2 are the query cols
if ( objTagData.text ) arrColNames.push(objTagData.text);
if ( objTagData.value ) arrColNames.push(objTagData.value);
if ( objTagData.filter ) {
// A: Param Check (NOTE: Dont use "!$(tag).filter.val" as actual value may be [false] or ""!)
if ( !$(tag).filter.col || !$(tag).filter.op || typeof $(tag).filter.val === 'undefined' ) {
console.error('FILTER ERROR:\n\nYour filter:\n'+ $(tag)['context'].outerHTML.replace(/\"\;/gi,'"') +'\n\nShould look like this:\n"filter":{"col":"name", "op":"eq", "val":"bill"}\'>');
return;
}
else if ( !APP_FILTEROPS[$(tag).filter.op] ) {
console.error('FILTER ERROR:\n\nOperation Unknown:\n'+ $(tag).filter.op +'>');
return;
}
}
// STEP 3: Query and Populate tag
if (DEBUG) { console.log('objTagData: '); console.log(objTagData); }
sprLib.list(objTagData.list).getItems({
listCols: arrColNames,
queryFilter: objTagData.filter || null,
queryLimit: objTagData.limit || null,
queryOrderby: objTagData.order || null,
metadata: false
})
.then(function(arrItems){
// 3.A: Capture query results
objTagData.data = arrItems;
// 3.B: Remove any temporary UI items now that this element is being populated
$(tag).find('.sprlibuiTemp').remove();
// 3.C: Find/Populate element bound to this LIST object
if ( $(tag).is('select') || $(tag).is('table') || $(tag).is('tbody') ) {
if ( $(tag).is('select') ) {
if ( !objTagData.text && !objTagData.value ) {
reject('<select> requires `text` and `value`.\nEx: <select data-sprlib=\'{ "list":"Employees", "value":"Title", "text":"Id" }\'></select>');
}
$.each(objTagData.data, function(i,data){
console.log(data);
$(tag).append('<option value="'+ data[objTagData.value] +'">'+ data[objTagData.text] +'</option>');
});
}
else if ( $(tag).is('table') || $(tag).is('tbody') ) {
// 3.C.1: Prepare table
{
// CASE 1: <table>
if ( $(tag).is('table') ) {
// A: Destroy tablesorter before modifying table
if ( objTagData.tableSorter && $.tablesorter ) $(tag).trigger("destroy");
// B: Add or Empty <thead>
( $(tag).find('> thead').length == 0 ) ? $(tag).prepend('<thead/>') : $(tag).find('> thead').empty();
// C: Populate <thead>
var $row = $('<tr/>');
$.each(objTagData.cols, function(key,col){
if ( !col.hidden ) $row.append('<th>'+ (col.label || col.name || col) +'</th>');
});
$(tag).find('> thead').append( $row );
// D: Add or Empty <tbody>
( $(tag).find('> tbody').length == 0 ) ? $(tag).append('<tbody/>') : $(tag).find('> tbody').empty();
// E: Set loop fill object
objTable = $(tag);
}
// CASE 2: <tbody>
else if ( $(tag).is('tbody') ) {
$(tag).empty();
objTable = $(tag).parent('table');
}
}
// 3.C.2: Add table rows
objTagData.data.forEach(function(arrData,i){
// 1: Add row
isFilterPassed = false;
var $newRow = $('<tr/>');
// 2: Populate row cells
$.each(arrData, function(key,val){
var $cell = $('<td/>');
// A: Filtering: Check if filtering, if not give green light
// FIXME: Filtering: "filter": {"col":"active", "op":"eq", "val":false}} }
// TODO: should we use same object filter everywhere like in tables?
if ( !objFilter.col || ( objFilter.col == key && objFilter.op == "eq" && objFilter.val == val ) ) isFilterPassed = true;
// B: Populate and style cell for this result/column
objTagData.cols.forEach(function(col){
// CASE: "Title" or "Author/ID"
if ( typeof col === 'string' ) {
// FIXME: Current support is only for: 1-level deep (no User/Group/ID queries, etc.)
if ( col.indexOf("/") > -1 && col.split("/").length == 2) {
// `key='Manager'` val=`{Title:'Brent'}`
if ( key == col.split("/")[0] && val && val[col.split("/")[1]] ) $cell.text( val[col.split("/")[1]] );
}
else if ( objTagData.cols.indexOf(key) > -1 ) {
$cell.text( val );
}
}
// CASE: {name:"Title"} or {name:"Author/ID"}
// TODO: handle `Author/Title` etc. (SEE ABOVE)
else if ( col.hasOwnProperty('name') && col.name == key ) {
// A: Stringify boolean values (true/false)
if ( typeof val === 'boolean' ) val = val.toString().replace('true','Yes').replace('false','No');
// B: Create cell
if ( val && col.isNumPct && !isNaN(val) ) $cell.text( Math.round(val*100)+'%' );
// FIXME: get formatting working! (remove `dataType` below, use format)
else if ( val && col.dataType == 'Currency' && !isNaN(val) ) $cell.text( formatCurrency(val) );
else if ( val && col.dataType == 'DateTime' ) $cell.text( formatDate(val, (col.dateFormat||'INTL')) );
else if ( val && Object.keys(APP_DATE_FORMATS).indexOf(col.format) > -1 ) $cell.text( formatDate(val,(col.format||'INTL')) );
else $cell.text( (val || '') );
// C: Add CSS style and/or dispClass (if any)
if ( col.class ) { $cell.addClass( col.class ); }
if ( col.style ) {
col.style.split(';').forEach(function(style){
if ( style.indexOf(':') && style.split(':').length == 2 ) {
$cell.css(style.split(':')[0].toString().trim(), style.split(':')[1].toString().trim());
}
});
}
}
});
// C: Add cell to row (NOTE: Ignore `__next`, `__metadata`, etc.)
if ( key.indexOf('__') == -1 ) $newRow.append( $cell );
});
// 3: Add new table row if filter matched and only if the cell(s) were populated
//if ( isFilterPassed && $newRow.find('td').length > 0 ) $(objTable).find('> tbody').append( $newRow );
if ( isFilterPassed ) $(objTable).find('> tbody').append( $newRow );
});
// 3.C.3: OPTIONS: tablesorter
if ( objTagData.tableSorter && $.tablesorter ) {
objTagData.tablesorter({ sortList:objTagData.tableSorter.sortList }); // Sort by (Col#/Asc=0,Desc=1)
objTagData.tableSorter.htmlEle = $(objTable);
}
// 3.C.4: Last: Show message when no rows
if ( $(objTable).find('tbody tr').length == 0 ) {
$(objTable).find('tbody').append('<tr><td colspan="'+ $(objTable).find('thead th').length +'" style="color:#ccc; text-align:center;">'+ APP_STRINGS[APP_OPTS.language].noRows +'</td></tr>');
}
}
}
else {
// B: (NOTE: There may be more than one row of data, but if use bound a single text field, what else can we do - so we use [0]/first row)
if ( $(tag).is('input[type="text"]') ) $(tag).val( objTagData.data[0][objTagData.value] );
else if ( $(tag).not('input') ) $(tag).text( objTagData.data[0][objTagData.value] );
}
})
.catch(function(strErr){
if ( $(tag).is('table') || $(tag).is('tbody') ) {
if ( $(tag).find('tbody').length == 0 ) $(tag).append('<tbody/>');
$(tag).find('tbody').append(
'<tr>'
+ '<td style="padding:10px; color:white; background:lightcoral;" colspan="'+ ($(tag).find('thead th').length > 0 ? (arrColNames.length || $(tag).find('thead th').length) : 1) +'">'
+ strErr +'</td></tr>'
);
}
// TODO: show error in tags other than table
console.error(strErr);
});
});
}
/* ===============================================================================================
|
####### ###### #
# # # # # # ## #### ###### # #### ## #####
# # ## # # # # # # # # # # # # # # #
# # # # # ###### # # # ##### # # # # # # #
# # # # # # ###### # ### # # # # ###### # #
# # # ## # # # # # # # # # # # # #
####### # # # # # #### ###### ####### #### # # #####
|
==================================================================================================
*/
if ( $ && $(document) ) {
$(document).ready(function(){
// REALITY-CHECK:
if ( !sprLib ) {
console.error("Error: `sprLib` not found! sprestlib-ui.js requires sprestlib.js\n(TIP: use `sprestlib-ui.bundle.js` it has everything!)");
return;
}
// STEP 1: Show busy spinners where needed
doShowBusySpinners();
// STEP 2: Populate page elements
doPopulatePageElements();
});
}
})();
| 42.769811 | 222 | 0.511602 |
de058325c0fc43486cbaf36ec1d36261540fb024 | 282 | js | JavaScript | client/app/assets/components/Blog.js | pporche87/queersintech | f457bbbbc673928368bd61dd001344a55aad5661 | [
"MIT"
] | 4 | 2018-06-08T20:54:21.000Z | 2020-07-31T20:02:11.000Z | client/app/assets/components/Blog.js | pporche87/queersintech | f457bbbbc673928368bd61dd001344a55aad5661 | [
"MIT"
] | 21 | 2017-11-26T17:07:37.000Z | 2018-02-02T22:06:38.000Z | client/app/assets/components/Blog.js | pporche87/queersintech | f457bbbbc673928368bd61dd001344a55aad5661 | [
"MIT"
] | 3 | 2018-01-08T19:04:29.000Z | 2018-02-02T04:03:25.000Z | import React, { Component } from 'react';
class Blog extends Component {
render() {
return (
<div className="Blog">
<div className="page">
Future home of Blog after medium api integration
</div>
</div>
);
}
}
export default Blog;
| 17.625 | 58 | 0.574468 |
de059965df596d26133400f24a2dc03f82ce0a43 | 358 | js | JavaScript | frontend/node_modules/@material-ui/icons/esm/ShopTwo.js | jrocktorrens/JoinIn | 61ec694b60ca5b9bc5f46507d6acd45c6fdba43e | [
"Apache-2.0"
] | 9 | 2020-12-07T10:31:58.000Z | 2021-01-30T09:55:20.000Z | node_modules/@material-ui/icons/esm/ShopTwo.js | Jdilla1212/Portfolio | 8c3e443edd65db05407a3c647423098adb9aea86 | [
"Unlicense"
] | 71 | 2022-02-09T04:40:51.000Z | 2022-03-25T07:28:16.000Z | node_modules/@material-ui/icons/esm/ShopTwo.js | Jdilla1212/Portfolio | 8c3e443edd65db05407a3c647423098adb9aea86 | [
"Unlicense"
] | 5 | 2022-02-28T03:25:14.000Z | 2022-03-17T11:32:55.000Z | import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon( /*#__PURE__*/React.createElement("path", {
d: "M3 9H1v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2H3V9zm15-4V3c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H5v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5h-5zm-6-2h4v2h-4V3zm0 12V8l5.5 3-5.5 4z"
}), 'ShopTwo'); | 71.6 | 186 | 0.703911 |
de059de17de5e763cceb130a672e305ddfafb758 | 1,278 | js | JavaScript | packages/tools/f-vue-icons/icons/ReviewIcon.js | Preet-Sandhu/fozzie-components | 8715e261e368b397b7b57b3998fe163444d67478 | [
"Apache-2.0"
] | 13 | 2021-01-27T15:06:26.000Z | 2022-01-11T14:15:38.000Z | packages/tools/f-vue-icons/icons/ReviewIcon.js | Preet-Sandhu/fozzie-components | 8715e261e368b397b7b57b3998fe163444d67478 | [
"Apache-2.0"
] | 463 | 2020-11-24T15:03:54.000Z | 2022-03-31T10:47:34.000Z | packages/tools/f-vue-icons/icons/ReviewIcon.js | Preet-Sandhu/fozzie-components | 8715e261e368b397b7b57b3998fe163444d67478 | [
"Apache-2.0"
] | 46 | 2020-11-24T15:10:57.000Z | 2022-03-22T14:26:02.000Z | import _mergeJSXProps from "babel-helper-vue-jsx-merge-props";
export default {
name: 'ReviewIcon',
props: {},
functional: true,
render: function render(h, ctx) {
var attrs = ctx.data.attrs || {};
ctx.data.attrs = attrs;
return h("svg", _mergeJSXProps([{
attrs: {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 16 16"
},
"class": "c-ficon c-ficon--review"
}, ctx.data]), [h("path", {
attrs: {
fill: "#333",
d: "M7.432 6.16a.333.333 0 0 1-.25.183l-1.27.185.919.895a.333.333 0 0 1 .096.295L6.71 8.982l1.135-.597a.333.333 0 0 1 .31 0l1.135.597-.217-1.264a.333.333 0 0 1 .096-.295l.919-.895-1.27-.185a.333.333 0 0 1-.25-.182L8 5.01l-.568 1.15zm.27-2.05a.333.333 0 0 1 .597 0l.789 1.599 1.764.256c.273.04.382.376.185.57L9.76 7.777l.301 1.757a.333.333 0 0 1-.484.351L8 9.056l-1.577.83a.333.333 0 0 1-.484-.351l.3-1.757-1.276-1.244a.333.333 0 0 1 .185-.569l1.764-.256.79-1.599zm-4.23 7.953a3.853 3.853 0 0 1 2.195-.73H13a.333.333 0 0 0 .333-.333V3A.333.333 0 0 0 13 2.667H3A.333.333 0 0 0 2.667 3v9.867c.225-.303.496-.574.804-.804zM13 2a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H5.672a3.179 3.179 0 0 0-1.806.6 3.235 3.235 0 0 0-1.21 1.814c-.094.382-.656.313-.656-.08V3a1 1 0 0 1 1-1h10z"
}
})]);
}
}; | 58.090909 | 770 | 0.611894 |
de05a7bf82af3e3eb44f30b637edf3df2540a546 | 9,350 | js | JavaScript | tests/baselines/reference/typeGuardsInIfStatement.js | apoterenko/ExtJsTsEmitter | 2083c152f37f8721659ecb83277001146fae1689 | [
"Apache-2.0"
] | 42 | 2015-03-07T14:01:25.000Z | 2020-12-09T08:14:47.000Z | tests/baselines/reference/typeGuardsInIfStatement.js | ShehryarAhmed/TypeScript | d27d10ce2ff013d66ff73890726b06587bda18fa | [
"Apache-2.0"
] | 11 | 2015-02-05T18:41:39.000Z | 2021-01-27T11:31:25.000Z | tests/baselines/reference/typeGuardsInIfStatement.js | ShehryarAhmed/TypeScript | d27d10ce2ff013d66ff73890726b06587bda18fa | [
"Apache-2.0"
] | 15 | 2015-02-06T20:52:18.000Z | 2020-09-25T05:27:47.000Z | //// [typeGuardsInIfStatement.ts]
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x: number | string) {
if (typeof x === "string") {
return x.length; // string
}
else {
return x++; // number
}
}
function foo2(x: number | string) {
// x is assigned in the if true branch, the type is not narrowed
if (typeof x === "string") {
x = 10;
return x; // string | number
}
else {
return x; // string | number
}
}
function foo3(x: number | string) {
// x is assigned in the if true branch, the type is not narrowed
if (typeof x === "string") {
x = "Hello"; // even though assigned using same type as narrowed expression
return x; // string | number
}
else {
return x; // string | number
}
}
function foo4(x: number | string) {
// false branch updates the variable - so here it is not number
if (typeof x === "string") {
return x; // string | number
}
else {
x = 10; // even though assigned number - this should result in x to be string | number
return x; // string | number
}
}
function foo5(x: number | string) {
// false branch updates the variable - so here it is not number
if (typeof x === "string") {
return x; // string | number
}
else {
x = "hello";
return x; // string | number
}
}
function foo6(x: number | string) {
// Modify in both branches
if (typeof x === "string") {
x = 10;
return x; // string | number
}
else {
x = "hello";
return x; // string | number
}
}
function foo7(x: number | string | boolean) {
if (typeof x === "string") {
return x === "hello"; // string
}
else if (typeof x === "boolean") {
return x; // boolean
}
else {
return x == 10; // number
}
}
function foo8(x: number | string | boolean) {
if (typeof x === "string") {
return x === "hello"; // string
}
else {
var b: number | boolean = x; // number | boolean
if (typeof x === "boolean") {
return x; // boolean
}
else {
return x == 10; // number
}
}
}
function foo9(x: number | string) {
var y = 10;
if (typeof x === "string") {
// usage of x or assignment to separate variable shouldn't cause narrowing of type to stop
y = x.length;
return x === "hello"; // string
}
else {
return x == 10; // number
}
}
function foo10(x: number | string | boolean) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
if (typeof x === "string") {
return x === "hello"; // string
}
else {
var y: boolean | string;
var b = x; // number | boolean
return typeof x === "number"
? x === 10 // number
: x; // x should be boolean
}
}
function foo11(x: number | string | boolean) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
// Assigning value to x deep inside another guard stops narrowing of type too
if (typeof x === "string") {
return x; // string | number | boolean - x changed in else branch
}
else {
var y: number| boolean | string;
var b = x; // number | boolean | string - because below we are changing value of x in if statement
return typeof x === "number"
? (
// change value of x
x = 10 && x.toString() // number | boolean | string
)
: (
// do not change value
y = x && x.toString() // number | boolean | string
);
}
}
function foo12(x: number | string | boolean) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
// Assigning value to x in outer guard shouldn't stop narrowing in the inner expression
if (typeof x === "string") {
return x.toString(); // string | number | boolean - x changed in else branch
}
else {
x = 10;
var b = x; // number | boolean | string
return typeof x === "number"
? x.toString() // number
: x.toString(); // boolean | string
}
}
//// [typeGuardsInIfStatement.js]
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true,
// provided the true branch statement contains no assignments to the variable or parameter.
// In the false branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false,
// provided the false branch statement contains no assignments to the variable or parameter
function foo(x) {
if (typeof x === "string") {
return x.length; // string
}
else {
return x++; // number
}
}
function foo2(x) {
// x is assigned in the if true branch, the type is not narrowed
if (typeof x === "string") {
x = 10;
return x; // string | number
}
else {
return x; // string | number
}
}
function foo3(x) {
// x is assigned in the if true branch, the type is not narrowed
if (typeof x === "string") {
x = "Hello"; // even though assigned using same type as narrowed expression
return x; // string | number
}
else {
return x; // string | number
}
}
function foo4(x) {
// false branch updates the variable - so here it is not number
if (typeof x === "string") {
return x; // string | number
}
else {
x = 10; // even though assigned number - this should result in x to be string | number
return x; // string | number
}
}
function foo5(x) {
// false branch updates the variable - so here it is not number
if (typeof x === "string") {
return x; // string | number
}
else {
x = "hello";
return x; // string | number
}
}
function foo6(x) {
// Modify in both branches
if (typeof x === "string") {
x = 10;
return x; // string | number
}
else {
x = "hello";
return x; // string | number
}
}
function foo7(x) {
if (typeof x === "string") {
return x === "hello"; // string
}
else if (typeof x === "boolean") {
return x; // boolean
}
else {
return x == 10; // number
}
}
function foo8(x) {
if (typeof x === "string") {
return x === "hello"; // string
}
else {
var b = x; // number | boolean
if (typeof x === "boolean") {
return x; // boolean
}
else {
return x == 10; // number
}
}
}
function foo9(x) {
var y = 10;
if (typeof x === "string") {
// usage of x or assignment to separate variable shouldn't cause narrowing of type to stop
y = x.length;
return x === "hello"; // string
}
else {
return x == 10; // number
}
}
function foo10(x) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
if (typeof x === "string") {
return x === "hello"; // string
}
else {
var y;
var b = x; // number | boolean
return typeof x === "number"
? x === 10 // number
: x; // x should be boolean
}
}
function foo11(x) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
// Assigning value to x deep inside another guard stops narrowing of type too
if (typeof x === "string") {
return x; // string | number | boolean - x changed in else branch
}
else {
var y;
var b = x; // number | boolean | string - because below we are changing value of x in if statement
return typeof x === "number"
? (
// change value of x
x = 10 && x.toString() // number | boolean | string
)
: (
// do not change value
y = x && x.toString() // number | boolean | string
);
}
}
function foo12(x) {
// Mixing typeguard narrowing in if statement with conditional expression typeguard
// Assigning value to x in outer guard shouldn't stop narrowing in the inner expression
if (typeof x === "string") {
return x.toString(); // string | number | boolean - x changed in else branch
}
else {
x = 10;
var b = x; // number | boolean | string
return typeof x === "number"
? x.toString() // number
: x.toString(); // boolean | string
}
}
| 31.166667 | 107 | 0.544813 |
de0685b75e736cb776738b82140a866c0de9480e | 373 | js | JavaScript | test/fixtures/plugin/plugin.js | alan-agius4/postcss-loader | 792e2175e52cc4641a9f37e55451961a05441a10 | [
"MIT"
] | 2,766 | 2015-01-08T01:29:13.000Z | 2020-07-27T02:45:27.000Z | test/fixtures/plugin/plugin.js | alan-agius4/postcss-loader | 792e2175e52cc4641a9f37e55451961a05441a10 | [
"MIT"
] | 396 | 2015-01-08T03:47:04.000Z | 2020-07-28T18:10:59.000Z | test/fixtures/plugin/plugin.js | alan-agius4/postcss-loader | 792e2175e52cc4641a9f37e55451961a05441a10 | [
"MIT"
] | 269 | 2015-01-27T23:26:58.000Z | 2020-07-09T07:45:13.000Z | 'use strict';
const postcss = require('postcss');
module.exports = postcss.plugin('my-plugin', (options) => {
const myOptions = {...{ alpha: '1.0', color: 'black' }, ...options};
return (root, result) => {
root.walkDecls((decl) => {
if (decl.value === myOptions.color) {
decl.value = 'rgba(0, 0, 0, ' + myOptions.alpha + ')'
}
})
}
});
| 23.3125 | 70 | 0.541555 |
de0823d374a5a7a42a262b99005a61e42f708ac9 | 1,433 | js | JavaScript | app/scripts/bullet.js | isabella232/skookum_invaders | 28355c2f73ec4d71edecf608b0eebd2ba289e8a0 | [
"MIT"
] | 1 | 2018-01-02T20:33:37.000Z | 2018-01-02T20:33:37.000Z | app/scripts/bullet.js | Skookum/skookum_invaders | 28355c2f73ec4d71edecf608b0eebd2ba289e8a0 | [
"MIT"
] | 1 | 2021-02-23T18:36:32.000Z | 2021-02-23T18:36:32.000Z | app/scripts/bullet.js | isabella232/skookum_invaders | 28355c2f73ec4d71edecf608b0eebd2ba289e8a0 | [
"MIT"
] | 2 | 2018-01-02T20:33:51.000Z | 2020-11-24T15:11:08.000Z | function Bullet(x, y) {
this.initialize(x, y);
}
Bullet.prototype = new Actor();
Bullet.prototype.initialize = function(x, y) {
this.id = randomString();
this.name = 'bullet';
this.frameWidth = 50;
this.frameHeight = 100;
this.dead = false;
var spriteSheet = new createjs.SpriteSheet({
images:['images/'+this.name+'.png'],
frames: {width:this.frameWidth, height:this.frameHeight, count:2, regX:this.frameWidth/2, regY:this.frameHeight/2},
animations: {shoot:[0,1, "shoot", 8]}
});
this.BitmapAnimation_initialize(spriteSheet);
this.gotoAndPlay('shoot');
this.x = x;
this.y = y;
this.scale = 0.2;
this.width = parseInt((this.frameWidth * this.scale) * 0.35, 10);
this.height = parseInt((this.frameHeight * this.scale) * 0.8, 10);
this.vY = 4;
this.scaleX = this.scaleY = this.scale;
this.currentFrame = 0;
game.items.addChild(this);
return this;
};
// tick function
Bullet.prototype.onTick = function() {
var self = this;
if (this.dead) return game.items.removeChild(this);
this.y -= this.vY;
this.vY *= 1.03;
// console.log(this.BoundingRectangle(), this.frame);
if (this.bottom() < -(this.height)) this.die();
else {
_.each(game.enemies.children, function(e) {
if (self.checkHit(e)) {
e.takeDamage();
self.die();
}
});
}
return this;
};
// die function
Bullet.prototype.die = function() {
this.dead = true;
}; | 22.046154 | 119 | 0.635729 |
de08cc37a547af14b06ba3808595cca478e8cbcd | 3,617 | js | JavaScript | src/utils/continueTime.js | czztracy/CBFX | 21c023e81dd2ad58de221e718304f93deebfdd53 | [
"MIT"
] | null | null | null | src/utils/continueTime.js | czztracy/CBFX | 21c023e81dd2ad58de221e718304f93deebfdd53 | [
"MIT"
] | null | null | null | src/utils/continueTime.js | czztracy/CBFX | 21c023e81dd2ad58de221e718304f93deebfdd53 | [
"MIT"
] | null | null | null | import store from '@/store'
import { addOverTime } from '@/api/modle'
import { Message, MessageBox } from 'element-ui'
import jwt from 'jwt-simple'
// 定时器隔5分钟执行逻辑
let timeClock = null
export const addTheClock = (createModleTime) => {
timeClock = setInterval(() => {
const activetime = sessionStorage.getItem('activetime')
const waitTimes = (new Date()).getTime() - createModleTime
const operateTimes = (new Date()).getTime() - activetime
const waitMinus = minus(waitTimes)
const operateMinus = minus(operateTimes)
if ((waitMinus > 20) && (operateMinus > 20)) {
clearInterval(timeClock);
MessageBox.prompt('请输入您的登录密码', '确定登出', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
inputPattern: /\S/,
inputErrorMessage: '密码不能为空',
inputType: 'password',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true
instance.confirmButtonText = '执行中...'
const jstSecret = 'DBS'
const logincode = jwt.decode(sessionStorage.getItem('logincode'), jstSecret)
const userInfoss = []
const userInfo = {
userName: logincode,
password: instance.inputValue
}
if (sessionStorage.getItem('roles') !== 'supplier') {
userInfoss.push(userInfo, 'haier')
} else {
userInfoss.push(userInfo, 'supplier')
}
store.dispatch('Login', userInfoss).then(() => {
done()
instance.confirmButtonLoading = false
instance.confirmButtonText = '重新登录'
Message({
type: 'success',
message: '重新登录成功'
})
createModleTime = (new Date()).getTime()
// sessionStorage.setItem('activetime', (new Date()).getTime())
addTheClock(createModleTime)
}).catch(() => {
instance.confirmButtonLoading = false
instance.confirmButtonText = '重新登录'
Message({
type: 'error',
message: '密码错误'
})
})
} else {
done()
}
}
}).then(({ value }) => {
// instance.inputValue = value
}).catch(() => {
store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
})
})
} else if (waitMinus > 20 && operateMinus < 20) {
clearInterval(timeClock);
addOverTime().then(res => {
createModleTime = (new Date()).getTime()
// sessionStorage.setItem('activetime', (new Date()).getTime())
addTheClock(createModleTime)
console.log(res)
}).catch(err => {
// 111
})
}
console.log(activetime, createModleTime, waitMinus, operateMinus)
},300000)
}
// 时间戳差值比较
function minus(num) {
const leave1 = num % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
const hours = Math.floor(leave1 / (3600 * 1000))
const leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
const minutes = Math.floor(leave2 / (60*1000))
const lessTime = hours * 60 + minutes
return lessTime
}
// 关闭定时器
export const closeClock = () => {
sessionStorage.removeItem('activetime')
clearInterval(timeClock);
}
| 37.28866 | 92 | 0.518662 |