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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f20dfe87ef1cb9f8ff7b8f9dff1745603f9aa2c8 | 507 | js | JavaScript | Fetal_Sensor_Visualizer_p5js/mousePressed.js | zkobrinsky/fetal-kick-sensor | f2c24e8d0cf8c3801c9fadae72438e41350447f1 | [
"MIT"
] | 1 | 2021-01-25T15:33:29.000Z | 2021-01-25T15:33:29.000Z | Fetal_Sensor_Visualizer_p5js/mousePressed.js | zkobrinsky/fetal-kick-sensor | f2c24e8d0cf8c3801c9fadae72438e41350447f1 | [
"MIT"
] | null | null | null | Fetal_Sensor_Visualizer_p5js/mousePressed.js | zkobrinsky/fetal-kick-sensor | f2c24e8d0cf8c3801c9fadae72438e41350447f1 | [
"MIT"
] | null | null | null | function mousePressed() {
let red = random(30, 240);
let green = random(30, 240);
let blue = random(30, 240);
//event listener to wait one mouseclick so I can enter canvas without creating a ripple
if (windowState == true) {
let rip = new Ripple(mouseX, mouseY, 1, red, green, blue, 1, 0);
ripples.push(rip);
if (ripples.length > 10) {
// ripples[0].stopSounds();
ripples.splice(0, 1);
}
// console.log(ripples);
playsound();
}
windowState = true;
} | 20.28 | 89 | 0.609467 |
f20e30c79d8192f2a00488c19e76fd289c6554d3 | 2,947 | js | JavaScript | dist/dojox/mobile/app/_base.js | skylark-integration/skylark-dojox | 413a6a8afa13c0d467c210d1e6c89393f99737eb | [
"MIT"
] | null | null | null | dist/dojox/mobile/app/_base.js | skylark-integration/skylark-dojox | 413a6a8afa13c0d467c210d1e6c89393f99737eb | [
"MIT"
] | 3 | 2020-03-10T15:01:09.000Z | 2020-08-16T08:13:08.000Z | dist/dojox/mobile/app/_base.js | skylark-integration/skylark-dojox | 413a6a8afa13c0d467c210d1e6c89393f99737eb | [
"MIT"
] | null | null | null | /**
* dojox - A version of dojox.js framework that ported to running on skylarkjs.
* @author Hudaokeji, Inc.
* @version v0.9.0
* @link https://github.com/skylark-integration/dojox/
* @license MIT
*/
dojo.provide("dojox.mobile.app._base"),dojo.experimental("dojox.mobile.app._base"),dojo.require("dijit._base"),dojo.require("dijit._WidgetBase"),dojo.require("dojox.mobile"),dojo.require("dojox.mobile.parser"),dojo.require("dojox.mobile.Button"),dojo.require("dojox.mobile.app._event"),dojo.require("dojox.mobile.app._Widget"),dojo.require("dojox.mobile.app.StageController"),dojo.require("dojox.mobile.app.SceneController"),dojo.require("dojox.mobile.app.SceneAssistant"),dojo.require("dojox.mobile.app.AlertDialog"),dojo.require("dojox.mobile.app.List"),dojo.require("dojox.mobile.app.ListSelector"),dojo.require("dojox.mobile.app.TextBox"),dojo.require("dojox.mobile.app.ImageView"),dojo.require("dojox.mobile.app.ImageThumbView"),function(){var o,e,i,r={},n=[];function t(o,e){var i,n;do{if((i=o.pop()).source)n=i.source;else{if(!i.module)return void console.log("Error: invalid JavaScript resource "+dojo.toJson(i));n=dojo.moduleUrl(i.module)+".js"}}while(o.length>0&&r[n]);o.length<1&&r[n]?e():dojo.xhrGet({url:n,sync:!1}).addCallbacks(function(i){dojo.eval(i),r[n]=!0,o.length>0?t(o,e):e()},function(){console.log("Failed to load resource "+n)})}var l=function(){o=new dojox.mobile.app.StageController(i);var r={id:"com.test.app",version:"1.0.0",initialScene:"main"};if(dojo.global.appInfo&&dojo.mixin(r,dojo.global.appInfo),(e=dojox.mobile.app.info=r).title){dojo.query("head title")[0]||dojo.create("title",{},dojo.query("head")[0]);document.title=e.title}o.pushScene(e.initialScene)};dojo.mixin(dojox.mobile.app,{init:function(e){var r;i=e||dojo.body(),dojox.mobile.app.STAGE_CONTROLLER_ACTIVE=!0,dojo.subscribe("/dojox/mobile/app/goback",function(){o.popScene()}),dojo.subscribe("/dojox/mobile/app/alert",function(o){dojox.mobile.app.getActiveSceneController().showAlertDialog(o)}),dojo.subscribe("/dojox/mobile/app/pushScene",function(e,i){o.pushScene(e,i||{})}),dojo.xhrGet({url:"view-resources.json",load:function(o){var e=[];if(o){n=o=dojo.fromJson(o);for(var i=0;i<o.length;i++)o[i].scene||e.push(o[i])}e.length>0?t(e,l):l()},error:l}),r=!1,dojo.global.BackButton?(BackButton.override(),dojo.connect(document,"backKeyDown",function(o){dojo.publish("/dojox/mobile/app/goback")}),r=!0):dojo.global.Mojo,r&&dojo.addClass(dojo.body(),"mblNativeBack")},getActiveSceneController:function(){return o.getActiveSceneController()},getStageController:function(){return o},loadResources:function(o,e){t(o,e)},loadResourcesForScene:function(o,e){for(var i=[],r=0;r<n.length;r++)n[r].scene==o&&i.push(n[r]);i.length>0?t(i,e):e()},resolveTemplate:function(o){return"app/views/"+o+"/"+o+"-scene.html"},resolveAssistant:function(o){return"app/assistants/"+o+"-assistant.js"}})}();
//# sourceMappingURL=../../sourcemaps/mobile/app/_base.js.map
| 294.7 | 2,679 | 0.734306 |
f20ecd06f757a80c5287e5663027169fd7218dea | 1,704 | js | JavaScript | js/scripts.js | gracelauren/packageJS | 60143afb9f61fa2be14ee65a5b942e391a6ec710 | [
"MIT"
] | null | null | null | js/scripts.js | gracelauren/packageJS | 60143afb9f61fa2be14ee65a5b942e391a6ec710 | [
"MIT"
] | null | null | null | js/scripts.js | gracelauren/packageJS | 60143afb9f61fa2be14ee65a5b942e391a6ec710 | [
"MIT"
] | null | null | null | $(document).ready(function(){
$('form#new-package').submit(function(event){
event.preventDefault();
var inputtedLength = parseInt($("input#new-package-length").val());
var inputtedWidth = parseInt($("input#new-package-width").val());
var inputtedHeight = parseInt($("input#new-package-height").val());
var inputtedWeight = parseInt($("input#new-package-weight").val());
var newPackage = { length: inputtedLength, width: inputtedWidth,
weight: inputtedWeight, height: inputtedHeight,
price: function() {
return this.length + this.width + this.height * this.weight;
},
draw: function(){
return "<svg width='"
+ (this.width * 10)
+ "' height='"
+ (this.height * 10)
+ "'><rect width='"
+ (this.width * 10)
+ "' height='"
+ (this.height * 10)
+ "'style='fill:rgb(164,124,72);stroke-width:3;stroke:rgb(0,0,0)'/></svg>"
}
};
$("input#new-package-length").val("");
$("input#new-package-width").val("");
$("input#new-package-height").val("");
$("input#new-package-weight").val("");
$("#show-price").show();
$(".price").text(newPackage.price());
$(".length").text(newPackage.length);
$(".width").text(newPackage.width);
$(".height").text(newPackage.height);
$(".weight").text(newPackage.weight);
$(".draw").empty();
$(".draw").append(newPackage.draw());
});
});
| 40.571429 | 98 | 0.482981 |
f20f36bd4212acf06754591f4d1a9677e21ce06a | 2,360 | js | JavaScript | Gruntfile.js | dianbaer/jeno | b34def1c146b6ef45bb2d683a04c2dba0bc1efc1 | [
"MIT"
] | 380 | 2017-10-26T12:03:59.000Z | 2021-04-15T00:57:13.000Z | Gruntfile.js | dianbaer/basic | b34def1c146b6ef45bb2d683a04c2dba0bc1efc1 | [
"MIT"
] | null | null | null | Gruntfile.js | dianbaer/basic | b34def1c146b6ef45bb2d683a04c2dba0bc1efc1 | [
"MIT"
] | 86 | 2017-10-27T02:31:45.000Z | 2022-03-25T02:23:07.000Z | module.exports = function (grunt) {
// 项目配置
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '\n\r'
},
dist: {
src: [
'juggle-help/src/Tools.js',//无依赖
'juggle-event/src/Event.js',//依赖juggle-help
'juggle-event/src/EventPool.js',//依赖Event
'juggle-event/src/EventDispatcher.js',//依赖juggle-help,EventPool
'juggle-juggler/src/JugglerEventType.js',//无依赖
'juggle-juggler/src/Juggler.js',//依赖JugglerEventType,juggle-help
'juggle-juggler/src/JugglerManager.js',//依赖Juggler
'juggle-tween/src/Transitions.js',//无依赖
'juggle-tween/src/Tween.js',//依赖juggle-help,juggle-event,juggle-juggler,transitions
'juggle-tween/src/TweenPool.js',//依赖Tween,juggle-help
'juggle-delayedcall/src/DelayedCall.js',//依赖juggle-help,juggle-event,juggle-juggler
'juggle-delayedcall/src/DelayedCallPool.js',//DelayedCall,juggle-help
'juggle-websocket/src/WebSocketEventType.js',//无依赖
'juggle-websocket/src/WebSocketConfig.js',//无依赖
'juggle-websocket/src/WebSocketClient.js',//依赖WebSocketEventType,WebSocketConfig,juggle-event
'juggle-http/src/HttpEventType.js',//无依赖
'juggle-http/src/HttpClient.js',//依赖httpEventType,juggle-event
'juggle-resource/src/ResourceEventType.js',//无依赖
'juggle-resource/src/Loader.js',//resourceEventType,juggle-http,juggle-event
'juggle-resource/src/ResourceManager.js',//依赖resourceEventType,Loader
'juggle-mv/src/ViewManager.js',//无依赖
'juggle-module/src/ModuleManager.js',//依赖juggle-resource
'juggle-httpfilter/src/HttpFilter.js'//依赖juggle-http
],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
build: {
src: 'dist/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
// 默认任务
grunt.registerTask('default', ['concat', 'uglify']);
}; | 48.163265 | 114 | 0.566949 |
f20f7f211f1f3209f214b967b8a570a0f88486a4 | 1,094 | js | JavaScript | src/Text/index.js | abrande/helix-react | b02ce0dc5210be52453ecc83d751af91289f23f1 | [
"Apache-2.0"
] | null | null | null | src/Text/index.js | abrande/helix-react | b02ce0dc5210be52453ecc83d751af91289f23f1 | [
"Apache-2.0"
] | null | null | null | src/Text/index.js | abrande/helix-react | b02ce0dc5210be52453ecc83d751af91289f23f1 | [
"Apache-2.0"
] | null | null | null | import PropTypes from 'prop-types';
import React from 'react';
import classnames from 'classnames';
const Text = ({
id,
label,
className,
required,
optional,
children,
prefix,
suffix,
style,
...rest
}) => {
return (
<hx-text-control class={className} style={style}>
<input {...rest} id={id} required={required} type="text" />
<label
className={classnames({
hxOptional: optional,
hxRequired: required,
})}
htmlFor={id}
>
{label}
</label>
{prefix && <span className="hxPrefix">{prefix}</span>}
{suffix && <span className="hxSuffix">{suffix}</span>}
{children}
</hx-text-control>
);
};
Text.propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
style: PropTypes.object,
children: PropTypes.node,
optional: PropTypes.bool,
disabled: PropTypes.bool,
required: PropTypes.bool,
label: PropTypes.string,
name: PropTypes.string,
prefix: PropTypes.node,
suffix: PropTypes.node,
onChange: PropTypes.func,
};
export default Text;
| 20.641509 | 65 | 0.626143 |
f20f941cc7c8cbfcc611f26ce9bfaead38fb8ccb | 1,476 | js | JavaScript | src/calculate-bounds.js | craigmc08/ski-heat-map | 795d980fa9adba1ec0837f96db5c12ab0e6eb13e | [
"MIT"
] | null | null | null | src/calculate-bounds.js | craigmc08/ski-heat-map | 795d980fa9adba1ec0837f96db5c12ab0e6eb13e | [
"MIT"
] | null | null | null | src/calculate-bounds.js | craigmc08/ski-heat-map | 795d980fa9adba1ec0837f96db5c12ab0e6eb13e | [
"MIT"
] | null | null | null | const coordinates = require('./coordinates');
function CalculateTrackBounds(track, paddingPercent) {
let minlat = Infinity;
let maxlat = -Infinity;
let minlon = Infinity;
let maxlon = -Infinity;
let minele = Infinity;
let maxele = -Infinity;
for (let i = 0; i < track.length; i++) {
minlat = minlat < track[i].latitude ? minlat : track[i].latitude;
maxlat = maxlat > track[i].latitude ? maxlat : track[i].latitude;
minlon = minlon < track[i].longitude ? minlon : track[i].longitude;
maxlon = maxlon > track[i].longitude ? maxlon : track[i].longitude;
minele = minele < track[i].elevation ? minele : track[i].elevation;
maxele = maxele > track[i].elevation ? maxele : track[i].elevation;
}
const raw_width = (maxlon - minlon);
const padding = raw_width * paddingPercent * 2;
const width = raw_width + 2 * padding;
const height = (maxlat - minlat) + 2 * padding;
const depth = maxele - minele;
const north = maxlat + padding;
const south = minlat - padding;
const east = maxlon + padding;
const west = minlon - padding;
return {
width,
height,
widthFeet: coordinates.longitudeToDistance(width, (north + south) / 2),
heightFeet: coordinates.latitudeToDistance(height),
depth,
maxlat: north,
minlat: south,
maxlon: east,
minlon: west,
};
}
module.exports = CalculateTrackBounds; | 33.545455 | 79 | 0.621274 |
f210c7fd772dc8b3fc0ff1139a4bfe85b1d88bec | 2,558 | js | JavaScript | src/actions/register.js | chaos87/backtube | 139d7f725b0fbd4e9bbe27d2d4e9eddbe2f66fa7 | [
"MIT"
] | null | null | null | src/actions/register.js | chaos87/backtube | 139d7f725b0fbd4e9bbe27d2d4e9eddbe2f66fa7 | [
"MIT"
] | 23 | 2020-12-06T13:18:31.000Z | 2021-02-08T03:12:25.000Z | src/actions/register.js | chaos87/backtube | 139d7f725b0fbd4e9bbe27d2d4e9eddbe2f66fa7 | [
"MIT"
] | null | null | null | import {
REGISTER_FAILED,
REGISTER_STARTED,
REGISTER_SUCCESS,
CONFIRMATION_SUCCESS,
CONFIRMATION_STARTED,
CONFIRMATION_FAILED,
RESEND_CODE_FAILED,
RESEND_CODE_STARTED,
RESEND_CODE_SUCCESS
} from '../constants/actionTypes'
import { register, confirm, resendCode } from '../api/register'
export function registerUser(userInfo) {
return async function (dispatch) {
dispatch(registrationStarted())
return register(userInfo)
.then(registration => {
if (registration.error) {
let username = registration.error === "User already exists" ? userInfo["username"] : null
dispatch(registrationFailed(registration.error, username))
}
else {
dispatch(registrationSuccess(registration))
}
})
.catch(err => {
dispatch(registrationFailed(err.message, null))
});
}
}
export function confirmUser(username, code) {
return function (dispatch) {
dispatch(confirmationStarted())
return confirm(username, code)
.then(confirmation => {
if (confirmation !== "SUCCESS") {
dispatch(confirmationFailed(confirmation.error))
}
else {
dispatch(confirmationSuccess())
}
})
.catch(err => {
dispatch(confirmationFailed(err.message))
});
}
}
export function resendConfirmationCode(username) {
return function (dispatch) {
dispatch(resendCodeStarted())
return resendCode(username)
.then(result => {
if (!('CodeDeliveryDetails' in result)) {
dispatch(resendCodeFailed(result.error))
}
else {
dispatch(resendCodeSuccess())
}
})
.catch(err => {
dispatch(resendCodeFailed(err.message))
});
}
}
const registrationSuccess = registration => ({
type: REGISTER_SUCCESS,
payload: {
registration
}
});
const registrationStarted = () => ({
type: REGISTER_STARTED
});
const registrationFailed = (error, username) => ({
type: REGISTER_FAILED,
payload: {
error,
username
}
});
const confirmationSuccess = () => ({
type: CONFIRMATION_SUCCESS
});
const confirmationStarted = () => ({
type: CONFIRMATION_STARTED
});
const confirmationFailed = error => ({
type: CONFIRMATION_FAILED,
payload: {
error
}
});
const resendCodeSuccess = () => ({
type: RESEND_CODE_SUCCESS
});
const resendCodeStarted = () => ({
type: RESEND_CODE_STARTED
});
const resendCodeFailed = error => ({
type: RESEND_CODE_FAILED,
payload: {
error
}
});
| 21.863248 | 101 | 0.632916 |
f21105a2c40323f9b3dcf1ae0536461ed4e8e854 | 1,872 | js | JavaScript | stubs/inertia/resources/js/Components/UI/Dropdown.js | lucky-media/breeze-react | 15de241f248258e40bd18c2d35abe3b581228cbd | [
"MIT"
] | 13 | 2021-04-29T18:17:08.000Z | 2022-01-04T17:18:52.000Z | stubs/inertia/resources/js/Components/UI/Dropdown.js | lucky-media/breeze-react | 15de241f248258e40bd18c2d35abe3b581228cbd | [
"MIT"
] | null | null | null | stubs/inertia/resources/js/Components/UI/Dropdown.js | lucky-media/breeze-react | 15de241f248258e40bd18c2d35abe3b581228cbd | [
"MIT"
] | 4 | 2021-07-01T17:43:52.000Z | 2022-01-04T17:18:22.000Z | import React, { useState, useContext } from "react";
import { InertiaLink } from "@inertiajs/inertia-react";
const DropDownContext = React.createContext();
const Dropdown = ({ children }) => {
const [open, setOpen] = useState(false);
const toggleOpen = () => {
setOpen((prevState) => !prevState);
};
return (
<DropDownContext.Provider value={{ toggleOpen, open, setOpen }}>
<div className="relative">
{children}
</div>
</DropDownContext.Provider>
);
}
const Content = ({ children }) => {
const { open, setOpen } = useContext(DropDownContext)
return (
<>
{open && (
<>
<div className="fixed inset-0 z-40" onClick={() => setOpen(false)}></div>
<div className="absolute z-50 mt-2 rounded-md shadow-lg origin-top-left right-0 w-48"
onClick={() => setOpen(false)}
>
<div className="rounded-md bg-white ring-1 ring-black ring-opacity-5">
{children}
</div>
</div>
</>
)}
</>
)
}
const Trigger = ({ children }) => {
const { toggleOpen } = useContext(DropDownContext)
return (
<div onClick={toggleOpen}>
{children}
</div>
)
}
const Link = ({ href, children }) => {
return <InertiaLink
href={href}
method="post"
as="button"
className="block w-full px-4 py-2 text-left text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out"
>
{children}
</InertiaLink>
}
Dropdown.Trigger = Trigger;
Dropdown.Content = Content;
Dropdown.Link = Link;
export default Dropdown;
| 24.96 | 175 | 0.524038 |
f2111b58d98e5cd4d76cf6a0c57d3975eacbe1fb | 67,078 | js | JavaScript | app.js | arma7x/k-todoist | 7c65f2208173129c959bc28ff4f5db0e2c7ba04b | [
"MIT"
] | 4 | 2021-04-04T23:08:40.000Z | 2022-01-10T15:15:47.000Z | app.js | arma7x/k-todoist | 7c65f2208173129c959bc28ff4f5db0e2c7ba04b | [
"MIT"
] | 1 | 2022-02-08T15:39:45.000Z | 2022-02-08T18:40:23.000Z | app.js | arma7x/k-todoist | 7c65f2208173129c959bc28ff4f5db0e2c7ba04b | [
"MIT"
] | null | null | null | const APP_VERSION = '1.1.0';
window.addEventListener("load", function() {
localforage.setDriver(localforage.LOCALSTORAGE);
function isElementInViewport(el, marginTop = 0, marginBottom = 0) {
if (!el.getBoundingClientRect)
return
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 + marginTop &&
rect.left >= 0 &&
rect.bottom <= ((window.innerHeight || document.documentElement.clientHeight) - marginBottom) && /* or $(window).height() */
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
);
}
const CLIENT_ID = "37243c41f091443492812b2782548508";
const SCOPE = 'task:add,data:read,data:read_write,data:delete,project:delete';
var IFRAME_TIMER;
const state = new KaiState({
'TODOIST_SYNC': {},
});
const initTodoistWebsocket = function() {
localforage.getItem('TODOIST_SYNC')
.then((TODOIST_SYNC) => {
if (TODOIST_SYNC != null) {
if (TODOIST_SYNC.user != null) {
if (TODOIST_SYNC.user.websocket_url != null) {
// console.log('WS', TODOIST_SYNC.user.websocket_url);
const ws = new WebSocket(TODOIST_SYNC.user.websocket_url);
ws.onclose = function() {
// console.log('ws.onclose');
initTodoistWebsocket();
}
ws.onmessage = function(msg) {
if (msg.data != null) {
try {
const data = JSON.parse(msg.data);
if (data.type === "sync_needed") {
if (window['TODOIST_API'] != null ) {
router.showLoading();
window['TODOIST_API'].sync()
.finally(() => {
router.hideLoading();
})
// console.log(data.type);
}
}
} catch (e) {}
}
}
ws.onopen = function() {
// console.log('ws.onopen');
if (window['TODOIST_API'] != null ) {
router.showLoading();
window['TODOIST_API'].sync()
.finally(() => {
router.hideLoading();
})
}
}
}
}
}
})
}
const onCompleteSync = function(data) {
if (data == null) {
return
}
localforage.setItem('TODOIST_SYNC', data)
.then((TODOIST_SYNC) => {
state.setState('TODOIST_SYNC', TODOIST_SYNC);
// console.log('onCompleteSync');
})
}
function ymd(yourDate){
const offset = yourDate.getTimezoneOffset()
yourDate = new Date(yourDate.getTime() - (offset*60*1000))
return yourDate.toISOString().split('T')[0]
}
function getURLParam(key, target) {
var values = [];
if (!target) target = location.href;
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var pattern = key + '=([^&#]+)';
var o_reg = new RegExp(pattern,'ig');
while (true){
var matches = o_reg.exec(target);
if (matches && matches[1]){
values.push(matches[1]);
} else {
break;
}
}
if (!values.length){
return [];
} else {
return values.length == 1 ? [values[0]] : values;
}
}
function extractTodayItems(items) {
var now = new Date();
var _tasks = [];
items.forEach((i) => {
if (i.is_deleted == 0 && i.due != null) {
const idx = items.findIndex((j) => {
return j.parent_id === i.id && j.is_deleted == 0;
});
i.is_due = false;
i.has_subtask = false;
i.total_subtask = 0;
i.parsed_content = DOMPurify.sanitize(snarkdown(i.content));
if (idx > -1) {
i.has_subtask = true;
const found = items.filter((k) => {
return k.parent_id === i.id && k.is_deleted == 0;
});
i.total_subtask = found.length;
}
i.due_string = '-';
var date = new Date(i.due.date);
if (date < now) {
i.is_due = true;
}
i.due_string = ymd(date);
if (i.due.date.indexOf('T') === 10) {
var datetime = new Date(i.due.date);
if (datetime < now) {
i.is_due = true;
} else {
i.is_due = false;
}
i.due_string = datetime.toLocaleString();
}
if (!i.has_subtask && (i.is_due || now.toLocaleDateString() === date.toLocaleDateString())) {
_tasks.push(i);
}
}
});
_tasks.sort((a,b) => (a.child_order > b.child_order) ? 1 : ((b.child_order > a.child_order) ? -1 : 0));
return _tasks;
}
function extractItems(items, project_id, parent_id, section_id) {
var _tasks = [];
items.forEach((i) => {
if (i.project_id === project_id && i.parent_id === parent_id && i.section_id === section_id && i.is_deleted == 0) {
const idx = items.findIndex((j) => {
return j.parent_id === i.id && j.is_deleted == 0;
});
i.is_due = false;
i.has_subtask = false;
i.total_subtask = 0;
i.parsed_content = DOMPurify.sanitize(snarkdown(i.content));
if (idx > -1) {
i.has_subtask = true;
const found = items.filter((k) => {
return k.parent_id === i.id && k.is_deleted == 0;
});
i.total_subtask = found.length;
}
i.due_string = '-';
if (i.due) {
var now = new Date();
var date = new Date(i.due.date);
if (date < now) {
i.is_due = true;
}
i.due_string = ymd(date);
if (i.due.date.indexOf('T') === 10) {
var datetime = new Date(i.due.date);
if (datetime < now) {
i.is_due = true;
} else {
i.is_due = false;
}
i.due_string = datetime.toLocaleString();
}
}
_tasks.push(i);
}
});
_tasks.sort((a,b) => (a.child_order > b.child_order) ? 1 : ((b.child_order > a.child_order) ? -1 : 0));
return _tasks;
}
function extractSections(sections, project_id) {
var _sections = [];
sections.forEach((i) => {
if (i.project_id === project_id && i.is_deleted == 0) {
_sections.push(i);
}
});
_sections.sort((a,b) => (a.section_order > b.section_order) ? 1 : ((b.section_order > a.section_order) ? -1 : 0));
return _sections;
}
const helpSupportPage = new Kai({
name: 'helpSupportPage',
data: {
title: 'helpSupportPage'
},
template: `<div style="padding:4px;"><style>.kui-software-key{height:0px}#__kai_router__{height:266px!important;}.kui-router-m-bottom{margin-bottom:0px!important;}</style>
<h5 style="margin-top:6px;margin-bottom:2px;"># New features:</h5>
<ul style="padding: 1px 0 1px 20px;font-size:14px;margin-bottom:2px;">
<li style="margin-right:0px;margin-bottom:3px;">Add <b>description</b> field for Task</li>
<li style="margin-right:0px;margin-bottom:3px;"><b>Task Viewer</b> support markdown markup(for description field)</li>
<li style="margin-right:0px;margin-bottom:3px;"><b>Task Viewer</b> support navigation between anchor tags</li>
</ul>
<h5 style="margin-top:6px;margin-bottom:2px;"># Task Viewer Shortcut key:</h5>
<ul style="padding: 1px 0 1px 20px;font-size:14px;margin-bottom:2px;">
<li style="margin-right:0px;margin-bottom:3px;"><b>Arrow Up</b> or <b>Arrow Down</b> to scroll the page</li>
<li style="margin-right:0px;margin-bottom:3px;"><b>Arrow Left</b> or <b>Arrow Right</b> to jump between anchor tag</li>
<li style="margin-right:0px;margin-bottom:3px;"><b>Enter</b> to select anchor tag</li>
</ul>
<h5 style="margin-top:6px;margin-bottom:2px;"># List of unavailable Premium features(maybe implemented on next update):</h5>
<ul style="padding: 1px 0 1px 20px;font-size:14px;margin-bottom:2px;">
<li style="margin-right:0px;margin-bottom:3px;">Backups</li>
<li style="margin-right:0px;margin-bottom:3px;">Archive a project</li>
<li style="margin-right:0px;margin-bottom:3px;">Unarchive a project</li>
<li style="margin-right:0px;margin-bottom:3px;">Filters</li>
<li style="margin-right:0px;margin-bottom:3px;">Label</li>
<li style="margin-right:0px;margin-bottom:3px;">User settings</li>
<li style="margin-right:0px;margin-bottom:3px;">Templates</li>
<li style="margin-right:0px;margin-bottom:3px;">Reminders</li>
<li style="margin-right:0px;margin-bottom:3px;">Get all completed items(Task)</li>
<li style="margin-right:0px;margin-bottom:3px;">Project Notes(Project Comment)</li>
<li style="margin-right:0px;margin-bottom:3px;">Item Notes(Task Comment)</li>
</ul>
</div>`,
mounted: function() {
this.$router.setHeaderTitle('Help & Support');
navigator.spatialNavigationEnabled = false;
},
unmounted: function() {},
methods: {},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {},
center: function() {},
right: function() {}
}
});
const loginPage = function($router) {
var ping = new XMLHttpRequest({ mozSystem: true });
ping.open('GET', 'https://malaysiaapi.herokuapp.com/', true);
ping.send();
var salt = window.crypto.getRandomValues(new Uint32Array(10))[0].toString();
const hashids2 = new Hashids(salt, 15);
const random = hashids2.encode(1);
var url = `https://todoist.com/oauth/authorize?client_id=${CLIENT_ID}&scope=${SCOPE}&state=${random}`
$router.push(new Kai({
name: 'loginPage',
data: {
title: 'loginPage'
},
templateUrl: document.location.origin + '/templates/login.html',
mounted: function() {
const hdr = document.getElementById('__kai_header__');
hdr.classList.add("sr-only");
const sk = document.getElementById('__kai_soft_key__');
sk.classList.add("sr-only");
const kr = document.getElementById('__kai_router__');
kr.classList.add("full-screen-browser");
navigator.spatialNavigationEnabled = true;
var frameContainer = document.getElementById('login-container');
loginTab = new Tab(url);
window['loginTab'] = loginTab;
loginTab.iframe.setAttribute('height', '296px;');
loginTab.iframe.setAttribute('style', 'padding:2px;');
loginTab.iframe.setAttribute('frameBorder', '0');
loginTab.iframe.addEventListener('mozbrowserloadstart', () => {
$router.showLoading(false);
});
loginTab.iframe.addEventListener('mozbrowserloadend', () => {
this.$router.hideLoading();
});
var container = document.querySelector('#login-container');
var root1 = container.createShadowRoot();
var root2 = container.createShadowRoot();
root1.appendChild(loginTab.iframe);
var shadow = document.createElement('shadow');
root2.appendChild(shadow);
loginTab.iframe.addEventListener('mozbrowserlocationchange', function (e) {
if (e.detail.url.indexOf('https://malaysiaapi.herokuapp.com/todoist/api/v1/redirect') > -1) {
// console.log(window['loginTab'].url.url);
const codeToken = getURLParam('code', window['loginTab'].url.url);
const stateToken = getURLParam('state', window['loginTab'].url.url);
if (codeToken.length > 0 && stateToken.length > 0) {
setTimeout(() => {
var oauthAuthorize = new XMLHttpRequest({ mozSystem: true });
oauthAuthorize.open('GET', 'https://malaysiaapi.herokuapp.com/todoist/api/v1/exchange_token?code=' + codeToken[0], true);
oauthAuthorize.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
oauthAuthorize.setRequestHeader("X-Accept", 'application/json');
oauthAuthorize.onreadystatechange = function() {
if(oauthAuthorize.readyState == 4 && oauthAuthorize.status == 200) {
if (oauthAuthorize.response) {
var obj = JSON.parse(oauthAuthorize.response);
localforage.setItem('TODOIST_ACCESS_TOKEN', obj.data)
$router.showToast('Login Success');
$router.hideLoading()
$router.pop();
} else {
$router.hideLoading()
$router.showToast('Invalid response');
$router.pop();
}
} else if (oauthAuthorize.status == 403) {
$router.hideLoading()
$router.showToast('Unauthorize 403');
$router.pop();
} else if (oauthAuthorize.readyState == 4) {
$router.hideLoading()
$router.showToast('Unknown Error');
$router.pop();
}
}
$router.showLoading();
oauthAuthorize.send();
}, 500);
}
}
});
},
unmounted: function() {
const hdr = document.getElementById('__kai_header__');
hdr.classList.remove("sr-only");
const sk = document.getElementById('__kai_soft_key__');
sk.classList.remove("sr-only");
const kr = document.getElementById('__kai_router__');
kr.classList.remove("full-screen-browser");
navigator.spatialNavigationEnabled = false;
},
methods: {
listenState: function() {}
},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {},
center: function() {},
right: function() {}
},
backKeyListener: function() {
window['loginTab'].getCanGoBack()
.then((canGoBack) => {
if (canGoBack) {
window['loginTab'].goBack();
} else {
this.$router.pop();
}
});
return true;
}
}));
}
const addProjectPage = function($router, id, name, color, favorite) {
$router.push(
new Kai({
name: 'addProjectPage',
data: {
title: name || '',
favorite: favorite ? 'Yes' : 'No',
color_hex: color ? Todoist.Colors[color][1] : '#b8b8b8',
color_name: color ? Todoist.Colors[color][0] : 'Grey',
color_index: color || 48
},
verticalNavClass: '.addProjNav',
templateUrl: document.location.origin + '/templates/addProject.html',
mounted: function() {
this.$router.setHeaderTitle(id ? 'Update Project' : 'Add Project');
navigator.spatialNavigationEnabled = false;
},
unmounted: function() {},
methods: {
setFavorite: function() {
var menu = [
{ "text": "Yes", "checked": false },
{ "text": "No", "checked": false }
];
const idx = menu.findIndex((opt) => {
return opt.text === this.data.favorite;
});
this.$router.showSingleSelector('Favorite', menu, 'Select', (selected) => {
this.setData({ favorite: selected.text });
}, 'Cancel', null, undefined, idx);
},
setColor: function() {
var colors = [];
for (var i in Todoist.Colors) {
colors.push({ "text": Todoist.Colors[i][0], "hex": Todoist.Colors[i][1], 'index': i,"checked": false });
}
const idx = colors.findIndex((opt) => {
return opt.hex === this.data.color_hex;
});
this.$router.showSingleSelector('Color', colors, 'Select', (selected) => {
this.setData({ color_name: selected.text, color_hex: selected.hex, color_index: parseInt(selected.index) });
}, 'Cancel', null, undefined, idx);
}
},
softKeyText: { left: 'Back', center: 'SELECT', right: id ? 'Update' : 'Add' },
softKeyListener: {
left: function() {
this.$router.pop();
},
center: function() {
const listNav = document.querySelectorAll(this.verticalNavClass);
if (this.verticalNavIndex > -1) {
if (listNav[this.verticalNavIndex]) {
listNav[this.verticalNavIndex].click();
}
}
},
right: function() {
if (window['TODOIST_API']) {
this.$router.showLoading();
var req;
if (id) {
req = window['TODOIST_API'].updateProject(id, document.getElementById('project_title').value, this.data.color_index, (this.data.favorite === 'Yes' || false))
} else {
req = window['TODOIST_API'].createProject(document.getElementById('project_title').value, null, this.data.color_index, (this.data.favorite === 'Yes' || false))
}
req.then(() => {
this.$router.showToast('Success');
this.$router.pop();
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}
}
},
softKeyInputFocusText: { left: 'Done', center: '', right: '' },
softKeyInputFocusListener: {
left: function() {
if (document.activeElement.tagName === 'INPUT') {
document.activeElement.blur();
this.dPadNavListener.arrowDown();
}
},
center: function() {},
right: function() {}
},
dPadNavListener: {
arrowUp: function() {
this.navigateListNav(-1);
this.data.title = document.getElementById('project_title').value;
},
arrowRight: function() {
// this.navigateTabNav(-1);
},
arrowDown: function() {
this.navigateListNav(1);
this.data.title = document.getElementById('project_title').value;
},
arrowLeft: function() {
// this.navigateTabNav(1);
},
}
})
);
}
const taskPage = function($router, task_id) {
const idx = state.getState('TODOIST_SYNC')['items'].find((j) => {
return j.id === task_id;
});
if (idx) {
var ANCHORS = [];
var PARENT;
var _anchorIndex = -1;
idx.parsed_content = DOMPurify.sanitize(snarkdown(idx.content));
idx.parsed_description = DOMPurify.sanitize(snarkdown(idx.description));
var due = null;
if (idx.due) {
var date = new Date(idx.due.date);
due = ymd(date);
if (idx.due.date.indexOf('T') === 10) {
var datetime = new Date(idx.due.date);
due = datetime.toLocaleString();
}
}
$router.push(
new Kai({
name: 'taskPage',
data: {
title: 'taskPage',
task: idx,
due: due
},
templateUrl: document.location.origin + '/templates/task.html',
mounted: function() {
this.$router.setHeaderTitle(`#${idx.id}`);
navigator.spatialNavigationEnabled = false;
const VD = document.getElementById('__viewDefinition__');
const len = ANCHORS.length;
ANCHORS = [];
var done = false, _idx = 0;
PARENT = window.getComputedStyle(document.getElementById('__kai_router__'));
const _anchors = VD.querySelectorAll('a')
for (var x in _anchors) {
if (_anchors[x].innerHTML !== "" && _anchors[x].innerHTML != null && _anchors[x].innerText.trim() != "" && _anchors[x].innerText != null) {
ANCHORS.push(_anchors[x]);
if (!done) {
if (len === 0 && isElementInViewport(_anchors[x], parseFloat(PARENT.marginTop), parseFloat(PARENT.marginBottom))) {
_anchors[x].classList.add('focus');
done = true;
_anchorIndex = _idx;
}
}
_idx++;
}
}
if (ANCHORS[_anchorIndex])
ANCHORS[_anchorIndex].classList.add('focus');
this.methods.getVisibleAnchor();
console.log(ANCHORS);
},
unmounted: function() {},
methods: {
isAnchorInViewPort: function(index) {
if (ANCHORS[index] == null)
return false;
if (isElementInViewport(ANCHORS[index], parseFloat(PARENT.marginTop), parseFloat(PARENT.marginBottom))) {
return true;
}
return false;
},
getVisibleAnchor: function() {
const val = _anchorIndex === -1 ? -1 : 1;
if (((_anchorIndex === -1) || (_anchorIndex === ANCHORS.length)) && !this.methods.isAnchorInViewPort(_anchorIndex - val)) {
for (var x in ANCHORS) {
if (this.methods.isAnchorInViewPort(x)) {
_anchorIndex = parseInt(x);
break;
}
}
} else if (this.methods.isAnchorInViewPort(_anchorIndex - val) && !this.methods.isAnchorInViewPort(_anchorIndex)) {
if (ANCHORS[_anchorIndex]) {
ANCHORS[_anchorIndex].classList.remove('focus');
}
ANCHORS[_anchorIndex - val].classList.add('focus');
_anchorIndex = _anchorIndex - val;
}
this.methods.renderCenterText();
},
renderCenterText: function() {
if (ANCHORS[_anchorIndex]) {
this.$router.setSoftKeyCenterText("GOTO");
} else {
this.$router.setSoftKeyCenterText("");
}
}
},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {},
center: function() {
if (ANCHORS[_anchorIndex]) {
window.open(ANCHORS[_anchorIndex].href);
}
},
right: function() {}
},
dPadNavListener: {
arrowUp: function() {
const DOM = document.getElementById(this.id);
DOM.scrollTop -= 20;
this.scrollThreshold = DOM.scrollTop;
if (ANCHORS[_anchorIndex]) {
ANCHORS[_anchorIndex].classList.remove('focus');
while (!this.methods.isAnchorInViewPort(_anchorIndex)) {
_anchorIndex -= 1;
if (ANCHORS[_anchorIndex] == null)
break
}
}
if (ANCHORS[_anchorIndex])
ANCHORS[_anchorIndex].classList.add('focus');
this.methods.getVisibleAnchor();
},
arrowRight: function() {
if (ANCHORS[_anchorIndex + 1] == null)
return
if (this.methods.isAnchorInViewPort(_anchorIndex + 1)) {
ANCHORS[_anchorIndex].classList.remove('focus');
ANCHORS[_anchorIndex + 1].classList.add('focus');
_anchorIndex += 1;
}
this.methods.renderCenterText();
},
arrowDown: function() {
const DOM = document.getElementById(this.id);
DOM.scrollTop += 20;
this.scrollThreshold = DOM.scrollTop;
if (ANCHORS[_anchorIndex]) {
ANCHORS[_anchorIndex].classList.remove('focus');
while (!this.methods.isAnchorInViewPort(_anchorIndex)) {
_anchorIndex += 1;
if (ANCHORS[_anchorIndex] == null)
break
}
}
if (ANCHORS[_anchorIndex])
ANCHORS[_anchorIndex].classList.add('focus');
this.methods.getVisibleAnchor();
},
arrowLeft: function() {
if (ANCHORS[_anchorIndex - 1] == null)
return
if (this.methods.isAnchorInViewPort(_anchorIndex - 1)) {
ANCHORS[_anchorIndex].classList.remove('focus');
ANCHORS[_anchorIndex - 1].classList.add('focus');
_anchorIndex -= 1;
}
this.methods.renderCenterText();
},
}
})
);
} else {
$router.pop();
}
}
const addTaskPage = function($router, content=null, project_id=null, section_id=null, parent_id=null, order=null, label_ids=[], priority=null, due_string=null, due_date=null, due_datetime=null, due_lang=null, assignee=null, description=null) {
$router.push(
new Kai({
name: 'addProjectPage',
data: {
content: content || '',
description: description || '',
priority: priority || 1,
due_date_str: due_date ? ymd(due_date) : 'No',
due_date: due_date || null,
due_datetime_str: due_datetime ? due_datetime.toLocaleTimeString() : 'No',
due_datetime: due_datetime || null,
},
verticalNavClass: '.addTaskNav',
templateUrl: document.location.origin + '/templates/addTask.html',
mounted: function() {
this.$router.setHeaderTitle(content ? 'Update Task' : 'Add Task');
navigator.spatialNavigationEnabled = false;
},
unmounted: function() {},
methods: {
setPriority: function() {
var menu = [
{ "text": "Priority 1", "val": 1, "checked": false },
{ "text": "Priority 2", "val": 2, "checked": false },
{ "text": "Priority 3", "val": 3, "checked": false },
{ "text": "Priority 4", "val": 4, "checked": false }
];
const idx = menu.findIndex((opt) => {
return parseInt(opt.val) === parseInt(this.data.priority);
});
this.$router.showSingleSelector('Priority', menu, 'Select', (selected) => {
this.setData({ priority: parseInt(selected.val) });
}, 'Cancel', null, undefined, idx);
},
setDate: function() {
var y,m,d;
var date = new Date(this.data.due_date);
if (this.data.due_date) {
y = date.getFullYear();
m = date.getMonth() + 1;
d = date.getDate();
}
this.$router.showDatePicker(y, m, d, (dt) => {
setTimeout(() => {
this.setData({ due_date_str: ymd(dt), due_date: dt });
}, 100);
}, () => {
this.setData({ due_date_str: 'No', due_date: null });
});
},
setTime: function() {
var HH,MM;
var date = new Date(this.data.due_datetime);
if (this.data.due_datetime) {
HH = date.getHours();
MM = date.getMinutes();
}
this.$router.showTimePicker(HH, MM, null, (dt) => {
setTimeout(() => {
this.setData({ due_datetime_str: dt.toLocaleTimeString(), due_datetime: dt });
}, 100);
}, () => {
this.setData({ due_datetime_str: 'No', due_datetime: null });
});
}
},
softKeyText: { left: 'Back', center: 'SELECT', right: content ? 'Update' : 'Add' },
softKeyListener: {
left: function() {
this.$router.pop();
},
center: function() {
const listNav = document.querySelectorAll(this.verticalNavClass);
if (this.verticalNavIndex > -1) {
if (listNav[this.verticalNavIndex]) {
listNav[this.verticalNavIndex].click();
}
}
},
right: function() {
var date = (this.data.due_date_str === 'No' ? null : this.data.due_date_str);
var datetime = null;
if (this.data.due_datetime_str !== 'No') {
date = null;
const d = new Date((this.data.due_date_str === 'No' ? new Date() : new Date(this.data.due_date)));
dt = new Date(this.data.due_datetime);
dt.setDate(d.getDate());
dt.setMonth(d.getMonth());
dt.setFullYear(d.getFullYear());
datetime = dt.toISOString();
}
// console.log(this.data.content, project_id, section_id, parent_id, order, label_ids, this.data.priority, due_string, date, datetime, due_lang, assignee);
if (window['TODOIST_API']) {
this.$router.showLoading();
var req;
if (content) {
req = window['TODOIST_API'].updateTask(project_id, this.data.content, label_ids, this.data.priority, due_string, date, datetime, due_lang, assignee, this.data.description);
} else {
req = window['TODOIST_API'].createTask(this.data.content, project_id, section_id, parent_id, order, label_ids, this.data.priority, due_string, date, datetime, due_lang, assignee, this.data.description);
}
req.then(() => {
this.$router.showToast('Success');
this.$router.pop();
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}
}
},
softKeyInputFocusText: { left: 'Done', center: '', right: '' },
softKeyInputFocusListener: {
left: function() {
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
document.activeElement.blur();
this.dPadNavListener.arrowDown();
}
},
center: function() {},
right: function() {}
},
dPadNavListener: {
arrowUp: function() {
this.navigateListNav(-1);
this.data.content = document.getElementById('content').value;
this.data.description = document.getElementById('description').value;
},
arrowRight: function() {
// this.navigateTabNav(-1);
},
arrowDown: function() {
this.navigateListNav(1);
this.data.content = document.getElementById('content').value;
this.data.description = document.getElementById('description').value;
},
arrowLeft: function() {
// this.navigateTabNav(1);
},
}
})
);
}
const tasksPage = function($router, project_id, parent_id, section_id) {
var name = `${project_id}`;
if (section_id) {
const idx = state.getState('TODOIST_SYNC')['sections'].find((j) => {
return j.id === section_id && j.is_deleted == 0;
});
if (idx) {
name = `Section: ${idx.name}`;
} else {
$router.pop();
}
} else if (parent_id) {
const idx = state.getState('TODOIST_SYNC')['items'].find((j) => {
return j.id === parent_id && j.is_deleted == 0;
});
if (idx) {
name = `Sub Task: ${idx.content}`;
} else {
$router.pop();
}
} else {
const idx = state.getState('TODOIST_SYNC')['projects'].find((j) => {
return j.id === project_id && j.is_deleted == 0;
});
if (idx) {
name = `${idx.name}`;
} else {
$router.pop();
}
}
$router.push(
new Kai({
name: 'tasksPage',
data: {
title: 'tasksPage',
tasks: [],
empty: true
},
templateUrl: document.location.origin + '/templates/tasks.html',
verticalNavClass: '.taskListNav',
mounted: function() {
navigator.spatialNavigationEnabled = false;
this.$router.setHeaderTitle(name);
state.addStateListener('TODOIST_SYNC', this.methods.listenStateSync);
var tasks = extractItems(state.getState('TODOIST_SYNC')['items'], project_id, parent_id, section_id);
if ((tasks.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({tasks: tasks, empty: !(tasks.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
unmounted: function() {
state.removeStateListener('TODOIST_SYNC', this.methods.listenStateSync);
},
methods: {
listenStateSync: function(data) {
if (section_id) {
const idx = data['sections'].find((j) => {
return j.id === section_id && j.is_deleted == 0;
});
if (!idx) {
$router.pop();
}
} else if (parent_id) {
const idx = data['items'].find((j) => {
return j.id === parent_id && j.is_deleted == 0;
});
if (!idx) {
$router.pop();
}
} else {
const idx = data['projects'].find((j) => {
return j.id === project_id && j.is_deleted == 0;
});
if (!idx) {
$router.pop();
}
}
var _tasks = extractItems(data['items'], project_id, parent_id, section_id);
if ((_tasks.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({tasks: _tasks, empty: !(_tasks.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
// console.log(this.data.tasks);
},
selected: function() {
var task = this.data.tasks[this.verticalNavIndex];
if (task) {
taskPage($router, task.id);
}
},
toggleSoftKeyText: function(idx) {
setTimeout(() => {
const page = $router.stack[$router.stack.length - 1];
if (page) {
if (page.name != 'tasksPage')
return;
}
if (this.data.tasks[idx]) {
this.$router.setSoftKeyText('Add', 'VIEW', 'More');
} else {
this.$router.setSoftKeyText('Add', '', '');
}
}, 100);
}
},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {
addTaskPage(this.$router, null, project_id, section_id, parent_id);
},
center: function() {
if (this.verticalNavIndex > -1) {
const nav = document.querySelectorAll(this.verticalNavClass);
nav[this.verticalNavIndex].click();
}
},
right: function() {
var task = this.data.tasks[this.verticalNavIndex];
if (task) {
var title = 'Options';
var menu = [
{ "text": task.has_subtask ? "Open Sub Task" : "Add Sub Task" },
{ "text": "Edit Task" },
{ "text": "Task Completed" },
{ "text": "Delete Task" },
];
this.$router.showOptionMenu('Options', menu, 'Select', (selected) => {
setTimeout(() => {
if (selected.text === 'Open Sub Task') {
tasksPage($router, task.project_id, task.id, section_id);
} else if (selected.text === 'Add Sub Task') {
addTaskPage(this.$router, null, project_id, section_id, task.id);
} else if (selected.text === 'Edit Task') {
var date = null;
var datetime = null;
if (task.due) {
date = new Date(task.due.date);
if (task.due.date.indexOf('T') === 10) {
datetime = new Date(task.due.date);
}
}
addTaskPage($router, task.content, task.id, null, null, null, [], task.priority, null, date, datetime, null, null, task.description);
} else if (selected.text === 'Delete Task') {
setTimeout(() => {
this.$router.showDialog('Confirm', 'Are you sure to delete task #' + task.id + ' ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteTask(task.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
});
}, 100);
} else if (selected.text === 'Task Completed') {
setTimeout(() => {
this.$router.showDialog('Confirm', 'Are you sure task #' + task.id + ' was completed ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteTask(task.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
});
}, 100);
} else {
// console.log(selected, task);
}
}, 101);
}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}, 0);
}
}
},
dPadNavListener: {
arrowUp: function() {
if (this.verticalNavIndex === 0 || this.data.tasks.length === 0) {
return;
}
this.navigateListNav(-1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
arrowRight: function() {},
arrowDown: function() {
if (this.verticalNavIndex === (this.data.tasks.length - 1) || this.data.tasks.length === 0) {
return;
}
this.navigateListNav(1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}
}
})
);
}
const todayTasksPage = function($router) {
$router.push(
new Kai({
name: 'todayTasksPage',
data: {
title: 'todayTasksPage',
tasks: [],
empty: true
},
templateUrl: document.location.origin + '/templates/tasks.html',
verticalNavClass: '.taskListNav',
mounted: function() {
navigator.spatialNavigationEnabled = false;
this.$router.setHeaderTitle('Today');
state.addStateListener('TODOIST_SYNC', this.methods.listenStateSync);
var tasks = extractTodayItems(state.getState('TODOIST_SYNC')['items']);
if ((tasks.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({tasks: tasks, empty: !(tasks.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
unmounted: function() {
state.removeStateListener('TODOIST_SYNC', this.methods.listenStateSync);
},
methods: {
listenStateSync: function(data) {
var _tasks = extractTodayItems(data['items']);
if ((_tasks.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({tasks: _tasks, empty: !(_tasks.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
// console.log(this.data.tasks);
},
selected: function() {
var task = this.data.tasks[this.verticalNavIndex];
if (task) {
setTimeout(() => {
taskPage($router, task.id);
}, 100);
}
},
toggleSoftKeyText: function(idx) {
setTimeout(() => {
const page = $router.stack[$router.stack.length - 1];
if (page) {
if (page.name != 'todayTasksPage')
return;
}
if (this.data.tasks[idx]) {
this.$router.setSoftKeyText('', 'VIEW', 'More');
} else {
this.$router.setSoftKeyText('', '', '');
}
}, 100);
}
},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {
//addTaskPage(this.$router, null, project_id, section_id, parent_id);
},
center: function() {
if (this.verticalNavIndex > -1) {
const nav = document.querySelectorAll(this.verticalNavClass);
nav[this.verticalNavIndex].click();
}
},
right: function() {
var task = this.data.tasks[this.verticalNavIndex];
if (task) {
var title = 'Options';
var menu = [
{ "text": "Edit Task" },
{ "text": "Task Completed" },
{ "text": "Delete Task" },
];
this.$router.showOptionMenu('Options', menu, 'Select', (selected) => {
setTimeout(() => {
if (selected.text === 'Edit Task') {
var date = null;
var datetime = null;
if (task.due) {
date = new Date(task.due.date);
if (task.due.date.indexOf('T') === 10) {
datetime = new Date(task.due.date);
}
}
setTimeout(() => {
addTaskPage($router, task.content, task.id, null, null, null, [], task.priority, null, date, datetime, null, null, task.description);
}, 100);
} else if (selected.text === 'Delete Task') {
setTimeout(() => {
this.$router.showDialog('Confirm', 'Are you sure to delete task #' + task.id + ' ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteTask(task.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
});
}, 100);
} else if (selected.text === 'Task Completed') {
setTimeout(() => {
this.$router.showDialog('Confirm', 'Are you sure task #' + task.id + ' was completed ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteTask(task.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
});
}, 100);
} else {
// console.log(selected, task);
}
}, 101);
}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}, 0);
}
}
},
dPadNavListener: {
arrowUp: function() {
if (this.verticalNavIndex === 0 || this.data.tasks.length === 0) {
return;
}
this.navigateListNav(-1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
arrowRight: function() {},
arrowDown: function() {
if (this.verticalNavIndex === (this.data.tasks.length - 1) || this.data.tasks.length === 0) {
return;
}
this.navigateListNav(1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}
}
})
);
}
const sectionsPage = function($router, project_id) {
const idx = state.getState('TODOIST_SYNC')['projects'].find((j) => {
return j.id === project_id && j.is_deleted == 0;
});
var name = `${project_id}`;
if (idx) {
name = `${idx.name}`;
} else {
$router.pop();
}
$router.push(
new Kai({
name: 'sectionsPage',
data: {
title: 'sectionsPage',
sections: [],
empty: true
},
templateUrl: document.location.origin + '/templates/sections.html',
verticalNavClass: '.sectionListNav',
mounted: function() {
navigator.spatialNavigationEnabled = false;
this.$router.setHeaderTitle(name);
state.addStateListener('TODOIST_SYNC', this.methods.listenStateSync);
var sections = extractSections(state.getState('TODOIST_SYNC')['sections'], project_id);
if ((sections.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({sections: sections, empty: !(sections.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
unmounted: function() {
state.removeStateListener('TODOIST_SYNC', this.methods.listenStateSync);
},
methods: {
listenStateSync: function(data) {
const idx = data['projects'].find((j) => {
return j.id === project_id && j.is_deleted == 0;
});
if (!idx) {
$router.pop();
}
var _sections = extractSections(data['sections'], project_id);
if ((_sections.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
this.setData({sections: _sections, empty: !(_sections.length > 0)});
this.methods.toggleSoftKeyText(this.verticalNavIndex);
// console.log(this.data.sections);
},
selected: function() {
var section = this.data.sections[this.verticalNavIndex];
if (section) {
tasksPage($router, section.project_id, null, section.id);
}
},
toggleSoftKeyText: function(idx) {
setTimeout(() => {
const page = $router.stack[$router.stack.length - 1];
if (page) {
if (page.name != 'sectionsPage')
return;
}
if (this.data.sections[idx]) {
this.$router.setSoftKeyText('Add', 'OPEN', 'More');
} else {
this.$router.setSoftKeyText('Add', '', '');
}
}, 100);
}
},
softKeyText: { left: '', center: '', right: '' },
softKeyListener: {
left: function() {
addSectionPage($router, project_id);
},
center: function() {
if (this.verticalNavIndex > -1) {
const nav = document.querySelectorAll(this.verticalNavClass);
nav[this.verticalNavIndex].click();
}
},
right: function() {
var section = this.data.sections[this.verticalNavIndex];
if (section) {
var title = 'Options';
var menu = [
{ "text": "Edit Section" },
{ "text": "Delete Section" }
];
this.$router.showOptionMenu(title, menu, 'Select', (selected) => {
setTimeout(() => {
if (selected.text === 'Edit Section') {
addSectionPage($router, section.id, section.name);
} else if (selected.text === 'Delete Section') {
setTimeout(() => {
this.$router.showDialog('Confirm', 'Are you sure to delete ' + section.name + ' ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteSection(section.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
});
}, 100);
}
}, 101);
}, () => {
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}, 0);
}
}
},
dPadNavListener: {
arrowUp: function() {
if (this.verticalNavIndex === 0 || this.data.sections.length === 0) {
return;
}
this.navigateListNav(-1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
},
arrowRight: function() {},
arrowDown: function() {
if (this.verticalNavIndex === (this.data.sections.length - 1) || this.data.sections.length === 0) {
return;
}
this.navigateListNav(1);
this.methods.toggleSoftKeyText(this.verticalNavIndex);
}
}
})
);
}
const addSectionPage = function($router, project_id, name) {
$router.push(
new Kai({
name: name ? 'editSectionPage' : 'addSectionPage',
data: {
title: name || ''
},
verticalNavClass: '.addSectionNav',
templateUrl: document.location.origin + '/templates/addSection.html',
mounted: function() {
navigator.spatialNavigationEnabled = false;
this.$router.setHeaderTitle(name ? 'Edit Section' : 'Add Section');
},
unmounted: function() {},
methods: {},
softKeyText: { left: 'Back', center: 'SELECT', right: name ? 'Update' : 'Add' },
softKeyListener: {
left: function() {
this.$router.pop();
},
center: function() {},
right: function() {}
},
softKeyInputFocusText: { left: 'Back', center: '', right: name ? 'Update' : 'Add' },
softKeyInputFocusListener: {
left: function() {
if (document.activeElement.tagName === 'INPUT') {
document.activeElement.blur();
this.$router.pop();
}
},
center: function() {},
right: function() {
if (document.activeElement.tagName === 'INPUT') {
if (window['TODOIST_API']) {
this.$router.showLoading();
var req;
if (name) {
req = window['TODOIST_API'].updateSection(project_id, document.getElementById('section_title').value)
} else {
req = window['TODOIST_API'].createSection(project_id, document.getElementById('section_title').value)
}
req.then(() => {
this.$router.showToast('Success');
document.activeElement.blur();
this.$router.pop();
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}
}
}
},
dPadNavListener: {
arrowUp: function() {
this.navigateListNav(-1);
this.data.title = document.getElementById('project_title').value;
},
arrowRight: function() {
// this.navigateTabNav(-1);
},
arrowDown: function() {
this.navigateListNav(1);
this.data.title = document.getElementById('project_title').value;
},
arrowLeft: function() {
// this.navigateTabNav(1);
},
}
})
);
}
const homepage = new Kai({
name: 'homepage',
data: {
title: 'homepage',
offset: -1,
projects: [],
projectsVerticalNavIndexID: 0,
empty: true,
TODOIST_ACCESS_TOKEN: null
},
verticalNavClass: '.homepageNav',
templateUrl: document.location.origin + '/templates/homepage.html',
mounted: function() {
navigator.spatialNavigationEnabled = false;
this.$router.setHeaderTitle('K-Todoist');
localforage.getItem('APP_VERSION')
.then((v) => {
if (v == null || v != APP_VERSION) {
this.$router.showToast('Read about new updates');
this.$router.push('helpSupportPage');
localforage.setItem('APP_VERSION', APP_VERSION)
} else {
this.$state.addStateListener('TODOIST_SYNC', this.methods.listenStateSync);
navigator.spatialNavigationEnabled = false;
localforage.getItem('TODOIST_ACCESS_TOKEN')
.then((TODOIST_ACCESS_TOKEN) => {
if (TODOIST_ACCESS_TOKEN != null) {
this.setData({ TODOIST_ACCESS_TOKEN: TODOIST_ACCESS_TOKEN });
if (window['TODOIST_API'] == null) {
window['TODOIST_API'] = new Todoist(TODOIST_ACCESS_TOKEN, onCompleteSync);
window['TODOIST_API'].sync()
.then(() => {
initTodoistWebsocket();
});
}
localforage.getItem('TODOIST_SYNC')
.then((TODOIST_SYNC) => {
if (TODOIST_SYNC != null) {
this.$state.setState('TODOIST_SYNC', TODOIST_SYNC);
this.methods.listenStateSync(TODOIST_SYNC);
}
})
} else {
this.$router.setSoftKeyText('Menu', '', '');
}
});
}
});
},
unmounted: function() {
this.$state.removeStateListener('TODOIST_SYNC', this.methods.listenStateSync);
},
methods: {
sync: function() {
if (window['TODOIST_API']) {
this.$router.showLoading();
window['TODOIST_API'].sync()
.finally(() => {
this.$router.hideLoading();
})
}
},
listenStateSync: function(data) {
var projects = [];
data.projects.forEach((i) => {
if (i.is_deleted == 0) {
i.color_hex = Todoist.Colors[i.color][1];
projects.push(i);
}
});
if (projects.length > 0) {
this.$router.setSoftKeyText('Menu', '', 'More');
} else {
this.$router.setSoftKeyText('Menu', '', '');
}
if ((projects.length - 1) < this.verticalNavIndex) {
this.verticalNavIndex--;
}
projects.sort((a,b) => (a.child_order > b.child_order) ? 1 : ((b.child_order > a.child_order) ? -1 : 0));
this.setData({ projects: projects, empty: (projects.length === 0 ? true : false) });
// console.log(projects);
},
toggleSoftKeyText: function() {
setTimeout(() => {
const page = this.$router.stack[this.$router.stack.length - 1];
if (page) {
if (page.name != 'homepage')
return;
}
if (!this.$router.bottomSheet) {
if (this.data.projects.length > 0) {
this.$router.setSoftKeyText('Menu', '', 'More');
} else {
this.$router.setSoftKeyText('Menu', '', '');
}
}
}, 100);
},
deleteArticle: function() {},
nextPage: function() {},
selected: function() {
var proj = this.data.projects[this.verticalNavIndex];
if (proj) {
tasksPage(this.$router, proj.id, null, null);
}
}
},
softKeyText: { left: 'Menu', center: '', right: '' },
softKeyListener: {
left: function() {
localforage.getItem('TODOIST_ACCESS_TOKEN')
.then((res) => {
var title = 'Menu';
var menu = [
{ "text": "Help & Support" },
{ "text": "Login" },
{ "text": "Kill App" }
];
if (res) {
try {
title = this.$state.getState('TODOIST_SYNC').user.email;
} catch (e){}
menu = [
{ "text": "Help & Support" },
{ "text": "Sync" },
{ "text": "Add Project" },
{ "text": "Today" },
{ "text": "Logout" },
{ "text": "Kill App" }
];
}
this.$router.showOptionMenu(title, menu, 'Select', (selected) => {
setTimeout(() => {
if (selected.text === 'Login') {
loginPage(this.$router);
} else if (selected.text === 'Add Project') {
addProjectPage(this.$router);
} else if (selected.text === 'Logout') {
window['TODOIST_API'] = null;
localforage.removeItem('TODOIST_ACCESS_TOKEN');
localforage.removeItem('TODOIST_SYNC');
this.verticalNavIndex = 0;
this.setData({ TODOIST_ACCESS_TOKEN: null });
this.setData({ projects: [], offset: -1 });
this.$router.setSoftKeyText('Menu', '', '');
} else if (selected.text === 'Sync') {
this.methods.sync();
} else if (selected.text === 'Help & Support') {
this.$router.push('helpSupportPage');
} else if (selected.text === 'Today') {
todayTasksPage(this.$router);
} else if (selected.text === 'Kill App') {
window.close();
}
}, 101);
}, () => {
this.methods.toggleSoftKeyText();
}, 0);
})
.catch((err) => {
// console.log(err);
});
},
center: function() {
//if (this.verticalNavIndex > -1) {
// const nav = document.querySelectorAll(this.verticalNavClass);
// nav[this.verticalNavIndex].click();
//}
},
right: function() {
var proj = this.data.projects[this.verticalNavIndex];
if (proj) {
var title = 'Options';
var menu = [
{ "text": "Show Tasks" },
{ "text": "Show Sections" },
{ "text": "Edit Project" },
{ "text": "Delete Project" }
];
this.$router.showOptionMenu(title, menu, 'Select', (selected) => {
setTimeout(() => {
if (selected.text === 'Show Tasks') {
tasksPage(this.$router, proj.id, null, null);
} else if (selected.text === 'Show Sections') {
sectionsPage(this.$router, proj.id);
} else if (selected.text === 'Edit Project') {
addProjectPage(this.$router, proj.id, proj.name, proj.color, proj.is_favorite);
} else if (selected.text === 'Delete Project') {
this.$router.showDialog('Confirm', 'Are you sure to delete ' + proj.name + ' ?', null, 'Yes', () => {
this.$router.showLoading();
window['TODOIST_API'].deleteProject(proj.id)
.then(() => {
this.$router.showToast('Success');
})
.catch((e) => {
var msg;
if (e.response) {
msg = e.response.toString();
} else {
msg = e.toString();
}
this.$router.showToast(msg);
})
.finally(() => {
this.$router.hideLoading();
});
}, 'No', () => {}, '', () => {}, () => {
this.methods.toggleSoftKeyText();
});
}
}, 101);
}, () => {
this.methods.toggleSoftKeyText();
}, 0);
}
}
},
backKeyListener: function() {
return false;
},
dPadNavListener: {
arrowUp: function() {
if (this.verticalNavIndex === 0 || this.data.projects.length === 0) {
return;
}
this.navigateListNav(-1);
},
arrowRight: function() {},
arrowDown: function() {
if (this.verticalNavIndex === (this.data.projects.length - 1) || this.data.projects.length === 0) {
return;
}
this.navigateListNav(1);
},
arrowLeft: function() {},
}
});
const router = new KaiRouter({
title: 'K-Todoist',
routes: {
'index' : {
name: 'homepage',
component: homepage
},
'helpSupportPage': {
name: 'helpSupportPage',
component: helpSupportPage
}
}
});
const app = new Kai({
name: '_APP_',
data: {},
templateUrl: document.location.origin + '/templates/template.html',
mounted: function() {},
unmounted: function() {},
router,
state
});
try {
app.mount('app');
} catch(e) {
// console.log(e);
}
IFRAME_TIMER = setInterval(() => {
if (document.activeElement.tagName === 'IFRAME') {
navigator.spatialNavigationEnabled = true;
}
}, 500);
function displayKaiAds() {
var display = true;
if (window['kaiadstimer'] == null) {
window['kaiadstimer'] = new Date();
} else {
var now = new Date();
if ((now - window['kaiadstimer']) < 300000) {
display = false;
} else {
window['kaiadstimer'] = now;
}
}
console.log('Display Ads:', display);
if (!display)
return;
getKaiAd({
publisher: 'ac3140f7-08d6-46d9-aa6f-d861720fba66',
app: 'k-todoist',
slot: 'kaios',
onerror: err => console.error(err),
onready: ad => {
ad.call('display')
ad.on('close', () => {
app.$router.hideBottomSheet();
document.body.style.position = '';
});
ad.on('display', () => {
app.$router.hideBottomSheet();
document.body.style.position = '';
});
}
})
}
displayKaiAds();
document.addEventListener('visibilitychange', () => {
if (app.$router.stack.length === 1) {
setTimeout(() => {
navigator.spatialNavigationEnabled = false;
}, 500);
}
if (document.activeElement.tagName === 'IFRAME') {
document.activeElement.blur();
}
if (document.visibilityState === 'hidden') {
if (IFRAME_TIMER) {
clearInterval(IFRAME_TIMER);
}
} else if (document.visibilityState === 'visible') {
displayKaiAds();
const browser = app.$router.stack[app.$router.stack.length - 1];
if (browser.name === 'browser') {
if (document.activeElement.tagName !== 'IFRAME') {
navigator.spatialNavigationEnabled = true;
}
}
IFRAME_TIMER = setInterval(() => {
if (document.activeElement.tagName === 'IFRAME') {
navigator.spatialNavigationEnabled = true;
}
}, 500);
}
});
});
| 37.811725 | 245 | 0.479501 |
f211f01b213b61d4e71cab3cf1be29ec219ce0c8 | 2,149 | js | JavaScript | src/components/LandingPage.js | Sa1m0n31/drokam-pl | 815c2a71b96955990ecef62d365a8494d13cb2d3 | [
"RSA-MD"
] | null | null | null | src/components/LandingPage.js | Sa1m0n31/drokam-pl | 815c2a71b96955990ecef62d365a8494d13cb2d3 | [
"RSA-MD"
] | null | null | null | src/components/LandingPage.js | Sa1m0n31/drokam-pl | 815c2a71b96955990ecef62d365a8494d13cb2d3 | [
"RSA-MD"
] | null | null | null | import React, { useEffect, useRef } from "react"
import Menu from "./Menu";
import { graphql, useStaticQuery } from "gatsby";
import Img from "gatsby-image";
import { gsap } from 'gsap/all';
import HamburgerMenu from "./HamburgerMenu"
const LandingPage = () => {
const landingPage = useRef(null);
const centerLogo = useRef(null);
useEffect(() => {
gsap.fromTo(centerLogo.current, { y: 300, opacity: 0 }, { y: 0, opacity: 1, duration: 1 });
}, []);
const data = useStaticQuery(graphql`
query Slider {
landing: file(relativePath: { eq: "drokam-landing.png" }) {
childImageSharp {
fluid(maxWidth: 2000, maxHeight: 1200) {
...GatsbyImageSharpFluid_noBase64
}
}
}
landingMobile: file(relativePath: { eq: "drokam-landing-mobile.webp" }) {
childImageSharp {
fluid(maxWidth: 414, maxHeight: 736) {
...GatsbyImageSharpFluid_noBase64
}
}
}
centerLogo: file(relativePath: { eq: "drokam-logo-landing.png" }) {
childImageSharp {
fluid(maxWidth: 850, maxHeight: 123) {
...GatsbyImageSharpFluid_noBase64
}
}
}
}
`);
return (<div className="landingPage" ref={landingPage}>
<Img loading="eager" className="landingPageImg" fluid={data.landing.childImageSharp.fluid} alt="drokam" />
<Img loading="eager" className="landingPageImg landingPageImg--mobile" fluid={data.landingMobile.childImageSharp.fluid} alt="drokam" />
<menu className="topMenu">
<Menu frontPage={true} />
<HamburgerMenu />
</menu>
<div ref={centerLogo} className="centerLogo">
<Img loading="eager" className="centerLogo__img" fluid={data.centerLogo.childImageSharp.fluid} alt="drokam-logo" />
<img loading="eager" className="centerLogo__img--mobile" src={require("../../static/img/drokam-logo-mobile.webp")} alt="drokam-logo" />
</div>
</div>);
};
export default LandingPage; | 36.423729 | 143 | 0.582597 |
f212f4de0f3763017c95a2b6e1d794634e7ec656 | 672 | js | JavaScript | source/components/TextIngredient/index.js | herdianurdin/foodiee | 7809cddf23636e6c74b8ad2821264cf125230f06 | [
"MIT"
] | null | null | null | source/components/TextIngredient/index.js | herdianurdin/foodiee | 7809cddf23636e6c74b8ad2821264cf125230f06 | [
"MIT"
] | null | null | null | source/components/TextIngredient/index.js | herdianurdin/foodiee | 7809cddf23636e6c74b8ad2821264cf125230f06 | [
"MIT"
] | null | null | null | import React, { memo } from 'react'
import { Text } from 'react-native'
import colors from '../../assets/colors'
import sizes from '../../assets/sizes'
const TextIngredient = (props) => {
const { backgroundColor, title, number } = props
return (
<Text
style={{
fontSize: sizes.s16,
fontFamily: 'OpenSans-Regular',
backgroundColor,
color: colors.dark,
paddingHorizontal: sizes.s12,
paddingVertical: sizes.s6,
}}
>
{number ? `${number}. ${title}` : title}
</Text>
)
}
export default memo(TextIngredient)
| 26.88 | 52 | 0.525298 |
f2132b3974bf8a7f4427c0379c746387e0e1cbcc | 3,941 | js | JavaScript | app/containers/CommunicationProvider/tests/actions.test.js | Serninator/hackchat-client | 9a0d808ac46d3d326867030de58641e3cec88040 | [
"WTFPL"
] | 19 | 2020-12-15T03:04:09.000Z | 2022-03-26T07:36:06.000Z | app/containers/CommunicationProvider/tests/actions.test.js | Serninator/hackchat-client | 9a0d808ac46d3d326867030de58641e3cec88040 | [
"WTFPL"
] | 37 | 2020-12-03T03:23:45.000Z | 2022-01-13T21:51:00.000Z | app/containers/CommunicationProvider/tests/actions.test.js | Serninator/hackchat-client | 9a0d808ac46d3d326867030de58641e3cec88040 | [
"WTFPL"
] | 13 | 2020-10-10T18:58:41.000Z | 2022-03-26T07:36:07.000Z | /**
* Communication provider tests
*/
import {
changeChannel,
joinChannel,
sendChat,
enableCaptcha,
disableCaptcha,
lockChannel,
unlockChannel,
inviteUser,
whisperUser,
ignoreUser,
kickUser,
banUser,
muteUser,
unmuteUser,
pushNotif,
clearNotifs,
} from '../actions';
import {
CHANGE_CHANNEL,
START_JOIN,
SEND_CHAT,
ENABLE_CAPTCHA,
DISABLE_CAPTCHA,
LOCK_CHANNEL,
UNLOCK_CHANNEL,
INVITE_USER,
WHISPER_USER,
IGNORE_USER,
KICK_USER,
BAN_USER,
MUTE_USER,
UNMUTE_USER,
PUSH_NOTIF,
CLEAR_NOTIFS,
} from '../constants';
describe('CommunicationProvider actions', () => {
describe('Change current channel', () => {
it('has a type of CHANGE_CHANNEL', () => {
const expected = {
type: CHANGE_CHANNEL,
};
expect(changeChannel()).toEqual(expected);
});
});
describe('Initiate join', () => {
it('has a type of START_JOIN', () => {
const expected = {
type: START_JOIN,
};
expect(joinChannel()).toEqual(expected);
});
});
describe('Send channel message', () => {
it('has a type of SEND_CHAT', () => {
const expected = {
type: SEND_CHAT,
};
expect(sendChat()).toEqual(expected);
});
});
describe('Enabling captcha', () => {
it('has a type of ENABLE_CAPTCHA', () => {
const expected = {
type: ENABLE_CAPTCHA,
};
expect(enableCaptcha()).toEqual(expected);
});
});
describe('Disabling captcha', () => {
it('has a type of DISABLE_CAPTCHA', () => {
const expected = {
type: DISABLE_CAPTCHA,
};
expect(disableCaptcha()).toEqual(expected);
});
});
describe('Locking channel', () => {
it('has a type of LOCK_CHANNEL', () => {
const expected = {
type: LOCK_CHANNEL,
};
expect(lockChannel()).toEqual(expected);
});
});
describe('Unlocking channel', () => {
it('has a type of UNLOCK_CHANNEL', () => {
const expected = {
type: UNLOCK_CHANNEL,
};
expect(unlockChannel()).toEqual(expected);
});
});
describe('Inviting a user', () => {
it('has a type of INVITE_USER', () => {
const expected = {
type: INVITE_USER,
};
expect(inviteUser()).toEqual(expected);
});
});
describe('Whispering a user', () => {
it('has a type of WHISPER_USER', () => {
const expected = {
type: WHISPER_USER,
};
expect(whisperUser()).toEqual(expected);
});
});
describe('Ignoring a user', () => {
it('has a type of IGNORE_USER', () => {
const expected = {
type: IGNORE_USER,
};
expect(ignoreUser()).toEqual(expected);
});
});
describe('Kicking a user', () => {
it('has a type of KICK_USER', () => {
const expected = {
type: KICK_USER,
};
expect(kickUser()).toEqual(expected);
});
});
describe('Banning a user', () => {
it('has a type of BAN_USER', () => {
const expected = {
type: BAN_USER,
};
expect(banUser()).toEqual(expected);
});
});
describe('Muting a user', () => {
it('has a type of MUTE_USER', () => {
const expected = {
type: MUTE_USER,
};
expect(muteUser()).toEqual(expected);
});
});
describe('Unmuting a user', () => {
it('has a type of UNMUTE_USER', () => {
const expected = {
type: UNMUTE_USER,
};
expect(unmuteUser()).toEqual(expected);
});
});
describe('Adding a notification', () => {
it('has a type of PUSH_NOTIF', () => {
const expected = {
type: PUSH_NOTIF,
};
expect(pushNotif()).toEqual(expected);
});
});
describe('Clearning notifications', () => {
it('has a type of CLEAR_NOTIFS', () => {
const expected = {
type: CLEAR_NOTIFS,
};
expect(clearNotifs()).toEqual(expected);
});
});
});
| 21.074866 | 49 | 0.544024 |
f213bc7664ec1a3fa82c95567b9c2f77caa6bc26 | 981 | js | JavaScript | src/components/DeleteModal/index.js | uba-templates/nc-im-me-fe | ae691a6b2fb0af32574b101063bf245b348bcce6 | [
"BSD-2-Clause"
] | null | null | null | src/components/DeleteModal/index.js | uba-templates/nc-im-me-fe | ae691a6b2fb0af32574b101063bf245b348bcce6 | [
"BSD-2-Clause"
] | 1 | 2018-02-08T03:24:48.000Z | 2018-02-08T04:20:46.000Z | src/components/DeleteModal/index.js | uba-templates/nc-im-me-fe | ae691a6b2fb0af32574b101063bf245b348bcce6 | [
"BSD-2-Clause"
] | null | null | null | import React, { Component } from 'react';
import { Icon } from 'tinper-bee';
import Popconfirm from 'bee-popconfirm';
import './index.less';
export default class DeleteModal extends Component {
static defaultProps = {
confirmText: '删除',
cancelText: '取消',
title: '确定要删除这条信息吗?',
placement: 'top'
};
constructor(props) {
super(props);
}
render() {
let { title, confirmText, cancelText, placement}= this.props;
const locale={lang: 'zh-cn', ok: confirmText, cancel: cancelText};
const content= (
<div className='title-box'>
<Icon className="delete-icon iconfont icon-tishianniuzhuyi"/>
<div className='bd-title-1'>{title}</div>
</div>
);
return <Popconfirm
className='delete-modal'
trigger="click"
placement={placement}
content={content}
rootClose={true}
locale={locale}
onCancel={this.props.onCancel}
onClose={this.props.onConfirm}
>
<Icon className="iconfont icon-shanchu icon-style"/>
</Popconfirm>
}
}
| 23.926829 | 68 | 0.673802 |
f213ef12741d4c334ca1c89724d3aa01ec5100ff | 1,193 | js | JavaScript | frontend/src/dashboard/components/ActivityBanner.js | kuanfan99/zeva | 57b506a108fe57438506569d5503c90c52216b2f | [
"Apache-2.0"
] | 3 | 2020-03-25T03:06:20.000Z | 2021-01-20T23:36:03.000Z | frontend/src/dashboard/components/ActivityBanner.js | kuanfan99/zeva | 57b506a108fe57438506569d5503c90c52216b2f | [
"Apache-2.0"
] | 740 | 2019-12-16T15:53:39.000Z | 2022-03-26T08:25:10.000Z | frontend/src/dashboard/components/ActivityBanner.js | kuanfan99/zeva | 57b506a108fe57438506569d5503c90c52216b2f | [
"Apache-2.0"
] | 11 | 2019-11-28T20:39:15.000Z | 2022-01-31T17:53:31.000Z | import React from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import history from '../../app/History';
const ActivityBanner = (props) => {
const {
colour,
icon,
boldText,
regularText,
linkTo,
} = props;
return (
<button
type="button"
name="activity-button"
data-testid="activity-button"
className="alert alert-light activity-banner"
key={regularText}
onClick={() => { history.push(linkTo); }}
>
<div>
<FontAwesomeIcon icon={icon} size="3x" className={colour} />
</div>
<div className="activity-text">
<h3>{boldText}</h3>
<p> — {regularText}</p>
</div>
<div id="fa-arrow">
<FontAwesomeIcon icon="chevron-right" size="2x" className={colour} />
</div>
</button>
);
};
export default ActivityBanner;
ActivityBanner.defaultProps = {
linkTo: '',
};
ActivityBanner.propTypes = {
colour: PropTypes.string.isRequired,
icon: PropTypes.string.isRequired,
boldText: PropTypes.string.isRequired,
regularText: PropTypes.string.isRequired,
linkTo: PropTypes.string,
};
| 23.392157 | 77 | 0.630344 |
f21478696ec722bf29718a040515c3186a98d15c | 1,766 | js | JavaScript | examples/vue.config.js | HughSunny/set-ui-vue | 2159337328902b7459fdb5799f06562d36315cee | [
"MIT"
] | null | null | null | examples/vue.config.js | HughSunny/set-ui-vue | 2159337328902b7459fdb5799f06562d36315cee | [
"MIT"
] | null | null | null | examples/vue.config.js | HughSunny/set-ui-vue | 2159337328902b7459fdb5799f06562d36315cee | [
"MIT"
] | null | null | null | const path = require('path');
const webpack = require('webpack');
module.exports = {
// 生产环境不生成 source map
productionSourceMap: false,
// webpack-dev-server 参考 https://webpack.js.org/configuration/dev-server/
devServer: {
port: 7000,
compress: true,
},
// 该对象将会被 webpack-merge 合并入最终的 webpack 配置
configureWebpack: {
// webpack plugins
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.DefinePlugin({
APP_VERSION: `"${require('./package.json').version}"`,
BUILD_DATE: JSON.stringify(new Date().toLocaleString()),
}),
],
},
// https://github.com/neutrinojs/webpack-chain
chainWebpack: config => {
config.resolve.alias.set('@$', path.join(__dirname, 'src'));
config.resolve.alias.set('set-ui', path.join(__dirname, '../'));
config.resolve.alias.set('set-ui-style', path.join(__dirname, '../src/styles'));
// config.resolve.alias.set('set-ui', path.join(__dirname, '../src'));
// config.resolve.alias.set('set-ui-style', path.join(__dirname, '../lib/styles'));
// svg icon
const svgRule = config.module.rule('svg');
svgRule.uses.clear();
svgRule
.oneOf('inline')
.resourceQuery(/inline/)
.use('vue-svg-icon-loader')
.loader('vue-svg-icon-loader')
.end()
.end()
.oneOf('external')
.use('file-loader')
.loader('file-loader')
.options({
name: 'assets/[name].[hash:8].[ext]',
});
},
pluginOptions: {},
css: {
loaderOptions: {
less: {
modifyVars: {
'border-radius-base': '2px',
'layout-header-height': '48px',
'menu-collapsed-width': '48px',
},
javascriptEnabled: true,
},
},
},
};
| 28.483871 | 87 | 0.580408 |
f2148caa1aae10fdfb33c7f18cd9b1c136421d4c | 13,327 | js | JavaScript | node_modules/@elastic/eui/es/components/image/image.js | mimifitz/IOMED | 93e4e070d2f01b376e3a91adc801929bddd8bb84 | [
"MIT"
] | null | null | null | node_modules/@elastic/eui/es/components/image/image.js | mimifitz/IOMED | 93e4e070d2f01b376e3a91adc801929bddd8bb84 | [
"MIT"
] | null | null | null | node_modules/@elastic/eui/es/components/image/image.js | mimifitz/IOMED | 93e4e070d2f01b376e3a91adc801929bddd8bb84 | [
"MIT"
] | null | null | null | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useState } from 'react';
import PropTypes from "prop-types";
import classNames from 'classnames';
import { EuiOverlayMask } from '../overlay_mask';
import { EuiIcon } from '../icon';
import { EuiI18n } from '../i18n';
import { EuiFocusTrap } from '../focus_trap';
import { keys } from '../../services';
import { useInnerText } from '../inner_text';
var sizeToClassNameMap = {
s: 'euiImage--small',
m: 'euiImage--medium',
l: 'euiImage--large',
xl: 'euiImage--xlarge',
fullWidth: 'euiImage--fullWidth',
original: ''
};
export var SIZES = Object.keys(sizeToClassNameMap);
var fullScreenIconColorMap = {
light: 'ghost',
dark: 'default'
};
export var EuiImage = function EuiImage(_ref) {
var className = _ref.className,
url = _ref.url,
_ref$size = _ref.size,
size = _ref$size === void 0 ? 'original' : _ref$size,
caption = _ref.caption,
hasShadow = _ref.hasShadow,
allowFullScreen = _ref.allowFullScreen,
_ref$fullScreenIconCo = _ref.fullScreenIconColor,
fullScreenIconColor = _ref$fullScreenIconCo === void 0 ? 'light' : _ref$fullScreenIconCo,
alt = _ref.alt,
style = _ref.style,
rest = _objectWithoutProperties(_ref, ["className", "url", "size", "caption", "hasShadow", "allowFullScreen", "fullScreenIconColor", "alt", "style"]);
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
isFullScreenActive = _useState2[0],
setIsFullScreenActive = _useState2[1];
var onKeyDown = function onKeyDown(event) {
if (event.key === keys.ESCAPE) {
event.preventDefault();
event.stopPropagation();
closeFullScreen();
}
};
var closeFullScreen = function closeFullScreen() {
setIsFullScreenActive(false);
};
var openFullScreen = function openFullScreen() {
setIsFullScreenActive(true);
};
var customStyle = _objectSpread({}, style);
var classes = classNames('euiImage', {
'euiImage--hasShadow': hasShadow,
'euiImage--allowFullScreen': allowFullScreen
}, className);
if (typeof size === 'string' && SIZES.includes(size)) {
classes = "".concat(classes, " ").concat(sizeToClassNameMap[size]);
} else {
classes = "".concat(classes);
customStyle.maxWidth = size;
customStyle.maxHeight = size; // Set width back to auto to ensure aspect ratio is kept
customStyle.width = 'auto';
}
var _useInnerText = useInnerText(),
_useInnerText2 = _slicedToArray(_useInnerText, 2),
optionalCaptionRef = _useInnerText2[0],
optionalCaptionText = _useInnerText2[1];
var optionalCaption;
if (caption) {
optionalCaption = React.createElement("figcaption", {
ref: optionalCaptionRef,
className: "euiImage__caption"
}, caption);
}
var allowFullScreenIcon = React.createElement(EuiIcon, {
type: "fullScreen",
color: fullScreenIconColorMap[fullScreenIconColor],
className: "euiImage__icon"
});
var fullScreenDisplay = React.createElement(EuiOverlayMask, {
onClick: closeFullScreen
}, React.createElement(EuiFocusTrap, {
clickOutsideDisables: true
}, React.createElement("figure", {
className: "euiImage euiImage-isFullScreen",
"aria-label": optionalCaptionText
}, React.createElement(EuiI18n, {
token: "euiImage.closeImage",
values: {
alt: alt
},
default: "Close full screen {alt} image"
}, function (closeImage) {
return React.createElement("button", {
type: "button",
"aria-label": closeImage,
className: "euiImage__button",
onClick: closeFullScreen,
onKeyDown: onKeyDown
}, React.createElement("img", _extends({
src: url,
alt: alt,
className: "euiImage-isFullScreen__img"
}, rest)), React.createElement(EuiIcon, {
type: "cross",
color: fullScreenIconColorMap[fullScreenIconColor],
className: "euiImage-isFullScreen__icon"
}));
}), optionalCaption)));
if (allowFullScreen) {
return React.createElement("figure", {
className: classes,
"aria-label": optionalCaptionText
}, React.createElement(EuiI18n, {
token: "euiImage.openImage",
values: {
alt: alt
},
default: "Open full screen {alt} image"
}, function (openImage) {
return React.createElement("button", {
type: "button",
"aria-label": openImage,
className: "euiImage__button",
onClick: openFullScreen
}, React.createElement("img", _extends({
src: url,
alt: alt,
className: "euiImage__img",
style: customStyle
}, rest)), allowFullScreenIcon, isFullScreenActive && fullScreenDisplay);
}), optionalCaption);
} else {
return React.createElement("figure", {
className: classes,
"aria-label": optionalCaptionText
}, React.createElement("img", _extends({
style: customStyle,
src: url,
className: "euiImage__img",
alt: alt
}, rest)), optionalCaption);
}
};
EuiImage.propTypes = {
/**
* Sepearate from the caption is a title on the alt tag itself.
* This one is required for accessibility.
*/
alt: PropTypes.string.isRequired,
/**
* Accepts `s` / `m` / `l` / `xl` / `original` / `fullWidth` / or a CSS size of `number` or `string`.
* `fullWidth` will set the figure to stretch to 100% of its container.
* `string` and `number` types will max both the width or height, whichever is greater.
*/
size: PropTypes.oneOfType([PropTypes.oneOf(["s", "m", "l", "xl", "fullWidth", "original"]).isRequired, PropTypes.number.isRequired, PropTypes.string.isRequired]),
/**
* Changes the color of the icon that floats above the image when it can be clicked to fullscreen.
* The default value of `light` is fine unless your image has a white background, in which case you should change it to `dark`.
*/
fullScreenIconColor: PropTypes.oneOf(["light", "dark"]),
url: PropTypes.string.isRequired,
/**
* Provides the visible caption to the image
*/
caption: PropTypes.node,
/**
* When set to `true` (default) will apply a slight shadow to the image
*/
hasShadow: PropTypes.bool,
/**
* When set to `true` will make the image clickable to a larger version
*/
allowFullScreen: PropTypes.bool,
className: PropTypes.string,
"aria-label": PropTypes.string,
"data-test-subj": PropTypes.string
};
EuiImage.__docgenInfo = {
"description": "",
"methods": [],
"displayName": "EuiImage",
"props": {
"size": {
"defaultValue": {
"value": "'original'",
"computed": false
},
"type": {
"name": "union",
"value": [{
"name": "enum",
"value": [{
"value": "\"s\"",
"computed": false
}, {
"value": "\"m\"",
"computed": false
}, {
"value": "\"l\"",
"computed": false
}, {
"value": "\"xl\"",
"computed": false
}, {
"value": "\"fullWidth\"",
"computed": false
}, {
"value": "\"original\"",
"computed": false
}]
}, {
"name": "number"
}, {
"name": "string"
}]
},
"required": false,
"description": "Accepts `s` / `m` / `l` / `xl` / `original` / `fullWidth` / or a CSS size of `number` or `string`.\n`fullWidth` will set the figure to stretch to 100% of its container.\n`string` and `number` types will max both the width or height, whichever is greater."
},
"fullScreenIconColor": {
"defaultValue": {
"value": "'light'",
"computed": false
},
"type": {
"name": "enum",
"value": [{
"value": "\"light\"",
"computed": false
}, {
"value": "\"dark\"",
"computed": false
}]
},
"required": false,
"description": "Changes the color of the icon that floats above the image when it can be clicked to fullscreen.\nThe default value of `light` is fine unless your image has a white background, in which case you should change it to `dark`."
},
"alt": {
"type": {
"name": "string"
},
"required": true,
"description": "Sepearate from the caption is a title on the alt tag itself.\nThis one is required for accessibility."
},
"url": {
"type": {
"name": "string"
},
"required": true,
"description": ""
},
"caption": {
"type": {
"name": "node"
},
"required": false,
"description": "Provides the visible caption to the image"
},
"hasShadow": {
"type": {
"name": "bool"
},
"required": false,
"description": "When set to `true` (default) will apply a slight shadow to the image"
},
"allowFullScreen": {
"type": {
"name": "bool"
},
"required": false,
"description": "When set to `true` will make the image clickable to a larger version"
},
"className": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"aria-label": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"data-test-subj": {
"type": {
"name": "string"
},
"required": false,
"description": ""
}
}
}; | 37.646893 | 534 | 0.626323 |
f2156d700c5d79b1b2a5eb2e36149c44c82123d2 | 592 | js | JavaScript | Sources/Elastos/Frameworks/Droid/DevSamples/bak/Launcher/xul/chrome/tests/remote_contentpopup.js | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/Frameworks/Droid/DevSamples/bak/Launcher/xul/chrome/tests/remote_contentpopup.js | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/Frameworks/Droid/DevSamples/bak/Launcher/xul/chrome/tests/remote_contentpopup.js | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | dump("====================== Content Script Loaded =======================\n");
let assistant = Content.formAssistant;
AsyncTests.add("TestRemoteAutocomplete:Click", function(aMessage, aJson) {
let element = content.document.getElementById(aJson.id);
assistant.open(element);
assistant._executeDelayed(function(assistant) {
sendAsyncMessage("FormAssist:AutoComplete", assistant._getJSON());
});
return true;
});
AsyncTests.add("TestRemoteAutocomplete:Check", function(aMessage, aJson) {
let element = content.document.getElementById(aJson.id);
return element.value;
});
| 31.157895 | 79 | 0.699324 |
f2159313bf58a91f4e0f1d2723eeca894e5d2c1d | 485 | js | JavaScript | __test__/validators/isPositive.test.js | viczam/easevalidation | c72170817674488055f0cf78ea9f737c3f58f211 | [
"MIT"
] | 14 | 2018-11-22T16:36:01.000Z | 2021-02-12T18:14:28.000Z | __test__/validators/isPositive.test.js | viczam/easevalidation | c72170817674488055f0cf78ea9f737c3f58f211 | [
"MIT"
] | 11 | 2018-12-03T22:59:21.000Z | 2021-09-01T05:38:00.000Z | __test__/validators/isPositive.test.js | viczam/easevalidation | c72170817674488055f0cf78ea9f737c3f58f211 | [
"MIT"
] | null | null | null | import { validators, test } from '../../src';
const { isPositive, isNumber } = validators;
describe('validators', () => {
it('isPositive', () => {
expect(test(isPositive())(1)).toBeTruthy();
expect(test(isPositive(false))(0)).toBeTruthy();
expect(test(isPositive())(0)).toBeFalsy();
expect(test(isPositive())(-1)).toBeFalsy();
expect(test(isNumber(), isPositive())('-1')).toBeFalsy();
expect(test(isNumber(), isPositive())('1.211')).toBeTruthy();
});
});
| 32.333333 | 65 | 0.612371 |
f215948606581236846103e7f5ec7dbec680ce28 | 7,714 | js | JavaScript | src/views/chipManage/chipBasicInfoManage/grindInfo/siteManage.js | htjia/vueYrProject | c66f82dc62290b0ae988c43f8b17ff1f35a20357 | [
"MIT"
] | null | null | null | src/views/chipManage/chipBasicInfoManage/grindInfo/siteManage.js | htjia/vueYrProject | c66f82dc62290b0ae988c43f8b17ff1f35a20357 | [
"MIT"
] | null | null | null | src/views/chipManage/chipBasicInfoManage/grindInfo/siteManage.js | htjia/vueYrProject | c66f82dc62290b0ae988c43f8b17ff1f35a20357 | [
"MIT"
] | null | null | null | import PageHeaderLayout from '@/components/PageHeaderLayout'
import HeaderSearchAdd from '@/components/HeaderSearchAdd'
import { queryList, deletes, customerList, add, update, barCode, printLabel, getGrindingPlatterTypeList, printList } from '@/api/chipBasicInfoManage/grindInfo'
export default {
components: { PageHeaderLayout, HeaderSearchAdd },
data() {
const valuecheck = (rule, value, callback) => {
if (value.trim().length === 0) {
callback(new Error('盘号不能为空'))
} else {
callback()
}
}
return {
listLoading: false,
addDialogVisible: false,
editDialogVisible: false,
activeTabIndex: 0,
list: [],
printList: [{
code: '',
imgSrc: ''
}],
userOptions: [],
machineForm: {
code: '',
type: ''
},
rules: {
code: [{ required: true, validator: valuecheck, trigger: 'blur' }],
type: [{ required: true, message: '请选择盘类型', trigger: 'blur' }]
},
userLists: [],
pageSize: 12,
pageNum: 1,
totalPage: 0,
currentId: 0,
type: '',
code: '',
creator: '',
panList: [
{
id: 0,
name: '2寸片/10片式'
},
{
id: 1,
name: '2寸片/12片式'
},
{
id: 2,
name: '4寸片/4片式'
},
{
id: 3,
name: '4寸片/5片式'
}
],
imgSrc: ''
}
},
mounted() {
this.getGrindingPlatterTypeLists()
this.fetchData()
this.customerList()
},
methods: {
getGrindingPlatterTypeLists() {
const params = {
pageNum: 1,
pageSize: 10000
}
getGrindingPlatterTypeList(params).then(res => {
this.panList = res.data.list
})
},
// 查询
customerList() {
customerList().then(res => {
this.userLists = res.data.list
})
},
handleSearch() {
this.pageNum = 1
this.fetchData()
},
clearAll() {
this.pageNum = 1
this.type = ''
this.code = ''
this.creator = ''
this.fetchData()
},
// 每页数量改变
sizeChange(pageSize) {
this.pageSize = pageSize
this.fetchData()
},
// 当前页数改变
currentChange(pageNum) {
this.pageNum = pageNum
this.fetchData()
},
printLabel() {
if (this.machineForm.code === '') {
this.$message({
type: 'error',
message: '请填写盘号!'
})
return
}
const params = {
module: 'platterPrint',
contents: [
[
{ key: '芯片盘号打印', value: this.machineForm.code }
]
]
}
printLabel(params).then(res => {
this.$message({
type: 'success',
message: '正在打印,请稍后!'
})
})
},
setimg() {
if (this.machineForm.code === '') {
this.$message({
type: 'error',
message: '请填写盘号!'
})
return
}
const params = [this.machineForm.code]
barCode(params).then(res => {
this.imgSrc = res.data[0]
})
},
// 查询
fetchData() {
this.listLoading = true
const params = {
pageNum: this.pageNum,
pageSize: this.pageSize,
type: this.type,
code: this.code,
creator: this.creator
}
queryList(params).then(res => {
this.list = res.data.list
this.totalPage = parseInt(res.data.total)
this.listLoading = false
})
},
// 打印
printCode() {
this.listLoading = true
const params = {
type: this.type,
code: this.code,
creator: this.creator
}
printList(params).then(res => {
this.listLoading = false
this.printList = res.data
setTimeout(() => {
const head_str = '<html><head><title></title></head><body>'
const foot_str = '</body></html>'
const new_str = document.getElementById('printDivs').innerHTML
const newWind = window.open('打印窗口', '_blank')
newWind.document.write(head_str + new_str + foot_str)
newWind.document.close()
newWind.print()
newWind.close()
}, 1000)
})
// this.printList = []
// for (const item of this.list) {
// const params = [item.code]
// barCode(params).then(res => {
// this.printList.push({
// code: item.code,
// imgSrc: res.data[0]
// })
// })
// }
// setTimeout(() => {
// const head_str = '<html><head><title></title></head><body>'
// const foot_str = '</body></html>'
// const new_str = document.getElementById('printDivs').innerHTML
// const newWind = window.open('打印窗口', '_blank')
// newWind.document.write(head_str + new_str + foot_str)
// newWind.document.close()
// newWind.print()
// newWind.close()
// }, 1000)
},
// 添加
handleAdd() {
this.machineForm.code = ''
this.machineForm.type = ''
this.imgSrc = ''
this.addDialogVisible = true
},
// 编辑
handleEdit(row) {
this.currentId = row.id
this.machineForm.code = row.code
this.machineForm.type = row.type
this.imgSrc = ''
this.editDialogVisible = true
this.setimg()
},
// 关闭
handleClose(formName) {
this.$refs[formName].resetFields()
},
// 添加提交
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const params = {
code: this.machineForm.code,
type: this.machineForm.type,
creator: sessionStorage.getItem('User-Id')
}
add(params).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '添加成功!'
})
this.$refs[formName].resetFields()
this.addDialogVisible = false
this.fetchData()
}
})
} else {
console.log('error submit!!')
return false
}
})
},
// 添加提交
editsubmitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const params = {
id: this.currentId,
code: this.machineForm.code,
type: this.machineForm.type,
creator: sessionStorage.getItem('User-Id')
}
update(params).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '修改成功!'
})
this.$refs[formName].resetFields()
this.editDialogVisible = false
this.fetchData()
}
})
} else {
console.log('error submit!!')
return false
}
})
},
// 取消
resetForm(formName) {
this.addDialogVisible = false
this.$refs[formName].resetFields()
},
// 删除按钮
handleDelete(row) {
this.$confirm('此操作将永久删除当前信息, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const params = {
id: row.id
}
deletes(params).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '删除成功!'
})
if (this.list.length === 1 && this.pageNum !== 1) {
this.pageNum = this.pageNum - 1
}
this.fetchData()
}
})
})
}
}
}
| 25.375 | 159 | 0.480425 |
f2168bbc3344ecbfe4571edb08fe3dba928a3bed | 1,724 | js | JavaScript | src/permission.js | soutokujyun/vue2-element-system | 222ddca19792b2a4f01f5d2899a6d2aa11f23e4a | [
"MIT"
] | null | null | null | src/permission.js | soutokujyun/vue2-element-system | 222ddca19792b2a4f01f5d2899a6d2aa11f23e4a | [
"MIT"
] | null | null | null | src/permission.js | soutokujyun/vue2-element-system | 222ddca19792b2a4f01f5d2899a6d2aa11f23e4a | [
"MIT"
] | null | null | null | import router from './router'
import { getToken } from "@/utils/auth"
import store from '@/store'
import { Message } from "element-ui"
const whiteList = ['/login'] // no redirect whitelist
router.beforeEach(async (to, from, next) => {
document.title = to.meta.title || "Element System";
const hasToken = getToken();
if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page
next({ path: '/' })
} else {
const hasRoles = store.getters.roles && store.getters.roles.length > 0;
if (hasRoles) {
next();
} else {
// request user info
try {
// get user info
const { roles } = await store.dispatch('user/getInfo')
// generate routes map based on roles
const accessRoutes = await store.dispatch('permission/generateRoutes', roles);
// dynamically add accessible routes
for (let accessRoute of accessRoutes) {
router.addRoute(accessRoute);
}
// next to page
next({ ...to, replace: true })
} catch (error) {
await store.dispatch('user/logout')
Message.error({
message: error || 'Has Error'
})
next(`/login?redirect=${to.path}`)
}
}
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next()
} else {
next("/login?redirect=" + to.fullPath);
}
}
});
| 35.183673 | 98 | 0.459977 |
f216f6e59084d16819efc30a0c512eadab6d52b5 | 4,585 | js | JavaScript | src/Components/Qualification/Qualification.js | giuroperto/coronathon | 88afb4da98fd955afa899a0eb5bb5e8ff08bbac7 | [
"MIT"
] | null | null | null | src/Components/Qualification/Qualification.js | giuroperto/coronathon | 88afb4da98fd955afa899a0eb5bb5e8ff08bbac7 | [
"MIT"
] | null | null | null | src/Components/Qualification/Qualification.js | giuroperto/coronathon | 88afb4da98fd955afa899a0eb5bb5e8ff08bbac7 | [
"MIT"
] | null | null | null | import React from 'react';
import './Qualification.css';
const Qualification = () => {
return (
<>
<hr className='green-bar m-0'></hr>
<div className='quali-page'>
<h2 className='all-titles title-size mb-5'>SUAS INDICAÇÕES</h2>
<div className='all-cards d-flex flex-column align-items-center'>
<div className="cards-top d-flex mb-5 mt-3">
<div className="quali-card d-flex">
<div className="green-ball mr-3"></div>
<div className="quali-topics d-flex flex-column align-items-start">
<h4 className='quali-text quali-title'>Microsoft Word</h4>
<p className='quali-text quali-course m-0'>Digital Innovation One</p>
<a href='https://web.digitalinnovation.one/home' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://web.digitalinnovation.one/home)</p></a>
<p className='quali-text quali-course m-0'>Brasil Mais Digital</p>
<a href='http://www.brasilmaisdigital.org.br/index.php/pt-br/' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(http://www.brasilmaisdigital.org.br/index.php/pt-br/)</p></a>
</div>
</div>
<div className="quali-card d-flex">
<div className="green-ball mr-3"></div>
<div className="quali-topics d-flex flex-column align-items-start">
<h4 className='quali-text quali-title'>Comunicação e Oratória</h4>
<p className='quali-text quali-course m-0'>FGV Online</p>
<a href='https://educacao-executiva.fgv.br/cursos/online/curta-media-duracao-online/introducao-comunicacao-na-era-digital' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://educacao-executiva.fgv.br/cursos/online/curta-media-duracao-online/introducao-comunicacao-na-era-digital)</p></a>
<p className='quali-text quali-course m-0'>Udemy</p>
<a href='https://www.udemy.com/courses/business/communications/' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://www.udemy.com/courses/business/communications/)</p></a>
</div>
</div>
</div>
<div className="cards-bottom d-flex">
<div className="quali-card d-flex">
<div className="green-ball mr-3"></div>
<div className="quali-topics d-flex flex-column align-items-start">
<h4 className='quali-text quali-title'>Microsoft Excel</h4>
<p className='quali-text quali-course m-0'>Digital Innovation One</p>
<a href='https://web.digitalinnovation.one/home' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://web.digitalinnovation.one/home)</p></a>
<p className='quali-text quali-course m-0'>Brasil Mais Digital</p>
<a href='http://www.brasilmaisdigital.org.br/index.php/pt-br/' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(http://www.brasilmaisdigital.org.br/index.php/pt-br/)</p></a>
</div>
</div>
<div className="quali-card d-flex">
<div className="green-ball mr-3"></div>
<div className="quali-topics d-flex flex-column align-items-start">
<h4 className='quali-text quali-title'>Ferramentas de Gestão</h4>
<p className='quali-text quali-course m-0'>Voitto - Agile</p>
<a href='https://www.voitto.com.br/digital/introducao-agile-scrum' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://www.voitto.com.br/digital/introducao-agile-scrum)</p></a>
<p className='quali-text quali-course m-0'>Portal GSTI</p>
<a href='https://www.portalgsti.com.br/pmbok/cursos/' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://www.portalgsti.com.br/pmbok/cursos/)</p></a>
<p className='quali-text quali-course m-0'>Respostas para o amanhã</p>
<a href='https://respostasparaoamanha.com.br/cursos/aprender-projeto/inicio' target='_blank' rel="noopener noreferrer"><p className='quali-text quali-link m-0'>(https://respostasparaoamanha.com.br/cursos/aprender-projeto/inicio)</p></a>
</div>
</div>
</div>
</div>
</div>
</>
)
}
export default Qualification;
| 70.538462 | 344 | 0.621592 |
f217863694abf939f80c4aef7443be276245c561 | 2,860 | js | JavaScript | src/providers/config/commandsPermission.js | nowifi4u/Commando | d476adbda613d6c9489d356cfb1e221b0b7142a0 | [
"Apache-2.0"
] | 1 | 2021-02-12T00:06:49.000Z | 2021-02-12T00:06:49.000Z | src/providers/config/commandsPermission.js | nowifi4u/Commando | d476adbda613d6c9489d356cfb1e221b0b7142a0 | [
"Apache-2.0"
] | null | null | null | src/providers/config/commandsPermission.js | nowifi4u/Commando | d476adbda613d6c9489d356cfb1e221b0b7142a0 | [
"Apache-2.0"
] | null | null | null | const { Guild } = require('discord.js');
/**
* @type {ProviderSettings}
*/
module.exports = {
name: 'commandsPermission',
getID: getID,
updateOtherShards: true,
listeners: {
commandPermissionChange: provider => (key, command, role, enabled) => provider.set3(key, 'commandsPermission', command.name, role.id, enabled),
groupPermisionChange: provider => (key, group, role, enabled) => provider.set3(key, 'groupsPermission', role.id, group.id, enabled),
guildCreate: provider => guild => {
const id = guild.id;
const settings = provider.settings.get(id);
if(!settings) return;
setup(provider.client, id, settings);
},
commandRegister: provider => command => {
for(const [guild, settings] of provider.settings) {
if(guild !== 'global' && !provider.client.guilds.cache.has(guild)) continue;
setupCommand(provider.client.guilds.cache.get(guild), command, settings);
}
},
groupRegister: provider => group => {
for(const [guild, settings] of provider.settings) {
if(guild !== 'global' && !provider.client.guilds.cache.has(guild)) continue;
setupGroup(provider.client.guilds.cache.get(guild), group, settings);
}
}
},
setup: setup
};
function setup(client, id, settings) {
if(!settings) return;
const guild = resolveID(client, id);
if(typeof guild === 'undefined') return;
if(settings.commandsPermission) {
for(const command in settings.commandsPermission) {
if(client.registry.commands.has(command)) {
setupCommand(guild, command, settings.commandsPermission[command]);
}
}
}
if(settings.groupsPermission) {
for(const group in settings.groupsPermission) {
if(client.registry.groups.has(group)) {
setupGroup(guild, group, settings.groupsPermission[group]);
}
}
}
}
function setupCommand(guild, command, settings) {
if(typeof settings !== 'object') return;
if(guild) {
if(!guild._commandsPermission) guild._commandsPermission = {};
guild._commandsPermission[command] = settings;
} else {
command.defaultPermission = settings;
}
}
function setupGroup(guild, group, settings) {
if(typeof settings !== 'object') return;
if(guild) {
if(!guild._commandsPermission) guild._commandsPermission = {};
guild._commandsPermission[group.id] = settings;
} else {
group.defaultPermission = settings;
}
}
/**
* @param {Guild|string} guild - Value to get the id from
* @returns {string}
*/
function getID(guild) {
if(guild instanceof Guild) return guild.id;
if(guild === 'global' || guild === null) return 'global';
if(typeof guild === 'string' && !isNaN(guild)) return guild;
throw new TypeError('Invalid guild specified. Must be a Guild instance, guild ID, "global", or null.');
}
function resolveID(client, guild) {
if(guild === null || guild === 0 || guild === 'global') return null;
guild = getID(guild);
return client.guilds.cache.get(guild);
}
| 31.086957 | 145 | 0.693007 |
f2182471c8a0461b7d519e78874723386f1addba | 2,105 | js | JavaScript | src/client/app/core/auth.service.js | amirek/tmn | 9c89552576ec91e7376747ded911698e9f7a5d3a | [
"MIT"
] | null | null | null | src/client/app/core/auth.service.js | amirek/tmn | 9c89552576ec91e7376747ded911698e9f7a5d3a | [
"MIT"
] | null | null | null | src/client/app/core/auth.service.js | amirek/tmn | 9c89552576ec91e7376747ded911698e9f7a5d3a | [
"MIT"
] | null | null | null | (function () {
'use strict';
angular
.module('app')
.service('authService', authService);
authService.$inject = ['$q', 'sessionService', 'userService'];
function authService($q, sessionService, userService) {
var service = {
logIn: logIn,
logOut: logOut,
isLoggedIn: isLoggedIn,
isStudent: isStudent,
isTutor: isTutor
};
return service;
/**
* Check whether the user is logged in
* @returns boolean
*/
function isLoggedIn() {
return sessionService.getUser() !== null;
}
/**
* Check whether the user in session is a student
* @returns boolean
*/
function isStudent() {
var user = sessionService.getUser();
return user != null && user.IsTutor === false;
}
/**
* Check whether the user in session is a tutor
* @returns boolean
*/
function isTutor() {
var user = sessionService.getUser();
return user != null && user.IsTutor === true;
}
/**
* Log in
*
* @param {number} userId (but it's all fake anyway)
* @returns {*|Promise}
*/
function logIn(userId) {
var deferred = $q.defer();
deferred.resolve(userService.getAll().then(function (users) {
return users.filter(function (user) {
return user.Id === userId;
})[0];
}));
return deferred.promise
.then(function (user) {
sessionService.setUser(user);
});
}
/**
* Log out
*
* @returns {*|Promise}
*/
function logOut() {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise
.then(function () {
sessionService.destroy();
});
}
}
})();
| 25.670732 | 73 | 0.455107 |
f21824e9ce82503dbdbadb6a9b082ed32875a7a2 | 242 | js | JavaScript | packages/to-dts/test/enum.spec.js | streamside/scriptappy | ff95f35d993feeff43d5a77dde678de1b61da0e1 | [
"MIT"
] | 4 | 2018-08-24T10:44:45.000Z | 2021-03-25T10:38:09.000Z | packages/to-dts/test/enum.spec.js | streamside/scriptappy | ff95f35d993feeff43d5a77dde678de1b61da0e1 | [
"MIT"
] | 20 | 2021-09-13T08:33:16.000Z | 2022-03-21T09:41:19.000Z | packages/to-dts/test/enum.spec.js | streamside/scriptappy | ff95f35d993feeff43d5a77dde678de1b61da0e1 | [
"MIT"
] | 7 | 2018-04-09T11:32:46.000Z | 2021-01-25T12:37:12.000Z | const en = require('../lib/types/enum');
describe('enum', () => {
it('should create empty', () => {
const def = { name: 'ee' };
expect(en(def)).to.eql({ flags: 0, kind: 'enum', name: 'ee', constant: true, members: [] });
});
});
| 26.888889 | 96 | 0.520661 |
f218db666f1404758cbab2d644b56e776aa4d18c | 897 | js | JavaScript | lib/helper.js | Rizsyad/GTPS-HTTP | 053142d896f6a6ea422e803f9cd5630b2470fa2c | [
"MIT"
] | 1 | 2022-03-20T04:19:06.000Z | 2022-03-20T04:19:06.000Z | lib/helper.js | Rizsyad/GTPS-HTTP | 053142d896f6a6ea422e803f9cd5630b2470fa2c | [
"MIT"
] | null | null | null | lib/helper.js | Rizsyad/GTPS-HTTP | 053142d896f6a6ea422e803f9cd5630b2470fa2c | [
"MIT"
] | null | null | null | const moment = require("moment-mini");
const { success, info, block, warning } = require("./console");
const getIp = (req) => {
let ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;
ip = ip.split(":").reverse()[0];
return ip;
};
const sendLog = (req, res, isWarning = false) => {
let ip = getIp(req);
const statusCode =
req.url === "/growtopia/server_data.php" && req.method === "POST"
? res.statusCode
: "-";
const userAgent =
req.headers["user-agent"] === undefined ? "" : req.headers["user-agent"];
const now = new Date();
const dateStringWithTime = moment(now).format("YYYY-MM-DD HH:mm:ss");
const message = `${ip} - - [${dateStringWithTime}] "${req.method} ${req.url}" ${statusCode} "${userAgent}"`;
if (isWarning) {
warning(`${message} \n`);
} else {
info(message);
}
};
module.exports = {
sendLog,
getIp,
};
| 24.916667 | 110 | 0.598662 |
f21935f56e467096eeea93840488cb58aa19a5e9 | 2,629 | js | JavaScript | index.js | jesusalc/learning_full_stack_react | 7ce1104ddf6f7ce2d356bff206467e533564172e | [
"MIT"
] | null | null | null | index.js | jesusalc/learning_full_stack_react | 7ce1104ddf6f7ce2d356bff206467e533564172e | [
"MIT"
] | null | null | null | index.js | jesusalc/learning_full_stack_react | 7ce1104ddf6f7ce2d356bff206467e533564172e | [
"MIT"
] | null | null | null | const express = require('express'),
app = express(),
mongojs = require('mongojs'),
AuthView = require('./src/Auth'),
bodyParser = require('body-parser'),
port = 3000,
servername = "localhost",
routelist = `
Server Running on http://${servername}:${port}
Server Running on http://${servername}:${port}/form
Server Running on http://${servername}:${port}/error
Server Running on http://${servername}:${port}/register
`,
db = mongojs('mongo-sample', ['users']),
users_table = db.users.initializeOrderedBulkOp()
users_table.insert({name:'Hen', age:26, email:'he@gmail.com'})
users_table.insert({name:'Ben', age:33, email:'ben@02geek.com'})
users_table.insert({name:'Gloria', age:23, email:'gloria@02geek.com'})
users_table.insert({name:'Tom', age:50, email:'tom@02geek.com', children:['ben', 'sharon','lauri']})
users_table.find({age:{$lt:30}}).remove()
users_table.find({name:'Ben'}).updateOne({$set:{age:34}})
users_table.execute((err,r) => {
console.log("Loading commands to users to mongo DB using bulk")
db.close
})
app.use(express.static('public'))
app.use(bodyParser.urlencoded({extended:true}))
app.set('view engine', 'ejs')
app.get('/', (req, res) => {
res.send('Hello World!')
res.send('Hello World!')
})
/* get | post | put | delete */
app.get('/blog/*.html', (req, res) => {
res.send('Blog Hello World!')
})
app.route('/register')
.get((req, res) => {
let body = Auth.register('this is a message from our server')
res.render('layout/overlay', {
title: "Register!",
body:body
})
})
.post((req, res) => {
let db = mongojs('mysite', ['users'])
let email = req.body.email
let password = req.body.password1
let postRes = res
if (password !== req.body.password2){
let body = Auth.register('Passwords dont match')
res.render('layout/overlay', {
title: "Register!",
body:body
})
} else {
db.users.count({email: email}, (req, res) => {
if (res) {
postRes.redirect("/login")
} else {
db.users.insert({email:email, password:password})
postRes.send('You have been added:' +email)
}
})
}
res.send('Register post!')
})
app.route('/form')
.get((req, res) => {
res.sendFile(__dirname + '/src/form.html')
})
.post((req, res) => {
res.send(req.body.name + ', these are the results.' )
})
/* if route is not found */
app.use((req,res,next) => {
res.status(404).send(`Sorry I can't find this page.
${routelist}`)
})
app.listen(port, () => {
console.log(routelist)
}) | 27.673684 | 100 | 0.597946 |
f21aacf8ee85559edde18f85951e66b0e5d37d20 | 307 | js | JavaScript | 001.Programming Basics with JS - Alone 2022/01.First Steps In Coding/P08.Pet Shop.js | Marti2509/SoftUni | ca2db82ad9effaf8df110e1e29a47334e22b26ce | [
"MIT"
] | 1 | 2022-03-23T15:33:31.000Z | 2022-03-23T15:33:31.000Z | 001.Programming Basics with JS - Alone 2022/01.First Steps In Coding/P08.Pet Shop.js | Marti2509/SoftUni | ca2db82ad9effaf8df110e1e29a47334e22b26ce | [
"MIT"
] | null | null | null | 001.Programming Basics with JS - Alone 2022/01.First Steps In Coding/P08.Pet Shop.js | Marti2509/SoftUni | ca2db82ad9effaf8df110e1e29a47334e22b26ce | [
"MIT"
] | null | null | null | function main(input){
let numberOfPackegesDogs = Number(input[0]);
let numberOfPackegesCats = Number(input[1]);
let priceForDogs = numberOfPackegesDogs * 2.50;
let priceForCats = numberOfPackegesCats * 4;
let sum = priceForCats + priceForDogs;
console.log(`${sum} lv.`);
}
main(); | 25.583333 | 51 | 0.684039 |
f21b6991309f1560445d310c8424241a97642305 | 21,649 | js | JavaScript | MERN Back-End/methods/actions.js | MalikSaqib141947/fruitDoctor | 6e32c2ada5f53f4fa4fc1860056d064fa1302f70 | [
"MIT"
] | 1 | 2021-06-26T15:36:27.000Z | 2021-06-26T15:36:27.000Z | MERN Back-End/methods/actions.js | MalikSaqib141947/fruitDoctor | 6e32c2ada5f53f4fa4fc1860056d064fa1302f70 | [
"MIT"
] | null | null | null | MERN Back-End/methods/actions.js | MalikSaqib141947/fruitDoctor | 6e32c2ada5f53f4fa4fc1860056d064fa1302f70 | [
"MIT"
] | null | null | null | var users = require('../models/user')
var thread = require('../models/discussionThread')
var jwt = require('jwt-simple')
var config = require('../config/dbconfig')
var db = require('../config/db')
const nodemailer = require('nodemailer')
//const { post } = require('../routes')
var dateFormat = require("dateformat");
//const { isValidObjectId } = require('mongoose')
const path = require('path');
const fs = require('fs');
var mongoose = require('mongoose')
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'ymaliksaqib@gmail.com',
pass: 'zyjceecdezdorabh'
}
});
var functions = {
addNew: function(req, res){
if((!req.body.email) || (!req.body.password) || (!req.body.name)){
res.json({success: false, msg: "Enter all fields"})
}
else{
///////
users.findOne({
email: req.body.email
}, function(err, user){
if(err)
throw err
if(user){
res.json({success: false, msg: "Signup Failed, user with this email already exists"})
}
else{
var newUser = users({
email: req.body.email,
name: req.body.name,
password: req.body.password
});
newUser.save(function(errr, userr){
if(errr){
res.json({success: false, msg: "Failed to save"})
}
else{
res.json({success: true, msg: userr})
}
})
}});
//////
}
},
sendMail: function (req, res){
var mailOptions = {
from: 'Fruit Doctor',
to: `${req.body.email}`,
subject: 'Confirm Email',
text: `Your Confirmaiton Code: ${req.body.code}`
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
res.json({success: false, msg: `${error}`})
} else {
res.json({success: true, msg: 'Code sent, check your Email!'})
}
});
},
updatePassword: function(req, res){
users.findOne({
email: req.body.email
}, function(err, user){
if(err)
throw err
if(!user){
res.json({success: false, msg: "User does not exist"})
}
else{
user.password = req.body.password;
user.save(function (err, user) {
if (err) {
res.json({success: false, msg: err});
} else {
res.json({success: true, msg: "Password Updated Successfully!"});
}
});
}});
},
authenticate: function (req, res){
users.findOne({
email: req.body.email
}, function(err, user){
if(err)
throw err
if(!user){
res.json({success: false, msg: "Authentication failed, User not found"})
}
else{
user.comparePassword(req.body.password, function(err2, isMatch){
if(isMatch && !err2){
var token = jwt.encode(user, config.secret)
res.json({success: true, token: token})
}
else{
return res.json({success: false, msg: "Authentication failed, Wrong Password!"})
}
})
}
})
},
getinfo: async function(req, res){
if(req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer'){
var token = req.headers.authorization.split(' ')[1]
var decodedtoken = jwt.decode(token, config.secret)
var photoUrl;
var rating;
var rank;
await users.findOne({
email: decodedtoken.email
}, function(err, user){
if(err)
throw err
else{
photoUrl = user.pictureUrl
rating = user.rating
rank = user.rank
}
});
return res.json({success: true, name: decodedtoken.name, email: decodedtoken.email, pictureUrl: photoUrl, rating: rating, rank: rank})//decodedtoken.name
}
else{
return res.json({success: false, msg: 'No Headers'})
}
},
postQuery: async function(req,res) {
var author;
var now = new Date();
var newPost;
await users.findOne({
email: req.body.user
}, function(err, user){
if(err)
throw err
else
author = user
});
newPost = thread.Thread({
subject: req.body.subject,
query: req.body.query,
author: author._id,
imageURL: req.body.image,
postDate: now,
relatedFruit: req.body.fruit,
replies: []
});
newPost.save(function(errr, savedPost){
if(errr){
return res.json({success: false, msg: errr})
}
else{
return res.json({success: true, msg: savedPost})
}
})
},
// getLikers: function(req,res){
// thread.Thread.findById("6044973db974320004a1d599")
// .then((threadd) => {
// res.statusCode = 200;
// res.setHeader('Content-Type', 'application/json');
// res.json(threadd.likers);
// res.end();
// })
// },
getQueries: function(req, res){
thread.Thread.find({})
.populate('author')
.populate('replies.author')
.then((threads) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.json(threads);
res.end();
}, function(err, threads){
if(err)
throw err
});
},
getReplies: function(req, res){
thread.Thread.findById(req.params.queryId)
.populate('author')
.populate('replies.author')
.then((thread) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.json(thread['replies']);
res.end();
}, function(err, threads){
if(err)
throw err
});
},
rateQuery: async function(req, res){
if(req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer'){
var token = req.headers.authorization.split(' ')[1]
var decodedtoken = jwt.decode(token, config.secret)
await users.findOne({
email: decodedtoken.email
}, function(err, user){
if(err)
throw err
else{
thread.Thread.findById(req.params.queryId)
.then((threadd) => {
users.findById(threadd.author).then((author) => {
var liker = threadd.likers.find(obj => obj.email === user.email);
if(liker){
threadd.likers = threadd.likers.filter(item => item.email !== user.email);
thread.Thread.findByIdAndUpdate(
threadd._id, {$set: {likers: threadd.likers }}
, function(errr, thr){
if(errr)
throw err
})
//updating the rating of the query author
var newRating = author.rating - 5;
newRating = Number(newRating);
//updating the rank of the query author
var newRank = author.rank;
if(author.rating < 500){
newRank = "BEGINNER"
}
else if(author.rating < 1000){
newRank = "INTERMEDIATE"
}
users.updateOne(
{email: author.email}, {$set: {rating: newRating, rank: newRank }}
, function(errr, userr){
if(errr)
throw err
})
}else{
threadd.likers.push(user);
thread.Thread.findByIdAndUpdate(
threadd._id, {$set: {likers: threadd.likers }}
, function(errr, thr){
if(errr)
throw err
})
//updating the rating of the query author
var newRating = author.rating + 5;
newRating = Number(newRating);
//updating the rank of the query author
var newRank = author.rank;
if(author.rating >= 1000){
newRank = "EXPERT"
}
else if(author.rating >= 500){
newRank = "INTERMEDIATE"
}
users.updateOne(
{email: author.email}, {$set: {rating: newRating, rank: newRank }}
, function(errr, userr){
if(errr)
throw err
})
}
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.json({"success": true, "likers": threadd.likers});
res.end();
})
}, function(errr, threads){
if(errr)
throw errr
});
}
});
}
},
rateReply: async function(req, res){
if(req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer'){
var token = req.headers.authorization.split(' ')[1]
var decodedtoken = jwt.decode(token, config.secret)
await users.findOne({
email: decodedtoken.email
}, async function(err, user){
if(err)
throw err
else{
// var newObjectId=new mongoose.Types.ObjectId(req.params.replyId);
// var params={
// '_id':newObjectId
// }
thread.Thread.findById(req.params.queryId)
.then(async(thrd) => {
console.log(thrd);
users.findById(thrd.replies.id(req.params.replyId).author).then(async(author) => {
var liker = thrd.replies.id(req.params.replyId).likers.find(obj => obj.email === user.email);
if(liker) {
thrd.replies.id(req.params.replyId).likers = thrd.replies.id(req.params.replyId).likers.filter(item => item.email !== user.email);
await thrd.save().then((th) => {});
// thread.Thread.findByIdAndUpdate(
// thrd._id, {$set: {likers: thrd.replies.id(req.params.replyId).likers }}
// , function(errr, rep){
// if(errr)
// throw err
// })
//updating the rating of the reply author
var newRating = author.rating - 5;
newRating = Number(newRating);
//updating the rank of the reply author
var newRank = author.rank;
if(author.rating < 500){
newRank = "BEGINNER"
}
else if(author.rating < 1000){
newRank = "INTERMEDIATE"
}
users.updateOne(
{email: author.email}, {$set: {rating: newRating, rank: newRank }}
, function(errr, userr){
if(errr)
throw err
})
}else{
thrd.replies.id(req.params.replyId).likers.push(user);
await thrd.save().then((th) => {});
// res.statusCode = 200;
// res.setHeader('Content-Type', 'application/json');
// res.json(dish);
// thread.Thread.findByIdAndUpdate(
// thrd._id, {$set: {likers: thrd.replies.id(req.params.replyId).likers }}
// , function(errr, rep){
// if(errr)
// throw err
// })
//updating the rating of the query author
var newRating = author.rating + 5;
newRating = Number(newRating);
//updating the rank of the query author
var newRank = author.rank;
if(author.rating >= 1000){
newRank = "EXPERT"
}
else if(author.rating >= 500){
newRank = "INTERMEDIATE"
}
users.updateOne(
{email: author.email}, {$set: {rating: newRating, rank: newRank }}
, function(errr, userr){
if(errr)
throw err
})
}
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.json({"success": true, "likers": thrd.replies.id(req.params.replyId).likers});
res.end();
})
}, function(errr, threads){
if(errr)
throw errr
});
}
});
}
},
postReply: async function(req, res) {
var author;
var now = new Date();
var Reply;
await users.findOne({
email: req.body.replierEmail
}, function(err, user){
if(err)
throw err
else
author = user
});
Reply = thread.Reply({
replyText: req.body.replyText,
ratings: 0,
author: author,
postDate: now
});
var err;
thread.Thread.findById(req.body.postID)
.then((thread2) => {
console.log(req.body.postID);
if (thread2 != null) {
thread2.replies.push(Reply);
thread2.save()
.then((thread3) => {
console.log(req.body.postID);
thread.Thread.findById(thread3._id)
.populate('replies.author')
.then((thread4) => {
console.log(req.body.postID);
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.json({success: true, data: thread4
});
})
}, function(err, threads){
if(err)
throw err
});
}
else {
err = new Error('Dish ' + req.body.postID + ' not found');
err.status = 404;
return next(err);
}
}, function(err, threads){
if(err)
throw err
});
},
updateUser: async function(req, res) {
if((!req.body.email) || (!req.body.pictureUrl)){
res.json({success: false, msg: "Please Select a Picture!"})
}
else{
///////
users.findOne({
email: req.body.email
}, function(err, user){
if(err)
throw err
if(user){
users.updateOne(
{email: req.body.email}, {$set:{pictureUrl: req.body.pictureUrl}}
, function(errr, userr){
if(errr)
throw err
if(!userr){
res.json({success: false, msg: "Failed to update the profile picture!"})
}
else if(userr){
res.json({success: true, msg: "Profile Picture Updated!"})
}
})}});
//})})}
}
},
getCure: async function(req, res){
fs.readFile('cure.json', (err, data) => {
if (err) throw err;
let result = JSON.parse(data);
try{
if(result['cures'][req.params.fruit]){
if(result['cures'][req.params.fruit][req.params.disease]){
let diagnosis = result['cures'][req.params.fruit][req.params.disease]
let chemCures = Object.keys(diagnosis.chemical).length;
let bioCures = Object.keys(diagnosis.biological).length;
res.json({success: true, data: diagnosis, chemCures: chemCures, bioCures: bioCures})
}
}
else{
res.json({success: false})
}
}
catch(error){
throw error
}
});
}
}
module.exports = functions | 42.118677 | 170 | 0.352996 |
f21ca7a71ec25ebf25fcfd4a9c67cffc5d4e69ce | 765 | js | JavaScript | js-tp-basic-to-advanced/FUNDAMENTS/16_exercicio.js | angeloengcomp/LearningJS | c8b301ccaae2f386db5f0fc1cc68a16ddd24dab0 | [
"MIT"
] | null | null | null | js-tp-basic-to-advanced/FUNDAMENTS/16_exercicio.js | angeloengcomp/LearningJS | c8b301ccaae2f386db5f0fc1cc68a16ddd24dab0 | [
"MIT"
] | null | null | null | js-tp-basic-to-advanced/FUNDAMENTS/16_exercicio.js | angeloengcomp/LearningJS | c8b301ccaae2f386db5f0fc1cc68a16ddd24dab0 | [
"MIT"
] | null | null | null | // escreva uma função que recebe um numero
// e retorna o seguinte:
// numero é divisivel por 3 = Fizz
// numero é divisivel por 5 = Buzz
// numero é divisivel por 3 e 5 = FizzBuzz
// numero não é divisivel por 3 e 5 retorna o proprio numero
// checar se o numero é realmente um numero retorna o proprio numero
// use a funcao com numeros de 0 a 100
function fizzBuzz(numero) {
let valor = undefined;
let r = undefined;
if (numero % 3 === 0) r = 'Fizz';
if (numero % 5 === 0) r = 'Buzz';
if (numero % 3 === 0 && numero % 5 === 0) r = 'FizzBuzz';
if (numero % 3 != 0 && numero % 5 != 0) r = numero;
if (Number.isInteger(numero)) valor = numero;
return console.log(valor, r);
};
for (let i = 1; i <= 100; i++) {
fizzBuzz(i);
}
| 29.423077 | 68 | 0.610458 |
f21d8269f2719af1d36cf336bf9eb755000e6cd7 | 245 | js | JavaScript | Dataset/Leetcode/valid/46/39.js | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/valid/46/39.js | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/valid/46/39.js | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | var XXX = function(nums) {
if(nums.length == 1) return [nums]
let res = []
for(let i=0; i<nums.length; i++) {
res = res.concat(XXX([...nums.slice(0,i), ...nums.slice(i+1)]).map(v => [nums[i], ...v]))
}
return res
};
| 24.5 | 97 | 0.502041 |
f21dd730b0c95188b54bc6796e391895be069709 | 760 | js | JavaScript | dist-mdi/mdi/emoticon-excited-outline.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | dist-mdi/mdi/emoticon-excited-outline.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | dist-mdi/mdi/emoticon-excited-outline.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | import { h } from 'vue'
export default {
name: "EmoticonExcitedOutline",
vendor: "Mdi",
type: "",
tags: ["emoticon","excited","outline"],
render() {
return h(
"svg",
{"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-emoticon-excited-outline","innerHTML":"<path d='M12,2C6.47,2 2,6.47 2,12C2,17.53 6.47,22 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M13,9.94L14.06,11L15.12,9.94L16.18,11L17.24,9.94L15.12,7.82L13,9.94M8.88,9.94L9.94,11L11,9.94L8.88,7.82L6.76,9.94L7.82,11L8.88,9.94M12,17.5C14.33,17.5 16.31,16.04 17.11,14H6.89C7.69,16.04 9.67,17.5 12,17.5Z' />"},
)
}
} | 58.461538 | 562 | 0.631579 |
f21dddf2e42d397e1d7615b24f241efe4abd6817 | 2,286 | js | JavaScript | notes.js | CaioLemec/memory-match | 8cbc726d7a7c4322fc0213dcf6487932e0b34fe5 | [
"Apache-2.0"
] | null | null | null | notes.js | CaioLemec/memory-match | 8cbc726d7a7c4322fc0213dcf6487932e0b34fe5 | [
"Apache-2.0"
] | null | null | null | notes.js | CaioLemec/memory-match | 8cbc726d7a7c4322fc0213dcf6487932e0b34fe5 | [
"Apache-2.0"
] | null | null | null | // Muitas responsabilidades, clicks, animações, variações = components
// Poucas responsabilidades, simples, contexto, estrutural = object
// Criando Regex :
// const regex = /caio lemec/;
// const regex = /^caio/; Buscando palavra que inicia com...
// const regex = /lemec$/; Buscando palavra que Finaliza com...
// const resultado = regex.test(texto);
// console.log("resultado:", resultado);
// REGEX EMAIL = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
// REGEX EMAIL = /^[0-9]{4,5}$-[0-9]{4}/
// const AAA = (function(){
// const module = {};
// module._style = () => {
// const $head = document.querySelector("head");
// const $style = document.createElement("style");
// $style.textContent =`
// . {
// }
// `;
// $head.insertAdjacentElement("beforeend",$style);
// };
// module.render = () => {
// module._style();
// return `<></>`
// };
// return {
// render: module.render
// };
// })();
// O node é uma plataforma com motor e recursos (API's) para rodar o backend
// sem precisar de um browser.
// O NPM = Node Package Manager - gerenciador de pacotes é ele que usamos
// para começar a instalar as dependencias com comandos via terminal.
// melhor usado em projetos grandes.
// Site para verificar as dependencias = nodejs.com
// Yarn é o concorrente do npm, tambem como package manager, gerencia pacotes
// para instalar dependencias. melhor usado em projetor pequenos.
// para criar um package.json basta você usar o comando npm init na pasta do
// projeto e seguir os passos descrevendo o .json
// versão 1.0.(0) = pequenas alteração, troca variável, alteram o último zero,
// chamado de patch.
// versão 1.(0).0 = novas funcionalidade sem alterar a usabilidade do usuário,
// chamado de miner.
// versão (1).0.0 = chamado de major, é alterado quando ocorre uma grande alteração,
// alteram a forma de usar.
// licenças: MIT é usado quando não importa a obtenção de todos itens
// a terceiros sem direitos autorais.
// licenças: apache2.0 ou mlp2.0 deixar o código aberto mais deixa a detenção
// da marca para o criador. | 38.1 | 172 | 0.61811 |
f21ecddbe34213950cb2c91828299cf3d6650fbb | 439 | js | JavaScript | 1-100/86.js | hangfengnice/leetcode | f137ecd907c28a0a7da85c94d3c21f48c2a3de5d | [
"MIT"
] | null | null | null | 1-100/86.js | hangfengnice/leetcode | f137ecd907c28a0a7da85c94d3c21f48c2a3de5d | [
"MIT"
] | null | null | null | 1-100/86.js | hangfengnice/leetcode | f137ecd907c28a0a7da85c94d3c21f48c2a3de5d | [
"MIT"
] | null | null | null | var partition = function (head, x) {
let small = new ListNode();
let smallHead = small;
let large = new ListNode();
let largeHead = large;
while (head) {
if (head.val < x) {
smallHead.next = head;
smallHead = smallHead.next;
} else {
largeHead.next = head;
largeHead = largeHead.next;
}
head = head.next;
}
largeHead.next = null;
smallHead.next = large.next;
return small.next;
};
| 21.95 | 36 | 0.601367 |
f21f76175354d4fa9dd34b63b38dac444fa1baa9 | 1,630 | js | JavaScript | browser/test/unit-tests/app/directives/ssMarkdown.unit.js | marklogic/marklogic-samplestack | 5449924fe9abd1712d3ef20ca2f25f2e291578e0 | [
"Apache-2.0"
] | 73 | 2015-01-05T05:57:02.000Z | 2019-05-07T12:34:21.000Z | browser/test/unit-tests/app/directives/ssMarkdown.unit.js | marklogic-community/marklogic-samplestack | 5449924fe9abd1712d3ef20ca2f25f2e291578e0 | [
"Apache-2.0"
] | 435 | 2015-01-01T01:36:16.000Z | 2018-04-01T09:20:05.000Z | browser/test/unit-tests/app/directives/ssMarkdown.unit.js | marklogic/marklogic-samplestack | 5449924fe9abd1712d3ef20ca2f25f2e291578e0 | [
"Apache-2.0"
] | 65 | 2015-01-22T09:15:16.000Z | 2019-04-17T03:23:01.000Z | /*
* Copyright 2012-2015 MarkLogic Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['testHelper'], function (helper) {
return function () {
describe('ssMarkdown', function () {
var el;
var scope;
var $compile;
beforeEach(function (done) {
angular.mock.module('app');
inject(
function ($rootScope, _$httpBackend_, _$compile_, _$timeout_) {
scope = $rootScope.$new();
$compile = _$compile_;
el = angular.element(
'<div><div ss-markdown="content"/></div>'
);
$compile(el)(scope);
done();
}
);
});
it(
'should call highlight on code',
function () {
this.timeout(3000);
scope.content = '# I Heading\n\n' +
'```javascript\nreturn \'I Code\';\n```\n';
scope.$apply();
el.find('h1').text().should.equal('I Heading');
el.find('code').text().should.equal('return \'I Code\';\n');
}
);
});
};
});
| 28.103448 | 76 | 0.557669 |
f22086493d8b98158d3606d3982a7a810b33e0dd | 2,762 | js | JavaScript | packages/api-gas-updater/index.js | pooltogether/pooltogether-api-monorepo | 299f0336bfd0ec3b4229e32df8bec6fb08c072ea | [
"MIT"
] | 3 | 2021-12-07T10:25:15.000Z | 2022-03-29T04:16:32.000Z | packages/api-gas-updater/index.js | pooltogether/pooltogether-api-monorepo | 299f0336bfd0ec3b4229e32df8bec6fb08c072ea | [
"MIT"
] | 7 | 2021-04-29T22:42:14.000Z | 2021-07-27T16:54:58.000Z | packages/api-gas-updater/index.js | pooltogether/pooltogether-api-monorepo | 299f0336bfd0ec3b4229e32df8bec6fb08c072ea | [
"MIT"
] | 2 | 2021-12-13T21:31:07.000Z | 2022-03-29T15:00:02.000Z | import { DEFAULT_HEADERS } from '../../utils/constants'
import { log } from '../../utils/sentry'
import { updateGasCosts } from './updateGasCosts'
export const MAINNET_CHAIN_ID = 1
export const POLYGON_CHAIN_ID = 137
export const AVALANCHE_CHAIN_ID = 43114
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event))
})
addEventListener('scheduled', (event) => {
try {
event.waitUntil(updateGasScheduledHandler(event))
} catch (e) {
event.waitUntil(log(e, event.request))
}
})
const updateAllGasCosts = async (event) => {
const mainnetPromise = updateGasCosts(event, MAINNET_CHAIN_ID)
const polygonPromise = updateGasCosts(event, POLYGON_CHAIN_ID)
const avalanchePromise = updateGasCosts(event, AVALANCHE_CHAIN_ID)
return await Promise.all([mainnetPromise, polygonPromise, avalanchePromise])
}
/**
* Handle cloudflare cron job triggers by updating gas costs
* @param {*} event
* @returns
*/
async function updateGasScheduledHandler(event) {
// setInfuraId(INFURA_ID)
// setQuicknodeId(QUICKNODE_ID)
// setFetch(fetch)
try {
await updateAllGasCosts(event)
return true
} catch (e) {
event.waitUntil(log(e, event.request))
return false
}
}
/**
* Allow manual updates
* @param {Event} event
*/
async function handleRequest(event) {
// setInfuraId(INFURA_ID)
// setQuicknodeId(QUICKNODE_ID)
// setFetch(fetch)
try {
const request = event.request
const _url = new URL(request.url)
const pathname = _url.pathname
// Read routes
if (pathname.startsWith(`/update`)) {
try {
await updateAllGasCosts(event)
const successResponse = new Response(
`Successfully updated gas for ${MAINNET_CHAIN_ID}, ${POLYGON_CHAIN_ID} and ${AVALANCHE_CHAIN_ID}`,
{
...DEFAULT_HEADERS,
status: 200
}
)
successResponse.headers.set('Content-Type', 'text/plain')
return successResponse
} catch (e) {
event.waitUntil(log(e, e.request))
console.log('err updatin')
const errorResponse = new Response(`Error updating ${CHAIN_ID}`, {
...DEFAULT_HEADERS,
status: 500
})
errorResponse.headers.set('Content-Type', 'text/plain')
return errorResponse
}
}
const notFoundResponse = new Response('Invalid request', {
...DEFAULT_HEADERS,
status: 500
})
notFoundResponse.headers.set('Content-Type', 'text/plain')
return notFoundResponse
} catch (e) {
event.waitUntil(log(e, e.request))
const errorResponse = new Response('Error', {
...DEFAULT_HEADERS,
status: 500
})
errorResponse.headers.set('Content-Type', 'text/plain')
return errorResponse
}
}
| 27.346535 | 108 | 0.661477 |
f221ba26f7d21235bd321b2d09437a08553ab787 | 961 | js | JavaScript | client-react/sagas/userSaga.js | kmarques/ladder | e2dcc3a33839f942507e2db3a1cdec02976f2227 | [
"MIT"
] | 1 | 2018-10-30T16:01:48.000Z | 2018-10-30T16:01:48.000Z | client-react/sagas/userSaga.js | kmarques/ladder | e2dcc3a33839f942507e2db3a1cdec02976f2227 | [
"MIT"
] | 2 | 2017-02-01T23:03:22.000Z | 2017-02-08T18:31:48.000Z | client-react/sagas/userSaga.js | kmarques/ladder | e2dcc3a33839f942507e2db3a1cdec02976f2227 | [
"MIT"
] | 2 | 2018-10-30T15:21:51.000Z | 2020-03-30T10:24:57.000Z | /**
* Created by karl on 05/02/2017.
*/
'use strict';
import { put, call } from 'redux-saga/effects';
import { fetchUsers, newUser } from '../Api/user';
import * as types from '../constants/actionTypes';
// Responsible for searching media library, making calls to the API
// and instructing the redux-saga middle ware on the next line of action,
// for success or failure operation.
export function* fetchUsersSaga({}) {
try {
const users = yield call(fetchUsers);
yield put({ type: types.FETCH_USERS_SUCCESS, users });
} catch (error) {
yield put({ type: types.FETCH_GAMES_ERROR, error });
}
}
export function* newUserSaga({payload}) {
try {
const user = yield call(newUser, payload);
yield put({ type: types.NEW_USER_SUCCESS, user });
yield put({ type: types.UI_MODAL_NEW_USER_TOGGLE });
yield put({ type: types.UI_ADMIN_ACTION_TOGGLE });
} catch (error) {
yield put({ type: types.NEW_USER_ERROR, error });
}
} | 31 | 73 | 0.681582 |
f222185504d95ecec9d7d9f2a15f1c24ffe07b69 | 22,879 | js | JavaScript | miniprogram/pages/addorg/addOrg.js | hanfubaike/hanfubaike-weapp | 7b4bc85f83b89d326db93c97a847ff6ada84aacb | [
"Apache-2.0"
] | 1 | 2021-04-13T17:15:00.000Z | 2021-04-13T17:15:00.000Z | miniprogram/pages/addorg/addOrg.js | hanfubaike/hanfubaike-weapp | 7b4bc85f83b89d326db93c97a847ff6ada84aacb | [
"Apache-2.0"
] | null | null | null | miniprogram/pages/addorg/addOrg.js | hanfubaike/hanfubaike-weapp | 7b4bc85f83b89d326db93c97a847ff6ada84aacb | [
"Apache-2.0"
] | 1 | 2021-06-18T08:07:39.000Z | 2021-06-18T08:07:39.000Z |
const app = getApp()
const chooseLocation = requirePlugin('chooseLocation');
import util from '../../utils/util.js';
Page({
data: {
value: '',
showMask:false,
loading:false,
postType:'新增',
sizeType:['original'],
reasonFileList: [],
logoFileList: [],
orgImageFileList:[],
show: false,
orgName:"",
orgType: "",
locationName: '',
locationAddress: '',
latitude: '',
longitude: '',
status:0,
src: '',
openid: '',
dbName:'org',
srcName:'',
autosize:{ maxHeight: 300, minHeight: 50 },
width: 250,//宽度
height: 250,//高度
nameLabel:{
orgName:"组织名称",
orgType:"组织类型",
locationAddress:"详细地址",
orgDesc:"组织简介",
contactName:"负责人",
telNumble:"联系电话",
QQGroup:"QQ群",
wxmp:"微信公众号",
reason:"申请说明"
},
isModify:false,
isPC:app.isPC,
cloudData:{}
},
lastSaveTime:0
,
uploadTasks:[],
formData:{logoList:[],reasonImageList:[],orgImageList:[]},
orgTypeList: ['社会组织','商业组织','汉服商家','大学组织','高中组织','初中组织'],
async onLoad(option){
const self = this
await app.checkLogin(self)
this.option = option
if(option.mod == "modify" || option.mod=="revise"){
self.setData({isModify:true})
wx.setNavigationBarTitle({
title: "修改组织信息"
})
self.getOrgInfo(option.id,self.setOrgInfo)
return
}
let fs = wx.getFileSystemManager();
wx.getStorage({
key: 'formData',
success(res) {
let logoFileList = res.data.logoFileList || []
let reasonFileList = res.data.reasonFileList || []
let orgImageFileList = res.data.orgImageFileList || []
let saveTime = res.data.saveTime || new Date()
let fileList = logoFileList.concat(reasonFileList).concat(orgImageFileList)
for (let x in fileList){
let url = fileList[x].url
try{
fs.accessSync(url)
}
catch (err){
//console.log(err)
console.log("文件已过期")
res.data.logoFileList = []
res.data.reasonFileList= []
res.data.orgImageFileList=[]
break
}
}
self.setData(res.data)
}
})
//setInterval(this.autoSave,10000)
},
onShow(option){
let self = this
if (app.cropperImg.url){
let fileName = app.cropperImg.fileName
this.setData({
[`${fileName}`]:this.data[`${fileName}`].concat({url:app.cropperImg.url})
},
function(){
app.cropperImg = {}
},
)
}
const location = chooseLocation.getLocation(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null
if(location){
console.log(location)
let addres = ""
if(location.city && location.district && location.name && location.province){
addres = `${location.province}${location.city}${location.district}${location.name}`
}else{
addres = location.address
}
console.log(addres)
self.setData({
locationAddress: addres,
latitude: location.latitude,
longitude: location.longitude,
})
self.formData['locationAddress'] = addres
self.autoSave()
}
},
autoSave(){
this.formData['latitude'] = this.data.latitude
this.formData['longitude'] = this.data.longitude
this.formData['logoFileList'] = this.data.logoFileList
this.formData['orgImageFileList'] = this.data.orgImageFileList
this.formData['reasonFileList'] = this.data.reasonFileList
this.formData['saveTime'] = new Date()
wx.setStorage({
key:'formData',
data:this.formData
})
},
dbUpdate: async function (data) {
const db = wx.cloud.database()
let self = this
let locationGeo = db.Geo.Point(this.data.longitude, this.data.latitude)
data['longLatiute'] = locationGeo
delete data['longitude']
delete data['latitude']
delete data['reasonFileList']
delete data['orgImageFileList']
delete data['logoFileList']
delete data['saveTime']
let dbres = {}
try{
if (this.data.isModify){
delete data['reason']
delete data['checkOpenid']
delete data['reasonImageList']
delete data['_openid']
delete data['status']
delete data['postType']
if(self.option.mod == "revise"){
data['status'] = 0
//修改标识
data['revise'] = true
}
let id = this.data._id
let removeList = self.removeList || []
let updated = false
await wx.cloud.callFunction({
// 云函数名称
name: 'updateOrg',
// 传给云函数的参数
data: {
id,
orgData:data,
removeList
},
})
.then(res => {
console.log(res)
if(res.result.updated){
console.log('[数据库] [更新记录] 成功')
updated = true
}else{
setTimeout(function () {
wx.hideLoading()
}, 200)
wx.showModal({
showCancel:false,
title: '提示',
content: res.result.msg,
success (res) {
if (res.confirm) {
console.log('用户点击确定')
}
}
})
console.error('[数据库] [更新记录] 失败:', res)
}
})
.catch(error =>{
console.error(error)
setTimeout(function () {
wx.hideLoading()
}, 200)
wx.showModal({
showCancel:false,
title: '提示',
content: "更新失败:未知错误"
})
console.error('[数据库] [更新记录] 失败:', error)
})
.finally(function(){
})
return updated
}else{
data['postTime'] = db.serverDate()
dbres = await db.collection(this.data.dbName).add({
data: data,
})
console.log(dbres)
return true
}
}catch(err){
console.error('[数据库] [更新记录] 失败:', err)
return false
}
},
dbQuery:function () {
console.log("正在查询数据库..")
wx.showLoading({
title: '正在检查',
mask:true
})
const db = wx.cloud.database()
//查询当前用户所有的 counters
return db.collection(this.data.dbName).field({
orgName: true
}).where({
orgName: this.formData.orgName
}).get()
},
orgClick() {
const self = this
wx.showActionSheet({
itemList: self.orgTypeList,
success (res) {
//console.log(res.tapIndex)
self.setData({
orgType:self.orgTypeList[res.tapIndex]
})
self.formData['orgType'] = self.orgTypeList[res.tapIndex]
self.autoSave()
},
fail (res) {
console.log(res.errMsg)
}
})
},
formSubmit: function (e) {
console.log('form发生了submit事件,携带数据为:', e.detail.value)
let formData = e.detail.value
let self = this
formData["poster"] = app.globalData.userInfo.name || app.globalData.userInfo.nickName
this.formData = formData
this.autoSave()
if (!this.postForm()){
console.error("提交失败")
wx.showToast({
icon: 'none',
title: '提交失败!'
})
}
},
formReset: function () {
console.log('form发生了reset事件')
},
postForm: async function(){
let self = this
let dbres = {}
if(!this.data.isModify){
try{
dbres = await this.dbQuery()
console.log('[数据库] [查询记录] 成功: ', dbres)
}catch (err) {
wx.showToast({
icon: 'none',
title: '查询记录失败'
})
console.error('[数据库] [查询记录] 失败:', err)
return
}
if (dbres.data.length!=0){
app.showToast("组织名称已存在,请重新输入")
return
}
}
if (!this.checkFormData()){
return
}
let uploadRes = await self.uploadFiles(self.formData.orgName)
if (!uploadRes){
return
}
if (await self.dbUpdate(self.formData)){
//setTimeout(function () {
//wx.hideLoading()
//}, 2000)
//在返回结果中会包含新创建的记录的 _id
//app.showToast("提交成功","success")
//setTimeout(function () {
//wx.showLoading({
//title: '正在向管理员发送通知...',
//mask:true
//})
//}, 1500)
//app.showToast("提交成功","success")
//提交成功之后清除表单缓存
wx.setStorage({
key:'formData',
data:{}
})
if(self.data.isModify && self.option.mod!='revise'){
wx.showToast({
icon:'success',
title: '修改成功!',
})
let id = self.data._id
let longitude = self.data.longitude
let latitude = self.data.latitude
setTimeout(function(){
let Page = getCurrentPages()[getCurrentPages().length - 2];
let options = {
id,
longitude,
latitude
}
Page.onLoad(options)
wx.navigateBack({
complete: (res) => {},
})
//wx.navigateTo({
//url: "/pages/orgPage/orgPage?id=" + id + "&longitude=" + longitude + "&latitude=" + latitude ,
//})
},1500)
return
}
setTimeout(function(){
wx.showLoading({
title: '正在跳转...',
mask:true
})
},1000)
await self.sendEmailToAdmin()
setTimeout(function(){
wx.hideLoading()
wx.navigateTo({
url: '/pages/msg/msg_success?title=提交成功&msg=等待管理员审核。请点击下方的确定按钮订阅通知消息,审核通过后我们会第一时间通知你,如长时间没有审核,请通过邮件联系我们:&msgLink=hanfubaike@163.com&btText=确定&SubscribeMessage=true',
})
},2000)
//wx.showModal({
//title: '提示',
//content: '提交成功,请等待管理员审核,点击确定按钮返回首页',
//success(res) {
//if (res.confirm) {
// wx.redirectTo({
// url: 'map'
// })
// } else if (res.cancel) {
//console.log('用户点击取消')
//}
//}
//})
}else{
wx.hideLoading({
success: (res) => {},
})
wx.showModal({
showCancel:false,
title: '提示',
content: '提交失败!',
})
}
},
checkFormData(){
console.log("开始检查数据")
let ignoreList = ['wxmp','latitude','longitude','logoFileList','orgImageFileList','reasonFileList','reason','telNumble']
//if(this.data.isModify){
//ignoreList.push("reason")
//}
let formData = this.formData
let nameLabel = this.data.nameLabel
if (this.data.logoFileList.length==0){
//app.showToast("请上传【LOGO】")
//return
}
if (this.data.orgImageFileList.length==0){
//app.showToast("请上传【照片墙】")
//return
}
if (this.data.reasonFileList.length == 0 && !this.data.isModify) {
app.showToast("请上传【证明材料】")
return false
}
if (!this.data.latitude || !this.data.longitude){
app.showToast("请先点击按钮选取位置")
return false
}
for (let x in formData){
let value = formData[x]
if (ignoreList.indexOf(x) > -1){
continue
}
if (!value){
app.showToast("请填写【" + nameLabel[x] + "】")
return false
}else{
value = value.toString().replace(/\s*/g, "")
if (value.length == 0){
app.showToast("请填写【" + nameLabel[x] + "】")
return false
}
}
}
return true
},
chooseLocation: function () {
let self = this
const key = 'AIZBZ-F5M62-ACTUF-C2LQH-DQKC7-TVB7A'; //使用在腾讯位置服务申请的key
const referer = '汉服小百科'; //调用插件的app的名称
let longLatiute = {}
if(self.data.longitude && self.data.latitude){
longLatiute.longitude = self.data.longitude
longLatiute.latitude = self.data.latitude
}
const location = longLatiute.length>0 ? JSON.stringify(longLatiute) : '';
console.log(location)
const category = '';
wx.navigateTo({
url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}`
});
/*wx.chooseLocation({
success: function (res) {
console.log(res)
self.setData({
locationAddress: res.address,
latitude: res.latitude,
longitude: res.longitude,
})
self.formData['locationAddress'] = res.address
self.autoSave()
}
})*/
},
beforeRead(event) {
console.log(event.detail)
const { file, callback } = event.detail;
let fileSure = false
// if(file.size > 1*1024*1024){
// }else{
// fileSure = true
// }
// callback(fileSure);
},
afterRead(event) {
const {
file,
name
} = event.detail;
console.log(event.detail)
function setImg(imgArray,isOrigin,name,self){
let fileList = []
for(let x in imgArray){
if(isOrigin){
fileList.push({url:imgArray[x].path})
}else{
fileList.push({url:imgArray[x].url})
}
}
if(name == 'orgImage'){
self.setData({
orgImageFileList: self.data.orgImageFileList.concat(fileList)
});
}
else{
self.setData({
reasonFileList: self.data.reasonFileList.concat(fileList)
});
}
}
let self = this
if (name == 'logo'){
//getCurrentPages().slice(-1)
wx.navigateTo({
url: '../cropper/cropper?fileName=logoFileList&export_scale=1&url='+file.path,
})
}else {
// if(app.isPC){
wx.yx.compressImage({
filePath:file,
success(res){
console.log(res)
setImg(res.imgArray,false,name,self)
}
})
// wx.showModal({
// title: '提示',
// content: '图片太大了,请将图片压缩至1M或使用手机上传!',
// showCancel: false,
// fail: function (res) {
// }
// })
//}else{
//setImg(file,true,name,self)
//}
}
},
delete(event) {
const { index, name } = event.detail;
let fileListName = 'reasonFileList'
if (name == "logo"){
fileListName = 'logoFileList'
}else if(name == "orgImage"){
fileListName = 'orgImageFileList'
}
const fileList = this.data[`${fileListName}`];
fileList.splice(index, 1);
this.setData({ [`${fileListName}`]: fileList });
},
imageName:function(name, filePath, index, fileList){
let loc = fileList.length == 1 ? '' : "-" + index
let uploadPath = "orgImg/"
if(name.indexOf('-reason')>-1){
uploadPath = "reasonImg/"
}
const cloudPath = uploadPath + name + "-" + util.getDateName(new Date()) + filePath.match(/\.[^.]+?$/)[0]
//const cloudPath = "orgReg/" + name + loc + '.jpg'
return cloudPath
},
uploadfile(fileList,fileListName,fileName){
const self = this
let uploadTasks = []
for (let x in fileList){
let filePath = fileList[x].url
if (filePath.indexOf("cloud://")>-1){
//if(cloudFileList.indexOf(filePath)>-1){
console.log("跳过云端已存在的文件",filePath)
uploadTasks.push(new Promise(function (resolve, reject){
return resolve({url:filePath,fileName:fileListName})
}))
continue
}else{
}
let cloudPath = this.imageName(fileName, filePath, x, fileList)
uploadTasks.push(new Promise(function (resolve, reject){
wx.cloud.uploadFile({
cloudPath: cloudPath,
filePath: filePath
}).then(res => {
//console.log(res.fileID)
return resolve({url:res.fileID,fileName:fileListName});
//wx.showToast({ title: '上传成功', icon: 'none' });
}).catch(error => {
setTimeout(function () {
wx.hideLoading()
}, 1000)
wx.showToast({ title: '上传失败', icon: 'none' });
return error;
})
}))
}
return uploadTasks
},
async uploadFiles(orgName){
function setFileList(fileList){
let newFileList = []
for(let x in fileList){
newFileList.push(fileList[x].url)
}
return newFileList
}
const self = this
let name = orgName + "-reason"
let logoName = orgName + "-logo"
let orgImageName = orgName + "-orgImage"
console.log("正在上传图片")
wx.showLoading({
title: "正在上传图片...",
mask:true
})
let logoFileList = this.data.logoFileList
let reasonFileList = this.data.reasonFileList
let orgImageFileList = this.data.orgImageFileList
let uploadTasks = []
let cloudFileList = []
let removeList = []
if(self.data.isModify){
cloudFileList = cloudFileList.concat(self.cloudData.orgImageList).concat(self.cloudData.logoList)
let allFileList = []
allFileList = allFileList.concat(logoFileList).concat(reasonFileList).concat(orgImageFileList)
allFileList = setFileList(allFileList)
console.log('allFileList',allFileList)
console.log('cloudFileList',cloudFileList)
for(let x in cloudFileList){
let fileUrl = cloudFileList[x]
if(allFileList.indexOf(fileUrl)>-1){
}else{
removeList.push(fileUrl)
}
}
}
uploadTasks = uploadTasks.concat(self.uploadfile(logoFileList, "logoList",logoName))
if(!this.data.isModify){
uploadTasks = uploadTasks.concat(self.uploadfile(reasonFileList, "reasonImageList",name))
}
uploadTasks = uploadTasks.concat(self.uploadfile(orgImageFileList, "orgImageFileList",orgImageName))
console.log(uploadTasks)
let logoList =[]
let orgImageList = []
let reasonImageList = []
try {
const values = await Promise.all(uploadTasks);
console.log('图片上传成功!', values);
for (let x in values) {
let fileName = values[x].fileName;
let url = values[x].url;
switch (fileName) {
case "logoList":
logoList.push(url);
break;
case "orgImageFileList":
orgImageList.push(url);
break;
case "reasonImageList":
reasonImageList.push(url);
break;
}
}
self.removeList = removeList
self.formData["logoList"] = logoList;
self.formData["orgImageList"] = orgImageList;
self.formData["reasonImageList"] = reasonImageList;
self.formData['postType'] = self.data.postType;
//注册状态,0:待审核,-1:审核未通过,1:审核通过
self.formData['status'] = 0;
return true;
}
catch (reason) {
console.log(reason);
app.showToast("上传图片失败!");
return false;
}
},
postBt(e){
//console.log(e)
//app.getMsgSetting(this.postForm)
},
sendEmail(from,title,to,cc,text){
const self = this
return wx.cloud.callFunction({
// 云函数名称
name: 'sendEmail',
// 传给云函数的参数
data: {
from: from,
title:title,
to:to,
cc:cc,
text: text,
},
})
.then(res => {
console.log(res.result)
console.log("发送邮件成功")
//app.showToast("已向管理员发送通知!","success")
})
.catch(error =>{
console.error(error)
console.log("发送邮件失败")
//app.showToast("向管理员发送通知失败!")
})
.finally(function(){
})
},
async sendEmailToAdmin(){
let orgName = this.formData.orgName
let from = {
name: "汉服百科",
address: "hanfubaike@163.com"
}
let title = "新增组织『" + orgName +"』需要审核,请及时查看。"
let to = [{
name: "汉服百科管理组",
address: "hanfubaike@qq.com"
}]
let cc = {
name: "汉服百科",
address: "hanfubaike@163.com"
}
let text = "新增组织『" + orgName +"』需要审核,申请人:" + this.formData["poster"] + ",请打开小程序进行查看!"
const db = wx.cloud.database()
const dbCommand = db.command
let dbres = {}
//查询当前用户所有的 counters
function getAdmiEmail(){
//email: dbCommand.exists(true),
try{
return db.collection('user').field({
openid:false
}).where({
isManager:true
}).get()
}catch(err){
wx.showToast({
icon: 'none',
title: '查询记录失败'
})
console.error('[数据库] [查询记录] 失败:', err)
}
}
dbres = await getAdmiEmail()
if (!dbres){
return
}
console.log('[数据库] [查询记录] 成功: ', dbres)
if (dbres.data.length != 0){
for (let x in dbres.data){
if (!dbres.data[x].name || !dbres.data[x].email){
continue
}
to.push(
{name: dbres.data[x].name,
address: dbres.data[x].email}
)
}
}
await this.sendEmail(from,title,to,cc,text)
},
inputChage(e){
//console.log(e)
let _id = e.currentTarget.id
this.formData[_id] = e.detail
//如果距离上次保存时间超过指定时间(微秒),则保存。
if (new Date() - this.lastSaveTime > 5000){
console.log(e)
this.autoSave()
if (this.lastSaveTime==0){
//Notify({ type: 'success', message: '已开启自动保存' });
}
this.lastSaveTime = new Date()
console.log("表单已自动保存")
}
},
setOrgInfo(dataList){
const data = dataList[0]
let self = this
console.log(data)
if(data.status==1 && self.option.mod=="revise"){
console.log("已审核通过,正在跳转到主页")
wx.showModal({
title: '提示',
content: '已审核通过,点击确定跳转到主页。',
showCancel: false,
success (res) {
if (res.confirm) {
console.log('用户点击确定')
wx.reLaunch({
url: '/pages/map/map',
})
}
}
})
}
//console.log(data)
let listData = []
let listData2 = []
let listData3 = []
for (let x in data.logoList){
listData.push({url:data.logoList[x]})
}
data.logoFileList = listData
for (let x in data.reasonImageList){
listData2.push({url:data.reasonImageList[x]})
}
data.reasonImageList = listData2
for (let x in data.orgImageList){
listData3.push({url:data.orgImageList[x]})
}
data.orgImageFileList = listData3
data.latitude = data.longLatiute.latitude
data.longitude = data.longLatiute.longitude
this.cloudData = data
this.setData(
data
)
},
getOrgInfo: function (id,func) {
wx.showLoading({
title: '加载中...',
mask:true
})
let field = {
postTime:false
}
const db = wx.cloud.database()
//查询当前用户所有的 counters
db.collection(this.data.dbName).where({
_id:id,
_openid: '{openid}'
}).field(field).get({
success: res => {
console.log('[数据库] [查询记录] 成功: ', res)
if (res.data){
func(res.data)
}else{
}
},
fail: err => {
wx.showToast({
icon: 'none',
title: '查询记录失败'
})
console.error('[数据库] [查询记录] 失败:', err)
},
complete:res => {
setTimeout(function () {
wx.hideLoading()
}, 1000)
}
})
}
}); | 25.910532 | 177 | 0.536693 |
f223cf6809a3db0bbb7400a7c4f8ea8b5f4c6f83 | 609 | js | JavaScript | packages/upload-file-by-koa/index.js | huomarvin/easy-to-understand | 9922c543c56515714f46e4dd3b4a6ceb6ca7f842 | [
"MIT"
] | 4 | 2021-09-13T15:02:49.000Z | 2022-02-23T03:00:59.000Z | packages/upload-file-by-koa/index.js | huomarvin/easy-to-understand | 9922c543c56515714f46e4dd3b4a6ceb6ca7f842 | [
"MIT"
] | null | null | null | packages/upload-file-by-koa/index.js | huomarvin/easy-to-understand | 9922c543c56515714f46e4dd3b4a6ceb6ca7f842 | [
"MIT"
] | null | null | null | const Koa = require("koa");
const path = require("path");
const Router = require("@koa/router");
const app = new Koa();
const router = new Router();
const { handleUploadReq, getStorageBase } = require("./utils");
app.use(require("koa-static")(path.resolve(__dirname, "static")));
app.use(require("koa-static")(path.resolve(__dirname, "tmp")));
router.post("/upload/form", async (ctx, next) => {
const result = await handleUploadReq(ctx.req, getStorageBase("img"));
ctx.body = result;
});
app.use(router.routes()).use(router.allowedMethods());
app.listen(3000, () => {
console.log(`3000端口监听成功`);
});
| 29 | 71 | 0.674877 |
f2245ade19b21511839fb14145be17415abedf91 | 2,691 | js | JavaScript | src/views/inputs/index.js | bugra9/adminJS | 7941ef8f5be4584118d13c79c118f4ecf4f550f4 | [
"MIT"
] | null | null | null | src/views/inputs/index.js | bugra9/adminJS | 7941ef8f5be4584118d13c79c118f4ecf4f550f4 | [
"MIT"
] | null | null | null | src/views/inputs/index.js | bugra9/adminJS | 7941ef8f5be4584118d13c79c118f4ecf4f550f4 | [
"MIT"
] | null | null | null | import React, { Component, PropTypes } from 'react';
import JTextForm from './JTextForm';
import JTextTable from './JTextTable';
import JDateTimeForm from './JDateTimeForm';
import JDateTimeTable from './JDateTimeTable';
import JSelectForm from './JSelectForm';
import JSelectTable from './JSelectTable';
import JEditor from './JEditor';
import JFileForm from './JFileForm';
import JSlugForm from './JSlugForm';
class JInput extends Component {
render() {
const {input, type} = this.props;
let value = this.props.value;
if(!value)
value = "";
switch(input.input.type) {
case "text":
if(type === "Input")
return (
<JTextForm input={input} value={String(value)} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
case "number":
if(type === "Input")
return (
<JTextForm type="number" input={input} value={value} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
case "slug":
if(type === "Input")
return (
<JSlugForm input={input} value={String(value)} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
case "editor":
if(type === "Input")
return (
<JEditor input={input} value={value} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
case "file":
if(type === "Input")
return (
<JFileForm input={input} value={value} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
case "date":
if(type === "Input")
return (
<JDateTimeForm input={input} value={value} />
);
else
return (
<JDateTimeTable input={input} value={value} />
);
case "select":
if(type === "Input")
return (
<JSelectForm input={input} value={value} />
);
else
return (
<JSelectTable input={input} value={value} />
);
default:
if(type === "Input")
return (
<JTextForm input={input} value={String(value)} />
);
else
return (
<JTextTable input={input} value={String(value)} />
);
}
}
}
JInput.propTypes = {
input: PropTypes.object.isRequired,
type: PropTypes.string
};
export default JInput; | 26.126214 | 67 | 0.497956 |
f2260e1b73d656d3e2624310af7c6ce9f3c1df0a | 518 | js | JavaScript | src/utils/auth.js | 4ncov/admin-4ncov | 7d95f0ee0547d1873d11c0f6f19f0fc1a9ee0ef9 | [
"MIT"
] | null | null | null | src/utils/auth.js | 4ncov/admin-4ncov | 7d95f0ee0547d1873d11c0f6f19f0fc1a9ee0ef9 | [
"MIT"
] | null | null | null | src/utils/auth.js | 4ncov/admin-4ncov | 7d95f0ee0547d1873d11c0f6f19f0fc1a9ee0ef9 | [
"MIT"
] | null | null | null | import Cookies from 'js-cookie'
const TokenKey = 'vue_admin_template_token'
const getTokenPayload = token => JSON.parse(atob(token.substring(token.indexOf('.') + 1, token.lastIndexOf('.'))))
export function getToken() {
return Cookies.get(TokenKey)
}
export function setToken(token, expiresAt) {
return Cookies.set(TokenKey, token, { expires: new Date(expiresAt) })
}
export function removeToken() {
return Cookies.remove(TokenKey)
}
export function getUserId() {
return getTokenPayload(getToken()).id
}
| 23.545455 | 114 | 0.739382 |
f2274af21a4a22850e39d2946d1d2fedef05c1b4 | 141 | js | JavaScript | Documentation/_cl_stack_workload_8cpp.js | muthukumaravel7/armnn | 879ec231203df5b0a94462c0b247dc7d8d8a7a44 | [
"MIT"
] | null | null | null | Documentation/_cl_stack_workload_8cpp.js | muthukumaravel7/armnn | 879ec231203df5b0a94462c0b247dc7d8d8a7a44 | [
"MIT"
] | null | null | null | Documentation/_cl_stack_workload_8cpp.js | muthukumaravel7/armnn | 879ec231203df5b0a94462c0b247dc7d8d8a7a44 | [
"MIT"
] | null | null | null | var _cl_stack_workload_8cpp =
[
[ "ClStackWorkloadValidate", "_cl_stack_workload_8cpp.xhtml#a8c9fec997dbb5db4cdb433c36d075782", null ]
]; | 35.25 | 106 | 0.808511 |
f228b08f3785241dd7f8083eb4c483009d4be860 | 690 | js | JavaScript | static/js/script.js | sreekaransrinath/otc-website | 4802560bae5fbb993da5ff269ae6152a105996da | [
"MIT"
] | null | null | null | static/js/script.js | sreekaransrinath/otc-website | 4802560bae5fbb993da5ff269ae6152a105996da | [
"MIT"
] | null | null | null | static/js/script.js | sreekaransrinath/otc-website | 4802560bae5fbb993da5ff269ae6152a105996da | [
"MIT"
] | null | null | null | const ul = document.querySelector(".navbar-ul");
const burgerMenu = document.querySelector(".burger-menu");
const title = document.querySelector("h1");
const teamContainer = document.querySelector(".team-container");
// For burger menu
burgerMenu.addEventListener(
"click",
(event) => {
ul.classList.toggle("hide-burger-menu");
event.stopPropagation();
},
{ passive: true }
);
window.addEventListener(
"click",
() => {
ul.classList.add("hide-burger-menu");
},
{ passive: true }
);
// For team page
if (window.location.pathname.startsWith("/team"))
title.addEventListener(
"click",
() => {
teamContainer.classList.toggle("cto-visible");
},
{ passive: true }
);
| 20.909091 | 64 | 0.678261 |
f2298e55eb771068eae3fad28a068972a0cc7771 | 837 | js | JavaScript | src/components/like-button/LikeButton.js | 5cobak/fontend-lessons | d4f8bea97a8609267b2c3769ef40546a2d791877 | [
"MIT"
] | 1 | 2020-05-10T14:59:28.000Z | 2020-05-10T14:59:28.000Z | src/components/like-button/LikeButton.js | 5cobak/frontend-lessons | d4f8bea97a8609267b2c3769ef40546a2d791877 | [
"MIT"
] | 34 | 2020-12-11T10:05:37.000Z | 2022-02-27T00:56:25.000Z | src/components/like-button/LikeButton.js | 5cobak/toxin | d4f8bea97a8609267b2c3769ef40546a2d791877 | [
"MIT"
] | null | null | null | class LikeButton {
constructor(button) {
this.$button = $(button);
this.countLike = +this.$button.find('.js-like-button__likes').text();
this._init();
}
_toggleLike() {
const { $button } = this;
if (!$button.hasClass('like-button_active')) {
this.countLike += 1;
$button.find('.js-like-button__likes').text(this.countLike);
} else {
this.countLike -= 1;
$button.find('.js-like-button__likes').text(this.countLike);
}
$button.toggleClass('like-button_active');
}
_handlerClick() {
this._toggleLike();
}
_bindHandlers() {
this.handlerClick = this._handlerClick.bind(this);
}
_addEventHandlers() {
this.$button.on('click', this.handlerClick);
}
_init() {
this._bindHandlers();
this._addEventHandlers();
}
}
export default LikeButton;
| 21.461538 | 73 | 0.623656 |
f229ee91df30c69755db0728d19002e4affbb98f | 559 | js | JavaScript | test/built-ins/Date/prototype/S15.9.4.1_A1_T1.js | ptomato/test262 | 10ad4c159328d12ad8d12b95a8f8aefa0e4fd49b | [
"BSD-3-Clause"
] | 1,849 | 2015-01-15T12:42:53.000Z | 2022-03-30T21:23:59.000Z | test/built-ins/Date/prototype/S15.9.4.1_A1_T1.js | ptomato/test262 | 10ad4c159328d12ad8d12b95a8f8aefa0e4fd49b | [
"BSD-3-Clause"
] | 2,157 | 2015-01-06T05:01:55.000Z | 2022-03-31T17:18:08.000Z | test/built-ins/Date/prototype/S15.9.4.1_A1_T1.js | ptomato/test262 | 10ad4c159328d12ad8d12b95a8f8aefa0e4fd49b | [
"BSD-3-Clause"
] | 411 | 2015-01-22T01:40:04.000Z | 2022-03-28T19:19:16.000Z | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The Date property "prototype" has { DontEnum, DontDelete, ReadOnly }
attributes
esid: sec-date.prototype
description: Checking ReadOnly attribute
includes: [propertyHelper.js]
---*/
var x = Date.prototype;
verifyNotWritable(Date, "prototype", null, 1);
assert.sameValue(Date.prototype, x, 'The value of Date.prototype is expected to equal the value of x');
// TODO: Convert to verifyProperty() format.
| 31.055556 | 103 | 0.738819 |
f229ef4c576d7e3100f7f16ca867cb069be712eb | 1,636 | js | JavaScript | ACAP_linux/3rd/OpenMesh/Documentation/a02042.js | shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer | 8c9afe017769f9554706bcd267b6861c4c144999 | [
"MIT"
] | 216 | 2018-09-09T11:53:56.000Z | 2022-03-19T13:41:35.000Z | 3rd/OpenMesh/Documentation/a02042.js | IGLICT/Sampling_code | 213bbd1366276d904937c527ec0c6f5137bf3ad6 | [
"MIT"
] | 13 | 2018-10-23T08:29:09.000Z | 2021-09-08T06:45:34.000Z | ACAP_linux/3rd/OpenMesh/Documentation/a02042.js | shubhMaheshwari/Automatic-Unpaired-Shape-Deformation-Transfer | 8c9afe017769f9554706bcd267b6861c4c144999 | [
"MIT"
] | 41 | 2018-09-13T08:50:41.000Z | 2022-02-23T00:33:54.000Z | var a02042 =
[
[ "Base", "a02042.html#afa249000890245eb81a257cdc6550fce", null ],
[ "const_iterator", "a02042.html#ad38ed107dd48236d7421ba1a9ec18604", null ],
[ "Handle", "a02042.html#a8bbd4da98b39695332f9a4739585b7f1", null ],
[ "HandleContainer", "a02042.html#aab59d97fa0c082544b8efa9b9bbbdd4e", null ],
[ "iterator", "a02042.html#a4e6b4dc445ca71eaeb8c1d4d96c6aebd", null ],
[ "ExtStatusSetT", "a02042.html#a0098c25bbaf1002d8eed9f76da4db6b8", null ],
[ "~ExtStatusSetT", "a02042.html#a19ec76f21a5d07cf67327a7ebbb86861", null ],
[ "back", "a02042.html#af1c21348004cf9ec238a4596d7ae7a5e", null ],
[ "back", "a02042.html#a05c8375a842f824369c2ee7ff7dba572", null ],
[ "begin", "a02042.html#a9e4b96481de64f35c3a002430a433732", null ],
[ "begin", "a02042.html#a389395158b5612d7d8da5edd4a6ed3ac", null ],
[ "clear", "a02042.html#ad9fea495459de8f064b735bad03b4d1b", null ],
[ "empty", "a02042.html#a19c77cb929e90bad1d3d1e33456b679c", null ],
[ "end", "a02042.html#a30769cd0ae217d417ea5b58ee9a77519", null ],
[ "end", "a02042.html#ad43631667f5227e0e19b8348c0e55ce7", null ],
[ "erase", "a02042.html#a3eb4adaa2903eb2ef4ce65dd25239c59", null ],
[ "erase", "a02042.html#a281b55f96cea609ef899ac00e51228f5", null ],
[ "front", "a02042.html#a16274d5a97952a11b41bd0c689b7d0c4", null ],
[ "front", "a02042.html#a2d429546a2cd9414994553eb361ac67a", null ],
[ "insert", "a02042.html#a091d795b77504b4bd5544bc50ff1cc19", null ],
[ "size", "a02042.html#a86fb33ef0dfa07f9d88bd64c1bc1ab4e", null ],
[ "handles_", "a02042.html#a6d15ac1af7bda1c83fe22c70f56fd5d3", null ]
]; | 65.44 | 81 | 0.726161 |
f22a1eefd310d0fd6b75906a380de4b892d06d4e | 1,291 | js | JavaScript | app/router/v1.js | Weislife/egg-swagger-joi | ab397d44335c47fe726d56e3cc29405eed0f11f5 | [
"MIT"
] | 5 | 2018-07-31T02:17:42.000Z | 2019-01-15T07:10:25.000Z | app/router/v1.js | Weislife/egg-swagger-joi | ab397d44335c47fe726d56e3cc29405eed0f11f5 | [
"MIT"
] | null | null | null | app/router/v1.js | Weislife/egg-swagger-joi | ab397d44335c47fe726d56e3cc29405eed0f11f5 | [
"MIT"
] | null | null | null | 'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller, io } = app;
const subRouter = router.namespace('/api/v1');
subRouter.get('/test', controller.v1.mytest.index);
subRouter.resources('admin', '/manage/admin', controller.v1.admin);
subRouter.post('admin', '/manage/admin/login', controller.v1.admin.login);
subRouter.post('admin', '/manage/admin/update_password', app.middleware.manageJWTValidate(), controller.v1.admin.update_password);
// 官网-新闻
subRouter.get('site', '/manage/site/news', app.middleware.manageJWTValidate(), controller.v1.site.news_manage_list);
subRouter.post('site', '/manage/site/news', app.middleware.manageJWTValidate(), controller.v1.site.news_create);
subRouter.delete('site', '/manage/site/news/:id', app.middleware.manageJWTValidate(), controller.v1.site.news_delete);
subRouter.get('site', '/manage/site/news/:id', app.middleware.manageJWTValidate(), controller.v1.site.news_get);
subRouter.put('site', '/manage/site/news/:id', app.middleware.manageJWTValidate(), controller.v1.site.news_update);
subRouter.get('site', '/site/news/:id', controller.v1.site.news_get_and_count_see_num);
subRouter.get('site', '/site/news', controller.v1.site.news_list);
};
| 49.653846 | 132 | 0.728892 |
f22a414f0517914e69ac519fe9e6f13ea685f8af | 2,804 | js | JavaScript | src/installer-component.js | razvan-rosu/demo-polymer3-pwa | 43c6fda2756aad471cd59fd661fd75b30f001ad6 | [
"MIT"
] | 1 | 2020-12-01T15:43:52.000Z | 2020-12-01T15:43:52.000Z | src/installer-component.js | razvan-rosu/demo-polymer3-pwa | 43c6fda2756aad471cd59fd661fd75b30f001ad6 | [
"MIT"
] | null | null | null | src/installer-component.js | razvan-rosu/demo-polymer3-pwa | 43c6fda2756aad471cd59fd661fd75b30f001ad6 | [
"MIT"
] | null | null | null | import {LitElement, html} from '@polymer/lit-element';
/**
* Install Button component
*/
class InstallerComponent extends LitElement {
constructor() {
super();
}
static get properties() {
return {
};
}
render() {
return html`
<style>
:host {
display: block;
}
.InstallerComponent {
display:inline-block;
padding:0 10px;
text-align:center;
text-transform:uppercase;
font-weight: bold;
line-height:30px;
text-decoration:none;
color: #323230;
background-color:#FFF;
border: 1px solid #323230;
white-space:nowrap;
-webkit-transition:all 0.2s ease-in-out;
-o-transition:all 0.2s ease-in-out;
transition:all 0.2s ease-in-out;
-webkit-touch-callout:none;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
vertical-align:middle;
cursor:pointer;
-ms-touch-action:manipulation;
touch-action:manipulation;
outline:0
}
.InstallerComponent:hover {
color: #333;
background-color: #FE7A22;
}
.InstallerComponent[disabled] {
pointer-events:none;
cursor:not-allowed;
-webkit-box-shadow:0 0 0 rgba(0, 0, 0, 0);
box-shadow:0 0 0 rgba(0,0,0,0);
opacity:0.30;
filter:alpha(opacity=30)
}
</style>
<button type="button" disabled id="Install" class="InstallerComponent">Install</button>
`
}
firstUpdated(_changedProperties) {
let btnAdd = this.shadowRoot.getElementById('Install');
var deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
// Update UI notify the user they can add to home screen
btnAdd.removeAttribute('disabled');
console.log('Install button has been enabled!');
});
btnAdd.addEventListener('click', (e) => {
// hide our user interface that shows our A2HS button
btnAdd.setAttribute('disabled', 'true');
// Show the prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice
.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the A2HS prompt');
} else {
console.log('User dismissed the A2HS prompt');
}
deferredPrompt = null;
});
});
}
}
customElements.define('installer-component', InstallerComponent);
| 27.223301 | 91 | 0.587732 |
f22ab43161aedd9ad5f2c232901a5e13bf9c8f16 | 674 | js | JavaScript | lessons/js-data-abstraction/points.js | feeedback/hexlet_professions_backend | 4e4acc64678afdc4e904d9bcdf816b5236a6db43 | [
"MIT"
] | null | null | null | lessons/js-data-abstraction/points.js | feeedback/hexlet_professions_backend | 4e4acc64678afdc4e904d9bcdf816b5236a6db43 | [
"MIT"
] | null | null | null | lessons/js-data-abstraction/points.js | feeedback/hexlet_professions_backend | 4e4acc64678afdc4e904d9bcdf816b5236a6db43 | [
"MIT"
] | null | null | null | // sc: https://ru.hexlet.io/courses/js-data-abstraction/lessons/points/exercise_unit
// points.js
// Реализуйте и экспортируйте по умолчанию функцию calculateDistance, которая находит
// расстояние между двумя точками на плоскости:
// point1 = [0, 0];
// point2 = [3, 4];
// calculateDistance(point1, point2); // 5
// Подсказки
// Формула расчёта расстояния между двумя точками
// https://www.youtube.com/watch?v=cavwFx4Xd0o
// @ts-check
// BEGIN (write your solution here)
const calculateDistance = ([x1, y1], [x2, y2]) => {
const deltaX = x2 - x1;
const deltaY = y2 - y1;
return Math.sqrt(deltaX ** 2 + deltaY ** 2);
};
export default calculateDistance;
// END
| 26.96 | 85 | 0.698813 |
f22b2c34ed197b9b7b73f9b4f098299e82a1a76d | 207 | js | JavaScript | src/pomodoroStates.js | balajeerc/pomodoro-intrusive | 2567a91a73426ac1c1b4f48adcf107ed38b7d119 | [
"MIT"
] | 10 | 2018-02-22T12:10:22.000Z | 2021-07-25T21:18:15.000Z | src/pomodoroStates.js | balajeerc/pomodoro-intrusive | 2567a91a73426ac1c1b4f48adcf107ed38b7d119 | [
"MIT"
] | 9 | 2017-12-02T05:39:54.000Z | 2022-03-25T18:18:04.000Z | src/pomodoroStates.js | balajeerc/pomodoro-intrusive | 2567a91a73426ac1c1b4f48adcf107ed38b7d119 | [
"MIT"
] | 1 | 2019-08-28T15:05:43.000Z | 2019-08-28T15:05:43.000Z | export const START_ACTIVITY_CHECK = 'pomodoro-intrusive/START_ACTIVITY_CHECK';
export const WAIT_ON_BREAK = 'pomodoro-intrusive/WAIT_ON_BREAK';
export const WAIT_ON_WORK = 'pomodoro-intrusive/WAIT_ON_WORK';
| 51.75 | 78 | 0.84058 |
f22bd59ea5eb7070ae95686804620819fd0ed453 | 1,649 | js | JavaScript | test/statistics.js | juneidysoo/statsd | 8e065fb791b552d076795a72487602059c9e46b5 | [
"MIT"
] | null | null | null | test/statistics.js | juneidysoo/statsd | 8e065fb791b552d076795a72487602059c9e46b5 | [
"MIT"
] | 3 | 2018-10-19T13:55:13.000Z | 2018-10-25T22:33:27.000Z | test/statistics.js | juneidysoo/statsd | 8e065fb791b552d076795a72487602059c9e46b5 | [
"MIT"
] | null | null | null | const assert = require('assert');
const statistics = require('../src/statistics');
describe(__filename, () => {
statistics.init();
const { stats } = statistics;
const originalFlushInterval = statistics.flushInterval;
before(() => {
statistics.flushInterval = 100;
});
after(() => {
statistics.flushInterval = originalFlushInterval;
});
afterEach(() => {
stats.reset();
});
describe('Aggregate', () => {
it('Counter', () => {
stats._insert('foo:2|c');
const m = statistics.aggregate();
assert.equal(m.counters.foo, 2);
});
it('Counter rate', () => {
stats._insert('foo:2|c');
const m = statistics.aggregate();
assert.equal(m.counter_rates.foo, 20);
});
it('Empty timers', () => {
stats.timers.init('foo');
const m = statistics.aggregate();
assert.equal(m.counter_rates['foo'], void 0);
});
it('Single time', () => {
stats._insert('foo:100|ms');
const m = statistics.aggregate();
assert.deepEqual(
m.timer_data.foo,
{
std: 0,
upper: 100,
lower: 100,
count: 1,
count_ps: 10,
sum: 100,
sum_squares: Math.pow(100, 2),
mean: 100,
median: 100
}
);
});
it('Multiple times', () => {
const values = [100, 200, 300];
values.forEach(val => stats._insert(`foo:${val}|ms`));
const m = statistics.aggregate();
assert.deepEqual(
m.timer_data.foo,
{
std: 81.64965809277261,
upper: 300,
lower: 100,
count: 3,
count_ps: 30,
sum: 600,
sum_squares: values.reduce(
(acc, val) => acc + Math.pow(val, 2),
0
),
mean: 200,
median: 200
}
);
});
});
});
| 21.986667 | 57 | 0.566404 |
f22ec833d0e4defd4ffa21de5d3cad70636f5972 | 1,003 | js | JavaScript | commands/getMsgs.js | riforik/RikardChatHTML | 871810bb487f866f6c84a8862d45b22bf1f66317 | [
"MIT"
] | 1 | 2019-03-26T01:23:09.000Z | 2019-03-26T01:23:09.000Z | commands/getMsgs.js | riforik/RikardChatHTML | 871810bb487f866f6c84a8862d45b22bf1f66317 | [
"MIT"
] | 1 | 2019-03-23T22:48:39.000Z | 2019-03-23T22:48:39.000Z | commands/getMsgs.js | riforik/RikardChatHTML | 871810bb487f866f6c84a8862d45b22bf1f66317 | [
"MIT"
] | null | null | null | function getMsgs() {
function initMessages() {
// console.log("here");
var initMessages = $.ajax({
url: "./services/messages.php",
type: "POST",
dataType: "json"
});
initMessages.done(function(data) {
chat = [];
var content = "";
$.each(data, function(i, item) {
var m_id = item.id;
var m_userName = item.userName;
var m_message = item.message;
var m_Time = item.mTime;
content = "";
});
const msgArr1 = data.length
checkSize(msgArr1, chat);
});
initMessages.fail(function(jqXHR, textStatus) {
console.log("Something went Wrong! (getMsgs)" + textStatus);
});
};
initMessages();
function checkSize(msgArr1, chat) {
console.log(`Chat Length: ${chat.length}`);
console.log(`Arr Length: ${msgArr1}`);
};
} | 24.463415 | 72 | 0.479561 |
f22eea65ba83ba3087dbac1cd055a27d95ea3575 | 11,205 | js | JavaScript | public/assets/admin/ckeditor5/node_modules/@ckeditor/ckeditor5-comments/src/comments/commentsediting.js | Godfather-3113/laravel.blog | e8c87547a452cd8befd94e365594e0c54422f1ba | [
"MIT"
] | null | null | null | public/assets/admin/ckeditor5/node_modules/@ckeditor/ckeditor5-comments/src/comments/commentsediting.js | Godfather-3113/laravel.blog | e8c87547a452cd8befd94e365594e0c54422f1ba | [
"MIT"
] | null | null | null | public/assets/admin/ckeditor5/node_modules/@ckeditor/ckeditor5-comments/src/comments/commentsediting.js | Godfather-3113/laravel.blog | e8c87547a452cd8befd94e365594e0c54422f1ba | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2016 - 2021, CKSource - Frederico Knabben. All rights reserved.
*
*
*
*
* +---------------------------------------------------------------------------------+
* | |
* | Hello stranger! |
* | |
* | |
* | What you're currently looking at is the source code of a legally protected, |
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
* | are forbidden and will result in legal consequences. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
const _0x5dc9=['low','markerToData','push','change:isThreadsLoadingPaused','_handleMarkerAddAndRemove','_detachCommentThread','has','editor','length','registerPostFixer','schema','commands','delete','editing','_attachedThreads','change','conversion','then','change:isReadOnly','upcast','CommentsEditing','model','end','map','removeCommentThread','$graveyard','CommentsRepository','isEqual','listenTo','config','isCollapsed','activeMarker','document','text','createPositionBefore','getWalker','stop','init','isThreadsLoadingPaused','markers','createRange','destroyed','getCommentThread','high','updateMarker','differ','_changedMarkers','change:activeMarker','_threads','pluginName','update:comment','getMarkersGroup','get','getAllMarkersForId','hasMarkerForId','getCommentThreads','add','split','rootName','_attachThreadToMarker','comment:','openNewCommentThread','createElement','start','dataDowncast','set','data','removeMarker','ck-comment-marker','destroy','top','dataToMarker','ck-comment-marker--active','elementToElement','for','markerToHighlight','$marker','attachTo','name','_initializeMarkerConverters','newRange','plugins','state','once','addCommentThread','collaboration.channelId','hasCommentThread','editingDowncast','managedUsingOperations','comment'];(function(_0x534a3,_0x5dc9cd){const _0x4f3d92=function(_0x4409de){while(--_0x4409de){_0x534a3['push'](_0x534a3['shift']());}};_0x4f3d92(++_0x5dc9cd);}(_0x5dc9,0x65));const _0x4f3d=function(_0x534a3,_0x5dc9cd){_0x534a3=_0x534a3-0x0;let _0x4f3d92=_0x5dc9[_0x534a3];return _0x4f3d92;};import{Plugin as _0x13412e}from'ckeditor5/src/core';import{Rect as _0x19002f}from'ckeditor5/src/utils';import _0x37ed0f from'./commentsrepository';import _0x3e7762 from'./addcommentthreadcommand';import _0x41970a from'../utils/getmarkerdomelement';import _0x32fa7b from'./integrations/commentsrestrictededitingmode';import'../../theme/commentmarker.css';export default class r extends _0x13412e{static get['requires'](){return[_0x37ed0f,_0x32fa7b];}static get[_0x4f3d('0x26')](){return _0x4f3d('0x9');}constructor(_0x20bdaa){super(_0x20bdaa),this[_0x4f3d('0x36')]('isThreadsLoadingPaused',!0x0),_0x20bdaa[_0x4f3d('0x37')][_0x4f3d('0x48')]('ready',()=>this[_0x4f3d('0x1b')]=!0x1),this['set'](_0x4f3d('0x14'),null),this['on'](_0x4f3d('0x24'),(_0x303f6f,_0x23dc79,_0x34bd1b,_0x30ef55)=>{_0x20bdaa[_0x4f3d('0xa')]['change'](_0x3a9c5d=>{if(_0x34bd1b){const {id:_0x4ce1c5}=k(_0x34bd1b),_0x4cb235=this[_0x4f3d('0x2a')](_0x4ce1c5);for(const _0x5b36eb of _0x4cb235)_0x3a9c5d[_0x4f3d('0x21')](_0x5b36eb);}if(_0x30ef55){const {id:_0x5c0a50}=k(_0x30ef55),_0x160d3f=this[_0x4f3d('0x2a')](_0x5c0a50);for(const _0x399a55 of _0x160d3f)_0x3a9c5d[_0x4f3d('0x21')](_0x399a55);}});}),this[_0x4f3d('0x3')]=new Set();}[_0x4f3d('0x1a')](){const _0x5f04c2=this[_0x4f3d('0x56')],_0x3f48a0=_0x5f04c2[_0x4f3d('0x46')][_0x4f3d('0x29')](_0x4f3d('0xf')),_0x190371=_0x5f04c2['config'][_0x4f3d('0x29')](_0x4f3d('0x4a'));_0x5f04c2[_0x4f3d('0x0')][_0x4f3d('0x2d')](_0x4f3d('0x49'),new _0x3e7762(_0x5f04c2)),this['listenTo'](_0x5f04c2,_0x4f3d('0x7'),(_0x463ea6,_0x545c24,_0x44a238)=>{_0x3f48a0['switchReadOnly'](_0x44a238,_0x5f04c2[_0x4f3d('0x12')][_0x4f3d('0x29')]('collaboration.channelId'));}),this[_0x4f3d('0x11')](_0x3f48a0,g(_0x4f3d('0xd'),_0x190371),(_0xbafcc7,{threadId:_0x1667f3})=>{_0x5f04c2[_0x4f3d('0xa')][_0x4f3d('0x4')](_0x1c6e44=>{for(const _0x40ce86 of this['getAllMarkersForId'](_0x1667f3))_0x1c6e44[_0x4f3d('0x38')](_0x40ce86);});const _0x27034f=_0x3f48a0[_0x4f3d('0x1f')](_0x1667f3);_0x3f48a0[_0x4f3d('0x4b')](_0x1667f3)&&!_0x27034f['length']||_0xbafcc7[_0x4f3d('0x19')]();},{'priority':_0x4f3d('0x20')}),this[_0x4f3d('0x11')](_0x3f48a0,g('addComment',_0x190371),(_0x177c81,{threadId:_0x4a7006,isFromAdapter:_0x9e9e2c})=>{const _0x259deb=this[_0x4f3d('0x2a')](_0x4a7006);if(_0x9e9e2c||0x0==_0x259deb['length']||!_0x3f48a0['hasCommentThread'](_0x4a7006))return;0x1===_0x3f48a0[_0x4f3d('0x1f')](_0x4a7006)[_0x4f3d('0x57')]&&_0x5f04c2['model'][_0x4f3d('0x4')](_0x50cce9=>{for(const _0x2a395e of _0x259deb)_0x50cce9[_0x4f3d('0x21')](_0x2a395e,{'usingOperation':!0x0,'affectsData':!0x0});});},{'priority':_0x4f3d('0x4f')}),this[_0x4f3d('0x44')](),this[_0x4f3d('0x53')]();}[_0x4f3d('0x3a')](){const _0x378956=this[_0x4f3d('0x56')][_0x4f3d('0x46')][_0x4f3d('0x29')](_0x4f3d('0xf')),_0x404d33=this[_0x4f3d('0x56')][_0x4f3d('0x12')][_0x4f3d('0x29')](_0x4f3d('0x4a'));for(const _0x15cc1e of _0x378956[_0x4f3d('0x2c')]({'channelId':_0x404d33}))_0x378956[_0x4f3d('0x54')](_0x15cc1e['id']),_0x378956[_0x4f3d('0x25')][_0x4f3d('0x1')](_0x15cc1e['id']);super['destroy']();}[_0x4f3d('0x2b')](_0x1fc117){return this[_0x4f3d('0x2a')](_0x1fc117)[_0x4f3d('0x57')]>0x0;}[_0x4f3d('0x2a')](_0x4ff67a){const _0x1313d0=this[_0x4f3d('0x56')][_0x4f3d('0xa')][_0x4f3d('0x1c')][_0x4f3d('0x29')](_0x4f3d('0x31')+_0x4ff67a);return _0x1313d0?[_0x1313d0]:Array['from'](this[_0x4f3d('0x56')][_0x4f3d('0xa')][_0x4f3d('0x1c')][_0x4f3d('0x28')](_0x4f3d('0x31')+_0x4ff67a));}[_0x4f3d('0x44')](){const _0xc904d9=this[_0x4f3d('0x56')];_0xc904d9[_0x4f3d('0x5')]['for'](_0x4f3d('0x4c'))[_0x4f3d('0x40')]({'model':_0x4f3d('0x4e'),'view':_0x548b27=>{const {id:_0x4213a2}=k(_0x548b27['markerName']),_0x288f3e=[_0x4f3d('0x39')];return this[_0x4f3d('0x14')]&&k(this[_0x4f3d('0x14')])['id']===_0x4213a2&&_0x288f3e[_0x4f3d('0x51')](_0x4f3d('0x3d')),{'classes':_0x288f3e,'attributes':{'data-comment':_0x4213a2}};}}),_0xc904d9[_0x4f3d('0x5')]['for'](_0x4f3d('0x35'))[_0x4f3d('0x50')]({'model':_0x4f3d('0x4e'),'view':_0x450b5f=>{const _0x41a882=_0xc904d9['model'][_0x4f3d('0x1c')][_0x4f3d('0x29')](_0x450b5f),{id:_0x1c3df5,part:_0x14c3d7}=k(_0x450b5f);return _0x41a882['affectsData']?{'group':_0x4f3d('0x4e'),'name':_0x14c3d7?_0x1c3df5+':'+_0x14c3d7:_0x1c3df5}:null;}}),_0xc904d9[_0x4f3d('0x5')][_0x4f3d('0x3f')](_0x4f3d('0x8'))[_0x4f3d('0x3e')]({'view':{'name':_0x4f3d('0x4e'),'attribute':{'id':/^\w/}},'model':(_0x4ec135,{writer:_0x5a1afb})=>_0x5a1afb[_0x4f3d('0x33')](_0x4f3d('0x41'),{'data-name':_0x4f3d('0x31')+_0x4ec135['getAttribute']('id')})}),_0xc904d9[_0x4f3d('0x5')][_0x4f3d('0x3f')](_0x4f3d('0x8'))[_0x4f3d('0x3c')]({'view':_0x4f3d('0x4e')});}['_handleMarkerAddAndRemove'](){const _0x282d09=this['editor'],_0xcddfd3=_0x282d09[_0x4f3d('0x46')][_0x4f3d('0x29')](_0x4f3d('0xf')),_0x4507ed=new Set();_0x282d09['model']['document'][_0x4f3d('0x58')](_0x384fe7=>{let _0x35e955=!0x1;for(const [_0x3b8d72,_0x2c8455]of _0x282d09['model'][_0x4f3d('0x15')][_0x4f3d('0x22')][_0x4f3d('0x23')]){const {group:_0x19d8b7,id:_0x2536fb}=k(_0x3b8d72);let _0x48a0a8=_0x2c8455[_0x4f3d('0x45')];if(_0x4f3d('0x4e')!==_0x19d8b7||!_0x48a0a8)continue;const _0x140e99=_0x4f3d('0xe')===_0x48a0a8['root'][_0x4f3d('0x2f')];_0x140e99||(_0x48a0a8=y(_0x48a0a8,_0x282d09['model']),!_0x48a0a8||_0x48a0a8[_0x4f3d('0x10')](_0x2c8455[_0x4f3d('0x45')]))?!_0x48a0a8||!_0x282d09[_0x4f3d('0xa')]['hasContent'](_0x48a0a8)||this[_0x4f3d('0x3')][_0x4f3d('0x55')](_0x2536fb)&&_0x140e99?(_0x384fe7[_0x4f3d('0x38')](_0x3b8d72),_0x35e955=!0x0):_0x140e99||(this[_0x4f3d('0x1b')]?_0x4507ed[_0x4f3d('0x2d')](_0x2536fb):this['_attachThreadToMarker'](_0x2536fb)):(_0x384fe7[_0x4f3d('0x21')](_0x3b8d72,{'range':_0x48a0a8}),_0x35e955=!0x0);}return _0x35e955;}),this['on'](_0x4f3d('0x52'),(_0x4f07d4,_0x470b39,_0xce4f71)=>{if(!_0xce4f71&&_0x4507ed['size'])for(const _0x4e0452 of _0x4507ed)this[_0x4f3d('0x30')](_0x4e0452),_0x4507ed[_0x4f3d('0x1')](_0x4e0452);}),this[_0x4f3d('0x11')](_0x282d09[_0x4f3d('0xa')][_0x4f3d('0x1c')],_0x4f3d('0x27'),(_0x19d102,_0x48cfbc,_0xe9388,_0x170b71)=>{if(_0x170b71)return;const {id:_0x210b2f}=k(_0x48cfbc[_0x4f3d('0x43')]),_0x35701c=_0x282d09[_0x4f3d('0x46')][_0x4f3d('0x29')]('CommentsRepository')['getCommentThread'](_0x210b2f);_0x4507ed[_0x4f3d('0x1')](_0x210b2f),_0x35701c&&!this[_0x4f3d('0x2b')](_0x210b2f)&&(this[_0x4f3d('0x3')]['delete'](_0x210b2f),_0xcddfd3[_0x4f3d('0x54')](_0x210b2f));});}['_attachThreadToMarker'](_0x5bdb5a){if(this[_0x4f3d('0x3')][_0x4f3d('0x55')](_0x5bdb5a))return;this[_0x4f3d('0x3')]['add'](_0x5bdb5a);const _0x5e9cde=this['editor'],_0x53f143=_0x5e9cde['plugins']['get'](_0x4f3d('0xf')),_0x5ef627=_0x5e9cde[_0x4f3d('0x12')][_0x4f3d('0x29')](_0x4f3d('0x4a')),_0x46a7b1=()=>{const _0x423f26=this[_0x4f3d('0x2a')](_0x5bdb5a);if(0x0==_0x423f26[_0x4f3d('0x57')])return null;const _0xe34dec=_0x423f26[_0x4f3d('0xc')](_0xafb9b5=>_0x41970a(_0x5e9cde['editing'],_0xafb9b5));return _0xe34dec['sort']((_0x400e0d,_0x15895f)=>{const _0x417427=new _0x19002f(_0x400e0d),_0x450055=new _0x19002f(_0x15895f),_0x4c3962=_0x417427['top']-_0x450055[_0x4f3d('0x3b')];return 0x0==_0x4c3962?_0x417427['left']-_0x450055['left']:_0x4c3962;}),_0xe34dec[0x0];};!this[_0x4f3d('0x2a')](_0x5bdb5a)[0x0][_0x4f3d('0x4d')]?_0x5e9cde[_0x4f3d('0x2')]['view'][_0x4f3d('0x48')]('render',()=>{_0x53f143[_0x4f3d('0x32')]({'channelId':_0x5ef627,'threadId':_0x5bdb5a,'target':_0x46a7b1});},{'priority':'low'}):_0x53f143['fetchCommentThread']({'channelId':_0x5ef627,'threadId':_0x5bdb5a})[_0x4f3d('0x6')](_0x34e5d5=>{if(_0x4f3d('0x1e')!==_0x5e9cde[_0x4f3d('0x47')]){if(_0x34e5d5)_0x34e5d5[_0x4f3d('0x42')](_0x46a7b1);else{const _0x7db5de=this[_0x4f3d('0x2a')](_0x5bdb5a);_0x5e9cde[_0x4f3d('0xa')][_0x4f3d('0x4')](_0xa5a97f=>{for(const _0x44a928 of _0x7db5de)_0xa5a97f[_0x4f3d('0x38')](_0x44a928);});}}});}}function g(_0x38eeba,_0x319d96){return _0x319d96?_0x38eeba+':'+_0x319d96:_0x38eeba;}function k(_0x30b579){const _0x4b3380=_0x30b579[_0x4f3d('0x2e')](':');return{'group':_0x4b3380[0x0],'id':_0x4b3380[0x1],'part':_0x4b3380[0x2]};}function y(_0x230008,_0x51dc5a){const _0x4f090f=_0x51dc5a[_0x4f3d('0x59')],_0x4212d3=_0x51dc5a[_0x4f3d('0x1d')](_0x230008[_0x4f3d('0x34')]);for(const _0x10f93e of _0x230008[_0x4f3d('0x18')]()){const {type:_0xf37409,item:_0xf53fbc,nextPosition:_0x1e1e4b}=_0x10f93e;if(_0x4f3d('0x16')===_0xf37409||_0x4f090f['isObject'](_0xf53fbc)){const _0x2f3f92=_0x51dc5a[_0x4f3d('0x17')](_0xf53fbc);_0x4212d3['isCollapsed']&&(_0x4212d3[_0x4f3d('0x34')]=_0x2f3f92),_0x4212d3[_0x4f3d('0xb')]=_0x1e1e4b;}}return _0x4212d3[_0x4f3d('0x13')]?null:_0x4212d3;} | 487.173913 | 10,025 | 0.682731 |
f2303040fba2b79253d9f5e4e1c78edb1270d706 | 1,305 | js | JavaScript | public/js/JScontrollers/owners.js | averdugo/serving | 558aed1d2f0bf01978e34019357ca300eae84803 | [
"MIT"
] | null | null | null | public/js/JScontrollers/owners.js | averdugo/serving | 558aed1d2f0bf01978e34019357ca300eae84803 | [
"MIT"
] | null | null | null | public/js/JScontrollers/owners.js | averdugo/serving | 558aed1d2f0bf01978e34019357ca300eae84803 | [
"MIT"
] | null | null | null | var swown = true;
function addOwner(){
var form = $('#crearOwnerForm').serializeObject();
var url ="/admin/owners";
$.post(url,form,function(result){
if (swown){
$('#crearOwner').modal('hide');
alert('Dueño Creado')
}else{
location.reload();
}
});
}
function getOwner(id){
var url ="/admin/owners/"+id+"/edit"
$.get(url,function(result){
$('#idEditFormOwner').val(result.id);
$('#nameEditFormOwner').val(result.name);
$('#contactEditFormOwner').val(result.contact);
$('#phoneEditFormOwner').val(result.phone);
$('#editarOwner').modal();
});
}
function editOwner(){
var form = $('#editarOwnerForm').serializeObject();
var url ="/admin/owners/"+form.id;
$.post(url,form,function(result){
$('#editarOwner').modal('hide');
alert('Dueño Actualizado');
location.reload();
});
}
function getOwnerOptions(swsite){
var url ="/admin/owners/option/";
$.get(url,function(result){
$('select#owner_id').html(result)
});
}
function deleteOwner(id){
var form = $('#deleteFormO').serializeObject();
var url ="/admin/owners/"+id;
$.post(url, form, function(result){
$("#owner"+result).remove();
});
}
| 23.303571 | 55 | 0.563218 |
f2321bea2ef676f3bbb90ae9c7edabce49a7efef | 2,364 | js | JavaScript | plugins/http.js | mythxiaoai/smart-web | 6f6875390353bc17be189b90aad50668ce58359c | [
"Apache-2.0"
] | 1 | 2021-03-02T09:40:23.000Z | 2021-03-02T09:40:23.000Z | plugins/http.js | mythxiaoai/smart-web | 6f6875390353bc17be189b90aad50668ce58359c | [
"Apache-2.0"
] | null | null | null | plugins/http.js | mythxiaoai/smart-web | 6f6875390353bc17be189b90aad50668ce58359c | [
"Apache-2.0"
] | null | null | null | // axios.request(config)
// axios.get(url[, config])
// axios.delete(url[, config])
// axios.head(url[, config])
// axios.options(url[, config])
// axios.post(url[, data[, config]])
// axios.put(url[, data[, config]])
// axios.patch(url[, data[, config]])
/**
* 插件目的:优化resful风格的参数 保证相同输入,减少脑力成本,优化api调用
* $api 调用方式 this.$api.user.list.get(parms,options)----> url = /user/list get为请求方法
*/
//全方法
const methods = ['get', 'delete', 'post', 'put', 'patch']
//传data的方法
let dataArr = ['delete', 'post', 'put', 'patch']
//传paarms的方法
let paramsArr = ['get']
/**
返回事例
{
url: '/sys/user/list',
method: 'get',
params: { data: 1 },
options: { set: 333 }
}
*/
let cb = function(obj) {
//参数处理
obj.data = dataArr.includes(obj.method) && obj.params;
obj.params = paramsArr.includes(obj.method) && obj.params;
//优先用用户传进来的options
let opts = Object.assign({}, obj, obj.options);
return window.$axios.$request(opts)
}
//全路径当做url匹配
const api = proxyMethod(cb);
//方法匹配 $http.get("url",{})
const http = new Proxy({},{
get:(target,key)=>{
if(!methods.includes(key)){
console.error( "http的调用方法只限制 'get', 'delete', 'post', 'put', 'patch'");
return {};
}
return (url, params,options={})=>{
//参数处理
options.url = url;
options.method = key;
options.data = dataArr.includes(key) && params;
options.params = paramsArr.includes(key) && params;
return window.$axios.$request(options)
};
}
});
export default ({$axios}, inject) => {
inject('api', api)
inject('http', http)
}
export {api,http};
function proxyMethod(callback, urlPath = '') {
const methods = ['get', 'delete', 'post', 'put', 'patch']
let fn = function() {
return new Proxy(
{},
{
get: (target, key) => {
if (methods.includes(key)) {
//每次调用完后url清空
let url = urlPath;
urlPath = '';
return (params = {}, options = {}) => {
return (
callback &&
callback.call(null, {
url,
method: key,
params,
options
})
)
}
} else {
urlPath += `/${key}`
return fn(callback, urlPath)
}
}
}
)
}
return fn(callback, urlPath)
}
| 23.64 | 90 | 0.524112 |
f232223e460478db033885984b233eeae04fa7d3 | 7,116 | js | JavaScript | build/main/lib/core/checkEnums.js | geometryzen/webgl-core | 934d13cf79182d5afd18da306c33d504a007bc1b | [
"MIT"
] | null | null | null | build/main/lib/core/checkEnums.js | geometryzen/webgl-core | 934d13cf79182d5afd18da306c33d504a007bc1b | [
"MIT"
] | 5 | 2020-12-04T18:14:42.000Z | 2022-03-02T04:33:56.000Z | build/main/lib/core/checkEnums.js | geometryzen/webgl-core | 934d13cf79182d5afd18da306c33d504a007bc1b | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkEnums = void 0;
var BeginMode_1 = require("./BeginMode");
var BlendingFactorDest_1 = require("./BlendingFactorDest");
var BlendingFactorSrc_1 = require("./BlendingFactorSrc");
var BufferObjects_1 = require("./BufferObjects");
var Capability_1 = require("./Capability");
var ClearBufferMask_1 = require("./ClearBufferMask");
var DepthFunction_1 = require("./DepthFunction");
var PixelFormat_1 = require("./PixelFormat");
var PixelType_1 = require("./PixelType");
var Usage_1 = require("./Usage");
var mustBeEQ_1 = require("../checks/mustBeEQ");
/**
* Verify that the enums match the values in the WebGL rendering context.
*/
function checkEnums(gl) {
// BeginMode
mustBeEQ_1.mustBeEQ('LINE_LOOP', BeginMode_1.BeginMode.LINE_LOOP, gl.LINE_LOOP);
mustBeEQ_1.mustBeEQ('LINE_STRIP', BeginMode_1.BeginMode.LINE_STRIP, gl.LINE_STRIP);
mustBeEQ_1.mustBeEQ('LINES', BeginMode_1.BeginMode.LINES, gl.LINES);
mustBeEQ_1.mustBeEQ('POINTS', BeginMode_1.BeginMode.POINTS, gl.POINTS);
mustBeEQ_1.mustBeEQ('TRIANGLE_FAN', BeginMode_1.BeginMode.TRIANGLE_FAN, gl.TRIANGLE_FAN);
mustBeEQ_1.mustBeEQ('TRIANGLE_STRIP', BeginMode_1.BeginMode.TRIANGLE_STRIP, gl.TRIANGLE_STRIP);
mustBeEQ_1.mustBeEQ('TRIANGLES', BeginMode_1.BeginMode.TRIANGLES, gl.TRIANGLES);
// BlendingFactorDest
mustBeEQ_1.mustBeEQ('ZERO', BlendingFactorDest_1.BlendingFactorDest.ZERO, gl.ZERO);
mustBeEQ_1.mustBeEQ('ONE', BlendingFactorDest_1.BlendingFactorDest.ONE, gl.ONE);
mustBeEQ_1.mustBeEQ('SRC_COLOR', BlendingFactorDest_1.BlendingFactorDest.SRC_COLOR, gl.SRC_COLOR);
mustBeEQ_1.mustBeEQ('ONE_MINUS_SRC_COLOR', BlendingFactorDest_1.BlendingFactorDest.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_SRC_COLOR);
mustBeEQ_1.mustBeEQ('SRC_ALPHA', BlendingFactorDest_1.BlendingFactorDest.SRC_ALPHA, gl.SRC_ALPHA);
mustBeEQ_1.mustBeEQ('ONE_MINUS_SRC_ALPHA', BlendingFactorDest_1.BlendingFactorDest.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
mustBeEQ_1.mustBeEQ('DST_ALPHA', BlendingFactorDest_1.BlendingFactorDest.DST_ALPHA, gl.DST_ALPHA);
mustBeEQ_1.mustBeEQ('ONE_MINUS_DST_ALPHA', BlendingFactorDest_1.BlendingFactorDest.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_DST_ALPHA);
// BlendingFactorSrc
mustBeEQ_1.mustBeEQ('ZERO', BlendingFactorSrc_1.BlendingFactorSrc.ZERO, gl.ZERO);
mustBeEQ_1.mustBeEQ('ONE', BlendingFactorSrc_1.BlendingFactorSrc.ONE, gl.ONE);
mustBeEQ_1.mustBeEQ('DST_COLOR', BlendingFactorSrc_1.BlendingFactorSrc.DST_COLOR, gl.DST_COLOR);
mustBeEQ_1.mustBeEQ('ONE_MINUS_DST_COLOR', BlendingFactorSrc_1.BlendingFactorSrc.ONE_MINUS_DST_COLOR, gl.ONE_MINUS_DST_COLOR);
mustBeEQ_1.mustBeEQ('SRC_ALPHA_SATURATE', BlendingFactorSrc_1.BlendingFactorSrc.SRC_ALPHA_SATURATE, gl.SRC_ALPHA_SATURATE);
mustBeEQ_1.mustBeEQ('SRC_ALPHA', BlendingFactorSrc_1.BlendingFactorSrc.SRC_ALPHA, gl.SRC_ALPHA);
mustBeEQ_1.mustBeEQ('ONE_MINUS_SRC_ALPHA', BlendingFactorSrc_1.BlendingFactorSrc.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
mustBeEQ_1.mustBeEQ('DST_ALPHA', BlendingFactorSrc_1.BlendingFactorSrc.DST_ALPHA, gl.DST_ALPHA);
mustBeEQ_1.mustBeEQ('ONE_MINUS_DST_ALPHA', BlendingFactorSrc_1.BlendingFactorSrc.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_DST_ALPHA);
// BufferObjects
mustBeEQ_1.mustBeEQ('ARRAY_BUFFER', BufferObjects_1.BufferObjects.ARRAY_BUFFER, gl.ARRAY_BUFFER);
mustBeEQ_1.mustBeEQ('ARRAY_BUFFER_BINDING', BufferObjects_1.BufferObjects.ARRAY_BUFFER_BINDING, gl.ARRAY_BUFFER_BINDING);
mustBeEQ_1.mustBeEQ('ELEMENT_ARRAY_BUFFER', BufferObjects_1.BufferObjects.ELEMENT_ARRAY_BUFFER, gl.ELEMENT_ARRAY_BUFFER);
mustBeEQ_1.mustBeEQ('ELEMENT_ARRAY_BUFFER_BINDING', BufferObjects_1.BufferObjects.ELEMENT_ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING);
// Capability
mustBeEQ_1.mustBeEQ('CULL_FACE', Capability_1.Capability.CULL_FACE, gl.CULL_FACE);
mustBeEQ_1.mustBeEQ('BLEND', Capability_1.Capability.BLEND, gl.BLEND);
mustBeEQ_1.mustBeEQ('DITHER', Capability_1.Capability.DITHER, gl.DITHER);
mustBeEQ_1.mustBeEQ('STENCIL_TEST', Capability_1.Capability.STENCIL_TEST, gl.STENCIL_TEST);
mustBeEQ_1.mustBeEQ('DEPTH_TEST', Capability_1.Capability.DEPTH_TEST, gl.DEPTH_TEST);
mustBeEQ_1.mustBeEQ('SCISSOR_TEST', Capability_1.Capability.SCISSOR_TEST, gl.SCISSOR_TEST);
mustBeEQ_1.mustBeEQ('POLYGON_OFFSET_FILL', Capability_1.Capability.POLYGON_OFFSET_FILL, gl.POLYGON_OFFSET_FILL);
mustBeEQ_1.mustBeEQ('SAMPLE_ALPHA_TO_COVERAGE', Capability_1.Capability.SAMPLE_ALPHA_TO_COVERAGE, gl.SAMPLE_ALPHA_TO_COVERAGE);
mustBeEQ_1.mustBeEQ('SAMPLE_COVERAGE', Capability_1.Capability.SAMPLE_COVERAGE, gl.SAMPLE_COVERAGE);
// ClearBufferMask
mustBeEQ_1.mustBeEQ('COLOR_BUFFER_BIT', ClearBufferMask_1.ClearBufferMask.COLOR_BUFFER_BIT, gl.COLOR_BUFFER_BIT);
mustBeEQ_1.mustBeEQ('DEPTH_BUFFER_BIT', ClearBufferMask_1.ClearBufferMask.DEPTH_BUFFER_BIT, gl.DEPTH_BUFFER_BIT);
mustBeEQ_1.mustBeEQ('STENCIL_BUFFER_BIT', ClearBufferMask_1.ClearBufferMask.STENCIL_BUFFER_BIT, gl.STENCIL_BUFFER_BIT);
// DepthFunction
mustBeEQ_1.mustBeEQ('ALWAYS', DepthFunction_1.DepthFunction.ALWAYS, gl.ALWAYS);
mustBeEQ_1.mustBeEQ('EQUAL', DepthFunction_1.DepthFunction.EQUAL, gl.EQUAL);
mustBeEQ_1.mustBeEQ('GEQUAL', DepthFunction_1.DepthFunction.GEQUAL, gl.GEQUAL);
mustBeEQ_1.mustBeEQ('GREATER', DepthFunction_1.DepthFunction.GREATER, gl.GREATER);
mustBeEQ_1.mustBeEQ('LEQUAL', DepthFunction_1.DepthFunction.LEQUAL, gl.LEQUAL);
mustBeEQ_1.mustBeEQ('LESS', DepthFunction_1.DepthFunction.LESS, gl.LESS);
mustBeEQ_1.mustBeEQ('NEVER', DepthFunction_1.DepthFunction.NEVER, gl.NEVER);
mustBeEQ_1.mustBeEQ('NOTEQUAL', DepthFunction_1.DepthFunction.NOTEQUAL, gl.NOTEQUAL);
// PixelFormat
mustBeEQ_1.mustBeEQ('DEPTH_COMPONENT', PixelFormat_1.PixelFormat.DEPTH_COMPONENT, gl.DEPTH_COMPONENT);
mustBeEQ_1.mustBeEQ('ALPHA', PixelFormat_1.PixelFormat.ALPHA, gl.ALPHA);
mustBeEQ_1.mustBeEQ('RGB', PixelFormat_1.PixelFormat.RGB, gl.RGB);
mustBeEQ_1.mustBeEQ('RGBA', PixelFormat_1.PixelFormat.RGBA, gl.RGBA);
mustBeEQ_1.mustBeEQ('LUMINANCE', PixelFormat_1.PixelFormat.LUMINANCE, gl.LUMINANCE);
mustBeEQ_1.mustBeEQ('LUMINANCE_ALPHA', PixelFormat_1.PixelFormat.LUMINANCE_ALPHA, gl.LUMINANCE_ALPHA);
// PixelType
mustBeEQ_1.mustBeEQ('UNSIGNED_BYTE', PixelType_1.PixelType.UNSIGNED_BYTE, gl.UNSIGNED_BYTE);
mustBeEQ_1.mustBeEQ('UNSIGNED_SHORT_4_4_4_4', PixelType_1.PixelType.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_4_4_4_4);
mustBeEQ_1.mustBeEQ('UNSIGNED_SHORT_5_5_5_1', PixelType_1.PixelType.UNSIGNED_SHORT_5_5_5_1, gl.UNSIGNED_SHORT_5_5_5_1);
mustBeEQ_1.mustBeEQ('UNSIGNED_SHORT_5_6_5', PixelType_1.PixelType.UNSIGNED_SHORT_5_6_5, gl.UNSIGNED_SHORT_5_6_5);
// Usage
mustBeEQ_1.mustBeEQ('STREAM_DRAW', Usage_1.Usage.STREAM_DRAW, gl.STREAM_DRAW);
mustBeEQ_1.mustBeEQ('STATIC_DRAW', Usage_1.Usage.STATIC_DRAW, gl.STATIC_DRAW);
mustBeEQ_1.mustBeEQ('DYNAMIC_DRAW', Usage_1.Usage.DYNAMIC_DRAW, gl.DYNAMIC_DRAW);
return gl;
}
exports.checkEnums = checkEnums;
| 76.516129 | 149 | 0.805228 |
f233bc3365cd3e1fa96f50bc3705b48f4900d59b | 3,957 | js | JavaScript | JavaScript/js_lang/objects/DescriptorAccessor.js | sreeise/Programming-Reference | c77f6a46abab28b8f0f4a56ebd9843310b19d489 | [
"MIT"
] | 2 | 2019-04-28T00:56:22.000Z | 2019-08-03T17:41:19.000Z | JavaScript/js_lang/objects/DescriptorAccessor.js | sreeise/ProgrammingSnippets | c77f6a46abab28b8f0f4a56ebd9843310b19d489 | [
"MIT"
] | 1 | 2018-07-10T22:33:12.000Z | 2018-07-16T22:30:35.000Z | JavaScript/js_lang/objects/DescriptorAccessor.js | sreeise/ProgrammingSnippets | c77f6a46abab28b8f0f4a56ebd9843310b19d489 | [
"MIT"
] | null | null | null | // Property Descriptors and Accessors
// Property descriptors present in objects come in two main
// flavors: data descriptors and accessor descriptors.
// A data descriptor is a property that has a value, which may
// or may not be writable. An accessor descriptor is a property
// described by a getter-setter pair of functions. A descriptor
// must be one of these two flavors; it cannot be both.
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
// The writable, enumerable and configurable properties
// Object.defineProperty() defines a new property directly on an object, or modifies an
// existing property on an object, and returns the object.
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
// Configurable: True if and only if the type of this property descriptor may be changed and if
// the property may be deleted from the corresponding object. Defaults to false.
//
// Enumerable: True if and only if this property shows up during enumeration of the properties on
// the corresponding object. Defaults to false.
//
// Writable: True if and only if the value associated with the property may be changed with an
// assignment operator. Defaults to false.
let Cpu = Object.create(Object.prototype);
// The Cpu object has a description property that is non-configurable and
// not writable but will show up on the enumerable properties of this object.
Object.defineProperty(Cpu, "description", {
value: "CPU or central processing unit carries out instructions of a computer program",
writable: false,
enumerable: true,
configurable: false,
});
console.log(Cpu.description); // => CPU or central processing unit carries out instructions of a computer program
// The cores property can be changed but it cannot be removed from the Cpu object.
// The cores property will default to undefined.
Object.defineProperty(Cpu, "cores", {
enumerable: true,
configurable: false,
get() {
return this.value;
},
set(value) {
this.value = value;
}
});
console.log(Cpu.cores); // => undefined
// Create a Cpu object based upon Cpu:
let AmdCpu = Object.create(Cpu);
console.log(AmdCpu.description); // => CPU or central processing unit carries out instructions of a computer program
console.log(AmdCpu.cores); // => undefined
AmdCpu.cores = 4;
console.log(AmdCpu.cores); // => 4
// You can get the writable, configurable, and enumerable values of a property for an object
// by calling Object.getOwnPropertyDescriptor() which returns a property descriptor for an
// own property (that is, one directly present on an object and not in the object's prototype
// chain) of a given object. In the case of the AmdCpu object we would not be able to get the
// cores property.
Object.defineProperty(AmdCpu, "company", {
writable: false,
configurable: false,
enumerable: true,
value: "Amd",
});
const descriptor = Object.getOwnPropertyDescriptor(AmdCpu, "company");
console.log(descriptor.writable); // => false
console.log(descriptor.configurable); // => false
console.log(descriptor.enumerable); // => true
// You can also prevent inherited properties:
// This creates an object as non enumerable, non configurable, not writable as defaults.
let obj = Object.create(null);
// If you want to prevent Object.defineProperty from throwing an error you can use
// Reflect.defineProperty which returns boolean. If the property is created true
// will be returned and if not false.
if (Reflect.defineProperty(Cpu, "description", {
writable: true,
configurable: true,
enumerable: true,
})) {
// The property was created. We won't get here since the original
// configurable and writable are both false.
console.log("The property was defined");
} else {
console.log("Could not define property");
} | 38.417476 | 116 | 0.7349 |
f234557451183befc4d3f762d88ada5fef8ce8b1 | 8,116 | js | JavaScript | index.js | Peter-Hebden-NCL/rhythm-tapper | d9ca3b42d031b34fe74e505e72ee5b2b100dbf9a | [
"MIT"
] | null | null | null | index.js | Peter-Hebden-NCL/rhythm-tapper | d9ca3b42d031b34fe74e505e72ee5b2b100dbf9a | [
"MIT"
] | null | null | null | index.js | Peter-Hebden-NCL/rhythm-tapper | d9ca3b42d031b34fe74e505e72ee5b2b100dbf9a | [
"MIT"
] | null | null | null | $(document).ready(function(){
weak = new Audio('tap-weak.mp3');
strong = new Audio('tap-strong.mp3');
playstate = "";
prev = ""
dur = 0;
sound = "";
pos = 0;
lapsed = 0;
line_pos = 0;
unstressed = 0;
primary = 0;
secondary = 0;
space = 0;
punctuation = 0;
line = 0;
poem_text = [];
// EXAMPLE TEXT - Each poem requires a stresses variable and a poem-text variable as shown below
string_1 = "0 10 1 0 1 0 1 0 1-0 1 01 0 1 0 10 1"
string_1_text = ["If music be the food of love, play on,","That strain again! it had a dying fall"];
// EXAMPLE SELECTION BUTTON - each poem requires one of these functions (SEE INDEX.HTML FOR PLACEMENT)
$("#string_1").click(function(){
if ( !($(this).hasClass("noclick")) ) {
$(".poet-select").addClass("noclick");
$(this).css({"color":"white"});
$("#stop").removeClass("hidden");
poem_text = string_1_text;
play_poem(string_1);
}
});
$("#minus-button").click(function(){
alter_speed("-");
});
$("#plus-button").click(function(){
alter_speed("+");
});
$("#show-text").click(function(){
if ($("#show-text").prop("checked") && playstate == "play") {
$("#line-display").removeClass("hidden");
} else {
$("#line-display").addClass("hidden");
}
});
$("#stop").click(function(){
playstate = "stop"
$(".poet-select").removeClass("noclick");
$(".poet-select").removeAttr("style");
$(this).addClass("hidden");
$("#the_dot").removeClass("big-dot med-dot little-dot");
$("#the_dot").addClass("hidden");
});
function get_sound(a) {
if (a == "0") {
return weak.play();
} else {
if (a == "1" || a == "2") {
return strong.play();
} else {
return false;
}
}
};
//no argument needed in this version (controls dictate speed rather than choice of poem)
function set_speed(p) {
unstressed = 300;
primary = 500;
secondary = 400;
space = 200;
punctuation = 400;
line = 400;
};
function alter_speed(sym) {
if (sym == "-") {
//either increase duration by 100ms or double value
if (unstressed >= 100) {
unstressed = unstressed + 100;
} else {
if (unstressed > 0.5) {
unstressed = Math.floor(unstressed * 2);
}
}
}
if (sym == "+") {
//either reduce duration by 100ms or halve value
if (unstressed > 100) {
unstressed = unstressed - 100;
} else {
if (unstressed > 0.5) {
unstressed = Math.floor(unstressed * 0.5);
}
}
}
//alter all other values
primary = Math.floor(unstressed * (5/3));
secondary = Math.floor(unstressed * (4/3));
space = Math.floor(unstressed * (2/3));
punctuation = Math.floor(unstressed * (4/3));
line = Math.floor(unstressed * (4/3));
console.log("unstressed: "+unstressed);
console.log("primary: "+primary);
console.log("secondary: "+secondary);
console.log("space: "+space);
console.log("punctuation: "+punctuation);
console.log("line: "+line);
}
function get_duration(a) {
if (a == "0") {
//unstressed
return unstressed;
}
if (a == "1") {
//primary stress
return primary;
}
if (a == "2") {
//secondary stress
return secondary;
}
if (a == " ") {
//word break
if (prev != "p") {
//space
return space;
} else {
//space after punctuation
//nopause
}
}
if (a == "p") {
//punctuation
return punctuation;
}
if (a == "-") {
//line break
if (prev != "p") {
//new line
return line;
} else {
//new line after punctuation
//nopause
}
}
};
function get_dot(a) {
if (a == "0") {
$("#the_dot").removeClass("hidden big-dot med-dot");
$("#the_dot").addClass("little-dot");
}
if (a == "1") {
$("#the_dot").removeClass("hidden little-dot med-dot");
$("#the_dot").addClass("big-dot");
}
if (a == "2") {
$("#the_dot").removeClass("hidden big-dot little-dot");
$("#the_dot").addClass("med-dot");
}
if (!(
a == "0" ||
a == "1" ||
a == "2"
)) {
$("#the_dot").removeClass("big-dot med-dot little-dot");
$("#the_dot").addClass("hidden");
}
}
function play_poem(poem) {
//state of play
playstate = "play";
//previous poem-code value
prev = ""
//set speed of poem
set_speed(poem);
//position (index) in the poem-code
pos = 0;
//duration of current beat (initially set to first beat)
dur = get_duration(poem[pos]);
//amount of time lapsed within current beat
lapsed = 0;
line_pos = 0;
console.log(poem_text[line_pos]);
$("#line-display").html(poem_text[line_pos]);
if ($("#show-text").prop("checked")) {
$("#line-display").removeClass("hidden");
} else {
$("#line-display").addClass("hidden");
}
//play initial beat sound
get_sound(poem[pos]);
//display initial beat dot
get_dot(poem[pos]);
var id = setInterval(frame, 100);
function frame() {
// Check - at the end of the poem code and the beat
if ( pos == (poem.length - 1) /*&& lapsed >= dur*/) {
playstate = "";
clearInterval(id);
$(".poet-select").removeClass("noclick");
$(".poet-select").removeAttr("style");
$("#the_dot").removeClass("big-dot med-dot little-dot");
$("#stop, #the_dot, #line-display").addClass("hidden");
} else {
// Check - stop button pressed
if (playstate == "stop") {
playstate = "";
clearInterval(id);
$(".poet-select").removeClass("noclick");
$(".poet-select").removeAttr("style");
$("#the_dot").removeClass("big-dot med-dot little-dot");
$("#stop, #the_dot, #line-display").addClass("hidden");
}
//move lapsed on by 100
lapsed = lapsed + 100;
//Check - move to next beat?
if (lapsed >= dur) {
prev = poem[pos];
pos = pos + 1;
dur = get_duration(poem[pos]);
lapsed = 0;
// Check - need to play sound for new beat?
if (
poem[pos] == "0" ||
poem[pos] == "1" ||
poem[pos] == "2"
) {
get_sound(poem[pos]);
}
//change dot for new beat
get_dot(poem[pos]);
//change text line if new line
if (poem[pos] == "-") {
line_pos = line_pos + 1;
console.log(poem_text[line_pos]);
$("#line-display").html(poem_text[line_pos]);
}
}
}
}
};
});
| 29.299639 | 106 | 0.433588 |
f235cf0562ee1808aa8fcd5bb4ecf4a4850ade72 | 2,944 | js | JavaScript | userfiles/templates/shopmag/js/functions.js | minhv1993/muahang | 11889e1702d8fc6c9a3fb1f82ceb1628b722667f | [
"Apache-2.0"
] | null | null | null | userfiles/templates/shopmag/js/functions.js | minhv1993/muahang | 11889e1702d8fc6c9a3fb1f82ceb1628b722667f | [
"Apache-2.0"
] | null | null | null | userfiles/templates/shopmag/js/functions.js | minhv1993/muahang | 11889e1702d8fc6c9a3fb1f82ceb1628b722667f | [
"Apache-2.0"
] | null | null | null | EqualHeight = function (selector) {
var max = 0, all = mw.$(selector), l = all.length, i = 0, j = 0;
for (; i < l; i++) {
var max = all[i].offsetHeight > max ? all[i].offsetHeight : max;
}
for (; j < l; j++) {
all[j].style.minHeight = max + 'px';
}
}
$(document).ready(function () {
$(window).bind('mw.cart.add', function (event, data) {
if (document.getElementById('AddToCartModal') === null) {
AddToCartModal = mw.modal({
content: AddToCartModalContent(data.product.title),
template: 'mw_modal_basic',
name: "AddToCartModal",
width: 400,
height: 200
});
}
else {
AddToCartModal.container.innerHTML = AddToCartModalContent(data.product.title);
}
});
$(window).bind('load resize', function () {
document.getElementById('content-master').style.minHeight = ($(window).height() - $('#footer').outerHeight()) + 'px';
});
document.getElementById('content-master').style.minHeight = ($(window).height() - $('#footer').outerHeight()) + 'px';
$(window).bind('load', function () {
var slider = $('#homeslider .magic-slider')[0];
if (typeof slider !== 'undefined') {
$(window).bind('scroll', function () {
if ($(window).scrollTop() > 0) {
slider.magicSlider.stopAutorotate()
}
else {
slider.magicSlider.autoRotate();
}
});
}
mw.onLive(function () {
$(document.body).click(function (e) {
if (mw.tools.hasClass(e.target, "mw-icon-changeble")) {
mw.iconSelector._activeElement = e.target;
mw.iconSelector.popup();
}
else if (mw.tools.hasParentsWithClass(e.target, "mw-icon-changeble")) {
mw.iconSelector._activeElement = e.target;
mw.iconSelector.popup();
}
else {
mw.iconSelector.hide();
}
});
});
});
$(".menu-button").bind('click', function () {
$(this).toggleClass('active');
});
$(".header-shopcarts-holder").hover(function (e) {
$(this).addClass('active');
$(this).addClass('hovered');
}, function () {
var el = $(this);
el.removeClass('hovered');
setTimeout(function () {
if (!el.hasClass('hovered')) {
el.removeClass('active');
}
}, 500);
});
$(document.body).bind('mousedown', function (e) {
if (!mw.tools.hasParentsWithClass(e.target, 'header-menu')) {
$('.menu-button.active').removeClass('active');
}
})
}); | 18.993548 | 125 | 0.473845 |
f235ff67f1fe7167a02877fa59edd2cea55ccecb | 845 | js | JavaScript | src/app.js | HeadassHouse/loremaster-backend | e3989a3b4fe447baf0643873b4d6c604eec2364d | [
"MIT"
] | null | null | null | src/app.js | HeadassHouse/loremaster-backend | e3989a3b4fe447baf0643873b4d6c604eec2364d | [
"MIT"
] | 19 | 2020-06-12T04:55:54.000Z | 2020-08-23T17:27:26.000Z | src/app.js | HeadassHouse/loremaster-backend | e3989a3b4fe447baf0643873b4d6c604eec2364d | [
"MIT"
] | null | null | null | const express = require('express');
const http = require('http');
const cors = require('cors');
const { ApolloServer } = require('apollo-server-express');
const { importSchema } = require('graphql-import');
const resolver = require('./resolvers/resolver');
const campaign = require('../jsonTemplates/campaign');
const createApp = () => {
const app = express();
app.use(cors());
app.use('/campaign', (_, res) => {
res.send(campaign);
});
const server = new ApolloServer({
typeDefs: importSchema('src/schemas/schema.graphql'),
resolvers: resolver,
subscriptions: {
onConnect: () => 'connected',
},
debug: false,
});
server.applyMiddleware({ app });
const httpServer = http.createServer(app);
server.installSubscriptionHandlers(httpServer);
return httpServer;
};
module.exports = createApp;
| 24.142857 | 58 | 0.665089 |
f23621737b2d96c6c3e610579bee207cc10cb787 | 850 | js | JavaScript | app.js | rgalicia0729/chat_express | eef455f610bd0436b78c4b254e20afa368f99275 | [
"MIT"
] | null | null | null | app.js | rgalicia0729/chat_express | eef455f610bd0436b78c4b254e20afa368f99275 | [
"MIT"
] | null | null | null | app.js | rgalicia0729/chat_express | eef455f610bd0436b78c4b254e20afa368f99275 | [
"MIT"
] | null | null | null | const express = require('express');
const cors = require('cors');
const mongoose = require('mongoose');
const path = require('path');
const { Modules } = require('./modules/chat.modules');
const { PORT, URI_MONGODB } = require('./env');
const app = express();
app.use(cors());
app.use(express.json());
// Configuración de socket service
const server = require('http').createServer(app);
module.exports.io = require('socket.io')(server);
require('./modules/sockets/socket_service');
// Public files
const publicPath = path.resolve(__dirname, 'public');
app.use(express.static(publicPath));
// Add modules
const modules = new Modules(app);
modules.addModules();
// Conexión con mongodb
mongoose.connect(URI_MONGODB);
server.listen(PORT, (err) => {
if (err) throw new Error(err);
console.log(`Servidor corriendo en el puerto: ${PORT}`);
});
| 25 | 58 | 0.702353 |
f2388bde4d1fdd916c954318da4eb376931d2566 | 2,322 | js | JavaScript | lib/React/Widgets/QueryDataModelWidget/index.js | fullflavedave/paraviewweb-es5 | f8fc10efd3242a3d7be5424b8a06b234fc88c1c2 | [
"BSD-3-Clause"
] | null | null | null | lib/React/Widgets/QueryDataModelWidget/index.js | fullflavedave/paraviewweb-es5 | f8fc10efd3242a3d7be5424b8a06b234fc88c1c2 | [
"BSD-3-Clause"
] | null | null | null | lib/React/Widgets/QueryDataModelWidget/index.js | fullflavedave/paraviewweb-es5 | f8fc10efd3242a3d7be5424b8a06b234fc88c1c2 | [
"BSD-3-Clause"
] | null | null | null | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _QueryDataModelWidget = require('PVWStyle/ReactWidgets/QueryDataModelWidget.mcss');
var _QueryDataModelWidget2 = _interopRequireDefault(_QueryDataModelWidget);
var _String = require('./String');
var _String2 = _interopRequireDefault(_String);
var _Number = require('./Number');
var _Number2 = _interopRequireDefault(_Number);
var _DataListenerMixin = require('./DataListenerMixin');
var _DataListenerMixin2 = _interopRequireDefault(_DataListenerMixin);
var _DataListenerUpdateMixin = require('./DataListenerUpdateMixin');
var _DataListenerUpdateMixin2 = _interopRequireDefault(_DataListenerUpdateMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* This React component expect the following input properties:
* - model:
* Expect a QueryDataModel instance.
* - listener:
* Expect a Boolean based on the automatic data model registration for listening.
* Default value is true and false for the sub components.
*/
exports.default = _react2.default.createClass({
displayName: 'QueryDataModelWidget',
propTypes: {
model: _react2.default.PropTypes.object
},
mixins: [_DataListenerMixin2.default, _DataListenerUpdateMixin2.default],
render: function render() {
var model = this.props.model,
args = model.originalData.arguments,
orderList = model.originalData.arguments_order.filter(function (name) {
return args[name].values.length > 1;
});
return _react2.default.createElement(
'div',
{ className: _QueryDataModelWidget2.default.container },
orderList.map(function (name) {
if (model.getUiType(name) === 'list') {
return _react2.default.createElement(_String2.default, {
key: name,
model: model,
arg: name,
listener: false
});
} else if (model.getUiType(name) === 'slider') {
return _react2.default.createElement(_Number2.default, {
key: name,
model: model,
arg: name,
listener: false
});
}
return null;
})
);
}
}); | 28.666667 | 95 | 0.675711 |
f238e42c4df025ad2ba0ca2622dc23f1edf6ef7c | 478 | js | JavaScript | dist-mdi/mdi/table-of-contents.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | dist-mdi/mdi/table-of-contents.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | dist-mdi/mdi/table-of-contents.js | maciejg-git/vue-bootstrap-icons | bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec | [
"MIT",
"CC-BY-4.0",
"MIT-0"
] | null | null | null | import { h } from 'vue'
export default {
name: "TableOfContents",
vendor: "Mdi",
type: "",
tags: ["table","of","contents"],
render() {
return h(
"svg",
{"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-table-of-contents","innerHTML":"<path d='M3,9H17V7H3V9M3,13H17V11H3V13M3,17H17V15H3V17M19,17H21V15H19V17M19,7V9H21V7H19M19,13H21V11H19V13Z' />"},
)
}
} | 36.769231 | 294 | 0.633891 |
f239970ac93ee1958491ba0dcd168d3f7442fd0e | 997 | js | JavaScript | src/Widgets.js | ZakiRangwala/LinkedIn-Clone | 295a896d5d8728ac72da97eeead1136b9f74797c | [
"MIT"
] | 2 | 2021-04-02T00:44:04.000Z | 2021-07-22T06:15:55.000Z | src/Widgets.js | ZakiRangwala/LinkedIn-Clone | 295a896d5d8728ac72da97eeead1136b9f74797c | [
"MIT"
] | null | null | null | src/Widgets.js | ZakiRangwala/LinkedIn-Clone | 295a896d5d8728ac72da97eeead1136b9f74797c | [
"MIT"
] | null | null | null | import React from "react";
import InfoIcon from "@material-ui/icons/Info";
import FiberManualRecordIcon from "@material-ui/icons/FiberManualRecord";
import "./Widgets.css";
function Widgets() {
const newsArticle = (heading, subtitle) => (
<div className="widgets__article">
<div className="widgets__articleLeft">
<FiberManualRecordIcon />
</div>
<div className="widgets__articleRight">
<h4>{heading}</h4>
<p>{subtitle}</p>
</div>
</div>
);
return (
<div className="widgets">
<div className="widgets__header">
<h2>LinkedIn News</h2>
<InfoIcon />
</div>
{newsArticle("Coronavirus Cases","The death toll is on the rise - 10K readers")}
{newsArticle("The Empire Strikes Back","Star Wars movie cancelled by the people - 4K readers")}
{newsArticle("Merry Christmas","Everyone worldwide experiences their first lockdown christmas - 2K readers")}
</div>
);
}
export default Widgets;
| 29.323529 | 115 | 0.651956 |
f23a37e24cde04805f6dd751b151bfb5f9c1b050 | 445 | js | JavaScript | config/environments/production.js | oss-spanish-geoserver/cartodb-requests-counter | 9dda801d7f0e1eca0be457ab3b63e21c028fe397 | [
"BSD-4-Clause"
] | null | null | null | config/environments/production.js | oss-spanish-geoserver/cartodb-requests-counter | 9dda801d7f0e1eca0be457ab3b63e21c028fe397 | [
"BSD-4-Clause"
] | null | null | null | config/environments/production.js | oss-spanish-geoserver/cartodb-requests-counter | 9dda801d7f0e1eca0be457ab3b63e21c028fe397 | [
"BSD-4-Clause"
] | 1 | 2019-06-10T17:57:42.000Z | 2019-06-10T17:57:42.000Z | module.exports.node_port = 8080;
module.exports.node_host = '127.0.0.1';
module.exports.environment = 'production';
module.exports.redis_host = '127.0.0.1';
module.exports.redis_port = 6379;
module.exports.redisPool = 50;
module.exports.redisIdleTimeoutMillis = 10000;
module.exports.redisReapIntervalMillis = 1000;
module.exports.redisLog = false;
| 44.5 | 54 | 0.61573 |
ea1e7bb984fd97bf2603615a7e194746f5e3f9b4 | 3,624 | js | JavaScript | src/components/Post/PostAddEdit/PostAddEdit.js | gfrancischini/p2-reactnd-project-readable | 144bfc37997def75921f55567ffac19b02fc75ff | [
"MIT"
] | null | null | null | src/components/Post/PostAddEdit/PostAddEdit.js | gfrancischini/p2-reactnd-project-readable | 144bfc37997def75921f55567ffac19b02fc75ff | [
"MIT"
] | 1 | 2018-04-12T21:10:13.000Z | 2021-12-05T20:48:40.000Z | src/components/Post/PostAddEdit/PostAddEdit.js | gfrancischini/p2-reactnd-project-readable | 144bfc37997def75921f55567ffac19b02fc75ff | [
"MIT"
] | null | null | null | import React from 'react'
import PropTypes from 'prop-types';
import { AlertBox } from 'components/Common';
import { PostCategorySelection } from './PostCategorySelection'
export class PostAddEdit extends React.Component {
constructor() {
super();
this.state = {
title: null,
body: null,
category: null,
error: null
}
}
componentWillReceiveProps(newProps) {
if (newProps.post) {
this.setState({
title: newProps.post.title,
body: newProps.post.body,
category: newProps.post.category
})
}
}
handleTitleChange = (e) => {
this.setState({
title: e.target.value
});
}
handleBodyChange = (e) => {
this.setState({
body: e.target.value
});
}
handleCategoryChange = (category) => {
console.log("handleCategoryChange= " + category);
this.setState({
category
});
}
handleNewPostButtonClick = (e) => {
e.preventDefault();
const { title, body, category } = this.state;
const errors = [];
if (!title) {
errors.push("You must fill the title.");
}
if (!body) {
errors.push("You must fill the body.");
}
if (errors.length > 0) {
this.setState({ error: { title: "Please check the following errors:", messages: errors } });
return;
}
this.props.handleNewPostButtonClick(title, body, category);
}
render() {
let renderError = null;
if (this.state.error) {
renderError = <AlertBox type="error" title={this.state.error.title} messages={this.state.error.messages} />
}
const submitButtonTitle = this.props.idEdition ? "Save Your Post" : "Publish Your Post";
return (
<div className="page-content ask-question">
<div className="boxedtitle page-title"><h2>Create a Post</h2></div>
<p>Duis dapibus aliquam mi, eget euismod sem scelerisque ut. Vivamus at elit quis urna adipiscing iaculis. Curabitur vitae velit in neque dictum blandit. Proin in iaculis neque.</p>
<div className="form-style form-style-3" id="question-submit">
<form>
<div className="form-inputs clearfix">
<p>
<label className="required">Post Title<span>*</span></label>
<input onChange={this.handleTitleChange} type="text" id="question-title" value={this.state.title || ''} />
<span className="form-description">Please choose an appropriate title for the post.</span>
</p>
<p>
<label className="required">Category<span>*</span></label>
<span className="styled-select">
<PostCategorySelection categories={this.props.categories}
currentCategory={this.state.category}
handleCategoryChange={this.handleCategoryChange} />
</span>
<span className="form-description">Please choose the appropriate section so easily search for your post.</span>
</p>
</div>
<div id="form-textarea">
<p>
<label className="required">Details<span>*</span></label>
<textarea style={{ "whiteSpace": "pre-wrap" }} onChange={this.handleBodyChange} id="question-details" aria-required="true" cols="58" rows="8" value={this.state.body || ''} />
<span className="form-description">Type the description thoroughly and in detail .</span>
</p>
</div>
{renderError}
<p className="form-submit">
<input disabled={this.props.isProcessing} onClick={this.handleNewPostButtonClick} type="submit" id="publish-question" value={submitButtonTitle} className="button color small submit" />
</p>
</form>
</div>
</div>
)
}
}
PostAddEdit.propTypes = {
/**
* handleCommentButtonClick
*/
handleNewPostButtonClick: PropTypes.func.isRequired
} | 27.454545 | 191 | 0.652042 |
ea1faea9e481ca03094ad6a0d61e82146693d7e7 | 2,022 | js | JavaScript | front-end/plugins/base/js/features/utils/_thread_settings_menu_decoration.js | HewlettPackard/Loom | e26c6c8cf36f631b6adac93309bb6cb7df8ba980 | [
"Apache-2.0"
] | 5 | 2017-08-24T10:11:29.000Z | 2019-04-08T01:55:59.000Z | front-end/plugins/base/js/features/utils/_thread_settings_menu_decoration.js | HewlettPackard/Loom | e26c6c8cf36f631b6adac93309bb6cb7df8ba980 | [
"Apache-2.0"
] | 4 | 2017-07-11T21:46:27.000Z | 2017-07-21T03:55:20.000Z | front-end/plugins/base/js/features/utils/_thread_settings_menu_decoration.js | HewlettPackard/Loom | e26c6c8cf36f631b6adac93309bb6cb7df8ba980 | [
"Apache-2.0"
] | 2 | 2018-04-01T18:32:24.000Z | 2022-02-18T07:04:24.000Z | /*******************************************************************************
* (c) Copyright 2017 Hewlett Packard Enterprise Development LP Licensed under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
* may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
define(["require", "exports", 'jquery', 'weaver/views/ThreadSettingsMenu', '../../common/utils/DisplayModeMenu'], function (require, exports, $, ThreadSettingsMenu, DisplayModeMenu) {
var originalInitialize = ThreadSettingsMenu.prototype.initialize;
function addButton(css, name, style) {
style = style || "";
return $('<div class="mas-threadSettingsMenu--item mas-menu ' + css + ' mas-menu-expandsDown mas-menu-rightAligned">' + '<div class="mas-menu--toggle mas-button-leftIcon" ' + style + '>' + name + '</div>' + '</div>');
}
;
ThreadSettingsMenu.prototype.initialize = function () {
originalInitialize.apply(this, arguments);
this.$('.mas-menu--content:first-child').prepend(addButton('mas-displayMenu', 'Display Mode', 'style="display: flex"'));
/*this._addButton('mas-mapMenu', 'Distortion');
this.mapMenu = new MapMenu({
model: this.model,
el: this.$('.mas-mapMenu'),
});*/
this.displayModeMenu = new DisplayModeMenu({
model: this.model,
el: this.$('.mas-displayMenu')
});
};
var decorate = function () {
};
return decorate;
});
//# sourceMappingURL=_thread_settings_menu_decoration.js.map | 56.166667 | 225 | 0.616716 |
ea1fd0df99f0182fd65af3a14136aa5654b89077 | 201 | js | JavaScript | src/routes/hello-world.js | glanderson42/express-rest-skeleton | d7f564061bd9528afb71d340c609bc1c00dbf71f | [
"MIT"
] | null | null | null | src/routes/hello-world.js | glanderson42/express-rest-skeleton | d7f564061bd9528afb71d340c609bc1c00dbf71f | [
"MIT"
] | null | null | null | src/routes/hello-world.js | glanderson42/express-rest-skeleton | d7f564061bd9528afb71d340c609bc1c00dbf71f | [
"MIT"
] | null | null | null | module.exports = (app, express) => {
const router = express.Router();
// eslint-disable-next-line global-require
router.get('/', require('../controllers/hello-world/get'));
return router;
};
| 22.333333 | 61 | 0.661692 |
ea21833b797dfdb8629ebc0646b8f70e350f0f41 | 1,206 | js | JavaScript | example/client.js | joway/socket.io-kfk | c6dc646c02948dab96f2687ad865df989696fc12 | [
"MIT"
] | 3 | 2019-01-26T15:20:40.000Z | 2019-04-10T17:18:45.000Z | example/client.js | joway/socket.io-kfk | c6dc646c02948dab96f2687ad865df989696fc12 | [
"MIT"
] | 1 | 2020-02-11T02:13:41.000Z | 2020-02-11T02:42:33.000Z | example/client.js | joway/socket.io-kfk | c6dc646c02948dab96f2687ad865df989696fc12 | [
"MIT"
] | null | null | null | const io = require('socket.io-client')
const manager1 = new io.Manager('http://localhost:7777', {
transportOptions: { polling: { extraHeaders: { id: '1' } } },
})
const manager2 = new io.Manager('http://localhost:8888', {
transportOptions: { polling: { extraHeaders: { id: '2' } } },
})
const nsp1 = manager1.socket('/nsp')
const nsp2 = manager2.socket('/nsp')
nsp1.on('connect', function(e) {
console.log('1 connected')
})
nsp1.on('connect', function(e) {
console.log('2 connected')
})
nsp1.on('callback', function(data) {
console.log('user 1 get data: ', data)
})
nsp2.on('callback', function(data) {
console.log('user 2 get data: ', data)
})
const begin = new Date()
for (let i = 0; i < 5000; i++) {
const rand = Math.random()
.toString(36)
.substring(7)
if (i % 4 === 0) {
const msg = 'user 1 send: 中文'
nsp1.emit('event', msg)
} else if (i % 4 === 1) {
const msg = 'user 2 send: 中文'
nsp2.emit('event', msg)
} else if (i % 4 === 2) {
const msg = '2|user 1 send: 中文 to user 2'
nsp1.emit('exchange', msg)
} else {
const msg = '1|user 2 send: 中文 to user 1'
nsp2.emit('exchange', msg)
}
}
const end = new Date()
console.log(end - begin)
| 24.612245 | 63 | 0.597015 |
ea21906f1b5f2fb2fcccf9fcc43562a4d646828e | 19,493 | js | JavaScript | service/task/service/taskService.js | heyuguan/vue-koa | f6d839b27f01f492ce5394ed37ebd9a8e33ddf86 | [
"Apache-2.0"
] | 2 | 2019-03-08T05:37:47.000Z | 2019-03-08T05:37:51.000Z | service/task/service/taskService.js | heyuguan/vue-koa | f6d839b27f01f492ce5394ed37ebd9a8e33ddf86 | [
"Apache-2.0"
] | 2 | 2020-07-16T19:14:56.000Z | 2021-05-08T06:46:40.000Z | service/task/service/taskService.js | heyuguan/vue-koa | f6d839b27f01f492ce5394ed37ebd9a8e33ddf86 | [
"Apache-2.0"
] | null | null | null |
var crypto = require('crypto');
var logger = require("../../../models").logger;
var _ = require('lodash');
var Dao = require("../../../models/mongo/MongoDao");
var db = require("../../../models").mongo;
var xl = require('excel4node');
var fs = require('fs');
var tableService = require('../../table/service/tableService');
var statisticsService = require('../../statistics/service/statisticsService');
var emrService = require('../../emr/service/emrService');
var myDao = require('../dao/taskDao');
var dataInfoDBName = "task_data_";
const path = require('path');
var config = require('../../../config');
const util = require('util');
var zipper = require("zip-local");
var moment = require('moment');
var s = {
// 获取列表
PageList: async function (pageIndex, pageSize, query) {
var q = {};
if (query && query.ent_status !== undefined && query.ent_status != "") {
q.ent_status = query.ent_status;
}
if (query && query.status !== undefined && query.status != "") {
q.status = query.status;
}
if (query && query.name) {
q = { name: { $regex: new RegExp(query.name) } };
}
// if (query && query.data_source_id !== undefined) {
// q.data_source_id = query.data_source_id;
// }
return await myDao.pageList(pageIndex, pageSize, q, { create_date: 1 });
},
PageListname: async function (pageIndex, pageSize, query) {
return await myDao.pageList(pageIndex, pageSize, query, { create_date: 1 });
},
// 根据ID获取
findById: async function (query) {
return await myDao.findById2(query);
},
find: async function (query, options) {
return await myDao.find(query, options);
},
// 新建
add: async function (query, data_source_id) {
return await myDao.insert(query);
},
// 更新
update: async function (query, data_source_id) {
return await myDao.update2(query);
},
// 导出数据任务--提取数据到mongoDB
exportData: async function (data) {
var info_id = data.info_id;
if (!info_id) {
var _po = {};
_po.id = data.id;
_po.status = "-1";
_po.stop_cause = "参数错误";
await myDao.update2(_po);
// ctx.json(api.error("参数错误"));
return;
}
var tableId = data.tableId;
logger.info("##-->>" + JSON.stringify(data));
var info = await statisticsService.dbInfoById(info_id);
var entTable = await tableService.findTableById(tableId);
if (!entTable) {
var _po = {};
_po.id = data.id;
_po.status = "-1";
_po.stop_cause = "数据未找到";
await myDao.update2(_po);
// ctx.json(api.error("数据未找到:" + tableId));
return;
}
if (!data.hospital_id) {
var _po = {};
_po.id = data.id;
_po.status = "-1";
_po.stop_cause = "医院ID未找到";
await myDao.update2(_po);
return;
}
var search = {};
if (data.search != "") {
search = JSON.parse(data.search);
}
var fieldList = await tableService.findFieldListByTableId(tableId);
var dataList = await emrService.pageList(info, entTable, 1, 1, search);
var total = dataList.total;
// 更新进度;
var _po = {};
_po.id = data.id;
_po.status = "2";
_po.execute_data = new Date();
_po.stop_cause = "";
_po.dataTotal = total;
await myDao.update2(_po);
var pageCount = parseInt((total + 20 - 1) / 20);
logger.info("##-->>pageCount=" + pageCount);
for (var page = data.page || 1; page <= pageCount; page++) {
var _data = await this.findById(data);
if ((_data.is_stop && _data.is_stop == "1") || (_data.ent_status && _data.ent_status == "1")) {
// 判断是否停止提取任务;
var _po = {};
_po.id = data.id;
_po.status = "0";
_po.page = page;
_po.execute_data = new Date();
_po.stop_cause = "";
_po.dataTotal = total;
await myDao.update2(_po);
return;
}
{
var list = await emrService.pageList(info, entTable, page, 20, search);
var m = 1;
for (var j in list.items) {
var ent = list.items[j];
var _query = {};
_query.info = info;
_query.entTable = entTable;
_query.data_id = ent.id;
_query.task_id = data.id;
_query.table_id = tableId;
await s.outData(_query);
// 更新进度;
var progress = ((((page - 1) * 20 + m) / total) * 100).toFixed(2);
logger.info("##-->>progress" + progress);
var _po = {};
_po.progress = "查询:" + progress + "%|导出:0%";
_po.id = data.id;
_po.status = "2";
_po.page = page;
_po.execute_data = new Date();
_po.stop_cause = "";
_po.dataTotal = total;
await myDao.update2(_po);
m++;
}
// // 更新进度;
// var progress = ((page / pageCount) * 100).toFixed(2);
// logger.info("##-->>progress" + progress);
// var _po = {};
// _po.progress = "查询:" + progress + "%|导出:0%";
// _po.id = data.id;
// _po.status = "2";
// _po.page = page;
// _po.execute_data = new Date();
// _po.stop_cause = "";
// _po.dataTotal = total;
// await myDao.update2(_po);
}
}
var _po = {};
_po.progress = "查询:100%|导出:0%";
_po.id = data.id;
_po.status = "2";
_po.page = pageCount + 1;
_po.execute_data = new Date();
_po.stop_cause = "";
_po.dataTotal = total;
await myDao.update2(_po);
await s.exportFile(data);
},
outData: async function (query) {
var info = query.info;
var entTable = query.entTable;
var data_id = query.data_id;
var task_id = query.task_id;
var table_id = query.table_id;
var parentObj = await emrService.findById(info, entTable, data_id);
if (!parentObj) {
ctx.json(api.error("parentObj is null!"));
return;
}
var fieldList = await tableService.findFieldListByTableId(table_id);
var parentData = await o.outParent(entTable, fieldList, parentObj, task_id);
await o.outChilds(info, parentObj, table_id, task_id, parentData);
},
// 导出文件任务--将数据写入文件;
exportFile: async function (data) {
var entTable = await tableService.findTableById(data.tableId);
var tableChilds = await tableService.tableList({ parent_id: data.tableId });
var wb = new xl.Workbook();
await outSaveFile.outParent(wb, entTable, tableChilds.length, 1, data);
await outSaveFile.outChilds(wb, tableChilds, data);
// 保存文件
var buffer = await outSaveFile.out(wb);
let fileData = new Buffer(buffer, 'binary');
var file_name = data.id + '.xlsx';
var output_path = config.output_path;
if (!fs.existsSync(output_path)) {
fs.mkdirSync(output_path);
}
var export_path = path.join(output_path, data.id);
if (!fs.existsSync(export_path)) {
fs.mkdirSync(export_path);
}
var filePath = export_path + '/' + file_name;
var file_path = path.join(export_path, file_name);
if (fs.existsSync(file_path)) {
fs.unlinkSync(file_path);
}
try {
fs.writeFileSync(filePath, fileData, (err) => {
if (err) {
logger.error("error:::===>", err);
}
console.log(patientName + '...保存完毕');
});
} catch (e) {
emdata.logger.error(e);
}
// 压缩文件
var zipName = data.id + ".zip";
var file_path_zip = path.join(output_path, zipName);
if (fs.existsSync(file_path_zip)) {
fs.unlinkSync(file_path_zip);
}
var buff = zipper.sync.zip(export_path).compress();
buff.save(output_path + "/" + zipName);
var _po = {};
_po.id = data.id;
_po.progress = "查询:100%|导出:100%";
_po.status = "1";
_po.execute_data = new Date();
_po.stop_cause = "";
_po.file = zipName;
await myDao.update2(_po);
}
};
var o = {
outParent: async function (entTable, fieldList, parentObj, task_id) {
var data = {};
var r = 2;
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
if (parentObj.hasOwnProperty(field.field_name)) {
var val = parentObj[field.field_name];
logger.info("##-->>val=" + val);
if (val) {
if (field.data_type == 'date') {
data[fieldList[i].title] = val;
} else {
if (val != "")
data[fieldList[i].title] = val + '';
}
}
} else {
logger.warn(field.title);
}
}
var _myDao = new Dao(db, dataInfoDBName + entTable.table_name);
data.task_id = task_id;
var result = _myDao.find(data);
if (!result.task_id) {
await _myDao.insert(data);
}
return data;
},
outChild: async function (entTable, fieldList, objList, task_id, parentData) {
var r = 2;
for (var j = 0; j < objList.length; j++) {
var obj = objList[j];
var data = {};
if (parentData && parentData.住院号) {
data["住院号"] = parentData.住院号;
}
if (parentData && parentData.记录号) {
data["记录号"] = parentData.记录号;
}
if (parentData && parentData.病区) {
data["病区"] = parentData.病区;
}
if (parentData && parentData.科室) {
data["科室"] = parentData.科室;
}
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
if (obj.hasOwnProperty(field.field_name)) {
var val = obj[field.field_name];
if (val) {
if (field.data_type == 'date') {
data[fieldList[i].title] = val;
} else {
data[fieldList[i].title] = val + '';
}
}
} else {
logger.warn(field.title);
}
}
var _myDao = new Dao(db, dataInfoDBName + entTable.table_name);
data.task_id = task_id;
var result = _myDao.find(data);
if (!result.task_id)
await _myDao.insert(data);
r++;
}
},
outChilds: async function (info, obj, parent_id, task_id, parentData) {
var _this = this;
var tableChilds = await tableService.tableList({ parent_id: parent_id });
for (var i = 0; i < tableChilds.length; i++) {
var tableChild = tableChilds[i];
var child_table_id = tableChild._id + '';
var fileListChld = await tableService.findFieldListByTableId(child_table_id);
logger.info("##-->>" + JSON.stringify(tableChild.data_id_key));
var q = {};
if (tableChild.data_id_key !== undefined) {
var vals = JSON.parse(tableChild.data_id_key);
for (var key in vals) {
var val = obj[key];
q[vals[key]] = val;
}
}
var objList = await emrService.findData(info, tableChild, q, {});
var sub_tableChild = await tableService.tableList({ parent_id: child_table_id });
if (sub_tableChild.length > 0) {
var sub_tableChild = sub_tableChild[0];
var sub_child_table_id = sub_tableChild._id + '';
var sub_fileListChld = await tableService.findFieldListByTableId(sub_child_table_id);
var sub_vals = JSON.parse(sub_tableChild.data_id_key);
var sub_obj_list = [];
for (var m in objList) {
var item = objList[m];
var sub_q = {};
for (var key in sub_vals) {
var val = item[key];
sub_q[sub_vals[key]] = val;
}
var sub_objList = await emrService.findData(info, sub_tableChild, sub_q, {});
for (var j in sub_objList) {
var sub_item = sub_objList[j];
for (var k in fileListChld) {
var p = fileListChld[k].field_name;
sub_item[p] = item[p];
}
logger.warn(sub_item);
sub_obj_list.push(sub_item);
}
}
for (var k in sub_fileListChld) {
fileListChld.push(sub_fileListChld[k]);
}
await _this.outChild(tableChild, fileListChld, sub_obj_list, task_id, parentData);
} else {
await _this.outChild(tableChild, fileListChld, objList, task_id, parentData);
}
}
}
};
var outSaveFile = {
out: async function (wb) {
return new Promise(function (resolve, reject) {
wb.writeToBuffer().then(function (buffer) {
return resolve(buffer);
});
});
},
outParent: async function (wb, entTable, fileTotal, fileIndex, data) {
var m = 1;
var _wb;
var ws;
var _myDao = new Dao(db, dataInfoDBName + entTable.table_name);
var q = { task_id: data.id };
var dataList = await _myDao.pageList(1, 1, q);
var total = dataList.total;
if (total < 1){
return;
}
if (total > 2000 && total > (data.dataTotal + 100)) {
_wb = new xl.Workbook();
ws = _wb.addWorksheet(entTable.title);
} else {
ws = wb.addWorksheet(entTable.title);
}
var pageCount = parseInt((total + 20 - 1) / 20);
var r = 1;
var fieldList = [];
for (var page = 1; page <= pageCount; page++) {
if (page > 250 * m) {
if (_wb) {
await this.saveFile(_wb, data, entTable, m);
m++;
_wb = new xl.Workbook();
ws = _wb.addWorksheet(entTable.title);
}
}
var list = await _myDao.pageList(1, 20, q);
for (var j in list.items) {
var ent = list.items[j];
if (r == 1) {
for (var key in ent) {
if (key && key != "task_id" && key != "_id")
fieldList.push(key);
}
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
ws.cell(r, i + 1).string(field);
}
r++;
}
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
var val = ent[field];
if (util.isDate(val)) {
ws.cell(r, i + 1).date(val);
} else if (util.isString(val)) {
ws.cell(r, i + 1).string(val);
} else if (util.isNumber(val)) {
ws.cell(r, i + 1).string(val + "");
} else if (util.isUndefined(val)) {
ws.cell(r, i + 1).string("");
} else {
ws.cell(r, i + 1).string("未知字段类型:" + JSON.stringify(val));
}
}
r++;
}
// 更新进度;
var progress = ((page / pageCount) * 100).toFixed(2);
logger.info("##-->>progress" + progress);
var _po = {};
_po.id = data.id;
_po.status = "2";
_po.progress = "查询:100%|导出:" + fileIndex + "(" + progress + "%)/" + fileTotal;
_po.execute_data = new Date();
_po.stop_cause = "";
await myDao.update2(_po);
}
if (_wb) {
await this.saveFile(_wb, data, entTable, m);
}
},
outChilds: async function (wb, tableChilds, data) {
var _this = this;
for (var i = 0; i < tableChilds.length; i++) {
var _data = await s.findById(data);
if ((_data.is_stop && _data.is_stop == "1") || (_data.ent_status && _data.ent_status == "1")) {
// 判断是否停止任务;
var _po = {};
_po.id = data.id;
_po.status = "0";
_po.execute_data = new Date();
_po.stop_cause = "";
await myDao.update2(_po);
return;
}
var tableChild = tableChilds[i];
await _this.outParent(wb, tableChild, tableChilds.length, i + 2, data);
}
},
saveFile: async function (wb, data, entTable, i) {
// 保存文件
var buffer = await this.out(wb);
let fileData = new Buffer(buffer, 'binary');
var file_name = data.id + "_" + entTable.table_name + "_" + i + '.xlsx';
var output_path = config.output_path;
if (!fs.existsSync(output_path)) {
fs.mkdirSync(output_path);
}
var export_path = path.join(output_path, data.id);
if (!fs.existsSync(export_path)) {
fs.mkdirSync(export_path);
}
var filePath = export_path + '/' + file_name;
var file_path = path.join(export_path, file_name);
if (fs.existsSync(file_path)) {
fs.unlinkSync(file_path);
}
try {
fs.writeFileSync(filePath, fileData, (err) => {
if (err) {
logger.error("error:::===>", err);
}
console.log(patientName + '...保存完毕');
});
} catch (e) {
emdata.logger.error(e);
}
},
deleteFolderRecursive: async function(path) {
if( fs.existsSync(path) ) {
fs.readdirSync(path).forEach(function(file) {
var curPath = path + "/" + file;
if(fs.statSync(curPath).isDirectory()) { // recurse
outSaveFile.deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
};
module.exports = s; | 37.924125 | 107 | 0.470887 |
ea227fdbc4688e82fdbc2c130297029a64a311bb | 887 | js | JavaScript | src/hooks/useIndex.js | facubrusa/realestatefrontend | 208dee1d894d38f23a95ae8f92a5f61650d2214e | [
"RSA-MD"
] | null | null | null | src/hooks/useIndex.js | facubrusa/realestatefrontend | 208dee1d894d38f23a95ae8f92a5f61650d2214e | [
"RSA-MD"
] | null | null | null | src/hooks/useIndex.js | facubrusa/realestatefrontend | 208dee1d894d38f23a95ae8f92a5f61650d2214e | [
"RSA-MD"
] | null | null | null | import { graphql, useStaticQuery } from "gatsby";
const useIndex = () => {
const response = useStaticQuery(graphql`
query {
allStrapiPages( filter: { name: { eq: "Home" }}) {
nodes {
id
name
content
image {
localFile {
childImageSharp {
fluid( maxWidth: 1920 duotone: {
highlight: "#222222", shadow: "#192550", opacity: 30
}) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
}
}
}
`);
return response.allStrapiPages.nodes[0];
}
export default useIndex; | 29.566667 | 84 | 0.35062 |
ea27288b7dc6281c966e18afa589f96abd9ae1b8 | 163 | js | JavaScript | src/freeCodeCamp/palindrome-checker.js | zweimach/wiyata.js | 7aeb8c3b4f421a4c4bb36429693d9bbb07c8a446 | [
"MIT"
] | null | null | null | src/freeCodeCamp/palindrome-checker.js | zweimach/wiyata.js | 7aeb8c3b4f421a4c4bb36429693d9bbb07c8a446 | [
"MIT"
] | null | null | null | src/freeCodeCamp/palindrome-checker.js | zweimach/wiyata.js | 7aeb8c3b4f421a4c4bb36429693d9bbb07c8a446 | [
"MIT"
] | null | null | null | export function palindrome(str) {
const cleanStr = str.replace(/[^0-9a-z]/gi, "").toLowerCase();
return cleanStr === cleanStr.split("").reverse().join("");
}
| 27.166667 | 64 | 0.644172 |
ea2a0ed8402382b7473bc210599d5ddb02a43043 | 450 | js | JavaScript | app/index.js | jgoday/react_template | 52f234b69c928cf97adaa7fa6ea26d9ea9af7746 | [
"MIT"
] | null | null | null | app/index.js | jgoday/react_template | 52f234b69c928cf97adaa7fa6ea26d9ea9af7746 | [
"MIT"
] | null | null | null | app/index.js | jgoday/react_template | 52f234b69c928cf97adaa7fa6ea26d9ea9af7746 | [
"MIT"
] | null | null | null | import React from "react"
import ReactDOM from "react-dom"
import {Router, Route, IndexRoute, browserHistory} from "react-router"
import App from "./components/App"
import Message from "./components/Message"
import "./less/main.less"
const routes =
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path="/message/:id" />
</Route>
</Router>
ReactDOM.render(
routes,
document.getElementById("main")) | 23.684211 | 70 | 0.697778 |
ea2a1a7b48e80c033df8db714924c16465b5572c | 147 | js | JavaScript | src/Service/MapDataService.js | paperlapap78/react-map | 59067318c8dbbf19bf694db93de58fb0e9554d1d | [
"BSD-3-Clause"
] | null | null | null | src/Service/MapDataService.js | paperlapap78/react-map | 59067318c8dbbf19bf694db93de58fb0e9554d1d | [
"BSD-3-Clause"
] | null | null | null | src/Service/MapDataService.js | paperlapap78/react-map | 59067318c8dbbf19bf694db93de58fb0e9554d1d | [
"BSD-3-Clause"
] | null | null | null | import mapData from '../Service/map-data.json';
export default class MapDataService {
static get() {
return Promise.resolve(mapData)
}
}
| 16.333333 | 47 | 0.70068 |
ea2ada55147520794f7c9d335aed4aac0bb99431 | 74 | js | JavaScript | src/typeStrategies/any.js | TechnologyAdvice/obey | 7e4832db2092ce1eaf0586933ce1e92a9ea3d37b | [
"MIT"
] | 200 | 2016-02-22T23:02:01.000Z | 2017-12-08T02:43:42.000Z | src/typeStrategies/any.js | TechnologyAdvice/obey | 7e4832db2092ce1eaf0586933ce1e92a9ea3d37b | [
"MIT"
] | 51 | 2016-02-23T15:05:38.000Z | 2017-11-16T21:35:29.000Z | src/typeStrategies/any.js | psvet/obey | 7e4832db2092ce1eaf0586933ce1e92a9ea3d37b | [
"MIT"
] | 9 | 2016-03-29T15:47:20.000Z | 2017-11-03T14:26:31.000Z | const any = {
default: context => context.value
}
module.exports = any
| 12.333333 | 35 | 0.675676 |
ea2da2b0f3f5e09e664bf8fbc3ed9605c174887e | 314 | js | JavaScript | worker/db-worker-actions/action-exec-pragma.js | ezewer/bfx-facs-db-better-sqlite | a4cb2c9e82ac84e49527369bb515c1647765da88 | [
"Apache-2.0"
] | 1 | 2021-05-19T04:48:15.000Z | 2021-05-19T04:48:15.000Z | worker/db-worker-actions/action-exec-pragma.js | ezewer/bfx-facs-db-better-sqlite | a4cb2c9e82ac84e49527369bb515c1647765da88 | [
"Apache-2.0"
] | null | null | null | worker/db-worker-actions/action-exec-pragma.js | ezewer/bfx-facs-db-better-sqlite | a4cb2c9e82ac84e49527369bb515c1647765da88 | [
"Apache-2.0"
] | 3 | 2020-10-05T08:26:16.000Z | 2021-01-08T02:29:06.000Z | 'use strict'
module.exports = (db, sql, params) => {
const isSqlArray = Array.isArray(sql)
const sqlArr = isSqlArray ? sql : [sql]
const { simple = true } = { ...params }
const res = []
for (const query of sqlArr) {
res.push(db.pragma(query, { simple }))
}
return isSqlArray ? res : res[0]
}
| 19.625 | 42 | 0.601911 |
ea2e8ee726326114ff927558476075ab17ce9e60 | 1,329 | js | JavaScript | admin/public/js/jobData.js | ribsalad/piezo | 5e2ea6a4403660eae4340b4ae81254e9e3cc71b1 | [
"Apache-2.0"
] | 51 | 2015-02-03T10:59:39.000Z | 2022-01-25T15:24:48.000Z | admin/public/js/jobData.js | ribsalad/piezo | 5e2ea6a4403660eae4340b4ae81254e9e3cc71b1 | [
"Apache-2.0"
] | 47 | 2015-04-21T20:31:45.000Z | 2021-08-18T21:48:02.000Z | admin/public/js/jobData.js | ribsalad/piezo | 5e2ea6a4403660eae4340b4ae81254e9e3cc71b1 | [
"Apache-2.0"
] | 23 | 2015-07-20T18:39:53.000Z | 2022-03-21T00:12:34.000Z | (function () {
var fixDataMapIndexes = function() {
$('[id*=job-data-map]').each(function(i, element){
if (i % 2 === 0) {
var itemNumber = i / 2;
element.id = 'job-data-map_' + itemNumber + '_key';
element.name = 'job-data-map[' + itemNumber + '].key';
}
if (i % 2 !== 0) {
var itemNumber = (i - 1) / 2;
element.id = 'job-data-map_' + itemNumber + '_value';
element.name = 'job-data-map[' + itemNumber + '].value';
}
})
};
$('.job-data-map').on('click', '.job-data-delete a', function () {
$(this).parent().next().next().remove();
$(this).parent().next().remove();
$(this).parent().remove();
fixDataMapIndexes();
});
$('.job-data-add').click(function () {
var key = $(this).prev().prev().clone();
var value = $(this).prev().clone();
$(this).prev().prev().before($('<div class="job-data-delete text-right"><a href="#">delete</a></div>'));
key.find('input').val('');
value.find('input').val('');
$(this).before(key);
$(this).before(value);
fixDataMapIndexes();
});
$('form').submit(function () {
fixDataMapIndexes();
});
})(); | 30.204545 | 112 | 0.456734 |
ea2eef63482d2eab6a9ff22c16ab0a57ed02707b | 1,201 | js | JavaScript | Javascript/advanced_algorithms/searchng_algorithmss/src/exponential_search/exponential_search.js | mikeadossi/algorithm_dojo | 0ae570fd9099bc080667c9eb50d6ee617172e470 | [
"MIT"
] | null | null | null | Javascript/advanced_algorithms/searchng_algorithmss/src/exponential_search/exponential_search.js | mikeadossi/algorithm_dojo | 0ae570fd9099bc080667c9eb50d6ee617172e470 | [
"MIT"
] | null | null | null | Javascript/advanced_algorithms/searchng_algorithmss/src/exponential_search/exponential_search.js | mikeadossi/algorithm_dojo | 0ae570fd9099bc080667c9eb50d6ee617172e470 | [
"MIT"
] | null | null | null | // SOURCE: https://www.geeksforgeeks.org/exponential-search/
// Javascript program to find an element x
// in a sorted array using Exponential Search
// A recursive binary search
// function. It returns location
// of x in given array arr[l..r] is
// present, otherwise -1
function binarySearch(arr, l, r, x)
{
if (r >= l)
{
let mid = l + (r - l) / 2;
// If the element is present
// at the middle itself
if (arr[mid] == x)
return mid;
// If element is smaller than
// mid, then it can only be
// present n left subarray
if (arr[mid] > x)
return binarySearch(arr, l, mid - 1, x);
// Else the element can only
// be present in right subarray
return binarySearch(arr, mid + 1, r, x);
}
// We reach here when element
// is not present in array
return -1;
}
// Returns position of first
// occurrence of x in array
function exponentialSearch(arr, n, x)
{
// If x is present at
// first location itself
if (arr[0] == x)
return 0;
// Find range for binary search
// by repeated doubling
let i = 1;
while (i < n && arr[i] <= x)
i = i * 2;
// Call binary search for
// the found range.
return binarySearch(arr, i/2,
Math.min(i, n - 1), x);
}
| 20.016667 | 60 | 0.633639 |
ea3086b13bc4ee34aac09d9f4265312fdc948610 | 720 | js | JavaScript | 05-text/app/template-cache.js | jelz/10-things-about-amd | 3bbf5d111b78c24d601837ea9038717a2f2831a4 | [
"MIT"
] | 1 | 2015-02-14T20:47:24.000Z | 2015-02-14T20:47:24.000Z | 05-text/app/template-cache.js | jelz/10-things-about-amd | 3bbf5d111b78c24d601837ea9038717a2f2831a4 | [
"MIT"
] | null | null | null | 05-text/app/template-cache.js | jelz/10-things-about-amd | 3bbf5d111b78c24d601837ea9038717a2f2831a4 | [
"MIT"
] | null | null | null | define(function (require) {
var $ = require('jquery'),
_ = require('underscore'),
$body = $('body'),
cache = {},
prefix = 'template-';
var templates = [
require('text!tpl/layout.html'),
require('text!tpl/content.html'),
require('text!tpl/menu.html')
];
_.each(templates, function (markup) {
$(markup).appendTo($body);
});
return function (key) {
var cacheKey = prefix + key,
template = cache[cacheKey];
if (!template) {
template = _.template($('#' + cacheKey).html());
cache[cacheKey] = template;
}
return template;
};
});
| 24 | 60 | 0.476389 |
ea30bf51d866155cbe3b8b24692c217c6d6cf70b | 795 | js | JavaScript | 15_activities/1/Activities/07-Ins_Multi_Trace/Solved/plots.js | KManthey/Interactive-Visualizations | 251c06ae96941a7bfd5d2c43d1e47edd4eabb015 | [
"ADSL"
] | null | null | null | 15_activities/1/Activities/07-Ins_Multi_Trace/Solved/plots.js | KManthey/Interactive-Visualizations | 251c06ae96941a7bfd5d2c43d1e47edd4eabb015 | [
"ADSL"
] | null | null | null | 15_activities/1/Activities/07-Ins_Multi_Trace/Solved/plots.js | KManthey/Interactive-Visualizations | 251c06ae96941a7bfd5d2c43d1e47edd4eabb015 | [
"ADSL"
] | null | null | null | /**
* Generates an array of random numbers between 0 and 9
* @param {integer} n: length of array to generate
*/
function randomNumbersBetween0and9(n) {
var randomNumberArray = [];
for (var i = 0; i < n; i++) {
var randomNumber = Math.floor(Math.random() * 10);
randomNumberArray.push(randomNumber);
}
return randomNumberArray;
}
// Create our first trace
var trace1 = {
x: [1, 2, 3, 4, 5],
y: randomNumbersBetween0and9(5),
type: "scatter"
};
// Create our second trace
var trace2 = {
x: [1, 2, 3, 4, 5],
y: randomNumbersBetween0and9(5),
type: "scatter"
};
// The data array consists of both traces
var data = [trace1, trace2];
// Note that we omitted the layout object this time
// This will use default parameters for the layout
Plotly.newPlot("plot", data);
| 23.382353 | 55 | 0.67044 |
ea31300aed84ece3b5a652aa5beb9dd84cf057c8 | 2,907 | js | JavaScript | react-school-library/src/components/books/BookDetailsPage.js | perestaj/ReactSchoolLibrary | f81668331e35a446359092e1178df4170afd777f | [
"MIT"
] | null | null | null | react-school-library/src/components/books/BookDetailsPage.js | perestaj/ReactSchoolLibrary | f81668331e35a446359092e1178df4170afd777f | [
"MIT"
] | null | null | null | react-school-library/src/components/books/BookDetailsPage.js | perestaj/ReactSchoolLibrary | f81668331e35a446359092e1178df4170afd777f | [
"MIT"
] | null | null | null | import React, { Component } from "react";
import { connect } from "react-redux";
import * as bookActions from "../../actions/bookActions";
import { bindActionCreators } from "redux";
import { withRouter } from "react-router-dom";
import BookDetailsForm from './BookDetailsForm';
import BookEditForm from './BookEditForm';
import AccessManager from '../../authorization/AccessManager';
class BookDetailsPage extends Component {
componentDidMount() {
const id = Number(this.props.match.params.id);
if (id === 0) {
this.props.actions.createBook();
this.props.actions.setBookEditMode(true);
} else {
this.props.actions.loadBook(id);
}
}
componentWillUnmount() {
this.props.actions.setBookEditMode(false);
}
redirectToBooksList() {
this.props.history.push("/books");
}
edit(event) {
event.preventDefault();
this.props.actions.setBookEditMode(true);
}
save(values) {
const book = {...values};
book.authorIds = values.authorIds.map(id => +id);
book.publisherID = +values.publisherID;
this.props.actions.updateBook(book, this.props.history);
}
cancel(event) {
event.preventDefault();
this.props.actions.setBookEditMode(false);
}
render() {
const { book, bookEditMode, authors, publishers, currentUser, ajaxCallSuccess } = this.props;
if (!ajaxCallSuccess) {
return <div>Error while loading book details</div>;
}
if (bookEditMode && AccessManager.canEditBook(currentUser)) {
const isAddMode = Number(this.props.match.params.id) === 0;
return (
<BookEditForm authors={authors} publishers={publishers} initialValues={this.props.initialValues} isAddMode={isAddMode}
cancel={this.cancel.bind(this)} onSubmit={this.save.bind(this)} redirectToBooksList={this.redirectToBooksList.bind(this)} />
);
}
const showEditButton = AccessManager.canEditBook(currentUser);
return (
<BookDetailsForm book={book} showEditButton={showEditButton}
edit={this.edit.bind(this)} redirectToBooksList={this.redirectToBooksList.bind(this)} />
);
}
}
function mapStateToProps(state, ownProps) {
let book = state.bookReducer.book;
let bookEditMode = state.bookReducer.bookEditMode || false;
var ajaxCallSuccess = state.ajaxCallSuccess;
return {
initialValues: Object.keys(book).length === 0 ? { authorIds: [] } : book,
book,
bookEditMode,
ajaxCallSuccess,
currentUser: state.authorizationReducer,
authors: state.authorReducer.authors || [],
publishers: state.publisherReducer.publishers || []
};
}
function mapDispatchToProps(dispatch, ownProps) {
return {
actions: bindActionCreators(bookActions, dispatch)
};
}
export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(BookDetailsPage)
); | 28.5 | 142 | 0.674923 |
ea313cb8592cdfd21742f0dd5de401e4e476a64b | 5,698 | js | JavaScript | server/game/snake-engine.js | ValYouW/SnakeMatch | 3a58eb65218e6c2d9b07bbe756b4c5a75dca90e6 | [
"MIT"
] | 5 | 2015-07-20T08:21:28.000Z | 2021-07-30T11:45:36.000Z | server/game/snake-engine.js | ValYouW/SnakeMatch | 3a58eb65218e6c2d9b07bbe756b4c5a75dca90e6 | [
"MIT"
] | null | null | null | server/game/snake-engine.js | ValYouW/SnakeMatch | 3a58eb65218e6c2d9b07bbe756b4c5a75dca90e6 | [
"MIT"
] | 2 | 2017-02-06T12:49:30.000Z | 2021-02-28T01:29:55.000Z | var Board = require('../../common/game-objects/board.js').Board,
Snake = require('../../common/game-objects/snake.js').Snake,
Pellet = require('../../common/game-objects/pellet.js').Pellet,
protocol = require('../../common/protocol.js').Protocol;
var INITIAL_SNAKE_SIZE = 5;
var MAX_PELLETS = 6;
/**
* Represents a game update response
* @constructor
*/
function GameUpdateData() {
this.loosingSnake = -1;
this.pelletsUpdate = false;
}
/**
* Creates a new instance of SnakeEngine
* The snake engine is responsible for managing the snake game on the server
* @param {number} width - The board width
* @param {number} height - The board height
* @param {number} boxSize - A board box size
* @constructor
*/
function SnakeEngine(width, height, boxSize) {
this.board = new Board(width, height, boxSize);
// The first snake is created on the left side and is heading right (very top row, y index = 0)
var snakeLoc = this.board.toScreen(INITIAL_SNAKE_SIZE - 1);
this.snake1 = new Snake(snakeLoc.x, snakeLoc.y, boxSize, INITIAL_SNAKE_SIZE, protocol.Direction.Right);
// The second snake is created on the right side and is heading left (very top row, y index = 0)
snakeLoc = this.board.toScreen(this.board.horizontalBoxes - INITIAL_SNAKE_SIZE);
this.snake2 = new Snake(snakeLoc.x, snakeLoc.y, boxSize, INITIAL_SNAKE_SIZE, protocol.Direction.Left);
/** @type {Pellet[]} */
this.pellets = [];
}
/**
* Handles a message from the client signaling a direction change
* @param {ChangeDirMessage} data
*/
SnakeEngine.prototype.handleDirChangeMessage = function(data) {
if (data.playerIndex === 1) {
this.snake1.changeDirection(data.newDirection);
} else if (data.playerIndex === 2) {
this.snake2.changeDirection(data.newDirection);
}
};
/**
* Updates the game, if either snake has lost due to collision, return its index
* @returns {GameUpdateData} The index of the LOOSING snake
*/
SnakeEngine.prototype.update = function() {
var res = new GameUpdateData();
// Update snake1
this.snake1.update();
// Check if the snake collides with itself or out-of-bounds
var collision = this.checkCollision(this.snake1);
if (collision) {
res.loosingSnake = 1;
return res;
}
// Check if the snake eats a pellet
res.pelletsUpdate = this.eatPellet(this.snake1);
// Update snake2
this.snake2.update();
// Check if the snake collides with itself or out-of-bounds
collision = this.checkCollision(this.snake2);
if (collision) {
res.loosingSnake = 2;
return res;
}
// Check if the snake eats a pellet
res.pelletsUpdate = this.eatPellet(this.snake2) || res.pelletsUpdate;
// Finally add new pellet
res.pelletsUpdate = this.addPellet() || res.pelletsUpdate;
// No one lost (yet...).
return res;
};
/**
* Checks if the snake collides with itself ot out-of-bounds
* @returns {boolean} Whether there was a collision
* @private
*/
SnakeEngine.prototype.checkCollision = function(snake) {
// Check if the head is out-of-bounds
if (snake.parts[0].location.x < 0 ||
snake.parts[0].location.y < 0 ||
snake.parts[0].location.x + snake.parts[0].size > this.board.rectangle.width ||
snake.parts[0].location.y + snake.parts[0].size > this.board.rectangle.height) {
return true;
}
// Check if the snake head collides with its body
for (var i = 1; i < snake.parts.length; ++i) {
if (snake.parts[0].location.equals(snake.parts[i].location)) {
return true;
}
}
return false;
};
/**
* Check if the snake eats a pellet, add new ones if necessary
* @param {Snake} snake - The snake that should eat
* @returns {boolean} Whether the snake ate a pellet
* @private
*/
SnakeEngine.prototype.eatPellet = function(snake) {
// Check if the snake head collides with pellet
for (var i = 0; i < this.pellets.length; ++i) {
if (snake.parts[0].location.equals(this.pellets[i].location)) {
// Add tail to the snake
snake.addTail();
// Remove this pellet
this.pellets.splice(i, 1);
return true;
}
}
return false;
};
/**
* Adds a new pellet to the game
* @returns {boolean} Whether a new pellet added
* @private
*/
SnakeEngine.prototype.addPellet = function() {
// Check if we should add pellets
if (this.pellets.length >= MAX_PELLETS || Math.random() > 0.2) {
return false;
}
// Keep loop until we found a spot for a pellet (theoretically this can turn into an infinite loop, so a solution could
// be to stop the random search after X times and look for a spot on the board).
var keepSearch = true;
while (keepSearch) {
keepSearch = false;
// Take a random spot on the board
var boxIndex = Math.floor(Math.random() * this.board.horizontalBoxes * this.board.horizontalBoxes);
var loc = this.board.toScreen(boxIndex);
// check that this spot is not on snake1
for (var i = 0; i < this.snake1.parts.length; ++i) {
if (this.snake1.parts[i].location.equals(loc)) {
keepSearch = true;
break;
}
}
if (!keepSearch) {
// check that this spot is not on snake2
for (i = 0; i < this.snake2.parts.length; ++i) {
if (this.snake2.parts[i].location.equals(loc)) {
keepSearch = true;
break;
}
}
}
if (!keepSearch) {
// check that this spot is not on existing pellet
for (i = 0; i < this.pellets.length; ++i) {
if (this.pellets[i].location.equals(loc)) {
keepSearch = true;
break;
}
}
}
if (!keepSearch) {
// Hooray we can add the pellet
this.pellets.push(new Pellet(loc));
}
}
return true;
};
module.exports = SnakeEngine; | 28.777778 | 121 | 0.661285 |
ea31723e3bd100e794cb9ca92e1a49f0e90de2bf | 1,447 | js | JavaScript | lib/utils.js | emsiengineering/emsi-ui | 5d3c9399b52d96ae5f9a75e15cc49101ecdea071 | [
"MIT"
] | null | null | null | lib/utils.js | emsiengineering/emsi-ui | 5d3c9399b52d96ae5f9a75e15cc49101ecdea071 | [
"MIT"
] | 15 | 2016-09-19T17:10:51.000Z | 2019-04-10T17:06:54.000Z | lib/utils.js | emsiengineering/emsi-ui | 5d3c9399b52d96ae5f9a75e15cc49101ecdea071 | [
"MIT"
] | null | null | null | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getTrueProps = getTrueProps;
exports.getFirstChildByProp = getFirstChildByProp;
exports.getChildIndexByProp = getChildIndexByProp;
var _react = require('react');
function getTrueProps(children) {
var propName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'active';
var equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var childArray = _react.Children.toArray(children);
return childArray.filter(function (child, index) {
return child.props[propName] === equals;
});
}
function getFirstChildByProp(children) {
var propName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'active';
var equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var matchingChildren = getTrueProps(children, propName, equals);
if (matchingChildren.length > 0) return matchingChildren[0];
return false;
}
function getChildIndexByProp(children) {
var propName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'active';
var equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var childArray = _react.Children.toArray(children);
var indexes = [];
childArray.forEach(function (child, index) {
if (child.props[propName] === equals) indexes.push(index);
});
return indexes;
} | 31.456522 | 94 | 0.705598 |
ea3202eb4a274c0264cfe957238b229d89c9bc80 | 1,824 | js | JavaScript | src/frontend/src/store/modules/notices.js | woowacourse-teams/2020-devbie | cfb6a6ec81435326233ce0ec4e22e423ea6d7b51 | [
"MIT"
] | 30 | 2020-06-23T02:51:05.000Z | 2022-03-27T06:12:34.000Z | src/frontend/src/store/modules/notices.js | woowacourse-teams/2020-devbie | cfb6a6ec81435326233ce0ec4e22e423ea6d7b51 | [
"MIT"
] | 218 | 2020-07-06T08:06:52.000Z | 2022-02-27T09:51:01.000Z | src/frontend/src/store/modules/notices.js | woowacourse-teams/2020-devbie | cfb6a6ec81435326233ce0ec4e22e423ea6d7b51 | [
"MIT"
] | 10 | 2020-07-06T09:30:38.000Z | 2021-06-12T06:58:38.000Z | import { deleteAction, getAction, postAction } from "../../api";
export default {
state: {
languages: [],
jobPositions: []
},
mutations: {
SET_NOTICE_ID(state, data) {
state.noticeId = data;
},
SET_FILTERS(state, data) {
state.languages = data.languages.map(res => res.pair);
state.jobPositions = data.jobPositions.map(res => res.pair);
}
},
actions: {
async DELETE_NOTICE({ commit }, noticeId) {
await deleteAction(`/api/notices/${noticeId}`);
commit("DELETE_NOTICE", Number(noticeId));
},
async CREATE_NOTICE({ commit }, noticeRequest) {
const response = await postAction(`/api/notices`, noticeRequest);
const id = response["headers"].location.split("/")[3];
commit("SET_NOTICE_ID", id);
},
async FETCH_FILTERS({ commit }) {
const { data } = await getAction(`/api/notices/filters`);
commit("SET_FILTERS", data);
},
// eslint-disable-next-line no-unused-vars
async UPLOAD_NOTICE_IMAGE({ commit }, payload) {
const response = await postAction(
`/api/notices/image`,
payload,
`content-type: multipart/form-data`
);
return response["headers"].location;
}
},
getters: {
fetchedNewCreatedNoticeId(state) {
return state.noticeId;
},
fetchedLanguages(state) {
return state.languages;
},
fetchedJobPositions(state) {
return state.jobPositions;
},
fetchedKeyword(state) {
return state.keyword;
},
fetchedFilterByJobPositions(state) {
const emptyPair = [{ key: "", text: "포지션" }];
return emptyPair.concat(state.jobPositions);
},
fetchedFilterByLanguages(state) {
const emptyPair = [{ key: "", text: "언어" }];
return emptyPair.concat(state.languages);
}
}
};
| 28.061538 | 71 | 0.610197 |
ea33eae0831058e04d4d54cd70ad0a0dd0c7ec45 | 5,533 | js | JavaScript | pages/components/RecentSkills.js | jgilbertworks/jeremygilbert | 6fb48860ec9934bb1b4255e7f1d223961f373518 | [
"MIT"
] | null | null | null | pages/components/RecentSkills.js | jgilbertworks/jeremygilbert | 6fb48860ec9934bb1b4255e7f1d223961f373518 | [
"MIT"
] | 7 | 2021-04-01T08:08:00.000Z | 2022-02-13T20:26:00.000Z | pages/components/RecentSkills.js | jgilbertworks/jeremygilbert | 6fb48860ec9934bb1b4255e7f1d223961f373518 | [
"MIT"
] | null | null | null | import React, { Component } from "react";
class RecentSkills extends Component {
codeHubClick = e => {
e.preventDefault();
window.location.assign("https://limitless-bayou-67971.herokuapp.com/");
};
clickyGame = e => {
e.preventDefault();
window.location.assign("https://shielded-woodland-97189.herokuapp.com/");
};
petFinder = e => {
e.preventDefault();
window.location.assign("https://cryptic-gorge-70462.herokuapp.com/");
}
mealMusic = e => {
e.preventDefault();
window.location.assign("https://jgilbertworks.github.io/meal-music/");
}
render() {
return (
<div className="wrapper">
<div className="recent-work">
<h1 className="recent-header">recent work</h1>
</div>
<div className="recent-container">
<div>
<div className="main-card">
<img
onClick={this.codeHubClick}
className="skill-photo"
src="/codehub.png"
alt="codeHub" />
</div>
<p className="work-description">
codeHub: a social network for developers
</p>
</div>
<div>
<div className="main-card">
<img
onClick={this.clickyGame}
className="skill-photo"
src="/memory.png"
alt="memory game" />
</div>
<p className="work-description">
Clicky Game: a memory game made in React.js
</p>
</div>
<div>
<div className="main-card">
<img
onClick={this.mealMusic}
className="skill-photo"
src="/mealmusic.png"
alt="my image"
/>
</div>
<p className="work-description">
Meal Music: pair your favorite restaurant and playlist
</p>
</div>
<div>
<div id="card4" className="main-card">
<img
onClick={this.petFinder}
className="skill-photo"
src="/petfinder-3.png"
alt="pet finder"
/>
</div>
<p className="work-description">
Lost & Hound: report missing and lost pets
</p>
</div>
</div>
<style jsx>{`
.wrapper {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
margin: 1rem;
font-family: "Arial";
}
.recent-header {
margin: 2rem;
font-size: 40px;
}
.recent-container {
display: grid;
grid-template-rows: 1fr;
// margin: 2rem;
justify-items: center;
// background-color: purple;
}
.main-card {
display: grid;
justify-items: center;
grid-template-columns: repeat(2, fr);
grid-template-rows: repeat(4 minmax(100px, auto));
height: 150px;
width: 90%;
min-width: 180px;
max-width: 300px;
border-radius: 5px;
margin: 1rem;
border: 0.5px solid lightgray;
// box-shadow: -12px 12px 2px 1px rgba(30, 30, 31, 0.2);
background-color: whitesmoke;
transition: transform 0.5s ease;
overflow: hidden;
transition: all 0.2s ease-in-out;
}
.main-card:hover {
transform: scale(1.1);
}
.skill-photo {
display: grid;
align-self: end;
width: 100%;
height: 100%;
border-radius: 5px;
border: 1px solid whitesmoke;
background-color: white;
margin: 0 auto;
background-size: cover;
/* margin-top:10px;
// border:1px solid lightgrey;
margin-right: 10px; */
cursor: pointer;
// transition: all .2s ease-in-out;
}
.skill-photo:hover {
// transform: scale(1.1);
}
.work-description {
font-size: 18px;
font-weight: bold;
margin: 1rem;
}
// media queries
@media (max-width: 2560px) {
.recent-container {
grid-template-columns: 1fr 1fr 1fr 1fr;
// padding: 0px 100px 0px 100px;
}
}
@media (max-width: 1440px) {
.recent-container {
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr;
// padding: 0px 75px 0px 75px;
}
}
@media (max-width: 1024px) {
.recent-container {
grid-template-columns: 1fr 1fr;
// padding: 0px 50px 0px 50px;
}
}
@media (max-width: 768px) {
.recent-container {
grid-template-columns: 1fr 1fr;
margin: 0.05rem;
padding: 0.05rem;
// padding: 0px 25px 0px 25px;
}
}
@media (max-width: 425px) {
.recent-container {
grid-template-columns: 1fr;
padding: 0px 10px 0px 10px;
}
}
`}</style>
</div>
);
}
}
export default RecentSkills;
| 28.817708 | 77 | 0.457979 |
ea34946aaa91b0ca396dce83c556aac590262779 | 2,192 | js | JavaScript | guns-admin/src/main/webapp/static/modular/housingSubsidy/housingSubsidyLookPerson.js | a329185818/baozhangxitong | 9c3a3b4ca966fcbc9cbb1b3124805e0e19b8099d | [
"Apache-2.0"
] | null | null | null | guns-admin/src/main/webapp/static/modular/housingSubsidy/housingSubsidyLookPerson.js | a329185818/baozhangxitong | 9c3a3b4ca966fcbc9cbb1b3124805e0e19b8099d | [
"Apache-2.0"
] | null | null | null | guns-admin/src/main/webapp/static/modular/housingSubsidy/housingSubsidyLookPerson.js | a329185818/baozhangxitong | 9c3a3b4ca966fcbc9cbb1b3124805e0e19b8099d | [
"Apache-2.0"
] | null | null | null | /**
* 住房补贴个人查看初始化
*/
var SubsidyLookPersonManage = {
id: "HousingSubsidyLookTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1,
url:"",
secondLayerIndex:-1
};
/**
* 初始化表格的列
*/
SubsidyLookPersonManage.initColumn = function () {
return [
{field: '', radio: false,formatter:function(value,row,index){
return '<input type="hidden" value="'+row.id+'">';
}
},
{title: '申请人姓名', field: 'name', align: 'center', valign: 'middle'},
{title: '住房补贴金额', field: 'rent', align: 'center', valign: 'middle'},
{title: '住房补贴开始时间', field: 'startTime', align: 'center', valign: 'middle'},
{title: '住房补贴结束时间', field: 'endTime', align: 'center', valign: 'middle'},
{title: '操作人姓名', field: 'oprationName', align: 'center', valign: 'middle'},
{title: '解除人姓名', field: 'relieveOprationName', align: 'center', valign: 'middle'},
{title: '解除时间', field: 'relieveTime', align: 'center', valign: 'middle'},
{title: '备注', field: 'remark', align: 'center', valign: 'middle', visible: false},
{title: '身份证号码', field: 'idCard', align: 'center', valign: 'middle', visible: false},
{title: '电话号码', field: 'telphone', align: 'center', valign: 'middle', visible: false},
{title: 'OPTYPENUM', field: 'optypenum', align: 'center', valign: 'middle',visible: false},
{title: 'RECYEAR', field: 'recyear', align: 'center', valign: 'middle',visible: false},
{title: 'RECNUM', field: 'recnum', align: 'center', valign: 'middle',visible: false}
];
};
/**
* 关闭此对话框
*/
SubsidyLookPersonManage.close = function () {
parent.layer.close(window.parent.SubsidyLookPersonManage.layerIndex);
};
$(function () {
SubsidyLookPersonManage.url = "/housingSubsidy/person_list";
var data = {
optypenum:subsidyOptypenum,
recyear:subsidyRecyear,
recnum:subsidyRecnum
};
var defaultColunms = SubsidyLookPersonManage.initColumn();
var table = new BSTable(SubsidyLookPersonManage.id, SubsidyLookPersonManage.url, defaultColunms);
table.setQueryParams(data);
SubsidyLookPersonManage.table = table.init();
});
| 36.533333 | 101 | 0.620894 |
ea3531efd573ed5782f4def05d224d0f90d09500 | 337 | js | JavaScript | routes/contacts.js | lferreira/ntalk | acc16a58634d291bd4056a8003a9512c4fa39578 | [
"MIT"
] | null | null | null | routes/contacts.js | lferreira/ntalk | acc16a58634d291bd4056a8003a9512c4fa39578 | [
"MIT"
] | null | null | null | routes/contacts.js | lferreira/ntalk | acc16a58634d291bd4056a8003a9512c4fa39578 | [
"MIT"
] | null | null | null | module.exports = function(app) {
var contacts = app.controllers.contacts;
app.get('/contacts', contacts.index);
app.get('/contacts/:id', contacts.show);
app.post('/contacts', contacts.create);
app.get('/contacts/:id/edit', contacts.edit);
app.put('/contacts/:id', contacts.update);
app.delete('/contacts/:id', contacts.destroy);
}; | 37.444444 | 47 | 0.703264 |
ea353546b87b4096d23a5f916ef2da8e45ac5a03 | 645 | js | JavaScript | 2021-08-05-cubes-and-colors/custom/render-cubes-04/blender.Point Instance.3mL9Q6KIC4y.js | vorg/nodes-stream | bf180ea110fda65d0732a263f0d28f7d3b22ed39 | [
"MIT"
] | 8 | 2021-08-06T12:15:29.000Z | 2022-02-11T14:57:18.000Z | 2021-08-05-cubes-and-colors/custom/render-cubes-04/blender.Point Instance.v7oIe_U47l0.js | vorg/nodes-stream | bf180ea110fda65d0732a263f0d28f7d3b22ed39 | [
"MIT"
] | null | null | null | 2021-08-05-cubes-and-colors/custom/render-cubes-04/blender.Point Instance.v7oIe_U47l0.js | vorg/nodes-stream | bf180ea110fda65d0732a263f0d28f7d3b22ed39 | [
"MIT"
] | null | null | null | module.exports = (node, graph) => {
const geometryIn = node.in('geometry')
const objectIn = node.in('object')
const geomOut = node.out('geom')
function update() {
const geometry = geometryIn.value
const object = objectIn.value
if (!geometry || !object) return
const g = {
...object,
offsets: { data: geometry.positions, divisor: 1 },
scales: { data: geometry.scales, divisor: 1 },
colors: { data: geometry.colors, divisor: 1 },
instances: geometry.positions.length
}
console.log('g', g)
geomOut.setValue(g)
}
geometryIn.onChange = update
objectIn.onChange = update
}; | 23.888889 | 56 | 0.627907 |
ea3566f6431ff6fc3303e2ff4fdfcba49f8a441b | 6,160 | js | JavaScript | src/main.js | leahciMic/hadapi | 947dfd687ab96b5798494318a3841b4e0ab485e2 | [
"MIT"
] | null | null | null | src/main.js | leahciMic/hadapi | 947dfd687ab96b5798494318a3841b4e0ab485e2 | [
"MIT"
] | 4 | 2020-09-06T10:07:22.000Z | 2021-09-01T18:41:24.000Z | src/main.js | leahciMic/hadapi | 947dfd687ab96b5798494318a3841b4e0ab485e2 | [
"MIT"
] | null | null | null | import serializeError from 'serialize-error';
import zeromq from 'zeromq';
import nanoid from 'nanoid';
// Hadapi (Highly available distributed application programming interface)
export async function exposeRemoteProcedure(
api,
{ connect, bind, socketType = 'rep', linger = 5000 } = {}
) {
const replySocket = zeromq.socket(socketType);
replySocket.setsockopt(zeromq.ZMQ_LINGER, linger);
const validSocketTypes = ['rep', 'router', 'dealer'];
if (!validSocketTypes.includes(socketType)) {
throw new Error('invalid socket type');
}
if (typeof connect === 'string') {
replySocket.connect(connect);
} else if (typeof bind === 'string') {
await new Promise((resolve, reject) => {
replySocket.bind(bind, (err, value) => {
if (err) {
reject(err);
} else {
resolve(value);
}
});
});
} else {
throw new Error('missing connect or bind paramter');
}
replySocket.on('message', async (...frames) => {
let reply;
let parsedData;
if (socketType === 'rep' && frames.length === 1) {
parsedData = JSON.parse(frames[0]);
reply = params => {
replySocket.send(
JSON.stringify({
...params,
messageId: parsedData.messageId
})
);
};
} else if (socketType === 'router' && frames.length === 3) {
parsedData = JSON.parse(frames[2]);
reply = params => {
replySocket.send([
frames[0],
frames[1],
JSON.stringify({
...params,
messageId: parsedData.messageId
})
]);
};
} else if (socketType === 'router' && frames.length > 3) {
parsedData = JSON.parse(frames[frames.length - 1]);
reply = params => {
replySocket.send(
frames
.slice(0, frames.length - 1)
.concat([JSON.stringify({ ...params, messageId: parsedData.messageID })])
);
};
} else {
throw new Error('unexpected condition (possibly not implemented)');
}
const { operation, messageId, ...parsed } = parsedData;
try {
if (typeof api[operation] !== 'function') {
throw new Error('Operation does not exist');
}
const returnValue = await api[operation](parsed);
reply({ operation: 'REPLY', returnValue });
} catch (err) {
reply({
operation: 'EXCEPTION',
exception: serializeError(err)
});
}
});
return replySocket;
}
// Send to othersied and receive information
// @todo have a requestId to ensure we only process things once
// and that replies are for the data we send...
export function consumeRemoteProcedure({ connect, bind, socketType = 'req', linger = 5000 } = {}) {
const requestSocket = zeromq.socket(socketType);
requestSocket.setsockopt(zeromq.ZMQ_LINGER, linger);
const validSocketTypes = ['req', 'router', 'dealer'];
if (!validSocketTypes.includes(socketType)) {
throw new Error('invalid socket type');
}
if (typeof connect === 'string') {
requestSocket.connect(connect);
} else if (typeof bind === 'string') {
requestSocket.bind(bind);
} else {
throw new Error('missing connect or bind paramter');
}
const replyMap = new Map();
requestSocket.on('message', (...frames) => {
let result;
let messageId;
if (socketType === 'req' && frames.length === 1) {
result = JSON.parse(frames[0]);
({ messageId } = result);
} else if (socketType === 'dealer' && frames.length === 3) {
result = JSON.parse(frames[2]);
messageId = frames[0].toString('utf8');
} else {
throw new Error('unexpected condition (possibly not implemented)');
}
if (!messageId) {
throw new Error('Received message without an identifier');
}
if (!replyMap.has(messageId)) {
throw new Error('Received unsolicited message');
}
const promise = replyMap.get(messageId);
replyMap.delete(messageId);
if (result.operation === 'EXCEPTION') {
const err = new Error(result.exception.message);
Object.assign(err, result.exception);
promise.reject(err);
} else if (result.operation === 'REPLY') {
promise.resolve(result.returnValue);
} else {
throw new Error('unexpected condition (possibly not implemented)');
}
});
const deferPromise = () => {
let resolve;
let reject;
const promise = new Promise((tmpResolve, tmpReject) => {
resolve = tmpResolve;
reject = tmpReject;
});
return {
promise,
reject,
resolve
};
};
return new Proxy(
{
async close() {
return requestSocket.close();
},
async unmonitor() {
return requestSocket.unmonitor();
},
async disconnect(addr) {
return requestSocket.disconnect(addr);
}
},
{
get(target, property) {
if (target[property]) {
return target[property];
}
return async namedArgs => {
const messageId = nanoid();
const deferred = deferPromise();
replyMap.set(messageId, deferred);
if (socketType === 'req') {
requestSocket.send(
JSON.stringify({
messageId,
operation: property,
...namedArgs
})
);
} else if (socketType === 'dealer') {
requestSocket.send([
messageId,
'',
JSON.stringify({
messageId,
operation: property,
...namedArgs
})
]);
} else {
throw new Error(`socket type ${socketType} not implemented yet`);
}
return deferred.promise;
};
}
}
);
}
export function createBrokerProxy({
backendAddress = 'tcp://*:5000',
frontendAddress = 'tcp://*:5001'
} = {}) {
const frontend = zeromq.socket('router');
const backend = zeromq.socket('dealer');
frontend.bindSync(frontendAddress);
backend.bindSync(backendAddress);
zeromq.proxy(frontend, backend);
}
| 26.101695 | 99 | 0.567045 |
ea35e7805af8374e8efa94932595cd2d003db5bf | 657 | js | JavaScript | public/precache-manifest.192ccfd7b3bf7ad6dd4c7113c2d94936.js | davefernandes/online-survey | 720e0b34e7cf19856efccd0139898e2a4c035fa9 | [
"MIT"
] | null | null | null | public/precache-manifest.192ccfd7b3bf7ad6dd4c7113c2d94936.js | davefernandes/online-survey | 720e0b34e7cf19856efccd0139898e2a4c035fa9 | [
"MIT"
] | null | null | null | public/precache-manifest.192ccfd7b3bf7ad6dd4c7113c2d94936.js | davefernandes/online-survey | 720e0b34e7cf19856efccd0139898e2a4c035fa9 | [
"MIT"
] | null | null | null | self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "fbfb15865b63bca52aa5a39af4db2450",
"url": "/index.html"
},
{
"revision": "1af48c6a812678c3a761",
"url": "/static/css/main.b12f4bef.chunk.css"
},
{
"revision": "03212f7e51b04a28fdc5",
"url": "/static/js/2.a438f44e.chunk.js"
},
{
"revision": "570d362d673dab785e62d2b8563e1118",
"url": "/static/js/2.a438f44e.chunk.js.LICENSE.txt"
},
{
"revision": "1af48c6a812678c3a761",
"url": "/static/js/main.bad39cfd.chunk.js"
},
{
"revision": "9b4e396c183e42c1fa5c",
"url": "/static/js/runtime-main.09b85ec0.js"
}
]); | 25.269231 | 66 | 0.627093 |
ea3697e161e8c3e710f342e809cb2415b7cf7ba6 | 1,912 | js | JavaScript | public/assets/combobox-c6f78fad03fc4fd5289b3c1e3ae57e46.js | EOL/eol | ef7503f6c004c8265c71feedd9a0632b0c138351 | [
"MIT"
] | 33 | 2015-03-03T07:40:29.000Z | 2021-04-18T22:56:42.000Z | public/assets/combobox-c6f78fad03fc4fd5289b3c1e3ae57e46.js | EOL/eol | ef7503f6c004c8265c71feedd9a0632b0c138351 | [
"MIT"
] | 34 | 2015-02-23T11:30:22.000Z | 2021-07-06T14:14:30.000Z | public/assets/combobox-c6f78fad03fc4fd5289b3c1e3ae57e46.js | EOL/eol | ef7503f6c004c8265c71feedd9a0632b0c138351 | [
"MIT"
] | 28 | 2015-01-18T12:53:57.000Z | 2019-02-02T20:39:33.000Z | !function(t){t.widget("custom.combobox",{_create:function(){this.wrapper=t("<span>").addClass("custom-combobox").insertAfter(this.element),this.element.hide(),this._createAutocomplete(),this._createShowAllButton()},_createAutocomplete:function(){var e=this.element.children(":selected"),i=e.val()?e.text():"";this.input=t("<input>").appendTo(this.wrapper).val(i).attr("title","").addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left").autocomplete({delay:0,minLength:0,source:t.proxy(this,"_source")}).tooltip({tooltipClass:"ui-state-highlight"}),this._on(this.input,{autocompleteselect:function(t,e){e.item.option.selected=!0,this._trigger("select",t,{item:e.item.option})},autocompletechange:"_removeIfInvalid"})},_createShowAllButton:function(){var e=this.input,i=!1;t("<a>").appendTo(this.wrapper).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("custom-combobox-toggle ui-corner-right").mousedown(function(){i=e.autocomplete("widget").addClass("combobox").is(":visible")}).click(function(){e.focus(),i||e.autocomplete("search","")})},_source:function(e,i){var n=new RegExp(t.ui.autocomplete.escapeRegex(e.term),"i");i(this.element.children("option").map(function(){var i=t(this).text();return!this.value||e.term&&!n.test(i)?void 0:{label:i,value:i,option:this}}))},_removeIfInvalid:function(e,i){if(!i.item){var n=this.input.val(),s=n.toLowerCase(),o=!1;this.element.children("option").each(function(){return t(this).text().toLowerCase()===s?(this.selected=o=!0,!1):void 0}),o||(this.input.val("").attr("title").tooltip("open"),this.element.val(""),this._delay(function(){this.input.tooltip("close").attr("title","")},2500))}},_destroy:function(){this.wrapper.remove(),this.element.show()}})}(jQuery),$(function(){$("#combobox").children("#attribute").combobox(),$("#toggle").click(function(){$("#combobox").toggle()})}); | 1,912 | 1,912 | 0.723326 |
ea377dd5a0bcb5460fc0f2d3341e720e0ac7a517 | 1,502 | js | JavaScript | browser.js | Marak/bpipe | 47e09c1057dd18faaaf89b222fb82db3e35621d7 | [
"MIT"
] | 76 | 2015-02-25T15:41:23.000Z | 2022-01-21T21:46:51.000Z | browser.js | Marak/bpipe | 47e09c1057dd18faaaf89b222fb82db3e35621d7 | [
"MIT"
] | null | null | null | browser.js | Marak/bpipe | 47e09c1057dd18faaaf89b222fb82db3e35621d7 | [
"MIT"
] | 4 | 2015-11-28T00:21:27.000Z | 2019-01-04T12:48:45.000Z | var ws = require('websocket-stream');
var through = require('through2');
// create connection to websocket server
var stream = ws('ws://localhost:8001');
stream.on('error', function(err){
// console.log(err);
});
var domstream = require('domnode-dom');
var hello = {
"source": "browser",
"id": new Date().getTime(),
"url": window.location.href
};
stream.write(new Buffer(JSON.stringify(hello)))
stream.on('data', function(x) {
// console.log('data from server', x.toString());
var data = JSON.parse(x.toString());
var selector = data.selector;
// if there is no data, assume its a request to bind a new event listerer from bpipe
if (typeof data.data === "undefined") {
var inputElement = document.querySelectorAll(selector)[0];
var inputStream = domstream.createEventStream(inputElement, data.event);
// console.log('mapping new element', inputElement, selector)
inputStream.pipe(through(function(chunk, enc, cb){
var data = {
"selector": selector,
"data": chunk.toString(),
"source": "browser",
"url": window.location.href
};
cb(null, JSON.stringify(data));
}))
.pipe(stream);
} else {
// data incoming from bpipe, send it to the browser
var outputElement = document.querySelectorAll(selector)[0];
var outputStream = domstream.createWriteStream(outputElement, 'text/plain');
//console.log('incoming data from bpipe', data, outputElement);
outputStream.write(data.data);
}
}); | 31.291667 | 86 | 0.66245 |
ea3a92cbb3f117e0001b3a871943a5fe3f34dddd | 3,004 | js | JavaScript | jotleaf/static/js/libs/jquery.fontselector.js | reverie/jotleaf.com | 86311b546bb5bae7ba826f5576ea82ac515e8b7d | [
"MIT"
] | 1 | 2020-10-25T15:10:43.000Z | 2020-10-25T15:10:43.000Z | jotleaf/static/js/libs/jquery.fontselector.js | reverie/jotleaf.com | 86311b546bb5bae7ba826f5576ea82ac515e8b7d | [
"MIT"
] | null | null | null | jotleaf/static/js/libs/jquery.fontselector.js | reverie/jotleaf.com | 86311b546bb5bae7ba826f5576ea82ac515e8b7d | [
"MIT"
] | null | null | null | // Generated by CoffeeScript 1.4.0
var FontSelector,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
FontSelector = (function() {
function FontSelector(element, options) {
this.unbindEvents = __bind(this.unbindEvents, this);
this.destroy = __bind(this.destroy, this);
this.close = __bind(this.close, this);
this.open = __bind(this.open, this);
this.getSelected = __bind(this.getSelected, this);
this.setSelected = __bind(this.setSelected, this);
this.bindEvents = __bind(this.bindEvents, this);
this.options = $.extend({
selected: function(style) {},
className: 'open'
}, options);
this.root = element;
this.initial = this.root.findOne('.initial');
this.ul = this.root.findOne("ul");
this.root.data('fontselector', this);
this.ul.hide();
this._visible = false;
this.setSelected(this.options.initial[1], this.options.initial[2]);
this.ul.find("li").each(function() {
var $t, family;
$t = $(this);
family = $t.data('font-family');
return $t.css("font-family", family);
});
this.bindEvents();
}
FontSelector.prototype.bindEvents = function() {
var _this = this;
this.initial.click(this.open);
this.ul.on('click', 'li', function(e) {
var $t, displayName, family;
$t = $(e.target);
family = $t.data('font-family');
displayName = $t.text();
_this.setSelected(family, displayName);
_this.root.trigger('fontChange', [family]);
_this.options.selected(family);
return _this.close();
});
return $("html").click(this.close);
};
FontSelector.prototype.setSelected = function(family, displayName) {
var unquoted;
unquoted = family.replace(/'/g, '');
this._selected = unquoted;
this.initial.css("font-family", family);
return this.initial.text(displayName);
};
FontSelector.prototype.getSelected = function() {
return this._selected;
};
FontSelector.prototype.open = function() {
var _this = this;
if (this._visible) {
return;
}
this.root.addClass(this.options.className);
this.ul.outerWidth(this.initial.outerWidth());
return this.ul.slideDown("fast", function() {
_this.ul.css('overflow', 'auto');
_this.ul.css('overflow-y', 'auto');
return _this._visible = true;
});
};
FontSelector.prototype.close = function() {
var _this = this;
if (!this._visible) {
return;
}
return this.ul.slideUp("fast", function() {
_this.root.removeClass(_this.options.className);
return _this._visible = false;
});
};
FontSelector.prototype.destroy = function() {
return this.unbindEvents();
};
FontSelector.prototype.unbindEvents = function() {
var _ref;
if ((_ref = this.ul) != null) {
_ref.off('click', 'li');
}
$("html").off('click', this.close);
return this.initial.off('click', this.open);
};
return FontSelector;
})();
| 27.309091 | 85 | 0.622836 |
ea3ab63a0a8999470179d8463abd555553a3ca64 | 45 | js | JavaScript | src/index.js | evandhq/react-simple-carousel | 1fa49ee18805dbf8e6db5a4b29f2a3e702797757 | [
"MIT"
] | 9 | 2016-10-22T08:36:51.000Z | 2018-07-08T10:13:02.000Z | src/index.js | evandhq/react-simple-carousel | 1fa49ee18805dbf8e6db5a4b29f2a3e702797757 | [
"MIT"
] | 1 | 2021-03-05T07:54:48.000Z | 2021-03-05T07:54:48.000Z | src/index.js | evandhq/react-simple-carousel | 1fa49ee18805dbf8e6db5a4b29f2a3e702797757 | [
"MIT"
] | null | null | null | export default from './components/Carousel';
| 22.5 | 44 | 0.777778 |
ea3b418d88a66968345bcbe41c95b1430a13b579 | 5,680 | js | JavaScript | restaurant-passport/src/actions/actions.js | Restaurant-passport-2/FE | b1e92d79b9266fda5961c5dfb34a4a76756c2af3 | [
"MIT"
] | null | null | null | restaurant-passport/src/actions/actions.js | Restaurant-passport-2/FE | b1e92d79b9266fda5961c5dfb34a4a76756c2af3 | [
"MIT"
] | 28 | 2019-12-24T01:10:13.000Z | 2022-02-26T22:07:47.000Z | restaurant-passport/src/actions/actions.js | Restaurant-passport-2/FE | b1e92d79b9266fda5961c5dfb34a4a76756c2af3 | [
"MIT"
] | null | null | null | import axios from 'axios';
import { axiosWithAuth } from '../utils/axiosWithAuth';
export const SIGNUP_USER_START = 'SIGNUP_USER_START';
export const SIGNUP_USER_SUCCESS = 'SIGNUP_USER_SUCCESS';
export const SIGNUP_USER_FAILURE = 'SIGNUP_USER_FAILURE';
export const LOGIN_USER_START = 'LOGIN_USER_START';
export const LOGIN_USER_SUCCESS = 'LOGIN_USER_SUCCESS';
export const LOGIN_USER_FAILURE = 'LOGIN_USER_FAILURE';
export const LOGOUT_USER_START = 'LOGOUT_USER_START';
export const LOGOUT_USER_SUCCESS = 'LOGOUT_USER_SUCCESS';
export const LOGOUT_USER_FAILURE = 'LOGOUT_USER_FAILURE';
export const ADD_RESTAURANT_START = 'ADD_RESTAURANT_START';
export const ADD_RESTAURANT_SUCCESS = 'ADD_RESTAURANT_SUCCESS';
export const ADD_RESTAURANT_FAILURE = 'ADD_RESTAURANT_FAILURE';
export const EDIT_RESTAURANT_START = 'EDIT_RESTAURANT_START';
export const EDIT_RESTAURANT_SUCCESS = 'EDIT_RESTAURANT_SUCCESS';
export const EDIT_RESTAURANT_FAILURE = 'EDIT_RESTAURANT_FAILURE';
export const DELETE_RESTAURANT_START = 'DELETE_RESTAURANT_START';
export const DELETE_RESTAURANT_SUCCESS = 'DELETE_RESTAURANT_SUCCESS';
export const DELETE_RESTAURANT_FAILURE = 'DELETE_RESTAURANT_FAILURE';
export const GET_RECOMMENDATIONS_START= 'GET_RECOMMENDATIONS_START';
export const GET_RECOMMENDATIONS_SUCCESS = 'GET_RECOMMENDATIONS_SUCCESS';
export const GET_RECOMMENDATIONS_FAILURE = 'GET_RECOMMENDATIONS_FAILURE';
export const signupUser = (newUser, history) => dispatch => {
//console.log('In signupUser in actions');
dispatch( { type: SIGNUP_USER_START });
axios
.post("https://restaurant-passport-2.herokuapp.com/api/auth/signup", newUser)
.then(response => {
//console.log(response);
dispatch( { type: SIGNUP_USER_SUCCESS, payload: response.data});
localStorage.setItem('token', response.data.token);
history.push('/')
})
.catch(err => {
dispatch( { type: SIGNUP_USER_FAILURE, payload: err.response});
});
};
export const loginUser = (user, history) => dispatch => {
dispatch( { type: LOGIN_USER_START });
//console.log('in loginUser in actions');
axios
.post("https://restaurant-passport-2.herokuapp.com/api/auth/login", user)
.then(response =>{
//console.log('Login response from actions' ,history.push);
localStorage.setItem('token', response.data.token);
dispatch( {type: LOGIN_USER_SUCCESS, payload: response.data });
history.push('/restaurants')
})
.catch(err => {
dispatch( { type: LOGIN_USER_FAILURE, payload: err.response});
});
};
export const logoutUser = () => dispatch => {
dispatch( { type: LOGOUT_USER_START});
localStorage.removeItem('token');
const tokenCheck = localStorage.getItem('token');
if (tokenCheck === null) {
dispatch( { type: LOGOUT_USER_SUCCESS});
} else {
dispatch ( { type: LOGOUT_USER_FAILURE});
};
};
export const addRestaurant = (restaurant) => dispatch => {
dispatch( { type: ADD_RESTAURANT_START});
//console.log("Ready to be sent : ", restaurant);
axiosWithAuth().post('https://restaurant-passport-2.herokuapp.com/api/passport/entry', restaurant)
.then(response => {
//console.log("Here is the response after adding a restaurant", response);
dispatch({type: ADD_RESTAURANT_SUCCESS, payload: response.data.entries})
})
.catch(err => {
//console.log('This is an error in add restaurant', err);
dispatch({type: ADD_RESTAURANT_FAILURE, payload: err})
})
};
export const editRestaurant = (restaurant) => dispatch => {
dispatch( { type: EDIT_RESTAURANT_START});
//console.log('In editRestaurant in actions with restaurant of id ', restaurant.restaurant_id);
axiosWithAuth().put(`https://restaurant-passport-2.herokuapp.com/api/passport/entry/${restaurant.restaurant_id}`, restaurant)
.then(response => {
//console.log("Here is the response after editing a restaurant", response);
dispatch({type: EDIT_RESTAURANT_SUCCESS, payload: response.data.entries})
})
.catch(err => {
//console.log('This is an error in edit restaurant: ', err);
dispatch({type: EDIT_RESTAURANT_FAILURE, payload: err})
});
};
export const deleteRestaurant = (restaurant) => dispatch => {
dispatch( { type: DELETE_RESTAURANT_START});
//console.log('In deleteRestaurant in actions');
axiosWithAuth().delete(`https://restaurant-passport-2.herokuapp.com/api/passport/entry/${restaurant.restaurant_id}`)
.then(response => {
//console.log('delete action response', response)
dispatch({type: DELETE_RESTAURANT_SUCCESS, payload: response.data.entries})
})
.catch(err => {
//console.log('delete action error', err)
dispatch({type: DELETE_RESTAURANT_FAILURE, payload: err.message})
})
};
export const getRecommendations = (searchParams) => dispatch => {
dispatch( { type: GET_RECOMMENDATIONS_START});
//console.log('In getRecommendations in actions');
//console.log('With searchParams: ', searchParams);
axiosWithAuth()
.get("https://restaurant-passport-2.herokuapp.com/api/restaurants/search", {
params: searchParams,
})
.then(response => {
//console.log('get recommendations response', response);
dispatch({type: GET_RECOMMENDATIONS_SUCCESS, payload: response.data.businesses})
})
.catch(err => {
//console.log('get recommendations error', err);
dispatch({type: GET_RECOMMENDATIONS_FAILURE, payload: err.message})
})
} | 41.764706 | 129 | 0.688028 |
ea3c1a52dd5e6d8e79ea9b2a4e533af3e13980e1 | 1,854 | js | JavaScript | artifact_evaluation/data/codeCoverage/codealchemist_generate/741.js | weucode/COMFORT | 0cfce5d70a58503f8ba3c3ff825abc24b79a1d2b | [
"Apache-2.0"
] | 55 | 2021-03-05T06:42:22.000Z | 2022-02-22T05:33:47.000Z | artifact_evaluation/data/codeCoverage/codealchemist_generate/741.js | Delepha/COMFORT | a76ab2cc0069542b2bd75e4952c4709eef936124 | [
"Apache-2.0"
] | null | null | null | artifact_evaluation/data/codeCoverage/codealchemist_generate/741.js | Delepha/COMFORT | a76ab2cc0069542b2bd75e4952c4709eef936124 | [
"Apache-2.0"
] | 20 | 2021-04-14T15:17:05.000Z | 2022-02-15T10:48:00.000Z | var v0 = (function (v1, v2, v3){
(v1.exports) = (v3.p) + ("b61c4e14e90e796e36f0d10792fcc505.svg");
});
v0(/s$/i, "");
// GenBlkBrick
for(var v1 = 0;(v1) < (7);v1++){
var v2 = ({type : 'Lagrange'});
}
[].reduce(v0, v1);
var v3 = (function (v1, v2, v3){
(function (v4){
'use strict';
var v5 = v1('readable-stream').Readable, v6 = ({objectMode : true});
function v7(){
if(! (this) instanceof (v7)){
return new v7();
}
(this._inflights) = ({});
}
(v7.prototype.put) = (function (v8, v9){
(this._inflights[v8.messageId]) = v8;
if(v9){
v9();
}
return this;
});
(v7.prototype.createStream) = (function (){
var v10 = new v5(v6), v11 = this._inflights, v12 = Object.keys(this._inflights), v14 = false, v15 = 0;
(v10._read) = (function (){
if((! v14) && ((v15) < (v12.length))){
this.push(v11[v12[v15++]]);
}else {
this.push(null);
}
});
(v10.destroy) = (function (){
if(v14){
return;
}
var v16 = this;
(v14) = true;
v4.nextTick((function (){
v16.emit('close');
}));
});
return v10;
});
(v7.prototype.del) = (function (v8, v9){
(v8) = this._inflights[v8.messageId];
if(v8){
delete this._inflights[v8.messageId];
v9(null, v8);
}else {
if(v9){
v9(new Error('missing packet'));
}
}
return this;
});
(v7.prototype.get) = (function (v8, v9){
(v8) = this._inflights[v8.messageId];
if(v8){
v9(null, v8);
}else {
if(v9){
v9(new Error('missing packet'));
}
}
return this;
});
(v7.prototype.close) = (function (v9){
(this._inflights) = null;
if(v9){
v9();
}
});
(v2.exports) = v7;
}).call(this, v1('_process'));
});
Object.defineProperty(v0.prototype, "instanceDivisor", ({get : (function (){
return this._instanceDivisor;
}), set : (function (v2){
(this._instanceDivisor) = v2;
if((v2) == (0)){
(this._instanced) = false;
}else {
(this._instanced) = true;
}
}), enumerable : true, configurable : true}));
var v4 = ({thereYet : v3, cap : v0});
for(var v5 = 0;- 0;){
v1++;
}
| 19.723404 | 102 | 0.607335 |
ea3c74079089dcf776244f9c23353251b0b363a2 | 78,924 | js | JavaScript | src/static/hsqlparametrosentrada.js | ronaldomg/Valim_EFS_REDIS | 67ce6769fccffef1455cbb616ab3a02e30e034b2 | [
"Unlicense"
] | null | null | null | src/static/hsqlparametrosentrada.js | ronaldomg/Valim_EFS_REDIS | 67ce6769fccffef1455cbb616ab3a02e30e034b2 | [
"Unlicense"
] | null | null | null | src/static/hsqlparametrosentrada.js | ronaldomg/Valim_EFS_REDIS | 67ce6769fccffef1455cbb616ab3a02e30e034b2 | [
"Unlicense"
] | null | null | null | /**@preserve GeneXus Java 10_3_12-110051 on December 12, 2020 18:56:51.25
*/
gx.evt.autoSkip = false;
gx.define('hsqlparametrosentrada', false, function () {
this.ServerClass = "hsqlparametrosentrada" ;
this.PackageName = "" ;
this.setObjectType("web");
this.setOnAjaxSessionTimeout("Warn");
this.hasEnterEvent = true;
this.skipOnEnter = false;
this.addKeyListener("5", "REFRESH");
this.addKeyListener("12", "CANCEL");
this.addKeyListener("1", "HELP");
this.SetStandaloneVars=function()
{
};
this.s132_client=function()
{
if ( this.AV29NomeCampo1Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO1","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO1","Visible", 0 );
}
if ( this.AV32NomeCampo2Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO2","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO2","Visible", 0 );
}
if ( this.AV35NomeCampo3Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO3","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO3","Visible", 0 );
}
if ( this.AV38NomeCampo4Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO4","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO4","Visible", 0 );
}
if ( this.AV41NomeCampo5Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO5","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO5","Visible", 0 );
}
if ( this.AV44NomeCampo6Data != "" )
{
gx.fn.setCtrlProperty("TABCAMPO6","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO6","Visible", 0 );
}
if ( this.AV30NomeCampo1Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO7","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO7","Visible", 0 );
}
if ( this.AV33NomeCampo2Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO8","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO8","Visible", 0 );
}
if ( this.AV36NomeCampo3Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO9","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO9","Visible", 0 );
}
if ( this.AV39NomeCampo4Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO10","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO10","Visible", 0 );
}
if ( this.AV42NomeCampo5Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO11","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO11","Visible", 0 );
}
if ( this.AV45NomeCampo6Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO12","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO12","Visible", 0 );
}
if ( this.AV47NomeCampo7Integer != "" )
{
gx.fn.setCtrlProperty("TABCAMPO13","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO13","Visible", 0 );
}
if ( this.AV31NomeCampo1String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO14","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO14","Visible", 0 );
}
if ( this.AV34NomeCampo2String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO15","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO15","Visible", 0 );
}
if ( this.AV37NomeCampo3String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO16","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO16","Visible", 0 );
}
if ( this.AV40NomeCampo4String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO17","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO17","Visible", 0 );
}
if ( this.AV43NomeCampo5String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO18","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO18","Visible", 0 );
}
if ( this.AV46NomeCampo6String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO19","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO19","Visible", 0 );
}
if ( this.AV48NomeCampo7String != "" )
{
gx.fn.setCtrlProperty("TABCAMPO20","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO20","Visible", 0 );
}
if ( this.AV79NomeCampo1Numerico != "" )
{
gx.fn.setCtrlProperty("TABCAMPO21","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO21","Visible", 0 );
}
if ( this.AV80NomeCampo2Numerico != "" )
{
gx.fn.setCtrlProperty("TABCAMPO22","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO22","Visible", 0 );
}
if ( this.AV81NomeCampo3Numerico != "" )
{
gx.fn.setCtrlProperty("TABCAMPO23","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO23","Visible", 0 );
}
if ( this.AV82NomeCampo4Numerico != "" )
{
gx.fn.setCtrlProperty("TABCAMPO24","Visible", 1 );
}
else
{
gx.fn.setCtrlProperty("TABCAMPO24","Visible", 0 );
}
};
this.e1220d2_client=function()
{
this.executeServerEvent("ENTER", true, null, false, false);
};
this.e1420d2_client=function()
{
this.executeServerEvent("'FECHAR'", false, null, false, false);
};
this.e1620d2_client=function()
{
this.executeServerEvent("CANCEL", true, null, false, false);
};
this.GXValidFnc = [];
var GXValidFnc = this.GXValidFnc ;
this.GXCtrlIds=[2,5,6,9,12,14,15,16,19,21,22,23,26,28,29,30,33,35,36,37,40,42,43,44,47,49,50,51,54,56,57,58,61,63,64,65,68,70,71,72,75,77,78,79,82,84,85,86,89,91,92,93,96,98,99,100,103,105,106,107,110,112,113,114,117,119,120,121,124,126,127,128,131,133,134,135,138,140,141,142,145,147,148,149,152,154,155,156,159,161,162,163,166,168,169,170,173,175,176,177,185];
this.GXLastCtrlId =185;
GXValidFnc[2]={fld:"TABLE2",grid:0};
GXValidFnc[5]={fld:"DIV1", format:2,grid:0};
GXValidFnc[6]={fld:"TABLE4",grid:0};
GXValidFnc[9]={fld:"TABCAMPO1",grid:0};
GXValidFnc[12]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO1DATA",gxz:"ZV29NomeCampo1Data",gxold:"OV29NomeCampo1Data",gxvar:"AV29NomeCampo1Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV29NomeCampo1Data=Value},v2z:function(Value){gx.O.ZV29NomeCampo1Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO1DATA",gx.O.AV29NomeCampo1Data,0)},c2v:function(){gx.O.AV29NomeCampo1Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO1DATA")},nac:gx.falseFn};
GXValidFnc[14]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO1DATA",gxz:"ZV6ConteudoCampo1Data",gxold:"OV6ConteudoCampo1Data",gxvar:"AV6ConteudoCampo1Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV6ConteudoCampo1Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV6ConteudoCampo1Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO1DATA",gx.O.AV6ConteudoCampo1Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV6ConteudoCampo1Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO1DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 14 , function() {
});
GXValidFnc[15]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO1DATA",gxz:"ZV55ValidaCampo1Data",gxold:"OV55ValidaCampo1Data",gxvar:"AV55ValidaCampo1Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV55ValidaCampo1Data=Value},v2z:function(Value){gx.O.ZV55ValidaCampo1Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO1DATA",gx.O.AV55ValidaCampo1Data,0)},c2v:function(){gx.O.AV55ValidaCampo1Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO1DATA")},nac:gx.falseFn};
GXValidFnc[16]={fld:"TABCAMPO2",grid:0};
GXValidFnc[19]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO2DATA",gxz:"ZV32NomeCampo2Data",gxold:"OV32NomeCampo2Data",gxvar:"AV32NomeCampo2Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV32NomeCampo2Data=Value},v2z:function(Value){gx.O.ZV32NomeCampo2Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO2DATA",gx.O.AV32NomeCampo2Data,0)},c2v:function(){gx.O.AV32NomeCampo2Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO2DATA")},nac:gx.falseFn};
GXValidFnc[21]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO2DATA",gxz:"ZV9ConteudoCampo2Data",gxold:"OV9ConteudoCampo2Data",gxvar:"AV9ConteudoCampo2Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV9ConteudoCampo2Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV9ConteudoCampo2Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO2DATA",gx.O.AV9ConteudoCampo2Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV9ConteudoCampo2Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO2DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 21 , function() {
});
GXValidFnc[22]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO2DATA",gxz:"ZV56ValidaCampo2Data",gxold:"OV56ValidaCampo2Data",gxvar:"AV56ValidaCampo2Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV56ValidaCampo2Data=Value},v2z:function(Value){gx.O.ZV56ValidaCampo2Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO2DATA",gx.O.AV56ValidaCampo2Data,0)},c2v:function(){gx.O.AV56ValidaCampo2Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO2DATA")},nac:gx.falseFn};
GXValidFnc[23]={fld:"TABCAMPO3",grid:0};
GXValidFnc[26]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO3DATA",gxz:"ZV35NomeCampo3Data",gxold:"OV35NomeCampo3Data",gxvar:"AV35NomeCampo3Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV35NomeCampo3Data=Value},v2z:function(Value){gx.O.ZV35NomeCampo3Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO3DATA",gx.O.AV35NomeCampo3Data,0)},c2v:function(){gx.O.AV35NomeCampo3Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO3DATA")},nac:gx.falseFn};
GXValidFnc[28]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO3DATA",gxz:"ZV12ConteudoCampo3Data",gxold:"OV12ConteudoCampo3Data",gxvar:"AV12ConteudoCampo3Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV12ConteudoCampo3Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV12ConteudoCampo3Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO3DATA",gx.O.AV12ConteudoCampo3Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV12ConteudoCampo3Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO3DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 28 , function() {
});
GXValidFnc[29]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO3DATA",gxz:"ZV57ValidaCampo3Data",gxold:"OV57ValidaCampo3Data",gxvar:"AV57ValidaCampo3Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV57ValidaCampo3Data=Value},v2z:function(Value){gx.O.ZV57ValidaCampo3Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO3DATA",gx.O.AV57ValidaCampo3Data,0)},c2v:function(){gx.O.AV57ValidaCampo3Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO3DATA")},nac:gx.falseFn};
GXValidFnc[30]={fld:"TABCAMPO4",grid:0};
GXValidFnc[33]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO4DATA",gxz:"ZV38NomeCampo4Data",gxold:"OV38NomeCampo4Data",gxvar:"AV38NomeCampo4Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV38NomeCampo4Data=Value},v2z:function(Value){gx.O.ZV38NomeCampo4Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO4DATA",gx.O.AV38NomeCampo4Data,0)},c2v:function(){gx.O.AV38NomeCampo4Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO4DATA")},nac:gx.falseFn};
GXValidFnc[35]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO4DATA",gxz:"ZV15ConteudoCampo4Data",gxold:"OV15ConteudoCampo4Data",gxvar:"AV15ConteudoCampo4Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV15ConteudoCampo4Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV15ConteudoCampo4Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO4DATA",gx.O.AV15ConteudoCampo4Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV15ConteudoCampo4Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO4DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 35 , function() {
});
GXValidFnc[36]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO4DATA",gxz:"ZV58ValidaCampo4Data",gxold:"OV58ValidaCampo4Data",gxvar:"AV58ValidaCampo4Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV58ValidaCampo4Data=Value},v2z:function(Value){gx.O.ZV58ValidaCampo4Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO4DATA",gx.O.AV58ValidaCampo4Data,0)},c2v:function(){gx.O.AV58ValidaCampo4Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO4DATA")},nac:gx.falseFn};
GXValidFnc[37]={fld:"TABCAMPO5",grid:0};
GXValidFnc[40]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO5DATA",gxz:"ZV41NomeCampo5Data",gxold:"OV41NomeCampo5Data",gxvar:"AV41NomeCampo5Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV41NomeCampo5Data=Value},v2z:function(Value){gx.O.ZV41NomeCampo5Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO5DATA",gx.O.AV41NomeCampo5Data,0)},c2v:function(){gx.O.AV41NomeCampo5Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO5DATA")},nac:gx.falseFn};
GXValidFnc[42]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO5DATA",gxz:"ZV18ConteudoCampo5Data",gxold:"OV18ConteudoCampo5Data",gxvar:"AV18ConteudoCampo5Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV18ConteudoCampo5Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV18ConteudoCampo5Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO5DATA",gx.O.AV18ConteudoCampo5Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV18ConteudoCampo5Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO5DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 42 , function() {
});
GXValidFnc[43]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO5DATA",gxz:"ZV59ValidaCampo5Data",gxold:"OV59ValidaCampo5Data",gxvar:"AV59ValidaCampo5Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV59ValidaCampo5Data=Value},v2z:function(Value){gx.O.ZV59ValidaCampo5Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO5DATA",gx.O.AV59ValidaCampo5Data,0)},c2v:function(){gx.O.AV59ValidaCampo5Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO5DATA")},nac:gx.falseFn};
GXValidFnc[44]={fld:"TABCAMPO6",grid:0};
GXValidFnc[47]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO6DATA",gxz:"ZV44NomeCampo6Data",gxold:"OV44NomeCampo6Data",gxvar:"AV44NomeCampo6Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV44NomeCampo6Data=Value},v2z:function(Value){gx.O.ZV44NomeCampo6Data=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO6DATA",gx.O.AV44NomeCampo6Data,0)},c2v:function(){gx.O.AV44NomeCampo6Data=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO6DATA")},nac:gx.falseFn};
GXValidFnc[49]={lvl:0,type:"date",len:10,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO6DATA",gxz:"ZV21ConteudoCampo6Data",gxold:"OV21ConteudoCampo6Data",gxvar:"AV21ConteudoCampo6Data",dp:{f:0,st:false,wn:false,mf:false,pic:"99/99/9999",dec:0},ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV21ConteudoCampo6Data=gx.fn.toDatetimeValue(Value)},v2z:function(Value){gx.O.ZV21ConteudoCampo6Data=gx.fn.toDatetimeValue(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO6DATA",gx.O.AV21ConteudoCampo6Data,0);if (typeof(this.dom_hdl) == 'function') this.dom_hdl.call(gx.O);},c2v:function(){gx.O.AV21ConteudoCampo6Data=gx.fn.toDatetimeValue(this.val())},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO6DATA")},nac:gx.falseFn};
this.declareDomainHdlr( 49 , function() {
});
GXValidFnc[50]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO6DATA",gxz:"ZV60ValidaCampo6Data",gxold:"OV60ValidaCampo6Data",gxvar:"AV60ValidaCampo6Data",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV60ValidaCampo6Data=Value},v2z:function(Value){gx.O.ZV60ValidaCampo6Data=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO6DATA",gx.O.AV60ValidaCampo6Data,0)},c2v:function(){gx.O.AV60ValidaCampo6Data=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO6DATA")},nac:gx.falseFn};
GXValidFnc[51]={fld:"TABCAMPO7",grid:0};
GXValidFnc[54]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO1INTEGER",gxz:"ZV30NomeCampo1Integer",gxold:"OV30NomeCampo1Integer",gxvar:"AV30NomeCampo1Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV30NomeCampo1Integer=Value},v2z:function(Value){gx.O.ZV30NomeCampo1Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO1INTEGER",gx.O.AV30NomeCampo1Integer,0)},c2v:function(){gx.O.AV30NomeCampo1Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO1INTEGER")},nac:gx.falseFn};
GXValidFnc[56]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO1INTEGER",gxz:"ZV7ConteudoCampo1Integer",gxold:"OV7ConteudoCampo1Integer",gxvar:"AV7ConteudoCampo1Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV7ConteudoCampo1Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV7ConteudoCampo1Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO1INTEGER",gx.O.AV7ConteudoCampo1Integer,0)},c2v:function(){gx.O.AV7ConteudoCampo1Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO1INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[57]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO1INTEGER",gxz:"ZV61ValidaCampo1Integer",gxold:"OV61ValidaCampo1Integer",gxvar:"AV61ValidaCampo1Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV61ValidaCampo1Integer=Value},v2z:function(Value){gx.O.ZV61ValidaCampo1Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO1INTEGER",gx.O.AV61ValidaCampo1Integer,0)},c2v:function(){gx.O.AV61ValidaCampo1Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO1INTEGER")},nac:gx.falseFn};
GXValidFnc[58]={fld:"TABCAMPO8",grid:0};
GXValidFnc[61]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO2INTEGER",gxz:"ZV33NomeCampo2Integer",gxold:"OV33NomeCampo2Integer",gxvar:"AV33NomeCampo2Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV33NomeCampo2Integer=Value},v2z:function(Value){gx.O.ZV33NomeCampo2Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO2INTEGER",gx.O.AV33NomeCampo2Integer,0)},c2v:function(){gx.O.AV33NomeCampo2Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO2INTEGER")},nac:gx.falseFn};
GXValidFnc[63]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO2INTEGER",gxz:"ZV10ConteudoCampo2Integer",gxold:"OV10ConteudoCampo2Integer",gxvar:"AV10ConteudoCampo2Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV10ConteudoCampo2Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV10ConteudoCampo2Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO2INTEGER",gx.O.AV10ConteudoCampo2Integer,0)},c2v:function(){gx.O.AV10ConteudoCampo2Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO2INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[64]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO2INTEGER",gxz:"ZV62ValidaCampo2Integer",gxold:"OV62ValidaCampo2Integer",gxvar:"AV62ValidaCampo2Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV62ValidaCampo2Integer=Value},v2z:function(Value){gx.O.ZV62ValidaCampo2Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO2INTEGER",gx.O.AV62ValidaCampo2Integer,0)},c2v:function(){gx.O.AV62ValidaCampo2Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO2INTEGER")},nac:gx.falseFn};
GXValidFnc[65]={fld:"TABCAMPO9",grid:0};
GXValidFnc[68]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO3INTEGER",gxz:"ZV36NomeCampo3Integer",gxold:"OV36NomeCampo3Integer",gxvar:"AV36NomeCampo3Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV36NomeCampo3Integer=Value},v2z:function(Value){gx.O.ZV36NomeCampo3Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO3INTEGER",gx.O.AV36NomeCampo3Integer,0)},c2v:function(){gx.O.AV36NomeCampo3Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO3INTEGER")},nac:gx.falseFn};
GXValidFnc[70]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO3INTEGER",gxz:"ZV13ConteudoCampo3Integer",gxold:"OV13ConteudoCampo3Integer",gxvar:"AV13ConteudoCampo3Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV13ConteudoCampo3Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV13ConteudoCampo3Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO3INTEGER",gx.O.AV13ConteudoCampo3Integer,0)},c2v:function(){gx.O.AV13ConteudoCampo3Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO3INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[71]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO3INTEGER",gxz:"ZV63ValidaCampo3Integer",gxold:"OV63ValidaCampo3Integer",gxvar:"AV63ValidaCampo3Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV63ValidaCampo3Integer=Value},v2z:function(Value){gx.O.ZV63ValidaCampo3Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO3INTEGER",gx.O.AV63ValidaCampo3Integer,0)},c2v:function(){gx.O.AV63ValidaCampo3Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO3INTEGER")},nac:gx.falseFn};
GXValidFnc[72]={fld:"TABCAMPO10",grid:0};
GXValidFnc[75]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO4INTEGER",gxz:"ZV39NomeCampo4Integer",gxold:"OV39NomeCampo4Integer",gxvar:"AV39NomeCampo4Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV39NomeCampo4Integer=Value},v2z:function(Value){gx.O.ZV39NomeCampo4Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO4INTEGER",gx.O.AV39NomeCampo4Integer,0)},c2v:function(){gx.O.AV39NomeCampo4Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO4INTEGER")},nac:gx.falseFn};
GXValidFnc[77]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO4INTEGER",gxz:"ZV16ConteudoCampo4Integer",gxold:"OV16ConteudoCampo4Integer",gxvar:"AV16ConteudoCampo4Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV16ConteudoCampo4Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV16ConteudoCampo4Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO4INTEGER",gx.O.AV16ConteudoCampo4Integer,0)},c2v:function(){gx.O.AV16ConteudoCampo4Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO4INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[78]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO4INTEGER",gxz:"ZV64ValidaCampo4Integer",gxold:"OV64ValidaCampo4Integer",gxvar:"AV64ValidaCampo4Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV64ValidaCampo4Integer=Value},v2z:function(Value){gx.O.ZV64ValidaCampo4Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO4INTEGER",gx.O.AV64ValidaCampo4Integer,0)},c2v:function(){gx.O.AV64ValidaCampo4Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO4INTEGER")},nac:gx.falseFn};
GXValidFnc[79]={fld:"TABCAMPO11",grid:0};
GXValidFnc[82]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO5INTEGER",gxz:"ZV42NomeCampo5Integer",gxold:"OV42NomeCampo5Integer",gxvar:"AV42NomeCampo5Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV42NomeCampo5Integer=Value},v2z:function(Value){gx.O.ZV42NomeCampo5Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO5INTEGER",gx.O.AV42NomeCampo5Integer,0)},c2v:function(){gx.O.AV42NomeCampo5Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO5INTEGER")},nac:gx.falseFn};
GXValidFnc[84]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO5INTEGER",gxz:"ZV19ConteudoCampo5Integer",gxold:"OV19ConteudoCampo5Integer",gxvar:"AV19ConteudoCampo5Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV19ConteudoCampo5Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV19ConteudoCampo5Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO5INTEGER",gx.O.AV19ConteudoCampo5Integer,0)},c2v:function(){gx.O.AV19ConteudoCampo5Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO5INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[85]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO5INTEGER",gxz:"ZV65ValidaCampo5Integer",gxold:"OV65ValidaCampo5Integer",gxvar:"AV65ValidaCampo5Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV65ValidaCampo5Integer=Value},v2z:function(Value){gx.O.ZV65ValidaCampo5Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO5INTEGER",gx.O.AV65ValidaCampo5Integer,0)},c2v:function(){gx.O.AV65ValidaCampo5Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO5INTEGER")},nac:gx.falseFn};
GXValidFnc[86]={fld:"TABCAMPO12",grid:0};
GXValidFnc[89]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO6INTEGER",gxz:"ZV45NomeCampo6Integer",gxold:"OV45NomeCampo6Integer",gxvar:"AV45NomeCampo6Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV45NomeCampo6Integer=Value},v2z:function(Value){gx.O.ZV45NomeCampo6Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO6INTEGER",gx.O.AV45NomeCampo6Integer,0)},c2v:function(){gx.O.AV45NomeCampo6Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO6INTEGER")},nac:gx.falseFn};
GXValidFnc[91]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO6INTEGER",gxz:"ZV22ConteudoCampo6Integer",gxold:"OV22ConteudoCampo6Integer",gxvar:"AV22ConteudoCampo6Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV22ConteudoCampo6Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV22ConteudoCampo6Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO6INTEGER",gx.O.AV22ConteudoCampo6Integer,0)},c2v:function(){gx.O.AV22ConteudoCampo6Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO6INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[92]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO6INTEGER",gxz:"ZV66ValidaCampo6Integer",gxold:"OV66ValidaCampo6Integer",gxvar:"AV66ValidaCampo6Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV66ValidaCampo6Integer=Value},v2z:function(Value){gx.O.ZV66ValidaCampo6Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO6INTEGER",gx.O.AV66ValidaCampo6Integer,0)},c2v:function(){gx.O.AV66ValidaCampo6Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO6INTEGER")},nac:gx.falseFn};
GXValidFnc[93]={fld:"TABCAMPO13",grid:0};
GXValidFnc[96]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO7INTEGER",gxz:"ZV47NomeCampo7Integer",gxold:"OV47NomeCampo7Integer",gxvar:"AV47NomeCampo7Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV47NomeCampo7Integer=Value},v2z:function(Value){gx.O.ZV47NomeCampo7Integer=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO7INTEGER",gx.O.AV47NomeCampo7Integer,0)},c2v:function(){gx.O.AV47NomeCampo7Integer=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO7INTEGER")},nac:gx.falseFn};
GXValidFnc[98]={lvl:0,type:"int",len:10,dec:0,sign:false,pic:"ZZZZZZZZZ9",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO7INTEGER",gxz:"ZV24ConteudoCampo7Integer",gxold:"OV24ConteudoCampo7Integer",gxvar:"AV24ConteudoCampo7Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV24ConteudoCampo7Integer=gx.num.intval(Value)},v2z:function(Value){gx.O.ZV24ConteudoCampo7Integer=gx.num.intval(Value)},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO7INTEGER",gx.O.AV24ConteudoCampo7Integer,0)},c2v:function(){gx.O.AV24ConteudoCampo7Integer=gx.num.intval(this.val())},val:function(){return gx.fn.getIntegerValue("vCONTEUDOCAMPO7INTEGER",'.')},nac:gx.falseFn};
GXValidFnc[99]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO7INTEGER",gxz:"ZV67ValidaCampo7Integer",gxold:"OV67ValidaCampo7Integer",gxvar:"AV67ValidaCampo7Integer",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV67ValidaCampo7Integer=Value},v2z:function(Value){gx.O.ZV67ValidaCampo7Integer=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO7INTEGER",gx.O.AV67ValidaCampo7Integer,0)},c2v:function(){gx.O.AV67ValidaCampo7Integer=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO7INTEGER")},nac:gx.falseFn};
GXValidFnc[100]={fld:"TABCAMPO14",grid:0};
GXValidFnc[103]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO1STRING",gxz:"ZV31NomeCampo1String",gxold:"OV31NomeCampo1String",gxvar:"AV31NomeCampo1String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV31NomeCampo1String=Value},v2z:function(Value){gx.O.ZV31NomeCampo1String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO1STRING",gx.O.AV31NomeCampo1String,0)},c2v:function(){gx.O.AV31NomeCampo1String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO1STRING")},nac:gx.falseFn};
GXValidFnc[105]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO1STRING",gxz:"ZV8ConteudoCampo1String",gxold:"OV8ConteudoCampo1String",gxvar:"AV8ConteudoCampo1String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV8ConteudoCampo1String=Value},v2z:function(Value){gx.O.ZV8ConteudoCampo1String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO1STRING",gx.O.AV8ConteudoCampo1String,0)},c2v:function(){gx.O.AV8ConteudoCampo1String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO1STRING")},nac:gx.falseFn};
GXValidFnc[106]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO1STRING",gxz:"ZV68ValidaCampo1String",gxold:"OV68ValidaCampo1String",gxvar:"AV68ValidaCampo1String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV68ValidaCampo1String=Value},v2z:function(Value){gx.O.ZV68ValidaCampo1String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO1STRING",gx.O.AV68ValidaCampo1String,0)},c2v:function(){gx.O.AV68ValidaCampo1String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO1STRING")},nac:gx.falseFn};
GXValidFnc[107]={fld:"TABCAMPO15",grid:0};
GXValidFnc[110]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO2STRING",gxz:"ZV34NomeCampo2String",gxold:"OV34NomeCampo2String",gxvar:"AV34NomeCampo2String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV34NomeCampo2String=Value},v2z:function(Value){gx.O.ZV34NomeCampo2String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO2STRING",gx.O.AV34NomeCampo2String,0)},c2v:function(){gx.O.AV34NomeCampo2String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO2STRING")},nac:gx.falseFn};
GXValidFnc[112]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO2STRING",gxz:"ZV11ConteudoCampo2String",gxold:"OV11ConteudoCampo2String",gxvar:"AV11ConteudoCampo2String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV11ConteudoCampo2String=Value},v2z:function(Value){gx.O.ZV11ConteudoCampo2String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO2STRING",gx.O.AV11ConteudoCampo2String,0)},c2v:function(){gx.O.AV11ConteudoCampo2String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO2STRING")},nac:gx.falseFn};
GXValidFnc[113]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO2STRING",gxz:"ZV69ValidaCampo2String",gxold:"OV69ValidaCampo2String",gxvar:"AV69ValidaCampo2String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV69ValidaCampo2String=Value},v2z:function(Value){gx.O.ZV69ValidaCampo2String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO2STRING",gx.O.AV69ValidaCampo2String,0)},c2v:function(){gx.O.AV69ValidaCampo2String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO2STRING")},nac:gx.falseFn};
GXValidFnc[114]={fld:"TABCAMPO16",grid:0};
GXValidFnc[117]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO3STRING",gxz:"ZV37NomeCampo3String",gxold:"OV37NomeCampo3String",gxvar:"AV37NomeCampo3String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV37NomeCampo3String=Value},v2z:function(Value){gx.O.ZV37NomeCampo3String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO3STRING",gx.O.AV37NomeCampo3String,0)},c2v:function(){gx.O.AV37NomeCampo3String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO3STRING")},nac:gx.falseFn};
GXValidFnc[119]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO3STRING",gxz:"ZV14ConteudoCampo3String",gxold:"OV14ConteudoCampo3String",gxvar:"AV14ConteudoCampo3String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV14ConteudoCampo3String=Value},v2z:function(Value){gx.O.ZV14ConteudoCampo3String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO3STRING",gx.O.AV14ConteudoCampo3String,0)},c2v:function(){gx.O.AV14ConteudoCampo3String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO3STRING")},nac:gx.falseFn};
GXValidFnc[120]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO3STRING",gxz:"ZV70ValidaCampo3String",gxold:"OV70ValidaCampo3String",gxvar:"AV70ValidaCampo3String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV70ValidaCampo3String=Value},v2z:function(Value){gx.O.ZV70ValidaCampo3String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO3STRING",gx.O.AV70ValidaCampo3String,0)},c2v:function(){gx.O.AV70ValidaCampo3String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO3STRING")},nac:gx.falseFn};
GXValidFnc[121]={fld:"TABCAMPO17",grid:0};
GXValidFnc[124]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO4STRING",gxz:"ZV40NomeCampo4String",gxold:"OV40NomeCampo4String",gxvar:"AV40NomeCampo4String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV40NomeCampo4String=Value},v2z:function(Value){gx.O.ZV40NomeCampo4String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO4STRING",gx.O.AV40NomeCampo4String,0)},c2v:function(){gx.O.AV40NomeCampo4String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO4STRING")},nac:gx.falseFn};
GXValidFnc[126]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO4STRING",gxz:"ZV17ConteudoCampo4String",gxold:"OV17ConteudoCampo4String",gxvar:"AV17ConteudoCampo4String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV17ConteudoCampo4String=Value},v2z:function(Value){gx.O.ZV17ConteudoCampo4String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO4STRING",gx.O.AV17ConteudoCampo4String,0)},c2v:function(){gx.O.AV17ConteudoCampo4String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO4STRING")},nac:gx.falseFn};
GXValidFnc[127]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO4STRING",gxz:"ZV71ValidaCampo4String",gxold:"OV71ValidaCampo4String",gxvar:"AV71ValidaCampo4String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV71ValidaCampo4String=Value},v2z:function(Value){gx.O.ZV71ValidaCampo4String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO4STRING",gx.O.AV71ValidaCampo4String,0)},c2v:function(){gx.O.AV71ValidaCampo4String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO4STRING")},nac:gx.falseFn};
GXValidFnc[128]={fld:"TABCAMPO18",grid:0};
GXValidFnc[131]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO5STRING",gxz:"ZV43NomeCampo5String",gxold:"OV43NomeCampo5String",gxvar:"AV43NomeCampo5String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV43NomeCampo5String=Value},v2z:function(Value){gx.O.ZV43NomeCampo5String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO5STRING",gx.O.AV43NomeCampo5String,0)},c2v:function(){gx.O.AV43NomeCampo5String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO5STRING")},nac:gx.falseFn};
GXValidFnc[133]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO5STRING",gxz:"ZV20ConteudoCampo5String",gxold:"OV20ConteudoCampo5String",gxvar:"AV20ConteudoCampo5String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV20ConteudoCampo5String=Value},v2z:function(Value){gx.O.ZV20ConteudoCampo5String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO5STRING",gx.O.AV20ConteudoCampo5String,0)},c2v:function(){gx.O.AV20ConteudoCampo5String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO5STRING")},nac:gx.falseFn};
GXValidFnc[134]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO5STRING",gxz:"ZV72ValidaCampo5String",gxold:"OV72ValidaCampo5String",gxvar:"AV72ValidaCampo5String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV72ValidaCampo5String=Value},v2z:function(Value){gx.O.ZV72ValidaCampo5String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO5STRING",gx.O.AV72ValidaCampo5String,0)},c2v:function(){gx.O.AV72ValidaCampo5String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO5STRING")},nac:gx.falseFn};
GXValidFnc[135]={fld:"TABCAMPO19",grid:0};
GXValidFnc[138]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO6STRING",gxz:"ZV46NomeCampo6String",gxold:"OV46NomeCampo6String",gxvar:"AV46NomeCampo6String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV46NomeCampo6String=Value},v2z:function(Value){gx.O.ZV46NomeCampo6String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO6STRING",gx.O.AV46NomeCampo6String,0)},c2v:function(){gx.O.AV46NomeCampo6String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO6STRING")},nac:gx.falseFn};
GXValidFnc[140]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO6STRING",gxz:"ZV23ConteudoCampo6String",gxold:"OV23ConteudoCampo6String",gxvar:"AV23ConteudoCampo6String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV23ConteudoCampo6String=Value},v2z:function(Value){gx.O.ZV23ConteudoCampo6String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO6STRING",gx.O.AV23ConteudoCampo6String,0)},c2v:function(){gx.O.AV23ConteudoCampo6String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO6STRING")},nac:gx.falseFn};
GXValidFnc[141]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO6STRING",gxz:"ZV73ValidaCampo6String",gxold:"OV73ValidaCampo6String",gxvar:"AV73ValidaCampo6String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV73ValidaCampo6String=Value},v2z:function(Value){gx.O.ZV73ValidaCampo6String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO6STRING",gx.O.AV73ValidaCampo6String,0)},c2v:function(){gx.O.AV73ValidaCampo6String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO6STRING")},nac:gx.falseFn};
GXValidFnc[142]={fld:"TABCAMPO20",grid:0};
GXValidFnc[145]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO7STRING",gxz:"ZV48NomeCampo7String",gxold:"OV48NomeCampo7String",gxvar:"AV48NomeCampo7String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV48NomeCampo7String=Value},v2z:function(Value){gx.O.ZV48NomeCampo7String=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO7STRING",gx.O.AV48NomeCampo7String,0)},c2v:function(){gx.O.AV48NomeCampo7String=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO7STRING")},nac:gx.falseFn};
GXValidFnc[147]={lvl:0,type:"svchar",len:60,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO7STRING",gxz:"ZV25ConteudoCampo7String",gxold:"OV25ConteudoCampo7String",gxvar:"AV25ConteudoCampo7String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV25ConteudoCampo7String=Value},v2z:function(Value){gx.O.ZV25ConteudoCampo7String=Value},v2c:function(){gx.fn.setControlValue("vCONTEUDOCAMPO7STRING",gx.O.AV25ConteudoCampo7String,0)},c2v:function(){gx.O.AV25ConteudoCampo7String=this.val()},val:function(){return gx.fn.getControlValue("vCONTEUDOCAMPO7STRING")},nac:gx.falseFn};
GXValidFnc[148]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO7STRING",gxz:"ZV74ValidaCampo7String",gxold:"OV74ValidaCampo7String",gxvar:"AV74ValidaCampo7String",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV74ValidaCampo7String=Value},v2z:function(Value){gx.O.ZV74ValidaCampo7String=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO7STRING",gx.O.AV74ValidaCampo7String,0)},c2v:function(){gx.O.AV74ValidaCampo7String=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO7STRING")},nac:gx.falseFn};
GXValidFnc[149]={fld:"TABCAMPO21",grid:0};
GXValidFnc[152]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO1NUMERICO",gxz:"ZV79NomeCampo1Numerico",gxold:"OV79NomeCampo1Numerico",gxvar:"AV79NomeCampo1Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV79NomeCampo1Numerico=Value},v2z:function(Value){gx.O.ZV79NomeCampo1Numerico=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO1NUMERICO",gx.O.AV79NomeCampo1Numerico,0)},c2v:function(){gx.O.AV79NomeCampo1Numerico=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO1NUMERICO")},nac:gx.falseFn};
GXValidFnc[154]={lvl:0,type:"decimal",len:18,dec:6,sign:false,pic:"ZZ,ZZZ,ZZZ,ZZ9.999999",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO1NUMERICO",gxz:"ZV75ConteudoCampo1Numerico",gxold:"OV75ConteudoCampo1Numerico",gxvar:"AV75ConteudoCampo1Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV75ConteudoCampo1Numerico=gx.fn.toDecimalValue(Value,',','.')},v2z:function(Value){gx.O.ZV75ConteudoCampo1Numerico=gx.fn.toDecimalValue(Value,'.',',')},v2c:function(){gx.fn.setDecimalValue("vCONTEUDOCAMPO1NUMERICO",gx.O.AV75ConteudoCampo1Numerico,6,',')},c2v:function(){gx.O.AV75ConteudoCampo1Numerico=this.val()},val:function(){return gx.fn.getDecimalValue("vCONTEUDOCAMPO1NUMERICO",'.',',')},nac:gx.falseFn};
GXValidFnc[155]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO1NUMERICO",gxz:"ZV83ValidaCampo1Numerico",gxold:"OV83ValidaCampo1Numerico",gxvar:"AV83ValidaCampo1Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV83ValidaCampo1Numerico=Value},v2z:function(Value){gx.O.ZV83ValidaCampo1Numerico=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO1NUMERICO",gx.O.AV83ValidaCampo1Numerico,0)},c2v:function(){gx.O.AV83ValidaCampo1Numerico=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO1NUMERICO")},nac:gx.falseFn};
GXValidFnc[156]={fld:"TABCAMPO22",grid:0};
GXValidFnc[159]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO2NUMERICO",gxz:"ZV80NomeCampo2Numerico",gxold:"OV80NomeCampo2Numerico",gxvar:"AV80NomeCampo2Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV80NomeCampo2Numerico=Value},v2z:function(Value){gx.O.ZV80NomeCampo2Numerico=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO2NUMERICO",gx.O.AV80NomeCampo2Numerico,0)},c2v:function(){gx.O.AV80NomeCampo2Numerico=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO2NUMERICO")},nac:gx.falseFn};
GXValidFnc[161]={lvl:0,type:"decimal",len:18,dec:6,sign:false,pic:"ZZ,ZZZ,ZZZ,ZZ9.999999",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO2NUMERICO",gxz:"ZV76ConteudoCampo2Numerico",gxold:"OV76ConteudoCampo2Numerico",gxvar:"AV76ConteudoCampo2Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV76ConteudoCampo2Numerico=gx.fn.toDecimalValue(Value,',','.')},v2z:function(Value){gx.O.ZV76ConteudoCampo2Numerico=gx.fn.toDecimalValue(Value,'.',',')},v2c:function(){gx.fn.setDecimalValue("vCONTEUDOCAMPO2NUMERICO",gx.O.AV76ConteudoCampo2Numerico,6,',')},c2v:function(){gx.O.AV76ConteudoCampo2Numerico=this.val()},val:function(){return gx.fn.getDecimalValue("vCONTEUDOCAMPO2NUMERICO",'.',',')},nac:gx.falseFn};
GXValidFnc[162]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO2NUMERICO",gxz:"ZV84ValidaCampo2Numerico",gxold:"OV84ValidaCampo2Numerico",gxvar:"AV84ValidaCampo2Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV84ValidaCampo2Numerico=Value},v2z:function(Value){gx.O.ZV84ValidaCampo2Numerico=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO2NUMERICO",gx.O.AV84ValidaCampo2Numerico,0)},c2v:function(){gx.O.AV84ValidaCampo2Numerico=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO2NUMERICO")},nac:gx.falseFn};
GXValidFnc[163]={fld:"TABCAMPO23",grid:0};
GXValidFnc[166]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO3NUMERICO",gxz:"ZV81NomeCampo3Numerico",gxold:"OV81NomeCampo3Numerico",gxvar:"AV81NomeCampo3Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV81NomeCampo3Numerico=Value},v2z:function(Value){gx.O.ZV81NomeCampo3Numerico=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO3NUMERICO",gx.O.AV81NomeCampo3Numerico,0)},c2v:function(){gx.O.AV81NomeCampo3Numerico=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO3NUMERICO")},nac:gx.falseFn};
GXValidFnc[168]={lvl:0,type:"decimal",len:18,dec:6,sign:false,pic:"ZZ,ZZZ,ZZZ,ZZ9.999999",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO3NUMERICO",gxz:"ZV77ConteudoCampo3Numerico",gxold:"OV77ConteudoCampo3Numerico",gxvar:"AV77ConteudoCampo3Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV77ConteudoCampo3Numerico=gx.fn.toDecimalValue(Value,',','.')},v2z:function(Value){gx.O.ZV77ConteudoCampo3Numerico=gx.fn.toDecimalValue(Value,'.',',')},v2c:function(){gx.fn.setDecimalValue("vCONTEUDOCAMPO3NUMERICO",gx.O.AV77ConteudoCampo3Numerico,6,',')},c2v:function(){gx.O.AV77ConteudoCampo3Numerico=this.val()},val:function(){return gx.fn.getDecimalValue("vCONTEUDOCAMPO3NUMERICO",'.',',')},nac:gx.falseFn};
GXValidFnc[169]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO3NUMERICO",gxz:"ZV85ValidaCampo3Numerico",gxold:"OV85ValidaCampo3Numerico",gxvar:"AV85ValidaCampo3Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV85ValidaCampo3Numerico=Value},v2z:function(Value){gx.O.ZV85ValidaCampo3Numerico=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO3NUMERICO",gx.O.AV85ValidaCampo3Numerico,0)},c2v:function(){gx.O.AV85ValidaCampo3Numerico=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO3NUMERICO")},nac:gx.falseFn};
GXValidFnc[170]={fld:"TABCAMPO24",grid:0};
GXValidFnc[173]={lvl:0,type:"svchar",len:31,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vNOMECAMPO4NUMERICO",gxz:"ZV82NomeCampo4Numerico",gxold:"OV82NomeCampo4Numerico",gxvar:"AV82NomeCampo4Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV82NomeCampo4Numerico=Value},v2z:function(Value){gx.O.ZV82NomeCampo4Numerico=Value},v2c:function(){gx.fn.setControlValue("vNOMECAMPO4NUMERICO",gx.O.AV82NomeCampo4Numerico,0)},c2v:function(){gx.O.AV82NomeCampo4Numerico=this.val()},val:function(){return gx.fn.getControlValue("vNOMECAMPO4NUMERICO")},nac:gx.falseFn};
GXValidFnc[175]={lvl:0,type:"decimal",len:18,dec:6,sign:false,pic:"ZZ,ZZZ,ZZZ,ZZ9.999999",ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vCONTEUDOCAMPO4NUMERICO",gxz:"ZV78ConteudoCampo4Numerico",gxold:"OV78ConteudoCampo4Numerico",gxvar:"AV78ConteudoCampo4Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV78ConteudoCampo4Numerico=gx.fn.toDecimalValue(Value,',','.')},v2z:function(Value){gx.O.ZV78ConteudoCampo4Numerico=gx.fn.toDecimalValue(Value,'.',',')},v2c:function(){gx.fn.setDecimalValue("vCONTEUDOCAMPO4NUMERICO",gx.O.AV78ConteudoCampo4Numerico,6,',')},c2v:function(){gx.O.AV78ConteudoCampo4Numerico=this.val()},val:function(){return gx.fn.getDecimalValue("vCONTEUDOCAMPO4NUMERICO",'.',',')},nac:gx.falseFn};
GXValidFnc[176]={lvl:0,type:"char",len:1,dec:0,sign:false,ro:0,grid:0,gxgrid:null,fnc:null,isvalid:null,rgrid:[],fld:"vVALIDACAMPO4NUMERICO",gxz:"ZV86ValidaCampo4Numerico",gxold:"OV86ValidaCampo4Numerico",gxvar:"AV86ValidaCampo4Numerico",ucs:[],op:[],ip:[],nacdep:[],ctrltype:"edit",v2v:function(Value){gx.O.AV86ValidaCampo4Numerico=Value},v2z:function(Value){gx.O.ZV86ValidaCampo4Numerico=Value},v2c:function(){gx.fn.setControlValue("vVALIDACAMPO4NUMERICO",gx.O.AV86ValidaCampo4Numerico,0)},c2v:function(){gx.O.AV86ValidaCampo4Numerico=this.val()},val:function(){return gx.fn.getControlValue("vVALIDACAMPO4NUMERICO")},nac:gx.falseFn};
GXValidFnc[177]={fld:"DIV2", format:2,grid:0};
GXValidFnc[185]={fld:"JS", format:2,grid:0};
this.AV29NomeCampo1Data = "" ;
this.ZV29NomeCampo1Data = "" ;
this.OV29NomeCampo1Data = "" ;
this.AV6ConteudoCampo1Data = gx.date.nullDate() ;
this.ZV6ConteudoCampo1Data = gx.date.nullDate() ;
this.OV6ConteudoCampo1Data = gx.date.nullDate() ;
this.AV55ValidaCampo1Data = "" ;
this.ZV55ValidaCampo1Data = "" ;
this.OV55ValidaCampo1Data = "" ;
this.AV32NomeCampo2Data = "" ;
this.ZV32NomeCampo2Data = "" ;
this.OV32NomeCampo2Data = "" ;
this.AV9ConteudoCampo2Data = gx.date.nullDate() ;
this.ZV9ConteudoCampo2Data = gx.date.nullDate() ;
this.OV9ConteudoCampo2Data = gx.date.nullDate() ;
this.AV56ValidaCampo2Data = "" ;
this.ZV56ValidaCampo2Data = "" ;
this.OV56ValidaCampo2Data = "" ;
this.AV35NomeCampo3Data = "" ;
this.ZV35NomeCampo3Data = "" ;
this.OV35NomeCampo3Data = "" ;
this.AV12ConteudoCampo3Data = gx.date.nullDate() ;
this.ZV12ConteudoCampo3Data = gx.date.nullDate() ;
this.OV12ConteudoCampo3Data = gx.date.nullDate() ;
this.AV57ValidaCampo3Data = "" ;
this.ZV57ValidaCampo3Data = "" ;
this.OV57ValidaCampo3Data = "" ;
this.AV38NomeCampo4Data = "" ;
this.ZV38NomeCampo4Data = "" ;
this.OV38NomeCampo4Data = "" ;
this.AV15ConteudoCampo4Data = gx.date.nullDate() ;
this.ZV15ConteudoCampo4Data = gx.date.nullDate() ;
this.OV15ConteudoCampo4Data = gx.date.nullDate() ;
this.AV58ValidaCampo4Data = "" ;
this.ZV58ValidaCampo4Data = "" ;
this.OV58ValidaCampo4Data = "" ;
this.AV41NomeCampo5Data = "" ;
this.ZV41NomeCampo5Data = "" ;
this.OV41NomeCampo5Data = "" ;
this.AV18ConteudoCampo5Data = gx.date.nullDate() ;
this.ZV18ConteudoCampo5Data = gx.date.nullDate() ;
this.OV18ConteudoCampo5Data = gx.date.nullDate() ;
this.AV59ValidaCampo5Data = "" ;
this.ZV59ValidaCampo5Data = "" ;
this.OV59ValidaCampo5Data = "" ;
this.AV44NomeCampo6Data = "" ;
this.ZV44NomeCampo6Data = "" ;
this.OV44NomeCampo6Data = "" ;
this.AV21ConteudoCampo6Data = gx.date.nullDate() ;
this.ZV21ConteudoCampo6Data = gx.date.nullDate() ;
this.OV21ConteudoCampo6Data = gx.date.nullDate() ;
this.AV60ValidaCampo6Data = "" ;
this.ZV60ValidaCampo6Data = "" ;
this.OV60ValidaCampo6Data = "" ;
this.AV30NomeCampo1Integer = "" ;
this.ZV30NomeCampo1Integer = "" ;
this.OV30NomeCampo1Integer = "" ;
this.AV7ConteudoCampo1Integer = 0 ;
this.ZV7ConteudoCampo1Integer = 0 ;
this.OV7ConteudoCampo1Integer = 0 ;
this.AV61ValidaCampo1Integer = "" ;
this.ZV61ValidaCampo1Integer = "" ;
this.OV61ValidaCampo1Integer = "" ;
this.AV33NomeCampo2Integer = "" ;
this.ZV33NomeCampo2Integer = "" ;
this.OV33NomeCampo2Integer = "" ;
this.AV10ConteudoCampo2Integer = 0 ;
this.ZV10ConteudoCampo2Integer = 0 ;
this.OV10ConteudoCampo2Integer = 0 ;
this.AV62ValidaCampo2Integer = "" ;
this.ZV62ValidaCampo2Integer = "" ;
this.OV62ValidaCampo2Integer = "" ;
this.AV36NomeCampo3Integer = "" ;
this.ZV36NomeCampo3Integer = "" ;
this.OV36NomeCampo3Integer = "" ;
this.AV13ConteudoCampo3Integer = 0 ;
this.ZV13ConteudoCampo3Integer = 0 ;
this.OV13ConteudoCampo3Integer = 0 ;
this.AV63ValidaCampo3Integer = "" ;
this.ZV63ValidaCampo3Integer = "" ;
this.OV63ValidaCampo3Integer = "" ;
this.AV39NomeCampo4Integer = "" ;
this.ZV39NomeCampo4Integer = "" ;
this.OV39NomeCampo4Integer = "" ;
this.AV16ConteudoCampo4Integer = 0 ;
this.ZV16ConteudoCampo4Integer = 0 ;
this.OV16ConteudoCampo4Integer = 0 ;
this.AV64ValidaCampo4Integer = "" ;
this.ZV64ValidaCampo4Integer = "" ;
this.OV64ValidaCampo4Integer = "" ;
this.AV42NomeCampo5Integer = "" ;
this.ZV42NomeCampo5Integer = "" ;
this.OV42NomeCampo5Integer = "" ;
this.AV19ConteudoCampo5Integer = 0 ;
this.ZV19ConteudoCampo5Integer = 0 ;
this.OV19ConteudoCampo5Integer = 0 ;
this.AV65ValidaCampo5Integer = "" ;
this.ZV65ValidaCampo5Integer = "" ;
this.OV65ValidaCampo5Integer = "" ;
this.AV45NomeCampo6Integer = "" ;
this.ZV45NomeCampo6Integer = "" ;
this.OV45NomeCampo6Integer = "" ;
this.AV22ConteudoCampo6Integer = 0 ;
this.ZV22ConteudoCampo6Integer = 0 ;
this.OV22ConteudoCampo6Integer = 0 ;
this.AV66ValidaCampo6Integer = "" ;
this.ZV66ValidaCampo6Integer = "" ;
this.OV66ValidaCampo6Integer = "" ;
this.AV47NomeCampo7Integer = "" ;
this.ZV47NomeCampo7Integer = "" ;
this.OV47NomeCampo7Integer = "" ;
this.AV24ConteudoCampo7Integer = 0 ;
this.ZV24ConteudoCampo7Integer = 0 ;
this.OV24ConteudoCampo7Integer = 0 ;
this.AV67ValidaCampo7Integer = "" ;
this.ZV67ValidaCampo7Integer = "" ;
this.OV67ValidaCampo7Integer = "" ;
this.AV31NomeCampo1String = "" ;
this.ZV31NomeCampo1String = "" ;
this.OV31NomeCampo1String = "" ;
this.AV8ConteudoCampo1String = "" ;
this.ZV8ConteudoCampo1String = "" ;
this.OV8ConteudoCampo1String = "" ;
this.AV68ValidaCampo1String = "" ;
this.ZV68ValidaCampo1String = "" ;
this.OV68ValidaCampo1String = "" ;
this.AV34NomeCampo2String = "" ;
this.ZV34NomeCampo2String = "" ;
this.OV34NomeCampo2String = "" ;
this.AV11ConteudoCampo2String = "" ;
this.ZV11ConteudoCampo2String = "" ;
this.OV11ConteudoCampo2String = "" ;
this.AV69ValidaCampo2String = "" ;
this.ZV69ValidaCampo2String = "" ;
this.OV69ValidaCampo2String = "" ;
this.AV37NomeCampo3String = "" ;
this.ZV37NomeCampo3String = "" ;
this.OV37NomeCampo3String = "" ;
this.AV14ConteudoCampo3String = "" ;
this.ZV14ConteudoCampo3String = "" ;
this.OV14ConteudoCampo3String = "" ;
this.AV70ValidaCampo3String = "" ;
this.ZV70ValidaCampo3String = "" ;
this.OV70ValidaCampo3String = "" ;
this.AV40NomeCampo4String = "" ;
this.ZV40NomeCampo4String = "" ;
this.OV40NomeCampo4String = "" ;
this.AV17ConteudoCampo4String = "" ;
this.ZV17ConteudoCampo4String = "" ;
this.OV17ConteudoCampo4String = "" ;
this.AV71ValidaCampo4String = "" ;
this.ZV71ValidaCampo4String = "" ;
this.OV71ValidaCampo4String = "" ;
this.AV43NomeCampo5String = "" ;
this.ZV43NomeCampo5String = "" ;
this.OV43NomeCampo5String = "" ;
this.AV20ConteudoCampo5String = "" ;
this.ZV20ConteudoCampo5String = "" ;
this.OV20ConteudoCampo5String = "" ;
this.AV72ValidaCampo5String = "" ;
this.ZV72ValidaCampo5String = "" ;
this.OV72ValidaCampo5String = "" ;
this.AV46NomeCampo6String = "" ;
this.ZV46NomeCampo6String = "" ;
this.OV46NomeCampo6String = "" ;
this.AV23ConteudoCampo6String = "" ;
this.ZV23ConteudoCampo6String = "" ;
this.OV23ConteudoCampo6String = "" ;
this.AV73ValidaCampo6String = "" ;
this.ZV73ValidaCampo6String = "" ;
this.OV73ValidaCampo6String = "" ;
this.AV48NomeCampo7String = "" ;
this.ZV48NomeCampo7String = "" ;
this.OV48NomeCampo7String = "" ;
this.AV25ConteudoCampo7String = "" ;
this.ZV25ConteudoCampo7String = "" ;
this.OV25ConteudoCampo7String = "" ;
this.AV74ValidaCampo7String = "" ;
this.ZV74ValidaCampo7String = "" ;
this.OV74ValidaCampo7String = "" ;
this.AV79NomeCampo1Numerico = "" ;
this.ZV79NomeCampo1Numerico = "" ;
this.OV79NomeCampo1Numerico = "" ;
this.AV75ConteudoCampo1Numerico = 0 ;
this.ZV75ConteudoCampo1Numerico = 0 ;
this.OV75ConteudoCampo1Numerico = 0 ;
this.AV83ValidaCampo1Numerico = "" ;
this.ZV83ValidaCampo1Numerico = "" ;
this.OV83ValidaCampo1Numerico = "" ;
this.AV80NomeCampo2Numerico = "" ;
this.ZV80NomeCampo2Numerico = "" ;
this.OV80NomeCampo2Numerico = "" ;
this.AV76ConteudoCampo2Numerico = 0 ;
this.ZV76ConteudoCampo2Numerico = 0 ;
this.OV76ConteudoCampo2Numerico = 0 ;
this.AV84ValidaCampo2Numerico = "" ;
this.ZV84ValidaCampo2Numerico = "" ;
this.OV84ValidaCampo2Numerico = "" ;
this.AV81NomeCampo3Numerico = "" ;
this.ZV81NomeCampo3Numerico = "" ;
this.OV81NomeCampo3Numerico = "" ;
this.AV77ConteudoCampo3Numerico = 0 ;
this.ZV77ConteudoCampo3Numerico = 0 ;
this.OV77ConteudoCampo3Numerico = 0 ;
this.AV85ValidaCampo3Numerico = "" ;
this.ZV85ValidaCampo3Numerico = "" ;
this.OV85ValidaCampo3Numerico = "" ;
this.AV82NomeCampo4Numerico = "" ;
this.ZV82NomeCampo4Numerico = "" ;
this.OV82NomeCampo4Numerico = "" ;
this.AV78ConteudoCampo4Numerico = 0 ;
this.ZV78ConteudoCampo4Numerico = 0 ;
this.OV78ConteudoCampo4Numerico = 0 ;
this.AV86ValidaCampo4Numerico = "" ;
this.ZV86ValidaCampo4Numerico = "" ;
this.OV86ValidaCampo4Numerico = "" ;
this.AV29NomeCampo1Data = "" ;
this.AV6ConteudoCampo1Data = gx.date.nullDate() ;
this.AV55ValidaCampo1Data = "" ;
this.AV32NomeCampo2Data = "" ;
this.AV9ConteudoCampo2Data = gx.date.nullDate() ;
this.AV56ValidaCampo2Data = "" ;
this.AV35NomeCampo3Data = "" ;
this.AV12ConteudoCampo3Data = gx.date.nullDate() ;
this.AV57ValidaCampo3Data = "" ;
this.AV38NomeCampo4Data = "" ;
this.AV15ConteudoCampo4Data = gx.date.nullDate() ;
this.AV58ValidaCampo4Data = "" ;
this.AV41NomeCampo5Data = "" ;
this.AV18ConteudoCampo5Data = gx.date.nullDate() ;
this.AV59ValidaCampo5Data = "" ;
this.AV44NomeCampo6Data = "" ;
this.AV21ConteudoCampo6Data = gx.date.nullDate() ;
this.AV60ValidaCampo6Data = "" ;
this.AV30NomeCampo1Integer = "" ;
this.AV7ConteudoCampo1Integer = 0 ;
this.AV61ValidaCampo1Integer = "" ;
this.AV33NomeCampo2Integer = "" ;
this.AV10ConteudoCampo2Integer = 0 ;
this.AV62ValidaCampo2Integer = "" ;
this.AV36NomeCampo3Integer = "" ;
this.AV13ConteudoCampo3Integer = 0 ;
this.AV63ValidaCampo3Integer = "" ;
this.AV39NomeCampo4Integer = "" ;
this.AV16ConteudoCampo4Integer = 0 ;
this.AV64ValidaCampo4Integer = "" ;
this.AV42NomeCampo5Integer = "" ;
this.AV19ConteudoCampo5Integer = 0 ;
this.AV65ValidaCampo5Integer = "" ;
this.AV45NomeCampo6Integer = "" ;
this.AV22ConteudoCampo6Integer = 0 ;
this.AV66ValidaCampo6Integer = "" ;
this.AV47NomeCampo7Integer = "" ;
this.AV24ConteudoCampo7Integer = 0 ;
this.AV67ValidaCampo7Integer = "" ;
this.AV31NomeCampo1String = "" ;
this.AV8ConteudoCampo1String = "" ;
this.AV68ValidaCampo1String = "" ;
this.AV34NomeCampo2String = "" ;
this.AV11ConteudoCampo2String = "" ;
this.AV69ValidaCampo2String = "" ;
this.AV37NomeCampo3String = "" ;
this.AV14ConteudoCampo3String = "" ;
this.AV70ValidaCampo3String = "" ;
this.AV40NomeCampo4String = "" ;
this.AV17ConteudoCampo4String = "" ;
this.AV71ValidaCampo4String = "" ;
this.AV43NomeCampo5String = "" ;
this.AV20ConteudoCampo5String = "" ;
this.AV72ValidaCampo5String = "" ;
this.AV46NomeCampo6String = "" ;
this.AV23ConteudoCampo6String = "" ;
this.AV73ValidaCampo6String = "" ;
this.AV48NomeCampo7String = "" ;
this.AV25ConteudoCampo7String = "" ;
this.AV74ValidaCampo7String = "" ;
this.AV79NomeCampo1Numerico = "" ;
this.AV75ConteudoCampo1Numerico = 0 ;
this.AV83ValidaCampo1Numerico = "" ;
this.AV80NomeCampo2Numerico = "" ;
this.AV76ConteudoCampo2Numerico = 0 ;
this.AV84ValidaCampo2Numerico = "" ;
this.AV81NomeCampo3Numerico = "" ;
this.AV77ConteudoCampo3Numerico = 0 ;
this.AV85ValidaCampo3Numerico = "" ;
this.AV82NomeCampo4Numerico = "" ;
this.AV78ConteudoCampo4Numerico = 0 ;
this.AV86ValidaCampo4Numerico = "" ;
this.Events = {"e1220d2_client": ["ENTER", true] ,"e1420d2_client": ["'FECHAR'", true] ,"e1620d2_client": ["CANCEL", true]};
this.EvtParms["REFRESH"] = [[{av:'AV29NomeCampo1Data',fld:'vNOMECAMPO1DATA'},{av:'AV32NomeCampo2Data',fld:'vNOMECAMPO2DATA'},{av:'AV35NomeCampo3Data',fld:'vNOMECAMPO3DATA'},{av:'AV38NomeCampo4Data',fld:'vNOMECAMPO4DATA'},{av:'AV41NomeCampo5Data',fld:'vNOMECAMPO5DATA'},{av:'AV44NomeCampo6Data',fld:'vNOMECAMPO6DATA'},{av:'AV30NomeCampo1Integer',fld:'vNOMECAMPO1INTEGER'},{av:'AV33NomeCampo2Integer',fld:'vNOMECAMPO2INTEGER'},{av:'AV36NomeCampo3Integer',fld:'vNOMECAMPO3INTEGER'},{av:'AV39NomeCampo4Integer',fld:'vNOMECAMPO4INTEGER'},{av:'AV42NomeCampo5Integer',fld:'vNOMECAMPO5INTEGER'},{av:'AV45NomeCampo6Integer',fld:'vNOMECAMPO6INTEGER'},{av:'AV47NomeCampo7Integer',fld:'vNOMECAMPO7INTEGER'},{av:'AV79NomeCampo1Numerico',fld:'vNOMECAMPO1NUMERICO'},{av:'AV80NomeCampo2Numerico',fld:'vNOMECAMPO2NUMERICO'},{av:'AV81NomeCampo3Numerico',fld:'vNOMECAMPO3NUMERICO'},{av:'AV82NomeCampo4Numerico',fld:'vNOMECAMPO4NUMERICO'},{av:'AV31NomeCampo1String',fld:'vNOMECAMPO1STRING'},{av:'AV34NomeCampo2String',fld:'vNOMECAMPO2STRING'},{av:'AV37NomeCampo3String',fld:'vNOMECAMPO3STRING'},{av:'AV40NomeCampo4String',fld:'vNOMECAMPO4STRING'},{av:'AV43NomeCampo5String',fld:'vNOMECAMPO5STRING'},{av:'AV46NomeCampo6String',fld:'vNOMECAMPO6STRING'},{av:'AV48NomeCampo7String',fld:'vNOMECAMPO7STRING'}],[{av:'gx.fn.getCtrlProperty("vVALIDACAMPO1DATA","Visible")',ctrl:'vVALIDACAMPO1DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO2DATA","Visible")',ctrl:'vVALIDACAMPO2DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO3DATA","Visible")',ctrl:'vVALIDACAMPO3DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO4DATA","Visible")',ctrl:'vVALIDACAMPO4DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO5DATA","Visible")',ctrl:'vVALIDACAMPO5DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO6DATA","Visible")',ctrl:'vVALIDACAMPO6DATA',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO1INTEGER","Visible")',ctrl:'vVALIDACAMPO1INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO2INTEGER","Visible")',ctrl:'vVALIDACAMPO2INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO3INTEGER","Visible")',ctrl:'vVALIDACAMPO3INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO4INTEGER","Visible")',ctrl:'vVALIDACAMPO4INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO5INTEGER","Visible")',ctrl:'vVALIDACAMPO5INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO6INTEGER","Visible")',ctrl:'vVALIDACAMPO6INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO7INTEGER","Visible")',ctrl:'vVALIDACAMPO7INTEGER',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO1STRING","Visible")',ctrl:'vVALIDACAMPO1STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO2STRING","Visible")',ctrl:'vVALIDACAMPO2STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO3STRING","Visible")',ctrl:'vVALIDACAMPO3STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO4STRING","Visible")',ctrl:'vVALIDACAMPO4STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO5STRING","Visible")',ctrl:'vVALIDACAMPO5STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO6STRING","Visible")',ctrl:'vVALIDACAMPO6STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO7STRING","Visible")',ctrl:'vVALIDACAMPO7STRING',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO1NUMERICO","Visible")',ctrl:'vVALIDACAMPO1NUMERICO',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO2NUMERICO","Visible")',ctrl:'vVALIDACAMPO2NUMERICO',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO3NUMERICO","Visible")',ctrl:'vVALIDACAMPO3NUMERICO',prop:'Visible'},{av:'gx.fn.getCtrlProperty("vVALIDACAMPO4NUMERICO","Visible")',ctrl:'vVALIDACAMPO4NUMERICO',prop:'Visible'},{av:'AV50SdtCampos',fld:'vSDTCAMPOS'},{av:'AV89GXV1',fld:'vGXV1'},{av:'AV51SdtCamposItem',fld:'vSDTCAMPOSITEM'},{av:'AV44NomeCampo6Data',fld:'vNOMECAMPO6DATA'},{av:'AV60ValidaCampo6Data',fld:'vVALIDACAMPO6DATA'},{av:'AV41NomeCampo5Data',fld:'vNOMECAMPO5DATA'},{av:'AV59ValidaCampo5Data',fld:'vVALIDACAMPO5DATA'},{av:'AV38NomeCampo4Data',fld:'vNOMECAMPO4DATA'},{av:'AV58ValidaCampo4Data',fld:'vVALIDACAMPO4DATA'},{av:'AV35NomeCampo3Data',fld:'vNOMECAMPO3DATA'},{av:'AV57ValidaCampo3Data',fld:'vVALIDACAMPO3DATA'},{av:'AV32NomeCampo2Data',fld:'vNOMECAMPO2DATA'},{av:'AV56ValidaCampo2Data',fld:'vVALIDACAMPO2DATA'},{av:'AV29NomeCampo1Data',fld:'vNOMECAMPO1DATA'},{av:'AV55ValidaCampo1Data',fld:'vVALIDACAMPO1DATA'},{av:'AV47NomeCampo7Integer',fld:'vNOMECAMPO7INTEGER'},{av:'AV67ValidaCampo7Integer',fld:'vVALIDACAMPO7INTEGER'},{av:'AV45NomeCampo6Integer',fld:'vNOMECAMPO6INTEGER'},{av:'AV66ValidaCampo6Integer',fld:'vVALIDACAMPO6INTEGER'},{av:'AV42NomeCampo5Integer',fld:'vNOMECAMPO5INTEGER'},{av:'AV65ValidaCampo5Integer',fld:'vVALIDACAMPO5INTEGER'},{av:'AV39NomeCampo4Integer',fld:'vNOMECAMPO4INTEGER'},{av:'AV64ValidaCampo4Integer',fld:'vVALIDACAMPO4INTEGER'},{av:'AV36NomeCampo3Integer',fld:'vNOMECAMPO3INTEGER'},{av:'AV63ValidaCampo3Integer',fld:'vVALIDACAMPO3INTEGER'},{av:'AV33NomeCampo2Integer',fld:'vNOMECAMPO2INTEGER'},{av:'AV62ValidaCampo2Integer',fld:'vVALIDACAMPO2INTEGER'},{av:'AV30NomeCampo1Integer',fld:'vNOMECAMPO1INTEGER'},{av:'AV61ValidaCampo1Integer',fld:'vVALIDACAMPO1INTEGER'},{av:'AV79NomeCampo1Numerico',fld:'vNOMECAMPO1NUMERICO'},{av:'AV83ValidaCampo1Numerico',fld:'vVALIDACAMPO1NUMERICO'},{av:'AV80NomeCampo2Numerico',fld:'vNOMECAMPO2NUMERICO'},{av:'AV84ValidaCampo2Numerico',fld:'vVALIDACAMPO2NUMERICO'},{av:'AV81NomeCampo3Numerico',fld:'vNOMECAMPO3NUMERICO'},{av:'AV85ValidaCampo3Numerico',fld:'vVALIDACAMPO3NUMERICO'},{av:'AV82NomeCampo4Numerico',fld:'vNOMECAMPO4NUMERICO'},{av:'AV86ValidaCampo4Numerico',fld:'vVALIDACAMPO4NUMERICO'},{av:'AV48NomeCampo7String',fld:'vNOMECAMPO7STRING'},{av:'AV74ValidaCampo7String',fld:'vVALIDACAMPO7STRING'},{av:'AV46NomeCampo6String',fld:'vNOMECAMPO6STRING'},{av:'AV73ValidaCampo6String',fld:'vVALIDACAMPO6STRING'},{av:'AV43NomeCampo5String',fld:'vNOMECAMPO5STRING'},{av:'AV72ValidaCampo5String',fld:'vVALIDACAMPO5STRING'},{av:'AV40NomeCampo4String',fld:'vNOMECAMPO4STRING'},{av:'AV71ValidaCampo4String',fld:'vVALIDACAMPO4STRING'},{av:'AV37NomeCampo3String',fld:'vNOMECAMPO3STRING'},{av:'AV70ValidaCampo3String',fld:'vVALIDACAMPO3STRING'},{av:'AV34NomeCampo2String',fld:'vNOMECAMPO2STRING'},{av:'AV69ValidaCampo2String',fld:'vVALIDACAMPO2STRING'},{av:'AV31NomeCampo1String',fld:'vNOMECAMPO1STRING'},{av:'AV68ValidaCampo1String',fld:'vVALIDACAMPO1STRING'}]];
this.EvtParms["ENTER"] = [[{av:'gx.fn.getCtrlProperty("TABCAMPO1","Visible")',ctrl:'TABCAMPO1',prop:'Visible'},{av:'AV6ConteudoCampo1Data',fld:'vCONTEUDOCAMPO1DATA'},{av:'AV29NomeCampo1Data',fld:'vNOMECAMPO1DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO2","Visible")',ctrl:'TABCAMPO2',prop:'Visible'},{av:'AV52SnErro',fld:'vSNERRO'},{av:'AV9ConteudoCampo2Data',fld:'vCONTEUDOCAMPO2DATA'},{av:'AV32NomeCampo2Data',fld:'vNOMECAMPO2DATA'},{av:'AV55ValidaCampo1Data',fld:'vVALIDACAMPO1DATA'},{av:'AV56ValidaCampo2Data',fld:'vVALIDACAMPO2DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO3","Visible")',ctrl:'TABCAMPO3',prop:'Visible'},{av:'AV12ConteudoCampo3Data',fld:'vCONTEUDOCAMPO3DATA'},{av:'AV35NomeCampo3Data',fld:'vNOMECAMPO3DATA'},{av:'AV57ValidaCampo3Data',fld:'vVALIDACAMPO3DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO4","Visible")',ctrl:'TABCAMPO4',prop:'Visible'},{av:'AV15ConteudoCampo4Data',fld:'vCONTEUDOCAMPO4DATA'},{av:'AV38NomeCampo4Data',fld:'vNOMECAMPO4DATA'},{av:'AV58ValidaCampo4Data',fld:'vVALIDACAMPO4DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO5","Visible")',ctrl:'TABCAMPO5',prop:'Visible'},{av:'AV18ConteudoCampo5Data',fld:'vCONTEUDOCAMPO5DATA'},{av:'AV41NomeCampo5Data',fld:'vNOMECAMPO5DATA'},{av:'AV59ValidaCampo5Data',fld:'vVALIDACAMPO5DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO6","Visible")',ctrl:'TABCAMPO6',prop:'Visible'},{av:'AV21ConteudoCampo6Data',fld:'vCONTEUDOCAMPO6DATA'},{av:'AV44NomeCampo6Data',fld:'vNOMECAMPO6DATA'},{av:'AV60ValidaCampo6Data',fld:'vVALIDACAMPO6DATA'},{av:'gx.fn.getCtrlProperty("TABCAMPO7","Visible")',ctrl:'TABCAMPO7',prop:'Visible'},{av:'AV7ConteudoCampo1Integer',fld:'vCONTEUDOCAMPO1INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO8","Visible")',ctrl:'TABCAMPO8',prop:'Visible'},{av:'AV10ConteudoCampo2Integer',fld:'vCONTEUDOCAMPO2INTEGER'},{av:'AV61ValidaCampo1Integer',fld:'vVALIDACAMPO1INTEGER'},{av:'AV62ValidaCampo2Integer',fld:'vVALIDACAMPO2INTEGER'},{av:'AV30NomeCampo1Integer',fld:'vNOMECAMPO1INTEGER'},{av:'AV33NomeCampo2Integer',fld:'vNOMECAMPO2INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO9","Visible")',ctrl:'TABCAMPO9',prop:'Visible'},{av:'AV13ConteudoCampo3Integer',fld:'vCONTEUDOCAMPO3INTEGER'},{av:'AV63ValidaCampo3Integer',fld:'vVALIDACAMPO3INTEGER'},{av:'AV36NomeCampo3Integer',fld:'vNOMECAMPO3INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO10","Visible")',ctrl:'TABCAMPO10',prop:'Visible'},{av:'AV16ConteudoCampo4Integer',fld:'vCONTEUDOCAMPO4INTEGER'},{av:'AV64ValidaCampo4Integer',fld:'vVALIDACAMPO4INTEGER'},{av:'AV39NomeCampo4Integer',fld:'vNOMECAMPO4INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO11","Visible")',ctrl:'TABCAMPO11',prop:'Visible'},{av:'AV19ConteudoCampo5Integer',fld:'vCONTEUDOCAMPO5INTEGER'},{av:'AV65ValidaCampo5Integer',fld:'vVALIDACAMPO5INTEGER'},{av:'AV42NomeCampo5Integer',fld:'vNOMECAMPO5INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO12","Visible")',ctrl:'TABCAMPO12',prop:'Visible'},{av:'AV22ConteudoCampo6Integer',fld:'vCONTEUDOCAMPO6INTEGER'},{av:'AV66ValidaCampo6Integer',fld:'vVALIDACAMPO6INTEGER'},{av:'AV45NomeCampo6Integer',fld:'vNOMECAMPO6INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO13","Visible")',ctrl:'TABCAMPO13',prop:'Visible'},{av:'AV24ConteudoCampo7Integer',fld:'vCONTEUDOCAMPO7INTEGER'},{av:'AV67ValidaCampo7Integer',fld:'vVALIDACAMPO7INTEGER'},{av:'AV47NomeCampo7Integer',fld:'vNOMECAMPO7INTEGER'},{av:'gx.fn.getCtrlProperty("TABCAMPO14","Visible")',ctrl:'TABCAMPO14',prop:'Visible'},{av:'AV8ConteudoCampo1String',fld:'vCONTEUDOCAMPO1STRING'},{av:'AV31NomeCampo1String',fld:'vNOMECAMPO1STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO15","Visible")',ctrl:'TABCAMPO15',prop:'Visible'},{av:'AV11ConteudoCampo2String',fld:'vCONTEUDOCAMPO2STRING'},{av:'AV34NomeCampo2String',fld:'vNOMECAMPO2STRING'},{av:'AV68ValidaCampo1String',fld:'vVALIDACAMPO1STRING'},{av:'AV69ValidaCampo2String',fld:'vVALIDACAMPO2STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO16","Visible")',ctrl:'TABCAMPO16',prop:'Visible'},{av:'AV14ConteudoCampo3String',fld:'vCONTEUDOCAMPO3STRING'},{av:'AV37NomeCampo3String',fld:'vNOMECAMPO3STRING'},{av:'AV70ValidaCampo3String',fld:'vVALIDACAMPO3STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO17","Visible")',ctrl:'TABCAMPO17',prop:'Visible'},{av:'AV17ConteudoCampo4String',fld:'vCONTEUDOCAMPO4STRING'},{av:'AV40NomeCampo4String',fld:'vNOMECAMPO4STRING'},{av:'AV71ValidaCampo4String',fld:'vVALIDACAMPO4STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO18","Visible")',ctrl:'TABCAMPO18',prop:'Visible'},{av:'AV20ConteudoCampo5String',fld:'vCONTEUDOCAMPO5STRING'},{av:'AV43NomeCampo5String',fld:'vNOMECAMPO5STRING'},{av:'AV72ValidaCampo5String',fld:'vVALIDACAMPO5STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO19","Visible")',ctrl:'TABCAMPO19',prop:'Visible'},{av:'AV23ConteudoCampo6String',fld:'vCONTEUDOCAMPO6STRING'},{av:'AV46NomeCampo6String',fld:'vNOMECAMPO6STRING'},{av:'AV73ValidaCampo6String',fld:'vVALIDACAMPO6STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO20","Visible")',ctrl:'TABCAMPO20',prop:'Visible'},{av:'AV25ConteudoCampo7String',fld:'vCONTEUDOCAMPO7STRING'},{av:'AV48NomeCampo7String',fld:'vNOMECAMPO7STRING'},{av:'gx.fn.getCtrlProperty("TABCAMPO21","Visible")',ctrl:'TABCAMPO21',prop:'Visible'},{av:'AV75ConteudoCampo1Numerico',fld:'vCONTEUDOCAMPO1NUMERICO'},{av:'gx.fn.getCtrlProperty("TABCAMPO22","Visible")',ctrl:'TABCAMPO22',prop:'Visible'},{av:'AV76ConteudoCampo2Numerico',fld:'vCONTEUDOCAMPO2NUMERICO'},{av:'AV83ValidaCampo1Numerico',fld:'vVALIDACAMPO1NUMERICO'},{av:'AV84ValidaCampo2Numerico',fld:'vVALIDACAMPO2NUMERICO'},{av:'AV79NomeCampo1Numerico',fld:'vNOMECAMPO1NUMERICO'},{av:'AV80NomeCampo2Numerico',fld:'vNOMECAMPO2NUMERICO'},{av:'gx.fn.getCtrlProperty("TABCAMPO23","Visible")',ctrl:'TABCAMPO23',prop:'Visible'},{av:'AV77ConteudoCampo3Numerico',fld:'vCONTEUDOCAMPO3NUMERICO'},{av:'AV85ValidaCampo3Numerico',fld:'vVALIDACAMPO3NUMERICO'},{av:'AV81NomeCampo3Numerico',fld:'vNOMECAMPO3NUMERICO'},{av:'gx.fn.getCtrlProperty("TABCAMPO24","Visible")',ctrl:'TABCAMPO24',prop:'Visible'},{av:'AV78ConteudoCampo4Numerico',fld:'vCONTEUDOCAMPO4NUMERICO'},{av:'AV86ValidaCampo4Numerico',fld:'vVALIDACAMPO4NUMERICO'},{av:'AV82NomeCampo4Numerico',fld:'vNOMECAMPO4NUMERICO'}],[{av:'AV52SnErro',fld:'vSNERRO'}]];
this.EvtParms["'FECHAR'"] = [[],[]];
this.EnterCtrl = ["BTNCONFIRMAR"];
this.InitStandaloneVars( );
});
gx.setParentObj(new hsqlparametrosentrada());
| 123.899529 | 6,508 | 0.74848 |
ea3e8150d3a52caef2fc955138b303c146d3dd29 | 2,824 | js | JavaScript | test/queries-test/multi-match-query.test.js | mccool/elastic-builder | 9633db957799ec8d010feba8b34815749b425a50 | [
"MIT"
] | 432 | 2017-04-12T13:30:59.000Z | 2022-03-27T09:40:30.000Z | test/queries-test/multi-match-query.test.js | mccool/elastic-builder | 9633db957799ec8d010feba8b34815749b425a50 | [
"MIT"
] | 113 | 2017-05-16T10:48:08.000Z | 2022-03-04T23:18:22.000Z | test/queries-test/multi-match-query.test.js | mccool/elastic-builder | 9633db957799ec8d010feba8b34815749b425a50 | [
"MIT"
] | 67 | 2017-08-08T07:27:50.000Z | 2022-03-17T13:00:43.000Z | import test from 'ava';
import { MultiMatchQuery } from '../../src';
import {
validatedCorrectly,
nameExpectStrategy,
makeSetsOptionMacro
} from '../_macros';
const getInstance = (fields, queryStr) => new MultiMatchQuery(fields, queryStr);
const setsOption = makeSetsOptionMacro(
getInstance,
nameExpectStrategy('multi_match', { fields: [] })
);
const validRewrites = [
'constant_score',
'scoring_boolean',
'constant_score_boolean',
'constant_score_filter',
'top_terms_boost_23',
'top_terms_15'
];
test(validatedCorrectly, getInstance, 'operator', ['and', 'or']);
test(validatedCorrectly, getInstance, 'zeroTermsQuery', ['all', 'none']);
// prettier-ignore
test(validatedCorrectly, getInstance, 'type', [
'best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix'
]);
test(validatedCorrectly, getInstance, 'rewrite', validRewrites, false);
test(validatedCorrectly, getInstance, 'fuzzyRewrite', validRewrites, false);
test(setsOption, 'field', {
param: 'my_field',
propValue: ['my_field'],
keyName: 'fields'
});
test(setsOption, 'fields', {
param: ['my_field_a', 'my_field_b'],
spread: false
});
test(setsOption, 'type', { param: 'best_fields' });
test(setsOption, 'tieBreaker', { param: 0.3 });
test(setsOption, 'operator', { param: 'and' });
test(setsOption, 'lenient', { param: true });
test(setsOption, 'slop', { param: 2 });
test(setsOption, 'fuzziness', { param: 'AUTO' });
test(setsOption, 'prefixLength', { param: 5 });
test(setsOption, 'maxExpansions', { param: 3 });
test(setsOption, 'rewrite', { param: 'constant_score' });
test(setsOption, 'fuzzyRewrite', { param: 'constant_score_boolean' });
test(setsOption, 'zeroTermsQuery', { param: 'all' });
test(setsOption, 'cutoffFrequency', { param: 10 });
// constructor, fields can be str or arr
test('constructor sets arguments', t => {
let valueA = getInstance('my_field', 'query str').toJSON();
let valueB = getInstance()
.field('my_field')
.query('query str')
.toJSON();
t.deepEqual(valueA, valueB);
let expected = {
multi_match: {
fields: ['my_field'],
query: 'query str'
}
};
t.deepEqual(valueA, expected);
valueA = getInstance(['my_field_a', 'my_field_b'], 'query str').toJSON();
valueB = getInstance()
.fields(['my_field_a', 'my_field_b'])
.query('query str')
.toJSON();
t.deepEqual(valueA, valueB);
const valueC = getInstance()
.field('my_field_a')
.field('my_field_b')
.query('query str')
.toJSON();
t.deepEqual(valueA, valueC);
expected = {
multi_match: {
fields: ['my_field_a', 'my_field_b'],
query: 'query str'
}
};
t.deepEqual(valueA, valueB);
});
| 30.042553 | 80 | 0.633499 |
ea3ecbd95a5d77c2c408b6e47b5b10717d34bc46 | 553 | js | JavaScript | config/db.js | Cindy994688/-COMP30022-Project-dupe | 4d556997636f8543210d767fe91943b3073be4d1 | [
"MIT"
] | null | null | null | config/db.js | Cindy994688/-COMP30022-Project-dupe | 4d556997636f8543210d767fe91943b3073be4d1 | [
"MIT"
] | null | null | null | config/db.js | Cindy994688/-COMP30022-Project-dupe | 4d556997636f8543210d767fe91943b3073be4d1 | [
"MIT"
] | null | null | null | const mongoose = require('mongoose');
// Edit the line below with your own connection string
const db = 'mongodb+srv://' + process.env.DB_USERNAME +':' + process.env.DB_PASSWORD + '@fire451.jxyew.mongodb.net/' + process.env.DB_NAME + '?retryWrites=true&w=majority';
const connectDB = async () => {
try {
await mongoose.connect(db,{useNewUrlParser: true});
console.log('MongoDB is Connected...');
} catch (err) {
console.log("not connected to db :(");
console.error(err.message);
}
};
module.exports=connectDB;
| 30.722222 | 173 | 0.654611 |
ea4017800152af09310a3ae1e8595b64be051f5b | 2,489 | js | JavaScript | lib/index.js | tobilg/directory-tree | b36008833fc60384b2edfc6d4d96c5a5312a7630 | [
"MIT"
] | null | null | null | lib/index.js | tobilg/directory-tree | b36008833fc60384b2edfc6d4d96c5a5312a7630 | [
"MIT"
] | null | null | null | lib/index.js | tobilg/directory-tree | b36008833fc60384b2edfc6d4d96c5a5312a7630 | [
"MIT"
] | null | null | null | // --------------------
// directory-tree module
// --------------------
// modules
var fs = require('fs'),
pathModule = require('path'),
_ = require('lodash');
// exports
module.exports = function(path, options) {
// parse options
options = options || {};
options = _.extend({
initialPath: fs.realpathSync(path),
filterFiles: /^(.+)\.*?$/,
filterFolders: /^([^\.].*)$/,
includeBasePath: false,
includeRealPath: false
}, options);
return processFolder(path, options);
};
function processFolder(path, options)
{
// get list of files in dir
var files = fs.readdirSync(path);
files.sort();
//var realPath = fs.realpathSync(path);
// get index file
var result = {};
// create files parameter
var resultFiles = [];
// get all files
var folders = [];
files.forEach(function(file) {
var filePath = pathModule.join(path, file),
stats = fs.statSync(filePath);
if (stats.isDirectory()) {
folders.push(file);
return;
}
if (options.filterFiles) {
var match = file.match(options.filterFiles);
if (!match) return;
file = match[1];
}
var fileObj = {"name": file, "type": "file", size: stats.size};
if (options.includeBasePath) {
fileObj.basePath = filePath.replace(options.initialPath, '').replace(/\\/g, '/');
}
if (options.includeRealPath) {
fileObj.realPath = fs.realpathSync(filePath);
}
resultFiles.push(fileObj);
});
// push to items array
result.items = resultFiles;
// all folders
folders.forEach(function(file) {
if (options.filterFolders) {
var match = file.match(options.filterFolders);
if (!match) return;
file = match[1];
}
// get real path
var realPath = pathModule.join(path, file);
// recurse
var resultFolder = processFolder(realPath, options);
// set folder properties
resultFolder.name = file;
resultFolder.type = "folder";
if (options.includeBasePath) {
resultFolder.basePath = realPath.replace(options.initialPath, '').replace(/\\/g, '/');
}
if (options.includeRealPath) {
resultFolder.realPath = realPath;
}
result.items.push(resultFolder);
});
return result;
}
| 23.932692 | 98 | 0.546404 |
ea404ac6f2adb24fa0c4dee843ea60f83b4b16c4 | 4,204 | js | JavaScript | tasks/svg2json.js | gruntjs-updater/grunt-svg2json | c98d2bdeb792892f0c0aa61d0a1841a6da2328b4 | [
"MIT"
] | null | null | null | tasks/svg2json.js | gruntjs-updater/grunt-svg2json | c98d2bdeb792892f0c0aa61d0a1841a6da2328b4 | [
"MIT"
] | null | null | null | tasks/svg2json.js | gruntjs-updater/grunt-svg2json | c98d2bdeb792892f0c0aa61d0a1841a6da2328b4 | [
"MIT"
] | null | null | null | /*
* grunt-svg2json
* https://github.com/dhaakon/grunt-svg2json
*
* Copyright (c) 2014 David Poyner
* Licensed under the MIT license.
*/
'use strict';
var exec = require('child_process').exec,
path = require('path'),
comm = path.join(__dirname , '../bin/svg2gfx.xslt'), // our xlstproc
_ = require('underscore'),
sanitizer = require('./lib/sanitize');
module.exports = function( grunt ) {
// self reference
var self = this;
var fileInfo = {};
var _sanitizer = sanitizer( this );
/*
*
* parseSVG - function to parse the SVG and call the xsltproc
* @param - context - the context to refer to
*
*/
this.parseSVG = function( context ) {
// helper function to get the xslt command
function getXSLTProcCommand( src, dest ){
return ['xsltproc', comm, src, '>', dest].join(' ');
};
// if we are converting a single file
function convertSingleFile( src, dest ){
var callback = function( err, stdout, stderr ){
if ( err ) console.log( err );
var obj = _sanitizer.clean( dest );
grunt.log.ok(['[ ' + src + ' ] successfully parsed!']);
grunt.file.write( dest, JSON.stringify( obj ) );
context.done();
};
exec( getXSLTProcCommand( src, dest ) , callback );
};
// if we are converting multiple files
function convertMultipleFiles ( src, dest ){
var tmp = {};
fileInfo.tmpFiles = []
var callback = function( err, stdout, stderr ){
// If there are more files lets run this command again
if ( fileInfo.currentFile-- > 1 ){
var tmpFile = path.join( __dirname, '../tmp/tmp__' + fileInfo.currentFile + '.json' );
fileInfo.tmpFiles.push({ name: src[fileInfo.currentFile - 1],file:tmpFile });
exec( getXSLTProcCommand( src[fileInfo.currentFile - 1], tmpFile ), callback );
// if we are finished let's copy the files over and destroy the temp files
}else{
// iterate through our temporary files to copy to destination file
for ( var file in fileInfo.tmpFiles ){
//_sanitizer.clean(file);
var _f = fileInfo.tmpFiles[file]; // grab it
var name = _f.name;
name = name.split('.')[0];
name = name.split('/')[1];
tmp[name] = _sanitizer.clean(_f.file);
grunt.log.ok(['[ ' + _f.name + ' ] successfully parsed!'])
grunt.file.delete( _f.file ); // delete it
}
grunt.file.write( dest, JSON.stringify(tmp) );// write it
context.done(); // we are done here
}
};
// create a temp file
var tmpFile = path.join( __dirname, '../tmp/tmp__' + fileInfo.currentFile + '.json');
// store it to retrieve later
fileInfo.tmpFiles.push( { name:src[fileInfo.currentFile - 1],file:tmpFile } );
// call the xslt process
exec( getXSLTProcCommand( src[fileInfo.currentFile - 1], tmpFile ), callback );
}
// check to see if the file exists
function doesFileExist ( filepath ) {
var hasFile = grunt.file.exists;
if( !hasFile( filepath ) ){
grunt.log.warn('Source file"' + filepath + '" not found.');
return false;
}else{
return true;
}
}
function fileIterator ( files ) {
// grab the src then filter and convert
var isMoreThanOneFile = files.src.length > 1;
var hasDestFile = grunt.file.exists( files.dest );
// if there is no destination file we need to create one before running the;
// xslt process.
if ( !hasDestFile ){
grunt.file.write( files.dest );
}
// if there is not more than one file we can just convert that file.
if ( !isMoreThanOneFile ){
var hasFile = doesFileExist( files.src[0] );
convertSingleFile( files.src[0], files.dest );
// if there is we need added logic to create tmp files to then concatinate.
}else{
var root = path.join( __dirname, '../', '/tmp/' );
grunt.file.mkdir(root);
fileInfo.currentFile = fileInfo.numFiles = files.src.length;
convertMultipleFiles( files.src, files.dest );
}
};
// iterate through all the files
return context.files.forEach( fileIterator );
}
grunt.registerMultiTask('svg2json', 'svg to json', function(){
var options = this.options({});
this.done = this.async();
self.parseSVG(this);
});
};
| 30.028571 | 91 | 0.630114 |