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
3b2b2e52a1ae98b254b66569d0b804a735872c59
6,555
js
JavaScript
src/pages/Component/component/Log/history1000.js
GLYASAI/rainbond-ui
dabc388352d1f5b497fb9ca18a958a679a7f9751
[ "Apache-2.0" ]
73
2017-12-11T06:01:11.000Z
2022-03-04T11:38:55.000Z
src/pages/Component/component/Log/history1000.js
GLYASAI/rainbond-ui
dabc388352d1f5b497fb9ca18a958a679a7f9751
[ "Apache-2.0" ]
99
2018-03-24T15:43:56.000Z
2022-02-28T08:51:49.000Z
src/pages/Component/component/Log/history1000.js
GLYASAI/rainbond-ui
dabc388352d1f5b497fb9ca18a958a679a7f9751
[ "Apache-2.0" ]
76
2017-12-29T13:28:15.000Z
2022-03-31T02:40:00.000Z
/* eslint-disable react/no-string-refs */ /* eslint-disable no-nested-ternary */ /* eslint-disable import/extensions */ import Ansi from '@/components/Ansi'; import { Icon, Modal } from 'antd'; import React, { PureComponent } from 'react'; import { getServiceLog } from '../../../../services/app'; import globalUtil from '../../../../utils/global'; import styles from '../../Log.less'; export default class History1000Log extends PureComponent { constructor(props) { super(props); this.state = { list: [], loading: true, showHighlighted: '', }; } componentDidMount() { this.loadData(); } loadData() { getServiceLog({ team_name: globalUtil.getCurrTeamName(), app_alias: this.props.appAlias, lines: 1000, }).then(data => { if (data) { this.setState({ loading: false, list: data.list || [] }); } }); } render() { const { loading, list, showHighlighted } = this.state; return ( <Modal title="最近1000条日志" visible width={1000} bodyStyle={{ background: '#222222', color: '#fff' }} className={styles.logModal} onCancel={this.props.onCancel} footer={null} > {loading ? ( <div style={{ textAlign: 'center' }}> <Icon type="loading" style={{ marginTop: 20, marginBottom: 20 }} /> </div> ) : ( '' )} {!loading ? ( <div style={{ padding: '20px 0', maxHeight: 500, overflowY: 'auto', background: '#212121', }} > {list.length > 0 ? ( <div className={styles.History1000Log}> {list.map((log, index) => { return ( <div key={index}> <span style={{ color: showHighlighted === log.substring(0, log.indexOf(':')) ? '#FFFF91' : '#666666', }} > <b>{/* <Icon type="caret-right" /> */}</b> <span>{log === '' ? '' : `${index + 1}`}</span> </span> <span ref="texts" style={{ color: showHighlighted == log.substring(0, log.indexOf(':')) ? '#FFFF91' : '#FFF', }} > <Ansi> {log.substring(log.indexOf(':') + 1, log.length)} </Ansi> </span> {list.length === 1 ? ( <span style={{ color: showHighlighted === log.substring(0, log.indexOf(':')) ? '#FFFF91' : '#bbb', cursor: 'pointer', backgroundColor: log.substring(0, log.indexOf(':')) ? '#666' : '', }} onClick={() => { this.setState({ showHighlighted: showHighlighted == log.substring(0, log.indexOf(':')) ? '' : log.substring(0, log.indexOf(':')), }); }} > <Ansi>{log.substring(0, log.indexOf(':'))}</Ansi>{' '} </span> ) : list.length > 1 && index >= 1 && log.substring(0, log.indexOf(':')) == list[index <= 0 ? index + 1 : index - 1].substring( 0, list[index <= 0 ? index + 1 : index - 1].indexOf( ':' ) ) ? ( '' ) : ( <span style={{ color: showHighlighted == log.substring(0, log.indexOf(':')) ? '#FFFF91' : '#bbb', cursor: 'pointer', backgroundColor: index == 0 && log.substring(0, log.indexOf(':')) ? '#666' : log.substring(0, log.indexOf(':')) == list[ index <= 0 ? index + 1 : index - 1 ].substring( 0, list[ index <= 0 ? index + 1 : index - 1 ].indexOf(':') ) ? '' : '#666', }} onClick={() => { this.setState({ showHighlighted: showHighlighted == log.substring(0, log.indexOf(':')) ? '' : log.substring(0, log.indexOf(':')), }); }} > <Ansi>{log.substring(0, log.indexOf(':'))}</Ansi>{' '} </span> )} </div> ); })} </div> ) : ( <p style={{ textAlign: 'center', marginBottom: 0, color: '#999' }} > 暂无日志 </p> )} </div> ) : ( '' )} </Modal> ); } }
35.241935
80
0.292601
3b2b670f045ed5bb9a04bcb84c738252d53270a1
271
js
JavaScript
nodejs/003_formacao_nodejs/0022_aula_novidades/find.js
WilliamDeveloper/udemy_cursos
f592bafbe3d2a5d631458f8c42151c880aadef17
[ "MIT" ]
null
null
null
nodejs/003_formacao_nodejs/0022_aula_novidades/find.js
WilliamDeveloper/udemy_cursos
f592bafbe3d2a5d631458f8c42151c880aadef17
[ "MIT" ]
null
null
null
nodejs/003_formacao_nodejs/0022_aula_novidades/find.js
WilliamDeveloper/udemy_cursos
f592bafbe3d2a5d631458f8c42151c880aadef17
[ "MIT" ]
null
null
null
var users = [ { nome:'william', idade:18 }, { nome:'william', idade:12 }, { nome:'luciane', idade:15 } ] var primeiroUsuario = users.find(user => user.nome == 'william') console.log(primeiroUsuario)
15.941176
64
0.490775
3b2b830522139f254096d65de7c35ed5d02f93ed
289
js
JavaScript
src/utils/elOnceEventListener.js
wenyejie/stormjs
94b26d8b9a554f4d1548bd4ccbf42c490e281a86
[ "MIT" ]
null
null
null
src/utils/elOnceEventListener.js
wenyejie/stormjs
94b26d8b9a554f4d1548bd4ccbf42c490e281a86
[ "MIT" ]
null
null
null
src/utils/elOnceEventListener.js
wenyejie/stormjs
94b26d8b9a554f4d1548bd4ccbf42c490e281a86
[ "MIT" ]
null
null
null
/** * 当点击元素外部时, 执行回调 * * @author: Storm * @date: 2018/11/02 */ export default { add (eventFn, element = document) { element.addEventListener('click', eventFn, { once: true }) }, remove (eventFn, element = document) { element.removeEventListener('click', eventFn) } }
18.0625
62
0.629758
3b2cc88897463ee4c566afafc85bd5615ab69a98
99
js
JavaScript
source/keys.spec.js
amit08255/rambda
11e6da32008d3f19e76a2a7cc140c3ba4426ef52
[ "MIT" ]
1,362
2017-01-16T14:38:27.000Z
2022-03-31T22:10:55.000Z
source/keys.spec.js
amit08255/rambda
11e6da32008d3f19e76a2a7cc140c3ba4426ef52
[ "MIT" ]
245
2017-04-01T14:33:17.000Z
2022-03-28T07:36:32.000Z
source/keys.spec.js
amit08255/rambda
11e6da32008d3f19e76a2a7cc140c3ba4426ef52
[ "MIT" ]
112
2017-03-24T11:04:58.000Z
2022-03-18T10:55:44.000Z
import { keys } from './keys' test('happy', () => { expect(keys({ a : 1 })).toEqual([ 'a' ]) })
16.5
42
0.474747
3b2d53063da9b7bdde2859ff9d116278fd03b12d
2,764
js
JavaScript
day3/1.ajax/3.form.js
Crystal2030/nodestudy
5b79f6c68ccfbe773d992de2fc7f40ad1400106e
[ "MIT" ]
null
null
null
day3/1.ajax/3.form.js
Crystal2030/nodestudy
5b79f6c68ccfbe773d992de2fc7f40ad1400106e
[ "MIT" ]
null
null
null
day3/1.ajax/3.form.js
Crystal2030/nodestudy
5b79f6c68ccfbe773d992de2fc7f40ad1400106e
[ "MIT" ]
null
null
null
//引入核心模块 var http = require('http'); //引用URL解析URL参数 var url = require('url'); //读写文件 var fs = require('fs'); var formidable = require('formidable'); var querystring = require('querystring'); var util = require('util'); var mime = require('mime'); //创建http服务器 //只有当提交form表单,并且是GET请求的时候,浏览器才会把表单进行序列化拼到URL后面 http.createServer(function(req,res){ //一定会返回一个对象 // true的话urlObj的query也会是一个对象,否则就是一个字符串 // username=zfpx&password=123 -> {username:'zfpx',password:123} var urlObj = url.parse(req.url,true); //路径名 var pathname = urlObj.pathname; if(pathname == '/'){ //读取文件的内容 fs.readFile('./3.form.html','utf8',function(err,data){ res.end(data); }) }else if(pathname == '/reg'){ var result=''; //当读到客户端提交过来的数据时会触发data事件,然后调用回调函数 req.on('data',function(data){ result +=data; }) req.on('end',function(data){ //取出请求体的内容类型 var contentType = req.headers['content-type']; //如果请求体发过来的是序列化表单 if(contentType =='application/x-www-form-urlencoded'){ //把查询字符串转成对象 var obj = querystring.parse(result); console.log(obj); }else if(contentType == 'application/json'){ var obj = JSON.parse(result); console.log(obj); } //发送响应 res.end('ok'); }) }else if(pathname == '/reg2'){ // 构建一个解析器 var formParser = new formidable.IncomingForm(); ///用解析器解析请求体 //把非file的input放在fields里 //把文件类型的元素放在files里 formParser.parse(req, function(err, fields, files) { fs.readFile(files.avatar.path,function(err,data){ console.log(files.avatar); var filename = '/imgs/'+files.avatar.name; fs.writeFile('.'+filename,data,function(err){ res.writeHead(200,{'Content-Type':'text/plain'}); res.end(filename); }) }) }); }else{ /** * . 当前目录 * ./3.uploader.js 当前目录下的某个文件 * / : 1. 如果是在HTML的链接中,代表URL根目录 * 2. 如果出现在读文件的时候,则它代表当前盘符的根目录 * * 3.uploader.js: 代表当前目录下面的index.js文件 = ./3.uploader.js * .. :代表上一级目录 */ fs.exists('.'+pathname,function(exists){ if(exists){ //从文件名中获取文件的Content-Type res.setHeader('Content-Type',mime.lookup(pathname)); fs.readFile('.'+pathname,function(err,data){ res.end(data); }) }else{ res.statusCode = 404; res.end('404'); } }) } }).listen(8000);
31.409091
69
0.514834
3b2f28c62cdbc5c9ae9fbd6f5e66dbcc8b9bafe8
87,279
js
JavaScript
node/lib/util/commit.js
petroseskinder/git-meta
fecb725cfdfd3b9d9c06b486f577fa8d405031d3
[ "BSD-3-Clause" ]
null
null
null
node/lib/util/commit.js
petroseskinder/git-meta
fecb725cfdfd3b9d9c06b486f577fa8d405031d3
[ "BSD-3-Clause" ]
null
null
null
node/lib/util/commit.js
petroseskinder/git-meta
fecb725cfdfd3b9d9c06b486f577fa8d405031d3
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2016, Two Sigma Open Source * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of git-meta nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ "use strict"; // TODO: This module is getting to be too big and we need to split it, probably // into `commit_util` and `commit_status_util`. /** * This module contains methods for committing. */ const assert = require("chai").assert; const co = require("co"); const colors = require("colors"); const fs = require("fs-promise"); const NodeGit = require("nodegit"); const path = require("path"); const ConfigUtil = require("./config_util"); const CherryPickUtil = require("./cherry_pick_util.js"); const DoWorkQueue = require("../util/do_work_queue"); const DiffUtil = require("./diff_util"); const GitUtil = require("./git_util"); const Hook = require("../util/hook"); const Mutex = require("async-mutex").Mutex; const Open = require("./open"); const RepoStatus = require("./repo_status"); const PrintStatusUtil = require("./print_status_util"); const SequencerState = require("../util/sequencer_state"); const SequencerStateUtil = require("../util/sequencer_state_util"); const SparseCheckoutUtil = require("./sparse_checkout_util"); const StatusUtil = require("./status_util"); const Submodule = require("./submodule"); const SubmoduleConfigUtil = require("./submodule_config_util"); const SubmoduleUtil = require("./submodule_util"); const TreeUtil = require("./tree_util"); const UserError = require("./user_error"); const getSubmodulesFromCommit = SubmoduleConfigUtil.getSubmodulesFromCommit; /** * If the specified `message` does not end with '\n', return the result of * appending '\n' to 'message'; otherwise, return 'message'. * * @param {String} message */ exports.ensureEolOnLastLine = function (message) { // TODO: test independently return message.endsWith("\n") ? message : (message + "\n"); }; /** * Return the `NodeGit.Tree` object for the (left) parent of the head commit * in the specified `repo`, or null if the commit has no parent. * * @param {NodeGit.Repository} repo * @return {NodeGit.Tree|null} */ const getHeadParentTree = co.wrap(function *(repo) { const head = yield repo.getHeadCommit(); const parent = yield GitUtil.getParentCommit(repo, head); if (null === parent) { return null; // RETURN } const treeId = parent.treeId(); return yield NodeGit.Tree.lookup(repo, treeId); }); const getAmendStatusForRepo = co.wrap(function *(repo, all) { const tree = yield getHeadParentTree(repo); const normal = yield DiffUtil.getRepoStatus(repo, tree, [], false, true); if (!all) { return normal; // RETURN } // If we're ignoring the index, need calculate the changes in two steps. // We've already got the "normal" comparison now we need to get changes // directly against the workdir. const toWorkdir = yield DiffUtil.getRepoStatus(repo, tree, [], true, true); // And use `calculateAllStatus` to create the final value. return exports.calculateAllStatus(normal.staged, toWorkdir.workdir); }); /** * This class represents the meta-data associated with a commit. */ class CommitMetaData { /** * Create a new `CommitMetaData` object having the specified `signature` * and `message`. * * @param {NodeGit.Signature} signature * @param {String} message */ constructor(signature, message) { assert.instanceOf(signature, NodeGit.Signature); assert.isString(message); this.d_signature = signature; this.d_message = message; Object.freeze(this); } /** * the signature associated with a commit * * @property {NodeGit.Signature} signature */ get signature() { return this.d_signature; } /** * the message associated with a commit * * @property {String} message */ get message() { return this.d_message; } /** * Return true if the specified `other` represents an equivalent value to * this object and false otherwise. Two `CommitMetaData` values are * equivalent if they have the same `message`, `signature.name()`, and * `signature.email()` values. * * @param {CommitMetaData} other * @return {Boolean} */ equivalent(other) { assert.instanceOf(other, CommitMetaData); return this.d_message === other.d_message && this.d_signature.name() === other.d_signature.name() && this.d_signature.email() === other.d_signature.email(); } } exports.CommitMetaData = CommitMetaData; /** * Stage the specified `filename` having the specified `change` in the * specified `index`. * * @param {NodeGit.Index} index * @param {String} path * @param {RepoStatus.FILEMODE} change */ exports.stageChange = co.wrap(function *(index, path, change) { assert.instanceOf(index, NodeGit.Index); assert.isString(path); assert.isNumber(change); if (RepoStatus.FILESTATUS.REMOVED !== change) { yield index.addByPath(path); } else { try { yield index.remove(path, -1); } catch (e) { // NOOP: this case will be hit if the removal of `path` has // already been staged; we don't have any way that I can see to // check for this other than just trying to remove it. } } }); const mutex = new Mutex(); const runPreCommitHook = co.wrap(function *(repo, index) { assert.instanceOf(repo, NodeGit.Repository); assert.instanceOf(index, NodeGit.Index); const tempIndexPath = repo.path() + "index.gmtmp"; yield SparseCheckoutUtil.setSparseBitsAndWriteIndex(repo, index, tempIndexPath); let release = null; try { if (Hook.hasHook(repo, "pre-commit")) { release = yield mutex.acquire(); const isOk = yield Hook.execHook(repo, "pre-commit", [], { GIT_INDEX_FILE: tempIndexPath}); yield GitUtil.overwriteIndexFromFile(index, tempIndexPath); if (!isOk) { // hooks are responsible for printing their own message throw new UserError(""); } } } finally { if (release !== null) { release(); } yield fs.unlink(tempIndexPath); } }); /** * Prepare a temp index in the specified `repo`, then run the hooks, * and read back the index. If the specified `doAll` is true, stage * files indicated that they are to be committed in the `staged` * section. Ignore submodules. * * @async * @param {NodeGit.Repository} repo * @param {RepoStatus} repoStatus * @param {Boolean} doAll * @param {Boolean} noVerify */ const prepareIndexAndRunHooks = co.wrap(function *(repo, changes, doAll, noVerify) { assert.instanceOf(repo, NodeGit.Repository); assert.isObject(changes); assert.isBoolean(doAll); assert.isBoolean(noVerify); const index = yield repo.index(); // If we're auto-staging files, loop through workdir and stage them. if (doAll) { for (let path in changes) { yield exports.stageChange(index, path, changes[path]); } yield SparseCheckoutUtil.setSparseBitsAndWriteIndex(repo, index); } if (!noVerify) { yield runPreCommitHook(repo, index); } }); const editorMessagePrefix = `\ Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. `; function branchStatusLine(status) { if (null !== status.currentBranchName) { return `On branch ${status.currentBranchName}.\n`; } return `On detached head ${GitUtil.shortSha(status.headCommit)}.\n`; } /** * Return a string having the same value as the specified `text` except that * each empty line is replaced with "#", and each non-empty line is prefixed * with "# ". The result of calling with the empty string is the empty string. * The behavior is undefined unless `"" === text || text.endsWith("\n")`. * * @param {String} text * @return {String} */ exports.prefixWithPound = function (text) { assert.isString(text); if ("" === text) { return ""; // RETURN } assert(text.endsWith("\n")); const lines = text.split("\n"); const resultLines = lines.map((line, i) => { // The split operation makes an empty line that we don't want to // prefix. if (i === lines.length - 1) { return ""; } // Empty lines don't get "# ", just "#". if ("" === line) { return "#"; // RETURN } return `# ${line}`; }); return resultLines.join("\n"); }; /** * Return text describing the changes in the specified `status`. Use the * specified `cwd` to show relative paths. * * @param {RepoStatus} status * @param {String} cwd */ exports.formatStatus = function (status, cwd) { assert.instanceOf(status, RepoStatus); assert.isString(cwd); let result = ""; const statuses = PrintStatusUtil.accumulateStatus(status); if (0 !== statuses.staged.length) { result += `Changes to be committed:\n`; result += PrintStatusUtil.printStatusDescriptors(statuses.staged, x => x, cwd); } if (0 !== statuses.workdir.length) { result += "\n"; result += `Changes not staged for commit:\n`; result += PrintStatusUtil.printStatusDescriptors(statuses.workdir, x => x, cwd); } if (0 !== statuses.untracked.length) { result += "\n"; result += "Untracked files:\n"; result += PrintStatusUtil.printUntrackedFiles(statuses.untracked, x => x, cwd); } return result; }; /** * Return a string describing the specified `status` that is appropriate as a * description in the editor prompting for a commit message; adjust paths to be * relative to the specified `cwd`. * * @param {RepoStatus} status * @param {String} cwd * @return {String} */ exports.formatEditorPrompt = function (status, cwd) { assert.instanceOf(status, RepoStatus); assert.isString(cwd); let result = editorMessagePrefix + branchStatusLine(status); result += exports.formatStatus(status, cwd); const prefixed = exports.prefixWithPound(result); return "\n" + prefixed + "#\n"; }; /** * Stage all of the specified `submodules` that are open in the specified * `index`. We need to do this whenever generating a meta-repo commit because * otherwise, we could commit a staged commit in a submodule that would have * been reverted in its open repo. * * @param {NodeGit.Repository} repo * @param {NodeGit.Index} index * @param {Object} submodules name -> RepoStatus.Submodule */ const stageOpenSubmodules = co.wrap(function *(repo, index, submodules) { yield Object.keys(submodules).map(co.wrap(function *(name) { const sub = submodules[name]; if (null !== sub.workdir) { yield index.addByPath(name); } })); yield SparseCheckoutUtil.setSparseBitsAndWriteIndex(repo, index); }); /** * Return true if a commit should be generated for the repo having the * specified `status`. Ignore the possibility of generating a meta-repo commit * if the specified `skipMeta` is true. If the specified `subMessages` is * provided, ignore staged changes in submodules unless they have entries in * `subMessages`. * * @param {RepoStatus} status * @param {Boolean} skipMeta * @param {Object} [subMessages] * @return {Boolean} */ exports.shouldCommit = function (status, skipMeta, subMessages) { assert.instanceOf(status, RepoStatus); assert.isBoolean(skipMeta); if (undefined !== subMessages) { assert.isObject(subMessages); } // If the meta-repo has staged commits, we must commit. if (!skipMeta && !status.isIndexClean()) { return true; // RETURN } const subs = status.submodules; const SAME = RepoStatus.Submodule.COMMIT_RELATION.SAME; // Look through the submodules looking for one that would require a new // commit in the meta-repo. for (let name in subs) { const sub = subs[name]; const commit = sub.commit; const index = sub.index; const workdir = sub.workdir; if (null !== workdir) { if (!skipMeta && SAME !== workdir.relation) { // changed commit in workdir return true; // RETURN } if ((undefined === subMessages || (name in subMessages)) && !workdir.status.isIndexClean()) { // If this sub-repo is to be committed, and it has a dirty // index, then we must commit. return true; // RETURN } } if (!skipMeta && (null === index || // deleted null === commit || // added SAME !== index.relation || // changed commit commit.url !== index.url)) { // changed URL // changed commit in index return true; // RETURN } } return false; }; const updateHead = co.wrap(function *(repo, sha) { // Now we need to put the commit on head. We need to unstage // the changes we've just committed, otherwise we see // conflicts with the workdir. We do a SOFT reset because we // don't want to affect index changes for paths you didn't // touch. // This will return the same one that we modified above const index = yield repo.index(); // First, we write the new index to the actual index file. yield SparseCheckoutUtil.setSparseBitsAndWriteIndex(repo, index); const commit = yield repo.getCommit(sha); yield NodeGit.Reset.reset(repo, commit, NodeGit.Reset.TYPE.SOFT); }); /** * Create a commit across modified repositories and the specified `metaRepo` * with the specified `message`; if `null === message`, do not create a commit * for the meta-repo. If the specified `all` is provided, automatically stage * files listed to be committed as `staged` (note that some of these may * already be staged). If the optionally specified `subMessages` is provided, * use the messages it contains for the commit messages of the respective * submodules in it, and create no commits for submodules with no entries in * `subMessages`. Return an object that lists the sha of the created meta-repo * commit and the shas of any commits generated in submodules. The behavior is * undefined if there are entries in `.gitmodules` for submodules having no * commits, or if `null === message && undefined === subMessages`. The * behavior is undefined unless there is something to commit. * * @async * @param {NodeGit.Repository} metaRepo * @param {Boolean} all * @param {RepoStatus} metaStatus * @param {String|null} message * @param {Object} [subMessages] map from submodule to message * @param {Commit} mergeParent if mid-merge, the commit being * merged, which will become the right parent * of this commit (and the equivalent in the * submodules). * @return {Object} * @return {String|null} return.metaCommit * @return {Object} return.submoduleCommits map submodule name to new commit */ exports.commit = co.wrap(function *(metaRepo, all, metaStatus, message, subMessages, noVerify, mergeParent) { assert.instanceOf(metaRepo, NodeGit.Repository); assert.isBoolean(all); assert.instanceOf(metaStatus, RepoStatus); assert(exports.shouldCommit(metaStatus, message === null, subMessages), "nothing to commit"); if (null !== message) { assert.isString(message); } if (undefined !== subMessages) { assert.isObject(subMessages); } assert(null !== message || undefined !== subMessages, "if no meta message, sub messages must be specified"); assert.isBoolean(noVerify); let mergeTree = null; if (mergeParent) { assert.instanceOf(mergeParent, NodeGit.Commit); mergeTree = yield mergeParent.getTree(); } const signature = yield ConfigUtil.defaultSignature(metaRepo); const submodules = metaStatus.submodules; // Commit submodules. If any changes, remember this so we know to generate // a commit in the meta-repo whether or not the meta-repo has its own // workdir changes. const subCommits = {}; const subRepos = {}; const commitSubmodule = co.wrap(function *(name) { let subMessage = message; // If we're explicitly providing submodule messages, look the commit // message up for this submodule and return early if there isn't one. if (undefined !== subMessages) { subMessage = subMessages[name]; if (undefined === subMessage) { return; // RETURN } } const status = submodules[name]; const repoStatus = (status.workdir && status.workdir.status) || null; if (null !== repoStatus && 0 !== Object.keys(repoStatus.staged).length) { const subRepo = yield SubmoduleUtil.getRepo(metaRepo, name); yield prepareIndexAndRunHooks(subRepo, repoStatus.staged, all, noVerify); const headCommit = yield subRepo.getHeadCommit(); const parents = []; if (headCommit !== null) { parents.push(headCommit); } if (mergeTree !== null) { const mergeSubParent = yield mergeTree.entryByPath(name); if (mergeSubParent.id() !== headCommit.id()) { parents.push(mergeSubParent.id()); } } const index = yield subRepo.index(); const tree = yield index.writeTree(); const commit = yield subRepo.createCommit( null, signature, signature, exports.ensureEolOnLastLine(subMessage), tree, parents); subRepos[name] = subRepo; subCommits[name] = commit.tostrS(); } }); const index = yield metaRepo.index(); yield DoWorkQueue.doInParallel(Object.keys(submodules), commitSubmodule); if (all) { for (const subName of Object.keys(metaStatus.staged)) { exports.stageChange(index, subName, metaStatus.staged[subName]); } } for (const subName of Object.keys(subCommits)) { const subRepo = subRepos[subName]; const sha = subCommits[subName]; yield updateHead(subRepo, sha); } const result = { metaCommit: null, submoduleCommits: subCommits, }; if (null === message) { return result; // RETURN } yield stageOpenSubmodules(metaRepo, index, submodules); if (!noVerify) { yield runPreCommitHook(metaRepo, index); } const tree = yield index.writeTree(); const headCommit = yield metaRepo.getHeadCommit(); const parents = [headCommit]; if (mergeParent) { assert(mergeParent !== headCommit); parents.push(mergeParent); } result.metaCommit = yield metaRepo.createCommit( "HEAD", signature, signature, exports.ensureEolOnLastLine(message), tree, parents); if (mergeParent) { yield SequencerStateUtil.cleanSequencerState(metaRepo.path()); } return result; }); /** * Return true if the specified `filename` in the specified `repo` is * executable and false otherwise. * * TODO: move this out somewhere lower-level and make an independent test. * * @param {Nodegit.Repository} repo * @param {String} filename * @return {Bool} */ const isExecutable = co.wrap(function *(repo, filename) { assert.instanceOf(repo, NodeGit.Repository); assert.isString(filename); const fullPath = path.join(repo.workdir(), filename); try { yield fs.access(fullPath, fs.constants.X_OK); return true; } catch (e) { // cannot execute return false; } }); /** * Create a temp index and run the pre-commit hooks for the specified * `repo` having the specified `status` using the specified commit * `message` and return the ID of the new commit. Note that this * method records staged commits for submodules but does not recurse * into their repositories. Note also that changes that would involve * altering `.gitmodules` -- additions, removals, and URL changes -- * are ignored. HEAD and the main on-disk index file are not changed, * although the in-memory index is altered. * * @param {NodeGit.Repository} repo * @param {RepoStatus} status * @param {String} message * @return {String} */ exports.writeRepoPaths = co.wrap(function *(repo, status, message, noVerify) { assert.instanceOf(repo, NodeGit.Repository); assert.instanceOf(status, RepoStatus); assert.isString(message); const headCommit = yield repo.getHeadCommit(); const changes = {}; const staged = status.staged; const FILEMODE = NodeGit.TreeEntry.FILEMODE; const FILESTATUS = RepoStatus.FILESTATUS; const Change = TreeUtil.Change; // We do a soft reset later, which means that we don't touch the index. // Therefore, all of our files must be staged. const index = yield repo.index(); yield index.readTree(yield headCommit.getTree()); // First, handle "normal" file changes. for (let filename in staged) { const stat = staged[filename]; if (FILESTATUS.REMOVED === stat) { yield index.removeByPath(filename); changes[filename] = null; } else { const blobId = yield TreeUtil.hashFile(repo, filename); const executable = yield isExecutable(repo, filename); const mode = executable ? FILEMODE.EXECUTABLE : FILEMODE.BLOB; changes[filename] = new Change(blobId, mode); yield index.addByPath(filename); } } // Then submodules. const subs = status.submodules; for (let subName in subs) { const sub = subs[subName]; // As noted in the contract, `writePaths` ignores added or removed // submodules. if (null !== sub.commit && null !== sub.index && sub.commit.sha !== sub.index.sha) { const id = NodeGit.Oid.fromString(sub.index.sha); changes[subName] = new Change(id, FILEMODE.COMMIT); // Stage this submodule if it's open. yield CherryPickUtil.addSubmoduleCommit(index, subName, sub.index.sha); } } if (!noVerify) { yield runPreCommitHook(repo, index); } // Use 'TreeUtil' to create a new tree having the required paths. const treeId = yield index.writeTree(); const tree = yield NodeGit.Tree.lookup(repo, treeId); // Create a commit with this tree. const sig = yield ConfigUtil.defaultSignature(repo); const parents = [headCommit]; const commitId = yield NodeGit.Commit.create( repo, 0, sig, sig, 0, exports.ensureEolOnLastLine(message), tree, parents.length, parents); //restore the index // Now, reload the index to get rid of the changes we made to it. // In theory, this should be index.read(true), but that doesn't // work for some reason. yield GitUtil.overwriteIndexFromFile(index, index.path()); // ...and apply the changes from the commit that we just made. // I'm pretty sure this doesn't do rename/copy detection, but the nodegit // API docs are pretty vague, as are the libgit2 docs. const commit = yield NodeGit.Commit.lookup(repo, commitId); const diffs = yield commit.getDiff(); const diff = diffs[0]; for (let i = 0; i < diff.numDeltas(); i++) { const delta = diff.getDelta(i); const newFile = delta.newFile(); if (GitUtil.isZero(newFile.id())) { index.removeByPath(delta.oldFile().path()); } else { index.addByPath(newFile.path()); } } return commitId; }); /** * Commit changes to the files indicated as staged by the specified `status` * in the specified `repo`, applying the specified commit `message`. Return an * object listing the commit IDs of the commits that were made in submodules * and the meta-repo. * * @async * @param {NodeGit.Repository} repo * @param {RepoStatus} status * @param {String} message * @return {Object} * @return {String} return.metaCommit * @return {Object} return.submoduleCommits map from sub name to commit id */ exports.commitPaths = co.wrap(function *(repo, status, message, noVerify) { assert.instanceOf(repo, NodeGit.Repository); assert.instanceOf(status, RepoStatus); assert.isString(message); assert.isBoolean(noVerify); const subCommits = {}; // map from name to sha const committedSubs = {}; // map from name to RepoAST.Submodule const subs = status.submodules; const writeSubPaths = co.wrap(function *(subName) { const sub = subs[subName]; const workdir = sub.workdir; // Nothing to do for closed submodules. if (null === workdir) { return; // RETURN } const staged = workdir.status.staged; const stagedPaths = Object.keys(staged); // Nothing to do if no paths listed as stagged. if (0 === stagedPaths.length) { return; // RETURN } const wdStatus = workdir.status; const subRepo = yield SubmoduleUtil.getRepo(repo, subName); const oid = yield exports.writeRepoPaths(subRepo, wdStatus, message, noVerify); const sha = oid.tostrS(); subCommits[subName] = sha; const oldIndex = sub.index; const Submodule = RepoStatus.Submodule; committedSubs[subName] = sub.copy({ index: new Submodule.Index(sha, oldIndex.url, Submodule.COMMIT_RELATION.AHEAD), workdir: new Submodule.Workdir(wdStatus.copy({ headCommit: sha, }), Submodule.COMMIT_RELATION.SAME) }); committedSubs[subName].repo = subRepo; }); yield DoWorkQueue.doInParallel(Object.keys(subs), writeSubPaths); for (const subName of Object.keys(committedSubs)) { const sub = committedSubs[subName]; yield updateHead(sub.repo, sub.index.sha); } // We need a `RepoStatus` object containing only the set of the submodules // to commit to pass to `writeRepoPaths`. const pathStatus = status.copy({ submodules: committedSubs, }); const id = yield exports.writeRepoPaths(repo, pathStatus, message); const commit = yield repo.getCommit(id); yield NodeGit.Reset.reset(repo, commit, NodeGit.Reset.TYPE.SOFT); return { metaCommit: id, submoduleCommits: subCommits, }; }); /** * Return the meta-data for the specified `commit`. * * @param {NodeGit.Commit} commit * @return {CommitMetaData} */ exports.getCommitMetaData = function (commit) { assert.instanceOf(commit, NodeGit.Commit); return new CommitMetaData(commit.committer(), commit.message()); }; /** * Return the amend status for the submodule having the specified current * `status` and the optionally specified `old` value in the previous commit. A * missing `old` indicates that the submodule was added in the commit being * amended. * * @param {RepoStatus.Submodule} status * @param {String|null} old * @return {Object} * @return {CommitMetaData|null} return.oldCommit if sub in last commit * @return {RepoStatus.Submodule|null} return.status null if shouldn't exist */ exports.getSubmoduleAmendStatus = co.wrap(function *(status, old, getRepo, all) { assert.instanceOf(status, RepoStatus.Submodule); if (null !== old) { assert.instanceOf(old, Submodule); } const index = status.index; const commit = status.commit; const workdir = status.workdir; if (null === old && null === index) { // Gone in index and didn't exist before; has no status now. return { oldCommit: null, status: null, }; } // We'll create an amend commit for of this sub only if: // - it's not gone in the index // - it wasn't removed in the last commit // - it wasn't added in the last commit // - its sha was updated in the last commit // - no new commits have been staged or created in the workdir const SAME = RepoStatus.Submodule.COMMIT_RELATION.SAME; const shouldAmend = null !== index && null !== commit && null !== old && old.sha !== commit.sha && SAME === index.relation && (null === workdir || SAME === workdir.relation); const commitSha = old && old.sha; let indexSha = index && index.sha; let workdirStatus = workdir && workdir.status; let oldCommit = null; // will hold commit meta data let repo = null; if (shouldAmend) { // Set up the index sha to match the old commit -- as it must to be // able to do an amend. indexSha = commitSha; // Then read in the staged/workdir changes based on the difference in // this submodule's open repo and the prior commit. repo = yield getRepo(); const commit = yield repo.getHeadCommit(repo); oldCommit = exports.getCommitMetaData(commit); const amendStat = yield getAmendStatusForRepo(repo, all); workdirStatus = new RepoStatus({ headCommit: commitSha, staged: amendStat.staged, workdir: amendStat.workdir, }); } else if (null !== workdirStatus) { repo = yield getRepo(); } const commitUrl = old && old.url; const indexUrl = index && index.url; const newStatus = yield StatusUtil.getSubmoduleStatus(repo, workdirStatus, indexUrl, commitUrl, indexSha, commitSha); return { status: newStatus, oldCommit: oldCommit, }; }); /* Read the state of the commits in the commit before the one to be * amended, so that we can see what's been changed. */ const computeAmendSubmoduleChanges = co.wrap(function*(repo, head) { assert.instanceOf(repo, NodeGit.Repository); assert.instanceOf(head, NodeGit.Commit); const headTree = yield head.getTree(); const oldUrls = {}; const parents = yield head.getParents(); // `merged` records changes that were present in at least one parent const merged = {}; // `changes` records what changes were actually made in this // commit (as opposed to merged from a parent). let changes = null; if (parents.length === 0) { changes = {}; } for (const parent of parents) { const parentTree = yield parent.getTree(); const parentSubmodules = yield getSubmodulesFromCommit(repo, parent); // TODO: this doesn't really handle URL updates Object.assign(oldUrls, parentSubmodules); const diff = yield NodeGit.Diff.treeToTree(repo, parentTree, headTree, null); const ourChanges = yield SubmoduleUtil.getSubmoduleChangesFromDiff( diff, true); if (changes === null) { changes = ourChanges; } else { for (const path of Object.keys(changes)) { if (ourChanges[path] === undefined) { merged[path] = changes[path]; delete changes[path]; } else { delete ourChanges[path]; } } for (const path of Object.keys(ourChanges)) { merged[path] = ourChanges[path]; delete changes[path]; } } } return { changes: changes, merged: merged, oldUrls: oldUrls }; }); /** * Return the status object describing an amend commit to be created in the * specified `repo` and a map containing the submodules to have amend * commits created mapped to `CommitMetaData` objects describing their current * commits; submodules with staged changes not in this map receive normal * commits. Format paths relative to the specified `cwd`. Ignore * non-submodule changes to the meta-repo. Auto-stage modifications (to * tracked files) if the specified `all` is true. * * @param {NodeGit.Repository} repo * @param {Object} [options] * @param {Boolean} [options.all = false] * @param {String} [options.cwd = ""] * * @return {Object} * @return {RepoStatus} return.status * @return {Object} return.subsToAmend name -> `CommitMetaData` */ exports.getAmendStatus = co.wrap(function *(repo, options) { assert.instanceOf(repo, NodeGit.Repository); if (undefined === options) { options = {}; } else { assert.isObject(options); } let all = options.all; if (undefined === all) { all = false; } else { assert.isBoolean(all); } let cwd = options.cwd; if (undefined === cwd) { cwd = ""; } else { assert.isString(cwd); } const baseStatus = yield exports.getCommitStatus(repo, cwd, { all: all, }); const head = yield repo.getHeadCommit(); const newUrls = yield getSubmodulesFromCommit(repo, head); const amendChanges = yield computeAmendSubmoduleChanges(repo, head); const changes = amendChanges.changes; const merged = amendChanges.merged; const oldUrls = amendChanges.oldUrls; const submodules = baseStatus.submodules; // holds resulting sub statuses const opener = new Open.Opener(repo, null); const subsToAmend = {}; // holds map of subs to amend to their commit info // Loop through submodules that either have changes against the current // commit, or were changed in the current commit. const subsToInspect = Array.from(new Set( Object.keys(submodules).concat(Object.keys(changes)))); const inspectSub = co.wrap(function *(name) { const change = changes[name]; let currentSub = submodules[name]; let old = null; const isMerged = name in merged; // TODO: This is pretty complicated -- it might be simpler to // figure out if a commit is present in any ancestor. if (isMerged) { // In this case, the "old" version is actually the merged // version old = new Submodule(oldUrls[name], merged[name].newSha); } else if (undefined !== change) { // We handle deleted submodules later. TODO: this should not be a // special case when we've done the refactoring noted below. if (null === change.newSha) { return; // RETURN } // This submodule was affected by the commit; record its old sha // if it wasn't added. if (null !== change.oldSha) { old = new Submodule(oldUrls[name], change.oldSha); } if (undefined === currentSub) { // This submodule is not open though; we need to construct a // `RepoStatus.Submodule` object for it as if it had been // loaded; the commit and index parts of this object are the // same as they cannot have been changed. // // TODO: refactor this and `getSubmoduleAmendStatus` to be // less-wonky, specifically to not deal in terms of // `RepoAST.Submodule` objects. const url = newUrls[name]; const Submodule = RepoStatus.Submodule; currentSub = new Submodule({ commit: new Submodule.Commit(change.newSha, url), index: new Submodule.Index(change.newSha, url, Submodule.COMMIT_RELATION.SAME), }); } } else { // This submodule was opened but not changed. Populate 'old' with // current commit value, if it exists. const commit = currentSub.commit; if (null !== commit) { old = new Submodule(commit.url, commit.sha); } } const getRepo = () => opener.getSubrepo(name, Open.SUB_OPEN_OPTION.FORCE_OPEN); const result = yield exports.getSubmoduleAmendStatus(currentSub, old, getRepo, all); // If no status was returned, or this was a merged // submodule with no local changes, remove this submodule. if (null === result.status || (isMerged && result.status.isWorkdirClean() && result.status.isIndexClean())) { delete submodules[name]; } else { submodules[name] = result.status; } // If it's to be amended, populate `subsToAmend` with the last commit // info. if (null !== result.oldCommit) { subsToAmend[name] = result.oldCommit; } }); yield DoWorkQueue.doInParallel(subsToInspect, inspectSub); // Look for subs that were removed in the commit we are amending; reflect // their status. Object.keys(changes).forEach(name => { // If we find one, create a status entry for it reflecting its // deletion. const change = changes[name]; if (null === change.newSha) { submodules[name] = new RepoStatus.Submodule({ commit: new RepoStatus.Submodule.Commit(change.sha, oldUrls[name]), index: null, }); } }); const resultStatus = baseStatus.copy({ submodules: submodules, }); return { status: resultStatus, subsToAmend: subsToAmend, }; }); /** * Create a commit in the specified `repo`, based on the HEAD commit, * using the specified commit `message`, and return the sha of the * created commit. * * @param {NodeGit.Repository} repo * @param {String} message * @return {NodeGit.Oid} */ exports.createAmendCommit = co.wrap(function *(repo, message) { assert.instanceOf(repo, NodeGit.Repository); assert.isString(message); const head = yield repo.getHeadCommit(); const index = yield repo.index(); const treeId = yield index.writeTree(); const tree = yield NodeGit.Tree.lookup(repo, treeId); const termedMessage = exports.ensureEolOnLastLine(message); const id = yield repo.createCommit( null, head.author(), head.committer(), termedMessage, tree, head.parents()); return id; }); /** * Amend the specified meta `repo` and the shas of the created commits. Amend * the head of `repo` and submodules listed in the specified `subsToAmend` * array. Create new commits for other modified submodules described in the * specified `status`. If the specified `all` is true, stage files marked as * `staged` preemptively (some of these files may already be staged). * Use the specified `message` for all commits. The behavior is undefined if * the amend should result in the first commit of a submodule being stripped, * or any meta-repo commit being stripped (i.e., when there would be no * changes). The behavior is also undefined if any of `subsToAmend` submodules * do not have an open repo indicated in `status`. * * @param {NodeGit.Repository} repo * @param {RepoStatus} status * @param {String[]} subsToAmend * @param {Boolean} all * @param {String|null} message * @param {Object|null} subMessages * @param {Boolean} noVerify * @return {Object} * @return {String} return.metaCommit sha of new commit on meta-repo * @return {Object} return.submoduleCommits from sub name to sha */ exports.amendMetaRepo = co.wrap(function *(repo, status, subsToAmend, all, message, subMessages, noVerify) { assert.instanceOf(repo, NodeGit.Repository); assert.instanceOf(status, RepoStatus); assert.isArray(subsToAmend); assert.isBoolean(all); if (null !== message) { assert.isString(message); } if (null !== subMessages) { assert.isObject(subMessages); } assert(null !== message || null !== subMessages, "if no meta message, sub messages must be specified"); const head = yield repo.getHeadCommit(); const signature = head.author(); const stageFiles = co.wrap(function *(repo, staged, index) { if (all) { yield Object.keys(staged).map(co.wrap(function *(path) { yield exports.stageChange(index, path, staged[path]); })); } yield index.write(); }); const subCommits = {}; const subRepos = {}; const subs = status.submodules; const amendSubSet = new Set(subsToAmend); yield Object.keys(subs).map(co.wrap(function *(subName) { // If we're providing specific sub messages, use it if provided and // skip committing the submodule otherwise. let subMessage = message; if (null !== subMessages) { subMessage = subMessages[subName]; if (undefined === subMessage) { return; // RETURN } } subMessage = exports.ensureEolOnLastLine(subMessage); const subStatus = subs[subName]; // We're working on only open repos (they would have been opened // earlier if necessary). if (null === subStatus.workdir) { return; // RETURN } const doAmend = amendSubSet.has(subName); const repoStatus = subStatus.workdir.status; const staged = repoStatus.staged; const numStaged = Object.keys(staged).length; // If we're not amending and nothing staged, exit now. if (!doAmend && 0 === numStaged) { return; // RETURN } const subRepo = yield SubmoduleUtil.getRepo(repo, subName); subRepos[subName] = subRepo; const head = yield subRepo.getHeadCommit(); const subIndex = yield subRepo.index(); // If the submodule is to be amended, we don't do the normal commit // process. if (doAmend) { // First, we check to see if this submodule needs to have its last // commit stripped. That will be the case if we have no files // staged indicated as staged. assert.isNotNull(repoStatus); if (0 === numStaged) { const parent = yield GitUtil.getParentCommit(subRepo, head); const TYPE = NodeGit.Reset.TYPE; const type = all ? TYPE.HARD : TYPE.MIXED; yield NodeGit.Reset.reset(subRepo, parent, type); return; // RETURN } if (all) { const actualStatus = yield StatusUtil.getRepoStatus(subRepo, { showMetaChanges: true, }); // TODO: factor this out. We cannot use `repoStatus` to // determine what to stage as it shows the status vs. HEAD^ // and so some things that should be changed will not be in it. // We cannot call `Index.addAll` because it will stage // untracked files. Therefore, we need to use our normal // status routine to examine the workdir and stage changed // files. const workdir = actualStatus.workdir; for (let path in actualStatus.workdir) { const change = workdir[path]; if (RepoStatus.FILESTATUS.ADDED !== change) { yield exports.stageChange(subIndex, path, change); } } if (!noVerify) { yield runPreCommitHook(subRepo, subIndex); } } subCommits[subName] = yield exports.createAmendCommit(subRepo, subMessage); return; // RETURN } if (all) { const actualStatus = yield StatusUtil.getRepoStatus(subRepo, { showMetaChanges: true, }); const workdir = actualStatus.workdir; for (let path in actualStatus.workdir) { const change = workdir[path]; if (RepoStatus.FILESTATUS.ADDED !== change) { yield exports.stageChange(subIndex, path, change); } } } if (!noVerify) { yield runPreCommitHook(subRepo, subIndex); } const tree = yield subIndex.writeTree(); const commit = yield subRepo.createCommit( null, signature, signature, subMessage, tree, [head]); if (null !== commit) { subCommits[subName] = commit; } })); for (const subName of Object.keys(subCommits)) { const subCommit = subCommits[subName]; const subRepo = subRepos[subName]; yield updateHead(subRepo, subCommit.tostrS()); } let metaCommit = null; if (null !== message) { const index = yield repo.index(); yield stageOpenSubmodules(repo, index, subs); yield stageFiles(repo, status.staged, index); metaCommit = yield exports.createAmendCommit(repo, message); yield updateHead(repo, metaCommit.tostrS()); } return { metaCommit: metaCommit, submoduleCommits: subCommits, }; }); /** * Return a human-readable format of the time for the specified `time`. * * @param {NodeGit.Time} time * @return {String} */ exports.formatCommitTime = function (time) { assert.instanceOf(time, NodeGit.Time); const signPrefix = time.offset() < 0 ? "-" : ""; // TODO: something better than rounding offset, though I think we can live // without showing minute-specific TZ diffs for a long time. const offset = Math.floor(time.offset() / 60); const date = new Date((time.time() + (time.offset() * 60)) * 1000); // TODO: do something user-locale-aware. const formatted = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: "UTC", year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric", }).format(date); return `${formatted} ${signPrefix}${Math.abs(offset)}00`; }; /** * Return a string describing the signature of an amend commit, to be used in * an editor prompt, based on the specified `currentSignature` that is the * current signature used in a normal commit, and the specified `lastSignature` * used on the commit to be amended. * * @param {NodeGit.Signature} currentSignature * @param {NodeGit.Signature} lastSignature * @return {String} */ exports.formatAmendSignature = function (currentSignature, lastSignature) { assert.instanceOf(currentSignature, NodeGit.Signature); assert.instanceOf(lastSignature, NodeGit.Signature); let result = ""; if (lastSignature.name() !== currentSignature.name() || lastSignature.email() !== currentSignature.email()) { result += `\ Author: ${lastSignature.name()} <${lastSignature.email()}> `; } const time = lastSignature.when(); result += `\ Date: ${exports.formatCommitTime(time)} `; return result; }; /** * Return the text with which to prompt a user prior to making an amend commit * in specified `repo` having the changes indicated by the specified `status`, * reflecting that unstaged (tracked) files are to be committed if the * specified `all` is true. Format paths relative to the specified `cwd`. * Display the specified `date` value for the date section of the message. * * @param {Signature} repoSignature * @param {CommitMetaData} metaCommitData * @param {RepoStatus} status * @param {String} cwd * @return {String} */ exports.formatAmendEditorPrompt = function (currentSignature, lastCommitData, status, cwd) { assert.instanceOf(currentSignature, NodeGit.Signature); assert.instanceOf(lastCommitData, CommitMetaData); assert.instanceOf(status, RepoStatus); assert.isString(cwd); let result = editorMessagePrefix + "\n"; result += exports.formatAmendSignature(currentSignature, lastCommitData.signature); result += branchStatusLine(status); result += exports.formatStatus(status, cwd); return lastCommitData.message + "\n" + exports.prefixWithPound(result) + "#\n"; }; /** * Calculate and return, from the specified `current` `RepoStatus` object * describing the status of the repository, and the specified `requested` * `ReposStatus` object describing the state of only the paths the user wants * to commit, a new `RepoStatus` object having all changes to be committed * indicated as staged and all changes not to be committed (even if actually * staged) registered as workdir changes. Note that the non-path fields of the * returned object (such as `currentBranch`) are derived from `current`. * * @param {RepoStatus} current * @param {RepoStatus} requested * @return {RepoStatus} */ exports.calculatePathCommitStatus = function (current, requested) { assert.instanceOf(current, RepoStatus); assert.instanceOf(requested, RepoStatus); // Anything requested that's staged or not untracked becomes staged. // Everything else that's currently staged or in the workdir goes to // workdir. function calculateOneRepo(currentStaged, currentWorkdir, requestedStaged, requestedWorkdir) { const newStaged = {}; const newWorkdir = {}; // Initialize `newStaged` with requested files that are already staged. Object.assign(newStaged, requestedStaged); // Copy over everything requested in the workdir that's not added, // i.e., untracked. Object.keys(requestedWorkdir).forEach(filename => { const status = requestedWorkdir[filename]; if (RepoStatus.FILESTATUS.ADDED !== status) { newStaged[filename] = status; } }); // Now copy over to `workdir` the current files that won't be staged. function copyToWorkdir(files) { Object.keys(files).forEach(filename => { if (!(filename in newStaged)) { newWorkdir[filename] = files[filename]; } }); } copyToWorkdir(currentStaged); copyToWorkdir(currentWorkdir); return { staged: newStaged, workdir: newWorkdir, }; } const newFiles = calculateOneRepo(current.staged, current.workdir, requested.staged, requested.workdir); const currentSubs = current.submodules; const requestedSubs = requested.submodules; const newSubs = {}; Object.keys(currentSubs).forEach(subName => { const currentSub = currentSubs[subName]; const requestedSub = requestedSubs[subName]; // If this submodule was not requested, don't include it. if (undefined === requestedSub) { return; } const curWd = currentSub.workdir; if (null !== curWd) { const curStatus = curWd.status; const reqStatus = requestedSub.workdir.status; const newSubFiles = calculateOneRepo(curStatus.staged, curStatus.workdir, reqStatus.staged, reqStatus.workdir); const newStatus = curWd.status.copy({ staged: newSubFiles.staged, workdir: newSubFiles.workdir, }); newSubs[subName] = currentSub.copy({ workdir: new RepoStatus.Submodule.Workdir(newStatus, curWd.relation) }); } else { // If no workdir, no change. newSubs[subName] = currentSub; } }); return current.copy({ staged: newFiles.staged, workdir: newFiles.workdir, submodules: newSubs, }); }; /** * Return true if the specified `status` contains any submodules that are * incompatible with path-based commits. A submodule is incompatible with * path-based commits if: * 1. It has a change that would affect the `.gitmodules` file. * 2. It has files selected (staged) to be committed on top of new commits. * We cannot use path-based commit with previously staged commits because it's * impossible to ignore or target those commits. We can't use them with * configuration changes due to the complexity of manipulating the * `.gitmodules` file. * * TODO: * (a) Consider allowing previously-staged commits to be included with a * flag. * (b) Consider allowing submodules with configuration changes if the * submodule itself is included in the path change. Note that even if * this makes sense (not sure yet), it would require sophisticated * manipulation of the `gitmodules` file. * * @param {RepoStatus} status * @return {Boolean} */ exports.areSubmodulesIncompatibleWithPathCommits = function (status) { assert.instanceOf(status, RepoStatus); const subs = status.submodules; for (let subName in subs) { const sub = subs[subName]; const commit = sub.commit; const index = sub.index; // Newly added or removed submodules require changes to the modules // file. if (null === commit || null === index) { return true; } // as do URL changes if (commit.url !== index.url) { return true; } // Finally, check for new commits. const SAME = RepoStatus.Submodule.COMMIT_RELATION.SAME; const workdir = sub.workdir; if ((null !== workdir && 0 !== Object.keys(workdir.status.staged).length) && (SAME !== index.relation || SAME !== workdir.relation)) { return true; } } return false; }; /** * Return the staged changes to be committed or left uncommitted for an all * commit given the specified `staged` index files and specified `workdir` * differences. * * @param {Object} staged map from path to {RepoStatus.FILESTATUS} * @param {Object} workdir map from path to {RepoStatus.FILESTATUS} * @return {Object} * @return {Object} return.staged map from path to {RepoStatus.FileStatus} * @return {Object} return.workdir map from path to {RepoStatus.FileStatus} */ exports.calculateAllStatus = function (staged, workdir) { assert.isObject(staged); assert.isObject(workdir); const ADDED = RepoStatus.FILESTATUS.ADDED; const resultIndex = {}; const resultWorkdir = {}; Object.keys(workdir).forEach(filename => { const workdirStatus = workdir[filename]; // If untracked, store this change in the workdir section; otherwise, // store it in the staged section. if (ADDED === workdirStatus && ADDED !== staged[filename]) { resultWorkdir[filename] = workdirStatus; } else { resultIndex[filename] = workdirStatus; } }); return { staged: resultIndex, workdir: resultWorkdir, }; }; /** * Return a `RepoStatus` object reflecting the commit that would be made for a * repository having the specified `normalStatus` (indicating HEAD -> index -> * workdir changes) and the specified `toWorkdirStatus` (indicating HEAD -> * workdir changes). All workdir changes in `toWorkdirStatus` will be turned * into staged changes, except when `toWorkdirStatus` indicates that a file has * been added but `normalStatus` does not, i.e., the file is untracked. The * behavior is undefined if `normalStatus` and `toWorkdirStatus` to not have * the same values for fields other than `staged` and `workdir` in the main * repo status or that of any submodules. * * @param {RepoStatus} normalStatus * @param {RepoStatus} toWorkdirStatus * @return {RepoStatus} */ exports.calculateAllRepoStatus = function (normalStatus, toWorkdirStatus) { assert.instanceOf(normalStatus, RepoStatus); assert.instanceOf(toWorkdirStatus, RepoStatus); function convertOneRepo(normal, toWorkdir) { const index = normal.staged; const workdir = toWorkdir.workdir; const converted = exports.calculateAllStatus(index, workdir); return normal.copy({ staged: converted.staged, workdir: converted.workdir, }); } // Convert the status for the meta-repo. const base = convertOneRepo(normalStatus, toWorkdirStatus); // Then do the same for each submodule. const subs = base.submodules; const workdirSubs = toWorkdirStatus.submodules; const resultSubs = {}; Object.keys(subs).forEach(subName => { const sub = subs[subName]; const normalSubWorkdir = sub.workdir; if (null === normalSubWorkdir) { // If the submodule isn't open, take it as is. resultSubs[subName] = sub; return; // RETURN } // Otherwise, when the submodule is open, we need to pull out the // `RepoStatus` objects from both the normal and workdir sides and // apply `convertOneRepo`. const toWorkdirSub = workdirSubs[subName]; assert.notEqual(undefined, toWorkdirSub); const toWorkdirSubWorkdir = toWorkdirSub.workdir; assert.isNotNull(toWorkdirSubWorkdir); const newStatus = convertOneRepo(normalSubWorkdir.status, toWorkdirSubWorkdir.status); const newWorkdir = new RepoStatus.Submodule.Workdir( newStatus, normalSubWorkdir.relation); resultSubs[subName] = sub.copy({ workdir: newWorkdir, }); }); return base.copy({ submodules: resultSubs, }); }; /** * Return the status of the specified `repo` indicating a commit that would be * performed, including all (tracked) modified files if the specified `all` is * provided (default false). Restrict status to the specified `paths` if * nonempty (default []), using the specified `cwd` to resolve their meaning. * The behavior undefined unless `0 === paths.length || !all`. * * @param {NodeGit.Repository} repo * @param {String} cwd * @param {Object} [options] * @param {Boolean} [options.all] * @param {Boolean} [options.showMetaChanges] * @return {RepoStatus} */ exports.getCommitStatus = co.wrap(function *(repo, cwd, options) { if (undefined === options) { options = {}; } else { assert.isObject(options); } if (undefined === options.all) { options.all = false; } else { assert.isBoolean(options.all); } if (undefined === options.showMetaChanges) { options.showMetaChanges = false; } else { assert.isBoolean(options.showMetaChanges); } if (undefined === options.paths) { options.paths = []; } else { assert.isArray(options.paths); } assert(0 === options.paths.length || !options.all, "paths not compatible with auto-staging"); // The `baseStatus` object holds the "normal" status reflecting the // difference between HEAD -> index and index -> workdir. This status is // used to calculate all other types such as for `all` and with `paths. const baseStatus = yield StatusUtil.getRepoStatus(repo, { showMetaChanges: options.showMetaChanges, }); if (0 !== options.paths.length) { // Doing path-based status. First, we need to compute the // `commitStatus` object that reflects the paths requested by the user. const requestedStatus = yield StatusUtil.getRepoStatus(repo, { cwd: cwd, paths: options.paths, showMetaChanges: options.showMetaChanges, }); return exports.calculatePathCommitStatus(baseStatus, requestedStatus); } if (options.all) { // If we're auto-staging, we have to compute the commit status // differently, comparing the workdir directly to the tree rather than // the index, but still avoiding untracked files. const workdirStatus = yield StatusUtil.getRepoStatus(repo, { showMetaChanges: options.showMetaChanges, ignoreIndex: true, showAllUntracked: true, }); return exports.calculateAllRepoStatus(baseStatus, workdirStatus); } // If no special options, just return `baseStatus` as is. return baseStatus; }); /** * Return a `RepoStatus` object having the same value as the specified `status` * but with all staged and workdir changes removed from all submodules. * * @param {RepoStatus} status * @return {RepoStatus} */ exports.removeSubmoduleChanges = function (status) { assert.instanceOf(status, RepoStatus); const newSubs = {}; const subs = status.submodules; Object.keys(subs).forEach(subName => { const sub = subs[subName]; const workdir = sub.workdir; if (null !== workdir) { // If the sub is open, make a copy of its status that is the same // except for the removal of all staged and workdir changes. const workdirStatus = workdir.status; const newWorkdirStatus = workdirStatus.copy({ staged: {}, workdir: {}, }); const newWorkdir = new RepoStatus.Submodule.Workdir( newWorkdirStatus, workdir.relation); const newSub = sub.copy({ workdir: newWorkdir }); newSubs[subName] = newSub; } else { // If the sub is closed just copy it over as is. newSubs[subName] = sub; } }); return status.copy({ submodules: newSubs, }); }; /** * Return a string to use as a prompt for creating a split commit from the * specified `status`. If the specified `metaCommitData` is provided, supply * information from it and the specified `currentSignature` in the prompt for * the meta-repo commit. Similarly, if there is an entry in`subAmendData` for * a submodule, us that entry in the prompt for that submodule and display * amend-specific information, but do not prompt with the previous commit * message for a submodule if it matches the meta-repo message. * * @param {RepoStatus} status * @param {NodeGit.Signature} currentSignature * @param {CommitMetaData|null} metaCommitData * @param {Object} subAmendData map from name to CommitMetaData * @return {String} */ exports.formatSplitCommitEditorPrompt = function (status, currentSignature, metaCommitData, subAmendData) { assert.instanceOf(status, RepoStatus); assert.instanceOf(currentSignature, NodeGit.Signature); if (null !== metaCommitData) { assert.instanceOf(metaCommitData, CommitMetaData); } assert.isObject(subAmendData); // Put a prompt for the meta repo and its status first. let result = ""; if (metaCommitData) { result += metaCommitData.message; } result += `\ # <*> enter meta-repo message above this line; delete this line to \ commit only submodules `; if (metaCommitData) { const text = exports.formatAmendSignature(currentSignature, metaCommitData.signature); result += exports.prefixWithPound(text); } result += exports.prefixWithPound(branchStatusLine(status)); // Remove submodule changes because we're going to display them under each // submodule. const metaStatus = exports.removeSubmoduleChanges(status); result += exports.prefixWithPound(exports.formatStatus(metaStatus, "")); const submodules = status.submodules; const subNames = Object.keys(submodules).sort(); // Now, add a section for each submodule that has changes to be committed. subNames.forEach(subName => { const sub = submodules[subName]; const workdir = sub.workdir; if (null === workdir) { // Cannot generate a commit for a closed submodule. return; // RETURN } const subStat = workdir.status; if (subStat.isIndexClean()) { // No need to do anything if the submodule has no staged files. return; // RETURN } result += `\ # ----------------------------------------------------------------------------- `; const subData = subAmendData[subName]; // Prompt with the preexisting commit message for an amended sub, // unless that message matches that of the preexisting meta-repo commit // message. if (undefined !== subData && (null === metaCommitData || metaCommitData.message !== subData.message)) { result += subData.message; } result += `\ # <${subName}> enter message for '${subName}' above this line; delete this \ line to skip committing '${subName}' `; if (undefined !== subData) { result += `\ # If this sub-repo is skipped, it will not be amended and the original commit # will be used. `; const text = exports.formatAmendSignature(currentSignature, subData.signature); result += exports.prefixWithPound(text); } result += exports.prefixWithPound(exports.formatStatus(subStat, "")); }); result += `\ # # Please enter the commit message(s) for your changes. The message for a # repo will be composed of all lines not beginning with '#' that come before # its tag, but after any other tag (or the beginning of the file). Tags are # lines beginning with '# <sub-repo-name>', or '# <*>' for the meta-repo. # If the tag for a repo is removed, no commit will be generated for that repo. # If you do not provide a commit message for a sub-repo, the commit # message for the meta-repo will be used. `; return result; }; /** * Parse the specified `text` and return an object indicating what (if any) * commit messages to use for the meta-repo and each sub-repo. The meta-repo * commit message consists of the non-comment lines prior to the first sub-repo * tag. A sub-repo tag is a line in the form of `# <${sub-repo name}>`. The * commit message for a sub-repo consists of the non-comment lines between its * tag and the next sub-repo tag, or the end of the file. If the tag exists * for a sub-repo, but its message is blank, the commit message for the * meta-repo is used. if it has one. Throw a `UserError` if the same sub-repo * tag is found more than once. * * @param {String} text * @return {Object} * @return {String|null} return.metaMessage commit message for the meta-repo * @return {Object} return.subMessages commit messages for submodules */ exports.parseSplitCommitMessages = function (text) { assert.isString(text); let metaMessage = null; const seen = new Set(); const subMessages = {}; const lines = text.split("\n"); let start = 0; // start of current block of lines function consumeCurrentBlock(tag, start, end) { if (seen.has(tag)) { throw new UserError(`${tag} was used more than once.`); } seen.add(tag); const blockLines = lines.slice(start, end); const message = GitUtil.stripMessageLines(blockLines); if ("*" === tag) { if ("" !== message) { metaMessage = message; } else { throw new UserError("Empty meta-repo commit message."); } } else { if ("" === message) { if (null !== metaMessage) { subMessages[tag] = metaMessage; } } else { subMessages[tag] = message; } } } const tagMatcher = /# <(.*)>.*$/; for (let i = 0; i < lines.length; ++i) { const line = lines[i]; const match = tagMatcher.exec(line); if (null !== match) { consumeCurrentBlock(match[1], start, i); start = i + 1; } } return { metaMessage: metaMessage, subMessages: subMessages, }; }; function errorWithStatus(status, relCwd, message) { throw new UserError(`\ ${PrintStatusUtil.printRepoStatus(status, relCwd)} ${colors.yellow(message)} `); } function checkForPathIncompatibleSubmodules(repoStatus, relCwd) { const Commit = require("../util/commit"); if (Commit.areSubmodulesIncompatibleWithPathCommits(repoStatus)) { errorWithStatus(repoStatus, relCwd, `\ Cannot use path-based commit on submodules with staged commits or configuration changes.`); } } function abortForNoMessage() { throw new UserError("Aborting commit due to empty commit message."); } /** * Perform the commit command in the specified `repo`. Consider the values in * the specified `paths` to be relative to the specified `cwd`, and format * paths displayed to the user according to `cwd`. If the optionally specified * `message` is provided use it for the commit message; otherwise, prompt the * user to enter a message. If the specified `all` is true, include (tracked) * modified but unstaged changes. If `paths` is non-empty, include only the * files indicated in those `paths` in the commit. If the specified * `interactive` is true, prompt the user to create an "interactive" message, * allowing for different commit messages for each changed submodules. The * behavior is undefined if `null !== message && true === interactive` or if `0 * !== paths.length && all`. * * @param {NodeGit.Repository} repo * @param {String} cwd * @param {String|null} message * @param {Boolean} meta * @param {Boolean} all * @param {String[]} paths * @param {Boolean} interactive * @param {Boolean} noVerify * @param {Boolean} editMessage * @return {Object} * @return {String} return.metaCommit * @return {Object} return.submoduleCommits map from sub name to commit id */ exports.doCommitCommand = co.wrap(function *(repo, cwd, message, all, paths, interactive, noVerify, editMessage) { assert.instanceOf(repo, NodeGit.Repository); assert.isString(cwd); if (null !== message) { assert.isString(message); } assert.isBoolean(all); assert.isArray(paths); assert.isBoolean(interactive); assert.isBoolean(noVerify); assert.isBoolean(editMessage); const workdir = repo.workdir(); const relCwd = path.relative(workdir, cwd); const repoStatus = yield exports.getCommitStatus(repo, cwd, { all: all, paths: paths, }); // Abort if there are uncommittable submodules; we don't want to commit a // .gitmodules file with references to a submodule that doesn't have a // commit. // // TODO: potentially do somthing more intelligent like committing a // different versions of .gitmodules than what is on disk to omit // "uncommittable" submodules. Considering that this situation should be // relatively rare, I don't think it's worth the additional complexity at // this time. if (repoStatus.areUncommittableSubmodules()) { errorWithStatus( repoStatus, relCwd, "Please stage changes in new submodules before committing."); } // If we're using paths, the status of what we're committing needs to be // calculated. Also, we need to see if there are any submodule // configuration changes. const usingPaths = 0 !== paths.length; // If we're doing a path based commit, validate that we are in a supported // configuration. if (usingPaths) { checkForPathIncompatibleSubmodules(repoStatus, relCwd); } const seq = yield SequencerStateUtil.readSequencerState(repo.path()); if (usingPaths || !all || interactive) { if (seq) { const ty = seq.type.toLowerCase(); const msg = "Cannot do a partial commit during a " + ty; throw new UserError(msg); } } let mergeParent = null; if (seq && seq.type === SequencerState.TYPE.MERGE) { mergeParent = NodeGit.Commit.lookup(repo, seq.target); } // If there is nothing possible to commit, exit early. if (!exports.shouldCommit(repoStatus, false, undefined)) { process.stdout.write(PrintStatusUtil.printRepoStatus(repoStatus, relCwd)); return; } let subMessages; if (interactive) { // If 'interactive' mode is requested, ask the user to specify which // repos are committed and with what commit messages. const sig = yield ConfigUtil.defaultSignature(repo); const prompt = exports.formatSplitCommitEditorPrompt(repoStatus, sig, null, {}); const userText = yield GitUtil.editMessage(repo, prompt, editMessage, !noVerify); const userData = exports.parseSplitCommitMessages(userText); message = userData.metaMessage; subMessages = userData.subMessages; // Check if there's actually anything to commit. if (!exports.shouldCommit(repoStatus, message === null, subMessages)) { console.log("Nothing to commit."); return; } } else if (null === message) { // If no message on the command line, prompt for one. const initialMessage = exports.formatEditorPrompt(repoStatus, cwd); message = yield GitUtil.editMessage(repo, initialMessage, editMessage, !noVerify); } message = GitUtil.stripMessage(message); if ("" === message) { abortForNoMessage(); } if (usingPaths) { return yield exports.commitPaths(repo, repoStatus, message, noVerify); } else { return yield exports.commit(repo, all, repoStatus, message, subMessages, noVerify, mergeParent); } }); /** * Perform the amend commit command in the specified `repo`. Use the specified * `cwd` to format paths displayed to the user. If the optionally specified * `message` is provided use it for the commit message; otherwise, prompt the * user to enter a message. If the specified `all` is true, include (tracked) * modified but unstaged changes. If the specified `interactive` is true, * prompt the user to create an "interactive" message, allowing for different * commit messages for each changed submodules. Use the specified * `editMessage` function to invoke an editor when needed. If * `!editMessage`, use the message of the previous commit. The * behavior is undefined if `null !== message && true === interactive`. Do not * generate a commit if it would be empty. * * @param {NodeGit.Repository} repo * @param {String} cwd * @param {String|null} message * @param {Boolean} all * @param {Boolean} interactive * @param {Boolean} noVerify * @param {Boolean} editMessage * @return {Object} * @return {String|null} return.metaCommit * @return {Object} return.submoduleCommits map from sub name to commit id */ exports.doAmendCommand = co.wrap(function *(repo, cwd, message, all, interactive, noVerify, editMessage) { assert.instanceOf(repo, NodeGit.Repository); assert.isString(cwd); if (null !== message) { assert.isString(message); } assert.isBoolean(all); assert.isBoolean(interactive); assert.isBoolean(editMessage); const workdir = repo.workdir(); const relCwd = path.relative(workdir, cwd); const amendStatus = yield exports.getAmendStatus(repo, { all: all, cwd: relCwd, }); const status = amendStatus.status; const subsToAmend = amendStatus.subsToAmend; const head = yield repo.getHeadCommit(); const defaultSig = yield ConfigUtil.defaultSignature(repo); const headMeta = exports.getCommitMetaData(head); let subMessages = null; if (interactive) { // If 'interactive' mode is requested, ask the user to specify which // repos are committed and with what commit messages. const prompt = exports.formatSplitCommitEditorPrompt(status, defaultSig, headMeta, subsToAmend); const userText = yield GitUtil.editMessage(repo, prompt, editMessage, !noVerify); const userData = exports.parseSplitCommitMessages(userText); message = userData.metaMessage; subMessages = userData.subMessages; } else { const mismatched = Object.keys(subsToAmend).filter(name => { const meta = subsToAmend[name]; return !headMeta.equivalent(meta); }); if (0 !== mismatched.length) { let error = `\ The last meta-repo commit (message or author) does not match that of the last commit in the following sub-repos: `; mismatched.forEach(name => { error += ` ${colors.red(name)}\n`; }); error += `\ To prevent errors, you must make this commit using the interactive ('-i') option, which will allow you to see and edit the commit messages for each repository independently.`; throw new UserError(error); } if (null === message) { // If no message, use editor / hooks. const prompt = exports.formatAmendEditorPrompt(defaultSig, headMeta, status, relCwd); const rawMessage = yield GitUtil.editMessage(repo, prompt, editMessage, !noVerify); message = GitUtil.stripMessage(rawMessage); } } if ("" === message) { abortForNoMessage(); } if (!exports.shouldCommit(status, null === message, subMessages || undefined)) { process.stdout.write(PrintStatusUtil.printRepoStatus(status, relCwd)); process.stdout.write(` You asked to amend the most recent commit, but doing so would make it empty. You can remove the commit entirely with "git meta reset HEAD^".`); return { metaCommit: null, submoduleCommits: {} }; } // Finally, perform the operation. return yield exports.amendMetaRepo(repo, status, Object.keys(subsToAmend), all, message, subMessages, noVerify); });
36.140373
79
0.577378
3b2fe5f19b0432435887fa0aad42443a9a4fad6e
2,498
js
JavaScript
spec/transformer-integration-spec.js
asutherland/graph-viz-d3-js
546cc2e419bff3a10cdd981ed90d858a5324a526
[ "MIT" ]
300
2015-01-02T13:36:14.000Z
2022-03-19T10:05:13.000Z
spec/transformer-integration-spec.js
asutherland/graph-viz-d3-js
546cc2e419bff3a10cdd981ed90d858a5324a526
[ "MIT" ]
52
2015-01-24T14:00:47.000Z
2018-10-08T17:58:00.000Z
spec/transformer-integration-spec.js
asutherland/graph-viz-d3-js
546cc2e419bff3a10cdd981ed90d858a5324a526
[ "MIT" ]
34
2015-02-05T05:43:20.000Z
2020-08-30T00:26:32.000Z
define(['transformer', 'spec/shapes/longer-labels', 'text!spec/dots/directed/switch.gv', 'spec/shapes/directed/switch', 'text!spec/dots/directed/table.gv', 'spec/shapes/directed/table', 'text!spec/dots/adept.gv', 'spec/shapes/adept', 'spec/shapes/double-quotes', 'spec/shapes/multiple-edges'], function (transformer, longerLabels, switchSource, switchShape, tableSource, tableShape, adeptSource, adeptShape, doubleQuotesShape, multipleEdgesShape) { describe('Transformer', function() { it("should extract node shapes correctly when labels are longer than 4 chars", function() { var stage = transformer.generate("digraph { longer -> labels -> ok}"); expect(stage).toEqual(longerLabels); }); xit("should handle struct with multiple edges", function() { var stage = transformer.generate(switchSource); expect(stage).toEqual(switchShape); }); xit("should handle diagrams with html tables", function() { var stage = transformer.generate(tableSource); expect(stage).toEqual(tableShape); }); it("should handle undirected diagrams", function() { var stage = transformer.generate(adeptSource); expect(stage).toEqual(adeptShape); }); xit("should handle diagrams with html tables", function() { var stage = transformer.generate( 'digraph G { G[ label="google.com" shape=box URL="http://google.com" tooltip="Click me!" style="filled" fillcolor="#5cb85c" color="#5cb85c" fontcolor="#ffffff"];}' ); expect(stage).toEqual(tableShape); }); it("should handle diagrams with escaped quotes", function() { var stage = transformer.generate('digraph G {mynode [ label="Some \\\" quote" ];}'); expect(stage).toEqual(doubleQuotesShape); }); it("should handle multiple edges between nodes", function() { var stage = transformer.generate([ "digraph G {", " A; B; C", " subgraph Rel1 {", " edge [dir=none, color=red]", " A -> B -> C -> A", " }", " subgraph Rel2 {", " edge [color=blue]", " B -> C", " C -> A", " }", "}" ].join("\n")); expect(stage).toEqual(multipleEdgesShape); }); it("should handle id of nodes", function() { var stage = transformer.generate( "digraph G {foo_node [id=foo_node_id]}" ); expect(stage.groups[0].identifier).toEqual("foo_node_id"); }); }); });
37.848485
171
0.61289
3b306377a27f01836ba1dbe6beb1654957521aac
3,565
js
JavaScript
server/test/unit/models/auth.spec.js
butlerx/coolest-platform
acf0c8e40452524ba890373e1d1f1af96d012276
[ "MIT" ]
1
2019-01-30T12:09:51.000Z
2019-01-30T12:09:51.000Z
server/test/unit/models/auth.spec.js
CoderDojo/coolest-platform
acf0c8e40452524ba890373e1d1f1af96d012276
[ "MIT" ]
125
2017-11-26T23:12:31.000Z
2022-02-12T08:30:32.000Z
server/test/unit/models/auth.spec.js
butlerx/coolest-platform
acf0c8e40452524ba890373e1d1f1af96d012276
[ "MIT" ]
3
2017-11-26T22:02:36.000Z
2018-01-09T12:07:09.000Z
const uuid = require('uuid'); const proxy = require('proxyquire'); const jsonwebtoken = require('jsonwebtoken'); const bcrypt = require('bcrypt'); const config = require('../../../config/auth'); let Auth; describe('auth model', () => { const sandbox = sinon.createSandbox(); before(async () => { Auth = proxy('../../../models/auth', { '../database': {}, './user': {}, jsonwebtoken, bcrypt, }); }); it('should create an auth and create a new jwt', async () => { const attributes = { userId: uuid() }; const auth = await new Auth(attributes); const tokenCreator = sinon.spy(auth, 'createToken'); await auth.triggerThen('saving', { attributes }); expect(tokenCreator).to.have.been.calledOnce; expect(attributes.token.length).to.equal(189); }); // Ensure this is only called "onSave" elsewhat queries are appended the token it('should not create a token when using Auth as a Factory', async () => { const auth = await new Auth({ userId: uuid() }); expect(auth.attributes.token).to.be.undefined; }); afterEach(() => { sandbox.reset(); }); describe('createToken', () => { it('should use jwt', () => { const signSpy = sinon.spy(jsonwebtoken, 'sign'); const userId = 'user1'; new Auth().createToken(userId); expect(signSpy).to.have.been.calledOnce; expect(signSpy).to.have.been.calledWith({ data: userId }); }); }); describe('verifyToken', () => { afterEach(() => { sandbox.reset(); sandbox.restore(); }); it('should return the decrypted token on success', () => { const verifySpy = sandbox.spy(jsonwebtoken, 'verify'); const auth = new Auth(); const token = auth.createToken('user1'); const res = Auth.verifyToken(token); expect(verifySpy).to.have.been.calledOnce; expect(verifySpy).to.have.been.calledWith( token, config.authSecret, { maxAge: config.authTimeout }, ); expect(res.data).to.equal('user1'); expect(Object.keys(res)).to.eql(['data', 'iat', 'exp']); }); it('should throw on error or falsy', () => { const verifySpy = sandbox.spy(jsonwebtoken, 'verify'); const auth = new Auth(); let token = auth.createToken('user1'); token = token.substring(1); try { Auth.verifyToken(token); } catch (e) { expect(verifySpy).to.have.been.calledOnce; expect(verifySpy).to.have.been.calledWith( token, config.authSecret, { maxAge: config.authTimeout }, ); expect(e.message).to.equal('invalid token'); } }); }); describe('setPassword', () => { it('should set a bcrypted password', async () => { const genSaltSpy = sinon.spy(bcrypt, 'genSalt'); const hashSpy = sinon.spy(bcrypt, 'hash'); const auth = new Auth(); await auth.setPassword('banana'); expect(genSaltSpy).to.have.been.calledOnce; expect(hashSpy).to.have.been.calledOnce; expect(hashSpy).to.have.been.calledWith( 'banana', sinon.match.string, ); }); }); describe('verifyPassword', () => { it('should use bcrypt', async () => { const verifySpy = sinon.spy(bcrypt, 'compare'); const auth = new Auth(); await auth.setPassword('banana'); await auth.verifyPassword('banana'); expect(verifySpy).to.have.been.calledOnce; expect(verifySpy).to.have.been.calledWith( 'banana', auth.attributes.password, ); }); }); });
31.548673
80
0.591585
3b30831b5b7207dde94cfbdcc4dc0276b26f3b5b
532
js
JavaScript
server/routes/index.js
gse7en2012/bambooGoldAdmin
109eaf78996dedb90ddb4e83d08c9703bdab85d1
[ "MIT" ]
null
null
null
server/routes/index.js
gse7en2012/bambooGoldAdmin
109eaf78996dedb90ddb4e83d08c9703bdab85d1
[ "MIT" ]
null
null
null
server/routes/index.js
gse7en2012/bambooGoldAdmin
109eaf78996dedb90ddb4e83d08c9703bdab85d1
[ "MIT" ]
null
null
null
console.log('route load'); module.exports = { Auth: require('./Auth'), Inits: require('./Init'), News: require('./News'), NewsAct: require('./NewsAct'), Activity: require('./Activity'), Links: require('./Link'), Info: require('./Info'), Strategy: require('./Strategy'), Users: require('./Users'), Live: require('./Live'), Discuss: require('./Discuss'), Questions: require('./Questions'), Files: require('./Files'), Message: require('./Message'), Vip: require('./Vip') };
26.6
38
0.573308
3b30839cd36cc26f76403d1ee23efcce87df4cda
588
js
JavaScript
validator_webui/static/js/views/CookbookView.js
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
validator_webui/static/js/views/CookbookView.js
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
validator_webui/static/js/views/CookbookView.js
ging/fiware-validator
d9e58318817bdbb690ce960930a8d204f42b0fce
[ "Apache-2.0" ]
null
null
null
/** * Created by Administrator on 12/05/2016. */ define(function (require) { "use strict"; var _ = require("underscore"), Backbone = require('backbone'), Cookbook = require('models/CookbookModel'); return Backbone.View.extend({ model: Cookbook, initialize: function () { this.template = _.template('<option value="<%=id%>"><%= name %></option>'); this.render(); }, render: function () { this.setElement(this.template(this.model.attributes)); return this; } }) });
25.565217
87
0.540816
3b30941a7c064361dcfd51d23435a1e3bf57ec56
1,039
js
JavaScript
code/cypher/encrypt_decrypt.js
RyLeeHarrison/javascript_code_snippet
d1153e7a895e1a8776e8e40c4020f82de1bfa4c8
[ "MIT" ]
1
2019-06-08T14:32:57.000Z
2019-06-08T14:32:57.000Z
code/cypher/encrypt_decrypt.js
RyleeHarrison/javascript_code_snippet
d1153e7a895e1a8776e8e40c4020f82de1bfa4c8
[ "MIT" ]
null
null
null
code/cypher/encrypt_decrypt.js
RyleeHarrison/javascript_code_snippet
d1153e7a895e1a8776e8e40c4020f82de1bfa4c8
[ "MIT" ]
1
2020-11-24T15:56:29.000Z
2020-11-24T15:56:29.000Z
const crypto = require('crypto'); const algorithm = 'aes192'; const theKey = 'password'; const cipher = crypto.createCipher(algorithm, theKey); const decipher = crypto.createDecipher(algorithm, theKey); const inputEncoding = 'utf8'; const outputEncoding = 'hex'; function encrypt(text) { let encrypted = cipher.update(text, inputEncoding, outputEncoding); encrypted += cipher.final('hex'); return encrypted; } function decrypt(encrypted_text) { let decrypted = decipher.update(encrypted_text, outputEncoding, inputEncoding); decrypted += decipher.final(inputEncoding); return decrypted; } const plaintext = 'Hello world'; console.log('PLAIN TEXT: ' + plaintext); // ==> PLAIN TEXT: Hello world const encrypted_plaintext = encrypt(plaintext); console.log('encrypted: ' + encrypted_plaintext); // ==> encrypted: 028d5dc7fbae682d276dc9359155a2f0 const encrypted_plaintext_decrypted = decrypt(encrypted_plaintext); console.log('decrypted: ' + encrypted_plaintext_decrypted); // ==> decrypted: Hello world
28.081081
81
0.744947
3b30ab0aa66a94a5729d9cd879be8efb22e62275
701
js
JavaScript
leetcode/2.add-two-numbers/add-two-numbers.js
typeofNaN/HelloWorld
3ed82c3af9c5a4dd18945a0e544d486ef3e05360
[ "MIT" ]
null
null
null
leetcode/2.add-two-numbers/add-two-numbers.js
typeofNaN/HelloWorld
3ed82c3af9c5a4dd18945a0e544d486ef3e05360
[ "MIT" ]
null
null
null
leetcode/2.add-two-numbers/add-two-numbers.js
typeofNaN/HelloWorld
3ed82c3af9c5a4dd18945a0e544d486ef3e05360
[ "MIT" ]
null
null
null
/** * Definition for singly-linked list. * function ListNode(val, next) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } */ /** * @param {ListNode} l1 * @param {ListNode} l2 * @return {ListNode} */ var addTwoNumbers = function(l1, l2) { const result = p = {} while (l1 || l2) { // 求和 const sum = (l1 && l1.val || 0) + (l2 && l2.val || 0) + (p.val || 0) // 取模 const exceed = ~~(sum / 10) l1 = l1 && l1.next l2 = l2 && l2.next // 取余 p.val = sum % 10 if (l1 || l2 || exceed) { p.next = { val: exceed } } p = p.next } return result }
20.028571
74
0.457917
3b31686f5403aaf8381ed14b9b68281c1a7cb889
2,703
js
JavaScript
app-libs/translate/utils.js
xyqfer/youpin
0a38eae6a7b5804f9ef8f26285dd8a0dead2771e
[ "MIT" ]
2
2017-12-04T03:35:58.000Z
2019-04-18T04:19:05.000Z
app-libs/translate/utils.js
xyqfer/youpin
0a38eae6a7b5804f9ef8f26285dd8a0dead2771e
[ "MIT" ]
203
2017-12-04T03:16:41.000Z
2022-03-31T21:18:14.000Z
app-libs/translate/utils.js
xyqfer/youpin
0a38eae6a7b5804f9ef8f26285dd8a0dead2771e
[ "MIT" ]
null
null
null
function shiftLeftOrRightThenSumOrXor(num, opArray) { return opArray.reduce((acc, opString) => { var op1 = opString[1]; // '+' | '-' ~ SUM | XOR var op2 = opString[0]; // '+' | '^' ~ SLL | SRL var xd = opString[2]; // [0-9a-f] var shiftAmount = hexCharAsNumber(xd); var mask = (op1 == '+') ? acc >>> shiftAmount : acc << shiftAmount; return (op2 == '+') ? (acc + mask & 0xffffffff) : (acc ^ mask); }, num); } function hexCharAsNumber(xd) { return (xd >= 'a') ? xd.charCodeAt(0) - 87 : Number(xd); } function transformQuery(query) { for (var e = [], f = 0, g = 0; g < query.length; g++) { var l = query.charCodeAt(g); if (l < 128) { e[f++] = l; // 0{l[6-0]} } else if (l < 2048) { e[f++] = l >> 6 | 0xC0; // 110{l[10-6]} e[f++] = l & 0x3F | 0x80; // 10{l[5-0]} } else if (0xD800 == (l & 0xFC00) && g + 1 < query.length && 0xDC00 == (query.charCodeAt(g + 1) & 0xFC00)) { // that's pretty rare... (avoid ovf?) l = (1 << 16) + ((l & 0x03FF) << 10) + (query.charCodeAt(++g) & 0x03FF); e[f++] = l >> 18 | 0xF0; // 111100{l[9-8*]} e[f++] = l >> 12 & 0x3F | 0x80; // 10{l[7*-2]} e[f++] = l & 0x3F | 0x80; // 10{(l+1)[5-0]} } else { e[f++] = l >> 12 | 0xE0; // 1110{l[15-12]} e[f++] = l >> 6 & 0x3F | 0x80; // 10{l[11-6]} e[f++] = l & 0x3F | 0x80; // 10{l[5-0]} } } return e; } function normalizeHash(encondindRound2) { if (encondindRound2 < 0) { encondindRound2 = (encondindRound2 & 0x7fffffff) + 0x80000000; } return encondindRound2 % 1E6; } function calcHash(query, windowTkk) { // STEP 1: spread the the query char codes on a byte-array, 1-3 bytes per char var bytesArray = transformQuery(query); // STEP 2: starting with TKK index, add the array from last step one-by-one, and do 2 rounds of shift+add/xor var d = windowTkk.split('.'); var tkkIndex = Number(d[0]) || 0; var tkkKey = Number(d[1]) || 0; var encondingRound1 = bytesArray.reduce((acc, current) => { acc += current; return shiftLeftOrRightThenSumOrXor(acc, ['+-a', '^+6']) }, tkkIndex); // STEP 3: apply 3 rounds of shift+add/xor and XOR with they TKK key var encondingRound2 = shiftLeftOrRightThenSumOrXor(encondingRound1, ['+-3', '^+b', '+-f']) ^ tkkKey; // STEP 4: Normalize to 2s complement & format var normalizedResult = normalizeHash(encondingRound2); return normalizedResult.toString() + "." + (normalizedResult ^ tkkIndex) } module.exports.getTK = (text) => { return calcHash(text, '409837.2120040981'); };
43.596774
114
0.538291
3b318510f173e2aba404fcd02b6678496975f956
750
js
JavaScript
testAxios/ZomatoAPI.js
Ranur-react/React-Native-ABSENSI-MAP
03fdfa5dcc013004fb87b6fab6ebdc9f575764d6
[ "Apache-2.0" ]
null
null
null
testAxios/ZomatoAPI.js
Ranur-react/React-Native-ABSENSI-MAP
03fdfa5dcc013004fb87b6fab6ebdc9f575764d6
[ "Apache-2.0" ]
null
null
null
testAxios/ZomatoAPI.js
Ranur-react/React-Native-ABSENSI-MAP
03fdfa5dcc013004fb87b6fab6ebdc9f575764d6
[ "Apache-2.0" ]
null
null
null
import React,{Component} from 'react'; import {View,ScrollView,Text} from 'react-native'; import axios from 'axios'; export default class ZomatoAPI extends Component { state={data:''}; constructor() { super(); this.getdata(); }; getdata =async()=>{ let api = axios.create({ baseURL: `https://developers.zomato.com/api/v2.1/categories` }); let x; api.defaults.headers.common['user-key'] = '9f620278d1adb224c5c59fd77f29847d'; api.get('/').then(res=>{ x = res.data; console.log(x) this.setState({data:123}) }) } render(){ return( <ScrollView> <View> <Text>Hayoo "{this.state.data}" </Text> </View> </ScrollView> ) } }
18.75
81
0.569333
3b321eac5b66594b0e325969106d85ab67085329
15,318
js
JavaScript
assets/users/person.controller.js
GregDick/clipped-in
8bee0339422162689b301ba73c4fed8f565669f4
[ "MIT" ]
1
2015-09-11T19:07:41.000Z
2015-09-11T19:07:41.000Z
public/assets/users/person.controller.js
GregDick/clipped-in
8bee0339422162689b301ba73c4fed8f565669f4
[ "MIT" ]
1
2015-07-15T16:38:24.000Z
2015-07-20T14:41:34.000Z
public/assets/users/person.controller.js
GregDick/clipped-in
8bee0339422162689b301ba73c4fed8f565669f4
[ "MIT" ]
null
null
null
'use strict'; angular.module('clippedIn').controller('PersonCtrl', function (Profile, $routeParams, FB_URL, $filter, $scope, $rootScope, $location, Outside, SweetAlert) { //=====================THIS CONTROLLER IS FOR VIEWING SOMEONE ELSE'S PROFILE=================== var main = this; //call popover toggle function main.toggleTop = function () { $('.topPop').popover('toggle'); }; main.toggleLead = function () { $('.leadPop').popover('toggle'); }; //gets user information var fb = new Firebase(FB_URL); var authData = fb.getAuth(); //gets id of profile that is being viewed main.id = $routeParams.id; //if this is your own profile redirect to #/profile if (authData.uid === main.id) { $location.path('/profile'); } Profile.getProfile(main.id, function (profileObj) { main.profileObj = profileObj; //set topRope and lead as booleans main.topRope = $filter('lowercase')(profileObj.topRope) === 'yes' ? true : false; main.lead = $filter('lowercase')(profileObj.lead) === 'yes' ? true : false; //set belay string if (main.topRope && main.lead) { main.belay = ' can top-rope AND lead belay'; } else if (main.topRope && !main.lead) { main.belay = ' can top-rope belay but doesn\'t know how to lead belay yet...'; } else if (!main.topRope && main.lead) { main.belay = ' can lead belay but doesn\'t know how to top-rope belay yet...'; } else { main.belay = ' doesn\'t know how to belay yet...'; } }); checkTopRope(); checkLead(); main.endorseTopRope = function () { Profile.addTopRope(main.id, authData.uid, function () { checkTopRope(); SweetAlert.swal({ title: '+1 Top-Rope Belay!', type: 'success', showConfirmButton: false, timer: 1500 }); }); }; main.endorseLead = function () { Profile.addLead(main.id, authData.uid, function () { checkLead(); SweetAlert.swal({ title: '+1 Lead Belay!', type: 'success', showConfirmButton: false, timer: 1500 }); }); }; function checkTopRope() { Profile.getTopRope(main.id, function (res) { main.topRopeNames = []; //makes sure you can't endorse twice and sets popover array for (var id in res) { if (res[id] === authData.uid) { main.disableTopRope = true; } Profile.getProfile(res[id], function (profileObj) { main.topRopeNames.push(profileObj.name); console.log(profileObj); //lists first + number of endorsed if (main.topRopeNames.length > 2) { main.topRopePeople = main.topRopeNames[0] + ' and ' + (main.topRopeNames.length - 1) + ' other people think '; } else if (main.topRopeNames.length === 2) { main.topRopePeople = main.topRopeNames[0] + ' and 1 other person think '; } else { main.topRopePeople = main.topRopeNames[0] + ' thinks '; } }); } }); }; function checkLead() { Profile.getLead(main.id, function (res) { main.leadNames = []; //makes sure you can't endorse twice and sets popover array for (var id in res) { if (res[id] === authData.uid) { main.disableLead = true; } Profile.getProfile(res[id], function (profileObj) { main.leadNames.push(profileObj.name); //lists whoever endorsed if (main.leadNames.length > 2) { main.leadPeople = main.leadNames[0] + ' and ' + (main.leadNames.length - 1) + ' other people think '; } else if (main.leadNames.length === 2) { main.leadPeople = main.leadNames[0] + ' and 1 other person think '; } else { main.leadPeople = main.leadNames[0] + ' thinks '; } }); } }); }; //get trip list to see if profile should link to trip Outside.getTrips(function (trips) { main.trips = trips; for (var id in trips) { if (main.id === id) { main.tripLink = '#/trip/' + id; } } }); }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9hc3NldHMvdXNlcnMvcGVyc29uLmNvbnRyb2xsZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxPQUFPLENBQ0osTUFBTSxDQUFDLFdBQVcsQ0FBQyxDQUNuQixVQUFVLENBQUMsWUFBWSxFQUFFLFVBQVMsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsU0FBUyxFQUFFLE9BQU8sRUFBRSxVQUFVLEVBQUM7O0FBRTVILE1BQUksSUFBSSxHQUFHLElBQUksQ0FBQzs7O0FBS2hCLE1BQUksQ0FBQyxTQUFTLEdBQUcsWUFBVztBQUMxQixLQUFDLENBQUMsU0FBUyxDQUFDLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0dBQ2hDLENBQUE7QUFDRCxNQUFJLENBQUMsVUFBVSxHQUFHLFlBQVc7QUFDM0IsS0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztHQUNqQyxDQUFBOztBQUVELE1BQUksRUFBRSxHQUFHLElBQUksUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQzlCLE1BQUksUUFBUSxHQUFHLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FBQzs7O0FBRzVCLE1BQUksQ0FBQyxFQUFFLEdBQUcsWUFBWSxDQUFDLEVBQUUsQ0FBQzs7O0FBRzFCLE1BQUcsUUFBUSxDQUFDLEdBQUcsS0FBSyxJQUFJLENBQUMsRUFBRSxFQUFDO0FBQzFCLGFBQVMsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUM7R0FDNUI7O0FBRUQsU0FBTyxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsRUFBRSxFQUFFLFVBQVMsVUFBVSxFQUFDO0FBQzlDLFFBQUksQ0FBQyxVQUFVLEdBQUcsVUFBVSxDQUFDOztBQUU3QixRQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLEtBQUssS0FBSyxHQUFHLElBQUksR0FBRyxLQUFLLENBQUM7QUFDakYsUUFBSSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssR0FBRyxJQUFJLEdBQUcsS0FBSyxDQUFDOztBQUV6RSxRQUFHLElBQUksQ0FBQyxPQUFPLElBQUksSUFBSSxDQUFDLElBQUksRUFBQztBQUMzQixVQUFJLENBQUMsS0FBSyxHQUFHLDhCQUE4QixDQUFDO0tBQzdDLE1BQUssSUFBRyxJQUFJLENBQUMsT0FBTyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksRUFBQztBQUNsQyxVQUFJLENBQUMsS0FBSyxHQUFHLGdFQUErRCxDQUFDO0tBQzlFLE1BQUssSUFBRyxDQUFDLElBQUksQ0FBQyxPQUFPLElBQUksSUFBSSxDQUFDLElBQUksRUFBQztBQUNsQyxVQUFJLENBQUMsS0FBSyxHQUFHLGdFQUErRCxDQUFDO0tBQzlFLE1BQUk7QUFDSCxVQUFJLENBQUMsS0FBSyxHQUFHLG9DQUFtQyxDQUFDO0tBQ2xEO0dBQ0osQ0FBQyxDQUFBOztBQUVGLGNBQVksRUFBRSxDQUFDO0FBQ2YsV0FBUyxFQUFFLENBQUM7O0FBRVosTUFBSSxDQUFDLGNBQWMsR0FBRyxZQUFVO0FBQzlCLFdBQU8sQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEVBQUUsRUFBRSxRQUFRLENBQUMsR0FBRyxFQUFFLFlBQVU7QUFDbEQsa0JBQVksRUFBRSxDQUFDO0FBQ2YsZ0JBQVUsQ0FBQyxJQUFJLENBQUM7QUFDZCxhQUFLLEVBQUUsb0JBQW9CO0FBQzNCLFlBQUksRUFBRSxTQUFTO0FBQ2YseUJBQWlCLEVBQUUsS0FBSztBQUN4QixhQUFLLEVBQUUsSUFBSTtPQUNaLENBQUMsQ0FBQztLQUNKLENBQUMsQ0FBQTtHQUNILENBQUE7QUFDRCxNQUFJLENBQUMsV0FBVyxHQUFHLFlBQVU7QUFDM0IsV0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxFQUFFLFFBQVEsQ0FBQyxHQUFHLEVBQUUsWUFBVTtBQUMvQyxlQUFTLEVBQUUsQ0FBQztBQUNaLGdCQUFVLENBQUMsSUFBSSxDQUFDO0FBQ2QsYUFBSyxFQUFFLGdCQUFnQjtBQUN2QixZQUFJLEVBQUUsU0FBUztBQUNmLHlCQUFpQixFQUFFLEtBQUs7QUFDeEIsYUFBSyxFQUFFLElBQUk7T0FDWixDQUFDLENBQUM7S0FDSixDQUFDLENBQUE7R0FDSCxDQUFBOztBQUVELFdBQVMsWUFBWSxHQUFFO0FBQ3JCLFdBQU8sQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEVBQUUsRUFBRSxVQUFTLEdBQUcsRUFBQztBQUN2QyxVQUFJLENBQUMsWUFBWSxHQUFHLEVBQUUsQ0FBQzs7QUFFdkIsV0FBSSxJQUFJLEVBQUUsSUFBSSxHQUFHLEVBQUM7QUFDaEIsWUFBRyxHQUFHLENBQUMsRUFBRSxDQUFDLEtBQUssUUFBUSxDQUFDLEdBQUcsRUFBQztBQUMxQixjQUFJLENBQUMsY0FBYyxHQUFHLElBQUksQ0FBQztTQUM1QjtBQUNELGVBQU8sQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLFVBQVMsVUFBVSxFQUFDO0FBQzlDLGNBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUN4QyxpQkFBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQzs7QUFFeEIsY0FBRyxJQUFJLENBQUMsWUFBWSxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUM7QUFDOUIsZ0JBQUksQ0FBQyxhQUFhLEdBQUcsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsR0FBRyxPQUFPLElBQUksSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBLEFBQUMsR0FBRSxzQkFBc0IsQ0FBQztXQUM5RyxNQUFLLElBQUcsSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFDO0FBQ3RDLGdCQUFJLENBQUMsYUFBYSxHQUFHLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLEdBQUcsNEJBQTRCLENBQUM7V0FDMUUsTUFBSTtBQUNILGdCQUFJLENBQUMsYUFBYSxHQUFHLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLEdBQUcsVUFBVSxDQUFDO1dBQ3hEO1NBQ0YsQ0FBQyxDQUFBO09BQ0g7S0FDRixDQUFDLENBQUE7R0FDSCxDQUFDOztBQUVGLFdBQVMsU0FBUyxHQUFFO0FBQ2xCLFdBQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUUsRUFBRSxVQUFTLEdBQUcsRUFBQztBQUNwQyxVQUFJLENBQUMsU0FBUyxHQUFHLEVBQUUsQ0FBQzs7QUFFcEIsV0FBSSxJQUFJLEVBQUUsSUFBSSxHQUFHLEVBQUM7QUFDaEIsWUFBRyxHQUFHLENBQUMsRUFBRSxDQUFDLEtBQUssUUFBUSxDQUFDLEdBQUcsRUFBQztBQUMxQixjQUFJLENBQUMsV0FBVyxHQUFHLElBQUksQ0FBQztTQUN6QjtBQUNELGVBQU8sQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLFVBQVMsVUFBVSxFQUFDO0FBQzlDLGNBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQzs7QUFFckMsY0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUM7QUFDM0IsZ0JBQUksQ0FBQyxVQUFVLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsR0FBRyxPQUFPLElBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBLEFBQUMsR0FBRSxzQkFBc0IsQ0FBQztXQUNyRyxNQUFLLElBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFDO0FBQ25DLGdCQUFJLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLEdBQUcsNEJBQTRCLENBQUM7V0FDcEUsTUFDRztBQUNGLGdCQUFJLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLEdBQUcsVUFBVSxDQUFDO1dBQ2xEO1NBQ0YsQ0FBQyxDQUFBO09BQ0g7S0FDRixDQUFDLENBQUE7R0FDSCxDQUFDOzs7QUFHRixTQUFPLENBQUMsUUFBUSxDQUFDLFVBQVMsS0FBSyxFQUFDO0FBQzlCLFFBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO0FBQ25CLFNBQUksSUFBSSxFQUFFLElBQUksS0FBSyxFQUFDO0FBQ2xCLFVBQUcsSUFBSSxDQUFDLEVBQUUsS0FBRyxFQUFFLEVBQUM7QUFDZCxZQUFJLENBQUMsUUFBUSxHQUFHLFNBQVMsR0FBQyxFQUFFLENBQUM7T0FDOUI7S0FDRjtHQUNGLENBQUMsQ0FBQztDQUVKLENBQUMsQ0FBQSIsImZpbGUiOiJzcmMvYXNzZXRzL3VzZXJzL3BlcnNvbi5jb250cm9sbGVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiYW5ndWxhclxuICAubW9kdWxlKCdjbGlwcGVkSW4nKVxuICAuY29udHJvbGxlcignUGVyc29uQ3RybCcsIGZ1bmN0aW9uKFByb2ZpbGUsICRyb3V0ZVBhcmFtcywgRkJfVVJMLCAkZmlsdGVyLCAkc2NvcGUsICRyb290U2NvcGUsICRsb2NhdGlvbiwgT3V0c2lkZSwgU3dlZXRBbGVydCl7XG4vLz09PT09PT09PT09PT09PT09PT09PVRISVMgQ09OVFJPTExFUiBJUyBGT1IgVklFV0lORyBTT01FT05FIEVMU0UnUyBQUk9GSUxFPT09PT09PT09PT09PT09PT09PVxuICAgIHZhciBtYWluID0gdGhpcztcblxuXG5cbiAgICAvL2NhbGwgcG9wb3ZlciB0b2dnbGUgZnVuY3Rpb25cbiAgICBtYWluLnRvZ2dsZVRvcCA9IGZ1bmN0aW9uICgpe1xuICAgICAgJCgnLnRvcFBvcCcpLnBvcG92ZXIoJ3RvZ2dsZScpO1xuICAgIH1cbiAgICBtYWluLnRvZ2dsZUxlYWQgPSBmdW5jdGlvbiAoKXtcbiAgICAgICQoJy5sZWFkUG9wJykucG9wb3ZlcigndG9nZ2xlJyk7XG4gICAgfVxuICAgIC8vZ2V0cyB1c2VyIGluZm9ybWF0aW9uXG4gICAgdmFyIGZiID0gbmV3IEZpcmViYXNlKEZCX1VSTCk7XG4gICAgdmFyIGF1dGhEYXRhID0gZmIuZ2V0QXV0aCgpO1xuXG4gICAgLy9nZXRzIGlkIG9mIHByb2ZpbGUgdGhhdCBpcyBiZWluZyB2aWV3ZWRcbiAgICBtYWluLmlkID0gJHJvdXRlUGFyYW1zLmlkO1xuXG4gICAgLy9pZiB0aGlzIGlzIHlvdXIgb3duIHByb2ZpbGUgcmVkaXJlY3QgdG8gIy9wcm9maWxlXG4gICAgaWYoYXV0aERhdGEudWlkID09PSBtYWluLmlkKXtcbiAgICAgICRsb2NhdGlvbi5wYXRoKCcvcHJvZmlsZScpO1xuICAgIH1cblxuICAgIFByb2ZpbGUuZ2V0UHJvZmlsZShtYWluLmlkLCBmdW5jdGlvbihwcm9maWxlT2JqKXtcbiAgICAgIG1haW4ucHJvZmlsZU9iaiA9IHByb2ZpbGVPYmo7XG4gICAgICAvL3NldCB0b3BSb3BlIGFuZCBsZWFkIGFzIGJvb2xlYW5zXG4gICAgICBtYWluLnRvcFJvcGUgPSAkZmlsdGVyKCdsb3dlcmNhc2UnKShwcm9maWxlT2JqLnRvcFJvcGUpID09PSAneWVzJyA/IHRydWUgOiBmYWxzZTtcbiAgICAgIG1haW4ubGVhZCA9ICRmaWx0ZXIoJ2xvd2VyY2FzZScpKHByb2ZpbGVPYmoubGVhZCkgPT09ICd5ZXMnID8gdHJ1ZSA6IGZhbHNlO1xuICAgICAgLy9zZXQgYmVsYXkgc3RyaW5nXG4gICAgICAgIGlmKG1haW4udG9wUm9wZSAmJiBtYWluLmxlYWQpe1xuICAgICAgICAgIG1haW4uYmVsYXkgPSAnIGNhbiB0b3Atcm9wZSBBTkQgbGVhZCBiZWxheSc7XG4gICAgICAgIH1lbHNlIGlmKG1haW4udG9wUm9wZSAmJiAhbWFpbi5sZWFkKXtcbiAgICAgICAgICBtYWluLmJlbGF5ID0gXCIgY2FuIHRvcC1yb3BlIGJlbGF5IGJ1dCBkb2Vzbid0IGtub3cgaG93IHRvIGxlYWQgYmVsYXkgeWV0Li4uXCI7XG4gICAgICAgIH1lbHNlIGlmKCFtYWluLnRvcFJvcGUgJiYgbWFpbi5sZWFkKXtcbiAgICAgICAgICBtYWluLmJlbGF5ID0gXCIgY2FuIGxlYWQgYmVsYXkgYnV0IGRvZXNuJ3Qga25vdyBob3cgdG8gdG9wLXJvcGUgYmVsYXkgeWV0Li4uXCI7XG4gICAgICAgIH1lbHNle1xuICAgICAgICAgIG1haW4uYmVsYXkgPSBcIiBkb2Vzbid0IGtub3cgaG93IHRvIGJlbGF5IHlldC4uLlwiO1xuICAgICAgICB9XG4gICAgfSlcblxuICAgIGNoZWNrVG9wUm9wZSgpO1xuICAgIGNoZWNrTGVhZCgpO1xuXG4gICAgbWFpbi5lbmRvcnNlVG9wUm9wZSA9IGZ1bmN0aW9uKCl7XG4gICAgICBQcm9maWxlLmFkZFRvcFJvcGUobWFpbi5pZCwgYXV0aERhdGEudWlkLCBmdW5jdGlvbigpe1xuICAgICAgICBjaGVja1RvcFJvcGUoKTtcbiAgICAgICAgU3dlZXRBbGVydC5zd2FsKHtcbiAgICAgICAgICB0aXRsZTogJysxIFRvcC1Sb3BlIEJlbGF5IScsXG4gICAgICAgICAgdHlwZTogJ3N1Y2Nlc3MnLFxuICAgICAgICAgIHNob3dDb25maXJtQnV0dG9uOiBmYWxzZSxcbiAgICAgICAgICB0aW1lcjogMTUwMFxuICAgICAgICB9KTtcbiAgICAgIH0pXG4gICAgfVxuICAgIG1haW4uZW5kb3JzZUxlYWQgPSBmdW5jdGlvbigpe1xuICAgICAgUHJvZmlsZS5hZGRMZWFkKG1haW4uaWQsIGF1dGhEYXRhLnVpZCwgZnVuY3Rpb24oKXtcbiAgICAgICAgY2hlY2tMZWFkKCk7XG4gICAgICAgIFN3ZWV0QWxlcnQuc3dhbCh7XG4gICAgICAgICAgdGl0bGU6ICcrMSBMZWFkIEJlbGF5IScsXG4gICAgICAgICAgdHlwZTogJ3N1Y2Nlc3MnLFxuICAgICAgICAgIHNob3dDb25maXJtQnV0dG9uOiBmYWxzZSxcbiAgICAgICAgICB0aW1lcjogMTUwMFxuICAgICAgICB9KTtcbiAgICAgIH0pXG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY2hlY2tUb3BSb3BlKCl7XG4gICAgICBQcm9maWxlLmdldFRvcFJvcGUobWFpbi5pZCwgZnVuY3Rpb24ocmVzKXtcbiAgICAgICAgbWFpbi50b3BSb3BlTmFtZXMgPSBbXTtcbiAgICAgICAgLy9tYWtlcyBzdXJlIHlvdSBjYW4ndCBlbmRvcnNlIHR3aWNlIGFuZCBzZXRzIHBvcG92ZXIgYXJyYXlcbiAgICAgICAgZm9yKHZhciBpZCBpbiByZXMpe1xuICAgICAgICAgIGlmKHJlc1tpZF0gPT09IGF1dGhEYXRhLnVpZCl7XG4gICAgICAgICAgICBtYWluLmRpc2FibGVUb3BSb3BlID0gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgUHJvZmlsZS5nZXRQcm9maWxlKHJlc1tpZF0sIGZ1bmN0aW9uKHByb2ZpbGVPYmope1xuICAgICAgICAgICAgbWFpbi50b3BSb3BlTmFtZXMucHVzaChwcm9maWxlT2JqLm5hbWUpO1xuICAgICAgICAgICAgY29uc29sZS5sb2cocHJvZmlsZU9iaik7XG4gICAgICAgICAgICAvL2xpc3RzIGZpcnN0ICsgbnVtYmVyIG9mIGVuZG9yc2VkXG4gICAgICAgICAgICBpZihtYWluLnRvcFJvcGVOYW1lcy5sZW5ndGggPiAyKXtcbiAgICAgICAgICAgICAgbWFpbi50b3BSb3BlUGVvcGxlID0gbWFpbi50b3BSb3BlTmFtZXNbMF0gKyAnIGFuZCAnICsgKG1haW4udG9wUm9wZU5hbWVzLmxlbmd0aCAtIDEpICsnIG90aGVyIHBlb3BsZSB0aGluayAnO1xuICAgICAgICAgICAgfWVsc2UgaWYobWFpbi50b3BSb3BlTmFtZXMubGVuZ3RoID09PSAyKXtcbiAgICAgICAgICAgICAgbWFpbi50b3BSb3BlUGVvcGxlID0gbWFpbi50b3BSb3BlTmFtZXNbMF0gKyAnIGFuZCAxIG90aGVyIHBlcnNvbiB0aGluayAnO1xuICAgICAgICAgICAgfWVsc2V7XG4gICAgICAgICAgICAgIG1haW4udG9wUm9wZVBlb3BsZSA9IG1haW4udG9wUm9wZU5hbWVzWzBdICsgJyB0aGlua3MgJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9KVxuICAgIH07XG5cbiAgICBmdW5jdGlvbiBjaGVja0xlYWQoKXtcbiAgICAgIFByb2ZpbGUuZ2V0TGVhZChtYWluLmlkLCBmdW5jdGlvbihyZXMpe1xuICAgICAgICBtYWluLmxlYWROYW1lcyA9IFtdO1xuICAgICAgICAvL21ha2VzIHN1cmUgeW91IGNhbid0IGVuZG9yc2UgdHdpY2UgYW5kIHNldHMgcG9wb3ZlciBhcnJheVxuICAgICAgICBmb3IodmFyIGlkIGluIHJlcyl7XG4gICAgICAgICAgaWYocmVzW2lkXSA9PT0gYXV0aERhdGEudWlkKXtcbiAgICAgICAgICAgIG1haW4uZGlzYWJsZUxlYWQgPSB0cnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICBQcm9maWxlLmdldFByb2ZpbGUocmVzW2lkXSwgZnVuY3Rpb24ocHJvZmlsZU9iail7XG4gICAgICAgICAgICBtYWluLmxlYWROYW1lcy5wdXNoKHByb2ZpbGVPYmoubmFtZSk7XG4gICAgICAgICAgICAvL2xpc3RzIHdob2V2ZXIgZW5kb3JzZWRcbiAgICAgICAgICAgIGlmKG1haW4ubGVhZE5hbWVzLmxlbmd0aCA+IDIpe1xuICAgICAgICAgICAgICBtYWluLmxlYWRQZW9wbGUgPSBtYWluLmxlYWROYW1lc1swXSArICcgYW5kICcgKyAobWFpbi5sZWFkTmFtZXMubGVuZ3RoIC0gMSkgKycgb3RoZXIgcGVvcGxlIHRoaW5rICc7XG4gICAgICAgICAgICB9ZWxzZSBpZihtYWluLmxlYWROYW1lcy5sZW5ndGggPT09IDIpe1xuICAgICAgICAgICAgICBtYWluLmxlYWRQZW9wbGUgPSBtYWluLmxlYWROYW1lc1swXSArICcgYW5kIDEgb3RoZXIgcGVyc29uIHRoaW5rICc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNle1xuICAgICAgICAgICAgICBtYWluLmxlYWRQZW9wbGUgPSBtYWluLmxlYWROYW1lc1swXSArICcgdGhpbmtzICc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSlcbiAgICB9O1xuXG4gICAgLy9nZXQgdHJpcCBsaXN0IHRvIHNlZSBpZiBwcm9maWxlIHNob3VsZCBsaW5rIHRvIHRyaXBcbiAgICBPdXRzaWRlLmdldFRyaXBzKGZ1bmN0aW9uKHRyaXBzKXtcbiAgICAgIG1haW4udHJpcHMgPSB0cmlwcztcbiAgICAgIGZvcih2YXIgaWQgaW4gdHJpcHMpe1xuICAgICAgICBpZihtYWluLmlkPT09aWQpe1xuICAgICAgICAgIG1haW4udHJpcExpbmsgPSAnIy90cmlwLycraWQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9KTtcblxuICB9KVxuIl19
120.614173
11,222
0.885102
3b322b7ec388256065f4e8d93e7192880230262b
1,101
js
JavaScript
generators/app/templates/front-end/apps/mainApp/controllers/indexController.js
CyborgSamrat/generator-lmf
d98e0a5eede695750ccd87c0cdef438f19471e4d
[ "Apache-2.0" ]
null
null
null
generators/app/templates/front-end/apps/mainApp/controllers/indexController.js
CyborgSamrat/generator-lmf
d98e0a5eede695750ccd87c0cdef438f19471e4d
[ "Apache-2.0" ]
null
null
null
generators/app/templates/front-end/apps/mainApp/controllers/indexController.js
CyborgSamrat/generator-lmf
d98e0a5eede695750ccd87c0cdef438f19471e4d
[ "Apache-2.0" ]
null
null
null
define(['angular'], function (angular) { angular.module('mainApp').controller('indexController', ['$rootScope', '$scope', '$http', '$location', 'identifier', 'envService', function ($rootScope, scope, http, $location, identifier, envService) { $rootScope.tryIt = "Hi, printing from root"; scope.modules = modules; scope.isInLogin = function () { return "/login" === $location.path(); }; $rootScope.$on("loggedin", function() { checkAuth(); }); $rootScope.$on("loggedout", function () { checkAuth(); }); function checkAuth() { scope.authenticated = identifier.isAuthenticated(); } function init() { $('#loader-wrapper').hide(); checkAuth(); } init(); scope.name = "Samrat"; scope.isActive = function (viewLocation) { return viewLocation === $location.path(); }; }]); });
29.756757
154
0.474114
3b331b2f9f358f4ac6a5205b31874d09de332fcb
10,658
js
JavaScript
src/pages/index.js
Luftare/luftare-com
dc491b9d0304af53fa0278e5b4dea39f32e99632
[ "MIT" ]
1
2020-08-07T16:15:23.000Z
2020-08-07T16:15:23.000Z
src/pages/index.js
Luftare/luftare-com
dc491b9d0304af53fa0278e5b4dea39f32e99632
[ "MIT" ]
5
2021-03-08T19:30:20.000Z
2022-02-12T08:45:45.000Z
src/pages/index.js
Luftare/luftare-com
dc491b9d0304af53fa0278e5b4dea39f32e99632
[ "MIT" ]
null
null
null
import React from 'react' import styled from 'styled-components' import Grid from '../components/grid' import Section from '../components/section' import MusicBox from '../components/musicbox' import Project from '../components/Project' import { media } from '../styles' const HeroText = styled.div` font-size: 2em; ${media.tablet` font-size: 3em; `}; ` const Image = styled.div` vertical-align: bottom; align-items: flex-end; justify-content: center; display: inline-flex; width: 100%; height: ${({ height }) => height || '80vw'}; background-image: url('${(props) => props.src}'); background-size: cover; background-position: center; background-repeat: no-repeat; ${media.tablet` width: ${(props) => (props.wide ? '100%' : '50%')}; height: ${({ tabletHeight, height }) => tabletHeight || height || '40vw'}; `} ` const TextBox = styled.span` display: flex; align-items: center; box-sizing: border-box; font-size: 4em; color: ${(props) => props.theme.white}; background-color: ${({ background }) => background || 'rgba(105, 245, 205, 0.9)'}; width: 100%; height: 100%; ${media.tablet` font-size: 5em; `} ${media.desktop` font-size: 6em; `}; ` const projects = [ { title: 'Songen Music Generator', description: "Songen is an AI-powered music generator, combining my two major ambitions - music and development. Co-created together with the Vibin team, it's available on App Store and has an ever-growing user base.", link: 'https://www.songen.app/', icons: ['swift'], imageSrc: require('../assets/songen.png'), }, { title: 'Vibin', description: "Vibin is a music app for anyone to enjoy music creation and jamming. It's co-created together with a team of three in which I'm the developer. It's a native iPhone app written in Swift.", link: '', icons: ['swift'], imageSrc: require('../assets/vibin.jpg'), }, { title: 'Shared a ride', description: "It's a service facilitating shared rides. Driving a private car to your sports club? Consider environment and offer a free ride to people living nearby.", link: 'https://sleepy-cori-895937.netlify.app/', icons: ['html5', 'vue'], imageSrc: require('../assets/kimppakyyti.png'), }, { title: 'Cloud Bunny game', description: 'I wanted to see how close to native mobile gaming feel I could get with a browser game. Vue is used to render the menu on top of an html canvas. I have produced all the graphics and sounds.', link: 'https://admiring-meninsky-2e3688.netlify.com/', icons: ['html5', 'vue', 'howler'], imageSrc: require('../assets/cloudbunny.png'), }, { title: 'Word game', description: 'An excercise to design and implement a simple-to-use word game to play with friends face-to-face. Less is more.', link: 'https://hardcore-morse-b1902c.netlify.app/', icons: ['html5', 'vue', 'howler'], imageSrc: require('../assets/alias.png'), }, { title: 'AI rocket landing', description: 'I programmed this machine learning demo to visualize the learning process of a neural network. A genetic algorithm is applied to train a space rocket to smoothly land with the minimum possible fuel consumption.', link: 'https://luftare.github.io/AI-space-ship/', icons: ['html5', 'synaptic'], imageSrc: require('../assets/spaceship.png'), }, { title: 'AI pong player', description: 'I have programmed a few games featuring "AI" opponents to play against and the opponents are just following simple if/else heuristics. The problem is that the opponent is then only as good as it was programmed to be. In this demo machine learning is applied to train the opponent\'s neural networks.', link: 'https://luftare.github.io/ai-pong-paper/', icons: ['html5', 'synaptic'], imageSrc: require('../assets/aipong.png'), }, { title: '3d', description: 'I wrote a 3d rendering engine out of curiosity. The rendering is powered by 2d canvas leaving all the trigonometry and geometry puzzles to be handled with vanilla JS.', link: 'https://luftare.github.io/vanilla-3d/', icons: ['html5'], imageSrc: require('../assets/threed.png'), }, { title: 'Real-time multiplayer', description: 'It is a real-time multiplayer game powered by websocket connection. It attempts to challenge the common consensus that TCP is not applicable for real-time multiplayer games. It also experiments combining canvas and css animations to produce performant graphics.', link: 'https://lfbg.herokuapp.com/', icons: ['html5', 'node', 'socketio', 'digitalocean'], imageSrc: require('../assets/lfbg.png'), }, { title: 'Disc golf app', description: 'A web app aiming to produce native mobile app user experience for disc golf players. Offline features make it possible to use the app with limited network connectivity.', link: 'https://mystifying-lalande-9b47dd.netlify.com/', icons: ['react', 'mobx'], imageSrc: require('../assets/pirkko.png'), }, { title: 'Hearing test', description: "How well can you hear? The test generates a report of both ears' relative spectral sensitivity as a graph. The test has proven to produce similar results compared to tests conducted by healthcare professionals.", link: 'https://hardcore-aryabhata-359dd8.netlify.app/', icons: ['html5', 'audio'], imageSrc: require('../assets/hearing.png'), }, { title: 'Diplacusis test', description: 'Did you know that ears may interpret the same frequency inaccurately when played separately? That condition is called Diplacusis and this simple app tests the severity of it.', link: 'https://romantic-heisenberg-dd6e59.netlify.app/', icons: ['html5', 'audio'], imageSrc: require('../assets/diplacusis.png'), }, { title: 'Hirvikolari', description: 'Would you be able to react quickly enough to avoid crashing at a moose? Even after 6 beers, 120km/h and in thick fog? Better not to try it out in wilderness but at home. Decelereation physics are somewhat based on dry weather conditions.', link: 'https://luftare.github.io/hirvikolari/', icons: ['html5'], imageSrc: require('../assets/hirvikolari.png'), }, { title: 'Project manager', description: "A simple project management software where users can login and be assigned to projects. Users have profiles and projects have deadlines. It's a project management software so it's grey and a little boring.", link: '', icons: ['html5', 'vue', 'node', 'mysql'], imageSrc: require('../assets/manager.png'), }, { title: 'Minigolf adventure game', description: "What comes when a minigolf game and an RPG game is crossbred? I wanted to build a game with lots of levels that aren't too coupled with the game engine. A dedicated level editor made it easy to write the story and add new levels to the game.", link: 'https://luftare.github.io/wall-bounce/', icons: ['vue'], imageSrc: require('../assets/minigolf.png'), }, { title: 'Plant evolution', description: 'What makes plants to have unique shapes? Here the process of evolution is demonstrated with virtual plants. Plants interact with underlying plants by shading them and the successful individuals seed more plants. Physical constraints are applied to wither weak structures.', link: 'https://luftare.github.io/trees/', icons: ['html5'], imageSrc: require('../assets/trees.png'), }, { title: 'Sailboat physics', description: 'How can you sail into headwind? To fully grasp the idea I wrote this sailboat model featuring procedural islands, seafloor heightmap and a depth sounder.', link: 'https://luftare.github.io/sailboat-simulation/', icons: ['html5'], imageSrc: require('../assets/sail.png'), }, { title: 'Snowboard', description: "As an ex-snowboarder this is one of my favourite game prototypes I've put together. The physics mostly revolve around vector dot and cross products. I also experimented with some fake 3d techniques to boost the immersion of the mostly 2d game.", link: 'https://eloquent-wozniak-c9aa9c.netlify.com/', icons: ['html5', 'howler'], imageSrc: require('../assets/snowboard.png'), }, { title: 'Drum machine', description: 'A simple drum sampler. Tap the pads to trigger drum sounds or record a beat on the fly. It features a metronome, undo and changing of tempo.', link: 'https://nifty-wright-7f299a.netlify.com/', icons: ['react', 'audio'], imageSrc: require('../assets/drum.png'), }, { title: 'Wacky music generator', description: 'In order to produce bonkers music you need equivalent instruments for the job. Create beat, draw riffs just like in paint and write lyrics to a textbox to hear the next UG hit. Its cool how much browser(s) can do nowadays.', link: 'https://trusting-sinoussi-6c3faf.netlify.com/', icons: ['react', 'audio'], imageSrc: require('../assets/noisebox.png'), }, ] const BackgroundImage = styled.div` background-image: url('${(props) => props.src}'); background-size: cover; background-position: center; background-repeat: no-repeat; ` const Split = styled.div` display: grid; grid-auto-flow: column; ${media.tablet` grid-auto-flow: dense; grid-template-rows: auto; grid-template-columns: 1fr 1fr; `}; ` const IndexPage = () => ( <Grid> <Section airy> <HeroText> a <b>musical developer</b> at your service </HeroText> </Section> <Section wide> <Image src={require('../assets/ide.png')} wide height="200px" tabletHeight="350px" > <TextBox noPaddingX background="rgba(125, 25, 255, 0.6)"> <Grid> <span>dev</span> </Grid> </TextBox> </Image> {projects.map((project, i) => ( <Project key={project.title} {...project} reverse={i % 2 === 0} /> ))} <Image src={require('../assets/daw.png')} wide height="200px" tabletHeight="350px" > <TextBox noPaddingX background="rgba(255, 185, 22, 0.85)"> <Grid> <span>music</span> </Grid> </TextBox> </Image> </Section> <Section wide> <Split> <Grid> <MusicBox /> </Grid> <BackgroundImage src={require('../assets/instruments.jpeg')} /> </Split> </Section> </Grid> ) export default IndexPage
38.064286
308
0.657816
3b3342f94cbb0b551821004ab309144baf1687a2
623
js
JavaScript
src/components/Indicator.js
scotato/goldilocks.design
2c06aa17e22e67af452058bf09e492a6d6afc856
[ "MIT" ]
5
2020-03-06T18:05:12.000Z
2020-04-05T12:06:50.000Z
src/components/Indicator.js
scotato/goldilocks.design
2c06aa17e22e67af452058bf09e492a6d6afc856
[ "MIT" ]
7
2019-12-30T21:01:59.000Z
2022-01-22T10:40:32.000Z
src/components/Indicator.js
scotato/goldilocks.design
2c06aa17e22e67af452058bf09e492a6d6afc856
[ "MIT" ]
3
2020-03-06T16:49:41.000Z
2020-04-08T02:09:13.000Z
import React from 'react' import styled from 'styled-components' import Icon from './Icon' const Indicator = styled.div` display: flex; align-items: center; margin-right: ${props => props.theme.size[400]}; font-weight: 700; color: ${props => props.theme.color[props.color]}; svg { max-width: 100%; } ` const Badge = styled.span` margin-left: ${props => props.theme.size[200]}; line-height: 1; ` export default props => props.badge ? ( <Indicator title={`${props.title} ${props.badge}`} color={props.color}> <Icon name={props.icon} /> <Badge>{props.badge}</Badge> </Indicator> ) : null
22.25
73
0.65008
3b336d84e428ee6708822fa2ffa660e484a0dd89
2,188
js
JavaScript
packages/@sanity/components/src/textareas/DefaultTextArea.js
jaaberg/sanity
2ff0084a1eb17f40ec57aa54b5046410887a501d
[ "MIT" ]
null
null
null
packages/@sanity/components/src/textareas/DefaultTextArea.js
jaaberg/sanity
2ff0084a1eb17f40ec57aa54b5046410887a501d
[ "MIT" ]
null
null
null
packages/@sanity/components/src/textareas/DefaultTextArea.js
jaaberg/sanity
2ff0084a1eb17f40ec57aa54b5046410887a501d
[ "MIT" ]
null
null
null
import PropTypes from 'prop-types' import React from 'react' import styles from 'part:@sanity/components/textareas/default-style' import IoAndroidClose from 'part:@sanity/base/close-icon' const NOOP = () => {} export default class DefaultTextArea extends React.Component { static propTypes = { onChange: PropTypes.func, onFocus: PropTypes.func, onKeyPress: PropTypes.func, onBlur: PropTypes.func, onClear: PropTypes.func, value: PropTypes.string, customValidity: PropTypes.string, isClearable: PropTypes.bool, rows: PropTypes.number, hasFocus: PropTypes.bool, disabled: PropTypes.bool } static defaultProps = { value: '', customValidity: '', rows: 10, isClearable: false, onKeyPress: NOOP, onChange: NOOP, onFocus: NOOP, onClear: NOOP, onBlur: NOOP } handleClear = event => { this.props.onClear(event) } select() { if (this._input) { this._input.select() } } focus() { if (this._input) { this._input.focus() } } setInput = element => { this._input = element } componentDidMount() { this._input.setCustomValidity(this.props.customValidity) } componentWillReceiveProps(nextProps) { if (nextProps.customValidity !== this.props.customValidity) { this._input.setCustomValidity(nextProps.customValidity) } } render() { const { value, isClearable, rows, onKeyPress, onChange, onFocus, onBlur, onClear, customValidity, ...rest } = this.props return ( <div className={styles.root}> <textarea className={styles.textarea} rows={rows} value={value} onChange={onChange} onKeyPress={onKeyPress} onFocus={onFocus} onBlur={onBlur} autoComplete="off" ref={this.setInput} {...rest} /> { isClearable && !this.props.disabled && ( <button className={styles.clearButton} onClick={onClear}> <IoAndroidClose color="inherit" /> </button> ) } </div> ) } }
21.242718
69
0.592322
3b33e64489877acd753b4cf496e620eb0c501096
506
js
JavaScript
test/test-reverse.js
VendaCino/streamts
fdf1908bb2ebecfb6a5a84bfd24812404ec07fdf
[ "MIT" ]
986
2015-01-06T18:25:10.000Z
2022-03-02T08:56:58.000Z
test/test-reverse.js
VendaCino/streamts
fdf1908bb2ebecfb6a5a84bfd24812404ec07fdf
[ "MIT" ]
56
2015-01-17T10:15:17.000Z
2022-03-06T08:37:22.000Z
test/test-reverse.js
VendaCino/streamts
fdf1908bb2ebecfb6a5a84bfd24812404ec07fdf
[ "MIT" ]
94
2015-01-12T14:44:37.000Z
2021-05-13T07:17:17.000Z
QUnit.test("reverse", function (assert) { var data = [1, 2, 3, 4]; var result = Stream(data) .reverse() .toArray(); assert.equal(result.length, 4); assert.equal(result[0], 4); assert.equal(result[1], 3); assert.equal(result[2], 2); assert.equal(result[3], 1); // assert original data is untouched assert.equal(data.length, 4); assert.equal(data[0], 1); assert.equal(data[1], 2); assert.equal(data[2], 3); assert.equal(data[3], 4); });
24.095238
41
0.579051
3b3492c50089b8e2f14b43bfe78171a12841bc90
1,071
js
JavaScript
10.read-video-pwa/service-worker.js
Nancyyuan/jssamples
438a0d6341dad3a962711d471a27e419b7b8f542
[ "MIT" ]
null
null
null
10.read-video-pwa/service-worker.js
Nancyyuan/jssamples
438a0d6341dad3a962711d471a27e419b7b8f542
[ "MIT" ]
null
null
null
10.read-video-pwa/service-worker.js
Nancyyuan/jssamples
438a0d6341dad3a962711d471a27e419b7b8f542
[ "MIT" ]
null
null
null
// Files to cache const cacheName = 'helloworld-pwa'; const appShellFiles = [ './helloworld-pwa.html', './dbr-big.png', './helloworld-pwa.webmanifest', ]; // Installing Service Worker self.addEventListener('install', (e) => { console.log('[Service Worker] Install'); e.waitUntil((async () => { const cache = await caches.open(cacheName); console.log('[Service Worker] Caching all: app shell and content'); await cache.addAll(appShellFiles); })()); }); self.addEventListener('fetch', (e) => { e.respondWith((async () => { const r = await caches.match(e.request); console.log(`[Service Worker] Fetching resource: ${e.request.url}`); if (r) { return r; } const response = await fetch(e.request); const cache = await caches.open(cacheName); console.log(`[Service Worker] Caching new resource: ${e.request.url}`); if (e.request.method !== "POST") cache.put(e.request, response.clone()); return response; })()); });
35.7
80
0.588235
3b34b4589761b103f54a8406774583c55e8d97c8
1,273
js
JavaScript
SilveR/R/library/htmlTable/javascript/toggler.js
robalexclark/SilveR-Dev
263008fdb9dc3fdd22bfc6f71b7c092867631563
[ "MIT" ]
7
2019-04-27T10:26:46.000Z
2022-02-04T09:57:34.000Z
SilveR/R/library/htmlTable/javascript/toggler.js
robalexclark/SilveR-Dev
263008fdb9dc3fdd22bfc6f71b7c092867631563
[ "MIT" ]
14
2019-12-28T07:09:11.000Z
2022-03-28T19:33:50.000Z
SilveR/R/library/htmlTable/javascript/toggler.js
robalexclark/SilveR-Dev
263008fdb9dc3fdd22bfc6f71b7c092867631563
[ "MIT" ]
4
2019-03-05T05:52:24.000Z
2020-11-18T07:52:04.000Z
$(document).ready(function(){ $(".gmisc_table td .hidden").map(function(index, el){ el.parentNode.style["original-color"] = el.parentNode.style["background-color"]; el.parentNode.style["background-color"] = "#DDD"; }); getSelected = function(){ var t = ''; if(window.getSelection){ t = window.getSelection(); }else if(document.getSelection){ t = document.getSelection(); }else if(document.selection){ t = document.selection.createRange().text; } return t.toString(); }; $(".gmisc_table td").map(function(index, el){ this.style.cursor = "pointer"; el.onmouseup = function(e){ if (getSelected().length > 0) return; var hidden = this.getElementsByClassName("hidden"); if (hidden.length > 0){ this.innerHTML = hidden[0].textContent; this.style["background-color"] = this.style["original-color"]; }else{ $(this).append("<span class='hidden' style='display: none'>" + this.innerHTML + "</span>"); this.childNodes[0].data = this.childNodes[0].data.substr(0, 20) + "... "; this.style["original-color"] = this.style["background-color"]; this.style["background-color"] = "#DDD"; } }; }); });
31.04878
85
0.588374
3b3520085667dfe71d45c9120f686c3e3e5d5aaf
267
js
JavaScript
client/src/components/LikeButton/CountLabel.js
AliMohamedMagdi/tumblr
6d917b7dd69e679fb3079bff3445d14d5a17bf7e
[ "MIT" ]
6
2019-09-30T12:30:47.000Z
2021-08-12T18:21:07.000Z
client/src/components/LikeButton/CountLabel.js
AliMohamedMagdi/tumblr
6d917b7dd69e679fb3079bff3445d14d5a17bf7e
[ "MIT" ]
5
2019-09-09T00:06:04.000Z
2021-09-21T00:29:38.000Z
client/src/components/LikeButton/CountLabel.js
AliMohamedMagdi/tumblr
6d917b7dd69e679fb3079bff3445d14d5a17bf7e
[ "MIT" ]
1
2021-06-16T16:55:29.000Z
2021-06-16T16:55:29.000Z
import styled from 'styled-components' export default styled.p` z-index: 1; position: absolute; bottom: 25%; margin: 0; font-size: 0.65rem; font-weight: bold; line-height: 2; opacity: 0.4; color: ${({isLiked}) => (isLiked ? 'inherit' : '#fff')}; `
19.071429
58
0.625468
3b35ffc7c08cf432b2561a5355ff06bc158fcbb6
944
js
JavaScript
src/main/resources/static/templates/js/services/WarehouseBatchInventoryService.js
fengjiaqian/DynamicQuery
62cde7ec38c8fdce8e6612356d398356bcba28f7
[ "Apache-2.0" ]
1
2021-01-21T01:12:02.000Z
2021-01-21T01:12:02.000Z
src/main/resources/static/templates/js/services/WarehouseBatchInventoryService.js
fengjiaqian/DynamicQuery
62cde7ec38c8fdce8e6612356d398356bcba28f7
[ "Apache-2.0" ]
1
2020-06-06T05:58:48.000Z
2020-06-06T05:58:48.000Z
src/main/resources/static/templates/js/services/WarehouseBatchInventoryService.js
fengjiaqian/DynamicQuery
62cde7ec38c8fdce8e6612356d398356bcba28f7
[ "Apache-2.0" ]
1
2021-01-21T01:12:06.000Z
2021-01-21T01:12:06.000Z
/** * 货位库存 */ define(['app'], function (app) { app.service('WarehouseBatchInventoryService', ['QHttp', function (QHttp) { /** * 列表 */ this.getBatchInventoryList = function (data) { return QHttp.request({ method: 'post', url: "/listBatchInventoryByStoreId", data:data }); }; /** * 变更明细 */ this.getBatchInventoryDetail = function (data) { return QHttp.request({ method: 'post', url: '/listProductStoreBatchChangeRecord', data:data }); }; /** * 库存修改 */ this.modWarehouseBatchInventory = function (data) { return QHttp.request({ method: 'post', url: '/updateProductStoreBatch', data:data }); }; }]); });
24.205128
78
0.434322
3b362abe9e4b0bc257f449e2da9a9219e85d2eb2
531
js
JavaScript
src/promotions-manager/promotions-manager-ui/src/Components/Helper/FieldGroup.js
AssafTzurEl/aws-workshop-colony
c680918169948fdcb4f6c11a6ada745bb337e460
[ "Apache-2.0" ]
1
2020-11-02T17:14:34.000Z
2020-11-02T17:14:34.000Z
src/promotions-manager/promotions-manager-ui/src/Components/Helper/FieldGroup.js
AssafTzurEl/aws-workshop-colony
c680918169948fdcb4f6c11a6ada745bb337e460
[ "Apache-2.0" ]
2
2021-05-09T10:48:42.000Z
2022-02-19T06:45:03.000Z
src/promotions-manager/promotions-manager-ui/src/Components/Helper/FieldGroup.js
AssafTzurEl/aws-workshop-colony
c680918169948fdcb4f6c11a6ada745bb337e460
[ "Apache-2.0" ]
33
2021-10-13T11:35:56.000Z
2022-03-30T11:21:40.000Z
import React from 'react'; import {FormGroup, ControlLabel, FormControl, HelpBlock} from "react-bootstrap"; const FieldGroup = ({ id, label, help, error, ...props }) => { return ( <FormGroup controlId={id} validationState={error ? 'error' : null}> <ControlLabel>{label}</ControlLabel> <FormControl {...props} /> {help && <HelpBlock>{help}</HelpBlock>} {error && <div className="alert alert-danger">{error}</div>} </FormGroup> ); } export default FieldGroup;
35.4
80
0.602637
3b3638b64763d652542257bc02613bee6a890f72
9,172
js
JavaScript
es/components/viewer3d/viewer3d.js
OgzAkt/react-planner
187fee01c3a5c6977133e124f1544c42006944b0
[ "MIT" ]
1,037
2016-10-06T16:15:19.000Z
2022-03-30T09:10:31.000Z
es/components/viewer3d/viewer3d.js
OgzAkt/react-planner
187fee01c3a5c6977133e124f1544c42006944b0
[ "MIT" ]
208
2016-10-14T16:56:11.000Z
2022-02-26T09:53:45.000Z
es/components/viewer3d/viewer3d.js
OgzAkt/react-planner
187fee01c3a5c6977133e124f1544c42006944b0
[ "MIT" ]
369
2016-11-18T16:28:22.000Z
2022-03-31T04:05:39.000Z
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import React from 'react'; import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import * as Three from 'three'; import { parseData, updateScene } from './scene-creator'; import { disposeScene } from './three-memory-cleaner'; import OrbitControls from './libs/orbit-controls'; import diff from 'immutablediff'; import * as SharedStyle from '../../shared-style'; var Scene3DViewer = function (_React$Component) { _inherits(Scene3DViewer, _React$Component); function Scene3DViewer(props) { _classCallCheck(this, Scene3DViewer); var _this = _possibleConstructorReturn(this, (Scene3DViewer.__proto__ || Object.getPrototypeOf(Scene3DViewer)).call(this, props)); _this.lastMousePosition = {}; _this.width = props.width; _this.height = props.height; _this.renderingID = 0; _this.renderer = window.__threeRenderer || new Three.WebGLRenderer({ preserveDrawingBuffer: true }); window.__threeRenderer = _this.renderer; return _this; } _createClass(Scene3DViewer, [{ key: 'componentDidMount', value: function componentDidMount() { var _this2 = this; var actions = { areaActions: this.context.areaActions, holesActions: this.context.holesActions, itemsActions: this.context.itemsActions, linesActions: this.context.linesActions, projectActions: this.context.projectActions }; var state = this.props.state; var data = state.scene; var canvasWrapper = ReactDOM.findDOMNode(this.refs.canvasWrapper); var scene3D = new Three.Scene(); //RENDERER this.renderer.setClearColor(new Three.Color(SharedStyle.COLORS.white)); this.renderer.setSize(this.width, this.height); // LOAD DATA var planData = parseData(data, actions, this.context.catalog); scene3D.add(planData.plan); scene3D.add(planData.grid); var aspectRatio = this.width / this.height; var camera = new Three.PerspectiveCamera(45, aspectRatio, 1, 300000); scene3D.add(camera); // Set position for the camera var cameraPositionX = -(planData.boundingBox.max.x - planData.boundingBox.min.x) / 2; var cameraPositionY = (planData.boundingBox.max.y - planData.boundingBox.min.y) / 2 * 10; var cameraPositionZ = (planData.boundingBox.max.z - planData.boundingBox.min.z) / 2; camera.position.set(cameraPositionX, cameraPositionY, cameraPositionZ); camera.up = new Three.Vector3(0, 1, 0); // HELPER AXIS // let axisHelper = new Three.AxisHelper(100); // scene3D.add(axisHelper); // LIGHT var light = new Three.AmbientLight(0xafafaf); // soft white light scene3D.add(light); // Add another light var spotLight1 = new Three.SpotLight(SharedStyle.COLORS.white, 0.30); spotLight1.position.set(cameraPositionX, cameraPositionY, cameraPositionZ); scene3D.add(spotLight1); // OBJECT PICKING var toIntersect = [planData.plan]; var mouse = new Three.Vector2(); var raycaster = new Three.Raycaster(); this.mouseDownEvent = function (event) { _this2.lastMousePosition.x = event.offsetX / _this2.width * 2 - 1; _this2.lastMousePosition.y = -event.offsetY / _this2.height * 2 + 1; }; this.mouseUpEvent = function (event) { event.preventDefault(); mouse.x = event.offsetX / _this2.width * 2 - 1; mouse.y = -(event.offsetY / _this2.height) * 2 + 1; if (Math.abs(mouse.x - _this2.lastMousePosition.x) <= 0.02 && Math.abs(mouse.y - _this2.lastMousePosition.y) <= 0.02) { raycaster.setFromCamera(mouse, camera); var intersects = raycaster.intersectObjects(toIntersect, true); if (intersects.length > 0 && !isNaN(intersects[0].distance)) { intersects[0].object.interact && intersects[0].object.interact(); } else { _this2.context.projectActions.unselectAll(); } } }; this.renderer.domElement.addEventListener('mousedown', this.mouseDownEvent); this.renderer.domElement.addEventListener('mouseup', this.mouseUpEvent); this.renderer.domElement.style.display = 'block'; // add the output of the renderer to the html element canvasWrapper.appendChild(this.renderer.domElement); // create orbit controls var orbitController = new OrbitControls(camera, this.renderer.domElement); var spotLightTarget = new Three.Object3D(); spotLightTarget.name = 'spotLightTarget'; spotLightTarget.position.set(orbitController.target.x, orbitController.target.y, orbitController.target.z); scene3D.add(spotLightTarget); spotLight1.target = spotLightTarget; var render = function render() { orbitController.update(); spotLight1.position.set(camera.position.x, camera.position.y, camera.position.z); spotLightTarget.position.set(orbitController.target.x, orbitController.target.y, orbitController.target.z); camera.updateMatrix(); camera.updateMatrixWorld(); for (var elemID in planData.sceneGraph.LODs) { planData.sceneGraph.LODs[elemID].update(camera); } _this2.renderer.render(scene3D, camera); _this2.renderingID = requestAnimationFrame(render); }; render(); this.orbitControls = orbitController; this.camera = camera; this.scene3D = scene3D; this.planData = planData; } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { cancelAnimationFrame(this.renderingID); this.orbitControls.dispose(); this.renderer.domElement.removeEventListener('mousedown', this.mouseDownEvent); this.renderer.domElement.removeEventListener('mouseup', this.mouseUpEvent); disposeScene(this.scene3D); this.scene3D.remove(this.planData.plan); this.scene3D.remove(this.planData.grid); this.scene3D = null; this.planData = null; this.camera = null; this.orbitControls = null; this.renderer.renderLists.dispose(); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { var width = nextProps.width, height = nextProps.height; var actions = { areaActions: this.context.areaActions, holesActions: this.context.holesActions, itemsActions: this.context.itemsActions, linesActions: this.context.linesActions, projectActions: this.context.projectActions }; this.width = width; this.height = height; this.camera.aspect = width / height; this.camera.updateProjectionMatrix(); if (nextProps.state.scene !== this.props.state.scene) { var changedValues = diff(this.props.state.scene, nextProps.state.scene); updateScene(this.planData, nextProps.state.scene, this.props.state.scene, changedValues.toJS(), actions, this.context.catalog); } this.renderer.setSize(width, height); } }, { key: 'render', value: function render() { return React.createElement('div', { ref: 'canvasWrapper' }); } }]); return Scene3DViewer; }(React.Component); export default Scene3DViewer; Scene3DViewer.propTypes = { state: PropTypes.object.isRequired, width: PropTypes.number.isRequired, height: PropTypes.number.isRequired }; Scene3DViewer.contextTypes = { areaActions: PropTypes.object.isRequired, holesActions: PropTypes.object.isRequired, itemsActions: PropTypes.object.isRequired, linesActions: PropTypes.object.isRequired, projectActions: PropTypes.object.isRequired, catalog: PropTypes.object };
38.700422
564
0.690035
3b367b581693ab060e6d306686f059e56ce8615a
1,337
js
JavaScript
packages/underscore-tests/each_test.js
joseconstela/meteor
5c32331591f268f2acdac5a1a7481eb9e65dc3d4
[ "Apache-2.0", "BSD-2-Clause", "MIT" ]
30,418
2015-01-01T05:51:14.000Z
2022-03-30T15:17:36.000Z
packages/underscore-tests/each_test.js
joseconstela/meteor
5c32331591f268f2acdac5a1a7481eb9e65dc3d4
[ "Apache-2.0", "BSD-2-Clause", "MIT" ]
8,548
2015-01-01T01:07:47.000Z
2022-03-31T13:37:41.000Z
packages/underscore-tests/each_test.js
joseconstela/meteor
5c32331591f268f2acdac5a1a7481eb9e65dc3d4
[ "Apache-2.0", "BSD-2-Clause", "MIT" ]
5,172
2015-01-01T20:43:33.000Z
2022-03-27T12:48:44.000Z
Tinytest.add("underscore-tests - each", function (test) { // arrays _.each([42], function (val, index) { test.equal(index, 0); test.equal(val, 42); }); // objects with 'length' field aren't treated as arrays _.each({length: 42}, function (val, key) { test.equal(key, 'length'); test.equal(val, 42); }); // The special 'arguments' variable is treated as an // array (function () { _.each(arguments, function (val, index) { test.equal(index, 0); test.equal(val, 42); }); })(42); // An object with a 'callee' field isn't treated as arguments _.each({callee: 42}, function (val, key) { test.equal(key, 'callee'); test.equal(val, 42); }); // An object with a 'callee' field isn't treated as arguments _.each({length: 4, callee: 42}, function (val, key) { if (key === 'callee') test.equal(val, 42); else if (key === 'length') test.equal(val, 4); else test.fail({message: 'unexpected key: ' + key}); }); // NOTE: An object with a numberic 'length' field *and* a function // 'callee' field will be treated as an array in IE. This may or may // not be fixable, but isn't a big deal since: (1) 'callee' is a // pretty rare key, and (2) JSON objects can't have functions // anyways, which is the main use-case for _.each. });
29.065217
70
0.604338
3b369a2a8da2f0bc77e3b2a130e41b87aa1a237e
74,661
js
JavaScript
chrome/js/modules/request.js
cdaapi/POSTMan-Chrome-Extension
ec2dc635f588fd5145853c8b6f4fc881b4c12632
[ "Apache-2.0" ]
null
null
null
chrome/js/modules/request.js
cdaapi/POSTMan-Chrome-Extension
ec2dc635f588fd5145853c8b6f4fc881b4c12632
[ "Apache-2.0" ]
null
null
null
chrome/js/modules/request.js
cdaapi/POSTMan-Chrome-Extension
ec2dc635f588fd5145853c8b6f4fc881b4c12632
[ "Apache-2.0" ]
null
null
null
pm.request = { url:"", urlParams:{}, name:"", description:"", bodyParams:{}, headers:[], method:"GET", dataMode:"params", isFromCollection:false, collectionRequestId:"", methodsWithBody:["POST", "PUT", "PATCH", "DELETE", "LINK", "UNLINK"], areListenersAdded:false, startTime:0, endTime:0, xhr:null, editorMode:0, responses:[], body:{ mode:"params", data:"", isEditorInitialized:false, codeMirror:false, init:function () { this.initPreview(); this.initFormDataEditor(); this.initUrlEncodedEditor(); this.initEditorListeners(); }, initPreview:function () { $(".request-preview-header-limitations").dropdown(); }, hide:function () { pm.request.body.closeFormDataEditor(); pm.request.body.closeUrlEncodedEditor(); $("#data").css("display", "none"); }, getRawData:function () { if (pm.request.body.isEditorInitialized) { return pm.request.body.codeMirror.getValue(); } else { return ""; } }, loadRawData:function (data) { var body = pm.request.body; if (body.isEditorInitialized === true) { body.codeMirror.setValue(data); body.codeMirror.refresh(); } }, initCodeMirrorEditor:function () { pm.request.body.isEditorInitialized = true; var bodyTextarea = document.getElementById("body"); pm.request.body.codeMirror = CodeMirror.fromTextArea(bodyTextarea, { mode:"htmlmixed", lineNumbers:true, theme:'eclipse' }); $("#request .CodeMirror").resizable({ stop: function() { pm.request.body.codeMirror.refresh(); }, resize: function(event, ui) { ui.size.width = ui.originalSize.width; $(".CodeMirror-scroll").height($(this).height()); pm.request.body.codeMirror.refresh(); } }); $("#request .CodeMirror-scroll").css("height", "200px"); pm.request.body.codeMirror.refresh(); }, setEditorMode:function (mode, language) { var displayMode = $("#body-editor-mode-selector a[data-language='" + language + "']").html(); $('#body-editor-mode-item-selected').html(displayMode); if (pm.request.body.isEditorInitialized) { if (mode === "javascript") { pm.request.body.codeMirror.setOption("mode", {"name":"javascript", "json":true}); } else { pm.request.body.codeMirror.setOption("mode", mode); } if (mode === "text") { $('#body-editor-mode-selector-format').addClass('disabled'); } else { $('#body-editor-mode-selector-format').removeClass('disabled'); } //pm.request.body.autoFormatEditor(mode); pm.request.body.codeMirror.refresh(); } }, autoFormatEditor:function (mode) { var content = pm.request.body.codeMirror.getValue(), validated = null, result = null; $('#body-editor-mode-selector-format-result').empty().hide(); if (pm.request.body.isEditorInitialized) { // In case its a JSON then just properly stringify it. // CodeMirror does not work well with pure JSON format. if (mode === 'javascript') { // Validate code first. try { validated = pm.jsonlint.instance.parse(content); if (validated) { content = JSON.parse(pm.request.body.codeMirror.getValue()); pm.request.body.codeMirror.setValue(JSON.stringify(content, null, 4)); } } catch(e) { result = e.message; // Show jslint result. // We could also highlight the line with error here. $('#body-editor-mode-selector-format-result').html(result).show(); } } else { // Otherwise use internal CodeMirror.autoFormatRage method for a specific mode. var totalLines = pm.request.body.codeMirror.lineCount(), totalChars = pm.request.body.codeMirror.getValue().length; pm.request.body.codeMirror.autoFormatRange( {line: 0, ch: 0}, {line: totalLines - 1, ch: pm.request.body.codeMirror.getLine(totalLines - 1).length} ); } } }, initFormDataEditor:function () { var editorId = "#formdata-keyvaleditor"; var params = { placeHolderKey:"Key", placeHolderValue:"Value", valueTypes:["text", "file"], deleteButton:'<img class="deleteButton" src="img/delete.png">', onDeleteRow:function () { }, onBlurElement:function () { } }; $(editorId).keyvalueeditor('init', params); }, initUrlEncodedEditor:function () { var editorId = "#urlencoded-keyvaleditor"; var params = { placeHolderKey:"Key", placeHolderValue:"Value", valueTypes:["text"], deleteButton:'<img class="deleteButton" src="img/delete.png">', onDeleteRow:function () { }, onBlurElement:function () { } }; $(editorId).keyvalueeditor('init', params); }, initEditorListeners:function () { $('#body-editor-mode-selector .dropdown-menu').on("click", "a", function (event) { var editorMode = $(event.target).attr("data-editor-mode"); var language = $(event.target).attr("data-language"); pm.request.body.setEditorMode(editorMode, language); }); // 'Format code' button listener. $('#body-editor-mode-selector-format').on('click.postman', function(evt) { var editorMode = $(event.target).attr("data-editor-mode"); if ($(evt.currentTarget).hasClass('disabled')) { return; } //pm.request.body.autoFormatEditor(pm.request.body.codeMirror.getMode().name); }); }, openFormDataEditor:function () { var containerId = "#formdata-keyvaleditor-container"; $(containerId).css("display", "block"); var editorId = "#formdata-keyvaleditor"; var params = $(editorId).keyvalueeditor('getValues'); var newParams = []; for (var i = 0; i < params.length; i++) { var param = { key:params[i].key, value:params[i].value }; newParams.push(param); } }, closeFormDataEditor:function () { var containerId = "#formdata-keyvaleditor-container"; $(containerId).css("display", "none"); }, openUrlEncodedEditor:function () { var containerId = "#urlencoded-keyvaleditor-container"; $(containerId).css("display", "block"); var editorId = "#urlencoded-keyvaleditor"; var params = $(editorId).keyvalueeditor('getValues'); var newParams = []; for (var i = 0; i < params.length; i++) { var param = { key:params[i].key, value:params[i].value }; newParams.push(param); } }, closeUrlEncodedEditor:function () { var containerId = "#urlencoded-keyvaleditor-container"; $(containerId).css("display", "none"); }, setDataMode:function (mode) { pm.request.dataMode = mode; pm.request.body.mode = mode; $('#data-mode-selector a').removeClass("active"); $('#data-mode-selector a[data-mode="' + mode + '"]').addClass("active"); $("#body-editor-mode-selector").css("display", "none"); if (mode === "params") { pm.request.body.openFormDataEditor(); pm.request.body.closeUrlEncodedEditor(); $('#body-data-container').css("display", "none"); } else if (mode === "raw") { pm.request.body.closeUrlEncodedEditor(); pm.request.body.closeFormDataEditor(); $('#body-data-container').css("display", "block"); if (pm.request.body.isEditorInitialized === false) { pm.request.body.initCodeMirrorEditor(); } else { pm.request.body.codeMirror.refresh(); } $("#body-editor-mode-selector").css("display", "block"); } else if (mode === "urlencoded") { pm.request.body.closeFormDataEditor(); pm.request.body.openUrlEncodedEditor(); $('#body-data-container').css("display", "none"); } }, getDataMode:function () { return pm.request.body.mode; }, //Be able to return direct keyvaleditor params getData:function (asObjects) { var data; var mode = pm.request.body.mode; var params; var newParams; var param; var i; if (mode === "params") { params = $('#formdata-keyvaleditor').keyvalueeditor('getValues'); newParams = []; for (i = 0; i < params.length; i++) { param = { key:params[i].key, value:params[i].value, type:params[i].type }; newParams.push(param); } if(asObjects === true) { return newParams; } else { data = pm.request.getBodyParamString(newParams); } } else if (mode === "raw") { data = pm.request.body.getRawData(); } else if (mode === "urlencoded") { params = $('#urlencoded-keyvaleditor').keyvalueeditor('getValues'); newParams = []; for (i = 0; i < params.length; i++) { param = { key:params[i].key, value:params[i].value, type:params[i].type }; newParams.push(param); } if(asObjects === true) { return newParams; } else { data = pm.request.getBodyParamString(newParams); } } return data; }, loadData:function (mode, data, asObjects) { var body = pm.request.body; body.setDataMode(mode); body.data = data; var params; if (mode === "params") { if(asObjects === true) { $('#formdata-keyvaleditor').keyvalueeditor('reset', data); } else { params = getBodyVars(data, false); $('#formdata-keyvaleditor').keyvalueeditor('reset', params); } } else if (mode === "raw") { body.loadRawData(data); } else if (mode === "urlencoded") { if(asObjects === true) { $('#urlencoded-keyvaleditor').keyvalueeditor('reset', data); } else { params = getBodyVars(data, false); $('#urlencoded-keyvaleditor').keyvalueeditor('reset', params); } } } }, init:function () { this.url = ""; this.urlParams = {}; this.body.data = ""; this.bodyParams = {}; this.headers = []; this.method = "GET"; this.dataMode = "params"; if (!this.areListenersAdded) { this.areListenersAdded = true; this.initializeHeaderEditor(); this.initializeUrlEditor(); this.body.init(); this.addListeners(); } var lastRequest = pm.settings.get("lastRequest"); if (lastRequest !== "") { var lastRequestParsed = JSON.parse(lastRequest); pm.request.isFromCollection = false; pm.request.loadRequestInEditor(lastRequestParsed); } }, setHeaderValue:function (key, value) { var headers = pm.request.headers; var origKey = key; key = key.toLowerCase(); var found = false; for (var i = 0, count = headers.length; i < count; i++) { var headerKey = headers[i].key.toLowerCase(); if (headerKey === key && value !== "text") { headers[i].value = value; found = true; } } var editorId = "#headers-keyvaleditor"; if (!found && value !== "text") { var header = { "key":origKey, "value":value }; headers.push(header); } $(editorId).keyvalueeditor('reset', headers); }, getHeaderValue:function (key) { var headers = pm.request.headers; key = key.toLowerCase(); for (var i = 0, count = headers.length; i < count; i++) { var headerKey = headers[i].key.toLowerCase(); if (headerKey === key) { return headers[i].value; } } return false; }, getHeaderEditorParams:function () { var hs = $('#headers-keyvaleditor').keyvalueeditor('getValues'); var newHeaders = []; for (var i = 0; i < hs.length; i++) { var header = { key:hs[i].key, value:hs[i].value, name:hs[i].key }; newHeaders.push(header); } return newHeaders; }, onHeaderAutoCompleteItemSelect:function(item) { if(item.type == "preset") { var preset = pm.headerPresets.getHeaderPreset(item.id); if("headers" in preset) { var headers = $('#headers-keyvaleditor').keyvalueeditor('getValues'); var loc = -1; for(var i = 0; i < headers.length; i++) { if(headers[i].key === item.label) { loc = i; break; } } if(loc >= 0) { headers.splice(loc, 1); } var newHeaders = _.union(headers, preset.headers); $('#headers-keyvaleditor').keyvalueeditor('reset', newHeaders); //Ensures that the key gets focus var element = $('#headers-keyvaleditor .keyvalueeditor-last input:first-child')[0]; $('#headers-keyvaleditor .keyvalueeditor-last input:first-child')[0].focus(); setTimeout(function() { element.focus(); }, 10); } } }, initializeHeaderEditor:function () { var params = { placeHolderKey:"Header", placeHolderValue:"Value", deleteButton:'<img class="deleteButton" src="img/delete.png">', onInit:function () { }, onAddedParam:function () { $("#headers-keyvaleditor .keyvalueeditor-key").catcomplete({ source:pm.headerPresets.presetsForAutoComplete, delay:50, select:function (event, item) { pm.request.onHeaderAutoCompleteItemSelect(item.item); } }); }, onDeleteRow:function () { pm.request.headers = pm.request.getHeaderEditorParams(); $('#headers-keyvaleditor-actions-open .headers-count').html(pm.request.headers.length); }, onFocusElement:function () { $("#headers-keyvaleditor .keyvalueeditor-key").catcomplete({ source:pm.headerPresets.presetsForAutoComplete, delay:50, select:function (event, item) { pm.request.onHeaderAutoCompleteItemSelect(item.item); } }); }, onBlurElement:function () { $("#headers-keyvaleditor .keyvalueeditor-key").catcomplete({ source:pm.headerPresets.presetsForAutoComplete, delay:50, select:function (event, item) { pm.request.onHeaderAutoCompleteItemSelect(item.item); } }); pm.request.headers = pm.request.getHeaderEditorParams(); $('#headers-keyvaleditor-actions-open .headers-count').html(pm.request.headers.length); }, onReset:function () { var hs = $('#headers-keyvaleditor').keyvalueeditor('getValues'); $('#headers-keyvaleditor-actions-open .headers-count').html(hs.length); } }; $('#headers-keyvaleditor').keyvalueeditor('init', params); $('#headers-keyvaleditor-actions-close').on("click", function () { $('#headers-keyvaleditor-actions-open').removeClass("active"); pm.request.closeHeaderEditor(); }); $('#headers-keyvaleditor-actions-open').on("click", function () { var isDisplayed = $('#headers-keyvaleditor-container').css("display") === "block"; if (isDisplayed) { pm.request.closeHeaderEditor(); } else { pm.request.openHeaderEditor(); } }); }, getAsJson:function () { var request = { url:$('#url').val(), data:pm.request.body.getData(true), headers:pm.request.getPackedHeaders(), dataMode:pm.request.dataMode, method:pm.request.method, version:2 }; return JSON.stringify(request); }, saveCurrentRequestToLocalStorage:function () { pm.settings.set("lastRequest", pm.request.getAsJson()); }, openHeaderEditor:function () { $('#headers-keyvaleditor-actions-open').addClass("active"); var containerId = "#headers-keyvaleditor-container"; $(containerId).css("display", "block"); }, closeHeaderEditor:function () { $('#headers-keyvaleditor-actions-open').removeClass("active"); var containerId = "#headers-keyvaleditor-container"; $(containerId).css("display", "none"); }, getUrlEditorParams:function () { var editorId = "#url-keyvaleditor"; var params = $(editorId).keyvalueeditor('getValues'); var newParams = []; for (var i = 0; i < params.length; i++) { var param = { key:params[i].key, value:params[i].value }; newParams.push(param); } return newParams; }, initializeUrlEditor:function () { var editorId; editorId = "#url-keyvaleditor"; var params = { placeHolderKey:"URL Parameter Key", placeHolderValue:"Value", deleteButton:'<img class="deleteButton" src="img/delete.png">', onDeleteRow:function () { pm.request.setUrlParamString(pm.request.getUrlEditorParams()); }, onBlurElement:function () { pm.request.setUrlParamString(pm.request.getUrlEditorParams()); } }; $(editorId).keyvalueeditor('init', params); $('#url-keyvaleditor-actions-close').on("click", function () { pm.request.closeUrlEditor(); }); $('#url-keyvaleditor-actions-open').on("click", function () { var isDisplayed = $('#url-keyvaleditor-container').css("display") === "block"; if (isDisplayed) { pm.request.closeUrlEditor(); } else { var newRows = getUrlVars($('#url').val(), false); $(editorId).keyvalueeditor('reset', newRows); pm.request.openUrlEditor(); } }); }, openUrlEditor:function () { $('#url-keyvaleditor-actions-open').addClass("active"); var containerId = "#url-keyvaleditor-container"; $(containerId).css("display", "block"); }, closeUrlEditor:function () { $('#url-keyvaleditor-actions-open').removeClass("active"); var containerId = "#url-keyvaleditor-container"; $(containerId).css("display", "none"); }, addListeners:function () { $('#data-mode-selector').on("click", "a", function () { var mode = $(this).attr("data-mode"); pm.request.body.setDataMode(mode); }); $('.request-meta-actions-togglesize').on("click", function () { var action = $(this).attr('data-action'); if (action === "minimize") { $(this).attr("data-action", "maximize"); $('.request-meta-actions-togglesize img').attr('src', 'img/circle_plus.png'); $("#request-description-container").slideUp(100); } else { $('.request-meta-actions-togglesize img').attr('src', 'img/circle_minus.png'); $(this).attr("data-action", "minimize"); $("#request-description-container").slideDown(100); } }); $('#url').keyup(function () { var newRows = getUrlVars($('#url').val(), false); $('#url-keyvaleditor').keyvalueeditor('reset', newRows); }); $('#add-to-collection').on("click", function () { if (pm.collections.areLoaded === false) { pm.collections.getAllCollections(); } }); $("#submit-request").on("click", function () { pm.request.send("text"); }); $("#preview-request").on("click", function () { pm.request.handlePreviewClick(); }); $("#update-request-in-collection").on("click", function () { pm.collections.updateCollectionFromCurrentRequest(); }); $("#cancel-request").on("click", function () { pm.request.cancel(); }); $("#request-actions-reset").on("click", function () { pm.request.startNew(); }); $('#request-method-selector').change(function () { var val = $(this).val(); pm.request.setMethod(val); }); }, getTotalTime:function () { this.totalTime = this.endTime - this.startTime; return this.totalTime; }, response:{ status:"", responseCode:[], time:0, headers:[], cookies:[], mime:"", text:"", state:{ size:"normal" }, previewType:"parsed", setMode:function (mode) { var text = pm.request.response.text; pm.request.response.setFormat(mode, text, pm.settings.get("previewType"), true); }, stripScriptTag:function (text) { var re = /<script\b[^>]*>([\s\S]*?)<\/script>/gm; text = text.replace(re, ""); return text; }, changePreviewType:function (newType) { if (this.previewType === newType) { return; } this.previewType = newType; $('#response-formatting a').removeClass('active'); $('#response-formatting a[data-type="' + this.previewType + '"]').addClass('active'); pm.settings.set("previewType", newType); if (newType === 'raw') { $('#response-as-text').css("display", "block"); $('#response-as-code').css("display", "none"); $('#response-as-preview').css("display", "none"); $('#code-data-raw').val(this.text); var codeDataWidth = $(document).width() - $('#sidebar').width() - 60; $('#code-data-raw').css("width", codeDataWidth + "px"); $('#code-data-raw').css("height", "600px"); $('#response-pretty-modifiers').css("display", "none"); } else if (newType === 'parsed') { $('#response-as-text').css("display", "none"); $('#response-as-code').css("display", "block"); $('#response-as-preview').css("display", "none"); $('#code-data').css("display", "none"); $('#response-pretty-modifiers').css("display", "block"); pm.editor.codeMirror.refresh(); } else if (newType === 'preview') { $('#response-as-text').css("display", "none"); $('#response-as-code').css("display", "none"); $('#code-data').css("display", "none"); $('#response-as-preview').css("display", "block"); $('#response-pretty-modifiers').css("display", "none"); } }, loadHeaders:function (data) { this.headers = pm.request.unpackResponseHeaders(data); if(pm.settings.get("usePostmanProxy") === true) { var count = this.headers.length; for(var i = 0; i < count; i++) { if(this.headers[i].key == "Postman-Location") { this.headers[i].key = "Location"; this.headers[i].name = "Location"; break; } } } $('#response-headers').html(""); this.headers = _.sortBy(this.headers, function (header) { return header.name; }); $("#response-headers").append(Handlebars.templates.response_headers({"items":this.headers})); $('.response-header-name').popover({ trigger: "hover", }); }, clear:function () { this.startTime = 0; this.endTime = 0; this.totalTime = 0; this.status = ""; this.time = 0; this.headers = {}; this.mime = ""; this.state.size = "normal"; this.previewType = "parsed"; $('#response').css("display", "none"); }, showScreen:function (screen) { $("#response").css("display", "block"); var active_id = "#response-" + screen + "-container"; var all_ids = ["#response-waiting-container", "#response-failed-container", "#response-success-container"]; for (var i = 0; i < 3; i++) { $(all_ids[i]).css("display", "none"); } $(active_id).css("display", "block"); }, render:function (response) { pm.request.response.showScreen("success"); $('#response-status').html(Handlebars.templates.item_response_code(response.responseCode)); $('.response-code').popover({ trigger: "hover" }); //This sets pm.request.response.headers $("#response-headers").append(Handlebars.templates.response_headers({"items":response.headers})); $('.response-tabs li[data-section="headers"]').html("Headers (" + response.headers.length + ")"); $("#response-data").css("display", "block"); $("#loader").css("display", "none"); $('#response-time .data').html(response.time + " ms"); var contentTypeIndexOf = find(response.headers, function (element, index, collection) { return element.key === "Content-Type"; }); var contentType; if (contentTypeIndexOf >= 0) { contentType = response.headers[contentTypeIndexOf].value; } $('#response').css("display", "block"); $('#submit-request').button("reset"); $('#code-data').css("display", "block"); var language = 'html'; pm.request.response.previewType = pm.settings.get("previewType"); var responsePreviewType = 'html'; if (!_.isUndefined(contentType) && !_.isNull(contentType)) { if (contentType.search(/json/i) !== -1 || contentType.search(/javascript/i) !== -1 || pm.settings.get("languageDetection") == 'javascript') { language = 'javascript'; } $('#language').val(language); if (contentType.search(/image/i) >= 0) { responsePreviewType = 'image'; $('#response-as-code').css("display", "none"); $('#response-as-text').css("display", "none"); $('#response-as-image').css("display", "block"); var imgLink = pm.request.processUrl($('#url').val()); $('#response-formatting').css("display", "none"); $('#response-actions').css("display", "none"); $("#response-language").css("display", "none"); $("#response-as-preview").css("display", "none"); $("#response-pretty-modifiers").css("display", "none"); $("#response-as-image").html("<img src='" + imgLink + "'/>"); } else { responsePreviewType = 'html'; pm.request.response.setFormat(language, response.text, pm.settings.get("previewType"), true); } } else { if (pm.settings.get("languageDetection") == 'javascript') { language = 'javascript'; } pm.request.response.setFormat(language, response.text, pm.settings.get("previewType"), true); } pm.request.response.renderCookies(response.cookies); if (responsePreviewType === "html") { $("#response-as-preview").html(""); var cleanResponseText = pm.request.response.stripScriptTag(pm.request.response.text); pm.filesystem.renderResponsePreview("response.html", cleanResponseText, "html", function (response_url) { $("#response-as-preview").html("<iframe></iframe>"); $("#response-as-preview iframe").attr("src", response_url); }); } if (pm.request.method === "HEAD") { pm.request.response.showHeaders() } if (pm.request.isFromCollection === true) { $("#response-collection-request-actions").css("display", "block"); } else { $("#response-collection-request-actions").css("display", "none"); } $("#response-sample-status").css("display", "block"); var r = pm.request.response; r.time = response.time; r.cookies = response.cookies; r.headers = response.headers; r.text = response.text; r.responseCode = response.responseCode; $("#response-samples").css("display", "block"); }, load:function (response) { $("#response-sample-status").css("display", "none"); if (response.readyState == 4) { //Something went wrong if (response.status == 0) { var errorUrl = pm.envManager.getCurrentValue(pm.request.url); $('#connection-error-url').html("<a href='" + errorUrl + "' target='_blank'>" + errorUrl + "</a>"); pm.request.response.showScreen("failed"); $('#submit-request').button("reset"); return false; } pm.request.response.showScreen("success") pm.request.response.showBody(); var responseCodeName; if ("statusText" in response) { responseCodeName = response.statusText; } else { responseCodeName = httpStatusCodes[response.status]['name']; } var responseCode = { 'code':response.status, 'name':responseCodeName, 'detail':httpStatusCodes[response.status]['detail'] }; var responseData; if (response.responseRawDataType == "arraybuffer") { responseData = response.response; } else { this.text = response.responseText; } pm.request.endTime = new Date().getTime(); var diff = pm.request.getTotalTime(); pm.request.response.time = diff; pm.request.response.responseCode = responseCode; $('#response-status').html(Handlebars.templates.item_response_code(responseCode)); $('.response-code').popover({ trigger: "hover" }); //This sets pm.request.response.headers this.loadHeaders(response.getAllResponseHeaders()); $('.response-tabs li[data-section="headers"]').html("Headers (" + this.headers.length + ")"); $("#response-data").css("display", "block"); $("#loader").css("display", "none"); $('#response-time .data').html(diff + " ms"); var contentType = response.getResponseHeader("Content-Type"); $('#response').css("display", "block"); $('#submit-request').button("reset"); $('#code-data').css("display", "block"); var language = 'html'; pm.request.response.previewType = pm.settings.get("previewType"); var responsePreviewType = 'html'; if (!_.isUndefined(contentType) && !_.isNull(contentType)) { if (contentType.search(/json/i) !== -1 || contentType.search(/javascript/i) !== -1 || pm.settings.get("languageDetection") == 'javascript') { language = 'javascript'; } $('#language').val(language); if (contentType.search(/image/i) >= 0) { responsePreviewType = 'image'; $('#response-as-code').css("display", "none"); $('#response-as-text').css("display", "none"); $('#response-as-image').css("display", "block"); var imgLink = pm.request.processUrl($('#url').val()); $('#response-formatting').css("display", "none"); $('#response-actions').css("display", "none"); $("#response-language").css("display", "none"); $("#response-as-preview").css("display", "none"); $("#response-pretty-modifiers").css("display", "none"); $("#response-as-image").html("<img src='" + imgLink + "'/>"); } else if (contentType.search(/pdf/i) >= 0 && response.responseRawDataType == "arraybuffer") { responsePreviewType = 'pdf'; // Hide everything else $('#response-as-code').css("display", "none"); $('#response-as-text').css("display", "none"); $('#response-as-image').css("display", "none"); $('#response-formatting').css("display", "none"); $('#response-actions').css("display", "none"); $("#response-language").css("display", "none"); $("#response-as-preview").html(""); $("#response-as-preview").css("display", "block"); $("#response-pretty-modifiers").css("display", "none"); pm.filesystem.renderResponsePreview("response.pdf", responseData, "pdf", function (response_url) { $("#response-as-preview").html("<iframe src='" + response_url + "'/>"); }); } else if (contentType.search(/pdf/i) >= 0 && response.responseRawDataType == "text") { pm.request.send("arraybuffer"); return; } else { responsePreviewType = 'html'; this.setFormat(language, this.text, pm.settings.get("previewType"), true); } } else { if (pm.settings.get("languageDetection") == 'javascript') { language = 'javascript'; } this.setFormat(language, this.text, pm.settings.get("previewType"), true); } var url = pm.request.url; //Sets pm.request.response.cookies pm.request.response.loadCookies(url); if (responsePreviewType === "html") { $("#response-as-preview").html(""); if (!pm.settings.get("disableIframePreview")) { var cleanResponseText = pm.request.response.stripScriptTag(pm.request.response.text); pm.filesystem.renderResponsePreview("response.html", cleanResponseText, "html", function (response_url) { $("#response-as-preview").html("<iframe></iframe>"); $("#response-as-preview iframe").attr("src", response_url); }); } } if (pm.request.method === "HEAD") { pm.request.response.showHeaders() } if (pm.request.isFromCollection === true) { $("#response-collection-request-actions").css("display", "block"); } else { $("#response-collection-request-actions").css("display", "none"); } } pm.layout.setLayout(); return true; }, renderCookies:function (cookies) { var count = 0; if (!cookies) { count = 0; } else { count = cookies.length; } if (count === 0) { $("#response-tabs-cookies").html("Cookies"); $('#response-tabs-cookies').css("display", "none"); } else { $("#response-tabs-cookies").html("Cookies (" + count + ")"); $('#response-tabs-cookies').css("display", "block"); cookies = _.sortBy(cookies, function (cookie) { return cookie.name; }); for (var i = 0; i < count; i++) { var cookie = cookies[i]; if ("expirationDate" in cookie) { var date = new Date(cookie.expirationDate * 1000); cookies[i].expires = date.toUTCString(); } } $('#response-cookies-items').html(Handlebars.templates.response_cookies({"items":cookies})); } pm.request.response.cookies = cookies; }, loadCookies:function (url) { chrome.cookies.getAll({url:url}, function (cookies) { var count; pm.request.response.renderCookies(cookies); }); }, setFormat:function (language, response, format, forceCreate) { //Keep CodeMirror div visible otherwise the response gets cut off $('#response-as-code').css("display", "block"); $('#response-as-text').css("display", "none"); $('#response-as-image').css("display", "none"); $('#response-formatting').css("display", "block"); $('#response-actions').css("display", "block"); $('#response-formatting a').removeClass('active'); $('#response-formatting a[data-type="' + format + '"]').addClass('active'); $('#code-data').css("display", "none"); $('#code-data').attr("data-mime", language); var codeDataArea = document.getElementById("code-data"); var foldFunc; var mode; $('#response-language').css("display", "block"); $('#response-language a').removeClass("active"); //Use prettyprint here instead of stringify if (language === 'javascript') { try { if ('string' === typeof response && response.match(/^[\)\]\}]/)) response = response.substring(response.indexOf('\n')); response = vkbeautify.json(response); mode = 'javascript'; foldFunc = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder); } catch (e) { mode = 'text'; } $('#response-language a[data-mode="javascript"]').addClass("active"); } else if (language === 'html') { response = vkbeautify.xml(response); mode = 'xml'; foldFunc = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder); $('#response-language a[data-mode="html"]').addClass("active"); } else { mode = 'text'; } var lineWrapping; if (pm.settings.get("lineWrapping") === true) { $('#response-body-line-wrapping').addClass("active"); lineWrapping = true; } else { $('#response-body-line-wrapping').removeClass("active"); lineWrapping = false; } pm.editor.mode = mode; var renderMode = mode; if ($.inArray(mode, ["javascript", "xml", "html"]) >= 0) { renderMode = "links"; } if (!pm.editor.codeMirror || forceCreate) { $('#response .CodeMirror').remove(); pm.editor.codeMirror = CodeMirror.fromTextArea(codeDataArea, { mode:renderMode, lineNumbers:true, fixedGutter:true, onGutterClick:foldFunc, theme:'eclipse', lineWrapping:lineWrapping, readOnly:true }); var cm = pm.editor.codeMirror; cm.setValue(response); } else { pm.editor.codeMirror.setOption("onGutterClick", foldFunc); pm.editor.codeMirror.setOption("mode", renderMode); pm.editor.codeMirror.setOption("lineWrapping", lineWrapping); pm.editor.codeMirror.setOption("theme", "eclipse"); pm.editor.codeMirror.setOption("readOnly", false); pm.editor.codeMirror.setValue(response); pm.editor.codeMirror.refresh(); CodeMirror.commands["goDocStart"](pm.editor.codeMirror); $(window).scrollTop(0); } //If the format is raw then switch if (format === "parsed") { $('#response-as-code').css("display", "block"); $('#response-as-text').css("display", "none"); $('#response-as-preview').css("display", "none"); $('#response-pretty-modifiers').css("display", "block"); } else if (format === "raw") { $('#code-data-raw').val(response); var codeDataWidth = $(document).width() - $('#sidebar').width() - 60; $('#code-data-raw').css("width", codeDataWidth + "px"); $('#code-data-raw').css("height", "600px"); $('#response-as-code').css("display", "none"); $('#response-as-text').css("display", "block"); $('#response-pretty-modifiers').css("display", "none"); } else if (format === "preview") { $('#response-as-code').css("display", "none"); $('#response-as-text').css("display", "none"); $('#response-as-preview').css("display", "block"); $('#response-pretty-modifiers').css("display", "none"); } }, toggleBodySize:function () { if ($('#response').css("display") === "none") { return false; } $('a[rel="tooltip"]').tooltip('hide'); if (this.state.size === "normal") { this.state.size = "maximized"; $('#response-body-toggle img').attr("src", "img/full-screen-exit-alt-2.png"); this.state.width = $('#response-data').width(); this.state.height = $('#response-data').height(); this.state.display = $('#response-data').css("display"); this.state.position = $('#response-data').css("position"); $('#response-data').css("position", "absolute"); $('#response-data').css("left", 0); $('#response-data').css("top", "-15px"); $('#response-data').css("width", $(document).width() - 20); $('#response-data').css("height", $(document).height()); $('#response-data').css("z-index", 100); $('#response-data').css("background-color", "#fff"); $('#response-data').css("padding", "10px"); } else { this.state.size = "normal"; $('#response-body-toggle img').attr("src", "img/full-screen-alt-4.png"); $('#response-data').css("position", this.state.position); $('#response-data').css("left", 0); $('#response-data').css("top", 0); $('#response-data').css("width", this.state.width); $('#response-data').css("height", this.state.height); $('#response-data').css("z-index", 10); $('#response-data').css("background-color", "#fff"); $('#response-data').css("padding", "0px"); } }, showHeaders:function () { $('.response-tabs li').removeClass("active"); $('.response-tabs li[data-section="headers"]').addClass("active"); $('#response-data-container').css("display", "none"); $('#response-headers-container').css("display", "block"); $('#response-cookies-container').css("display", "none"); }, showBody:function () { $('.response-tabs li').removeClass("active"); $('.response-tabs li[data-section="body"]').addClass("active"); $('#response-data-container').css("display", "block"); $('#response-headers-container').css("display", "none"); $('#response-cookies-container').css("display", "none"); }, showCookies:function () { $('.response-tabs li').removeClass("active"); $('.response-tabs li[data-section="cookies"]').addClass("active"); $('#response-data-container').css("display", "none"); $('#response-headers-container').css("display", "none"); $('#response-cookies-container').css("display", "block"); }, openInNewWindow:function (data) { var name = "response.html"; var type = "text/html"; pm.filesystem.saveAndOpenFile(name, data, type, function () { }); } }, startNew:function () { pm.request.showRequestBuilder(); $('.sidebar-collection-request').removeClass('sidebar-collection-request-active'); if (pm.request.xhr !== null) { pm.request.xhr.abort(); } this.url = ""; this.urlParams = {}; this.body.data = ""; this.bodyParams = {}; this.name = ""; this.description = ""; this.headers = []; this.method = "GET"; this.dataMode = "params"; this.refreshLayout(); $('#url-keyvaleditor').keyvalueeditor('reset'); $('#headers-keyvaleditor').keyvalueeditor('reset'); $('#formdata-keyvaleditor').keyvalueeditor('reset'); $('#update-request-in-collection').css("display", "none"); $('#url').val(); $('#url').focus(); this.response.clear(); }, cancel:function () { if (pm.request.xhr !== null) { pm.request.xhr.abort(); } pm.request.response.clear(); }, setMethod:function (method) { this.url = $('#url').val(); this.method = method; this.refreshLayout(); }, refreshLayout:function () { $('#url').val(this.url); $('#request-method-selector').val(this.method); pm.request.body.loadRawData(pm.request.body.getData()); $('#headers-keyvaleditor').keyvalueeditor('reset', this.headers); $('#headers-keyvaleditor-actions-open .headers-count').html(this.headers.length); $('#submit-request').button("reset"); $('#data-mode-selector a').removeClass("active"); $('#data-mode-selector a[data-mode="' + this.dataMode + '"]').addClass("active"); if (this.isMethodWithBody(this.method)) { $("#data").css("display", "block"); var mode = this.dataMode; pm.request.body.setDataMode(mode); } else { pm.request.body.hide(); } if (this.name !== "") { $('#request-meta').css("display", "block"); $('#request-name').css("display", "inline-block"); if ($('#request-description').css("display") === "block") { $('#request-description').css("display", "block"); } else { $('#request-description').css("display", "none"); } } else { $('#request-meta').css("display", "none"); $('#request-name').css("display", "none"); $('#request-description').css("display", "none"); $('#request-samples').css("display", "none"); } $('.request-help-actions-togglesize a').attr('data-action', 'minimize'); $('.request-help-actions-togglesize img').attr('src', 'img/circle_minus.png'); }, loadRequestFromLink:function (link, headers) { this.startNew(); this.url = link; this.method = "GET"; pm.request.isFromCollection = false; if (pm.settings.get("retainLinkHeaders") === true) { if (headers) { pm.request.headers = headers; } } this.refreshLayout(); }, isMethodWithBody:function (method) { method = method.toUpperCase(); return $.inArray(method, pm.request.methodsWithBody) >= 0; }, packHeaders:function (headers) { var headersLength = headers.length; var paramString = ""; for (var i = 0; i < headersLength; i++) { var h = headers[i]; if (h.name && h.name !== "") { paramString += h.name + ": " + h.value + "\n"; } } return paramString; }, getPackedHeaders:function () { return this.packHeaders(this.headers); }, unpackResponseHeaders:function (data) { if (data === null || data === "") { return []; } else { var vars = [], hash; var hashes = data.split('\n'); var header; for (var i = 0; i < hashes.length; i++) { hash = hashes[i]; var loc = hash.search(':'); if (loc !== -1) { var name = $.trim(hash.substr(0, loc)); var value = $.trim(hash.substr(loc + 1)); header = { "name":name, "key":name, "value":value, "description":headerDetails[name.toLowerCase()] }; vars.push(header); } } return vars; } }, unpackHeaders:function (data) { if (data === null || data === "") { return []; } else { var vars = [], hash; var hashes = data.split('\n'); var header; for (var i = 0; i < hashes.length; i++) { hash = hashes[i]; if (!hash) { continue; } var loc = hash.search(':'); if (loc !== -1) { var name = $.trim(hash.substr(0, loc)); var value = $.trim(hash.substr(loc + 1)); header = { "name":$.trim(name), "key":$.trim(name), "value":$.trim(value), "description":headerDetails[$.trim(name).toLowerCase()] }; vars.push(header); } } return vars; } }, loadRequestInEditor:function (request, isFromCollection, isFromSample) { pm.request.showRequestBuilder(); pm.helpers.showRequestHelper("normal"); this.url = request.url; this.body.data = request.body; this.method = request.method.toUpperCase(); if (isFromCollection) { $('#update-request-in-collection').css("display", "inline-block"); if (typeof request.name !== "undefined") { this.name = request.name; $('#request-meta').css("display", "block"); $('#request-name').html(this.name); $('#request-name').css("display", "inline-block"); } else { this.name = ""; $('#request-meta').css("display", "none"); $('#request-name').css("display", "none"); } if (typeof request.description !== "undefined") { this.description = request.description; $('#request-description').html(this.description); $('#request-description').css("display", "block"); } else { this.description = ""; $('#request-description').css("display", "none"); } $('#response-sample-save-form').css("display", "none"); //Disabling this. Will enable after resolving indexedDB issues //$('#response-sample-save-start-container').css("display", "inline-block"); $('.request-meta-actions-togglesize').attr('data-action', 'minimize'); $('.request-meta-actions-togglesize img').attr('src', 'img/circle_minus.png'); //Load sample if ("responses" in request) { pm.request.responses = request.responses; $("#request-samples").css("display", "block"); if (request.responses) { if (request.responses.length > 0) { $('#request-samples table').html(""); $('#request-samples table').append(Handlebars.templates.sample_responses({"items":request.responses})); } else { $('#request-samples table').html(""); $("#request-samples").css("display", "none"); } } else { pm.request.responses = []; $('#request-samples table').html(""); $("#request-samples").css("display", "none"); } } else { pm.request.responses = []; $('#request-samples table').html(""); $("#request-samples").css("display", "none"); } } else if (isFromSample) { $('#update-request-in-collection').css("display", "inline-block"); } else { this.name = ""; $('#request-meta').css("display", "none"); $('#update-request-in-collection').css("display", "none"); } if (typeof request.headers !== "undefined") { this.headers = this.unpackHeaders(request.headers); } else { this.headers = []; } $('#headers-keyvaleditor-actions-open .headers-count').html(this.headers.length); $('#url').val(this.url); var newUrlParams = getUrlVars(this.url, false); //@todoSet params using keyvalueeditor function $('#url-keyvaleditor').keyvalueeditor('reset', newUrlParams); $('#headers-keyvaleditor').keyvalueeditor('reset', this.headers); this.response.clear(); $('#request-method-selector').val(this.method); if (this.isMethodWithBody(this.method)) { this.dataMode = request.dataMode; $('#data').css("display", "block"); if("version" in request) { if(request.version == 2) { pm.request.body.loadData(request.dataMode, request.data, true); } else { pm.request.body.loadData(request.dataMode, request.data); } } else { pm.request.body.loadData(request.dataMode, request.data); } } else { $('#data').css("display", "none"); } //Set raw body editor value if Content-Type is present var contentType = pm.request.getHeaderValue("Content-Type"); var mode; var language; if (contentType === false) { mode = 'text'; language = 'text'; } else if (contentType.search(/json/i) !== -1 || contentType.search(/javascript/i) !== -1) { mode = 'javascript'; language = 'json'; } else if (contentType.search(/xml/i) !== -1) { mode = 'xml'; language = 'xml'; } else if (contentType.search(/html/i) !== -1) { mode = 'xml'; language = 'html'; } else { language = 'text'; contentType = 'text'; } pm.request.body.setEditorMode(mode, language); $('body').scrollTop(0); }, getBodyParamString:function (params) { var paramsLength = params.length; var paramArr = []; for (var i = 0; i < paramsLength; i++) { var p = params[i]; if (p.key && p.key !== "") { paramArr.push(p.key + "=" + p.value); } } return paramArr.join('&'); }, setUrlParamString:function (params) { this.url = $('#url').val(); var url = this.url; var paramArr = []; for (var i = 0; i < params.length; i++) { var p = params[i]; if (p.key && p.key !== "") { paramArr.push(p.key + "=" + p.value); } } var baseUrl = url.split("?")[0]; if (paramArr.length > 0) { $('#url').val(baseUrl + "?" + paramArr.join('&')); } else { //Has key/val pair if (url.indexOf("?") > 0 && url.indexOf("=") > 0) { $('#url').val(baseUrl); } else { $('#url').val(url); } } }, reset:function () { }, encodeUrl:function (url) { var quesLocation = url.indexOf('?'); if (quesLocation > 0) { var urlVars = getUrlVars(url); var baseUrl = url.substring(0, quesLocation); var urlVarsCount = urlVars.length; var newUrl = baseUrl + "?"; for (var i = 0; i < urlVarsCount; i++) { newUrl += encodeURIComponent(urlVars[i].key) + "=" + encodeURIComponent(urlVars[i].value) + "&"; } newUrl = newUrl.substr(0, newUrl.length - 1); return url; } else { return url; } }, prepareHeadersForProxy:function (headers) { var count = headers.length; for (var i = 0; i < count; i++) { var key = headers[i].key.toLowerCase(); if (_.indexOf(pm.bannedHeaders, key) >= 0) { headers[i].key = "Postman-" + headers[i].key; headers[i].name = "Postman-" + headers[i].name; } } return headers; }, processUrl:function (url) { var finalUrl = pm.envManager.getCurrentValue(url); finalUrl = ensureProperUrl(finalUrl); return finalUrl; }, prepareForSending: function() { // Set state as if change event of input handlers was called pm.request.setUrlParamString(pm.request.getUrlEditorParams()); if (pm.helpers.activeHelper == "oauth1" && pm.helpers.oAuth1.isAutoEnabled) { pm.helpers.oAuth1.generateHelper(); pm.helpers.oAuth1.process(); } $('#headers-keyvaleditor-actions-open .headers-count').html(pm.request.headers.length); pm.request.url = pm.request.processUrl($('#url').val()); pm.request.startTime = new Date().getTime(); }, getXhrHeaders: function() { pm.request.headers = pm.request.getHeaderEditorParams(); var headers = pm.request.getHeaderEditorParams(); if(pm.settings.get("sendNoCacheHeader") === true) { var noCacheHeader = { key: "Cache-Control", name: "Cache-Control", value: "no-cache" }; headers.push(noCacheHeader); } if(pm.request.dataMode === "urlencoded") { var urlencodedHeader = { key: "Content-Type", name: "Content-Type", value: "application/x-www-form-urlencoded" }; headers.push(urlencodedHeader); } if (pm.settings.get("usePostmanProxy") == true) { headers = pm.request.prepareHeadersForProxy(headers); } var i; var finalHeaders = []; for (i = 0; i < headers.length; i++) { var header = headers[i]; if (!_.isEmpty(header.value)) { header.value = pm.envManager.getCurrentValue(header.value); finalHeaders.push(header); } } return finalHeaders; }, getDummyFormDataBoundary: function() { var boundary = "----WebKitFormBoundaryE19zNvXGzXaLvS5C"; return boundary; }, getFormDataPreview: function() { var rows, count, j; var row, key, value; var i; rows = $('#formdata-keyvaleditor').keyvalueeditor('getElements'); count = rows.length; var params = []; if (count > 0) { for (j = 0; j < count; j++) { row = rows[j]; key = row.keyElement.val(); var valueType = row.valueType; var valueElement = row.valueElement; if (valueType === "file") { var domEl = valueElement.get(0); var len = domEl.files.length; for (i = 0; i < len; i++) { var fileObj = { key: key, value: domEl.files[i], type: "file", } params.push(fileObj); } } else { value = valueElement.val(); value = pm.envManager.getCurrentValue(value); var textObj = { key: key, value: value, type: "text", } params.push(textObj); } } console.log(params); var paramsCount = params.length; var body = ""; for(i = 0; i < paramsCount; i++) { var param = params[i]; console.log(param); body += pm.request.getDummyFormDataBoundary(); if(param.type === "text") { body += "<br/>Content-Disposition: form-data; name=\"" + param.key + "\"<br/><br/>"; body += param.value; body += "<br/>"; } else if(param.type === "file") { body += "<br/>Content-Disposition: form-data; name=\"" + param.key + "\"; filename="; body += "\"" + param.value.name + "\"<br/>"; body += "Content-Type: " + param.value.type; body += "<br/><br/><br/>" } } body += pm.request.getDummyFormDataBoundary(); return body; } else { return false; } }, getFormDataBody: function() { var rows, count, j; var i; var row, key, value; var paramsBodyData = new FormData(); rows = $('#formdata-keyvaleditor').keyvalueeditor('getElements'); count = rows.length; if (count > 0) { for (j = 0; j < count; j++) { row = rows[j]; key = row.keyElement.val(); var valueType = row.valueType; var valueElement = row.valueElement; if (valueType === "file") { var domEl = valueElement.get(0); var len = domEl.files.length; for (i = 0; i < len; i++) { paramsBodyData.append(key, domEl.files[i]); } } else { value = valueElement.val(); value = pm.envManager.getCurrentValue(value); paramsBodyData.append(key, value); } } return paramsBodyData; } else { return false; } }, getUrlEncodedBody: function() { var rows, count, j; var row, key, value; var urlEncodedBodyData = ""; rows = $('#urlencoded-keyvaleditor').keyvalueeditor('getElements'); count = rows.length; if (count > 0) { for (j = 0; j < count; j++) { row = rows[j]; value = row.valueElement.val(); value = pm.envManager.getCurrentValue(value); value = encodeURIComponent(value); value = value.replace(/%20/g, '+'); key = encodeURIComponent(row.keyElement.val()); key = key.replace(/%20/g, '+'); urlEncodedBodyData += key + "=" + value + "&"; } urlEncodedBodyData = urlEncodedBodyData.substr(0, urlEncodedBodyData.length - 1); return urlEncodedBodyData; } else { return false; } }, getRequestBodyPreview: function() { if (pm.request.dataMode === 'raw') { var rawBodyData = pm.request.body.getData(true); rawBodyData = pm.envManager.getCurrentValue(rawBodyData); return rawBodyData; } else if (pm.request.dataMode === 'params') { var formDataBody = pm.request.getFormDataPreview(); if(formDataBody !== false) { return formDataBody; } else { return false; } } else if (pm.request.dataMode === 'urlencoded') { var urlEncodedBodyData = pm.request.getUrlEncodedBody(); if(urlEncodedBodyData !== false) { return urlEncodedBodyData; } else { return false; } } }, getRequestBodyToBeSent: function() { if (pm.request.dataMode === 'raw') { var rawBodyData = pm.request.body.getData(true); rawBodyData = pm.envManager.getCurrentValue(rawBodyData); return rawBodyData; } else if (pm.request.dataMode === 'params') { var formDataBody = pm.request.getFormDataBody(); if(formDataBody !== false) { return formDataBody; } else { return false; } } else if (pm.request.dataMode === 'urlencoded') { var urlEncodedBodyData = pm.request.getUrlEncodedBody(); if(urlEncodedBodyData !== false) { return urlEncodedBodyData; } else { return false; } } }, //Send the current request send:function (responseRawDataType) { pm.request.prepareForSending(); if (pm.request.url === "") { return; } var originalUrl = $('#url').val(); //Store this for saving the request var url = pm.request.encodeUrl(pm.request.url); var method = pm.request.method.toUpperCase(); var originalData = pm.request.body.getData(true); //Start setting up XHR var xhr = new XMLHttpRequest(); xhr.open(method, url, true); //Open the XHR request. Will be sent later xhr.onreadystatechange = function (event) { pm.request.response.load(event.target); }; //Response raw data type is used for fetching binary responses while generating PDFs if (!responseRawDataType) { responseRawDataType = "text"; } xhr.responseType = responseRawDataType; var headers = pm.request.getXhrHeaders(headers); for (var i = 0; i < headers.length; i++) { xhr.setRequestHeader(headers[i].name, headers[i].value); } // Prepare body if (pm.request.isMethodWithBody(method)) { var body = pm.request.getRequestBodyToBeSent(); if(body === false) { xhr.send(); } else { xhr.send(body); } } else { xhr.send(); } pm.request.xhr = xhr; //Save the request if (pm.settings.get("autoSaveRequest")) { pm.history.addRequest(originalUrl, method, pm.request.getPackedHeaders(), originalData, pm.request.dataMode); } //Show the final UI pm.request.updateUiPostSending(); }, updateUiPostSending: function() { $('#submit-request').button("loading"); pm.request.response.clear(); pm.request.response.showScreen("waiting"); }, splitUrlIntoHostAndPath: function(url) { var path = ""; var host; var parts = url.split('/'); host = parts[2]; var partsCount = parts.length; for(var i = 3; i < partsCount; i++) { path += "/" + parts[i]; } return { host: host, path: path }; }, showRequestBuilder: function() { $("#preview-request").html("Preview"); pm.request.editorMode = 0; $("#request-builder").css("display", "block"); $("#request-preview").css("display", "none"); }, showPreview: function() { //Show preview $("#preview-request").html("Build"); pm.request.editorMode = 1; $("#request-builder").css("display", "none"); $("#request-preview").css("display", "block"); }, handlePreviewClick:function() { if(pm.request.editorMode == 1) { pm.request.showRequestBuilder(); } else { pm.request.showPreview(); } pm.request.prepareForSending(); var method = pm.request.method.toUpperCase(); var httpVersion = "HTTP/1.1"; var hostAndPath = pm.request.splitUrlIntoHostAndPath(pm.request.url); var path = hostAndPath.path; var host = hostAndPath.host; var headers = pm.request.getXhrHeaders(); var hasBody = pm.request.isMethodWithBody(pm.request.method.toUpperCase()); var body; if(hasBody) { body = pm.request.getRequestBodyPreview(); } var requestPreview = method + " " + path + " " + httpVersion + "<br/>"; requestPreview += "Host: " + host + "<br/>"; var headersCount = headers.length; for(var i = 0; i < headersCount; i ++) { requestPreview += headers[i].key + ": " + headers[i].value + "<br/>"; } if(hasBody && body !== false) { requestPreview += "<br/>" + body + "<br/><br/>"; } else { requestPreview += "<br/><br/>"; } $("#request-preview-content").html(requestPreview); } };
35.334122
161
0.47559
3b369dca594453ec5ed303ae60a1618540215e68
442
js
JavaScript
src/updateRepo.js
879479119/Github-Trending-API
7f907c3f3dd499231f24afd24903cb3f4c041369
[ "MIT" ]
null
null
null
src/updateRepo.js
879479119/Github-Trending-API
7f907c3f3dd499231f24afd24903cb3f4c041369
[ "MIT" ]
null
null
null
src/updateRepo.js
879479119/Github-Trending-API
7f907c3f3dd499231f24afd24903cb3f4c041369
[ "MIT" ]
null
null
null
let Promise = require('bluebird') let getPageInHtml = require('./download') let parseRepo = require('./parseRepo') let addRepo = require('./addRepo') let removeRepo = require('./removeRepo') module.exports = function ({url, span}) { return getPageInHtml(url, span).then(html=>{ let arr = parseRepo(html, span) return removeRepo({url, span}, arr) }).then(result=>{ result.map((item)=>{ addRepo(item, url) }) return result }) }
26
45
0.674208
3b387be7f5e29f36557315ae9dd0d45e97588589
4,894
js
JavaScript
app/static/js/main.js
bharath24all/medical-diagnosis-webapp
776fdb0ab4c6945202c7cbc5371a2c9baeec88d1
[ "Apache-2.0" ]
7
2019-10-01T15:56:01.000Z
2021-10-30T08:22:48.000Z
app/static/js/main.js
bharath24all/medical-diagnosis-webapp
776fdb0ab4c6945202c7cbc5371a2c9baeec88d1
[ "Apache-2.0" ]
null
null
null
app/static/js/main.js
bharath24all/medical-diagnosis-webapp
776fdb0ab4c6945202c7cbc5371a2c9baeec88d1
[ "Apache-2.0" ]
4
2019-10-01T15:44:19.000Z
2021-12-23T07:32:18.000Z
// let net; // var webcam_runnig=false; // const webcamElement = document.getElementById('webcam'); // var webcamStream; // function readPath(input) { // if (input.files && input.files[0]) { // var reader = new FileReader(); // reader.onload = function (e) { // $('#cls_img').attr('src', e.target.result); // } // reader.readAsDataURL(input.files[0]); // } // } // async function setupWebcam() { // return new Promise((resolve, reject) => { // const navigatorAny = navigator; // navigator.getUserMedia = navigator.getUserMedia || // navigatorAny.webkitGetUserMedia || navigatorAny.mozGetUserMedia || // navigatorAny.msGetUserMedia; // if (navigator.getUserMedia) { // navigator.getUserMedia({video: true}, // stream => { // webcamElement.srcObject = stream; // webcamElement.addEventListener('loadeddata', () => resolve(), false); // webcamStream=stream; // }, // error => reject()); // } else { // reject(); // } // }); // } async function app() { console.log('Loading model ....'); // document.getElementById("result").innerHTML="Running"; // document.getElementById("pred_1").innerHTML ="Finding..."; // document.getElementById("conf_1").style.width=Math.floor(Math.random() * 100).toString()+'%'; // document.getElementById("pred_2").innerHTML ="Finding..."; // document.getElementById("conf_2").style.width=Math.floor(Math.random() * 100).toString()+'%'; // document.getElementById("pred_3").innerHTML ="Finding..."; // document.getElementById("conf_3").style.width=Math.floor(Math.random() * 100).toString()+'%'; // // Load the model. // net = await mobilenet.load(); // console.log('Sucessfully loaded model'); // // Make a prediction through the model on our image. // const imgEl = document.getElementById('cls_img'); // const result = await net.classify(imgEl); // // document.getElementById('header').style.width = // document.getElementById("pred_1").innerHTML =result[0].className; // document.getElementById("conf_1").style.width= Math.round(result[0].probability*100).toString()+'%'; // document.getElementById("pred_2").innerHTML =result[1].className; // document.getElementById("conf_2").style.width= Math.round(result[1].probability*100).toString()+'%'; var img_path =document.getElementById('image_for_detection').src; var service =document.getElementById('image_for_detection').alt; console.log(img_path) // $.ajax({ //create an ajax request to display.php // type: "POST", // url: "chest_service", // dataType: "html", //expect html to be returned // success: function(response){ // $("#prediction").html(response); // //alert(response); // } // }); $.post('service', // url { 'image_path': img_path,'service': service }, // data to be submit function(response) {// success callback $('#prediction').html(response); }) console.log('Done !!!!!!!!'); // document.getElementById("prediction").innerHTML ='dummy'; // console.log(Math.round(result[0].probability*100)) // console.log(result); // document.getElementById("result").innerHTML="Result"; } // async function app_webcam() { // console.log('Loading mobilenet..'); // // Load the model. // net = await mobilenet.load(); // console.log('Sucessfully loaded model'); // await setupWebcam(); // var track = webcamStream.getTracks()[0]; // while (webcam_runnig) { // const result = await net.classify(webcamElement); // console.log(result); // document.getElementById("pred_1").innerHTML =result[0].className; // document.getElementById("conf_1").style.width= Math.round(result[0].probability*100).toString()+'%'; // document.getElementById("pred_2").innerHTML =result[1].className; // document.getElementById("conf_2").style.width= Math.round(result[1].probability*100).toString()+'%'; // document.getElementById("pred_3").innerHTML =result[2].className; // document.getElementById("conf_3").style.width= Math.round(result[2].probability*100).toString()+'%'; // // Give some breathing room by waiting for the next animation frame to // // fire. // await tf.nextFrame(); // } // track.stop(); // } // $("#inputGroupFile04").change(function(){ // app(); // readPath(this); // }); // $("#option2").change(function(){ // $("#cls_img").addClass("d-none"); // $("#webcam").removeClass("d-none"); // webcam_runnig=true; // app_webcam(); // }); // $("#option1").change(function(){ // $("#cls_img").removeClass("d-none"); // $("#webcam").addClass("d-none"); // webcam_runnig=false; // app(); // }); app();
31.986928
105
0.609113
3b38ba1b5d23d3707d5304566af208e8f1816fc3
315
js
JavaScript
tests/parser.js
yorkie/lv
2fb5e264abffa34959ac601567ab608535a79a79
[ "MIT" ]
10
2015-01-01T16:02:11.000Z
2022-03-25T06:41:44.000Z
tests/parser.js
yorkie/lv
2fb5e264abffa34959ac601567ab608535a79a79
[ "MIT" ]
4
2015-03-07T16:20:13.000Z
2022-03-24T19:42:21.000Z
tests/parser.js
yorkie/lv
2fb5e264abffa34959ac601567ab608535a79a79
[ "MIT" ]
2
2015-09-04T07:45:08.000Z
2016-01-10T18:15:39.000Z
var fs = require('fs'); var path = require('path'); var Parser = require('../lib/parser'); var parser = new Parser('../examples/simple.js'); parser.on('error', function(err) { console.error(err); }) parser.on('done', function(program) { fs.writeFile(path.join(__dirname, './parser-test.asm'), program); });
21
67
0.650794
3b38ffbdeb96a07ebd646eed26e46b3f99906927
1,843
js
JavaScript
build/webpack/_development.js
ipanasenko/temp
870c64cd47f51b21c9870fba63a764f2a6e9671c
[ "MIT" ]
null
null
null
build/webpack/_development.js
ipanasenko/temp
870c64cd47f51b21c9870fba63a764f2a6e9671c
[ "MIT" ]
null
null
null
build/webpack/_development.js
ipanasenko/temp
870c64cd47f51b21c9870fba63a764f2a6e9671c
[ "MIT" ]
null
null
null
/* eslint key-spacing:0 */ import webpack from 'webpack'; import config from '../../config'; import _debug from 'debug'; const debug = _debug('app:webpack:development'); export default (webpackConfig) => { debug('Create configuration.'); debug('Override devtool with cheap-module-eval-source-map.'); webpackConfig.devtool = 'cheap-module-eval-source-map'; // ------------------------------------ // Enable HMR if Configured // ------------------------------------ if (config.compiler_enable_hmr) { debug('Enable Hot Module Replacement (HMR).'); webpackConfig.entry.app.push( 'webpack-hot-middleware/client?path=/__webpack_hmr' ); webpackConfig.plugins.push( new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin() ); webpackConfig.eslint.emitWarning = true; // We need to apply the react-transform HMR plugin to the Babel configuration, // but _only_ when HMR is enabled. Putting this in the default development // configuration will break other tasks such as test:unit because Webpack // HMR is not enabled there, and these transforms require it. webpackConfig.module.loaders = webpackConfig.module.loaders.map(loader => { if (/babel/.test(loader.loader)) { debug('Apply react-transform-hmr to babel development transforms'); if (loader.query.env.development.plugins[0][0] !== 'react-transform') { debug('ERROR: react-transform must be the first plugin'); return loader; } const reactTransformHmr = { transform: 'react-transform-hmr', imports: ['react'], locals: ['module'] }; loader.query.env.development.plugins[0][1].transforms .push(reactTransformHmr); } return loader; }); } return webpackConfig; };
31.237288
82
0.63592
3b39169438a1804b013efe55a3add60fe9203433
901
js
JavaScript
iam-test-token/test/iam-auth.test.js
sensrtrx/actions
a405095c9487fccf06b8a4d43487a76d1d35edeb
[ "MIT" ]
17
2020-08-19T11:32:53.000Z
2022-03-03T16:29:52.000Z
iam-test-token/test/iam-auth.test.js
sensrtrx/actions
a405095c9487fccf06b8a4d43487a76d1d35edeb
[ "MIT" ]
321
2019-11-28T07:06:47.000Z
2022-03-22T09:33:00.000Z
iam-test-token/test/iam-auth.test.js
sensrtrx/actions
a405095c9487fccf06b8a4d43487a76d1d35edeb
[ "MIT" ]
11
2019-12-19T07:19:14.000Z
2022-03-24T04:14:43.000Z
jest.mock('@actions/core'); jest.mock('axios'); const axios = require('axios'); const fetchIamToken = require('../src/iam-auth'); describe('fetch iam-api token', () => { afterEach(() => { jest.resetAllMocks(); }); test('it can fetch api token', async () => { axios.post.mockResolvedValueOnce({ data: { idToken: 'test-token' } }); const token = await fetchIamToken('key', 'email', 'password', 'tenantId'); expect(token).toEqual('test-token'); expect(axios.post).toHaveBeenCalledTimes(1); }); test('It throws exception on login failure', async () => { axios.post.mockRejectedValueOnce({ response: { status: 403, data: 'A message' } }); await expect(fetchIamToken('key', 'email', 'password', 'tenantId')) .rejects.toEqual(new Error('Authentication failed. HTTP status: 403. Reason: A message')); expect(axios.post).toHaveBeenCalledTimes(1); }); });
33.37037
96
0.649279
3b392a92a4816220a23bbc81fdc172c042764da1
1,834
js
JavaScript
specs/lib/getAccessorByteStrideSpec.js
PropellerAero/gltf-pipeline
0b00bd29e4db9200f99520e49ed094c99533cce2
[ "Apache-2.0" ]
null
null
null
specs/lib/getAccessorByteStrideSpec.js
PropellerAero/gltf-pipeline
0b00bd29e4db9200f99520e49ed094c99533cce2
[ "Apache-2.0" ]
1
2021-08-24T07:07:26.000Z
2021-08-24T07:07:26.000Z
specs/lib/getAccessorByteStrideSpec.js
PropellerAero/gltf-pipeline
0b00bd29e4db9200f99520e49ed094c99533cce2
[ "Apache-2.0" ]
null
null
null
"use strict"; const Cesium = require("@propelleraero/cesium"); const getAccessorByteStride = require("../../lib/getAccessorByteStride"); const WebGLConstants = Cesium.WebGLConstants; describe("getAccessorByteStride", () => { it("gets accessor byte stride", () => { const gltf = { accessors: [ { componentType: WebGLConstants.FLOAT, count: 24, type: "VEC3", min: [-1.0, -1.0, -1.0], max: [1.0, 1.0, 1.0], }, { bufferView: 0, componentType: WebGLConstants.FLOAT, count: 24, type: "VEC3", min: [-1.0, -1.0, -1.0], max: [1.0, 1.0, 1.0], }, { bufferView: 1, componentType: WebGLConstants.FLOAT, count: 24, type: "VEC3", min: [-1.0, -1.0, -1.0], max: [1.0, 1.0, 1.0], }, { componentType: WebGLConstants.FLOAT, count: 24, type: "VEC2", min: [0.0, 0.0], max: [1.0, 1.0], }, { componentType: WebGLConstants.INT, count: 36, type: "SCALAR", min: [0], max: [24], }, ], bufferViews: [ { buffer: 0, byteLength: 288, byteOffset: 0, }, { buffer: 0, byteLength: 288, byteOffset: 288, byteStride: 32, }, ], }; expect(getAccessorByteStride(gltf, gltf.accessors[0])).toBe(12); expect(getAccessorByteStride(gltf, gltf.accessors[1])).toBe(12); expect(getAccessorByteStride(gltf, gltf.accessors[2])).toBe(32); expect(getAccessorByteStride(gltf, gltf.accessors[3])).toBe(8); expect(getAccessorByteStride(gltf, gltf.accessors[4])).toBe(4); }); });
25.830986
73
0.483642
3b397058ad929ed77d5993b2ff272fdc3e077fb5
16,716
js
JavaScript
docs/assets/js/search.js
ao-framework/portals
82c100f9f595ba6e4b0d86460dae803b12548f30
[ "MIT" ]
null
null
null
docs/assets/js/search.js
ao-framework/portals
82c100f9f595ba6e4b0d86460dae803b12548f30
[ "MIT" ]
null
null
null
docs/assets/js/search.js
ao-framework/portals
82c100f9f595ba6e4b0d86460dae803b12548f30
[ "MIT" ]
null
null
null
var typedoc = typedoc || {}; typedoc.search = typedoc.search || {}; typedoc.search.data = {"kinds":{"1":"External module","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal"},"rows":[{"id":0,"kind":1,"name":"\"eventbus/eventbus.handler\"","url":"modules/_eventbus_eventbus_handler_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":128,"name":"EventBusHandler","url":"classes/_eventbus_eventbus_handler_.eventbushandler.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"eventbus/eventbus.handler\""},{"id":2,"kind":1024,"name":"count","url":"classes/_eventbus_eventbus_handler_.eventbushandler.html#count","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus.handler\".EventBusHandler"},{"id":3,"kind":1024,"name":"context","url":"classes/_eventbus_eventbus_handler_.eventbushandler.html#context","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus.handler\".EventBusHandler"},{"id":4,"kind":1024,"name":"listener","url":"classes/_eventbus_eventbus_handler_.eventbushandler.html#listener","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus.handler\".EventBusHandler"},{"id":5,"kind":65536,"name":"__type","url":"classes/_eventbus_eventbus_handler_.eventbushandler.html#listener.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"\"eventbus/eventbus.handler\".EventBusHandler.listener"},{"id":6,"kind":1,"name":"\"eventbus/eventbus.channel\"","url":"modules/_eventbus_eventbus_channel_.html","classes":"tsd-kind-external-module"},{"id":7,"kind":128,"name":"EventBusChannel","url":"classes/_eventbus_eventbus_channel_.eventbuschannel.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"eventbus/eventbus.channel\""},{"id":8,"kind":1024,"name":"handlers","url":"classes/_eventbus_eventbus_channel_.eventbuschannel.html#handlers","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus.channel\".EventBusChannel"},{"id":9,"kind":512,"name":"constructor","url":"classes/_eventbus_eventbus_channel_.eventbuschannel.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"eventbus/eventbus.channel\".EventBusChannel"},{"id":10,"kind":1024,"name":"channel","url":"classes/_eventbus_eventbus_channel_.eventbuschannel.html#channel","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus.channel\".EventBusChannel"},{"id":11,"kind":2048,"name":"getHandlersIfAllowed","url":"classes/_eventbus_eventbus_channel_.eventbuschannel.html#gethandlersifallowed","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus.channel\".EventBusChannel"},{"id":12,"kind":1,"name":"\"interfaces/eventbus.interfaces\"","url":"modules/_interfaces_eventbus_interfaces_.html","classes":"tsd-kind-external-module"},{"id":13,"kind":256,"name":"EventBusTable","url":"interfaces/_interfaces_eventbus_interfaces_.eventbustable.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"interfaces/eventbus.interfaces\""},{"id":14,"kind":256,"name":"EventBusChannelTable","url":"interfaces/_interfaces_eventbus_interfaces_.eventbuschanneltable.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"interfaces/eventbus.interfaces\""},{"id":15,"kind":1,"name":"\"eventbus/eventbus\"","url":"modules/_eventbus_eventbus_.html","classes":"tsd-kind-external-module"},{"id":16,"kind":128,"name":"EventBus","url":"classes/_eventbus_eventbus_.eventbus.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"eventbus/eventbus\""},{"id":17,"kind":1024,"name":"maxListeners","url":"classes/_eventbus_eventbus_.eventbus.html#maxlisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"eventbus/eventbus\".EventBus"},{"id":18,"kind":1024,"name":"channels","url":"classes/_eventbus_eventbus_.eventbus.html#channels","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"eventbus/eventbus\".EventBus"},{"id":19,"kind":512,"name":"constructor","url":"classes/_eventbus_eventbus_.eventbus.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":20,"kind":1024,"name":"name","url":"classes/_eventbus_eventbus_.eventbus.html#name","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":21,"kind":2048,"name":"allocate","url":"classes/_eventbus_eventbus_.eventbus.html#allocate","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-private","parent":"\"eventbus/eventbus\".EventBus"},{"id":22,"kind":2048,"name":"addListener","url":"classes/_eventbus_eventbus_.eventbus.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":23,"kind":2048,"name":"on","url":"classes/_eventbus_eventbus_.eventbus.html#on","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":24,"kind":2048,"name":"once","url":"classes/_eventbus_eventbus_.eventbus.html#once","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":25,"kind":2048,"name":"prependListener","url":"classes/_eventbus_eventbus_.eventbus.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":26,"kind":2048,"name":"prependOnceListener","url":"classes/_eventbus_eventbus_.eventbus.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":27,"kind":2048,"name":"removeListener","url":"classes/_eventbus_eventbus_.eventbus.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":28,"kind":2048,"name":"off","url":"classes/_eventbus_eventbus_.eventbus.html#off","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":29,"kind":2048,"name":"removeAllListeners","url":"classes/_eventbus_eventbus_.eventbus.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":30,"kind":2048,"name":"setMaxListeners","url":"classes/_eventbus_eventbus_.eventbus.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":31,"kind":2048,"name":"getMaxListeners","url":"classes/_eventbus_eventbus_.eventbus.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":32,"kind":2048,"name":"listeners","url":"classes/_eventbus_eventbus_.eventbus.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":33,"kind":2048,"name":"handlers","url":"classes/_eventbus_eventbus_.eventbus.html#handlers","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":34,"kind":2048,"name":"emit","url":"classes/_eventbus_eventbus_.eventbus.html#emit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":35,"kind":2048,"name":"channelNames","url":"classes/_eventbus_eventbus_.eventbus.html#channelnames","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":36,"kind":2048,"name":"listenerCount","url":"classes/_eventbus_eventbus_.eventbus.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"eventbus/eventbus\".EventBus"},{"id":37,"kind":1,"name":"\"service/service.channel.tap\"","url":"modules/_service_service_channel_tap_.html","classes":"tsd-kind-external-module"},{"id":38,"kind":128,"name":"ServiceChannelTap","url":"classes/_service_service_channel_tap_.servicechanneltap.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"service/service.channel.tap\""},{"id":39,"kind":1024,"name":"context","url":"classes/_service_service_channel_tap_.servicechanneltap.html#context","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel.tap\".ServiceChannelTap"},{"id":40,"kind":1024,"name":"handler","url":"classes/_service_service_channel_tap_.servicechanneltap.html#handler","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel.tap\".ServiceChannelTap"},{"id":41,"kind":65536,"name":"__type","url":"classes/_service_service_channel_tap_.servicechanneltap.html#handler.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"\"service/service.channel.tap\".ServiceChannelTap.handler"},{"id":42,"kind":512,"name":"constructor","url":"classes/_service_service_channel_tap_.servicechanneltap.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"service/service.channel.tap\".ServiceChannelTap"},{"id":43,"kind":1024,"name":"channel","url":"classes/_service_service_channel_tap_.servicechanneltap.html#channel","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel.tap\".ServiceChannelTap"},{"id":44,"kind":1,"name":"\"service/service.channel\"","url":"modules/_service_service_channel_.html","classes":"tsd-kind-external-module"},{"id":45,"kind":128,"name":"ServiceChannel","url":"classes/_service_service_channel_.servicechannel.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"service/service.channel\""},{"id":46,"kind":1024,"name":"context","url":"classes/_service_service_channel_.servicechannel.html#context","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":47,"kind":1024,"name":"locked","url":"classes/_service_service_channel_.servicechannel.html#locked","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":48,"kind":1024,"name":"secure","url":"classes/_service_service_channel_.servicechannel.html#secure","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":49,"kind":1024,"name":"taps","url":"classes/_service_service_channel_.servicechannel.html#taps","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":50,"kind":512,"name":"constructor","url":"classes/_service_service_channel_.servicechannel.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":51,"kind":1024,"name":"channel","url":"classes/_service_service_channel_.servicechannel.html#channel","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":52,"kind":1024,"name":"service","url":"classes/_service_service_channel_.servicechannel.html#service","classes":"tsd-kind-property tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":53,"kind":2048,"name":"handler","url":"classes/_service_service_channel_.servicechannel.html#handler","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service.channel\".ServiceChannel"},{"id":54,"kind":1,"name":"\"service/service\"","url":"modules/_service_service_.html","classes":"tsd-kind-external-module"},{"id":55,"kind":128,"name":"Service","url":"classes/_service_service_.service.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"service/service\""},{"id":56,"kind":1024,"name":"$channels","url":"classes/_service_service_.service.html#_channels","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"service/service\".Service"},{"id":57,"kind":512,"name":"constructor","url":"classes/_service_service_.service.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":58,"kind":1024,"name":"serviceName","url":"classes/_service_service_.service.html#servicename","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"service/service\".Service"},{"id":59,"kind":2048,"name":"allocate","url":"classes/_service_service_.service.html#allocate","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-private","parent":"\"service/service\".Service"},{"id":60,"kind":2048,"name":"name","url":"classes/_service_service_.service.html#name","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":61,"kind":2048,"name":"channels","url":"classes/_service_service_.service.html#channels","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":62,"kind":2048,"name":"taps","url":"classes/_service_service_.service.html#taps","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":63,"kind":2048,"name":"removeTap","url":"classes/_service_service_.service.html#removetap","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":64,"kind":2048,"name":"removeAllTaps","url":"classes/_service_service_.service.html#removealltaps","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":65,"kind":2048,"name":"request","url":"classes/_service_service_.service.html#request","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"service/service\".Service"},{"id":66,"kind":2048,"name":"remove","url":"classes/_service_service_.service.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":67,"kind":2048,"name":"route","url":"classes/_service_service_.service.html#route","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":68,"kind":2048,"name":"routeLock","url":"classes/_service_service_.service.html#routelock","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":69,"kind":2048,"name":"routeLockSec","url":"classes/_service_service_.service.html#routelocksec","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":70,"kind":2048,"name":"routeTap","url":"classes/_service_service_.service.html#routetap","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"service/service\".Service"},{"id":71,"kind":2048,"name":"throwLocked","url":"classes/_service_service_.service.html#throwlocked","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-private","parent":"\"service/service\".Service"},{"id":72,"kind":1,"name":"\"interfaces/service.interfaces\"","url":"modules/_interfaces_service_interfaces_.html","classes":"tsd-kind-external-module"},{"id":73,"kind":256,"name":"ServiceChannelTable","url":"interfaces/_interfaces_service_interfaces_.servicechanneltable.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"interfaces/service.interfaces\""},{"id":74,"kind":256,"name":"ServiceTable","url":"interfaces/_interfaces_service_interfaces_.servicetable.html","classes":"tsd-kind-interface tsd-parent-kind-external-module","parent":"\"interfaces/service.interfaces\""},{"id":75,"kind":1,"name":"\"portals\"","url":"modules/_portals_.html","classes":"tsd-kind-external-module"},{"id":76,"kind":128,"name":"Portals","url":"classes/_portals_.portals.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"portals\""},{"id":77,"kind":1024,"name":"buses","url":"classes/_portals_.portals.html#buses","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"portals\".Portals"},{"id":78,"kind":1024,"name":"services","url":"classes/_portals_.portals.html#services","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"portals\".Portals"},{"id":79,"kind":2048,"name":"bus","url":"classes/_portals_.portals.html#bus","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"portals\".Portals"},{"id":80,"kind":2048,"name":"service","url":"classes/_portals_.portals.html#service","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"portals\".Portals"},{"id":81,"kind":2048,"name":"destroyBus","url":"classes/_portals_.portals.html#destroybus","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"portals\".Portals"},{"id":82,"kind":2048,"name":"destroyService","url":"classes/_portals_.portals.html#destroyservice","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"portals\".Portals"},{"id":83,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-external-module"}]};
5,572
16,636
0.745274
3b398bd38d06f4222d8d3f50e93d970127d78aa8
79
js
JavaScript
src/js/maintenance/components/BikeLookupView/index.js
rit-bikeshare/mobile-app
8b21c0c745d3bdf67b61fb53700ca71fb19e261e
[ "MIT" ]
3
2017-10-26T22:24:21.000Z
2020-02-15T07:30:26.000Z
src/js/maintenance/components/BikeLookupView/index.js
rit-bikeshare/mobile-app
8b21c0c745d3bdf67b61fb53700ca71fb19e261e
[ "MIT" ]
5
2017-11-24T06:02:35.000Z
2022-02-12T13:10:26.000Z
src/js/maintenance/components/BikeLookupView/index.js
rit-bikeshare/mobile-app
8b21c0c745d3bdf67b61fb53700ca71fb19e261e
[ "MIT" ]
1
2019-06-10T13:45:26.000Z
2019-06-10T13:45:26.000Z
import BikeLookupView from './BikeLookupView'; export default BikeLookupView;
19.75
46
0.822785
3b3b6d5cece32ea5dc9f73cbfe97cdd624d7d56d
515
js
JavaScript
typeDefs/therapeutic.js
BloomTech-Labs/bio-bid-be
20031d517617e597a4436f21e3fb5cadf5b2a006
[ "MIT" ]
null
null
null
typeDefs/therapeutic.js
BloomTech-Labs/bio-bid-be
20031d517617e597a4436f21e3fb5cadf5b2a006
[ "MIT" ]
9
2020-03-26T17:43:30.000Z
2021-09-21T08:35:29.000Z
typeDefs/therapeutic.js
sametweb/bio-bid-be
d7fa185187e92c853dd6dcc75484d78b827bf22e
[ "MIT" ]
4
2020-06-12T17:16:53.000Z
2020-08-31T19:07:14.000Z
const { gql } = require("apollo-server"); module.exports = gql` extend type Query { therapeutics: [Therapeutic!] therapeutic(name: String!): Therapeutic! searchTherapeutics(search: String!): [Therapeutic]! } extend type Mutation { createTherapeutic(name: String!): Therapeutic! updateTherapeutic(name: String!, updated_name: String!): Therapeutic! deleteTherapeutic(name: String!): Therapeutic! } type Therapeutic { id: ID name: String! companies: [Company]! } `;
23.409091
73
0.67767
3b3b76e9ded3042e5b1e1c0b5561d2538ab3a5b8
1,444
js
JavaScript
src/sorted-array/sorted-array.js
slugbyte/data-structures
f3b312e83c8d03f6dfdb7f1d63c732a6870104f8
[ "MIT" ]
null
null
null
src/sorted-array/sorted-array.js
slugbyte/data-structures
f3b312e83c8d03f6dfdb7f1d63c732a6870104f8
[ "MIT" ]
6
2018-12-10T15:54:48.000Z
2021-05-07T23:09:07.000Z
src/sorted-array/sorted-array.js
slugbyte/data-structures
f3b312e83c8d03f6dfdb7f1d63c732a6870104f8
[ "MIT" ]
2
2018-12-10T16:40:50.000Z
2018-12-17T11:16:58.000Z
class SortedArray { constructor(data=[]){ if(!(data instanceof Array)) throw new Error('inital data must be an Array instance') this.data = data if(this.data.length > 0) this._quicksort() return new Proxy(this, { set: () => { return false }, get: (target, prop) => { let num = Number(prop) if(!isNaN(num)) return target.data[num] return target[prop]; } }) } _swap(i, j){ let temp = this.data[i] this.data[i] = this.data[j] this.data[j] = temp } _quicksort(){ let _partition = (data, lo, hi) => { let pivot = data[hi] let i = lo for (let j=lo; j<hi; j++) if(data[j] < pivot) this._swap(i++, j) this._swap(i, hi) return i } let _sort = (data, lo, hi) => { if(lo<hi){ let p = _partition(data, lo, hi) _sort(data, lo, p - 1) _sort(data, p + 1, hi) } } _sort(this.data, 0, this.data.length - 1) return this } insert(value){ this.data.push(value) return this._quicksort() } concat(data){ if(data instanceof Array){ return new SortedArray(this.data.concat(data)) } else if (data instanceof SortedArray) { return new SortedArray(this.data.concat(data.data)) } else { throw new Error('concat only supports SortedArray and Array') } } } module.exports = SortedArray
21.552239
67
0.541551
3b3ce7cba5ce45b6781e9e116b057ed726237a94
6,608
js
JavaScript
components/jobSearchBasics/ApplyForJob.js
dhcole/career-network
56a8212ce67da0b914d2bde8b15ec2d45ea65d14
[ "MIT" ]
1
2021-01-17T13:55:18.000Z
2021-01-17T13:55:18.000Z
components/jobSearchBasics/ApplyForJob.js
dhcole/career-network
56a8212ce67da0b914d2bde8b15ec2d45ea65d14
[ "MIT" ]
36
2019-12-05T15:55:42.000Z
2021-12-09T01:01:55.000Z
components/jobSearchBasics/ApplyForJob.js
dhcole/career-network
56a8212ce67da0b914d2bde8b15ec2d45ea65d14
[ "MIT" ]
2
2020-06-16T14:38:40.000Z
2020-09-12T05:20:18.000Z
import { makeStyles } from '@material-ui/styles'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { Flags } from 'react-feature-flags'; import PropTypes from 'prop-types'; import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; import Grid from '@material-ui/core/Grid'; import NextLink from 'next/link'; import React from 'react'; import Typography from '@material-ui/core/Typography'; import ClassIcon from '@material-ui/icons/Class'; import FileCopyIcon from '@material-ui/icons/FileCopy'; import PhoneInTalkIcon from '@material-ui/icons/PhoneInTalk'; import RadioButtonCheckedIcon from '@material-ui/icons/RadioButtonChecked'; import ScaffoldContainer from '../ScaffoldContainer'; import SectionHeader from './SectionHeader'; import { JOB_SEARCH_BASICS_TYPES } from '../constants'; const useStyles = makeStyles(theme => ({ root: { paddingTop: theme.spacing(16), paddingBottom: theme.spacing(16), backgroundColor: fade(JOB_SEARCH_BASICS_TYPES.apply.color, 0.04), }, title: { color: JOB_SEARCH_BASICS_TYPES.apply.color, fontWeight: 600, fontSize: '2.5rem', lineHeight: '3.5rem', textAlign: 'right', }, itemContainer: { display: 'flex', marginTop: theme.spacing(4), }, iconContainer: { borderRadius: '50%', padding: theme.spacing(1.7), width: '56px', height: '56px', background: 'white', boxShadow: '0 8px 12px 0 rgba(0, 0, 0, 0.04)', color: JOB_SEARCH_BASICS_TYPES.apply.color, }, topicIcon: { color: JOB_SEARCH_BASICS_TYPES.apply.color, fontSize: '18px', }, link: { fontWeight: 700, color: theme.palette.text.secondary, }, })); const TOPIC_TYPES = [ { value: 'write-resume', label: 'How to write a resume that’s more likely to get through an automated screening process', }, { value: 'tailor-application', label: 'How to tailor your application to each job posting', }, { value: 'interview', label: 'What to ask during an interview (because they’re not just interviewing you — you’re interviewing them, too)', }, { value: 'recruiter', label: 'The things recruiters look for', }, ]; const MILESTONE_TYPES = [ { value: 'resume', label: 'Resume', milestoneLink: `/milestones/resume`, description: 'This is a summary of your work history. It may include information about your awards, interests, and volunteer activities. ', icon: FileCopyIcon, }, { value: 'supporting-information', label: 'Supporting Information', milestoneLink: `/milestones/supporting-information`, description: 'Many job postings require applicants to provide more than just your work history. Supporting information could include a cover letter, list of references, or even a portfolio, depending on the role', icon: ClassIcon, }, { value: 'interviewing-skills', label: 'Interviewing Skills', milestoneLink: `/milestones/interviewing-skills`, description: 'Interviews can be intimidating, especially if you haven’t had many or are out of practice. We’ll help you prep for everything from a phone screen to a video interview. ', icon: PhoneInTalkIcon, }, ]; export default function ApplyForJob({ scrollToRef }) { const classes = useStyles(); return ( <div className={classes.root} ref={scrollToRef}> <ScaffoldContainer> <Grid container justify="center"> <Grid item container xs={12} sm={4}> <Typography className={classes.title} variant="h2"> Applying for <br /> Jobs </Typography> </Grid> <Grid item container xs={12} sm={6}> <Box mb={2}> <Typography variant="h5"> Stand out in the job market by telling your story effectively. </Typography> </Box> <Typography variant="body1"> The exact steps you take to apply for a job will be different depending on the type of job you’re applying for. But there are some tips and tricks that will help in just about evey case. <br /> <br /> We have a range of activities to help you land a job that meets your needs, and we’ll cover topics like: </Typography> {TOPIC_TYPES.map(topic => ( <Box key={topic.value} className={classes.itemContainer}> <RadioButtonCheckedIcon className={classes.topicIcon} /> <Box ml={2}> <Typography variant="body1">{topic.label}</Typography> </Box> </Box> ))} <Box mt={10}> <SectionHeader gutterBottom>Milestones to Measure Progress</SectionHeader> <Typography variant="body1"> One thing we’ve heard from job seekers is that it’s hard to feel like you’re making progress from one day to the next. That’s why we’ve included milestones to help you actually see your progress as you complete activities. <br /> <br /> If some of these milestones aren’t relevant for you, no problem. You choose where to start and what to skip. </Typography> {MILESTONE_TYPES.map(milestone => ( <Box key={milestone.value} className={classes.itemContainer}> <milestone.icon className={classes.iconContainer} /> <Box ml={3}> <Typography variant="h5" gutterBottom> {milestone.label} </Typography> <Typography variant="body1" gutterBottom> {milestone.description} </Typography> <Flags authorizedFlags={['milestonePages']}> {milestone.milestoneLink && ( <NextLink href="/milestones/[milestone]" as={milestone.milestoneLink}> <Button className={classes.link}>Learn more</Button> </NextLink> )} </Flags> </Box> </Box> ))} </Box> </Grid> </Grid> </ScaffoldContainer> </div> ); } ApplyForJob.propTypes = { scrollToRef: PropTypes.shape({ current: PropTypes.objectOf(PropTypes.object), }), }; ApplyForJob.defaultProps = { scrollToRef: null, };
34.962963
206
0.601544
3b3d092c2f661bd848e75f5a24489e3b808e6991
570
js
JavaScript
src/components/List/index.js
Travis-Witts/User-Directory
83484a09e81a5b9a5a2fa0a3b1bbeff7ece19512
[ "MIT" ]
1
2021-05-08T18:28:49.000Z
2021-05-08T18:28:49.000Z
src/components/List/index.js
Travis-Witts/User-Directory
83484a09e81a5b9a5a2fa0a3b1bbeff7ece19512
[ "MIT" ]
null
null
null
src/components/List/index.js
Travis-Witts/User-Directory
83484a09e81a5b9a5a2fa0a3b1bbeff7ece19512
[ "MIT" ]
null
null
null
import React from "react"; import ListElement from "../ListElement"; function List({ employees }) { return ( <table className="table table-secondary sortable" id="sortTable" style={{ width: "100%" }}> <thead> <tr className="text-light bg-dark"> <th style={{"cursor" : "pointer"}}>First Name</th> <th style={{"cursor" : "pointer"}}>Last Name</th> <th style={{"cursor" : "pointer"}}>Email</th> </tr> </thead> <ListElement employees={employees}></ListElement> </table> ); } export default List;
28.5
95
0.582456
3b3d1801db574b81d75407b0fd8cc7b658c529b3
1,040
js
JavaScript
frontend/app/forms/petition-for-dismissal-or-acquittal/petition-for-dismissal-or-acquittal.web.component.js
samuelmoutah/utahexpungements.org
01bc85285bd8f6dbb2cbe559b5c51629c08fcc03
[ "MIT" ]
null
null
null
frontend/app/forms/petition-for-dismissal-or-acquittal/petition-for-dismissal-or-acquittal.web.component.js
samuelmoutah/utahexpungements.org
01bc85285bd8f6dbb2cbe559b5c51629c08fcc03
[ "MIT" ]
null
null
null
frontend/app/forms/petition-for-dismissal-or-acquittal/petition-for-dismissal-or-acquittal.web.component.js
samuelmoutah/utahexpungements.org
01bc85285bd8f6dbb2cbe559b5c51629c08fcc03
[ "MIT" ]
null
null
null
import React from "react"; import FormThatPrints from "../inputs/form-that-prints.component"; import TextInput from "../inputs/text-input.component"; import Section from "../inputs/section.component.js"; export default function PetitionForDismissalOrAcquittal_Web(props) { return ( <FormThatPrints> <Section name="1. Personal Information"> <TextInput dataKey="person.firstName" label="First Name" /> <TextInput dataKey="person.middleName" label={__("middle name")} /> <TextInput dataKey="person.lastName" label="Last Name" /> <TextInput dataKey="person.addressStreet" label={__("street")} /> <TextInput dataKey="person.addressCity" label={__("city")} /> <TextInput dataKey="person.addressState" label={__("state")} /> <TextInput dataKey="person.addressZip" label={__("zip")} /> <TextInput dataKey="person.homePhone" label={__("home phone")} /> <TextInput dataKey="person.email" label={__("email address")} /> </Section> </FormThatPrints> ); }
45.217391
75
0.673077
3b3d349e62faaab5384ff5b1574cf3c492ac8c33
543
js
JavaScript
tasks/lib/print-commit.js
glebcha/git-changelog
069c8d3e5440cb45d11b8dd2bdd229058705d3b1
[ "MIT" ]
1
2021-07-01T17:48:45.000Z
2021-07-01T17:48:45.000Z
tasks/lib/print-commit.js
XadillaX/git-changelog
49a00ad3e8892f5f07775f5d54f84338e0c98759
[ "MIT" ]
null
null
null
tasks/lib/print-commit.js
XadillaX/git-changelog
49a00ad3e8892f5f07775f5d54f84338e0c98759
[ "MIT" ]
2
2020-06-26T23:53:22.000Z
2020-07-19T01:36:41.000Z
var debug = require('debug')('changelog:printSection'); var format = require('util').format; function printCommit(commit, printCommitLinks) { var prefix = ''; var result = ''; if (printCommitLinks) { result += format('%s\n (%s', commit.subject, this.linkToCommit(commit.hash)); if (commit.closes.length) { result += ',\n ' + commit.closes.map(this.linkToIssue, this).join(', '); } result += ')\n'; } else { result += format('%s\n', commit.subject); } return result; } module.exports = printCommit;
23.608696
82
0.620626
3b3d4006be88d0c823f570f812f39187aea49ba6
103
js
JavaScript
resources/js/binance_api.js
jerrycan11/binance-trade
51e9f7a97c33c764b20f47aa3331318c13a5df54
[ "MIT" ]
null
null
null
resources/js/binance_api.js
jerrycan11/binance-trade
51e9f7a97c33c764b20f47aa3331318c13a5df54
[ "MIT" ]
null
null
null
resources/js/binance_api.js
jerrycan11/binance-trade
51e9f7a97c33c764b20f47aa3331318c13a5df54
[ "MIT" ]
1
2021-11-12T22:02:45.000Z
2021-11-12T22:02:45.000Z
import Binance from 'binance-api-node'; const binance_api = new Binance(); export default binance_api;
25.75
39
0.786408
3b3d73f6e72f81b76101fb42f412b8b14da18c53
32,487
js
JavaScript
handbook/build/assets/js/14cdac51.520283e0.js
argtek/Furion
3f5515bb2e0e658e11913311d749c2863f72448e
[ "Apache-2.0" ]
1
2021-06-24T00:41:42.000Z
2021-06-24T00:41:42.000Z
handbook/build/assets/js/14cdac51.520283e0.js
lxhcnblogscom/Furion
bf9a9bb55e6dd38e75abb217a2c2e2f5ff2ea017
[ "Apache-2.0" ]
5
2022-02-15T00:51:16.000Z
2022-03-02T12:43:10.000Z
handbook/build/assets/js/14cdac51.520283e0.js
lxhcnblogscom/Furion
bf9a9bb55e6dd38e75abb217a2c2e2f5ff2ea017
[ "Apache-2.0" ]
null
null
null
(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[4474],{3905:function(t,e,n){"use strict";n.d(e,{Zo:function(){return m},kt:function(){return u}});var a=n(7294);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function r(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){o(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function l(t,e){if(null==t)return{};var n,a,o=function(t,e){if(null==t)return{};var n,a,o={},i=Object.keys(t);for(a=0;a<i.length;a++)n=i[a],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var s=a.createContext({}),c=function(t){var e=a.useContext(s),n=e;return t&&(n="function"==typeof t?t(e):r(r({},e),t)),n},m=function(t){var e=c(t.components);return a.createElement(s.Provider,{value:e},t.children)},p={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},d=a.forwardRef((function(t,e){var n=t.components,o=t.mdxType,i=t.originalType,s=t.parentName,m=l(t,["components","mdxType","originalType","parentName"]),d=c(n),u=o,C=d["".concat(s,".").concat(u)]||d[u]||p[u]||i;return n?a.createElement(C,r(r({ref:e},m),{},{components:n})):a.createElement(C,r({ref:e},m))}));function u(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var i=n.length,r=new Array(i);r[0]=d;var l={};for(var s in e)hasOwnProperty.call(e,s)&&(l[s]=e[s]);l.originalType=t,l.mdxType="string"==typeof t?t:o,r[1]=l;for(var c=2;c<i;c++)r[c]=n[c];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},7852:function(t,e,n){"use strict";n.r(e),n.d(e,{frontMatter:function(){return r},contentTitle:function(){return l},metadata:function(){return s},toc:function(){return c},default:function(){return p}});var a=n(4034),o=n(9973),i=(n(7294),n(3905)),r={id:"entity",title:"9.3 \u6570\u636e\u5e93\u5b9e\u4f53",sidebar_label:"9.3 \u6570\u636e\u5e93\u5b9e\u4f53"},l=void 0,s={unversionedId:"entity",id:"entity",isDocsHomePage:!1,title:"9.3 \u6570\u636e\u5e93\u5b9e\u4f53",description:"\u4e00\u65e6\u5b9a\u4e49\u4e86\u5b9e\u4f53\u6216\u6539\u53d8\u4e86\u5b9e\u4f53\u7ed3\u6784\u6216\u5b9e\u4f53\u914d\u7f6e\uff0c\u9700\u8981\u91cd\u65b0\u6267\u884c Add-Migration \u548c Update-Database \u547d\u4ee4\u3002",source:"@site/docs/entity.mdx",sourceDirName:".",slug:"/entity",permalink:"/furion/docs/entity",editUrl:"https://gitee.com/dotnetchina/Furion/tree/master/handbook/docs/entity.mdx",version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1623560748,formattedLastUpdatedAt:"6/13/2021",frontMatter:{id:"entity",title:"9.3 \u6570\u636e\u5e93\u5b9e\u4f53",sidebar_label:"9.3 \u6570\u636e\u5e93\u5b9e\u4f53"},sidebar:"docs",previous:{title:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668",permalink:"/furion/docs/dbcontext-locator"},next:{title:"9.4 \u4ed3\u50a8\u6a21\u5f0f (Repository)",permalink:"/furion/docs/dbcontext-repository"}},c=[{value:"9.3.1 \u6570\u636e\u5e93\u5b9e\u4f53",id:"931-\u6570\u636e\u5e93\u5b9e\u4f53",children:[]},{value:"9.3.2 \u5982\u4f55\u5b9a\u4e49\u5b9e\u4f53",id:"932-\u5982\u4f55\u5b9a\u4e49\u5b9e\u4f53",children:[{value:"9.3.2.1 \u5b9e\u4f53\u7ee7\u627f\u9009\u7528\u539f\u5219",id:"9321-\u5b9e\u4f53\u7ee7\u627f\u9009\u7528\u539f\u5219",children:[]},{value:"9.3.2.2 <code>IEntity</code> \u793a\u8303\uff1a",id:"9322-ientity-\u793a\u8303\uff1a",children:[]},{value:"9.3.2.3 <code>EntityBase</code> \u793a\u8303\uff1a",id:"9323-entitybase-\u793a\u8303\uff1a",children:[]},{value:"9.3.2.4 <code>Entity</code> \u793a\u8303\uff1a",id:"9324-entity-\u793a\u8303\uff1a",children:[]},{value:"9.3.2.5 <code>EntityNotKey</code> \u793a\u8303\uff1a",id:"9325-entitynotkey-\u793a\u8303\uff1a",children:[]}]},{value:"9.3.3 \u81ea\u5b9a\u4e49\u516c\u5171\u5b9e\u4f53",id:"933-\u81ea\u5b9a\u4e49\u516c\u5171\u5b9e\u4f53",children:[]},{value:"9.3.4 \u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e",id:"934-\u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e",children:[{value:"9.3.4.1 \u5728\u6570\u636e\u5e93\u5b9e\u4f53\u4e2d\u914d\u7f6e",id:"9341-\u5728\u6570\u636e\u5e93\u5b9e\u4f53\u4e2d\u914d\u7f6e",children:[]},{value:"9.3.4.2 \u5728\u4efb\u4f55\u5b9e\u4f8b\u7c7b\u4e2d\u914d\u7f6e",id:"9342-\u5728\u4efb\u4f55\u5b9e\u4f8b\u7c7b\u4e2d\u914d\u7f6e",children:[]}]},{value:"9.3.5 \u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e\u8bf4\u660e",id:"935-\u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e\u8bf4\u660e",children:[]},{value:"9.3.6 \u914d\u7f6e\u5217\u540d\u53ca\u5217\u7c7b\u578b",id:"936-\u914d\u7f6e\u5217\u540d\u53ca\u5217\u7c7b\u578b",children:[]},{value:"9.3.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"937-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],m={toc:c};function p(t){var e=t.components,n=(0,o.Z)(t,["components"]);return(0,i.kt)("wrapper",(0,a.Z)({},m,n,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u7279\u522b\u63d0\u9192")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"\u4e00\u65e6\u5b9a\u4e49\u4e86\u5b9e\u4f53\u6216\u6539\u53d8\u4e86\u5b9e\u4f53\u7ed3\u6784\u6216\u5b9e\u4f53\u914d\u7f6e\uff0c\u9700\u8981\u91cd\u65b0\u6267\u884c ",(0,i.kt)("inlineCode",{parentName:"p"},"Add-Migration")," \u548c ",(0,i.kt)("inlineCode",{parentName:"p"},"Update-Database")," \u547d\u4ee4\u3002"))),(0,i.kt)("h2",{id:"931-\u6570\u636e\u5e93\u5b9e\u4f53"},"9.3.1 \u6570\u636e\u5e93\u5b9e\u4f53"),(0,i.kt)("p",null,"\u5728\u9762\u5411\u5bf9\u8c61\u5f00\u53d1\u601d\u60f3\u4e2d\uff0c\u6700\u91cd\u8981\u5c24\u4e3a",(0,i.kt)("strong",{parentName:"p"},"\u5bf9\u8c61"),"\u4e8c\u5b57\uff0c\u5728 .NET \u5f00\u53d1\u8fc7\u53bb\uff0c\u64cd\u4f5c\u6570\u636e\u5e93\u5f80\u5f80\u91c7\u7528 ",(0,i.kt)("inlineCode",{parentName:"p"},"DataTable")," \u548c ",(0,i.kt)("inlineCode",{parentName:"p"},"DataSet")," \u6765\u63a5\u6536\u6570\u636e\u5e93\u8fd4\u56de\u7ed3\u679c\u96c6\uff0c\u800c\u64cd\u4f5c\u6570\u636e\u5e93\u4e5f\u79bb\u4e0d\u5f00\u624b\u5199 ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u8bed\u53e5\u3002"),(0,i.kt)("p",null,"\u5728\u8fc7\u53bb\u9762\u5411\u8fc7\u7a0b\u548c\u5e94\u7528\u4e0d\u53d1\u8fbe\u7684\u65f6\u4ee3\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u786e\u5b9e\u597d\u4f7f\u3002\u7136\u540e\u968f\u7740\u4e2d\u56fd\u4e92\u8054\u7f51\u7f51\u6c11\u7684\u6fc0\u589e\uff0c\u7535\u5b50\u5316\u65f6\u4ee3\u7684\u5230\u6765\uff0c\u5404\u884c\u5404\u4e1a\u5bf9\u5e94\u7528\u9700\u6c42\u4e5f\u8fbe\u5230\u4e86\u524d\u6240\u672a\u6709\u7684\u91cf\u7ea7\u3002"),(0,i.kt)("p",null,"\u6240\u4ee5\uff0c\u5728\u8fc7\u53bb\u624b\u5199 ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u7684\u65f6\u4ee3\u5404\u79cd\u95ee\u9898\u663e\u9732\u65e0\u7591\uff1a"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"\u7a0b\u5e8f\u5458\u80fd\u529b\u53c2\u5dee\u4e0d\u9f50\uff0c\u5199\u51fa\u7684 ",(0,i.kt)("inlineCode",{parentName:"li"},"sql")," \u6027\u80fd\u81ea\u7136\u4e5f\u5929\u5dee\u5730\u522b"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"sql")," \u5c5e\u4e8e\u5b57\u7b26\u4e32\u786c\u7f16\u7a0b\uff0c\u540e\u671f\u7ef4\u62a4\u96be\u4e0a\u52a0\u96be"),(0,i.kt)("li",{parentName:"ul"},"\u8bb8\u591a\u5355\u8868\u751a\u81f3\u591a\u8868\u7ed3\u6784\u4e00\u81f4\uff0c\u51fa\u73b0\u5927\u91cf\u91cd\u590d ",(0,i.kt)("inlineCode",{parentName:"li"},"sql")," \u4ee3\u7801"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"sql")," \u672c\u8eab\u5728\u4e0d\u540c\u7684\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u4e2d\u5199\u6cd5\u6709\u5dee\uff0c\u540e\u7eed\u8fc1\u79fb\u5934\u75db\u4e0d\u5df2")),(0,i.kt)("p",null,"\u5f53\u7136\uff0c",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u662f\u65f6\u4ee3\u7684\u4ea7\u7269\uff0c\u6211\u4eec\u4e5f\u79bb\u4e0d\u5f00 ",(0,i.kt)("inlineCode",{parentName:"p"},"sql"),"\uff0c\u4f46\u5bf9\u4e8e\u5927\u591a\u6570\u7a0b\u5e8f\u5458\u548c\u9879\u76ee\u6765\u8bf4\uff0c",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u672a\u5fc5\u80fd\u591f\u5e26\u7ed9\u4ed6\u4eec\u591a\u5927\u7684\u6548\u76ca\u3002"),(0,i.kt)("p",null,"\u6240\u4ee5\uff0c",(0,i.kt)("inlineCode",{parentName:"p"},"ORM")," \u5c31\u8bde\u751f\u4e86\uff0c\u6240\u8c13\u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"ORM")," \u5c31\u662f\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff0c\u82f1\u6587\uff1a",(0,i.kt)("inlineCode",{parentName:"p"},"Object Relational Mapping"),"\uff0c\u7b80\u5355\u70b9\u8bf4\uff0c",(0,i.kt)("inlineCode",{parentName:"p"},"ORM")," \u6839\u636e\u7279\u6709\u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"POCO \u8d2b\u8840\u6a21\u578b")," \u89c4\u5219\u751f\u6210 ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u8bed\u53e5\u3002\u5927\u5927\u907f\u514d\u4e86\u91cd\u590d ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u548c ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u80fd\u529b\u53c2\u5dee\u4e0d\u9f50\u7b49\u95ee\u9898\u3002\uff08\u5f53\u7136 ",(0,i.kt)("inlineCode",{parentName:"p"},"ORM")," \u4f5c\u8005 ",(0,i.kt)("inlineCode",{parentName:"p"},"sql")," \u80fd\u529b\u4e5f\u4f1a\u5f71\u54cd\u6700\u7ec8\u6027\u80fd\uff09"),(0,i.kt)("p",null,"\u4e0a\u9762\u6240\u8bf4\u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"POCO")," \u8d2b\u8840\u6a21\u578b\u6b63\u662f\u6211\u4eec\u672c\u7ae0\u8282\u7684 ",(0,i.kt)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u5b9e\u4f53"),"\u3002"),(0,i.kt)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u5b9e\u4f53\u5c31\u662f\u6570\u636e\u5e93\u8868\u7684\u7c7b\u8868\u73b0\uff0c\u901a\u8fc7\u4e00\u5b9a\u7684\u89c4\u5219\u4f7f\u8fd9\u4e2a\u7c7b\u80fd\u591f\u4e00\u4e00\u5bf9\u5e94\u8868\u7ed3\u6784\u3002\u901a\u5e38\u8fd9\u6837\u7684\u7c7b\u4e5f\u79f0\u4e3a\uff1a",(0,i.kt)("inlineCode",{parentName:"p"},"POCO")," \u8d2b\u8840\u6a21\u578b\uff0c\u4e5f\u5c31\u662f\u53ea\u6709\u5b9a\u4e49\uff0c\u6ca1\u6709\u884c\u4e3a\u3002"),(0,i.kt)("h2",{id:"932-\u5982\u4f55\u5b9a\u4e49\u5b9e\u4f53"},"9.3.2 \u5982\u4f55\u5b9a\u4e49\u5b9e\u4f53"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u63d0\u4f9b\u591a\u79cd\u5b9a\u4e49\u5b9e\u4f53\u7684\u63a5\u53e3\u4f9d\u8d56\uff1a"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"IEntity"),"\uff1a\u5b9e\u4f53\u57fa\u63a5\u53e3\uff0c\u662f\u6240\u6709\u5b9e\u4f53\u7684\u57fa\u63a5\u53e3"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"IEntityNotKey"),"\uff1a\u65e0\u952e\u5b9e\u4f53\u63a5\u53e3\uff0c\u4e5f\u5c31\u662f\u89c6\u56fe\u3001\u5b58\u50a8\u8fc7\u7a0b\u3001\u51fd\u6570\u4f9d\u8d56\u63a5\u53e3"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"EntityBase"),"\uff1a\u5b9e\u4f53\u57fa\u62bd\u8c61\u7c7b\uff0c\u5185\u7f6e\u4e86 ",(0,i.kt)("inlineCode",{parentName:"li"},"Id"),"\uff0c",(0,i.kt)("inlineCode",{parentName:"li"},"TenantId")," \u5b57\u6bb5"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Entity"),"\uff1a\u5b9e\u4f53\u901a\u7528\u62bd\u8c61\u7c7b\uff0c\u7ee7\u627f\u81ea ",(0,i.kt)("inlineCode",{parentName:"li"},"EntityBase"),"\uff0c\u540c\u65f6\u5185\u7f6e ",(0,i.kt)("inlineCode",{parentName:"li"},"CreatedTime"),"\uff0c",(0,i.kt)("inlineCode",{parentName:"li"},"UpdatedTime"),"\uff0c",(0,i.kt)("inlineCode",{parentName:"li"},"IsDeleted")," \u5b57\u6bb5"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"EntityNotKey"),"\uff1a\u65e0\u952e\u5b9e\u4f53\u62bd\u8c61\u7c7b\uff0c\u89c6\u56fe\u3001\u5b58\u50a8\u8fc7\u7a0b\u3001\u51fd\u6570\u4f9d\u8d56\u62bd\u8c61\u7c7b")),(0,i.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u5b9e\u4f53\u5b9a\u4e49\u4f4d\u7f6e")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4e2d\u6709\u7ea6\u5b9a\uff0c\u5b9e\u4f53\u7edf\u4e00\u5b9a\u4e49\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"Furion.Core")," \u5c42\u3002"))),(0,i.kt)("h3",{id:"9321-\u5b9e\u4f53\u7ee7\u627f\u9009\u7528\u539f\u5219"},"9.3.2.1 \u5b9e\u4f53\u7ee7\u627f\u9009\u7528\u539f\u5219"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"\u5982\u679c\u4f60\u4e0d\u9700\u8981 ",(0,i.kt)("inlineCode",{parentName:"li"},"Furion")," \u4e3a\u5b9e\u4f53\u6dfb\u52a0\u4efb\u4f55\u5185\u7f6e\u7279\u6027\uff0c\u9009\u7528 ",(0,i.kt)("inlineCode",{parentName:"li"},"IEntity"),"\uff0c\u65e0\u952e\u5b9e\u4f53\u9009\u7528 ",(0,i.kt)("inlineCode",{parentName:"li"},"IEntityNotKey")),(0,i.kt)("li",{parentName:"ul"},"\u5982\u679c\u4f60\u53ea\u9700\u8981 ",(0,i.kt)("inlineCode",{parentName:"li"},"Id")," \u5c5e\u6027\uff0c\u9009\u7528 ",(0,i.kt)("inlineCode",{parentName:"li"},"EntityBase")),(0,i.kt)("li",{parentName:"ul"},"\u5982\u679c\u4f60\u9700\u8981 ",(0,i.kt)("inlineCode",{parentName:"li"},"Furion")," \u4e3a\u4f60\u81ea\u52a8\u6dfb\u52a0\u5e38\u7528\u5b57\u6bb5\uff0c\u5219\u9009\u7528 ",(0,i.kt)("inlineCode",{parentName:"li"},"Entity")),(0,i.kt)("li",{parentName:"ul"},"\u5982\u679c\u4f60\u9700\u8981\u89c6\u56fe\u3001\u5b58\u50a8\u8fc7\u7a0b\u3001\u51fd\u6570\u53ef\u4ee5\u901a\u8fc7 ",(0,i.kt)("inlineCode",{parentName:"li"},"DbSet")," \u64cd\u4f5c\uff0c\u5219\u7ee7\u627f ",(0,i.kt)("inlineCode",{parentName:"li"},"EntityNotKey"))),(0,i.kt)("h3",{id:"9322-ientity-\u793a\u8303\uff1a"},"9.3.2.2 ",(0,i.kt)("inlineCode",{parentName:"h3"},"IEntity")," \u793a\u8303\uff1a"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,5}","{1,5}":!0},"using Furion.DatabaseAccessor;\n\nnamespace Furion.Core\n{\n public class User : IEntity\n {\n /// <summary>\n /// \u624b\u5de5\u5b9a\u4e49 Id\n /// </summary>\n public int Id { get; set; }\n\n /// <summary>\n /// \u540d\u79f0\n /// </summary>\n public string Name { get; set; }\n }\n}\n")),(0,i.kt)("h3",{id:"9323-entitybase-\u793a\u8303\uff1a"},"9.3.2.3 ",(0,i.kt)("inlineCode",{parentName:"h3"},"EntityBase")," \u793a\u8303\uff1a"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,5}","{1,5}":!0},"using Furion.DatabaseAccessor;\n\nnamespace Furion.Core\n{\n public class User : EntityBase\n {\n // \u65e0\u9700\u5b9a\u4e49 Id \u5c5e\u6027\n\n /// <summary>\n /// \u540d\u79f0\n /// </summary>\n public string Name { get; set; }\n }\n}\n")),(0,i.kt)("h3",{id:"9324-entity-\u793a\u8303\uff1a"},"9.3.2.4 ",(0,i.kt)("inlineCode",{parentName:"h3"},"Entity")," \u793a\u8303\uff1a"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,5}","{1,5}":!0},"using Furion.DatabaseAccessor;\n\nnamespace Furion.Core\n{\n public class User : Entity\n {\n // \u65e0\u9700\u5b9a\u4e49 Id \u5c5e\u6027\n // \u5e76\u81ea\u52a8\u6dfb\u52a0 CreatedTime\uff0cUpdateTime\uff0cIsDeleted \u5c5e\u6027\n\n /// <summary>\n /// \u540d\u79f0\n /// </summary>\n public string Name { get; set; }\n }\n}\n")),(0,i.kt)("h3",{id:"9325-entitynotkey-\u793a\u8303\uff1a"},"9.3.2.5 ",(0,i.kt)("inlineCode",{parentName:"h3"},"EntityNotKey")," \u793a\u8303\uff1a"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,5,7-9}","{1,5,7-9}":!0},'using Furion.DatabaseAccessor;\n\nnamespace Furion.Core\n{\n public class UserView : EntityNotKey\n {\n public UserView() : base("\u89c6\u56fe\u540d\u79f0")\n {\n }\n\n /// <summary>\n /// Id\n /// </summary>\n public int Id { get; set; }\n\n /// <summary>\n /// \u540d\u79f0\n /// </summary>\n public string Name { get; set; }\n }\n}\n')),(0,i.kt)("div",{className:"admonition admonition-note alert alert--secondary"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))),"\u7279\u522b\u6ce8\u610f")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u5b9e\u4f53\u5fc5\u987b\u76f4\u63a5\u6216\u95f4\u63a5\u7ee7\u627f ",(0,i.kt)("inlineCode",{parentName:"p"},"IEntity")," \u624d\u80fd\u8fdb\u884c\u4ed3\u50a8\u7b49\u64cd\u4f5c\u3002"))),(0,i.kt)("h2",{id:"933-\u81ea\u5b9a\u4e49\u516c\u5171\u5b9e\u4f53"},"9.3.3 \u81ea\u5b9a\u4e49\u516c\u5171\u5b9e\u4f53"),(0,i.kt)("p",null,"\u5728\u5b9e\u9645\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u6bcf\u4e2a\u5e94\u7528\u7684\u6570\u636e\u5e93\u8868\u90fd\u6709\u4e00\u4e9b\u516c\u5171\u7684\u7c7b\uff0c\u6bd4\u5982\u521b\u5efa\u4eba\uff0c\u521b\u5efa\u65f6\u95f4\u7b49\uff0c\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u5c31\u9700\u8981\u81ea\u5b9a\u4e49\u516c\u5171\u5b9e\u4f53\u7c7b\u4e86\u3002"),(0,i.kt)("p",null,"\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4e2d\uff0c\u521b\u5efa\u516c\u5171\u5b9e\u4f53\u7c7b\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff1a"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"\u516c\u5171\u5b9e\u4f53\u7c7b",(0,i.kt)("strong",{parentName:"li"},"\u5fc5\u987b\u662f\u516c\u5f00\u4e14\u662f\u62bd\u8c61\u7c7b")),(0,i.kt)("li",{parentName:"ul"},"\u516c\u5171\u5b9e\u4f53\u7c7b\u5fc5\u987b\u542b\u6709\u65e0\u53c2\u6784\u9020\u51fd\u6570"),(0,i.kt)("li",{parentName:"ul"},"\u516c\u5171\u5b9e\u4f53\u7c7b\u5fc5\u987b\u63d0\u4f9b\u6570\u636e\u5e93\u5b9a\u4f4d\u5668\u7684\u652f\u6301")),(0,i.kt)("p",null,"\u5982\uff1a"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{83-91}","{83-91}":!0},"using System;\nusing System.ComponentModel.DataAnnotations;\nusing System.ComponentModel.DataAnnotations.Schema;\n\nnamespace Your.Namespace\n{\n public abstract class CommonEntity : CommonEntity<int, MasterDbContextLocator>\n {\n }\n\n public abstract class CommonEntity<TKey> : CommonEntity<TKey, MasterDbContextLocator>\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3, TDbContextLocator4> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n where TDbContextLocator4 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3, TDbContextLocator4, TDbContextLocator5> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n where TDbContextLocator4 : class, IDbContextLocator\n where TDbContextLocator5 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3, TDbContextLocator4, TDbContextLocator5, TDbContextLocator6> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n where TDbContextLocator4 : class, IDbContextLocator\n where TDbContextLocator5 : class, IDbContextLocator\n where TDbContextLocator6 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3, TDbContextLocator4, TDbContextLocator5, TDbContextLocator6, TDbContextLocator7> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n where TDbContextLocator4 : class, IDbContextLocator\n where TDbContextLocator5 : class, IDbContextLocator\n where TDbContextLocator6 : class, IDbContextLocator\n where TDbContextLocator7 : class, IDbContextLocator\n {\n }\n\n public abstract class CommonEntity<TKey, TDbContextLocator1, TDbContextLocator2, TDbContextLocator3, TDbContextLocator4, TDbContextLocator5, TDbContextLocator6, TDbContextLocator7, TDbContextLocator8> : PrivateCommonEntity<TKey>\n where TDbContextLocator1 : class, IDbContextLocator\n where TDbContextLocator2 : class, IDbContextLocator\n where TDbContextLocator3 : class, IDbContextLocator\n where TDbContextLocator4 : class, IDbContextLocator\n where TDbContextLocator5 : class, IDbContextLocator\n where TDbContextLocator6 : class, IDbContextLocator\n where TDbContextLocator7 : class, IDbContextLocator\n where TDbContextLocator8 : class, IDbContextLocator\n {\n }\n\n public abstract class PrivateCommonEntity<TKey> : IPrivateEntity\n {\n // \u6ce8\u610f\u662f\u5728\u8fd9\u91cc\u5b9a\u4e49\u4f60\u7684\u516c\u5171\u5b9e\u4f53\n public virtual TKey Id { get; set; }\n\n public virtual DateTime CreatedTime { get; set; }\n\n // \u66f4\u591a\u5c5e\u6027\u5b9a\u4e49\n }\n}\n")),(0,i.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u7279\u522b\u8bf4\u660e")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"\u901a\u8fc7\u4e0a\u9762\u7684\u683c\u5f0f\u5b9a\u4e49\u53ef\u4ee5\u5b8c\u7f8e\u7684\u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u5efa\u8bae\u91c7\u7528\u8fd9\u79cd\u683c\u5f0f\uff0c\u800c\u4e14\u6240\u6709\u7684\u516c\u5171\u5c5e\u6027\u90fd\u5e94\u8be5\u5b9a\u4e49\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"PrivateXXXX")," ",(0,i.kt)("inlineCode",{parentName:"p"},"\u79c1"),"\u6709\u7c7b\u4e2d\u3002"))),(0,i.kt)("h2",{id:"934-\u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e"},"9.3.4 \u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e"),(0,i.kt)("p",null,"\u5728\u8fc7\u53bb\u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"EF Core")," \u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e\u9700\u8981\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"DbContext")," \u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"OnModelCreating")," \u4e2d\u914d\u7f6e\u3002",(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u4e3a\u4e86\u7b80\u5316\u914d\u7f6e\u548c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u62bd\u8c61\u51fa\u4e86 ",(0,i.kt)("inlineCode",{parentName:"p"},"IEntityTypeBuilder<TEntity>")," \u63a5\u53e3\u3002"),(0,i.kt)("p",null,"\u901a\u8fc7 ",(0,i.kt)("inlineCode",{parentName:"p"},"IEntityTypeBuilder<TEntity>")," \u63a5\u53e3\uff0c\u6211\u4eec\u65e0\u9700\u5728 ",(0,i.kt)("inlineCode",{parentName:"p"},"DbContext")," \u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"OnModelCreating")," \u4e2d\u914d\u7f6e\uff0c\u53ef\u5728\u4efb\u610f\u5730\u65b9\u914d\u7f6e\u3002"),(0,i.kt)("h3",{id:"9341-\u5728\u6570\u636e\u5e93\u5b9e\u4f53\u4e2d\u914d\u7f6e"},"9.3.4.1 \u5728\u6570\u636e\u5e93\u5b9e\u4f53\u4e2d\u914d\u7f6e"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,5,20-25}","{1,5,20-25}":!0},"using Furion.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Furion.Core\n{\n public class User : Entity, IEntityTypeBuilder<User>\n {\n /// <summary>\n /// \u540d\u79f0\n /// </summary>\n public string Name { get; set; }\n\n /// <summary>\n /// \u5e74\u9f84\n /// </summary>\n public int Age { get; set; }\n\n // \u914d\u7f6e\u6570\u636e\u5e93\u5b9e\u4f53\n public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasKey(u => u.Id);\n entityBuilder.HasIndex(u => u.Name);\n }\n }\n}\n")),(0,i.kt)("h3",{id:"9342-\u5728\u4efb\u4f55\u5b9e\u4f8b\u7c7b\u4e2d\u914d\u7f6e"},"9.3.4.2 \u5728\u4efb\u4f55\u5b9e\u4f8b\u7c7b\u4e2d\u914d\u7f6e"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1,8,10-14}","{1,8,10-14}":!0},"using Furion.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Furion.Core\n{\n public class SomeClass : IEntityTypeBuilder<User>\n {\n public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasKey(u => u.Id);\n entityBuilder.HasIndex(u => u.Name);\n }\n }\n}\n")),(0,i.kt)("p",null,"\u5982\u4e0a\u9762\u4f8b\u5b50\uff0c\u901a\u8fc7 ",(0,i.kt)("inlineCode",{parentName:"p"},"SomeClass")," \u914d\u7f6e ",(0,i.kt)("inlineCode",{parentName:"p"},"User")," \u6570\u636e\u5e93\u5b9e\u4f53\u3002"),(0,i.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u66f4\u591a\u77e5\u8bc6")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"\u5982\u9700\u4e86\u89e3\u5b9e\u4f53\u914d\u7f6e\u652f\u6301\u54ea\u4e9b\u914d\u7f6e\u53ef\u67e5\u9605 ",(0,i.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/zh-cn/ef/core/modeling/"},"\u3010EFCore - \u521b\u5efa\u6a21\u578b\u3011")," \u7ae0\u8282\u3002"))),(0,i.kt)("h2",{id:"935-\u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e\u8bf4\u660e"},"9.3.5 \u6570\u636e\u5e93\u5b9e\u4f53\u914d\u7f6e\u8bf4\u660e"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4f1a\u81ea\u52a8\u626b\u63cf\u6240\u6709\u7ee7\u627f ",(0,i.kt)("inlineCode",{parentName:"p"},"IEntity")," \u63a5\u53e3\u7684\u7c7b\u8fdb\u884c ",(0,i.kt)("inlineCode",{parentName:"p"},"DbSet<TEntity>")," \u6ce8\u518c\uff0c\u4e5f\u5c31\u662f\u5b9e\u73b0\u81ea\u52a8\u914d\u7f6e ",(0,i.kt)("inlineCode",{parentName:"p"},"DbContext")," \u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"OnModelCreating"),"\u3002"),(0,i.kt)("p",null,"\u5982\u679c\u9700\u8981\u8df3\u8fc7\u81ea\u52a8\u6ce8\u518c\uff0c\u53ea\u9700\u8981\u8d34 ",(0,i.kt)("inlineCode",{parentName:"p"},"[NonAutomatic]")," \u6216 ",(0,i.kt)("inlineCode",{parentName:"p"},"[SkipScan]")," \u7279\u6027\u5373\u53ef\u3002\u4e00\u65e6\u8d34\u4e86\u6b64\u7279\u6027\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u624b\u52a8\u914d\u7f6e ",(0,i.kt)("inlineCode",{parentName:"p"},"DbContext")," \u7684 ",(0,i.kt)("inlineCode",{parentName:"p"},"OnModelCreating")),(0,i.kt)("h2",{id:"936-\u914d\u7f6e\u5217\u540d\u53ca\u5217\u7c7b\u578b"},"9.3.6 \u914d\u7f6e\u5217\u540d\u53ca\u5217\u7c7b\u578b"),(0,i.kt)("p",null,"\u6709\u65f6\u5019\u6211\u4eec\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u5217\u540d\u6216\u5217\u7c7b\u578b\uff0c\u6bd4\u5982 ",(0,i.kt)("inlineCode",{parentName:"p"},"decimal(18,2)"),"\uff0c\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u5728\u5c5e\u6027\u4e0a\u9762\u8d34 ",(0,i.kt)("inlineCode",{parentName:"p"},'[Column("\u5217\u540d", TypeName="decimal(18,2)")]')," \u5373\u53ef\u3002"),(0,i.kt)("h2",{id:"937-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.3.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),(0,i.kt)("div",{className:"admonition admonition-note alert alert--secondary"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"\u7ed9 Furion \u63d0 ",(0,i.kt)("a",{parentName:"p",href:"https://gitee.com/dotnetchina/Furion/issues/new?issue"},"Issue"),"\u3002"))))}p.isMDXComponent=!0}}]);
32,487
32,487
0.69908
3b3dfdff5b3925482821a214145e3407256a13d1
1,889
js
JavaScript
packages/react/src/components/ToggleSmall/ToggleSmall-story.js
guigueb/carbon
12f2573cf3c3a009090b17bff44fa442cc0e002f
[ "Apache-2.0" ]
4,233
2018-01-26T21:58:14.000Z
2022-03-31T10:51:14.000Z
packages/react/src/components/ToggleSmall/ToggleSmall-story.js
guigueb/carbon
12f2573cf3c3a009090b17bff44fa442cc0e002f
[ "Apache-2.0" ]
8,658
2018-01-29T16:24:38.000Z
2022-03-31T22:28:57.000Z
packages/react/src/components/ToggleSmall/ToggleSmall-story.js
mattrosno/carbon
80ee23cc8447bef8a7f41d4ba7366446a11d4808
[ "Apache-2.0" ]
1,288
2018-01-30T07:53:37.000Z
2022-03-30T20:45:05.000Z
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React from 'react'; import { action } from '@storybook/addon-actions'; import { withKnobs, text, boolean } from '@storybook/addon-knobs'; import ToggleSmall from '../ToggleSmall'; const toggleProps = () => ({ labelText: text( 'Label toggle input control (labelText)', 'Toggle element label' ), className: 'some-class', labelA: text('Label for untoggled state (labelA)', ''), labelB: text('Label for toggled state (labelB)', ''), disabled: boolean('Disabled (disabled)', false), onChange: action('onChange'), onToggle: action('onToggle'), }); export default { title: 'Deprecated/ToggleSmall', decorators: [withKnobs], parameters: { component: ToggleSmall, subcomponents: {}, }, }; export const Default = () => ( <> <h4> This component has been deprecated, please use the `size` prop provided by Toggle instead </h4> <br /> <ToggleSmall defaultToggled {...toggleProps()} className="some-class" id="toggle-1" /> </> ); Default.storyName = 'toggled'; Default.parameters = { info: { text: ` Toggles are controls that are used to quickly switch between two possible states. The example below shows an uncontrolled Toggle component. To use the Toggle component as a controlled component, set the toggled property. Setting the toggled property will allow you to change the value dynamically, whereas setting the defaultToggled prop will only set the value initially. This example has defaultToggled set to true. Small toggles may be used when there is not enough space for a regular sized toggle. This issue is most commonly found in tables. `, }, };
29.061538
122
0.67496
3b3e99cd37f600f8ae72ba3836eacc40f4d99d6c
3,979
js
JavaScript
test/native_key.js
zhangweis/node-jds
25d8ab4257a28b0c648563a2c7bddd682566231e
[ "MIT" ]
1
2015-09-10T09:51:59.000Z
2015-09-10T09:51:59.000Z
test/native_key.js
kyledrake/bitcoinjs-server
fcb8e2c8634431d3d1602ad1bd5b16fc37486b6d
[ "MIT" ]
null
null
null
test/native_key.js
kyledrake/bitcoinjs-server
fcb8e2c8634431d3d1602ad1bd5b16fc37486b6d
[ "MIT" ]
1
2020-06-03T10:01:49.000Z
2020-06-03T10:01:49.000Z
var vows = require('vows'), assert = require('assert'); var ccmodule = require('../lib/binding'); var BitcoinKey = ccmodule.BitcoinKey; var Util = require('../lib/util'); var encodeHex = Util.encodeHex; var decodeHex = Util.decodeHex; vows.describe('BitcoinKey').addBatch({ 'A generated key': { topic: function () { return BitcoinKey.generateSync(); }, 'is a BitcoinKey': function (topic) { assert.instanceOf(topic, BitcoinKey); }, 'has a valid public key': { topic: function (topic) { return topic.public; }, 'that is a Buffer': function (topic) { assert.isTrue(Buffer.isBuffer(topic, Buffer)); }, 'that is 65 bytes long': function (topic) { assert.equal(topic.length, 65); }, 'that begins with a 0x04 byte': function (topic) { assert.equal(topic[0], 4); } }, 'has a valid private key': { topic: function (topic) { return topic.private; }, 'that is a Buffer': function (topic) { assert.isTrue(Buffer.isBuffer(topic, Buffer)); }, 'that is 32 bytes long': function (topic) { assert.equal(topic.length, 32); }, 'that correctly reimports': function (topic) { var newKey = new BitcoinKey(); newKey.private = topic; assert.equal(encodeHex(topic), encodeHex(newKey.private)); } }, 'has a DER encoding': { topic: function (topic) { return topic.toDER(); }, 'that is a Buffer': function (topic) { assert.isTrue(Buffer.isBuffer(topic, Buffer)); }, 'that is 279 bytes long': function (topic) { assert.equal(topic.length, 279); } }, 'can regenerate its public key': function (topic) { var pubkeyBefore = topic.public; // We'll overwrite the public key with some other one, so we can be sure // that it as actually been regenerated. topic.public = decodeHex("0478314155256b51105268fd1ef12f63a6deb4ac7955489cd023f6e0137f0e3889c54f533d3212d9d65636825f11b2d1e0a0da20504b010370008c7c8a945333be"); topic.regenerateSync(); assert.equal(encodeHex(topic.public), encodeHex(pubkeyBefore)); } }, 'A predefined key': { topic: function () { var key = new BitcoinKey(); key.private = decodeHex("59441e38964bafc959c730a86ba4deee5bdd3674a1a4dff7a2a3bff04a5e5929"); key.public = decodeHex("04b7c931bb4947c1964455cb7dd0d2e28c6bafcac1a2e8cb9d6970634ac2313e2a4a054d90936dce1bd4663ccf2dcec8f49ff8733bb0815e2b90e6dff173ff00ba"); return key; }, 'is a BitcoinKey': function (topic) { assert.instanceOf(topic, BitcoinKey); } }, 'A predefined public key': { topic: function () { var key = new BitcoinKey(); key.public = decodeHex("04a19c1f07c7a0868d86dbb37510305843cc730eb3bea8a99d92131f44950cecd923788419bfef2f635fad621d753f30d4b4b63b29da44b4f3d92db974537ad5a4"); return key; }, 'is a BitcoinKey': function (topic) { assert.instanceOf(topic, BitcoinKey); }, 'correctly verifies a signature synchronously': function (topic) { assert.isTrue(topic.verifySignatureSync(decodeHex("230aba77ccde46bb17fcb0295a92c0cc42a6ea9f439aaadeb0094625f49e6ed8"), decodeHex("3046022100a3ee5408f0003d8ef00ff2e0537f54ba09771626ff70dca1f01296b05c510e85022100d4dc70a5bb50685b65833a97e536909a6951dd247a2fdbde6688c33ba6d6407501"))); }, 'verifying a signature asynchronously': { topic: function (topic) { topic.verifySignature(decodeHex("230aba77ccde46bb17fcb0295a92c0cc42a6ea9f439aaadeb0094625f49e6ed8"), decodeHex("3046022100a3ee5408f0003d8ef00ff2e0537f54ba09771626ff70dca1f01296b05c510e85022100d4dc70a5bb50685b65833a97e536909a6951dd247a2fdbde6688c33ba6d6407501"), this.callback); }, 'returns true': function (topic) { assert.isTrue(topic); } } } }).export(module);
30.607692
287
0.667002
3b3f36b85ddc49866cb76a29320532b10daf84ca
4,593
js
JavaScript
lib/extent.js
Volicon/couch-r
26014dfec6067970628e5de8d840a25fb8d4f844
[ "MIT" ]
1
2019-12-11T02:18:45.000Z
2019-12-11T02:18:45.000Z
lib/extent.js
VoliJS/couch-r
26014dfec6067970628e5de8d840a25fb8d4f844
[ "MIT" ]
null
null
null
lib/extent.js
VoliJS/couch-r
26014dfec6067970628e5de8d840a25fb8d4f844
[ "MIT" ]
null
null
null
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", { value: true }); const type_r_1 = require("type-r"); const couchbase_1 = require("couchbase"); let DocumentExtent = class DocumentExtent extends type_r_1.Messenger { constructor() { super(...arguments); this._designDocs = {}; this._indexes = []; } static onDefine(_a, BaseClass) { var { queries } = _a, spec = __rest(_a, ["queries"]); this.prototype.queries = Object.assign({}, queries, this.prototype.queries); //this.prototype.queries = queries; this._instance = null; type_r_1.Messenger.onDefine.call(this, spec, BaseClass); } static get instance() { return this._instance || (this._instance = new this()); } appendView(view, name) { const key = this.getDesignDocKey(name), designDoc = this._designDocs[key] || (this._designDocs[key] = new DesignDocument(key)); designDoc.append(view, name); return key; } appendIndex(index, name) { this._indexes.push(name); } async onConnect(initialize) { for (let name in this.queries) { // Connect query to the extent. const query = this.queries[name] = this.queries[name].bind(this, name); // Create the corresponding Couchbase query object. this[name] = query.create(); } if (initialize) { // Initialize design documents... await this.updateViews(); } } query(theQuery, options = {}) { return this.api.query(theQuery, options); } async updateViews() { return Promise.all(Object.keys(this._designDocs) .map(name => this._designDocs[name].update(this))); } async updateIndexes(existingIndexes) { const toBuild = []; for (let name of this._indexes) { let existing = existingIndexes[name]; const local = this.queries[name]; if (existing && local.notEqual(existing)) { this.log('info', `dropping index ${name}...`); await this.manager.dropIndex(name, { ignoreIfNotExists: true }); existing = null; } if (!existing) { this.log('info', `creating index ${name}...`); await this.query(this[name].consistency(couchbase_1.N1qlQuery.Consistency.STATEMENT_PLUS)); toBuild.push(name); } } return toBuild; } }; DocumentExtent = __decorate([ type_r_1.define, type_r_1.definitions({ queries: type_r_1.mixinRules.merge }) ], DocumentExtent); exports.DocumentExtent = DocumentExtent; class DesignDocument { constructor(id) { this.id = id; this.views = {}; } // Append view to the document append(view, name) { this.views[name] = view.toJSON(); } // Updates view definition in the given bucket async update(bucket) { const { id, views } = this, { manager } = bucket; return manager .getDesignDocument(id) .then(doc => { if (type_r_1.tools.notEqual(views, doc.views)) { console.log(`[Couch-R] Updating design document "${id}"...`); return manager.upsertDesignDocument(id, { views }); } }) .catch(e => { console.log(`[Couch-R] Creating design document "${id}"...`); return manager.upsertDesignDocument(id, { views }); }); } } exports.DesignDocument = DesignDocument; //# sourceMappingURL=extent.js.map
39.594828
150
0.575659
3b3f92736e662dd97935cb4a2b0c675bd59c357f
265
js
JavaScript
addon/locales/ru.nav.js
zbw8388/sidebery
2ee9b59724b3e3faab9f929aa775ffc4b37d00f4
[ "MIT" ]
829
2018-12-14T04:42:35.000Z
2022-03-31T13:20:23.000Z
addon/locales/ru.nav.js
zbw8388/sidebery
2ee9b59724b3e3faab9f929aa775ffc4b37d00f4
[ "MIT" ]
561
2018-11-25T05:30:40.000Z
2022-03-31T13:34:22.000Z
addon/locales/ru.nav.js
zbw8388/sidebery
2ee9b59724b3e3faab9f929aa775ffc4b37d00f4
[ "MIT" ]
87
2019-04-29T19:36:01.000Z
2022-03-30T01:09:03.000Z
export default { 'nav.show_hidden_tooltip': { message: 'Показать скрытые панели' }, 'nav.add_ctx_tooltip': { message: 'Создать контейнер' }, 'nav.add_panel_tooltip': { message: 'Создать панель' }, 'nav.settings_tooltip': { message: 'Открыть настройки' }, }
37.857143
68
0.701887
3b40576933853c7aa3d4f0a76388e812dbed480f
394
js
JavaScript
lib/data/attr-users.js
baby-plan/baby-plan
7310017063ad8d1cbeaf1bda80364abf161eff52
[ "MIT" ]
2
2017-08-16T12:11:04.000Z
2017-08-21T00:54:52.000Z
lib/data/attr-users.js
baby-plan/baby-plan
7310017063ad8d1cbeaf1bda80364abf161eff52
[ "MIT" ]
null
null
null
lib/data/attr-users.js
baby-plan/baby-plan
7310017063ad8d1cbeaf1bda80364abf161eff52
[ "MIT" ]
null
null
null
/** 用户数据 */ module.exports = [{ id: 1, img: '/assets/head-icon/avatar1.jpg' }, { id: 2, img: '/assets/head-icon/avatar2.jpg' }, { id: 3, img: '/assets/head-icon/avatar3.jpg' }, { id: 4, img: '/assets/head-icon/avatar4.jpg' }, { id: 5, img: '/assets/head-icon/avatar5.jpg' }, { id: 6, img: '/assets/head-icon/avatar6.jpg' } ]
15.153846
40
0.5
3b408acc53bdecd675e3b3689873e0a7956877ec
42
js
JavaScript
index.js
pillys/nodetpl
661d3ddcc055a22878722ab6d986196e5286e8a2
[ "MIT" ]
37
2015-11-24T10:03:21.000Z
2019-05-31T03:50:14.000Z
index.js
pillys/nodetpl
661d3ddcc055a22878722ab6d986196e5286e8a2
[ "MIT" ]
6
2016-02-15T02:15:16.000Z
2016-08-12T09:42:27.000Z
index.js
pillys/nodetpl
661d3ddcc055a22878722ab6d986196e5286e8a2
[ "MIT" ]
8
2015-11-14T06:42:20.000Z
2016-08-16T01:11:22.000Z
module.exports = require('./lib/nodetpl');
42
42
0.714286
3b4099b6a629fd97d58ac9d9396623f5b4d09cc7
1,448
js
JavaScript
node_modules/@sap/cds/lib/log/errors.js
lbritz/RiskApplication
4560276e6acf7dde720aa6927e07698273710328
[ "Apache-2.0", "MIT" ]
null
null
null
node_modules/@sap/cds/lib/log/errors.js
lbritz/RiskApplication
4560276e6acf7dde720aa6927e07698273710328
[ "Apache-2.0", "MIT" ]
null
null
null
node_modules/@sap/cds/lib/log/errors.js
lbritz/RiskApplication
4560276e6acf7dde720aa6927e07698273710328
[ "Apache-2.0", "MIT" ]
null
null
null
const error = exports = module.exports = (..._) => { throw _error(..._) } const _error = (msg, _details, _base = error, ...etc) => { if (msg.raw) return _error (String.raw (msg,_details,_base,...etc)) const e = msg instanceof Error ? msg : new Error (msg) Error.captureStackTrace(e,_base) if (_details) Object.assign (e,_details) return e } exports.reject = function (msg, _details, _base) { return Promise.reject(_error(msg, _details, _base)) } exports.expected = ([,type], arg) => { const [ name, value ] = Object.entries(arg)[0] return error `Expected argument '${name}'${type}, but got: ${require('util').inspect(value,{depth:11})}` } exports.duplicate_cds = (...locations) => { const { local } = require('../utils') throw error `Duplicate @sap/cds/common! There are duplicate versions of @sap/cds loaded from these locations: ${locations.map(local).join('\n ')} To fix this, check all dependencies to "@sap/cds" in your package.json and those of reused packages and ensure they allow deduped use of @sap/cds. ` } exports.no_primary_db = (p,_base) => error (`Not connected to primary datasource! Attempt to use 'cds.${p}' without prior connect to primary datasource, i.e. cds.connect.to('db'). ${ process.argv[1].endsWith('cds') && process.argv[2] in {run:1,serve:1} ? ` Please configure one thru 'cds.requires.db' or use in-memory db: cds ${process.argv[2]} --in-memory` : ''}` ,{},_base)
35.317073
106
0.665746
3b40e93692deededa92d410511018bb805307b5f
1,792
js
JavaScript
docs/src/pages/components/lists/CheckboxListSecondary.js
jjsquillante/material-ui
d36858d36741bb57facb7f1e91d0d2d4d760b4bb
[ "MIT" ]
5
2019-01-30T04:52:23.000Z
2022-01-10T06:36:44.000Z
docs/src/pages/components/lists/CheckboxListSecondary.js
jjsquillante/material-ui
d36858d36741bb57facb7f1e91d0d2d4d760b4bb
[ "MIT" ]
130
2020-07-24T01:59:20.000Z
2021-07-12T21:11:13.000Z
docs/src/pages/components/lists/CheckboxListSecondary.js
jjsquillante/material-ui
d36858d36741bb57facb7f1e91d0d2d4d760b4bb
[ "MIT" ]
3
2018-08-11T04:51:06.000Z
2019-07-21T13:54:13.000Z
import * as React from 'react'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemButton from '@material-ui/core/ListItemButton'; import ListItemText from '@material-ui/core/ListItemText'; import ListItemAvatar from '@material-ui/core/ListItemAvatar'; import Checkbox from '@material-ui/core/Checkbox'; import Avatar from '@material-ui/core/Avatar'; export default function CheckboxListSecondary() { const [checked, setChecked] = React.useState([1]); const handleToggle = (value) => () => { const currentIndex = checked.indexOf(value); const newChecked = [...checked]; if (currentIndex === -1) { newChecked.push(value); } else { newChecked.splice(currentIndex, 1); } setChecked(newChecked); }; return ( <List dense sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}> {[0, 1, 2, 3].map((value) => { const labelId = `checkbox-list-secondary-label-${value}`; return ( <ListItem key={value} secondaryAction={ <Checkbox edge="end" onChange={handleToggle(value)} checked={checked.indexOf(value) !== -1} inputProps={{ 'aria-labelledby': labelId }} /> } disablePadding > <ListItemButton> <ListItemAvatar> <Avatar alt={`Avatar n°${value + 1}`} src={`/static/images/avatar/${value + 1}.jpg`} /> </ListItemAvatar> <ListItemText id={labelId} primary={`Line item ${value + 1}`} /> </ListItemButton> </ListItem> ); })} </List> ); }
30.896552
83
0.553013
3b40ecd2e86cded8d3825cc0cc07a84496b6cd5a
5,884
js
JavaScript
resources/site/js/index.js
hidura/sugelico
d3c76f358a788d5f3a891cf0a7dd7420ac3a7845
[ "MIT" ]
null
null
null
resources/site/js/index.js
hidura/sugelico
d3c76f358a788d5f3a891cf0a7dd7420ac3a7845
[ "MIT" ]
null
null
null
resources/site/js/index.js
hidura/sugelico
d3c76f358a788d5f3a891cf0a7dd7420ac3a7845
[ "MIT" ]
null
null
null
var labels=[]; var values=[]; var data=[]; $(function () { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '/resources/site/assets/chart.js/dist/Chart.js'; // Then bind the event to the callback function. // There are several events for cross browser compatibility. // Fire the loading head.appendChild(script); var url = "ws://erpta.sugelico.com:13267/api"; if (!window.WebSocket) alert("WebSocket not supported by this browser"); var myWebSocket = { connect: function () { var location = url; var full = window.location.host; //window.location.host is subdomain.domain.com var parts = full.split('.'); this._ws = new WebSocket(location+"?keyses="+getCookie("loginkey")); this._ws.onopen = this._onopen; this._ws.onmessage = this._onmessage; this._ws.onclose = this._onclose; this._ws.onerror = this._onerror; }, _onopen: function () { console.debug("WebSocket Connected"); }, _onmessage: function (message) { data = JSON.parse(message.data); console.log(data); if (data.error!=undefined){ $("#error_msg").text(data.error); $("#msg_box").slideDown('fast'); return; } // productSold=data.products_sale.slice(data.products_sale.length-7,data.products_sale.length); // labels=[]; // values=[]; // loadChart(); // productSold.forEach(function (product) { // labels.push(product[0]); // values.push(product[1]) // }); // loadChart(); // $("#daily_income").text("RD$"+sugelico.numberWithCommas(data.fulltotal)); // $("#net_income").text("RD$"+sugelico.numberWithCommas(data.fullsubtotal)); // $("#open_orders").text(sugelico.numberWithCommas(data.open_preorders)); // console.log(data); // $("#paytypes").empty(); // for (var key in data.paytypetotals) { // var tblStr="<table><tbody>" + // // "<tr>"+ // "<td>Total</td><td>"+sugelico.numberWithCommas(data.paytypetotals[key]["total"])+"</td>" + // "</tr>" + // "</tbody></table>" // $("#paytypes").append("<div class='card' style='width: 18rem;'>\n" + // " <div class='card-body'>\n" + // " <h5 class='card-title'>"+key+"</h5>\n" + // " <p class='card-text'>"+tblStr+" </p>\n" + // " <a href='#' data-id='"+key+"' onClick='billsLst(this);' class='btn btn-primary'>Ver Más</a>\n" + // " </div>\n" + // "</div>") // } }, _onclose: function () { console.debug("WebSocket Closed"); }, _onerror: function (e) { console.debug("Error occured: " + e); }, _send: function (message) { console.debug("Message Send: " + message); if (this._ws) this._ws.send(message); } }; myWebSocket.connect(); // Adding the script tag to the head as suggested before }); function billsLst(target) { var tr=""; data.bills.forEach(function (bill) { if ($(target).attr("data-id")===bill.paytpname){ tr+="<tr>" + "<td>" +bill.billpreorder+"</td>" + "<td>" +sugelico.numberWithCommas(bill.ptpsubtotal)+"</td>" + "<td>" +sugelico.numberWithCommas(bill.ptptax)+"</td>" + "<td>" +sugelico.numberWithCommas(bill.ptptotal)+"</td>" + "<td>" +sugelico.numberWithCommas(bill.ptpaid)+"</td>" + "</tr>" } }); var tblStr="" + "<div class='col-md-12'>" + "<table class='table table-responsive'>" + "<thead>" + "<tr>" + "<td>Codigo</td>" + "<td>Subtotal</td>" + "<td>Impuesto</td>" + "<td>Total</td>" + "<td>Total pagado</td>" + "</tr>" + "</thead>" + "<tbody>" + tr+ "</tbody>"+ "</table>" + "</div>"; sugelico.openDialog("Facturas",tblStr); } function loadChart() { var ctx = document.getElementById("bills"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [{ label: 'Productos mas vendidos', data: values, 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 } }] } } }); }
33.816092
124
0.434908
3b41850e812f4e7b9166a50cccb71ed74d1c9f01
288
js
JavaScript
src/IsomorphicRelay.js
jeswin-unmaintained/isomorphic-relay
bf3480b77eb9d84391265c9022574f0595991784
[ "BSD-2-Clause" ]
null
null
null
src/IsomorphicRelay.js
jeswin-unmaintained/isomorphic-relay
bf3480b77eb9d84391265c9022574f0595991784
[ "BSD-2-Clause" ]
null
null
null
src/IsomorphicRelay.js
jeswin-unmaintained/isomorphic-relay
bf3480b77eb9d84391265c9022574f0595991784
[ "BSD-2-Clause" ]
null
null
null
import './fixFetch'; import injectPreparedData from './injectPreparedData'; import IsomorphicRootContainer from './IsomorphicRootContainer'; import prepareData from './prepareData'; export default { injectPreparedData, prepareData, RootContainer: IsomorphicRootContainer, };
26.181818
64
0.784722
3b41ab27b533a3e47299ece2317e3a0f6e13033f
1,310
js
JavaScript
js_test/compiler/test_compiler.js
mikegagnon/puzzlecode
04b242e2eff1ed285b386bddd50082523261532d
[ "Unlicense" ]
15
2015-01-28T22:58:01.000Z
2021-09-27T00:22:41.000Z
js_test/compiler/test_compiler.js
mikegagnon/puzzlecode
04b242e2eff1ed285b386bddd50082523261532d
[ "Unlicense" ]
null
null
null
js_test/compiler/test_compiler.js
mikegagnon/puzzlecode
04b242e2eff1ed285b386bddd50082523261532d
[ "Unlicense" ]
6
2015-06-26T13:35:04.000Z
2022-02-14T17:46:15.000Z
/** * This is free and unencumbered software released into the public domain. * See UNLICENSE. */ /** * array of [programLine, instructionObject] pairs * tests ability to correctly compile instructions and detect errors * specific to instructions. * * Things that are __not__ tested here: * - tokenization * - comments * - labels * - second phase of goto parsing */ var testInstructions = [ ["move", new PuzzleCodeInstruction(Opcode.MOVE, null)], ["move foo", null], ["move foo bar", null], ["turn left", new PuzzleCodeInstruction(Opcode.TURN, Direction.LEFT)], ["turn right", new PuzzleCodeInstruction(Opcode.TURN, Direction.RIGHT)], ["turn up", null], ["turn down", null], ["turn", null], ["turn 0", null], ["turn 1", null], ["turn left right", null], ["turn left foo", null], ["goto foo_1", new PuzzleCodeInstruction(Opcode.GOTO, "foo_1")], ["goto foo bar", null], ["goto 1foo", null], ["goto _foo", null], ["goto move", null], ["goto goto", null] ] for (var i = 0; i < testInstructions.length; i++) { var line = testInstructions[i][0] var expected = testInstructions[i][1] var result = compileLine(line)[0] assert(_.isEqual(result, expected), "compile('" + line + "') != expected") }
26.734694
76
0.623664
3b429785bac2f04be5198c4143bab2d9f5894816
3,394
js
JavaScript
app/services/brand/controller.js
factman/api-app
5ee489eee776c7a9afc8d4efbe3e3acae10728a5
[ "MIT" ]
1
2019-07-14T13:09:47.000Z
2019-07-14T13:09:47.000Z
app/services/brand/controller.js
factman/api-app
5ee489eee776c7a9afc8d4efbe3e3acae10728a5
[ "MIT" ]
null
null
null
app/services/brand/controller.js
factman/api-app
5ee489eee776c7a9afc8d4efbe3e3acae10728a5
[ "MIT" ]
null
null
null
import Brand from "./../../models/brand"; // Create and Save a new Brand exports.create = (req, res) => { // Validate request if (!req.body.decription) { res.status(400).send({ message: "Brand description can not be empty", }); } // Create a Brand const brand = new Brand({ title: req.body.title || "Untitled Brand", description: req.body.description, logo: req.body.logo, banner: req.body.banner, }); // Save Brand in the database brand.save() .then((data) => { res.send(data); }).catch((err) => { res.status(500).send({ message: err.message || "Some error occurred while creating the Brand.", }); }); }; // Retrieve and return all brands from the database. exports.findAll = (req, res) => { Brand.find() .then((brands) => { res.send(brands); }).catch((err) => { res.status(500).send({ message: err.message || "Some error occurred while retrieving brands.", }); }); }; // Find a single brand with a brandId exports.findOne = (req, res) => { Brand.findById(req.params.brandId) .then((brand) => { if (!brand) { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.send(brand); }).catch((err) => { if (err.kind === "ObjectId") { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.status(500).send({ message: `Error retrieving brand with id ${req.params.brandId}`, }); }); }; // Update a brand identified by the brandId in the request exports.update = (req, res) => { // Validate Request if (!req.body.decription) { res.status(400).send({ message: "Brand description can not be empty", }); } // Find brand and update it with the request body Brand.findByIdAndUpdate(req.params.brandId, { title: req.body.title || "Untitled Brand", description: req.body.description, logo: req.body.logo, banner: req.body.banner, }, { new: true }) .then((brand) => { if (!brand) { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.send(brand); }).catch((err) => { if (err.kind === "ObjectId") { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.status(500).send({ message: `Error updating brand with id ${req.params.brandId}`, }); }); }; // Delete a brand with the specified brandId in the request exports.delete = (req, res) => { Brand.findByIdAndRemove(req.params.brandId) .then((brand) => { if (!brand) { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.send({ message: "Brand deleted successfully!" }); }).catch((err) => { if (err.kind === "ObjectId" || err.name === "NotFound") { res.status(404).send({ message: `Brand not found with id ${req.params.brandId}`, }); } res.status(500).send({ message: `Could not delete brand with id ${req.params.brandId}`, }); }); };
27.819672
81
0.537714
3b42c3430cc90b6560c57a0a54279163faf8eda5
441
js
JavaScript
src/reducer.js
mathieudutour/redux-queue-offline
9d88e68599310b2e7de21b23e7655265db81d34d
[ "MIT" ]
76
2016-01-23T20:40:26.000Z
2021-05-01T19:08:13.000Z
src/reducer.js
mathieudutour/redux-queue-offline
9d88e68599310b2e7de21b23e7655265db81d34d
[ "MIT" ]
5
2016-04-18T19:59:56.000Z
2017-10-25T15:44:08.000Z
src/reducer.js
mathieudutour/redux-queue-offline
9d88e68599310b2e7de21b23e7655265db81d34d
[ "MIT" ]
15
2016-04-18T16:59:31.000Z
2021-08-18T07:26:14.000Z
import { INITIAL_STATE } from './initialState' import { QUEUE_ACTION, ONLINE, OFFLINE } from './actions' export default function reducer (state = INITIAL_STATE, action = {}) { switch (action.type) { case QUEUE_ACTION: return {...state, queue: state.queue.concat(action.payload)} case ONLINE: return {queue: [], isOnline: true} case OFFLINE: return {...state, isOnline: false} default: return state } }
29.4
70
0.662132
3b43d963e9fcd1b4dfbcddf1a1efb505b0c72f13
2,161
js
JavaScript
front/src/Main/Memo/WriteThread.js
tks3141/A_2010
4aa468593897e3d98a6e50b39cedea844b297bd2
[ "MIT" ]
3
2020-10-31T00:45:26.000Z
2020-12-11T15:36:11.000Z
front/src/Main/Memo/WriteThread.js
tks3141/A_2010
4aa468593897e3d98a6e50b39cedea844b297bd2
[ "MIT" ]
9
2020-11-03T05:57:19.000Z
2020-11-18T04:59:07.000Z
front/src/Main/Memo/WriteThread.js
tks3141/A_2010
4aa468593897e3d98a6e50b39cedea844b297bd2
[ "MIT" ]
1
2020-10-31T00:44:17.000Z
2020-10-31T00:44:17.000Z
import React, { useState, useEffect, useContext } from "react"; import { makeStyles } from '@material-ui/core/styles'; import { formatSec2Str } from '../Duration'; import Card from '@material-ui/core/Card' import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; import EditIcon from '@material-ui/icons/Edit'; import DescriptionIcon from '@material-ui/icons/Description'; import DeleteIcon from '@material-ui/icons/Delete'; import DoneIcon from '@material-ui/icons/Done'; //import {UserInfoContext} from "../../context"; import { CardActions } from "@material-ui/core"; const useStyles = makeStyles((theme) => ({ root: { flex: 1, display: 'flex', justifyContent: 'flex-end', }, } )); function WriteThread(props) { const [text, setText] = useState(""); const parent_memo = props.parent_memo; //const { userInfo, setUserInfo } = useContext(UserInfoContext); const classes = useStyles(); const handleOnclick = () => { let thread_text; if (props.isthread) { thread_text = "@" + props.thread_memo.account_id + " " + text; // console.log("スレッドに返信") } if (props.isthread) { props.onSubmit({ text: thread_text, time: parent_memo.time, parent_id: parent_memo.id, user_id: props.user_id }); } else { props.onSubmit({ text: text, time: parent_memo.time, parent_id: parent_memo.id, user_id: props.user_id }); } setText(""); } // console.log("親のメモ:",parent_memo) // console.log("提出予定:" ,text,parent_memo.time,parent_memo.id,props.user_id ) //console.log("返信状態",props.thread) return ( <> <TextField type="text" id="memo-input" label="返信を追加" multiline fullWidth onChange={e => setText(e.target.value)} value={text} error={text.length >= 100} helperText={text.length >= 100 ? 'メモは100文字以内にしてください!' : ' '} /> {text.length > 0 ? <Button id="submit" variant="contained" color="primary" onClick={handleOnclick}> {/*<DescriptionIcon />*/} 返信 </Button> : <Button id="submit" variant="contained" color="primary" disabled onClick={handleOnclick}> {/*<DescriptionIcon />*/} 返信 </Button> } </> ) } export default WriteThread;
31.318841
116
0.67515
3b44f9115d77e056eadd033b8ecb8eaf2e5283d4
705
js
JavaScript
application/html/class_p_h_p_unit___framework___constraint___array_has_key.js
slliac/Ljus4Food
3bb47ba25c9e5ba48c7ffd3a42f88e24f06e6524
[ "MIT" ]
null
null
null
application/html/class_p_h_p_unit___framework___constraint___array_has_key.js
slliac/Ljus4Food
3bb47ba25c9e5ba48c7ffd3a42f88e24f06e6524
[ "MIT" ]
null
null
null
application/html/class_p_h_p_unit___framework___constraint___array_has_key.js
slliac/Ljus4Food
3bb47ba25c9e5ba48c7ffd3a42f88e24f06e6524
[ "MIT" ]
null
null
null
var class_p_h_p_unit___framework___constraint___array_has_key = [ [ "__construct", "class_p_h_p_unit___framework___constraint___array_has_key.html#ae68e3281fdc4689e22a68b4b463c5fa9", null ], [ "failureDescription", "class_p_h_p_unit___framework___constraint___array_has_key.html#aaabb679273bfb812df4d81c283754a59", null ], [ "matches", "class_p_h_p_unit___framework___constraint___array_has_key.html#a9c9c337de483bbdbb9fa249a6c7c9cc5", null ], [ "toString", "class_p_h_p_unit___framework___constraint___array_has_key.html#a5558c5d549f41597377fa1ea8a1cefa3", null ], [ "$key", "class_p_h_p_unit___framework___constraint___array_has_key.html#aa60b0284e0dfa2463495481cf11e3cf4", null ] ];
88.125
135
0.846809
3b4527539d7c429bae84771d08f93202d9a94f3f
1,828
js
JavaScript
changsha/dva-quickstart/src/components/Xbanner.js
wlf520wyh/changsha
a79d68e29466c944087993a1154e24989f5043c9
[ "MIT" ]
1
2019-03-05T08:12:22.000Z
2019-03-05T08:12:22.000Z
changsha/dva-quickstart/src/components/Xbanner.js
wlf520wyh/changsha
a79d68e29466c944087993a1154e24989f5043c9
[ "MIT" ]
null
null
null
changsha/dva-quickstart/src/components/Xbanner.js
wlf520wyh/changsha
a79d68e29466c944087993a1154e24989f5043c9
[ "MIT" ]
1
2019-02-20T10:11:10.000Z
2019-02-20T10:11:10.000Z
import React from "react"; import { connect } from "dva"; import Xbannercss from '../components/Xcss/Xbanner.css' import banner_1 from '../assets/img/banner_1.png'; import banner_2 from '../assets/img/banner_2.png'; import banner_3 from '../assets/img/banner_3.png'; import banner_4 from '../assets/img/banner_4.png'; function Xbanner() { return ( <div className={Xbannercss.banner}> <div id="demo" className="carousel slide" data-ride="carousel"> <ul className="carousel-indicators"> <li data-target="#demo" data-slide-to="0" className="active"></li> <li data-target="#demo" data-slide-to="1"></li> <li data-target="#demo" data-slide-to="2"></li> </ul> <div className="carousel-inner"> <div className="carousel-item active"> <img src={banner_1} alt=''/> </div> <div className="carousel-item"> <img src={banner_2} alt=''/> </div> <div className="carousel-item"> <img src={banner_3} alt=''/> </div> <div className="carousel-item"> <img src={banner_4} alt=''/> </div> </div> <a className="carousel-control-prev" href="#demo" data-slide="prev"> <span className="carousel-control-prev-icon"></span> </a> <a className="carousel-control-next" href="#demo" data-slide="next"> <span className="carousel-control-next-icon"></span> </a> </div> </div> ); } Xbanner.propTypes = {}; export default connect()(Xbanner);
40.622222
86
0.497265
3b4577a40a2b60e4dbbd16e4c4c20c314764141c
271
js
JavaScript
app.js
Moosecoop/MooseBot2
6f947553cf050ed6ff7f9da96ee12946c19a2f8b
[ "MIT" ]
null
null
null
app.js
Moosecoop/MooseBot2
6f947553cf050ed6ff7f9da96ee12946c19a2f8b
[ "MIT" ]
null
null
null
app.js
Moosecoop/MooseBot2
6f947553cf050ed6ff7f9da96ee12946c19a2f8b
[ "MIT" ]
null
null
null
const komada = require('komada'); const token = require('./tokens.json'); komada.start({ botToken: token.discord, ownerID: '199621462586425346', clientID: '241714829788708864', prefix: 'm?', clientOptions: { fetchAllMembers: true, }, });
20.846154
39
0.634686
3b4591e66e949a4c9bd8ac3af28c41f3fdb26859
764
js
JavaScript
Userland/Libraries/LibWeb/Tests/DOM/document.documentElement.js
r00ster91/serenity
f8387dea2689d564aff612bfd4ec5086393fac35
[ "BSD-2-Clause" ]
19,438
2019-05-20T15:11:11.000Z
2022-03-31T23:31:32.000Z
Userland/Libraries/LibWeb/Tests/DOM/document.documentElement.js
r00ster91/serenity
f8387dea2689d564aff612bfd4ec5086393fac35
[ "BSD-2-Clause" ]
7,882
2019-05-20T01:03:52.000Z
2022-03-31T23:26:31.000Z
Userland/Libraries/LibWeb/Tests/DOM/document.documentElement.js
r00ster91/serenity
f8387dea2689d564aff612bfd4ec5086393fac35
[ "BSD-2-Clause" ]
2,721
2019-05-23T00:44:57.000Z
2022-03-31T22:49:34.000Z
describe("documentElement", () => { loadLocalPage("/res/html/misc/blank.html"); afterInitialPageLoad(page => { test("Basic functionality", () => { expect(page.document.documentElement).not.toBeNull(); // FIXME: Add this in once HTMLHtmlElement's constructor is implemented. //expect(document.documentElement).toBeInstanceOf(HTMLHtmlElement); expect(page.document.documentElement.nodeName).toBe("HTML"); }); // FIXME: Add this in once removeChild is implemented. test.skip("Nullable", () => { page.document.removeChild(page.document.documentElement); expect(page.document.documentElement).toBeNull(); }); }); waitForPageToLoad(); });
36.380952
84
0.624346
3b4607623999e0c419c6684ea25142f21690679d
85,107
js
JavaScript
public/template/js/helper-plugins.js
sharbel93/Lav_Hog
ed08e491063d4a9519c98e867ac28d116476584a
[ "MIT" ]
2
2017-07-29T04:19:13.000Z
2021-02-16T11:01:44.000Z
public/template/js/helper-plugins.js
sharbel93/Lav_Hog
ed08e491063d4a9519c98e867ac28d116476584a
[ "MIT" ]
null
null
null
public/template/js/helper-plugins.js
sharbel93/Lav_Hog
ed08e491063d4a9519c98e867ac28d116476584a
[ "MIT" ]
null
null
null
/* Debounce Resize */ (function(a){var d=a.event,b,c;b=d.special.debouncedresize={setup:function(){a(this).on("resize",b.handler)},teardown:function(){a(this).off("resize",b.handler)},handler:function(a,f){var g=this,h=arguments,e=function(){a.type="debouncedresize";d.dispatch.apply(g,h)};c&&clearTimeout(c);f?e():c=setTimeout(e,b.threshold)},threshold:150}})(jQuery); // Sticky Plugin v1.0.0 for jQuery // ============= // Author: Anthony Garand // Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk) // Improvements by Leonardo C. Daronco (daronco) // Created: 2/14/2011 // Date: 2/12/2012 // Website: http://labs.anthonygarand.com/sticky // Description: Makes an element on the page stick on the screen as you scroll // It will only set the 'top' and 'position' of your element, you // might need to adjust the width in some cases. (function($) { var defaults = { topSpacing: 0, bottomSpacing: 0, className: 'is-sticky', wrapperClassName: 'sticky-wrapper', center: false, getWidthFrom: '' }, $window = $(window), $document = $(document), sticked = [], windowHeight = $window.height(), scroller = function() { var scrollTop = $window.scrollTop(), documentHeight = $document.height(), dwh = documentHeight - windowHeight, extra = (scrollTop > dwh) ? dwh - scrollTop : 0; for (var i = 0; i < sticked.length; i++) { var s = sticked[i], elementTop = s.stickyWrapper.offset().top, etse = elementTop - s.topSpacing - extra; if (scrollTop <= etse) { if (s.currentTop !== null) { s.stickyElement .css('position', '') .css('top', ''); s.stickyElement.parent().removeClass(s.className); s.currentTop = null; } } else { var newTop = documentHeight - s.stickyElement.outerHeight() - s.topSpacing - s.bottomSpacing - scrollTop - extra; if (newTop < 0) { newTop = newTop + s.topSpacing; } else { newTop = s.topSpacing; } if (s.currentTop != newTop) { s.stickyElement .css('position', 'fixed') .css('top', newTop); if (typeof s.getWidthFrom !== 'undefined') { s.stickyElement.css('width', $(s.getWidthFrom).width()); } s.stickyElement.parent().addClass(s.className); s.currentTop = newTop; } } } }, resizer = function() { windowHeight = $window.height(); }, methods = { init: function(options) { var o = $.extend(defaults, options); return this.each(function() { var stickyElement = $(this); var stickyId = stickyElement.attr('id'); var wrapper = $('<div></div>') .attr('id', stickyId + '-sticky-wrapper') .addClass(o.wrapperClassName); stickyElement.wrapAll(wrapper); if (o.center) { stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"}); } if (stickyElement.css("float") == "right") { stickyElement.css({"float":"none"}).parent().css({"float":"right"}); } var stickyWrapper = stickyElement.parent(); stickyWrapper.css('height', stickyElement.outerHeight()); sticked.push({ topSpacing: o.topSpacing, bottomSpacing: o.bottomSpacing, stickyElement: stickyElement, currentTop: null, stickyWrapper: stickyWrapper, className: o.className, getWidthFrom: o.getWidthFrom }); }); }, update: scroller }; // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer): if (window.addEventListener) { window.addEventListener('scroll', scroller, false); window.addEventListener('resize', resizer, false); } else if (window.attachEvent) { window.attachEvent('onscroll', scroller); window.attachEvent('onresize', resizer); } $.fn.sticky = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method ) { return methods.init.apply( this, arguments ); } else { $.error('Method ' + method + ' does not exist on jQuery.sticky'); } }; $(function() { setTimeout(scroller, 0); }); })(jQuery); /** * Isotope v1.5.25 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * * Commercial use requires one-time license fee * http://metafizzy.co/#licenses * * Copyright 2012 David DeSandro / Metafizzy */ (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e<h;e++){c=g[e]+a;if(typeof b[c]=="string")return c}},i=h("transform"),j=h("transitionProperty"),k={csstransforms:function(){return!!i},csstransforms3d:function(){var a=!!h("perspective");if(a){var c=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d="@media ("+c.join("transform-3d),(")+"modernizr)",e=b("<style>"+d+"{#modernizr{height:3px}}"+"</style>").appendTo("head"),f=b('<div id="modernizr" />').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[j],r=h("transitionDuration"));var s=b.event,t=b.event.handle?"handle":"dispatch",u;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",u&&clearTimeout(u),u=setTimeout(function(){s[t].apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var v=["width","height"],w=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=v.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;f<g;f++)e=d[f],this.originalStyle[e]=c[e]||"";this.element.css(this.options.containerStyle),this._updateAnimationEngine(),this._updateUsingTransforms();var h={"original-order":function(a,b){return b.elemCount++,b.elemCount},random:function(){return Math.random()}};this.options.getSortData=b.extend(this.options.getSortData,h),this.reloadItems(),this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var i=this;setTimeout(function(){i.element.addClass(i.options.containerClass)},0),this.options.resizable&&w.bind("smartresize.isotope",function(){i.resize()}),this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(a){var b=this.options.itemSelector,c=b?a.filter(b).add(a.find(b)):a,d={position:"absolute"};return c=c.filter(function(a,b){return b.nodeType===1}),this.usingTransforms&&(d.left=0,d.top=0),c.css(d).addClass(this.options.itemClass),this.updateSortData(c,!0),c},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms),this._sort(),this.reLayout(a)},option:function(a){if(b.isPlainObject(a)){this.options=b.extend(!0,this.options,a);var c;for(var d in a)c="_update"+f(d),this[c]&&this[c]()}},_updateAnimationEngine:function(){var a=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,""),b;switch(a){case"css":case"none":b=!1;break;case"jquery":b=!0;break;default:b=!e.csstransitions}this.isUsingJQueryAnimation=b,this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var a=this.usingTransforms=this.options.transformsEnabled&&e.csstransforms&&e.csstransitions&&!this.isUsingJQueryAnimation;a||(delete this.options.hiddenStyle.scale,delete this.options.visibleStyle.scale),this.getPositionStyles=a?this._translate:this._positionAbs},_filter:function(a){var b=this.options.filter===""?"*":this.options.filter;if(!b)return a;var c=this.options.hiddenClass,d="."+c,e=a.filter(d),f=e;if(b!=="*"){f=e.filter(b);var g=a.not(d).not(b).addClass(c);this.styleQueue.push({$el:g,style:this.options.hiddenStyle})}return this.styleQueue.push({$el:f,style:this.options.visibleStyle}),f.removeClass(c),a.filter(b)},updateSortData:function(a,c){var d=this,e=this.options.getSortData,f,g;a.each(function(){f=b(this),g={};for(var a in e)!c&&a==="original-order"?g[a]=b.data(this,"isotope-sort-data")[a]:g[a]=e[a](f,d);b.data(this,"isotope-sort-data",g)})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,c=this.options.sortAscending?1:-1,d=function(d,e){var f=b(d,a),g=b(e,a);return f===g&&a!=="original-order"&&(f=b(d,"original-order"),g=b(e,"original-order")),(f>g?1:f<g?-1:0)*c};this.$filteredAtoms.sort(d)},_getSorter:function(a,c){return b.data(a,"isotope-sort-data")[c]},_translate:function(a,b){return{translate:[a,b]}},_positionAbs:function(a,b){return{left:a,top:b}},_pushPosition:function(a,b,c){b=Math.round(b+this.offset.left),c=Math.round(c+this.offset.top);var d=this.getPositionStyles(b,c);this.styleQueue.push({$el:a,style:d}),this.options.itemPositionDataEnabled&&a.data("isotope-item-position",{x:b,y:c})},layout:function(a,b){var c=this.options.layoutMode;this["_"+c+"Layout"](a);if(this.options.resizesContainer){var d=this["_"+c+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:d})}this._processStyleQueue(a,b),this.isLaidOut=!0},_processStyleQueue:function(a,c){var d=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",f=this.options.animationOptions,g=this.options.onLayout,h,i,j,k;i=function(a,b){b.$el[d](b.style,f)};if(this._isInserting&&this.isUsingJQueryAnimation)i=function(a,b){h=b.$el.hasClass("no-transition")?"css":d,b.$el[h](b.style,f)};else if(c||g||f.complete){var l=!1,m=[c,g,f.complete],n=this;j=!0,k=function(){if(l)return;var b;for(var c=0,d=m.length;c<d;c++)b=m[c],typeof b=="function"&&b.call(n.element,a,n);l=!0};if(this.isUsingJQueryAnimation&&d==="animate")f.complete=k,j=!1;else if(e.csstransitions){var o=0,p=this.styleQueue[0],s=p&&p.$el,t;while(!s||!s.length){t=this.styleQueue[o++];if(!t)return;s=t.$el}var u=parseFloat(getComputedStyle(s[0])[r]);u>0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){this.$allAtoms=this.$allAtoms.not(a),this.$filteredAtoms=this.$filteredAtoms.not(a);var c=this,d=function(){a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),w.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryPlaceBrick(a,g)}})},_masonryPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=this.masonry.columnWidth*d,h=c;this._pushPosition(a,g,h);var i=c+a.outerHeight(!0),j=this.masonry.cols+1-f;for(e=0;e<j;e++)this.masonry.colYs[d+e]=i},_masonryGetContainerSize:function(){var a=Math.max.apply(Math,this.masonry.colYs);return{height:a}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(a){var c=this,d=this.element.width(),e=this.fitRows;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.x!==0&&f+e.x>d&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.rowXs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryHorizontalPlaceBrick(a,g)}})},_masonryHorizontalPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=c,h=this.masonryHorizontal.rowHeight*d;this._pushPosition(a,g,h);var i=c+a.outerWidth(!0),j=this.masonryHorizontal.rows+1-f;for(e=0;e<j;e++)this.masonryHorizontal.rowXs[d+e]=i},_masonryHorizontalGetContainerSize:function(){var a=Math.max.apply(Math,this.masonryHorizontal.rowXs);return{width:a}},_masonryHorizontalResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_fitColumnsReset:function(){this.fitColumns={x:0,y:0,width:0}},_fitColumnsLayout:function(a){var c=this,d=this.element.height(),e=this.fitColumns;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.y!==0&&g+e.y>d&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var x=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){x("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){x("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); /* * Isotope custom layout mode that extends masonry in order to work with percentage-sized columns */ (function(window, $) { $.extend($.Isotope.prototype, { _sloppyMasonryReset : function() { // layout-specific props var containerSize = this.element.width(), segmentSize = this.options.sloppyMasonry && this.options.sloppyMasonry.columnWidth || // or use the size of the first item, i.e. outerWidth this.$filteredAtoms.outerWidth(true) || // if there's no items, use size of container containerSize; this.sloppyMasonry = { cols : Math.round(containerSize / segmentSize), columnWidth : segmentSize }; var i = this.sloppyMasonry.cols; this.sloppyMasonry.colYs = []; while (i--) { this.sloppyMasonry.colYs.push(0); } }, _sloppyMasonryLayout : function($elems) { var instance = this, props = instance.sloppyMasonry; $elems.each(function() { var $this = $(this), // how many columns does this brick span colSpan = Math.round($this.outerWidth(true) / props.columnWidth); colSpan = Math.min(colSpan, props.cols); if (colSpan === 1) { // if brick spans only one column, // just like singleMode instance._sloppyMasonryPlaceBrick($this, props.colYs); } else { // brick spans more than one column // how many different places could // this brick fit horizontally var groupCount = props.cols + 1 - colSpan, groupY = [], groupColY, i; // for each group potential // horizontal position for (i = 0; i < groupCount; i++) { // make an array of colY values // for that one group groupColY = props.colYs.slice(i, i + colSpan); // and get the max value of the // array groupY[i] = Math.max.apply(Math, groupColY); } instance._sloppyMasonryPlaceBrick($this, groupY); } }); }, _sloppyMasonryPlaceBrick : function($brick, setY) { // get the minimum Y value from the columns var minimumY = Math.min.apply(Math, setY), shortCol = 0; // Find index of short column, the first from the left for ( var i = 0, len = setY.length; i < len; i++) { if (setY[i] === minimumY) { shortCol = i; break; } } // position the brick var x = this.sloppyMasonry.columnWidth * shortCol, y = minimumY; this._pushPosition($brick, x, y); // apply setHeight to necessary columns var setHeight = minimumY + $brick.outerHeight(true), setSpan = this.sloppyMasonry.cols + 1 - len; for (i = 0; i < setSpan; i++) { this.sloppyMasonry.colYs[shortCol + i] = setHeight; } }, _sloppyMasonryGetContainerSize : function() { var containerHeight = Math.max.apply(Math, this.sloppyMasonry.colYs); return { height : containerHeight }; }, _sloppyMasonryResizeChanged : function() { return true; } }); })(this, this.jQuery); /* * touchSwipe - jQuery Plugin * https://github.com/mattbryson/TouchSwipe-Jquery-Plugin * http://labs.skinkers.com/touchSwipe/ * http://plugins.jquery.com/project/touchSwipe * * Copyright (c) 2010 Matt Bryson (www.skinkers.com) * Dual licensed under the MIT or GPL Version 2 licenses. * * $version: 1.3.3 */ (function(g){function P(c){if(c&&void 0===c.allowPageScroll&&(void 0!==c.swipe||void 0!==c.swipeStatus))c.allowPageScroll=G;c||(c={});c=g.extend({},g.fn.swipe.defaults,c);return this.each(function(){var b=g(this),f=b.data(w);f||(f=new W(this,c),b.data(w,f))})}function W(c,b){var f,p,r,s;function H(a){var a=a.originalEvent,c,Q=n?a.touches[0]:a;d=R;n?h=a.touches.length:a.preventDefault();i=0;j=null;k=0;!n||h===b.fingers||b.fingers===x?(r=f=Q.pageX,s=p=Q.pageY,y=(new Date).getTime(),b.swipeStatus&&(c= l(a,d))):t(a);if(!1===c)return d=m,l(a,d),c;e.bind(I,J);e.bind(K,L)}function J(a){a=a.originalEvent;if(!(d===q||d===m)){var c,e=n?a.touches[0]:a;f=e.pageX;p=e.pageY;u=(new Date).getTime();j=S();n&&(h=a.touches.length);d=z;var e=a,g=j;if(b.allowPageScroll===G)e.preventDefault();else{var o=b.allowPageScroll===T;switch(g){case v:(b.swipeLeft&&o||!o&&b.allowPageScroll!=M)&&e.preventDefault();break;case A:(b.swipeRight&&o||!o&&b.allowPageScroll!=M)&&e.preventDefault();break;case B:(b.swipeUp&&o||!o&&b.allowPageScroll!= N)&&e.preventDefault();break;case C:(b.swipeDown&&o||!o&&b.allowPageScroll!=N)&&e.preventDefault()}}h===b.fingers||b.fingers===x||!n?(i=U(),k=u-y,b.swipeStatus&&(c=l(a,d,j,i,k)),b.triggerOnTouchEnd||(e=!(b.maxTimeThreshold?!(k>=b.maxTimeThreshold):1),!0===D()?(d=q,c=l(a,d)):e&&(d=m,l(a,d)))):(d=m,l(a,d));!1===c&&(d=m,l(a,d))}}function L(a){a=a.originalEvent;a.preventDefault();u=(new Date).getTime();i=U();j=S();k=u-y;if(b.triggerOnTouchEnd||!1===b.triggerOnTouchEnd&&d===z)if(d=q,(h===b.fingers||b.fingers=== x||!n)&&0!==f){var c=!(b.maxTimeThreshold?!(k>=b.maxTimeThreshold):1);if((!0===D()||null===D())&&!c)l(a,d);else if(c||!1===D())d=m,l(a,d)}else d=m,l(a,d);else d===z&&(d=m,l(a,d));e.unbind(I,J,!1);e.unbind(K,L,!1)}function t(){y=u=p=f=s=r=h=0}function l(a,c){var d=void 0;b.swipeStatus&&(d=b.swipeStatus.call(e,a,c,j||null,i||0,k||0,h));if(c===m&&b.click&&(1===h||!n)&&(isNaN(i)||0===i))d=b.click.call(e,a,a.target);if(c==q)switch(b.swipe&&(d=b.swipe.call(e,a,j,i,k,h)),j){case v:b.swipeLeft&&(d=b.swipeLeft.call(e, a,j,i,k,h));break;case A:b.swipeRight&&(d=b.swipeRight.call(e,a,j,i,k,h));break;case B:b.swipeUp&&(d=b.swipeUp.call(e,a,j,i,k,h));break;case C:b.swipeDown&&(d=b.swipeDown.call(e,a,j,i,k,h))}(c===m||c===q)&&t(a);return d}function D(){return null!==b.threshold?i>=b.threshold:null}function U(){return Math.round(Math.sqrt(Math.pow(f-r,2)+Math.pow(p-s,2)))}function S(){var a;a=Math.atan2(p-s,r-f);a=Math.round(180*a/Math.PI);0>a&&(a=360-Math.abs(a));return 45>=a&&0<=a?v:360>=a&&315<=a?v:135<=a&&225>=a? A:45<a&&135>a?C:B}function V(){e.unbind(E,H);e.unbind(F,t);e.unbind(I,J);e.unbind(K,L)}var O=n||!b.fallbackToMouseEvents,E=O?"touchstart":"mousedown",I=O?"touchmove":"mousemove",K=O?"touchend":"mouseup",F="touchcancel",i=0,j=null,k=0,e=g(c),d="start",h=0,y=p=f=s=r=0,u=0;try{e.bind(E,H),e.bind(F,t)}catch(P){g.error("events not supported "+E+","+F+" on jQuery.swipe")}this.enable=function(){e.bind(E,H);e.bind(F,t);return e};this.disable=function(){V();return e};this.destroy=function(){V();e.data(w,null); return e}}var v="left",A="right",B="up",C="down",G="none",T="auto",M="horizontal",N="vertical",x="all",R="start",z="move",q="end",m="cancel",n="ontouchstart"in window,w="TouchSwipe";g.fn.swipe=function(c){var b=g(this),f=b.data(w);if(f&&"string"===typeof c){if(f[c])return f[c].apply(this,Array.prototype.slice.call(arguments,1));g.error("Method "+c+" does not exist on jQuery.swipe")}else if(!f&&("object"===typeof c||!c))return P.apply(this,arguments);return b};g.fn.swipe.defaults={fingers:1,threshold:75, maxTimeThreshold:null,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,click:null,triggerOnTouchEnd:!0,allowPageScroll:"auto",fallbackToMouseEvents:!0};g.fn.swipe.phases={PHASE_START:R,PHASE_MOVE:z,PHASE_END:q,PHASE_CANCEL:m};g.fn.swipe.directions={LEFT:v,RIGHT:A,UP:B,DOWN:C};g.fn.swipe.pageScroll={NONE:G,HORIZONTAL:M,VERTICAL:N,AUTO:T};g.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:x}})(jQuery); /* * jQuery throttle / debounce - v1.1 - 3/7/2010 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); /** * jQuery.LocalScroll - Animated scrolling navigation, using anchors. * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * Date: 3/11/2009 * @author Ariel Flesler * @version 1.2.7 **/ ;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery); /*! * jQuery imagesLoaded plugin v2.1.1 * http://github.com/desandro/imagesloaded * MIT License. by Paul Irish et al. */ (function(a,b){var c="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";a.fn.imagesLoaded=function(l){var i=this,n=a.isFunction(a.Deferred)?a.Deferred():0,m=a.isFunction(n.notify),f=i.find("img").add(i.filter("img")),g=[],k=[],h=[];if(a.isPlainObject(l)){a.each(l,function(o,p){if(o==="callback"){l=p}else{if(n){n[o](p)}}})}function j(){var o=a(k),p=a(h); if(n){if(h.length){n.reject(f,o,p)}else{n.resolve(f)}}if(a.isFunction(l)){l.call(i,f,o,p)}}function e(o){d(o.target,o.type==="error")}function d(o,p){if(o.src===c||a.inArray(o,g)!==-1){return}g.push(o);if(p){h.push(o)}else{k.push(o)}a.data(o,"imagesLoaded",{isBroken:p,src:o.src});if(m){n.notifyWith(a(o),[p,f,a(k),a(h)])}if(f.length===g.length){setTimeout(j);f.unbind(".imagesLoaded",e)}}if(!f.length){j()}else{f.bind("load.imagesLoaded error.imagesLoaded",e).each(function(o,q){var r=q.src;var p=a.data(q,"imagesLoaded"); if(p&&p.src===r){d(q,p.isBroken);return}if(q.complete&&q.naturalWidth!==b){d(q,q.naturalWidth===0||q.naturalHeight===0);return}if(q.readyState||q.complete){q.src=c;q.src=r}})}return n?n.promise(i):i}})(jQuery); /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ // usage: log('inside coolFunc', this, arguments); // paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ window.log = function f(){ log.history = log.history || []; log.history.push(arguments); if(this.console) { var args = arguments, newarr; args.callee = args.callee.caller; newarr = [].slice.call(args); if (typeof console.log === 'object') log.apply.call(console.log, console, newarr); else console.log.apply(console, newarr);}}; // make it safe to use console.log always (function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;!!(d=c.pop());){a[d]=a[d]||b;}}) (function(){try{console.log();return window.console;}catch(a){return (window.console={});}}()); /** * jQuery.browser.mobile (http://detectmobilebrowser.com/) * * jQuery.browser.mobile will be true if the browser is a mobile device * **/ (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera); /* * jQuery throttle / debounce - v1.1 - 3/7/2010 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); /* * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+ * http://cherne.net/brian/resources/jquery.hoverIntent.html */ (function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k; n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n) },j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery); /** * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * @author Ariel Flesler * @version 1.4.3.1 */ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); /* * Copyright (C) 2009 Joel Sutherland * Licenced under the MIT license * http://www.newmediacampaigns.com/page/jquery-flickr-plugin * * Available tags for templates: * title, link, date_taken, description, published, author, author_id, tags, image* */ (function($){$.fn.jflickrfeed=function(settings,callback){settings=$.extend(true,{flickrbase:'http://api.flickr.com/services/feeds/',feedapi:'photos_public.gne',limit:20,qstrings:{lang:'en-us',format:'json',jsoncallback:'?'},cleanDescription:true,useTemplate:true,itemTemplate:'',itemCallback:function(){}},settings);var url=settings.flickrbase+settings.feedapi+'?';var first=true;for(var key in settings.qstrings){if(!first) url+='&';url+=key+'='+settings.qstrings[key];first=false;} return $(this).each(function(){var $container=$(this);var container=this;$.getJSON(url,function(data){$.each(data.items,function(i,item){if(i<settings.limit){if(settings.cleanDescription){var regex=/<p>(.*?)<\/p>/g;var input=item.description;if(regex.test(input)){item.description=input.match(regex)[2] if(item.description!=undefined) item.description=item.description.replace('<p>','').replace('</p>','');}} item['image_s']=item.media.m.replace('_m','_s');item['image_t']=item.media.m.replace('_m','_t');item['image_m']=item.media.m.replace('_m','_m');item['image']=item.media.m.replace('_m','');item['image_b']=item.media.m.replace('_m','_b');delete item.media;if(settings.useTemplate){var template=settings.itemTemplate;for(var key in item){var rgx=new RegExp('{{'+key+'}}','g');template=template.replace(rgx,item[key]);} $container.append(template)} settings.itemCallback.call(container,item);}});if($.isFunction(callback)){callback.call(container,data);}});});}})(jQuery); /*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function (factory) { if (typeof define === 'function' && define.amd && define.amd.jQuery) { // AMD. Register as anonymous module. define(['jquery'], factory); } else { // Browser globals. factory(jQuery); } }(function ($) { var pluses = /\+/g; function raw(s) { return s; } function decoded(s) { return decodeURIComponent(s.replace(pluses, ' ')); } function converted(s) { if (s.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { return config.json ? JSON.parse(s) : s; } catch(er) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); var result = key ? undefined : {}; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = decode(parts.join('=')); if (key && key === name) { result = converted(cookie); break; } if (!key) { result[name] = converted(cookie); } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) !== undefined) { $.cookie(key, '', $.extend(options, { expires: -1 })); return true; } return false; }; })); /* * Swipe 2.0 * Brad Birdsall * Copyright 2013, MIT License * */ function Swipe(k,e){var f=function(){};var s=function(A){setTimeout(A||f,0)};var z={addEventListener:!!window.addEventListener,touch:("ontouchstart" in window)||window.DocumentTouch&&document instanceof DocumentTouch,transitions:(function(A){var C=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var B in C){if(A.style[C[B]]!==undefined){return true}}return false})(document.createElement("swipe"))};if(!k){return}var c=k.children[0];var q,d,p;e=e||{};var i=parseInt(e.startSlide,10)||0; var t=e.speed||300;e.continuous=e.continuous!==undefined?e.continuous:true;function l(){q=c.children;d=new Array(q.length);p=k.getBoundingClientRect().width||k.offsetWidth;c.style.width=(q.length*p)+"px";var B=q.length;while(B--){var A=q[B];A.style.width=p+"px";A.setAttribute("data-index",B);if(z.transitions){A.style.left=(B*-p)+"px";o(B,i>B?-p:(i<B?p:0),0)}}if(!z.transitions){c.style.left=(i*-p)+"px"}k.style.visibility="visible"}function m(){if(i){a(i-1)}else{if(e.continuous){a(q.length-1)}}}function n(){if(i<q.length-1){a(i+1) }else{if(e.continuous){a(0)}}}function a(D,A){if(i==D){return}if(z.transitions){var C=Math.abs(i-D)-1;var B=Math.abs(i-D)/(i-D);while(C--){o((D>i?D:i)-C-1,p*B,0)}o(i,p*B,A||t);o(D,0,A||t)}else{h(i*-p,D*-p,A||t)}i=D;s(e.callback&&e.callback(i,q[i]))}function o(A,C,B){j(A,C,B);d[A]=C}function j(B,E,D){var A=q[B];var C=A&&A.style;if(!C){return}C.webkitTransitionDuration=C.MozTransitionDuration=C.msTransitionDuration=C.OTransitionDuration=C.transitionDuration=D+"ms";C.webkitTransform="translate("+E+"px,0)translateZ(0)"; C.msTransform=C.MozTransform=C.OTransform="translateX("+E+"px)"}function h(E,D,A){if(!A){c.style.left=D+"px";return}var C=+new Date;var B=setInterval(function(){var F=+new Date-C;if(F>A){c.style.left=D+"px";if(y){v()}e.transitionEnd&&e.transitionEnd.call(event,i,q[i]);clearInterval(B);return}c.style.left=(((D-E)*(Math.floor((F/A)*100)/100))+E)+"px"},4)}var y=e.auto||0;var u;function v(){u=setTimeout(n,y)}function r(){y=0;clearTimeout(u)}var g={};var w={};var x;var b={handleEvent:function(A){switch(A.type){case"touchstart":this.start(A); break;case"touchmove":this.move(A);break;case"touchend":s(this.end(A));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":s(this.transitionEnd(A));break;case"resize":s(l.call());break}if(e.stopPropagation){A.stopPropagation()}},start:function(A){var B=A.touches[0];g={x:B.pageX,y:B.pageY,time:+new Date};x=undefined;w={};c.addEventListener("touchmove",this,false);c.addEventListener("touchend",this,false)},move:function(A){if(A.touches.length>1||A.scale&&A.scale!==1){return }if(e.disableScroll){A.preventDefault()}var B=A.touches[0];w={x:B.pageX-g.x,y:B.pageY-g.y};if(typeof x=="undefined"){x=!!(x||Math.abs(w.x)<Math.abs(w.y))}if(!x){A.preventDefault();r();w.x=w.x/((!i&&w.x>0||i==q.length-1&&w.x<0)?(Math.abs(w.x)/p+1):1);j(i-1,w.x+d[i-1],0);j(i,w.x+d[i],0);j(i+1,w.x+d[i+1],0)}},end:function(C){var E=+new Date-g.time;var B=Number(E)<250&&Math.abs(w.x)>20||Math.abs(w.x)>p/2;var A=!i&&w.x>0||i==q.length-1&&w.x<0;var D=w.x<0;if(!x){if(B&&!A){if(D){o(i-1,-p,0);o(i,d[i]-p,t); o(i+1,d[i+1]-p,t);i+=1}else{o(i+1,p,0);o(i,d[i]+p,t);o(i-1,d[i-1]+p,t);i+=-1}e.callback&&e.callback(i,q[i])}else{o(i-1,-p,t);o(i,0,t);o(i+1,p,t)}}c.removeEventListener("touchmove",b,false);c.removeEventListener("touchend",b,false)},transitionEnd:function(A){if(parseInt(A.target.getAttribute("data-index"),10)==i){if(y){v()}e.transitionEnd&&e.transitionEnd.call(A,i,q[i])}}};l();if(y){v()}if(z.addEventListener){if(z.touch){c.addEventListener("touchstart",b,false)}if(z.transitions){c.addEventListener("webkitTransitionEnd",b,false); c.addEventListener("msTransitionEnd",b,false);c.addEventListener("oTransitionEnd",b,false);c.addEventListener("otransitionend",b,false);c.addEventListener("transitionend",b,false)}window.addEventListener("resize",b,false)}else{window.onresize=function(){l()}}return{setup:function(){l()},slide:function(B,A){r();a(B,A)},prev:function(){r();m()},next:function(){r();n()},getPos:function(){return i},getNumSlides:function(){return q.length},kill:function(){r();c.style.width="auto";c.style.left=0;var B=q.length; while(B--){var A=q[B];A.style.width="100%";A.style.left=0;if(z.transitions){j(B,0,0)}}if(z.addEventListener){c.removeEventListener("touchstart",b,false);c.removeEventListener("webkitTransitionEnd",b,false);c.removeEventListener("msTransitionEnd",b,false);c.removeEventListener("oTransitionEnd",b,false);c.removeEventListener("otransitionend",b,false);c.removeEventListener("transitionend",b,false);window.removeEventListener("resize",b,false)}else{window.onresize=null}}}}if(window.jQuery||window.Zepto){(function(a){a.fn.Swipe=function(b){return this.each(function(){a(this).data("Swipe",new Swipe(a(this)[0],b)) })}})(window.jQuery||window.Zepto)}; /*! * FitVids 1.0 * Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ */ (function(a){a.fn.fitVids=function(b){var c={customSelector:null};var e=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0]; e.className="fit-vids-style";e.innerHTML="&shy;<style> .fluid-width-video-wrapper { width: 100%; position: relative; padding: 0; } .fluid-width-video-wrapper iframe, .fluid-width-video-wrapper object, .fluid-width-video-wrapper embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>"; d.parentNode.insertBefore(e,d);if(b){a.extend(c,b)}return this.each(function(){var f=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com']","object","embed"];if(c.customSelector){f.push(c.customSelector)}var g=a(this).find(f.join(","));g.each(function(){var l=a(this);if(this.tagName.toLowerCase()==="embed"&&l.parent("object").length||l.parent(".fluid-width-video-wrapper").length){return}var h=(this.tagName.toLowerCase()==="object"||(l.attr("height")&&!isNaN(parseInt(l.attr("height"),10))))?parseInt(l.attr("height"),10):l.height(),i=!isNaN(parseInt(l.attr("width"),10))?parseInt(l.attr("width"),10):l.width(),j=h/i; if(!l.attr("id")){var k="fitvid"+Math.floor(Math.random()*999999);l.attr("id",k)}l.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",(j*100)+"%");l.removeAttr("height").removeAttr("width")})})}})(jQuery); /* * jQuery Superfish Menu Plugin - v1.7.4 * Copyright (c) 2013 Joel Birch * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function(e){"use strict";var s=function(){var s={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},o=function(){var s=/iPhone|iPad|iPod/i.test(navigator.userAgent);return s&&e(window).load(function(){e("body").children().on("click",e.noop)}),s}(),n=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),t=function(e,o){var n=s.menuClass;o.cssArrows&&(n+=" "+s.menuArrowClass),e.toggleClass(n)},i=function(o,n){return o.find("li."+n.pathClass).slice(0,n.pathLevels).addClass(n.hoverClass+" "+s.bcClass).filter(function(){return e(this).children(n.popUpSelector).hide().show().length}).removeClass(n.pathClass)},r=function(e){e.children("a").toggleClass(s.anchorClass)},a=function(e){var s=e.css("ms-touch-action");s="pan-y"===s?"auto":"pan-y",e.css("ms-touch-action",s)},l=function(s,t){var i="li:has("+t.popUpSelector+")";e.fn.hoverIntent&&!t.disableHI?s.hoverIntent(u,p,i):s.on("mouseenter.superfish",i,u).on("mouseleave.superfish",i,p);var r="MSPointerDown.superfish";o||(r+=" touchend.superfish"),n&&(r+=" mousedown.superfish"),s.on("focusin.superfish","li",u).on("focusout.superfish","li",p).on(r,"a",t,h)},h=function(s){var o=e(this),n=o.siblings(s.data.popUpSelector);n.length>0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type?o.trigger("focus"):e.proxy(u,o.parent("li"))())},u=function(){var s=e(this),o=d(s);clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},p=function(){var s=e(this),n=d(s);o?e.proxy(f,s,n)():(clearTimeout(n.sfTimer),n.sfTimer=setTimeout(e.proxy(f,s,n),n.delay))},f=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(c(this)),s.$path.length&&e.proxy(u,s.$path)())},c=function(e){return e.closest("."+s.menuClass)},d=function(e){return c(e).data("sf-options")};return{hide:function(s){if(this.length){var o=this,n=d(o);if(!n)return this;var t=n.retainPath===!0?n.$path:"",i=o.find("li."+n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),r=n.speedOut;s&&(i.show(),r=0),n.retainPath=!1,n.onBeforeHide.call(i),i.stop(!0,!0).animate(n.animationOut,r,function(){var s=e(this);n.onHide.call(s)})}return this},show:function(){var e=d(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o),o.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(o)}),this},destroy:function(){return this.each(function(){var o,n=e(this),i=n.data("sf-options");return i?(o=n.find(i.popUpSelector).parent("li"),clearTimeout(i.sfTimer),t(n,i),r(o),a(n),n.off(".superfish").off(".hoverIntent"),o.children(i.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),i.$path.removeClass(i.hoverClass+" "+s.bcClass).addClass(i.pathClass),n.find("."+i.hoverClass).removeClass(i.hoverClass),i.onDestroy.call(n),n.removeData("sf-options"),void 0):!1})},init:function(o){return this.each(function(){var n=e(this);if(n.data("sf-options"))return!1;var h=e.extend({},e.fn.superfish.defaults,o),u=n.find(h.popUpSelector).parent("li");h.$path=i(n,h),n.data("sf-options",h),t(n,h),r(u),a(n),l(n,h),u.not("."+s.bcClass).superfish("hide",!0),h.onInit.call(this)})}}}();e.fn.superfish=function(o){return s[o]?s[o].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof o&&o?e.error("Method "+o+" does not exist on jQuery.fn.superfish"):s.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop},e.fn.extend({hideSuperfishUl:s.hide,showSuperfishUl:s.show})})(jQuery); /** * jQuery ScrollTo * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * @author Ariel Flesler * @version 1.4.3 */ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(!e)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); /** * Tweetie: A simple Twitter feed plugin * Author: Sonny T. <hi@sonnyt.com>, sonnyt.com */ (function($){$.fn.twittie=function(options){var settings=$.extend({'count':10,'hideReplies':false,'dateFormat':'%b/%d/%Y','template':'{{date}} - {{tweet}}'},options);var linking=function(tweet){var parts=tweet.split(' ');var twit='';for(var i=0,len=parts.length;i<len;i++){var text=parts[i];var link="https://twitter.com/#!/";if(text.indexOf('#')!==-1){text='<a href="'+link+'search/'+text.replace('#','%23').replace(/[^A-Za-z0-9]/,'')+'" target="_blank">'+text+'</a>'}if(text.indexOf('@')!==-1){text='<a href="'+link+text.replace('@','').replace(/[^A-Za-z0-9]/,'')+'" target="_blank">'+text+'</a>'}if(text.indexOf('http://')!==-1){text='<a href="'+text+'" target="_blank">'+text+'</a>'}twit+=text+' '}return twit};var dating=function(twt_date){var time=twt_date.split(' ');twt_date=new Date(Date.parse(time[1]+' '+time[2]+', '+time[5]+' '+time[3]+' UTC'));var months=['January','February','March','April','May','June','July','August','September','October','November','December'];var _date={'%d':twt_date.getDate(),'%m':twt_date.getMonth()+1,'%b':months[twt_date.getMonth()].substr(0,3),'%B':months[twt_date.getMonth()],'%y':String(twt_date.getFullYear()).slice(-2),'%Y':twt_date.getFullYear()};var date=settings.dateFormat;var format=settings.dateFormat.match(/%[dmbByY]/g);for(var i=0,len=format.length;i<len;i++){date=date.replace(format[i],_date[format[i]])}return date};var templating=function(data){var temp=settings.template;var temp_variables=['date','tweet','avatar'];for(var i=0,len=temp_variables.length;i<len;i++){temp=temp.replace(new RegExp('{{'+temp_variables[i]+'}}','gi'),data[temp_variables[i]])}return temp};this.html('<span>Loading...</span>');var that=this;$.getJSON('api/tweet.php',{count:settings.count,exclude_replies:settings.hideReplies},function(twt){that.find('span').fadeOut('fast',function(){that.html('<ul></ul>');for(var i=0;i<settings.count;i++){if(twt[i]){var temp_data={date:dating(twt[i].created_at),tweet:linking(twt[i].text),avatar:'<img src="'+twt[i].user.profile_image_url+'" />'};that.find('ul').append('<li>'+templating(temp_data)+'</li>')}else{break}}})})}})(jQuery); /* ============================================================== =============== Placeholder plugin ================================ ============================================================== */ (function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(t){var e;return t.value===t.getAttribute(S)&&"true"===t.getAttribute(I)?(t.setAttribute(I,"false"),t.value="",t.className=t.className.replace(R,""),e=t.getAttribute(P),e&&(t.type=e),!0):!1}function r(t){var e;return""===t.value?(t.setAttribute(I,"true"),t.value=t.getAttribute(S),t.className+=" "+k,e=t.getAttribute(P),e?t.type="text":"password"===t.type&&H.changeType(t,"text")&&t.setAttribute(P,"password"),!0):!1}function n(t,e){var r,n,a,u,i;if(t&&t.getAttribute(S))e(t);else for(r=t?t.getElementsByTagName("input"):r,n=t?t.getElementsByTagName("textarea"):n,i=0,u=r.length+n.length;u>i;i++)a=r.length>i?r[i]:n[i-r.length],e(a)}function a(t){n(t,e)}function u(t){n(t,r)}function i(t){return function(){f&&t.value===t.getAttribute(S)&&"true"===t.getAttribute(I)?H.moveCaret(t,0):e(t)}}function l(t){return function(){r(t)}}function c(t){return function(e){return p=t.value,"true"===t.getAttribute(I)?!(p===t.getAttribute(S)&&H.inArray(C,e.keyCode)):void 0}}function o(t){return function(){var e;"true"===t.getAttribute(I)&&t.value!==p&&(t.className=t.className.replace(R,""),t.value=t.value.replace(t.getAttribute(S),""),t.setAttribute(I,!1),e=t.getAttribute(P),e&&(t.type=e)),""===t.value&&(t.blur(),H.moveCaret(t,0))}}function s(t){return function(){t===document.activeElement&&t.value===t.getAttribute(S)&&"true"===t.getAttribute(I)&&H.moveCaret(t,0)}}function d(t){return function(){a(t)}}function g(t){t.form&&(x=t.form,x.getAttribute(U)||(H.addEventListener(x,"submit",d(x)),x.setAttribute(U,"true"))),H.addEventListener(t,"focus",i(t)),H.addEventListener(t,"blur",l(t)),f&&(H.addEventListener(t,"keydown",c(t)),H.addEventListener(t,"keyup",o(t)),H.addEventListener(t,"click",s(t))),t.setAttribute(j,"true"),t.setAttribute(S,y),r(t)}var v,b,f,h,p,m,A,y,E,x,T,N,L,w=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],B="#ccc",k="placeholdersjs",R=RegExp("\\b"+k+"\\b"),S="data-placeholder-value",I="data-placeholder-active",P="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",V="data-placeholder-focus",q="data-placeholder-live",z=document.createElement("input"),D=document.getElementsByTagName("head")[0],F=document.documentElement,G=t.Placeholders,H=G.Utils;if(void 0===z.placeholder){for(v=document.getElementsByTagName("input"),b=document.getElementsByTagName("textarea"),f="false"===F.getAttribute(V),h="false"!==F.getAttribute(q),m=document.createElement("style"),m.type="text/css",A=document.createTextNode("."+k+" { color:"+B+"; }"),m.styleSheet?m.styleSheet.cssText=A.nodeValue:m.appendChild(A),D.insertBefore(m,D.firstChild),L=0,N=v.length+b.length;N>L;L++)T=v.length>L?v[L]:b[L-v.length],y=T.getAttribute("placeholder"),y&&H.inArray(w,T.type)&&g(T);E=setInterval(function(){for(L=0,N=v.length+b.length;N>L;L++)T=v.length>L?v[L]:b[L-v.length],y=T.getAttribute("placeholder"),y&&H.inArray(w,T.type)&&(T.getAttribute(j)||g(T),(y!==T.getAttribute(S)||"password"===T.type&&!T.getAttribute(P))&&("password"===T.type&&!T.getAttribute(P)&&H.changeType(T,"text")&&T.setAttribute(P,"password"),T.value===T.getAttribute(S)&&(T.value=y),T.setAttribute(S,y)));h||clearInterval(E)},100)}G.disable=a,G.enable=u}(this); /* * jQuery.appear * https://github.com/bas2k/jquery.appear/ * http://code.google.com/p/jquery-appear/ * * Copyright (c) 2009 Michael Hixson * Copyright (c) 2012 Alexander Brovikov * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) */ (function($) { $.fn.appear = function(fn, options) { var settings = $.extend({ //arbitrary data to pass to fn data: undefined, //call fn only on the first appear? one: true, // X & Y accuracy accX: 0, accY: 0 }, options); return this.each(function() { var t = $(this); //whether the element is currently visible t.appeared = false; if (!fn) { //trigger the custom event t.trigger('appear', settings.data); return; } var w = $(window); //fires the appear event when appropriate var check = function() { //is the element hidden? if (!t.is(':visible')) { //it became hidden t.appeared = false; return; } //is the element inside the visible window? var a = w.scrollLeft(); var b = w.scrollTop(); var o = t.offset(); var x = o.left; var y = o.top; var ax = settings.accX; var ay = settings.accY; var th = t.height(); var wh = w.height(); var tw = t.width(); var ww = w.width(); if (y + th + ay >= b && y <= b + wh + ay && x + tw + ax >= a && x <= a + ww + ax) { //trigger the custom event if (!t.appeared) t.trigger('appear', settings.data); } else { //it scrolled out of view t.appeared = false; } }; //create a modified fn with some additional logic var modifiedFn = function() { //mark the element as visible t.appeared = true; //is this supposed to happen only once? if (settings.one) { //remove the check w.unbind('scroll', check); var i = $.inArray(check, $.fn.appear.checks); if (i >= 0) $.fn.appear.checks.splice(i, 1); } //trigger the original fn fn.apply(this, arguments); }; //bind the modified fn to the element if (settings.one) t.one('appear', settings.data, modifiedFn); else t.bind('appear', settings.data, modifiedFn); //check whenever the window scrolls w.scroll(check); //check whenever the dom changes $.fn.appear.checks.push(check); //check now (check)(); }); }; //keep a queue of appearance checks $.extend($.fn.appear, { checks: [], timeout: null, //process the queue checkAll: function() { var length = $.fn.appear.checks.length; if (length > 0) while (length--) ($.fn.appear.checks[length])(); }, //check the queue asynchronously run: function() { if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout); $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20); } }); //run checks when these methods are called $.each(['append', 'prepend', 'after', 'before', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'remove', 'css', 'show', 'hide'], function(i, n) { var old = $.fn[n]; if (old) { $.fn[n] = function() { var r = old.apply(this, arguments); $.fn.appear.run(); return r; } } }); })(jQuery); /* Plugin: jQuery Parallax Version 1.1.3 Author: Ian Lunn Twitter: @IanLunn Author URL: http://www.ianlunn.co.uk/ Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html */ (function( $ ){ var $window = $(window); var windowHeight = $window.height(); $window.resize(function () { windowHeight = $window.height(); }); $.fn.parallax = function(xpos, speedFactor, outerHeight) { var $this = $(this); var getHeight; var firstTop; var paddingTop = 0; //get the starting position of each element to have parallax applied to it function update (){ $this.each(function(){ firstTop = $this.offset().top; }); if (outerHeight) { getHeight = function(jqo) { return jqo.outerHeight(true); }; } else { getHeight = function(jqo) { return jqo.height(); }; } // setup defaults if arguments aren't specified if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.5; if (arguments.length < 3 || outerHeight === null) outerHeight = true; // function to be called whenever the window is scrolled or resized var pos = $window.scrollTop(); $this.each(function(){ var $element = $(this); var top = $element.offset().top; var height = getHeight($element); // Check if totally above or totally below viewport if (top + height < pos || top > pos + windowHeight) { return; } $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); }); } $window.bind('scroll', update).resize(update); update(); }; })(jQuery); /* Plugin Name: Count To Written by: Matt Huggins - https://github.com/mhuggins/jquery-countTo */ (function ($) { $.fn.countTo = function (options) { options = options || {}; return $(this).each(function () { // set options for current element var settings = $.extend({}, $.fn.countTo.defaults, { from: $(this).data('from'), to: $(this).data('to'), speed: $(this).data('speed'), refreshInterval: $(this).data('refresh-interval'), decimals: $(this).data('decimals') }, options); // how many times to update the value, and how much to increment the value on each update var loops = Math.ceil(settings.speed / settings.refreshInterval), increment = (settings.to - settings.from) / loops; // references & variables that will change with each update var self = this, $self = $(this), loopCount = 0, value = settings.from, data = $self.data('countTo') || {}; $self.data('countTo', data); // if an existing interval can be found, clear it first if (data.interval) { clearInterval(data.interval); } data.interval = setInterval(updateTimer, settings.refreshInterval); // initialize the element with the starting value render(value); function updateTimer() { value += increment; loopCount++; render(value); if (typeof(settings.onUpdate) == 'function') { settings.onUpdate.call(self, value); } if (loopCount >= loops) { // remove the interval $self.removeData('countTo'); clearInterval(data.interval); value = settings.to; if (typeof(settings.onComplete) == 'function') { settings.onComplete.call(self, value); } } } function render(value) { var formattedValue = settings.formatter.call(self, value, settings); $self.html(formattedValue); } }); }; $.fn.countTo.defaults = { from: 0, // the number the element should start at to: 0, // the number the element should end at speed: 1000, // how long it should take to count between the target numbers refreshInterval: 100, // how often the element should be updated decimals: 0, // the number of decimal places to show formatter: formatter, // handler for formatting the value before rendering onUpdate: null, // callback method for every time the element is updated onComplete: null // callback method for when the element finishes updating }; function formatter(value, settings) { return value.toFixed(settings.decimals); } }(jQuery)); /*! * jQuery Transit - CSS3 transitions and transformations * (c) 2011-2012 Rico Sta. Cruz <rico@ricostacruz.com> * MIT Licensed. * * http://ricostacruz.com/jquery.transit * http://github.com/rstacruz/jquery.transit */ (function(d){function m(a){if(a in j.style)return a;var b=["Moz","Webkit","O","ms"],c=a.charAt(0).toUpperCase()+a.substr(1);if(a in j.style)return a;for(a=0;a<b.length;++a){var d=b[a]+c;if(d in j.style)return d}}function l(a){"string"===typeof a&&this.parse(a);return this}function q(a,b,c,e){var h=[];d.each(a,function(a){a=d.camelCase(a);a=d.transit.propertyMap[a]||d.cssProps[a]||a;a=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()});-1===d.inArray(a,h)&&h.push(a)});d.cssEase[c]&&(c=d.cssEase[c]); var f=""+n(b)+" "+c;0<parseInt(e,10)&&(f+=" "+n(e));var g=[];d.each(h,function(a,b){g.push(b+" "+f)});return g.join(", ")}function f(a,b){b||(d.cssNumber[a]=!0);d.transit.propertyMap[a]=e.transform;d.cssHooks[a]={get:function(b){return d(b).css("transit:transform").get(a)},set:function(b,e){var h=d(b).css("transit:transform");h.setFromString(a,e);d(b).css({"transit:transform":h})}}}function g(a,b){return"string"===typeof a&&!a.match(/^[\-0-9\.]+$/)?a:""+a+b}function n(a){d.fx.speeds[a]&&(a=d.fx.speeds[a]); return g(a,"ms")}d.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var j=document.createElement("div"),e={},r=-1<navigator.userAgent.toLowerCase().indexOf("chrome");e.transition=m("transition");e.transitionDelay=m("transitionDelay");e.transform=m("transform");e.transformOrigin=m("transformOrigin");j.style[e.transform]= "";j.style[e.transform]="rotateY(90deg)";e.transform3d=""!==j.style[e.transform];var p=e.transitionEnd={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"}[e.transition]||null,k;for(k in e)e.hasOwnProperty(k)&&"undefined"===typeof d.support[k]&&(d.support[k]=e[k]);j=null;d.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)", easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)", easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};d.cssHooks["transit:transform"]={get:function(a){return d(a).data("transform")|| new l},set:function(a,b){var c=b;c instanceof l||(c=new l(c));a.style[e.transform]="WebkitTransform"===e.transform&&!r?c.toString(!0):c.toString();d(a).data("transform",c)}};d.cssHooks.transform={set:d.cssHooks["transit:transform"].set};"1.8">d.fn.jquery&&(d.cssHooks.transformOrigin={get:function(a){return a.style[e.transformOrigin]},set:function(a,b){a.style[e.transformOrigin]=b}},d.cssHooks.transition={get:function(a){return a.style[e.transition]},set:function(a,b){a.style[e.transition]=b}});f("scale"); f("translate");f("rotate");f("rotateX");f("rotateY");f("rotate3d");f("perspective");f("skewX");f("skewY");f("x",!0);f("y",!0);l.prototype={setFromString:function(a,b){var c="string"===typeof b?b.split(","):b.constructor===Array?b:[b];c.unshift(a);l.prototype.set.apply(this,c)},set:function(a){var b=Array.prototype.slice.apply(arguments,[1]);this.setter[a]?this.setter[a].apply(this,b):this[a]=b.join(",")},get:function(a){return this.getter[a]?this.getter[a].apply(this):this[a]||0},setter:{rotate:function(a){this.rotate= g(a,"deg")},rotateX:function(a){this.rotateX=g(a,"deg")},rotateY:function(a){this.rotateY=g(a,"deg")},scale:function(a,b){void 0===b&&(b=a);this.scale=a+","+b},skewX:function(a){this.skewX=g(a,"deg")},skewY:function(a){this.skewY=g(a,"deg")},perspective:function(a){this.perspective=g(a,"px")},x:function(a){this.set("translate",a,null)},y:function(a){this.set("translate",null,a)},translate:function(a,b){void 0===this._translateX&&(this._translateX=0);void 0===this._translateY&&(this._translateY=0); null!==a&&void 0!==a&&(this._translateX=g(a,"px"));null!==b&&void 0!==b&&(this._translateY=g(b,"px"));this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var a=(this.scale||"1,1").split(",");a[0]&&(a[0]=parseFloat(a[0]));a[1]&&(a[1]=parseFloat(a[1]));return a[0]===a[1]?a[0]:a},rotate3d:function(){for(var a=(this.rotate3d||"0,0,0,0deg").split(","),b=0;3>=b;++b)a[b]&&(a[b]=parseFloat(a[b])); a[3]&&(a[3]=g(a[3],"deg"));return a}},parse:function(a){var b=this;a.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(a,d,e){b.setFromString(d,e)})},toString:function(a){var b=[],c;for(c in this)if(this.hasOwnProperty(c)&&(e.transform3d||!("rotateX"===c||"rotateY"===c||"perspective"===c||"transformOrigin"===c)))"_"!==c[0]&&(a&&"scale"===c?b.push(c+"3d("+this[c]+",1)"):a&&"translate"===c?b.push(c+"3d("+this[c]+",0)"):b.push(c+"("+this[c]+")"));return b.join(" ")}};d.fn.transition=d.fn.transit=function(a, b,c,f){var h=this,g=0,j=!0;"function"===typeof b&&(f=b,b=void 0);"function"===typeof c&&(f=c,c=void 0);"undefined"!==typeof a.easing&&(c=a.easing,delete a.easing);"undefined"!==typeof a.duration&&(b=a.duration,delete a.duration);"undefined"!==typeof a.complete&&(f=a.complete,delete a.complete);"undefined"!==typeof a.queue&&(j=a.queue,delete a.queue);"undefined"!==typeof a.delay&&(g=a.delay,delete a.delay);"undefined"===typeof b&&(b=d.fx.speeds._default);"undefined"===typeof c&&(c=d.cssEase._default); b=n(b);var l=q(a,b,c,g),k=d.transit.enabled&&e.transition?parseInt(b,10)+parseInt(g,10):0;if(0===k)return b=j,c=function(b){h.css(a);f&&f.apply(h);b&&b()},!0===b?h.queue(c):b?h.queue(b,c):c(),h;var m={};b=j;c=function(b){this.offsetWidth;var c=!1,g=function(){c&&h.unbind(p,g);0<k&&h.each(function(){this.style[e.transition]=m[this]||null});"function"===typeof f&&f.apply(h);"function"===typeof b&&b()};0<k&&p&&d.transit.useTransitionEnd?(c=!0,h.bind(p,g)):window.setTimeout(g,k);h.each(function(){0<k&& (this.style[e.transition]=l);d(this).css(a)})};!0===b?h.queue(c):b?h.queue(b,c):c();return this};d.transit.getTransitionValue=q})(jQuery); /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.0.6 * * Requires: 1.2.2+ */ (function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
82.950292
15,714
0.665127
3b4621b4259558bb10109e413322058d545468c0
1,957
js
JavaScript
ClientApp/permission.js
JamesToan/QLTASK
2a160ed0b46345a018e8cf2e188c228d789cd378
[ "MIT" ]
null
null
null
ClientApp/permission.js
JamesToan/QLTASK
2a160ed0b46345a018e8cf2e188c228d789cd378
[ "MIT" ]
null
null
null
ClientApp/permission.js
JamesToan/QLTASK
2a160ed0b46345a018e8cf2e188c228d789cd378
[ "MIT" ]
null
null
null
import router from "./router"; import store from "./store"; import { getToken, removeToken, setRole } from "./store/common"; // getToken from cookie import { requestGetInfo, requestGetProfile } from "./store/api"; import firebase from "firebase"; const whiteList = ["/admin/login", "/admin/signup"]; // no redirect whitelist const mainTitle = "Quản lý yêu cầu"; router.beforeEach((to, from, next) => { //console.log(getToken() === undefined) //console.log(getToken()); if (getToken() === undefined) { if (whiteList.indexOf(to.path) !== -1) { document.title = mainTitle + " - " + to.meta.display; next(); } else { next("/admin/login"); } } else { if (store.state.name == "") { // firebase.auth().onAuthStateChanged(user => { // if (user) { // // User is signed in, see docs for a list of available properties // // https://firebase.google.com/docs/reference/js/firebase.User // requestGetProfile(user.email).then(data => { // if (data !== undefined) { // store.commit("SET_NAME", data.UserName); // store.commit("SET_ROLE", data.RoleId); // setRole(data.RoleId); // document.title = mainTitle + " - " + to.meta.display; // next(); // } // }); // } else { // // User is signed out // removeToken(); // next("/admin/login"); // } // }); requestGetInfo().then(data => { if (data !== undefined) { store.commit("SET_NAME", data.UserName); store.commit("SET_ROLE", data.RoleId); setRole(data.RoleId); document.title = mainTitle + " - " + to.meta.display; next(); } else { removeToken(); next("/admin/login"); } }); } else { document.title = mainTitle + " - " + to.meta.display; next(); } } });
34.333333
88
0.524783
3b465c93b4569a32914b07d8b92c6a65ad55e3f1
948
js
JavaScript
routes/peserta/FindjawabanController.js
noorqidam/api_tryout
1df45b1c6a3b4262ee7b07025e4bc9d3814de88d
[ "Apache-2.0" ]
null
null
null
routes/peserta/FindjawabanController.js
noorqidam/api_tryout
1df45b1c6a3b4262ee7b07025e4bc9d3814de88d
[ "Apache-2.0" ]
null
null
null
routes/peserta/FindjawabanController.js
noorqidam/api_tryout
1df45b1c6a3b4262ee7b07025e4bc9d3814de88d
[ "Apache-2.0" ]
null
null
null
'use strict' const express = require('express'); const router = express.Router(); const { JawabanUjian } = require('../../models/mongoose/JawabanUjian'); /** * Check Jawaban Exist In Ujian , Sesi and User */ router.get('/', async(req,res) => { try { let auth = req.auth; let sesi = req.query.sesi_id let soal_id = req.query.soal_id const SOAL_UJIAN = await JawabanUjian.findOne({ sesi_id: sesi, soal_id:soal_id ,email:auth.email},'ujian_id soal_id jawaban._id') if (SOAL_UJIAN) { return res.status(200).json({ success : 'true', message :'Data Di Temukan', data :SOAL_UJIAN }); } else { return res.status(200).json({ success : 'false', message :'Data Tidak Di Temukan' }); } } catch (error) { console.log(error) return res.status(500).json({ success : 'false', message :error }); } }) module.exports = router;
23.7
133
0.593882
3b4709259aa3b32a2c270259e89d4def723dd14b
10,314
js
JavaScript
src/store/data.js
ZenUml/ZenUml.github.io
db9e2c4040ec6d192d8c45b4b91e527e6e070303
[ "Apache-2.0" ]
24
2017-09-29T09:49:54.000Z
2021-05-05T08:18:01.000Z
src/store/data.js
ZenUml/ZenUml.github.io
db9e2c4040ec6d192d8c45b4b91e527e6e070303
[ "Apache-2.0" ]
2
2017-11-09T21:43:08.000Z
2019-05-09T05:03:08.000Z
src/store/data.js
ZenUml/ZenUml.github.io
db9e2c4040ec6d192d8c45b4b91e527e6e070303
[ "Apache-2.0" ]
2
2017-09-29T01:54:41.000Z
2019-01-03T06:46:53.000Z
import Vue from 'vue'; import yaml from 'js-yaml'; import utils from '../services/utils'; import defaultWorkspaces from '../data/defaultWorkspaces'; import defaultSettings from '../data/defaultSettings.yml'; import defaultLocalSettings from '../data/defaultLocalSettings'; import defaultLayoutSettings from '../data/defaultLayoutSettings'; import plainHtmlTemplate from '../data/plainHtmlTemplate.html'; import styledHtmlTemplate from '../data/styledHtmlTemplate.html'; import styledHtmlWithTocTemplate from '../data/styledHtmlWithTocTemplate.html'; import jekyllSiteTemplate from '../data/jekyllSiteTemplate.html'; const itemTemplate = (id, data = {}) => ({ id, type: 'data', data, hash: 0 }); const empty = (id) => { switch (id) { case 'workspaces': return itemTemplate(id, defaultWorkspaces()); case 'settings': return itemTemplate(id, '\n'); case 'localSettings': return itemTemplate(id, defaultLocalSettings()); case 'layoutSettings': return itemTemplate(id, defaultLayoutSettings()); default: return itemTemplate(id); } }; // Item IDs that will be stored in the localStorage const lsItemIdSet = new Set(utils.localStorageDataIds); // Getter/setter/patcher factories const getter = id => state => ((lsItemIdSet.has(id) ? state.lsItemMap : state.itemMap)[id] || {}).data || empty(id).data; const setter = id => ({ commit }, data) => commit('setItem', itemTemplate(id, data)); const patcher = id => ({ state, commit }, data) => { const item = Object.assign(empty(id), (lsItemIdSet.has(id) ? state.lsItemMap : state.itemMap)[id]); commit('setItem', { ...empty(id), data: typeof data === 'object' ? { ...item.data, ...data, } : data, }); }; // For layoutSettings const layoutSettingsToggler = propertyName => ({ getters, dispatch }, value) => dispatch('patchLayoutSettings', { [propertyName]: value === undefined ? !getters.layoutSettings[propertyName] : value, }); const notEnoughSpace = (getters) => { const constants = getters['layout/constants']; const showGutter = getters['discussion/currentDiscussion']; return document.body.clientWidth < constants.editorMinWidth + constants.explorerWidth + constants.sideBarWidth + constants.buttonBarWidth + (showGutter ? constants.gutterWidth : 0); }; // For templates const makeAdditionalTemplate = (name, value, helpers = '\n') => ({ name, value, helpers, isAdditional: true, }); const additionalTemplates = { plainText: makeAdditionalTemplate('Plain text', '{{{files.0.content.text}}}'), plainHtml: makeAdditionalTemplate('Plain HTML', plainHtmlTemplate), styledHtml: makeAdditionalTemplate('Styled HTML', styledHtmlTemplate), styledHtmlWithToc: makeAdditionalTemplate('Styled HTML with TOC', styledHtmlWithTocTemplate), jekyllSite: makeAdditionalTemplate('Jekyll site', jekyllSiteTemplate), }; // For tokens const tokenSetter = providerId => ({ getters, dispatch }, token) => { dispatch('patchTokens', { [providerId]: { ...getters[`${providerId}Tokens`], [token.sub]: token, }, }); }; // For workspaces const urlParser = window.document.createElement('a'); export default { namespaced: true, state: { // Data items stored in the DB itemMap: {}, // Data items stored in the localStorage lsItemMap: {}, }, mutations: { setItem: (state, value) => { // Create an empty item and override its data field const emptyItem = empty(value.id); const data = typeof value.data === 'object' ? Object.assign(emptyItem.data, value.data) : value.data; // Make item with hash const item = utils.addItemHash({ ...emptyItem, data, }); // Store item in itemMap or lsItemMap if its stored in the localStorage Vue.set(lsItemIdSet.has(item.id) ? state.lsItemMap : state.itemMap, item.id, item); }, }, getters: { workspaces: getter('workspaces'), sanitizedWorkspaces: (state, getters, rootState, rootGetters) => { const sanitizedWorkspaces = {}; const mainWorkspaceToken = rootGetters['workspace/mainWorkspaceToken']; Object.entries(getters.workspaces).forEach(([id, workspace]) => { const sanitizedWorkspace = { id, providerId: mainWorkspaceToken && 'googleDriveAppData', sub: mainWorkspaceToken && mainWorkspaceToken.sub, ...workspace, }; // Rebuild the url with current hostname urlParser.href = workspace.url || 'app'; const params = utils.parseQueryParams(urlParser.hash.slice(1)); sanitizedWorkspace.url = utils.addQueryParams('app', params, true); sanitizedWorkspaces[id] = sanitizedWorkspace; }); return sanitizedWorkspaces; }, settings: getter('settings'), computedSettings: (state, getters) => { const customSettings = yaml.safeLoad(getters.settings); const settings = yaml.safeLoad(defaultSettings); const override = (obj, opt) => { const objType = Object.prototype.toString.call(obj); const optType = Object.prototype.toString.call(opt); if (objType !== optType) { return obj; } else if (objType !== '[object Object]') { return opt; } Object.keys(obj).forEach((key) => { if (key === 'shortcuts') { obj[key] = Object.assign(obj[key], opt[key]); } else { obj[key] = override(obj[key], opt[key]); } }); return obj; }; return override(settings, customSettings); }, localSettings: getter('localSettings'), layoutSettings: getter('layoutSettings'), templates: getter('templates'), allTemplates: (state, getters) => ({ ...getters.templates, ...additionalTemplates, }), lastOpened: getter('lastOpened'), lastOpenedIds: (state, getters, rootState) => { const lastOpened = { ...getters.lastOpened, }; const currentFileId = rootState.file.currentId; if (currentFileId && !lastOpened[currentFileId]) { lastOpened[currentFileId] = Date.now(); } return Object.keys(lastOpened) .filter(id => rootState.file.itemMap[id]) .sort((id1, id2) => lastOpened[id2] - lastOpened[id1]) .slice(0, 20); }, syncData: getter('syncData'), syncDataByItemId: (state, getters) => { const result = {}; Object.entries(getters.syncData).forEach(([, value]) => { result[value.itemId] = value; }); return result; }, syncDataByType: (state, getters) => { const result = {}; utils.types.forEach((type) => { result[type] = {}; }); Object.entries(getters.syncData).forEach(([, item]) => { if (result[item.type]) { result[item.type][item.itemId] = item; } }); return result; }, dataSyncData: getter('dataSyncData'), tokens: getter('tokens'), googleTokens: (state, getters) => getters.tokens.google || {}, dropboxTokens: (state, getters) => getters.tokens.dropbox || {}, githubTokens: (state, getters) => getters.tokens.github || {}, wordpressTokens: (state, getters) => getters.tokens.wordpress || {}, zendeskTokens: (state, getters) => getters.tokens.zendesk || {}, }, actions: { setWorkspaces: setter('workspaces'), patchWorkspaces: patcher('workspaces'), setSettings: setter('settings'), patchLocalSettings: patcher('localSettings'), patchLayoutSettings: patcher('layoutSettings'), toggleNavigationBar: layoutSettingsToggler('showNavigationBar'), toggleEditor: layoutSettingsToggler('showEditor'), toggleSidePreview: layoutSettingsToggler('showSidePreview'), toggleStatusBar: layoutSettingsToggler('showStatusBar'), toggleScrollSync: layoutSettingsToggler('scrollSync'), toggleFocusMode: layoutSettingsToggler('focusMode'), toggleSideBar: ({ commit, getters, dispatch, rootGetters }, value) => { // Reset side bar dispatch('setSideBarPanel'); // Close explorer if not enough space const patch = { showSideBar: value === undefined ? !getters.layoutSettings.showSideBar : value, }; if (patch.showSideBar && notEnoughSpace(rootGetters)) { patch.showExplorer = false; } dispatch('patchLayoutSettings', patch); }, toggleExplorer: ({ commit, getters, dispatch, rootGetters }, value) => { // Close side bar if not enough space const patch = { showExplorer: value === undefined ? !getters.layoutSettings.showExplorer : value, }; if (patch.showExplorer && notEnoughSpace(rootGetters)) { patch.showSideBar = false; } dispatch('patchLayoutSettings', patch); }, setSideBarPanel: ({ dispatch }, value) => dispatch('patchLayoutSettings', { sideBarPanel: value === undefined ? 'menu' : value, }), setTemplates: ({ commit }, data) => { const dataToCommit = { ...data, }; // We don't store additional templates Object.keys(additionalTemplates).forEach((id) => { delete dataToCommit[id]; }); commit('setItem', itemTemplate('templates', dataToCommit)); }, setLastOpenedId: ({ getters, commit, dispatch, rootState }, fileId) => { const lastOpened = { ...getters.lastOpened }; lastOpened[fileId] = Date.now(); commit('setItem', itemTemplate('lastOpened', lastOpened)); dispatch('cleanLastOpenedId'); }, cleanLastOpenedId: ({ getters, commit, rootState }) => { const lastOpened = {}; const oldLastOpened = getters.lastOpened; Object.entries(oldLastOpened).forEach(([fileId, date]) => { if (rootState.file.itemMap[fileId]) { lastOpened[fileId] = date; } }); commit('setItem', itemTemplate('lastOpened', lastOpened)); }, setSyncData: setter('syncData'), patchSyncData: patcher('syncData'), patchDataSyncData: patcher('dataSyncData'), patchTokens: patcher('tokens'), setGoogleToken: tokenSetter('google'), setDropboxToken: tokenSetter('dropbox'), setGithubToken: tokenSetter('github'), setWordpressToken: tokenSetter('wordpress'), setZendeskToken: tokenSetter('zendesk'), }, };
36.062937
113
0.642525
3b470ef3fe60bfb4a2247b41b9ae1b634ed7df4c
3,167
js
JavaScript
public/template/js/permintaan_data.js
imam-crypto/Pos
62b8d5725985afd66b29d0e023e946c787e81dc0
[ "MIT" ]
null
null
null
public/template/js/permintaan_data.js
imam-crypto/Pos
62b8d5725985afd66b29d0e023e946c787e81dc0
[ "MIT" ]
null
null
null
public/template/js/permintaan_data.js
imam-crypto/Pos
62b8d5725985afd66b29d0e023e946c787e81dc0
[ "MIT" ]
null
null
null
const URL = BASE_URL + "lanjutan/PermintaanData/proses_tambah"; const URI = BASE_URL + "lanjutan/PermintaanData/proses_update"; const URS = BASE_URL + "lanjutan/PermintaanData/"; // $('#sel').change(function (e) { // let id = $(this).data('id_penugasan'); // console.log(id); // }) $('#btnTambah').click(() => { let tr = ` <tr> <td> <div class="form-group form-md-line-input has-success form-md-floating-label"> <div class="input-icon"> <input type="text" class="form-control" name="data[]"> <label for="form_control_1">Data</label> <span class="help-block">Data</span> <i class="fa fa-bell-o"></i> </div> </div> </td> <td style="width: 10%; text-align: center;"> <button class="btn red removeAjah" type="button"><i class="fa fa-minus"></i> </button> </td> </tr> ` $('#tabelPermintaan tbody').append(tr); }) $('#tabelPermintaan tbody').on('click', '.removeAjah', function(e) { $(this).closest('tr').remove(); }) $('#btnTunda').click(() => { var ddd = new FormData(frmPermintaan) console.log(ddd) fetch(URL, { method: 'POST', body: new FormData(frmPermintaan), }) .then(responseJson => responseJson.json()) .then(resultJson => { if (resultJson.success = true) { window.location.href = BASE_URL + "lanjutan/PermintaanData/index" }; }) }) $('#btnLampiran').click(() => { var ddd = new FormData(frmLampiran) console.log(ddd) fetch(URL, { method: 'POST', body: new FormData(frmLampiran), }) .then(responseJson => responseJson.json()) .then(resultJson => { if (resultJson.success = true) { window.location.href = BASE_URL + "lanjutan/PermintaanData/index" }; }) }) $('#btnUpdate').click(() => { var ddd = new FormData(frmUpdate) console.log(ddd) fetch(URI, { method: 'POST', body: new FormData(frmUpdate), }) .then(responseJson => responseJson.json()) .then(resultJson => { if (resultJson.success = true) { window.location.href = BASE_URL + "lanjutan/PermintaanData/index" }; }) }) $('#tblData tbody').on('click', '.btn-detail', function(e) { let id = $(this).data('id'); console.log(id); fetch(URS + 'getDetailData/' + id) .then(responseJson => responseJson.json()) .then(resultJson => { let v = resultJson; $('#id_minta_data').val(v.id_minta_data) $('#lampiran').attr("href", BASE_URL + 'asset/lampiran_data/' + v.lampiran) $('#lampiran').text(v.lampiran) }) }) $('#btnSimpan').click(() => { fetch(URS + 'proses_upproval', { method: 'POST', body: new FormData(frmData) }) .then(responseJson => responseJson.json()) .then(resultJson => { if (resultJson.success = true) { window.location.href = BASE_URL + "lanjutan/PermintaanData/lampiran/" + resultJson.id_permintaan }; }) })
24.361538
112
0.545943
3b48485f74a5638c4c4a2adb49b531c21eb1b3fb
283
js
JavaScript
lib/timestamp-view.js
zandaqo/bsonview
115e88f25d279397c38e50ecaddfeff46004e6c7
[ "MIT" ]
null
null
null
lib/timestamp-view.js
zandaqo/bsonview
115e88f25d279397c38e50ecaddfeff46004e6c7
[ "MIT" ]
null
null
null
lib/timestamp-view.js
zandaqo/bsonview
115e88f25d279397c38e50ecaddfeff46004e6c7
[ "MIT" ]
null
null
null
const TypeViewMixin = require('./type-view-mixin'); class TimestampView extends TypeViewMixin('biguint64') { static toBSON(view, start = 0) { const value = this.toJSON(view, start); return this.BSON.fromString(value.toString(), 10); } } module.exports = TimestampView;
25.727273
56
0.710247
3b489175612fb605ae959e2b80018d4d1b233918
10,183
js
JavaScript
WebRoot/js/jQuery-jcDate.js
lklong/fuckproject
01ce34ecf3ae346de8a9630a6c6f49540f39aca3
[ "Apache-2.0" ]
2
2015-05-28T12:58:27.000Z
2015-05-28T12:58:29.000Z
WebRoot/js/jQuery-jcDate.js
lklong/fuckproject
01ce34ecf3ae346de8a9630a6c6f49540f39aca3
[ "Apache-2.0" ]
null
null
null
WebRoot/js/jQuery-jcDate.js
lklong/fuckproject
01ce34ecf3ae346de8a9630a6c6f49540f39aca3
[ "Apache-2.0" ]
null
null
null
/* jQuery - jcDate v1.0 日期插件*/ ;(function($){ $.fn.jcDate = function(options) { var defaults = { IcoClass : "jcDateIco", Event : "click", Speed : 100, Left : 0, Top : 22, format : "/", Timeout : 100 }; var options = $.extend(defaults,options); return this.each(function() { if($("#jcDate").length == 0){ $("body").prepend("<div id='jcDate'><input type='hidden' value='' id='dateHideText' /><div id='jcDateTt'><a id='d_prev'></a><div><span></span><b>年</b><samp></samp><b>月</b></div><a id='d_next'></a></div><dl id='jcYeas'></dl><dl id='jcMonth'></dl><div id='jcDayWrap'><dl id='jcDayCon'></dl><div id='jcDateMax'><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul><ul></ul></div><div id='jcDateBtn'><samp>今天</samp><span>清空</span><a id='d_sub'>确定</a><div id='jcTimeWrap'><input type='text' value='' /><label>:</label><input type='text' value='' /></div></div></div></div>"); }; var $dateInput = $(this), $window = $(window), dateObj = new Date(), $jcDate = $("#jcDate"), inputOffLeft = $(this).offset().left, inputOfftop = $(this).offset().top, $year = $("#jcDateTt").find("span"), $month = $("#jcDateTt").find("samp"), $b = $("#jcDateTt").find("b"), $jcDateMax = $("#jcDateMax"), $weekFrame = $("#jcDayCon"), $DateBtn = $("#jcDateBtn"), $jcYeas = $("#jcYeas"), $jcMonth = $("#jcMonth"), $Now = $DateBtn.find("samp"), $clear = $DateBtn.find("span"), $jcDayWrap = $("#jcDayWrap"), $dayFrame = $jcDayWrap.find("ul"), $submit = $DateBtn.find("a#d_sub"), $HiddenText = $("input#dateHideText"), $jcTimeWrap = $("#jcTimeWrap"), $hh = $jcTimeWrap.find("input:eq(0)"), $mm = $jcTimeWrap.find("input:eq(1)"), $d_prev = $("#d_prev"), $d_next = $("#d_next"), // 获取当前时间 _year = parseInt(dateObj.getFullYear()), _month = dateObj.getMonth() + 1, _date = dateObj.getDate(), week = dateObj.getDay(), days = [ "日","一 ","二 ","三 ","四 ","五 ","六 "], _day = days[week], _hours = dateObj.getHours(), _minutes = dateObj.getMinutes(), weekDl = "", yearDl = "<dd class='visited'>"+_year+"年"+"</dd>", monthDl = "", $ul = "", _idx = 0, defInfo = "", getDateCount = function(y, m){ return [31, y % 4 == 0 && y % 100 != 0 || y % 400 == 0 ? 29 : 28 ,31,30,31,30,31,31,30,31,30,31][ m+1 ]; }; // 赋值数据 $hh.val("00"); $mm.val("00"); for(var w = 0 in days) { weekDl = weekDl + "<dt>" + days[w] + "</dt>"; }; $weekFrame.html(weekDl); ysCreate(_year); var mArr = new Array(); /* var NowY = _year, yArr = new Array(), for(var lys = 0; lys < 9 ; lys++ ){ lastyear = NowY - (lys+1); yArr.push("<dt>"+lastyear+"年"+"</dt>") }; yArr.reverse(); var dtf = ysArr(yArr); yArr.length = 0; for(var fys = 0; fys < 8 ; fys++ ){ firstyear = NowY + (fys+1); yArr.push("<dt>"+firstyear+"年"+"</dt>") }; var dtl = ysArr(yArr); $jcYeas.html(dtf+yearDl+dtl); function ysArr(arr){ var $Dts = ""; for(var index = 0 in arr){ $Dts = $Dts + arr[index]; }; return $Dts };*/ for(var ms = 1; ms <= 12; ms++ ){ if(ms == _month){ mArr.push("<dt class='visited'>" + ms + "月" +"</dt>"); } else { mArr.push("<dt>" + ms + "月" +"</dt>"); }; }; for(var mA = 0 in mArr){ monthDl += mArr[mA]; }; $jcMonth.html(monthDl) function shFade(show,hide,hide2,bool,index){ var fadeSpeed = options.speed; hide.fadeOut(fadeSpeed); hide2.fadeOut(fadeSpeed); show.delay(fadeSpeed*2).fadeIn(fadeSpeed); if(bool){ if(show!=$jcYeas){// 年份显示上下页箭头 $("#d_prev,#d_next").fadeOut(fadeSpeed); } $b.eq(index).hide(); } else { $("#d_prev,#d_next").fadeIn(fadeSpeed); $b.show(); $year.show(); $month.show(); }; }; $year.off().on("click",function(){ $(this).addClass("visited").next("samp").removeClass("visited"); shFade($jcYeas,$jcDayWrap,$jcMonth,true,1); $year.show(); $month.hide(); }); $("#jcYeas dd,#jcYeas dt").off().on("click",function(){ var y = parseInt($(this).text()); Traversal(y); $year.text(y); shFade($jcDayWrap,$jcYeas,$jcMonth,false); }); $month.off().on("click",function(){ $(this).addClass("visited").prev().removeClass("visited"); shFade($jcMonth,$jcDayWrap,$jcYeas,true,0); $month.show(); $year.hide(); }); $jcMonth.find("dt").off().on("click",function(){ var m = parseInt($(this).text()); mAnimate(m-1); $month.text(m); shFade($jcDayWrap,$jcYeas,$jcMonth,false); }); function Traversal(Ty){ $year.text(Ty); for(var m = 0; m < $dayFrame.length; m++){ var dayLi = "", $fLi = "", $lLi = "", firstLi = "", lastDay = 0, yearWeek = new Date(Ty,m,1).getDay(); getDateCount(Ty,m-2) == undefined ? fristDay = 31 : fristDay = getDateCount(Ty,m-2); for(var d = 1; d <= getDateCount(Ty,m-1); d++){ dayLi = dayLi + "<li class='jcDateColor'>"+ d +"</li>"; }; for(var f = 0 ; f < yearWeek; f++){ firstLi += "<li>"+ fristDay +"</li>,"; fristDay--; }; for(var l = 0 ; l <= 42-(d+yearWeek); l++ ){ lastDay = l + 1; $lLi += "<li>"+lastDay+"</li>"; }; fLiArr = firstLi.split(",").reverse(); for(var arr = 0 in fLiArr){ $fLi += fLiArr[arr]; }; $addLi = $fLi + dayLi + $lLi; $dayFrame.eq(m).html($addLi); }; }; mAnimate(_month-1); //功能方法 $d_prev.off().on("click",function(){ if($("#jcDateTt").find("samp").is(":hidden")){ var newYear = parseInt($("#jcDateTt").find("span").text())-18; $("#jcDateTt").find("span").html(newYear); ysCreate(newYear); }else{ _idx = $dayFrame.filter(".dateV").index(); if( _idx > 0){ _idx --; } else { var _Tyear = parseInt($year.text()); _Tyear--; Traversal(_Tyear); _idx = $dayFrame.length-1; }; mAnimate(_idx); } }); $d_next.off().on("click",function(){ if($("#jcDateTt").find("samp").is(":hidden")){ var newYear = parseInt($("#jcDateTt").find("span").text())+18; $("#jcDateTt").find("span").html(newYear); ysCreate(newYear); }else{ _idx = $dayFrame.filter(".dateV").index(); if( _idx < $dayFrame.length-1){ _idx ++; } else { var _Tyear = parseInt($("#jcDateTt").find("span").text()); _Tyear++; Traversal(_Tyear); _idx = 0; }; mAnimate(_idx); } }); function ysCreate(inyear){ var NowY = inyear, yArr = new Array(); for(var lys = 0; lys < 9 ; lys++ ){ lastyear = NowY - (lys+1); yArr.push("<dt>"+lastyear+"年"+"</dt>") }; yArr.reverse(); var dtf = ysArr(yArr); yArr.length = 0; for(var fys = 0; fys < 8 ; fys++ ){ firstyear = NowY + (fys+1); yArr.push("<dt>"+firstyear+"年"+"</dt>") }; var dtl = ysArr(yArr); $jcYeas.html(dtf+yearDl+dtl); function ysArr(arr){ var $Dts = ""; for(var index = 0 in arr){ $Dts = $Dts + arr[index]; }; return $Dts }; } function mAnimate(index){ $dayFrame.eq(index).addClass("dateV").siblings().removeClass("dateV"); $month.text(index+1); $jcDateMax.animate({ "left":-index*161 },options.Speed); }; function today(y,m,d){ $year.text(y); $month.text(m); Traversal(y); $.each($dayFrame.eq(m-1).find("li"),function(){ if($(this).hasClass("jcDateColor")){ $dayFrame.eq(m-1).find("li.jcDateColor").eq(d-1).addClass("visited"); }; }); $HiddenText.val(_date); $dayFrame.eq(m-1).find("li").text(); mAnimate(m-1); }; function clearVisited(){ $.each($("li.jcDateColor",$dayFrame),function(){ if($(this).hasClass("visited")){ $(this).removeClass("visited"); }; }); }; today(_year,_month,_date); $dayFrame.undelegate("li.jcDateColor","click").delegate("li.jcDateColor","click",function(){ clearVisited(); $(this).addClass("visited"); $HiddenText.val(parseInt($(this).text())) }); $dayFrame.undelegate("li.jcDateColor","dblclick").delegate("li.jcDateColor","click",function(){ submitDate(); }); $Now.off().on("click",function(){ today(_year,_month,_date); }); $clear.off().on("click",function(){ $("input.dateVisited").val(""); }); $submit.off().on("click",function(){ submitDate(); }); function submitDate(){ var Sy = $year.text(), Sm = $month.text(), Sd = $HiddenText.val(); Sm = Sm < 10 ? '0' + Sm : Sm; Sd = Sd < 10 ? '0' + Sd : Sd;// 1-9->01-09 NowDateArr = new Array(Sy,Sm,Sd); dateInfo =NowDateArr.join(options.format); if($hh.val() != "00" || $mm.val() != "00" ){ var Sh = $hh.val(), Sm = $mm.val(); NowDateArr.push(Sh+":"+Sm); printDate = NowDateArr.join(options.format).substring(), format = printDate.split("/"); dateInfo = format[0]+options.format+format[1]+options.format+format[2]+" "+format[3] }; $("input.dateVisited").val(dateInfo); closeDate(); }; $dateInput.addClass(options.IcoClass) //.val(defInfo) .off() .on(options.Event,function(e){ $(this).addClass("dateVisited"); //$jcDate.css({ "left" : e.pageX+(options.Left),"top" : e.pageY+(options.Top) }); var iof = $(this).offset(); $jcDate.css({ "left" : iof.left+options.Left,"top" : iof.top+options.Top }); $jcDate.show(options.Speed); $jcDayWrap.show(); $jcYeas.hide(); $jcMonth.hide(); $("#d_prev,#d_next").show(); $year.show(); $month.show(); $b.show(); }); $jcDate.off().on("mouseleave",function(){ setTimeout(closeDate,options.Timeout); }); function closeDate(){ $("input.dateVisited").removeClass("dateVisited"); $jcDate.hide(options.Speed); }; }); }; })(jQuery)
31.236196
620
0.519493
3b489e054433f17496850717bc001637e090dd06
161
js
JavaScript
lib/__tests__/index.js
grmlin/gremlins
085c7467e4da3f91fe601db33474c46870da15c0
[ "MIT" ]
27
2015-09-02T18:49:04.000Z
2019-10-14T08:47:01.000Z
lib/__tests__/index.js
grmlin/gremlinjs
085c7467e4da3f91fe601db33474c46870da15c0
[ "MIT" ]
15
2015-03-22T00:29:48.000Z
2019-02-18T09:24:08.000Z
lib/__tests__/index.js
grmlin/gremlinjs
085c7467e4da3f91fe601db33474c46870da15c0
[ "MIT" ]
3
2016-06-02T08:29:27.000Z
2018-03-23T13:39:53.000Z
'use strict'; require('babel-polyfill'); require('./gremlins-tests'); require('./Gremlin-tests'); require('./Mixins-tests'); require('./GremlinElement-tests');
20.125
34
0.695652
3b48cf0972f852a41fb621b7c41105d6f3d4efc7
2,608
js
JavaScript
comments-outside-of-editor/build/translations/hu.js
sem1colon/ckeditor5-collaboration-samples
56d0e28fde11bb01438de5b9cd861a0fd52c419d
[ "MIT" ]
null
null
null
comments-outside-of-editor/build/translations/hu.js
sem1colon/ckeditor5-collaboration-samples
56d0e28fde11bb01438de5b9cd861a0fd52c419d
[ "MIT" ]
null
null
null
comments-outside-of-editor/build/translations/hu.js
sem1colon/ckeditor5-collaboration-samples
56d0e28fde11bb01438de5b9cd861a0fd52c419d
[ "MIT" ]
null
null
null
(function(d){d['hu']=Object.assign(d['hu']||{},{a:"Nem sikerült a fájl feltöltése:",b:"Táblázat eszköztár",c:"Kép eszköztár",d:"Kép, vagy fájl beszúrása",e:"Félkövér",f:"Dőlt",g:"Áthúzott",h:"Aláhúzott",i:"Stílus megadása",j:"Stílusok",k:"Számozott lista",l:"Pontozott lista",m:"Balra igazítás",n:"Jobbra igazítás",o:"Középre igazítás",p:"Sorkizárt",q:"Szöveg igazítása",r:"Szöveg igazítás eszköztár",s:"Betűtípus",t:"Alapértelmezett",u:"Betűméret",v:"Apró",w:"Kicsi",x:"Nagy",y:"Hatalmas",z:"Formázás eltávolítása",aa:"Idézet",ab:"Táblázat beszúrása",ac:"Oszlop fejléc",ad:"Oszlop beszúrása balra",ae:"Oszlop beszúrása jobbra",af:"Oszlop törlése",ag:"Oszlop",ah:"Sor fejléc",ai:"Sor beszúrása alá",aj:"Sor beszúrása fölé",ak:"Sor törlése",al:"Sor",am:"Cellák egyesítése felfelé",an:"Cellák egyesítése jobbra",ao:"Cellák egyesítése lefelé",ap:"Cellák egyesítése balra",aq:"Cella felosztása függőlegesen",ar:"Cella felosztása vízszintesen",as:"Cellaegyesítés",at:"Média widget",au:"Sárga kiemelő",av:"Zöld kiemelő",aw:"Rózsaszín kiemelő",ax:"Kék kiemelő",ay:"Piros toll",az:"Zöld toll",ba:"Kiemelés eltávolítása",bb:"Kiemelés",bc:"Szöveg kiemelés eszköztár",bd:"Widget eszköztár",be:"A feltöltés folyamatban",bf:"Teljes méretű kép",bg:"Oldalsó kép",bh:"Balra igazított kép",bi:"Középre igazított kép",bj:"Jobbra igazított kép",bk:"Link",bl:"Média beszúrása",bm:"Az URL nem lehet üres.",bn:"Ez a média URL típus nem támogatott.",bo:"Az átméretezett kép URL-je nem érhető el.",bp:"Az átméretezett kép kiválasztása sikertelen",bq:"A jelenlegi helyen nem szúrható be a kép.",br:"A kép beszúrása sikertelen",bs:"Lenyíló eszköztár",bt:"Visszavonás",bu:"Újra",bv:"Bővített szövegszerkesztő",bw:"Bővített szövegszerkesztő, %0",bx:"Szerkesztő eszköztár",by:"További elemek",bz:"Megnyitás új lapon",ca:"Letölthető",cb:"Mentés",cc:"Mégsem",cd:"Illessze be a média URL-jét.",ce:"Tipp: Illessze be a média URL-jét a tartalomba.",cf:"Média URL",cg:"%0 / %1",ch:"Előző",ci:"Következő",cj:"Link eltávolítása",ck:"Link szerkesztése",cl:"Link megnyitása új ablakban",cm:"A link nem tartalmaz URL-t",cn:"URL link",co:"Bekezdés",cp:"Címsor 1",cq:"Címsor 2",cr:"Címsor 3",cs:"Címsor 4",ct:"Címsor 5",cu:"Címsor 6",cv:"képmodul",cw:"Kép beszúrása",cx:"A feltöltés nem sikerült",cy:"Képaláírás megadása",cz:"Helyettesítő szöveg módosítása",da:"Helyettesítő szöveg",db:"Fekete",dc:"Halvány szürke",dd:"Szürke",de:"Világosszürke",df:"Fehér",dg:"Piros",dh:"Narancs",di:"Sárga",dj:"Világoszöld",dk:"Zöld",dl:"Kékeszöld",dm:"Türkiz",dn:"Világoskék",do:"Kék",dp:"Lila"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
2,608
2,608
0.740031
3b492e2af9c2d6044385407ddd5818a1d5ca2788
1,446
js
JavaScript
test/crdt.js
HappyBlueStar/level-scuttlebutt
231595f810c868faaabbd95c3fb819de6e1e3c55
[ "MIT" ]
12
2015-01-04T00:50:40.000Z
2019-06-12T19:49:04.000Z
test/crdt.js
HappyBlueStar/level-scuttlebutt
231595f810c868faaabbd95c3fb819de6e1e3c55
[ "MIT" ]
null
null
null
test/crdt.js
HappyBlueStar/level-scuttlebutt
231595f810c868faaabbd95c3fb819de6e1e3c55
[ "MIT" ]
null
null
null
var level = require('level-test')() , assert = require('assert') , sublevel = require('level-sublevel') // , udid = require('udid')('example-app') , scuttlebutt = require('../') , Doc = require('crdt').Doc , test = require('tape') // setup db newDB = function (opts) { var db = sublevel(level('test-level-scuttlebutt-crdt', opts)) scuttlebutt(db, 'udid', function(name) {return new Doc;}); return db } test('modifying a sequence persists correctly', function(t) { t.plan(1) var DB = newDB() DB.open('one-doc', function(err, doc1) { var seq = doc1.createSeq('session', 'one'); doc1.on('_remove', function (update) { console.error('_REMOVE', update) }) seq.on('_update', console.error) seq.push({id: 'a'}); seq.push({id: 'b'}); seq.push({id: 'c'}); console.log(seq.toJSON()) seq.after('a', 'b'); console.log(JSON.stringify(doc1.history())) var firstOutput = seq.toJSON() // is 'drain' the right event to listen for here? DB.on('drain', function(){ DB.close(function(err){ if (err) console.log('err', err); // reopen DB var anotherDB = newDB({clean: false}) anotherDB.open('one-doc', function(err, doc2) { var seq2 = doc2.createSeq('session', 'one'); var secondOutput = seq2.toJSON() console.log(doc2.history()) t.same(secondOutput, firstOutput) }) }) }) }) })
26.290909
63
0.581604
3b4a1035db86e582f5d2951aab3ec3913d8aa055
891
js
JavaScript
src/modules/navigation/index.js
Nachox07/todo-app-react-native
16685f9c97f7262b8ce6c5c1a22e06123c7ebf17
[ "MIT" ]
null
null
null
src/modules/navigation/index.js
Nachox07/todo-app-react-native
16685f9c97f7262b8ce6c5c1a22e06123c7ebf17
[ "MIT" ]
null
null
null
src/modules/navigation/index.js
Nachox07/todo-app-react-native
16685f9c97f7262b8ce6c5c1a22e06123c7ebf17
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { addNavigationHelpers } from 'react-navigation'; import { createReduxBoundAddListener } from 'react-navigation-redux-helpers'; import NavigationStack from './navigationStack'; const addListener = createReduxBoundAddListener('root'); class AppNavigation extends Component { render() { const { navigationState, dispatch } = this.props; return ( <NavigationStack navigation={ addNavigationHelpers({ dispatch, state: navigationState, addListener, }) } /> ); } } const mapStateToProps = state => ({ navigationState: state.navigationState, }); export default connect(mapStateToProps)(AppNavigation);
28.741935
77
0.59147
3b4a53f9baeec60630de682724c6707d003b1b4b
4,741
js
JavaScript
static/js/node_crash.js
xhkyyy/elasticsearch-tools
8fcf74f5e91d3f613c575f7631508b6a1652239f
[ "MIT" ]
null
null
null
static/js/node_crash.js
xhkyyy/elasticsearch-tools
8fcf74f5e91d3f613c575f7631508b6a1652239f
[ "MIT" ]
null
null
null
static/js/node_crash.js
xhkyyy/elasticsearch-tools
8fcf74f5e91d3f613c575f7631508b6a1652239f
[ "MIT" ]
null
null
null
function genCheckBoxHtml(checkbox_name) { return ` <div class="form-check"> <input class="form-check-input" type="checkbox" value="${checkbox_name}" id="defaultCheck1"> <label class="form-check-label" for="defaultCheck1"> ${checkbox_name} </label> </div><br> `; } function genIndexListHtml(shards, msg, find) { var dg_type; if (find) { dg_type = 'success' } else { dg_type = 'danger'; } return ` <tr> <th scope="row">${shards.id}</th> <td>${shards.name}</td> <td>${shards.role}</td> <td><span class="badge badge-${dg_type}">${msg}</span></td> </tr> `; } var es_nodes; var shard_map; function build_shard_map_key(shard) { return shard.name + '#######' + shard.id; } function afterLoadData() { hideRowContentDiv('#progress_div', false); hideRowContentDiv('#indexDataDiv', true); } $('#loading').click(function () { var esurl_str = $('#esurl').val().trim(); if (esurl_str) { hideRowContentDiv('#progress_div', true); hideRowContentDiv('#indexDataDiv', false); var data = { 'esurl': esurl_str, 'uname': $.trim($('#uname').val()), 'pwd': $.trim($('#pwd').val()) }; var data_json_str = JSON.stringify(data); $.ajax({ type: "post", url: "/node_list", data: data_json_str, contentType: 'application/json', success: function (data) { $('#indexs_list_body').empty(); var checkboxObj = $('#nodes_checkbox'); checkboxObj.empty(); shard_map = new Map(); var nodes_checkbox = ''; data.nodes.forEach(function (ele) { nodes_checkbox += genCheckBoxHtml(ele.node); ele.shards.p_list.forEach(function (shard) { add_shark_map(build_shard_map_key(shard), ele.node); }); ele.shards.r_list.forEach(function (shard) { add_shark_map(build_shard_map_key(shard), ele.node); }); }); checkboxObj.html(nodes_checkbox); es_nodes = data.nodes; }, complete: function () { afterLoadData(); } }); } }); function add_shark_map(k, v) { if (shard_map.has(k)) { shard_map.get(k).push(v); } else { var l = []; l.push(v); shard_map.set(k, l); } } $(document).on('click', '.form-check-input', function () { var indexsListObj = $('#indexs_list_body'); indexsListObj.empty(); var es_affect_shards = [], crash_node_map = new Map(), checkedObj = $('.form-check-input:checked'); if (checkedObj && checkedObj.length > 0) { $('#indexs_list').removeClass('d-none'); } else { $('#indexs_list').addClass('d-none'); } checkedObj.each(function (i, box) { var box_id = $(this); crash_node_map.set(box_id.val(), true); es_nodes.forEach(function (ele) { if (ele.node == box_id.val()) { ele.shards.p_list.forEach(function (shard) { es_affect_shards.push(shard); }); ele.shards.r_list.forEach(function (shard) { es_affect_shards.push(shard); }); } }); }); indexsListObj.html(genDisIndexListHtml(es_affect_shards, crash_node_map)); }); function delDupShards(shards) { var m1 = new Map(); var shards_list = []; shards.forEach(function (shard) { var key = shard.name + '#######' + shard.id + '#######' + shard.role; if (!m1.has(key)) { shards_list.push(shard); m1.set(key, 0); } }); return shards_list; } function genDisIndexListHtml(shards, crash_node_map) { if (!shards || shards.length <= 0) { return ''; } shards = delDupShards(shards); var html = ''; shards.forEach(function (shard) { var back_node = shard_map.get(build_shard_map_key(shard)); var find = false; var msg = ''; if (back_node) { back_node.forEach(function (node) { if (!crash_node_map.has(node)) { msg += node + ', '; find = true; } }); } if (!msg) { msg = '不可恢复!'; } else { msg = msg.substr(0, msg.length - 2); } html += genIndexListHtml(shard, msg, find); }); return html; }
28.220238
100
0.498418
3b4adde8f3282c35eb175fed5e6adb88af95bd6d
1,054
js
JavaScript
ThreeBotPackages/zerobot/admin/frontend_src/sources/views/deployedSolutions/solutionExpose.js
threefoldtech/jumpscaleX_threebot
2841e1109abf1bee113b027a7e04bfbd25cbcb48
[ "Apache-2.0" ]
null
null
null
ThreeBotPackages/zerobot/admin/frontend_src/sources/views/deployedSolutions/solutionExpose.js
threefoldtech/jumpscaleX_threebot
2841e1109abf1bee113b027a7e04bfbd25cbcb48
[ "Apache-2.0" ]
546
2019-08-29T11:48:19.000Z
2020-12-06T07:20:45.000Z
ThreeBotPackages/zerobot/admin/frontend_src/sources/views/deployedSolutions/solutionExpose.js
threefoldtech/jumpscaleX_threebot
2841e1109abf1bee113b027a7e04bfbd25cbcb48
[ "Apache-2.0" ]
5
2019-09-26T14:03:05.000Z
2020-04-16T08:47:10.000Z
import { BaseView } from './baseview' import { solutions } from '../../services/deployedSolutions' const CHAT = "solutions.chatflow?author=tfgrid_solutions&package=tfgrid_solutions&chat=solution_expose" export default class DeployedSolutionExposeView extends BaseView { constructor(app, name) { super(app, name, CHAT, "wan.png"); } init(view) { super.init(view) let self = this self.parseData = [] solutions.listSolution('exposed').then((data) => { const solutions = data.json().solutions for (let i = 0; i < solutions.length; i++) { let solution = solutions[i]; solution._ip = "" solution._name = solution.Name.length > self.maxTitleLength ? solution.Name.substring(0, self.maxTitleLength) + '...' : solution.Name self.parseData.push(solution) } self.solutionlist.parse(self.parseData); self.solutionlist.showProgress({ hide: true }); }); } }
37.642857
103
0.59203
3b4b9feeeed83944e19e408ab815fa4483e24826
2,235
js
JavaScript
node_modules/js-crypto-env/dist/index.js
Vlowsz/Morph-v1
321c229529c9c2a6d17afe64e2890637ddebe9cb
[ "MIT" ]
null
null
null
node_modules/js-crypto-env/dist/index.js
Vlowsz/Morph-v1
321c229529c9c2a6d17afe64e2890637ddebe9cb
[ "MIT" ]
3
2021-03-09T22:47:48.000Z
2022-03-23T11:06:56.000Z
node_modules/js-crypto-env/dist/index.js
Vlowsz/Morph-v1
321c229529c9c2a6d17afe64e2890637ddebe9cb
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRootWebCryptoAll = exports.getWebCryptoAll = exports.getMsCrypto = exports.getWebCrypto = exports.getNodeCrypto = exports.default = void 0; /** * index.js **/ /** * Obtain require(crypto) in Node.js environment. * @return {undefined|Object} - Node.js crypto object */ var getNodeCrypto = function getNodeCrypto() { if (typeof window !== 'undefined') return undefined;else return require('crypto'); }; /** * Obtain window.crypto.subtle object in browser environments. * @return {undefined|Object} - WebCrypto API object */ exports.getNodeCrypto = getNodeCrypto; var getWebCrypto = function getWebCrypto() { if (typeof window === 'undefined') return undefined; if (window.crypto) return window.crypto.subtle; }; /** * Obtain window.crypto.subtle or window.msCrypto.subtle object in browser environments. * @return {undefined|Object} - WebCrypto API object */ exports.getWebCrypto = getWebCrypto; var getWebCryptoAll = function getWebCryptoAll() { if (typeof window === 'undefined') return undefined;else { if (window.msCrypto) return window.msCrypto.subtle; if (window.crypto) return window.crypto.subtle; } }; /** * Obtain window.crypto or window.msCrypto object in browser environments. * @return {undefined|Object} - WebCrypto API object */ exports.getWebCryptoAll = getWebCryptoAll; var getRootWebCryptoAll = function getRootWebCryptoAll() { if (typeof window === 'undefined') return undefined;else { if (window.msCrypto) return window.msCrypto; if (window.crypto) return window.crypto; } }; /** * Retrieve MsCryptoObject, i.e., window.msCrypto.subtle * @return {undefined|Object} */ exports.getRootWebCryptoAll = getRootWebCryptoAll; var getMsCrypto = function getMsCrypto() { if (typeof window === 'undefined') return undefined; if (window.crypto) return undefined; if (window.msCrypto) return window.msCrypto.subtle; }; exports.getMsCrypto = getMsCrypto; var _default = { getNodeCrypto: getNodeCrypto, getWebCrypto: getWebCrypto, getMsCrypto: getMsCrypto, getWebCryptoAll: getWebCryptoAll, getRootWebCryptoAll: getRootWebCryptoAll }; exports.default = _default;
27.592593
150
0.738702
3b4c097a1983557e51d4b1c0f0efc989ede9119d
3,105
js
JavaScript
src/components/index/navbar/navbar.js
cagdass/turjeeman-client
3a877f4771ee2248edaa433ccdee767a114a1d97
[ "Apache-2.0" ]
1
2017-07-28T06:35:03.000Z
2017-07-28T06:35:03.000Z
src/components/index/navbar/navbar.js
cagdass/turjeeman-client
3a877f4771ee2248edaa433ccdee767a114a1d97
[ "Apache-2.0" ]
null
null
null
src/components/index/navbar/navbar.js
cagdass/turjeeman-client
3a877f4771ee2248edaa433ccdee767a114a1d97
[ "Apache-2.0" ]
null
null
null
import React, {PropTypes} from "react"; import { Link } from "react-router"; import { Popover, PopoverInteractionKind, Position, Menu, MenuItem, MenuDivider } from "@blueprintjs/core"; import * as Blueprint from "@blueprintjs/core"; import appState from "../../../utility/app_state"; import loginService from "../login/_services/login_service"; import "./_assets/style.css"; const navbarStyle = { margin: "0", width: "auto", backgroundColor: "#c04050" }; const tabindex = -1; class NavBar extends React.Component { constructor(props, context, ...args) { super(props, context, ...args); } onLogout() { loginService.logoutUser().then(() => { let { router } = this.context; router.replace("login"); }).catch(error => { console.error(error); this.setState(error); }); } myAccount() { let { router } = this.context; router.replace("my_account"); } render() { const settingsMenu = <Menu> <MenuItem iconName="pt-icon-user" text="My account" onClick={this.myAccount.bind(this)} /> <MenuDivider /> <MenuItem text="Logout" iconName="pt-icon-log-out" onClick={this.onLogout.bind(this)} /> </Menu>; let user = appState.getUser(); let {name, surname} = user || {name: "", surname: ""}; return ( <nav className="pt-navbar pt-dark" style={navbarStyle}> <div style={navbarStyle}> <div className="pt-navbar-group pt-align-left"> <Link to="/dashboard"> <div className="pt-navbar-heading" style={{color: "white"}}>Turjeeman</div> </Link> </div> {name !== "" && surname !== "" && <div className="pt-navbar-group pt-align-right"> <Link to="/dashboard"> <button className="pt-button pt-minimal pt-icon-home" tabIndex={tabindex}><span className="no-highlight">Dashboard</span></button> </Link> <span className="pt-navbar-divider" /> <button className="pt-button pt-minimal pt-icon-notifications" tabIndex={tabindex}/> <span className="pt-navbar-divider" /> <Popover content={settingsMenu} position={Position.BOTTOM_RIGHT}> <div> <button className="pt-button pt-minimal pt-icon-cog" tabIndex={tabindex}> <span style={{fontSize: 14}}>{name + " " + surname}</span> </button> </div> </Popover> </div> } </div> </nav> ); } } NavBar.contextTypes = { router: PropTypes.object }; export default NavBar;
34.120879
158
0.489533
3b4d9cdb6dbdce69010e3bd027761385338fdab9
3,704
js
JavaScript
js/test.js
C-R-Y-P-T-X/c-r-y-p-t-x.github.io
f1d524715fc2eccb085b3c278a6f8c28927b527d
[ "MIT" ]
null
null
null
js/test.js
C-R-Y-P-T-X/c-r-y-p-t-x.github.io
f1d524715fc2eccb085b3c278a6f8c28927b527d
[ "MIT" ]
null
null
null
js/test.js
C-R-Y-P-T-X/c-r-y-p-t-x.github.io
f1d524715fc2eccb085b3c278a6f8c28927b527d
[ "MIT" ]
4
2016-06-10T05:12:34.000Z
2017-01-30T09:38:33.000Z
$(document).ready(function() { // Информация о текущем соединении get_current_bridge(); $('#status').on('click', '.take-break', function(e){ e.preventDefault(); $.ajax({ type: "POST", url: "ajax-action.php?action=pushbutton&status=0", dataType: "text", success: function(response) { } }) }) $('#status').on('click', '.to-work', function(e){ e.preventDefault(); $.ajax({ type: "POST", url: "ajax-action.php?action=pushbutton&status=1", dataType: "text", success: function(response) { } }) }) }); //************************************* // Информация о текущем соединении //************************************* function get_current_bridge() { var $current_bridge = document.getElementById("current_bridge"); $.ajax({ type: "POST", url: "ajax-action.php?action=get_current_bridge", dataType: "text", success: function(response) { response = JSON.parse(response); $current_bridge.innerHTML = response.result.context; if (response.result.type==1) { //document.location.href = response.result.context; // И останавливаю обновление clearTimeout(setVar3); get_step_form(null,null,response.result.id_eparty,response.result.id_ringing); $('#status').html(""); } else { var text_line = ''; var buttons_line = ''; switch (response.result.status) { case "0": text_line = 'Онлайн'; buttons_line = '<a href="#" class="btn btn-success take-break">Запросить перерыв</a>'; break; case "1": text_line = 'На перерыве'; buttons_line = '<a href="#" class="btn btn-success to-work">Продолжить работу</a>'; break; case "2": text_line = 'В ожидании перерыва. <font color="red">Продолжайте работу</font>, пока эта строка не исчезнет!'; buttons_line = ''; break; case "4": text_line = 'Переведен на перерыв из-за бездействия'; buttons_line = '<a href="#" class="btn btn-success to-work">Продолжить работу</a>'; break; } var text_line = '<p>Статус: <b>' + text_line + '</b></p>'; $('#status').html(text_line + buttons_line); } } }); } // Обновление списка активных операторов setVar3 = setInterval(get_current_bridge, 1000); // Получение многошаговой формы function get_step_form(form, button, id_eparty,id_ringing) { var data = ""; if (form!=null) { data = form.serialize(); if (button.value) { data += "&step_form_button="+button.value; } } else { //alert( id.value ); data += "&id_eparty="+id_eparty; data += '&id_ringing='+id_ringing; data += '&cc=1'; } $.ajax({ type: "POST", url: "/adm/eparty/regadmin/ajax-action.php?action=get_step_form", async: true, cache: false, data: data, success: function (response) { switch (response.result.type) { case "form": $("#step_form").html(response.result.content); $(".step_form_button").unbind("click"); $(".step_form_button").on('click', function(e) { e.preventDefault(); var form = $(this).closest("form"); if ((e.target.value!=2) || ($(".step_form_answer").length && $(".step_form_answer:checked").length!=0)) { get_step_form(form, e.target); } else { bootbox.alert('Выберите вариант ответа!'); } }); break; case "message": $("#step_form").html(response.result.content); break; case "redirect": document.location.href = response.result.content; break; } // switch }, error: function(request,error){ } }); }
28.060606
117
0.573434
3b4e5417b1629e1e4d8d042f606b12b3be14bfde
2,128
js
JavaScript
seeders/20190409020839-my-seed.js
Bshields87/Project-2
98ae8dd99f0cee247850433308d0647f3a6a32cc
[ "MIT" ]
null
null
null
seeders/20190409020839-my-seed.js
Bshields87/Project-2
98ae8dd99f0cee247850433308d0647f3a6a32cc
[ "MIT" ]
3
2019-04-10T19:03:57.000Z
2019-04-12T05:34:56.000Z
seeders/20190409020839-my-seed.js
Bshields87/Project-2
98ae8dd99f0cee247850433308d0647f3a6a32cc
[ "MIT" ]
null
null
null
'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.bulkInsert('Users', [{ email: 'demo@demo.com', fullname: 'John Doe', age: 32, photo: "https://i.pinimg.com/originals/b6/40/64/b64064fe8fc20db8d5035178f258c32a.jpg", userName: "johnnyboy69", password: "GettinLaid88", bio: "Hot guy on the beach", datingPreference: "Female", location: "Oakland, California" }, { email: 'demo2@demo.com', fullname: 'Jane Doe', age: 26, photo: "https://i.pinimg.com/originals/be/30/67/be30673ee820adc2f4bdd8e2fa8d6a8d.jpg", userName: "janeygirl69", password: "GettinLaid88", bio: "Hot girl on the beach", datingPreference: "Male", location: "Oakland, California" }, { email: 'demo@demo.com', fullname: 'Alex', age: 28, photo: "https://images.unsplash.com/photo-1528629297340-d1d466945dc5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80", userName: "alexboy69", password: "GettinLaid88", bio: "Hot guy on a bike", datingPreference: "Male", location: "San Francisco, California" }, { email: 'demo2@demo.com', fullname: 'Alexa', age: 32, photo: "https://www.playarida.com/wp-content/uploads/2013/07/tumblr_m7evqvqr7x1qg8ddao1_500.jpg", userName: "alexagirl69", password: "GettinLaid88", bio: "Hot girl on a bike", datingPreference: "Female", location: "San Francisco, California" } ], {}); /* Add altering commands here. Return a promise to correctly handle asynchronicity. Example: return queryInterface.bulkInsert('People', [{ name: 'John Doe', isBetaMember: false }], {}); */ }, down: (queryInterface, Sequelize) => { return queryInterface.bulkDelete('Users', null, {}); /* Add reverting commands here. Return a promise to correctly handle asynchronicity. Example: return queryInterface.bulkDelete('People', null, {}); */ } };
28
129
0.602914
3b4e8a04e96dcd41753058c647fa0f9f78862b04
83,531
js
JavaScript
backend/web/assets/b89648cc/js/jquery.min.min.js
HendriGnwn/e-schedule
073fd12e536d95416ebe62ad6a8e950919864cfc
[ "BSD-3-Clause" ]
1
2017-10-14T19:02:55.000Z
2017-10-14T19:02:55.000Z
backend/web/assets/b89648cc/js/jquery.min.min.js
HendriGnwn/e-schedule
073fd12e536d95416ebe62ad6a8e950919864cfc
[ "BSD-3-Clause" ]
null
null
null
backend/web/assets/b89648cc/js/jquery.min.min.js
HendriGnwn/e-schedule
073fd12e536d95416ebe62ad6a8e950919864cfc
[ "BSD-3-Clause" ]
null
null
null
/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery-2.0.3.min.map */(function(e,undefined){function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,s,o,u,a,f;if(1===t.nodeType){if(q.hasData(e)&&(s=q.access(e),o=q.set(t,s),f=s.events)){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;r>n;n++)x.event.add(t,i,f[i][n])}L.hasData(e)&&(u=L.access(e),a=x.extend({},u),L.set(t,a))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,s=[],o=0,u=e.length;for(;u>o;o++)r=e[o],r.style&&(s[o]=q.get(r,"olddisplay"),n=r.style.display,t?(s[o]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(s[o]=q.access(r,"olddisplay",Rt(r.nodeName)))):s[o]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(o=0;u>o;o++)r=e[o],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?s[o]||"":"none"));return e}function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var s=n===(r?"border":"content")?4:"width"===t?1:0,o=0;for(;4>s;s+=2)"margin"===n&&(o+=x.css(e,n+jt[s],!0,i)),r?("content"===n&&(o-=x.css(e,"padding"+jt[s],!0,i)),"margin"!==n&&(o-=x.css(e,"border"+jt[s]+"Width",!0,i))):(o+=x.css(e,"padding"+jt[s],!0,i),"padding"!==n&&(o+=x.css(e,"border"+jt[s]+"Width",!0,i)));return o}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,s=qt(e),o=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,s);if(0>=i||null==i){if(i=vt(e,t,s),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=o&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(o?"border":"content"),r,s)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(xt[0].contentWindow||xt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Mt(e,t),xt.detach()),Nt[e]=n),n}function Mt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}function _t(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||$t.test(e)?r(e,i):_t(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)_t(e+"["+i+"]",t[i],n,r)}function un(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(w)||[];if(x.isFunction(n))while(r=s[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ln(e,t,n,r){function o(u){var a;return i[u]=!0,x.each(e[u]||[],function(e,u){var f=u(t,n,r);return"string"!=typeof f||s||i[f]?s?!(a=f):undefined:(t.dataTypes.unshift(f),o(f),!1)}),a}var i={},s=e===on;return o(t.dataTypes[0])||!i["*"]&&o("*")}function cn(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}function pn(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while("*"===a[0])a.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}return s?(s!==a[0]&&a.unshift(s),n[s]):undefined}function fn(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift())if("*"===s)s=a;else if("*"!==a&&a!==s){if(o=f[a+" "+s]||f["* "+s],!o)for(i in f)if(u=i.split(" "),u[1]===s&&(o=f[a+" "+u[0]]||f["* "+u[0]])){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}return{state:"success",data:t}}function En(){return setTimeout(function(){xn=undefined}),xn=x.now()}function Sn(e,t,n){var r,i=(Nn[t]||[]).concat(Nn["*"]),s=0,o=i.length;for(;o>s;s++)if(r=i[s].call(n,t,e))return r}function jn(e,t,n){var r,i,s=0,o=kn.length,u=x.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=xn||En(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;a>o;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),1>s&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xn||En(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;for(Dn(l,f.opts.specialEasing);o>s;s++)if(r=kn[s].call(f,e,l,f.opts))return r;return x.map(l,Sn,f),x.isFunction(f.opts.start)&&f.opts.start.call(e,f),x.fx.timer(x.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Dn(e,t){var n,r,i,s,o;for(n in e)if(r=x.camelCase(n),i=t[r],s=e[n],x.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=x.cssHooks[r],o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}function An(e,t,n){var r,i,s,o,u,a,f=this,l={},c=e.style,h=e.nodeType&&Lt(e),p=q.get(e,"fxshow");n.queue||(u=x._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,f.always(function(){f.always(function(){u.unqueued--,x.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[c.overflow,c.overflowX,c.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(c.display="inline-block")),n.overflow&&(c.overflow="hidden",f.always(function(){c.overflow=n.overflow[0],c.overflowX=n.overflow[1],c.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],wn.exec(i)){if(delete t[r],s=s||"toggle"===i,i===(h?"hide":"show")){if("show"!==i||!p||p[r]===undefined)continue;h=!0}l[r]=p&&p[r]||x.style(e,r)}if(!x.isEmptyObject(l)){p?"hidden"in p&&(h=p.hidden):p=q.access(e,"fxshow",{}),s&&(p.hidden=!h),h?x(e).show():f.done(function(){x(e).hide()}),f.done(function(){var t;q.remove(e,"fxshow");for(t in l)x.style(e,t,l[t])});for(r in l)o=Sn(h?p[r]:0,r,f),r in p||(p[r]=o.start,h&&(o.end=o.start,o.start="width"===r||"height"===r?1:0))}}function Ln(e,t,n,r,i){return new Ln.prototype.init(e,t,n,r,i)}function qn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=jt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Hn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;for("boolean"==typeof o&&(f=o,o=arguments[1]||{},u=2),"object"==typeof o||x.isFunction(o)||(o={}),a===u&&(o=this,--u);a>u;u++)if(null!=(e=arguments[u]))for(t in e)n=o[t],r=e[t],o!==r&&(f&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,s=n&&x.isArray(n)?n:[]):s=n&&x.isPlainObject(n)?n:{},o[t]=x.extend(f,s,r)):r!==undefined&&(o[t]=r));return o},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=j(e);if(n){if(o){for(;s>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(o){for(;s>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;for(n=!!n;o>s;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,t,n){var r,i=0,s=e.length,o=j(e),u=[];if(o)for(;s>i;i++)r=t(e[i],i,n),null!=r&&(u[u.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(u[u.length]=r);return f.apply([],u)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,s,o){var u=0,a=e.length,f=null==n;if("object"===x.type(n)){i=!0;for(u in n)x.access(e,t,u,n[u],!0,s,o)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(x(e),n)})),t))for(;a>u;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)));return i?e:f?t.call(e):a?t(e[0],n):s},now:Date.now,swap:function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});t=x(o),function(e,t){function ot(e,t,n,i){var s,o,u,a,f,l,p,m,g,E;if((t?t.ownerDocument||t:w)!==h&&c(t),t=t||h,n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=t.nodeType)&&9!==a)return[];if(d&&!i){if(s=Z.exec(e))if(u=s[1]){if(9===a){if(o=t.getElementById(u),!o||!o.parentNode)return n;if(o.id===u)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(u))&&y(t,o)&&o.id===u)return n.push(o),n}else{if(s[2])return H.apply(n,t.getElementsByTagName(e)),n;if((u=s[3])&&r.getElementsByClassName&&t.getElementsByClassName)return H.apply(n,t.getElementsByClassName(u)),n}if(r.qsa&&(!v||!v.test(e))){if(m=p=b,g=t,E=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){l=mt(e),(p=t.getAttribute("id"))?m=p.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",f=l.length;while(f--)l[f]=m+gt(l[f]);g=$.test(e)&&t.parentNode||t,E=l.join(",")}if(E)try{return H.apply(n,g.querySelectorAll(E)),n}catch(S){}finally{p||t.removeAttribute("id")}}}return Nt(e.replace(W,"$1"),t,n,i)}function ut(){function t(n,r){return e.push(n+=" ")>s.cacheLength&&delete t[e.shift()],t[n]=r}var e=[];return t}function at(e){return e[b]=!0,e}function ft(e){var t=h.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)s.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||O)-(~e.sourceIndex||O);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function dt(e){return at(function(t){return t=+t,at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function vt(){}function mt(e,t){var n,r,i,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=s.preFilter;while(u){(!n||(r=X.exec(u)))&&(r&&(u=u.slice(r[0].length)||u),a.push(i=[])),n=!1,(r=V.exec(u))&&(n=r.shift(),i.push({value:n,type:r[0].replace(W," ")}),u=u.slice(n.length));for(o in s.filter)!(r=G[o].exec(u))||f[o]&&!(r=f[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)}function gt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var r=t.dir,s=n&&"parentNode"===r,o=S++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||s)return e(t,n,i)}:function(t,n,u){var a,f,l,c=E+" "+o;if(u){while(t=t[r])if((1===t.nodeType||s)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||s)if(l=t[b]||(t[b]={}),(f=l[r])&&f[0]===c){if((a=f[1])===!0||a===i)return a===!0}else if(f=l[r]=[c],f[1]=e(t,n,u)||i,f[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=null!=t;for(;a>u;u++)(s=e[u])&&(!n||n(s,r,i))&&(o.push(s),f&&t.push(u));return o}function Et(e,t,n,r,i,s){return r&&!r[b]&&(r=Et(r)),i&&!i[b]&&(i=Et(i,s)),at(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||Tt(t||"*",u.nodeType?[u]:u,[]),m=!e||!s&&t?v:wt(v,h,e,u,a),g=n?i||(s?e:d||r)?[]:o:m;if(n&&n(m,g,u,a),r){f=wt(g,p),r(f,[],u,a),l=f.length;while(l--)(c=f[l])&&(g[p[l]]=!(m[p[l]]=c))}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?j.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=wt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):H.apply(o,g)})}function St(e){var t,n,r,i=e.length,o=s.relative[e[0].type],u=o||s.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,!0),c=yt(function(e){return j.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];for(;i>a;a++)if(n=s.relative[e[a].type])h=[yt(bt(h),n)];else{if(n=s.filter[e[a].type].apply(null,e[a].matches),n[b]){for(r=++a;i>r;r++)if(s.relative[e[r].type])break;return Et(a>1&&bt(h),a>1&&gt(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(W,"$1"),n,r>a&&St(e.slice(a,r)),i>r&&St(e=e.slice(r)),i>r&&gt(e))}h.push(n)}return bt(h)}function xt(e,t){var n=0,r=t.length>0,o=e.length>0,u=function(u,a,l,c,p){var d,v,m,g=[],y=0,b="0",w=u&&[],S=null!=p,x=f,T=u||o&&s.find.TAG("*",p&&a.parentNode||a),N=E+=null==x?1:Math.random()||.1;for(S&&(f=a!==h&&a,i=n);null!=(d=T[b]);b++){if(o&&d){v=0;while(m=e[v++])if(m(d,a,l)){c.push(d);break}S&&(E=N,i=++n)}r&&((d=!m&&d)&&y--,u&&w.push(d))}if(y+=b,r&&b!==y){v=0;while(m=t[v++])m(w,g,a,l);if(u){if(y>0)while(b--)w[b]||g[b]||(g[b]=D.call(c));g=wt(g)}H.apply(c,g),S&&!u&&g.length>0&&y+t.length>1&&ot.uniqueSort(c)}return S&&(E=N,f=x),w};return r?at(u):u}function Tt(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function Nt(e,t,n,i){var o,u,f,l,c,h=mt(e);if(!i&&1===h.length){if(u=h[0]=h[0].slice(0),u.length>2&&"ID"===(f=u[0]).type&&r.getById&&9===t.nodeType&&d&&s.relative[u[1].type]){if(t=(s.find.ID(f.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(u.shift().value.length)}o=G.needsContext.test(e)?0:u.length;while(o--){if(f=u[o],s.relative[l=f.type])break;if((c=s.find[l])&&(i=c(f.matches[0].replace(rt,it),$.test(u[0].type)&&t.parentNode||t))){if(u.splice(o,1),e=i.length&&gt(u),!e)return H.apply(n,i),n;break}}}return a(e,h)(i,t,!d,n,$.test(e)),n}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b="sizzle"+ -(new Date),w=e.document,E=0,S=0,T=ut(),N=ut(),C=ut(),k=!1,L=function(e,t){return e===t?(k=!0,0):0},A=typeof t,O=1<<31,M={}.hasOwnProperty,_=[],D=_.pop,P=_.push,H=_.push,B=_.slice,j=_.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},F="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",I="[\\x20\\t\\r\\n\\f]",q="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",R=q.replace("w","w#"),U="\\["+I+"*("+q+")"+I+"*(?:([*^$|!~]?=)"+I+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+R+")|)|)"+I+"*\\]",z=":("+q+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+U.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+I+"+|((?:^|[^\\\\])(?:\\\\.)*)"+I+"+$","g"),X=RegExp("^"+I+"*,"+I+"*"),V=RegExp("^"+I+"*([>+~]|"+I+")"+I+"*"),$=RegExp(I+"*[+~]"),J=RegExp("="+I+"*([^\\]'\"]*)"+I+"*\\]","g"),K=RegExp(z),Q=RegExp("^"+R+"$"),G={ID:RegExp("^#("+q+")"),CLASS:RegExp("^\\.("+q+")"),TAG:RegExp("^("+q.replace("w","w*")+")"),ATTR:RegExp("^"+U),PSEUDO:RegExp("^"+z),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+I+"*(even|odd|(([+-]|)(\\d*)n|)"+I+"*(?:([+-]|)"+I+"*(\\d+)|))"+I+"*\\)|)","i"),bool:RegExp("^(?:"+F+")$","i"),needsContext:RegExp("^"+I+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+I+"*((?:-\\d)?\\d*)"+I+"*\\)|)(?=[^-]|$)","i")},Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+I+"?|("+I+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{H.apply(_=B.call(w.childNodes),w.childNodes),_[w.childNodes.length].nodeType}catch(st){H={apply:_.length?function(e,t){P.apply(e,B.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}u=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=ot.support={},c=ot.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==h&&9===n.nodeType&&n.documentElement?(h=n,p=n.documentElement,d=!u(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){c()}),r.attributes=ft(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ft(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ft(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ft(function(e){return p.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(s.find.ID=function(e,t){if(typeof t.getElementById!==A&&d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},s.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete s.find.ID,s.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),s.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if("*"===e){while(n=s[i++])1===n.nodeType&&r.push(n);return r}return s},s.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==A&&d?n.getElementsByClassName(e):t},m=[],v=[],(r.qsa=Y.test(n.querySelectorAll))&&(ft(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||v.push("\\["+I+"*(?:value|"+F+")"),e.querySelectorAll(":checked").length||v.push(":checked")}),ft(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&v.push("[*^$]="+I+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(r.matchesSelector=Y.test(g=p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ft(function(e){r.disconnectedMatch=g.call(e,"div"),g.call(e,"[s!='']:x"),m.push("!=",z)}),v=v.length&&RegExp(v.join("|")),m=m.length&&RegExp(m.join("|")),y=Y.test(p.contains)||p.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&1===r.nodeType&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},L=p.compareDocumentPosition?function(e,t){if(e===t)return k=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||y(w,e)?-1:t===n||y(w,t)?1:l?j.call(l,e)-j.call(l,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,s=e.parentNode,o=t.parentNode,u=[e],a=[t];if(e===t)return k=!0,0;if(!s||!o)return e===n?-1:t===n?1:s?-1:o?1:l?j.call(l,e)-j.call(l,t):0;if(s===o)return ct(e,t);r=e;while(r=r.parentNode)u.unshift(r);r=t;while(r=r.parentNode)a.unshift(r);while(u[i]===a[i])i++;return i?ct(u[i],a[i]):u[i]===w?-1:a[i]===w?1:0},n):h},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==h&&c(e),t=t.replace(J,"='$1']"),!(!r.matchesSelector||!d||m&&m.test(t)||v&&v.test(t)))try{var n=g.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return ot(t,h,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==h&&c(e),y(e,t)},ot.attr=function(e,n){(e.ownerDocument||e)!==h&&c(e);var i=s.attrHandle[n.toLowerCase()],o=i&&M.call(s.attrHandle,n.toLowerCase())?i(e,n,!d):t;return o===t?r.attributes||!d?e.getAttribute(n):(o=e.getAttributeNode(n))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,n=[],i=0,s=0;if(k=!r.detectDuplicates,l=!r.sortStable&&e.slice(0),e.sort(L),k){while(t=e[s++])t===e[s]&&(i=n.push(s));while(i--)e.splice(n[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},s=ot.selectors={cacheLength:50,createPseudo:at,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return G.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&K.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=RegExp("(^|"+I+")"+e+"("+I+"|$)"))&&T(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),u="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;d=v="only"===e&&!d&&"nextSibling"}return!0}if(d=[o?m.firstChild:m.lastChild],o&&y){l=m[b]||(m[b]={}),f=l[e]||[],p=f[0]===E&&f[1],h=f[0]===E&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(1===c.nodeType&&++h&&c===t){l[e]=[E,p,h];break}}else if(y&&(f=(t[b]||(t[b]={}))[e])&&f[0]===E)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:1===c.nodeType)&&++h&&(y&&((c[b]||(c[b]={}))[e]=[E,h]),c===t))break;return h-=i,h===r||0===h%r&&h/r>=0}}},PSEUDO:function(e,t){var n,r=s.pseudos[e]||s.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],s.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=j.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(W,"$1"));return r[b]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)(s=o[u])&&(e[u]=!(t[u]=s))}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return Q.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=d?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!s.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[0>n?n+t:n]}),even:dt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:dt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},s.pseudos.nth=s.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})s.pseudos[n]=ht(n);for(n in{submit:!0,reset:!0})s.pseudos[n]=pt(n);vt.prototype=s.filters=s.pseudos,s.setFilters=new vt;a=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=mt(e)),n=t.length;while(n--)s=St(t[n]),s[b]?r.push(s):i.push(s);s=C(e,xt(i,r))}return s};r.sortStable=b.split("").sort(L).join("")===b,r.detectDuplicates=k,c(),r.sortDetached=ft(function(e){return 1&e.compareDocumentPosition(h.createElement("div"))}),ft(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase ()?1:2)}),r.attributes&&ft(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ft(function(e){return null==e.getAttribute("disabled")})||lt(F,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,s,o,u=[],a=!e.once&&[],f=function(h){for(t=e.memory&&h,n=!0,o=i||0,i=0,s=u.length,r=!0;u&&s>o;o++)if(u[o].apply(h[0],h[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,u&&(a?a.length&&f(a.shift()):t?u=[]:l.disable())},l={add:function(){if(u){var n=u.length;(function o(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&l.has(n)||u.push(n):n&&n.length&&"string"!==r&&o(n)})})(arguments),r?s=u.length:t&&(i=n,f(t))}return this},remove:function(){return u&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,u,n))>-1)u.splice(n,1),r&&(s>=n&&s--,o>=n&&o--)}),this},has:function(e){return e?x.inArray(e,u)>-1:!!u&&!!u.length},empty:function(){return u=[],s=0,this},disable:function(){return u=a=t=undefined,this},disabled:function(){return!u},lock:function(){return a=undefined,t||l.disable(),this},locked:function(){return!a},fireWith:function(e,t){return!u||n&&!a||(t=t||[],t=[e,t.slice?t.slice():t],r?a.push(t):f(t)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!n}};return l},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,s){var o=s[0],u=x.isFunction(e[t])&&e[t];i[s[1]](function(){var e=u&&u.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o+"With"](this===r?n.promise():this,u?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[1^e][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,s=1===i?e:x.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1)for(u=Array(r),a=Array(r),f=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i;return i||s.resolveWith(f,n),s.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),u=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=u.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(u,null!=u.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),u.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),s=this.cache[i];if("string"==typeof t)s[t]=n;else if(x.isEmptyObject(s))x.extend(this.cache[i],t);else for(r in t)s[r]=t[r];return s},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,s=this.key(e),o=this.cache[s];if(t===undefined)this.cache[s]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in o?r=[t,i]:(r=i,r=r in o?[r]:r.match(w)||[])),n=r.length;while(n--)delete o[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],s=0,o=null;if(e===undefined){if(this.length&&(o=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>s;s++)r=n[s].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,o[r]));q.set(i,"hasDataAttrs",!0)}return o}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),s=x._queueHooks(e,t),o=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(o--)n=q.get(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,s,o=0,u=this.length,a="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(w)||[];u>o;o++)if(n=this[o],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){s=0;while(i=t[s++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(w)||[];u>o;o++)if(n=this[o],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,s=x(this),o=e.match(w)||[];while(t=o[i++])s.hasClass(t)?s.removeClass(t):s.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s="select-one"===e.type||0>i,o=s?null:[],u=s?i+1:r.length,a=0>i?u:s?i:0;for(;u>a;a++)if(n=r[a],!(!n.selected&&a!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),s)return t;o.push(t)}return o},set:function(e,t){var n,r,i=e.options,s=x.makeArray(t),o=i.length;while(o--)r=i[o],(r.selected=x.inArray(x(r).val(),s)>=0)&&(n=!0);return n||(e.selectedIndex=-1),s}}},attr:function(e,t,n){var i,s,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===r?x.prop(e,t,n):(1===o&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(s=i.get(e,t))?s:(s=x.find.attr(e,t),null==s?undefined:s):null!==n?i&&"set"in i&&(s=i.set(e,n,t))!==undefined?s:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(w);if(s&&1===e.nodeType)while(n=s[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,s,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return s=1!==o||!x.isXMLDoc(e),s&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],s=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,s}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;x.event={global:{},add:function(e,t,n,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=q.get(e);if(g){n.handler&&(o=n,n=o.handler,s=o.selector),n.guid||(n.guid=x.guid++),(f=g.events)||(f=g.events={}),(u=g.handle)||(u=g.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(u.elem,arguments)},u.elem=e),t=(t||"").match(w)||[""],l=t.length;while(l--)a=X.exec(t[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),d&&(h=x.event.special[d]||{},d=(s?h.delegateType:h.bindType)||d,h=x.event.special[d]||{},c=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:s,needsContext:s&&x.expr.match.needsContext.test(s),namespace:v.join(".")},o),(p=f[d])||(p=f[d]=[],p.delegateCount=0,h.setup&&h.setup.call(e,i,v,u)!==!1||e.addEventListener&&e.addEventListener(d,u,!1)),h.add&&(h.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),s?p.splice(p.delegateCount++,0,c):p.push(c),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=q.hasData(e)&&q.get(e);if(m&&(a=m.events)){t=(t||"").match(w)||[""],f=t.length;while(f--)if(u=X.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort(),p){c=x.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],!i&&v!==l.origType||n&&n.guid!==l.guid||u&&!u.test(l.namespace)||r&&r!==l.selector&&("**"!==r||!l.selector)||(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&(c.teardown&&c.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,p,m.handle),delete a[p])}else for(p in a)x.event.remove(e,p+t[f],n,r,!0);x.isEmptyObject(a)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,u,a,f,l,c,h,p=[r||o],d=y.call(t,"type")?t.type:t,v=y.call(t,"namespace")?t.namespace.split("."):[];if(u=a=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(v=d.split("."),d=v.shift(),v.sort()),l=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=v.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),h=x.event.special[d]||{},i||!h.trigger||h.trigger.apply(r,n)!==!1)){if(!i&&!h.noBubble&&!x.isWindow(r)){for(f=h.delegateType||d,_.test(f+d)||(u=u.parentNode);u;u=u.parentNode)p.push(u),a=u;a===(r.ownerDocument||o)&&p.push(a.defaultView||a.parentWindow||e)}s=0;while((u=p[s++])&&!t.isPropagationStopped())t.type=s>1?f:h.bindType||d,c=(q.get(u,"events")||{})[t.type]&&q.get(u,"handle"),c&&c.apply(u,n),c=l&&u[l],c&&x.acceptData(u)&&c.apply&&c.apply(u,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||h._default&&h._default.apply(p.pop(),n)!==!1||!x.acceptData(r)||l&&x.isFunction(r[d])&&!x.isWindow(r)&&(a=r[l],a&&(r[l]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,a&&(r[l]=a)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,s,o=[],u=d.call(arguments),a=(q.get(this,"events")||{})[e.type]||[],f=x.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!f.preDispatch||f.preDispatch.call(this,e)!==!1){o=x.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(s.namespace))&&(e.handleObj=s,e.data=s.data,r=((x.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return f.postDispatch&&f.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(!e.button||"click"!==e.type))for(;a!==this;a=a.parentNode||this)if(a.disabled!==!0||"click"!==e.type){for(r=[],n=0;u>n;n++)s=t[n],i=s.selector+" ",r[i]===undefined&&(r[i]=s.needsContext?x(i,this).index(a)>=0:x.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return t.length>u&&o.push({elem:this,handlers:t.slice(u)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,u=this.fixHooks[i];u||(this.fixHooks[i]=u=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=u.props?this.props.concat(u.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),u.filter?u.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var s,o;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(o in e)this.on(o,t,n,e[o],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(s=r,r=function(e){return x().off(e),s.apply(this,arguments)},r.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,s=[],o=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(o?o.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=s.push(n);break}return this.pushStack(s.length>1?x.unique(s):s)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ct={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,s,o,u,a,l=0,c=this.length,h=this,p=c-1,d=e[0],v=x.isFunction(d);if(v||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=h.eq(r);v&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(s=x.map(mt(r,"script"),ft),o=s.length;c>l;l++)u=r,l!==p&&(u=x.clone(u,!0,!0),o&&x.merge(s,mt(u,"script"))),t.call(this[l],u,l);if(o)for(a=s[s.length-1].ownerDocument,x.map(s,ht),l=0;o>l;l++)u=s[l],at.test(u.type||"")&&!q.access(u,"globalEval")&&x.contains(a,u)&&(u.src?x._evalUrl(u.src):x.globalEval(u.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),s=i.length-1,o=0;for(;s>=o;o++)n=o===s?this:this.clone(!0),x(i[o])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(o=mt(u),s=mt(e),r=0,i=s.length;i>r;r++)yt(s[r],o[r]);if(t)if(n)for(s=s||mt(e),o=o||mt(u),r=0,i=s.length;i>r;r++)gt(s[r],o[r]);else gt(e,u);return o=mt(u,"script"),o.length>0&&dt(o,!a&&mt(e,"script")),u},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l=0,c=e.length,h=t.createDocumentFragment(),p=[];for(;c>l;l++)if(i=e[l],i||0===i)if("object"===x.type(i))x.merge(p,i.nodeType?[i]:i);else if(rt.test(i)){s=s||h.appendChild(t.createElement("div")),o=(nt.exec(i)||["",""])[1].toLowerCase(),u=ct[o]||ct._default,s.innerHTML=u[1]+i.replace(tt,"<$1></$2>")+u[2],f=u[0];while(f--)s=s.lastChild;x.merge(p,s.childNodes),s=h.firstChild,s.textContent=""}else p.push(t.createTextNode(i));h.textContent="",l=0;while(i=p[l++])if((!r||-1===x.inArray(i,r))&&(a=x.contains(i.ownerDocument,i),s=mt(h.appendChild(i),"script"),a&&dt(s),n)){f=0;while(i=s[f++])at.test(i.type||"")&&n.push(i)}return h},cleanData:function(e){var t,n,r,i,s,o,u=x.event.special,a=0;for(;(n=e[a])!==undefined;a++){if(F.accepts(n)&&(s=n[q.expando],s&&(t=q.cache[s]))){if(r=Object.keys(t.events||{}),r.length)for(o=0;(i=r[o])!==undefined;o++)u[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[s]&&delete q.cache[s]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,s={},o=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>o;o++)s[t[o]]=x.css(e,t[o],!1,r);return s}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,s,o,u=x.camelCase(t),a=e.style;return t=x.cssProps[u]||(x.cssProps[u]=At(a,u)),o=x.cssHooks[t]||x.cssHooks[u],n===undefined?o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t]:(s=typeof n,"string"===s&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),s="number"),null==n||"number"===s&&isNaN(n)||("number"!==s||x.cssNumber[u]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(a[t]="inherit"),o&&"set"in o&&(n=o.set(e,n,r))===undefined||(a[t]=n)),undefined)}},css:function(e,t,n,r){var i,s,o,u=x.camelCase(t);return t=x.cssProps[u]||(x.cssProps[u]=At(e.style,u)),o=x.cssHooks[t]|| x.cssHooks[u],o&&"get"in o&&(i=o.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(s=parseFloat(i),n===!0||x.isNumeric(s)?s||0:i):i}}),vt=function(e,t,n){var r,i,s,o=n||qt(e),u=o?o.getPropertyValue(t)||o[t]:undefined,a=e.style;return o&&(""!==u||x.contains(e.ownerDocument,e)||(u=x.style(e,t)),Ct.test(u)&&wt.test(t)&&(r=a.width,i=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=u,u=o.width,a.width=r,a.minWidth=i,a.maxWidth=s)),u};x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&bt.test(x.css(e,"display"))?x.swap(e,Et,function(){return Pt(e,t,r)}):Pt(e,t,r):undefined},set:function(e,n,r){var i=r&&qt(e);return Ot(e,n,r?Ft(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},vt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=vt(e,t),Ct.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},s="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+jt[r]+t]=s[r]||s[r-2]||s[0];return i}},wt.test(e)||(x.cssHooks[e+t].set=Ot)});var Wt=/%20/g,$t=/\[\]$/,Bt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&zt.test(this.nodeName)&&!It.test(e)&&(this.checked||!ot.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}}):{name:t.name,value:n.replace(Bt,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join("&").replace(Wt,"+")};x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Xt,Ut,Yt=x.now(),Vt=/\?/,Gt=/#.*$/,Jt=/([?&])_=[^&]*/,Qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Kt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Zt=/^(?:GET|HEAD)$/,en=/^\/\//,tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,nn=x.fn.load,rn={},on={},sn="*/".concat("*");try{Ut=i.href}catch(an){Ut=o.createElement("a"),Ut.href="",Ut=Ut.href}Xt=tn.exec(Ut.toLowerCase())||[];x.fn.load=function(e,t,n){if("string"!=typeof e&&nn)return nn.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>=0&&(r=e.slice(u),e=e.slice(0,u)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),o.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){s=arguments,o.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){o.each(n,s||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ut,type:"GET",isLocal:Kt.test(Xt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":sn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?cn(cn(e,x.ajaxSettings),t):cn(x.ajaxSettings,e)},ajaxPrefilter:un(rn),ajaxTransport:un(on),ajax:function(e,t){function T(e,t,s,u){var f,m,g,b,w,S=t;2!==y&&(y=2,o&&clearTimeout(o),n=undefined,i=u||"",E.readyState=e>0?4:0,f=e>=200&&300>e||304===e,s&&(b=pn(l,E,s)),b=fn(l,b,E,f),f?(l.ifModified&&(w=E.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=E.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e||"HEAD"===l.type?S="nocontent":304===e?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g)):(g=S,(e||!S)&&(S="error",0>e&&(e=0))),E.status=e,E.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,E]):p.rejectWith(c,[E,S,g]),E.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[E,l,f?m:g]),d.fireWith(c,[E,S]),a&&(h.trigger("ajaxComplete",[E,l]),--x.active||x.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=x.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?x(c):x.event,p=x.Deferred(),d=x.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(2===y){if(!s){s={};while(t=Qt.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===y?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>y)for(t in e)v[t]=[v[t],e[t]];else E.always(e[E.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),T(0,t),this}};if(p.promise(E).complete=d.add,E.success=E.done,E.error=E.fail,l.url=((e||l.url||Ut)+"").replace(Gt,"").replace(en,Xt[1]+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=x.trim(l.dataType||"*").toLowerCase().match(w)||[""],null==l.crossDomain&&(u=tn.exec(l.url.toLowerCase()),l.crossDomain=!(!u||u[1]===Xt[1]&&u[2]===Xt[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Xt[3]||("http:"===Xt[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=x.param(l.data,l.traditional)),ln(rn,l,t,E),2===y)return E;a=l.global,a&&0===x.active++&&x.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Zt.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(Vt.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Jt.test(r)?r.replace(Jt,"$1_="+Yt++):r+(Vt.test(r)?"&":"?")+"_="+Yt++)),l.ifModified&&(x.lastModified[r]&&E.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&E.setRequestHeader("If-None-Match",x.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&E.setRequestHeader("Content-Type",l.contentType),E.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+sn+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)E.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,E,l)!==!1&&2!==y){b="abort";for(f in{success:1,error:1,complete:1})E[f](l[f]);if(n=ln(on,l,t,E)){E.readyState=1,a&&h.trigger("ajaxSend",[E,l]),l.async&&l.timeout>0&&(o=setTimeout(function(){E.abort("timeout")},l.timeout));try{y=1,n.send(m,T)}catch(S){if(!(2>y))throw S;T(-1,S)}}else T(-1,"No Transport");return E}return E.abort()},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var hn=[],dn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||x.expando+"_"+Yt++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,s,o,u=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");return u||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,u?t[u]=t[u].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(Vt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return o||x.error(i+" was not called"),o[0]},t.dataTypes[0]="json",s=e[i],e[i]=function(){o=arguments},r.always(function(){e[i]=s,t[i]&&(t.jsonpCallback=n.jsonpCallback,hn.push(i)),o&&x.isFunction(s)&&s(o[0]),o=s=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gn=x.ajaxSettings.xhr(),mn={0:200,1223:204},yn=0,vn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in vn)vn[e]();vn=undefined}),x.support.cors=!!gn&&"withCredentials"in gn,x.support.ajax=gn=!!gn,x.ajaxTransport(function(e){var t;return x.support.cors||gn&&!e.crossDomain?{send:function(n,r){var i,s,o=e.xhr();if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)o[i]=e.xhrFields[i];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)o.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete vn[s],t=o.onload=o.onerror=null,"abort"===e?o.abort():"error"===e?r(o.status||404,o.statusText):r(mn[o.status]||o.status,o.statusText,"string"==typeof o.responseText?{text:o.responseText}:undefined,o.getAllResponseHeaders()))}},o.onload=t(),o.onerror=t("error"),t=vn[s=yn++]=t("abort"),o.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var xn,bn,wn=/^(?:toggle|show|hide)$/,Tn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Cn=/queueHooks$/,kn=[An],Nn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tn.exec(t),s=i&&i[3]||(x.cssNumber[e]?"":"px"),o=(x.cssNumber[e]||"px"!==s&&+r)&&Tn.exec(x.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3],i=i||[],o=+r||1;do u=u||".5",o/=u,x.style(n.elem,e,o+s);while(u!==(u=n.cur()/r)&&1!==u&&--a)}return i&&(o=n.start=+o||+r||0,n.unit=s,n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]),n}]};x.Animation=x.extend(jn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Nn[n]=Nn[n]||[],Nn[n].unshift(t)},prefilter:function(e,t){t?kn.unshift(e):kn.push(e)}});x.Tween=Ln,Ln.prototype={constructor:Ln,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(x.cssNumber[n]?"":"px")},cur:function(){var e=Ln.propHooks[this.prop];return e&&e.get?e.get(this):Ln.propHooks._default.get(this)},run:function(e){var t,n=Ln.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ln.propHooks._default.set(this),this}},Ln.prototype.init.prototype=Ln.prototype,Ln.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ln.propHooks.scrollTop=Ln.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(qn(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Lt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),s=x.speed(t,n,r),o=function(){var t=jn(this,x.extend({},e),s);(i||q.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",s=x.timers,o=q.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&Cn.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem!==this||null!=e&&s[i].queue!==e||(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=x.timers,o=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;o>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});x.each({slideDown:qn("show"),slideUp:qn("hide"),slideToggle:qn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=Ln.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(xn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),xn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){bn||(bn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(bn),bn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],s={top:0,left:0},o=i&&i.ownerDocument;if(o)return t=o.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(s=i.getBoundingClientRect()),n=Hn(o),{top:s.top+n.pageYOffset-t.clientTop,left:s.left+n.pageXOffset-t.clientLeft}):s},x.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=x.css(e,"position"),c=x(e),h={};"static"===l&&(e.style.position="relative"),u=c.offset(),s=x.css(e,"top"),a=x.css(e,"left"),f=("absolute"===l||"fixed"===l)&&(s+a).indexOf("auto")>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),x.isFunction(t)&&(t=t.call(e,n,u)),null!=t.top&&(h.top=t.top-u.top+o),null!=t.left&&(h.left=t.left-u.left+i),"using"in t?t.using.call(e,h):c.css(h)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,s){var o=Hn(t);return s===undefined?o?o[n]:t[i]:(o?o.scrollTo(r?e.pageXOffset:s,r?s:e.pageYOffset):t[i]=s,undefined)},t,i,arguments.length,null)}});x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var s=arguments.length&&(n||"boolean"!=typeof r),o=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,o):x.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
16,706.2
32,770
0.65074
3b4eeac1a138f7605c963f2a2b7e206481d0953f
3,791
js
JavaScript
reference/sketchbook/misc/throttling.js
JaDogg/__py_playground
416f88db10e03f5380bcb5cfcad0bca50ffa657c
[ "MIT" ]
1
2015-10-28T00:00:16.000Z
2015-10-28T00:00:16.000Z
reference/sketchbook/misc/throttling.js
JaDogg/__py_playground
416f88db10e03f5380bcb5cfcad0bca50ffa657c
[ "MIT" ]
null
null
null
reference/sketchbook/misc/throttling.js
JaDogg/__py_playground
416f88db10e03f5380bcb5cfcad0bca50ffa657c
[ "MIT" ]
null
null
null
// David Nolen pointed out http://underscorejs.org/docs/underscore.html#section-64 // as an example of hairy code. I wrote this to understand it. Everything on this // page is untested. // Basis to elaborate on: a wrapper for func. function unthrottled(func) { return function() { return func.apply(this, arguments); }; } // For the following wrappers for func let's say a 'request' is when // you call the wrapper; and when the wrapper actually calls func, // that's a 'call'. // A sync throttle: any requests within refractoryPeriod after the // last call get the last call's result. function throttle(func, refractoryPeriod) { var wakeTime = 0, lastResult; return function() { var now = Date.now(); if (wakeTime <= now) { wakeTime = now + refractoryPeriod; lastResult = func.apply(this, arguments); } return lastResult; }; } // A simplest async throttle-ish thing: call func() periodically until // someone calls .stop(); get the latest result from .value. function throttle(func, interval) { function update() { result.value = func(); // N.B. different interface timeoutId = setTimeout(update, interval); } var result = { value: undefined, stop: function() { clearTimeout(timeoutId); }, }; var timeoutId = setTimeout(update, 0); return result; } // Fancier: like Underscore's, passes `this` and arguments each time. // Unlike Underscore's, it always calls the func asynchronously. This // happens every interval msec, using the most recent this/arguments // each time, until the whole interval goes by without a request. (It // still does one final update then, like Underscore's.) function throttle(func, interval, value) { // Return the most recent async result, and ensure it'll get // updated. function ask() { context = this, args = arguments; asked = true; schedule(0); return value; } function schedule(wait) { if (timeoutId === null) timeoutId = setTimeout(update, wait); } function update() { timeoutId = null; if (asked) schedule(interval); asked = false; value = func.apply(context, args); } var context, args; var asked = false, timeoutId = null; return ask; } // Mixed sync/async throttling, Underscore-style. // A request in the refractoryPeriod after a call schedules an async // call for the end of the period, and immediately returns the last // result. Other requests call func immediately. The async call uses // `this` and `arguments` from the most recent request. function throttle(func, refractoryPeriod) { var lastResult, context, args; var wakeTime = 0, timeoutId = null; function ask() { context = this, args = arguments; var now = Date.now(); if (now < wakeTime) { // We're in the refractory period after a call. if (timeoutId === null) timeoutId = setTimeout(update, wakeTime - now); } else { // We're good to go. First cancel any lagging async call. clearTimeout(timeoutId); update(now); } return lastResult; } function update(now) { timeoutId = null; wakeTime = (now || Date.now()) + refractoryPeriod; lastResult = func.apply(context, args); } return ask; } // Editorial: Underscore's works out to be similar to my code for the // same spec, but as usual with Underscore it's scantily documented // and it's a pain to reverse-engineer the details. // Mixing sync and async calls to the same function seems a recipe for // trouble, but doesn't make the throttle function itself greatly // harder to follow.
34.153153
82
0.646004
3b4f1f3d1c37c182ca17fd606312e2794165205b
418
js
JavaScript
src/svg-icons/av/playlist-add.js
quandhz/material-ui
b86b6424a1e1031469b7c3dd3ef905e387fb5cb6
[ "MIT" ]
16
2017-05-28T14:50:30.000Z
2022-03-09T08:12:50.000Z
src/svg-icons/av/playlist-add.js
cherishstand/material-ui
f2edf58f6e1683ce26f5046ce05a6c9e83b60928
[ "MIT" ]
107
2017-05-19T18:18:46.000Z
2022-03-02T04:33:36.000Z
src/svg-icons/av/playlist-add.js
cherishstand/material-ui
f2edf58f6e1683ce26f5046ce05a6c9e83b60928
[ "MIT" ]
16
2017-05-08T17:14:39.000Z
2022-03-31T18:51:27.000Z
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvPlaylistAdd = (props) => ( <SvgIcon {...props}> <path d="M14 10H2v2h12v-2zm0-4H2v2h12V6zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2 16h8v-2H2v2z"/> </SvgIcon> ); AvPlaylistAdd = pure(AvPlaylistAdd); AvPlaylistAdd.displayName = 'AvPlaylistAdd'; AvPlaylistAdd.muiName = 'SvgIcon'; export default AvPlaylistAdd;
27.866667
97
0.729665
3b4ff85356201ee8a87812d9fbac7f193d32044c
116
js
JavaScript
doc/html/search/variables_0.js
vfrydrychowski/Auto-Analyse
f6399156e49a65daab0f667401c31bcacbc9ab36
[ "MIT" ]
null
null
null
doc/html/search/variables_0.js
vfrydrychowski/Auto-Analyse
f6399156e49a65daab0f667401c31bcacbc9ab36
[ "MIT" ]
1
2022-03-22T15:48:15.000Z
2022-03-22T15:48:15.000Z
doc/html/search/variables_0.js
vfrydrychowski/Auto-Analyse
f6399156e49a65daab0f667401c31bcacbc9ab36
[ "MIT" ]
null
null
null
var searchData= [ ['a_0',['a',['../namespaceinterface.html#ae471c0e676216758e9bfb1afc5fe7500',1,'interface']]] ];
23.2
94
0.706897
3b50000665c1555689627960916841fbfce49011
1,882
js
JavaScript
src/tutorials/polyglot/todo_tooling/todo/static/todo.js
pauleveritt/pauleveritt.github.io
3e4707dba1f3a57297f90c10cc2da4c3075c1a69
[ "BSD-3-Clause" ]
8
2016-07-15T19:58:29.000Z
2021-03-11T09:57:11.000Z
src/tutorials/polyglot/todo_tooling/todo/static/todo.js
pauleveritt/pauleveritt.github.io
3e4707dba1f3a57297f90c10cc2da4c3075c1a69
[ "BSD-3-Clause" ]
2
2015-11-26T13:54:52.000Z
2016-03-03T13:04:17.000Z
src/tutorials/polyglot/todo_tooling/todo/static/todo.js
pauleveritt/pauleveritt.github.io
3e4707dba1f3a57297f90c10cc2da4c3075c1a69
[ "BSD-3-Clause" ]
6
2016-03-01T13:05:00.000Z
2016-10-11T16:37:18.000Z
(function () { $(document).ready(function () { var newName = $('#newName'), todoList = $('#todoList'), template = tmpl('list_todos'); var todos; function refreshToDos () { /* Fetch the list of todos and re-draw the listing */ $.get('/api/todo', function (data) { todos = data['objects']; todoList.find('ul') .replaceWith(template({todos: todos})); }); } // Create a new to do newName.change(function () { var payload = JSON.stringify({name: newName.val()}); $.post('/api/todo', payload, function () { refreshToDos(); newName.val(''); }) }); // Edit a to do todoList.on('click', '.edit', function () { // Toggle the <input> for this todo todoList.find('li').removeAttr('editing'); var li = $(this).closest('li').first().attr('editing', '1'); }); todoList.on('change', 'input', function () { // When the revealed-input changes, update using PATCH var todoId = $(this).closest('li')[0].id, data = JSON.stringify({name: $(this).val()}); $.ajax({url: '/api/todo/' + todoId, type: 'PATCH', data: data}) .done(function () { refreshToDos(); }); }); // Delete an existing to do todoList.on('click', '.delete', function () { var todoId = $(this).closest('li')[0].id; $.ajax({url: '/api/todo/' + todoId, type: 'DELETE'}) .done(function () { refreshToDos(); }); }); // On startup, go fetch the list of todos and re-draw refreshToDos(); }); })();
32.448276
75
0.447928
3b507567035b5ec5a81909c0709159454110e605
338
js
JavaScript
examples/simple/webpack.config.js
felixhao28/event-hooks-webpack-plugin
7b7878543f4df970e0c7c82b6fe1f835f35b6d6d
[ "MIT" ]
null
null
null
examples/simple/webpack.config.js
felixhao28/event-hooks-webpack-plugin
7b7878543f4df970e0c7c82b6fe1f835f35b6d6d
[ "MIT" ]
null
null
null
examples/simple/webpack.config.js
felixhao28/event-hooks-webpack-plugin
7b7878543f4df970e0c7c82b6fe1f835f35b6d6d
[ "MIT" ]
null
null
null
const EventHooksPlugin = require('../../lib'); module.exports = { plugins: [ new EventHooksPlugin({ run: () => { console.log(`Executing 'run' callback task`); }, done: () => { console.log(`Executing 'done' callback task`); } }) ] };
22.533333
62
0.431953
3b5120af19132412badb043a292716b80cb9236e
21,726
js
JavaScript
anvil/driver/common.js
jonalter/titanium_mobile
5f47148d322de7dece1d9ecbe2dabe44d959ea95
[ "Apache-2.0" ]
1
2015-11-05T01:19:58.000Z
2015-11-05T01:19:58.000Z
anvil/driver/common.js
alg/titanium_mobile
4e74ade5b9696132db674a28090fa639f3967960
[ "Apache-2.0" ]
null
null
null
anvil/driver/common.js
alg/titanium_mobile
4e74ade5b9696132db674a28090fa639f3967960
[ "Apache-2.0" ]
1
2019-03-15T04:55:17.000Z
2019-03-15T04:55:17.000Z
/* * Appcelerator Titanium Mobile * Copyright (c) 2011-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * Purpose: common file across platforms for driver tasks * * Description: contains common logic used by all platforms when executing driver tasks. * Most of the logic defined here represents only partial pieces of an overall task and most * of these functions are invoked by the platform specific task handlers. As the test format * between driver and harness is not platform specific, the handling mechanism is defined in * this file. */ var fs = require("fs"), path = require("path"), wrench = require("wrench"), driverUtils = require(path.resolve(driverGlobal.driverDir, "driverUtils")); module.exports = new function() { var self = this; /* any key/value pairs stored in here will be injected into the harness config tiapp.xml as property entries */ this.customTiappXmlProperties = {}; // keeps track of state within the harness set/config list var configs; var configSetIndex; var configIndex; /* keeps track of where the specified harness set/config can be found within the harness set/ config list */ var selectedConfigSetIndex; var selectedConfigIndex; // specified suite and test args (pulled off at the start of the run so store them) var selectedSuiteArg; var selectedTestArg; /* keep track of where we are in the result set which can be different from the set/config master list */ var results; var resultConfigSetIndex; var resultConfigIndex; var resultSuiteIndex; var resultTestIndex; // actual list of suites and tests reported by the harness var reportedSuites; var reportedTests; var timer; // set per test in order to catch timeouts /* called once per test pass no matter how many config sets, configs, suites or tests happen to be involved. This is where general init or cleaning logic that needs to occur before a test run kicks off should live. Inside this method, the harness config list will be built (or rebuilt), the arguments given to the start command will be pulled off and processed (in the case of a specified config set or config), the log file for the test run will be initialized and the result set will be initialized */ this.startTestPass = function(startArgs, successCallback, errorCallback) { configs = []; results = []; configSetIndex = 0; configIndex = 0; selectedConfigSetIndex = null; selectedConfigIndex = null; // build list of tiapp.xml and app.js combinations function loadHarnessConfigs() { function loadConfig(setIndex, configDir, configName) { var stat = fs.statSync(path.resolve(configDir, configName)); if (stat.isDirectory()) { configs[setIndex].setConfigs.push({ configDir: configDir, configName: configName }); } } // load standard configs var files = fs.readdirSync(path.resolve(driverGlobal.configSetDir, "configs")); if (files.length > 0) { configs.push({ setDir: driverGlobal.configSetDir, setName: "standard", setConfigs: [] }); for (var i = 0; i < files.length; i++) { loadConfig((configs.length - 1), path.resolve(driverGlobal.configSetDir, "configs"), files[i]); } } // load custom configs if ((typeof driverGlobal.config.customHarnessConfigDirs) !== "undefined") { if (Object.prototype.toString.call(driverGlobal.config.customHarnessConfigDirs) === "[object Array]") { for (var i = 0; i < driverGlobal.config.customHarnessConfigDirs.length; i++) { var configSetDir = driverGlobal.config.customHarnessConfigDirs[i]; var configSetName; // load the config set name if (path.existsSync(path.resolve(configSetDir, "name.txt"))) { configSetName = driverUtils.trimStringRight(fs.readFileSync(path.resolve(configSetDir, "name.txt"), "ascii")); } else { driverUtils.log("the custom harness config set at <" + configSetDir + "/name.txt" + "> does not contain a name.txt file that provides a harness config set name, ignoring", driverGlobal.logLevels.quiet); continue; } var files = fs.readdirSync(path.resolve(configSetDir, "configs")); if (files.length > 0) { configs.push({ setDir: configSetDir, setName: configSetName, setConfigs: [] }); for (var j = 0; j < files.length; j++) { loadConfig((configs.length - 1), path.resolve(configSetDir, "configs"), files[j]); } } } } else { driverUtils.log("the customHarnessConfigDirs property in the config module is set but is not an array", driverGlobal.logLevels.quiet); } } if (configs.length < 1) { driverUtils.log("there must be at least one harness config, exiting"); process.exit(1); } } /* process the arguments passed to the "start" command (not the arguments that were passed to the driver itself) */ var processStartArgsCallback = function() { var errorState = false; var configSetArg = driverUtils.getArgument(startArgs, "--config-set"); if ((typeof configSetArg) !== "undefined") { var numConfigSets = configs.length; for (var i = 0; i < numConfigSets; i++) { if (configSetArg === configs[i].setName) { configSetIndex = i; selectedConfigSetIndex = i; break; } } if (selectedConfigSetIndex === null) { driverUtils.log("specified config set is not recognized"); errorState = true; } } // config set must have also been specified if there is more than a single config set var configArg = driverUtils.getArgument(startArgs, "--config"); if ((selectedConfigSetIndex !== null) || (configs.length === 1 )) { if ((typeof configArg) !== "undefined") { var numConfigs = configs[configSetIndex].setConfigs.length; for (var i = 0; i < numConfigs; i++) { if (configArg === configs[configSetIndex].setConfigs[i].configName) { configIndex = i; selectedConfigIndex = i; break; } } if (selectedConfigIndex === null) { driverUtils.log("specified config is not recognized"); errorState = true; } } } else if ((selectedConfigSetIndex === null) && ((typeof configArg) !== "undefined")) { driverUtils.log("valid --config-set argument must be provided when --config is specified"); errorState = true; } if (!errorState) { selectedSuiteArg = driverUtils.getArgument(startArgs, "--suite"); selectedTestArg = driverUtils.getArgument(startArgs, "--test"); successCallback(); } else { errorCallback(); } }; loadHarnessConfigs(); driverUtils.openLog(processStartArgsCallback); }; /* * invoked each time a run of a config is started. the commandElements argument is only * defined the first time this function is called at the start of a test pass. the overall * purpose of this function is to cycle configs during a test pass and reset other state * variables */ this.startConfig = function(callback) { /* this is the only safe place to reset the suite and test states - if done in the message processing there is a chance that the config has just been restarted to deal with a timeout and the states would be reset prematurely */ resultSuiteIndex = 0; resultTestIndex = 0; // add the config set to the results if it does not exist var foundSet = false; for (var i = 0; i < results.length; i++) { if (results[i].setName === configs[configSetIndex].setName) { foundSet = true; } } if (!foundSet) { results.push({ setName: configs[configSetIndex].setName, setConfigs: [] }); resultConfigSetIndex = results.length - 1; } // add the config to the config set entry in the results (no risk of duplicate entry) results[resultConfigSetIndex].setConfigs.push({ configName: configs[configSetIndex].setConfigs[configIndex].configName, configSuites: [] }); resultConfigIndex = results[resultConfigSetIndex].setConfigs.length - 1; callback(); }; /* * basically this function handles picking between starting a new config pass and finishing * the test pass */ this.finishConfig = function(passFinishedCallback) { var finishPass = false; // roll to the next config and roll to the next set if need be configIndex++; if ((configIndex + 1) > configs[configSetIndex].setConfigs.length) { configSetIndex++; if ((configSetIndex + 1) > configs.length) { finishPass = true; // this was the last set, finish the whole pass } else { // this was the last config in the set, reset for the start of the new set configIndex = 0; } } if (selectedConfigIndex !== null) { /* if we are here then that means that the specified config has finished and we don't support running a specified config across multiple sets so finish the pass */ finishPass = true; } if (finishPass) { driverUtils.closeLog(); passFinishedCallback(results); } else { driverGlobal.platform.startConfig(); } }; this.createHarness = function(platform, command, successCallback, errorCallback) { var harnessPlatformDir = path.resolve(driverGlobal.harnessDir, platform); var createCallback = function() { try { fs.mkdirSync(harnessPlatformDir, 0777); } catch(e) { driverUtils.log("temp " + platform + " harness dir already exist"); } driverUtils.runCommand(command, driverUtils.logStdout, function(error) { if (error !== null) { driverUtils.log("error encountered when creating harness: " + error); if (errorCallback) { errorCallback(); } } else { driverUtils.log("harness created"); updateHarness(platform, successCallback, errorCallback); } }); }; if (path.existsSync(path.resolve(harnessPlatformDir, "harness", "tiapp.xml"))) { this.deleteHarness(platform, createCallback); } else { createCallback(); } }; /* * makes sure that the newly created harness contains the correct tiapp.xml and resources * based on the harness template */ var updateHarness = function(platform, successCallback, errorCallback) { var config = configs[configSetIndex].setConfigs[configIndex]; var configDir = path.resolve(config.configDir, config.configName); var harnessPlatformDir = path.resolve(driverGlobal.harnessDir, platform); var updateSuitesCallback = function() { try { wrench.copyDirSyncRecursive(path.resolve(configs[configSetIndex].setDir, "Resources"), path.resolve(harnessPlatformDir, "harness", "Resources"), {preserve: true}); driverUtils.log("harness suites updated"); updateTiappCallback(); } catch(exception) { driverUtils.log("unable to update the harness suites: " + exception); if (errorCallback) { errorCallback(); } } }; var updateTiappCallback = function() { function injectCustomTiappXmlProperties() { if (self.customTiappXmlProperties.length < 1) { // nothing custom to add so leave the copy alone return; } var tiappXmlPath = path.resolve(harnessPlatformDir, "harness", "tiapp.xml"); var tiappXmlContents; // load the config set name if (path.existsSync(tiappXmlPath)) { try { tiappXmlContents = fs.readFileSync(tiappXmlPath, "utf8"); } catch(e) { self.log("exception <" + e + "> occurred when reading tiapp.xml at: " + tiappXmlPath); } } else { /* this should not happen since the path to the tiapp.xml is passed in and it is assumed that the file should exist in the harness before we start injecting values. Die hard! */ driverUtils.log("no tiapp.xml file found at: " + tiappXmlPath, driverGlobal.logLevels.quiet); process.exit(1); } var splitPos = tiappXmlContents.indexOf("</ti:app>"); if (splitPos === -1) { /* this could only happen if the tiapp.xml in the config is messed up so die hard if it happens */ driverUtils.log("no closing ti:app tag found in the tiapp.xml file"); process.exit(1); } var preSplit = tiappXmlContents.substring(0, splitPos); var postSplit = tiappXmlContents.substring(splitPos, tiappXmlContents.length - 1); var newTiappXmlContents = preSplit; for (var key in self.customTiappXmlProperties) { if (self.customTiappXmlProperties.hasOwnProperty(key)) { var foundPos = tiappXmlContents.indexOf("<property name=\"" + key + "\""); if (foundPos === -1) { /* make sure to only inject if the value doesn't already exist in the config tiapp.xml so we avoid duplicates */ newTiappXmlContents += "\t<property name=\"" + key + "\" type=\"" + self.customTiappXmlProperties[key].type + "\">" + self.customTiappXmlProperties[key].value + "</property>\n"; } } } newTiappXmlContents += postSplit; fs.writeFileSync(tiappXmlPath, newTiappXmlContents); } driverUtils.copyFile(path.resolve(configDir, "tiapp.xml"), path.resolve(harnessPlatformDir, "harness", "tiapp.xml"), function(error) { if (error !== null) { driverUtils.log("unable to update the harness tiapp.xml: " + error); if (errorCallback) { errorCallback(); } } else { injectCustomTiappXmlProperties(); driverUtils.log("harness tiapp.xml updated"); updateAppjsCallback(); } }); }; var updateAppjsCallback = function() { if (path.existsSync(path.resolve(configDir, "app.js"))) { driverUtils.copyFile(path.resolve(configDir, "app.js"), path.resolve(harnessPlatformDir, "harness", "Resources", "app.js"), function(error) { if (error !== null) { driverUtils.log("unable to update app.js for harness: " + error); if (errorCallback) { errorCallback(); } } else { driverUtils.log("app.js updated for harness"); if (successCallback) { successCallback(); } } }); } else { successCallback(); } }; // update the harness based on the harness template packaged with the driver try { wrench.copyDirSyncRecursive(driverGlobal.harnessTemplateDir, path.resolve(harnessPlatformDir, "harness", "Resources"), {preserve: true}); driverUtils.log("harness updated with template"); updateSuitesCallback(); } catch(exception) { driverUtils.log("unable to update harness with template: " + exception); if (errorCallback) { errorCallback(); } } }; this.deleteHarness = function(platform, callback) { var harnessDir = path.resolve(driverGlobal.harnessDir, platform, "harness"); if (path.existsSync(harnessDir)) { wrench.rmdirSyncRecursive(harnessDir, true); driverUtils.log("harness deleted"); } callback(); }; /* this function handles messages from the driver and implements the communication protocol outlined in the driver.js comment section */ this.processHarnessMessage = function(rawMessage) { var message; try { message = JSON.parse(rawMessage); } catch(e) { // this means something has gone waaaaaay wrong console.log("exception <" + e + "> occured when trying to convert JSON message <" + rawMessage + "> from Driver"); process.exit(1); } var responseData = ""; if ((typeof message) !== "object") { driverUtils.log("invalid message, expecting object"); return responseData; } if (message.type === "ready") { responseData = "getSuites"; } else if (message.type === "suites") { reportedSuites = message.suites; if (selectedSuiteArg) { var found = false; // does the specified suite even exist in the current config? for (var i = 0; i < reportedSuites.length; i++) { if (selectedSuiteArg === reportedSuites[i].name) { /* usually we let incrementTest() handle rolling this value but in this case we need to jump to the specified index */ resultSuiteIndex = i; responseData = startSuite(); found = true; } } if (!found) { driverUtils.log("specified suite not found"); // maybe the next config has the suite we are looking for? driverGlobal.platform.finishConfig(); } } else { if (reportedSuites.length === 0) { driverUtils.log("no suites found for configuration"); driverGlobal.platform.finishConfig(); } else { responseData = startSuite(); } } } else if (message.type === "tests") { var found = false; reportedTests = message.tests; /* does the current suite already exist in the results? Since we restart a suite when a timeout occurs, it is possible to already have the suite in the results */ var configSuites = results[resultConfigSetIndex].setConfigs[resultConfigIndex].configSuites; var numSuites = configSuites.length; for (var i = 0; i < numSuites; i++) { if (reportedSuites[resultSuiteIndex].name === configSuites[i].suiteName) { found = true; } } // only add the suite to the results if the suite doesn't already exist in the results if (!found) { configSuites.push({ suiteName: reportedSuites[resultSuiteIndex].name, suiteTests: [] }); } // in order to run a specific test, the suite must also be specified. Ignore otherwise if (selectedSuiteArg && selectedTestArg) { var found = false; for (var i = 0; i < reportedTests.length; i++) { if (selectedTestArg === reportedTests[i].name) { resultTestIndex = i; found = true; break; } } if (found) { responseData = startTest(); } else { /* we can finish the entire config here since we know that a suite had to be specified and therefore this suite is the only one being run for the config. In the case of the test not being found, we could just ignore the arg and run the entire suite but I would prefer to log an error and just finish the config rather than running tests that the user did not specify */ driverUtils.log("specified test not found"); driverGlobal.platform.finishConfig(); } } else { responseData = startTest(); } } else if (message.type === "result") { /* now that we have a result, make sure we cancel the timer first so we don't risk triggering a exception while we process the result */ clearTimeout(timer); addResult(message.result, message.description, message.duration); driverUtils.log("suite<" + message.suite + "> test<" + message.test + "> result<" + message.result + ">"); if (selectedSuiteArg && selectedTestArg) { /* since this was the only test in the config that we needed to run just move onto the next config */ driverGlobal.platform.finishConfig(); } else { var next = incrementTest(); if (next === "suite") { responseData = startSuite(); } else if (next === "test") { responseData = startTest(); } } } return responseData; }; var startSuite = function() { return "getTests|" + reportedSuites[resultSuiteIndex].name; }; var startTest = function() { var timeout = driverGlobal.config.defaultTestTimeout; // if there is a custom timeout set for the test, override the default var testTimeout = reportedTests[resultTestIndex].timeout; if ((typeof testTimeout) !== "undefined") { timeout = parseInt(testTimeout); } /* add this so that we give a little overhead for network latency. The goal here is that is that general network overhead doesn't eat up time out of a specific test timeout */ timeout += 500; var suiteName = reportedSuites[resultSuiteIndex].name; var testName = reportedTests[resultTestIndex].name; /* we need a fall back in the case of a test timing out which might occur for a variety of reason such as poorly written test, legitimate test failure of device issue */ timer = setTimeout(function() { addResult("timeout", "", timeout); driverUtils.log("suite<" + suiteName + "> test<" + testName + "> result<timeout>"); if (selectedSuiteArg && selectedTestArg) { driverGlobal.platform.finishConfig(); } else { /* make sure we skip to the next test in the event of failure otherwise this will loop forever (assuming that the timeout is consistent with each run of the test) */ incrementTest(); driverGlobal.platform.resumeConfig(); } }, timeout); console.log("running suite<" + suiteName + "> test<" + testName + ">..."); return "run|" + suiteName + "|" + testName; }; function addResult(result, description, duration) { var configSuites = results[resultConfigSetIndex].setConfigs[resultConfigIndex].configSuites; var numSuites = configSuites.length; configSuites[numSuites - 1].suiteTests.push({ testName: reportedTests[resultTestIndex].name, testResult: { result: result, description: description, duration: duration } }); } /* * when a test is finished, update the current test and if need be, roll over into the * next suite. returns value indicating what the next test position is */ var incrementTest = function() { if (resultTestIndex < (reportedTests.length - 1)) { resultTestIndex++; return "test"; } else { driverUtils.log("test run finished for suite<" + reportedSuites[resultSuiteIndex].name + ">"); if (resultSuiteIndex < (reportedSuites.length - 1)) { if (selectedSuiteArg) { driverGlobal.platform.finishConfig(); } else { resultTestIndex = 0; resultSuiteIndex++; return "suite"; } } else { driverUtils.log("all suites completed"); driverGlobal.platform.finishConfig(); } } return ""; }; };
30.471248
184
0.673433
3b51507e66a63bc770cd14ef53aba80cdb84db29
7,572
js
JavaScript
src/desktop/apps/editorial_features/test/components/venice_2017/video.test.js
pepopowitz/force
06c33c6c76b3bc62fa332de10112f9f61f7aacc1
[ "MIT" ]
null
null
null
src/desktop/apps/editorial_features/test/components/venice_2017/video.test.js
pepopowitz/force
06c33c6c76b3bc62fa332de10112f9f61f7aacc1
[ "MIT" ]
null
null
null
src/desktop/apps/editorial_features/test/components/venice_2017/video.test.js
pepopowitz/force
06c33c6c76b3bc62fa332de10112f9f61f7aacc1
[ "MIT" ]
null
null
null
/* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const _ = require("underscore") const benv = require("benv") const sinon = require("sinon") const Backbone = require("backbone") const Curation = require("../../../../../models/curation.coffee") const Article = require("../../../../../models/article") const markdown = require("../../../../../components/util/markdown.coffee") const { resolve } = require("path") xdescribe("Venice Video", function () { beforeEach(function (done) { return benv.setup(() => { benv.expose({ $: benv.require("jquery"), jQuery: benv.require("jquery"), moment: require("moment"), crop: sinon.stub(), markdown, VRView: { Player: (this.player = sinon.stub()).returns({ on: sinon.stub(), play: (this.play = sinon.stub()), pause: (this.pause = sinon.stub()), getDuration: sinon.stub().returns(100), iframe: { src: "" }, setVolume: (this.setVolume = sinon.stub()), setCurrentTime: (this.setCurrentTime = sinon.stub()), }), }, }) Backbone.$ = $ $.fn.fadeOut = sinon.stub() $.fn.fadeIn = sinon.stub() this.clock = sinon.useFakeTimers() this.options = { asset() {}, sd: { APP_URL: "localhost" }, videoIndex: 0, curation: new Curation({ sub_articles: [], description: "description", sections: [ { description: "description", cover_image: "", }, ], }), sub_articles: [], videoGuide: new Article({ id: "123", title: "Video Guide" }), } return benv.render( resolve( __dirname, "../../../components/venice_2017/templates/index.jade" ), this.options, () => { const VeniceVideoView = benv.requireWithJadeify( resolve(__dirname, "../../../components/venice_2017/client/video"), [] ) VeniceVideoView.__set__("sd", { APP_URL: "localhost" }) VeniceVideoView.__set__("noUiSlider", { create: (this.scrubberCreate = sinon.stub()).returns({ on: (this.on = sinon.stub()), set: sinon.stub(), }), }) VeniceVideoView.__set__("analyticsHooks", { trigger: (this.analytics = sinon.stub()), }) this.view = new VeniceVideoView({ el: $("body"), video: "/vanity/videos/scenic_mono_3.mp4", }) this.view.trigger = sinon.stub() return done() } ) }) }) afterEach(function () { this.clock.restore() return benv.teardown() }) it("sets up video", function () { this.player.args[0][0].should.equal("#vrvideo") return this.player.args[0][1].video.should.equal( "/vanity/videos/scenic_mono_3.mp4" ) }) it("sets up scrubber #onVRViewReady", function () { this.view.onVRViewReady() this.scrubberCreate.args[0][1].behaviour.should.equal("snap") this.scrubberCreate.args[0][1].start.should.equal(0) this.scrubberCreate.args[0][1].range.min.should.equal(0) return this.scrubberCreate.args[0][1].range.max.should.equal(100) }) it("emits an error if the browser is not supported", function () { this.view.onVRViewError({ message: "Sorry, browser not supported" }) this.view.trigger.args[0][0].should.equal("videoError") return this.view.trigger.args[0][1].should.equal( "Sorry, browser not supported" ) }) it("does not try to update scrubber while dragging", function () { this.view.onVRViewReady() this.on.args[0][1]() return this.view.scrubbing.should.be.true() }) it("sets the time on scrubber change", function () { this.view.onVRViewReady() this.on.args[1][1]([12]) this.setCurrentTime.args[0][0].should.equal(12) return this.view.scrubbing.should.be.false() }) it("toggles play", function () { this.view.vrView.isPaused = true this.view.onTogglePlay() return this.play.callCount.should.equal(1) }) it("toggles pause", function () { this.view.vrView.isPaused = false this.view.onTogglePlay() return this.pause.callCount.should.equal(1) }) it("toggles mute", function () { this.view.onToggleMute() this.setVolume.callCount.should.equal(1) return this.setVolume.args[0][0].should.equal(0) }) it("toggles unmute", function () { $("#togglemute").attr("data-state", "muted").addClass("muted") this.view.onToggleMute() this.setVolume.callCount.should.equal(1) return this.setVolume.args[0][0].should.equal(1) }) it("toggles completed cover on video completion", function () { this.view.onVRViewReady() this.view.updateTime({ currentTime: 100 }) return this.view.trigger.args[1][0].should.eql("videoCompleted") }) it("swaps the video", function () { this.view.swapVideo({ video: "videourl" }) return this.view.vrView.iframe.src.should.eql( "localhost/vanity/vrview/index.html?video=videourl&is_stereo=false&is_vr_off=false&loop=false" ) }) it("contructs an iframe src", function () { const src = this.view.createIframeSrc("http://video.com/url") return src.should.equal( "localhost/vanity/vrview/index.html?video=http://video.com/url&is_stereo=false&is_vr_off=false&loop=false" ) }) it("updateTime sets the scrubber", function () { this.view.onVRViewReady() this.view.updateTime({ currentTime: 25 }) return this.view.scrubber.set.args[0][0].should.equal(25) }) it("tracks duration in percentage and seconds", function () { this.view.onVRViewReady() this.view.updateTime({ currentTime: 26 }) this.analytics.args[0][0].should.equal("video:seconds") this.analytics.args[0][1].seconds.should.equal("3") this.analytics.args[1][0].should.equal("video:seconds") this.analytics.args[1][1].seconds.should.equal("10") this.analytics.args[2][0].should.equal("video:duration") this.analytics.args[2][1].duration.should.equal("25%") this.view.updateTime({ currentTime: 51 }) this.analytics.args[3][0].should.equal("video:duration") this.analytics.args[3][1].duration.should.equal("50%") this.view.updateTime({ currentTime: 76 }) this.analytics.args[4][0].should.equal("video:duration") this.analytics.args[4][1].duration.should.equal("75%") this.view.updateTime({ currentTime: 100 }) this.analytics.args[5][0].should.equal("video:duration") return this.analytics.args[5][1].duration.should.equal("100%") }) it("triggers closeVideo", function () { $(".venice-video__close").click() return this.view.trigger.args[0][0].should.equal("closeVideo") }) it("adds time to the scrubber", function () { $("body").append('<div class="noUi-handle"></div>') this.view.onVRViewReady() this.view.updateTime({ currentTime: 26 }) return this.view.$time.text().should.equal("00:26") }) it("#fadeInControls", function () { this.view.isMobile = true this.view.fadeInControls() return $.fn.fadeIn.callCount.should.equal(1) }) return it("#fadeOutControls", function () { this.view.isMobile = true this.view.fadeOutControls() this.clock.tick(3000) return $.fn.fadeOut.callCount.should.equal(1) }) })
33.504425
112
0.613708
3b517f8e6fc3359f7025c9e1f9c40ad8c0116cc2
3,733
js
JavaScript
lib/client/retry.spec.js
meltwater/mlabs-graphql
5516a079e76fdfb2bd6a46781ee9901e4eb3e475
[ "MIT" ]
2
2019-05-31T01:23:16.000Z
2021-03-20T07:35:28.000Z
lib/client/retry.spec.js
meltwater/mlabs-graphql
5516a079e76fdfb2bd6a46781ee9901e4eb3e475
[ "MIT" ]
17
2019-04-15T15:53:07.000Z
2021-09-20T23:38:52.000Z
lib/client/retry.spec.js
meltwater/mlabs-graphql
5516a079e76fdfb2bd6a46781ee9901e4eb3e475
[ "MIT" ]
1
2020-11-20T17:23:04.000Z
2020-11-20T17:23:04.000Z
import test from 'ava' import createLogger from '@meltwater/mlabs-logger' import retry, { willRetryError, getDelay } from './retry' const factor = 0 const retries = 10 test.beforeEach((t) => { t.context.createF = ( numFailures = 10, statusCode = 500, hasNetErr = true ) => { let n = 1 return async () => { if (n > numFailures) return true n++ const err = new Error('Fail') err.networkError = null if (hasNetErr) err.networkError = { statusCode } throw err } } t.context.retryHeader = (v) => ({ headers: { get: (k) => { if (k === 'retry-after') return v.toString() } } }) t.context.ctx = { name: 'test', log: createLogger({ noop: true }) } }) test('retry', async (t) => { const { ctx } = t.context const f = t.context.createF(10) const data = await retry(f, ctx, { factor, retries }) t.true(data) }) test('retry: no fail', async (t) => { const { ctx } = t.context const f = t.context.createF(0) const data = await retry(f, ctx, { factor, retries }) t.true(data) }) test('retry: fail', async (t) => { const { ctx } = t.context const f = t.context.createF(11) await t.throwsAsync(retry(f, ctx, { factor, retries }), { message: 'Fail' }) }) test('retry 0 times', async (t) => { const { ctx } = t.context const f = t.context.createF(0) const data = await retry(f, ctx, { factor, retries: 0 }) t.true(data) }) test('retry 0 times: fail', async (t) => { const { ctx } = t.context const f = t.context.createF(1) await t.throwsAsync(retry(f, ctx, { factor, retries: 0 }), { message: 'Fail' }) }) test('retry: valid code', async (t) => { const { ctx } = t.context const f = t.context.createF(1, 500) const data = await retry(f, ctx, { factor, retries }) t.true(data) }) test('retry: invalid code', async (t) => { const { ctx } = t.context const f = t.context.createF(1, 507) await t.throwsAsync(retry(f, ctx, { factor, retries: 0 }), { message: 'Fail' }) }) test.only('retry: no network error', async (t) => { const { ctx } = t.context const f = t.context.createF(1, 507, false) await t.throwsAsync(retry(f, ctx, { factor, retries: 0 }), { message: 'Fail' }) }) test('retry: delay', async (t) => { const { ctx } = t.context const start = new Date() const f = t.context.createF(1) const data = await retry(f, ctx, { factor, retries: 1 }) const end = new Date() t.true(data) t.true(end - start >= 1000) }) test('willRetryError', (t) => { t.false(willRetryError()) t.true(willRetryError({ statusCode: 500 })) t.false(willRetryError({ statusCode: 505 })) t.true(willRetryError({ code: 'ETIMEDOUT' })) t.false(willRetryError({ code: 'NOTETIMEDOUT' })) }) test('getDelay', (t) => { t.is(getDelay(undefined, { minTimeout: 0 }), 0) t.is(getDelay({}, { minTimeout: 20 }), 0) t.is(getDelay({ statusCode: 500 }, { minTimeout: 20000 }), 0) t.is(getDelay({ statusCode: 503 }, { minTimeout: 20000 }), 0) }) test('getDelay: header in seconds', (t) => { const statusCode = 503 const h = t.context.retryHeader t.is(getDelay({ statusCode, response: h(0) }, { minTimeout: 0 }), 0) t.is(getDelay({ statusCode, response: h(30) }, { minTimeout: 0 }), 30000) t.is(getDelay({ statusCode, response: h(30) }, { minTimeout: 50000 }), 0) t.is(getDelay({ statusCode, response: h(30) }, { minTimeout: 20000 }), 10000) }) test('getDelay: header as date', (t) => { const h = t.context.retryHeader const statusCode = 503 const date = new Date(Date.now() + 100000).toString() const delay = getDelay( { statusCode, response: h(date.toString()) }, { minTimeout: 0 } ) t.log(date) t.true(delay > 80000) })
26.104895
79
0.598178
3b5186499cbf7b09c8c6896aaf4a592a5b4973d7
480
js
JavaScript
node_modules/fortune/node_modules/array-buffer/lib/index.js
geoapi/crowdclarify
e9250566fe00c0447aa073b766a448c0efc8df6b
[ "MIT" ]
null
null
null
node_modules/fortune/node_modules/array-buffer/lib/index.js
geoapi/crowdclarify
e9250566fe00c0447aa073b766a448c0efc8df6b
[ "MIT" ]
null
null
null
node_modules/fortune/node_modules/array-buffer/lib/index.js
geoapi/crowdclarify
e9250566fe00c0447aa073b766a448c0efc8df6b
[ "MIT" ]
null
null
null
module.exports = { toBuffer: toBuffer, toArrayBuffer: toArrayBuffer } // Thanks kraag22. // http://stackoverflow.com/a/17064149/4172219 function toBuffer (arrayBuffer) { if (Buffer.isBuffer(arrayBuffer)) return arrayBuffer return new Buffer(new Uint8Array(arrayBuffer)) } // Thanks David Fooks. // http://stackoverflow.com/a/19544002/4172219 function toArrayBuffer (buffer) { if (buffer instanceof ArrayBuffer) return buffer return new Uint8Array(buffer).buffer }
22.857143
54
0.760417
3b53169186c252f8a70210595a8e9e0bb2bcd9ad
2,194
js
JavaScript
src/view/graphComponents/RenderDataSvm.js
VRAM-Software/prediction_configuration_utility
afab6dd948fda3b0ed9d7ec3ece5137954ab3f7b
[ "Apache-2.0" ]
null
null
null
src/view/graphComponents/RenderDataSvm.js
VRAM-Software/prediction_configuration_utility
afab6dd948fda3b0ed9d7ec3ece5137954ab3f7b
[ "Apache-2.0" ]
40
2020-02-27T20:19:31.000Z
2022-03-25T19:03:26.000Z
src/view/graphComponents/RenderDataSvm.js
VRAM-Software/prediction_configuration_utility
afab6dd948fda3b0ed9d7ec3ece5137954ab3f7b
[ "Apache-2.0" ]
1
2020-03-23T14:30:02.000Z
2020-03-23T14:30:02.000Z
import React from "react"; export default class RenderDataSvm extends React.Component { render() { const dataTrain = this.props.dataForTraining.map((item, index) => item[this.props.params[this.props.params.length - 1]] > 0 ? ( <circle cx={this.props.scale.x(item[this.props.params[0]])} cy={this.props.scale.y(item[this.props.params[1]])} r="4" stroke="black" strokeWidth="1" style={{ fill: "green" }} key={index} /> ) : ( <circle cx={this.props.scale.x(item[this.props.params[0]])} cy={this.props.scale.y(item[this.props.params[1]])} r="4" stroke="black" strokeWidth="1" style={{ fill: "red" }} key={index} /> ) ); const dataQuality = this.props.dataForQuality.map((item, index) => item[this.props.params[this.props.params.length - 1]] > 0 ? ( <rect x={this.props.scale.x(item[this.props.params[0]])} y={this.props.scale.y(item[this.props.params[1]])} height="8" width="8" stroke="black" strokeWidth="1" style={{ fill: "green" }} key={index} /> ) : ( <rect x={this.props.scale.x(item[this.props.params[0]])} y={this.props.scale.y(item[this.props.params[1]])} height="8" width="8" stroke="black" strokeWidth="1" style={{ fill: "red" }} key={index} /> ) ); return ( <g> {this.props.viewDataQuality ? dataQuality : null} {this.props.viewDataTraining ? dataTrain : null} </g> ); } }
35.387097
74
0.394713
3b537f6b9f069f8c3310bd5ad7987b751ab5e88e
1,929
js
JavaScript
teste-dexter-server-master/app.js
mesquita97/dex-case
614aa77fa5f81a04cb0152ea96e72624cafd2440
[ "MIT" ]
null
null
null
teste-dexter-server-master/app.js
mesquita97/dex-case
614aa77fa5f81a04cb0152ea96e72624cafd2440
[ "MIT" ]
null
null
null
teste-dexter-server-master/app.js
mesquita97/dex-case
614aa77fa5f81a04cb0152ea96e72624cafd2440
[ "MIT" ]
null
null
null
var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI var express = require('express'); var ParseServer = require('parse-server').ParseServer; var ParseDashboard = require('parse-dashboard'); const bodyParser = require('body-parser'); const LOCAL_URL="http://localhost:1337/parse"; var api = new ParseServer({ databaseURI: databaseUri || "mongodb://dex.company:DEX.Company70@ds135252.mlab.com:35252/teste-dexter", cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'OSGiFZBrXxNLjN3gYDPsgi7P4a0j6fzcc2iaCKga', masterKey: process.env.MASTER_KEY || 'k8xm42UVuIP51wR2DswLY8NL3zgWfev8AuKUUjga', serverURL: process.env.SERVER_URL || 'https://dex-case.herokuapp.com/parse' }); var dashboard = new ParseDashboard({ apps: [{ serverURL: LOCAL_URL, appId: 'OSGiFZBrXxNLjN3gYDPsgi7P4a0j6fzcc2iaCKga', masterKey: 'k8xm42UVuIP51wR2DswLY8NL3zgWfev8AuKUUjga', appName: "Teste Dexter" }], users: [{ user:"admin", pass:"newPassword" }] }); var app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use('/dashboard', dashboard); app.use(express.static('imgs')); // app.use(function(req, res, next) { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT'); res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); next(); }); app.get('/parse', function(req, res) { res.sendFile(res.body); }); app.post('/parse', function(req, res){ var user = req.body.email; var password = req.body.password; var login = [user, password]; res.sendDate('http://localhost:1337/parse'); }); // Serve the Parse API on the /parse URL prefix app.use('/parse', api); var port = 1337; app.listen(port, function() { console.log('Teste Dexter API running on port ' + port + '.'); });
28.367647
113
0.708657
3b53e2280d7a58e2cc0b8a96b7e10f07ffef740c
1,280
js
JavaScript
src/components/AppHeader.js
halocline/challenger
9a866b85b36e84028b9d5abd4f2a4994773d2ea1
[ "MIT" ]
null
null
null
src/components/AppHeader.js
halocline/challenger
9a866b85b36e84028b9d5abd4f2a4994773d2ea1
[ "MIT" ]
5
2021-03-10T04:21:39.000Z
2022-02-26T22:17:57.000Z
src/components/AppHeader.js
halocline/challenger
9a866b85b36e84028b9d5abd4f2a4994773d2ea1
[ "MIT" ]
null
null
null
import React from 'react'; import { Link } from 'react-router-dom'; import { Box, Button, Header, Text } from 'grommet'; import { Achievement } from 'grommet-icons'; const AppHeader = () => { return ( <Header background="brand" pad={{ horizontal: 'large', vertical: 'small' }} justify="center" fill > <Box direction="row" align="center" fill justify="between" height={{ min: 'xxsmall' }} width={{ max: 'xlarge' }} > <Link to="/"> <Button // as={Link} // to="/" > <Box direction="row" gap="small"> <Achievement /> <Text>Challenger</Text> </Box> </Button> </Link> <Box direction="row" gap="large"> <Link to="/challenges"> <Button // as={Link} // to="/challenges" label="All" primary /> </Link> <Link to="/challenge"> <Button // as={Link} // to="/challenge" label="One" primary /> </Link> </Box> </Box> </Header> ); }; export { AppHeader };
22.45614
54
0.414844
3b5466770df5669e8c1a12a1a764df88cfc40031
2,817
js
JavaScript
lib/array-observer.js
toddself/orm
d852a49cd48385b6022c303e35035b15fff3fc11
[ "Apache-2.0" ]
null
null
null
lib/array-observer.js
toddself/orm
d852a49cd48385b6022c303e35035b15fff3fc11
[ "Apache-2.0" ]
null
null
null
lib/array-observer.js
toddself/orm
d852a49cd48385b6022c303e35035b15fff3fc11
[ "Apache-2.0" ]
null
null
null
function makeArrayObserver (arr, prop, validator, changeList, joi) { const traps = { push (target) { return function (val, opts = {}) { joi.assert(val, validator) if (!opts.ignore) changeList.add(prop, val) return Array.prototype.push.call(target, val) } }, unshift (target) { return function (val, opts = {}) { joi.assert(val, validator) if (!opts.ignore) changeList.add(prop, val) return Array.prototype.unshift.call(target, val) } }, shift (target) { return function (opts = {}) { if (!opts.ignore) changeList.del(prop, arr[0]) return Array.prototype.shift.call(target) } }, pop (target) { return function (opts = {}) { if (!opts.ignore) changeList.del(prop, target[target.length - 1]) return Array.prototype.pop.call(target) } }, splice (target) { return function (...args) { const opts = args[args.length - 1].ignore ? args.pop() : {} const start = args[0] let len = target.length if (typeof args[1] !== 'undefined') len = args[1] const vals = args.slice(2) for (const val of vals) { joi.assert(val, validator) if (!opts.ignore) changeList.add(prop, val) } if (len > 0) { const tl = target.length for (let i = (start % tl); i <= len; i++) { if (i < tl && !opts.ignore) changeList.del(prop, target[i]) } } return Array.prototype.splice.apply(target, args) } }, fill (target) { return function (val, opts = {}) { joi.assert(val, validator) for (const val of arr) { if (!opts.ignore) changeList.del(prop, val) } Array.prototype.fill.call(target, val) for (let i = 0, len = target.length; i < len; i++) { if (!opts.ignore) changeList.add(prop, val) } return target } } } const handler = { get (target, property) { const trapList = Object.keys(traps) if (trapList.includes(property)) { return traps[property](target) } else { return target[property] } }, set (target, property, val) { if (!Number.isNaN(parseInt(property, 10))) { joi.assert(val, validator) changeList.add(prop, val) target[property] = val return val } if (property === 'length') { for (const val of target) { if (val) changeList.del(prop, val) } target.length = val return val } target[property] = val return val } } for (const val in arr) { joi.assert(val, validator) } return new Proxy(arr, handler) } module.exports = makeArrayObserver
26.828571
73
0.537451
3b5497c84f65e68dd77383e115220ddd0bb916d5
6,812
js
JavaScript
project/www/js/chart/canvas.map.js
kongwen/zhubao1
e276829ff7ab6ffe52e79cbbce3bf8c4828c5dc9
[ "Apache-2.0" ]
null
null
null
project/www/js/chart/canvas.map.js
kongwen/zhubao1
e276829ff7ab6ffe52e79cbbce3bf8c4828c5dc9
[ "Apache-2.0" ]
null
null
null
project/www/js/chart/canvas.map.js
kongwen/zhubao1
e276829ff7ab6ffe52e79cbbce3bf8c4828c5dc9
[ "Apache-2.0" ]
null
null
null
/** * @author zhouyuan * @version 1.0 * @describe pie chart Based on oCanvas graphic */ var map; var makerAry = []; var colorMAP = ["#9e1900","#f30000","#ff6600","#eeae00"]; var centerMAP; var map; var areaId; var zoomChi = [0.000015,0.000015,0.000015,0.000015, 0.00003,0.000012,0.00024,0.000485, 0.00097,0.00194,0.004,0.008,0.016, 0.031,0.061,0.122,0.244,0.49,0.98,1.96,4];//比例尺数组 function leftAreaControl(data){ var list = data["areaList"]; var str = "<div class='leftCon' id='leftCon'><span></span><b></b><dl id='leftList'>"; str += "<dt>Key Areas <b class='back' id='back' ></b></dt>"; for(var i =0;i<list.length;i++){ var id = list[i]["areaid"]; var name = list[i]["areaName"]; var num = i+1; if(i == 0){ str += "<dd ids='"+id+"'><span class='listIcon' >"+num+"</span><em>"+name+"</em> <b class='active'></b></dd>"; }else{ str += "<dd ids='"+id+"'><span class='listIcon' >"+num+"</span><em>"+name+"</em> <b></b></dd>"; } } str += "</dl></div>"; $(str).insertAfter($("#map-canvas")); $("#leftCon>span").tap(function() { $(this).hide(); $("#leftCon>b").show(); $("#leftList").css("margin-left","0"); }); $("#leftCon>b").tap(function() { $(this).hide(); $("#leftCon>span").show(); $("#leftList").css("margin-left","-160px"); }); $("#leftCon dd").tap(function(){ var areaid = $(this).attr("ids"); areaId = areaid; initialize(areaid,"2G",data); $("#leftCon dd b").removeClass('active'); $(".tabCon").removeClass("tabConActive"); $(".tabCon:eq(0)").addClass("tabConActive"); $(this).find("b").addClass('active'); }); $("<div id='rightNOteTop'><div class='tabCon tabConActive'><b>2G</b></div><div class='tabCon'><b>3G</b></div><div class='tabCon'><b>LTE</b></div></div>").insertAfter($("#map-canvas")); $("#rightNOteTop>div").tap(function(){ for(var i =0;i<makerAry.length;i++){ makerAry[i].setMap(null); makerAry[i] = null; delete makerAry[i]; } $("#rightNOteTop>div").removeClass("tabConActive"); $(this).addClass("tabConActive"); var type = $(this).find(">b").text(); makePositions(areaId,type,data,map); map.panTo(centerMAP); updateNoteList(type,data); }); $("<div id='rightNOte' class='mapNote' ><dl><dt>Impacted Users & VIP:</dt></dl></div>").insertAfter($("#map-canvas")); } //设置地图缩放范围 function setMapResolution(){ //获取所有地图类型 var mapTypes = map.getMapTypes(); //对所有地图类型限制缩放级别 for(var i=0; i<mapTypes.length; i++) { mapTypes[i].getMinimumResolution = function() { return 12; }; mapTypes[i].getMaximumResulution = function() { return 16; }; } } //获取地图显示中心区域 function getCenter(areaid,data){ var list = data['areaListDetail']; for(var i = 0;i<list.length;i++){ var id = list[i]["areaid"]; if(id == areaid){ var centerX = list[i]["longitude"]; var centerY = list[i]["latitude"]; centerMAP = new google.maps.LatLng(centerY,centerX); return centerMAP; } } } //获取第一个区域的id function getFirstArea(data){ var list = data['areaListDetail']; if(!list || (list && list.length==0)){return;} var firstAreaId = list[0]["areaid"]; return firstAreaId; } //跟新注释信息 function updateNoteList(type,data){ var list = data['thresholds'][type]; var str = "<dl>"; str += "<dt>Impacted Users & VIP:</dt>"; for(var i = 0;i<list.length;i++){ var num = i+1; var value = list[i]; str += "<dd><span class='icon"+num+"' ></span>"+value+"</dd>"; } str += "</dl>"; $("#rightNOte>dl").html(str); } //获取扇形的路径 function getShan(radius,angle){ var str = 'M'; str += " 0,0 "; var ary = []; radius = radius/2; for(var x =0;x<=radius;x++){ if(x%8==0 || x==radius){ var y = Math.pow(radius*radius-x*x,1/2)//勾股定理开根号 ary.push("-"+x+","+"-"+y+" "); } } str += ary.join(""); str += " 0,0 "; str += "z"; return str; } //添加标记 function makePositions(areaid,type,data,maps){ var list = data['areaListDetail']; for (i in makerAry){ makerAry[i].setMap(null); makerAry[i] = null; delete makerAry[i]; } makerAry.length = 0; var zoom = map.getZoom(); var scale = zoomChi[zoom]; for(var i = 0;i<list.length;i++){ var id = list[i]["areaid"]; if(id == areaid){ var cellList = list[i]["cellList"][type]; if(cellList){ var locationArray = []; var locationNameArray = []; var rotation = []; var level = []; var radius = []; var angle = []; for(var j =0;j<cellList.length;j++){ var x = cellList[j]["longitude"];//经度 var y = cellList[j]["latitude"];//纬度 var name = cellList[j]["cellName"]; var ro = cellList[j]["DirectionAngle"]; var range = cellList[j]["range"]; var radiuss = cellList[j]["radius"]; var angles = cellList[j]["angle"]; locationArray.push(new google.maps.LatLng(y,x)); locationNameArray.push(name); rotation.push(ro);//偏转角度 level.push(range); radius.push(radiuss); angle.push(angles); } var goldDot = { path: 'M 0,2 -2,0 0,-2 2,0 0,2 z', fillColor: "#ac412a", strokeColor:"#ac412a", fillOpacity:1, scale:scale, strokeColor: "#cf3111", strokeWeight:7, rotation:0 }; var m = 0; for (var coord in locationArray){ //定义扇形 var shanPath = getShan(radius[m],angle[m]); var goldShan = { path:shanPath, fillColor:colorMAP[level[m]-1], fillOpacity: 0.8, scale:scale, strokeColor: "gold", strokeWeight: 0, rotation:rotation[m] }; //var image = '../css/images/mapIcon/map_color'+level[m]+'_'+rotation[m]+'.png'; //alert(image); makerAry.push(new google.maps.Marker({ position: locationArray[coord], map: map, icon: goldShan, scale:0.3, title: locationNameArray[coord] })); makerAry.push(new google.maps.Marker({ position: locationArray[coord], map: map, icon: goldDot, title: locationNameArray[coord] })); m++; } break; } } } } function makemap(areaid,data){ var styles = [{stylers: [{ lightness: -10 }]}]; var mapOptions = { zoom:16, panControl: false, zoomControl: false, mapTypeControl: false, scaleControl: false, streetViewControl: false, styles: styles, center:centerMAP }; map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions); map.type='2G'; map.areaid = areaid; google.maps.event.addListener(map,'zoom_changed', function() { var zoomLevel = map.getZoom(); var type = map.type; var areaid = map.areaid; makePositions(areaid,type,data,map); }); } function initialize(areaid,type,data) { var makerAry = []; var cityCircle; map.type = type; map.areaid = areaid; getCenter(areaid,data); map.setZoom(16); map.panTo(centerMAP); makePositions(areaid,"2G",data,map); updateNoteList(type,data); }
24.415771
185
0.593952
3b54ab035e69f2403464f5c574c21b66efb98b5b
4,083
js
JavaScript
scripts/launchpad/deploy_erc20.js
medibloc/cosmjs
06fbc34f72f12c30a396c3ca296f80eca9fa60b0
[ "Apache-2.0" ]
null
null
null
scripts/launchpad/deploy_erc20.js
medibloc/cosmjs
06fbc34f72f12c30a396c3ca296f80eca9fa60b0
[ "Apache-2.0" ]
null
null
null
scripts/launchpad/deploy_erc20.js
medibloc/cosmjs
06fbc34f72f12c30a396c3ca296f80eca9fa60b0
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env -S yarn node /* eslint-disable @typescript-eslint/naming-convention */ const { Secp256k1HdWallet } = require("@cosmjs/amino"); const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad"); const fs = require("fs"); const httpUrl = "http://localhost:1317"; const alice = { mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", address1: "cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0", address2: "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5", address3: "cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta", address4: "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce", }; const unused = { address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", }; const guest = { address: "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej", }; const codeMeta = { source: "https://crates.io/api/v1/crates/cw-erc20/0.7.0/download", builder: "cosmwasm/rust-optimizer:0.10.4", }; const initDataHash = { admin: undefined, initMsg: { decimals: 5, name: "Hash token", symbol: "HASH", initial_balances: [ { address: alice.address0, amount: "11", }, { address: alice.address1, amount: "11", }, { address: alice.address2, amount: "11", }, { address: alice.address3, amount: "11", }, { address: alice.address4, amount: "11", }, { address: unused.address, amount: "12812345", }, { address: guest.address, amount: "22004000000", }, ], }, }; const initDataIsa = { admin: undefined, initMsg: { decimals: 0, name: "Isa Token", symbol: "ISA", initial_balances: [ { address: alice.address0, amount: "999999999", }, { address: alice.address1, amount: "999999999", }, { address: alice.address2, amount: "999999999", }, { address: alice.address3, amount: "999999999", }, { address: alice.address4, amount: "999999999", }, { address: unused.address, amount: "42", }, ], }, }; const initDataJade = { admin: alice.address1, initMsg: { decimals: 18, name: "Jade Token", symbol: "JADE", initial_balances: [ { address: alice.address0, amount: "189189189000000000000000000", // 189189189 JADE }, { address: alice.address1, amount: "189189189000000000000000000", // 189189189 JADE }, { address: alice.address2, amount: "189189189000000000000000000", // 189189189 JADE }, { address: alice.address3, amount: "189189189000000000000000000", // 189189189 JADE }, { address: alice.address4, amount: "189189189000000000000000000", // 189189189 JADE }, { address: guest.address, amount: "189500000000000000000", // 189.5 JADE }, ], }, }; async function main() { const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const wasm = fs.readFileSync(__dirname + "/contracts/cw_erc20.wasm"); const uploadReceipt = await client.upload(wasm, codeMeta, "Upload ERC20 contract"); console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`); for (const { initMsg, admin } of [initDataHash, initDataIsa, initDataJade]) { const { contractAddress } = await client.instantiate(uploadReceipt.codeId, initMsg, initMsg.symbol, { memo: `Create an ERC20 instance for ${initMsg.symbol}`, admin: admin, }); console.info(`Contract instantiated for ${initMsg.symbol} at ${contractAddress}`); } } main().then( () => { console.info("All done, let the coins flow."); process.exit(0); }, (error) => { console.error(error); process.exit(1); }, );
25.04908
105
0.607397
3b54c5e57866d29dfb98141f63b4dadbc05ba9ec
585
js
JavaScript
components/Footer.js
mymakarim/khabarnamanext
3d9693949a73eab5f9279119449f0a2bf6cae52f
[ "Apache-2.0" ]
null
null
null
components/Footer.js
mymakarim/khabarnamanext
3d9693949a73eab5f9279119449f0a2bf6cae52f
[ "Apache-2.0" ]
null
null
null
components/Footer.js
mymakarim/khabarnamanext
3d9693949a73eab5f9279119449f0a2bf6cae52f
[ "Apache-2.0" ]
null
null
null
import Link from 'next/link' export default function Footer() { return ( <div className='text-xs p-5 flex flex-col items-start gap-2 md:gap-4 text-gray-900 '> <div className='flex gap-2'> <Link href='/about-us'> <a className='hover:underline'>درباره ما</a> </Link> <Link href='/contact-us'> <a className='hover:underline'>تماس باما</a> </Link> </div> <p className='font-semibold'> {new Date().getFullYear()} © تمام حقوق مادی و معنوی این وب سایت برای خبرنامه محفوظ می‌باشد </p> </div> ) }
29.25
98
0.579487
3b5512b4738f5400721b5ef8789948619a89409d
816
js
JavaScript
src/lib/packet/index.js
alexandref93/workflow
b3700f75364e2a7254ac157cfa8863e5557aadb4
[ "MIT" ]
4
2018-02-06T00:54:04.000Z
2018-02-06T13:20:02.000Z
src/lib/packet/index.js
alexandref93/workflow
b3700f75364e2a7254ac157cfa8863e5557aadb4
[ "MIT" ]
1
2018-03-19T23:44:52.000Z
2018-03-19T23:44:52.000Z
src/lib/packet/index.js
alexandref93/workflow
b3700f75364e2a7254ac157cfa8863e5557aadb4
[ "MIT" ]
null
null
null
// @flow import path from 'path'; import type { TypeLibExternal } from '../../type-definitions'; import { loader } from '../loader'; import { load as loadConfig, getPathRootConfig } from '../configYML'; type TypeLoadPacket = ({libExternal: TypeLibExternal}) => TypeLibExternal; export const loadPacket : TypeLoadPacket = ({libExternal = {}} = {}) => { const config = loadConfig(); config.packet && config.packet.forEach(packet => { const packetLoaded = loader({ pathModule: packet.isLocal ? path.resolve(getPathRootConfig(), packet.path) : '', name: packet.name, isLocal: packet.isLocal, }); if (typeof packetLoaded === 'object') { Object.keys(packetLoaded).forEach(key => { libExternal[key] = packetLoaded[key]; }); } }); return libExternal; };
26.322581
87
0.643382
3b55c14318fca14729749375772644de13b66b2e
267
js
JavaScript
src/index.js
alejoriosrivas/my-first-npm-package
02f6dfce0653234020e3f7910deaa08e76269591
[ "ISC", "MIT" ]
null
null
null
src/index.js
alejoriosrivas/my-first-npm-package
02f6dfce0653234020e3f7910deaa08e76269591
[ "ISC", "MIT" ]
null
null
null
src/index.js
alejoriosrivas/my-first-npm-package
02f6dfce0653234020e3f7910deaa08e76269591
[ "ISC", "MIT" ]
null
null
null
const messages = [ 'Alejo', 'Fede', 'Nico', 'Yessi', 'Juan', 'Lau', 'Cami', 'Dani', ]; const randomMsg = () => { const message = messages[Math.floor(Math.random() * messages.length)]; console.log(message); }; randomMsg(); module.exports = { randomMsg };
13.35
71
0.602996
3b55fe1ae6ed331fd37ececb2f9cc1943b79cfc9
4,989
js
JavaScript
scripts/tree.js
greggman/hft-garden
29367b2292fa9bc69c1170d1ac6b326d91d86652
[ "BSD-3-Clause" ]
null
null
null
scripts/tree.js
greggman/hft-garden
29367b2292fa9bc69c1170d1ac6b326d91d86652
[ "BSD-3-Clause" ]
null
null
null
scripts/tree.js
greggman/hft-garden
29367b2292fa9bc69c1170d1ac6b326d91d86652
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright 2014, Gregg Tavares. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Gregg Tavares. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ "use strict"; define([ './goal', './rand', ], function( Goal, rand ) { var Tree = function(services, options) { this.services = services; var globals = services.globals; //var geo = new THREE.BufferGeometry(); //var vertices = new Float32Array( numVerts * 3 ); //var normals = new Float32Array( numVerts * 3 ); //var uvs = new Float32Array( numVerts * 2 ); //var indices = new Uint16Array( numTriangles * 3 ); var numBranches = options.numBranches || 2; var baseColor = 0x808080; //0x80FF00; if (options.numLeaves) { var leafTexture = rand.element(services.leafTextures); baseColor = leafTexture.baseColor; this.leafMaterial = new THREE.MeshPhongMaterial({ ambient: 0x808080, map: leafTexture.texture, specular: 0xFFFFFF, shininess: 30, shading: THREE.FlatShading, side: THREE.DoubleSide, transparent: true, alphaTest: 0.5, }); } this.material = new THREE.MeshPhongMaterial({ ambient: 0x808080, color: baseColor, specular: 0, //0xFFFFFF, shininess: 30, shading: THREE.FlatShading, // shading: THREE.SmoothShading, //wireframe: true, }); var depth = options.depth || 4; var self = this; function makeBranch(depth, scale, leafScale, length) { var root = new THREE.Object3D(); var mesh = new THREE.Mesh(services.geometry.treeMesh, self.material); root.add(mesh); mesh.scale.x = scale; mesh.scale.z = scale; mesh.scale.y = length; if (options.numLeaves) { var angle = rand.range(Math.PI * 2); var halfU = 0.5 / options.numLeaves; for (var ii = 0; ii < options.numLeaves; ++ii) { var u = ii / options.numLeaves; var leaf = new THREE.Mesh(services.geometry.leafMesh, self.leafMaterial); root.add(leaf); leaf.scale.x = leafScale * globals.leafScale * length * 0.2; leaf.scale.y = leafScale * globals.leafScale * length * 0.2; leaf.scale.z = leafScale * globals.leafScale * length * 0.2; leaf.position.x = scale * 0.6; leaf.position.y = rand.range(length / 4 * 1, length / 4 * 3); leaf.rotation.z = rand.plusMinus(Math.PI * 0.125); leaf.rotation.y = angle + (u + rand.range(halfU)) * Math.PI * 2; } } if (depth) { for (var ii = 0; ii < numBranches; ++ii) { var u = numBranches > 1 ? (ii / (numBranches - 1)) * 2 - 1 : rand.range(0.5, -0.5); var blen = length * rand.range(0.6, 0.9); var branch = makeBranch(depth - 1, scale * globals.treeBranchRadius, leafScale * globals.leafScaleShrink, blen); branch.position.y = length * 0.98; branch.rotation.z = Math.PI * rand.range(globals.treeMinBend, globals.treeMaxBend) * u; branch.rotation.x = rand.range(globals.treeMinTwist, globals.treeMaxTwist); branch.rotation.y = rand.range(globals.treeMinTwist, globals.treeMaxTwist); root.add(branch); } } else { var goal = new Goal(services); root.add(goal.root); goal.root.position.y = length; } return root; } this.root = makeBranch(depth, 1, 1, options.rootLength); this.root.rotation.z = rand.plusMinus(0.2); this.process = function() { }; }; return Tree; });
36.955556
122
0.644819
3b562e8415d67b179f4c6fa0a9068a53b6c1a8b2
1,415
js
JavaScript
lib/index.js
xlshield/devserver-qrcode-webpack-plugin
fedee2faa06d7d4bb69e56ddbe913a114e4da8ea
[ "MIT" ]
4
2018-07-13T04:48:12.000Z
2018-07-16T07:09:55.000Z
lib/index.js
xlshield/devserver-qrcode-webpack-plugin
fedee2faa06d7d4bb69e56ddbe913a114e4da8ea
[ "MIT" ]
null
null
null
lib/index.js
xlshield/devserver-qrcode-webpack-plugin
fedee2faa06d7d4bb69e56ddbe913a114e4da8ea
[ "MIT" ]
1
2019-04-04T07:30:47.000Z
2019-04-04T07:30:47.000Z
const qrcode = require('qrcode-terminal'); const internalIp = require('internal-ip'); const SIZE_LARGE = 'large'; const SIZE_SMALL = 'small'; const defaultOptions = { size: SIZE_LARGE }; class DevserverQRcodeWebpackPlugin { constructor(options) { if (Object.prototype.toString.call(options) !== '[object Object]') { options = defaultOptions; console.warn('devserver-qrcode-webpack-plugin: the type of options should be Object'); } const { size } = options; this.size = size == SIZE_LARGE ? SIZE_LARGE : SIZE_SMALL; } getLocalIp() { return internalIp.v4.sync(); } printQRcode(url) { qrcode.generate(url, { small: this.size === SIZE_SMALL }, function(qrcode) { console.log(qrcode); console.log(url); }); } apply(compiler) { const devServer = compiler.options.devServer; if (!devServer) { console.warn('devserver-qrcode-webpack-plugin: needs to start webpack-dev-server'); return; } const protocol = devServer.https ? 'https' : 'http'; const hostname = this.getLocalIp(); const port = devServer.port; const pathname = devServer.openPage || ''; const url = `${protocol}://${hostname}:${port}/${pathname}`; this.printQRcode(url); } } module.exports = DevserverQRcodeWebpackPlugin;
32.159091
98
0.60636