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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d6ac43829883ca3082f3a7c7c0c4241a6bce37a4 | 835 | js | JavaScript | src/main.js | hugoayed/tuto-medium | ff66d4f086df23609b853d397368b278eee4b61f | [
"MIT"
] | null | null | null | src/main.js | hugoayed/tuto-medium | ff66d4f086df23609b853d397368b278eee4b61f | [
"MIT"
] | null | null | null | src/main.js | hugoayed/tuto-medium | ff66d4f086df23609b853d397368b278eee4b61f | [
"MIT"
] | null | null | null | import Vue from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify';
import VueYouTubeEmbed from 'vue-youtube-embed'
// import firebase from 'firebase/app'
// import 'firebase/firestore'
// import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
// // Import Bootstrap an BootstrapVue CSS files (order is important)
// import 'bootstrap/dist/css/bootstrap.css'
// import 'bootstrap-vue/dist/bootstrap-vue.css'
// // Make BootstrapVue available throughout your project
// Vue.use(BootstrapVue)
// // Optionally install the BootstrapVue icon components plugin
// Vue.use(IconsPlugin)
Vue.use(VueYouTubeEmbed)
Vue.config.productionTip = false
// firebase.initializeApp({
// Configurações do seu app
// })
// export const db = firebase.firestore()
new Vue({
vuetify,
render: h => h(App)
}).$mount('#app')
| 27.833333 | 69 | 0.732934 |
d6aca6b1937b4c8c4a7f0e733c4701b6aa6af257 | 1,234 | js | JavaScript | test/itemPatserSpec.js | KMR-zoar/thinkBackOnEdit | e9452b57c7a15b0a071b85ab4b10279a4d762fde | [
"MIT"
] | null | null | null | test/itemPatserSpec.js | KMR-zoar/thinkBackOnEdit | e9452b57c7a15b0a071b85ab4b10279a4d762fde | [
"MIT"
] | 1 | 2022-02-12T11:26:37.000Z | 2022-02-12T11:26:37.000Z | test/itemPatserSpec.js | KMR-zoar/thinkBackOnEdit | e9452b57c7a15b0a071b85ab4b10279a4d762fde | [
"MIT"
] | null | null | null | const assert = require('assert')
const itemParser = require('../lib/itemPaeser')
describe('アイテムパーサー', () => {
it('アイテムオブジェクトのパース', () => {
const content = JSON.stringify({
type: 'Feature',
properties: {
title: 'Almost junction, join or use noexit tag',
class: 1,
level: 1
},
geometry: {
type: 'Point',
coordinates: [139.7136643, 36.0429181]
}
})
const item = {
title: 'Almost junction, join or use noexit tag',
link:
'http://osmose.openstreetmap.fr/map/#zoom=16&lat=36.0429181&lon=139.7136643&item=1270&level=1',
content:
'\n item=1270, class=1, level=1\n <a href="http://osmose.openstreetmap.fr/error/27629905558">E</a>\n <a href="http://localhost:8111/load_and_zoom?left=139.7116643&bottom=36.0409181&right=139.7156643&top=36.0449181">josm</a>\n ',
contentSnippet: 'item=1270, class=1, level=1\n E\n josm',
guid:
'http://osmose.openstreetmap.fr/map/#zoom=16&lat=36.0429181&lon=139.7136643&item=1270&level=1',
categories: ['1270']
}
const result = itemParser(item)
assert.equal(content, JSON.stringify(result))
})
})
| 34.277778 | 276 | 0.594814 |
d6acd2b003c4d69ec84197115d7dac66284c7cb6 | 742 | js | JavaScript | packages/logger/__test__/formatters/renameFields.test.js | Madvinking/node-toolbox | 459e10ec37312cdadd6e6a3186386b26357ed37f | [
"MIT"
] | null | null | null | packages/logger/__test__/formatters/renameFields.test.js | Madvinking/node-toolbox | 459e10ec37312cdadd6e6a3186386b26357ed37f | [
"MIT"
] | 4 | 2021-09-22T18:42:25.000Z | 2022-02-21T10:26:54.000Z | packages/logger/__test__/formatters/renameFields.test.js | Madvinking/node-toolbox | 459e10ec37312cdadd6e6a3186386b26357ed37f | [
"MIT"
] | 1 | 2021-09-22T14:55:14.000Z | 2021-09-22T14:55:14.000Z | import { renameFields } from '../../src/formatters/renameFields.js';
describe('formatter - renameFields', () => {
it('should rename fields', () => {
const fieldsToRename = {
'req.headers.x-request-id': 'requestId',
'user-agent': 'header-user-agent',
'nested.foo': 'nested.foobar',
};
const logData = {
message: 'test message',
req: { headers: { 'x-request-id': 'test-request-id' } },
nested: { foo: 'bar' },
};
const expected = {
message: 'test message',
req: { headers: {} },
requestId: 'test-request-id',
nested: { foobar: 'bar' },
};
const newData = renameFields(fieldsToRename)(logData);
expect(newData).toStrictEqual(expected);
});
});
| 25.586207 | 68 | 0.570081 |
d6ad17d9b640399170a610730f73b678a3d105ae | 2,387 | js | JavaScript | lib/Department.js | Drantho/EmployeeTrackerCMS | 68275465a0e47e1b17b6492b526a5e0f70ab2607 | [
"MIT"
] | null | null | null | lib/Department.js | Drantho/EmployeeTrackerCMS | 68275465a0e47e1b17b6492b526a5e0f70ab2607 | [
"MIT"
] | null | null | null | lib/Department.js | Drantho/EmployeeTrackerCMS | 68275465a0e47e1b17b6492b526a5e0f70ab2607 | [
"MIT"
] | null | null | null | // get database connection
const connection = require("./Database");
class Department {
// constructor with default for id
constructor(name, id = "") {
this.name = name;
this.id = id;
}
// log props
displayDepartment = () => {
console.log(`Department ID: ${this.id}`);
console.log(`Department Name: ${this.name}`);
console.log(`-----------------------------------`);
}
// setter for id prop
setId = id => {
this.id = id;
}
// save department and return promise
async saveDepartmentToDatabase() {
const promise = new Promise((resolve, reject) => {
connection.query(`INSERT INTO department(name) VALUES(?)`, [this.name], (error, results, field) => {
if (error) {
throw (error);
}
this.setId(results.insertId);
resolve(results.insertId);
})
})
return await promise;
}
// update department and return promise
updateDepartmentInDatabase() {
connection.query("UPDATE department SET ? WHERE ?", [{ name: this.name }, { id: this.id }], (err, result) => {
if (err) {
throw err
}
})
}
// delete department and log result
deleteDepartmentFromDatabase() {
// delete selected department
connection.query("DELETE FROM department WHERE ?", [{ id: this.id }], (err, result) => {
if (err) {
throw err
}
// inform user of success and call main
console.log(`Department deleted. `);
})
}
// static function to get array of departments
static async getDepartments() {
const promise = new Promise((resolve, reject) => {
connection.query(`SELECT * FROM department ORDER BY id`, (error, results, field) => {
if (error) {
throw (error);
}
resolve(results.map(department => ({ name: department.name, value: department })));
})
})
return await promise;
}
// static function to log departments
static async viewDepartments() {
console.table((await Department.getDepartments()).map(department => department.value));
}
}
module.exports = Department; | 25.945652 | 118 | 0.522413 |
d6ad82454c2a98411f4e391b9b0feaec119d1c54 | 1,348 | js | JavaScript | app/utils/tests/requiredIfAllPresent.test.js | nicolezing/NewAgain | 53b051880c3988ab8aa3cd20da856c2927ed83f4 | [
"MIT"
] | null | null | null | app/utils/tests/requiredIfAllPresent.test.js | nicolezing/NewAgain | 53b051880c3988ab8aa3cd20da856c2927ed83f4 | [
"MIT"
] | 2 | 2019-12-01T14:03:08.000Z | 2020-04-06T14:57:31.000Z | app/utils/tests/requiredIfAllPresent.test.js | nicolezing/NewAgain | 53b051880c3988ab8aa3cd20da856c2927ed83f4 | [
"MIT"
] | null | null | null | /**
* Test requiredIfAllPresent
*/
import 'jest-dom/extend-expect';
import requiredIfAllPresent from '../requiredIfAllPresent';
describe('requiredIfAllPresent()', () => {
it('Expect to return error if wrong parameter entered', () => {
expect(() => requiredIfAllPresent()).toThrow();
});
it('Expect generator to fail with invalid requiredType input', () => {
expect(() => requiredIfAllPresent(['A'], 'str')).toThrow();
});
it('Expect generator to fail if no dependency is provided', () => {
expect(() => requiredIfAllPresent([], 'string')).toThrow();
});
it('Expect to return error if A is true, but B is not provided', () => {
expect(
requiredIfAllPresent(['A'], 'string')({ A: true }, 'B', 'test component'),
).toBeInstanceOf(Error);
});
it('Expect to have no error if dependencies are not true, and B is not provided', () => {
const spy = jest.spyOn(global.console, 'error');
requiredIfAllPresent(['A'], 'string')(
{ A: true, D: false },
'B',
'test component',
);
expect(spy).not.toHaveBeenCalled();
});
it('Expect to return error if A is true, B is provided with wrong type', () => {
expect(
requiredIfAllPresent(['A'], 'string')(
{ A: true, B: 2 },
'B',
'test component',
),
).toBeInstanceOf(Error);
});
});
| 29.304348 | 91 | 0.593472 |
d6addf5b38bc1fb96725149143a9e00cc026aeb1 | 181 | js | JavaScript | lib/index.js | october93/october-icons | d69dbb7e4e13a1d4e7cb65de78ea067e94097656 | [
"MIT"
] | 1 | 2020-07-27T20:01:56.000Z | 2020-07-27T20:01:56.000Z | lib/index.js | october93/icons | d69dbb7e4e13a1d4e7cb65de78ea067e94097656 | [
"MIT"
] | null | null | null | lib/index.js | october93/icons | d69dbb7e4e13a1d4e7cb65de78ea067e94097656 | [
"MIT"
] | null | null | null | import { createIconSet } from "react-native-vector-icons"
import glyphmap from "../dist/glyphmap.json"
export default createIconSet(glyphmap, "october-icons", "october-icons.ttf")
| 36.2 | 76 | 0.773481 |
d6ae0a267d41b1a484f69d58130382972a7d2bca | 2,786 | js | JavaScript | packages/code/user/server/user_verify.js | zakaihamilton/screens | 19784dd78956774ddb7bcb1cffdb8248e57eaa46 | [
"Unlicense"
] | 3 | 2017-05-29T08:11:52.000Z | 2018-05-24T15:11:25.000Z | packages/code/user/server/user_verify.js | zakaihamilton/screens | 19784dd78956774ddb7bcb1cffdb8248e57eaa46 | [
"Unlicense"
] | 14 | 2019-03-27T19:08:02.000Z | 2022-02-13T19:56:41.000Z | packages/code/user/server/user_verify.js | zakaihamilton/screens | 19784dd78956774ddb7bcb1cffdb8248e57eaa46 | [
"Unlicense"
] | null | null | null | /*
@author Zakai Hamilton
@component UserVerify
*/
screens.user.verify = function UserVerify(me, { core, db }) {
me.init = async function () {
var login = await core.util.config("settings.core.login");
me.client_id = login.client_id;
const { OAuth2Client } = require("google-auth-library");
me.client = new OAuth2Client(me.client_id);
};
me.match = function (id) {
var isMatch = (id === this.userId);
me.log("name: " + name + " isMatch:" + isMatch);
return isMatch;
};
me.list = async function () {
return await db.shared.user.list();
};
me.verify = async function (info) {
if (me.platform === "server" && !info.platform) {
var name = decodeURIComponent(info.headers["user_name"]);
var email = decodeURIComponent(info.headers["user_email"]);
var token = info.headers["token"];
if (!token) {
me.log_error("no token passed in header, url: " + info.url + " name: " + name);
info.stop = true;
return;
}
var hash = core.string.hash(token);
try {
var profile = await db.cache.tokens.find({ hash });
if (!profile) {
const ticket = await me.client.verifyIdToken({
idToken: token,
audience: me.client_id,
});
const payload = ticket.getPayload();
const userid = payload["sub"];
profile = { userid, name, email, request: 0 };
}
profile.date = new Date().toString();
let previous = profile.previous;
profile.previous = profile.utc;
profile.utc = Date.now();
profile.request++;
if (profile.request === 1 || previous + 60000 < profile.utc) {
me.log("Storing profile: " + JSON.stringify(profile));
await db.cache.tokens.use({ hash }, profile);
}
info.userId = profile.userid;
info.userName = profile.name;
info.userEmail = profile.email;
let user = await db.shared.user.find({ user: info.userId });
if (!user || user.name !== info.userName || user.email !== info.userEmail) {
db.shared.user.use({ user: info.userId }, { name: info.userName, email: info.userEmail });
}
}
catch (err) {
let error = "failed to verify token, err: " + err;
me.log_error(error);
info.stop = true;
}
}
};
return "server";
}; | 40.970588 | 110 | 0.488155 |
d6aea7e7ca9d9fffe94ed01ad015e54bb2ac41f5 | 68 | js | JavaScript | app/services/md-toaster.js | streamrail/ember-cli-materialize | 4654c0dcc31f3e1681c7bf8eb395771d24163e97 | [
"MIT"
] | null | null | null | app/services/md-toaster.js | streamrail/ember-cli-materialize | 4654c0dcc31f3e1681c7bf8eb395771d24163e97 | [
"MIT"
] | null | null | null | app/services/md-toaster.js | streamrail/ember-cli-materialize | 4654c0dcc31f3e1681c7bf8eb395771d24163e97 | [
"MIT"
] | null | null | null | export { default } from 'ember-cli-materialize/services/md-toaster'; | 68 | 68 | 0.779412 |
d6af836844cc62617c97d084add28fdfaab63cf1 | 265 | js | JavaScript | packages/error/src/index.js | cryptolatam/cryptolatam | 275ddb01f8838e544594f45a9b93f103634013d8 | [
"MIT"
] | null | null | null | packages/error/src/index.js | cryptolatam/cryptolatam | 275ddb01f8838e544594f45a9b93f103634013d8 | [
"MIT"
] | null | null | null | packages/error/src/index.js | cryptolatam/cryptolatam | 275ddb01f8838e544594f45a9b93f103634013d8 | [
"MIT"
] | null | null | null | "use strict";
import ExtendableError from "es6-error";
export default class CryptoLATAMError extends ExtendableError {
constructor(message = "Unspecified Error", data = null) {
super(message);
this.data = data;
this.isCryptoLATAMError = true;
}
}
| 22.083333 | 63 | 0.716981 |
d6aff523e6146305c07e7f937029ff8f37b2236c | 5,552 | js | JavaScript | index.js | christ-ine/README-generator | b3ba015d1fab39bb7dc8c8dcaf12e9c4fe83a1b1 | [
"Unlicense"
] | null | null | null | index.js | christ-ine/README-generator | b3ba015d1fab39bb7dc8c8dcaf12e9c4fe83a1b1 | [
"Unlicense"
] | null | null | null | index.js | christ-ine/README-generator | b3ba015d1fab39bb7dc8c8dcaf12e9c4fe83a1b1 | [
"Unlicense"
] | null | null | null | const fs = require('fs');
const util = require('util');
const inquirer = require('inquirer');
const thenableWriteFile = util.promisify(fs.writeFile);
function promptUser() {
return inquirer.prompt([
{
type: "input",
name: 'title',
message: 'What is the title of your project?'
},
{
type: "input",
name: 'description',
message: 'What is the description of your project?'
},
{
type: "input",
name: 'installation',
message: "What are the steps required to install your project?"
},
{
type: "input",
name: 'usage',
message: 'Waht are the instructions for the project and examples for use?'
},
{
type: "input",
name: "contribution",
message: "What are the conribution guidelines?"
},
{
type: "input",
name: "tests",
message: "Do you have any tests for your project?"
},
{
type: "list",
name: "license",
choices: ["MIT", "Apache", "GPL"]
},
{
type: "input",
name: "username",
message: "Please enter your github username"
},
{
type: "input",
name: "email",
message: "Please enter your email address"
},
{
type: "input",
name: "fullname",
message: "Please enter your full name."
}
]);
}
function getReadMeOutput(answers) {
const license = answers.license;
const licenseDescription = answers.licenseDescription;
if(license === "MIT") {
answers.license = "[](https://opensource.org/licenses/MIT)";
answers.licenseDescription =
`MIT License
Copyright (c) 2020 ${answers.fullname}
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.`
} else if (license === "Apache") {
answers.license = "[](https://opensource.org/licenses/Apache-2.0)";
answers.licenseDescription =
`Copyright 2020 ${answers.fullname}
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.`
} else {
answers.license = "[](https://www.gnu.org/licenses/gpl-3.0)";
answers.licenseDescription =
`Copyright (C) 2020 ${answers.fullname}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`
}
return `# ${answers.title}
## Description
${answers.description}
## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Badges](#badges)
* [Contributing](#contributing)
* [Tests](#tests)
* [Questions](#questions)
## Installation
${answers.installation}
## Usage
${answers.usage}
## License
${answers.licenseDescription}
## Badges
${answers.license}
## Contributing
${answers.contribution}
## Tests
${answers.tests}
## Questions
Have any additional questions? Contact me below!
* [GitHub](https://github.com/${answers.username})
* [Email me!](mailto:${answers.email})`
}
promptUser()
.then(function(answers) {
const readMe = getReadMeOutput(answers);
return thenableWriteFile("README(generated).md", readMe)
})
.then(function() {
console.log("Successfully generated README")
})
.catch(function(error){
console.log("An error has occured", error)
}) | 28.471795 | 145 | 0.666246 |
d6b07745c3de02da63b1277a269707dceb55a746 | 319 | js | JavaScript | doc/html/search/functions_5.js | petrkotas/libLS | eb57365bfb0be486a4e8c564ff831ad358993268 | [
"BSD-3-Clause"
] | null | null | null | doc/html/search/functions_5.js | petrkotas/libLS | eb57365bfb0be486a4e8c564ff831ad358993268 | [
"BSD-3-Clause"
] | null | null | null | doc/html/search/functions_5.js | petrkotas/libLS | eb57365bfb0be486a4e8c564ff831ad358993268 | [
"BSD-3-Clause"
] | null | null | null | var searchData=
[
['example',['example',['../namespacegenerate__sphere.html#a3cf17a631a5a76e3ed0662a133114bbc',1,'generate_sphere']]],
['expand',['expand',['../struct_box.html#a67dcee6dbc6fb6b382674dc96dd18bac',1,'Box']]],
['extent',['extent',['../struct_box.html#a5e3af223e469c7c3d4cd542b922d5632',1,'Box']]]
];
| 45.571429 | 118 | 0.724138 |
d6b115f708d1dd2fe770b74faee293bfdf095515 | 3,003 | js | JavaScript | .eleventy.js | jeroenwtf/nitroboard | 3e38612bac1100d0dbd02a16ca1392f81dc0e27b | [
"MIT"
] | 25 | 2019-11-27T14:52:32.000Z | 2021-03-26T13:52:23.000Z | .eleventy.js | jeroenwtf/nitroboard | 3e38612bac1100d0dbd02a16ca1392f81dc0e27b | [
"MIT"
] | 2 | 2021-05-12T09:53:36.000Z | 2022-02-11T00:02:20.000Z | .eleventy.js | jeroenwtf/nitroboard | 3e38612bac1100d0dbd02a16ca1392f81dc0e27b | [
"MIT"
] | 2 | 2019-11-30T20:58:18.000Z | 2021-01-25T19:10:50.000Z | const fs = require("fs");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const debugging = require("./src/utils/debugging");
const seo = require("./src/utils/seo");
const excerpts = require("./src/utils/excerpts");
const markdown = require("./src/utils/markdown");
const { loadFilters } = require("./src/utils/filters");
module.exports = function(eleventyConfig) {
// we need site/includes/packs.njk to be ignored in git
// however, we still need it to watched for changes.
// the .eleventyignore is used to tell Eleventy what to ignore
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.setDataDeepMerge(true);
const markdownIt = require("markdown-it");
const markdownItEmoji = require("markdown-it-emoji");
const markdownItFootnotes = require("markdown-it-footnote");
const options = {
html: true,
breaks: true,
linkify: true
};
const md = markdownIt(options)
.use(markdownItEmoji)
.use(markdownItFootnotes);
debugging(eleventyConfig);
seo(eleventyConfig);
excerpts(eleventyConfig);
markdown(eleventyConfig, md);
loadFilters(eleventyConfig);
eleventyConfig.setLibrary("md", md);
eleventyConfig.addPairedShortcode("markdown", function(content) {
return md.render(content);
});
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntaxHighlight);
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addLayoutAlias("default", "layouts/default.njk");
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
eleventyConfig.addLayoutAlias("page", "layouts/page.njk");
eleventyConfig.addCollection("feed", collection => {
return collection
.getFilteredByTag("blog")
.reverse()
.slice(0, 20);
});
// move to head so that it does not interfere
// with turbolinks in development
eleventyConfig.setBrowserSyncConfig({
// show 404s in dev. Borrowed from eleventy blog starter
callbacks: {
ready: function(_, browserSync) {
// A bit of chicken and egg. This is keeps the exception
// from showing during the first local build
const generated404Exists = fs.existsSync("dist/404.html");
const content_404 = generated404Exists
? fs.readFileSync("dist/404.html")
: "<h1>File Does Not Exist</h1>";
browserSync.addMiddleware("*", (_, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
}
},
// scripts in body conflict with Turbolinks
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function(snippet, match) {
return snippet + match;
}
}
}
});
return {
dir: { input: "site", output: "dist", data: "_data", includes: "includes" },
passthroughFileCopy: true,
templateFormats: ["njk", "md", "css", "html", "yml"],
htmlTemplateEngine: "njk"
};
};
| 32.290323 | 80 | 0.670663 |
d6b11c29b62fc1d61f596a1fdbf94708d869e69a | 1,117 | js | JavaScript | examples/docs/.vuepress/config.js | PingTouG/vxui | 9d6a9daf6df1a2bf7e4eec5145b8e030a74ca9fb | [
"MIT"
] | 1 | 2021-03-01T05:06:21.000Z | 2021-03-01T05:06:21.000Z | examples/docs/.vuepress/config.js | PingTouG/vxui | 9d6a9daf6df1a2bf7e4eec5145b8e030a74ca9fb | [
"MIT"
] | 11 | 2021-03-01T20:59:57.000Z | 2022-02-26T21:41:55.000Z | examples/docs/.vuepress/config.js | PingTouG/vxui | 9d6a9daf6df1a2bf7e4eec5145b8e030a74ca9fb | [
"MIT"
] | null | null | null | const autoRouter = require('./utils/autoRouter')
module.exports = async () => {
return {
title: 'VXUI',
description: '基于Vue开发的组件库',
base: '/vxui/',
dest: 'docs',
head: [['link', { rel: 'icon', href: 'favicon.ico' }]],
themeConfig: {
nav: [
{ text: '指南', link: '/installation' },
{ text: 'GitHub', link: 'https://github.com/PingTouG/vxui' }
],
sidebar: [
{
title: '开发指南',
collapsable: false,
children: [
['/installation', '安装'],
['/quickstart', '快速开始']
]
},
{
title: '组件',
collapsable: false,
children: await autoRouter('../../components')
}
],
sidebarDepth: 0
},
plugins: [
[
'demo-code',
{
showText: '显示代码',
hideText: '隐藏代码',
minHeight: 0,
onlineBtns: {
codepen: false,
jsfiddle: false,
codesandbox: false
},
demoCodeMark: 'demo'
}
],
'@vuepress/back-to-top'
]
}
}
| 21.901961 | 68 | 0.432408 |
d6b1b4557e7575cd954369ec697c1a8f3f6dc99c | 326 | js | JavaScript | src/player/player.js | muzenplaats/musje | bf1067d736c8f52931bb0c418d79cc10275434f7 | [
"Unlicense"
] | 9 | 2020-12-28T08:27:16.000Z | 2022-03-11T00:37:48.000Z | src/player/player.js | malcomwu/musje | bf1067d736c8f52931bb0c418d79cc10275434f7 | [
"Unlicense"
] | 1 | 2021-04-04T16:18:04.000Z | 2021-05-14T10:53:55.000Z | src/player/player.js | muzenplaats/musje | bf1067d736c8f52931bb0c418d79cc10275434f7 | [
"Unlicense"
] | 3 | 2021-04-04T10:03:45.000Z | 2021-09-26T06:55:53.000Z | import { play, pause, stop } from './play'
const AudioContext = window.AudioContext || window.webkitAudioContext
var _ctx
export default class Player {
constructor(obj) {
this.obj = obj
}
get context() { return _ctx || (_ctx = new AudioContext()) }
play = play
pause = pause
stop = stop
}
| 19.176471 | 70 | 0.631902 |
d6b1c6454ff74e0195e6580edb22894bbbf833e5 | 2,075 | js | JavaScript | resources/js/api/admin/category.js | loverofMush/lg-blog | 08595fbbcff380509f0ff46f4f4bbcbec352268a | [
"MIT"
] | null | null | null | resources/js/api/admin/category.js | loverofMush/lg-blog | 08595fbbcff380509f0ff46f4f4bbcbec352268a | [
"MIT"
] | 3 | 2021-03-10T03:37:10.000Z | 2022-02-26T22:01:56.000Z | resources/js/api/admin/category.js | timothyakinyelu/lg-blog | 08595fbbcff380509f0ff46f4f4bbcbec352268a | [
"MIT"
] | null | null | null | /*
Imports the API URL from the config.
*/
import { BLOG_CONFIG } from '../../config.js';
import { authHeader } from '../../authHelper';
export default {
/*
GET /api/v1/categories
*/
getCategories: function(){
const requestOptions = {
headers: { ...authHeader(), 'Content-Type': 'application/json' },
};
return axios.get( BLOG_CONFIG.API_URL + '/categories', requestOptions );
},
/*
POST /api/v1/categories
*/
addNewCategory: function( name, slug ){
const requestOptions = {
headers: { ...authHeader(), 'Content-Type': 'application/json' },
};
/*
Initialize the form data
*/
let formData = new FormData();
/*
Add the form data we need to submit
*/
// formData.append('parent', parent);
formData.append('name', name);
formData.append('slug', slug);
return axios.post( BLOG_CONFIG.API_URL + '/categories', formData, requestOptions)
},
/*
PUT /api/v1/jobtypes/{categoryID}
*/
updateCategory: function( categoryID, name, slug){
const requestOptions = {
headers: { ...authHeader(), 'Content-Type': 'application/json' },
};
/*
Initialize the form data
*/
let formData = new FormData();
/*
Add the form data we need to submit
*/
// formData.append('parent', parent);
formData.append('name', name);
formData.append('slug', slug);
formData.append('_method', 'PUT');
return axios.post( BLOG_CONFIG.API_URL + '/categories/' + categoryID + '/edit', formData, requestOptions);
},
/*
DELETE /api/v1/categories/{categoryID}/
*/
deleteCategory: function( categoryID ){
const requestOptions = {
headers: { ...authHeader(), 'Content-Type': 'application/json' },
};
return axios.delete( BLOG_CONFIG.API_URL + '/categories/' + categoryID, requestOptions );
}
} | 27.302632 | 114 | 0.54988 |
d6b222a9c1628f568e02bd40a43de4880c6e3032 | 1,948 | js | JavaScript | cassandra/lib/CQLBuilder.js | tomyc/platform-plugin-cassandra-node | b9b4e1772272b92a29b8ac19dd01692d427b7b04 | [
"Apache-2.0"
] | 4 | 2018-01-29T20:45:12.000Z | 2018-12-03T17:32:47.000Z | cassandra/lib/CQLBuilder.js | tomyc/platform-plugin-cassandra-node | b9b4e1772272b92a29b8ac19dd01692d427b7b04 | [
"Apache-2.0"
] | 3 | 2018-05-13T16:36:19.000Z | 2018-08-26T19:38:18.000Z | cassandra/lib/CQLBuilder.js | tomyc/platform-plugin-cassandra-node | b9b4e1772272b92a29b8ac19dd01692d427b7b04 | [
"Apache-2.0"
] | 4 | 2018-04-26T16:47:28.000Z | 2021-03-04T09:44:09.000Z | const QueryBuilder = require('./QueryBuilder');
const TableSchemaBuilder = require('./TableSchemaBuilder');
const UDTSchemaBuilder = require('./UDTSchemaBuilder');
class CQLBuilder {
static get INSERT_QUERY() { return 'insert'; }
static get UPDATE_QUERY() { return 'update'; }
/**
* Creates insert type of query
* @param tableName
* @param [keyspace = '']
* @returns {QueryBuilder}
*/
static insertInto(tableName, keyspace = '') {
return new QueryBuilder().insertInto(tableName, keyspace);
}
/**
* Creates update type of query
* @param tableName
* @param [keyspace = '']
* @returns {QueryBuilder}
*/
static update(tableName, keyspace) {
return new QueryBuilder().update(tableName, keyspace);
}
/**
* Creates query based on given type
* @param type CQLBuilder.INSERT_QUERY or CQLBuilder.UPDATE_QUERY
* @returns {QueryBuilder}
*/
static query(type) {
const queryBuilder = new QueryBuilder();
if (type === CQLBuilder.INSERT_QUERY) {
queryBuilder.insertInto();
} else if (type === CQLBuilder.UPDATE_QUERY) {
queryBuilder.update();
}
return queryBuilder;
}
/**
* Creates table creation type of query
* @param tableName
* @returns {TableSchemaBuilder}
*/
static createTable(tableName = '') {
return new TableSchemaBuilder().createTable(tableName);
}
/**
* Creates UDT creation type of query
* @param typeName
* @returns {UDTSchemaBuilder}
*/
static createUDT(typeName = '') {
return new UDTSchemaBuilder().createType(typeName);
}
static dropTable(tableName = '') {
return new TableSchemaBuilder().dropTable(tableName);
}
static dropType(typeName = '') {
return new UDTSchemaBuilder().dropType(typeName);
}
}
module.exports = CQLBuilder; | 26.324324 | 69 | 0.615503 |
d6b3b7cc8b639445b577694e396c77978fbf77d3 | 40 | js | JavaScript | contoureur.js | etpinard/contoureur | 60280adb7c94048c5e9648a5093e2cb430c505b8 | [
"MIT"
] | null | null | null | contoureur.js | etpinard/contoureur | 60280adb7c94048c5e9648a5093e2cb430c505b8 | [
"MIT"
] | null | null | null | contoureur.js | etpinard/contoureur | 60280adb7c94048c5e9648a5093e2cb430c505b8 | [
"MIT"
] | null | null | null | /* global: d3 */
(function() {
})();
| 5.714286 | 16 | 0.4 |
d6b40829eac7f21e6ffd6e94b5c71b7b1f47144b | 856 | js | JavaScript | signaling.js | lastmjs/browser-based-super-grid | 3887a78464eefbd96ad7d2fe19bdb3f5633ccd85 | [
"MIT"
] | 1 | 2017-06-08T12:47:32.000Z | 2017-06-08T12:47:32.000Z | signaling.js | lastmjs/browser-based-super-grid | 3887a78464eefbd96ad7d2fe19bdb3f5633ccd85 | [
"MIT"
] | 14 | 2017-04-04T16:07:45.000Z | 2017-05-22T16:43:35.000Z | signaling.js | lastmjs/browser-based-super-grid | 3887a78464eefbd96ad7d2fe19bdb3f5633ccd85 | [
"MIT"
] | null | null | null | const WebSocket = require('ws');
const server = new WebSocket.Server({
port: 8000
});
let clients = {};
server.on('connection', (client) => {
client.on('message', (message) => {
const deserializedMessage = JSON.parse(message);
switch (deserializedMessage.type) {
case 'INITIAL_CONNECTION': {
client.peerID = deserializedMessage.peerID;
clients[deserializedMessage.peerID] = client;
break;
}
default: {
if (!clients[deserializedMessage.peerID]) {
return;
}
clients[deserializedMessage.peerID].send(JSON.stringify(Object.assign({}, deserializedMessage, {
peerID: client.peerID
})));
break;
}
}
});
});
| 27.612903 | 112 | 0.510514 |
d6b50b475967b374e342dfb760dda1d692c90b81 | 4,567 | js | JavaScript | client/views/game/players.js | yeter1/qqq | d47081e302057aa83b410a5e05a39c587b29a7f8 | [
"Unlicense",
"MIT"
] | null | null | null | client/views/game/players.js | yeter1/qqq | d47081e302057aa83b410a5e05a39c587b29a7f8 | [
"Unlicense",
"MIT"
] | null | null | null | client/views/game/players.js | yeter1/qqq | d47081e302057aa83b410a5e05a39c587b29a7f8 | [
"Unlicense",
"MIT"
] | null | null | null | // Game Players
// Helper
Template.gamePlayers.helpers({
game: function() {
return Games.findOne({_id: Session.get('gameId')});
},
canInvite: function() {
return Meteor.isCordova;
},
canStart: function() {
var game = Games.findOne({_id: Session.get('gameId')});
var allReady = true;
game.players.list.forEach(function(v) {
if(v.ready == false) {
allReady = false;
}
});
return (game.players.joined >= 4) && allReady;
},
started: function() {
var game = Games.findOne({_id: Session.get('gameId')});
if(game.is.started) {
Router.go('gamePlay', {gameId: game._id});
}
return false;
}
});
// Events
Template.gamePlayers.events({
'click #game-start': function(event, template) {
console.log('E - click #game-start');
var game = Games.findOne({_id: Session.get('gameId')});
if(game) {
var input = {key: "started", value: true, gameId: game._id};
Meteor.call('gameStart', input, function (error, response) {
console.log('M - gameStart');
if(error) {
Materialize.toast(App.Defaults.messages.error, App.Defaults.toastTime);
} else {
Materialize.toast(response.message, App.Defaults.toastTime);
if(response.success) {
// Notifications - Round 1
Meteor.setTimeout(function() {
}, 2000);
Router.go('gamePlay', {gameId: game._id});
}
}
});
}
},
'click #game-started': function(event, template) {
console.log('E - click #game-started');
var game = Games.findOne({_id: Session.get('gameId')});
if(game.is.started) {
Router.go('gamePlay', {gameId: game._id});
}
},
'click #game-ready': function(event, template) {
console.log('E - click #game-ready');
// Get Inputs
var input = {};
input.ready = template.$(event.currentTarget).is(':checked');
input.gameId = Session.get('gameId');
console.log(input);
Meteor.call('gameToggleReady', input, function (error, response) {
console.log('M - gameToggleReady');
if(error) {
Materialize.toast(App.Defaults.messages.error, App.Defaults.toastTime);
} else {
Materialize.toast(response.message, App.Defaults.toastTime);
}
});
},
'click #game-invite': function(event, template) {
event.preventDefault();
console.log('E - click #game-invite');
var game = Games.findOne({_id: Session.get('gameId')});
if(Meteor.isCordova) {
// Show action loading
App.Helpers.actionLoading('#game-invite', 'before');
var message = 'Mafia in '+game.city.name+'! Code: '+game.city.code;
var subject = 'Join us and save the city!';
var image = 'http://mafia.atulmy.com/static/images/ic_launcher.png';
var link = 'http://mafia.atulmy.com/';
window.plugins.socialsharing.share(
message,
subject,
image,
link
);
setTimeout(function() {
App.Helpers.actionLoading('#game-invite', 'after');
}, 2000);
}
}
});
// On Render
Template.gamePlayers.rendered = function() {
console.log('R - Template.gamePlayers.rendered');
var game = Games.findOne({_id: Session.get('gameId')});
if(game.is.started) {
Router.go('home');
}
$( function() {
App.init();
App.Materialize.Init.modal();
});
};
// On Create
Template.gamePlayers.onCreated(function () {
console.log('R - Template.gamePlayers.created');
var self = this;
self.autorun(function () {
// Notifications
var notifications = Notifications.find();
notifications.observeChanges({
added: function(id, obj) {
if(obj.type == 'overlay') {
App.Overlay.show(obj.text, 'pulse', App.Defaults.overlayTime);
} else {
if(obj.by != Meteor.userId()) {
Materialize.toast(obj.text, App.Defaults.toastTime);
}
}
}
});
});
}); | 28.905063 | 91 | 0.511058 |
d6b512214195efdd9a37b411fb7b1a67300b7403 | 1,298 | js | JavaScript | src_demo/site/helpers/site/gallery-items.js | mmilano/SidePanelCollapse | 2c1ac5475bafb43f27a7928e3a5679b215f495ad | [
"MIT"
] | null | null | null | src_demo/site/helpers/site/gallery-items.js | mmilano/SidePanelCollapse | 2c1ac5475bafb43f27a7928e3a5679b215f495ad | [
"MIT"
] | null | null | null | src_demo/site/helpers/site/gallery-items.js | mmilano/SidePanelCollapse | 2c1ac5475bafb43f27a7928e3a5679b215f495ad | [
"MIT"
] | 1 | 2021-06-28T20:03:17.000Z | 2021-06-28T20:03:17.000Z | // *****
// handlebars BLOCK helper module
//
// generate the gallery of pages
var gallery = function(globalContext, options) {
"use strict";
let out = ""; // output
// check that options = the handlebars options object.
// allow for arbitrary number of attributes passed as arguments
if (!options || !options.fn) {
options = arguments[arguments.length-1];
}
// in lieu of passing in the {object} site-gallery, get it out of the global context that is passed in
let siteGallery = globalContext && globalContext["site-gallery"];
// create a parallel array of just the active page keys
let keys = Object.keys(siteGallery);
let pagesActive = [];
keys.forEach(function(page) {
if (!siteGallery[page].disable) {
pagesActive.push(page);
};
});
let pagesLength = pagesActive.length - 1; // convert human-friendly length to be compatible with the machine-friendly index
if (pagesLength < 1) {pagesLength = 1;};
// generate the block element for each active page
pagesActive.forEach(function(p) {
let aPage = siteGallery[p];
// render the block helper content
let element = options.fn(aPage);
out += element;
});
return out;
};
module.exports = gallery; | 29.5 | 128 | 0.644068 |
d6b554e802c6c84eb941205b843d087e2591cb7f | 3,561 | js | JavaScript | guns-admin/src/main/webapp/static/modular/system/updown/updown_info.js | thesecondteam/GunsSecond | 631d3c01b543fe4680769040fbc085a07ba0c1f2 | [
"Apache-2.0"
] | null | null | null | guns-admin/src/main/webapp/static/modular/system/updown/updown_info.js | thesecondteam/GunsSecond | 631d3c01b543fe4680769040fbc085a07ba0c1f2 | [
"Apache-2.0"
] | 5 | 2019-08-05T03:23:54.000Z | 2021-09-20T20:51:12.000Z | guns-admin/src/main/webapp/static/modular/system/updown/updown_info.js | thesecondteam/GunsSecond | 631d3c01b543fe4680769040fbc085a07ba0c1f2 | [
"Apache-2.0"
] | 5 | 2019-08-03T08:00:11.000Z | 2019-08-03T08:35:04.000Z |
/**
* 初始化详情对话框
*/
var UpdownInfoDlg = {
updownInfoData : {},
validateFields: {
oppeople: {
validators: {
notEmpty: {
message: '操作人不能为为空'
}
}
},
optime: {
validators: {
notEmpty: {
message: '操作时间不能为空'
}
}
}
}
};
UpdownInfoDlg.validate = function () {
$('#updownInfoForm').data("bootstrapValidator").resetForm();
$('#updownInfoForm').bootstrapValidator('validate');
return $("#updownInfoForm").data('bootstrapValidator').isValid();
}
/**
* 清除数据
*/
UpdownInfoDlg.clearData = function() {
this.updownInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UpdownInfoDlg.set = function(key, val) {
this.updownInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UpdownInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
UpdownInfoDlg.close = function() {
parent.layer.close(window.parent.Updown.layerIndex);
}
/**
* 收集数据
*/
UpdownInfoDlg.collectData = function() {
this
.set('ordernumber')
.set('optime')
.set('oppeople')
.set('optype')
.set('recphone')
.set('areaid')
.set('recpeople')
.set('id');
}
/**
* 拼单添加
*/
UpdownInfoDlg.ploadSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/updown/pload", function(data){
Feng.success("添加成功!");
window.parent.Updown.table.refresh();
UpdownInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
var orders=$('#ordernumber').val();
ajax.set("orders",JSON.stringify(orders));
ajax.set("boxcode",$('#boxcode').val());
ajax.set("oppeople",$('#oppeople').val());
ajax.set("optime",$('#optime').val());
ajax.set("areaid",$('#areaid').val());
ajax.start();
}
/**
* 拆单添加
*/
UpdownInfoDlg.cloadSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/updown/cload", function(data){
Feng.success("添加成功!");
window.parent.Updown.table.refresh();
UpdownInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
var boxcodes=$('#boxcode').val();
ajax.set("order",$('#ordernumber').val());
ajax.set("boxcodes",JSON.stringify(boxcodes));
ajax.set("oppeople",$('#oppeople').val());
ajax.set("optime",$('#optime').val());
ajax.set("areaid",$('#areaid').val());
ajax.start();
}
/**
* 整箱添加
*/
UpdownInfoDlg.loadSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/updown/load", function(data){
Feng.success("添加成功!");
window.parent.Updown.table.refresh();
UpdownInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set("order",$('#ordernumber').val());
ajax.set("boxcode",$('#boxcode').val());
ajax.set("oppeople",$('#oppeople').val());
ajax.set("optime",$('#optime').val());
ajax.set("areaid",$('#areaid').val());
ajax.start();
}
| 21.323353 | 86 | 0.540298 |
d6b5cd66516ada808dd7ebd90b92e31f746a229e | 139 | js | JavaScript | dest/CUBE/Book/index.js | ChineseCubes/react-odp | 8126f695c4a2e772ed542cc7e2e135326fa0547d | [
"MIT"
] | 2 | 2015-02-13T04:55:23.000Z | 2015-04-07T00:35:46.000Z | dest/CUBE/Book/index.js | ChineseCubes/react-odp | 8126f695c4a2e772ed542cc7e2e135326fa0547d | [
"MIT"
] | 7 | 2015-01-13T10:28:34.000Z | 2017-04-10T13:22:28.000Z | dest/CUBE/Book/index.js | ChineseCubes/react-odp | 8126f695c4a2e772ed542cc7e2e135326fa0547d | [
"MIT"
] | null | null | null | (function(){
module.exports = {
AudioControl: require('./AudioControl'),
Playground: require('./Playground')
};
}).call(this);
| 19.857143 | 44 | 0.625899 |
d6b6158283e6a0f87f2b12533047649c08b8bcfc | 251 | js | JavaScript | Programming Hero Course/Advanced JavaScript/break-continue.js | arifparvez14/WebDevelopment | 8da72a3040e08cb07929a887111eb74f3ab3bc56 | [
"MIT"
] | null | null | null | Programming Hero Course/Advanced JavaScript/break-continue.js | arifparvez14/WebDevelopment | 8da72a3040e08cb07929a887111eb74f3ab3bc56 | [
"MIT"
] | 7 | 2021-03-10T12:15:34.000Z | 2022-03-02T07:54:47.000Z | Programming Hero Course/Advanced JavaScript/break-continue.js | arifparvez14/WebDevelopment | 8da72a3040e08cb07929a887111eb74f3ab3bc56 | [
"MIT"
] | null | null | null | const num = [1,-2,2,-3,3,4,5,6,7];
for(let i = 0; i < num.length; i++){
if(num[i] > 3){
break;
}
//console.log(num[i]);
}
for(let i = 0; i < num.length; i++){
if(num[i] < 0){
continue;
}
console.log(num[i]);
} | 16.733333 | 36 | 0.438247 |
d6b61af00378632f77edd1e317c1cd2b1e767e99 | 10,722 | js | JavaScript | api/controllers/ProjectController.js | merico-dev/build-backend | ea3e508e9b3cd812c45980baed690da360d34216 | [
"Apache-2.0"
] | 4 | 2021-05-28T00:45:30.000Z | 2021-06-29T00:45:04.000Z | api/controllers/ProjectController.js | merico-dev/build-backend | ea3e508e9b3cd812c45980baed690da360d34216 | [
"Apache-2.0"
] | null | null | null | api/controllers/ProjectController.js | merico-dev/build-backend | ea3e508e9b3cd812c45980baed690da360d34216 | [
"Apache-2.0"
] | 2 | 2021-06-02T01:26:28.000Z | 2021-06-08T14:17:00.000Z | const eeQuery = require('../util/eeQuery')
const converter = require('../util/eeToCEDataConverter')
const errors = require('../util/errors')
const validate = require('../util/validation')
const ProjectUtil = require('../util/project')
const projectProfileUtil = require('../util/projectProfile')
const BadgeUtil = require('../util/badges')
const INVALID_GIT_URL = 'You must specify a git URL like this: https://github.com/joncodo/p5CodingChallenge.git'
const codeAnalysis = require('../util/codeAnalysis')
const { getProjectDevRankings } = require('../util/analyticsApi/reportData')
const {
formatBasicProjectForApiResponse,
formatFullProjectForApiResponse,
formatFavoriteResults,
formatDevRankingMetricsForProject,
formatErrorResponse
} = require('../util/apiResponseFormatter')
const formatCreateManyResponse = (successes, warnings, failures) => {
return {
successes: successes.map(formatBasicProjectForApiResponse),
warnings,
failures
}
}
module.exports = {
projectCount: (req, res) => {
const sql = 'select count(id) from "Projects"'
eeQuery.execute(sql, [], res, (rows) => {
return res.status(200).send({ rows })
})
},
projects: async (req, res) => {
const count = req.query.count || 10
const start = req.query.start || 0
const sortColumn = req.query.sortColumn
const sortDirection = req.query.sortDirection
const isFavorite = req.query.isFavorite
try {
const { projects, totalRecords } = await converter.getUserProjectsWithEEData(
req.user,
start,
count,
sortColumn,
sortDirection,
isFavorite
)
return res.status(200).send({
data: projects.map(formatFullProjectForApiResponse),
totalRecords
})
} catch (error) {
console.error('ERROR: ProjectController:projects: ', error)
return res.status(500).send('ERROR: ProjectController:projects: ' + error)
}
},
create: async (req, res) => {
try {
const results = await ProjectUtil.create(req.body.gitUrl, req.body.url, req.body.name, req.user)
await codeAnalysis.analyze(results.gitUrl, req.user.id)
return res.status(200).send(formatBasicProjectForApiResponse(results))
} catch (error) {
errors.send(res, error, '234fdfqqwdf')
}
},
createMany: async (req, res) => {
try {
const { projectsAdded, warnings, failures } = await module.exports.createManyProjects(req.body.projects, req.user)
if (!projectsAdded.length) {
return res.status(200).send(formatCreateManyResponse([], warnings, failures))
}
const analyses = await module.exports.submitManyProjectsForAnalysis(projectsAdded, req)
const allWarnings = module.exports.updateWarningsWithAnalysis(projectsAdded, warnings, analyses)
return res.status(200).send(formatCreateManyResponse(projectsAdded, allWarnings, failures))
} catch (error) {
console.log('ProjectController.js:createMany', error)
errors.send(res, error, 'ProjectController.js:createMany')
}
},
createManyProjects: async (projects, user) => {
try {
const projectCreatePromises = []
const projectsAdded = []
const gitProjects = await ProjectUtil.getProjectsFrom3rdParties(projects, user)
const { validProjects, warnings, failures } = ProjectUtil.filterGitProjectsBySize(gitProjects, projects)
validProjects.forEach(async (project) => {
projectCreatePromises.push(
ProjectUtil.create(project.gitUrl, project.url, project.name, user).catch((e) => e)
)
})
await Promise.all(projectCreatePromises).then((results) => {
results.forEach((result, index) => {
if (result instanceof Error) {
console.error('ProjectController.js:createManyProjects', results)
failures.push({
message: 'Repo failed to add',
code: 'REPO_EXISTS',
project: validProjects[index]
})
} else {
projectsAdded.push(result)
}
})
})
return { projectsAdded, warnings, failures }
} catch (error) {
console.error('ProjectController.js:createManyProjects failed to create projects', error)
throw error
}
},
submitManyProjectsForAnalysis: async (projects, req) => {
try {
const analysisSubmissionPromises = []
projects.forEach(async (project) => {
analysisSubmissionPromises.push(codeAnalysis.analyze(project.gitUrl, req.user.id))
})
return await Promise.all(analysisSubmissionPromises.map((p) => p.catch((e) => e)))
} catch (error) {
console.error('ProjectController.js:submitManyProjectsForAnalysis failed to submit', error)
}
},
updateWarningsWithAnalysis: (projects, createWarnings, analyses) => {
const warnings = []
projects.forEach(project => {
const warning = createWarnings.find(warning => warning.project.gitUrl === project.gitUrl)
const analysis = analyses.find(analysis => analysis.gitUrl === project.gitUrl)
if (analysis && analysis.options.commitAfter) {
const commitLimitMessage = `Due to the large size of this repository, we can only process the most recent ${analysis.options.commitLimit} commits.`
const newWarning = warning
? {
...warning,
message: `${warning.message}. ${commitLimitMessage}`
}
: {
message: commitLimitMessage,
code: 'REPO_TOO_BIG',
project
}
warnings.push(newWarning)
} else if (warning) {
warnings.push(warning)
}
})
return warnings
},
delete: async (req, res) => {
const gitUrl = req.query.gitUrl || req.body.gitUrl
if (!gitUrl && validate.isValidGitUrl(gitUrl)) {
return res.status(500).send(INVALID_GIT_URL)
}
try {
const deletedProject = await ProjectUtil.delete(gitUrl, req.user.id)
const remainingProjects = await ProjectUtil.getAllByUserId(req.user.id)
// TODO: DRY this up (it's very similar to what happens in deleteMany)
if (!remainingProjects.length) {
BadgeUtil.deleteAllByUser(req.user)
} else {
// TODO: should this be done in a sequelize hook (Project.onDelete)?
await BadgeUtil.deleteProjectSpecificBadges(deletedProject.getDataValue('id'), req.user.id)
// TODO: make this better
const remainingProject = remainingProjects[0]
await BadgeUtil.generateGlobalBadges(remainingProject.id, req.user.id)
}
return res.status(200).send({ data: formatFullProjectForApiResponse(deletedProject) })
} catch (error) {
errors.send(res, error, '89237yjkfdfd')
}
},
deleteMany: async (req, res) => {
const gitUrls = req.body.gitUrls
if (!gitUrls && validate.isInvalidGitUrlArray(gitUrls)) {
return res.status(500).send(INVALID_GIT_URL)
}
try {
const promises = []
gitUrls.forEach(async (gitUrl) => {
promises.push(ProjectUtil.delete(gitUrl, req.user.id))
})
const deletedProjects = await Promise.all(promises)
const remainingProjects = await ProjectUtil.getAllByUserId(req.user.id)
// TODO: move this badge stuff into a separate function within this file
if (!remainingProjects.length) {
BadgeUtil.deleteAllByUser(req.user)
} else {
// TODO: should this be done in a sequelize hook (Project.onDelete)?
const badgeDeletionPromises = []
deletedProjects.forEach((project) => {
badgeDeletionPromises.push(BadgeUtil.deleteProjectSpecificBadges(project.getDataValue('id'), req.user.id))
})
await Promise.all(badgeDeletionPromises)
// TODO: make this better
await BadgeUtil.generateGlobalBadges(remainingProjects[0].id, req.user.id)
}
return res.status(200).send('All selected repos were deleted')
} catch (error) {
errors.send(res, error, 'lsd0d9kfj83')
}
},
setFavoriteRepos: async (req, res) => {
try {
const projects = req.body.projects
if (!projects) {
return res.status(400).send('You must pass projects in the body [{id: 1, isFavorite:true}]')
}
const promises = projects.map(project => ProjectUtil.setFavorite(project.gitUrl, req.user.id, project.isFavorite))
const results = await Promise.all(promises)
return res.status(200).send(formatFavoriteResults(results))
} catch (error) {
errors.send(res, error, 'sdfkjdiu')
}
},
/**
* @deprecated
*/
getCeRepos: async (req, res) => {
try {
const projects = await ProjectUtil.findAll()
return res.status(200).send({ projects })
} catch (error) {
errors.send(res, error, 'sdfkjh38')
}
},
allDevMetricsForProject: async (req, res) => {
try {
const { gitUrl, startDate, endDate } = req.query
const userId = req.user.id
const project = await ProjectUtil.findOne({
gitUrl: gitUrl
})
if (!project) {
return res.status(404).send({ error: 'Project not found' })
}
const user = project.get('Users').find(user => user.get('id') === userId)
if (!user) {
return res.status(401).send({ error: 'Project does not belong to user' })
}
const rawMetrics = await getProjectDevRankings(gitUrl, startDate, endDate, user.get('primaryEmail'))
const formattedMetrics = rawMetrics.map(formatDevRankingMetricsForProject)
return res.status(200).send({ data: formattedMetrics })
} catch (error) {
errors.send(res, error, 'ProjectController:devMetricsForProject')
}
},
publicProfile: async (req, res) => {
try {
const { gitUrl } = req.query
const project = await ProjectUtil.getOneByGitUrl(ProjectUtil.homogenizeGitUrl(gitUrl))
if (!project) {
return res.status(404).send(formatErrorResponse('No project found for that gitUrl', { gitUrl }))
}
const { topContributors, population, velocity, merges, interval } = await projectProfileUtil.getPublicProfile(project)
return res.status(200).send({
data: {
gitUrl: project.get('gitUrl'),
name: project.get('name'),
webUrl: project.get('url'),
interval,
topContributors,
population,
velocity,
merges
}
})
} catch (error) {
console.error('ProjectController:publicProfile', error)
return res.status(500).send(formatErrorResponse(
'An unexpected error occurred getting the project public profile',
{ stack: error.stack }
))
}
}
}
| 32.295181 | 155 | 0.646428 |
d6b631c30021c88c42572e6fd06cd48a81e486d7 | 6,300 | js | JavaScript | sources/js/Request.js | heschel6/Magic_Experiment | ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1 | [
"MIT"
] | 201 | 2016-11-14T23:13:21.000Z | 2019-04-17T19:55:12.000Z | sources/js/Request.js | heschel6/Magic_Experiment | ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1 | [
"MIT"
] | 10 | 2016-12-23T06:06:23.000Z | 2021-04-19T21:04:55.000Z | sources/js/Request.js | heschel6/Magic_Experiment | ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1 | [
"MIT"
] | 19 | 2016-12-23T10:08:35.000Z | 2021-08-16T08:08:22.000Z | var Request, RequestEngine,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
RequestEngine = (function(_super) {
__extends(RequestEngine, _super);
RequestEngine.prototype._kind = 'RequestEngine';
RequestEngine.prototype.url = NULL;
RequestEngine.prototype.parameters = NULL;
RequestEngine.prototype.files = NULL;
RequestEngine.prototype.username = NULL;
RequestEngine.prototype.password = NULL;
RequestEngine.prototype.success = NULL;
RequestEngine.prototype.error = NULL;
RequestEngine.prototype.async = true;
RequestEngine.prototype.response = {};
RequestEngine.prototype.xhttp = new XMLHttpRequest;
function RequestEngine(type, args) {
var item, that;
if (!Utils.isString(args[0])) {
return null;
}
this.url = args[0];
if (Utils.isFunction(args[1])) {
this.success = args[1];
if (Utils.isFunction(args[2])) {
this.error = args[2];
}
} else if (Utils.isObject(args[1])) {
if (args[1].success) {
this.success = args[1].success;
}
if (args[1].error) {
this.error = args[1].error;
}
if (args[1].files) {
this.files = args[1].files;
}
if (args[1].async === false) {
this.async = false;
}
if (args[1].then) {
this.then = args[1].then;
}
if (args[1].username) {
this.username = args[1].username;
}
if (args[1].password) {
this.password = args[1].password;
}
if (args[1].parameters && Utils.isObject(args[1].parameters)) {
this.parameters = args[1].parameters;
}
if (Utils.isFunction(args[2])) {
this.success = args[2];
if (Utils.isFunction(args[3])) {
this.error = args[3];
}
}
}
if (this.parameters) {
that = this;
this._parameters = Object.keys(this.parameters).map(function(k) {
return encodeURIComponent(k) + '=' + encodeURIComponent(that.parameters[k]);
}).join('&');
}
if (this.files) {
this.setUploadEvents();
}
this.xhttp.onreadystatechange = this.responseProcess.bind(this);
if (type === 'GET' && this._parameters && this._parameters.length) {
this.url = this.url + '?' + this._parameters;
}
this.xhttp.open(type, this.url, this.async, this.username, this.password);
if (type === 'POST' && this.files) {
this._parameters = new FormData;
for (item in this.parameters) {
console.log(this.parameters);
this._parameters.append(item, this.parameters[item]);
}
for (item in this.files) {
this._parameters.append(item, this.files[item]);
}
} else if (type !== 'GET') {
this.xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
this.xhttp.send(this._parameters);
return;
}
RequestEngine.prototype.setUploadEvents = function() {
var that;
that = this;
this.xhttp.upload.addEventListener(Event.Progress, function(event) {
event.progress = NULL;
if (event.lengthComputable) {
event.progress = event.loaded / event.total;
}
that.emit(Event.Progress, event);
});
this.xhttp.upload.addEventListener(Event.Loaded, function(event) {
event.progress = 100;
that.emit(Event.Load, event);
});
this.xhttp.upload.addEventListener(Event.Error, function(event) {
that.emit(Event.Error, event);
});
return this.xhttp.upload.addEventListener(Event.Abort, function(event) {
that.emit(Event.Abort, event);
});
};
RequestEngine.prototype.setHTTPResponse = function() {
var err;
if (this.xhttp.responseText !== NULL) {
try {
return this.response.data = JSON.parse(this.xhttp.responseText);
} catch (_error) {
err = _error;
return this.response.data = this.xhttp.responseText;
}
}
};
RequestEngine.prototype.responseProcess = function() {
this.response.state = this.xhttp.readyState;
this.response.status = this.xhttp.status;
if (this.xhttp.readyState === 4) {
this.response.raw = this.xhttp.responseText;
if (this.xhttp.status.toString()[0] === '2') {
if (this.success) {
this.setHTTPResponse();
this.success(this.response);
this.emit(Event.Success, this.response);
}
} else {
if (this.error) {
this.setHTTPResponse();
this.error(this.response);
this.emit(Event.Error, this.response);
}
}
if (this.then) {
this.then(this.response);
}
this.emit(Event.Response, this.response);
}
};
RequestEngine.prototype.onSuccess = function(cb) {
return this.on(Event.Success, cb);
};
RequestEngine.prototype.onError = function(cb) {
return this.on(Event.Error, cb);
};
RequestEngine.prototype.onResponse = function(cb) {
return this.on(Event.Response, cb);
};
RequestEngine.prototype.onProgress = function(cb) {
return this.on(Event.Progress, cb);
};
RequestEngine.prototype.onAbort = function(cb) {
return this.on(Event.Abort, cb);
};
RequestEngine.prototype.onLoad = function(cb) {
return this.on(Event.Load, cb);
};
RequestEngine.prototype.onLoaded = function(cb) {
return this.on(Event.Loaded, cb);
};
RequestEngine.prototype.onDone = function(cb) {
return this.on(Event.Loaded, cb);
};
return RequestEngine;
})(Element);
Request = {
get: function() {
if (arguments.length === 0) {
return null;
}
return new RequestEngine('GET', arguments);
},
send: function() {
if (arguments.length === 0) {
return null;
}
return new RequestEngine('POST', arguments);
},
"delete": function() {
if (arguments.length === 0) {
return null;
}
return new RequestEngine('DELETE', arguments);
},
update: function() {
if (arguments.length === 0) {
return null;
}
return new RequestEngine('PUT', arguments);
}
};
| 28.125 | 290 | 0.612381 |
d6b7757018cd7ead01125fe47787d667ca69810e | 457 | js | JavaScript | module_connect_postgreSQL/models/index.js | JS3322/module_css_javascript | 76f8672dec99e70060e783f370a329041d5f33cf | [
"MIT"
] | null | null | null | module_connect_postgreSQL/models/index.js | JS3322/module_css_javascript | 76f8672dec99e70060e783f370a329041d5f33cf | [
"MIT"
] | null | null | null | module_connect_postgreSQL/models/index.js | JS3322/module_css_javascript | 76f8672dec99e70060e783f370a329041d5f33cf | [
"MIT"
] | null | null | null | 'use strict'
require('dotenv').config()
const Sequelize = require('sequelize')
const env = process.env
const config = require(__dirname + '/../config/')[env.NODE_ENV]
const db = {}
const sequelize = new Sequelize(config.database, config.username, config.password, config)
Object.keys(db).forEach(modelName => {
if (db[modelName].associate) {
db[modelName].associate(db)
}
})
db.sequelize = sequelize
db.Sequelize = Sequelize
module.exports = db | 22.85 | 90 | 0.717724 |
d6b8daad36d9e1b1572df00875d557f963e622a0 | 126 | js | JavaScript | src/app/core/core.component.js | gigigo-html5/gig-starter-angular1-kit | 29eba25c236d4fc476c299a84de2f6d214404b12 | [
"MIT"
] | 2 | 2016-09-19T15:29:12.000Z | 2016-09-27T07:58:45.000Z | src/app/core/core.component.js | gigigo-html5/gig-starter-angular1-kit | 29eba25c236d4fc476c299a84de2f6d214404b12 | [
"MIT"
] | null | null | null | src/app/core/core.component.js | gigigo-html5/gig-starter-angular1-kit | 29eba25c236d4fc476c299a84de2f6d214404b12 | [
"MIT"
] | null | null | null | export default {
controller: 'CoreController',
controllerAs: 'core',
templateUrl: __dirname + '/core.view.html'
}
| 21 | 46 | 0.674603 |
d6b8e86df8bb6643e052d7d139a232d7a0f2c538 | 2,817 | js | JavaScript | src/js/data/audio.js | bernhard-hofmann/elematter-js13k | b7c4c0a9e06446a9afacbd605ea1efb0ae3433ae | [
"MIT"
] | 32 | 2015-04-01T07:51:15.000Z | 2022-02-08T08:35:43.000Z | src/js/data/audio.js | jackrugile/elematter-js13k | b7c4c0a9e06446a9afacbd605ea1efb0ae3433ae | [
"MIT"
] | null | null | null | src/js/data/audio.js | jackrugile/elematter-js13k | b7c4c0a9e06446a9afacbd605ea1efb0ae3433ae | [
"MIT"
] | 10 | 2015-05-15T09:23:06.000Z | 2021-10-05T23:05:10.000Z | /*==============================================================================
Audio
==============================================================================*/
g.audio.add( 'ui-l', 6,
[
[0,0.42,0.07,0.5,0.13,0.61,,-0.0799,0.0032,,0.42,0.56,0.68,0.83,0.6799,,0.1799,0.6,0.69,0.58,,0.24,-0.0278,0.7]
]
);
g.audio.add( 'ui-m', 6,
[
[0,0.42,0.07,0.5,0.13,0.84,,0.0026,0.0032,,0.42,0.56,0.68,0.81,0.6799,,0.1799,0.6,0.69,0.58,,0.24,-0.0278,0.7]
]
);
g.audio.add( 'ui-h', 6,
[
[0,0.42,0.07,0.5,0.13,0.9,,,0.0032,,0.42,0.56,0.68,0.81,0.6799,,0.1799,0.6,0.69,0.58,,0.24,-0.0278,0.7]
]
);
g.audio.add( 'ui-open', 4,
[
[2,0.0206,0.2536,0.28,0.35,0.32,,0.02,0.06,0.54,0.7,0.9788,,,-1,,-0.64,0.7,0.89,0.74,0.93,0.37,0.1102,0.35]
]
);
g.audio.add( 'ui-tap', 15,
[
[2,0.16,0.0338,,0.0273,0.94,,1,1,,,-0.38,,0.0854,,,,,1,,,0.1,,0.45]
]
);
g.audio.add( 'fire-e', 15,
[
[0,0.0015,0.1454,0.1299,0.35,0.17,,0.0002,-0.0391,0.2938,0.2564,0.317,,,0.6036,0.5537,0.0251,0.8326,0.8964,-0.9428,0.7715,0.1282,,0.35]
]
);
g.audio.add( 'fire-w', 15,
[
[2,,0.1839,0.4625,0.2596,0.28,0.2,0.1799,0.24,0.4829,0.8777,-0.7658,0.0207,0.1163,-0.162,0.285,0.1058,-0.005,0.9952,0.027,0.0095,,0.0344,0.3]
]
);
g.audio.add( 'fire-a', 15,
[
[3,0.21,0.1784,0.3504,0.2841,0.84,0.0057,0.52,0.56,0.0752,0.735,0.5024,0.1312,0.452,0.5037,0.0798,-0.1418,-0.2362,0.4854,-0.0141,0.3018,0.0106,-0.0548,0.4]
]
);
g.audio.add( 'fire-f', 15,
[
[3,0.13,0.21,0.15,0.32,0.1701,0.0314,0.022,-0.0097,,,-0.5037,0.7324,0.0077,-0.1999,,0.5447,0.6625,1,0.0991,0.1081,0.0686,-0.078,0.3]
]
);
g.audio.add( 'hit-e', 15,
[
[3,0.0032,0.7122,0.3074,0.1242,0.4294,,-0.7643,0.0621,0.0073,0.9191,0.9475,,,-0.6928,-0.3204,0.9318,0.5246,0.9096,-0.8044,0.6524,0.0002,0.3206,0.32]
]
);
g.audio.add( 'hit-w', 15,
[
[3,0.0211,0.5274,0.0501,0.4198,0.1625,,0.8586,-0.0099,,,0.7094,,-0.6983,0.0269,,-0.0004,,0.301,-0.1429,,0.3653,,0.35]
]
);
g.audio.add( 'hit-a', 15,
[
[3,0.05,0.1,,0.1698,0.4,,0.76,-0.62,,,0.04,,,-0.58,0.35,1,0.4399,1,-0.36,1,,,0.35]
]
);
g.audio.add( 'hit-f', 15,
[
[3,,0.26,0.26,0.32,0.31,,-0.3399,-0.54,,,-0.2629,0.739,,,,0.72,0.72,1,-0.3399,0.73,,,0.3]
]
);
g.audio.add( 'wave', 5,
[
[2,0.3605,0.3137,0.2096,0.5834,0.5001,,-0.4232,,-0.0584,-0.7583,0.3493,0.627,-0.409,-0.5195,0.9178,,0.5519,0.8155,0.0368,-0.6577,0.183,-0.0001,0.3]
]
);
g.audio.add( 'life', 5,
[
[0,0.1219,0.5797,0.5152,0.3988,0.15,,-0.14,-1,0.93,0.91,-0.16,,0.03,0.62,1,-0.0167,-0.2123,0.9297,-0.5433,0.1666,,-0.0042,0.4]
]
);
g.audio.add( 'gameover', 1,
[
[0,,0.9466,0.34,0.72,0.1471,,-0.0999,-0.5,,,-0.7254,,0.2,0.58,0.56,-0.0921,-0.1867,0.9041,-0.0156,,,-0.006,0.3]
]
);
g.audio.add( 'boss', 1,
[
[3,,0.32,0.29,0.9,0.26,,-0.7,0.6599,,0.78,0.1667,,,-0.0784,0.9115,-0.12,0.6599,0.22,0.36,0.21,,-0.3399,0.3]
]
); | 26.083333 | 157 | 0.521122 |
d6b9bcace7349ca1ac70389712ebd22f797602fc | 3,182 | js | JavaScript | lib/store.js | leizongmin/node-lei-spider | 4992a97ccf5d4f8e335bf64f2e90e7a081b65c03 | [
"MIT"
] | 7 | 2015-11-24T03:10:00.000Z | 2017-07-14T07:33:08.000Z | lib/store.js | leizongmin/node-lei-spider | 4992a97ccf5d4f8e335bf64f2e90e7a081b65c03 | [
"MIT"
] | 1 | 2017-12-21T04:09:31.000Z | 2017-12-21T04:09:31.000Z | lib/store.js | leizongmin/node-lei-spider | 4992a97ccf5d4f8e335bf64f2e90e7a081b65c03 | [
"MIT"
] | 5 | 2015-11-15T13:20:58.000Z | 2016-10-14T02:58:46.000Z | /**
* lei-crawler
*
* @author Zongmin Lei <leizongmin@gmail.com>
*/
var Redis = require('ioredis');
var utils = require('./utils');
var debug = utils.debug('store');
module.exports = exports = function (options) {
return new SimpleStore(options);
};
// 默认Redis数据库地址
exports.DEFAULT_HOST = 'localhost';
// 默认Redis数据库端口
exports.DEFAULT_PORT = 6379;
// 默认Redis数据库号
exports.DEFAULT_DB = 0;
// 默认Key前缀
exports.DEFAULT_PREFIX = 'lei-crawler:';
/**
* SimpleStore
*
* @param {Object} options
* - {String} host
* - {Number} port
* - {Number} db
* - {String} prefix
*/
function SimpleStore (options) {
options = utils.merge({
host: exports.DEFAULT_HOST,
port: exports.DEFAULT_PORT,
db: exports.DEFAULT_DB,
prefix: exports.DEFAULT_PREFIX
}, options || {});
this._options = options;
var redis = this._redis = new Redis({
host: options.host,
port: options.port,
db: options.db
});
debug('new SimpleStore: options=%j', options);
}
SimpleStore.prototype._getKey = function (key) {
return this._options.prefix + key;
};
SimpleStore.prototype._getValues = function (values) {
if (!Array.isArray(values)) values = [values];
return values;
};
SimpleStore.prototype.sAdd = function (name, values, callback) {
values = this._getValues(values);
if (values.length < 1) return callback();
this._redis.sadd(this._getKey(name), values, callback);
};
SimpleStore.prototype.sRemove = function (name, values, callback) {
values = this._getValues(values);
if (values.length < 1) return callback();
this._redis.srem(this._getKey(name), values, callback);
};
SimpleStore.prototype.sExists = function (name, value, callback) {
this._redis.sismember(this._getKey(name), value, function (err, ret) {
callback(err, ret > 0);
});
};
SimpleStore.prototype.sGet = function (name, callback) {
this._redis.spop(this._getKey(name), callback);
};
SimpleStore.prototype.sAll = function (name, callback) {
this._redis.smembers(this._getKey(name), callback);
};
SimpleStore.prototype.sCount = function (name, callback) {
this._redis.scard(this._getKey(name), callback);
};
SimpleStore.prototype.sInter = function (name, values, callback) {
var self = this;
var tmpKey = self._getKey('tmp:inter:' + Date.now() + Math.random());
values = self._getValues(values);
if (values.length < 1) return callback(null, []);
// 先创建一个临时集合,计算两个集合之间的交集,再删除临时集合,返回交集结果
self._redis.sadd(tmpKey, values, function (err) {
if (err) return callback(err);
self._redis.sinter(self._getKey(name), tmpKey, function (err, ret) {
self._redis.del(tmpKey, function (err2) {
callback(err || err2, ret);
});
});
});
};
SimpleStore.prototype.delete = function (name, callback) {
this._redis.del(this._getKey(name), callback);
};
SimpleStore.prototype.get = function (name, callback) {
this._redis.get(this._getKey(name), callback);
};
SimpleStore.prototype.set = function (name, value, callback) {
this._redis.set(this._getKey(name), value, callback);
};
SimpleStore.prototype.setCache = function (name, value, ttl, callback) {
this._redis.setex(this._getKey(name), ttl, value, callback);
};
| 25.66129 | 72 | 0.684161 |
d6ba39da7b71eeb23d552bff5cf813370b78ac7b | 477 | js | JavaScript | app/lib/config/config.js | javiercbk/budgeteala | 6d235ce6579c5ea8e2d2f59f66ce8918ff6454f9 | [
"Unlicense"
] | 7 | 2018-12-13T14:07:53.000Z | 2020-07-24T00:50:32.000Z | app/lib/config/config.js | javiercbk/budgeteala | 6d235ce6579c5ea8e2d2f59f66ce8918ff6454f9 | [
"Unlicense"
] | null | null | null | app/lib/config/config.js | javiercbk/budgeteala | 6d235ce6579c5ea8e2d2f59f66ce8918ff6454f9 | [
"Unlicense"
] | 1 | 2019-07-02T10:47:16.000Z | 2019-07-02T10:47:16.000Z | const config = require('./index');
const prospect = {
username: config.DB_USERNAME,
password: config.DB_PASSWORD,
database: config.DB_NAME,
host: config.DB_HOST,
logging: config.DB_LOGGING,
dialect: config.DB_DIALECT,
timezone: 'UTC'
};
const dbConfig = {};
['development', 'production'].forEach((prop) => {
dbConfig[prop] = prospect;
});
// add test database as sqlite
dbConfig.test = {
dialect: 'sqlite',
logging: false
};
module.exports = dbConfig;
| 18.346154 | 49 | 0.685535 |
d6ba900f44699ef095a2147e00024c68ca815be2 | 6,245 | js | JavaScript | www/core/components/educaper/controllers/dashboard.js | mounir1/v2beta | 16c9b9233eab29d71238b95f3c4edf9d56394d33 | [
"Apache-2.0"
] | null | null | null | www/core/components/educaper/controllers/dashboard.js | mounir1/v2beta | 16c9b9233eab29d71238b95f3c4edf9d56394d33 | [
"Apache-2.0"
] | null | null | null | www/core/components/educaper/controllers/dashboard.js | mounir1/v2beta | 16c9b9233eab29d71238b95f3c4edf9d56394d33 | [
"Apache-2.0"
] | null | null | null | // (C) Copyright 2015 Martin Dougiamas
//
// 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.
angular.module('mm.core.educaper')
/**
* Controller to handle the list of sections in App settings.
*
* @module mm.core.settings
* @ngdoc controller
* @name mmSettingsListCtrl
*/
.controller('mmDashboardCtrl', function($scope, $mmCourses, $mmSettingsDelegate) {
$scope.isIOS = ionic.Platform.isIOS();
$scope.handlers = $mmSettingsDelegate.getHandlers();
$scope.areHandlersLoaded = $mmSettingsDelegate.areHandlersLoaded;
console.log('mmCourses' + $mmCourses);
var courses = $mmCourses.currentCourses;
console.log('courses: ' + courses)
Highcharts.chart('piechart', {
chart: {
type: 'pie'
},
title: {
text: 'Browsers Usage'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
}
},
series: [{
data: [{
name: "Microsoft Internet Explorer",
y: 56.33
}, {
name: "Chrome",
y: 24.03,
sliced: true,
selected: true
}, {
name: "Firefox",
y: 10.38
}, {
name: "Safari",
y: 4.77
}, {
name: "Opera",
y: 0.91
}, {
name: "Proprietary or Undetectable",
y: 0.2
}]
}]
});
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Temperature Data'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
var ch = document.getElementById("myChart");
var myChart = new Chart(ch, {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "My First dataset",
fill: false,
lineTension: 0.1,
backgroundColor: "rgba(75,192,192,0.4)",
borderColor: "rgba(75,192,192,1)",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "rgba(75,192,192,1)",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(75,192,192,1)",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [65, 59, 80, 81, 56, 55, 40],
spanGaps: false,
}]
};
var ctx = document.getElementById("chartInstance");
var chartInstance = new Chart(ctx, {
type: 'line',
data: data,
options: {
responsive: false
}
});
var _data = {
labels: ["01-01",
"01-04",
"01-15",
"02-03",
"03-25",
"04-03",
"04-14",
"05-27",
"05-27",
"08-03"
],
datasets: [{
data: [5, 13, 23, 20, 5, 13, 23, 20, 110, 2],
label: "female",
borderColor: "rgba(197,23,1,0.8)",
backgroundColor: "rgba(197,23,1,0.4)",
hoverBackgroundColor: "rgba(197,23,1,1)",
borderWidth: 1,
pointBorderColor: "rgba(197,23,1,1)",
pointBackgroundColor: "rgba(255,255,255,0.8)",
pointBorderWidth: 1.5,
tension: -1,
yAxisID: "y-axis-1",
}, ],
};
var _options = {
scales: {
xAxes: [{
categorySpacing: 0
}],
yAxes: [{
type: "linear",
display: true,
position: "left",
id: "y-axis-1",
}]
}
};
var myBar = new Chart(document.getElementById("barChart").getContext("2d"), {
type: "bar",
data: _data,
options: _options
});
}); | 29.319249 | 98 | 0.43747 |
d6bbe729caf42b623a57d94b7bf94e904defe2c9 | 399 | js | JavaScript | app/components/ProjectItem/Inner.js | tomhank123/portfolio | 250ecd7d1bfe69b1ff2ba2d1d1816d802a67a945 | [
"MIT"
] | null | null | null | app/components/ProjectItem/Inner.js | tomhank123/portfolio | 250ecd7d1bfe69b1ff2ba2d1d1816d802a67a945 | [
"MIT"
] | null | null | null | app/components/ProjectItem/Inner.js | tomhank123/portfolio | 250ecd7d1bfe69b1ff2ba2d1d1816d802a67a945 | [
"MIT"
] | 1 | 2021-04-22T10:49:21.000Z | 2021-04-22T10:49:21.000Z | import styled from 'styled-components';
export default styled.div`
${({ theme }) => theme.mixins.boxShadow};
${({ theme }) => theme.mixins.flexBetween};
flex-direction: column;
align-items: flex-start;
position: relative;
height: 100%;
padding: 2rem 1.75rem;
border-radius: var(--border-radius);
background-color: var(--pallete-primary-light);
transition: var(--transition);
`;
| 26.6 | 49 | 0.684211 |
d6bca4affac477d8b4c21bd5b44c0c2bc192efb4 | 900 | js | JavaScript | src/three.interaction/utils/Utils.js | ahmad-moussawi/track-space-debris | 9375e252940a41322a5db4a8b4f2f50d4977bd8d | [
"MIT"
] | 1 | 2019-10-25T21:03:24.000Z | 2019-10-25T21:03:24.000Z | src/three.interaction/utils/Utils.js | ahmad-moussawi/track-space-debris | 9375e252940a41322a5db4a8b4f2f50d4977bd8d | [
"MIT"
] | 1 | 2021-09-02T03:40:23.000Z | 2021-09-02T03:40:23.000Z | src/three.interaction/utils/Utils.js | ahmad-moussawi/track-space-debris | 9375e252940a41322a5db4a8b4f2f50d4977bd8d | [
"MIT"
] | 1 | 2020-05-22T23:14:24.000Z | 2020-05-22T23:14:24.000Z | /**
* get variable type
* @param {*} val a variable which you want to get the type
* @return {String} variable-type
*/
function _rt(val) {
return Object.prototype.toString.call(val);
}
/**
* Utils tool box
*
* @namespace Utils
*/
export const Utils = {
/**
* determine whether it is a `Function`
*
* @static
* @method
* @memberof Utils
* @param {*} variable a variable which you want to determine
* @return {Boolean} type result
*/
isFunction: (function() {
const ks = _rt(function() {});
return function(variable) {
return _rt(variable) === ks;
};
})(),
/**
* determine whether it is a `undefined`
*
* @static
* @method
* @memberof Utils
* @param {*} variable a variable which you want to determine
* @return {Boolean} type result
*/
isUndefined(variable) {
return typeof variable === 'undefined';
},
};
| 19.565217 | 63 | 0.602222 |
d6bf059cd52552f4133ff1d1f2a321e50cf35ee6 | 1,578 | js | JavaScript | dist/lib/src/schemas/schema_validator.js | tqd2ax/dharma.js | f6ffaec834e2ef72eb41dd1a6991b38293f54af9 | [
"MIT"
] | null | null | null | dist/lib/src/schemas/schema_validator.js | tqd2ax/dharma.js | f6ffaec834e2ef72eb41dd1a6991b38293f54af9 | [
"MIT"
] | null | null | null | dist/lib/src/schemas/schema_validator.js | tqd2ax/dharma.js | f6ffaec834e2ef72eb41dd1a6991b38293f54af9 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsonschema_1 = require("jsonschema");
var values = require("lodash.values");
var schemas_1 = require("./schemas");
var customFormats = require("./custom_formats");
/**
* Borrowed, with slight modification, from the wonderful 0x.js project codebase:
* https://github.com/0xProject/0x.js/tree/development/packages/json-schemas
*/
var SchemaValidator = /** @class */ (function () {
function SchemaValidator() {
this._validator = new jsonschema_1.Validator();
this.addCustomValidators();
for (var _i = 0, _a = values(schemas_1.Schemas); _i < _a.length; _i++) {
var schema = _a[_i];
this._validator.addSchema(schema, schema.id);
}
}
SchemaValidator.prototype.addSchema = function (schema) {
this._validator.addSchema(schema, schema.id);
};
SchemaValidator.prototype.validate = function (instance, schema) {
return this._validator.validate(instance, schema);
};
SchemaValidator.prototype.isValid = function (instance, schema) {
var isValid = this.validate(instance, schema).errors.length === 0;
return isValid;
};
SchemaValidator.prototype.addCustomValidators = function () {
this._validator.customFormats.BigNumber = customFormats.bigNumberFormat;
this._validator.customFormats.wholeBigNumber = customFormats.wholeBigNumberFormat;
};
return SchemaValidator;
}());
exports.SchemaValidator = SchemaValidator;
//# sourceMappingURL=schema_validator.js.map | 42.648649 | 90 | 0.692649 |
d6c05c9160137375aac766e89432f1372733eaf6 | 76 | js | JavaScript | src/store/actions/requests/index.js | Imballinst/kanim-app-ui | aa8154dccaf9ba3de19e157147306edd05a4f25d | [
"MIT"
] | null | null | null | src/store/actions/requests/index.js | Imballinst/kanim-app-ui | aa8154dccaf9ba3de19e157147306edd05a4f25d | [
"MIT"
] | 9 | 2018-08-14T04:58:45.000Z | 2018-12-08T13:56:45.000Z | src/store/actions/requests/index.js | Imballinst/kanim-app-ui | aa8154dccaf9ba3de19e157147306edd05a4f25d | [
"MIT"
] | null | null | null | export * from './auth';
export * from './offices';
export * from './queue';
| 19 | 26 | 0.605263 |
d6c09bbea2f9d01c1e22e7f249a067bf6196511a | 770 | js | JavaScript | src/tools/hash.js | zbfe/zui | e7433c64df4374a3d40b4e537ec4b47d3f7d9578 | [
"MIT"
] | 5 | 2016-03-11T04:30:12.000Z | 2016-08-26T05:50:03.000Z | src/tools/hash.js | zbfe/zui | e7433c64df4374a3d40b4e537ec4b47d3f7d9578 | [
"MIT"
] | 4 | 2016-03-11T04:28:39.000Z | 2016-06-12T11:46:26.000Z | src/tools/hash.js | zbfe/zui | e7433c64df4374a3d40b4e537ec4b47d3f7d9578 | [
"MIT"
] | null | null | null | /**
* @file hash
* @author schoeu1110@gmail.com
* @module tools/hash
*/
define(function (require) {
'use strict';
var hash = {};
/**
* hash get操作
* @param {string} key 标志
* @return {string} 值
* */
hash.get = function (key) {
};
/**
* hash set操作
* @param {string} key 标志
* @param {string|object} value 值
* @param {number} time 过期时间,可选
* */
hash.set = function (key, value, time) {
};
/**
* hash 移除操作
* @param {string} key 需要移除的key值
* */
hash.remove = function (key) {
};
/**
* hash 清除操作
* */
hash.clear = function () {
};
/**
* hash 获取hash存储值长度
* */
hash.length = function () {
};
return hash;
});
| 15.098039 | 44 | 0.462338 |
d6c18204196ed473a94bca55772fc30a3faf1d0f | 3,545 | js | JavaScript | src/test/resources/sources/struts-STRUTS_2_3_31/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js | boiko/pase | dd458f8d7ea946bf2ad840c109b05173da1e39c2 | [
"MIT"
] | 4 | 2020-09-18T16:18:05.000Z | 2021-12-10T09:09:46.000Z | src/test/resources/sources/struts-STRUTS_2_3_31/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js | boiko/pase | dd458f8d7ea946bf2ad840c109b05173da1e39c2 | [
"MIT"
] | 8 | 2020-09-11T10:06:14.000Z | 2021-08-25T08:08:46.000Z | src/test/resources/sources/struts-STRUTS_2_3_31/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js | boiko/pase | dd458f8d7ea946bf2ad840c109b05173da1e39c2 | [
"MIT"
] | 3 | 2020-11-13T10:05:19.000Z | 2021-08-06T17:21:33.000Z | /*
* $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
dojo.provide("struts.widget.StrutsTabContainer");
dojo.require("dojo.widget.TabContainer");
dojo.widget.defineWidget(
"struts.widget.StrutsTabContainer",
dojo.widget.TabContainer, {
widgetType : "StrutsTabContainer",
afterSelectTabNotifyTopics : "",
afterSelectTabNotifyTopicsArray : null,
beforeSelectTabNotifyTopics : "",
beforeSelectTabNotifyTopicsArray : null,
disabledTabCssClass : "strutsDisabledTab",
postCreate : function() {
struts.widget.StrutsTabContainer.superclass.postCreate.apply(this);
//before topics
if(!dojo.string.isBlank(this.beforeSelectTabNotifyTopics)) {
this.beforeSelectTabNotifyTopicsArray = this.beforeSelectTabNotifyTopics.split(",");
}
//after topics
if(!dojo.string.isBlank(this.afterSelectTabNotifyTopics)) {
this.afterSelectTabNotifyTopicsArray = this.afterSelectTabNotifyTopics.split(",");
}
// add disabled class to disabled tabs
if(this.disabledTabCssClass) {
dojo.lang.forEach(this.children, function(div){
if(div.disabled) {
this.disableTab(div);
}
});
}
},
selectChild: function (tab, callingWidget) {
if(!tab.disabled) {
var cancel = {"cancel" : false};
if(this.beforeSelectTabNotifyTopicsArray) {
var self = this;
dojo.lang.forEach(this.beforeSelectTabNotifyTopicsArray, function(topic) {
try {
dojo.event.topic.publish(topic, cancel, tab, self);
} catch(ex){
dojo.debug(ex);
}
});
}
if(!cancel.cancel) {
struts.widget.StrutsTabContainer.superclass.selectChild.apply(this, [tab, callingWidget]);
if(this.afterSelectTabNotifyTopicsArray) {
var self = this;
dojo.lang.forEach(this.afterSelectTabNotifyTopicsArray, function(topic) {
try {
dojo.event.topic.publish(topic, tab, self);
} catch(ex){
dojo.debug(ex);
}
});
}
}
}
},
disableTab : function(t) {
var tabWidget = this.getTabWidget(t);
tabWidget.disabled = true;
dojo.html.addClass(tabWidget.controlButton.domNode, this.disabledTabCssClass);
},
enableTab : function(t) {
var tabWidget = this.getTabWidget(t);
tabWidget.disabled = false;
dojo.html.removeClass(tabWidget.controlButton.domNode, this.disabledTabCssClass);
},
getTabWidget : function(t) {
if(dojo.lang.isNumber(t)) {
//tab index
return this.children[t];
} else if(dojo.lang.isString(t)) {
//tab id
return dojo.widget.byId(t);
} else {
//tab widget?
return t;
}
}
});
| 30.042373 | 98 | 0.653879 |
d6c22eb4a5d68965b758227425db4916e36504c7 | 1,566 | js | JavaScript | node_modules/react-borealis/__tests__/borealis-redirect-test.js | UMNLibraries/react-citation-demo | fb4caa88de216c9fcce21a2655a672cb003f98c6 | [
"MIT"
] | 2 | 2017-05-11T15:15:19.000Z | 2018-07-04T11:17:53.000Z | node_modules/react-borealis/__tests__/borealis-redirect-test.js | UMNLibraries/react-citation-demo | fb4caa88de216c9fcce21a2655a672cb003f98c6 | [
"MIT"
] | 4 | 2021-03-09T04:00:28.000Z | 2021-05-07T13:13:33.000Z | __tests__/borealis-redirect-test.js | Minitex/react-borealis | 439996cbd9c1ce2a38b258d203fda9f0baebb045 | [
"BSD-4-Clause-UC"
] | null | null | null | import React from 'react';
import { shallow } from 'enzyme';
import BorealisRoute from '../src/react-borealis-route';
describe('Borealis', () => {
it('should render correctly', () => {
const config = {
pdf: {
transcript: {
texts: ['P.D.F ya\'ll'],
label: 'PDF',
},
thumbnail: 'https://cdm16022.contentdm.oclc.org/utils/getthumbnail/collection/p16022coll35/id/0',
config: {
height: 800,
},
values: [
{
src: 'http://cdm16022.contentdm.oclc.org/utils/getfile/collection/p16022coll52/id/16/filename',
thumbnail: 'http://lib-mdl-dev.oit.umn.edu/thumbnails/p16022coll52:16',
transcript: {
texts: ['1 Cecelia Boone Narrator Sara Ring Interviewer June 9, 2011 Minitex Oral History Project Minneapolis, Minnesota SR: Tell us how you got started working at Minitex. How did you end up in the job you are doing right now? CB: As always, there is a story. blah blah'],
label: 'PDF',
},
},
{
src: 'http://cdm16022.contentdm.oclc.org/utils/getfile/collection/p16022coll52/id/17/filename',
thumbnail: 'http://lib-mdl-dev.oit.umn.edu/thumbnails/p16022coll52:17',
transcript: {
texts: ['blah blah blah, second pdf here'],
label: 'PDF',
},
},
],
},
};
const component = shallow(<BorealisRoute config={config} basename="/" />);
expect(component).toMatchSnapshot();
});
});
| 37.285714 | 287 | 0.572158 |
d6c28b75ccd0809729a1795104575dcab8cd1d25 | 1,897 | js | JavaScript | icons/dist/pax/Group.js | dfds-frontend/react-components | 51e62edce56d16a63f5bf936b4c044f145c9f015 | [
"Unlicense"
] | 2 | 2019-01-07T11:13:08.000Z | 2019-01-28T12:57:29.000Z | icons/dist/pax/Group.js | dfds-frontend/react-components | 51e62edce56d16a63f5bf936b4c044f145c9f015 | [
"Unlicense"
] | null | null | null | icons/dist/pax/Group.js | dfds-frontend/react-components | 51e62edce56d16a63f5bf936b4c044f145c9f015 | [
"Unlicense"
] | null | null | null | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
import * as React from 'react';
var SvgGroup = React.forwardRef(function (props, svgRef) {
return React.createElement("svg", _extends({
width: "1em",
height: "1em",
viewBox: "0 0 32 32",
ref: svgRef
}, props), React.createElement("path", {
fill: "currentColor",
d: "M6.462 17.071a3.601 3.601 0 1 1 0-7.203 3.601 3.601 0 0 1 0 7.203zm6.381 4.584l.002.011.043.443c-1.771 1.137-3.875 1.402-6.135 1.402-2.529 0-4.864-.428-6.753-1.824l.002-.025a3.658 3.658 0 0 1 3.639-3.41l.943.002c.232 0 .406.045.522.135s.239.252.368.484l.968 1.703.968-1.703c.13-.232.251-.393.368-.484s.29-.135.523-.135l.191-.002h.713a3.65 3.65 0 0 1 3.021 1.611c.351.519.573 1.132.617 1.792zm2.958-6.453a3.6 3.6 0 1 1 0-7.201 3.6 3.6 0 0 1 0 7.201zm9.34 1.557a3.6 3.6 0 1 1 0-7.201 3.6 3.6 0 0 1 0 7.201zm6.381 4.584l.003.011.042.444c-1.77 1.137-3.875 1.401-6.135 1.401-2.529 0-4.864-.428-6.752-1.824l.002-.025a3.658 3.658 0 0 1 3.639-3.41l.943.002c.232 0 .407.045.523.135s.239.252.368.484l.968 1.703.968-1.703c.13-.232.251-.393.368-.484s.29-.135.523-.135l.191-.002h.713a3.65 3.65 0 0 1 3.021 1.611c.351.519.573 1.132.617 1.792zm-13.773-.057l-.029.3c-.532.04-1.075.057-1.629.057a17.3 17.3 0 0 1-2.325-.145 4.595 4.595 0 0 0-3.377-4.022 3.632 3.632 0 0 1 2.59-1.092l.943.002c.232 0 .407.045.523.136.116.09.239.252.367.484l.968 1.703.968-1.703c.129-.232.251-.394.367-.484.116-.091.291-.136.523-.136l.191-.002h.714c.888 0 1.702.326 2.336.86a4.589 4.589 0 0 0-3.131 4.031l-.001.012z"
}));
});
export default SvgGroup; | 118.5625 | 1,187 | 0.672114 |
d6c5d3dcefa673f0b3b9dd165abdaa4f51f3d2d1 | 5,162 | js | JavaScript | docs/js/chunk-feb801e4.d8450d4f.js | 36px/www.cgpan.cloud | ce6261d2916bac62a81ad7b3f43d6aed455ac70a | [
"MIT"
] | null | null | null | docs/js/chunk-feb801e4.d8450d4f.js | 36px/www.cgpan.cloud | ce6261d2916bac62a81ad7b3f43d6aed455ac70a | [
"MIT"
] | null | null | null | docs/js/chunk-feb801e4.d8450d4f.js | 36px/www.cgpan.cloud | ce6261d2916bac62a81ad7b3f43d6aed455ac70a | [
"MIT"
] | null | null | null | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-feb801e4"],{"280b":function(e,t,i){},"729a":function(e,t,i){},7484:function(e,t,i){"use strict";var l=i("729a"),s=i.n(l);s.a},a788:function(e,t,i){"use strict";i.r(t);var l=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"home"},[i("MainFrame",[[i("MyView")]],2)],1)},s=[],a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("h1",[e._v("云仓库")]),i("el-breadcrumb",{attrs:{separator:"/"}},[i("el-breadcrumb-item",{attrs:{to:{path:"/"}}},[e._v("首页")]),i("el-breadcrumb-item",[i("a",{attrs:{href:"/"}},[e._v("云仓库")])]),i("el-breadcrumb-item",[e._v("云仓库列表")]),i("el-breadcrumb-item",[e._v("云仓库详情")])],1),i("div",{directives:[{name:"show",rawName:"v-show",value:e.display.current==e.display.list,expression:"display.current==display.list"}]},[i("RepoNetList")],1),i("div",{directives:[{name:"show",rawName:"v-show",value:e.display.current==e.display.detail,expression:"display.current==display.detail"}]},[i("RepoNetDetail")],1)],1)},r=[],n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("h1",[e._v("云仓库 List")]),i("ul",{attrs:{id:"example-1"}},[e._l(e.items,function(t){return i("li",{key:t.id,staticClass:"item"},[i("a",{staticClass:"item-link",attrs:{href:"#"},on:{click:e.onClickItem}},[e._m(0,!0),i("div",{staticClass:"item-label"},[e._v(e._s(t.label))])])])}),i("li",{staticClass:"item-add"},[i("a",{staticClass:"item-link",attrs:{href:"#"},on:{click:e.onClickInsert}},[e._m(1),i("div",{staticClass:"item-add-label"},[e._v("新建")])])])],2),i("MyInsertDialog",{ref:"insertDialog"})],1)},o=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"item-icon"},[i("i",{staticClass:"el-icon-cloudy"})])},function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"item-add-icon"},[i("i",{staticClass:"el-icon-circle-plus-outline"})])}],c=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-dialog",{staticClass:"dialog",attrs:{title:"新建云仓库",visible:e.dialogVisible,width:"90%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[i("el-form",{ref:"form",attrs:{model:e.form,"label-width":"80px"}},[i("el-form-item",{attrs:{label:"名称"}},[i("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),i("el-form-item",{attrs:{label:"标签"}},[i("el-input",{model:{value:e.form.label,callback:function(t){e.$set(e.form,"label",t)},expression:"form.label"}})],1),i("el-form-item",{attrs:{label:"备注"}},[i("el-input",{attrs:{type:"textarea"},model:{value:e.form.description,callback:function(t){e.$set(e.form,"description",t)},expression:"form.description"}})],1)],1),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),i("el-button",{attrs:{type:"primary"},on:{click:e.onClickOK}},[e._v("确 定")])],1)],1)},m=[],d={name:"RepoNetInsertDialog",data(){return{form:{name:"",label:"",description:""},dialogVisible:!1}},computed:{},mounted(){},methods:{onClickOK(){this.doInsert()},doInsert(){var e=this,t=this.form.description,i=this.form.label,l=this.form.name,s=null,a="RepoNet",r={net:{entity:{name:l,label:i,description:t}}},n=t=>{e.onSuccess()},o=t=>{e.onError(t)};this.$store.dispatch("rest/post",{id:s,type:a,data:r,on_ok:n,on_error:o})},onSuccess(){this.dialogVisible=!1,this.$store.dispatch("RepoNet/refresh",{})},onError(e){},showDialog(){this.form.name="",this.form.label="",this.form.description="",this.dialogVisible=!0},handleClose(){}}},u=d,p=(i("c24e"),i("2877")),f=Object(p["a"])(u,c,m,!1,null,"1352ee72",null),b=f.exports,h={name:"RepoNetList",components:{MyInsertDialog:b},data(){return{items_old:[{name:"",label:"label",description:"de1"},{name:"",label:"label",description:"de2"},{name:"",label:"中文名",description:"de3"},{name:"",label:"label",description:"de4"},{name:"",label:"label",description:""},{name:"",label:"这是一个很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的名字",description:""},{name:"",label:"label",description:""},{name:"",label:"label",description:""}]}},computed:{items(){return this.$store.getters["RepoNet/list"]}},mounted(){this.refresh()},methods:{refresh(){this.$store.dispatch("RepoNet/refresh",{})},onClickItem(e){this.$alert(" click item : "+e)},onClickInsert(){this.$refs.insertDialog.showDialog()}}},v=h,_=(i("7484"),Object(p["a"])(v,n,o,!1,null,"5d410d04",null)),k=_.exports,C=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},w=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("h1",[e._v(" 云仓库 Detail ")])])}],y={name:"HomeView"},g=y,$=Object(p["a"])(g,C,w,!1,null,null,null),x=$.exports,N={name:"RepoNetView",components:{RepoNetList:k,RepoNetDetail:x},data(){return{display:{current:1,list:1,detail:2}}}},R=N,D=Object(p["a"])(R,a,r,!1,null,null,null),E=D.exports,V={name:"home",components:{MyView:E}},I=V,O=Object(p["a"])(I,l,s,!1,null,null,null);t["default"]=O.exports},c24e:function(e,t,i){"use strict";var l=i("280b"),s=i.n(l);s.a}}]);
//# sourceMappingURL=chunk-feb801e4.d8450d4f.js.map | 2,581 | 5,110 | 0.664471 |
d6c5df3c656a375fb834519791fb72b5d7755362 | 3,878 | js | JavaScript | src/store/modules/auth.js | lesterbx/task-manager | 4554cfb84e25f1a57494b667a3cd7675b3e78c65 | [
"MIT"
] | null | null | null | src/store/modules/auth.js | lesterbx/task-manager | 4554cfb84e25f1a57494b667a3cd7675b3e78c65 | [
"MIT"
] | null | null | null | src/store/modules/auth.js | lesterbx/task-manager | 4554cfb84e25f1a57494b667a3cd7675b3e78c65 | [
"MIT"
] | null | null | null | import { promisifyValidator } from '@/utils'
import { validateUser } from '@/utils/validators'
const state = {
/**
* Current user object
*/
user: null,
/**
* Boolean to tells if the current user is authenticated
*/
authenticated: false
}
const getters = {
/**
* Returns the current user object
*/
getUser: (state) => state.user,
/**
* Returns if the user is authenticated
*/
getAuthenticated: (state) => state.authenticated,
/**
* Returns the list of workspaces of the user
*/
userWorkspaces: state => state.user && state.user.workspaces
}
const mutations = {
/**
* Sets the current user object
*/
setUser: (state, user) => { state.user = user },
/**
* Sets if the current user is authenticated
*/
setAuthenticated: (state, authenticated) => { state.authenticated = authenticated }
}
const actions = {
/**
* Checks if the user has a session opened and resolves with the email if it has
*/
getSession: ({ getters }) => {
return getters.getAuthDB.getSession()
.then(({ userCtx }) => userCtx.name !== null
? Promise.resolve(userCtx.name)
: Promise.reject('Wrong session'))
.catch(() => Promise.reject('No session'))
},
/**
* Fetch the user information from the database
*/
fetchUser: ({ commit, dispatch, getters }, email) => {
return getters.getAuthDB.getUser(email)
.then(({ name, firstName, lastName, workspaces }) => {
commit('setUser', { email: name, firstName, lastName, workspaces })
dispatch('storeUser', { email: name, firstName, lastName, workspaces })
return Promise.resolve({ email: name, firstName, lastName, workspaces })
})
.catch(() => Promise.reject('No user'))
},
/**
* Creates a new user
*/
signUp: ({ dispatch, commit, getters }, { email, password, ...metadata }) => {
return dispatch('checkConnection')
.then(() => promisifyValidator(validateUser, { name: email, password, ...metadata, workspaces: [] }))
.then(() => getters.getAuthDB.signUp(email, password, { metadata: { ...metadata, workspaces: [] } }))
.then(() => dispatch('login', { email, password }))
.catch(error => (error.status === 409)
? Promise.reject('The email is already in use by some user')
: Promise.reject(error.reason))
},
/**
* Logs in a new user
*/
login: ({ commit, dispatch, getters }, { email, password }) => {
if (email === '' || password === '') {
return Promise.reject('Enter your email and password')
} else {
return dispatch('checkConnection')
.then(() => getters.getAuthDB.logIn(email, password))
.then(() => {
commit('setAuthenticated', true)
return dispatch('init')
})
.catch((error) => (error.status === 0)
? Promise.reject('No connection with the server')
: Promise.reject(error.reason))
}
},
/**
* Logs out the user, r3emoves all the local data
*/
logOut: ({ commit, getters, dispatch }) => {
dispatch('removeWorkspacesDBs')
dispatch('removeUser')
commit('setAuthenticated', false)
commit('setUser', null)
getters.getAuthDB.logOut()
},
/**
* Stores a user in the local storage
*/
storeUser: (_, user) => {
window.localStorage.setItem('task-manager-user', JSON.stringify(user))
},
/**
* Returns a user from the local storage
*/
readLocalUser: ({ commit }) => {
let localUser = JSON.parse(localStorage.getItem('task-manager-user'))
if (localUser) {
commit('setUser', localUser)
return Promise.resolve(localUser)
} else {
return Promise.reject('No local user')
}
},
/**
* Removes the user from the local storage
*/
removeUser: () => {
window.localStorage.clear()
}
}
export default {
state,
getters,
mutations,
actions
}
| 28.514706 | 107 | 0.604177 |
d6c5e0a05a8bba76cac71d8010371c828cdf5784 | 559 | js | JavaScript | Source/Plugins/Core/com.equella.core/resources/web/scripts/file/fileuploadhandler.js | rmathis/openEQUELLA | 5dda2d2343c5ba49fff7ccc625dadc1e42d93023 | [
"Apache-2.0"
] | 14 | 2019-10-09T23:59:32.000Z | 2022-03-01T08:34:56.000Z | Source/Plugins/Core/com.equella.core/resources/web/scripts/file/fileuploadhandler.js | rmathis/openEQUELLA | 5dda2d2343c5ba49fff7ccc625dadc1e42d93023 | [
"Apache-2.0"
] | 1,549 | 2019-08-16T01:07:16.000Z | 2022-03-31T23:57:34.000Z | Source/Plugins/Core/com.equella.core/resources/web/scripts/file/fileuploadhandler.js | rmathis/openEQUELLA | 5dda2d2343c5ba49fff7ccc625dadc1e42d93023 | [
"Apache-2.0"
] | 24 | 2019-09-05T00:09:35.000Z | 2021-10-19T05:10:39.000Z | var FileUploadHandler = {
setupZipProgress: function(checkCall, done) {
var intId;
intId = window.setInterval(function() {
checkCall(function(r){
if (r.finished)
{
window.clearInterval(intId);
done();
}
else {
var percent = 100 * (r.upto / r.total);
$('#zipProgress').progression({Current:percent, AnimateTimeOut : 100});
}
});
}, 500);
},
};
| 29.421053 | 91 | 0.422182 |
d6c63990aee2f714a478dd362a5e056a073f99ef | 618 | js | JavaScript | src/packer/IFB_LLLCHAR.js | iskandarsaleh/jsPOS | b07df8cfde4fcd71b4d3e8d908e994d49d9644b6 | [
"MIT"
] | 20 | 2016-01-20T03:53:31.000Z | 2021-03-02T09:01:39.000Z | src/packer/IFB_LLLCHAR.js | iskandarsaleh/jsPOS | b07df8cfde4fcd71b4d3e8d908e994d49d9644b6 | [
"MIT"
] | 12 | 2016-01-17T03:42:28.000Z | 2019-07-13T02:31:56.000Z | src/packer/IFB_LLLCHAR.js | iskandarsaleh/jsPOS | b07df8cfde4fcd71b4d3e8d908e994d49d9644b6 | [
"MIT"
] | 10 | 2016-01-15T19:42:31.000Z | 2021-06-18T10:12:52.000Z | /**
* @author Sean sean.snow@live.com
* @date 2015/12/25
*/
import ISOStringFieldPackager from './ISOStringFieldPackager';
import NullPadder from '../NullPadder';
import AsciiInterpreter from '../AsciiInterpreter';
import BcdPrefixer from '../BcdPrefixer';
class IFB_LLLCHAR extends ISOStringFieldPackager {
constructor(len:Number, description:String) {
super(len, description, NullPadder, AsciiInterpreter, BcdPrefixer.LLL);
this.checkLength(len, 999);
}
setLength(len:Number) {
this.checkLength(len, 999);
super.setLength(len);
}
}
export default IFB_LLLCHAR; | 24.72 | 79 | 0.70712 |
d6c685822b7eb6f2c11694c0078742d995d97290 | 1,056 | js | JavaScript | test/unit/app/controllers/authentication.controller/logout.js | Team-Fade/teamwork-web-applications-with-node.js | 18a1257a3b5ceec892e64cd179b89d383b818377 | [
"MIT"
] | null | null | null | test/unit/app/controllers/authentication.controller/logout.js | Team-Fade/teamwork-web-applications-with-node.js | 18a1257a3b5ceec892e64cd179b89d383b818377 | [
"MIT"
] | null | null | null | test/unit/app/controllers/authentication.controller/logout.js | Team-Fade/teamwork-web-applications-with-node.js | 18a1257a3b5ceec892e64cd179b89d383b818377 | [
"MIT"
] | null | null | null | const { expect } = require('chai');
const { init } =
require('../../../../../app/controllers/authentication.controller');
describe('Controllers tests: ', () => {
describe('Authentication controller: ', () => {
let controller;
let data;
let req = null;
let res = null;
before(() => {
data = {
users: {
},
};
const reqOptions = {
session: {
destroy() {
return Promise.resolve(res.redirect('/'));
},
},
};
controller = init(data);
req = require('../../../req-res')
.getRequestMock(reqOptions);
res = require('../../../req-res')
.getResponseMock();
});
it('expect logout() to call session.destroy and redirect to /', () => {
controller.logout(req, res);
expect(res.redirectUrl).to.be.equal('/');
});
});
});
| 25.142857 | 79 | 0.410985 |
d6c6dbed2a36f8c63eb0a4038dcc8333f27d7c4a | 8,370 | js | JavaScript | static/3d/public/lib/onEvent.js | c-array/hszh | f1167fe85422f7236d2919b111922ac425d8c449 | [
"MIT"
] | null | null | null | static/3d/public/lib/onEvent.js | c-array/hszh | f1167fe85422f7236d2919b111922ac425d8c449 | [
"MIT"
] | null | null | null | static/3d/public/lib/onEvent.js | c-array/hszh | f1167fe85422f7236d2919b111922ac425d8c449 | [
"MIT"
] | null | null | null | (function (definition) {
"use strict";
if (!Array.from) {
Array.from = (function () {
var toStr = Object.prototype.toString;
var isCallable = function (fn) {
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
};
var toInteger = function (value) {
var number = Number(value);
if (isNaN(number)) { return 0; }
if (number === 0 || !isFinite(number)) { return number; }
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function (value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
// The length property of the from method is 1.
return function from(arrayLike/*, mapFn, thisArg */) {
// 1. Let C be the this value.
var C = this;
// 2. Let items be ToObject(arrayLike).
var items = Object(arrayLike);
// 3. ReturnIfAbrupt(items).
if (arrayLike == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
// 4. If mapfn is undefined, then let mapping be false.
var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
var T;
if (typeof mapFn !== 'undefined') {
// 5. else
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
if (arguments.length > 2) {
T = arguments[2];
}
}
// 10. Let lenValue be Get(items, "length").
// 11. Let len be ToLength(lenValue).
var len = toLength(items.length);
// 13. If IsConstructor(C) is true, then
// 13. a. Let A be the result of calling the [[Construct]] internal method
// of C with an argument list containing the single item len.
// 14. a. Else, Let A be ArrayCreate(len).
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
// 16. Let k be 0.
var k = 0;
// 17. Repeat, while k < len… (also steps a - h)
var kValue;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k += 1;
}
// 18. Let putStatus be Put(A, "length", len, true).
A.length = len;
// 20. Return A.
return A;
};
}());
}
if (!THREE) {
throw new Error("This module is dependent from 'three.js,add this file first.");
}
// CommonJS
if (typeof exports === "object" && typeof module === "object") {
module.exports = definition(THREE);
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(definition);
// <script>
} else if (typeof window !== "undefined" || typeof self !== "undefined") {
// Prefer window over self for add-on scripts. Use self for
// non-windowed contexts.
var global = typeof window !== "undefined" ? window : self;
definition(THREE);
} else {
throw new Error("This environment was not anticipated by three-onEvent. Please file a bug.");
}
})(function (THREE) {
var TargetList = {
'gaze': {},
'click': {},
'hover': {}
};
var updateCallbackList = [];
var EventListeners = {},listenerList = {};
Object.keys(TargetList).forEach(function(v,i) {
EventListeners[v] = {
flag: false,
listener: function(targetList) {
listenerList[v](targetList,option.camera);
}
};
});
var option = {};
THREE.onEvent = function(scene,camera) {
option.scene = scene || {};
option.camera = camera || {};
}
THREE.onEvent.prototype.removeAll = function() {
for(var key in TargetList) {
for(var id in TargetList[key]) {
delete TargetList[key][id];
}
}
}
THREE.onEvent.prototype.update = function() {
for(var key in updateCallbackList) {
updateCallbackList[key]();
}
}
Object.assign(THREE.Object3D.prototype,{
on: function(method,callback1,callback2) {
if (EventListeners.hasOwnProperty(method)) {
TargetList[method][this.id] = {
object3d : this,
callback: Array.from(arguments).slice(1)
};
var eventlistener = EventListeners[method];
if(!eventlistener.flag){
eventlistener.flag = true;
eventlistener.listener(TargetList[method]);
}
} else {
console.warn("There is no method called '" + method + "';");
}
},
off: function(method) {
if (!!method) {
if (EventListeners.hasOwnProperty(method)) {
delete TargetList[method][this.id];
} else {
console.warn("There is no method called '" + method + "';");
}
} else {
for(var key in TargetList) {
delete TargetList[key][this.id];
}
}
}
});
function getObjList(targetList) {
var list = [];
for(var key in targetList) {
var target = targetList[key].object3d;
list.push(target);
}
return group2meshlist(list);
}
function group2meshlist(list) {
var l = [];
for (var i in list) {
if (list[i].type === 'Group') {
l = l.concat(group2meshlist(list[i].children));
} else {
l.push(list[i])
}
}
return l;
}
function getEventObj(targetList,object3d) {
return object2group(targetList,object3d);
}
function object2group(targetList,object3d) {
if(targetList[object3d.id]) {
return targetList[object3d.id];
} else {
return object2group(targetList,object3d.parent)
}
}
// WebVR object3d on gazer
listenerList.gaze = function (targetList,camera) {
var Gazing = false,targetObject,obj;
var Eye = new THREE.Raycaster();
var gazeListener = function() {
// create a gazeListener loop
if (!!targetList ) {
var list = [];
Eye.setFromCamera(new THREE.Vector2(),camera);
list = getObjList(targetList);
var intersects = Eye.intersectObjects(list);
if (intersects.length > 0) {
if(!Gazing) { //trigger once when gaze in
Gazing = true;
targetObject = intersects[0].object;
obj = getEventObj(targetList,targetObject);
if(!!obj.callback[0]) obj.callback[0](targetObject);
}
} else{
if(Gazing && !!obj.callback[1]) {
obj.callback[1](targetObject);
}
Gazing = false;
}
}
}
updateCallbackList.push(gazeListener);
}
// object3d on mouse click
listenerList.click = function (targetList,camera) {
var targetObject,obj,Click = false,Down = false;
var Mouse = new THREE.Raycaster();
function down(event) {
event.preventDefault();
if (!targetList) return;
var list = [];
Mouse.setFromCamera(new THREE.Vector2(( event.clientX / window.innerWidth ) * 2 - 1,- ( event.clientY / window.innerHeight ) * 2 + 1), camera);
list = getObjList(targetList);
var intersects = Mouse.intersectObjects(list);
if (intersects.length > 0) { // mouse down trigger
if (Click) return;
Click = true;
targetObject = intersects[0].object;
obj = getEventObj(targetList,targetObject);
} else {
Click = false;
}
}
function move(event) {
event.preventDefault();
// disable click trigger when mouse moving
if (Click) Click = false;
}
function up(event) {
event.preventDefault();
if (Click && !!obj.callback[0]) obj.callback[0](targetObject);
Click = false;
}
window.addEventListener('mousedown',down,false);
window.addEventListener('mousemove',move,false);
window.addEventListener('mouseup',up,false);
}
// object3d on mouse hover
listenerList.hover = function (targetList,camera) {
var targetObject,obj,Hover = false;
var Mouse = new THREE.Raycaster();
window.addEventListener('mousemove',function(event) {
event.preventDefault();
if (!targetList) return;
var list = [];
Mouse.setFromCamera(new THREE.Vector2(( event.clientX / window.innerWidth ) * 2 - 1,- ( event.clientY / window.innerHeight ) * 2 + 1), camera);
list = getObjList(targetList);
var intersects = Mouse.intersectObjects(list);
if (intersects.length > 0) {
if (Hover) return;
Hover = true;
targetObject = intersects[0].object;
obj = getEventObj(targetList,targetObject);
if(!!obj.callback[0]) obj.callback[0](targetObject);
} else {
if(Hover && !!obj.callback[1]) {
obj.callback[1](targetObject);
}
Hover = false;
}
}, false)
}
});
| 28.961938 | 145 | 0.623059 |
d6c9322538064c099bc90aa30b89df345ee28602 | 793 | js | JavaScript | components/molecules/HeaderNavigation/HeaderNavigation.js | gregrickaby/blog | 5693e5449ba0117a49590d030f9d97ca5e885793 | [
"MIT"
] | 1 | 2022-03-25T16:18:08.000Z | 2022-03-25T16:18:08.000Z | components/molecules/HeaderNavigation/HeaderNavigation.js | gregrickaby/blog | 5693e5449ba0117a49590d030f9d97ca5e885793 | [
"MIT"
] | 19 | 2022-02-21T20:09:25.000Z | 2022-03-28T20:09:39.000Z | components/molecules/HeaderNavigation/HeaderNavigation.js | gregrickaby/blog | 5693e5449ba0117a49590d030f9d97ca5e885793 | [
"MIT"
] | null | null | null | import config from '@/lib/config'
import Link from 'next/link'
import {Fragment} from 'react'
import styles from './HeaderNavigation.module.css'
/**
* Render Navigation component.
*
* @author Greg Rickaby
* @return {Element} The Navigation component.
*/
export default function HeaderNavigation() {
return (
<nav className={styles.headerNavigation}>
{!!config.headerNavigation?.length &&
config?.headerNavigation.map((item, index) => {
return (
<Fragment key={index}>
{' '}
{index === 0 ? '' : <>·</>}{' '}
<Link href={item?.url} prefetch={false}>
<a className={styles.link}>{item?.label}</a>
</Link>
</Fragment>
)
})}
</nav>
)
}
| 26.433333 | 60 | 0.547289 |
d6cad42f1c10eb8120e1c22ba2230f98e5cb275d | 265 | js | JavaScript | landing/next.config.js | lcwrxx/devhub | b4e7825700bbec3cf7d48298962d5ccd4ce28ca7 | [
"RSA-MD"
] | 2 | 2019-12-30T15:31:15.000Z | 2019-12-30T19:28:04.000Z | landing/next.config.js | lcwrxx/devhub | b4e7825700bbec3cf7d48298962d5ccd4ce28ca7 | [
"RSA-MD"
] | 9 | 2021-05-11T23:11:38.000Z | 2022-02-13T20:45:37.000Z | landing/next.config.js | lcwrxx/devhub | b4e7825700bbec3cf7d48298962d5ccd4ce28ca7 | [
"RSA-MD"
] | null | null | null | const withCSS = require('@zeit/next-css')
module.exports = withCSS({
env: {
STRIPE_PUBLIC_KEY:
process.env.NODE_ENV === 'production'
? 'pk_live_SRFXNC2vJzVcCNwE7fXVmCM900PLxWhQ6D'
: 'pk_test_PvG6Vvwe8z0SdsxY7fWtvAPW00X0ooU3XF',
},
})
| 24.090909 | 55 | 0.686792 |
d6cc74641578fb264e850c228a403a9e45cad270 | 96,272 | js | JavaScript | public/common/reports/dhtmlxGrid/dhtmlxGrid/grid2pdf/sample/codebase/dhtmlxgrid.js | pakistanlmis-org/vlmis-all-modules | c736ab9f108bee66c5bcb2694e93899ed8e9c9c5 | [
"MIT",
"Unlicense"
] | 1 | 2019-07-17T05:31:18.000Z | 2019-07-17T05:31:18.000Z | public/common/reports/dhtmlxGrid/dhtmlxGrid/grid2pdf/sample/codebase/dhtmlxgrid.js | pakistanlmis-org/vlmis-all-modules | c736ab9f108bee66c5bcb2694e93899ed8e9c9c5 | [
"MIT",
"Unlicense"
] | null | null | null | public/common/reports/dhtmlxGrid/dhtmlxGrid/grid2pdf/sample/codebase/dhtmlxgrid.js | pakistanlmis-org/vlmis-all-modules | c736ab9f108bee66c5bcb2694e93899ed8e9c9c5 | [
"MIT",
"Unlicense"
] | 1 | 2019-04-30T20:58:54.000Z | 2019-04-30T20:58:54.000Z | var globalActiveDHTMLGridObject;String.prototype._dhx_trim=function(){return this.replace(/ /g," ").replace(/(^[ \t]*)|([ \t]*$)/g,"")};function dhtmlxArray(A){return dhtmlXHeir((A||new Array()),dhtmlxArray._master)}dhtmlxArray._master={_dhx_find:function(B){for(var A=0;A<this.length;A++){if(B==this[A]){return A}}return -1},_dhx_insertAt:function(C,B){this[this.length]=null;for(var A=this.length-1;A>=C;A--){this[A]=this[A-1]}this[C]=B},_dhx_removeAt:function(A){this.splice(A,1)},_dhx_swapItems:function(A,C){var B=this[A];this[A]=this[C];this[C]=B}};function dhtmlXGridObject(id){if(_isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}if(id){if(typeof (id)=="object"){this.entBox=id;this.entBox.id="cgrid2_"+this.uid()}else{this.entBox=document.getElementById(id)}}else{this.entBox=document.createElement("DIV");this.entBox.id="cgrid2_"+this.uid()}this.entBox.innerHTML="";dhtmlxEventable(this);var self=this;this._wcorr=0;this.cell=null;this.row=null;this.iconURL="";this.editor=null;this._f2kE=true;this._dclE=true;this.combos=new Array(0);this.defVal=new Array(0);this.rowsAr={};this.rowsBuffer=dhtmlxArray();this.rowsCol=dhtmlxArray();this._data_cache={};this._ecache={};this._ud_enabled=true;this.xmlLoader=new dtmlXMLLoaderObject(this.doLoadDetails,this,true,this.no_cashe);this._maskArr=[];this.selectedRows=dhtmlxArray();this.UserData={};this._sizeFix=this._borderFix=0;this.entBox.className+=" gridbox";this.entBox.style.width=this.entBox.getAttribute("width")||(window.getComputedStyle?(this.entBox.style.width||window.getComputedStyle(this.entBox,null)["width"]):(this.entBox.currentStyle?this.entBox.currentStyle.width:this.entBox.style.width||0))||"100%";this.entBox.style.height=this.entBox.getAttribute("height")||(window.getComputedStyle?(this.entBox.style.height||window.getComputedStyle(this.entBox,null)["height"]):(this.entBox.currentStyle?this.entBox.currentStyle.height:this.entBox.style.height||0))||"100%";this.entBox.style.cursor="default";this.entBox.onselectstart=function(){return false};var t_creator=function(name){var t=document.createElement("TABLE");t.cellSpacing=t.cellPadding=0;t.style.cssText="width:100%;table-layout:fixed;";t.className=name.substr(2);return t};this.obj=t_creator("c_obj");this.hdr=t_creator("c_hdr");this.hdr.style.marginRight="20px";this.hdr.style.paddingRight="20px";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.overflow="auto";this.objBox.appendChild(this.obj);this.objBox.className="objbox";this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%";this.hdrBox.style.height="25px";this.hdrBox.style.overflow="hidden";this.hdrBox.className="xhdr";this.preloadImagesAr=new Array(0);this.sortImg=document.createElement("IMG");this.sortImg.style.display="none";this.hdrBox.appendChild(this.sortImg);this.hdrBox.appendChild(this.hdr);this.hdrBox.style.position="relative";this.entBox.appendChild(this.hdrBox);this.entBox.appendChild(this.objBox);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=[];this.cellWidthPC=[];this.cellWidthType=this.entBox.cellwidthtype||"px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=[];this.columnIds=[];this.columnColor=[];this._hrrar=[];this.cellType=dhtmlxArray();this.cellAlign=[];this.initCellWidth=[];this.fldSort=[];this._srdh=(_isIE&&(document.compatMode!="BackCompat")?24:20);this.imgURL=window.dhx_globalImgPath||"";this.isActive=false;this.isEditable=true;this.useImagesInHeader=false;this.pagingOn=false;this.rowsBufferOutSize=0;dhtmlxEvent(window,"unload",function(){try{if(self.destructor){self.destructor()}}catch(e){}});this.setSkin=function(name){this.skin_name=name;this.entBox.className="gridbox gridbox_"+name;this.skin_h_correction=0;this.enableAlterCss("ev_"+name,"odd_"+name,this.isTreeGrid());this._fixAlterCss();switch(name){case"clear":this._topMb=document.createElement("DIV");this._topMb.className="topMumba";this._topMb.innerHTML="<img style='left:0px' src='"+this.imgURL+"skinC_top_left.gif'><img style='right:20px' src='"+this.imgURL+"skinC_top_right.gif'>";this.entBox.appendChild(this._topMb);this._botMb=document.createElement("DIV");this._botMb.className="bottomMumba";this._botMb.innerHTML="<img style='left:0px' src='"+this.imgURL+"skinD_bottom_left.gif'><img style='right:20px' src='"+this.imgURL+"skinD_bottom_right.gif'>";this.entBox.appendChild(this._botMb);this.entBox.style.position="relative";this.skin_h_correction=20;break;case"dhx_skyblue":case"glassy_blue":case"dhx_black":case"dhx_blue":case"modern":case"light":this._srdh=20;this.forceDivInHeader=true;break;case"xp":this.forceDivInHeader=true;if((_isIE)&&(document.compatMode!="BackCompat")){this._srdh=25}else{this._srdh=22}break;case"mt":if((_isIE)&&(document.compatMode!="BackCompat")){this._srdh=25}else{this._srdh=22}break;case"gray":if((_isIE)&&(document.compatMode!="BackCompat")){this._srdh=22}break;case"sbdark":break}if(_isIE&&this.hdr){var d=this.hdr.parentNode;d.removeChild(this.hdr);d.appendChild(this.hdr)}this.setSizes()};if(_isIE){this.preventIECaching(true)}if(window.dhtmlDragAndDropObject){this.dragger=new dhtmlDragAndDropObject()}this._doOnScroll=function(e,mode){this.callEvent("onScroll",[this.objBox.scrollLeft,this.objBox.scrollTop]);this.doOnScroll(e,mode)};this.doOnScroll=function(e,mode){this.hdrBox.scrollLeft=this.objBox.scrollLeft;if(this.ftr){this.ftr.parentNode.scrollLeft=this.objBox.scrollLeft}if(mode){return }if(this._srnd){if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}this._dLoadTimer=window.setTimeout(function(){self._update_srnd_view()},100)}};this.attachToObject=function(obj){obj.appendChild(this.globalBox?this.globalBox:this.entBox);this.setSizes()};this.init=function(fl){if((this.isTreeGrid())&&(!this._h2)){this._h2=new dhtmlxHierarchy();if((this._fake)&&(!this._realfake)){this._fake._h2=this._h2}this._tgc={imgURL:null}}if(!this._hstyles){return }this.editStop();this.lastClicked=null;this.resized=null;this.fldSorted=this.r_fldSorted=null;this.cellWidthPX=[];this.cellWidthPC=[];if(this.hdr.rows.length>0){this.clearAll(true)}var hdrRow=this.hdr.insertRow(0);for(var i=0;i<this.hdrLabels.length;i++){hdrRow.appendChild(document.createElement("TH"));hdrRow.childNodes[i]._cellIndex=i;hdrRow.childNodes[i].style.height="0px"}if(_isIE&&_isIE<8){hdrRow.style.position="absolute"}else{hdrRow.style.height="auto"}var hdrRow=this.hdr.insertRow(_isKHTML?2:1);hdrRow._childIndexes=new Array();var col_ex=0;for(var i=0;i<this.hdrLabels.length;i++){hdrRow._childIndexes[i]=i-col_ex;if((this.hdrLabels[i]==this.splitSign)&&(i!=0)){if(_isKHTML){hdrRow.insertCell(i-col_ex)}hdrRow.cells[i-col_ex-1].colSpan=(hdrRow.cells[i-col_ex-1].colSpan||1)+1;hdrRow.childNodes[i-col_ex-1]._cellIndex++;col_ex++;hdrRow._childIndexes[i]=i-col_ex;continue}hdrRow.insertCell(i-col_ex);hdrRow.childNodes[i-col_ex]._cellIndex=i;hdrRow.childNodes[i-col_ex]._cellIndexS=i;this.setColumnLabel(i,this.hdrLabels[i])}if(col_ex==0){hdrRow._childIndexes=null}this._cCount=this.hdrLabels.length;if(_isIE){window.setTimeout(function(){self.setSizes()},1)}if(!this.obj.firstChild){this.obj.appendChild(document.createElement("TBODY"))}var tar=this.obj.firstChild;if(!tar.firstChild){tar.appendChild(document.createElement("TR"));tar=tar.firstChild;if(_isIE&&_isIE<8){tar.style.position="absolute"}else{tar.style.height="auto"}for(var i=0;i<this.hdrLabels.length;i++){tar.appendChild(document.createElement("TH"));tar.childNodes[i].style.height="0px"}}this._c_order=null;if(this.multiLine!=true){this.obj.className+=" row20px"}this.sortImg.style.position="absolute";this.sortImg.style.display="none";this.sortImg.src=this.imgURL+"sort_desc.gif";this.sortImg.defLeft=0;if(this.noHeader){this.hdrBox.style.display="none"}else{this.noHeader=false}if(this._ivizcol){this.setColHidden()}this.attachHeader();this.attachHeader(0,0,"_aFoot");this.setSizes();if(fl){this.parseXML()}this.obj.scrollTop=0;if(this.dragAndDropOff){this.dragger.addDragLanding(this.entBox,this)}if(this._initDrF){this._initD()}if(this._init_point){this._init_point()}};this.setColumnSizes=function(gridWidth){var summ=0;var fcols=[];for(var i=0;i<this._cCount;i++){if((this.initCellWidth[i]=="*")&&!this._hrrar[i]){this._awdth=false;fcols.push(i);continue}if(this.cellWidthType=="%"){if(typeof this.cellWidthPC[i]=="undefined"){this.cellWidthPC[i]=this.initCellWidth[i]}this.cellWidthPX[i]=Math.floor(gridWidth*this.cellWidthPC[i]/100)||0}else{if(typeof this.cellWidthPX[i]=="undefined"){this.cellWidthPX[i]=this.initCellWidth[i]}}if(!this._hrrar[i]){summ+=this.cellWidthPX[i]*1}}if(fcols.length){var ms=Math.floor((gridWidth-summ)/fcols.length);if(ms<0){ms=1}for(var i=0;i<fcols.length;i++){var next=Math.max((this._drsclmW?this._drsclmW[fcols[i]]:0),ms);this.cellWidthPX[fcols[i]]=next;summ+=next}if(gridWidth>summ){var last=fcols[fcols.length-1];this.cellWidthPX[last]=this.cellWidthPX[last]+(gridWidth-summ);summ=gridWidth}this._setAutoResize()}this.obj.style.width=summ+"px";this.hdr.style.width=summ+"px";if(this.ftr){this.ftr.style.width=summ+"px"}this.chngCellWidth();return summ};this.setSizes=function(){if((!this.hdr.rows[0])){return }window.clearTimeout(this._sizeTime);if(!this.entBox.offsetWidth&&(!this.globalBox||!this.globalBox.offsetWidth)){this._sizeTime=window.setTimeout(function(){self.setSizes()},250);return }var quirks=this.quirks=(_isIE&&document.compatMode=="BackCompat");var outerBorder=(this.entBox.offsetWidth-this.entBox.clientWidth)/2;if(this.globalBox){var splitOuterBorder=(this.globalBox.offsetWidth-this.globalBox.clientWidth)/2;if(this._delta_x&&!this._realfake){var ow=this.globalBox.clientWidth;this.globalBox.style.width=this._delta_x;this.entBox.style.width=Math.max(0,(this.globalBox.clientWidth+(quirks?splitOuterBorder*2:0))-this._fake.entBox.clientWidth)+"px";if(ow!=this.globalBox.clientWidth){this._fake._correctSplit(this._fake.entBox.clientWidth)}}if(this._delta_y&&!this._realfake){this.globalBox.style.height=this._delta_y;this.entBox.style.overflow=this._fake.entBox.style.overflow="hidden";this.entBox.style.height=this._fake.entBox.style.height=this.globalBox.clientHeight+(quirks?splitOuterBorder*2:0)+"px"}}else{if(this._delta_x){if(this.entBox.parentNode.tagName=="TD"){this.entBox.style.width="1px";this.entBox.style.width=parseInt(this._delta_x)*this.entBox.parentNode.clientWidth/100-outerBorder*2+"px"}else{this.entBox.style.width=this._delta_x}}if(this._delta_y){this.entBox.style.height=this._delta_y}}var isVScroll=this.parentGrid?false:(this.objBox.scrollHeight>this.objBox.offsetHeight);var scrfix=_isFF?18:18;var gridWidth=this.entBox.clientWidth-(this.skin_h_correction||0)*(quirks?0:1);var gridWidthActive=this.entBox.clientWidth-(this.skin_h_correction||0);var gridHeight=this.entBox.clientHeight;var summ=this.setColumnSizes(gridWidthActive-(isVScroll?scrfix:0));var isHScroll=this.parentGrid?false:((this.objBox.scrollWidth>this.objBox.offsetWidth)||(this.objBox.style.overflowX=="scroll"));var headerHeight=this.hdr.clientHeight;var footerHeight=this.ftr?this.ftr.clientHeight:0;var newWidth=gridWidth;var newHeight=gridHeight-headerHeight-footerHeight;if(this._awdth&&this._awdth[0]&&this._awdth[1]==99999){isHScroll=0}if(this._ahgr){if(this._ahgrMA){newHeight=this.entBox.parentNode.clientHeight-headerHeight-footerHeight}else{newHeight=this.obj.offsetHeight+(isHScroll?scrfix:0)}if(this._ahgrM){if(this._ahgrF){newHeight=Math.min(this._ahgrM,newHeight+headerHeight+footerHeight)-headerHeight-footerHeight}else{newHeight=Math.min(this._ahgrM,newHeight)}}if(isVScroll&&newHeight>=this.obj.scrollHeight+(isHScroll?scrfix:0)){isVScroll=false;this.setColumnSizes(gridWidthActive)}}if((this._awdth)&&(this._awdth[0])){if(this.cellWidthType=="%"){this.cellWidthType="px"}if(this._fake){summ+=this._fake.entBox.clientWidth}var newWidth=Math.min(Math.max(summ+(isVScroll?scrfix:0),this._awdth[2]),this._awdth[1]);if(this._fake){newWidth-=this._fake.entBox.clientWidth}}newHeight=Math.max(0,newHeight);this._ff_size_delta=(this._ff_size_delta==0.1)?0.2:0.1;if(!_isFF){this._ff_size_delta=0}this.entBox.style.width=newWidth+(quirks?2:0)*outerBorder+this._ff_size_delta+"px";this.entBox.style.height=newHeight+(quirks?2:0)*outerBorder+headerHeight+footerHeight+"px";this.objBox.style.height=newHeight+((quirks&&!isVScroll)?2:0)*outerBorder+"px";this.hdrBox.style.height=headerHeight+"px";if(newHeight!=gridHeight){this.doOnScroll(0,!this._srnd)}var ext=this["setSizes_"+this.skin_name];if(ext){ext.call(this)}this.setSortImgPos();if(headerHeight!=this.hdr.clientHeight&&this._ahgr){this.setSizes()}};this.setSizes_clear=function(){var y=this.hdr.offsetHeight;var x=this.entBox.offsetWidth;var y2=y+this.objBox.offsetHeight;this._topMb.style.top=(y||0)+"px";this._topMb.style.width=(x+20)+"px";this._botMb.style.top=(y2-3)+"px";this._botMb.style.width=(x+20)+"px"};this.chngCellWidth=function(){if((_isOpera)&&(this.ftr)){this.ftr.width=this.objBox.scrollWidth+"px"}var l=this._cCount;for(var i=0;i<l;i++){this.hdr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px";this.obj.rows[0].childNodes[i].style.width=this.cellWidthPX[i]+"px";if(this.ftr){this.ftr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px"}}};this.setDelimiter=function(delim){this.delim=delim};this.setInitWidthsP=function(wp){this.cellWidthType="%";this.initCellWidth=wp.split(this.delim.replace(/px/gi,""));if(!arguments[1]){this._setAutoResize()}};this._setAutoResize=function(){if(this._realfake){return }var el=window;var self=this;dhtmlxEvent(window,"resize",function(){window.clearTimeout(self._resize_timer);if(self._setAutoResize){self._resize_timer=window.setTimeout(function(){self.setSizes();if(self._fake){self._fake._correctSplit()}},100)}})};this.setInitWidths=function(wp){this.cellWidthType="px";this.initCellWidth=wp.split(this.delim);if(_isFF){for(var i=0;i<this.initCellWidth.length;i++){if(this.initCellWidth[i]!="*"){this.initCellWidth[i]=parseInt(this.initCellWidth[i])}}}};this.enableMultiline=function(state){this.multiLine=convertStringToBoolean(state)};this.enableMultiselect=function(state){this.selMultiRows=convertStringToBoolean(state)};this.setImagePath=function(path){this.imgURL=path};this.setImagesPath=this.setImagePath;this.setIconPath=function(path){this.iconURL=path};this.setIconsPath=this.setIconPath;this.changeCursorState=function(ev){var el=ev.target||ev.srcElement;if(el.tagName!="TD"){el=this.getFirstParentOfType(el,"TD")}if(!el){return }if((el.tagName=="TD")&&(this._drsclmn)&&(!this._drsclmn[el._cellIndex])){return el.style.cursor="default"}var check=(ev.layerX||0)+(((!_isIE)&&(ev.target.tagName=="DIV"))?el.offsetLeft:0);if((el.offsetWidth-(ev.offsetX||(parseInt(this.getPosition(el,this.hdrBox))-check)*-1))<(_isOpera?20:10)){el.style.cursor="E-resize"}else{el.style.cursor="default"}if(_isOpera){this.hdrBox.scrollLeft=this.objBox.scrollLeft}};this.startColResize=function(ev){if(this.resized){this.stopColResize()}this.resized=null;var el=ev.target||ev.srcElement;if(el.tagName!="TD"){el=this.getFirstParentOfType(el,"TD")}var x=ev.clientX;var tabW=this.hdr.offsetWidth;var startW=parseInt(el.offsetWidth);if(el.tagName=="TD"&&el.style.cursor!="default"){if((this._drsclmn)&&(!this._drsclmn[el._cellIndex])){return }self._old_d_mm=document.body.onmousemove;self._old_d_mu=document.body.onmouseup;document.body.onmousemove=function(e){if(self){self.doColResize(e||window.event,el,startW,x,tabW)}};document.body.onmouseup=function(){if(self){self.stopColResize()}}}};this.stopColResize=function(){document.body.onmousemove=self._old_d_mm||"";document.body.onmouseup=self._old_d_mu||"";this.setSizes();this.doOnScroll(0,1);this.callEvent("onResizeEnd",[this])};this.doColResize=function(ev,el,startW,x,tabW){el.style.cursor="E-resize";this.resized=el;var fcolW=startW+(ev.clientX-x);var wtabW=tabW+(ev.clientX-x);if(!(this.callEvent("onResize",[el._cellIndex,fcolW,this]))){return }if(_isIE){this.objBox.scrollLeft=this.hdrBox.scrollLeft}if(el.colSpan>1){var a_sizes=new Array();for(var i=0;i<el.colSpan;i++){a_sizes[i]=Math.round(fcolW*this.hdr.rows[0].childNodes[el._cellIndexS+i].offsetWidth/el.offsetWidth)}for(var i=0;i<el.colSpan;i++){this._setColumnSizeR(el._cellIndexS+i*1,a_sizes[i])}}else{this._setColumnSizeR(el._cellIndex,fcolW)}this.doOnScroll(0,1);this.setSizes();if(this._fake&&this._awdth){this._fake._correctSplit()}};this._setColumnSizeR=function(ind,fcolW){if(fcolW>((this._drsclmW&&!this._notresize)?(this._drsclmW[ind]||10):10)){this.obj.rows[0].childNodes[ind].style.width=fcolW+"px";this.hdr.rows[0].childNodes[ind].style.width=fcolW+"px";if(this.ftr){this.ftr.rows[0].childNodes[ind].style.width=fcolW+"px"}if(this.cellWidthType=="px"){this.cellWidthPX[ind]=fcolW}else{var gridWidth=parseInt(this.entBox.offsetWidth);if(this.objBox.scrollHeight>this.objBox.offsetHeight){gridWidth-=17}var pcWidth=Math.round(fcolW/gridWidth*100);this.cellWidthPC[ind]=pcWidth}if(this.sortImg.style.display!="none"){this.setSortImgPos()}}};this.setSortImgState=function(state,ind,order,row){order=(order||"asc").toLowerCase();if(!convertStringToBoolean(state)){this.sortImg.style.display="none";this.fldSorted=null;return }if(order=="asc"){this.sortImg.src=this.imgURL+"sort_asc.gif"}else{this.sortImg.src=this.imgURL+"sort_desc.gif"}this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].childNodes[ind];var r=this.hdr.rows[row||1];if(!r){return }for(var i=0;i<r.childNodes.length;i++){if(r.childNodes[i]._cellIndexS==ind){this.r_fldSorted=r.childNodes[i];return this.setSortImgPos()}}return this.setSortImgState(state,ind,order,(row||1)+1)};this.setSortImgPos=function(ind,mode,hRowInd,el){if(this._hrrar&&this._hrrar[this.r_fldSorted?this.r_fldSorted._cellIndex:ind]){return }if(!el){if(!ind){var el=this.r_fldSorted}else{var el=this.hdr.rows[hRowInd||0].cells[ind]}}if(el!=null){var pos=this.getPosition(el,this.hdrBox);var wdth=el.offsetWidth;this.sortImg.style.left=Number(pos[0]+wdth-13)+"px";this.sortImg.defLeft=parseInt(this.sortImg.style.left);this.sortImg.style.top=Number(pos[1]+5)+"px";if((!this.useImagesInHeader)&&(!mode)){this.sortImg.style.display="inline"}this.sortImg.style.left=this.sortImg.defLeft+"px"}};this.setActive=function(fl){if(arguments.length==0){var fl=true}if(fl==true){if(globalActiveDHTMLGridObject&&(globalActiveDHTMLGridObject!=this)){globalActiveDHTMLGridObject.editStop()}globalActiveDHTMLGridObject=this;this.isActive=true}else{this.isActive=false}};this._doClick=function(ev){var selMethod=0;var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(!el){return }var fl=true;if(this.markedCells){var markMethod=0;if(ev.shiftKey||ev.metaKey){markMethod=1}if(ev.ctrlKey){markMethod=2}this.doMark(el,markMethod);return true}if(this.selMultiRows!=false){if(ev.shiftKey&&this.row!=null){selMethod=1}if(ev.ctrlKey||ev.metaKey){selMethod=2}}this.doClick(el,fl,selMethod)};this._doContClick=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if((!el)||(typeof (el.parentNode.idd)=="undefined")){return true}if(ev.button==2||(_isMacOS&&ev.ctrlKey)){if(!this.callEvent("onRightClick",[el.parentNode.idd,el._cellIndex,ev])){var z=function(e){(e||event).cancelBubble=true;return false};(ev.srcElement||ev.target).oncontextmenu=z;return z(ev)}if(this._ctmndx){if(!(this.callEvent("onBeforeContextMenu",[el.parentNode.idd,el._cellIndex,this]))){return true}if(_isIE){ev.srcElement.oncontextmenu=function(){event.cancelBubble=true;return false}}if(this._ctmndx.showContextMenu){var dEl0=window.document.documentElement;var dEl1=window.document.body;var corrector=new Array((dEl0.scrollLeft||dEl1.scrollLeft),(dEl0.scrollTop||dEl1.scrollTop));if(_isIE){var x=ev.clientX+corrector[0];var y=ev.clientY+corrector[1]}else{var x=ev.pageX;var y=ev.pageY}this._ctmndx.showContextMenu(x-1,y-1);this.contextID=this._ctmndx.contextMenuZoneId=el.parentNode.idd+"_"+el._cellIndex;this._ctmndx._skip_hide=true}else{el.contextMenuId=el.parentNode.idd+"_"+el._cellIndex;el.contextMenu=this._ctmndx;el.a=this._ctmndx._contextStart;el.a(el,ev);el.a=null}ev.cancelBubble=true;return false}}else{if(this._ctmndx){if(this._ctmndx.hideContextMenu){this._ctmndx.hideContextMenu()}else{this._ctmndx._contextEnd()}}}return true};this.doClick=function(el,fl,selMethod,show){if(!this.selMultiRows){selMethod=0}var psid=this.row?this.row.idd:0;this.setActive(true);if(!selMethod){selMethod=0}if(this.cell!=null){this.cell.className=this.cell.className.replace(/cellselected/g,"")}if(el.tagName=="TD"){if(this.checkEvent("onSelectStateChanged")){var initial=this.getSelectedId()}var prow=this.row;if(selMethod==1){var elRowIndex=this.rowsCol._dhx_find(el.parentNode);var lcRowIndex=this.rowsCol._dhx_find(this.lastClicked);if(elRowIndex>lcRowIndex){var strt=lcRowIndex;var end=elRowIndex}else{var strt=elRowIndex;var end=lcRowIndex}for(var i=0;i<this.rowsCol.length;i++){if((i>=strt&&i<=end)){if(this.rowsCol[i]&&(!this.rowsCol[i]._sRow)){if(this.rowsCol[i].className.indexOf("rowselected")==-1&&this.callEvent("onBeforeSelect",[this.rowsCol[i].idd,psid])){this.rowsCol[i].className+=" rowselected";this.selectedRows[this.selectedRows.length]=this.rowsCol[i]}}else{this.clearSelection();return this.doClick(el,fl,0,show)}}}}else{if(selMethod==2){if(el.parentNode.className.indexOf("rowselected")!=-1){el.parentNode.className=el.parentNode.className.replace(/rowselected/g,"");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode));var skipRowSelection=true}}}this.editStop();if(typeof (el.parentNode.idd)=="undefined"){return true}if((!skipRowSelection)&&(!el.parentNode._sRow)){if(this.callEvent("onBeforeSelect",[el.parentNode.idd,psid])){if(selMethod==0){this.clearSelection()}this.cell=el;if((prow==el.parentNode)&&(this._chRRS)){fl=false}this.row=el.parentNode;this.row.className+=" rowselected";if(this.cell&&_isIE&&_isIE==8){var next=this.cell.nextSibling;var parent=this.cell.parentNode;parent.removeChild(this.cell);parent.insertBefore(this.cell,next)}if(this.selectedRows._dhx_find(this.row)==-1){this.selectedRows[this.selectedRows.length]=this.row}}else{fl=false}}if(this.cell&&this.cell.parentNode.className.indexOf("rowselected")!=-1){this.cell.className=this.cell.className.replace(/cellselected/g,"")+" cellselected"}if(selMethod!=1){if(!this.row){return }}this.lastClicked=el.parentNode;var rid=this.row.idd;var cid=this.cell;if(fl&&typeof (rid)!="undefined"&&cid&&!skipRowSelection){self.onRowSelectTime=setTimeout(function(){self.callEvent("onRowSelect",[rid,cid._cellIndex])},100)}if(this.checkEvent("onSelectStateChanged")){var afinal=this.getSelectedId();if(initial!=afinal){this.callEvent("onSelectStateChanged",[afinal,initial])}}}this.isActive=true;if(show!==false&&this.cell&&this.cell.parentNode.idd){this.moveToVisible(this.cell)}};this.selectAll=function(){this.clearSelection();var coll=this.rowsBuffer;if(this.pagingOn){coll=this.rowsCol}for(var i=0;i<coll.length;i++){this.render_row(i).className+=" rowselected"}this.selectedRows=dhtmlxArray([].concat(coll));if(this.selectedRows.length){this.row=this.selectedRows[0];this.cell=this.row.cells[0]}if((this._fake)&&(!this._realfake)){this._fake.selectAll()}};this.selectCell=function(r,cInd,fl,preserve,edit,show){if(!fl){fl=false}if(typeof (r)!="object"){r=this.render_row(r)}if(!r||r==-1){return null}if(r._childIndexes){var c=r.childNodes[r._childIndexes[cInd]]}else{var c=r.childNodes[cInd]}if(!c){c=r.childNodes[0]}if(preserve){this.doClick(c,fl,3,show)}else{this.doClick(c,fl,0,show)}if(edit){this.editCell()}};this.moveToVisible=function(cell_obj,onlyVScroll){if(this.pagingOn){var newPage=Math.floor(this.getRowIndex(cell_obj.parentNode.idd)/this.rowsBufferOutSize)+1;if(newPage!=this.currentPage){this.changePage(newPage)}}if(!cell_obj.offsetHeight&&this._srnd){var mask=this._realfake?this._fake.rowsAr[cell_obj.parentNode.idd]:cell_obj.parentNode;var h=this.rowsBuffer._dhx_find(mask)*this._srdh;return this.objBox.scrollTop=h}try{var distance=cell_obj.offsetLeft+cell_obj.offsetWidth+20;var scrollLeft=0;if(distance>(this.objBox.offsetWidth+this.objBox.scrollLeft)){if(cell_obj.offsetLeft>this.objBox.scrollLeft){scrollLeft=cell_obj.offsetLeft-5}}else{if(cell_obj.offsetLeft<this.objBox.scrollLeft){distance-=cell_obj.offsetWidth*2/3;if(distance<this.objBox.scrollLeft){scrollLeft=cell_obj.offsetLeft-5}}}if((scrollLeft)&&(!onlyVScroll)){this.objBox.scrollLeft=scrollLeft}var distance=cell_obj.offsetTop+cell_obj.offsetHeight+20;if(distance>(this.objBox.offsetHeight+this.objBox.scrollTop)){var scrollTop=distance-this.objBox.offsetHeight}else{if(cell_obj.offsetTop<this.objBox.scrollTop){var scrollTop=cell_obj.offsetTop-5}}if(scrollTop){this.objBox.scrollTop=scrollTop}}catch(er){}};this.editCell=function(){if(this.editor&&this.cell==this.editor.cell){return }this.editStop();if((this.isEditable!=true)||(!this.cell)){return false}var c=this.cell;if(c.parentNode._locked){return false}this.editor=this.cells4(c);if(this.editor!=null){if(this.editor.isDisabled()){this.editor=null;return false}if(this.callEvent("onEditCell",[0,this.row.idd,this.cell._cellIndex])!=false&&this.editor.edit){this._Opera_stop=(new Date).valueOf();c.className+=" editable";this.editor.edit();this.callEvent("onEditCell",[1,this.row.idd,this.cell._cellIndex])}else{this.editor=null}}};this.editStop=function(mode){if(_isOpera){if(this._Opera_stop){if((this._Opera_stop*1+50)>(new Date).valueOf()){return }this._Opera_stop=null}}if(this.editor&&this.editor!=null){this.editor.cell.className=this.editor.cell.className.replace("editable","");if(mode){var t=this.editor.val;this.editor.detach();this.editor.setValue(t);this.editor=null;return }if(this.editor.detach()){this.cell.wasChanged=true}var g=this.editor;this.editor=null;var z=this.callEvent("onEditCell",[2,this.row.idd,this.cell._cellIndex,g.getValue(),g.val]);if((typeof (z)=="string")||(typeof (z)=="number")){g[g.setImage?"setLabel":"setValue"](z)}else{if(!z){g[g.setImage?"setLabel":"setValue"](g.val)}}}};this._nextRowCell=function(row,dir,pos){row=this._nextRow((this._groups?this.rowsCol:this.rowsBuffer)._dhx_find(row),dir);if(!row){return null}return row.childNodes[row._childIndexes?row._childIndexes[pos]:pos]};this._getNextCell=function(acell,dir,i){acell=acell||this.cell;var arow=acell.parentNode;if(this._tabOrder){i=this._tabOrder[acell._cellIndex];if(typeof i!="undefined"){if(i<0){acell=this._nextRowCell(arow,dir,Math.abs(i)-1)}else{acell=arow.childNodes[i]}}}else{var i=acell._cellIndex+dir;if(i>=0&&i<this._cCount){if(arow._childIndexes){i=arow._childIndexes[acell._cellIndex]+dir}acell=arow.childNodes[i]}else{acell=this._nextRowCell(arow,dir,(dir==1?0:(this._cCount-1)))}}if(!acell){if((dir==1)&&this.tabEnd){this.tabEnd.focus();this.tabEnd.focus();this.setActive(false)}if((dir==-1)&&this.tabStart){this.tabStart.focus();this.tabStart.focus();this.setActive(false)}return null}if(acell.style.display!="none"&&(!this.smartTabOrder||!this.cells(acell.parentNode.idd,acell._cellIndex).isDisabled())){return acell}return this._getNextCell(acell,dir)};this._nextRow=function(ind,dir){var r=this.render_row(ind+dir);if(!r||r==-1){return null}if(r&&r.style.display=="none"){return this._nextRow(ind+dir,dir)}return r};this.scrollPage=function(dir){if(!this.rowsBuffer.length){return }var master=this._realfake?this._fake:this;var new_ind=Math.floor((master._r_select||this.getRowIndex(this.row.idd)||0)+(dir)*this.objBox.offsetHeight/(this._srdh||20));if(new_ind<0){new_ind=0}if(new_ind>=this.rowsBuffer.length){new_ind=this.rowsBuffer.length-1}if(this._srnd&&!this.rowsBuffer[new_ind]){this.objBox.scrollTop+=Math.floor((dir)*this.objBox.offsetHeight/(this._srdh||20))*(this._srdh||20);master._r_select=new_ind}else{this.selectCell(new_ind,this.cell._cellIndex,true,false,false,(this.multiLine||this._srnd));if(!this.multiLine&&!this._srnd&&!this._realfake){this.objBox.scrollTop=this.getRowById(this.getRowId(new_ind)).offsetTop}master._r_select=null}};this.doKey=function(ev){if(!ev){return true}if((ev.target||ev.srcElement).value!==window.undefined){var zx=(ev.target||ev.srcElement);if((!zx.parentNode)||(zx.parentNode.className.indexOf("editable")==-1)){return true}}if((globalActiveDHTMLGridObject)&&(this!=globalActiveDHTMLGridObject)){return globalActiveDHTMLGridObject.doKey(ev)}if(this.isActive==false){return true}if(this._htkebl){return true}if(!this.callEvent("onKeyPress",[ev.keyCode,ev.ctrlKey,ev.shiftKey,ev])){return false}var code="k"+ev.keyCode+"_"+(ev.ctrlKey?1:0)+"_"+(ev.shiftKey?1:0);if(this.cell){if(this._key_events[code]){if(false===this._key_events[code].call(this)){return true}if(ev.preventDefault){ev.preventDefault()}ev.cancelBubble=true;return false}if(this._key_events.k_other){this._key_events.k_other.call(this,ev)}}return true};this.selectRow=function(r,fl,preserve,show){if(typeof (r)!="object"){r=this.render_row(r)}this.selectCell(r,0,fl,preserve,false,show)};this.wasDblClicked=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(el){var rowId=el.parentNode.idd;return this.callEvent("onRowDblClicked",[rowId,el._cellIndex])}};this._onHeaderClick=function(e,el){var that=this.grid;el=el||that.getFirstParentOfType(_isIE?event.srcElement:e.target,"TD");if(this.grid.resized==null){if(!(this.grid.callEvent("onHeaderClick",[el._cellIndexS,(e||window.event)]))){return false}that.sortField(el._cellIndexS,false,el)}};this.deleteSelectedRows=function(){var num=this.selectedRows.length;if(num==0){return }var tmpAr=this.selectedRows;this.selectedRows=dhtmlxArray();for(var i=num-1;i>=0;i--){var node=tmpAr[i];if(!this.deleteRow(node.idd,node)){this.selectedRows[this.selectedRows.length]=node}else{if(node==this.row){var ind=i}}}if(ind){try{if(ind+1>this.rowsCol.length){ind--}this.selectCell(ind,0,true)}catch(er){this.row=null;this.cell=null}}};this.getSelectedRowId=function(){var selAr=new Array(0);var uni={};for(var i=0;i<this.selectedRows.length;i++){var id=this.selectedRows[i].idd;if(uni[id]){continue}selAr[selAr.length]=id;uni[id]=true}if(selAr.length==0){return null}else{return selAr.join(this.delim)}};this.getSelectedCellIndex=function(){if(this.cell!=null){return this.cell._cellIndex}else{return -1}};this.getColWidth=function(ind){return parseInt(this.cellWidthPX[ind])+((_isFF)?2:0)};this.setColWidth=function(ind,value){if(this._hrrar[ind]){return }if(this.cellWidthType=="px"){this.cellWidthPX[ind]=parseInt(value)-+((_isFF)?2:0)}else{this.cellWidthPC[ind]=parseInt(value)}this.setSizes()};this.getRowIndex=function(row_id){for(var i=0;i<this.rowsBuffer.length;i++){if(this.rowsBuffer[i]&&this.rowsBuffer[i].idd==row_id){return i}}return -1};this.getRowId=function(ind){return this.rowsBuffer[ind]?this.rowsBuffer[ind].idd:this.undefined};this.setRowId=function(ind,row_id){this.changeRowId(this.getRowId(ind),row_id)};this.changeRowId=function(oldRowId,newRowId){if(oldRowId==newRowId){return }var row=this.rowsAr[oldRowId];row.idd=newRowId;if(this.UserData[oldRowId]){this.UserData[newRowId]=this.UserData[oldRowId];this.UserData[oldRowId]=null}if(this._h2&&this._h2.get[oldRowId]){this._h2.get[newRowId]=this._h2.get[oldRowId];this._h2.get[newRowId].id=newRowId;delete this._h2.get[oldRowId]}this.rowsAr[oldRowId]=null;this.rowsAr[newRowId]=row;for(var i=0;i<row.childNodes.length;i++){if(row.childNodes[i]._code){row.childNodes[i]._code=this._compileSCL(row.childNodes[i]._val,row.childNodes[i])}}if(this._mat_links&&this._mat_links[oldRowId]){var a=this._mat_links[oldRowId];delete this._mat_links[oldRowId];for(var c in a){for(var i=0;i<a[c].length;i++){this._compileSCL(a[c][i].original,a[c][i])}}}this.callEvent("onRowIdChange",[oldRowId,newRowId])};this.setColumnIds=function(ids){this.columnIds=ids.split(this.delim)};this.setColumnId=function(ind,id){this.columnIds[ind]=id};this.getColIndexById=function(id){for(var i=0;i<this.columnIds.length;i++){if(this.columnIds[i]==id){return i}}};this.getColumnId=function(cin){return this.columnIds[cin]};this.getColumnLabel=function(cin,ind,hdr){var z=(hdr||this.hdr).rows[(ind||0)+1];for(var i=0;i<z.cells.length;i++){if(z.cells[i]._cellIndexS==cin){return(_isIE?z.cells[i].innerText:z.cells[i].textContent)}}return""};this.getFooterLabel=function(cin,ind){return this.getColumnLabel(cin,ind,this.ftr)};this.setRowTextBold=function(row_id){var r=this.getRowById(row_id);if(r){r.style.fontWeight="bold"}};this.setRowTextStyle=function(row_id,styleString){var r=this.getRowById(row_id);if(!r){return }for(var i=0;i<r.childNodes.length;i++){var pfix=r.childNodes[i]._attrs.style||"";if((this._hrrar)&&(this._hrrar[i])){pfix="display:none;"}if(_isIE){r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString}else{r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString}}};this.setRowColor=function(row_id,color){var r=this.getRowById(row_id);for(var i=0;i<r.childNodes.length;i++){r.childNodes[i].bgColor=color}};this.setCellTextStyle=function(row_id,ind,styleString){var r=this.getRowById(row_id);if(!r){return }var cell=r.childNodes[r._childIndexes?r._childIndexes[ind]:ind];if(!cell){return }var pfix="";if((this._hrrar)&&(this._hrrar[ind])){pfix="display:none;"}if(_isIE){cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString}else{cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString}};this.setRowTextNormal=function(row_id){var r=this.getRowById(row_id);if(r){r.style.fontWeight="normal"}};this.doesRowExist=function(row_id){if(this.getRowById(row_id)!=null){return true}else{return false}};this.getColumnsNum=function(){return this._cCount};this.moveRowUp=function(row_id){var r=this.getRowById(row_id);if(this.isTreeGrid()){return this.moveRowUDTG(row_id,-1)}var rInd=this.rowsCol._dhx_find(r);if((r.previousSibling)&&(rInd!=0)){r.parentNode.insertBefore(r,r.previousSibling);this.rowsCol._dhx_swapItems(rInd,rInd-1);this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd-1);if(this._cssEven){this._fixAlterCss(rInd-1)}}};this.moveRowDown=function(row_id){var r=this.getRowById(row_id);if(this.isTreeGrid()){return this.moveRowUDTG(row_id,1)}var rInd=this.rowsCol._dhx_find(r);if(r.nextSibling){this.rowsCol._dhx_swapItems(rInd,rInd+1);if(r.nextSibling.nextSibling){r.parentNode.insertBefore(r,r.nextSibling.nextSibling)}else{r.parentNode.appendChild(r)}this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd+1);if(this._cssEven){this._fixAlterCss(rInd)}}};this.getCombo=function(col_ind){if(!this.combos[col_ind]){this.combos[col_ind]=new dhtmlXGridComboObject()}return this.combos[col_ind]};this.setUserData=function(row_id,name,value){if(!row_id){row_id="gridglobaluserdata"}if(!this.UserData[row_id]){this.UserData[row_id]=new Hashtable()}this.UserData[row_id].put(name,value)};this.getUserData=function(row_id,name){if(!row_id){row_id="gridglobaluserdata"}this.getRowById(row_id);var z=this.UserData[row_id];return(z?z.get(name):"")};this.setEditable=function(fl){this.isEditable=convertStringToBoolean(fl)};this.selectRowById=function(row_id,multiFL,show,call){if(!call){call=false}this.selectCell(this.getRowById(row_id),0,call,multiFL,false,show)};this.clearSelection=function(){this.editStop();for(var i=0;i<this.selectedRows.length;i++){var r=this.rowsAr[this.selectedRows[i].idd];if(r){r.className=r.className.replace(/rowselected/g,"")}}this.selectedRows=dhtmlxArray();this.row=null;if(this.cell!=null){this.cell.className=this.cell.className.replace(/cellselected/g,"");this.cell=null}};this.copyRowContent=function(from_row_id,to_row_id){var frRow=this.getRowById(from_row_id);if(!this.isTreeGrid()){for(var i=0;i<frRow.cells.length;i++){this.cells(to_row_id,i).setValue(this.cells(from_row_id,i).getValue())}}else{this._copyTreeGridRowContent(frRow,from_row_id,to_row_id)}if(!_isIE){this.getRowById(from_row_id).cells[0].height=frRow.cells[0].offsetHeight}};this.setFooterLabel=function(c,label,ind){return this.setColumnLabel(c,label,ind,this.ftr)};this.setColumnLabel=function(c,label,ind,hdr){var z=(hdr||this.hdr).rows[ind||1];var col=(z._childIndexes?z._childIndexes[c]:c);if(!z.cells[col]){return }if(!this.useImagesInHeader){var hdrHTML="<div class='hdrcell'>";if(label.indexOf("img:[")!=-1){var imUrl=label.replace(/.*\[([^>]+)\].*/,"$1");label=label.substr(label.indexOf("]")+1,label.length);hdrHTML+="<img width='18px' height='18px' align='absmiddle' src='"+imUrl+"' hspace='2'>"}hdrHTML+=label;hdrHTML+="</div>";z.cells[col].innerHTML=hdrHTML;if(this._hstyles[col]){z.cells[col].style.cssText=this._hstyles[col]}}else{z.cells[col].style.textAlign="left";z.cells[col].innerHTML="<img src='"+this.imgURL+""+label+"' onerror='this.src = \""+this.imgURL+"imageloaderror.gif\"'>";var a=new Image();a.src=this.imgURL+""+label.replace(/(\.[a-z]+)/,".des$1");this.preloadImagesAr[this.preloadImagesAr.length]=a;var b=new Image();b.src=this.imgURL+""+label.replace(/(\.[a-z]+)/,".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=b}if((label||"").indexOf("#")!=-1){var t=label.match(/(^|{)#([^}]+)(}|$)/);if(t){var tn="_in_header_"+t[2];if(this[tn]){this[tn]((this.forceDivInHeader?z.cells[col].firstChild:z.cells[col]),col,label.split(t[0]))}}}};this.clearAll=function(header){if(!this.obj.rows[0]){return }if(this._h2){this._h2=new dhtmlxHierarchy();if(this._fake){if(this._realfake){this._h2=this._fake._h2}else{this._fake._h2=this._h2}}}this.limit=this._limitC=0;this.editStop(true);if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}if(this._dload){this.objBox.scrollTop=0;this.limit=this._limitC||0;this._initDrF=true}var len=this.rowsCol.length;len=this.obj.rows.length;for(var i=len-1;i>0;i--){var t_r=this.obj.rows[i];t_r.parentNode.removeChild(t_r)}if(header){this._master_row=null;this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);for(var i=this.hdr.rows.length-1;i>=0;i--){var t_r=this.hdr.rows[i];t_r.parentNode.removeChild(t_r)}if(this.ftr){this.ftr.parentNode.removeChild(this.ftr);this.ftr=null}this._aHead=this.ftr=this.cellWidth=this._aFoot=null;this.cellType=dhtmlxArray();this._hrrar=[];this.columnIds=[];this.combos=[]}this.row=null;this.cell=null;this.rowsCol=dhtmlxArray();this.rowsAr=[];this._RaSeCol=[];this.rowsBuffer=dhtmlxArray();this.UserData=[];this.selectedRows=dhtmlxArray();if(this.pagingOn||this._srnd){this.xmlFileUrl=""}if(this.pagingOn){this.changePage(1)}if(this._contextCallTimer){window.clearTimeout(this._contextCallTimer)}if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;this.setSortImgState(false);this.setSizes();this.callEvent("onClearAll",[])};this.sortField=function(ind,repeatFl,r_el){if(this.getRowsNum()==0){return false}var el=this.hdr.rows[0].cells[ind];if(!el){return }if(el.tagName=="TH"&&(this.fldSort.length-1)>=el._cellIndex&&this.fldSort[el._cellIndex]!="na"){var data=this.getSortingState();var sortType=(data[0]==ind&&data[1]=="asc")?"des":"asc";if(!this.callEvent("onBeforeSorting",[ind,this.fldSort[ind],sortType])){return }this.sortImg.src=this.imgURL+"sort_"+(sortType=="asc"?"asc":"desc")+".gif";if(this.useImagesInHeader){var cel=this.hdr.rows[1].cells[el._cellIndex].firstChild;if(this.fldSorted!=null){var celT=this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild;celT.src=celT.src.replace(/(\.asc\.)|(\.des\.)/,".")}cel.src=cel.src.replace(/(\.[a-z]+)$/,"."+sortType+"$1")}this.sortRows(el._cellIndex,this.fldSort[el._cellIndex],sortType);this.fldSorted=el;this.r_fldSorted=r_el;var c=this.hdr.rows[1];var c=r_el.parentNode;var real_el=c._childIndexes?c._childIndexes[el._cellIndex]:el._cellIndex;this.setSortImgPos(false,false,false,r_el)}};this.setCustomSorting=function(func,col){if(!this._customSorts){this._customSorts=new Array()}this._customSorts[col]=(typeof (func)=="string")?eval(func):func;this.fldSort[col]="cus"};this.enableHeaderImages=function(fl){this.useImagesInHeader=fl};this.setHeader=function(hdrStr,splitSign,styles){if(typeof (hdrStr)!="object"){var arLab=this._eSplit(hdrStr)}else{arLab=[].concat(hdrStr)}var arWdth=new Array(0);var arTyp=new dhtmlxArray(0);var arAlg=new Array(0);var arVAlg=new Array(0);var arSrt=new Array(0);for(var i=0;i<arLab.length;i++){arWdth[arWdth.length]=Math.round(100/arLab.length);arTyp[arTyp.length]="ed";arAlg[arAlg.length]="left";arVAlg[arVAlg.length]="middle";arSrt[arSrt.length]="na"}this.splitSign=splitSign||"#cspan";this.hdrLabels=arLab;this.cellWidth=arWdth;if(!this.initCellWidth.length){this.setInitWidthsP(arWdth.join(this.delim),true)}this.cellType=arTyp;this.cellAlign=arAlg;this.cellVAlign=arVAlg;this.fldSort=arSrt;this._hstyles=styles||[]};this._eSplit=function(str){if(![].push){return str.split(this.delim)}var a="r"+(new Date()).valueOf();var z=this.delim.replace(/([\|\+\*\^])/g,"\\$1");return(str||"").replace(RegExp(z,"g"),a).replace(RegExp("\\\\"+a,"g"),this.delim).split(a)};this.getColType=function(cInd){return this.cellType[cInd]};this.getColTypeById=function(cID){return this.cellType[this.getColIndexById(cID)]};this.setColTypes=function(typeStr){this.cellType=dhtmlxArray(typeStr.split(this.delim));this._strangeParams=new Array();for(var i=0;i<this.cellType.length;i++){if((this.cellType[i].indexOf("[")!=-1)){var z=this.cellType[i].split(/[\[\]]+/g);this.cellType[i]=z[0];this.defVal[i]=z[1];if(z[1].indexOf("=")==0){this.cellType[i]="math";this._strangeParams[i]=z[0]}}if(!window["eXcell_"+this.cellType[i]]){dhtmlxError.throwError("Configuration","Incorrect cell type: "+this.cellType[i],[this,this.cellType[i]])}}};this.setColSorting=function(sortStr){this.fldSort=sortStr.split(this.delim);for(var i=0;i<this.fldSort.length;i++){if(((this.fldSort[i]).length>4)&&(typeof (window[this.fldSort[i]])=="function")){if(!this._customSorts){this._customSorts=new Array()}this._customSorts[i]=window[this.fldSort[i]];this.fldSort[i]="cus"}}};this.setColAlign=function(alStr){this.cellAlign=alStr.split(this.delim);for(var i=0;i<this.cellAlign.length;i++){this.cellAlign[i]=this.cellAlign[i]._dhx_trim()}};this.setColVAlign=function(valStr){this.cellVAlign=valStr.split(this.delim)};this.setNoHeader=function(fl){this.noHeader=convertStringToBoolean(fl)};this.showRow=function(rowID){this.getRowById(rowID);if(this._h2){this.openItem(this._h2.get[rowID].parent.id)}var c=this.getRowById(rowID).childNodes[0];while(c&&c.style.display=="none"){c=c.nextSibling}if(c){this.moveToVisible(c,true)}};this.setStyle=function(ss_header,ss_grid,ss_selCell,ss_selRow){this.ssModifier=[ss_header,ss_grid,ss_selCell,ss_selCell,ss_selRow];var prefs=["#"+this.entBox.id+" table.hdr td","#"+this.entBox.id+" table.obj td","#"+this.entBox.id+" table.obj tr.rowselected td.cellselected","#"+this.entBox.id+" table.obj td.cellselected","#"+this.entBox.id+" table.obj tr.rowselected td"];for(var i=0;i<prefs.length;i++){if(this.ssModifier[i]){if(_isIE){document.styleSheets[0].addRule(prefs[i],this.ssModifier[i])}else{document.styleSheets[0].insertRule(prefs[i]+" { "+this.ssModifier[i]+" } ",0)}}}};this.setColumnColor=function(clr){this.columnColor=clr.split(this.delim)};this.enableAlterCss=function(cssE,cssU,perLevel,levelUnique){if(cssE||cssU){this.attachEvent("onGridReconstructed",function(){this._fixAlterCss();if(this._fake){this._fake._fixAlterCss()}})}this._cssSP=perLevel;this._cssSU=levelUnique;this._cssEven=cssE;this._cssUnEven=cssU};this._fixAlterCss=function(ind){if(this._h2&&(this._cssSP||this._cssSU)){return this._fixAlterCssTGR(ind)}if(!this._cssEven&&!this._cssUnEven){return }ind=ind||0;var j=ind;for(var i=ind;i<this.rowsCol.length;i++){if(!this.rowsCol[i]){continue}if(this.rowsCol[i].style.display!="none"){if(this.rowsCol[i].className.indexOf("rowselected")!=-1){if(j%2==1){this.rowsCol[i].className=this._cssUnEven+" rowselected "+(this.rowsCol[i]._css||"")}else{this.rowsCol[i].className=this._cssEven+" rowselected "+(this.rowsCol[i]._css||"")}}else{if(j%2==1){this.rowsCol[i].className=this._cssUnEven+" "+(this.rowsCol[i]._css||"")}else{this.rowsCol[i].className=this._cssEven+" "+(this.rowsCol[i]._css||"")}}j++}}};this.clearChangedState=function(){for(var i=0;i<this.rowsCol.length;i++){var row=this.rowsCol[i];var cols=row.childNodes.length;for(var j=0;j<cols;j++){row.childNodes[j].wasChanged=false}}};this.getChangedRows=function(and_added){var res=new Array();this.forEachRow(function(id){var row=this.rowsAr[id];if(row.tagName!="TR"){return }var cols=row.childNodes.length;if(and_added&&row._added){res[res.length]=row.idd}else{for(var j=0;j<cols;j++){if(row.childNodes[j].wasChanged){res[res.length]=row.idd;break}}}});return res.join(this.delim)};this._sUDa=false;this._sAll=false;this.setSerializationLevel=function(userData,fullXML,config,changedAttr,onlyChanged,asCDATA){this._sUDa=userData;this._sAll=fullXML;this._sConfig=config;this._chAttr=changedAttr;this._onlChAttr=onlyChanged;this._asCDATA=asCDATA};this.setSerializableColumns=function(list){if(!list){this._srClmn=null;return }this._srClmn=(list||"").split(",");for(var i=0;i<this._srClmn.length;i++){this._srClmn[i]=convertStringToBoolean(this._srClmn[i])}};this._serialise=function(rCol,inner,closed){this.editStop();var out=[];var close="</"+this.xml.s_row+">";if(this.isTreeGrid()){this._h2.forEachChildF(0,function(el){var temp=this._serializeRow(this.render_row_tree(-1,el.id));out.push(temp);if(temp){return true}else{return false}},this,function(){out.push(close)})}else{for(var i=0;i<this.rowsBuffer.length;i++){if(this.rowsBuffer[i]){var temp=this._serializeRow(this.render_row(i));out.push(temp);if(temp){out.push(close)}}}}return[out.join("")]};this._serializeRow=function(r,i){var out=[];var ra=this.xml.row_attrs;var ca=this.xml.cell_attrs;out.push("<"+this.xml.s_row);out.push(" id='"+r.idd+"'");if((this._sAll)&&this.selectedRows._dhx_find(r)!=-1){out.push(" selected='1'")}if(this._h2&&this._h2.get[r.idd].state=="minus"){out.push(" open='1'")}if(ra.length){for(var i=0;i<ra.length;i++){out.push(" "+ra[i]+"='"+r._attrs[ra[i]]+"'")}}out.push(">");if(this._sUDa&&this.UserData[r.idd]){keysAr=this.UserData[r.idd].getKeys();for(var ii=0;ii<keysAr.length;ii++){out.push("<userdata name='"+keysAr[ii]+"'>"+(this._asCDATA?"<![CDATA[":"")+this.UserData[r.idd].get(keysAr[ii])+(this._asCDATA?"]]>":"")+"</userdata>")}}var changeFl=false;for(var jj=0;jj<this._cCount;jj++){if((!this._srClmn)||(this._srClmn[jj])){var zx=this.cells3(r,jj);out.push("<cell");if(ca.length){for(var i=0;i<ca.length;i++){out.push(" "+ca[i]+"='"+zx.cell._attrs[ca[i]]+"'")}}zxVal=zx[this._agetm]();if(this._asCDATA){zxVal="<![CDATA["+zxVal+"]]>"}if((this._ecspn)&&(zx.cell.colSpan)&&zx.cell.colSpan>1){out.push(' colspan="'+zx.cell.colSpan+'" ')}if(this._chAttr){if(zx.wasChanged()){out.push(' changed="1"');changeFl=true}}else{if((this._onlChAttr)&&(zx.wasChanged())){changeFl=true}}if(this._sAll&&this.cellType[jj]=="tree"){out.push((this._h2?(" image='"+this._h2.get[r.idd].image+"'"):"")+">"+zxVal+"</cell>")}else{out.push(">"+zxVal+"</cell>")}if((this._ecspn)&&(zx.cell.colSpan)){for(var u=0;u<zx.cell.colSpan-1;u++){out.push("<cell/>");jj++}}}}if((this._onlChAttr)&&(!changeFl)&&(!r._added)){return""}return out.join("")};this._serialiseConfig=function(){var out="<head>";for(var i=0;i<this.hdr.rows[0].cells.length;i++){if(this._srClmn&&!this._srClmn[i]){continue}var sort=this.fldSort[i];if(sort=="cus"){sort=this._customSorts[i].toString();sort=sort.replace(/function[\ ]*/,"").replace(/\([^\f]*/,"")}out+="<column width='"+this.getColWidth(i)+"' align='"+this.cellAlign[i]+"' type='"+this.cellType[i]+"' sort='"+(sort||"na")+"' color='"+this.columnColor[i]+"'"+(this.columnIds[i]?(" id='"+this.columnIds[i]+"'"):"")+">";if(this._asCDATA){out+="<![CDATA["+this.getHeaderCol(i)+"]]>"}else{out+=this.getHeaderCol(i)}var z=this.getCombo(i);if(z){for(var j=0;j<z.keys.length;j++){out+="<option value='"+z.keys[j]+"'>"+z.values[j]+"</option>"}}out+="</column>"}return out+="</head>"};this.serialize=function(){var out='<?xml version="1.0"?><rows>';if(this._mathSerialization){this._agetm="getMathValue"}else{this._agetm="getValue"}if(this._sUDa&&this.UserData.gridglobaluserdata){var keysAr=this.UserData.gridglobaluserdata.getKeys();for(var i=0;i<keysAr.length;i++){out+="<userdata name='"+keysAr[i]+"'>"+this.UserData.gridglobaluserdata.get(keysAr[i])+"</userdata>"}}if(this._sConfig){out+=this._serialiseConfig()}out+=this._serialise();out+="</rows>";return out};this.getPosition=function(oNode,pNode){if(!pNode&&!_isChrome){var pos=getOffset(oNode);return[pos.left,pos.top]}pNode=pNode||document.body;var oCurrentNode=oNode;var iLeft=0;var iTop=0;while((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent}if(pNode==document.body){if(_isIE){iTop+=document.body.offsetTop||document.documentElement.offsetTop;iLeft+=document.body.offsetLeft||document.documentElement.offsetLeft}else{if(!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}}}return[iLeft,iTop]};this.getFirstParentOfType=function(obj,tag){while(obj&&obj.tagName!=tag&&obj.tagName!="BODY"){obj=obj.parentNode}return obj};this.objBox.onscroll=function(){this.grid._doOnScroll()};if((!_isOpera)||(_OperaRv>8.5)){this.hdr.onmousemove=function(e){this.grid.changeCursorState(e||window.event)};this.hdr.onmousedown=function(e){return this.grid.startColResize(e||window.event)}}this.obj.onmousemove=this._drawTooltip;this.obj.onclick=function(e){this.grid._doClick(e||window.event);if(this.grid._sclE){this.grid.editCell(e||window.event)}(e||event).cancelBubble=true};if(_isMacOS){this.entBox.oncontextmenu=function(e){e.cancelBubble=true;e.returnValue=false;return this.grid._doContClick(e||window.event)}}else{this.entBox.onmousedown=function(e){return this.grid._doContClick(e||window.event)};this.entBox.oncontextmenu=function(e){if(this.grid._ctmndx){(e||event).cancelBubble=true}return !this.grid._ctmndx}}this.obj.ondblclick=function(e){if(!this.grid.wasDblClicked(e||window.event)){return false}if(this.grid._dclE){var row=this.grid.getFirstParentOfType((_isIE?event.srcElement:e.target),"TR");if(row==this.grid.row){this.grid.editCell(e||window.event)}}(e||event).cancelBubble=true;if(_isOpera){return false}};this.hdr.onclick=this._onHeaderClick;this.sortImg.onclick=function(){self._onHeaderClick.apply({grid:self},[null,self.r_fldSorted])};this.hdr.ondblclick=this._onHeaderDblClick;if(!document.body._dhtmlxgrid_onkeydown){dhtmlxEvent(document,_isOpera?"keypress":"keydown",function(e){if(globalActiveDHTMLGridObject){return globalActiveDHTMLGridObject.doKey(e||window.event)}});document.body._dhtmlxgrid_onkeydown=true}dhtmlxEvent(document.body,"click",function(){if(self.editStop){self.editStop()}});this.entBox.onbeforeactivate=function(){this._still_active=null;this.grid.setActive();event.cancelBubble=true};this.entBox.onbeforedeactivate=function(){if(this.grid._still_active){this.grid._still_active=null}else{this.grid.isActive=false}event.cancelBubble=true};if(this.entBox.style.height.toString().indexOf("%")!=-1){this._delta_y=this.entBox.style.height}if(this.entBox.style.width.toString().indexOf("%")!=-1){this._delta_x=this.entBox.style.width}if(this._delta_x||this._delta_y){this._setAutoResize()}this.setColHidden=this.setColumnsVisibility;this.enableCollSpan=this.enableColSpan;this.setMultiselect=this.enableMultiselect;this.setMultiLine=this.enableMultiline;this.deleteSelectedItem=this.deleteSelectedRows;this.getSelectedId=this.getSelectedRowId;this.getHeaderCol=this.getColumnLabel;this.isItemExists=this.doesRowExist;this.getColumnCount=this.getColumnsNum;this.setSelectedRow=this.selectRowById;this.setHeaderCol=this.setColumnLabel;this.preventIECashing=this.preventIECaching;this.enableAutoHeigth=this.enableAutoHeight;this.getUID=this.uid;if(dhtmlx.image_path){this.setImagePath(dhtmlx.image_path)}if(dhtmlx.skin){this.setSkin(dhtmlx.skin)}return this}dhtmlXGridObject.prototype={getRowAttribute:function(B,A){return this.getRowById(B)._attrs[A]},setRowAttribute:function(C,A,B){this.getRowById(C)._attrs[A]=B},isTreeGrid:function(){return(this.cellType._dhx_find("tree")!=-1)},setRowHidden:function(F,C){var B=convertStringToBoolean(C);var E=this.getRowById(F);if(!E){return }if(E.expand===""){this.collapseKids(E)}if((C)&&(E.style.display!="none")){E.style.display="none";var D=this.selectedRows._dhx_find(E);if(D!=-1){E.className=E.className.replace("rowselected","");for(var A=0;A<E.childNodes.length;A++){E.childNodes[A].className=E.childNodes[A].className.replace(/cellselected/g,"")}this.selectedRows._dhx_removeAt(D)}this.callEvent("onGridReconstructed",[])}if((!C)&&(E.style.display=="none")){E.style.display="";this.callEvent("onGridReconstructed",[])}this.setSizes()},setColumnHidden:function(C,B){if(!this.hdr.rows.length){if(!this._ivizcol){this._ivizcol=[]}return this._ivizcol[C]=B}if((this.fldSorted)&&(this.fldSorted.cellIndex==C)&&(B)){this.sortImg.style.display="none"}var A=convertStringToBoolean(B);if(A){if(!this._hrrar){this._hrrar=new Array()}else{if(this._hrrar[C]){return }}this._hrrar[C]="display:none;";this._hideShowColumn(C,"none")}else{if((!this._hrrar)||(!this._hrrar[C])){return }this._hrrar[C]="";this._hideShowColumn(C,"")}if((this.fldSorted)&&(this.fldSorted.cellIndex==C)&&(!B)){this.sortImg.style.display="inline"}this.setSortImgPos();this.callEvent("onColumnHidden",[C,B])},isColumnHidden:function(A){if((this._hrrar)&&(this._hrrar[A])){return true}return false},setColumnsVisibility:function(B){if(B){this._ivizcol=B.split(this.delim)}if(this.hdr.rows.length&&this._ivizcol){for(var A=0;A<this._ivizcol.length;A++){this.setColumnHidden(A,this._ivizcol[A])}}},_fixHiddenRowsAll:function(H,C,A,B,F){F=F||"_cellIndex";var G=H.rows.length;for(var E=0;E<G;E++){var I=H.rows[E].childNodes;if(I.length!=this._cCount){for(var D=0;D<I.length;D++){if(I[D][F]==C){I[D].style[A]=B;break}}}else{I[C].style[A]=B}}},_hideShowColumn:function(E,D){var A=E;if((this.hdr.rows[1]._childIndexes)&&(this.hdr.rows[1]._childIndexes[E]!=E)){A=this.hdr.rows[1]._childIndexes[E]}if(D=="none"){this.hdr.rows[0].cells[E]._oldWidth=this.hdr.rows[0].cells[E].style.width||(this.initCellWidth[E]+"px");this.hdr.rows[0].cells[E]._oldWidthP=this.cellWidthPC[E];this.obj.rows[0].cells[E].style.width="0px";var B={rows:[this.obj.rows[0]]};this.forEachRow(function(F){if(this.rowsAr[F].tagName=="TR"){B.rows.push(this.rowsAr[F])}});this._fixHiddenRowsAll(B,E,"display","none");if(this.isTreeGrid()){this._fixHiddenRowsAllTG(E,"none")}if((_isOpera&&_OperaRv<9)||_isKHTML||(_isFF)){this._fixHiddenRowsAll(this.hdr,E,"display","none","_cellIndexS")}if(this.ftr){this._fixHiddenRowsAll(this.ftr.childNodes[0],E,"display","none")}this._fixHiddenRowsAll(this.hdr,E,"whiteSpace","nowrap","_cellIndexS");if(!this.cellWidthPX.length&&!this.cellWidthPC.length){this.cellWidthPX=[].concat(this.initCellWidth)}if(this.cellWidthPX[E]){this.cellWidthPX[E]=0}if(this.cellWidthPC[E]){this.cellWidthPC[E]=0}}else{if(this.hdr.rows[0].cells[E]._oldWidth){var C=this.hdr.rows[0].cells[E];if(_isOpera||_isKHTML||(_isFF)){this._fixHiddenRowsAll(this.hdr,E,"display","","_cellIndexS")}if(this.ftr){this._fixHiddenRowsAll(this.ftr.childNodes[0],E,"display","")}var B={rows:[this.obj.rows[0]]};this.forEachRow(function(F){if(this.rowsAr[F].tagName=="TR"){B.rows.push(this.rowsAr[F])}});this._fixHiddenRowsAll(B,E,"display","");if(this.isTreeGrid()){this._fixHiddenRowsAllTG(E,"")}this._fixHiddenRowsAll(this.hdr,E,"whiteSpace","normal","_cellIndexS");if(C._oldWidthP){this.cellWidthPC[E]=C._oldWidthP}if(C._oldWidth){this.cellWidthPX[E]=parseInt(C._oldWidth)}}}this.setSizes();if((!_isIE)&&(!_isFF)){this.obj.border=1;this.obj.border=0}},enableColSpan:function(A){this._ecspn=convertStringToBoolean(A)},enableRowsHover:function(B,A){this._unsetRowHover(false,true);this._hvrCss=A;if(convertStringToBoolean(B)){if(!this._elmnh){this.obj._honmousemove=this.obj.onmousemove;this.obj.onmousemove=this._setRowHover;if(_isIE){this.obj.onmouseleave=this._unsetRowHover}else{this.obj.onmouseout=this._unsetRowHover}this._elmnh=true}}else{if(this._elmnh){this.obj.onmousemove=this.obj._honmousemove;if(_isIE){this.obj.onmouseleave=null}else{this.obj.onmouseout=null}this._elmnh=false}}},enableEditEvents:function(B,C,A){this._sclE=convertStringToBoolean(B);this._dclE=convertStringToBoolean(C);this._f2kE=convertStringToBoolean(A)},enableLightMouseNavigation:function(A){if(convertStringToBoolean(A)){if(!this._elmn){this.entBox._onclick=this.entBox.onclick;this.entBox.onclick=function(){return true};this.obj._onclick=this.obj.onclick;this.obj.onclick=function(B){var C=this.grid.getFirstParentOfType(B?B.target:event.srcElement,"TD");if(!C){return }this.grid.editStop();this.grid.doClick(C);this.grid.editCell();(B||event).cancelBubble=true};this.obj._onmousemove=this.obj.onmousemove;this.obj.onmousemove=this._autoMoveSelect;this._elmn=true}}else{if(this._elmn){this.entBox.onclick=this.entBox._onclick;this.obj.onclick=this.obj._onclick;this.obj.onmousemove=this.obj._onmousemove;this._elmn=false}}},_unsetRowHover:function(B,C){if(C){that=this}else{that=this.grid}if((that._lahRw)&&(that._lahRw!=C)){for(var A=0;A<that._lahRw.childNodes.length;A++){that._lahRw.childNodes[A].className=that._lahRw.childNodes[A].className.replace(that._hvrCss,"")}that._lahRw=null}},_setRowHover:function(B){var C=this.grid.getFirstParentOfType(B?B.target:event.srcElement,"TD");if(C&&C.parentNode!=this.grid._lahRw){this.grid._unsetRowHover(0,C);C=C.parentNode;if(!C.idd||C.idd=="__filler__"){return }for(var A=0;A<C.childNodes.length;A++){C.childNodes[A].className+=" "+this.grid._hvrCss}this.grid._lahRw=C}this._honmousemove(B)},_autoMoveSelect:function(A){if(!this.grid.editor){var B=this.grid.getFirstParentOfType(A?A.target:event.srcElement,"TD");if(B.parentNode.idd){this.grid.doClick(B,true,0)}}this._onmousemove(A)},enableDistributedParsing:function(C,A,B){if(convertStringToBoolean(C)){this._ads_count=A||10;this._ads_time=B||250}else{this._ads_count=0}},destructor:function(){this.editStop(true);if(this._sizeTime){this._sizeTime=window.clearTimeout(this._sizeTime)}this.entBox.className=(this.entBox.className||"").replace(/gridbox.*/,"");if(this.formInputs){for(var B=0;B<this.formInputs.length;B++){this.parentForm.removeChild(this.formInputs[B])}}var A;this.xmlLoader=this.xmlLoader.destructor();for(var B=0;B<this.rowsCol.length;B++){if(this.rowsCol[B]){this.rowsCol[B].grid=null}}for(B in this.rowsAr){if(this.rowsAr[B]){this.rowsAr[B]=null}}this.rowsCol=new dhtmlxArray();this.rowsAr=new Array();this.entBox.innerHTML="";var C=function(){};this.entBox.onclick=this.entBox.onmousedown=this.entBox.onbeforeactivate=this.entBox.onbeforedeactivate=this.entBox.onbeforedeactivate=this.entBox.onselectstart=C;this.setSizes=this._update_srnd_view=this.callEvent=C;this.entBox.grid=this.objBox.grid=this.hdrBox.grid=this.obj.grid=this.hdr.grid=null;for(A in this){if((this[A])&&(this[A].m_obj)){this[A].m_obj=null}this[A]=null}if(this==globalActiveDHTMLGridObject){globalActiveDHTMLGridObject=null}return null},getSortingState:function(){var A=new Array();if(this.fldSorted){A[0]=this.fldSorted._cellIndex;A[1]=(this.sortImg.src.indexOf("sort_desc.gif")!=-1)?"des":"asc"}return A},enableAutoHeight:function(C,B,A){this._ahgr=convertStringToBoolean(C);this._ahgrF=convertStringToBoolean(A);this._ahgrM=B||null;if(arguments.length==1){this.objBox.style.overflowY=C?"hidden":"auto"}if(B=="auto"){this._ahgrM=null;this._ahgrMA=true;this._setAutoResize()}},enableStableSorting:function(A){this._sst=convertStringToBoolean(A);this.rowsCol.stablesort=function(F){var E=this.length-1;for(var D=0;D<this.length-1;D++){for(var C=0;C<E;C++){if(F(this[C],this[C+1])>0){var B=this[C];this[C]=this[C+1];this[C+1]=B}}E--}}},enableKeyboardSupport:function(A){this._htkebl=!convertStringToBoolean(A)},enableContextMenu:function(A){this._ctmndx=A},setScrollbarWidthCorrection:function(A){},enableTooltips:function(B){this._enbTts=B.split(",");for(var A=0;A<this._enbTts.length;A++){this._enbTts[A]=convertStringToBoolean(this._enbTts[A])}},enableResizing:function(B){this._drsclmn=B.split(",");for(var A=0;A<this._drsclmn.length;A++){this._drsclmn[A]=convertStringToBoolean(this._drsclmn[A])}},setColumnMinWidth:function(A,B){if(arguments.length==2){if(!this._drsclmW){this._drsclmW=new Array()}this._drsclmW[B]=A}else{this._drsclmW=A.split(",")}},enableCellIds:function(A){this._enbCid=convertStringToBoolean(A)},lockRow:function(A,C){var B=this.getRowById(A);if(B){B._locked=convertStringToBoolean(C);if((this.cell)&&(this.cell.parentNode.idd==A)){this.editStop()}}},_getRowArray:function(D){var C=new Array();for(var B=0;B<D.childNodes.length;B++){var A=this.cells3(D,B);C[B]=A.getValue()}return C},setDateFormat:function(B,A){this._dtmask=B;this._dtmask_inc=A},setNumberFormat:function(H,C,E,G){var D=H.replace(/[^0\,\.]*/g,"");var A=D.indexOf(".");if(A>-1){A=D.length-A-1}var B=D.indexOf(",");if(B>-1){B=D.length-A-2-B}if(typeof E!="string"){E=this.i18n.decimal_separator}if(typeof G!="string"){G=this.i18n.group_separator}var I=H.split(D)[0];var F=H.split(D)[1];this._maskArr[C]=[A,B,I,F,E,G]},_aplNFb:function(D,C){var A=this._maskArr[C];if(!A){return D}var B=parseFloat(D.toString().replace(/[^0-9]*/g,""));if(D.toString().substr(0,1)=="-"){B=B*-1}if(A[0]>0){B=B/Math.pow(10,A[0])}return B},_aplNF:function(D,C){var A=this._maskArr[C];if(!A){return D}var E=(parseFloat(D)<0?"-":"")+A[2];D=Math.abs(Math.round(parseFloat(D)*Math.pow(10,A[0]>0?A[0]:0))).toString();D=(D.length<A[0]?Math.pow(10,A[0]+1-D.length).toString().substr(1,A[0]+1)+D.toString():D).split("").reverse();D[A[0]]=(D[A[0]]||"0")+A[4];if(A[1]>0){for(var B=(A[0]>0?0:1)+A[0]+A[1];B<D.length;B+=A[1]){D[B]+=A[5]}}return E+D.reverse().join("")+A[3]},_launchCommands:function(A){for(var D=0;D<A.length;D++){var C=new Array();for(var B=0;B<A[D].childNodes.length;B++){if(A[D].childNodes[B].nodeType==1){C[C.length]=A[D].childNodes[B].firstChild.data}}this[A[D].getAttribute("command")].apply(this,C)}},_parseHead:function(P){var G=this.xmlLoader.doXPath("./head",P);if(G.length){var B=this.xmlLoader.doXPath("./column",G[0]);var I=this.xmlLoader.doXPath("./settings",G[0]);var J="setInitWidths";var M=false;if(I[0]){for(var Q=0;Q<I[0].childNodes.length;Q++){switch(I[0].childNodes[Q].tagName){case"colwidth":if(I[0].childNodes[Q].firstChild&&I[0].childNodes[Q].firstChild.data=="%"){J="setInitWidthsP"}break;case"splitat":M=(I[0].childNodes[Q].firstChild?I[0].childNodes[Q].firstChild.data:false);break}}}this._launchCommands(this.xmlLoader.doXPath("./beforeInit/call",G[0]));if(B.length>0){if(this.hdr.rows.length>0){this.clearAll(true)}var L=[[],[],[],[],[],[],[],[],[]];var N=["","width","type","align","sort","color","format","hidden","id"];var O=["",J,"setColTypes","setColAlign","setColSorting","setColumnColor","","","setColumnIds"];for(var H=0;H<B.length;H++){for(var F=1;F<N.length;F++){L[F].push(B[H].getAttribute(N[F]))}L[0].push((B[H].firstChild?B[H].firstChild.data:"").replace(/^\s*((\s\S)*.+)\s*$/gi,"$1"))}this.setHeader(L[0]);for(var H=0;H<O.length;H++){if(O[H]){this[O[H]](L[H].join(this.delim))}}for(var H=0;H<B.length;H++){if((this.cellType[H].indexOf("co")==0)||(this.cellType[H]=="clist")){var E=this.xmlLoader.doXPath("./option",B[H]);if(E.length){var A=new Array();if(this.cellType[H]=="clist"){for(var F=0;F<E.length;F++){A[A.length]=E[F].firstChild?E[F].firstChild.data:""}this.registerCList(H,A)}else{var C=this.getCombo(H);for(var F=0;F<E.length;F++){C.put(E[F].getAttribute("value"),E[F].firstChild?E[F].firstChild.data:"")}}}}else{if(L[6][H]){if((this.cellType[H].toLowerCase().indexOf("calendar")!=-1)||(this.fldSort[H]=="date")){this.setDateFormat(L[6][H])}else{this.setNumberFormat(L[6][H],H)}}}}this.init();var D=L[7].join(this.delim);if(this.setColHidden&&D.replace(/,/g,"")!=""){this.setColHidden(D)}if((M)&&(this.splitAt)){this.splitAt(M)}}this._launchCommands(this.xmlLoader.doXPath("./afterInit/call",G[0]))}var K=this.xmlLoader.doXPath("//rows/userdata",P);if(K.length>0){if(!this.UserData.gridglobaluserdata){this.UserData.gridglobaluserdata=new Hashtable()}for(var F=0;F<K.length;F++){this.UserData.gridglobaluserdata.put(K[F].getAttribute("name"),K[F].firstChild?K[F].firstChild.data:"")}}},getCheckedRows:function(A){var B=new Array();this.forEachRowA(function(C){if(this.cells(C,A).getValue()!=0){B.push(C)}},true);return B.join(",")},checkAll:function(){var B=arguments.length?arguments[0]:1;for(var A=0;A<this.getColumnsNum();A++){if(this.getColType(A)=="ch"){this.setCheckedRows(A,B)}}},uncheckAll:function(){this.checkAll(0)},setCheckedRows:function(B,A){this.forEachRowA(function(C){if(this.cells(C,B).isCheckbox()){this.cells(C,B).setValue(A)}})},_drawTooltip:function(D){var E=this.grid.getFirstParentOfType(D?D.target:event.srcElement,"TD");if(!E||((this.grid.editor)&&(this.grid.editor.cell==E))){return true}var C=E.parentNode;if(!C.idd||C.idd=="__filler__"){return }var B=(D?D.target:event.srcElement);if(C.idd==window.unknown){return true}if(!this.grid.callEvent("onMouseOver",[C.idd,E._cellIndex])){return true}if((this.grid._enbTts)&&(!this.grid._enbTts[E._cellIndex])){if(B.title){B.title=""}return true}if(E._cellIndex>=this.grid._cCount){return }var A=this.grid.cells3(C,E._cellIndex);if(!A||!A.cell||!A.cell._attrs){return }if(B._title){A.cell.title=""}if(!A.cell._attrs.title){B._title=true}if(A){B.title=A.cell._attrs.title||(A.getTitle?A.getTitle():(A.getValue()||"").toString().replace(/<[^>]*>/gi,""))}return true},enableCellWidthCorrection:function(A){if(_isFF){this._wcorr=parseInt(A)}},getAllRowIds:function(C){var A=[];for(var B=0;B<this.rowsBuffer.length;B++){if(this.rowsBuffer[B]){A.push(this.rowsBuffer[B].idd)}}return A.join(C||this.delim)},getAllItemIds:function(){return this.getAllRowIds()},setColspan:function(B,K,C){if(!this._ecspn){return }var A=this.getRowById(B);if((A._childIndexes)&&(A.childNodes[A._childIndexes[K]])){var F=A._childIndexes[K];var D=A.childNodes[F];var E=D.colSpan;D.colSpan=1;if((E)&&(E!=1)){for(var H=1;H<E;H++){var J=document.createElement("TD");if(D.nextSibling){A.insertBefore(J,D.nextSibling)}else{A.appendChild(J)}A._childIndexes[K+H]=F+H;J._cellIndex=K+H;J.style.textAlign=this.cellAlign[H];J.style.verticalAlign=this.cellVAlign[H];D=J;this.cells3(A,K+H).setValue("")}}for(var I=K*1+1*E;I<A._childIndexes.length;I++){A._childIndexes[I]+=(E-1)*1}}if((C)&&(C>1)){if(A._childIndexes){var F=A._childIndexes[K]}else{var F=K;A._childIndexes=new Array();for(var I=0;I<A.childNodes.length;I++){A._childIndexes[I]=I}}A.childNodes[F].colSpan=C;for(var I=1;I<C;I++){A._childIndexes[A.childNodes[F+1]._cellIndex]=F;A.removeChild(A.childNodes[F+1])}var G=A.childNodes[A._childIndexes[K]]._cellIndex;for(var I=G*1+1*C;I<A._childIndexes.length;I++){A._childIndexes[I]-=(C-1)}}},preventIECaching:function(A){this.no_cashe=convertStringToBoolean(A);this.xmlLoader.rSeed=this.no_cashe},enableColumnAutoSize:function(A){this._eCAS=convertStringToBoolean(A)},_onHeaderDblClick:function(C){var B=this.grid;var A=B.getFirstParentOfType(_isIE?event.srcElement:C.target,"TD");if(!B._eCAS){return false}B.adjustColumnSize(A._cellIndexS)},adjustColumnSize:function(E,G){if(this._hrrar&&this._hrrar[E]){return }this._notresize=true;var A=0;this._setColumnSizeR(E,20);for(var D=1;D<this.hdr.rows.length;D++){var C=this.hdr.rows[D];C=C.childNodes[(C._childIndexes)?C._childIndexes[E]:E];if((C)&&((!C.colSpan)||(C.colSpan<2))&&C._cellIndex==E){if((C.childNodes[0])&&(C.childNodes[0].className=="hdrcell")){C=C.childNodes[0]}A=Math.max(A,((_isFF||_isOpera)?(C.textContent.length*7):C.scrollWidth))}}var B=this.obj.rows.length;for(var F=1;F<B;F++){var H=this.obj.rows[F];if(!this.rowsAr[H.idd]){continue}if(H._childIndexes&&H._childIndexes[E]!=E||!H.childNodes[E]){continue}if(_isFF||_isOpera||G){H=H.childNodes[E].textContent.length*7}else{H=H.childNodes[E].scrollWidth}if(H>A){A=H}}A+=20+(G||0);this._setColumnSizeR(E,A);this._notresize=false;this.setSizes()},detachHeader:function(A,C){C=C||this.hdr;var B=C.rows[A+1];if(B){B.parentNode.removeChild(B)}this.setSizes()},detachFooter:function(A){this.detachHeader(A,this.ftr)},attachHeader:function(A,D,B){if(typeof (A)=="string"){A=this._eSplit(A)}if(typeof (D)=="string"){D=D.split(this.delim)}B=B||"_aHead";if(this.hdr.rows.length){if(A){this._createHRow([A,D],this[(B=="_aHead")?"hdr":"ftr"])}else{if(this[B]){for(var C=0;C<this[B].length;C++){this.attachHeader.apply(this,this[B][C])}}}}else{if(!this[B]){this[B]=new Array()}this[B][this[B].length]=[A,D,B]}},_createHRow:function(C,J){if(!J){if(this.entBox.style.position!="absolute"){this.entBox.style.position="relative"}var G=document.createElement("DIV");G.className="c_ftr".substr(2);this.entBox.appendChild(G);var M=document.createElement("TABLE");M.cellPadding=M.cellSpacing=0;if(!_isIE){M.width="100%";M.style.paddingRight="20px"}M.style.marginRight="20px";M.style.tableLayout="fixed";G.appendChild(M);M.appendChild(document.createElement("TBODY"));this.ftr=J=M;var F=M.insertRow(0);var A=((this.hdrLabels.length<=1)?C[0].length:this.hdrLabels.length);for(var D=0;D<A;D++){F.appendChild(document.createElement("TH"));F.childNodes[D]._cellIndex=D}if(_isIE&&_isIE<8){F.style.position="absolute"}else{F.style.height="auto"}}var E=C[1];var G=document.createElement("TR");J.rows[0].parentNode.appendChild(G);for(var D=0;D<C[0].length;D++){if(C[0][D]=="#cspan"){var H=G.cells[G.cells.length-1];H.colSpan=(H.colSpan||1)+1;continue}if((C[0][D]=="#rspan")&&(J.rows.length>1)){var O=J.rows.length-2;var N=false;var H=null;while(!N){var H=J.rows[O];for(var B=0;B<H.cells.length;B++){if(H.cells[B]._cellIndex==D){N=B+1;break}}O--}H=H.cells[N-1];H.rowSpan=(H.rowSpan||1)+1;continue}var I=document.createElement("TD");I._cellIndex=I._cellIndexS=D;if(this._hrrar&&this._hrrar[D]&&!_isIE){I.style.display="none"}if(typeof C[0][D]=="object"){I.appendChild(C[0][D])}else{if(this.forceDivInHeader){I.innerHTML="<div class='hdrcell'>"+(C[0][D]||" ")+"</div>"}else{I.innerHTML=(C[0][D]||" ")}if((C[0][D]||"").indexOf("#")!=-1){var M=C[0][D].match(/(^|{)#([^}]+)(}|$)/);if(M){var K="_in_header_"+M[2];if(this[K]){this[K]((this.forceDivInHeader?I.firstChild:I),D,C[0][D].split(M[0]))}}}}if(E){I.style.cssText=E[D]}G.appendChild(I)}var L=J;if(_isKHTML){if(J._kTimer){window.clearTimeout(J._kTimer)}J._kTimer=window.setTimeout(function(){J.rows[1].style.display="none";window.setTimeout(function(){J.rows[1].style.display=""},1)},500)}},attachFooter:function(A,B){this.attachHeader(A,B,"_aFoot")},setCellExcellType:function(C,A,B){this.changeCellType(this.getRowById(C),A,B)},changeCellType:function(C,D,B){B=B||this.cellType[D];var E=this.cells3(C,D);var A=E.getValue();E.cell._cellType=B;var E=this.cells3(C,D);E.setValue(A)},setRowExcellType:function(C,B){var D=this.rowsAr[C];for(var A=0;A<D.childNodes.length;A++){this.changeCellType(D,A,B)}},setColumnExcellType:function(A,C){for(var B=0;B<this.rowsBuffer.length;B++){if(this.rowsBuffer[B]&&this.rowsBuffer[B].tagName=="TR"){this.changeCellType(this.rowsBuffer[B],A,C)}}if(this.cellType[A]=="math"){this._strangeParams[B]=C}else{this.cellType[A]=C}},forEachRow:function(B){for(var A in this.rowsAr){if(this.rowsAr[A]&&this.rowsAr[A].idd){B.apply(this,[this.rowsAr[A].idd])}}},forEachRowA:function(B){for(var A=0;A<this.rowsBuffer.length;A++){if(this.rowsBuffer[A]){B.call(this,this.render_row(A).idd)}}},forEachCell:function(C,B){var D=this.getRowById(C);if(!D){return }for(var A=0;A<this._cCount;A++){B(this.cells3(D,A),A)}},enableAutoWidth:function(C,A,B){this._awdth=[convertStringToBoolean(C),parseInt(A||99999),parseInt(B||0)];if(arguments.length==1){this.objBox.style.overflowX=C?"hidden":"auto"}},updateFromXML:function(A,D,B,C){if(typeof D=="undefined"){D=true}this._refresh_mode=[true,D,B];this.load(A,C)},_refreshFromXML:function(C){if(this._f_rowsBuffer){this.filterBy(0,"")}reset=false;if(window.eXcell_tree){eXcell_tree.prototype.setValueX=eXcell_tree.prototype.setValue;eXcell_tree.prototype.setValue=function(K){var J=this.grid._h2.get[this.cell.parentNode.idd];if(J&&this.cell.parentNode.valTag){this.setLabel(K)}else{this.setValueX(K)}}}var I=this.cellType._dhx_find("tree");C.getXMLTopNode("rows");var D=C.doXPath("//rows")[0].getAttribute("parent")||0;var F={};if(this._refresh_mode[2]){if(I!=-1){this._h2.forEachChild(D,function(J){F[J.id]=true},this)}else{this.forEachRow(function(J){F[J]=true})}}var H=C.doXPath("//row");for(var B=0;B<H.length;B++){var G=H[B];var A=G.getAttribute("id");F[A]=false;var D=G.parentNode.getAttribute("id")||D;if(this.rowsAr[A]&&this.rowsAr[A].tagName!="TR"){if(this._h2){this._h2.get[A].buff.data=G}else{this.rowsBuffer[this.getRowIndex(A)].data=G}this.rowsAr[A]=G}else{if(this.rowsAr[A]){this._process_xml_row(this.rowsAr[A],G,-1);this._postRowProcessing(this.rowsAr[A],true)}else{if(this._refresh_mode[1]){var E={idd:A,data:G,_parser:this._process_xml_row,_locator:this._get_xml_data};if(this._refresh_mode[1]=="top"){this.rowsBuffer.unshift(E)}else{this.rowsBuffer.push(E)}if(this._h2){reset=true;(this._h2.add(A,(G.parentNode.getAttribute("id")||G.parentNode.getAttribute("parent")))).buff=this.rowsBuffer[this.rowsBuffer.length-1]}this.rowsAr[A]=G;G=this.render_row(this.rowsBuffer.length-1);this._insertRowAt(G,-1)}}}}if(this._refresh_mode[2]){for(A in F){if(F[A]&&this.rowsAr[A]){this.deleteRow(A)}}}this._refresh_mode=null;if(window.eXcell_tree){eXcell_tree.prototype.setValue=eXcell_tree.prototype.setValueX}if(reset){this._renderSort()}if(this._f_rowsBuffer){this._f_rowsBuffer=null;this.filterByAll()}},getCustomCombo:function(C,B){var A=this.cells(C,B).cell;if(!A._combo){A._combo=new dhtmlXGridComboObject()}return A._combo},setTabOrder:function(B){var D=B.split(this.delim);this._tabOrder=[];var A=this._cCount||B.length;for(var C=0;C<A;C++){D[C]={c:parseInt(D[C]),ind:C}}D.sort(function(F,E){return(F.c>E.c?1:-1)});for(var C=0;C<A;C++){if(!D[C+1]||(typeof D[C].c=="undefined")){this._tabOrder[D[C].ind]=(D[0].ind+1)*-1}else{this._tabOrder[D[C].ind]=D[C+1].ind}}},i18n:{loading:"Loading",decimal_separator:".",group_separator:","},_key_events:{k13_1_0:function(){var A=this.rowsCol._dhx_find(this.row);this.selectCell(this.rowsCol[A+1],this.cell._cellIndex,true)},k13_0_1:function(){var A=this.rowsCol._dhx_find(this.row);this.selectCell(this.rowsCol[A-1],this.cell._cellIndex,true)},k13_0_0:function(){this.editStop();this.callEvent("onEnter",[(this.row?this.row.idd:null),(this.cell?this.cell._cellIndex:null)]);this._still_active=true},k9_0_0:function(){this.editStop();if(!this.callEvent("onTab",[true])){return true}var A=this._getNextCell(null,1);if(A){this.selectCell(A.parentNode,A._cellIndex,(this.row!=A.parentNode),false,true);this._still_active=true}},k9_0_1:function(){this.editStop();if(!this.callEvent("onTab",[false])){return false}var A=this._getNextCell(null,-1);if(A){this.selectCell(A.parentNode,A._cellIndex,(this.row!=A.parentNode),false,true);this._still_active=true}},k113_0_0:function(){if(this._f2kE){this.editCell()}},k32_0_0:function(){var A=this.cells4(this.cell);if(!A.changeState||(A.changeState()===false)){return false}},k27_0_0:function(){this.editStop(true)},k33_0_0:function(){if(this.pagingOn){this.changePage(this.currentPage-1)}else{this.scrollPage(-1)}},k34_0_0:function(){if(this.pagingOn){this.changePage(this.currentPage+1)}else{this.scrollPage(1)}},k37_0_0:function(){if(!this.editor&&this.isTreeGrid()){this.collapseKids(this.row)}else{return false}},k39_0_0:function(){if(!this.editor&&this.isTreeGrid()){this.expandKids(this.row)}else{return false}},k40_0_0:function(){var B=this._realfake?this._fake:this;if(this.editor&&this.editor.combo){this.editor.shiftNext()}else{if(!this.row.idd){return }var A=Math.max((B._r_select||0),this.getRowIndex(this.row.idd))+1;if(this.rowsBuffer[A]){B._r_select=null;this.selectCell(A,this.cell._cellIndex,true);if(B.pagingOn){B.showRow(B.getRowId(A))}}else{this._key_events.k34_0_0.apply(this,[]);if(this.pagingOn&&this.rowsCol[A]){this.selectCell(A,0,true)}}}this._still_active=true},k38_0_0:function(){var B=this._realfake?this._fake:this;if(this.editor&&this.editor.combo){this.editor.shiftPrev()}else{if(!this.row.idd){return }var A=this.getRowIndex(this.row.idd)+1;if(A!=-1&&(!this.pagingOn||(A!=1))){var C=this._nextRow(A-1,-1);this.selectCell(C,this.cell._cellIndex,true);if(B.pagingOn&&C){B.showRow(C.idd)}}else{this._key_events.k33_0_0.apply(this,[])}}this._still_active=true}},_build_master_row:function(){var C=document.createElement("DIV");var B=["<table><tr>"];for(var A=0;A<this._cCount;A++){B.push("<td></td>")}B.push("</tr></table>");C.innerHTML=B.join("");this._master_row=C.firstChild.rows[0]},_prepareRow:function(A){if(!this._master_row){this._build_master_row()}var C=this._master_row.cloneNode(true);for(var B=0;B<C.childNodes.length;B++){C.childNodes[B]._cellIndex=B;if(this._enbCid){C.childNodes[B].id="c_"+A+"_"+B}if(this.dragAndDropOff){this.dragger.addDraggableItem(C.childNodes[B],this)}}C.idd=A;C.grid=this;return C},_process_jsarray_row:function(B,C){B._attrs={};for(var A=0;A<B.childNodes.length;A++){B.childNodes[A]._attrs={}}this._fillRow(B,(this._c_order?this._swapColumns(C):C));return B},_get_jsarray_data:function(B,A){return B[A]},_process_json_row:function(B,C){B._attrs={};for(var A=0;A<B.childNodes.length;A++){B.childNodes[A]._attrs={}}this._fillRow(B,(this._c_order?this._swapColumns(C.data):C.data));return B},_get_json_data:function(B,A){return B.data[A]},_process_csv_row:function(B,C){B._attrs={};for(var A=0;A<B.childNodes.length;A++){B.childNodes[A]._attrs={}}this._fillRow(B,(this._c_order?this._swapColumns(C.split(this.csv.cell)):C.split(this.csv.cell)));return B},_get_csv_data:function(B,A){return B.split(this.csv.cell)[A]},_process_xml_row:function(A,F){var J=this.xmlLoader.doXPath(this.xml.cell,F);var H=[];A._attrs=this._xml_attrs(F);if(this._ud_enabled){var I=this.xmlLoader.doXPath("./userdata",F);for(var D=I.length-1;D>=0;D--){this.setUserData(A.idd,I[D].getAttribute("name"),I[D].firstChild?I[D].firstChild.data:"")}}for(var C=0;C<J.length;C++){var E=J[this._c_order?this._c_order[C]:C];if(!E){continue}var B=A._childIndexes?A._childIndexes[C]:C;var G=E.getAttribute("type");if(A.childNodes[B]){if(G){A.childNodes[B]._cellType=G}A.childNodes[B]._attrs=this._xml_attrs(E)}if(!E.getAttribute("xmlcontent")){if(E.firstChild){E=E.firstChild.data}else{E=""}}H.push(E)}for(C<J.length;C<A.childNodes.length;C++){A.childNodes[C]._attrs={}}if(A.parentNode&&A.parentNode.tagName=="row"){A._attrs.parent=A.parentNode.getAttribute("idd")}this._fillRow(A,H);return A},_get_xml_data:function(B,A){B=B.firstChild;while(true){if(!B){return""}if(B.tagName=="cell"){A--}if(A<0){break}B=B.nextSibling}return(B.firstChild?B.firstChild.data:"")},_fillRow:function(D,F){if(this.editor){this.editStop()}for(var B=0;B<D.childNodes.length;B++){if((B<F.length)||(this.defVal[B])){var C=D.childNodes[B]._cellIndex;var E=F[C];var A=this.cells4(D.childNodes[B]);if((this.defVal[C])&&((E=="")||(typeof (E)=="undefined"))){E=this.defVal[C]}if(A){A.setValue(E)}}else{D.childNodes[B].innerHTML=" ";D.childNodes[B]._clearCell=true}}return D},_postRowProcessing:function(E,G){if(E._attrs["class"]){E._css=E.className=E._attrs["class"]}if(E._attrs.locked){E._locked=true}if(E._attrs.bgColor){E.bgColor=E._attrs.bgColor}var F=0;for(var B=0;B<E.childNodes.length;B++){var H=E.childNodes[B];var D=H._cellIndex;var C=H._attrs.style||E._attrs.style;if(C){H.style.cssText+=";"+C}if(H._attrs["class"]){H.className=H._attrs["class"]}C=H._attrs.align||this.cellAlign[D];if(C){H.align=C}H.vAlign=H._attrs.valign||this.cellVAlign[D];var A=H._attrs.bgColor||this.columnColor[D];if(A){H.bgColor=A}if(H._attrs.colspan&&!G){this.setColspan(E.idd,B+F,H._attrs.colspan);F+=(H._attrs.colspan-1)}if(this._hrrar&&this._hrrar[D]&&!G){H.style.display="none"}}this.callEvent("onRowCreated",[E.idd,E,null])},load:function(A,C,B){this.callEvent("onXLS",[this]);if(arguments.length==2&&typeof C!="function"){B=C;C=null}B=B||"xml";if(!this.xmlFileUrl){this.xmlFileUrl=A}this._data_type=B;this.xmlLoader.onloadAction=function(F,D,H,G,E){E=F["_process_"+B](E);if(!F._contextCallTimer){F.callEvent("onXLE",[F,0,0,E])}if(C){C();C=null}};this.xmlLoader.loadXML(A)},loadXMLString:function(C,B){var A=new dtmlXMLLoaderObject(function(){});A.loadXMLString(C);this.parse(A,B,"xml")},loadXML:function(A,B){this.load(A,B,"xml")},parse:function(C,B,A){if(arguments.length==2&&typeof B!="function"){A=B;B=null}A=A||"xml";this._data_type=A;C=this["_process_"+A](C);if(!this._contextCallTimer){this.callEvent("onXLE",[this,0,0,C])}if(B){B()}},xml:{top:"rows",row:"./row",cell:"./cell",s_row:"row",s_cell:"cell",row_attrs:[],cell_attrs:[]},csv:{row:"\n",cell:","},_xml_attrs:function(B){var C={};if(B.attributes.length){for(var A=0;A<B.attributes.length;A++){C[B.attributes[A].name]=B.attributes[A].value}}return C},_process_xml:function(A){if(!A.doXPath){var C=new dtmlXMLLoaderObject(function(){});if(typeof A=="string"){C.loadXMLString(A)}else{if(A.responseXML){C.xmlDoc=A}else{C.xmlDoc={}}C.xmlDoc.responseXML=A}A=C}if(this._refresh_mode){return this._refreshFromXML(A)}this._parsing=true;var G=A.getXMLTopNode(this.xml.top);if(G.tagName.toLowerCase()!=this.xml.top){return }this._parseHead(G);var F=A.doXPath(this.xml.row,G);var E=parseInt(A.doXPath("//"+this.xml.top)[0].getAttribute("pos")||0);var D=parseInt(A.doXPath("//"+this.xml.top)[0].getAttribute("total_count")||0);if(D&&!this.rowsBuffer[D-1]){this.rowsBuffer[D-1]=null}if(this.isTreeGrid()){return this._process_tree_xml(A)}for(var B=0;B<F.length;B++){if(this.rowsBuffer[B+E]){continue}var H=F[B].getAttribute("id")||(B+E+1);this.rowsBuffer[B+E]={idd:H,data:F[B],_parser:this._process_xml_row,_locator:this._get_xml_data};this.rowsAr[H]=F[B]}this.render_dataset();this._parsing=false;return A.xmlDoc.responseXML?A.xmlDoc.responseXML:A.xmlDoc},_process_jsarray:function(data){this._parsing=true;if(data&&data.xmlDoc){eval("data="+data.xmlDoc.responseText+";")}for(var i=0;i<data.length;i++){var id=i+1;this.rowsBuffer.push({idd:id,data:data[i],_parser:this._process_jsarray_row,_locator:this._get_jsarray_data});this.rowsAr[id]=data[i]}this.render_dataset();this._parsing=false},_process_csv:function(D){this._parsing=true;if(D.xmlDoc){D=D.xmlDoc.responseText}D=D.replace(/\r/g,"");D=D.split(this.csv.row);if(this._csvHdr){this.clearAll();var C=D.splice(0,1)[0].split(this.csv.cell);if(!this._csvAID){C.splice(0,1)}this.setHeader(C.join(this.delim));this.init()}for(var B=0;B<D.length;B++){if(!D[B]&&B==D.length-1){continue}if(this._csvAID){var E=B+1;this.rowsBuffer.push({idd:E,data:D[B],_parser:this._process_csv_row,_locator:this._get_csv_data})}else{var A=D[B].split(this.csv.cell);var E=A.splice(0,1)[0];this.rowsBuffer.push({idd:E,data:A,_parser:this._process_jsarray_row,_locator:this._get_jsarray_data})}this.rowsAr[E]=D[B]}this.render_dataset();this._parsing=false},_process_json:function(data){this._parsing=true;if(data&&data.xmlDoc){eval("data="+data.xmlDoc.responseText+";")}for(var i=0;i<data.rows.length;i++){var id=data.rows[i].id;this.rowsBuffer.push({idd:id,data:data.rows[i],_parser:this._process_json_row,_locator:this._get_json_data});this.rowsAr[id]=data[i]}this.render_dataset();this._parsing=false},render_dataset:function(C,A){if(this._srnd){if(this._fillers){return this._update_srnd_view()}A=Math.min((this._get_view_size()+(this._srnd_pr||0)),this.rowsBuffer.length)}if(this.pagingOn){C=Math.max((C||0),(this.currentPage-1)*this.rowsBufferOutSize);A=Math.min(this.currentPage*this.rowsBufferOutSize,this.rowsBuffer.length)}else{C=C||0;A=A||this.rowsBuffer.length}for(var B=C;B<A;B++){var E=this.render_row(B);if(E==-1){if(this.xmlFileUrl){if(this.callEvent("onDynXLS",[B,(this._dpref?this._dpref:(A-B))])){this.load(this.xmlFileUrl+getUrlSymbol(this.xmlFileUrl)+"posStart="+B+"&count="+(this._dpref?this._dpref:(A-B)),this._data_type)}}A=B;break}if(!E.parentNode||!E.parentNode.tagName){this._insertRowAt(E,B);if(E._attrs.selected||E._attrs.select){this.selectRow(E,E._attrs.call?true:false,true);E._attrs.selected=E._attrs.select=null}}if(this._ads_count&&B-C==this._ads_count){var D=this;this._context_parsing=this._context_parsing||this._parsing;return this._contextCallTimer=window.setTimeout(function(){D._contextCallTimer=null;D.render_dataset(B,A);if(!D._contextCallTimer){if(D._context_parsing){D.callEvent("onXLE",[])}else{D._fixAlterCss()}D.callEvent("onDistributedEnd",[]);D._context_parsing=false}},this._ads_time)}}if(this._srnd&&!this._fillers){this._fillers=[this._add_filler(A,this.rowsBuffer.length-A)]}this.setSizes()},render_row:function(B){if(!this.rowsBuffer[B]){return -1}if(this.rowsBuffer[B]._parser){var A=this.rowsBuffer[B];if(this.rowsAr[A.idd]&&this.rowsAr[A.idd].tagName=="TR"){return this.rowsBuffer[B]=this.rowsAr[A.idd]}var C=this._prepareRow(A.idd);this.rowsBuffer[B]=C;this.rowsAr[A.idd]=C;A._parser.call(this,C,A.data);this._postRowProcessing(C);return C}return this.rowsBuffer[B]},_get_cell_value:function(B,A,C){if(B._locator){if(this._c_order){A=this._c_order[A]}return B._locator.call(this,B.data,A)}return this.cells3(B,A)[C?C:"getValue"]()},sortRows:function(C,F,B){B=(B||"asc").toLowerCase();F=(F||this.fldSort[C]);C=C||0;if(this.isTreeGrid()){this.sortTreeRows(C,F,B)}else{var A={};var E=this.cellType[C];var G="getValue";if(E=="link"){G="getContent"}if(E=="dhxCalendar"||E=="dhxCalendarA"){G="getDate"}for(var D=0;D<this.rowsBuffer.length;D++){A[this.rowsBuffer[D].idd]=this._get_cell_value(this.rowsBuffer[D],C,G)}this._sortRows(C,F,B,A)}this.callEvent("onAfterSorting",[C,F,B])},_sortCore:function(C,F,B,A,E){var D="sort";if(this._sst){E.stablesort=this.rowsCol.stablesort;D="stablesort"}if(F.length>4){F=window[F]}if(F=="cus"){var G=this._customSorts[C];E[D](function(I,H){return G(A[I.idd],A[H.idd],B,I.idd,H.idd)})}else{if(typeof (F)=="function"){E[D](function(I,H){return F(A[I.idd],A[H.idd],B,I.idd,H.idd)})}else{if(F=="str"){E[D](function(I,H){if(B=="asc"){return A[I.idd]>A[H.idd]?1:-1}else{return A[I.idd]<A[H.idd]?1:-1}})}else{if(F=="int"){E[D](function(J,I){var H=parseFloat(A[J.idd]);H=isNaN(H)?-99999999999999:H;var K=parseFloat(A[I.idd]);K=isNaN(K)?-99999999999999:K;if(B=="asc"){return H-K}else{return K-H}})}else{if(F=="date"){E[D](function(J,I){var H=Date.parse(A[J.idd])||(Date.parse("01/01/1900"));var K=Date.parse(A[I.idd])||(Date.parse("01/01/1900"));if(B=="asc"){return H-K}else{return K-H}})}}}}}},_sortRows:function(C,D,B,A){this._sortCore(C,D,B,A,this.rowsBuffer);this._reset_view();this.callEvent("onGridReconstructed",[])},_reset_view:function(C){if(!this.obj.rows[0]){return }var A=this.obj.rows[0].parentNode;var D=A.removeChild(A.childNodes[0],true);if(_isKHTML){for(var B=A.parentNode.childNodes.length-1;B>=0;B--){if(A.parentNode.childNodes[B].tagName=="TR"){A.parentNode.removeChild(A.parentNode.childNodes[B],true)}}}else{if(_isIE){for(var B=A.childNodes.length-1;B>=0;B--){A.childNodes[B].removeNode(true)}}else{A.innerHTML=""}}A.appendChild(D);this.rowsCol=dhtmlxArray();if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;if(!C){if(_isIE&&this._srnd){this.render_dataset()}else{this.render_dataset()}}},deleteRow:function(B,D){if(!D){D=this.getRowById(B)}if(!D){return }this.editStop();if(!this._realfake){if(this.callEvent("onBeforeRowDeleted",[B])==false){return false}}var A=0;if(this.cellType._dhx_find("tree")!=-1&&!this._realfake){A=this._h2.get[B].parent.id;this._removeTrGrRow(D)}else{if(D.parentNode){D.parentNode.removeChild(D)}var F=this.rowsCol._dhx_find(D);if(F!=-1){this.rowsCol._dhx_removeAt(F)}for(var C=0;C<this.rowsBuffer.length;C++){if(this.rowsBuffer[C]&&this.rowsBuffer[C].idd==B){this.rowsBuffer._dhx_removeAt(C);F=C;break}}}this.rowsAr[B]=null;for(var C=0;C<this.selectedRows.length;C++){if(this.selectedRows[C].idd==B){this.selectedRows._dhx_removeAt(C)}}if(this._srnd){for(var C=0;C<this._fillers.length;C++){var E=this._fillers[C];if(!E){continue}if(E[0]>=F){E[0]=E[0]-1}else{if(E[1]>=F){E[1]=E[1]-1}}}this._update_srnd_view()}if(this.pagingOn){this.changePage()}if(!this._realfake){this.callEvent("onAfterRowDeleted",[B,A])}this.callEvent("onGridReconstructed",[]);if(this._ahgr){this.setSizes()}return true},_addRow:function(A,H,F){if(F==-1||typeof F=="undefined"){F=this.rowsBuffer.length}if(typeof H=="string"){H=H.split(this.delim)}var G=this._prepareRow(A);G._attrs={};for(var B=0;B<G.childNodes.length;B++){G.childNodes[B]._attrs={}}this.rowsAr[G.idd]=G;if(this._h2){this._h2.get[G.idd].buff=G}this._fillRow(G,H);this._postRowProcessing(G);if(this._skipInsert){this._skipInsert=false;return this.rowsAr[G.idd]=G}if(this.pagingOn){this.rowsBuffer._dhx_insertAt(F,G);this.rowsAr[G.idd]=G;return G}if(this._fillers){this.rowsCol._dhx_insertAt(F,null);this.rowsBuffer._dhx_insertAt(F,G);if(this._fake){this._fake.rowsCol._dhx_insertAt(F,null)}this.rowsAr[G.idd]=G;var E=false;for(var C=0;C<this._fillers.length;C++){var D=this._fillers[C];if(D&&D[0]<=F&&(D[0]+D[1])>=F){D[1]=D[1]+1;D[2].firstChild.style.height=parseInt(D[2].firstChild.style.height)+this._srdh+"px";E=true;if(this._fake){this._fake._fillers[C][1]++}}if(D&&D[0]>F){D[0]=D[0]+1;if(this._fake){this._fake._fillers[C][0]++}}}if(!E){this._fillers.push(this._add_filler(F,1,(F==0?{parentNode:this.obj.rows[0].parentNode,nextSibling:(this.rowsCol[1])}:this.rowsCol[F-1])))}return G}this.rowsBuffer._dhx_insertAt(F,G);return this._insertRowAt(G,F)},addRow:function(A,D,C){var B=this._addRow(A,D,C);if(!this.dragContext){this.callEvent("onRowAdded",[A])}if(this.pagingOn){this.changePage(this.currentPage)}if(this._srnd){this._update_srnd_view()}B._added=true;if(this._ahgr){this.setSizes()}this.callEvent("onGridReconstructed",[]);return B},_insertRowAt:function(B,C,A){this.rowsAr[B.idd]=B;if(this._skipInsert){this._skipInsert=false;return B}if((C<0)||((!C)&&(parseInt(C)!==0))){C=this.rowsCol.length}else{if(C>this.rowsCol.length){C=this.rowsCol.length}}if(this._cssEven){if((this._cssSP?this.getLevel(B.idd):C)%2==1){B.className+=" "+this._cssUnEven+(this._cssSU?(" "+this._cssUnEven+"_"+this.getLevel(B.idd)):"")}else{B.className+=" "+this._cssEven+(this._cssSU?(" "+this._cssEven+"_"+this.getLevel(B.idd)):"")}}if(!A){if((C==(this.obj.rows.length-1))||(!this.rowsCol[C])){if(_isKHTML){this.obj.appendChild(B)}else{this.obj.firstChild.appendChild(B)}}else{this.rowsCol[C].parentNode.insertBefore(B,this.rowsCol[C])}}this.rowsCol._dhx_insertAt(C,B);return B},getRowById:function(C){var B=this.rowsAr[C];if(B){if(B.tagName!="TR"){for(var A=0;A<this.rowsBuffer.length;A++){if(this.rowsBuffer[A]&&this.rowsBuffer[A].idd==C){return this.render_row(A)}}if(this._h2){return this.render_row(null,B.idd)}}return B}return null},cellById:function(B,A){return this.cells(B,A)},cells:function(C,B){if(arguments.length==0){return this.cells4(this.cell)}else{var D=this.getRowById(C)}var A=(D._childIndexes?D.childNodes[D._childIndexes[B]]:D.childNodes[B]);return this.cells4(A)},cellByIndex:function(B,A){return this.cells2(B,A)},cells2:function(C,B){var D=this.render_row(C);var A=(D._childIndexes?D.childNodes[D._childIndexes[B]]:D.childNodes[B]);return this.cells4(A)},cells3:function(C,B){var A=(C._childIndexes?C.childNodes[C._childIndexes[B]]:C.childNodes[B]);return this.cells4(A)},cells4:function(A){var B=window["eXcell_"+(A._cellType||this.cellType[A._cellIndex])];if(B){return new B(A)}},cells5:function(A,C){var C=C||(A._cellType||this.cellType[A._cellIndex]);if(!this._ecache[C]){if(!window["eXcell_"+C]){var B=eXcell_ro}else{var B=window["eXcell_"+C]}this._ecache[C]=new B(A)}this._ecache[C].cell=A;return this._ecache[C]},dma:function(A){if(!this._ecache){this._ecache={}}if(A&&!this._dma){this._dma=this.cells4;this.cells4=this.cells5}else{if(!A&&this._dma){this.cells4=this._dma;this._dma=null}}},getRowsNum:function(){return this.rowsBuffer.length},enableEditTabOnly:function(A){if(arguments.length>0){this.smartTabOrder=convertStringToBoolean(A)}else{this.smartTabOrder=true}},setExternalTabOrder:function(C,A){var B=this;this.tabStart=(typeof (C)=="object")?C:document.getElementById(C);this.tabStart.onkeydown=function(E){var D=(E||window.event);if(D.keyCode==9){D.cancelBubble=true;B.selectCell(0,0,0,0,1);if(B.smartTabOrder&&B.cells2(0,0).isDisabled()){B._key_events.k9_0_0.call(B)}this.blur();return false}};if(_isOpera){this.tabStart.onkeypress=this.tabStart.onkeydown}this.tabEnd=(typeof (A)=="object")?A:document.getElementById(A);this.tabEnd.onkeydown=this.tabEnd.onkeypress=function(E){var D=(E||window.event);if((D.keyCode==9)&&D.shiftKey){D.cancelBubble=true;B.selectCell((B.getRowsNum()-1),(B.getColumnCount()-1),0,0,1);if(B.smartTabOrder&&B.cells2((B.getRowsNum()-1),(B.getColumnCount()-1)).isDisabled()){B._key_events.k9_0_1.call(B)}this.blur();return false}};if(_isOpera){this.tabEnd.onkeypress=this.tabEnd.onkeydown}},uid:function(){if(!this._ui_seed){this._ui_seed=(new Date()).valueOf()}return this._ui_seed++},clearAndLoad:function(){var A=this._pgn_skin;this._pgn_skin=null;this.clearAll();this._pgn_skin=A;this.load.apply(this,arguments)},getStateOfView:function(){if(this.pagingOn){var A=(this.currentPage-1)*this.rowsBufferOutSize;return[this.currentPage,A,Math.min(A+this.rowsBufferOutSize,this.rowsBuffer.length),this.rowsBuffer.length]}return[Math.floor(this.objBox.scrollTop/this._srdh),Math.ceil(parseInt(this.objBox.offsetHeight)/this._srdh),this.rowsBuffer.length]}};(function(){function D(G,H){this[G]=H}function F(G,H){this[G].call(this,H)}function C(G,H){this[G].call(this,H.join(this.delim))}function A(G,J){for(var I=0;I<J.length;I++){if(typeof J[I]=="object"){var K=this.getCombo(I);for(var H in J[I]){K.put(H,J[I][H])}}}}function E(G,N,J){var P=1;var M=[];function O(R,Q,S){if(!M[Q]){M[Q]=[]}if(typeof S=="object"){S.toString=function(){return this.text}}M[Q][R]=S}for(var K=0;K<N.length;K++){if(typeof (N[K])=="object"&&N[K].length){for(var I=0;I<N[K].length;I++){O(K,I,N[K][I])}}else{O(K,0,N[K])}}for(var K=0;K<M.length;K++){for(var I=0;I<M[0].length;I++){var L=M[K][I];M[K][I]=(L||"").toString()||" ";if(L&&L.colspan){for(var H=1;H<L.colspan;H++){O(I+H,K,"#cspan")}}if(L&&L.rowspan){for(var H=1;H<L.rowspan;H++){O(I,K+H,"#rspan")}}}}this.setHeader(M[0]);for(var K=1;K<M.length;K++){this.attachHeader(M[K])}}var B=[{name:"label",def:" ",operation:"setHeader",type:E},{name:"id",def:"",operation:"columnIds",type:D},{name:"width",def:"*",operation:"setInitWidths",type:C},{name:"align",def:"left",operation:"cellAlign",type:D},{name:"valign",def:"middle",operation:"cellVAlign",type:D},{name:"sort",def:"na",operation:"fldSort",type:D},{name:"type",def:"ro",operation:"setColTypes",type:C},{name:"options",def:"",operation:"",type:A}];dhtmlx.extend_api("dhtmlXGridObject",{_init:function(G){return[G.parent]},image_path:"setImagePath",columns:"columns",rows:"rows",headers:"headers",skin:"setSkin",smart_rendering:"enableSmartRendering",css:"enableAlterCss",auto_height:"enableAutoHeight",save_hidden:"enableAutoHiddenColumnsSaving",save_cookie:"enableAutoSaving",save_size:"enableAutoSizeSaving",auto_width:"enableAutoWidth",block_selection:"enableBlockSelection",csv_id:"enableCSVAutoID",csv_header:"enableCSVHeader",cell_ids:"enableCellIds",colspan:"enableColSpan",column_move:"enableColumnMove",context_menu:"enableContextMenu",distributed:"enableDistributedParsing",drag:"enableDragAndDrop",drag_order:"enableDragOrder",tabulation:"enableEditTabOnly",header_images:"enableHeaderImages",header_menu:"enableHeaderMenu",keymap:"enableKeyboardSupport",mouse_navigation:"enableLightMouseNavigation",markers:"enableMarkedCells",math_editing:"enableMathEditing",math_serialization:"enableMathSerialization",drag_copy:"enableMercyDrag",multiline:"enableMultiline",multiselect:"enableMultiselect",save_column_order:"enableOrderSaving",hover:"enableRowsHover",rowspan:"enableRowspan",smart:"enableSmartRendering",save_sorting:"enableSortingSaving",stable_sorting:"enableStableSorting",undo:"enableUndoRedo",csv_cell:"setCSVDelimiter",date_format:"setDateFormat",drag_behavior:"setDragBehavior",editable:"setEditable",without_header:"setNoHeader",submit_changed:"submitOnlyChanged",submit_serialization:"submitSerialization",submit_selected:"submitOnlySelected",submit_id:"submitOnlyRowID",xml:"load"},{columns:function(K){for(var G=0;G<B.length;G++){var J=[];for(var H=0;H<K.length;H++){J[H]=K[H][B[G].name]||B[G].def}var I=B[G].type||F;I.call(this,B[G].operation,J,K)}this.init()},rows:function(G){},headers:function(H){for(var G=0;G<H.length;G++){this.attachHeader(H[G])}}})})(); | 96,272 | 96,272 | 0.754602 |
d6ccaba370c72fbcadbbdd3d9fecde11cf9bfcd2 | 1,677 | js | JavaScript | lib/index.js | xuxihai123/vite-plugin-mockit | 62354174f1e33711df9bdfe402cd0a4a10110340 | [
"MIT"
] | 4 | 2020-09-27T07:07:41.000Z | 2021-04-17T03:53:19.000Z | lib/index.js | xuxihai123/vite-plugin-mockit | 62354174f1e33711df9bdfe402cd0a4a10110340 | [
"MIT"
] | 1 | 2021-01-20T02:37:40.000Z | 2021-02-24T14:32:52.000Z | lib/index.js | xuxihai123/vite-plugin-mockit | 62354174f1e33711df9bdfe402cd0a4a10110340 | [
"MIT"
] | 2 | 2021-02-07T13:20:32.000Z | 2021-12-31T10:36:17.000Z | const chalk = require('chalk');
const path = require('path');
const middleware = require('../middleware');
const requireUncache = require('./requireUncache');
const fsWatch = require('./fsWatch');
const logcat = require('./logger');
const utils = require('./utils');
let isDebug = false;
let apiMocker;
module.exports = function (options) {
options = options || {};
if (options.disable) {
return {};
}
if (process.env.NODE_ENV === 'production') {
return {};
}
isDebug = options.debug;
options.entry = options.entry || './mock/index.js';
if (path.isAbsolute(options.entry) === false) {
options.entry = path.resolve(process.cwd(), options.entry);
}
const vitepkg = utils.resolveModulePkg('vite');
if (/^1\./.test(vitepkg.version)) {
logcat.log('detect vite 1.x');
apiMocker = middleware.koa;
} else {
logcat.log('detect vite >2.x');
apiMocker = middleware.connect;
}
fsWatch(options, refreshMock);
return {
configureServer: function (viteServer) {
const app = viteServer.middlewares || viteServer.app;
const middleware = apiMocker({}, mocklogFn);
app.use(middleware);
},
};
function refreshMock(filename) {
try {
const mockObj = requireUncache(options.entry);
apiMocker.refresh(mockObj);
isDebug && logcat.debug('filename change from ' + filename);
logcat.log('Done: Hot Mocker file replacement success!');
} catch (err) {
console.log(chalk.red(err.stack));
}
}
function mocklogFn(type, msg) {
if (type === 'matched') {
logcat.log(type + ' ' + msg);
} else {
isDebug && logcat.debug(type + ' ' + msg);
}
}
};
| 25.029851 | 66 | 0.624329 |
d6cd98ebb1c474e103ad44ac134b1851c21d06b2 | 187 | js | JavaScript | basico/aulas/aula013/ex012.js | eduardopalricas/javascrit | 9b96cd6aef7528ee527c679d6262b21e6286e659 | [
"MIT"
] | null | null | null | basico/aulas/aula013/ex012.js | eduardopalricas/javascrit | 9b96cd6aef7528ee527c679d6262b21e6286e659 | [
"MIT"
] | null | null | null | basico/aulas/aula013/ex012.js | eduardopalricas/javascrit | 9b96cd6aef7528ee527c679d6262b21e6286e659 | [
"MIT"
] | null | null | null | var c = 1
while(c<=6){
console.log('Tudo bem?')
c ++
}
var c=1
do{
console.log('Tudo bem?')
c ++
}while(c<=6)
for(var c=1; c<=6; c++){
console.log('Esta tudo bem?')
}
| 13.357143 | 33 | 0.502674 |
d6d0a74ef86a796774c754271f923dfdd0407831 | 1,209 | js | JavaScript | run_scripts/nodeVersion.js | mherodev/next-demo | 8df578d4148a7bcaf9f34f8e93fe4d01801cd5da | [
"MIT"
] | null | null | null | run_scripts/nodeVersion.js | mherodev/next-demo | 8df578d4148a7bcaf9f34f8e93fe4d01801cd5da | [
"MIT"
] | null | null | null | run_scripts/nodeVersion.js | mherodev/next-demo | 8df578d4148a7bcaf9f34f8e93fe4d01801cd5da | [
"MIT"
] | null | null | null | /* eslint-disable */
var exec = require('child_process').exec;
var required = require('../package.json').engines;
var requiredNode = parseFloat(required.node);
var requiredNpm = parseFloat(required.npm);
var color = { green: '\x1b[32m', red: '\x1b[31m', end: '\x1b[0m' };
exec('node -v && npm -v', function(err, stdout, stderr) {
if (err) {
throw err;
}
var lines = stdout.split('\n');
var currentNode = parseFloat(lines[0].slice(1));
var currentNpm = parseFloat(lines[1]);
var valid = (currentNode >= requiredNode) && (currentNpm >= requiredNpm);
if (!valid) {
var bang = Array(20).join('!') + ' ';
var msgFail = 'Node or NPM version requirement is not met.'
var msgNode = 'Requires Node {0} but found {1}'
.replace('{0}', requiredNode)
.replace('{1}', currentNode);
var msgNpm = 'Requires NPM {0} but found {1}'
.replace('{0}', requiredNpm)
.replace('{1}', currentNpm);
console.log([
color.red,
bang,
bang + msgFail,
bang + msgNode,
bang + msgNpm,
bang,
color.green,
'Node version manager: https://github.com/creationix/nvm',
color.end,
].join('\n'));
process.exit(1);
}
});
| 27.477273 | 75 | 0.595533 |
d6d1884258fbbf29fadf14c0e0000edd78e5ab8c | 8,232 | js | JavaScript | template/conch/html/collection/js/a.js | xinyiweizhen/maccms | 42ea5264e52cafd1e6469bfed5775213c83c64e1 | [
"Apache-2.0"
] | 3 | 2020-07-02T13:24:50.000Z | 2021-04-18T13:25:33.000Z | template/conch/html/collection/js/a.js | kenny67/maccms | 42ea5264e52cafd1e6469bfed5775213c83c64e1 | [
"Apache-2.0"
] | null | null | null | template/conch/html/collection/js/a.js | kenny67/maccms | 42ea5264e52cafd1e6469bfed5775213c83c64e1 | [
"Apache-2.0"
] | 5 | 2020-07-02T13:24:52.000Z | 2021-02-23T08:24:22.000Z | /*
* 加密工具已经升级了一个版本,目前为 jsjiami.com.v6 ,更新了加密算法,缩减了体积;
* 另外 jsjiami.com.v6 已经强制加入校验,注释可以去掉,但是 jsjiami.com.v6 不能去掉,其他都没有任何绑定。
* 誓死不会加入任何后门,JsJiami.com 加密的使命就是为了保护你们的Javascript 。
*/
var _0x15d0=['jsjiami.com.v6','etjXsDKjDiZFZdtfaABmiD.ycom.v6==','Q1VHw77DmMOheSY5wqY=','ZzxSKcKlXcK5wokC','P8KSwqvDt0Zmw6U=','wqnCl8KNw7M=','wonCs8K1wqde','wrjDusONw5Q=','JV5ow7EW','w6h0w7hbw4s=','w7fDhcOlw54R','IMKSwqHDqw==','wpLCjMK3w53Dnw==','MCJ3LHw=','wrwrd8OUw50=','w7RpScOmKg==','Q0IjT8OV','HDFOCkE=','wozChiok','w40+w6BNwoc=','FsOmA8KHaQ==','AcOeG8K8','asOyQknDpcOa','5rG95p2f5puf5aSt5Luf','w5lDfsOMLMOPw6tg','fThcPg==','w5o/BiPCl3/DpcOaw50=','wq0rMVzCgA==','w6fDoMO+w7IS','dHTCqcK2w7Rpcjc=','w5TDgsOHw6E=','wo4zEGPCnDXDn8KrwqM=','w6rDiMObw5g0','wrnDsMKnUw==','B8Kiw705CcOhw4l+','wpczchM=','w5TDhTDCrQ==','wpYlbxVxwo9T','wr/DqMKaVg==','wq3Ci8Kiwo9icBnDtw==','wq3DpsOBw51f','GVvDmsK3','ZMOgw7rDssK3','w6UECSnClQ==','d25Fw6zDtQ==','woA1JHDCnQ==','XsKvwp7Ctjw=','wrg3X1Y=','eCRWwqDCjCM=','QCfDuGY=','wpnDuns7wpbDvMKcwovDsw==','bT7Cl0RV','IjRuO2k=','H8OLN8KrTg==','YDNKL8K2YcKZwrQi','Y18IWcOz','w7F4woLCsW/CgMKqw444','NgYEK28=','5rO55p275puM5aWF5LqC'];(function(_0x400ee0,_0x3877e8,_0x5dbeb8){var _0x3ae503=function(_0x384404,_0xa589b5,_0x4a5396,_0x358605){_0xa589b5=_0xa589b5>>0x8;if(_0xa589b5<_0x384404){while(--_0x384404){_0x358605=_0x400ee0['shift']();if(_0xa589b5===_0x384404){_0xa589b5=_0x358605;_0x4a5396=_0x400ee0['shift']();}else if(_0x4a5396['replace'](/[etXDKDZFZdtfABDy=]/g,'')===_0xa589b5){_0x400ee0['push'](_0x358605);}}_0x400ee0['push'](_0x400ee0['shift']());}return 0x2b7e0;};return _0x3ae503(++_0x3877e8,_0x5dbeb8)>>_0x3877e8^_0x5dbeb8;}(_0x15d0,0x1b1,0x1b100));var _0x2608=function(_0x358198,_0x495c25){_0x358198=~~'0x'['concat'](_0x358198);var _0x13a287=_0x15d0[_0x358198];if(_0x2608['qPViBP']===undefined){(function(){var _0x30dad5=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x4d39a1='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x30dad5['atob']||(_0x30dad5['atob']=function(_0x1bc087){var _0x19438c=String(_0x1bc087)['replace'](/=+$/,'');for(var _0x5f497a=0x0,_0x35b454,_0x3be0e5,_0x5a25c6=0x0,_0xf824b4='';_0x3be0e5=_0x19438c['charAt'](_0x5a25c6++);~_0x3be0e5&&(_0x35b454=_0x5f497a%0x4?_0x35b454*0x40+_0x3be0e5:_0x3be0e5,_0x5f497a++%0x4)?_0xf824b4+=String['fromCharCode'](0xff&_0x35b454>>(-0x2*_0x5f497a&0x6)):0x0){_0x3be0e5=_0x4d39a1['indexOf'](_0x3be0e5);}return _0xf824b4;});}());var _0x382733=function(_0x21b1b8,_0x495c25){var _0xe0e328=[],_0x73629b=0x0,_0x389ecb,_0x52235c='',_0x1c5469='';_0x21b1b8=atob(_0x21b1b8);for(var _0x439bb4=0x0,_0x34e19d=_0x21b1b8['length'];_0x439bb4<_0x34e19d;_0x439bb4++){_0x1c5469+='%'+('00'+_0x21b1b8['charCodeAt'](_0x439bb4)['toString'](0x10))['slice'](-0x2);}_0x21b1b8=decodeURIComponent(_0x1c5469);for(var _0x57ed5d=0x0;_0x57ed5d<0x100;_0x57ed5d++){_0xe0e328[_0x57ed5d]=_0x57ed5d;}for(_0x57ed5d=0x0;_0x57ed5d<0x100;_0x57ed5d++){_0x73629b=(_0x73629b+_0xe0e328[_0x57ed5d]+_0x495c25['charCodeAt'](_0x57ed5d%_0x495c25['length']))%0x100;_0x389ecb=_0xe0e328[_0x57ed5d];_0xe0e328[_0x57ed5d]=_0xe0e328[_0x73629b];_0xe0e328[_0x73629b]=_0x389ecb;}_0x57ed5d=0x0;_0x73629b=0x0;for(var _0x5aea6e=0x0;_0x5aea6e<_0x21b1b8['length'];_0x5aea6e++){_0x57ed5d=(_0x57ed5d+0x1)%0x100;_0x73629b=(_0x73629b+_0xe0e328[_0x57ed5d])%0x100;_0x389ecb=_0xe0e328[_0x57ed5d];_0xe0e328[_0x57ed5d]=_0xe0e328[_0x73629b];_0xe0e328[_0x73629b]=_0x389ecb;_0x52235c+=String['fromCharCode'](_0x21b1b8['charCodeAt'](_0x5aea6e)^_0xe0e328[(_0xe0e328[_0x57ed5d]+_0xe0e328[_0x73629b])%0x100]);}return _0x52235c;};_0x2608['wWvUFb']=_0x382733;_0x2608['NWIORa']={};_0x2608['qPViBP']=!![];}var _0x3d6b8f=_0x2608['NWIORa'][_0x358198];if(_0x3d6b8f===undefined){if(_0x2608['MvursD']===undefined){_0x2608['MvursD']=!![];}_0x13a287=_0x2608['wWvUFb'](_0x13a287,_0x495c25);_0x2608['NWIORa'][_0x358198]=_0x13a287;}else{_0x13a287=_0x3d6b8f;}return _0x13a287;};var yema=0x1;apiready=function(){var _0x117bcb={'fVuOV':function(_0x1fc881,_0x569dca){return _0x1fc881!==_0x569dca;},'zFVdm':'TSrpd','ztXve':function(_0x3965c9){return _0x3965c9();},'LpOwE':'<section\x20class=\x22m-noRecord\x22><img\x20src=\x22../../image/ykl_list_empty_default.png\x22\x20style=\x22width:50%;margin:\x200px\x20auto;\x22>\x20<div\x20class=\x22c-info\x22>快去找些热播剧和大片看看吧</div></section>','PaNIw':function(_0x5a702b,_0x25ecf5){return _0x5a702b>_0x25ecf5;},'qTcTt':function(_0x5698d6,_0x13e9c8){return _0x5698d6(_0x13e9c8);},'tvmqU':'navcattpl','dqxgO':function(_0x26864a,_0x31c306){return _0x26864a+_0x31c306;},'VUaop':'/api.php/user/collection','WiaOj':_0x2608('0','Iy)@'),'PRtMA':'json','ghZvs':_0x2608('1','wY)7')};var _0x4f48da=$api[_0x2608('2','a0Jb')](_0x2608('3','0M%a'));var _0x1885e4=$api['byId'](_0x117bcb[_0x2608('4','D)t^')]);api[_0x2608('5','N7%8')]({'url':_0x117bcb[_0x2608('6','Iq]M')](api_url,_0x117bcb[_0x2608('7','$QJZ')]),'method':_0x117bcb['WiaOj'],'dataType':_0x117bcb[_0x2608('8','s%58')],'data':{'values':{'yema':yema,'user_id':userinfo[_0x117bcb[_0x2608('9','LdA5')]]}}},function(_0x283653,_0x4153d4){var _0x24a715={'pudCM':_0x117bcb['LpOwE']};if(_0x117bcb[_0x2608('a','&N@N')](_0x283653[_0x2608('b','2yq!')][_0x2608('c','((8y')],0x0)){var _0x155002=doT['template'](_0x1885e4[_0x2608('d','EOT7')]);_0x4f48da[_0x2608('e','SS(E')]=_0x117bcb[_0x2608('f','8Jvg')](_0x155002,_0x283653['data']);api['addEventListener']({'name':'scrolltobottom','extra':{'threshold':0x0}},function(_0x283653,_0x4153d4){if(_0x117bcb['fVuOV']('gQCpn',_0x117bcb[_0x2608('10','MPEh')])){_0x117bcb[_0x2608('11','%S[v')](jzgd);}else{_0x4f48da[_0x2608('12','5f*@')]=_0x24a715[_0x2608('13','1zbw')];return;}});}else{_0x4f48da[_0x2608('14','MOzQ')]=_0x117bcb['LpOwE'];return;}});};function jzgd(){var _0x169858={'JDjLm':function(_0x279996){return _0x279996();},'HkApb':function(_0x359a24,_0x1983b2){return _0x359a24(_0x1983b2);},'vkEhY':function(_0x4fdbb5,_0x113554){return _0x4fdbb5!==_0x113554;},'DCvUE':function(_0x2a8ac9,_0x2fd987){return _0x2a8ac9==_0x2fd987;},'tFWLu':function(_0x1284cb,_0x330ca5){return _0x1284cb!==_0x330ca5;},'sYlZB':'Nomcr','hPPtd':_0x2608('15','J(6Z'),'CjSQr':_0x2608('16','MPEh'),'JvOZn':function(_0x3eed16,_0xccb19c){return _0x3eed16===_0xccb19c;},'GGAgp':'RwpeU','JodMV':function(_0x1c559b,_0x35ef30){return _0x1c559b(_0x35ef30);},'RWswP':_0x2608('17','s%58'),'RrQqf':_0x2608('18','5f*@'),'kutgS':function(_0x1644e7,_0x334f97){return _0x1644e7+_0x334f97;},'oKdcu':'/api.php/user/collection','WbZKs':'post','YbsJe':function(_0x3d11d7,_0x196477){return _0x3d11d7+_0x196477;},'hPOsx':_0x2608('19','B@]3')};var _0x25e4f3=$api[_0x2608('1a','%uSy')](_0x169858[_0x2608('1b','0M%a')]);var _0x3a8119=$api['byId'](_0x169858['RrQqf']);api[_0x2608('1c','D)t^')]({'url':_0x169858[_0x2608('1d','58#G')](api_url,_0x169858[_0x2608('1e','Bj4A')]),'method':_0x169858[_0x2608('1f','N%oW')],'dataType':_0x2608('20','B@]3'),'data':{'values':{'yema':_0x169858[_0x2608('21','%uSy')](yema,0x1),'user_id':userinfo[_0x169858[_0x2608('22','MPEh')]]}}},function(_0x55988f,_0x16469f){var _0xed73c0={'WnfdL':function(_0x2cebf3,_0x5f1fee){return _0x169858[_0x2608('23','F0xL')](_0x2cebf3,_0x5f1fee);}};if(_0x55988f){if(_0x169858['vkEhY'](_0x2608('24','qwUS'),_0x2608('25','1zbw'))){if(_0x169858[_0x2608('26','MPEh')](_0x55988f[_0x2608('27','ft@r')]['length'],0x0)){if(_0x169858[_0x2608('28','k^h6')](_0x169858[_0x2608('29','%S[v')],_0x169858['hPPtd'])){api['toast']({'msg':_0x169858['CjSQr'],'duration':0x7d0});return;}else{if(_0x55988f){if(_0x55988f[_0x2608('2a','%S[v')][_0x2608('2b','3KnP')]==0x0){api['toast']({'msg':_0x2608('2c','2yq!'),'duration':0x7d0});return;}else{var _0x1c1060=doT[_0x2608('2d','qwUS')](_0x3a8119[_0x2608('2e','5f*@')]);_0x25e4f3[_0x2608('2f','$QJZ')]+=_0x1c1060(_0x55988f['data']);}}}}else{if(_0x169858[_0x2608('30','LdA5')]('RwpeU',_0x169858[_0x2608('31','N%oW')])){var _0x2fe1fe=doT[_0x2608('32','f3]j')](_0x3a8119[_0x2608('33','N%oW')]);_0x25e4f3[_0x2608('34','LdA5')]+=_0x169858[_0x2608('35','N%oW')](_0x2fe1fe,_0x55988f[_0x2608('36','a0Jb')]);}else{_0x169858['JDjLm'](jzgd);}}}else{var _0x597b48=doT[_0x2608('37','ISW2')](_0x3a8119[_0x2608('38','wY)7')]);_0x25e4f3['innerHTML']+=_0xed73c0['WnfdL'](_0x597b48,_0x55988f['data']);}}});} | 1,372 | 8,049 | 0.735301 |
d6d2a69020d0e53d7ea288a9c5c1055ea7421bc8 | 2,594 | js | JavaScript | public/vendor/calendar/custom/selectable-calendar.js | Sahil00129/laravel-project | 6a09497d5fb533e10cead4b931b4253917cdf0fb | [
"MIT"
] | null | null | null | public/vendor/calendar/custom/selectable-calendar.js | Sahil00129/laravel-project | 6a09497d5fb533e10cead4b931b4253917cdf0fb | [
"MIT"
] | null | null | null | public/vendor/calendar/custom/selectable-calendar.js | Sahil00129/laravel-project | 6a09497d5fb533e10cead4b931b4253917cdf0fb | [
"MIT"
] | null | null | null | document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('selectableCalendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
initialDate: '2020-09-12',
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectMirror: true,
select: function(arg) {
var title = prompt('Event Title:');
if (title) {
calendar.addEvent({
title: title,
start: arg.start,
end: arg.end,
allDay: arg.allDay
})
}
calendar.unselect()
},
eventClick: function(arg) {
if (confirm('Are you sure you want to delete this event?')) {
arg.event.remove()
}
},
editable: true,
dayMaxEvents: true, // allow "more" link when too many events
events: [
{
title: 'All Day Event',
start: '2020-09-01',
color: '#ec4f3d'
},
{
title: 'Long Event',
start: '2020-09-07',
end: '2020-09-10'
},
{
groupId: 999,
title: 'Birthday',
start: '2020-09-09T16:00:00',
color: '#5dab18'
},
{
groupId: 999,
title: 'Birthday',
start: '2020-09-16T16:00:00',
color: '#ec4f3d'
},
{
title: 'Conference',
start: '2020-09-11',
end: '2020-09-13'
},
{
title: 'Meeting',
start: '2020-09-12T10:30:00',
end: '2020-09-12T12:30:00'
},
{
title: 'Lunch',
start: '2020-09-12T12:00:00',
color: '#5dab18'
},
{
title: 'Meeting',
start: '2020-09-12T14:30:00'
},
{
title: 'Interview',
start: '2020-09-12T17:30:00'
},
{
title: 'Meeting',
start: '2020-09-12T20:00:00'
},
{
title: 'Birthday',
start: '2020-09-13T07:00:00',
color: '#5dab18'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2020-09-28',
color: '#5dab18'
}
]
});
calendar.render();
}); | 26.469388 | 69 | 0.432537 |
d6d3484c410efddf1009b81e879fb30a487b0217 | 142 | js | JavaScript | client/components/footer/footer.controller.js | bman4789/YeoMEAN | 97ae4041942c453106190e115ca1490d23b3b122 | [
"MIT"
] | 2 | 2015-04-08T01:07:51.000Z | 2015-09-17T13:34:42.000Z | client/components/footer/footer.controller.js | bman4789/YeoMEAN | 97ae4041942c453106190e115ca1490d23b3b122 | [
"MIT"
] | null | null | null | client/components/footer/footer.controller.js | bman4789/YeoMEAN | 97ae4041942c453106190e115ca1490d23b3b122 | [
"MIT"
] | null | null | null | 'use strict';
angular.module('yeoMeanApp')
.controller('FooterCtrl', function ($scope) {
$scope.year = new Date().getFullYear();
});
| 20.285714 | 47 | 0.647887 |
d6d38c2f426827ca2a82279d50d46bf990d808b8 | 8,992 | js | JavaScript | dist/lib/sendRequest.js | shastajs/tahoe | 1ba8447b78def5f19ede5cabea9d6025c5ee89d3 | [
"MIT"
] | 65 | 2016-01-21T17:09:49.000Z | 2021-05-07T14:08:05.000Z | dist/lib/sendRequest.js | shastajs/tahoe | 1ba8447b78def5f19ede5cabea9d6025c5ee89d3 | [
"MIT"
] | 12 | 2016-02-03T14:16:15.000Z | 2018-06-15T16:35:39.000Z | dist/lib/sendRequest.js | shastajs/tahoe | 1ba8447b78def5f19ede5cabea9d6025c5ee89d3 | [
"MIT"
] | 12 | 2016-02-03T22:54:24.000Z | 2018-08-30T23:36:23.000Z | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _superagent = require('superagent');
var _superagent2 = _interopRequireDefault(_superagent);
var _createEventSource = require('./createEventSource');
var _createEventSource2 = _interopRequireDefault(_createEventSource);
var _qs = require('qs');
var _qs2 = _interopRequireDefault(_qs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createResponseHandler = function createResponseHandler(_ref) {
var options = _ref.options,
dispatch = _ref.dispatch,
reject = _ref.reject,
resolve = _ref.resolve;
var debug = options.method.toUpperCase() + ' ' + options.endpoint;
return function (err, res) {
if (!res && !err) {
err = new Error('Connection failed: ' + debug);
}
if (err) {
err.res = res;
dispatch({
type: 'tahoe.failure',
meta: options,
payload: err
});
if (options.onGlobalError) options.onGlobalError(err, res);
if (options.onError) options.onError(err, res);
return reject(err);
}
// handle json responses
dispatch({
type: 'tahoe.success',
meta: options,
payload: {
raw: res.body,
text: res.text
}
});
if (options.onResponse) options.onResponse(res);
resolve(res);
};
};
exports.default = function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref3) {
var options = _ref3.options,
dispatch = _ref3.dispatch;
var req;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
dispatch({
type: 'tahoe.request',
payload: options
});
if (!options.tail) {
_context.next = 3;
break;
}
return _context.abrupt('return', (0, _createEventSource2.default)({ options: options, dispatch: dispatch }));
case 3:
req = _superagent2.default[options.method.toLowerCase()](options.endpoint);
if (options.headers) {
req.set(options.headers);
}
if (options.query) {
req.query(typeof options.query === 'string' ? options.query : _qs2.default.stringify(options.query, { strictNullHandling: true }));
}
if (options.body) {
req.send(options.body);
}
if (options.withCredentials) {
req.withCredentials();
}
return _context.abrupt('return', new _promise2.default(function (resolve, reject) {
req.end(createResponseHandler({
options: options,
dispatch: dispatch,
reject: reject,
resolve: resolve
}));
}));
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, undefined);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}();
module.exports = exports['default'];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvc2VuZFJlcXVlc3QuanMiXSwibmFtZXMiOlsiY3JlYXRlUmVzcG9uc2VIYW5kbGVyIiwib3B0aW9ucyIsImRpc3BhdGNoIiwicmVqZWN0IiwicmVzb2x2ZSIsImRlYnVnIiwibWV0aG9kIiwidG9VcHBlckNhc2UiLCJlbmRwb2ludCIsImVyciIsInJlcyIsIkVycm9yIiwidHlwZSIsIm1ldGEiLCJwYXlsb2FkIiwib25HbG9iYWxFcnJvciIsIm9uRXJyb3IiLCJyYXciLCJib2R5IiwidGV4dCIsIm9uUmVzcG9uc2UiLCJ0YWlsIiwicmVxIiwicmVxdWVzdCIsInRvTG93ZXJDYXNlIiwiaGVhZGVycyIsInNldCIsInF1ZXJ5IiwicXMiLCJzdHJpbmdpZnkiLCJzdHJpY3ROdWxsSGFuZGxpbmciLCJzZW5kIiwid2l0aENyZWRlbnRpYWxzIiwiZW5kIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7OztBQUNBOzs7O0FBQ0E7Ozs7OztBQUVBLElBQU1BLHdCQUF3QixTQUF4QkEscUJBQXdCLE9BQTRDO0FBQUEsTUFBekNDLE9BQXlDLFFBQXpDQSxPQUF5QztBQUFBLE1BQWhDQyxRQUFnQyxRQUFoQ0EsUUFBZ0M7QUFBQSxNQUF0QkMsTUFBc0IsUUFBdEJBLE1BQXNCO0FBQUEsTUFBZEMsT0FBYyxRQUFkQSxPQUFjOztBQUN4RSxNQUFNQyxRQUFXSixRQUFRSyxNQUFSLENBQWVDLFdBQWYsRUFBWCxTQUEyQ04sUUFBUU8sUUFBekQ7QUFDQSxTQUFPLFVBQUNDLEdBQUQsRUFBTUMsR0FBTixFQUFjO0FBQ25CLFFBQUksQ0FBQ0EsR0FBRCxJQUFRLENBQUNELEdBQWIsRUFBa0I7QUFDaEJBLFlBQU0sSUFBSUUsS0FBSix5QkFBZ0NOLEtBQWhDLENBQU47QUFDRDtBQUNELFFBQUlJLEdBQUosRUFBUztBQUNQQSxVQUFJQyxHQUFKLEdBQVVBLEdBQVY7QUFDQVIsZUFBUztBQUNQVSxjQUFNLGVBREM7QUFFUEMsY0FBTVosT0FGQztBQUdQYSxpQkFBU0w7QUFIRixPQUFUO0FBS0EsVUFBSVIsUUFBUWMsYUFBWixFQUEyQmQsUUFBUWMsYUFBUixDQUFzQk4sR0FBdEIsRUFBMkJDLEdBQTNCO0FBQzNCLFVBQUlULFFBQVFlLE9BQVosRUFBcUJmLFFBQVFlLE9BQVIsQ0FBZ0JQLEdBQWhCLEVBQXFCQyxHQUFyQjtBQUNyQixhQUFPUCxPQUFPTSxHQUFQLENBQVA7QUFDRDs7QUFFRDtBQUNBUCxhQUFTO0FBQ1BVLFlBQU0sZUFEQztBQUVQQyxZQUFNWixPQUZDO0FBR1BhLGVBQVM7QUFDUEcsYUFBS1AsSUFBSVEsSUFERjtBQUVQQyxjQUFNVCxJQUFJUztBQUZIO0FBSEYsS0FBVDtBQVFBLFFBQUlsQixRQUFRbUIsVUFBWixFQUF3Qm5CLFFBQVFtQixVQUFSLENBQW1CVixHQUFuQjtBQUN4Qk4sWUFBUU0sR0FBUjtBQUNELEdBM0JEO0FBNEJELENBOUJEOzs7dUZBZ0NlO0FBQUEsUUFBU1QsT0FBVCxTQUFTQSxPQUFUO0FBQUEsUUFBa0JDLFFBQWxCLFNBQWtCQSxRQUFsQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDYkEscUJBQVM7QUFDUFUsb0JBQU0sZUFEQztBQUVQRSx1QkFBU2I7QUFGRixhQUFUOztBQURhLGlCQU1UQSxRQUFRb0IsSUFOQztBQUFBO0FBQUE7QUFBQTs7QUFBQSw2Q0FPSixpQ0FBa0IsRUFBRXBCLGdCQUFGLEVBQVdDLGtCQUFYLEVBQWxCLENBUEk7O0FBQUE7QUFVUG9CLGVBVk8sR0FVREMscUJBQVF0QixRQUFRSyxNQUFSLENBQWVrQixXQUFmLEVBQVIsRUFBc0N2QixRQUFRTyxRQUE5QyxDQVZDOztBQVdiLGdCQUFJUCxRQUFRd0IsT0FBWixFQUFxQjtBQUNuQkgsa0JBQUlJLEdBQUosQ0FBUXpCLFFBQVF3QixPQUFoQjtBQUNEO0FBQ0QsZ0JBQUl4QixRQUFRMEIsS0FBWixFQUFtQjtBQUNqQkwsa0JBQUlLLEtBQUosQ0FBVSxPQUFPMUIsUUFBUTBCLEtBQWYsS0FBeUIsUUFBekIsR0FDTjFCLFFBQVEwQixLQURGLEdBRU5DLGFBQUdDLFNBQUgsQ0FBYTVCLFFBQVEwQixLQUFyQixFQUE0QixFQUFFRyxvQkFBb0IsSUFBdEIsRUFBNUIsQ0FGSjtBQUdEO0FBQ0QsZ0JBQUk3QixRQUFRaUIsSUFBWixFQUFrQjtBQUNoQkksa0JBQUlTLElBQUosQ0FBUzlCLFFBQVFpQixJQUFqQjtBQUNEO0FBQ0QsZ0JBQUlqQixRQUFRK0IsZUFBWixFQUE2QjtBQUMzQlYsa0JBQUlVLGVBQUo7QUFDRDs7QUF4QlksNkNBMEJOLHNCQUFZLFVBQUM1QixPQUFELEVBQVVELE1BQVYsRUFBcUI7QUFDdENtQixrQkFBSVcsR0FBSixDQUFRakMsc0JBQXNCO0FBQzVCQyxnQ0FENEI7QUFFNUJDLGtDQUY0QjtBQUc1QkMsOEJBSDRCO0FBSTVCQztBQUo0QixlQUF0QixDQUFSO0FBTUQsYUFQTSxDQTFCTTs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxHIiwiZmlsZSI6InNlbmRSZXF1ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHJlcXVlc3QgZnJvbSAnc3VwZXJhZ2VudCdcbmltcG9ydCBjcmVhdGVFdmVudFNvdXJjZSBmcm9tICcuL2NyZWF0ZUV2ZW50U291cmNlJ1xuaW1wb3J0IHFzIGZyb20gJ3FzJ1xuXG5jb25zdCBjcmVhdGVSZXNwb25zZUhhbmRsZXIgPSAoeyBvcHRpb25zLCBkaXNwYXRjaCwgcmVqZWN0LCByZXNvbHZlIH0pID0+IHtcbiAgY29uc3QgZGVidWcgPSBgJHtvcHRpb25zLm1ldGhvZC50b1VwcGVyQ2FzZSgpfSAke29wdGlvbnMuZW5kcG9pbnR9YFxuICByZXR1cm4gKGVyciwgcmVzKSA9PiB7XG4gICAgaWYgKCFyZXMgJiYgIWVycikge1xuICAgICAgZXJyID0gbmV3IEVycm9yKGBDb25uZWN0aW9uIGZhaWxlZDogJHtkZWJ1Z31gKVxuICAgIH1cbiAgICBpZiAoZXJyKSB7XG4gICAgICBlcnIucmVzID0gcmVzXG4gICAgICBkaXNwYXRjaCh7XG4gICAgICAgIHR5cGU6ICd0YWhvZS5mYWlsdXJlJyxcbiAgICAgICAgbWV0YTogb3B0aW9ucyxcbiAgICAgICAgcGF5bG9hZDogZXJyXG4gICAgICB9KVxuICAgICAgaWYgKG9wdGlvbnMub25HbG9iYWxFcnJvcikgb3B0aW9ucy5vbkdsb2JhbEVycm9yKGVyciwgcmVzKVxuICAgICAgaWYgKG9wdGlvbnMub25FcnJvcikgb3B0aW9ucy5vbkVycm9yKGVyciwgcmVzKVxuICAgICAgcmV0dXJuIHJlamVjdChlcnIpXG4gICAgfVxuXG4gICAgLy8gaGFuZGxlIGpzb24gcmVzcG9uc2VzXG4gICAgZGlzcGF0Y2goe1xuICAgICAgdHlwZTogJ3RhaG9lLnN1Y2Nlc3MnLFxuICAgICAgbWV0YTogb3B0aW9ucyxcbiAgICAgIHBheWxvYWQ6IHtcbiAgICAgICAgcmF3OiByZXMuYm9keSxcbiAgICAgICAgdGV4dDogcmVzLnRleHRcbiAgICAgIH1cbiAgICB9KVxuICAgIGlmIChvcHRpb25zLm9uUmVzcG9uc2UpIG9wdGlvbnMub25SZXNwb25zZShyZXMpXG4gICAgcmVzb2x2ZShyZXMpXG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgYXN5bmMgKHsgb3B0aW9ucywgZGlzcGF0Y2ggfSkgPT4ge1xuICBkaXNwYXRjaCh7XG4gICAgdHlwZTogJ3RhaG9lLnJlcXVlc3QnLFxuICAgIHBheWxvYWQ6IG9wdGlvbnNcbiAgfSlcblxuICBpZiAob3B0aW9ucy50YWlsKSB7XG4gICAgcmV0dXJuIGNyZWF0ZUV2ZW50U291cmNlKHsgb3B0aW9ucywgZGlzcGF0Y2ggfSlcbiAgfVxuXG4gIGNvbnN0IHJlcSA9IHJlcXVlc3Rbb3B0aW9ucy5tZXRob2QudG9Mb3dlckNhc2UoKV0ob3B0aW9ucy5lbmRwb2ludClcbiAgaWYgKG9wdGlvbnMuaGVhZGVycykge1xuICAgIHJlcS5zZXQob3B0aW9ucy5oZWFkZXJzKVxuICB9XG4gIGlmIChvcHRpb25zLnF1ZXJ5KSB7XG4gICAgcmVxLnF1ZXJ5KHR5cGVvZiBvcHRpb25zLnF1ZXJ5ID09PSAnc3RyaW5nJ1xuICAgICAgPyBvcHRpb25zLnF1ZXJ5XG4gICAgICA6IHFzLnN0cmluZ2lmeShvcHRpb25zLnF1ZXJ5LCB7IHN0cmljdE51bGxIYW5kbGluZzogdHJ1ZSB9KSlcbiAgfVxuICBpZiAob3B0aW9ucy5ib2R5KSB7XG4gICAgcmVxLnNlbmQob3B0aW9ucy5ib2R5KVxuICB9XG4gIGlmIChvcHRpb25zLndpdGhDcmVkZW50aWFscykge1xuICAgIHJlcS53aXRoQ3JlZGVudGlhbHMoKVxuICB9XG5cbiAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICByZXEuZW5kKGNyZWF0ZVJlc3BvbnNlSGFuZGxlcih7XG4gICAgICBvcHRpb25zLFxuICAgICAgZGlzcGF0Y2gsXG4gICAgICByZWplY3QsXG4gICAgICByZXNvbHZlXG4gICAgfSkpXG4gIH0pXG59XG4iXX0= | 69.169231 | 5,392 | 0.836521 |
d6d46efffb0408697200bd965276349599129a79 | 1,005 | js | JavaScript | index.js | tidysource/tidyuuid | aefd5b615bb9ad241b7b968716f3f61ce696bb49 | [
"MIT"
] | null | null | null | index.js | tidysource/tidyuuid | aefd5b615bb9ad241b7b968716f3f61ce696bb49 | [
"MIT"
] | null | null | null | index.js | tidysource/tidyuuid | aefd5b615bb9ad241b7b968716f3f61ce696bb49 | [
"MIT"
] | null | null | null | //base32hex chars where array index equals value
var chars = [
'0','1','2','3','4','5','6','7','8','9',
'a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t',
'u','v'
];
let counter = 0; //within current milisecond
let lastTime = null; //last timestamp of UUID
module.exports = function UUID(){
let id = '';
//Timestamp to 32 base
let nowTime = new Date().getTime();
/*
Increment counter within single
milisecond to preserve ordering
*/
if (nowTime === lastTime){
++ counter;
}
else{
counter = 0;
lastTime = nowTime;
}
//Convert counter to 32 radix and fix width to 5
let counterStr = counter.toString(32);
counterStr = '00000'.slice(counterStr.length) + counterStr;
//Random number (radix 32)
for(let i=0; i<18; ++i){
//Get random number between 0 and 32 (not including 32)
let number = Math.floor( Math.random() * 32);
id += chars[number];
}
id = [ nowTime.toString(32),
counterStr,
id
].join('');
return id;
};
| 20.9375 | 60 | 0.595025 |
d6d484a0ef00b3ea232b87aef0c6349cfd57cd7c | 233 | js | JavaScript | packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Arc/index.js | kgabryje/superset-ui-plugins-deckgl | 95021e9bfcc420e2fb667c2d699418b1d4ba14e6 | [
"Apache-2.0"
] | 15 | 2019-09-19T13:59:56.000Z | 2021-12-07T02:58:07.000Z | packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Arc/index.js | kgabryje/superset-ui-plugins-deckgl | 95021e9bfcc420e2fb667c2d699418b1d4ba14e6 | [
"Apache-2.0"
] | 84 | 2020-10-29T20:29:10.000Z | 2022-03-21T13:39:33.000Z | packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Arc/index.js | kgabryje/superset-ui-plugins-deckgl | 95021e9bfcc420e2fb667c2d699418b1d4ba14e6 | [
"Apache-2.0"
] | 25 | 2019-09-25T14:41:26.000Z | 2021-11-11T11:43:03.000Z | import { ArcChartPlugin } from '../../../../../superset-ui-legacy-preset-chart-deckgl';
import Stories from './Stories';
new ArcChartPlugin().configure({ key: 'deck_arc' }).register();
export default {
examples: [...Stories],
};
| 25.888889 | 87 | 0.660944 |
d6d4b0e1c64a9d023b855297bf836c3f1ccd1944 | 2,248 | js | JavaScript | cursoBasicoJS/cachipun.js | damiatus/PlatziCourses | 3441c6d8e2a3e7717dcb2287615998ac5e655441 | [
"MIT"
] | null | null | null | cursoBasicoJS/cachipun.js | damiatus/PlatziCourses | 3441c6d8e2a3e7717dcb2287615998ac5e655441 | [
"MIT"
] | null | null | null | cursoBasicoJS/cachipun.js | damiatus/PlatziCourses | 3441c6d8e2a3e7717dcb2287615998ac5e655441 | [
"MIT"
] | null | null | null | //Función para obtener un objeto aleatorio de un array
Array.prototype.sample = function(){
return this[Math.floor(Math.random()*this.length)];
}
//Declaro mis variables a usar
var papel = "papel";
var tijera = "tijera";
var piedra = "piedra";
var jugadas = ["piedra", "papel", "tijera"];
//Declaro mi función
function cachipun(jugada){
var jugadaPC = jugadas.sample(); //Al definir esta variable dentro de la fun ción, se llamará a la funcón sample() cada vez que juege de forma que jugadaPC vaya cambiando.
if (jugada == jugadaPC) { console.log("Empate, jueguen de nuevo");
} else if ((jugada==piedra && jugadaPC==tijera)||(jugada==papel && jugadaPC==piedra)||(jugada==tijera && jugadaPC==papel)){
console.log("Ganaste! :)"); //Acá me pongo solo en los casos en los que puedo ganar
} else {console.log("Perdiste :(")};
}
//Mensaje bonito de presetnación
console.log("Bienvenidos al juego del cachipun");
console.log("Por favor, ingrese su jugada");
//Para jugar basta llamar a la función con la nuestra jugada
cachipun(prompt("ingrese su jugada"));
////////////////////////////////////////////////////////////////////////
Array.prototype.sample = function(){
return this[Math.floor(Math.random()*this.length)];
}
var papel = "papel";
var tijera = "tijera";
var piedra = "piedra";
var jugadas = ["piedra", "papel", "tijera"];
var jugadaPC = jugadas.sample();
console.log(jugadaPC);
var jugada = papel
switch (jugada){
case jugadaPC:
console.log("Empate, jueguen de nuevo");
break;
case piedra:
switch (jugadaPC){
case tijera:
console.log("Ganaste! :)")
break;
default:
console.log("Perdiste :(")
}
break;
case papel:
switch (jugadaPC){
case piedra:
console.log("Ganaste! :)")
break;
default:
console.log("Perdiste :(")
}
break;
case tijera:
switch (jugadaPC){
case papel:
console.log("Ganaste! :)")
break;
default:
console.log("Perdiste :(")
}
break;
}
| 25.83908 | 175 | 0.564057 |
d6d4ea487c3ab562409c125cff90e861258546da | 859 | js | JavaScript | app/static/js/chunk-0bd973f6.115fcc68.js | mohansd/cyx-xElec-server | bef67274ba85d6172ac1ef4dd3df8c8ce86c6c61 | [
"Apache-2.0"
] | null | null | null | app/static/js/chunk-0bd973f6.115fcc68.js | mohansd/cyx-xElec-server | bef67274ba85d6172ac1ef4dd3df8c8ce86c6c61 | [
"Apache-2.0"
] | null | null | null | app/static/js/chunk-0bd973f6.115fcc68.js | mohansd/cyx-xElec-server | bef67274ba85d6172ac1ef4dd3df8c8ce86c6c61 | [
"Apache-2.0"
] | null | null | null | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0bd973f6"],{"548a":function(n,t,e){},"78bb":function(n,t,e){"use strict";e.r(t);var a=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"container"},[e("div",{staticClass:"header"},[e("div",{staticClass:"title"},[n._v("更新设备")]),e("div",{staticClass:"back",on:{click:n.hanleHide}},[e("fa-icon",{attrs:{"icon-name":"undo"}}),n._v("\n 返回\n ")],1)])])},i=[],c={name:"DeviceEdit",components:{},data:function(){return{}},computed:{},created:function(){},mounted:function(){},methods:{hanleHide:function(){this.$emit("hanleHide",!1)}}},s=c,o=(e("7ef2"),e("2877")),u=Object(o["a"])(s,a,i,!1,null,"26fb0aca",null);t["default"]=u.exports},"7ef2":function(n,t,e){"use strict";var a=e("548a"),i=e.n(a);i.a}}]);
//# sourceMappingURL=chunk-0bd973f6.115fcc68.js.map | 429.5 | 807 | 0.639115 |
d6d4fea0db43385ab590fd97d31572c088c87eaa | 609 | js | JavaScript | imports/ui/pages/dashboard.js | felixble/clean-meteor-prototype | f882188da6dbef3f709bbe86a3afa6494caf9bae | [
"MIT"
] | 1 | 2018-05-12T22:50:20.000Z | 2018-05-12T22:50:20.000Z | imports/ui/pages/dashboard.js | felixble/clean-meteor-prototype | f882188da6dbef3f709bbe86a3afa6494caf9bae | [
"MIT"
] | null | null | null | imports/ui/pages/dashboard.js | felixble/clean-meteor-prototype | f882188da6dbef3f709bbe86a3afa6494caf9bae | [
"MIT"
] | null | null | null | import { Template } from 'meteor/templating';
import './dashboard.html';
import '../components/article-list';
import { GatewayFactory } from '../../infrastructure/use-case-gateways';
Template.dashboard.onCreated(function() {
this.editListGateway = GatewayFactory.createEditListGateway();
});
Template.dashboard.helpers({
getRequiredArticles() {
const tmpl = Template.instance();
return tmpl.editListGateway.listRequiredArticles();
},
getAvailableArticles() {
const tmpl = Template.instance();
return tmpl.editListGateway.listAvailableArticles();
}
}); | 26.478261 | 72 | 0.697865 |
d6d55daae92f4244a6fc7d06f390ea4dbeae5ec2 | 5,125 | js | JavaScript | react-native-firebase-starter/src/containers/spaces/SocialSpaceListScreen.js | thurow/social-condominium | 4fea46c3a52f20ccd9eba645468ee20138d5fc60 | [
"MIT"
] | null | null | null | react-native-firebase-starter/src/containers/spaces/SocialSpaceListScreen.js | thurow/social-condominium | 4fea46c3a52f20ccd9eba645468ee20138d5fc60 | [
"MIT"
] | 2 | 2020-04-04T19:23:24.000Z | 2020-04-04T19:23:54.000Z | react-native-firebase-starter/src/containers/spaces/SocialSpaceListScreen.js | thurow/social-condominium | 4fea46c3a52f20ccd9eba645468ee20138d5fc60 | [
"MIT"
] | null | null | null | import React, { Component, Fragment } from 'react'
import { View, Text, ActivityIndicator } from 'react-native'
import SideMenu from 'react-native-side-menu';
import Menu from '../../components/menu/Menu';
import { SafeAreaView } from 'react-navigation';
import Header from '../../components/header/Header';
import { Container, Title } from '../../styles/styles';
import { Image } from 'react-native-elements';
import { FlatList } from 'react-native-gesture-handler';
import AsyncStorage from '@react-native-community/async-storage';
import firebase from 'react-native-firebase';
export class SocialSpaceListScreen extends Component {
state = {
isOpen: false,
isLoading: true,
socialSpaces: []
}
async componentDidMount() {
try {
const { condominium } = JSON.parse(await AsyncStorage.getItem('@user'))
const snapshot = await firebase.firestore().collection('social-space').where('condominium', '==', condominium).get()
this.setState({
socialSpaces: snapshot.docs.map( doc => (
{
id: doc.id,
name: doc.data().space_name,
image_url: doc.data().space_photo_uploaded_url
}
)),
isLoading: false
})
} catch (err) {
console.log(err)
}
}
toggleNav() {
this.setState({
isOpen: !this.state.isOpen
})
}
updateMenuState(isOpen) {
this.setState({ isOpen });
}
_listEmptyComponent = () => {
return (
<View>
<Text>Nenhum Espaço encontrado ;(</Text>
</View>
)
}
render() {
const { navigation } = this.props;
const { socialSpaces, isLoading } = this.state
const menu = <Menu navigation={navigation} />
return (
<Fragment>
<SafeAreaView style={{ flex: 0, backgroundColor: '#eb4444' }} />
<SafeAreaView style={{ flex: 1, backgroundColor: '#3b5998' }}>
<SideMenu
menu={menu}
isOpen={this.state.isOpen}
menuPosition='right'
onChange={isOpen => this.updateMenuState(isOpen)}
>
<Header logged toggleNav={() => this.toggleNav()} />
<Container>
<Title>Alugar Espaço</Title>
{isLoading && <ActivityIndicator size="large" color="#d33028" />}
<FlatList
data={socialSpaces}
style={isLoading === true ? { display: 'none' } : { }}
keyExtractor={space => space.id.toString()}
ListEmptyComponent={this._listEmptyComponent}
renderItem={({item}) =>
<View
style={{
flex: 0,
flexDirection: 'row',
alignItems: 'center',
flexGrow: 1,
marginBottom: 15,
padding:15,
borderWidth: 0.3,
borderRadius: 7,
borderColor: "red"
}}
>
<Image
style={{width: 100, height: 75, marginRight:10}}
source={{uri: item.image_url}} />
<Text
style={{
paddingVertical: 20,
fontSize: 20,
fontWeight:'400',
width: 0,
flexGrow: 1,
flex: 1,
}}
onPress={() => navigation.push('SocialSpace', {
spaceId: item.id
})}
>
{item.name}
</Text>
</View>
}
/>
</Container>
</SideMenu>
</SafeAreaView>
</Fragment>
)
}
}
export default SocialSpaceListScreen
| 41 | 128 | 0.369756 |
d6d5d248b3926a6464852dce2a8ea5914c71b951 | 34 | js | JavaScript | shared/src/services/tst.js | pavlovt/nuxt-blog | 47603118c983b75fbb71e1d12c4e4012157b649e | [
"MIT"
] | null | null | null | shared/src/services/tst.js | pavlovt/nuxt-blog | 47603118c983b75fbb71e1d12c4e4012157b649e | [
"MIT"
] | null | null | null | shared/src/services/tst.js | pavlovt/nuxt-blog | 47603118c983b75fbb71e1d12c4e4012157b649e | [
"MIT"
] | null | null | null | export default {
name: 'tst'
} | 11.333333 | 17 | 0.588235 |
d6d64f723fbf281b232645af8f18da19cf2bae4e | 602 | js | JavaScript | server/models/Log.js | passion-dev37/MERN_Admin_App | d69cf48715fc463723f0d95a0c5c8fc66721e8d6 | [
"MIT"
] | 2 | 2020-04-28T20:38:52.000Z | 2020-04-28T22:17:03.000Z | server/models/Log.js | passion-dev37/MERN_Admin_App | d69cf48715fc463723f0d95a0c5c8fc66721e8d6 | [
"MIT"
] | 5 | 2020-07-23T08:39:32.000Z | 2022-02-26T23:56:05.000Z | server/models/Log.js | passion-dev37/MERN_Admin_App | d69cf48715fc463723f0d95a0c5c8fc66721e8d6 | [
"MIT"
] | 1 | 2020-01-28T21:05:22.000Z | 2020-01-28T21:05:22.000Z | /* eslint-disable no-undef */
/* eslint-disable no-multi-assign */
const mongoose = require("mongoose");
const { Schema } = mongoose;
// Create Schema
const LogSchema = new Schema({
type: {
type: String,
required: true
},
email: {
type: String,
required: true
},
name: {
type: String,
required: true
},
explanation: {
type: String,
required: true
},
role: {
type: String,
required: true
},
company: { type: String },
date_logged: {
type: Date,
default: Date.now
}
});
module.exports = Log = mongoose.model("log", LogSchema);
| 16.27027 | 56 | 0.593023 |
d6d7d72b1461e2c0c76b30053dcf41d3894cba45 | 867 | js | JavaScript | UnitTesting/public/script.js | tanishq9/WebD-Node.js | eaa5ad49d7af30ef1ea51ac790b0780fcbf68fed | [
"Apache-2.0"
] | 1 | 2019-02-04T06:47:35.000Z | 2019-02-04T06:47:35.000Z | UnitTesting/public/script.js | tanishq9/WebD-Node.js | eaa5ad49d7af30ef1ea51ac790b0780fcbf68fed | [
"Apache-2.0"
] | null | null | null | UnitTesting/public/script.js | tanishq9/WebD-Node.js | eaa5ad49d7af30ef1ea51ac790b0780fcbf68fed | [
"Apache-2.0"
] | 1 | 2019-07-14T10:48:54.000Z | 2019-07-14T10:48:54.000Z | $(function(){
let kmBox = $('#km')
let minBox = $('#min')
let calcBtn = $('#calcfare')
let fareDiv = $('#fare')
let rateBtn = $('#getrates')
let rateDiv = $('#rates')
calcBtn.click(function () {
$.post('/calcfare', {
km: kmBox.val(),
min: minBox.val()
}, function (data) {
fareDiv.text('Fare : ' + data.fare)
})
})
rateBtn.click(function () {
$.get('/rate', function (data) {
let prettyRateData = `
Fixed Fare = Rs. ${data.fixed} for ${data.minKm} KM
<br>
Fare (Distance) = Rs. ${data.perKm} / KM (after first 5 km)
<br>
Fare (Waiting) = Rs. ${data.perMin} / min (after first ${data.freeMin} min)
`
rateDiv.html(prettyRateData)
})
})
}) | 24.771429 | 87 | 0.45098 |
d6d8035712707f0936978ec6632b72f8e38e93d6 | 64 | js | JavaScript | graphbrainz/extensions/mediawiki.js | meimecaj/musicquery | 167409bc9cbf63535469163f4733710c16443622 | [
"MIT"
] | 142 | 2016-11-26T02:43:51.000Z | 2022-02-03T05:04:42.000Z | graphbrainz/extensions/mediawiki.js | meimecaj/musicquery | 167409bc9cbf63535469163f4733710c16443622 | [
"MIT"
] | 93 | 2016-11-26T07:45:26.000Z | 2022-01-10T23:18:03.000Z | graphbrainz/extensions/mediawiki.js | meimecaj/musicquery | 167409bc9cbf63535469163f4733710c16443622 | [
"MIT"
] | 35 | 2016-11-27T18:38:17.000Z | 2022-01-30T18:06:57.000Z | export { default } from '../src/extensions/mediawiki/index.js';
| 32 | 63 | 0.71875 |
d6d84252ef1069a1e91b7359cd3c51ac14c6ba17 | 82 | js | JavaScript | src/lib/isEmailValid.js | andrglo/saros | 996a473aec4c090feea1d2ed9900e0803f44b981 | [
"Apache-2.0"
] | 4 | 2019-08-13T14:19:37.000Z | 2020-03-30T17:24:44.000Z | src/lib/isEmailValid.js | andrglo/saros | 996a473aec4c090feea1d2ed9900e0803f44b981 | [
"Apache-2.0"
] | 5 | 2020-04-05T14:41:07.000Z | 2020-09-04T20:31:34.000Z | src/lib/isEmailValid.js | andrglo/saros | 996a473aec4c090feea1d2ed9900e0803f44b981 | [
"Apache-2.0"
] | null | null | null | export default email =>
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(email)
| 27.333333 | 57 | 0.5 |
d6d88f9424b8392ed5c8256782197c9e70cfd5fa | 23,591 | js | JavaScript | dist/js/autoComplete.js | financebrokersnetwork/autoComplete.js | 21000229e749abcfde9c6eb7e6db47904ec92861 | [
"Apache-2.0"
] | null | null | null | dist/js/autoComplete.js | financebrokersnetwork/autoComplete.js | 21000229e749abcfde9c6eb7e6db47904ec92861 | [
"Apache-2.0"
] | null | null | null | dist/js/autoComplete.js | financebrokersnetwork/autoComplete.js | 21000229e749abcfde9c6eb7e6db47904ec92861 | [
"Apache-2.0"
] | null | null | null | (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.autoComplete = factory());
}(this, (function () { 'use strict';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function () {};
return {
s: F,
n: function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function (e) {
throw e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function () {
it = it.call(o);
},
n: function () {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function (e) {
didErr = true;
err = e;
},
f: function () {
try {
if (!normalCompletion && it.return != null) it.return();
} finally {
if (didErr) throw err;
}
}
};
}
var prepareInputField = (function (config) {
var input = config.inputField;
input.setAttribute("role", "combobox");
input.setAttribute("aria-haspopup", true);
input.setAttribute("aria-expanded", false);
input.setAttribute("aria-controls", config.resultsList.idName);
input.setAttribute("aria-autocomplete", "both");
});
var eventEmitter = (function (target, detail, name) {
target.dispatchEvent(new CustomEvent(name, {
bubbles: true,
detail: detail,
cancelable: true
}));
});
var ariaActive$2 = "aria-activedescendant";
var ariaExpanded$1 = "aria-expanded";
var closeList = function closeList(config, target) {
var inputField = config.inputField;
var list = document.getElementById(config.resultsList.idName);
if (list && target !== inputField) {
list.remove();
inputField.removeAttribute(ariaActive$2);
inputField.setAttribute(ariaExpanded$1, false);
eventEmitter(inputField, null, "close");
}
};
var createList = (function (config) {
var list = document.createElement(config.resultsList.element);
list.setAttribute("id", config.resultsList.idName);
list.setAttribute("class", config.resultsList.className);
list.setAttribute("role", "listbox");
var destination = "string" === typeof config.resultsList.destination ? document.querySelector(config.resultsList.destination) : config.resultsList.destination();
destination.insertAdjacentElement(config.resultsList.position, list);
return list;
});
var createItem = (function (data, index, config) {
var item = document.createElement(config.resultItem.element);
item.setAttribute("id", "".concat(config.resultItem.idName, "_").concat(index));
item.setAttribute("class", config.resultItem.className);
item.setAttribute("role", "option");
item.innerHTML = data.match;
if (config.resultItem.content) config.resultItem.content(data, item);
return item;
});
var keyboardEvent = "keydown";
var ariaSelected = "aria-selected";
var ariaActive$1 = "aria-activedescendant";
var navigation = (function (config, dataFeedback) {
config.inputField.removeEventListener(keyboardEvent, config.nav);
var cursor = -1;
var classList = config.resultItem.selected.className.split(" ");
var update = function update(event, list, state) {
event.preventDefault();
if (list.length) {
if (state) {
cursor++;
} else {
cursor--;
}
addActive(list);
config.inputField.setAttribute(ariaActive$1, list[cursor].id);
eventEmitter(event.srcElement, _objectSpread2(_objectSpread2({
event: event
}, dataFeedback), {}, {
selection: dataFeedback.results[cursor]
}), "navigate");
}
};
var removeActive = function removeActive(list) {
Array.from(list).forEach(function (item) {
var _item$classList;
item.removeAttribute(ariaSelected);
if (classList) (_item$classList = item.classList).remove.apply(_item$classList, _toConsumableArray(classList));
});
};
var addActive = function addActive(list) {
var _list$cursor$classLis;
removeActive(list);
if (cursor >= list.length) cursor = 0;
if (cursor < 0) cursor = list.length - 1;
list[cursor].setAttribute(ariaSelected, true);
if (classList) (_list$cursor$classLis = list[cursor].classList).add.apply(_list$cursor$classLis, _toConsumableArray(classList));
};
config.nav = function (event) {
var list = document.getElementById(config.resultsList.idName);
if (list) {
list = list.getElementsByTagName(config.resultItem.element);
switch (event.keyCode) {
case 40:
update(event, list, 1);
break;
case 38:
update(event, list);
break;
case 27:
config.inputField.value = "";
closeList(config);
break;
case 13:
event.preventDefault();
if (cursor >= 0) {
list[cursor].click();
}
break;
case 9:
closeList(config);
break;
}
}
};
config.inputField.addEventListener(keyboardEvent, config.nav);
});
var clickEvent = "click";
var ariaExpanded = "aria-expanded";
var ariaActive = "aria-activedescendant";
var resultsList = (function (config, data) {
var query = data.query,
matches = data.matches,
results = data.results;
var input = config.inputField;
var resultsList = config.resultsList;
var list = document.getElementById(config.resultsList.idName);
if (list) {
list.innerHTML = "";
input.removeAttribute(ariaActive);
} else {
list = createList(config);
input.setAttribute(ariaExpanded, true);
eventEmitter(input, data, "open");
}
if (matches.length) {
results.forEach(function (item, index) {
var resultItem = createItem(item, index, config);
resultItem.addEventListener(clickEvent, function (event) {
var dataFeedback = _objectSpread2(_objectSpread2({
event: event
}, data), {}, {
selection: _objectSpread2(_objectSpread2({}, item), {}, {
index: index
})
});
if (config.onSelection) config.onSelection(dataFeedback);
});
list.appendChild(resultItem);
});
} else {
if (!resultsList.noResults) {
closeList(config);
input.setAttribute(ariaExpanded, false);
} else {
resultsList.noResults(list, query);
}
}
if (resultsList.container) resultsList.container(list, data);
resultsList.navigation ? resultsList.navigation(list) : navigation(config, data);
document.addEventListener(clickEvent, function (event) {
return closeList(config, event.target);
});
});
var formatRawInputValue = function formatRawInputValue(value, config) {
value = value.toLowerCase();
return config.diacritics ? value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").normalize("NFC") : value;
};
var getInputValue = function getInputValue(inputField) {
return inputField instanceof HTMLInputElement || inputField instanceof HTMLTextAreaElement ? inputField.value : inputField.innerHTML;
};
var prepareQuery = function prepareQuery(input, config) {
return config.query && config.query.manipulate ? config.query.manipulate(input) : config.diacritics ? formatRawInputValue(input, config) : formatRawInputValue(input, config);
};
var highlightChar = function highlightChar(className, value) {
return "<span class=\"".concat(className, "\">").concat(value, "</span>");
};
var searchEngine = (function (query, record, config) {
var formattedRecord = formatRawInputValue(record, config);
if (config.searchEngine === "loose") {
query = query.replace(/ /g, "");
var queryLength = query.length;
var cursor = 0;
var match = Array.from(record).map(function (character, index) {
if (cursor < queryLength && formattedRecord[index] === query[cursor]) {
character = config.resultItem.highlight.render ? highlightChar(config.resultItem.highlight.className, character) : character;
cursor++;
}
return character;
}).join("");
if (cursor === queryLength) return match;
} else {
if (formattedRecord.includes(query)) {
var pattern = new RegExp(query.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), "i");
query = pattern.exec(record);
var _match = config.resultItem.highlight.render ? record.replace(query, highlightChar(config.resultItem.highlight.className, query)) : record;
return _match;
}
}
});
var findMatches = (function (config, query) {
var data = config.data,
customSearchEngine = config.searchEngine;
var results = [];
data.store.forEach(function (record, index) {
var search = function search(key) {
var recordValue = (key ? record[key] : record).toString();
var match = typeof customSearchEngine === "function" ? customSearchEngine(query, recordValue) : searchEngine(query, recordValue, config);
if (!match) return;
var result = {
index: index,
match: match,
value: record
};
if (key) result.key = key;
results.push(result);
};
if (data.key) {
var _iterator = _createForOfIteratorHelper(data.key),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var key = _step.value;
search(key);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
} else {
search();
}
});
return results;
});
var checkTriggerCondition = (function (config, event, query) {
return config.trigger.condition ? config.trigger.condition(event, query) : query.length >= config.threshold && query.replace(/ /g, "").length;
});
var debouncer = (function (callback, delay) {
var inDebounce;
return function () {
var context = this;
var args = arguments;
clearTimeout(inDebounce);
inDebounce = setTimeout(function () {
return callback.apply(context, args);
}, delay);
};
});
var autoComplete = function () {
function autoComplete(config) {
_classCallCheck(this, autoComplete);
var _config$selector = config.selector,
selector = _config$selector === void 0 ? "#autoComplete" : _config$selector,
placeHolder = config.placeHolder,
observer = config.observer,
_config$data = config.data,
src = _config$data.src,
key = _config$data.key,
cache = _config$data.cache,
store = _config$data.store,
results = _config$data.results,
query = config.query,
_config$trigger = config.trigger;
_config$trigger = _config$trigger === void 0 ? {} : _config$trigger;
var _config$trigger$event = _config$trigger.event,
event = _config$trigger$event === void 0 ? ["input"] : _config$trigger$event,
condition = _config$trigger.condition,
_config$threshold = config.threshold,
threshold = _config$threshold === void 0 ? 1 : _config$threshold,
_config$debounce = config.debounce,
debounce = _config$debounce === void 0 ? 0 : _config$debounce,
diacritics = config.diacritics,
searchEngine = config.searchEngine,
feedback = config.feedback,
_config$resultsList = config.resultsList;
_config$resultsList = _config$resultsList === void 0 ? {} : _config$resultsList;
var _config$resultsList$r = _config$resultsList.render,
resultsListRender = _config$resultsList$r === void 0 ? true : _config$resultsList$r,
container = _config$resultsList.container,
_config$resultsList$d = _config$resultsList.destination,
destination = _config$resultsList$d === void 0 ? selector : _config$resultsList$d,
_config$resultsList$p = _config$resultsList.position,
position = _config$resultsList$p === void 0 ? "afterend" : _config$resultsList$p,
_config$resultsList$e = _config$resultsList.element,
resultsListElement = _config$resultsList$e === void 0 ? "ul" : _config$resultsList$e,
_config$resultsList$i = _config$resultsList.idName,
resultsListId = _config$resultsList$i === void 0 ? "autoComplete_list" : _config$resultsList$i,
resultsListClass = _config$resultsList.className,
_config$resultsList$m = _config$resultsList.maxResults,
maxResults = _config$resultsList$m === void 0 ? 5 : _config$resultsList$m,
navigation = _config$resultsList.navigation,
noResults = _config$resultsList.noResults,
_config$resultItem = config.resultItem;
_config$resultItem = _config$resultItem === void 0 ? {} : _config$resultItem;
var content = _config$resultItem.content,
_config$resultItem$el = _config$resultItem.element,
resultItemElement = _config$resultItem$el === void 0 ? "li" : _config$resultItem$el,
resultItemId = _config$resultItem.idName,
_config$resultItem$cl = _config$resultItem.className,
resultItemClass = _config$resultItem$cl === void 0 ? "autoComplete_result" : _config$resultItem$cl,
_config$resultItem$hi = _config$resultItem.highlight;
_config$resultItem$hi = _config$resultItem$hi === void 0 ? {} : _config$resultItem$hi;
var highlightRender = _config$resultItem$hi.render,
_config$resultItem$hi2 = _config$resultItem$hi.className,
highlightClass = _config$resultItem$hi2 === void 0 ? "autoComplete_highlighted" : _config$resultItem$hi2,
_config$resultItem$se = _config$resultItem.selected;
_config$resultItem$se = _config$resultItem$se === void 0 ? {} : _config$resultItem$se;
var _config$resultItem$se2 = _config$resultItem$se.className,
selectedClass = _config$resultItem$se2 === void 0 ? "autoComplete_selected" : _config$resultItem$se2,
onSelection = config.onSelection;
this.selector = selector;
this.observer = observer;
this.placeHolder = placeHolder;
this.data = {
src: src,
key: key,
cache: cache,
store: store,
results: results
};
this.query = query;
this.trigger = {
event: event,
condition: condition
};
this.threshold = threshold;
this.debounce = debounce;
this.diacritics = diacritics;
this.searchEngine = searchEngine;
this.feedback = feedback;
this.resultsList = {
render: resultsListRender,
container: container,
destination: destination,
position: position,
element: resultsListElement,
idName: resultsListId,
className: resultsListClass,
maxResults: maxResults,
navigation: navigation,
noResults: noResults
};
this.resultItem = {
content: content,
element: resultItemElement,
idName: resultItemId,
className: resultItemClass,
highlight: {
render: highlightRender,
className: highlightClass
},
selected: {
className: selectedClass
}
};
this.onSelection = onSelection;
this.inputField = typeof this.selector === "string" ? document.querySelector(this.selector) : this.selector();
this.observer ? this.preInit() : this.init();
}
_createClass(autoComplete, [{
key: "start",
value: function start(input, query) {
var results = this.data.results ? this.data.results(findMatches(this, query)) : findMatches(this, query);
var dataFeedback = {
input: input,
query: query,
matches: results,
results: results.slice(0, this.resultsList.maxResults)
};
eventEmitter(this.inputField, dataFeedback, "results");
if (!this.resultsList.render) return this.feedback(dataFeedback);
resultsList(this, dataFeedback);
}
}, {
key: "dataStore",
value: function dataStore() {
var _this = this;
return new Promise(function ($return, $error) {
if (_this.data.cache && _this.data.store) return $return();
return new Promise(function ($return, $error) {
if (typeof _this.data.src === "function") {
return _this.data.src().then($return, $error);
}
return $return(_this.data.src);
}).then(function ($await_5) {
try {
_this.data.store = $await_5;
eventEmitter(_this.inputField, _this.data.store, "fetch");
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}, $error);
});
}
}, {
key: "compose",
value: function compose(event) {
var _this2 = this;
return new Promise(function ($return, $error) {
var input, query, triggerCondition;
input = getInputValue(_this2.inputField);
query = prepareQuery(input, _this2);
triggerCondition = checkTriggerCondition(_this2, event, query);
if (triggerCondition) {
return _this2.dataStore().then(function ($await_6) {
try {
_this2.start(input, query);
return $If_3.call(_this2);
} catch ($boundEx) {
return $error($boundEx);
}
}, $error);
} else {
closeList(_this2);
return $If_3.call(_this2);
}
function $If_3() {
return $return();
}
});
}
}, {
key: "init",
value: function init() {
var _this3 = this;
prepareInputField(this);
if (this.placeHolder) this.inputField.setAttribute("placeholder", this.placeHolder);
this.hook = debouncer(function (event) {
_this3.compose(event);
}, this.debounce);
this.trigger.event.forEach(function (eventType) {
_this3.inputField.addEventListener(eventType, _this3.hook);
});
eventEmitter(this.inputField, null, "init");
}
}, {
key: "preInit",
value: function preInit() {
var _this4 = this;
var callback = function callback(mutations, observer) {
mutations.forEach(function (mutation) {
if (_this4.inputField) {
observer.disconnect();
_this4.init();
}
});
};
var observer = new MutationObserver(callback);
observer.observe(document, {
childList: true,
subtree: true
});
}
}, {
key: "unInit",
value: function unInit() {
var _this5 = this;
this.trigger.event.forEach(function (eventType) {
_this5.inputField.removeEventListener(eventType, _this5.hook);
});
eventEmitter(this.inputField, null, "unInit");
}
}]);
return autoComplete;
}();
return autoComplete;
})));
| 36.182515 | 178 | 0.6054 |
d6d95a1cb22442791a8a78d26b783410bb9b9762 | 1,747 | js | JavaScript | JavaScript Frameworks/Homework Assignments/1. Underscore.js/1. Underscore.js/scripts/data-models.js | vic-alexiev/TelerikAcademy | 251ef33b69dea596eef4caaad674b2ba6489a863 | [
"MIT"
] | 4 | 2015-10-17T11:56:32.000Z | 2017-05-04T20:47:23.000Z | JavaScript Frameworks/Homework Assignments/1. Underscore.js/1. Underscore.js/scripts/data-models.js | vic-alexiev/TelerikAcademy | 251ef33b69dea596eef4caaad674b2ba6489a863 | [
"MIT"
] | null | null | null | JavaScript Frameworks/Homework Assignments/1. Underscore.js/1. Underscore.js/scripts/data-models.js | vic-alexiev/TelerikAcademy | 251ef33b69dea596eef4caaad674b2ba6489a863 | [
"MIT"
] | 13 | 2015-03-05T06:44:55.000Z | 2020-02-15T14:08:10.000Z | var dataModels = (function () {
var Mark = Class.create({
init: function (subject, value) {
this.subject = subject;
this.value = value;
}
});
var Student = Class.create({
init: function (firstName, lastName, age, marks) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.marks = marks;
},
getFullName: function () {
return this.firstName + " " + this.lastName;
},
getAverageMark: function () {
return _.chain(this.marks).map(function (m) {
return m.value;
}).value().reduce(function (a, b) {
return a + b;
}) / this.marks.length;
},
toString: function () {
return this.firstName + " " + this.lastName +
", age: " + this.age + ", avg mark: " + this.getAverageMark().toFixed(2);
}
});
var Animal = Class.create({
init: function (animalClass, species, legsCount) {
this.animalClass = animalClass;
this.species = species;
this.legsCount = legsCount;
},
toString: function () {
return "class: " + this.animalClass +
" species: " + this.species;
}
});
var Book = Class.create({
init: function (title, author) {
this.title = title;
this.author = author;
},
toString: function () {
return "title: " + this.title + " author: " + this.author;
}
});
return {
Student: Student,
Mark: Mark,
Animal: Animal,
Book: Book
};
})(); | 26.074627 | 89 | 0.472811 |
d6d986c359e7970de0d470b686c401810cf91cdc | 13,439 | js | JavaScript | dist/no-classes-transpile/esm/whyDidYouRender.min.js | OliverJAsh/why-did-you-render | 93fb085a162ed768d75c3911d9840eed59059f26 | [
"MIT"
] | null | null | null | dist/no-classes-transpile/esm/whyDidYouRender.min.js | OliverJAsh/why-did-you-render | 93fb085a162ed768d75c3911d9840eed59059f26 | [
"MIT"
] | null | null | null | dist/no-classes-transpile/esm/whyDidYouRender.min.js | OliverJAsh/why-did-you-render | 93fb085a162ed768d75c3911d9840eed59059f26 | [
"MIT"
] | null | null | null | /**
* @welldone-software/why-did-you-render 4.0.6
* MIT Licensed
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman)
* Generated at 2020-04-01
*/
import e from"lodash/get";import r from"lodash/isString";import t from"lodash/reduce";import o from"lodash/has";import n from"lodash/keys";import a from"lodash/isFunction";import i from"lodash/isRegExp";import c from"lodash/isDate";import s from"lodash/isPlainObject";import f from"lodash/isArray";import u from"lodash/defaults";function p(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){p(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function m(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],o=!0,n=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(o=(i=c.next()).done)&&(t.push(i.value),!r||t.length!==r);o=!0);}catch(e){n=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(n)throw a}}return t}(e,r)||y(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,r){if(e){if("string"==typeof e)return v(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(e,r):void 0}}function v(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var g,b="different",k="deepEquals",D="date",R="regex",w="reactElement",O="function",S="function"==typeof Symbol&&Symbol.for,N=S?Symbol.for("react.memo"):60115,E=S?Symbol.for("react.forward_ref"):60112,_=(p(g={},b,"different objects."),p(g,k,"different objects that are equal by value."),p(g,D,"different date objects with the same value."),p(g,R,"different regular expressions with the same value."),p(g,w,"different React elements with the same displayName."),p(g,O,"different functions with the same name."),g),x=!1;function C(e){var r=e.Component,t=e.displayName,o=e.hookName,n=e.prefixMessage,a=e.diffObjType,i=e.differences,c=e.values,s=e.options;i&&i.length>0?(s.consoleLog(p({},t,r),"".concat(n," of ").concat(a," changes:")),i.forEach((function(e){var r=e.pathString,t=e.diffType,n=e.prevValue,i=e.nextValue;s.consoleGroup("%c".concat("hook"===a?"[hook ".concat(o," result]"):"".concat(a,"."),"%c").concat(r,"%c"),"color:".concat(s.diffNameColor,";"),"color:".concat(s.diffPathColor,";"),"color:default;"),s.consoleLog("".concat(_[t]," (more info at ").concat(o?"http://bit.ly/wdyr3":"http://bit.ly/wdyr02",")")),s.consoleLog(p({},"prev ".concat(r),n),"!==",p({},"next ".concat(r),i)),s.consoleGroupEnd()}))):i&&(s.consoleLog(p({},t,r),"".concat(n," the ").concat(a," object itself changed but its values are all equal."),"props"===a?"This could have been avoided by making the component pure, or by preventing its father from re-rendering.":"This usually means this component called setState when no changes in its state actually occurred.","More info at ".concat("http://bit.ly/wdyr02")),s.consoleLog("prev ".concat(a,":"),c.prev," !== ",c.next,":next ".concat(a)))}function j(e){var r=e.Component,t=e.displayName,o=e.hookName,n=e.prevProps,a=e.prevState,i=e.prevHook,c=e.nextProps,s=e.nextState,f=e.nextHook,u=e.reason,l=e.options;if(function(e,r,t){return!x&&(!!t.logOnDifferentValues||(!(!r.whyDidYouRender||!r.whyDidYouRender.logOnDifferentValues)||!(e.propsDifferences&&e.propsDifferences.some((function(e){return e.diffType===b}))||e.stateDifferences&&e.stateDifferences.some((function(e){return e.diffType===b}))||e.hookDifferences&&e.hookDifferences.some((function(e){return e.diffType===b})))))}(u,r,l)){l.consoleGroup("%c".concat(t),"color: ".concat(l.titleColor,";"));var d="Re-rendered because";u.propsDifferences&&(C({Component:r,displayName:t,prefixMessage:d,diffObjType:"props",differences:u.propsDifferences,values:{prev:n,next:c},options:l}),d="And because"),u.stateDifferences&&C({Component:r,displayName:t,prefixMessage:d,diffObjType:"state",differences:u.stateDifferences,values:{prev:a,next:s},options:l}),u.hookDifferences&&C({Component:r,displayName:t,prefixMessage:d,diffObjType:"hook",differences:u.hookDifferences,values:{prev:i,next:f},hookName:o,options:l}),u.propsDifferences||u.stateDifferences||u.hookDifferences||l.consoleLog(p({},t,r),"Re-rendered although props and state objects are the same.","This usually means there was a call to this.forceUpdate() inside the component.","more info at ".concat("http://bit.ly/wdyr02")),l.consoleGroupEnd()}}function P(e){return e&&"undefined"!=typeof module&&module.hot&&module.hot.addStatusHandler&&module.hot.addStatusHandler((function(r){"idle"===r&&(x=!0,setTimeout((function(){x=!1}),e))})),j}var H=function(){};function T(e){return e.displayName||e.name||e.type&&T(e.type)||e.render&&T(e.render)||(r(e)?e:void 0)}var Y="undefined"!=typeof Element,W="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,A=function(e){return e.$$typeof===W};function L(e,r,t,o,n){return t.push({diffType:n,pathString:o,prevValue:e,nextValue:r}),n!==b}function M(e,r,t){try{var u=[];return function e(r,t,u){var p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(r===t)return!0;if(!r||!t)return L(r,t,u,p,b);if(f(r)&&f(t)){var l=r.length;if(l!==t.length)return L(r,t,u,p,b);for(var d=!0,m=l;0!=m--;)e(r[m],t[m],u,"".concat(p,"[").concat(m,"]"))||(d=!1);return L(r,t,u,p,d?k:b)}if(c(r)&&c(t))return r.getTime()===t.getTime()?L(r,t,u,p,D):L(r,t,u,p,b);if(i(r)&&i(t))return r.toString()===t.toString()?L(r,t,u,p,R):L(r,t,u,p,b);if(Y&&r instanceof Element&&t instanceof Element)return L(r,t,u,p,b);if(A(r)&&A(t)){if(r.type!==t.type)return L(r,t,u,p,b);var h=e(r.props,t.props,u,"".concat(p,".props"));return L(r,t,u,p,h?w:b)}if(a(r)&&a(t))return r.name===t.name?L(r,t,u,p,O):L(r,t,u,p,b);if(s(r)&&s(t)){var y=n(r),v=y.length;if(v!==n(t).length)return L(r,t,u,p,b);for(var g=v;0!=g--;)if(!o(t,y[g]))return L(r,t,u,p,b);for(var S=!0,N=v;0!=N--;){var E=y[N];e(r[E],t[E],u,"".concat(p,".").concat(E))||(S=!1)}return L(r,t,u,p,S?k:b)}return L(r,t,u,p,b)}(e,r,u,t),u}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: why-did-you-render couldn't handle circular references in props.",e.name,e.message),!1;throw e}}var I={};function F(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=o.shallow,a=void 0===n||n;if(e===r)return!1;if(!a)return M(e,r);var i=e||I,c=r||I,s=Object.keys(d({},i,{},c));return t(s,(function(e,r){var t=M(i[r],c[r],r);return t&&(e=[].concat(h(e),h(t))),e}),[])}function V(e,r,t,o,n,a){return{propsDifferences:F(e,o),stateDifferences:F(r,n),hookDifferences:F(t,a,{shallow:!1})}}function G(e){var r=e.Component,t=e.displayName,o=e.hookName,n=e.prevProps,a=e.prevState,i=e.prevHook,c=e.nextProps,s=e.nextState,f=e.nextHook;return{Component:r,displayName:t,hookName:o,prevProps:n,prevState:a,prevHook:i,nextProps:c,nextState:s,nextHook:f,options:e.options,reason:V(n,a,i,c,s,f)}}function U(e){return e.prototype&&!!e.prototype.isReactComponent}function $(e){return e.$$typeof===N}function q(e){return e.$$typeof===E}function B(e){var r=e.Component,t=e.displayName,o=e.options,n=e.React,a=e.isHookChange;return!function(e,r){return r.exclude&&r.exclude.length>0&&r.exclude.some((function(r){return r.test(e)}))}(t,o)&&(!1!==r.whyDidYouRender&&((!a||!r.whyDidYouRender||!1!==r.whyDidYouRender.trackHooks)&&!!(r.whyDidYouRender||o.trackAllPureComponents&&(r&&r.prototype instanceof n.PureComponent||$(r))||function(e,r){return r.include&&r.include.length>0&&r.include.some((function(r){return r.test(e)}))}(t,o))))}function z(e,r,t,o){class n extends e{constructor(r,t){var o;super(r,t),o=this,this._WDYR={renderNumber:0};var a=super.render||this.render;a!==e.prototype.render&&(this.render=function(){return n.prototype.render.apply(o),a()})}render(){return this._WDYR.renderNumber++,"isStrictMode"in this._WDYR||(this._WDYR.isStrictMode=function(e){for(var r=e&&e._reactInternalFiber;r;){if(1&r.mode)return!0;r=r.return}return!1}(this)),this._WDYR.isStrictMode&&this._WDYR.renderNumber%2==1||(this._WDYR.prevProps&&o.notifier(G({Component:e,displayName:r,prevProps:this._WDYR.prevProps,prevState:this._WDYR.prevState,nextProps:this.props,nextState:this.state,options:o})),this._WDYR.prevProps=this.props,this._WDYR.prevState=this.state),super.render?super.render():null}}try{n.displayName=r}catch(e){}return u(n,e),n}function J(e,r,t,o,n){var a="string"==typeof e?function(e,r){return function(t){return r.createElement(e,t)}}(e,o):e;function i(){var e=arguments[0],i=o.useRef(),c=i.current;if(i.current=e,c){var s=G({Component:a,displayName:t,prevProps:c,nextProps:e,options:n}),f=s.reason.propsDifferences&&!(r&&0===s.reason.propsDifferences.length);f&&n.notifier(s)}return a.apply(void 0,arguments)}try{i.displayName=t}catch(e){}return i.ComponentForHooksTracking=a,u(i,a),i}function K(r,t,o,n,a){var i=t.path,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current,s=n.useRef();if(!c)return o;var f=c.type.ComponentForHooksTracking||c.type,u=T(f);if(!B({Component:f,displayName:u,options:a,React:n,isHookChange:!0}))return o;var p=s.current;if(s.current=o,p){var l=G({Component:f,displayName:u,hookName:r,prevHook:i?e(p,i):p,nextHook:i?e(o,i):o,options:a});l.reason.hookDifferences&&a.notifier(l)}return o}function Q(e,r,t,o,n){return $(r)?function e(r,t,o,n){var a=r.type,i=U(a),c=q(a),s=$(a),f=c?a.render:a,p=i?z(f,t,0,n):s?e(f,t,o,n):J(f,!0,t,o,n);try{p.displayName=T(f)}catch(e){}p.ComponentForHooksTracking=r,u(p,f);var l=o.memo(c?o.forwardRef(p):p,r.compare);try{l.displayName=t}catch(e){}return u(l,r),l}(r,t,o,n):q(r)?function(e,r,t,o){var n=e.render,a=$(n),i=a?n.type:n,c=J(i,a,r,t,o);c.displayName=T(i),c.ComponentForHooksTracking=i,u(c,i);var s=t.forwardRef(a?t.memo(c,n.compare):c);try{s.displayName=r}catch(e){}return u(s,e),s}(r,t,o,n):U(r)?z(r,t,0,n):J(r,!1,t,o,n)}function X(e,r,t,o,n){if(e.has(r))return e.get(r);var a=Q(0,r,t,o,n);return e.set(r,a),a}var Z={useState:{path:"0"},useReducer:{path:"0"},useContext:!0,useMemo:!0};function ee(e,r){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=console.group,t=console.groupEnd;e.collapseGroups?r=console.groupCollapsed:e.onlyLogs&&(r=console.log,t=H);var o=e.notifier||P("hotReloadBufferMs"in e?e.hotReloadBufferMs:500);return d({include:null,exclude:null,notifier:o,onlyLogs:!1,consoleLog:console.log,consoleGroup:r,consoleGroupEnd:t,logOnDifferentValues:!1,trackHooks:!0,titleColor:"#058",diffNameColor:"blue",diffPathColor:"red",trackExtraHooks:[],trackAllPureComponents:!1},e)}(r),o=e.createElement,n=e.createFactory,a=new WeakMap;if(e.createElement=function(r){for(var n=null,i=null,c=null,s=arguments.length,f=new Array(s>1?s-1:0),u=1;u<s;u++)f[u-1]=arguments[u];try{if(n=("function"==typeof r||$(r)||q(r))&&B({Component:r,displayName:T(r),React:e,options:t}))return i=r&&r.whyDidYouRender&&r.whyDidYouRender.customName||T(r),c=X(a,r,i,e,t),o.apply(e,[c].concat(f))}catch(e){t.consoleLog("whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.",{errorInfo:{error:e,componentNameOrComponent:r,rest:f,options:t,isShouldTrack:n,displayName:i,WDYRPatchedComponent:c}})}return o.apply(e,[r].concat(f))},Object.assign(e.createElement,o),e.createFactory=function(r){var t=e.createElement.bind(null,r);return t.type=r,t},Object.assign(e.createFactory,n),t.trackHooks){var i=Object.entries(Z).map((function(r){var t=m(r,2),o=t[0],n=t[1];return[e,o,n]}));[].concat(h(i),h(t.trackExtraHooks)).forEach((function(r){var o=m(r,3),n=o[0],a=o[1],i=o[2],c=void 0===i?{}:i,s=n[a],f=a[0].toUpperCase()+a.slice(1),u=function(){for(var r=arguments.length,o=new Array(r),n=0;n<r;n++)o[n]=arguments[n];var i=s.call.apply(s,[this].concat(o));return K(a,c,i,e,t),i};Object.defineProperty(u,"name",{value:f,writable:!1}),Object.assign(u,{originalHook:s}),n[a]=u}))}return e.__REVERT_WHY_DID_YOU_RENDER__=function(){Object.assign(e,{createElement:o,createFactory:n}),a=null,[].concat(h(Object.keys(Z).map((function(r){return[e,r]}))),h(t.trackExtraHooks)).forEach((function(e){var r=m(e,2),t=r[0],o=r[1];t[o].originalHook&&(t[o]=t[o].originalHook)})),delete e.__REVERT_WHY_DID_YOU_RENDER__},e}ee.defaultNotifier=j;export default ee;
//# sourceMappingURL=whyDidYouRender.min.js.map
| 1,343.9 | 13,209 | 0.710618 |
d6d9bd264cfd77f1669eed93c34e9f0887789649 | 681 | js | JavaScript | generators/gulp/templates/gulp/tasks/browsersync.js | cmalven/generator-base | 4b1690fd4128e300acd48fefb85c874816bdfce7 | [
"MIT"
] | null | null | null | generators/gulp/templates/gulp/tasks/browsersync.js | cmalven/generator-base | 4b1690fd4128e300acd48fefb85c874816bdfce7 | [
"MIT"
] | 7 | 2019-12-23T15:46:35.000Z | 2021-05-07T11:47:11.000Z | generators/gulp/templates/gulp/tasks/browsersync.js | cmalven/generator-base | 4b1690fd4128e300acd48fefb85c874816bdfce7 | [
"MIT"
] | null | null | null | const config = require('../config');
const gulp = require('gulp');
//
// BrowserSync
//
//////////////////////////////////////////////////////////////////////
/*
Refreshes browser on file changes and syncs scroll/clicks between devices.
*/
module.exports = gulp.task('browserSync', function() {
const options = {
port: <%= Math.ceil(String(Math.floor(Math.random() * 999)).padStart(3, '0') / 10) * 10 + 3000 %>,
open: false,
ui: false,
};
if (config.useProxy) {
options.proxy = config.proxyUrl;
} else {
options.server = {
baseDir: config.serverBaseDir,
};
}
// Initialize Browsersync
global.browserSync.init(null, options);
});
| 21.28125 | 102 | 0.56094 |
d6d9d284c54ae9480db71ba2b225e7b78488278c | 420 | js | JavaScript | primefaces/src/main/type-definitions/specs/components/MethodCtor/input.js | psunde/primefaces | 1bd275a55bad460a687c9bfaef763b29fa407792 | [
"MIT"
] | 1,773 | 2015-01-04T12:18:31.000Z | 2022-03-25T04:42:06.000Z | primefaces/src/main/type-definitions/specs/components/MethodCtor/input.js | psunde/primefaces | 1bd275a55bad460a687c9bfaef763b29fa407792 | [
"MIT"
] | 7,130 | 2015-01-13T12:12:27.000Z | 2022-03-31T19:09:59.000Z | primefaces/src/main/type-definitions/specs/components/MethodCtor/input.js | psunde/primefaces | 1bd275a55bad460a687c9bfaef763b29fa407792 | [
"MIT"
] | 1,076 | 2015-01-13T18:40:26.000Z | 2022-03-31T22:43:17.000Z | /**
* Tests the constructor modifier on a method
*
* @constructor bar
* @method bar ctor bar
* @template {number} bar.S bar template
* @param {number} bar.arg1 bar arg1
* @param {Record<string, S>} bar.arg2 bar arg2
*/
({
/**
* ctor foo
* @constructor
* @template {string} T foo template
* @param {number} arg1 foo arg1
* @param {T[]} arg2 foo arg2
*/
foo(arg1, arg2) {}
}) | 22.105263 | 47 | 0.585714 |
d6db1f161e7c3781a7c045a3845c3c03c299983f | 354 | js | JavaScript | frontend/src/components/NowPlayingArea/SkipSongButton/SkipSongButton.js | unjown/qasong | c36349d25691b5172b7d6172b76fe1f462ba79c7 | [
"ISC"
] | 10 | 2020-11-11T07:41:37.000Z | 2021-02-01T16:07:20.000Z | frontend/src/components/NowPlayingArea/SkipSongButton/SkipSongButton.js | unjown/qasong | c36349d25691b5172b7d6172b76fe1f462ba79c7 | [
"ISC"
] | 80 | 2020-11-11T02:58:44.000Z | 2021-02-07T13:59:15.000Z | frontend/src/components/NowPlayingArea/SkipSongButton/SkipSongButton.js | unjown/qasong | c36349d25691b5172b7d6172b76fe1f462ba79c7 | [
"ISC"
] | 6 | 2020-11-11T07:41:37.000Z | 2020-12-12T03:21:17.000Z | import React from "react";
import IconButton from "@material-ui/core/IconButton";
import SkipNextIcon from "@material-ui/icons/SkipNext";
function SkipSongButton({ skipSong, disabled }) {
return (
<IconButton disabled={disabled} color="secondary" onClick={skipSong}>
<SkipNextIcon />
</IconButton>
);
}
export default SkipSongButton;
| 25.285714 | 73 | 0.725989 |
d6dc1861ae674564845a8bef5a034b00a1ad387c | 270 | js | JavaScript | test/RoundInputTest.js | janna98/IFD4 | 66ff689e9bffb37c3a8d49e08a92e346987d0fff | [
"MIT"
] | null | null | null | test/RoundInputTest.js | janna98/IFD4 | 66ff689e9bffb37c3a8d49e08a92e346987d0fff | [
"MIT"
] | null | null | null | test/RoundInputTest.js | janna98/IFD4 | 66ff689e9bffb37c3a8d49e08a92e346987d0fff | [
"MIT"
] | null | null | null | import { render } from "@testing-library/react";
import RoundInput from "../src/components/RoundInput";
import sinon from "sinon";
describe("RoundInput", () => {
it("renders", () => {
render(<RoundInput onChange={sinon.stub()} placeHolder={"Test"} />);
});
});
| 27 | 72 | 0.640741 |
d6dc256f6cf053699d3f0c377bb8977d531621cc | 301 | js | JavaScript | routes/api/index.js | tkuebler12/ProjectTwo | 234b786fa00293d40e40a7e332a7b2df307ecc82 | [
"MIT"
] | null | null | null | routes/api/index.js | tkuebler12/ProjectTwo | 234b786fa00293d40e40a7e332a7b2df307ecc82 | [
"MIT"
] | 2 | 2021-03-27T17:44:36.000Z | 2021-03-28T14:42:53.000Z | routes/api/index.js | tkuebler12/ProjectTwo | 234b786fa00293d40e40a7e332a7b2df307ecc82 | [
"MIT"
] | null | null | null | const router = require('express').Router();
const userRoutes = require('./userRoutes');
const cardAPI = require('./cardAPI');
const homeRoutes = require('./homeRoutes');
router.use('/users', userRoutes);
router.use('/pokemon', cardAPI);
router.use('/homepage', homeRoutes);
module.exports = router;
| 27.363636 | 43 | 0.710963 |
d6dd5060cff764061ece10d4bd91c762bd6adc17 | 48 | js | JavaScript | nodes/contents/node.js | nodule/github | 99f50487266458a458b3b3a2566b1014cbdf5968 | [
"MIT"
] | null | null | null | nodes/contents/node.js | nodule/github | 99f50487266458a458b3b3a2566b1014cbdf5968 | [
"MIT"
] | null | null | null | nodes/contents/node.js | nodule/github | 99f50487266458a458b3b3a2566b1014cbdf5968 | [
"MIT"
] | null | null | null | output = [$.repo, 'contents', $.branch, $.path]
| 24 | 47 | 0.583333 |
d6de847792b106a1d4b8f151f896478316f85b49 | 90 | js | JavaScript | src/views/educationproviders/index.js | gurpreetweb/farmeeproject | 5b10a88547e60f72e721ac384f2b99b52d301fbb | [
"MIT"
] | null | null | null | src/views/educationproviders/index.js | gurpreetweb/farmeeproject | 5b10a88547e60f72e721ac384f2b99b52d301fbb | [
"MIT"
] | null | null | null | src/views/educationproviders/index.js | gurpreetweb/farmeeproject | 5b10a88547e60f72e721ac384f2b99b52d301fbb | [
"MIT"
] | null | null | null | import educationProviders from "./educationproviders";
export default educationProviders;
| 30 | 54 | 0.855556 |
d6def815e9c8b1fe61a14ddd37f15f826e2ccfce | 3,578 | js | JavaScript | dist/test/xy-plot.js | sqren/react-vis-opbeat | 0b9777bc4aee430476a57979661ae9bc0b8b1092 | [
"MIT"
] | null | null | null | dist/test/xy-plot.js | sqren/react-vis-opbeat | 0b9777bc4aee430476a57979661ae9bc0b8b1092 | [
"MIT"
] | null | null | null | dist/test/xy-plot.js | sqren/react-vis-opbeat | 0b9777bc4aee430476a57979661ae9bc0b8b1092 | [
"MIT"
] | 1 | 2021-07-02T00:09:54.000Z | 2021-07-02T00:09:54.000Z | 'use strict';
var _tape = require('tape');
var _tape2 = _interopRequireDefault(_tape);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _enzyme = require('enzyme');
var _verticalBarSeries = require('../lib/plot/series/vertical-bar-series');
var _verticalBarSeries2 = _interopRequireDefault(_verticalBarSeries);
var _xAxis = require('../lib/plot/x-axis');
var _xAxis2 = _interopRequireDefault(_xAxis);
var _xyPlot = require('../lib/plot/xy-plot');
var _xyPlot2 = _interopRequireDefault(_xyPlot);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Copyright (c) 2016 Uber Technologies, Inc.
//
// 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.
(0, _tape2.default)('Render a stacked bar chart', function (assert) {
var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(
_xyPlot2.default,
{ width: 300, height: 300, stackBy: 'y' },
_react2.default.createElement(_verticalBarSeries2.default, {
data: [{ x: 1, y: 0 }, { x: 2, y: 1 }, { x: 3, y: 2 }]
}),
_react2.default.createElement(_verticalBarSeries2.default, {
data: [{ x: 1, y: 2 }, { x: 2, y: 1 }, { x: 3, y: 0 }] })
));
var renderedVerticalBarsWrapper = wrapper.find(_verticalBarSeries2.default);
assert.deepEqual(renderedVerticalBarsWrapper.at(0).prop('data'), [{ x: 1, y: 0 }, { x: 2, y: 1 }, { x: 3, y: 2 }], 'First bar series data is the same');
assert.deepEqual(renderedVerticalBarsWrapper.at(1).prop('data'), [{ x: 1, y: 2, y0: 0 }, { x: 2, y: 2, y0: 1 }, { x: 3, y: 2, y0: 2 }], 'Second bar series data contains y0 values');
assert.end();
});
(0, _tape2.default)('Render a stacked bar chart with other children', function (assert) {
var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(
_xyPlot2.default,
{ width: 300, height: 300, stackBy: 'y' },
_react2.default.createElement(_xAxis2.default, null),
_react2.default.createElement(_verticalBarSeries2.default, {
data: [{ x: 1, y: 0 }]
}),
_react2.default.createElement(_verticalBarSeries2.default, {
data: [{ x: 1, y: 2 }] }),
_react2.default.createElement('div', null)
));
var renderedVerticalBarsWrapper = wrapper.find(_verticalBarSeries2.default);
assert.deepEqual(renderedVerticalBarsWrapper.at(0).prop('data'), [{ x: 1, y: 0 }], 'First bar series data is the same');
assert.deepEqual(renderedVerticalBarsWrapper.at(1).prop('data'), [{ x: 1, y: 2, y0: 0 }], 'Second bar series data contains y0 values');
assert.end();
}); | 41.126437 | 183 | 0.698994 |
d6e0997d8b7ecc19af5bc635bdcd5201aabc7ad5 | 491 | js | JavaScript | asciiart/static/js/150.5e52e9de.chunk.js | platohe/platohe.github.io | ffd88edc1ef0a07c0e625c253a39726457c3eb01 | [
"Unlicense"
] | null | null | null | asciiart/static/js/150.5e52e9de.chunk.js | platohe/platohe.github.io | ffd88edc1ef0a07c0e625c253a39726457c3eb01 | [
"Unlicense"
] | null | null | null | asciiart/static/js/150.5e52e9de.chunk.js | platohe/platohe.github.io | ffd88edc1ef0a07c0e625c253a39726457c3eb01 | [
"Unlicense"
] | 1 | 2021-01-15T06:36:16.000Z | 2021-01-15T06:36:16.000Z | (this.webpackJsonpawesomeasciiart=this.webpackJsonpawesomeasciiart||[]).push([[150],{742:function(n,_,e){"use strict";e.r(_),_.default="##\n## Ren \n##\n$the_cow = <<EOC;\n $thoughts\n $thoughts\n ____ \n /# /_\\\\_\n | |/$eye\\\\$eye\\\\\n | \\\\\\\\_/_/\n / |_ | \n| ||\\\\_ ~| \n| ||| \\\\/ \n| |||_ \n \\\\// | \n || | \n ||_ \\\\ \n \\\\_| o| \n /\\\\___/ \n / ||||__ \n (___)_)\nEOC\n"}}]);
//# sourceMappingURL=150.5e52e9de.chunk.js.map | 245.5 | 444 | 0.454175 |
d6e11ac96d99ae916a5a90dde3787f8ca50088d5 | 2,671 | js | JavaScript | app.js | IlirImeri/webforza4 | 641508de4cab85bcf4c8c5a7ebc57a626d9112e6 | [
"Apache-2.0"
] | null | null | null | app.js | IlirImeri/webforza4 | 641508de4cab85bcf4c8c5a7ebc57a626d9112e6 | [
"Apache-2.0"
] | 1 | 2021-03-21T20:30:23.000Z | 2021-03-21T20:30:23.000Z | app.js | IlirImeri/webforza4 | 641508de4cab85bcf4c8c5a7ebc57a626d9112e6 | [
"Apache-2.0"
] | 3 | 2021-03-19T09:50:37.000Z | 2021-03-21T19:48:17.000Z | "use strict"
// import AutoLoad from "fastify-autoload"
// import Sensible from "fastify-sensible"
// import Env from "fastify-env"
// import UnderPressure from "under-pressure"
// import S from "fluent-json-schema"
// import { join } from "desm"
// import fastifyNext from "fastify-nextjs"
const AutoLoad = require("fastify-autoload")
const Sensible = require("fastify-sensible")
const Env = require("fastify-env")
const UnderPressure = require("under-pressure")
const S = require("fluent-json-schema")
const path = require("path")
const fastifyNext = require("fastify-nextjs")
module.exports = async function (fastify, opts) {
// It's very common to pass secrets and configuration
// to you application via environment variables.
// The `fastify-env` plugin will expose those configuration
// under `fastify.config` and validate those at startup.
fastify.register(Env, {
schema: S.object()
.prop("NODE_ENV", S.string().required())
.prop("COOKIE_SECRET", S.string().required())
.valueOf(),
})
// Fastify is an extremely lightweight framework, it does very little for you.
// Every feature you might need, such as cookies or database coonnectors
// is provided by external plugins.
// See the list of recognized plugins by the core team! https://www.fastify.io/ecosystem/
// `fastify-sensible` adds many small utilities, such as nice http errors.
fastify.register(Sensible)
// This plugin is especially useful if you expect an high load
// on your application, it measures the process load and returns
// a 503 if the process is undergoing too much stress.
fastify.register(UnderPressure, {
maxEventLoopDelay: 1000,
maxHeapUsedBytes: 1000000000,
maxRssBytes: 1000000000,
maxEventLoopUtilization: 0.98,
})
// This plugin allows to execute the react server side rendering with NextJS Framework
// you must declare your routes inside the after callback or with the fastify.next
fastify.register(fastifyNext, { dev: true })
// Normally you would need to load by hand each plugin. `fastify-autoload` is an utility
// we wrote to solve this specific problems. It loads all the content from the specified
// folder, even the subfolders. Take at look at its documentation, as it's doing a lot more!
// First of all, we require all the plugins that we'll need in our application.
fastify.register(AutoLoad, {
dir: path.join(__dirname, "plugins"),
options: Object.assign({}, opts),
})
// Then, we'll load all of our routes.
fastify.register(AutoLoad, {
dir: path.join(__dirname, "routes"),
dirNameRoutePrefix: false,
options: Object.assign({}, opts),
})
}
| 39.865672 | 94 | 0.720704 |
d6e1504b432cc5549c79654225ea5dffd680edc9 | 1,006 | js | JavaScript | src/users/update.js | Hicore/Hicore | fdc7775c9c85a27132b7f5b5ffd571a74fb6c65c | [
"MIT"
] | 7 | 2021-03-24T17:07:42.000Z | 2021-04-07T06:29:40.000Z | src/users/update.js | Hicore/Hicore | fdc7775c9c85a27132b7f5b5ffd571a74fb6c65c | [
"MIT"
] | 1 | 2021-05-03T13:14:03.000Z | 2021-05-08T09:03:38.000Z | src/users/update.js | hicore/hicore | fdc7775c9c85a27132b7f5b5ffd571a74fb6c65c | [
"MIT"
] | null | null | null | const { updateUserPassword: updateUserPassword } = require('./updateUserPassword');
const { updateUserEmail: updateUserEmail } = require('./updateUserEmail');
const { updateUserProfile: updateUserProfile } = require('./updateUserProfile');
const { updateUserUsername: updateUserUsername } = require('./updateUserUsername');
const { updateGameInfo: updateGameInfo } = require('./updateGameInfo');
const { updateUserProgress: updateUserProgress } = require('./updateUserProgress');
module.exports.updateUser = (jo, socket) => {
switch (jo.type) {
case 'profile':
updateUserProfile(jo, socket);
break;
case 'password':
updateUserPassword(jo, socket);
break;
case 'username':
updateUserUsername(jo, socket);
break;
case 'email':
updateUserEmail(jo, socket);
break;
case 'gameInfo':
updateGameInfo(jo, socket);
break;
case 'progress':
updateUserProgress(jo, socket);
break;
default:
break;
}
};
| 27.189189 | 83 | 0.668986 |
d6e19cc01753a3afd0a9d9f15acc83b9336d9c70 | 10,427 | js | JavaScript | CUDA/matrix_mult/node_modules/typed-function/test/conversion.test.js | leiverandres/HPC_assignments | 54e9099b7834362181c4a05b50b0b179fb7b8e60 | [
"MIT"
] | 5 | 2019-09-15T04:17:50.000Z | 2021-01-04T16:56:43.000Z | node_modules/typed-function/test/conversion.test.js | Alekcy/vacancy-analysis | 0938e90db8827ac33036996b8492df4ebce0ad0c | [
"MIT"
] | 2 | 2020-08-26T15:34:56.000Z | 2021-06-03T21:37:12.000Z | node_modules/typed-function/test/conversion.test.js | Alekcy/vacancy-analysis | 0938e90db8827ac33036996b8492df4ebce0ad0c | [
"MIT"
] | 2 | 2016-08-08T07:00:00.000Z | 2017-05-02T11:02:41.000Z | var assert = require('assert');
var typed = require('../typed-function');
var strictEqualArray = require('./strictEqualArray');
describe('conversion', function () {
before(function () {
typed.conversions = [
{from: 'boolean', to: 'number', convert: function (x) {return +x;}},
{from: 'boolean', to: 'string', convert: function (x) {return x + '';}},
{from: 'number', to: 'string', convert: function (x) {return x + '';}},
{
from: 'string',
to: 'Date',
convert: function (x) {
var d = new Date(x);
return isNaN(d.valueOf()) ? undefined : d;
},
fallible: true // TODO: not yet supported
}
];
});
after(function () {
// cleanup conversions
typed.conversions = [];
});
it('should add conversions to a function with one argument', function() {
var fn = typed({
'string': function (a) {
return a;
}
});
assert.equal(fn(2), '2');
assert.equal(fn(false), 'false');
assert.equal(fn('foo'), 'foo');
});
it('should add a conversion using addConversion', function() {
var typed2 = typed.create();
var conversion = {
from: 'number',
to: 'string',
convert: function (x) {
return x + '';
}
};
assert.equal(typed2.conversions.length, 0);
typed2.addConversion(conversion);
assert.equal(typed2.conversions.length, 1);
assert.strictEqual(typed2.conversions[0], conversion);
});
it('should throw an error when passing an invalid conversion object to addConversion', function() {
var typed2 = typed.create();
var errMsg = /TypeError: Object with properties \{from: string, to: string, convert: function} expected/;
assert.throws(function () {typed2.addConversion({})}, errMsg);
assert.throws(function () {typed2.addConversion({from: 'number', to: 'string'})}, errMsg);
assert.throws(function () {typed2.addConversion({from: 'number', convert: function () {}})}, errMsg);
assert.throws(function () {typed2.addConversion({to: 'string', convert: function () {}})}, errMsg);
assert.throws(function () {typed2.addConversion({from: 2, to: 'string', convert: function () {}})}, errMsg);
assert.throws(function () {typed2.addConversion({from: 'number', to: 2, convert: function () {}})}, errMsg);
assert.throws(function () {typed2.addConversion({from: 'number', to: 'string', convert: 'foo'})}, errMsg);
});
it('should add conversions to a function with multiple arguments', function() {
// note: we add 'string, string' first, and `string, number` afterwards,
// to test whether the conversions are correctly ordered.
var fn = typed({
'string, string': function (a, b) {
assert.equal(typeof a, 'string');
assert.equal(typeof b, 'string');
return 'string, string';
},
'string, number': function (a, b) {
assert.equal(typeof a, 'string');
assert.equal(typeof b, 'number');
return 'string, number';
}
});
assert.equal(fn(true, false), 'string, number');
assert.equal(fn(true, 2), 'string, number');
assert.equal(fn(true, 'foo'), 'string, string');
assert.equal(fn(2, false), 'string, number');
assert.equal(fn(2, 3), 'string, number');
assert.equal(fn(2, 'foo'), 'string, string');
assert.equal(fn('foo', true), 'string, number');
assert.equal(fn('foo', 2), 'string, number');
assert.equal(fn('foo', 'foo'), 'string, string');
assert.deepEqual(Object.keys(fn.signatures).sort(), ['string,number', 'string,string']);
});
it('should add conversions to a function with variable arguments (1)', function() {
var sum = typed({
'...number': function (values) {
assert(Array.isArray(values));
var sum = 0;
for (var i = 0; i < values.length; i++) {
sum += values[i];
}
return sum;
}
});
assert.equal(sum(2,3,4), 9);
assert.equal(sum(2,true,4), 7);
assert.equal(sum(1,2,false), 3);
assert.equal(sum(1,2,true), 4);
assert.equal(sum(true,1,2), 4);
assert.equal(sum(true,false, true), 2);
});
it('should add conversions to a function with variable arguments (2)', function() {
var sum = typed({
'string, ...number': function (name, values) {
assert.equal(typeof name, 'string');
assert(Array.isArray(values));
var sum = 0;
for (var i = 0; i < values.length; i++) {
sum += values[i];
}
return sum;
}
});
assert.equal(sum('foo', 2,3,4), 9);
assert.equal(sum('foo', 2,true,4), 7);
assert.equal(sum('foo', 1,2,false), 3);
assert.equal(sum('foo', 1,2,true), 4);
assert.equal(sum('foo', true,1,2), 4);
assert.equal(sum('foo', true,false, true), 2);
assert.equal(sum(123, 2,3), 5);
assert.equal(sum(false, 2,3), 5);
});
it('should add conversions to a function with variable arguments in a non-conflicting way', function() {
var fn = typed({
'...number': function (values) {
assert(Array.isArray(values));
var sum = 0;
for (var i = 0; i < values.length; i++) {
sum += values[i];
}
return sum;
},
'boolean': function (value) {
assert.equal(typeof value, 'boolean');
return 'boolean';
}
});
assert.equal(fn(2,3,4), 9);
assert.equal(fn(false), 'boolean');
assert.equal(fn(true), 'boolean');
assert.throws(function () {fn(2,true,4)}, /TypeError: Unexpected type of argument in function unnamed \(expected: number, actual: boolean, index: 1\)/);
assert.throws(function () {fn(true,2,4)}, /TypeError: Too many arguments in function unnamed \(expected: 1, actual: 3\)/);
});
it('should add conversions to a function with variable and union arguments', function() {
var fn = typed({
'...string | number': function (values) {
assert(Array.isArray(values));
return values;
}
});
strictEqualArray(fn(2,3,4), [2,3,4]);
strictEqualArray(fn(2,true,4), [2,1,4]);
strictEqualArray(fn(2,'str'), [2,'str']);
strictEqualArray(fn('str', true, false), ['str', 1, 0]);
strictEqualArray(fn('str', 2, false), ['str', 2, 0]);
assert.throws(function () {fn(new Date(), '2')}, /TypeError: Unexpected type of argument in function unnamed \(expected: string or number, actual: Date, index: 0\)/)
});
it('should add non-conflicting conversions to a function with one argument', function() {
var fn = typed({
'number': function (a) {
return a;
},
'string': function (a) {
return a;
}
});
// booleans should be converted to number
assert.strictEqual(fn(false), 0);
assert.strictEqual(fn(true), 1);
// numbers and strings should be left as is
assert.strictEqual(fn(2), 2);
assert.strictEqual(fn('foo'), 'foo');
});
it('should add non-conflicting conversions to a function with one argument', function() {
var fn = typed({
'boolean': function (a) {
return a;
}
});
// booleans should be converted to number
assert.equal(fn(false), 0);
assert.equal(fn(true), 1);
});
it('should add non-conflicting conversions to a function with two arguments', function() {
var fn = typed({
'boolean, boolean': function (a, b) {
return 'boolean, boolean';
},
'number, number': function (a, b) {
return 'number, number';
}
});
//console.log('FN', fn.toString());
// booleans should be converted to number
assert.equal(fn(false, true), 'boolean, boolean');
assert.equal(fn(2, 4), 'number, number');
assert.equal(fn(false, 4), 'number, number');
assert.equal(fn(2, true), 'number, number');
});
it('should add non-conflicting conversions to a function with three arguments', function() {
var fn = typed({
'boolean, boolean, boolean': function (a, b, c) {
return 'booleans';
},
'number, number, number': function (a, b, c) {
return 'numbers';
}
});
//console.log('FN', fn.toString());
// booleans should be converted to number
assert.equal(fn(false, true, true), 'booleans');
assert.equal(fn(false, false, 5), 'numbers');
assert.equal(fn(false, 4, false), 'numbers');
assert.equal(fn(2, false, false), 'numbers');
assert.equal(fn(false, 4, 5), 'numbers');
assert.equal(fn(2, false, 5), 'numbers');
assert.equal(fn(2, 4, false), 'numbers');
assert.equal(fn(2, 4, 5), 'numbers');
});
it('should insert conversions when having an any type argument', function() {
var fn = typed({
'number': function (a) {
return 'number';
},
'any': function (a) {
return 'any';
}
});
// booleans should be converted to number
assert.equal(fn(2), 'number');
assert.equal(fn(true), 'number');
assert.equal(fn('foo'), 'any');
assert.equal(fn('{}'), 'any');
});
describe ('ordering', function () {
it('should correctly select the signatures with the least amount of conversions', function () {
typed.conversions = [
{from: 'number', to: 'string', convert: function (x) {return x + '';}},
{from: 'boolean', to: 'string', convert: function (x) {return x + '';}},
{from: 'boolean', to: 'number', convert: function (x) {return +x;}}
];
var fn = typed({
'boolean, boolean': function (a, b) {
assert.equal(typeof a, 'boolean');
assert.equal(typeof b, 'boolean');
return 'booleans';
},
'number, number': function (a, b) {
assert.equal(typeof a, 'number');
assert.equal(typeof b, 'number');
return 'numbers';
},
'string, string': function (a, b) {
assert.equal(typeof a, 'string');
assert.equal(typeof b, 'string');
return 'strings';
}
});
assert.equal(fn(true, true), 'booleans');
assert.equal(fn(2, true), 'numbers');
assert.equal(fn(true, 2), 'numbers');
assert.equal(fn(2, 2), 'numbers');
assert.equal(fn('foo', 'bar'), 'strings');
assert.equal(fn('foo', 2), 'strings');
assert.equal(fn(2, 'foo'), 'strings');
assert.equal(fn(true, 'foo'), 'strings');
assert.equal(fn('foo', true), 'strings');
});
})
});
| 32.996835 | 169 | 0.574278 |
d6e3e1201ea60c6bf4688a34e7b96c1d5cebde14 | 1,159 | js | JavaScript | router.js | DimaCrafter/node-api-core | 03cc8580c789523aebd17c04b13c585660fe59b4 | [
"MIT"
] | 12 | 2018-09-14T15:03:03.000Z | 2021-12-22T04:38:09.000Z | router.js | DimaCrafter/node-api-core | 03cc8580c789523aebd17c04b13c585660fe59b4 | [
"MIT"
] | 10 | 2019-01-31T13:11:39.000Z | 2021-05-29T09:25:42.000Z | router.js | DimaCrafter/node-api-core | 03cc8580c789523aebd17c04b13c585660fe59b4 | [
"MIT"
] | 16 | 2019-10-03T14:12:45.000Z | 2021-05-01T18:05:52.000Z | const { getController, getActionCaller } = require("./utils/loader");
module.exports = {
routes: [],
register (pattern, target) {
const params = [];
pattern = pattern.replace(/\${([a-zA-z0-9_]+)}/g, (_, param) => {
params.push(param);
return '(.*?)';
});
if (typeof target == 'string') {
target = target.split('.');
const controller = getController(target[0]);
target = getActionCaller(controller, controller[target[1]]);
}
const route = { target };
if (params.length) {
route.pattern = new RegExp('^' + pattern + '$');
route.params = params;
} else {
route.pattern = pattern;
route.isText = true;
}
this.routes.push(route);
return route;
},
match (path) {
for (const route of this.routes) {
if (route.isText) {
if (route.pattern == path) return { target: route.target };
else continue;
} else {
let matched = route.pattern.exec(path);
if (matched) {
let params = {};
for (let i = 0; i < route.params.length; i++) {
params[route.params[i]] = matched[i + 1];
}
return { target: route.target, params };
} else {
continue;
}
}
}
}
};
| 22.288462 | 69 | 0.576359 |
d6e432286665dab171aaaee22ee94bbffbeb360c | 150 | js | JavaScript | insertMultipleItemsInList.js | roxkisrover/helpers | 41b6fdcca0fb63cf31721564481017f3607358a0 | [
"MIT"
] | 1 | 2020-04-30T04:56:37.000Z | 2020-04-30T04:56:37.000Z | insertMultipleItemsInList.js | roxkisrover/helpers | 41b6fdcca0fb63cf31721564481017f3607358a0 | [
"MIT"
] | null | null | null | insertMultipleItemsInList.js | roxkisrover/helpers | 41b6fdcca0fb63cf31721564481017f3607358a0 | [
"MIT"
] | 1 | 2020-04-30T04:56:23.000Z | 2020-04-30T04:56:23.000Z | export const insertMultipleItemsInList = (list, index, newItems = []) => [
...list.slice(0, index),
...newItems,
...list.slice(index),
];
| 25 | 74 | 0.6 |
d6e4c9e8f79ce63dea31d9c9f0506c384c4985e1 | 95 | js | JavaScript | JavaScript/8 kyu/legacy(to be del)/Convert a Number to a String!/solution.js | Hsins/CodeWars | 7e7b912fdd0647c0af381d8b566408e383ea5df8 | [
"MIT"
] | 1 | 2020-01-09T21:47:56.000Z | 2020-01-09T21:47:56.000Z | JavaScript/8 kyu/legacy(to be del)/Convert a Number to a String!/solution.js | Hsins/CodeWars | 7e7b912fdd0647c0af381d8b566408e383ea5df8 | [
"MIT"
] | 1 | 2020-01-20T12:39:03.000Z | 2020-01-20T12:39:03.000Z | JavaScript/8 kyu/legacy(to be del)/Convert a Number to a String!/solution.js | Hsins/CodeWars | 7e7b912fdd0647c0af381d8b566408e383ea5df8 | [
"MIT"
] | null | null | null | function numberToString(num) {
// Return a string of the number here!
return String(num);
} | 23.75 | 40 | 0.715789 |
d6e72521d688dba3a22f77f60718f2c90ccd3670 | 710 | js | JavaScript | tools/test/test-non-iterables.js | JoshuaWise/jellypromise | efea2efc223453fe2c78fc2f40b954a92c3f681e | [
"MIT"
] | 5 | 2016-06-25T04:51:44.000Z | 2017-09-14T21:48:34.000Z | tools/test/test-non-iterables.js | JoshuaWise/jellypromise | efea2efc223453fe2c78fc2f40b954a92c3f681e | [
"MIT"
] | null | null | null | tools/test/test-non-iterables.js | JoshuaWise/jellypromise | efea2efc223453fe2c78fc2f40b954a92c3f681e | [
"MIT"
] | null | null | null | 'use strict'
var toString = require('./to-string')
// This function runs the given test several times, once for each possible
// non-iterable value. Each non-iterable value is passed as the first argument
// to the given test function.
module.exports = function (test) {
function testInput(value) {
specify('given: ' + toString(value), function () {
return test(value)
})
}
testInput(undefined)
testInput(null)
testInput(0)
testInput(123)
testInput(NaN)
testInput(Infinity)
testInput(true)
testInput(false)
testInput({})
testInput(function () {})
if (typeof Symbol === 'function') {
testInput(Symbol())
}
if (typeof Symbol !== 'function' || !Symbol.iterator) {
testInput('foo')
}
}
| 23.666667 | 78 | 0.694366 |
d6e8a69edfa3383c5080e92f0870d603a57b2e51 | 743 | js | JavaScript | src/HomeView.js | Danielcresp/musily | 3af56e160ea11412c32ad84c12b29bfcfea55c38 | [
"MIT"
] | null | null | null | src/HomeView.js | Danielcresp/musily | 3af56e160ea11412c32ad84c12b29bfcfea55c38 | [
"MIT"
] | null | null | null | src/HomeView.js | Danielcresp/musily | 3af56e160ea11412c32ad84c12b29bfcfea55c38 | [
"MIT"
] | null | null | null | import React, {Component} from 'react';
import {StyleSheet,View} from 'react-native';
import AlbumList from './AlbumList';
require('console');
type Props = {};
export default class HomeView extends Component<Props> {
render() {
const album = {
image: 'https://upload.wikimedia.org/wikipedia/en/4/42/Beatles_-_Abbey_Road.jpg',
name: 'The Beatles - "Abbey Road',
likes: 200,
comments: 140,
}
const albums = Array(500).fill(album)
return (
<View style={styles.container}>
<AlbumList albums={albums}/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex:1,
backgroundColor:'#C2E4F1',
marginTop: 30,
width: '100%',
height:'100%',
},
}); | 23.21875 | 87 | 0.615074 |
d6e98b0b94c13b81999b6de6c482b3521b73182a | 65 | js | JavaScript | app/components/app-chart.js | abcum/ember-app | 4e23cce659d43df69d3a342c44a1de6d80662b76 | [
"MIT"
] | 2 | 2019-05-25T17:37:47.000Z | 2020-01-14T13:57:02.000Z | app/components/app-chart.js | abcum/ember-app | 4e23cce659d43df69d3a342c44a1de6d80662b76 | [
"MIT"
] | null | null | null | app/components/app-chart.js | abcum/ember-app | 4e23cce659d43df69d3a342c44a1de6d80662b76 | [
"MIT"
] | 1 | 2019-11-08T07:07:34.000Z | 2019-11-08T07:07:34.000Z | export { default } from '@abcum/ember-app/components/app-chart';
| 32.5 | 64 | 0.738462 |
d6ec1e2d9bb5543e871a98d6ea8849d60e70804b | 870 | js | JavaScript | src/Context/authContext.js | railsonrodrigues/react-salary | 514285a34cdf41c6b445102cc7e47852e6c37a2b | [
"MIT"
] | 5 | 2021-01-10T14:17:31.000Z | 2021-01-22T05:41:19.000Z | src/Context/authContext.js | railsonrodrigues/react-salary | 514285a34cdf41c6b445102cc7e47852e6c37a2b | [
"MIT"
] | null | null | null | src/Context/authContext.js | railsonrodrigues/react-salary | 514285a34cdf41c6b445102cc7e47852e6c37a2b | [
"MIT"
] | null | null | null | import React, {createContext, useEffect, useState} from 'react';
const Context = createContext();
function AuthProvider ({children}) {
const [authenticated, setAuthenticated] = useState(false);
const [loading, setLoading] = useState(true);
const handleLogin = () => {
localStorage.setItem('token', 'abc123')
setAuthenticated(true)
}
const handleLogout = () => {
localStorage.removeItem('token')
setAuthenticated(false)
}
useEffect(() => {
const token = localStorage.getItem('token');
if(token) {
setAuthenticated(true)
}
setTimeout(() => {
setLoading(false)
}, 500)
}, [])
if (loading) {
return <h1>LOADING...</h1>
}
return (
<Context.Provider value={{ authenticated, handleLogin, handleLogout }}>
{children}
</Context.Provider>
)
}
export { AuthProvider, Context }; | 20.714286 | 75 | 0.631034 |
d6ed7a56258ca97e3e13cb71020d2c9f0ad5aa7a | 2,567 | js | JavaScript | src/components/Blocks/CustomCardsBlock/index.js | eea/volto-freshwater | 9549d4c480fbbce4e7c01620c98fc4e7993bb913 | [
"MIT"
] | 1 | 2021-07-16T06:44:38.000Z | 2021-07-16T06:44:38.000Z | src/components/Blocks/CustomCardsBlock/index.js | eea/volto-freshwater | 9549d4c480fbbce4e7c01620c98fc4e7993bb913 | [
"MIT"
] | 1 | 2021-12-14T16:26:20.000Z | 2021-12-14T16:26:20.000Z | src/components/Blocks/CustomCardsBlock/index.js | eea/volto-freshwater | 9549d4c480fbbce4e7c01620c98fc4e7993bb913 | [
"MIT"
] | null | null | null | import React from 'react';
import {
BlockStyleWrapperEdit,
BlockStyleWrapperView,
} from '@eeacms/volto-block-style/BlockStyleWrapper';
import CustomCardsView from './View';
import CustomCardsEdit from './Edit';
import { PlainCardsSchemaExtender } from './templates/PlainCards/schema';
import PlainCardsView from './templates/PlainCards/PlainCardsView';
import { ColoredCardsSchemaExtender } from './templates/ColoredCards/schema';
import ColoredCardsView from './templates/ColoredCards/ColoredCardsView';
import { PresentationCardsSchemaExtender } from './templates/PresentationCards/schema';
import PresentationCardsView from './templates/PresentationCards/PresentationCardsView';
import { MetadataCardsSchemaExtender } from './templates/MetadataCards/schema';
import MetadataCardsView from './templates/MetadataCards/MetadataCardsView';
import AttachedImageWidget from './Widgets/AttachedImageWidget';
import TextAlignWidget from './Widgets/TextAlign';
import UrlWidget from '@plone/volto/components/manage/Widgets/UrlWidget';
import cardsSVG from '@plone/volto/icons/apps.svg';
export default (config) => {
config.blocks.blocksConfig.customCardsBlock = {
id: 'customCardsBlock',
title: 'Cards block',
icon: cardsSVG,
group: 'freshwater_addons',
view: (props) => (
<BlockStyleWrapperView {...props}>
<CustomCardsView {...props} />
</BlockStyleWrapperView>
),
edit: (props) => (
<BlockStyleWrapperEdit {...props}>
<CustomCardsEdit {...props} />
</BlockStyleWrapperEdit>
),
restricted: false,
mostUsed: false,
sidebarTab: 1,
blockRenderers: {
colored_cards: {
title: 'Colored cards',
schemaExtender: ColoredCardsSchemaExtender,
view: ColoredCardsView,
},
plain_cards: {
title: 'Plain cards',
schemaExtender: PlainCardsSchemaExtender,
view: PlainCardsView,
},
presentation_cards: {
title: 'Presentation Cards',
schemaExtender: PresentationCardsSchemaExtender,
view: PresentationCardsView,
},
metadata_cards: {
title: 'Metadata Cards',
schemaExtender: MetadataCardsSchemaExtender,
view: MetadataCardsView,
},
},
security: {
addPermission: [],
view: [],
},
};
if (!config.widgets.widget.attachedimage) {
config.widgets.widget.attachedimage = AttachedImageWidget;
}
config.widgets.widget.text_align = TextAlignWidget;
config.widgets.widget.object_by_path = UrlWidget;
return config;
};
| 32.493671 | 88 | 0.702766 |
d6edb0d8649c4d64f98b070b5050a5e51b77f0d2 | 1,467 | js | JavaScript | src/components/Restitution/00-intro/IntroQuestions.js | electriccitizen/mlsa-calculator | 297ab89ef7075ae8e570cbaf919cd2b7ddb3bb69 | [
"MIT"
] | null | null | null | src/components/Restitution/00-intro/IntroQuestions.js | electriccitizen/mlsa-calculator | 297ab89ef7075ae8e570cbaf919cd2b7ddb3bb69 | [
"MIT"
] | 1 | 2021-01-29T19:56:41.000Z | 2021-01-29T19:56:41.000Z | src/components/Restitution/00-intro/IntroQuestions.js | electriccitizen/mlsa-calculator | 297ab89ef7075ae8e570cbaf919cd2b7ddb3bb69 | [
"MIT"
] | 2 | 2022-01-26T10:20:44.000Z | 2022-03-03T10:18:48.000Z | import React from "react"
import { FormizStep } from "@formiz/core"
import { SectionHeader } from "../../Utils/SectionHeader"
import {
List,
ListItem,
ListIcon,
} from "@chakra-ui/react"
import { FaCheckCircle } from "react-icons/fa/index"
export const IntroQuestions = () => {
return (
<FormizStep
label={"Additional questions?"}
name="introQuestions"
order={1000}
>
<SectionHeader header={"Have additional questions?"} />
<List spacing={4}>
<ListItem>
<ListIcon as={FaCheckCircle} color="brand.400" />A victim advocate may
be able to help you with this restitution workbook. You can find a
Crime Victim Advocates near you using the <a isExternal href={"https://www.mocadsv.org/how-to-get-help/"}>MCADSV resource map</a>.
</ListItem>
<ListItem>
<ListIcon as={FaCheckCircle} color="brand.400" />
The Montana Department of Justice, Office for Victim Services
Restitution Officer may also be able to answer questions about
restitution. Contact the Restitution Officer at 406-444-7847
</ListItem>
<ListItem>
<ListIcon as={FaCheckCircle} color="brand.400" />
If you need legal help, you can apply for free legal assistance from
Montana Legal Services Association. Call the MLSA HelpLine toll free
at 1-800-666-6899.
</ListItem>
</List>
</FormizStep>
)
}
| 35.780488 | 140 | 0.641445 |
d6eeac81839fa625f99da9c917c95f3ccee10262 | 2,909 | js | JavaScript | src/pages/Cart/CartSummary/CartSummaryElements.js | eryk-M/burger-website | 759e51096c88bd8feece2a126f3e48959e51a752 | [
"FTL"
] | null | null | null | src/pages/Cart/CartSummary/CartSummaryElements.js | eryk-M/burger-website | 759e51096c88bd8feece2a126f3e48959e51a752 | [
"FTL"
] | null | null | null | src/pages/Cart/CartSummary/CartSummaryElements.js | eryk-M/burger-website | 759e51096c88bd8feece2a126f3e48959e51a752 | [
"FTL"
] | null | null | null | import styled from 'styled-components/macro';
import { FiShoppingCart } from 'react-icons/fi';
import { HiOutlineLocationMarker } from 'react-icons/hi';
import { device } from 'utils/breakpoints';
export const CartSummaryContainer = styled.div`
max-width: 90rem;
display: flex;
justify-content: space-between;
margin: 0 auto;
padding: 3rem;
@media ${device.mobileM} {
flex-direction: column-reverse;
padding: 0 1rem;
}
`;
export const CartSummaryDetails = styled.div``;
export const CartSummaryDetailsHeading = styled.h2`
font-size: 2rem;
margin-top: 1rem;
font-family: 'Rubik', sans-serif;
`;
export const CartSummaryItem = styled.div`
margin-top: 1rem;
margin-left: 7rem;
padding-bottom: 2rem;
display: ${({ flex }) => (flex ? 'flex' : 'block')};
&:first-of-type {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
`;
export const CartSummaryIconWrapper = styled.span`
background-color: var(--color-primary);
height: 4rem;
width: 4rem;
display: inline-block;
position: relative;
border-radius: 50%;
vertical-align: -1rem;
margin-right: 2rem;
`;
export const CartSummaryAddressIcon = styled(HiOutlineLocationMarker)`
font-size: 2.4rem;
color: var(--color-grey-light);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
`;
export const CartSummaryCartIcon = styled(FiShoppingCart)`
font-size: 2.4rem;
color: var(--color-grey-light);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
`;
export const CartSummaryAddressInfo = styled.p`
line-height: 1.5;
font-size: 1.4rem;
`;
export const CartSummaryOrderImage = styled.img`
display: block;
height: 15rem;
width: 15rem;
object-fit: cover;
@media ${device.mobileM} {
height: 10rem;
width: 10rem;
}
`;
export const CartSummaryOrder = styled.div`
margin-left: 1rem;
`;
export const CartSummaryOrderInfo = styled.p`
line-height: 1.7;
font-size: 1.4rem;
margin-left: 2rem;
font-weight: ${({ fontW }) => fontW};
&:first-of-type {
font-family: 'Arvo';
}
& span {
font-weight: bold;
}
`;
export const CartSummaryButton = styled.button``;
export const CartSummaryTotal = styled.div`
max-height: 30rem;
padding: 2rem;
width: 25rem;
border-top: 5px solid var(--color-primary);
@media ${device.mobileM} {
width: 100%;
}
`;
export const CartSummaryTotalHeading = styled.h2`
font-size: 1.6rem;
font-family: 'Rubik', sans-serif;
padding-bottom: 2rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
`;
export const CartSummaryTotalItem = styled.p`
margin-top: 2rem;
font-size: ${({ total }) => (total ? '1.6rem' : '1.4rem')};
display: flex;
justify-content: space-between;
&:last-of-type {
padding: 2rem;
border-top: 1px solid rgba(0, 0, 0, 0.2);
}
& span {
&:last-of-type {
font-weight: bold;
}
}
`;
export const CartSummaryButtonWrapper = styled.div`
margin-top: 2rem;
display: flex;
justify-content: space-between;
`;
| 21.87218 | 70 | 0.68924 |
d6f09f1e29bfee770a180013ebe2cd642a730e72 | 120 | js | JavaScript | script.js | taner-97/Netflix-Landing-Page-Website | 2b725f88be28709e6e485bf754c2e8a94ca9a769 | [
"MIT"
] | null | null | null | script.js | taner-97/Netflix-Landing-Page-Website | 2b725f88be28709e6e485bf754c2e8a94ca9a769 | [
"MIT"
] | null | null | null | script.js | taner-97/Netflix-Landing-Page-Website | 2b725f88be28709e6e485bf754c2e8a94ca9a769 | [
"MIT"
] | null | null | null | function toggleVideo(){
const trailer = document.querySelector('.trailer');
trailer.classList.toggle('active')
} | 30 | 55 | 0.725 |
d6f0c128a7d84ddad5cd5d6b7b3535f8214ba5a3 | 310 | js | JavaScript | built/client/components/generic/images/photoNails/AvatarNail/AvatarNail.js | smaccoun/wrapid-react-ts | 506facc4086f4aae0060e652e6005efdf728c855 | [
"MIT"
] | null | null | null | built/client/components/generic/images/photoNails/AvatarNail/AvatarNail.js | smaccoun/wrapid-react-ts | 506facc4086f4aae0060e652e6005efdf728c855 | [
"MIT"
] | null | null | null | built/client/components/generic/images/photoNails/AvatarNail/AvatarNail.js | smaccoun/wrapid-react-ts | 506facc4086f4aae0060e652e6005efdf728c855 | [
"MIT"
] | null | null | null | "use strict";
const React = require("react");
const s = require('./style.css');
const AvatarNail = () => {
return (React.createElement("div", { className: s.container }));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = AvatarNail;
//# sourceMappingURL=AvatarNail.js.map | 34.444444 | 68 | 0.690323 |
d6f1287e7a54c273565cf8369cdaa79788049071 | 274 | js | JavaScript | conf/src/index.js | liangjingtao2016/router-shop | a7335e450a930d32bac53ea13342c2dd21128988 | [
"MIT"
] | 3 | 2016-12-25T10:48:09.000Z | 2017-05-11T12:51:46.000Z | src/index.js | liangjingtao2016/router-shop | a7335e450a930d32bac53ea13342c2dd21128988 | [
"MIT"
] | null | null | null | src/index.js | liangjingtao2016/router-shop | a7335e450a930d32bac53ea13342c2dd21128988 | [
"MIT"
] | null | null | null | import React from 'react';
import { render } from 'react-dom';
import App from './routes'
import './lib/common.css';
const root = document.getElementById('app');
if ( __DEV__ ){
console.log("现在是开发环境")
}
if (__PROD__) {
console.log("现在是生产环境")
}
render(<App/>, root);
| 17.125 | 44 | 0.660584 |
d6f17be1af2b6a2c8921ade0f556071fe0963fdb | 1,040 | js | JavaScript | brewMation/node_modules/johnny-five/eg/grove-waterflow-edison.js | shaunEll/brewMation | e8740bd67a1e65b52c7414338d312508bb939890 | [
"CC-BY-3.0"
] | 2 | 2015-09-14T10:40:04.000Z | 2015-09-14T17:42:01.000Z | brewMation/node_modules/johnny-five/eg/grove-waterflow-edison.js | shaunEll/brewMation | e8740bd67a1e65b52c7414338d312508bb939890 | [
"CC-BY-3.0"
] | null | null | null | brewMation/node_modules/johnny-five/eg/grove-waterflow-edison.js | shaunEll/brewMation | e8740bd67a1e65b52c7414338d312508bb939890 | [
"CC-BY-3.0"
] | null | null | null | var five = require("../lib/johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
io: new Edison()
});
board.on("ready", function() {
// Plug the Water Flow Sensor into
// GROUND, POWER and Digital Pin 4
// on the Grove Shield
var water = new five.Sensor.Digital(4);
var startAt = Date.now();
water.on("change", function() {
console.log("barometer");
console.log(" pressure : ", this.pressure);
console.log("--------------------------------------");
});
});
// @markdown
// For this program, you'll need:
//
// 
//
// 
//
// 
//
// - [Grove - Barometer Sensor (BMP180)](http://www.seeedstudio.com/depot/Grove-Barometer-Sensor-BMP180-p-1840.html)
//
// @markdown
| 31.515152 | 128 | 0.644231 |
d6f230e17833331a09914bdc2db28181c5382219 | 258 | js | JavaScript | resources/assets/js/admin/AdministratorController/protectionManageId/protectionManageId.js | dauminhquan/Project_2018 | 12739b63a5522a9a54023d7f71565413fbbc99e3 | [
"MIT"
] | null | null | null | resources/assets/js/admin/AdministratorController/protectionManageId/protectionManageId.js | dauminhquan/Project_2018 | 12739b63a5522a9a54023d7f71565413fbbc99e3 | [
"MIT"
] | null | null | null | resources/assets/js/admin/AdministratorController/protectionManageId/protectionManageId.js | dauminhquan/Project_2018 | 12739b63a5522a9a54023d7f71565413fbbc99e3 | [
"MIT"
] | null | null | null |
window.Vue = require('vue');
window.axios = require("axios")
Vue.component('data-table', require('./components/dataTable.vue'));
Vue.component("data-edit-time",require("./components/dataEditTime.vue"))
const table = new Vue({
el: '#data-table',
});
| 19.846154 | 72 | 0.678295 |
d6f27c1bc46c18345405ab5a91fa53fb5953f934 | 170 | js | JavaScript | react_app/src/theme.js | hanlsin/react-flask-cookiecutter | 21e180cc969b62f40efd584783846be6f7b78988 | [
"MIT"
] | null | null | null | react_app/src/theme.js | hanlsin/react-flask-cookiecutter | 21e180cc969b62f40efd584783846be6f7b78988 | [
"MIT"
] | 4 | 2021-03-10T14:59:13.000Z | 2022-02-27T03:13:29.000Z | react_app/src/theme.js | hanlsin/react-flask-cookiecutter | 21e180cc969b62f40efd584783846be6f7b78988 | [
"MIT"
] | 1 | 2020-04-23T04:57:47.000Z | 2020-04-23T04:57:47.000Z |
const theme = {
font: {
family: "'Inter', sans-serif",
size: {
H1: "1.75em",
},
weight: {
H1: "bold",
},
}
};
export default theme;
| 11.333333 | 34 | 0.441176 |
d6f30e7d3d3584b1ae3724672f848c9c71aff8eb | 945 | js | JavaScript | src/database/admin/connection.js | matheusmdias/billsManager2 | 385680cfc1ab672ef3b1aab512c95e08daa03866 | [
"MIT"
] | null | null | null | src/database/admin/connection.js | matheusmdias/billsManager2 | 385680cfc1ab672ef3b1aab512c95e08daa03866 | [
"MIT"
] | null | null | null | src/database/admin/connection.js | matheusmdias/billsManager2 | 385680cfc1ab672ef3b1aab512c95e08daa03866 | [
"MIT"
] | null | null | null | const pg = require('pg');
const DB_HOST = process.env.DB_HOST;
const DB_DATABASE = process.env.DB_DATABASE;
const DB_USER = process.env.DB_USER;
const DB_PASSWORD = process.env.DB_PASSWORD;
const DB_PORT = process.env.DB_PORT;
const poolDB = new pg.Pool({
database: DB_DATABASE,
user : DB_USER,
password: DB_PASSWORD,
host : DB_HOST,
port : DB_PORT,
max : 10,
min : 0,
idleTimeoutMillis : 120000,
connectionTimeoutMillis: 120000
});
const executeQuery = (query, params = []) => {
return poolDB.connect()
.then(client => {
return client.query(query, params)
.then(result => {
client.release(true);
return result.rows;
})
.catch(error => {
client.release(true);
console.log('executeQuery access.db', error);
return Promise.reject(error);
});
});
};
module.exports = {
executeQuery
}; | 24.230769 | 55 | 0.601058 |
d6f4529a7e04acbdbb26395861c852a7dd609337 | 3,202 | js | JavaScript | Develop/app.js | ashlinhanson/employeeManagementTemplate | e8cf6bb169e924ce21991ae8f62b26c741c6d476 | [
"MIT"
] | null | null | null | Develop/app.js | ashlinhanson/employeeManagementTemplate | e8cf6bb169e924ce21991ae8f62b26c741c6d476 | [
"MIT"
] | null | null | null | Develop/app.js | ashlinhanson/employeeManagementTemplate | e8cf6bb169e924ce21991ae8f62b26c741c6d476 | [
"MIT"
] | null | null | null | const Manager = require("./lib/Manager");
const Engineer = require("./lib/Engineer");
const Intern = require("./lib/Intern");
const inquirer = require("inquirer");
const path = require("path");
const fs = require("fs");
const team = [];
// const stringArr = JSON.stringify(team);
const OUTPUT_DIR = path.resolve(__dirname, "output");
const outputPath = path.join(OUTPUT_DIR, "team.html");
const render = require("./lib/htmlRenderer");
function employeeInfo(){
inquirer.prompt([
{
type: "list",
message: "What type of employee would you like add?",
name: "name",
choices: ["Intern", "Engineer", "Manager", "Team Complete"],
},
]).then(val => {
if (val.name === "Intern"){
internInfo();
}else if(val.name === "Engineer"){
engineerInfo();
}else if(val.name === "Manager"){
managerInfo();
}else if(val.name === "Team Complete"){
generateHTML(outputPath, render(team));
};
});
};
function managerInfo(){
return inquirer.prompt([
{
message: "What is the manager's name?",
name: "name"
},
{
message: "What is the manager's id?",
name: "id"
},
{
message: "What is the manager's email?",
name: "email"
},
{
message: "What is the manager's office number?",
name: "officeNumber"
},
]).then(function(answer){
let manager = new Manager(answer.name, answer.id, answer.email, answer.officeNumber)
team.push(manager);
employeeInfo()
})
};
function engineerInfo(){
return inquirer.prompt([
{
message: "What is the engineer's name?",
name: "name"
},
{
message: "What is the engineer's id?",
name: "id"
},
{
message: "What is the engineer's email?",
name: "email"
},
{
message: "What is the engineer's Github username?",
name: "github"
}
]).then(function(answer){
let engineer = new Engineer(answer.name, answer.id, answer.email, answer.github)
team.push(engineer);
employeeInfo();
})
};
function internInfo(){
return inquirer.prompt([
{
message: "What is the intern's name?",
name: "name"
},
{
message: "What is the intern's id?",
name: "id"
},
{
message: "What is the intern's email?",
name: "email"
},
{
message: "What school does the intern go to?",
name: "school"
}
]).then(function(answer){
let intern = new Intern(answer.name, answer.id, answer.email, answer.school)
team.push(intern);
employeeInfo();
})
};
function generateHTML(fileName, data) {
fs.writeFile(fileName, data, "utf8", function (err){
if (err){
throw err;
}
console.log("All done! Your team info is now complete!");
});
};
employeeInfo();
| 25.412698 | 92 | 0.509057 |
d6f5c6e2d529f76f4ac8e3840af4c9fe49eff442 | 59 | js | JavaScript | public/hk/browserifyTestHideModules/UtilClass2.js | hhkk/141213UtdV6 | e8989ba4c9d2590026460ac13f9697910d13c629 | [
"MIT"
] | null | null | null | public/hk/browserifyTestHideModules/UtilClass2.js | hhkk/141213UtdV6 | e8989ba4c9d2590026460ac13f9697910d13c629 | [
"MIT"
] | null | null | null | public/hk/browserifyTestHideModules/UtilClass2.js | hhkk/141213UtdV6 | e8989ba4c9d2590026460ac13f9697910d13c629 | [
"MIT"
] | null | null | null | /**
* Created by henryms on 2/13/2015.
*/
qwewerwerwer
| 8.428571 | 35 | 0.627119 |