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
12bc2b11de7881b0cb9b5246c300dc44240c1bbc
18,549
js
JavaScript
src/js/plugins/youtube.js
tocsinde/plyr
5ca769807e773d6d6a884771ca8864e4db8c1376
[ "MIT" ]
null
null
null
src/js/plugins/youtube.js
tocsinde/plyr
5ca769807e773d6d6a884771ca8864e4db8c1376
[ "MIT" ]
null
null
null
src/js/plugins/youtube.js
tocsinde/plyr
5ca769807e773d6d6a884771ca8864e4db8c1376
[ "MIT" ]
null
null
null
// ========================================================================== // YouTube plugin // ========================================================================== import utils from './../utils'; import controls from './../controls'; import ui from './../ui'; // Standardise YouTube quality unit function mapQualityUnit(input) { switch (input) { case 'hd2160': return 2160; case 2160: return 'hd2160'; case 'hd1440': return 1440; case 1440: return 'hd1440'; case 'hd1080': return 1080; case 1080: return 'hd1080'; case 'hd720': return 720; case 720: return 'hd720'; case 'large': return 480; case 480: return 'large'; case 'medium': return 360; case 360: return 'medium'; case 'small': return 240; case 240: return 'small'; default: return 'default'; } } function mapQualityUnits(levels) { if (utils.is.empty(levels)) { return levels; } return utils.dedupe(levels.map(level => mapQualityUnit(level))); } const youtube = { setup() { // Add embed class for responsive utils.toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Set aspect ratio youtube.setAspectRatio.call(this); // Setup API if (utils.is.object(window.YT) && utils.is.function(window.YT.Player)) { youtube.ready.call(this); } else { // Load the API utils.loadScript(this.config.urls.youtube.api).catch(error => { this.debug.warn('YouTube API failed to load', error); }); // Setup callback for the API // YouTube has it's own system of course... window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue window.onYouTubeReadyCallbacks.push(() => { youtube.ready.call(this); }); // Set callback to process queue window.onYouTubeIframeAPIReady = () => { window.onYouTubeReadyCallbacks.forEach(callback => { callback(); }); }; } }, // Get the media title getTitle(videoId) { // Try via undocumented API method first // This method disappears now and then though... // https://github.com/sampotts/plyr/issues/709 if (utils.is.function(this.embed.getVideoData)) { const { title } = this.embed.getVideoData(); if (utils.is.empty(title)) { this.config.title = title; ui.setTitle.call(this); return; } } // Or via Google API const key = this.config.keys.google; if (utils.is.string(key) && !utils.is.empty(key)) { const url = `https://www.googleapis.com/youtube/v3/videos?id=${videoId}&key=${key}&fields=items(snippet(title))&part=snippet`; utils .fetch(url) .then(result => { if (utils.is.object(result)) { this.config.title = result.items[0].snippet.title; ui.setTitle.call(this); } }) .catch(() => {}); } }, // Set aspect ratio setAspectRatio() { const ratio = this.config.ratio.split(':'); this.elements.wrapper.style.paddingBottom = `${100 / ratio[0] * ratio[1]}%`; }, // API ready ready() { const player = this; // Ignore already setup (race condition) const currentId = player.media.getAttribute('id'); if (!utils.is.empty(currentId) && currentId.startsWith('youtube-')) { return; } // Get the source URL or ID let source = player.media.getAttribute('src'); // Get from <div> if needed if (utils.is.empty(source)) { source = player.media.getAttribute(this.config.attributes.embed.id); } // Replace the <iframe> with a <div> due to YouTube API issues const videoId = utils.parseYouTubeId(source); const id = utils.generateId(player.provider); const container = utils.createElement('div', { id }); player.media = utils.replaceElement(container, player.media); // Setup instance // https://developers.google.com/youtube/iframe_api_reference player.embed = new window.YT.Player(id, { videoId, playerVars: { autoplay: player.config.autoplay ? 1 : 0, // Autoplay controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported rel: 0, // No related vids showinfo: 0, // Hide info iv_load_policy: 3, // Hide annotations modestbranding: 1, // Hide logos as much as possible (they still show one in the corner when paused) disablekb: 1, // Disable keyboard as we handle it playsinline: 1, // Allow iOS inline playback // Tracking for stats // origin: window ? `${window.location.protocol}//${window.location.host}` : null, widget_referrer: window ? window.location.href : null, // Captions are flaky on YouTube cc_load_policy: player.captions.active ? 1 : 0, cc_lang_pref: player.config.captions.language, }, events: { onError(event) { // If we've already fired an error, don't do it again // YouTube fires onError twice if (utils.is.object(player.media.error)) { return; } const detail = { code: event.data, }; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError switch (event.data) { case 2: detail.message = 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.'; break; case 5: detail.message = 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.'; break; case 100: detail.message = 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.'; break; case 101: case 150: detail.message = 'The owner of the requested video does not allow it to be played in embedded players.'; break; default: detail.message = 'An unknown error occured'; break; } player.media.error = detail; utils.dispatchEvent.call(player, player.media, 'error'); }, onPlaybackQualityChange() { utils.dispatchEvent.call(player, player.media, 'qualitychange', false, { quality: player.media.quality, }); }, onPlaybackRateChange(event) { // Get the instance const instance = event.target; // Get current speed player.media.playbackRate = instance.getPlaybackRate(); utils.dispatchEvent.call(player, player.media, 'ratechange'); }, onReady(event) { // Get the instance const instance = event.target; // Get the title youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API player.media.play = () => { instance.playVideo(); }; player.media.pause = () => { instance.pauseVideo(); }; player.media.stop = () => { instance.stopVideo(); }; player.media.duration = instance.getDuration(); player.media.paused = true; // Seeking player.media.currentTime = 0; Object.defineProperty(player.media, 'currentTime', { get() { return Number(instance.getCurrentTime()); }, set(time) { // Vimeo will automatically play on seek const { paused } = player.media; // Set seeking flag player.media.seeking = true; // Trigger seeking utils.dispatchEvent.call(player, player.media, 'seeking'); // Seek after events sent instance.seekTo(time); // Restore pause state if (paused) { player.pause(); } }, }); // Playback speed Object.defineProperty(player.media, 'playbackRate', { get() { return instance.getPlaybackRate(); }, set(input) { instance.setPlaybackRate(input); }, }); // Quality Object.defineProperty(player.media, 'quality', { get() { return mapQualityUnit(instance.getPlaybackQuality()); }, set(input) { const quality = input; // Set via API instance.setPlaybackQuality(mapQualityUnit(quality)); // Trigger request event utils.dispatchEvent.call(player, player.media, 'qualityrequested', false, { quality, }); }, }); // Volume let { volume } = player.config; Object.defineProperty(player.media, 'volume', { get() { return volume; }, set(input) { volume = input; instance.setVolume(volume * 100); utils.dispatchEvent.call(player, player.media, 'volumechange'); }, }); // Muted let { muted } = player.config; Object.defineProperty(player.media, 'muted', { get() { return muted; }, set(input) { const toggle = utils.is.boolean(input) ? input : muted; muted = toggle; instance[toggle ? 'mute' : 'unMute'](); utils.dispatchEvent.call(player, player.media, 'volumechange'); }, }); // Source Object.defineProperty(player.media, 'currentSrc', { get() { return instance.getVideoUrl(); }, }); // Ended Object.defineProperty(player.media, 'ended', { get() { return player.currentTime === player.duration; }, }); // Get available speeds player.options.speed = instance.getAvailablePlaybackRates(); // Set the tabindex to avoid focus entering iframe if (player.supported.ui) { player.media.setAttribute('tabindex', -1); } utils.dispatchEvent.call(player, player.media, 'timeupdate'); utils.dispatchEvent.call(player, player.media, 'durationchange'); // Reset timer clearInterval(player.timers.buffering); // Setup buffering player.timers.buffering = setInterval(() => { // Get loaded % from YouTube player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) { utils.dispatchEvent.call(player, player.media, 'progress'); } // Set last buffer point player.media.lastBuffered = player.media.buffered; // Bail if we're at 100% if (player.media.buffered === 1) { clearInterval(player.timers.buffering); // Trigger event utils.dispatchEvent.call(player, player.media, 'canplaythrough'); } }, 200); // Rebuild UI setTimeout(() => ui.build.call(player), 50); }, onStateChange(event) { // Get the instance const instance = event.target; // Reset timer clearInterval(player.timers.playing); // Handle events // -1 Unstarted // 0 Ended // 1 Playing // 2 Paused // 3 Buffering // 5 Video cued switch (event.data) { case -1: // Update scrubber utils.dispatchEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube player.media.buffered = instance.getVideoLoadedFraction(); utils.dispatchEvent.call(player, player.media, 'progress'); break; case 0: player.media.paused = true; // YouTube doesn't support loop for a single video, so mimick it. if (player.media.loop) { // YouTube needs a call to `stopVideo` before playing again instance.stopVideo(); instance.playVideo(); } else { utils.dispatchEvent.call(player, player.media, 'ended'); } break; case 1: // If we were seeking, fire seeked event if (player.media.seeking) { utils.dispatchEvent.call(player, player.media, 'seeked'); } player.media.seeking = false; // Only fire play if paused before if (player.media.paused) { utils.dispatchEvent.call(player, player.media, 'play'); } player.media.paused = false; utils.dispatchEvent.call(player, player.media, 'playing'); // Poll to get playback progress player.timers.playing = setInterval(() => { utils.dispatchEvent.call(player, player.media, 'timeupdate'); }, 50); // Check duration again due to YouTube bug // https://github.com/sampotts/plyr/issues/374 // https://code.google.com/p/gdata-issues/issues/detail?id=8690 if (player.media.duration !== instance.getDuration()) { player.media.duration = instance.getDuration(); utils.dispatchEvent.call(player, player.media, 'durationchange'); } // Get quality controls.setQualityMenu.call(player, mapQualityUnits(instance.getAvailableQualityLevels())); break; case 2: player.media.paused = true; utils.dispatchEvent.call(player, player.media, 'pause'); break; default: break; } utils.dispatchEvent.call(player, player.elements.container, 'statechange', false, { code: event.data, }); }, }, }); }, }; export default youtube;
37.624746
263
0.431344
12bde0661167219e89621b5449f8982b63011aa7
734
js
JavaScript
dist/ply.amd.min.js
pluma0/ply
6b0b9f6394cf3ed74b588401dc17b3ad5db3841c
[ "Unlicense" ]
1
2015-05-04T22:16:00.000Z
2015-05-04T22:16:00.000Z
dist/ply.amd.min.js
pluma/ply
6b0b9f6394cf3ed74b588401dc17b3ad5db3841c
[ "Unlicense" ]
null
null
null
dist/ply.amd.min.js
pluma/ply
6b0b9f6394cf3ed74b588401dc17b3ad5db3841c
[ "Unlicense" ]
null
null
null
/*! ply 0.1.0 Original author Alan Plum <me@pluma.io>. Released into the Public Domain under the UNLICENSE. @preserve */ define(function(require,exports,module){function slice(arr,i){return Array.prototype.slice.call(arr,i)}exports.apply=apply;exports.call=call;exports.fapply=fapply;exports.fcall=fcall;exports.mapply=mapply;exports.mcall=mcall;function apply(fn,self,args){return fn.apply(self,args)}function call(fn,self){return apply(fn,self,slice(arguments,2))}function fapply(fn,args){return apply(fn,this,args)}function fcall(fn){return apply(fn,this,slice(arguments,1))}function mapply(obj,name,args){return apply(obj[name],obj,args)}function mcall(obj,name){return mapply(obj,name,slice(arguments,2))}return module.exports});
367
613
0.792916
12be31f70e5640630925e276b7db57e749da14d9
54
js
JavaScript
portfolio/node_modules/@sanity/ui/lib/esm/primitives/container/index.js
cpesar/my-portfolio
448f04a72060de5f44800ecd2a079dff453b2e8a
[ "MIT" ]
null
null
null
portfolio/node_modules/@sanity/ui/lib/esm/primitives/container/index.js
cpesar/my-portfolio
448f04a72060de5f44800ecd2a079dff453b2e8a
[ "MIT" ]
null
null
null
portfolio/node_modules/@sanity/ui/lib/esm/primitives/container/index.js
cpesar/my-portfolio
448f04a72060de5f44800ecd2a079dff453b2e8a
[ "MIT" ]
null
null
null
export * from "./container"; export * from "./types";
18
28
0.62963
12be4259d94526aeab745be473012c3984e41427
1,606
js
JavaScript
fuzzer_output/interesting/sample_1554169827316.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554169827316.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554169827316.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
function main() { const v2 = []; const v3 = {keyFor:"undefined",race:1337,trimEnd:1337,stackTraceLimit:1337,ignoreCase:v2,acosh:v2}; const v5 = [13.37,13.37]; function v6(v7,v8,v9,v10) { } function v11(v12,v13,v14,v15) { const v19 = [NaN,NaN,NaN,NaN,NaN]; const v21 = [4257340759,4257340759,4257340759,4257340759,4257340759]; const v22 = [NaN,v19,Boolean]; const v25 = -536870912 * 1.7976931348623157e+308; const v26 = v25.toPrecision(Boolean,Boolean,v22,v21); const v30 = [13.37,13.37,13.37,13.37,13.37]; Boolean.__proto__ = v12; const v32 = [1337,1337,v14,1337]; const v33 = [v30]; const v34 = {LN10:Boolean,clear:v30,multiline:"3WGX7UQqsB",isSafeInteger:v30,exec:-1984769435,assign:v33,call:13.37}; const v35 = {parseFloat:v32,asinh:1337,lastMatch:v34,subarray:-1984769435,toExponential:1337}; let v36 = v35; function v38(v39,v40,v41,v42) { let v44 = v11; const v45 = new Promise(v44,v39,13.37,v40); } const v47 = {construct:v38,defineProperty:v38,get:v38,set:v38,apply:v38,asinh:v38,ownKeys:v38,preventExtension:v38}; const v49 = new Proxy(Function,v47); const v50 = v38(v35,v49,v36,"3WGX7UQqsB"); } const v51 = {preventExtension:v11,get:v6,deleteProperty:v11,has:v11,defineProperty:v11,getOwnPropertyDescriptor:v6,call:v6,set:v11,ownKeys:v11,setPrototypeOf:v6,construct:v11}; const v53 = new Number(v5,v51); const v54 = "undefined"[v3]; const v55 = v11(v53,v6,v11,v6,v54); function v56(v57,v58,v59,v60,v61) { } const v62 = v56 + 1; let v65 = 0; const v66 = v65 + 1; v65 = v66; } %NeverOptimizeFunction(main); main();
39.170732
176
0.694894
12bf6982da65f77fa343f8032271469d9bdc8702
997
js
JavaScript
web/static/js/models/DeploymentModel.js
leilabbb/glider-dac-status
48ee6593d95c1d3901fb0e45dbdd82a6a097e49d
[ "MIT" ]
null
null
null
web/static/js/models/DeploymentModel.js
leilabbb/glider-dac-status
48ee6593d95c1d3901fb0e45dbdd82a6a097e49d
[ "MIT" ]
16
2016-05-16T13:40:56.000Z
2020-07-21T21:39:21.000Z
web/static/js/models/DeploymentModel.js
leilabbb/glider-dac-status
48ee6593d95c1d3901fb0e45dbdd82a6a097e49d
[ "MIT" ]
8
2015-02-20T16:39:30.000Z
2020-10-12T20:33:28.000Z
var DeploymentModel = Backbone.Model.extend({ urlRoot: '../api/deployment', defaults: { completed: null, created: null, dap: "", deployment_dir: "", erddap: "", estimated_deploy_date: null, estimated_deploy_location: "", iso: "", name: "", operator: "", sos: "", thredds: "", updated: null, username: "", geo_json: {}, // Requires a separate fetch wmo_id: "" }, fetchGeoJSON: function() { var self = this; var url = '../api/track/' + this.get('username') + '/' + this.get('name'); $.ajax({ url: url, dataType: 'json', success: function(data) { self.set('geo_json', data); self.trigger('deployment:geojson', self); } }); }, }); var DeploymentCollection = Backbone.Collection.extend({ url: '../api/deployment', model: DeploymentModel, parse: function(response) { if(response && response.results) { return response.results; } return []; } });
22.155556
78
0.562688
12bfc5e3ba0faad23ce2d6dd98a14d5c4864fa68
14,948
js
JavaScript
node_modules/@ionic/core/dist/ionic/p-756c4de8.system.entry.js
Klasse-cloud-trash/SWEP
98fa5790ba7ed6ac068d39ec57abae40349c188a
[ "MIT" ]
1
2020-06-04T13:57:28.000Z
2020-06-04T13:57:28.000Z
node_modules/@ionic/core/dist/ionic/p-756c4de8.system.entry.js
Klasse-cloud-trash/SWEP
98fa5790ba7ed6ac068d39ec57abae40349c188a
[ "MIT" ]
2
2020-06-01T16:28:51.000Z
2020-06-01T16:29:36.000Z
node_modules/@ionic/core/dist/ionic/p-756c4de8.system.entry.js
Klasse-cloud-trash/SWEP
98fa5790ba7ed6ac068d39ec57abae40349c188a
[ "MIT" ]
1
2021-11-03T15:18:14.000Z
2021-11-03T15:18:14.000Z
var __awaiter=this&&this.__awaiter||function(t,e,n,i){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,a){function o(t){try{d(i.next(t))}catch(e){a(e)}}function s(t){try{d(i["throw"](t))}catch(e){a(e)}}function d(t){t.done?n(t.value):r(t.value).then(o,s)}d((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return d([t,e])}}function d(o){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(a=o[0]&2?r["return"]:o[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;if(r=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;r=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1];a=o;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(o);break}if(a[2])n.ops.pop();n.trys.pop();continue}o=e.call(t,n)}catch(s){o=[6,s];r=0}finally{i=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-8b1a777b.system.js","./p-e4b6dc64.system.js","./p-90f9da43.system.js","./p-f709d13b.system.js","./p-fed1888c.system.js"],(function(t,e){"use strict";var n,i,r,a,o,s,d,l,c,g,h;return{setters:[function(t){n=t.r;i=t.d;r=t.h;a=t.H;o=t.e},function(t){s=t.b},function(t){d=t.f;l=t.a},function(t){c=t.c;g=t.h},function(t){h=t.h}],execute:function(){var p=":host{-webkit-box-sizing:content-box !important;box-sizing:content-box !important;display:inline-block;position:relative;outline:none;contain:content;cursor:pointer;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.toggle-icon-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;-webkit-transition:var(--handle-transition);transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--background);pointer-events:none;overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--background-checked)}.toggle-inner{left:var(--handle-spacing);border-radius:var(--handle-border-radius);position:absolute;width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);-webkit-transition:var(--handle-transition);transition:var(--handle-transition);background:var(--handle-background);-webkit-box-shadow:var(--handle-box-shadow);box-shadow:var(--handle-box-shadow);contain:strict}[dir=rtl] .toggle-inner,:host-context([dir=rtl]) .toggle-inner{left:unset;right:unset;right:var(--handle-spacing)}:host(.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width)), 0, 0);transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host-context([dir=rtl]):host(.toggle-checked) .toggle-icon-wrapper,:host-context([dir=rtl]).toggle-checked .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width)), 0, 0);transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);background:var(--handle-background-checked)}:host-context([dir=rtl]):host(.toggle-checked) .toggle-inner,:host-context([dir=rtl]).toggle-checked .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.088);--background-checked:var(--ion-color-primary, #3880ff);--border-radius:16px;--handle-background:#ffffff;--handle-background-checked:#ffffff;--handle-border-radius:25.5px;--handle-box-shadow:0 3px 12px rgba(0, 0, 0, 0.16), 0 3px 1px rgba(0, 0, 0, 0.1);--handle-height:calc(32px - (2px * 2));--handle-max-height:calc(100% - (var(--handle-spacing) * 2));--handle-width:calc(32px - (2px * 2));--handle-spacing:2px;--handle-transition:transform 300ms, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms, right 110ms ease-in-out 80ms;width:51px;height:32px;contain:strict;overflow:hidden}:host(.ion-color.toggle-checked) .toggle-icon{background:var(--ion-color-base)}.toggle-icon{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);-webkit-transition:background-color 300ms;transition:background-color 300ms}.toggle-inner{will-change:transform}:host(.toggle-activated) .toggle-icon::before,:host(.toggle-checked) .toggle-icon::before{-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0)}:host(.toggle-activated.toggle-checked) .toggle-inner::before{-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0)}:host(.toggle-activated) .toggle-inner{width:calc(var(--handle-width) + 6px)}:host(.toggle-activated.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width) - 6px), 0, 0);transform:translate3d(calc(100% - var(--handle-width) - 6px), 0, 0)}:host-context([dir=rtl]):host(.toggle-activated.toggle-checked) .toggle-icon-wrapper,:host-context([dir=rtl]).toggle-activated.toggle-checked .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width) + 6px), 0, 0);transform:translate3d(calc(-100% + var(--handle-width) + 6px), 0, 0)}:host(.toggle-disabled){opacity:0.3}:host(.in-item[slot]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:20px;padding-right:10px;padding-top:6px;padding-bottom:5px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host(.in-item[slot]){padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:10px;padding-inline-end:10px}}:host(.in-item[slot=start]){padding-left:0;padding-right:16px;padding-top:6px;padding-bottom:5px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host(.in-item[slot=start]){padding-left:unset;padding-right:unset;-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:16px;padding-inline-end:16px}}";var u=":host{-webkit-box-sizing:content-box !important;box-sizing:content-box !important;display:inline-block;position:relative;outline:none;contain:content;cursor:pointer;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.toggle-icon-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;-webkit-transition:var(--handle-transition);transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--background);pointer-events:none;overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--background-checked)}.toggle-inner{left:var(--handle-spacing);border-radius:var(--handle-border-radius);position:absolute;width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);-webkit-transition:var(--handle-transition);transition:var(--handle-transition);background:var(--handle-background);-webkit-box-shadow:var(--handle-box-shadow);box-shadow:var(--handle-box-shadow);contain:strict}[dir=rtl] .toggle-inner,:host-context([dir=rtl]) .toggle-inner{left:unset;right:unset;right:var(--handle-spacing)}:host(.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width)), 0, 0);transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host-context([dir=rtl]):host(.toggle-checked) .toggle-icon-wrapper,:host-context([dir=rtl]).toggle-checked .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width)), 0, 0);transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);background:var(--handle-background-checked)}:host-context([dir=rtl]):host(.toggle-checked) .toggle-inner,:host-context([dir=rtl]).toggle-checked .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.39);--background-checked:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.5);--border-radius:14px;--handle-background:#ffffff;--handle-background-checked:var(--ion-color-primary, #3880ff);--handle-border-radius:50%;--handle-box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--handle-width:20px;--handle-height:20px;--handle-max-height:calc(100% + 6px);--handle-spacing:0;--handle-transition:transform 160ms cubic-bezier(0.4, 0, 0.2, 1), background-color 160ms cubic-bezier(0.4, 0, 0.2, 1);padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:12px;width:36px;height:14px;contain:strict}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host(.ion-color.toggle-checked) .toggle-icon{background:rgba(var(--ion-color-base-rgb), 0.5)}:host(.ion-color.toggle-checked) .toggle-inner{background:var(--ion-color-base)}.toggle-icon{-webkit-transition:background-color 160ms;transition:background-color 160ms}.toggle-inner{will-change:background-color, transform}:host(.toggle-disabled){opacity:0.3}:host(.in-item[slot]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:16px;padding-right:0;padding-top:12px;padding-bottom:12px;cursor:pointer}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host(.in-item[slot]){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:0;padding-inline-end:0}}:host(.in-item[slot=start]){padding-left:2px;padding-right:18px;padding-top:12px;padding-bottom:12px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host(.in-item[slot=start]){padding-left:unset;padding-right:unset;-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:18px;padding-inline-end:18px}}";var b=t("ion_toggle",function(){function t(t){var e=this;n(this,t);this.inputId="ion-tg-"+m++;this.lastDrag=0;this.activated=false;this.name=this.inputId;this.checked=false;this.disabled=false;this.value="on";this.onClick=function(){if(e.lastDrag+300<Date.now()){e.checked=!e.checked}};this.onFocus=function(){e.ionFocus.emit()};this.onBlur=function(){e.ionBlur.emit()};this.ionChange=i(this,"ionChange",7);this.ionFocus=i(this,"ionFocus",7);this.ionBlur=i(this,"ionBlur",7);this.ionStyle=i(this,"ionStyle",7)}t.prototype.checkedChanged=function(t){this.ionChange.emit({checked:t,value:this.value})};t.prototype.disabledChanged=function(){this.emitStyle();if(this.gesture){this.gesture.enable(!this.disabled)}};t.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var t;var n=this;return __generator(this,(function(i){switch(i.label){case 0:t=this;return[4,e.import("./p-919cbd63.system.js")];case 1:t.gesture=i.sent().createGesture({el:this.el,gestureName:"toggle",gesturePriority:100,threshold:5,passive:false,onStart:function(){return n.onStart()},onMove:function(t){return n.onMove(t)},onEnd:function(t){return n.onEnd(t)}});this.disabledChanged();return[2]}}))}))};t.prototype.disconnectedCallback=function(){if(this.gesture){this.gesture.destroy();this.gesture=undefined}};t.prototype.componentWillLoad=function(){this.emitStyle()};t.prototype.emitStyle=function(){this.ionStyle.emit({"interactive-disabled":this.disabled})};t.prototype.onStart=function(){this.activated=true;this.setFocus()};t.prototype.onMove=function(t){if(f(document,this.checked,t.deltaX,-10)){this.checked=!this.checked;h()}};t.prototype.onEnd=function(t){this.activated=false;this.lastDrag=Date.now();t.event.preventDefault();t.event.stopImmediatePropagation()};t.prototype.getValue=function(){return this.value||""};t.prototype.setFocus=function(){if(this.buttonEl){this.buttonEl.focus()}};t.prototype.render=function(){var t;var e=this;var n=this,i=n.inputId,o=n.disabled,h=n.checked,p=n.activated,u=n.color,b=n.el;var f=s(this);var m=i+"-lbl";var k=d(b);var v=this.getValue();if(k){k.id=m}l(true,b,this.name,h?v:"",o);return r(a,{onClick:this.onClick,role:"checkbox","aria-disabled":o?"true":null,"aria-checked":""+h,"aria-labelledby":m,class:Object.assign(Object.assign({},c(u)),(t={},t[f]=true,t["in-item"]=g("ion-item",b),t["toggle-activated"]=p,t["toggle-checked"]=h,t["toggle-disabled"]=o,t["interactive"]=true,t))},r("div",{class:"toggle-icon",part:"track"},r("div",{class:"toggle-icon-wrapper"},r("div",{class:"toggle-inner",part:"handle"}))),r("button",{type:"button",onFocus:this.onFocus,onBlur:this.onBlur,disabled:o,ref:function(t){return e.buttonEl=t},"aria-hidden":"true"}))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:true,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{checked:["checkedChanged"],disabled:["disabledChanged"]}},enumerable:true,configurable:true});return t}());var f=function(t,e,n,i){var r=t.dir==="rtl";if(e){return!r&&i>n||r&&-i<n}else{return!r&&-i<n||r&&i>n}};var m=0;b.style={ios:p}}}}));
14,948
14,948
0.739831
12c10acdd2a9fc39cb7cc18ef193255efda451bd
9,258
js
JavaScript
resources/js/saldo_global.js
BitXad/storeman_web
8b79ce5845d687d0d6fe121c7877b0423b9e5fb0
[ "MIT" ]
null
null
null
resources/js/saldo_global.js
BitXad/storeman_web
8b79ce5845d687d0d6fe121c7877b0423b9e5fb0
[ "MIT" ]
null
null
null
resources/js/saldo_global.js
BitXad/storeman_web
8b79ce5845d687d0d6fe121c7877b0423b9e5fb0
[ "MIT" ]
null
null
null
$(document).on("ready",mostrar_saldos); function mostrar_saldos() { var base_url = document.getElementById('base_url').value; var controlador = base_url+'programa/mostrar_saldos'; var gestion_id = document.getElementById('gestion_id').value; $.ajax({url: controlador, type:"POST", data:{gestion_id:gestion_id}, success:function(respuesta){ //$("#encontrados").val("- 0 -"); //alert("llega aqui..!!"); var registros = JSON.parse(respuesta); if (registros != null){ // /*var cont = 0; var cant_total = 0; var total_final = 0; var n = registros.length; //tamaño del arreglo de la consulta //alert(n); //$("#encontrados").val("- "+n+" -"); html = ""; for(var i=0; i<n; i++){ html += "<tr>"; html += "<td>"+(i+1)+"</td>"; html += "<td>"+registros[i]["articulo_nombre"]+"</td>"; html += "<td style='text-align: center'>"+registros[i]["articulo_codigo"]+"</td>"; html += "<td style='text-align: center'>"+registros[i]["articulo_unidad"]+"</td>"; if (Number(registros[i]["saldo"]) % 1 == 0){ html += "<td style='text-align: right'>"+numberFormat(registros[i]["saldo"])+"</td>"; } else{ html += "<td style='text-align: right'>"+numberFormat(Number(registros[i]["saldo"]).toFixed(2))+"</td>"; } prec_unit = Number(registros[i]["prec_total"]) / Number(registros[i]["saldo"]); html += "<td style='text-align: right'>"+prec_unit.toFixed(2)+"</td>"; html += "<td style='text-align: right'>"+numberFormat(Number(registros[i]["prec_total"]).toFixed(2))+"</td>"; html += "<td class='no-print'><button class='btn btn-warning btn-xs' onclick='mostrarcompras("+registros[i]["articulo_id"]+")'><fa class='fa fa-user'></fa> Historial</button></td>"; html += "</tr>"; total_final += Number(registros[i]["prec_total"]); } html += "<tr>"; html += "<th colspan='6'> TOTAL FINAL Bs</th>"; html += "<th>"+numberFormat(Number(total_final).toFixed(2))+"</th>"; html += "</tr>"; } $("#tablaarticulos").html(html); //document.getElementById('tablas').style.display = 'block'; }, error:function(respuesta){ // alert("Algo salio mal...!!!"); html = ""; $("#tablarearticulo").html(html); } }); } function mostrarcompras(articulo_id) { var base_url = document.getElementById('base_url').value; var controlador = base_url+'programa/mostrar_compras'; var gestion_id = document.getElementById('gestion_id').value; $.ajax({url: controlador, type:"POST", data:{gestion_id:gestion_id, articulo_id:articulo_id}, success:function(respuesta){ var registros = JSON.parse(respuesta); if (registros != null){ var cant_total = 0; var monto_total = 0; var salida_total = 0; var saldo_total = 0; var total_final = 0; var n = registros.length; //tamaño del arreglo de la consulta html = ""; for(var i=0; i<n; i++){ html += "<tr>"; html += "<td>"+(i+1)+"</td>"; html += "<td>"+registros[i]["programa_nombre"]+"</td>"; html += "<td style='text-align: center'>"+formato_fecha(registros[i]["ingreso_fecha_ing"])+"</td>"; html += "<td style='text-align: center; background: yellow;'>"+numberFormat(Number(registros[i]["detalleing_cantidad"]).toFixed(2))+"</td>"; html += "<td style='text-align: center'>"+numberFormat(Number(registros[i]["detalleing_precio"]).toFixed(2))+"</td>"; html += "<td style='text-align: center'>"+numberFormat(Number(registros[i]["detalleing_total"]).toFixed(2))+"</td>"; html += "<td style='text-align: center; background: yellow;'>"+numberFormat(Number(registros[i]["detalleing_salida"]).toFixed(2))+"</td>"; html += "<td style='text-align: center; background: orange;'>"+numberFormat(Number(registros[i]["detalleing_saldo"]).toFixed(2))+"</td>"; html += "</tr>"; total_final += Number(registros[i]["prec_total"]); cant_total += Number(registros[i]["detalleing_cantidad"]); monto_total += Number(registros[i]["detalleing_total"]); salida_total += Number(registros[i]["detalleing_salida"]); saldo_total += Number(registros[i]["detalleing_saldo"]); } html += "<tr>"; html += "<th colspan='3'> TOTALES </th>"; html += "<th>"+numberFormat(Number(cant_total).toFixed(2))+"</th>"; html += "<th> </th>"; html += "<th>"+numberFormat(Number(monto_total).toFixed(2))+"</th>"; html += "<th>"+numberFormat(Number(salida_total).toFixed(2))+"</th>"; html += "<th>"+numberFormat(Number(saldo_total).toFixed(2))+"</th>"; html += "</tr>"; } $("#tablacompras").html(html); $("#boton_compras").click(); //document.getElementById('tablas').style.display = 'block'; }, error:function(respuesta){ // alert("Algo salio mal...!!!"); html = ""; $("#tablarearticulo").html(html); } }); } function convertiraliteral(numero) { var controlador = ""; var base_url = document.getElementById('base_url').value; controlador = base_url+'programa/convertiraliteral/'; $.ajax({url: controlador, type:"POST", data:{numero:numero}, success:function(respuesta){ var registros = JSON.parse(respuesta); if (registros != null){ //$('select[name="programa_id"] option:selected').text()); $("#literal").html(registros); } }, error:function(respuesta){ alert('No existe movimiento para este programa.'); html = ""; $("#literal").html(html); } }); } function numberFormat(numero){ // Variable que contendra el resultado final var resultado = ""; // Si el numero empieza por el valor "-" (numero negativo) if(numero[0]=="-") { // Cogemos el numero eliminando los posibles puntos que tenga, y sin // el signo negativo nuevoNumero=numero.replace(/\,/g,'').substring(1); }else{ // Cogemos el numero eliminando los posibles puntos que tenga nuevoNumero=numero.replace(/\,/g,''); } // Si tiene decimales, se los quitamos al numero if(numero.indexOf(".")>=0) nuevoNumero=nuevoNumero.substring(0,nuevoNumero.indexOf(".")); // Ponemos un punto cada 3 caracteres for (var j, i = nuevoNumero.length - 1, j = 0; i >= 0; i--, j++) resultado = nuevoNumero.charAt(i) + ((j > 0) && (j % 3 == 0)? ",": "") + resultado; // Si tiene decimales, se lo añadimos al numero una vez forateado con // los separadores de miles if(numero.indexOf(".")>=0) resultado+=numero.substring(numero.indexOf(".")); if(numero[0]=="-") { // Devolvemos el valor añadiendo al inicio el signo negativo return "-"+resultado; }else{ return resultado; } } function formato_fecha(string){ var info = ""; if(string != null){ info = string.split('-').reverse().join('/'); } return info; }
42.663594
209
0.446533
12c18a36f77412bd93e848ff776569e366c5d329
16,174
js
JavaScript
src/Administration/Resources/app/administration/src/module/sw-sales-channel/view/sw-sales-channel-detail-base/index.js
zaifastafa/platform
1867649e5f00ecd2132c5356c7052e87a2c542ac
[ "MIT" ]
1
2021-05-31T08:36:32.000Z
2021-05-31T08:36:32.000Z
src/Administration/Resources/app/administration/src/module/sw-sales-channel/view/sw-sales-channel-detail-base/index.js
shyim/platform
228e4428af1f47bd6a6826d8059416d3eaf9f0af
[ "MIT" ]
null
null
null
src/Administration/Resources/app/administration/src/module/sw-sales-channel/view/sw-sales-channel-detail-base/index.js
shyim/platform
228e4428af1f47bd6a6826d8059416d3eaf9f0af
[ "MIT" ]
1
2021-12-21T18:15:40.000Z
2021-12-21T18:15:40.000Z
import template from './sw-sales-channel-detail-base.html.twig'; import './sw-sales-channel-detail-base.scss'; const { Component, Mixin, Context, Defaults } = Shopware; const { Criteria } = Shopware.Data; const domUtils = Shopware.Utils.dom; const ShopwareError = Shopware.Classes.ShopwareError; const utils = Shopware.Utils; const { mapPropertyErrors } = Component.getComponentHelper(); Component.register('sw-sales-channel-detail-base', { template, inject: [ 'salesChannelService', 'productExportService', 'repositoryFactory', 'knownIpsService', 'acl', ], mixins: [ Mixin.getByName('notification'), Mixin.getByName('placeholder'), ], props: { // FIXME: add type for salesChannel property // eslint-disable-next-line vue/require-prop-types salesChannel: { required: true, }, productExport: { // type: Entity type: Object, required: true, }, // FIXME: add default value for this property // eslint-disable-next-line vue/require-default-prop storefrontSalesChannelCriteria: { type: Criteria, required: false, }, customFieldSets: { type: Array, required: true, }, isLoading: { type: Boolean, default: false, }, productComparisonAccessUrl: { type: String, default: '', }, templateOptions: { type: Array, default: () => [], }, showTemplateModal: { type: Boolean, default: false, }, templateName: { type: String, default: null, }, }, data() { return { showDeleteModal: false, defaultSnippetSetId: '71a916e745114d72abafbfdc51cbd9d0', isLoadingDomains: false, deleteDomain: null, storefrontDomains: [], selectedStorefrontSalesChannel: null, invalidFileName: false, isFileNameChecking: false, disableGenerateByCronjob: false, knownIps: [], }; }, computed: { secretAccessKeyFieldType() { return this.showSecretAccessKey ? 'text' : 'password'; }, isStoreFront() { return this.salesChannel && this.salesChannel.typeId === Defaults.storefrontSalesChannelTypeId; }, isDomainAware() { const domainAware = [Defaults.storefrontSalesChannelTypeId, Defaults.apiSalesChannelTypeId]; return domainAware.includes(this.salesChannel.typeId); }, salesChannelRepository() { return this.repositoryFactory.create('sales_channel'); }, isProductComparison() { return this.salesChannel && this.salesChannel.typeId === Defaults.productComparisonTypeId; }, storefrontSalesChannelDomainCriteria() { const criteria = new Criteria(); return criteria.addFilter(Criteria.equals('salesChannelId', this.productExport.storefrontSalesChannelId)); }, storefrontSalesChannelCurrencyCriteria() { const criteria = new Criteria(); criteria.addAssociation('salesChannels'); return criteria.addFilter(Criteria.equals('salesChannels.id', this.productExport.storefrontSalesChannelId)); }, paymentMethodCriteria() { const criteria = new Criteria(); criteria.addSorting(Criteria.sort('position', 'ASC')); return criteria; }, storefrontDomainsLoaded() { return this.storefrontDomains.length > 0; }, domainRepository() { return this.repositoryFactory.create( this.salesChannel.domains.entity, this.salesChannel.domains.source, ); }, globalDomainRepository() { return this.repositoryFactory.create('sales_channel_domain'); }, productExportRepository() { return this.repositoryFactory.create('product_export'); }, mainNavigationCriteria() { const criteria = new Criteria(1, 10); return criteria .addFilter(Criteria.equalsAny('type', ['page', 'folder'])); }, getIntervalOptions() { return [ { id: 0, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.0'), }, { id: 120, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.120'), }, { id: 300, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.300'), }, { id: 600, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.600'), }, { id: 900, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.900'), }, { id: 1800, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.1800'), }, { id: 3600, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.3600'), }, { id: 7200, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.7200'), }, { id: 14400, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.14400'), }, { id: 28800, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.28800'), }, { id: 43200, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.43200'), }, { id: 86400, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.86400'), }, { id: 172800, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.172800'), }, { id: 259200, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.259200'), }, { id: 345600, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.345600'), }, { id: 432000, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.432000'), }, { id: 518400, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.518400'), }, { id: 604800, name: this.$tc('sw-sales-channel.detail.productComparison.intervalLabels.604800'), }, ]; }, getFileFormatOptions() { return [ { id: 'csv', name: this.$tc('sw-sales-channel.detail.productComparison.fileFormatLabels.csv'), }, { id: 'xml', name: this.$tc('sw-sales-channel.detail.productComparison.fileFormatLabels.xml'), }, ]; }, getEncodingOptions() { return [ { id: 'ISO-8859-1', name: 'ISO-8859-1', }, { id: 'UTF-8', name: 'UTF-8', }, ]; }, invalidFileNameError() { if (this.invalidFileName && !this.isFileNameChecking) { this.$emit('invalid-file-name'); return new ShopwareError({ code: 'DUPLICATED_PRODUCT_EXPORT_FILE_NAME' }); } this.$emit('valid-file-name'); return null; }, taxCalculationTypeOptions() { return [ { value: 'horizontal', name: this.$tc('sw-sales-channel.detail.taxCalculation.horizontalName'), description: this.$tc('sw-sales-channel.detail.taxCalculation.horizontalDescription'), }, { value: 'vertical', name: this.$tc('sw-sales-channel.detail.taxCalculation.verticalName'), description: this.$tc('sw-sales-channel.detail.taxCalculation.verticalDescription'), }, ]; }, maintenanceIpWhitelist: { get() { return this.salesChannel.maintenanceIpWhitelist ? this.salesChannel.maintenanceIpWhitelist : []; }, set(value) { this.salesChannel.maintenanceIpWhitelist = value; }, }, ...mapPropertyErrors('salesChannel', [ 'name', 'customerGroupId', 'navigationCategoryId', ]), ...mapPropertyErrors('productExport', [ 'productStreamId', 'encoding', 'fileName', 'fileFormat', 'salesChannelDomainId', 'currencyId', ]), }, watch: { 'productExport.fileName'() { this.onChangeFileName(); }, }, created() { this.knownIpsService.getKnownIps().then(ips => { this.knownIps = ips; }); }, methods: { onGenerateKeys() { this.salesChannelService.generateKey().then((response) => { this.salesChannel.accessKey = response.accessKey; }).catch(() => { this.createNotificationError({ message: this.$tc('sw-sales-channel.detail.messageAPIError'), }); }); }, onGenerateProductExportKey(displaySaveNotification = true) { this.productExportService.generateKey().then((response) => { this.productExport.accessKey = response.accessKey; this.$emit('access-key-changed'); if (displaySaveNotification) { this.createNotificationInfo({ message: this.$tc('sw-sales-channel.detail.productComparison.messageAccessKeyChanged'), }); } }).catch(() => { this.createNotificationError({ message: this.$tc('sw-sales-channel.detail.messageAPIError'), }); }); }, onToggleActive() { if (this.salesChannel.active !== true || this.isProductComparison) { return; } const criteria = new Criteria(); criteria.addAssociation('themes'); this.salesChannelRepository .get(this.$route.params.id, Context.api, criteria) .then((entity) => { if (entity.extensions.themes !== undefined && entity.extensions.themes.length >= 1) { return; } this.salesChannel.active = false; this.createNotificationError({ message: this.$tc('sw-sales-channel.detail.messageActivateWithoutThemeError', 0, { name: this.salesChannel.name || this.placeholder(this.salesChannel, 'name'), }), }); }); }, onCloseDeleteModal() { this.showDeleteModal = false; }, onConfirmDelete() { this.showDeleteModal = false; this.$nextTick(() => { this.deleteSalesChannel(this.salesChannel.id); this.$router.push({ name: 'sw.dashboard.index' }); }); }, deleteSalesChannel(salesChannelId) { this.salesChannelRepository.delete(salesChannelId, Context.api).then(() => { this.$root.$emit('sales-channel-change'); }); }, copyToClipboard() { domUtils.copyToClipboard(this.salesChannel.accessKey); }, onStorefrontSelectionChange(storefrontSalesChannelId) { this.salesChannelRepository.get(storefrontSalesChannelId) .then((entity) => { this.salesChannel.languageId = entity.languageId; this.salesChannel.currencyId = entity.currencyId; this.salesChannel.paymentMethodId = entity.paymentMethodId; this.salesChannel.shippingMethodId = entity.shippingMethodId; this.salesChannel.countryId = entity.countryId; this.salesChannel.navigationCategoryId = entity.navigationCategoryId; this.salesChannel.navigationCategoryVersionId = entity.navigationCategoryVersionId; this.salesChannel.customerGroupId = entity.customerGroupId; }); }, onStorefrontDomainSelectionChange(storefrontSalesChannelDomainId) { this.globalDomainRepository.get(storefrontSalesChannelDomainId) .then((entity) => { this.productExport.salesChannelDomain = entity; this.productExport.currencyId = entity.currencyId; this.$emit('domain-changed'); }); }, loadStorefrontDomains(storefrontSalesChannelId) { const criteria = new Criteria(); criteria.addFilter(Criteria.equals('salesChannelId', storefrontSalesChannelId)); this.globalDomainRepository.search(criteria) .then((searchResult) => { this.storefrontDomains = searchResult; }); }, onChangeFileName() { this.isFileNameChecking = true; this.onChangeFileNameDebounce(); }, onChangeFileNameDebounce: utils.debounce(function executeChange() { if (!this.productExport) { return; } if (typeof this.productExport.fileName !== 'string' || this.productExport.fileName.trim() === '' ) { this.invalidFileName = false; this.isFileNameChecking = false; return; } const criteria = new Criteria(1, 1); criteria.addFilter( Criteria.multi( 'AND', [ Criteria.equals('fileName', this.productExport.fileName), Criteria.not('AND', [Criteria.equals('id', this.productExport.id)]), ], ), ); this.productExportRepository.search(criteria).then(({ total }) => { this.invalidFileName = total > 0; this.isFileNameChecking = false; }).catch(() => { this.invalidFileName = true; this.isFileNameChecking = false; }); }, 500), changeInterval() { this.disableGenerateByCronjob = this.productExport.interval === 0; if (this.disableGenerateByCronjob) { this.productExport.generateByCronjob = false; } }, }, });
33.279835
120
0.501298
12c2b41985533647f789f132213b1279d05784db
6,031
js
JavaScript
main/static/js/graphWithPeripheralLinks.js
transcranial/diseasegraph
e93f25206396facd2f6599099bcc5cd5c626f078
[ "MIT" ]
2
2016-01-12T04:43:19.000Z
2016-04-07T21:10:59.000Z
static/js/graphWithPeripheralLinks.js
transcranial/diseasegraph
e93f25206396facd2f6599099bcc5cd5c626f078
[ "MIT" ]
null
null
null
static/js/graphWithPeripheralLinks.js
transcranial/diseasegraph
e93f25206396facd2f6599099bcc5cd5c626f078
[ "MIT" ]
null
null
null
function graphWithPeripheralLinks(width, height, jsondatavar, term, method, nodes) { var format = d3.format(",d"), color = d3.scale.category20(); var svg = d3 .select("#content") .append("svg") .attr("width", width) .attr("height", height); var svg_key = d3 .select("#key") .append("svg") .attr("width", d3.select("#sideLeft").style("width")) .attr("height", height/2); var force = d3.layout.force() .gravity(0.7) .charge(-5000) .size([width, height]); /*Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { return true; } } return false; }*/ // d3.json(jsondatafile, function(json) { //json = JSON.parse(jsondatavar); json = jsondatavar; // populates key var sizes = []; var groups = []; var cy = 10; for (var i=0;i<json.nodes.length;i++) { sizes[i] = json.nodes[i].size; if (json.nodes[i].group[0].groupnum !== 0) { for (var j=0;j<json.nodes[i].group.length;j++) { if ($.inArray(json.nodes[i].group[j].groupnum, groups) == -1) { groups.push(json.nodes[i].group[j].groupnum); svg_key.append("circle").attr("cx",20).attr("cy",cy).attr("r",6).attr("fill",color(groups.indexOf(json.nodes[i].group[j].groupnum))); svg_key.append("text").attr("x",30).attr("y",cy).attr("dy", ".3em").text(json.nodes[i].group[j].groupname); cy+=20; } } } } var interpNodeSize = d3.interpolateRound(10,75); function calcNodeSize(size) { return interpNodeSize((size-d3.min(sizes))/(d3.max(sizes)-d3.min(sizes))); } var coeff = []; for (i=0; i<json.links.length; i++) { coeff[i] = json.links[i].coefficient; } var interpLinkSize = d3.interpolateRound(0,15); function calcLinkSize(coeffInput) { return interpLinkSize((coeffInput-d3.min(coeff))/(d3.max(coeff)-d3.min(coeff))); } var interpLinkDistance = d3.interpolateRound(300,0); function calcLinkDistance(coeffInput) { return interpLinkDistance((coeffInput-d3.min(coeff))/(d3.max(coeff)-d3.min(coeff))); } force .nodes(json.nodes) .links(json.links) .linkStrength(function(d) { return calcLinkSize(d.coefficient)/40; }) .start(); var link = svg.selectAll(".link") .data(json.links) .enter().append("line") .attr("class", "link") .attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }) .attr("stroke", "#C2C6D1") .attr("stroke-width", function(d) { linkSize = calcLinkSize(d.coefficient); return linkSize; }) .on("mouseover", function(d) {d3.select(this).attr("stroke", "#000000"); mouseoverLink(d);}) .on("mouseout", function(d) {d3.select(this).attr("stroke", "#C2C6D1"); mouseoutLink(d);}); function mouseoverLink(d) { d3.select("#linkInfo-source").html("Frequency:<br>" + d.source.name + ": "); d3.select("#linkInfo-source-num").html(d.source.size); d3.select("#linkInfo-target").html(d.target.name + ": "); d3.select("#linkInfo-target-num").html(d.target.size); d3.select("#linkInfo-coeff").html("<br>Association strength:"); d3.select("#linkInfo-coeff-num").html(d.coefficient.toFixed(5)); } function mouseoutLink(d) { d3.select("#linkInfo-source").html(""); d3.select("#linkInfo-source-num").html(""); d3.select("#linkInfo-target").html(""); d3.select("#linkInfo-target-num").html(""); d3.select("#linkInfo-value").html(""); d3.select("#linkInfo-value-num").html(""); d3.select("#linkInfo-coeff").html(""); d3.select("#linkInfo-coeff-num").html(""); } var node = svg.selectAll(".node") .data(json.nodes) .enter().append("g") .attr("class", "node") .call(force.drag) .on("mouseover", function(d) { d3.select("#linkInfo-source").html("<i>Click to make this the central node.</i>"); d3.select(this).attr("cursor", "pointer"); d3.select(this).attr("stroke", "#000000"); }) .on("mouseout", function(d) { d3.select("#linkInfo-source").html(""); d3.select(this).attr("cursor", "default"); d3.select(this).attr("stroke", "none"); }) .on("click", function(d) {clickNode(d3.select(this).text());}); svg.selectAll(".node") .filter(function(d,i) { return i === 0; }) .on("mouseover", function(d) {d3.select(this).attr("cursor", "default"); d3.select(this).attr("stroke", "none");}) .on("click", function(d) {return true;}); function clickNode(text) { window.location.href = '/graph.do?q=' + text + '&metric=' + method + '&nodenum=' + nodes; ga('send', 'event', 'graph', 'node_click', term); } function generateArcPath() { return d3.svg.arc() .outerRadius(function(d) { return calcNodeSize(d3.select(this.parentNode).datum().size); }) .innerRadius(0) .startAngle(function(d,i) { return i * 2*Math.PI / (d3.select(this.parentNode).datum().group.length); }) .endAngle(function(d,i) { return (i+1) * 2*Math.PI / (d3.select(this.parentNode).datum().group.length); }); } node.selectAll("path") .data(function(d) { return d.group; }) .enter().append("path") .attr("d", generateArcPath()) .style("fill", function(d) { if(d.groupnum === 0) {return "#000000";} else {return color(groups.indexOf(d.groupnum));} }) .style("opacity", 0.7); svg.selectAll(".node") .filter(function(d,i) { return i === 0; }) .append("circle") .attr("r", function(d) { return calcNodeSize(d.size); }) .style("stroke", "#000000") .style("stroke-width", 3) .style("fill", "#FFFFFF"); node.append("text") .attr("dy", ".3em") .style("text-anchor", "middle") .text(function(d) { return d.name; }); force.on("tick", function() { link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }); node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); }); // }); }
34.861272
138
0.61217
12c33dc51f86d72bf7c6e59d1f7ace6644173854
591
js
JavaScript
config/index.js
apooe/job1s-server
fe504fcfa09964b1a18936f351068bef4975af0c
[ "MIT" ]
null
null
null
config/index.js
apooe/job1s-server
fe504fcfa09964b1a18936f351068bef4975af0c
[ "MIT" ]
null
null
null
config/index.js
apooe/job1s-server
fe504fcfa09964b1a18936f351068bef4975af0c
[ "MIT" ]
null
null
null
const dotenv = require("dotenv"); //lload .env file const evFound = dotenv.config(); if (!evFound) { throw new Error("could not find .env file"); } //define env variables const config = { port: Number(process.env.PORT) || 8080, databaseURL: process.env.DATABASE_URL, api: { prefix: "/api", }, google: { placeApiKey: process.env.GOOGLE_API_KEY, }, auth: { jwtSecret: process.env.JWT_SECRET || "apooe", }, aws: { id: process.env.AWS_ID, secret: process.env.AWS_SECRET, bucket: process.env.AWS_UPLOAD_BUCKET_NAME, }, }; module.exports = config;
19.7
49
0.65313
12c35e0538f675b4b851a0471c53372ae143279d
2,187
js
JavaScript
server.js
tzoratto/faya
dff61674a6dbbb73d314a42a6eb3ca925f0e0cb6
[ "MIT" ]
1
2017-03-12T17:55:04.000Z
2017-03-12T17:55:04.000Z
server.js
tzoratto/faya
dff61674a6dbbb73d314a42a6eb3ca925f0e0cb6
[ "MIT" ]
null
null
null
server.js
tzoratto/faya
dff61674a6dbbb73d314a42a6eb3ca925f0e0cb6
[ "MIT" ]
null
null
null
'use strict'; /** * @file Entrypoint of the application. */ const express = require('express'); const logger = require('winston'); const mongoose = require("mongoose"); const dbConfig = require("./config/database.js"); const appConfig = require('./config/app'); const i18n = require("i18n"); const passport = require('passport'); const insertSetting = require('./config/setting'); mongoose.Promise = Promise; const app = express(); module.exports = app; require('./config/logs')(app); require('./config/passport')(passport); require('./config/express')(app, passport); require('./routes/routes')(app, passport); connectToDB() .on('disconnected', function () { logger.error(i18n.__('app.databaseDisconnected')); }) .on('connected', function () { logger.info(i18n.__('app.databaseConnected')); }) .once('open', function () { insertSetting(function (err) { if (err) { logger.error(i18n.__('app.settingInsertError', err.message)); process.exit(1); } startServer(); }); }); /** * Opens a connection to MongoDB. * */ function connectToDB() { var mongoDb = mongoose.connect(dbConfig.db, { server: { reconnectTries: Number.MAX_VALUE, reconnectInterval: 1000 } }); mongoDb.catch(function (err) { logger.error(i18n.__('app.databaseError'), err); mongoose.connection.close(function () { setTimeout(connectToDB, 1000); }); }); return mongoDb.connection; } /** * Starts the web server. */ function startServer() { app.listen(appConfig.port) .on('error', function(err) { logger.error(i18n.__('app.serverError'), err); }) .on('listening', function() { logger.info(i18n.__('app.serverStarted', appConfig.port)); }); } exitOnSignal('SIGINT'); exitOnSignal('SIGTERM'); /** * Add a signal listener to exit gently. * * @param signal - The signal to listen for. */ function exitOnSignal(signal) { process.on(signal, function () { logger.warn(i18n.__('app.serverShutdown', signal)); process.exit(1); }); }
23.771739
77
0.604938
12c3d36c6d647c50b1da983f94d751e4190e8290
1,773
js
JavaScript
docs/doxygen/html/classMotley_1_1CommandArrange.js
ericmotleybytes/motley-php
204ab16c1aec1f74711ee20ae7eefb6343dd4ba8
[ "MIT" ]
null
null
null
docs/doxygen/html/classMotley_1_1CommandArrange.js
ericmotleybytes/motley-php
204ab16c1aec1f74711ee20ae7eefb6343dd4ba8
[ "MIT" ]
null
null
null
docs/doxygen/html/classMotley_1_1CommandArrange.js
ericmotleybytes/motley-php
204ab16c1aec1f74711ee20ae7eefb6343dd4ba8
[ "MIT" ]
null
null
null
var classMotley_1_1CommandArrange = [ [ "__construct", "classMotley_1_1CommandArrange.html#aa7b5c5e4e0a97b7a4a4b39f94028ec6a", null ], [ "setName", "classMotley_1_1CommandArrange.html#a54c924f60ddcf87f06b4f8fb5e4b8e57", null ], [ "getName", "classMotley_1_1CommandArrange.html#aa60eabe9ed505a350b27cde1277bdf21", null ], [ "setDescription", "classMotley_1_1CommandArrange.html#a7052464d3a22156497a2bb41bafca4bc", null ], [ "getDescription", "classMotley_1_1CommandArrange.html#ab89dfc816f7eb7706df59385ea5875e5", null ], [ "setDisplayName", "classMotley_1_1CommandArrange.html#a670b80acb4bc04b9a16ec2ac7cc40e78", null ], [ "getDisplayName", "classMotley_1_1CommandArrange.html#a49f547827768717619db27a2e688e12a", null ], [ "addComponent", "classMotley_1_1CommandArrange.html#a654e01e151651f3504863c53d4a28b9c", null ], [ "getArranComps", "classMotley_1_1CommandArrange.html#ae43414ab58164f9ff08e55b20ed8802b", null ], [ "clearArranComps", "classMotley_1_1CommandArrange.html#a95cde6f98ced0fcedb12736cca8b3b36", null ], [ "parse", "classMotley_1_1CommandArrange.html#a9a802d3d1d9376afdf42408753dac76c", null ], [ "getMatchingComponents", "classMotley_1_1CommandArrange.html#a265a8f90a5e3c373b4cdfd86a7d0bdf1", null ], [ "getMatchingReason", "classMotley_1_1CommandArrange.html#a240bef500b866de112e3234ec437927d", null ], [ "$name", "classMotley_1_1CommandArrange.html#a3ad80381356457013ad79ae8e75b8dc3", null ], [ "$description", "classMotley_1_1CommandArrange.html#afacfadd365134f4aebf83a98aeac83b5", null ], [ "$displayName", "classMotley_1_1CommandArrange.html#a51906767fbb331908f98dd194b3773bc", null ], [ "$arranComps", "classMotley_1_1CommandArrange.html#a72093f460bb3ff28cd5b0b1a7fed2645", null ] ];
88.65
110
0.80203
12c3d4f6aa8d56fa6446745ab323f8eb767c1c53
116
js
JavaScript
.prettierrc.js
DanielGiljam/eslint-config-danielgiljam
a4850595c58ba264924dd30a05d86d0e8d5e6eea
[ "MIT" ]
null
null
null
.prettierrc.js
DanielGiljam/eslint-config-danielgiljam
a4850595c58ba264924dd30a05d86d0e8d5e6eea
[ "MIT" ]
3
2021-06-16T01:49:00.000Z
2021-06-16T01:52:29.000Z
.prettierrc.js
DanielGiljam/eslint-config-danielgiljam
a4850595c58ba264924dd30a05d86d0e8d5e6eea
[ "MIT" ]
null
null
null
const prettierConfigDanielGiljam = require("@danielgiljam/prettierrc") module.exports = prettierConfigDanielGiljam
29
70
0.853448
12c3e451c027f45844eed101ff3c08da24a28c2a
1,828
js
JavaScript
src/parser/flow.js
gbaptista/nanno-js
05c4703b00078a94c96a09d43d3549eb6dd0de5f
[ "MIT" ]
null
null
null
src/parser/flow.js
gbaptista/nanno-js
05c4703b00078a94c96a09d43d3549eb6dd0de5f
[ "MIT" ]
null
null
null
src/parser/flow.js
gbaptista/nanno-js
05c4703b00078a94c96a09d43d3549eb6dd0de5f
[ "MIT" ]
1
2022-03-23T20:32:56.000Z
2022-03-23T20:32:56.000Z
import MarkupParser from './markup'; class FlowParser { static parse(source, previousScene) { const ast = { timeline: [] }; let currentScene = previousScene; if (currentScene === undefined) currentScene = 0; let cleanSource = source.replace(/.*?\[/, ''); cleanSource = cleanSource.replace(/\].*/, ''); let flows = cleanSource.split('>'); flows = flows.map((flow) => flow.split('\n').join(' ').replace(/\s+/g, ' ').trim()).filter( (flow) => flow.trim() !== '', ); flows.forEach((flowSource) => { const parts = flowSource.split(/\s+/); const specialValues = []; if (/^\d/.exec(parts[0])) { specialValues.push(parts.shift()); } if (specialValues.length > 0 && /^\d/.exec(parts[0])) { specialValues.push(parts.shift()); } const flowPlaceboSource = `f\n ${parts.join(' ')}`; const result = MarkupParser.parseSection(flowPlaceboSource); specialValues.forEach((specialValue) => { if (/\//.exec(specialValue)) { const [column, row] = specialValue.split('/'); if (result.properties.column === undefined) { result.properties.column = parseFloat(column); } if (result.properties.row === undefined) { result.properties.row = parseFloat(row); } } else if (result.properties.scene === undefined) { result.properties.scene = parseInt(specialValue, 10); } }); if (result.properties.scene === undefined) { currentScene += 1; result.properties.scene = currentScene; } else { currentScene = result.properties.scene; } ast.timeline.push(result.properties); }); ast.previousScene = currentScene; return ast; } } export default FlowParser;
26.492754
95
0.571663
12c4163a78a989999e7142b7e084d0d122c0f50a
1,153
js
JavaScript
script.js
sam3112/vftvk-Simple-Interest-Calculator
c1a906bf618eb4b1f6a98a843feddd0266dcdfc6
[ "Apache-2.0" ]
null
null
null
script.js
sam3112/vftvk-Simple-Interest-Calculator
c1a906bf618eb4b1f6a98a843feddd0266dcdfc6
[ "Apache-2.0" ]
null
null
null
script.js
sam3112/vftvk-Simple-Interest-Calculator
c1a906bf618eb4b1f6a98a843feddd0266dcdfc6
[ "Apache-2.0" ]
null
null
null
var r=document.querySelector("#rate"); var p=document.querySelector("#principal"); var t=document.querySelector("#years"); var i=p.value*t.value*r.value/100; var result=document.querySelector("#result_display"); var compute=document.querySelector("#compute"); var clear=document.querySelector("#clear"); r.onchange=function(){ this.nextElementSibling.innerHTML=this.value+"%"; } compute.onclick=function(){ if((p.value<=0)||(p.value==="")){ if(p.value<=0 && !(p.value==="")){ result.innerHTML=""; result.innerHTML="Principal amount should be non zero positive number"; p.focus(); } else{ result.innerHTML=""; result.innerHTML="Principal amount cannot be blank "; p.focus(); } } else { var y=2020+Number(t.value); result.innerHTML=""; i=Math.round(p.value*t.value*r.value/100); result.innerHTML+="If you deposit <span class='yellow'>"+p.value+"</span><br>at an interest rate of <span class='yellow'>"+r.value+"</span>%<br>You will receive an amount of <span class='yellow'>"+i+"</span><br>in the year <span class='yellow'>"+y+"</span>"; } } clear.onclick= function(){ location.reload(); }
28.825
261
0.666956
12c5791866dca214f3f71b26384d93a4cea2bd3d
18,234
js
JavaScript
graphql-spring-boot-autoconfigure/src/main/resources/static/vendor/altair/13-es2018.js
firatkucuk/graphql-spring-boot
f95ced54695b7563451b90487f552273d0fccfe7
[ "MIT" ]
1,033
2018-09-29T23:18:14.000Z
2022-03-24T13:12:43.000Z
graphql-spring-boot-autoconfigure/src/main/resources/static/vendor/altair/13-es2018.js
firatkucuk/graphql-spring-boot
f95ced54695b7563451b90487f552273d0fccfe7
[ "MIT" ]
515
2018-10-01T08:36:58.000Z
2022-03-31T20:54:37.000Z
graphql-spring-boot-autoconfigure/src/main/resources/static/vendor/altair/13-es2018.js
firatkucuk/graphql-spring-boot
f95ced54695b7563451b90487f552273d0fccfe7
[ "MIT" ]
281
2018-10-03T16:06:31.000Z
2022-03-22T14:05:19.000Z
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{zeOt:function(e,t,s){"use strict";function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===h(e)}function r(e){return"string"==typeof e}function i(e){return"number"==typeof e}function c(e){return"object"==typeof e}function a(e){return null!=e}function o(e){return!e.trim().length}function h(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}s.r(t),s.d(t,"DocUtils",function(){return J});const l=Object.prototype.hasOwnProperty;class u{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let s=d(e);t+=s.weight,this._keys.push(s),this._keyMap[s.id]=s,t+=s.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function d(e){let t=null,s=null,i=null,c=1;if(r(e)||n(e))i=e,t=g(e),s=p(e);else{if(!l.call(e,"name"))throw new Error("Missing name property in key");const n=e.name;if(i=n,l.call(e,"weight")&&(c=e.weight,c<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n));t=g(n),s=p(n)}return{path:t,id:s,weight:c,src:i}}function g(e){return n(e)?e:e.split(".")}function p(e){return n(e)?e.join("."):e}var f={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(e,t){let s=[],o=!1;const l=(e,t,u)=>{if(a(e))if(t[u]){const d=e[t[u]];if(!a(d))return;if(u===t.length-1&&(r(d)||i(d)||function(e){return!0===e||!1===e||function(e){return c(e)&&null!==e}(e)&&"[object Boolean]"==h(e)}(d)))s.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(d));else if(n(d)){o=!0;for(let e=0,s=d.length;e<s;e+=1)l(d[e],t,u+1)}else t.length&&l(d,t,u+1)}else s.push(e)};return l(e,r(t)?t.split("."):t,0),o?s:s[0]},ignoreLocation:!1,ignoreFieldNorm:!1};const m=/[^ ]+/g;class y{constructor({getFn:e=f.getFn}={}){this.norm=function(e=3){const t=new Map,s=Math.pow(10,e);return{get(e){const n=e.match(m).length;if(t.has(n))return t.get(n);const r=1/Math.sqrt(n),i=parseFloat(Math.round(r*s)/s);return t.set(n,i),i},clear(){t.clear()}}}(3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,r(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();r(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!a(e)||o(e))return;let s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(e,t){let s={i:t,$:{}};this.keys.forEach((t,i)=>{let c=this.getFn(e,t.path);if(a(c))if(n(c)){let e=[];const t=[{nestedArrIndex:-1,value:c}];for(;t.length;){const{nestedArrIndex:s,value:i}=t.pop();if(a(i))if(r(i)&&!o(i)){let t={v:i,i:s,n:this.norm.get(i)};e.push(t)}else n(i)&&i.forEach((e,s)=>{t.push({nestedArrIndex:s,value:e})})}s.$[i]=e}else if(!o(c)){let e={v:c,n:this.norm.get(c)};s.$[i]=e}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function M(e,t,{getFn:s=f.getFn}={}){const n=new y({getFn:s});return n.setKeys(e.map(d)),n.setSources(t),n.create(),n}function x(e,{getFn:t=f.getFn}={}){const{keys:s,records:n}=e,r=new y({getFn:t});return r.setKeys(s),r.setIndexRecords(n),r}function _(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:r=f.distance,ignoreLocation:i=f.ignoreLocation}={}){const c=t/e.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function k(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const r=e.charAt(s);t[r]=(t[r]||0)|1<<n-s-1}return t}class L{constructor(e,{location:t=f.location,threshold:s=f.threshold,distance:n=f.distance,includeMatches:r=f.includeMatches,findAllMatches:i=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:a=f.isCaseSensitive,ignoreLocation:o=f.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:a,ignoreLocation:o},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(e,t)=>{this.chunks.push({pattern:e,alphabet:k(e),startIndex:t})},l=this.pattern.length;if(l>32){let e=0;const t=l%32,s=l-t;for(;e<s;)h(this.pattern.substr(e,32),e),e+=32;if(t){const e=l-32;h(this.pattern.substr(e),e)}}else h(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:s}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return s&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:a,ignoreLocation:o}=this.options;let h=[],l=0,u=!1;this.chunks.forEach(({pattern:t,alphabet:d,startIndex:g})=>{const{isMatch:p,score:m,indices:y}=function(e,t,s,{location:n=f.location,distance:r=f.distance,threshold:i=f.threshold,findAllMatches:c=f.findAllMatches,minMatchCharLength:a=f.minMatchCharLength,includeMatches:o=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(t.length>32)throw new Error("Pattern length exceeds max of 32.");const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let g=i,p=d;const m=a>1||o,y=m?Array(u):[];let M;for(;(M=e.indexOf(t,p))>-1;){let e=_(t,{currentLocation:M,expectedLocation:d,distance:r,ignoreLocation:h});if(g=Math.min(e,g),p=M+l,m){let e=0;for(;e<l;)y[M+e]=1,e+=1}}p=-1;let x=[],k=1,L=l+u;const I=1<<l-1;for(let f=0;f<l;f+=1){let n=0,i=L;for(;n<i;)_(t,{errors:f,currentLocation:d+i,expectedLocation:d,distance:r,ignoreLocation:h})<=g?n=i:L=i,i=Math.floor((L-n)/2+n);L=i;let a=Math.max(1,d-i+1),o=c?u:Math.min(d+i,u)+l,M=Array(o+2);M[o+1]=(1<<f)-1;for(let c=o;c>=a;c-=1){let n=c-1,i=s[e.charAt(n)];if(m&&(y[n]=+!!i),M[c]=(M[c+1]<<1|1)&i,f&&(M[c]|=(x[c+1]|x[c])<<1|1|x[c+1]),M[c]&I&&(k=_(t,{errors:f,currentLocation:n,expectedLocation:d,distance:r,ignoreLocation:h}),k<=g)){if(g=k,p=n,p<=d)break;a=Math.max(1,2*d-p)}}if(_(t,{errors:f+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>g)break;x=M}const S={isMatch:p>=0,score:Math.max(.001,k)};if(m){const e=function(e=[],t=f.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=e.length;i<c;i+=1){let c=e[i];c&&-1===n?n=i:c||-1===n||(r=i-1,r-n+1>=t&&s.push([n,r]),n=-1)}return e[i-1]&&i-n>=t&&s.push([n,i-1]),s}(y,a);e.length?o&&(S.indices=e):S.isMatch=!1}return S}(e,t,d,{location:n+g,distance:r,threshold:i,findAllMatches:c,minMatchCharLength:a,includeMatches:s,ignoreLocation:o});p&&(u=!0),l+=m,p&&y&&(h=[...h,...y])});let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&s&&(d.indices=h),d}}class I{constructor(e){this.pattern=e}static isMultiMatch(e){return S(e,this.multiRegex)}static isSingleMatch(e){return S(e,this.singleRegex)}search(){}}function S(e,t){const s=e.match(t);return s?s[1]:null}class b extends I{constructor(e,{location:t=f.location,threshold:s=f.threshold,distance:n=f.distance,includeMatches:r=f.includeMatches,findAllMatches:i=f.findAllMatches,minMatchCharLength:c=f.minMatchCharLength,isCaseSensitive:a=f.isCaseSensitive,ignoreLocation:o=f.ignoreLocation}={}){super(e),this._bitapSearch=new L(e,{location:t,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:c,isCaseSensitive:a,ignoreLocation:o})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class v extends I{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,s=0;const n=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,s))>-1;)s=t+r,n.push([t,s-1]);const i=!!n.length;return{isMatch:i,score:i?0:1,indices:n}}}const w=[class extends I{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},v,class extends I{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends I{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends I{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends I{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends I{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},b],$=w.length,A=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/,C=new Set([b.type,v.type]),F=[];function E(e,t){for(let s=0,n=F.length;s<n;s+=1){let n=F[s];if(n.condition(e,t))return new n(e,t)}return new L(e,t)}const O=e=>!(!e.$and&&!e.$or),R=e=>({$and:Object.keys(e).map(t=>({[t]:e[t]}))});function j(e,t,{auto:s=!0}={}){const i=e=>{let a=Object.keys(e);const o=(e=>!!e.$path)(e);if(!o&&a.length>1&&!O(e))return i(R(e));if((e=>!n(e)&&c(e)&&!O(e))(e)){const n=o?e.$path:a[0],i=o?e.$val:e[n];if(!r(i))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:p(n),pattern:i};return s&&(c.searcher=E(i,t)),c}let h={children:[],operator:a[0]};return a.forEach(t=>{const s=e[t];n(s)&&s.forEach(e=>{h.children.push(i(e))})}),h};return O(e)||(e=R(e)),i(e)}function q(e,t){const s=e.matches;t.matches=[],a(s)&&s.forEach(e=>{if(!a(e.indices)||!e.indices.length)return;const{indices:s,value:n}=e;let r={indices:s,value:n};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)})}function N(e,t){t.score=e.score}let T=(()=>{class e{constructor(e,t={},s){this.options={...f,...t},this._keyStore=new u(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof y))throw new Error("Incorrect 'index' type");this._myIndex=t||M(this.options.keys,this._docs,{getFn:this.options.getFn})}add(e){a(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let s=0,n=this._docs.length;s<n;s+=1){const r=this._docs[s];e(r,s)&&(this.removeAt(s),s-=1,n-=1,t.push(r))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:s,includeScore:n,shouldSort:c,sortFn:a,ignoreFieldNorm:o}=this.options;let h=r(e)?r(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=f.ignoreFieldNorm}){e.forEach(e=>{let s=1;e.matches.forEach(({key:e,norm:n,score:r})=>{const i=e?e.weight:null;s*=Math.pow(0===r&&i?Number.EPSILON:r,(i||1)*(t?1:n))}),e.score=s})}(h,{ignoreFieldNorm:o}),c&&h.sort(a),i(t)&&t>-1&&(h=h.slice(0,t)),function(e,t,{includeMatches:s=f.includeMatches,includeScore:n=f.includeScore}={}){const r=[];return s&&r.push(q),n&&r.push(N),e.map(e=>{const{idx:s}=e,n={item:t[s],refIndex:s};return r.length&&r.forEach(t=>{t(e,n)}),n})}(h,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(e){const t=E(e,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:e,i:s,n:r})=>{if(!a(e))return;const{isMatch:i,score:c,indices:o}=t.searchIn(e);i&&n.push({item:e,idx:s,matches:[{score:c,value:e,norm:r,indices:o}]})}),n}_searchLogical(e){const t=j(e,this.options),s=(e,t,n)=>{if(!e.children){const{keyId:s,searcher:r}=e,i=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(t,s),searcher:r});return i&&i.length?[{idx:n,item:t,matches:i}]:[]}switch(e.operator){case"$and":{const r=[];for(let i=0,c=e.children.length;i<c;i+=1){const c=s(e.children[i],t,n);if(!c.length)return[];r.push(...c)}return r}case"$or":{const r=[];for(let i=0,c=e.children.length;i<c;i+=1){const c=s(e.children[i],t,n);if(c.length){r.push(...c);break}}return r}}},n={},r=[];return this._myIndex.records.forEach(({$:e,i})=>{if(a(e)){let c=s(t,e,i);c.length&&(n[i]||(n[i]={idx:i,item:e,matches:[]},r.push(n[i])),c.forEach(({matches:e})=>{n[i].matches.push(...e)}))}}),r}_searchObjectList(e){const t=E(e,this.options),{keys:s,records:n}=this._myIndex,r=[];return n.forEach(({$:e,i:n})=>{if(!a(e))return;let i=[];s.forEach((s,n)=>{i.push(...this._findMatches({key:s,value:e[n],searcher:t}))}),i.length&&r.push({idx:n,item:e,matches:i})}),r}_findMatches({key:e,value:t,searcher:s}){if(!a(t))return[];let r=[];if(n(t))t.forEach(({v:t,i:n,n:i})=>{if(!a(t))return;const{isMatch:c,score:o,indices:h}=s.searchIn(t);c&&r.push({score:o,key:e,value:t,idx:n,norm:i,indices:h})});else{const{v:n,n:i}=t,{isMatch:c,score:a,indices:o}=s.searchIn(n);c&&r.push({score:a,key:e,value:n,norm:i,indices:o})}return r}}return e.version="6.4.6",e.createIndex=M,e.parseIndex=x,e.config=f,e})();T.parseQuery=j,function(...e){F.push(...e)}(class{constructor(e,{isCaseSensitive:t=f.isCaseSensitive,includeMatches:s=f.includeMatches,minMatchCharLength:n=f.minMatchCharLength,ignoreLocation:r=f.ignoreLocation,findAllMatches:i=f.findAllMatches,location:c=f.location,threshold:a=f.threshold,distance:o=f.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:s,minMatchCharLength:n,findAllMatches:i,ignoreLocation:r,location:c,threshold:a,distance:o},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map(e=>{let s=e.trim().split(A).filter(e=>e&&!!e.trim()),n=[];for(let r=0,i=s.length;r<i;r+=1){const e=s[r];let i=!1,c=-1;for(;!i&&++c<$;){const s=w[c];let r=s.isMultiMatch(e);r&&(n.push(new s(r,t)),i=!0)}if(!i)for(c=-1;++c<$;){const s=w[c];let r=s.isSingleMatch(e);if(r){n.push(new s(r,t));break}}}return n})}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:n}=this.options;e=n?e:e.toLowerCase();let r=0,i=[],c=0;for(let a=0,o=t.length;a<o;a+=1){const n=t[a];i.length=0,r=0;for(let t=0,a=n.length;t<a;t+=1){const a=n[t],{isMatch:o,indices:h,score:l}=a.search(e);if(!o){c=0,r=0,i.length=0;break}r+=1,c+=l,s&&(C.has(a.constructor.type)?i=[...i,...h]:i.push(h))}if(r){let e={isMatch:!0,score:c/r};return s&&(e.indices=i),e}}return{isMatch:!1,score:1}}});var z=T,D=s("Yen0"),Q=s("0MjU");class J{constructor(e){this.searchIndex=[],e&&this.updateSchema(e)}updateSchema(e){this.schema=Object(D.c)(e)}generateSearchIndex(){if(!this.schema)return[];let e=[];Object(Q.a)(this.schema).forEach(t=>{e=[...e,...this.getTypeIndices(t,!0,e)]});const t=this.schema.getTypeMap();return Object.keys(t).forEach(s=>{/^__/.test(s)||(e=[...e,...this.getTypeIndices(t[s],!1,e)])}),this.searchIndex=e,e}getFieldsIndices(e,t,s,n){let r=[];return Object.keys(e).forEach(i=>{const c=e[i],a={search:c.name,name:c.name,description:c.description?c.description:"",args:c.args?c.args.map(e=>({name:e.name,description:e.description})):[],cat:"field",type:t.name,isQuery:s,highlight:"field"};r=[...r,a],c.args&&c.args.length&&c.args.forEach(e=>{r=[...r,{...a,search:e.name,highlight:"argument"}]}),c.type&&(r=[...r,...this.getTypeIndices(c.type,!1,[...n,...r]).filter(e=>!!e)])}),r}getTypeIndices(e,t,s){let n=null;if(!e.name)return[];if(s.some(t=>t.name===e.name&&"type"===t.cat))return[];e.getFields&&(n=e.getFields());const r=[{search:e.name,name:e.name,cat:"type",description:e.description?e.description:"",isRoot:t,highlight:"type"}];return n?[...r,...this.getFieldsIndices(n,e,t,[...s,...r]).filter(e=>!!e)]:r}searchDocs(e){return this.searchIndex.length?new z(this.searchIndex,{keys:["search"],threshold:.4}).search(e).map(e=>e.item):[]}generateQuery(e,t,s){let n="",r=!1;if(!this.schema)return;switch(t){case this.schema.getQueryType()&&this.schema.getQueryType().name:n+="query";break;case this.schema.getMutationType()&&this.schema.getMutationType().name:n+="mutation";break;case this.schema.getSubscriptionType()&&this.schema.getSubscriptionType().name:n+="subscription";break;default:n+=`fragment _____ on ${t}`,r=!0}const i=this.generateFieldData(e,t,[],1,s);if(!i)return;n+=`{\n${i.query}\n}`;const c={...i.meta};return c.hasArgs=r||c.hasArgs,{query:n,meta:c}}cleanName(e){return e.replace(/[\[\]!]/g,"")}generateFieldData(e,t,s,n,r={}){if(!(e&&t&&s&&this.schema))return{query:"",meta:{}};const i=r.tabSize||2,c=this.schema.getType(t),a=c&&c.getFields()[e];if(!a)return{query:"",meta:{}};const o={hasArgs:!1};let h=" ".repeat(n*i)+a.name;a.args&&a.args.length&&(o.hasArgs=!0,h+=`(${a.args.reduce((e,t)=>e+", "+t.name+": ______","").substring(2)})`);const l=this.cleanName(a.type.inspect()),u=this.schema.getType(l);if(s.filter(e=>e.type===l).length)return{query:"",meta:{}};if(n>=(r.addQueryDepthLimit||0))return{query:"",meta:{}};const d=u&&u.getFields&&u.getFields();let g="";return d&&(g=Object.keys(d).reduce((t,i)=>{if(s.filter(e=>e.name===i&&e.type===l).length)return"";const c=this.generateFieldData(i,l,[...s,{name:e,type:l}],n+1,r);if(!c)return t;const a=c.query;return o.hasArgs=o.hasArgs||c.meta.hasArgs||!1,a?t+"\n"+a:t},"").substring(1)),g&&(h+=`{\n${g}\n`,h+=" ".repeat(n*i)+"}"),{query:h,meta:o}}}}}]);
18,234
18,234
0.682132
12c5c2843582dacc708f12fb01f2a77538777f59
1,142
js
JavaScript
extension/action/extension.queryBuild.js
raaffaaeell/vscode-database
42fd5a6c784e709034e07b8549c2bc1e9c52e206
[ "MIT" ]
1
2019-04-25T07:57:43.000Z
2019-04-25T07:57:43.000Z
extension/action/extension.queryBuild.js
kasecato/vscode-database
42fd5a6c784e709034e07b8549c2bc1e9c52e206
[ "MIT" ]
null
null
null
extension/action/extension.queryBuild.js
kasecato/vscode-database
42fd5a6c784e709034e07b8549c2bc1e9c52e206
[ "MIT" ]
1
2017-11-12T07:07:02.000Z
2017-11-12T07:07:02.000Z
var vscode = require('vscode'); var fs = require('fs'); var AbstractAction = require('./AbstractAction.js'); var getBuildQueryDocument = require('./helpers/getBuildQueryDocument.js'); module.exports = class queryBuild extends AbstractAction { execution() { getBuildQueryDocument().then((textDocumentTemp) => { vscode.window.showTextDocument(textDocumentTemp, vscode.ViewColumn.One, false); const confFiles = vscode.workspace.getConfiguration("files"); const autoSave = confFiles.get("autoSave", "off"); if (autoSave === "off") { vscode.workspace.onDidSaveTextDocument( (document) => { if(textDocumentTemp === document){ this.execQuery(document.getText()); } }, this); } }); }; execQuery(query) { if (!query) { return; } this.sqlMenager.queryPromiseMulti(query).then(allResult => { allResult.forEach(result => { this.sqlMenager.queryOutput(result); }); }); } }
30.052632
91
0.555166
12c5ca92cff522319ff97d1095c49e19ca69f6ef
1,451
js
JavaScript
test/__test__/example/wans.config.js
wannasky/wannasky-cli
1cf533766586f4ab4d56ef70a37e424aed63843c
[ "MIT" ]
4
2018-03-27T01:33:24.000Z
2018-07-11T01:48:52.000Z
test/__test__/example/wans.config.js
wannasky/wannasky-cli
1cf533766586f4ab4d56ef70a37e424aed63843c
[ "MIT" ]
1
2018-03-29T03:54:20.000Z
2018-03-29T03:54:20.000Z
test/__test__/example/wans.config.js
wannasky/wannasky-cli
1cf533766586f4ab4d56ef70a37e424aed63843c
[ "MIT" ]
null
null
null
module.exports = { //没有日志输出 silent: true, //端口号 port: 8080, //根目录 root: './test/__test__/example/public/', //代理设置 proxy: { '/home/xman/': { target: 'https://www.baidu.com' } }, //jsHint jsHint:{ files: ['src/**/*.js'], exclude: ['src/**/*.min.js'], options: { //... } }, // local: { // '/test': '../test' // }, //路由设置 router: { '/router/:id': { get: (req, res, query, mock) => { res.json({ name: 'wannasky' }) } }, '/module/test': { get: (req, res, query, mock) => { res.json(mock(mock.object({ status: 200, list: mock.array({ length: mock.random(5, 10), item: mock.object({ name: mock.text('name-', mock.index), age: mock.random(25, 35, true) }) }) }))) } }, '/wannasky/test': { post: (req, res, query) => { console.log('post query', query); res.json({success: true}) } } }, //测试json目录 //当路由,代理,静态资源都获取不到时,再尝试获取.json后缀的文件 testJsonDir: './__test__/json' }
20.728571
65
0.345968
12c63c29e4d0c2e767a20772444d991655cfd7cc
3,387
js
JavaScript
web/js/api.js
lechdo/demoJson
72977a64973ee75728fcdb7931b513364b895b9d
[ "MIT" ]
null
null
null
web/js/api.js
lechdo/demoJson
72977a64973ee75728fcdb7931b513364b895b9d
[ "MIT" ]
null
null
null
web/js/api.js
lechdo/demoJson
72977a64973ee75728fcdb7931b513364b895b9d
[ "MIT" ]
null
null
null
$(document).ready( function () { // tous les éléments dans la fonction seront éxécuté // une fois que la page aura fini de charger // on y place entres autres les déclarations dépendantes // d'un évenement et non d'une action, comme onClick ou onChange //on peut éplacer une requete lourde (bcp de données) qui ne sera // chargée qu'après le reste de la page // pratique pour la mise en forme (cf site de banque par exemple) // pour une déclaration dépendante d'une action, cela se passe coté // html, avec les attributs de balise. } ); getMethod = function () { // vider en premier la div pour remettre une nouvelle liste $("#liste").empty(); //afficher le loader // selection du display d'un élément document.getElementById("loader").style.display = "block"; $.ajax( { //uri derriere le nom de domaine, attention sans vhost, cela ne marchera pas url: "/api-get", // le type, s'il n'est pas mentionné, ce sera GET type: "GET", // renvoie l'action en cas de succès de la requête (il existe .fail dans Jquery) success: () => {alert("le get a été effectué")} } ) // executé quand la fonction est terminée .done(function (apiResult) { // nb : of et pas if, si on met if, il agira pour chaque caractère du json for (personne of apiResult) { // la méthode génératrice de template createHumanTemplate(personne); } // effacement du loader document.getElementById("loader").style.display = "none"; }) } postMethod = function () { var nom = document.getElementById("nom").value; var prenom = document.getElementById("prenom").value; var age = document.getElementById("age").value; // pour une demande de confirmation simple : confirm if (confirm("êtes vous sur de créer cette personne ?")){ // la methode post $.ajax( { url: "/api-post", type: "POST", // les paramètres sont en Json dans le Json, et oui... // cela fonctionne de la meme manière pour les paramètres de GET data: { nom: nom, prenom: prenom, age: age }, success: (apiResult) => {alert(apiResult)} } ) .done(function (apiResult) { createHumanTemplate() }) } } createHumanTemplate = function (personne) { console.log("je suis dans la func"); var bloc = document.createElement("tr") // amener un élément json dans un format html // creation de l'élément html var nom = document.createElement("td"); // attribution d'un texte au td nom.innerText = "nom : " + personne.nom; // attribution de l'éléement au bloc parent bloc.appendChild(nom); var prenom = document.createElement("td"); prenom.innerText = "prenom : " + personne.prenom; bloc.appendChild(prenom); var age = document.createElement("td"); age.innerText = " age : " + personne.age; bloc.appendChild(age); // méthode Jquery pour insérer le bloc dans une balise en séléctionnant son id. $("#liste").append(bloc); }
31.95283
92
0.580159
12c7134c4647e4528f28e84959c6f56b4cc49069
402
js
JavaScript
src/app/components/centered/marvel/marvelController.js
nicoroulet/angular-training
5c4ccec365b858026e2030b1041e69b2a64f2098
[ "Unlicense", "MIT" ]
null
null
null
src/app/components/centered/marvel/marvelController.js
nicoroulet/angular-training
5c4ccec365b858026e2030b1041e69b2a64f2098
[ "Unlicense", "MIT" ]
null
null
null
src/app/components/centered/marvel/marvelController.js
nicoroulet/angular-training
5c4ccec365b858026e2030b1041e69b2a64f2098
[ "Unlicense", "MIT" ]
null
null
null
angular.module('app-bootstrap').controller('MarvelController', [ '$http', function($http) { this.title = 'Characters!'; const marvel = this; $http({ url: 'http://gateway.marvel.com:80/v1/public/characters', method: 'GET', params: { apikey: '198e772c1c5cdce65a4c03afd8d87fd0' } }).success(function(res) { marvel.characters = res.data.results; }); } ]);
26.8
64
0.619403
12c7495b06da86331b068c530d99b6b70e53594d
7,954
js
JavaScript
tests/spec/core/biblio-db-spec.js
yashagarwal17/respec
859437c29177261d985d4938dc56bface699967c
[ "W3C-20150513" ]
2
2021-05-11T18:53:35.000Z
2021-05-11T18:55:29.000Z
tests/spec/core/biblio-db-spec.js
yashagarwal17/respec
859437c29177261d985d4938dc56bface699967c
[ "W3C-20150513" ]
304
2020-06-15T10:03:23.000Z
2022-03-28T10:05:31.000Z
tests/spec/core/biblio-db-spec.js
yashagarwal17/respec
859437c29177261d985d4938dc56bface699967c
[ "W3C-20150513" ]
1
2020-07-28T08:21:38.000Z
2020-07-28T08:21:38.000Z
"use strict"; import { biblioDB } from "../../../src/core/biblio-db.js"; describe("Core - biblioDB", () => { const data = { "whatwg-dom": { aliasOf: "WHATWG-DOM", }, "WHATWG-DOM": { authors: ["Anne van Kesteren"], href: "https://dom.spec.whatwg.org/", title: "DOM Standard", status: "Living Standard", publisher: "WHATWG", id: "WHATWG-DOM", }, addAllTest: { id: "ADD-ALL-TEST", title: "ADD ALL TEST", }, DAHU: { aliasOf: "DAHUT", }, DAHUT: { authors: ["Robin Berjon"], etAl: true, title: "The Dahut Specification Example From the Higher Circle", date: "15 March 1977", status: "Lazy Daft (Work for progress)", href: "http://berjon.com/", versions: [ "DAHUT-TEST6", "DAHUT-TEST5", "DAHUT-TEST4", "DAHUT-TEST3", "DAHUT-TEST2", "DAHUT-TEST1", ], id: "DAHUT", }, }; describe("ready getter", () => { it("resolves with a IDB database", async () => { const db = await biblioDB.ready; expect(db instanceof window.IDBDatabase).toBe(true); }); }); describe("add() method", () => { it("rejects when adding bad types", async () => { try { await biblioDB.add("invalid", "bar"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("rejects when adding empty type", async () => { try { await biblioDB.add("", "ref"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("adds single reference", async () => { await biblioDB.add("reference", { authors: ["Test Author"], href: "https://test/", title: "test spec", status: "Living Standard", publisher: "W3C", id: "test123", }); const result = await biblioDB.has("reference", "test123"); expect(result).toBe(true); }); }); describe("addAll() method", () => { it("adds both aliases and references", async () => { await biblioDB.addAll(data); const results = await Promise.all([ biblioDB.has("alias", "whatwg-dom"), biblioDB.has("reference", "ADD-ALL-TEST"), biblioDB.has("reference", "WHATWG-DOM"), ]); expect(results.every(v => v === true)).toBe(true); }); }); describe("get() method", () => { it("rejects when getting invalid type", async () => { try { await biblioDB.get("invalid", "bar"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("rejects when id is missing", async () => { try { await biblioDB.get("invalid"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("retrieves a reference", async () => { await biblioDB.add("reference", { href: "https://test/", title: "PASS", publisher: "W3C", id: "get-ref-test", }); const entry = await biblioDB.get("reference", "get-ref-test"); expect(entry.title).toBe("PASS"); }); it("retrieves an alias", async () => { await biblioDB.add("alias", { id: "ALIAS-GET-TEST", aliasOf: "PASS", }); const entry = await biblioDB.get("alias", "ALIAS-GET-TEST"); expect(entry.aliasOf).toBe("PASS"); }); it("returns null when it can't find an entry", async () => { const results = await Promise.all([ biblioDB.get("reference", "does not exist"), biblioDB.get("alias", "does not exist"), ]); expect(results.every(v => v === null)).toBe(true); }); }); describe("has() method", () => { it("rejects on invalid type", async () => { try { await biblioDB.has("invalid", "bar"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("rejects when id is missing", async () => { try { await biblioDB.has("invalid"); } catch (err) { expect(err instanceof TypeError).toBe(true); } }); it("returns true when entries exist", async () => { await Promise.all([ biblioDB.add("reference", { id: "has-ref-test", title: "pass", }), biblioDB.add("alias", { id: "has-alias-test", aliasOf: "pass", }), ]); const results = await Promise.all([ biblioDB.has("reference", "has-ref-test"), biblioDB.has("alias", "has-alias-test"), ]); expect(results.every(v => v === true)).toBe(true); }); it("returns false when entries don't exist", async () => { const results = await Promise.all([ biblioDB.has("reference", "does not exist"), biblioDB.has("alias", "does not exist"), ]); expect(results.every(v => v === false)).toBe(true); }); }); describe("isAlias() method", () => { it("rejects if passed a bad id", async () => { const p1 = biblioDB.isAlias(); const p2 = biblioDB.isAlias(null); const p3 = biblioDB.isAlias(""); await Promise.all([ p1.catch(err => expect(err instanceof TypeError).toBe(true)), p2.catch(err => expect(err instanceof TypeError).toBe(true)), p3.catch(err => expect(err instanceof TypeError).toBe(true)), ]); }); it("returns true when it is an alias", async () => { await biblioDB.add("alias", { aliasOf: "isAlias", id: "test-isAlias-pass", }); const result = await biblioDB.isAlias("test-isAlias-pass"); expect(result).toBe(true); }); it("returns false when it is not an alias", async () => { const result = await biblioDB.isAlias("not an alias"); expect(result).toBe(false); }); }); describe("find() method", () => { it("rejects if passed a bad id", async () => { const p1 = biblioDB.find(); const p2 = biblioDB.find(null); const p3 = biblioDB.find(""); await Promise.all([ p1.catch(err => expect(err instanceof TypeError).toBe(true)), p2.catch(err => expect(err instanceof TypeError).toBe(true)), p3.catch(err => expect(err instanceof TypeError).toBe(true)), ]); }); it("finds a references and resolves aliases", async () => { await biblioDB.addAll(data); const r1 = await biblioDB.find("DAHU"); expect(r1.id).toBe("DAHUT"); const r2 = await biblioDB.find("whatwg-dom"); // alias expect(r2.title).toBe("DOM Standard"); }); }); describe("resolveAlias() method", () => { it("rejects if passed a bad id", async () => { const p1 = biblioDB.resolveAlias(); const p2 = biblioDB.resolveAlias(null); const p3 = biblioDB.resolveAlias(""); await Promise.all([ p1.catch(err => expect(err instanceof TypeError).toBe(true)), p2.catch(err => expect(err instanceof TypeError).toBe(true)), p3.catch(err => expect(err instanceof TypeError).toBe(true)), ]); }); it("resolves known aliases or return null when alias is unknown", async () => { await biblioDB.addAll(data); const alias = await biblioDB.resolveAlias("whatwg-dom"); expect(alias).toBe("WHATWG-DOM"); const noAlias = await biblioDB.resolveAlias("does not exist"); expect(noAlias).toBe(null); }); }); describe("close() method", () => {}); describe("clear() method", () => { it("clears entire database", async () => { await biblioDB.add("reference", { title: "will be deleted", id: "get-ref-test", }); const entryBeforeClear = await biblioDB.has("reference", "get-ref-test"); expect(entryBeforeClear).toBeTruthy(); await biblioDB.clear(); const entryAfterClear = await biblioDB.has("reference", "get-ref-test"); expect(entryAfterClear).toBeFalsy(); }); }); });
29.135531
83
0.545135
12c826dc786e7ac2a2c959d1681101d6dbcc8c75
2,098
js
JavaScript
packages/core/logo/dist/esm/StatuspageLogo/Icon.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
1
2020-04-24T13:28:17.000Z
2020-04-24T13:28:17.000Z
packages/core/logo/dist/esm/StatuspageLogo/Icon.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
1
2022-03-02T07:06:35.000Z
2022-03-02T07:06:35.000Z
packages/core/logo/dist/esm/StatuspageLogo/Icon.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
null
null
null
import { __assign, __extends } from "tslib"; /* eslint-disable max-len */ import React, { Component } from 'react'; import { uid } from 'react-uid'; import { DefaultProps } from '../constants'; import Wrapper from '../Wrapper'; var svg = function (iconGradientStart, iconGradientStop) { var id = uid({ iconGradientStart: iconGradientStop }); return "<canvas height=\"32\" width=\"32\" aria-hidden=\"true\"></canvas>\n <svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\" focusable=\"false\" aria-hidden=\"true\">\n <defs>\n <linearGradient id=\"" + id + "\" x1=\"50%\" x2=\"50%\" y1=\"82.77%\" y2=\"10.134%\">\n <stop offset=\"0%\" stop-color=\"" + iconGradientStop + "\" />\n <stop offset=\"82%\" stop-color=\"" + iconGradientStart + "\" " + (iconGradientStart === 'inherit' ? 'stop-opacity="0.4"' : '') + " />\n </linearGradient>\n </defs>\n <g fill=\"none\" fill-rule=\"evenodd\">\n <circle cx=\"16\" cy=\"19.423\" r=\"5.538\" fill=\"url(#" + id + ")\" fill-rule=\"nonzero\"/>\n <path fill=\"currentColor\" fill-rule=\"nonzero\" d=\"M4.14318325,11.970217 L7.17443341,15.5164923 C7.40520779,15.7738906 7.80165918,15.8034375 8.06900618,15.5831636 C12.9601954,11.2622319 19.0323494,11.2622319 23.9235386,15.5831636 C24.1908857,15.8034375 24.5873371,15.7738906 24.8181114,15.5164923 L27.8525794,11.970217 C28.0663737,11.714892 28.04536,11.3403265 27.8043112,11.1098404 C20.6927794,4.96338652 11.2997654,4.96338652 4.20110522,11.1098404 C3.95712825,11.3377486 3.93190106,11.7124749 4.14318325,11.970217 Z\"/>\n </g>\n </svg>"; }; var StatuspageIcon = /** @class */ (function (_super) { __extends(StatuspageIcon, _super); function StatuspageIcon() { return _super !== null && _super.apply(this, arguments) || this; } StatuspageIcon.prototype.render = function () { return React.createElement(Wrapper, __assign({}, this.props, { svg: svg })); }; StatuspageIcon.defaultProps = DefaultProps; return StatuspageIcon; }(Component)); export default StatuspageIcon; //# sourceMappingURL=Icon.js.map
91.217391
1,245
0.655863
12c9f92c15bad20498cbe6f3ee5e7cd12e2af950
8,354
js
JavaScript
node_modules/@react-pdf-viewer/open/lib/cjs/open.js
sooftware/sooftware.io
f944f28339c73dd90adea6cc81e27d3ead598af4
[ "MIT" ]
8
2021-09-20T13:25:37.000Z
2022-01-02T06:59:10.000Z
frontend/src/main/frontend/node_modules/@react-pdf-viewer/open/lib/cjs/open.js
johnojacob99/CSC480-21F
ca56ae0091470cd768078a54bb7a177a30ecf358
[ "MIT" ]
null
null
null
frontend/src/main/frontend/node_modules/@react-pdf-viewer/open/lib/cjs/open.js
johnojacob99/CSC480-21F
ca56ae0091470cd768078a54bb7a177a30ecf358
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var React = require('react'); var core = require('@react-pdf-viewer/core'); function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n["default"] = e; return Object.freeze(n); } var React__namespace = /*#__PURE__*/_interopNamespace(React); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var OpenFileIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 }, React__namespace.createElement("path", { d: "M12.5 4.5L12.5 19.5" }), React__namespace.createElement("path", { d: "M18 10L12.5 4.5 7 10" }), React__namespace.createElement("path", { d: "M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5" }), React__namespace.createElement("path", { d: "M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5" }))); }; var useTriggerOpen = function (store) { var inputRef = React__namespace.useRef(); var openFile = function () { var inputEle = inputRef.current; if (inputEle) { inputEle.click(); if (store.get('triggerOpenFile')) { store.update('triggerOpenFile', false); } } }; var handleOpenFileTriggered = function (trigger) { if (trigger) { openFile(); } }; React__namespace.useEffect(function () { store.subscribe('triggerOpenFile', handleOpenFileTriggered); return function () { store.unsubscribe('triggerOpenFile', handleOpenFileTriggered); }; }, []); return { inputRef: inputRef, openFile: openFile, }; }; var TOOLTIP_OFFSET = { left: 0, top: 8 }; var OpenButton = function (_a) { var enableShortcuts = _a.enableShortcuts, store = _a.store, onClick = _a.onClick; var l10n = React__namespace.useContext(core.LocalizationContext).l10n; var label = l10n && l10n.open ? l10n.open.openFile : 'Open file'; var _b = useTriggerOpen(store), inputRef = _b.inputRef, openFile = _b.openFile; var ariaKeyShortcuts = enableShortcuts ? (core.isMac() ? 'Meta+O' : 'Ctrl+O') : ''; return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "open", position: core.Position.BottomCenter, target: React__namespace.createElement("div", { className: "rpv-open__input-wrapper" }, React__namespace.createElement("input", { ref: inputRef, className: "rpv-open__input", multiple: false, tabIndex: -1, title: "", type: "file", onChange: onClick }), React__namespace.createElement(core.MinimalButton, { ariaKeyShortcuts: ariaKeyShortcuts, ariaLabel: label, onClick: openFile }, React__namespace.createElement(OpenFileIcon, null))), content: function () { return label; }, offset: TOOLTIP_OFFSET })); }; var Open = function (_a) { var children = _a.children, enableShortcuts = _a.enableShortcuts, store = _a.store; var handleOpenFiles = function (e) { var files = e.target.files; if (!files || !files.length) { return; } var openFile = store.get('openFile'); if (openFile) { openFile(files[0]); } }; var defaultChildren = function (props) { return (React__namespace.createElement(OpenButton, { enableShortcuts: enableShortcuts, store: store, onClick: props.onClick })); }; var render = children || defaultChildren; return render({ onClick: handleOpenFiles, }); }; var OpenMenuItem = function (_a) { var store = _a.store, onClick = _a.onClick; var l10n = React__namespace.useContext(core.LocalizationContext).l10n; var label = l10n && l10n.open ? l10n.open.openFile : 'Open file'; var _b = useTriggerOpen(store), inputRef = _b.inputRef, openFile = _b.openFile; return (React__namespace.createElement(core.MenuItem, { icon: React__namespace.createElement(OpenFileIcon, null), onClick: openFile }, React__namespace.createElement("div", { className: "rpv-open__input-wrapper" }, React__namespace.createElement("input", { ref: inputRef, className: "rpv-open__input", multiple: false, tabIndex: -1, title: "", type: "file", onChange: onClick }), label))); }; var ShortcutHandler = function (_a) { var containerRef = _a.containerRef, store = _a.store; var keydownHandler = function (e) { if (e.shiftKey || e.altKey || e.key !== 'o') { return; } var isCommandPressed = core.isMac() ? e.metaKey : e.ctrlKey; if (!isCommandPressed) { return; } var containerEle = containerRef.current; if (!containerEle || !document.activeElement || !containerEle.contains(document.activeElement)) { return; } e.preventDefault(); store.update('triggerOpenFile', true); }; React__namespace.useEffect(function () { var containerEle = containerRef.current; if (!containerEle) { return; } document.addEventListener('keydown', keydownHandler); return function () { document.removeEventListener('keydown', keydownHandler); }; }, [containerRef.current]); return React__namespace.createElement(React__namespace.Fragment, null); }; var openPlugin = function (props) { var openPluginProps = React__namespace.useMemo(function () { return Object.assign({}, { enableShortcuts: true }, props); }, []); var store = React__namespace.useMemo(function () { return core.createStore({}); }, []); var OpenDecorator = function (props) { return (React__namespace.createElement(Open, __assign({ enableShortcuts: openPluginProps.enableShortcuts }, props, { store: store }))); }; var OpenButtonDecorator = function () { return React__namespace.createElement(OpenDecorator, null); }; var OpenMenuItemDecorator = function () { return (React__namespace.createElement(OpenDecorator, null, function (p) { return React__namespace.createElement(OpenMenuItem, { store: store, onClick: p.onClick }); })); }; var renderViewer = function (props) { var slot = props.slot; var updateSlot = { children: (React__namespace.createElement(React__namespace.Fragment, null, openPluginProps.enableShortcuts && (React__namespace.createElement(ShortcutHandler, { containerRef: props.containerRef, store: store })), slot.children)), }; return __assign(__assign({}, slot), updateSlot); }; return { install: function (pluginFunctions) { store.update('openFile', pluginFunctions.openFile); }, renderViewer: renderViewer, Open: OpenDecorator, OpenButton: OpenButtonDecorator, OpenMenuItem: OpenMenuItemDecorator, }; }; exports.OpenFileIcon = OpenFileIcon; exports.openPlugin = openPlugin;
44.201058
219
0.630357
12ca1194fae0af3a4f4a2a02ce8234d5ff920ca9
1,313
js
JavaScript
resources/js/mixins/CardMixin.js
yamada-ham/memo_laravel
b03102d1e9a6600837ec6007b26cd3e441813808
[ "MIT" ]
null
null
null
resources/js/mixins/CardMixin.js
yamada-ham/memo_laravel
b03102d1e9a6600837ec6007b26cd3e441813808
[ "MIT" ]
3
2021-05-11T10:34:24.000Z
2022-02-19T00:41:18.000Z
resources/js/mixins/CardMixin.js
yamada-ham/memo_laravel
b03102d1e9a6600837ec6007b26cd3e441813808
[ "MIT" ]
null
null
null
export default { data () { return { } }, mounted(){ this.autoResizeTextarea(this.$refs.titleTextarea) this.autoResizeTextarea(this.$refs.memoTextarea) }, updated(){ if(this.isModal){ this.autoResizeTextarea(this.$refs.modalTitleTextarea) this.autoResizeTextarea(this.$refs.modalMemoTextarea) } }, methods:{ //テキストエリアの高さを設定 autoResizeTextarea(el){ var areaHeight = el.scrollHeight areaHeight = parseInt(areaHeight) - 54; if(areaHeight < 30){ areaHeight = 30; } el.style.height = areaHeight + "px"; el.style.height = el.scrollHeight + 2 + 'px' }, //テキストエリアが入力されたときの処理 inputResizeTextarea($event){ //モーダルのテキストエリアが入力されたら、対応するメモカード内のテキストエリア改行する。 // if($event.target.className === 'modalTitleTextarea' || $event.target.className === 'modalMemoTextarea'){ this.autoResizeTextarea(this.$refs.titleTextarea) this.autoResizeTextarea(this.$refs.memoTextarea) // } }, //モダールがスクロールされた時にタイトルに影をつくる modalMemoScrollAndTitleShadow($event){ if($event.target.scrollTop === 0){ this.isScrollModal = false }else{ this.isScrollModal = true } }, //モーダルが閉じる時の処理 closeModal($event){ this.isModal = false this.update() }, } }
25.745098
113
0.635948
12cb9d55d4ae4971b806fc3ff526b59a10c3d993
29,711
js
JavaScript
XilinxProcessorIPLib/drivers/canfd/doc/html/api/xcanfd__hw_8h.js
saddepal/embeddedsw
c12743e5d7b0140804699ea818cae66b8d7b62a5
[ "BSD-2-Clause" ]
4
2020-11-06T07:18:11.000Z
2022-02-03T09:03:31.000Z
XilinxProcessorIPLib/drivers/canfd/doc/html/api/xcanfd__hw_8h.js
saddepal/embeddedsw
c12743e5d7b0140804699ea818cae66b8d7b62a5
[ "BSD-2-Clause" ]
null
null
null
XilinxProcessorIPLib/drivers/canfd/doc/html/api/xcanfd__hw_8h.js
saddepal/embeddedsw
c12743e5d7b0140804699ea818cae66b8d7b62a5
[ "BSD-2-Clause" ]
2
2020-11-06T07:18:16.000Z
2021-03-06T07:03:48.000Z
var xcanfd__hw_8h = [ [ "XCANFD_AFIDR_BASE_OFFSET", "xcanfd__hw_8h.html#gabc1a08e6f4f4d3e8eaa29aed9adfe297", null ], [ "XCANFD_AFMR_BASE_OFFSET", "xcanfd__hw_8h.html#gabc9c12f70c89c58f91933712abb4989f", null ], [ "XCANFD_AFR_OFFSET", "xcanfd__hw_8h.html#gafaf16949ceade676ebb936d9fa89b1eb", null ], [ "XCANFD_BRPR_BRP_MASK", "xcanfd__hw_8h.html#gaa2f59eb35cc8631250b3f016aa3aa673", null ], [ "XCANFD_BRPR_OFFSET", "xcanfd__hw_8h.html#gadf75e2f5afba9cd64e5791c153ee7e1a", null ], [ "XCANFD_BTR_OFFSET", "xcanfd__hw_8h.html#gab9688e1229929a3645cd284d1d245ada", null ], [ "XCANFD_BTR_SJW_MASK", "xcanfd__hw_8h.html#ga6f7e0452c98b7c77b0d05750833d2a42", null ], [ "XCANFD_BTR_SJW_SHIFT", "xcanfd__hw_8h.html#ga80eeaf2c70b389ed69f0353b16cd653a", null ], [ "XCANFD_BTR_TS1_MASK", "xcanfd__hw_8h.html#ga255b18c6b873d325f414dab1861ffa8b", null ], [ "XCANFD_BTR_TS2_MASK", "xcanfd__hw_8h.html#gafce91432bfd04a800a53a867aa71a0cd", null ], [ "XCANFD_BTR_TS2_SHIFT", "xcanfd__hw_8h.html#gaa0993f7d7f44b3d1da9843efe312af51", null ], [ "XCANFD_CSB_SHIFT", "xcanfd__hw_8h.html#ga43d436f275a572ba849da7181e5a1184", null ], [ "XCANFD_CTS_MASK", "xcanfd__hw_8h.html#ga47bdb7ea256f6b9c218cf02c87491ec0", null ], [ "XCANFD_DAR_MASK", "xcanfd__hw_8h.html#ga85d51007d6b2ccda975f5373572fcf74", null ], [ "XCANFD_DLC1", "xcanfd__hw_8h.html#gadc6fecd58898ff1270d6dc89aa9cad6c", null ], [ "XCANFD_DLC10", "xcanfd__hw_8h.html#gaeaeda5f7211c93f591719d523a404cb5", null ], [ "XCANFD_DLC11", "xcanfd__hw_8h.html#ga85ab5bc8ce52420346564bd7354c3e84", null ], [ "XCANFD_DLC12", "xcanfd__hw_8h.html#gaff50dd3345b3a5bf56ca6d0519d36f92", null ], [ "XCANFD_DLC13", "xcanfd__hw_8h.html#ga07c8627ff6f4600d5015c32115fffc17", null ], [ "XCANFD_DLC14", "xcanfd__hw_8h.html#ga961a1766083e3ac31a0b10eb663e1011", null ], [ "XCANFD_DLC15", "xcanfd__hw_8h.html#ga2072ca2db6633f6a0d94851ac9c74ebb", null ], [ "XCANFD_DLC2", "xcanfd__hw_8h.html#ga88262fa881bf94ef098524b0276c7d0c", null ], [ "XCANFD_DLC3", "xcanfd__hw_8h.html#gafadeb51740f777ba407ae74e1f8a8238", null ], [ "XCANFD_DLC4", "xcanfd__hw_8h.html#ga8de4edc749d54180135c7990d6d96dee", null ], [ "XCANFD_DLC5", "xcanfd__hw_8h.html#ga4f49a3e2975e48494400a7664b9ee4a9", null ], [ "XCANFD_DLC6", "xcanfd__hw_8h.html#ga51878206ef519d537bd3a52fa3f4ee3d", null ], [ "XCANFD_DLC7", "xcanfd__hw_8h.html#gaba9eedd4eeeb898a2ef4a9473f95b0fe", null ], [ "XCANFD_DLC8", "xcanfd__hw_8h.html#ga44430a2f96eded750274258fd0f35595", null ], [ "XCANFD_DLC9", "xcanfd__hw_8h.html#gac07678d9f40c0c8d80c1406d4f0b641e", null ], [ "XCANFD_DLCR_BRS_MASK", "xcanfd__hw_8h.html#ga0fe8edd82f6b538a0fb87f77033448c5", null ], [ "XCANFD_DLCR_DLC_MASK", "xcanfd__hw_8h.html#ga1b0e652716cf3dd05f680d8b2d4e18ca", null ], [ "XCANFD_DLCR_DLC_SHIFT", "xcanfd__hw_8h.html#ga65dd86b2b807afb20ca4f10807dda1b6", null ], [ "XCANFD_DLCR_EDL_MASK", "xcanfd__hw_8h.html#gaba2ed0d789ffa343886f29a59c99f4b6", null ], [ "XCANFD_DLCR_EFC_MASK", "xcanfd__hw_8h.html#ga32be2c14caf3d78681bfe91fb3722b03", null ], [ "XCANFD_DLCR_EFC_SHIFT", "xcanfd__hw_8h.html#gaaa2e0cb28be4e147aafc5c92e6ff847b", null ], [ "XCANFD_DLCR_MM_MASK", "xcanfd__hw_8h.html#ga2fad559c6836a6e3e7ebba71392bea26", null ], [ "XCANFD_DLCR_MM_SHIFT", "xcanfd__hw_8h.html#gae33409a47339eb9b7041c9add1b9500e", null ], [ "XCANFD_DLCR_TIMESTAMP_MASK", "xcanfd__hw_8h.html#ga3640e0165dc87525a924842f6c3b2f42", null ], [ "XCANFD_DW_BYTES", "xcanfd__hw_8h.html#ga5cf516486ca4407eb98947ca53159316", null ], [ "XCANFD_ECR_OFFSET", "xcanfd__hw_8h.html#ga611b3361112a43fe0f861e2e9ab063a7", null ], [ "XCANFD_ECR_REC_MASK", "xcanfd__hw_8h.html#gae9fa6c69d7dc2c6b98627f256cae69d2", null ], [ "XCANFD_ECR_REC_SHIFT", "xcanfd__hw_8h.html#ga76e600838cf08929a389be6f7b9a4d02", null ], [ "XCANFD_ECR_TEC_MASK", "xcanfd__hw_8h.html#gababa9fda97e7adc9ba7e850525f7cf92", null ], [ "XCANFD_ESR_ACKER_MASK", "xcanfd__hw_8h.html#gac948f1190d9b9563080b437caaf39435", null ], [ "XCANFD_ESR_BERR_MASK", "xcanfd__hw_8h.html#ga408350dcd09645b3e6814e7d90d5c7ed", null ], [ "XCANFD_ESR_CRCER_MASK", "xcanfd__hw_8h.html#ga91900a1167f30fcbf29d61a4db16fc3a", null ], [ "XCANFD_ESR_F_BERR_MASK", "xcanfd__hw_8h.html#ga28f90079457773535e4d48005cb97232", null ], [ "XCANFD_ESR_F_CRCER_MASK", "xcanfd__hw_8h.html#gaabda01fbcb23005534c536b01ce3e8f3", null ], [ "XCANFD_ESR_F_FMER_MASK", "xcanfd__hw_8h.html#gad4e817f355177f60440b8bd0172da3a0", null ], [ "XCANFD_ESR_F_STER_MASK", "xcanfd__hw_8h.html#gada18d458d70927776447a35e18327a6f", null ], [ "XCANFD_ESR_FMER_MASK", "xcanfd__hw_8h.html#ga8c387d7d7db751a35b0950d92a9d40c2", null ], [ "XCANFD_ESR_OFFSET", "xcanfd__hw_8h.html#gad6a1f68ffe89f6c2e5c0c735f9f6c7f1", null ], [ "XCANFD_ESR_STER_MASK", "xcanfd__hw_8h.html#ga79434e2fbe666cec588d68df77658e99", null ], [ "XCANFD_F_BRPR_OFFSET", "xcanfd__hw_8h.html#ga7a4dcaaa4bed9227030acc6b92736969", null ], [ "XCANFD_F_BRPR_TDC_ENABLE_MASK", "xcanfd__hw_8h.html#gae371ee092febcfc998c29d09652e8d11", null ], [ "XCANFD_F_BRPR_TDCMASK", "xcanfd__hw_8h.html#ga636b3d138e192fb39abfb404641b8ea6", null ], [ "XCANFD_F_BTR_OFFSET", "xcanfd__hw_8h.html#ga39cb59def7174e3ac4c1ecaac18a78bc", null ], [ "XCANFD_F_BTR_SJW_MASK", "xcanfd__hw_8h.html#ga1ea950826c113f4bec1ec193052868f6", null ], [ "XCANFD_F_BTR_SJW_SHIFT", "xcanfd__hw_8h.html#ga96b7a9e51fd1fcf4e93764694f929d64", null ], [ "XCANFD_F_BTR_TS1_MASK", "xcanfd__hw_8h.html#gaaf5d78e47a5ba6919b0545059d590a4a", null ], [ "XCANFD_F_BTR_TS2_MASK", "xcanfd__hw_8h.html#gac551c38e6faf80c5708b8008e4291a7b", null ], [ "XCANFD_F_BTR_TS2_SHIFT", "xcanfd__hw_8h.html#gaad09cbb2656a78c03ed0312e58f6e267", null ], [ "XCANFD_FSR_FL_0_SHIFT", "xcanfd__hw_8h.html#ga11138d24ceab59d2f91908bac8689a50", null ], [ "XCANFD_FSR_FL_1_MASK", "xcanfd__hw_8h.html#gaa7d22d05f32a51063d3f68db0d040321", null ], [ "XCANFD_FSR_FL_1_SHIFT", "xcanfd__hw_8h.html#gabde343b8e48170619b856da75f951191", null ], [ "XCANFD_FSR_FL_MASK", "xcanfd__hw_8h.html#ga69d971cc310942bf542abef6a5b540a7", null ], [ "XCANFD_FSR_IRI_1_MASK", "xcanfd__hw_8h.html#ga607e363dd96334c43d0b2bacc265d6b1", null ], [ "XCANFD_FSR_IRI_MASK", "xcanfd__hw_8h.html#ga9450ac36e89afdd51e04e01f814fb6c7", null ], [ "XCANFD_FSR_OFFSET", "xcanfd__hw_8h.html#gad76ab23ec63deac736572a2a2e00be31", null ], [ "XCANFD_FSR_RI_1_MASK", "xcanfd__hw_8h.html#gae3a1411622bf3d8d09b85ff2e2e28cbb", null ], [ "XCANFD_FSR_RI_1_SHIFT", "xcanfd__hw_8h.html#ga6f63f310c131f1ea6894fe022b9e2d98", null ], [ "XCANFD_FSR_RI_MASK", "xcanfd__hw_8h.html#ga90ada91711a91ba65a2b069b065f5484", null ], [ "XCANFD_ICR_OFFSET", "xcanfd__hw_8h.html#ga5bd9cae14b664a41a4ff58601b8656c7", null ], [ "XCANFD_IDR_ID1_MASK", "xcanfd__hw_8h.html#gaf3459bfd84186d43926280b9d5c41d43", null ], [ "XCANFD_IDR_ID1_SHIFT", "xcanfd__hw_8h.html#ga2288d59ab6b0ec1c8559e11425706cfd", null ], [ "XCANFD_IDR_ID2_MASK", "xcanfd__hw_8h.html#ga06d8bdb20f9f9bcb61cbc8d61da72067", null ], [ "XCANFD_IDR_ID2_SHIFT", "xcanfd__hw_8h.html#ga187f794d8e6753419063f513507fc33b", null ], [ "XCANFD_IDR_IDE_MASK", "xcanfd__hw_8h.html#ga34aa61f21432535cb035ca249613a452", null ], [ "XCANFD_IDR_IDE_SHIFT", "xcanfd__hw_8h.html#gac4c9f02ec4ab1bb098c095a4e080a28b", null ], [ "XCANFD_IDR_RTR_MASK", "xcanfd__hw_8h.html#ga4200a110757b2a5d582c9da3d50d11e3", null ], [ "XCANFD_IDR_SRR_MASK", "xcanfd__hw_8h.html#gaa98fc450afe82333806be782168d1f27", null ], [ "XCANFD_IER_OFFSET", "xcanfd__hw_8h.html#ga8d9c17c199f65019ddce460459b9ae9d", null ], [ "XCANFD_IETCS_OFFSET", "xcanfd__hw_8h.html#ga5add5352c35bd2bc65a0c6c2269d0ecc", null ], [ "XCANFD_IETRS_OFFSET", "xcanfd__hw_8h.html#ga9013659e893ea212f829f78822041bc2", null ], [ "XCANFD_ISR_OFFSET", "xcanfd__hw_8h.html#ga8ee2f8cbe81c38ba0e3fb6a00887b021", null ], [ "XCANFD_IXR_ARBLST_MASK", "xcanfd__hw_8h.html#ga4eb23b9ba4add8dbf3c8acae51d16350", null ], [ "XCANFD_IXR_BSOFF_MASK", "xcanfd__hw_8h.html#ga473303a551b82c39d3935fc669a64844", null ], [ "XCANFD_IXR_BSRD_MASK", "xcanfd__hw_8h.html#gac0d17a22ef94508321f74b8a2debf519", null ], [ "XCANFD_IXR_ERROR_MASK", "xcanfd__hw_8h.html#gab4dd107e6478058ee683a328fc40f594", null ], [ "XCANFD_IXR_PEE_MASK", "xcanfd__hw_8h.html#ga4bde3559f68028ddf56b1f1e67697bc9", null ], [ "XCANFD_IXR_RXBOFLW_BI_MASK", "xcanfd__hw_8h.html#gaab2eac44285c0ee62e68afe0ec3cb235", null ], [ "XCANFD_IXR_RXBOFLW_MASK", "xcanfd__hw_8h.html#gab74ba4ea81418e98746d05cc9ec11c6b", null ], [ "XCANFD_IXR_RXFOFLW_1_MASK", "xcanfd__hw_8h.html#ga975c5735320b27f0e43cecbe1d912eae", null ], [ "XCANFD_IXR_RXFOFLW_MASK", "xcanfd__hw_8h.html#ga566ff42774f4ea514508c26d10dc8a42", null ], [ "XCANFD_IXR_RXFWMFLL_1_MASK", "xcanfd__hw_8h.html#gada00785f8c38990346f69d502ed01a53", null ], [ "XCANFD_IXR_RXFWMFLL_MASK", "xcanfd__hw_8h.html#ga3feec04b7ca96b49d495f206d89fbcea", null ], [ "XCANFD_IXR_RXLRM_BI_MASK", "xcanfd__hw_8h.html#ga0478c407f5a28584a430f32bbf4095c5", null ], [ "XCANFD_IXR_RXMNF_MASK", "xcanfd__hw_8h.html#gab4f419c73461273aed0584742f0f120f", null ], [ "XCANFD_IXR_RXOK_MASK", "xcanfd__hw_8h.html#ga0674ab52420b8515233c8d07c4008e94", null ], [ "XCANFD_IXR_RXRBF_MASK", "xcanfd__hw_8h.html#ga57f764f6cc819e5d98539db3ede17fa0", null ], [ "XCANFD_IXR_SLP_MASK", "xcanfd__hw_8h.html#ga0a3e87ae6929b8043495aa9bc29e9401", null ], [ "XCANFD_IXR_TSCNT_OFLW_MASK", "xcanfd__hw_8h.html#gaed3a388d3bda2ca395811be3323860bd", null ], [ "XCANFD_IXR_TXCRS_MASK", "xcanfd__hw_8h.html#ga2d74772558b59933ac24e0d608b27c75", null ], [ "XCANFD_IXR_TXEOFLW_MASK", "xcanfd__hw_8h.html#ga0816df0230187c1c495d49922b4f9024", null ], [ "XCANFD_IXR_TXEWMFLL_MASK", "xcanfd__hw_8h.html#ga909694ed06e3cea4083354085f1f373c", null ], [ "XCANFD_IXR_TXOK_MASK", "xcanfd__hw_8h.html#ga428c4ab612018fedb0e39a945557f5bf", null ], [ "XCANFD_IXR_TXRRS_MASK", "xcanfd__hw_8h.html#ga43563637b709ac0b2853411b9d3a3a00", null ], [ "XCANFD_IXR_WKUP_MASK", "xcanfd__hw_8h.html#ga34815f7a241e4511568c6189ab6bacc6", null ], [ "XCANFD_MAILBOX_RB_MASK_BASE_OFFSET", "xcanfd__hw_8h.html#ga7e6240463fb16478ddc66878d38f9e36", null ], [ "XCANFD_MAX_FRAME_SIZE", "xcanfd__hw_8h.html#ga3555ff502fb4232f49d936bcef541630", null ], [ "XCANFD_MSR_ABR_MASK", "xcanfd__hw_8h.html#ga286d4997bc5331c0c574c0273d4ea6c1", null ], [ "XCANFD_MSR_BRSD_MASK", "xcanfd__hw_8h.html#ga332086833cedcda810dae5d10601c4aa", null ], [ "XCANFD_MSR_CONFIG_MASK", "xcanfd__hw_8h.html#ga875ca2027f80ea82c429676ee92fdec8", null ], [ "XCANFD_MSR_DAR_MASK", "xcanfd__hw_8h.html#ga30173625ebcd4984d29a3c910f29f092", null ], [ "XCANFD_MSR_DPEE_MASK", "xcanfd__hw_8h.html#ga8b6f3ee84710eeedca8081b92e37f5e2", null ], [ "XCANFD_MSR_LBACK_MASK", "xcanfd__hw_8h.html#gab1ce73c3a8872431690e198a09a7a401", null ], [ "XCANFD_MSR_OFFSET", "xcanfd__hw_8h.html#gaf320a6a3fc644cd807559ebb6ebda58b", null ], [ "XCANFD_MSR_SBR_MASK", "xcanfd__hw_8h.html#gab3f483dd3ed3451989fc5bba97eb6d1a", null ], [ "XCANFD_MSR_SLEEP_MASK", "xcanfd__hw_8h.html#gadb5501de8a00843c6e45ab248db5a749", null ], [ "XCANFD_MSR_SNOOP_MASK", "xcanfd__hw_8h.html#ga595fbf84f42acdc95f7e7648543e84e5", null ], [ "XCANFD_NOOF_AFR", "xcanfd__hw_8h.html#ga7670d50f03f4775fc6c5f0d2e43c0c85", null ], [ "XCANFD_RCS0_OFFSET", "xcanfd__hw_8h.html#ga3543fd945bee88ae8c3181ce6916d8c1", null ], [ "XCANFD_RCS1_OFFSET", "xcanfd__hw_8h.html#gae53283fba2bb4dfbd14f54eb87fdbf0c", null ], [ "XCANFD_RCS2_OFFSET", "xcanfd__hw_8h.html#ga75b93906b4933e893280cbddee9afdfd", null ], [ "XCANFD_RCS_HCB_MASK", "xcanfd__hw_8h.html#gaf76cde80e9848671506163e7e9e92cc7", null ], [ "XCanFd_ReadReg", "xcanfd__hw_8h.html#ga12b802c8f83b2a1b48d1322a7458ae34", null ], [ "XCANFD_RSD0_OFFSET", "xcanfd__hw_8h.html#gabc69ddf52c29254e19ec75507a3b0151", null ], [ "XCANFD_RSD1_OFFSET", "xcanfd__hw_8h.html#ga2d4b67047f679c0897f5ac1950d81929", null ], [ "XCANFD_RSD2_OFFSET", "xcanfd__hw_8h.html#ga79125dcac335bad1ffa2cf9368504c09", null ], [ "XCANFD_RSD3_OFFSET", "xcanfd__hw_8h.html#ga544e8f8864510b433f58e172e7d56f06", null ], [ "XCANFD_RXBFLL1_OFFSET", "xcanfd__hw_8h.html#gaee82a048b27add9af12d697b7b5dbb7a", null ], [ "XCANFD_RXBFLL2_OFFSET", "xcanfd__hw_8h.html#ga4f155f4b06f6733660020a3a01e90fe4", null ], [ "XCANFD_RXBUFFER0_FULL_MASK", "xcanfd__hw_8h.html#gadc3b451637f494659dcf6e1796a0c16a", null ], [ "XCANFD_RXBUFFER10_FULL_MASK", "xcanfd__hw_8h.html#gafda40a200796a82ede0dfc05fba964d7", null ], [ "XCANFD_RXBUFFER11_FULL_MASK", "xcanfd__hw_8h.html#gaeea77c8eaa243d4a17c54b4b752829d8", null ], [ "XCANFD_RXBUFFER12_FULL_MASK", "xcanfd__hw_8h.html#ga26ae90d00604887898bdfad9c1b42687", null ], [ "XCANFD_RXBUFFER13_FULL_MASK", "xcanfd__hw_8h.html#ga7a2c0ddd05d93ef2016c21e64bc4cd28", null ], [ "XCANFD_RXBUFFER14_FULL_MASK", "xcanfd__hw_8h.html#ga0776e72dd1d56014a60f442d7d57480c", null ], [ "XCANFD_RXBUFFER15_FULL_MASK", "xcanfd__hw_8h.html#ga2f0e8c0e32627cdb7501235d35d8481f", null ], [ "XCANFD_RXBUFFER16_FULL_MASK", "xcanfd__hw_8h.html#gae0743b8dd3db9ddf9cae093b4788fd8c", null ], [ "XCANFD_RXBUFFER17_FULL_MASK", "xcanfd__hw_8h.html#ga6c0581e92c3b60ab4fc99e34c978e68a", null ], [ "XCANFD_RXBUFFER18_FULL_MASK", "xcanfd__hw_8h.html#gaacbda283cc8526c828f0c821c8e93bcc", null ], [ "XCANFD_RXBUFFER19_FULL_MASK", "xcanfd__hw_8h.html#ga0ced88f47bd3e4719500718e95fa9ff0", null ], [ "XCANFD_RXBUFFER1_FULL_MASK", "xcanfd__hw_8h.html#gabde92365463802867a5bb7806a329d1e", null ], [ "XCANFD_RXBUFFER20_FULL_MASK", "xcanfd__hw_8h.html#ga3f0985f15ed20260b9e0125ba8477cf8", null ], [ "XCANFD_RXBUFFER21_FULL_MASK", "xcanfd__hw_8h.html#gaaa430d7d690b01f5ee9a5a056a36d495", null ], [ "XCANFD_RXBUFFER22_FULL_MASK", "xcanfd__hw_8h.html#ga069ae973615a0fe8ed78b858028e2801", null ], [ "XCANFD_RXBUFFER23_FULL_MASK", "xcanfd__hw_8h.html#gad63159f566c7e5c51fd596771bf6b963", null ], [ "XCANFD_RXBUFFER24_FULL_MASK", "xcanfd__hw_8h.html#gaa6d1c49590b53369a3b26924957241dd", null ], [ "XCANFD_RXBUFFER25_FULL_MASK", "xcanfd__hw_8h.html#ga3bef0fbfcb17f9280d2e91217217fd3a", null ], [ "XCANFD_RXBUFFER26_FULL_MASK", "xcanfd__hw_8h.html#gaa63c51e48232f7bce4e3dd05d47b241e", null ], [ "XCANFD_RXBUFFER27_FULL_MASK", "xcanfd__hw_8h.html#ga94cc08349ae43f271732308671189a53", null ], [ "XCANFD_RXBUFFER28_FULL_MASK", "xcanfd__hw_8h.html#ga8fbd5f901e84bccc3673945e06e76f5e", null ], [ "XCANFD_RXBUFFER29_FULL_MASK", "xcanfd__hw_8h.html#gac3a9f7d9beff53bbde7be5ac953a0943", null ], [ "XCANFD_RXBUFFER2_FULL_MASK", "xcanfd__hw_8h.html#gaf907c3484f13340935440ee9f2ca3d23", null ], [ "XCANFD_RXBUFFER30_FULL_MASK", "xcanfd__hw_8h.html#gad5a6a284ac66e9d4cfb905fb174f3210", null ], [ "XCANFD_RXBUFFER31_FULL_MASK", "xcanfd__hw_8h.html#gac7d15afebdb9685227a45cb7bb672a21", null ], [ "XCANFD_RXBUFFER32_FULL_MASK", "xcanfd__hw_8h.html#gab0dd5304888a8c2693489b3a5a973dce", null ], [ "XCANFD_RXBUFFER33_FULL_MASK", "xcanfd__hw_8h.html#gaa98476cdbf3f4d05a81441ca2c723619", null ], [ "XCANFD_RXBUFFER34_FULL_MASK", "xcanfd__hw_8h.html#ga4592cf58ba673b8d2d2c63ff308f496b", null ], [ "XCANFD_RXBUFFER35_FULL_MASK", "xcanfd__hw_8h.html#gafc01b135913fce669618e5a59bb8c7ea", null ], [ "XCANFD_RXBUFFER36_FULL_MASK", "xcanfd__hw_8h.html#gaf7bc726c8264561604410de720d375ce", null ], [ "XCANFD_RXBUFFER37_FULL_MASK", "xcanfd__hw_8h.html#gaadf1d5865c51ce72231ccdb4e534a5be", null ], [ "XCANFD_RXBUFFER38_FULL_MASK", "xcanfd__hw_8h.html#gab2d85bde17a354daf611b5483439ceb1", null ], [ "XCANFD_RXBUFFER39_FULL_MASK", "xcanfd__hw_8h.html#gacb31f45a79ca5aa7071ea96d9f475039", null ], [ "XCANFD_RXBUFFER3_FULL_MASK", "xcanfd__hw_8h.html#gada3e3b9f15b9006d38e59659295a4f11", null ], [ "XCANFD_RXBUFFER40_FULL_MASK", "xcanfd__hw_8h.html#ga25c47fba775b612467c12c928a8406a8", null ], [ "XCANFD_RXBUFFER41_FULL_MASK", "xcanfd__hw_8h.html#ga6330fcb3de547a1364154e959b24eb22", null ], [ "XCANFD_RXBUFFER42_FULL_MASK", "xcanfd__hw_8h.html#ga0bdf3988b118b28f7e5f7c4b588cdcbb", null ], [ "XCANFD_RXBUFFER43_FULL_MASK", "xcanfd__hw_8h.html#ga208be3ebc424610b36d09c309e1ed465", null ], [ "XCANFD_RXBUFFER44_FULL_MASK", "xcanfd__hw_8h.html#ga2092c3fe6154d86557cb0b77275913d1", null ], [ "XCANFD_RXBUFFER45_FULL_MASK", "xcanfd__hw_8h.html#ga77353dad98a4b48b6034ae528e530b56", null ], [ "XCANFD_RXBUFFER46_FULL_MASK", "xcanfd__hw_8h.html#ga3eed5479d22a85df6dd4f4e9f4db60f1", null ], [ "XCANFD_RXBUFFER47_FULL_MASK", "xcanfd__hw_8h.html#ga0d29d9241115a85eb6e6b292878b8e61", null ], [ "XCANFD_RXBUFFER4_FULL_MASK", "xcanfd__hw_8h.html#ga5d8c79596cac17e509933d487a1c444f", null ], [ "XCANFD_RXBUFFER5_FULL_MASK", "xcanfd__hw_8h.html#ga20c88b84cdae4ed23c86230dfc229e53", null ], [ "XCANFD_RXBUFFER6_FULL_MASK", "xcanfd__hw_8h.html#ga82d11f2a9710c2bbaad8aab19b9e492d", null ], [ "XCANFD_RXBUFFER7_FULL_MASK", "xcanfd__hw_8h.html#gabe3535d8934417dc7a652beb65fdbc16", null ], [ "XCANFD_RXBUFFER8_FULL_MASK", "xcanfd__hw_8h.html#ga70007bfd6177e0e76f34f228a36eda01", null ], [ "XCANFD_RXBUFFER9_FULL_MASK", "xcanfd__hw_8h.html#gaf465edbadb7909b21eaf96f99141bf53", null ], [ "XCANFD_RXFIFO_0_BASE_DLC_OFFSET", "xcanfd__hw_8h.html#ga747aa3d481e5c74bb70f0bf39ffcec18", null ], [ "XCANFD_RXFIFO_0_BASE_DW0_OFFSET", "xcanfd__hw_8h.html#ga0d8bb52005ea0cc600e2024b0ffcaf9b", null ], [ "XCANFD_RXFIFO_0_BASE_ID_OFFSET", "xcanfd__hw_8h.html#ga530180bdb9dc43bb5e89a06cdee1bf11", null ], [ "XCANFD_RXFIFO_1_BUFFER_0_BASE_DLC_OFFSET", "xcanfd__hw_8h.html#ga5e79ee1302076df7e260662f576c17af", null ], [ "XCANFD_RXFIFO_1_BUFFER_0_BASE_DW0_OFFSET", "xcanfd__hw_8h.html#gab2e1d29e5edba1c6980535b89e60c9a1", null ], [ "XCANFD_RXFIFO_1_BUFFER_0_BASE_ID_OFFSET", "xcanfd__hw_8h.html#ga49c501d1d9bd26f4e5daab4db582ce52", null ], [ "XCANFD_RXFIFO_NEXTDLC_OFFSET", "xcanfd__hw_8h.html#gae320058dc31534a2ee51b56e8df27442", null ], [ "XCANFD_RXFIFO_NEXTDW_OFFSET", "xcanfd__hw_8h.html#gab0a942abf01de815bbe3f5388ddd6455", null ], [ "XCANFD_RXFIFO_NEXTID_OFFSET", "xcanfd__hw_8h.html#gafc1f98a730908c7edc6f668a34fd7967", null ], [ "XCANFD_RXLRM_BI_SHIFT", "xcanfd__hw_8h.html#gac41197990b3712c19e5d03accf245fbf", null ], [ "XCANFD_SR_BBSY_MASK", "xcanfd__hw_8h.html#ga68abf56c4559d5d741fcde23658e4ab9", null ], [ "XCANFD_SR_BIDLE_MASK", "xcanfd__hw_8h.html#ga2c37534b278b94335f7ca8b313e0f707", null ], [ "XCANFD_SR_BSFR_CONFIG_MASK", "xcanfd__hw_8h.html#ga5efbb1f38c69e5d3bd87f7c13fd71880", null ], [ "XCANFD_SR_CONFIG_MASK", "xcanfd__hw_8h.html#ga71e00ba768796a2d77e7e0ec7abd5467", null ], [ "XCANFD_SR_ERRWRN_MASK", "xcanfd__hw_8h.html#ga0634de75f238f84f02edc78072e5b4b2", null ], [ "XCANFD_SR_ESTAT_MASK", "xcanfd__hw_8h.html#ga91e0545df281731f2acac938d3c9d634", null ], [ "XCANFD_SR_ESTAT_SHIFT", "xcanfd__hw_8h.html#gaac13d1ee6df944eda8ab067e387ca29b", null ], [ "XCANFD_SR_LBACK_MASK", "xcanfd__hw_8h.html#gaf698d15bafeb3e4488fa0bad48df97bf", null ], [ "XCANFD_SR_NISO_MASK", "xcanfd__hw_8h.html#ga0f467f6afc99ca3ad9dd7df46e678813", null ], [ "XCANFD_SR_NORMAL_MASK", "xcanfd__hw_8h.html#ga94e113eb7e9a839b26dfd61150cad353", null ], [ "XCANFD_SR_OFFSET", "xcanfd__hw_8h.html#ga905b0afb778e0c0cc6506ce1aeba1cfb", null ], [ "XCANFD_SR_PEE_CONFIG_MASK", "xcanfd__hw_8h.html#gad8d6cbdc8a032f5a909f088a366a5583", null ], [ "XCANFD_SR_SLEEP_MASK", "xcanfd__hw_8h.html#ga3c042eaa0d78e6b05fcf39d702f67dcf", null ], [ "XCANFD_SR_SNOOP_MASK", "xcanfd__hw_8h.html#ga4ebd4094c937470bba9700a243aa6af6", null ], [ "XCANFD_SR_TDCV_MASK", "xcanfd__hw_8h.html#ga81f9215a99fd75148ca49158d5aa644c", null ], [ "XCANFD_SRR_CEN_MASK", "xcanfd__hw_8h.html#ga1a923a858916161bc407f2918098bdba", null ], [ "XCANFD_SRR_OFFSET", "xcanfd__hw_8h.html#ga0282a642571a523b41e6e553a737448c", null ], [ "XCANFD_SRR_SRST_MASK", "xcanfd__hw_8h.html#ga24e0fb9923840195f47b29a05c11d66c", null ], [ "XCANFD_TCR_OFFSET", "xcanfd__hw_8h.html#gad65dd689fa39a0ded3e06aaeb5a74f82", null ], [ "XCANFD_TIMESTAMPR_OFFSET", "xcanfd__hw_8h.html#ga950578abebcac4aeb1c1e3a80aed19e2", null ], [ "XCANFD_TRR_OFFSET", "xcanfd__hw_8h.html#gac493cccf557027f9b6f94fdc859022df", null ], [ "XCANFD_TXBUFFER0_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga3399d3951e1fd22ec75d9eb206a09cba", null ], [ "XCANFD_TXBUFFER0_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga9c4f81ba267520c66cfd1b1c962922f0", null ], [ "XCANFD_TXBUFFER10_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga5bc58cf9312f1377307f4aeb9bde7ed5", null ], [ "XCANFD_TXBUFFER10_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga52a142c39f964104e2a54c69770916eb", null ], [ "XCANFD_TXBUFFER11_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gaa508ddca87470e28040b28504a017d2f", null ], [ "XCANFD_TXBUFFER11_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga2a4f5f9bf19bdaaba00db77d01446bed", null ], [ "XCANFD_TXBUFFER12_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga70d8a73eaf50be26d7d0494a6292cda8", null ], [ "XCANFD_TXBUFFER12_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga9cf5f8dff5a700ffca38fcac0dace1ce", null ], [ "XCANFD_TXBUFFER13_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga0706ebd740129c6624421909e5c2a987", null ], [ "XCANFD_TXBUFFER13_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga40a5b607a7d7ea542ee514fdd733b1bb", null ], [ "XCANFD_TXBUFFER14_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga13faa6d0157106f1e16ff73e8e9a830e", null ], [ "XCANFD_TXBUFFER14_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga2e4742abe746c86ea294d94ba4f9e848", null ], [ "XCANFD_TXBUFFER15_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gaf59281f4231a26fdec8b1ef879c39913", null ], [ "XCANFD_TXBUFFER15_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga1cdc452824242d4009e7e6dad257c851", null ], [ "XCANFD_TXBUFFER16_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga79969c8d9d689015a8edce9060b167e7", null ], [ "XCANFD_TXBUFFER16_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga4881f967c33fc4dfddf839e4bd5bbb60", null ], [ "XCANFD_TXBUFFER17_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gae2bf066a1d9517b3e56c1b74a9c57fb4", null ], [ "XCANFD_TXBUFFER17_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga86617c79ddc5c96fa0543a185f940006", null ], [ "XCANFD_TXBUFFER18_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga1ef9b97639991578797e6e0cc6387967", null ], [ "XCANFD_TXBUFFER18_RDY_RQT_MASK", "xcanfd__hw_8h.html#gaf30f6e8eb2548bc4c73219541c6c39ad", null ], [ "XCANFD_TXBUFFER19_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga81b05a9ff5633d2f80119c92347b91fd", null ], [ "XCANFD_TXBUFFER19_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga3dbaf79f5bf84225dbda41a3f5c043e5", null ], [ "XCANFD_TXBUFFER1_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga319ff3f0195d8eb23073be248e991b3f", null ], [ "XCANFD_TXBUFFER1_RDY_RQT_MASK", "xcanfd__hw_8h.html#gabf2333acd7d3b5d9bea2c5298164630e", null ], [ "XCANFD_TXBUFFER20_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga49dd92b5bd9d9663ebc58220ceefb5ca", null ], [ "XCANFD_TXBUFFER20_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga263beb3865dd79e55668f5de22e66b11", null ], [ "XCANFD_TXBUFFER21_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gadf08fc9c0189ca406ff91c891c305f6b", null ], [ "XCANFD_TXBUFFER21_RDY_RQT_MASK", "xcanfd__hw_8h.html#gaf55090153263a6fe5ce1a9d184e7b5e7", null ], [ "XCANFD_TXBUFFER22_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga86fac0c5e7e4baee219e0236645f2f08", null ], [ "XCANFD_TXBUFFER22_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga556514e9e050cce67ff4537c901bbbc7", null ], [ "XCANFD_TXBUFFER23_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga05af4dcddc39878b884f1a3ea841f3c4", null ], [ "XCANFD_TXBUFFER23_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga0cfd8aca39b023d66d798d040bdfdc3c", null ], [ "XCANFD_TXBUFFER24_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga7f3be28e4f5ca1d9947946e589d032eb", null ], [ "XCANFD_TXBUFFER24_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga79c2f05e2c955441308ad12d6ddb6c92", null ], [ "XCANFD_TXBUFFER25_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga250821918da5e4e360de4de35df25bb6", null ], [ "XCANFD_TXBUFFER25_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga4af7ad6993fa67dcdf701de4c88cb176", null ], [ "XCANFD_TXBUFFER26_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gae87fcd037552b799063f4e37fc6b63d3", null ], [ "XCANFD_TXBUFFER26_RDY_RQT_MASK", "xcanfd__hw_8h.html#gacd01488b42042693a8267fd09177594e", null ], [ "XCANFD_TXBUFFER27_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga3887902ee27fc07e8bfebfd44b8949f4", null ], [ "XCANFD_TXBUFFER27_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga8e9ef3c0fc04b0dd2e22b36fd0680b24", null ], [ "XCANFD_TXBUFFER28_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga90946985f0a89d2ec5cefbed102aaf6f", null ], [ "XCANFD_TXBUFFER28_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga52c9c4157e3e25307c7a868aaf4654aa", null ], [ "XCANFD_TXBUFFER29_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gab96a052f955c18a1b7800dc79e36a970", null ], [ "XCANFD_TXBUFFER29_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga6b780396c19dd0aeb4d0fa60fc9a5fe9", null ], [ "XCANFD_TXBUFFER2_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga7c5436f68b04b0020d5adc3b556833be", null ], [ "XCANFD_TXBUFFER2_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga1d913bbb69b890a9a6c3171c65626b82", null ], [ "XCANFD_TXBUFFER30_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga42abc4c8d8ba994e1fa66d100ee5ae75", null ], [ "XCANFD_TXBUFFER30_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga31e569ce89cc4b7f8e741fc9e528bbe5", null ], [ "XCANFD_TXBUFFER31_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga6f6ec0b6268fcb291af26787e0559601", null ], [ "XCANFD_TXBUFFER31_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga98a383894c69dac95b09dd94965f476f", null ], [ "XCANFD_TXBUFFER3_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga9f3bf0aeec97c09e559972cbd6f11430", null ], [ "XCANFD_TXBUFFER3_RDY_RQT_MASK", "xcanfd__hw_8h.html#gace8c9509daecea6a32025b8b98519d95", null ], [ "XCANFD_TXBUFFER4_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#ga2cdfbd6c1e23ab1e4629cb18caabb7c5", null ], [ "XCANFD_TXBUFFER4_RDY_RQT_MASK", "xcanfd__hw_8h.html#gaf2cac98b806d4a801881d5bea0f8265b", null ], [ "XCANFD_TXBUFFER5_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gab65577d3b607ddda891b7a8f55673fcb", null ], [ "XCANFD_TXBUFFER5_RDY_RQT_MASK", "xcanfd__hw_8h.html#gaf06433ecd2c9ac46c4e54cc135b12e80", null ], [ "XCANFD_TXBUFFER6_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gab315df7225add349b3a502d77833c7a4", null ], [ "XCANFD_TXBUFFER6_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga94c62dc73aeb4d687c326ebe6298fb72", null ], [ "XCANFD_TXBUFFER7_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gadbbfe54d938da8d386779eb8af2dd3c8", null ], [ "XCANFD_TXBUFFER7_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga0783eb1fa50e55a72ec8d93ee6dc76e7", null ], [ "XCANFD_TXBUFFER8_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gac8bc522d489ff08cf946e5ef80d58412", null ], [ "XCANFD_TXBUFFER8_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga368625b81d053f13f98c81e1ad6163fa", null ], [ "XCANFD_TXBUFFER9_CANCEL_RQT_MASK", "xcanfd__hw_8h.html#gac0b2d46fe48726dc7f040d97a159290f", null ], [ "XCANFD_TXBUFFER9_RDY_RQT_MASK", "xcanfd__hw_8h.html#ga0249a0783474327a5e6c814cf1649350", null ], [ "XCANFD_TXE_FL_MASK", "xcanfd__hw_8h.html#ga44f50954a4dd506b8c5cc3673b6b8660", null ], [ "XCANFD_TXE_FL_SHIFT", "xcanfd__hw_8h.html#ga8ffc1f432331ad7105ee66b2c945d8d2", null ], [ "XCANFD_TXE_FSR_OFFSET", "xcanfd__hw_8h.html#ga448383a1e77f84de5f150159cd524dc5", null ], [ "XCANFD_TXE_FWM_MASK", "xcanfd__hw_8h.html#ga7f29f81ff0d79c88c13a1f05c44bb9a7", null ], [ "XCANFD_TXE_FWM_OFFSET", "xcanfd__hw_8h.html#ga841d3f677f62d4405156e2a8276f42b0", null ], [ "XCANFD_TXE_IRI_MASK", "xcanfd__hw_8h.html#ga5e4cb2751cb4cd70f492d18452bc2710", null ], [ "XCANFD_TXE_IRI_SHIFT", "xcanfd__hw_8h.html#ga20c1287e0134f8b2838e58210f5b0196", null ], [ "XCANFD_TXE_RI_MASK", "xcanfd__hw_8h.html#gae26bdc34d1efa63f1c83fbf91f512a69", null ], [ "XCANFD_TXEFIFO_0_BASE_DLC_OFFSET", "xcanfd__hw_8h.html#ga4f6953eabc646d9a2ec5a1438f091712", null ], [ "XCANFD_TXEFIFO_0_BASE_ID_OFFSET", "xcanfd__hw_8h.html#ga02c320eb76e107b9012f1ee4e0d4b3c1", null ], [ "XCANFD_TXFIFO_0_BASE_DLC_OFFSET", "xcanfd__hw_8h.html#ga398844a70b19ae7a0cf8d1aecc7feddc", null ], [ "XCANFD_TXFIFO_0_BASE_DW0_OFFSET", "xcanfd__hw_8h.html#ga036f2c2fec022f32ebf3c5e6bc252bcb", null ], [ "XCANFD_TXFIFO_0_BASE_ID_OFFSET", "xcanfd__hw_8h.html#ga66aa59d2a5314c681188d01de9d4a01b", null ], [ "XCANFD_WIR_MASK", "xcanfd__hw_8h.html#gaaea9222a03e7560da7d12d9866d43362", null ], [ "XCANFD_WIR_OFFSET", "xcanfd__hw_8h.html#gafcb42e5f639fe09c200a449e7bdb7fd9", null ], [ "XCANFD_WMR_RXFP_MASK", "xcanfd__hw_8h.html#gafeb9a120686f79963d939f46d8f3178f", null ], [ "XCANFD_WMR_RXFP_MASK", "xcanfd__hw_8h.html#gafeb9a120686f79963d939f46d8f3178f", null ], [ "XCANFD_WMR_RXFP_SHIFT", "xcanfd__hw_8h.html#gac2a2ab2ff4739076715c1dce5d442a1c", null ], [ "XCANFD_WMR_RXFWM_1_MASK", "xcanfd__hw_8h.html#ga505a2f0fee5bd86ae267490fa8fea1f5", null ], [ "XCANFD_WMR_RXFWM_1_MASK", "xcanfd__hw_8h.html#ga505a2f0fee5bd86ae267490fa8fea1f5", null ], [ "XCANFD_WMR_RXFWM_1_SHIFT", "xcanfd__hw_8h.html#gab4d78f5cadee1cc5813cb3946e5bbbb2", null ], [ "XCANFD_WMR_RXFWM_MASK", "xcanfd__hw_8h.html#ga415513c352da6e80d9e8a38a67d976e8", null ], [ "XCanFd_WriteReg", "xcanfd__hw_8h.html#ga6d131863301cf6d7de97e223530acbe2", null ], [ "XST_BUFFER_ALREADY_FILLED", "xcanfd__hw_8h.html#gad68e298b8e6e8691b7cd5f7f27f81478", null ], [ "XST_INVALID_DLC", "xcanfd__hw_8h.html#ga2a772352afe503c047ed1e05764c3e41", null ], [ "XST_NOBUFFER", "xcanfd__hw_8h.html#ga9ce3a3b48c28f8c3643ec9e6bc6dac29", null ] ];
97.733553
114
0.797146
12cc13a88ca43f31b11a64df72a0d0c9cd6c8c51
3,474
js
JavaScript
examples/shadow-dom-counter/src/counter.js
agonsant/web-components-course
9c99ad97955faeacaf24f79d98482fe1770fdbdd
[ "MIT" ]
null
null
null
examples/shadow-dom-counter/src/counter.js
agonsant/web-components-course
9c99ad97955faeacaf24f79d98482fe1770fdbdd
[ "MIT" ]
null
null
null
examples/shadow-dom-counter/src/counter.js
agonsant/web-components-course
9c99ad97955faeacaf24f79d98482fe1770fdbdd
[ "MIT" ]
null
null
null
(function () { const stylesCss = `button, span { font-size: 3rem; font-family: monospace; padding: 0 .5rem; } button { background: pink; color: black; border: 0; border-radius: 6px; box-shadow: 0 0 5px rgba(173, 61, 85, .5); } button:active { background: #ad3d55; color: white; }`; class MyCounter extends HTMLElement { constructor() { super(); this.increment = this.increment.bind(this); this.decrement = this.decrement.bind(this); } connectedCallback() { const documentFragment = document.createDocumentFragment(); const style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(stylesCss)); documentFragment.appendChild(style); const root = document.createElement('div'); const decButton = document.createElement('button'); decButton.innerText = '-'; decButton.addEventListener('click', this.decrement); const incButton = document.createElement('button'); incButton.innerText = '+'; incButton.addEventListener('click', this.increment); root.appendChild(decButton); root.appendChild(document.createElement('span')); root.appendChild(incButton); documentFragment.appendChild(root); this.appendChild(documentFragment); if (!this.hasAttribute('value')) { this.setAttribute('value', 0); } } increment() { const step = +this.step || 1; const newValue = +this.value + step; if (this.max) { this.value = newValue > +this.max ? +this.max : +newValue; } else { this.value = +newValue; } } decrement() { const step = +this.step || 1; const newValue = +this.value - step; if (this.min) { this.value = newValue <= +this.min ? +this.min : +newValue; } else { this.value = +newValue; } } static get observedAttributes() { return ['value']; } attributeChangedCallback(name, oldValue, newValue) { this.querySelector('span').innerText = this.value; } get value() { return this.getAttribute('value'); } get step() { return this.getAttribute('step'); } get min() { return this.getAttribute('min'); } get max() { return this.getAttribute('max'); } set value(newValue) { this.setAttribute('value', newValue); } set step(newValue) { this.setAttribute('step', newValue); } set min(newValue) { this.setAttribute('min', newValue); } set max(newValue) { this.setAttribute('max', newValue); } disconnectedCallback() { this.incrementBtn.removeEventListener('click', this.increment); this.decrementBtn.removeEventListener('click', this.decrement); } } window.customElements.define('my-counter', MyCounter); })();
28.016129
75
0.510363
12cc1f8d5b1ba8ca630578653847df90e9f6a0bb
830
js
JavaScript
app/components/RequireAuth/index.js
mdeveloper919/lift
4c4459aed200bc1211c1bd77c7c3fa0c739787ef
[ "MIT" ]
null
null
null
app/components/RequireAuth/index.js
mdeveloper919/lift
4c4459aed200bc1211c1bd77c7c3fa0c739787ef
[ "MIT" ]
null
null
null
app/components/RequireAuth/index.js
mdeveloper919/lift
4c4459aed200bc1211c1bd77c7c3fa0c739787ef
[ "MIT" ]
null
null
null
// @flow import React, { Component } from 'react'; import { toastr } from 'react-redux-toastr'; import Message from './Message'; type Props = { toDo: string, onClickLogin?: Function, onClickRegister?: Function, children?: React$Element<any>, } class RequireAuth extends Component { props: Props render() { const { toDo } = this.props; const toastrOptions = { timeOut: 0, component: ( <Message toDo={toDo} onClickLogin={this.props.onClickLogin} onClickRegister={this.props.onClickRegister} /> ), }; return ( <div // eslint-disable-line jsx-a11y/no-static-element-interactions onClick={() => toastr.info('', '', toastrOptions)} > {this.props.children} </div> ); } } export default RequireAuth;
20.243902
73
0.59759
12cd590ede11b5353c336d9aec8207e6bad08865
1,822
js
JavaScript
keywordTool/pubfiles/src/code/singaporepressholdings/126871/default.js
dsofowote/KW-Tool
d8d9a5a6f79c33732f0301b7c72ec21d1df4d750
[ "MIT" ]
null
null
null
keywordTool/pubfiles/src/code/singaporepressholdings/126871/default.js
dsofowote/KW-Tool
d8d9a5a6f79c33732f0301b7c72ec21d1df4d750
[ "MIT" ]
null
null
null
keywordTool/pubfiles/src/code/singaporepressholdings/126871/default.js
dsofowote/KW-Tool
d8d9a5a6f79c33732f0301b7c72ec21d1df4d750
[ "MIT" ]
null
null
null
integration.meta = { 'sectionID' : '126871', 'siteName' : 'Luxury Insider - Smartphone - (SG) ', 'platform' : 'smartphone' }; integration.telemetry.setup({ 'url' : true, }); integration.testParams = { 'mobile_resolution' : [407] }; integration.flaggedTests = []; integration.params = { 'mf_siteId' : '707112', 'plr_FluidAnchor' : true, 'plr_Fluid' : true, 'plr_ContentType' : 'PAGESKINEXPRESS', 'plr_UseFullVersion' : true, 'plr_UseCreativeSettings' : true, 'plr_HideElementsByID' : '', 'plr_HideElementsByClass' : '', 'plr_URLKeywords' : 2, 'plr_ShowCloseButton' : true, 'plr_Responsive' : true, 'plr_FixedCloseButton' : true }; integration.on('adCallResult', function(e) { if (e.data.hasSkin) { $("body").addClass("inskinLoaded"); var stylesCSS = '<style type="text/css">'; stylesCSS += '.inskinLoaded .advert-leaderboard{margin:0px;}'; stylesCSS += '.inskinLoaded .search-trigger{margin-top:47px;}'; stylesCSS += 'body.inskinLoaded{padding-right: 0px !important;}'; stylesCSS += '</style>' $('head').append(stylesCSS); } }); integration.on('layoutChange', function(e) { integration.custom.FrameSideRight = e.data.plr_FrameSideRight; var stylesCSS = '<style id="inskinStyles" type="text/css">'; stylesCSS += '</style>' $('head').append(stylesCSS); integration.custom.laychange(); $(window).on('resize', function() { integration.custom.laychange(); }); }); integration.custom.laychange = function() { var windowWidth = $(window).width(); var contentWidth = windowWidth - integration.custom.FrameSideRight; var newValue = '.inskinLoaded .mainslider .view-main-slider ul li{width:' + contentWidth + 'px !important;'; document.getElementById("inskinStyles").innerHTML = newValue; } integration.on("adClose", function(e) { $("body").removeClass("inskinLoaded"); });
26.794118
109
0.690999
12ce013f33a84dca4fd4d05b883ed3c9d38db47e
1,376
js
JavaScript
public/js/dojo-1.6.1/dojox/embed/Object.js
younginnovations/aidstream-old
f5620435a9eed9766b2df5cf7148f94450f9be0e
[ "MIT" ]
4
2016-03-10T21:29:39.000Z
2021-07-02T23:50:52.000Z
web-app/public/js/dojox/embed/Object.js
skobbler/AddressHunter
092bbb612df05377099ea07f7f9263f6adb878ae
[ "BSD-3-Clause" ]
29
2021-03-13T06:58:13.000Z
2021-03-13T06:58:29.000Z
web-app/public/js/dojox/embed/Object.js
skobbler/AddressHunter
092bbb612df05377099ea07f7f9263f6adb878ae
[ "BSD-3-Clause" ]
2
2021-03-22T23:54:59.000Z
2022-01-26T21:54:57.000Z
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.embed.Object"]){ dojo._hasResource["dojox.embed.Object"]=true; dojo.provide("dojox.embed.Object"); dojo.experimental("dojox.embed.Object"); dojo.require("dijit._Widget"); dojo.require("dojox.embed.Flash"); dojo.require("dojox.embed.Quicktime"); dojo.declare("dojox.embed.Object",dijit._Widget,{width:0,height:0,src:"",movie:null,params:null,reFlash:/\.swf|\.flv/gi,reQtMovie:/\.3gp|\.avi|\.m4v|\.mov|\.mp4|\.mpg|\.mpeg|\.qt/gi,reQtAudio:/\.aiff|\.aif|\.m4a|\.m4b|\.m4p|\.midi|\.mid|\.mp3|\.mpa|\.wav/gi,postCreate:function(){ if(!this.width||!this.height){ var _1=dojo.marginBox(this.domNode); this.width=_1.w,this.height=_1.h; } var em=dojox.embed.Flash; if(this.src.match(this.reQtMovie)||this.src.match(this.reQtAudio)){ em=dojox.embed.Quicktime; } if(!this.params){ this.params={}; if(this.domNode.hasAttributes()){ var _2={dojoType:"",width:"",height:"","class":"",style:"",id:"",src:""}; var _3=this.domNode.attributes; for(var i=0,l=_3.length;i<l;i++){ if(!_2[_3[i].name]){ this.params[_3[i].name]=_3[i].value; } } } } var _4={path:this.src,width:this.width,height:this.height,params:this.params}; this.movie=new (em)(_4,this.domNode); }}); }
34.4
280
0.701308
12ce6aa0153d3a327664da8ed93b6f87be5e5a52
3,881
js
JavaScript
src/pages/Home/index.js
arthur-timoteo/react-native-insider-3.0
4227ab30f97c0c95ec68294459a4d78ea923e9a8
[ "MIT" ]
1
2021-10-03T15:00:05.000Z
2021-10-03T15:00:05.000Z
src/pages/Home/index.js
arthur-timoteo/react-native-insider-3.0
4227ab30f97c0c95ec68294459a4d78ea923e9a8
[ "MIT" ]
null
null
null
src/pages/Home/index.js
arthur-timoteo/react-native-insider-3.0
4227ab30f97c0c95ec68294459a4d78ea923e9a8
[ "MIT" ]
1
2021-10-02T00:44:27.000Z
2021-10-02T00:44:27.000Z
import React, { useState } from 'react'; import { TouchableWithoutFeedback, Keyboard, KeyboardAvoidingView, Platform, Modal, ActivityIndicator } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import StatusBarPage from '../../components/StatusBarPage'; import Menu from '../../components/Menu'; import ModalLink from '../../components/ModalLink'; import { Feather } from '@expo/vector-icons'; import { ContainerLogo, Logo, ContainerContent, Title, SubTitle, ContainerInput, BoxIcon, Input, ButtonLink, ButtonLinkText } from './styles'; import api from '../../services/api'; import { saveLink } from '../../utils/storeLinks'; export default function Home(){ const [loading,setLoading] = useState(false); const [input,setInput] = useState(''); const [modalVisible,setModalVisible] = useState(false); const [data,setData] = useState({}); async function handleShortLink(){ setLoading(true); try { const response = await api.post('/shorten', { long_url: input }); setData(response.data); setModalVisible(true); saveLink('sujeitolinks', response.data); Keyboard.dismiss(); setLoading(false); setInput(''); } catch (error) { alert('ops parece que deu alguma coisa errada!'); Keyboard.dismiss(); setInput(''); setLoading(false); } } return( <TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}> <LinearGradient colors={['#1ddbb9', '#132742']} style={{flex:1, justifyContent: 'center'}} > <StatusBarPage barStyle="light-content" backgroundColor="#1ddbb9" /> <Menu /> <KeyboardAvoidingView behavior={ Platform.OS === 'android' ? 'padding' : 'position'} enabled > <ContainerLogo> <Logo source={require('../../assets/Logo.png')} resizeMode="contain" /> </ContainerLogo> <ContainerContent> <Title>SujeitoLink</Title> <SubTitle>Cole seu link para encurtar</SubTitle> <ContainerInput> <BoxIcon> <Feather name="link" size={22} color="#fff" /> </BoxIcon> <Input placeholder="Cole seu link aqui..." placeholderTextColor="white" autoCapitalize="none" autoCorrect={false} keyboardType="url" value={input} onChangeText={(text) => setInput(text)} /> </ContainerInput> <ButtonLink onPress={handleShortLink}> { loading ? ( <ActivityIndicator color="#121212" size={24} /> ) : ( <ButtonLinkText>Gerar Link</ButtonLinkText> ) } </ButtonLink> </ContainerContent> </KeyboardAvoidingView> <Modal visible={modalVisible} transparent animationType="slide"> <ModalLink onClose={() => setModalVisible(false)} data={data} /> </Modal> </LinearGradient> </TouchableWithoutFeedback> ); }
36.961905
142
0.469467
12ceb44ece7d89d1af291abc94bc9c7ede8f66f2
50
js
JavaScript
client/src/selectors/table/index.js
rareramos/Nomisma-Price-Aggregation-Project
2114e455ed1e5a9a7d7195dd5b75df7328539320
[ "MIT" ]
2
2021-07-22T22:31:35.000Z
2021-07-22T22:31:40.000Z
client/src/selectors/table/index.js
rareramos/Nomisma-Price-Aggregation-Project
2114e455ed1e5a9a7d7195dd5b75df7328539320
[ "MIT" ]
2
2021-09-02T16:10:21.000Z
2021-09-02T16:10:31.000Z
client/src/selectors/table/index.js
rareramos/Nomisma-Price-Aggregation-Project
2114e455ed1e5a9a7d7195dd5b75df7328539320
[ "MIT" ]
null
null
null
export * from './base'; export * from './filter';
16.666667
25
0.6
12ceede035c07c34b14d2fad04a0fea4e1c8f37c
11,958
js
JavaScript
gif/NeuQuant.js
audioscape-demo/audioscape-copy
20c5ef2fc7d7ee5103c745764151618c12fbadd8
[ "MIT" ]
15
2015-03-01T00:29:33.000Z
2022-03-13T00:05:47.000Z
gif/NeuQuant.js
kjfeng/audioscape
5c9dc0e273f807a59db08517ba313ff09250bfc1
[ "MIT" ]
44
2017-11-07T14:46:33.000Z
2020-02-14T09:35:12.000Z
gif/NeuQuant.js
kjfeng/audioscape
5c9dc0e273f807a59db08517ba313ff09250bfc1
[ "MIT" ]
3
2015-02-28T23:27:38.000Z
2016-08-03T16:51:12.000Z
/* * NeuQuant Neural-Net Quantization Algorithm * ------------------------------------------ * * Copyright (c) 1994 Anthony Dekker * * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See * "Kohonen neural networks for optimal colour quantization" in "Network: * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of * the algorithm. * * Any party obtaining a copy of these files from the author, directly or * indirectly, is granted, free of charge, a full and unrestricted irrevocable, * world-wide, paid up, royalty-free, nonexclusive right and license to deal in * this software and documentation files (the "Software"), including without * limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons who * receive copies from any such party to do so, with the only requirement being * that this copyright notice remain intact. */ /* * This class handles Neural-Net quantization algorithm * @author Kevin Weiner (original Java version - kweiner@fmsware.com) * @author Thibault Imbert (AS3 version - bytearray.org) * @author Kevin Kwok (JavaScript version - https://github.com/antimatter15/jsgif) * @version 0.1 AS3 implementation */ NeuQuant = function() { var exports = {}; var netsize = 256; /* number of colours used */ /* four primes near 500 - assume no image has a length so large */ /* that it is divisible by all four primes */ var prime1 = 499; var prime2 = 491; var prime3 = 487; var prime4 = 503; var minpicturebytes = (3 * prime4); /* minimum size for input image */ /* * Program Skeleton ---------------- [select samplefac in range 1..30] [read * image from input file] pic = (unsigned char*) malloc(3*width*height); * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output * image header, using writecolourmap(f)] inxbuild(); write output image using * inxsearch(b,g,r) */ /* * Network Definitions ------------------- */ var maxnetpos = (netsize - 1); var netbiasshift = 4; /* bias for colour values */ var ncycles = 100; /* no. of learning cycles */ /* defs for freq and bias */ var intbiasshift = 16; /* bias for fractions */ var intbias = (1 << intbiasshift); var gammashift = 10; /* gamma = 1024 */ var gamma = (1 << gammashift); var betashift = 10; var beta = (intbias >> betashift); /* beta = 1/1024 */ var betagamma = (intbias << (gammashift - betashift)); /* defs for decreasing radius factor */ var initrad = (netsize >> 3); /* for 256 cols, radius starts */ var radiusbiasshift = 6; /* at 32.0 biased by 6 bits */ var radiusbias = (1 << radiusbiasshift); var initradius = (initrad * radiusbias); /* and decreases by a */ var radiusdec = 30; /* factor of 1/30 each cycle */ /* defs for decreasing alpha factor */ var alphabiasshift = 10; /* alpha starts at 1.0 */ var initalpha = (1 << alphabiasshift); var alphadec; /* biased by 10 bits */ /* radbias and alpharadbias used for radpower calculation */ var radbiasshift = 8; var radbias = (1 << radbiasshift); var alpharadbshift = (alphabiasshift + radbiasshift); var alpharadbias = (1 << alpharadbshift); /* * Types and Global Variables -------------------------- */ var thepicture; /* the input image itself */ var lengthcount; /* lengthcount = H*W*3 */ var samplefac; /* sampling factor 1..30 */ // typedef int pixel[4]; /* BGRc */ var network; /* the network itself - [netsize][4] */ var netindex = []; /* for network lookup - really 256 */ var bias = []; /* bias and freq arrays for learning */ var freq = []; var radpower = []; var NeuQuant = exports.NeuQuant = function NeuQuant(thepic, len, sample) { var i; var p; thepicture = thepic; lengthcount = len; samplefac = sample; network = new Array(netsize); for (i = 0; i < netsize; i++) { network[i] = new Array(4); p = network[i]; p[0] = p[1] = p[2] = (i << (netbiasshift + 8)) / netsize; freq[i] = intbias / netsize; /* 1/netsize */ bias[i] = 0; } }; var colorMap = function colorMap() { var map = []; var index = new Array(netsize); for (var i = 0; i < netsize; i++) index[network[i][3]] = i; var k = 0; for (var l = 0; l < netsize; l++) { var j = index[l]; map[k++] = (network[j][0]); map[k++] = (network[j][1]); map[k++] = (network[j][2]); } return map; }; /* * Insertion sort of network and building of netindex[0..255] (to do after * unbias) * ------------------------------------------------------------------------------- */ var inxbuild = function inxbuild() { var i; var j; var smallpos; var smallval; var p; var q; var previouscol; var startpos; previouscol = 0; startpos = 0; for (i = 0; i < netsize; i++) { p = network[i]; smallpos = i; smallval = p[1]; /* index on g */ /* find smallest in i..netsize-1 */ for (j = i + 1; j < netsize; j++) { q = network[j]; if (q[1] < smallval) { /* index on g */ smallpos = j; smallval = q[1]; /* index on g */ } } q = network[smallpos]; /* swap p (i) and q (smallpos) entries */ if (i != smallpos) { j = q[0]; q[0] = p[0]; p[0] = j; j = q[1]; q[1] = p[1]; p[1] = j; j = q[2]; q[2] = p[2]; p[2] = j; j = q[3]; q[3] = p[3]; p[3] = j; } /* smallval entry is now in position i */ if (smallval != previouscol) { netindex[previouscol] = (startpos + i) >> 1; for (j = previouscol + 1; j < smallval; j++) netindex[j] = i; previouscol = smallval; startpos = i; } } netindex[previouscol] = (startpos + maxnetpos) >> 1; for (j = previouscol + 1; j < 256; j++) netindex[j] = maxnetpos; /* really 256 */ }; /* * Main Learning Loop ------------------ */ var learn = function learn() { var i; var j; var b; var g; var r; var radius; var rad; var alpha; var step; var delta; var samplepixels; var p; var pix; var lim; if (lengthcount < minpicturebytes) samplefac = 1; alphadec = 30 + ((samplefac - 1) / 3); p = thepicture; pix = 0; lim = lengthcount; samplepixels = lengthcount / (3 * samplefac); delta = (samplepixels / ncycles) | 0; alpha = initalpha; radius = initradius; rad = radius >> radiusbiasshift; if (rad <= 1) rad = 0; for (i = 0; i < rad; i++) radpower[i] = alpha * (((rad * rad - i * i) * radbias) / (rad * rad)); if (lengthcount < minpicturebytes) step = 3; else if ((lengthcount % prime1) !== 0) step = 3 * prime1; else { if ((lengthcount % prime2) !== 0) step = 3 * prime2; else { if ((lengthcount % prime3) !== 0) step = 3 * prime3; else step = 3 * prime4; } } i = 0; while (i < samplepixels) { b = (p[pix + 0] & 0xff) << netbiasshift; g = (p[pix + 1] & 0xff) << netbiasshift; r = (p[pix + 2] & 0xff) << netbiasshift; j = contest(b, g, r); altersingle(alpha, j, b, g, r); if (rad !== 0) alterneigh(rad, j, b, g, r); /* alter neighbours */ pix += step; if (pix >= lim) pix -= lengthcount; i++; if (delta === 0) delta = 1; if (i % delta === 0) { alpha -= alpha / alphadec; radius -= radius / radiusdec; rad = radius >> radiusbiasshift; if (rad <= 1) rad = 0; for (j = 0; j < rad; j++) radpower[j] = alpha * (((rad * rad - j * j) * radbias) / (rad * rad)); } } }; /* ** Search for BGR values 0..255 (after net is unbiased) and return colour * index * ---------------------------------------------------------------------------- */ var map = exports.map = function map(b, g, r) { var i; var j; var dist; var a; var bestd; var p; var best; bestd = 1000; /* biggest possible dist is 256*3 */ best = -1; i = netindex[g]; /* index on g */ j = i - 1; /* start at netindex[g] and work outwards */ while ((i < netsize) || (j >= 0)) { if (i < netsize) { p = network[i]; dist = p[1] - g; /* inx key */ if (dist >= bestd) i = netsize; /* stop iter */ else { i++; if (dist < 0) dist = -dist; a = p[0] - b; if (a < 0) a = -a; dist += a; if (dist < bestd) { a = p[2] - r; if (a < 0) a = -a; dist += a; if (dist < bestd) { bestd = dist; best = p[3]; } } } } if (j >= 0) { p = network[j]; dist = g - p[1]; /* inx key - reverse dif */ if (dist >= bestd) j = -1; /* stop iter */ else { j--; if (dist < 0) dist = -dist; a = p[0] - b; if (a < 0) a = -a; dist += a; if (dist < bestd) { a = p[2] - r; if (a < 0) a = -a; dist += a; if (dist < bestd) { bestd = dist; best = p[3]; } } } } } return (best); }; var process = exports.process = function process() { learn(); unbiasnet(); inxbuild(); return colorMap(); }; /* * Unbias network to give byte values 0..255 and record position i to prepare * for sort * ----------------------------------------------------------------------------------- */ var unbiasnet = function unbiasnet() { var i; var j; for (i = 0; i < netsize; i++) { network[i][0] >>= netbiasshift; network[i][1] >>= netbiasshift; network[i][2] >>= netbiasshift; network[i][3] = i; /* record colour no */ } }; /* * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in * radpower[|i-j|] * --------------------------------------------------------------------------------- */ var alterneigh = function alterneigh(rad, i, b, g, r) { var j; var k; var lo; var hi; var a; var m; var p; lo = i - rad; if (lo < -1) lo = -1; hi = i + rad; if (hi > netsize) hi = netsize; j = i + 1; k = i - 1; m = 1; while ((j < hi) || (k > lo)) { a = radpower[m++]; if (j < hi) { p = network[j++]; try { p[0] -= (a * (p[0] - b)) / alpharadbias; p[1] -= (a * (p[1] - g)) / alpharadbias; p[2] -= (a * (p[2] - r)) / alpharadbias; } catch (e) {} // prevents 1.3 miscompilation } if (k > lo) { p = network[k--]; try { p[0] -= (a * (p[0] - b)) / alpharadbias; p[1] -= (a * (p[1] - g)) / alpharadbias; p[2] -= (a * (p[2] - r)) / alpharadbias; } catch (e) {} } } }; /* * Move neuron i towards biased (b,g,r) by factor alpha * ---------------------------------------------------- */ var altersingle = function altersingle(alpha, i, b, g, r) { /* alter hit neuron */ var n = network[i]; n[0] -= (alpha * (n[0] - b)) / initalpha; n[1] -= (alpha * (n[1] - g)) / initalpha; n[2] -= (alpha * (n[2] - r)) / initalpha; }; /* * Search for biased BGR values ---------------------------- */ var contest = function contest(b, g, r) { /* finds closest neuron (min dist) and updates freq */ /* finds best neuron (min dist-bias) and returns position */ /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ /* bias[i] = gamma*((1/netsize)-freq[i]) */ var i; var dist; var a; var biasdist; var betafreq; var bestpos; var bestbiaspos; var bestd; var bestbiasd; var n; bestd = ~ (1 << 31); bestbiasd = bestd; bestpos = -1; bestbiaspos = bestpos; for (i = 0; i < netsize; i++) { n = network[i]; dist = n[0] - b; if (dist < 0) dist = -dist; a = n[1] - g; if (a < 0) a = -a; dist += a; a = n[2] - r; if (a < 0) a = -a; dist += a; if (dist < bestd) { bestd = dist; bestpos = i; } biasdist = dist - ((bias[i]) >> (intbiasshift - netbiasshift)); if (biasdist < bestbiasd) { bestbiasd = biasdist; bestbiaspos = i; } betafreq = (freq[i] >> betashift); freq[i] -= betafreq; bias[i] += (betafreq << gammashift); } freq[bestpos] += beta; bias[bestpos] -= betagamma; return (bestbiaspos); }; NeuQuant.apply(this, arguments); return exports; };
22.562264
100
0.532949
12cfc45ad673915140af59373e94920609641f45
4,250
js
JavaScript
viewer/js/gis/dijit/Basemaps.js
JoelHearne/cmv-app
3b37184279b23c1c508a1097a0a42ebc64623e95
[ "MIT" ]
2
2016-05-13T15:19:10.000Z
2016-05-23T14:06:54.000Z
viewer/js/gis/dijit/Basemaps.js
JoelHearne/cmv-app
3b37184279b23c1c508a1097a0a42ebc64623e95
[ "MIT" ]
null
null
null
viewer/js/gis/dijit/Basemaps.js
JoelHearne/cmv-app
3b37184279b23c1c508a1097a0a42ebc64623e95
[ "MIT" ]
1
2016-04-03T17:01:45.000Z
2016-04-03T17:01:45.000Z
define([ 'dojo/_base/declare', 'dijit/_WidgetBase', 'dijit/_TemplatedMixin', 'dijit/_WidgetsInTemplateMixin', 'dojo/_base/lang', 'dijit/DropDownMenu', 'dijit/MenuItem', 'dojo/_base/array', 'dojox/lang/functional', 'dojo/text!./Basemaps/templates/Basemaps.html', 'esri/dijit/BasemapGallery', 'dojo/i18n!./Basemaps/nls/resource', 'dijit/form/DropDownButton', 'xstyle/css!./Basemaps/css/Basemaps.css' ], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, DropDownMenu, MenuItem, array, functional, template, BasemapGallery, i18n) { // main basemap widget return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { templateString: template, widgetsInTemplate: true, i18n: i18n, mode: 'agol', title: i18n.title, //baseClass: 'gis_Basemaps_Dijit', //buttonClass: 'gis_Basemaps_Button', //menuClass: 'gis_Basemaps_Menu', mapStartBasemap: 'streets', basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'gray', 'oceans', 'national-geographic', 'osm'], validBasemaps: [], postCreate: function () { this.inherited(arguments); this.currentBasemap = this.mapStartBasemap || null; if (this.mode === 'custom') { this.gallery = new BasemapGallery({ map: this.map, showArcGISBasemaps: false, basemaps: functional.map(this.basemaps, function (map) { return map.basemap; }) }); // if (this.map.getBasemap() !== this.mapStartBasemap) { //based off the title of custom basemaps in viewer.js config // this.gallery.select(this.mapStartBasemap); // } this.gallery.startup(); } this.menu = new DropDownMenu({ style: 'display: none;' //, //baseClass: this.menuClass }); array.forEach(this.basemapsToShow, function (basemap) { if (this.basemaps.hasOwnProperty(basemap)) { var menuItem = new MenuItem({ id: basemap, label: this.basemaps[basemap].title, iconClass: (basemap == this.mapStartBasemap) ? 'selectedIcon' : 'emptyIcon', onClick: lang.hitch(this, function () { if (basemap !== this.currentBasemap) { this.currentBasemap = basemap; if (this.mode === 'custom') { this.gallery.select(basemap); } else { this.map.setBasemap(basemap); } var ch = this.menu.getChildren(); array.forEach(ch, function (c) { if (c.id == basemap) { c.set('iconClass', 'selectedIcon'); } else { c.set('iconClass', 'emptyIcon'); } }); } }) }); this.menu.addChild(menuItem); } }, this); this.dropDownButton.set('dropDown', this.menu); }, startup: function () { this.inherited(arguments); if (this.mode === 'custom') { if (this.map.getBasemap() !== this.mapStartBasemap) { //based off the title of custom basemaps in viewer.js config this.gallery.select(this.mapStartBasemap); } } else { if (this.mapStartBasemap) { if (this.map.getBasemap() !== this.mapStartBasemap) { //based off the agol basemap name this.map.setBasemap(this.mapStartBasemap); } } } } }); });
42.079208
159
0.473176
12d02378c0a0d40cc3721daf20cfd3243d4914bf
413
js
JavaScript
resources/js/store/CurrentRoute/index.js
logix01001/importshipment
23b4a1367e535768c7a021e93a2569e367db05c0
[ "MIT" ]
null
null
null
resources/js/store/CurrentRoute/index.js
logix01001/importshipment
23b4a1367e535768c7a021e93a2569e367db05c0
[ "MIT" ]
null
null
null
resources/js/store/CurrentRoute/index.js
logix01001/importshipment
23b4a1367e535768c7a021e93a2569e367db05c0
[ "MIT" ]
null
null
null
export default { state:{ currentRoute : '', }, getters:{ currentRoute: (state) => { return state.currentRoute; } }, actions: { changeRoute({commit},data) { commit('setCurrentRoute',data) }, }, mutations: { setCurrentRoute(state,data) { state.currentRoute = data } } }
16.52
42
0.445521
12d0dd2afa15ef495cb8cdde898d13476f00e22e
623
js
JavaScript
packages/core/app/transforms/raw.js
hhff/spree-ember
31aeaa7a3b909c6524d193beddea1267b211130f
[ "MIT" ]
85
2015-03-26T18:02:17.000Z
2019-04-28T02:28:52.000Z
packages/core/app/transforms/raw.js
hhff/spree_ember
31aeaa7a3b909c6524d193beddea1267b211130f
[ "MIT" ]
62
2015-03-28T03:59:54.000Z
2018-10-04T18:07:30.000Z
packages/core/app/transforms/raw.js
hhff/spree_ember
31aeaa7a3b909c6524d193beddea1267b211130f
[ "MIT" ]
28
2015-02-27T05:15:47.000Z
2020-05-24T00:30:41.000Z
import DS from 'ember-data'; /** A simple `DS` transform for accepting raw server output and leaving as is. Currently the only use case is for accepting Spree's Order Checkout Steps as a raw array of strings. @class Raw @namespace Transform @module spree-ember-core/transforms/array @extends DS.Transform */ export default DS.Transform.extend({ /** Return raw output. @method deserialize */ deserialize: function(serialized) { return serialized; }, /** Don't serialize raw input. @method serialize */ serialize: function(deserialized) { return deserialized; } });
20.766667
87
0.690209
12d1055e1c434f0f0ca82cc7d6d4e79d5b989d6b
3,079
js
JavaScript
node_modules/caniuse-lite/data/regions/TT.js
victorfconti/SIF
f744a6327fcd8798e8b913fc9116cb04e359d07d
[ "MIT" ]
482
2019-03-07T17:45:28.000Z
2022-03-31T15:46:03.000Z
node_modules/caniuse-lite/data/regions/TT.js
victorfconti/SIF
f744a6327fcd8798e8b913fc9116cb04e359d07d
[ "MIT" ]
28
2019-10-31T13:15:27.000Z
2022-03-30T23:13:59.000Z
node_modules/caniuse-lite/data/regions/TT.js
victorfconti/SIF
f744a6327fcd8798e8b913fc9116cb04e359d07d
[ "MIT" ]
460
2019-03-09T19:07:05.000Z
2022-03-31T22:52:58.000Z
module.exports={D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.005782,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.023128,"23":0,"24":0,"25":0,"26":0.011564,"27":0,"28":0,"29":0,"30":0,"31":0.092512,"32":0,"33":0,"34":0.011564,"35":0,"36":0,"37":0,"38":0.017346,"39":0,"40":0,"41":0,"42":0,"43":0.005782,"44":0.005782,"45":0,"46":0,"47":0,"48":0.005782,"49":0.248626,"50":0.011564,"51":0.005782,"52":0.005782,"53":0.02891,"54":0.011564,"55":0.011564,"56":0.011564,"57":0.02891,"58":0.02891,"59":0.005782,"60":0.011564,"61":0.005782,"62":0.040474,"63":0.046256,"64":0.02891,"65":0.138768,"66":0.052038,"67":0.109858,"68":0.063602,"69":0.098294,"70":0.17346,"71":7.961814,"72":9.546082,"73":0.02891,"74":0.011564,"75":0},C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.005782,"44":0,"45":0,"46":0,"47":0.011564,"48":0.02891,"49":0,"50":0,"51":0.005782,"52":0.02891,"53":0,"54":0.005782,"55":0.005782,"56":0.11564,"57":0.017346,"58":0,"59":0,"60":0.017346,"61":0.005782,"62":0.040474,"63":0.02891,"64":0.242844,"65":1.231566,"66":0.017346,"67":0,"3.5":0,"3.6":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0.017346,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.005782,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.005782,"44":0,"45":0,"46":0,"47":0,"48":0.011564,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0.005782,"57":0.190806,"58":0.237062,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.005782},E:{"4":0,"5":0.005782,"6":0,"7":0,"8":0.005782,"9":0.005782,"10":0.017346,"11":0.075166,"12":1.509102,_:"0","3.1":0,"3.2":0,"5.1":0.02891,"6.1":0,"7.1":0,"9.1":0.034692,"10.1":0.150332,"11.1":0.265972,"12.1":0},G:{"8":0.39695112238567,"3.2":0.0056505497848494,"4.0-4.1":0.004237912338637,"4.2-4.3":0.004237912338637,"5.0-5.1":0.015539011908336,"6.0-6.1":0.0098884621234864,"7.0-7.1":0.032490661262884,"8.1-8.4":0.077695059541679,"9.0-9.2":0.040966485940158,"9.3":0.30230441348944,"10.0-10.2":0.18929341779245,"10.3":0.39271321004703,"11.0-11.2":0.51278739297508,"11.3-11.4":1.2289945782047,"12.0-12.1":10.850468224357,"12.2":0.052267585509857},I:{"3":0.0023348250591017,"4":0.31053173286052,_:"67","2.1":0,"2.2":0,"2.3":0.051366151300236,"4.1":0.088723352245863,"4.2-4.3":0.46929983687943,"4.4":0,"4.4.3-4.4.4":1.0530061016548},A:{"6":0,"7":0,"8":0.011564,"9":0.02891,"10":0.023128,"11":0.907774,"5.5":0},B:{"12":0.011564,"13":0.017346,"14":0.034692,"15":0.040474,"16":0.127204,"17":1.41659,_:"18"},K:{_:"0 10 11 12 11.1 11.5 12.1"},P:{"4":0.346078464,"5.0-5.4":0.021629904,"6.2-6.4":0.086519616,_:"7.2-7.4 8.2"},N:{"10":0,"11":0.097014},J:{"7":0.0075924,"10":0.0303696},R:{_:"0"},M:{"0":0.118104},O:{"0":0.177156},Q:{_:"1.2"},H:{"0":0.43127962886598},L:{"0":47.546464}};
1,539.5
3,078
0.564469
12d18d599954aebddb81e4e06be22824fce44f98
6,309
js
JavaScript
components/Checkout/index.js
FullyStackedCoder/tshirtshop-client
07f0b1a5fd48e2d0859373fae56c094ad91d934b
[ "MIT" ]
null
null
null
components/Checkout/index.js
FullyStackedCoder/tshirtshop-client
07f0b1a5fd48e2d0859373fae56c094ad91d934b
[ "MIT" ]
5
2020-09-07T10:29:34.000Z
2021-12-09T01:10:52.000Z
components/Checkout/index.js
FullyStackedCoder/tshirtshop-client
07f0b1a5fd48e2d0859373fae56c094ad91d934b
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { Query, Mutation } from "react-apollo"; import gql from "graphql-tag"; import { adopt } from "react-adopt"; import Router from "next/router"; import styled from "styled-components"; import User from "../User"; import Step1 from "./step1"; import Step2 from "./step2"; import Step3 from "./step3"; import Step4 from "./step4"; import { ALL_CART_ITEMS_QUERY } from "../Cart"; import Button from "../Button/styles"; const Center = styled.div` text-align: center; `; const Container = styled.div` max-width: ${props => props.theme.maxWidth}; margin: 0 auto; box-shadow: ${props => props.theme.bs}; padding: 2rem; `; const ALL_SHIPPING_REGIONS_QUERY = gql` query ALL_SHIPPING_REGIONS_QUERY { shippingRegions { shipping_region_id shipping_region } } `; const ALL_SHIPPING_TYPES_QUERY = gql` query ALL_SHIPPING_REGIONS_QUERY { shippings { shipping_id shipping_type shipping_cost shipping_region_id } } `; const Composed = adopt({ shippingRegions: ({ render }) => ( <Query query={ALL_SHIPPING_REGIONS_QUERY}>{render}</Query> ), shippingTypes: ({ render }) => ( <Query query={ALL_SHIPPING_TYPES_QUERY}>{render}</Query> ), cart: ({ cartId, render }) => ( <Query query={ALL_CART_ITEMS_QUERY} variables={{ cartId: cartId }}> {render} </Query> ) }); class Checkout extends Component { state = { showStep1: true, showStep2: true, showStep3: true, showStep4: true, firstName: "", lastName: "", address: "", city: "", state: "", country: "", zipcode: "", shipping: 1, shippingType: 0, shippingRegions: [], shippingTypes: [], cartId: "" }; saveAndContinue = step => { this.setState(prevState => { return { [step]: !prevState[step] }; }); }; saveToState = e => { this.setState({ [e.target.name]: e.target.value }); }; setStateHandler = data => { const me = data.me; if (me) { this.setState({ firstName: me.name.split(" ")[0] ? me.name.split(" ")[0] : "", lastName: me.name.split(" ")[1] ? me.name.split(" ")[1] : "", address: me.address_1 ? me.address_1 : "", city: me.city ? me.city : "", state: me.region ? me.region : "", country: me.country ? me.country : "", zipcode: me.postal_code ? me.postal_code : "", shipping: me.shipping_region_id ? me.shipping_region_id : 1 }); } }; shopButtonClickHandler = () => { try { Router.push({ pathname: "/" }); } catch (error) { console.log(error); } }; componentDidMount = () => { const cartId = localStorage.getItem("cart"); if (cartId) { this.setState(prevState => { return { cartId: cartId }; }); } }; render() { const { showStep1, showStep2, showStep3, showStep4 } = this.state; return ( <User onCompleted={data => this.setStateHandler(data)}> {({ data: { me }, loading }) => { if (loading) return null; return ( <Composed cartId={this.state.cartId}> {({ shippingRegions, shippingTypes, cart }) => { if (!me) return ( <Center> <Container> <Step1 user={me} saveAndContinue={this.saveAndContinue} cart={cart} /> </Container> </Center> ); if ( cart && cart.data.cartItems && !cart.data.cartItems.length ) return ( <Center> <Container> <p style={{ marginBottom: "3rem" }}> You have no items in your cart for checkout.<br/> Please click the below button to go to our shop and add the products you like to the cart for checkout </p> <Button onClick={this.shopButtonClickHandler}> Go to shop </Button> </Container> </Center> ); if (showStep2) { return ( <Container> <Step2 changed={event => this.saveToState(event)} values={this.state} user={me} saveAndContinue={this.saveAndContinue} shippingRegions={shippingRegions.data} shippingTypes={shippingTypes.data} /> </Container> ); } if (showStep3) { return ( <Container> <Step3 changed={event => this.saveToState(event)} values={this.state} user={me} saveAndContinue={this.saveAndContinue} shippingRegions={shippingRegions.data} shippingTypes={shippingTypes.data} /> </Container> ); } if (showStep4) { return ( <center> <Container> <Step4 changed={event => this.saveToState(event)} values={this.state} user={me} saveAndContinue={this.saveAndContinue} shippingRegions={shippingRegions.data} shippingTypes={shippingTypes.data} cart={cart} /> </Container> </center> ); } }} </Composed> ); }} </User> ); } } export default Checkout;
28.418919
82
0.457125
12d24df8fbbdabf0e05a3271815ac8ebd50d0f5b
437
js
JavaScript
public/plugin/numeral/locales/ja.min.js
hoanghongchuong/math
5f7877097d6a5ea0e8d9b882244292e6b879fbc0
[ "MIT" ]
null
null
null
public/plugin/numeral/locales/ja.min.js
hoanghongchuong/math
5f7877097d6a5ea0e8d9b882244292e6b879fbc0
[ "MIT" ]
null
null
null
public/plugin/numeral/locales/ja.min.js
hoanghongchuong/math
5f7877097d6a5ea0e8d9b882244292e6b879fbc0
[ "MIT" ]
null
null
null
(function(global,factory){if(typeof define==="function"&&define.amd){define(["../numeral"],factory)}else if(typeof module==="object"&&module.exports){factory(require("../numeral"))}else{factory(global.numeral)}})(this,function(numeral){numeral.register("locale","ja",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百万",billion:"十億",trillion:"兆"},ordinal:function(number){return"."},currency:{symbol:"¥"}})});
437
437
0.713959
12d3249bd00e217ccdbcf178cf713fb941c2a683
218
js
JavaScript
src/components/common/HSCardHeader.js
Launchpeer/hopscript-web
be82451abec67c345ac7e6714e9aae3527c5aadf
[ "MIT" ]
null
null
null
src/components/common/HSCardHeader.js
Launchpeer/hopscript-web
be82451abec67c345ac7e6714e9aae3527c5aadf
[ "MIT" ]
4
2021-03-09T07:44:27.000Z
2022-02-18T01:54:21.000Z
src/components/common/HSCardHeader.js
samoneill592/hopscript-web
be82451abec67c345ac7e6714e9aae3527c5aadf
[ "MIT" ]
null
null
null
import React from 'react'; const HSCardHeader = ({ children }) => ( <div className="brand-green f4 pa3 bb bw2 b--light-gray"> <div className="pa2 b f4">{children}</div> </div> ); export default HSCardHeader;
21.8
59
0.66055
12d37abe932864d80c31d87f48c6348906629c53
7,896
js
JavaScript
src/js/app/main.js
fu4303/three-cdn
aef54db7c0e97d5335c1b569f2a79d89028f5a77
[ "MIT" ]
null
null
null
src/js/app/main.js
fu4303/three-cdn
aef54db7c0e97d5335c1b569f2a79d89028f5a77
[ "MIT" ]
5
2021-03-09T12:27:31.000Z
2022-02-26T15:29:50.000Z
src/js/app/main.js
fu4303/three-cdn
aef54db7c0e97d5335c1b569f2a79d89028f5a77
[ "MIT" ]
null
null
null
// Global imports - import * as THREE from 'three'; import TWEEN from 'tween.js'; // Local imports - // Components import Renderer from './components/renderer'; import Camera from './components/camera'; import Light from './components/light'; import Controls from './components/controls'; // Helpers import Geometry from './helpers/geometry'; import Stats from './helpers/stats'; // Model import Texture from './model/texture'; import Model from './model/model'; // Managers import Interaction from './managers/interaction'; import DatGUI from './managers/datGUI'; // data import Config from './../data/config'; // -- End of imports // This class instantiates and ties all of the components together, starts the loading process and renders the main loop export default class Main { constructor(container) { // Set container property to container element this.container = container; // Start Three clock this.clock = new THREE.Clock(); this.t = 0; this.line = null; this.count = 0; this.curve = null; this.particles= []; this.traffic = new THREE.Group(); this.starsGeometry = null; this.axis = new THREE.Vector3( ); // Main scene creation this.scene = new THREE.Scene(); //this.scene.fog = new THREE.FogExp2(Config.fog.color, Config.fog.near); // Get Device Pixel Ratio first for retina if(window.devicePixelRatio) { Config.dpr = window.devicePixelRatio; } // Main renderer constructor this.renderer = new Renderer(this.scene, container); // Components instantiations this.camera = new Camera(this.renderer.threeRenderer); console.log(this.camera.threeCamera.position) this.controls = new Controls(this.camera.threeCamera, container); this.light = new Light(this.scene); // Create and place lights in scene const lights = ['ambient', 'directional', 'point', 'hemi']; lights.forEach((light) => this.light.place(light)); // Create and place geo in scene // // Set up rStats if dev environment // if(Config.isDev && Config.isShowingStats) { // this.stats = new Stats(this.renderer); // this.stats.setUp(); // } this.stats = new Stats(this.renderer); this.stats.setUp(); // Instantiate texture class this.texture = new Texture(); // Start loading the textures and then go on to load the model after the texture Promises have resolved this.texture.load().then(() => { this.manager = new THREE.LoadingManager(); // Textures loaded, load model this.model = new Model(this.scene, this.manager, this.texture.textures); this.model.load(); this.geometry = new Geometry(this.scene, this.texture.textures); this.geometry.make('plane')(130, 130, 1, 1); this.geometry.place([0, 10, 0], [Math.PI / 2, 0, 0]); this.geometry.make('map')(150, 150, 1, 1); this.geometry.place([0, -15, 0], [-Math.PI / 2, 0, 0]); this.geometry.make('cube')(15,15,15); this.geometry.place([0, 30, 0], [Math.PI / 36, Math.PI / 4,0]); var nodeGeometry = new THREE.CylinderGeometry( 2, 2, 1.5, 32 ); var nodeMaterial = new THREE.MeshToonMaterial( { transparent: true, flatShading: true, opacity: 1, color: 1570734, emissive: 0, specular: 0, shininess: 0 } ); var node1 = new THREE.Mesh( nodeGeometry, nodeMaterial ); node1.receiveShadows = true; node1.castShadows = true; node1.rotateY( Math.PI / 4) var node2 = new THREE.Mesh( nodeGeometry, nodeMaterial ); node2.position.y = 1.75; node2.receiveShadows = true; node2.castShadows = true; node2.rotateY( Math.PI / 4) // cube.rotateX( Math.PI / 12) // cube.rotateZ( Math.PI / 12) var node = new THREE.Group(); node.add(node1); node.add(node2); node.position.y = this.geometry.plane.position.y+1.1; node.position.x = 45; node.position.z = 50; this.scene.add(node); var secondNode = node.clone(); secondNode.position.x = -13; secondNode.position.z = -2.5; this.scene.add(secondNode); var curve = new THREE.CatmullRomCurve3( [ new THREE.Vector3(this.geometry.cube.position.x,this.geometry.cube.position.y-7.5,this.geometry.cube.position.z), new THREE.Vector3(this.geometry.cube.position.x,this.geometry.cube.position.y-14,this.geometry.cube.position.z), new THREE.Vector3(node.position.x, node.position.y+4, node.position.z), node.position, //new THREE.Vector3(node.position.x, node.position.y-8, node.position.z), new THREE.Vector3(node.position.x, this.geometry.map.position.y, node.position.z) ]); this.curve = curve; var points = curve.getPoints( 30 ); var lg = new THREE.BufferGeometry().setFromPoints( points ); var lm = new THREE.LineBasicMaterial( { color: 0x0000ff } ); this.line = new THREE.Line( lg, lm ); // this.scene.add( this.line ); this.scene.add(this.traffic); // onProgress callback this.manager.onProgress = (item, loaded, total) => { console.log(`${item}: ${loaded} ${total}`); }; // All loaders done now this.manager.onLoad = () => { // Set up interaction manager with the app now that the model is finished loading new Interaction(this.renderer.threeRenderer, this.scene, this.camera.threeCamera, this.controls.threeControls); // Add dat.GUI controls if dev if(Config.isDev) { // new DatGUI(this, this.model.obj); } new DatGUI(this, this.model.obj); // Everything is now fully loaded Config.isLoaded = true; this.container.querySelector('#loading').style.display = 'none'; }; }); // Start render which does not wait for model fully loaded this.render(); } render() { // Render rStats if Dev if(Config.isDev && Config.isShowingStats) { Stats.start(); } // Call render function and pass in created scene and camera this.renderer.render(this.scene, this.camera.threeCamera); // rStats has finished determining render call now if(Config.isDev && Config.isShowingStats) { Stats.end(); } // Delta time is sometimes needed for certain updates //const delta = this.clock.getDelta(); // Call any vendor or module frame updates here TWEEN.update(); this.controls.threeControls.update(); // RAF if(this.curve !== null){ // console.log(this.traffic); // console.log(this.traffic.children); var starsMaterial = new THREE.PointsMaterial( { color: 0x17e7ae } ); let starsGeometry = new THREE.Geometry(); let star = new THREE.Vector3(Math.random()*2-1,Math.random()*2-1,Math.random()*2-1); starsGeometry.vertices.push(star); var pts = new THREE.Points( starsGeometry, starsMaterial ); pts.t = 0; //console.log('wat'); //console.log(pts); this.traffic.add(pts); this.traffic.updateMatrix(); let me= this; // set the quaternion this.traffic.children.forEach(function(p){ (p.t <= 0.995) ? p.t+=0.005 : me.traffic.remove(p); var up = new THREE.Vector3( 0, 1, 0 ); var pp = me.curve.getUtoTmapping(p.t) var pos = me.curve.getPoint(pp); var tangent = me.curve.getTangent(p.t).normalize(); // console.log(tangent); let axis = new THREE.Vector3(); axis.crossVectors( up, tangent ).normalize(); var radians = Math.acos( up.dot( tangent ) ); p.quaternion.setFromAxisAngle( axis, radians ); p.position.x = pos.x; p.position.y = pos.y; p.position.z = pos.z; p.updateMatrix(); }) me.traffic = this.traffic // .position.set(pos.x, pos.y, pos.z); } requestAnimationFrame(this.render.bind(this)); // Bind the main class instead of window object } }
33.888412
120
0.637665
12d39c9fe96fea9eed8b1d7ba5ec29f0679b5ab0
3,008
js
JavaScript
controls/ultrasound/ultrasound-macro.js
ObjectIsAdvantag/xapi-macros-samples
4457a1c4f9f8c6715830fae314b0b721cc612f3f
[ "MIT" ]
22
2018-01-05T16:57:36.000Z
2019-12-12T16:50:52.000Z
controls/ultrasound/ultrasound-macro.js
ObjectIsAdvantag/xapi-macros-samples
4457a1c4f9f8c6715830fae314b0b721cc612f3f
[ "MIT" ]
6
2020-01-26T05:55:59.000Z
2020-06-08T06:14:20.000Z
controls/ultrasound/ultrasound-macro.js
ObjectIsAdvantag/xapi-macros-samples
4457a1c4f9f8c6715830fae314b0b721cc612f3f
[ "MIT" ]
15
2018-04-21T21:25:37.000Z
2019-12-13T18:49:05.000Z
// // Copyright (c) 2020 Cisco Systems // Licensed under the MIT License // const xapi = require('xapi') xapi.on('ready', init) // CE maximum volume for Ultrasound // note: Since CE 9.9, max is 70 across all devices //const MAX = 90 // for a DX80 //const MAX = 70 // for a RoomKit const MAX = 70 function init() { console.log("connexion successful") // Initialize the widgets xapi.config.get('Audio Ultrasound MaxVolume') .then(updateUI) // Update configuration from UI actions xapi.event.on('UserInterface Extensions Widget Action', (event) => { if (event.WidgetId !== 'US_volume_slider') return if (event.Type !== 'released') return // Update Ultrasound configuration const volume = Math.round(parseInt(event.Value) * MAX / 255) console.log(`updating Ultrasound configuration to: ${volume}`) xapi.config.set('Audio Ultrasound MaxVolume', volume) }) // Update UI from configuration changes xapi.config.on('Audio Ultrasound MaxVolume', updateUI) // Update if the controls is (re-)deployed xapi.event.on('UserInterface Extensions Widget LayoutUpdated', (event) => { console.log(`layout updated, let's refresh the widgets`) xapi.config.get('Audio Ultrasound MaxVolume') .then(updateUI) }) } function updateUI(volume) { console.log(`updating UI to new Ultrasound configuration: ${volume}`) // Update Widget: slider xapi.command('UserInterface Extensions Widget SetValue', { WidgetId: 'US_volume_text', Value: volume }) .catch((error) => { console.log("cannot update UI component 'Volume level'. Is the panel deployed?") return }) // Update Widget: slider let newVolume = parseInt(volume) const level = Math.round(newVolume * 255 / MAX) xapi.command('UserInterface Extensions Widget SetValue', { WidgetId: 'US_volume_slider', Value: level }) .catch((error) => { console.log("cannot update UI component 'Volume slider'. Is the panel deployed?") return }) // Update "Pairing" Invite on the Monitor updatePairingInvite(newVolume) } function updatePairingInvite(volume) { const MIN_LEVEL_TO_PAIR = 5 // note that this is an arbitrary value if (volume < MIN_LEVEL_TO_PAIR) { xapi.config.set('UserInterface CustomMessage', "/!\\ Pairing is disabled") return } // Pick the message that suits your device's registration mode xapi.status.get('Webex Status') .then((status) => { // If cloud-registered if (status == 'Registered') { xapi.config.set('UserInterface CustomMessage', "Tip: Launch Webex Teams to pair") } else { // If registered on-premises (VCS or CUCM ) xapi.config.set('UserInterface CustomMessage', "Tip: Pair from a Proximity client") } }) }
30.693878
99
0.626995
12d431f18ee887d89bd889a409759ed7f65d13dc
489
js
JavaScript
node_modules/owl/lib/utils.js
dkareithis/test-project
9eb921eac7ac6d2d1006be1ba92e6ed989aca42c
[ "MIT" ]
1
2015-06-26T11:28:09.000Z
2015-06-26T11:28:09.000Z
lib/utils.js
cpetzold/owl
e20e20ff6178a6e272ec12d6a657c1021a1deedc
[ "MIT", "Unlicense" ]
null
null
null
lib/utils.js
cpetzold/owl
e20e20ff6178a6e272ec12d6a657c1021a1deedc
[ "MIT", "Unlicense" ]
null
null
null
module.exports = { strip_tags: function(input, allowed) { allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi , commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi; return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; }); }, noop: function() {} }
32.6
95
0.470348
12d496215df7e15c826ebac8a4351cdf72688445
8,565
js
JavaScript
src/pages/Network/peer/peer.js
oooofeiger/fabricExplorer2
8cb35c889c35a81df1de890350a72ee9481bf92c
[ "MIT" ]
1
2019-05-08T09:04:00.000Z
2019-05-08T09:04:00.000Z
src/pages/Network/peer/peer.js
oooofeiger/fabricExplorer2
8cb35c889c35a81df1de890350a72ee9481bf92c
[ "MIT" ]
1
2019-05-08T09:10:17.000Z
2019-05-08T09:10:17.000Z
src/pages/Network/peer/peer.js
oooofeiger/fabricExplorer2
8cb35c889c35a81df1de890350a72ee9481bf92c
[ "MIT" ]
null
null
null
import React from 'react'; import ReactDOM from 'react-dom'; import { connect } from 'dva'; import { Row, Col, Icon, Tabs, Table, Menu, Dropdown, Button, message, } from 'antd'; import PageHeaderLayout from '@/components/PageHeaderWrapper'; import WrapDeployPeer from './peerDeploy'; import WrapGenerateCert from '../generateCert'; import styles from '../index.less'; import peer from '@/assets/节点.png'; const { TabPane } = Tabs; const host = window.hostIp; @connect(({ network, loading }) => { return { network, loading: loading.effects['network/getConfigPeer'], }; }) export default class PeerNetwork extends React.Component { constructor(props) { super(props); this.state = { currentPeer: null, listSwitch: true, updateSwitch: true, }; this.downloadFile = React.createRef(); this.managePeer = this.managePeer.bind(this); this.peerDelete = this.peerDelete.bind(this); this.checkName = this.checkName.bind(this); this.updateTable = this.updateTable.bind(this); } componentDidMount() { const { dispatch } = this.props; dispatch({ type: 'network/getConfigPeer', }); } componentDidUpdate(prevProps, prevState) { const prevNetwork = prevProps.network; const prevPeerDelete = prevNetwork.peerDelete; const prevManagePeer = prevNetwork.managePeer; const { updateSwitch } = this.state; const { dispatch, network } = this.props; const { peerDelete, managePeer } = network; network.peerConfig && this.state.listSwitch && this.setState({ currentPeer: network.peerConfig[0], listSwitch: false, }); if(managePeer && !prevManagePeer){ dispatch({ type: 'network/getConfigPeer', }); }else if(prevManagePeer && managePeer && managePeer.time !== prevManagePeer.time){ dispatch({ type: 'network/getConfigPeer', }); } if (peerDelete && !prevPeerDelete) { this.updateTable(); } else if (prevPeerDelete && peerDelete && peerDelete.time !== prevPeerDelete.time) { this.updateTable(); } if (updateSwitch) { dispatch({ type: 'network/getConfigPeer', }); this.setState({ updateSwitch: false, }); } } updateTable() { this.setState({ updateSwitch: true, }); } managePeer = (name, oper, message) => { // debugger; console.log(message==undefined) const { dispatch } = this.props; if (typeof message !== 'undefined') { if (confirm(message)) { dispatch({ type: 'network/handleManagePeer', payload: { peerName: name, oper, }, }); } } else { dispatch({ type: 'network/handleManagePeer', payload: { peerName: name, oper, }, }); } }; peerDelete = peerName => { const { dispatch } = this.props; dispatch({ type: 'network/peerDelete', payload: { peerName, }, }); }; checkName = (rule, value, callback) => { const { data, type } = this.props; data.map((item, i) => { if (type === 'peer') { if (item.peerName === value) { callback('节点已经存在!'); } else { callback(); } } else { if (item.ordererName === value) { callback('节点已经存在!'); } else { callback(); } } }); }; render() { const { currentPeer } = this.state; const { network, loading, list } = this.props; const { peerConfig } = network; const detailInfo = ( <div className={styles.peer}> Peer节点 - {currentPeer ? currentPeer.peerName : '当前还没有节点'} </div> ); peerConfig && peerConfig.map((ele,i)=>{ return ele.key = i }) const peerConfigCol = [ { title: '名称', dataIndex: 'peerName', }, { title: '所属主机', dataIndex: 'hostName' }, { title: '容器ID', dataIndex:'containerId' }, { title: 'orderer节点名称', dataIndex: 'ordererName', render: (text)=>{ if(!text){ return '-' }else{ return text } } }, { title: 'couchdb容器名称', dataIndex: 'couchdbContainerName', render: (text)=>{ if(!text){ return '-' }else{ return text } } }, { title: '是否使用TLS', dataIndex: 'tlsEnable', render: (text)=>{ if(text){ return '是' }else{ return '否' } } }, { title: '删除节点', dataIndex: 'delete', render: (text,item)=>(<a onClick={this.peerDelete.bind(this,item.peerName)}>删除</a>) } ]; const managePeerCol = [ { title: '名称', dataIndex: 'peerName', }, { title: '启动服务', dataIndex: 'start', render: (text, record) => { return ( <a href="javascript:;" onClick={() => this.managePeer(record.peerName, 'start')}> 启动 </a> ); }, }, { title: '重启服务', dataIndex: 'restart', render: (text, record) => { return ( <a href="javascript:;" onClick={() => this.managePeer(record.peerName, 'restart', '确定重启吗?')} > 重启 </a> ); }, }, { title: '停止服务', dataIndex: 'pause', render: (text, record) => { return ( <a href="javascript:;" onClick={() => this.managePeer(record.peerName, 'pause', '确定停止吗?')} > 停止 </a> ); }, }, { title: '继续运行服务', dataIndex: 'unpause', render: (text, record) => { return ( <a href="javascript:;" onClick={() => this.managePeer(record.peerName, 'unpause')} > 继续运行服务 </a> ); }, }, ]; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 8 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 8 }, }, }; return ( <PageHeaderLayout detailInfo={detailInfo} logo={peer} // leftContent={leftContent} > <Tabs defaultActiveKey="1" className={styles.tabs}> <TabPane className={styles.tabChildren} tab={ <span> <Icon type="file-text" /> 节点信息 </span> } key="1" > <Row gutter={24}> <Col md={24}> <div className={styles.blockListTable}> <div className={styles.blockTitle}>节点列表</div> <Table loading={loading} bordered dataSource={peerConfig} columns={peerConfigCol} /> </div> </Col> <Col md={24} style={{ marginTop: '24px' }}> <div className={styles.blockListTable}> <div className={styles.blockTitle}>管理节点</div> <Table loading={loading} bordered dataSource={peerConfig} columns={managePeerCol} /> </div> </Col> </Row> </TabPane> <TabPane className={styles.tabChildren} tab={ <span> <Icon type="cloud-upload" /> 创建节点 </span> } key="3" > <Row gutter={24}> <Col md={24}> <div className={styles.blockListTable}> <div className={styles.blockTitle}>创建节点</div> <WrapDeployPeer updateTable={this.updateTable} /> </div> </Col> </Row> </TabPane> </Tabs> <div ref={this.downloadFile} style={{ display: 'none' }} /> </PageHeaderLayout> ); } }
23.401639
93
0.45791
12d564ce3cf9798ccc6050b650e4e673656b9220
302
js
JavaScript
src/components/DynamicPage.js
N-Joshi/React-Webpack5-Skeleton-Setup
48eed7dbce80c7a560c48f1e6bcbccc59f7ffe4f
[ "MIT" ]
1
2020-09-12T06:59:40.000Z
2020-09-12T06:59:40.000Z
src/components/DynamicPage.js
N-Joshi/React-Webpack5-Skeleton-Setup
48eed7dbce80c7a560c48f1e6bcbccc59f7ffe4f
[ "MIT" ]
4
2021-03-10T22:20:29.000Z
2022-02-27T06:43:45.000Z
src/components/DynamicPage.js
N-Joshi/React-Webpack5-Skeleton-Setup
48eed7dbce80c7a560c48f1e6bcbccc59f7ffe4f
[ "MIT" ]
1
2018-09-18T19:37:25.000Z
2018-09-18T19:37:25.000Z
import React from 'react'; import { Header } from 'semantic-ui-react'; import Layout from './Layout'; const DynamicPage = () => { return ( <Layout> <Header as="h2">Dynamic Page</Header> <p>This page was loaded asynchronously!!!</p> </Layout> ); }; export default DynamicPage;
20.133333
51
0.63245
12d5cc436c7102a0a1b2636f0335672df2491fb3
10,223
js
JavaScript
assets/js/CheckPackageCtrl.js
pudthaiiiiz/insu_pj
70c766c9846190d7196637eea5715a0a40cebf68
[ "MIT" ]
null
null
null
assets/js/CheckPackageCtrl.js
pudthaiiiiz/insu_pj
70c766c9846190d7196637eea5715a0a40cebf68
[ "MIT" ]
null
null
null
assets/js/CheckPackageCtrl.js
pudthaiiiiz/insu_pj
70c766c9846190d7196637eea5715a0a40cebf68
[ "MIT" ]
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* global Global, angular, app */ app.controller('CheckPackageCtrl', ['$scope', 'HomeServices', '$timeout', function ($scope, HomeServices, $timeout) { var services = [ 'getProvince', 'getYear', 'getBrand' ]; $scope.showTextRegister = true; $scope.showTerm = false; $scope.hasUserAlraedy; $scope.hasUserYet; $scope.hasInviteAlraedy; $scope.hasInviteYet; $scope.assets = Global.assets; $scope.uploads = Global.uploads; $scope.baseUrl = Global.baseurl; var params = {}; $scope.data = {}; $scope.formSubmit = {}; $scope.saveMember = { status : "error" }; $scope.formRegister = { idCard : '', fullname : '', address : '', tel : '', email : '', username : '', password : '' }; $scope.formLevel = {}; $scope.formLevel.id = ''; $scope.formSearch = { year: '', brand: '', series: '', main: '' }; $scope.showFromLogin = 1; $scope.showFromRegister = 2; $scope.showFromLoginAndRegister = 0; $scope.showStep = 0; // $scope.needToRister = true; // $scope.showTerm = true; // $scope.needToRister = false; // $scope.showTextRegister = false; var assignData = function (serviceName, getData) { if (serviceName === 'getProvince') { $scope.data.Provinces = getData; } else if (serviceName === 'getYear') { $scope.data.Years = getData; } else if (serviceName === 'getBrand') { $scope.data.Brands = getData; } }; $scope.getLevelPackage = function () { var getIndexLevel = ($scope.formLevel.id - 1); $scope.formSubmit.lvType = $scope.data.Levels[getIndexLevel].lvType; $scope.formSubmit.lvPrice = $scope.data.Levels[getIndexLevel].lvPrice; $scope.formSubmit.lvLimit = $scope.data.Levels[getIndexLevel].lvLimit; }; $scope.submitSearchForm = function () { callService('getLevelPackage'); HomeServices.showLoad(true); }; $scope.submitLoginForm = function () { $scope.showStep = 3; }; $scope.submitRegisterForm = function() { // setTimeout(function (){ validateFormRegister(); // },500); }; var validateFormRegister = function() { // console.log('$scope.hasUserAlraedy :'+ $scope.hasUserAlraedy); // console.log('$scope.hasInviteAlraedy :'+ $scope.hasInviteAlraedy); if ($scope.hasUserAlraedy && ($scope.hasInviteAlraedy || (!$scope.hasInviteAlraedy && !$scope.hasInviteYet)) ) { $scope.showTerm = true; $scope.needToRister = false; $scope.showTextRegister = false; $scope.scrollTo('searchForm'); } else { if (!$scope.hasUserAlraedy) { $scope.scrollTo('box-user'); } else if (!$scope.hasInviteAlraedy) { $scope.scrollTo('box-invite'); } } } $scope.stepBackToRegister = function() { $scope.showTerm = false; $scope.needToRister = true; $scope.showTextRegister = true; $scope.scrollTo('searchForm'); } $scope.confirmTerm = function() { $scope.showTerm = false; $scope.needToRister = true; $scope.showTextRegister = true; callService("saveMember"); }; $scope.checkUser = function () { if ($scope.formRegister.username) { callService('checkUser'); } }; $scope.checkInvite = function () { if ($scope.formRegister.invite) { callService('checkInvite'); } else { delete $scope.hasInviteAlraedy; delete $scope.hasInviteYet; } }; $scope.selectWatch = function (selectWhere) { if (selectWhere === 'year') { $scope.formSearch.brand = ''; $scope.formSearch.series = ''; $scope.formSearch.main = ''; } else if (selectWhere === 'brand') { $scope.formSearch.series = ''; $scope.formSearch.main = ''; callService('getSeries'); HomeServices.showLoad(true); } else if (selectWhere === 'series') { $scope.formSearch.main = ''; callService('getMainPackage'); HomeServices.showLoad(true); } else if (selectWhere === 'province') { delete $scope.formRegister.amphur; delete $scope.formRegister.district; delete $scope.formRegister.zipcode; delete $scope.data.Amphurs; delete $scope.data.Districts; delete $scope.data.Zipcodes; getAmphur(); } else if (selectWhere === 'amphur') { delete $scope.formRegister.district; delete $scope.formRegister.zipcodel; delete $scope.data.Districts; delete $scope.data.Zipcodes; getDistrict(); } else if (selectWhere === 'district') { delete $scope.formRegister.zipcode; delete $scope.data.Zipcodes; getZipcode(); } }; var assignData = function (serviceName, getData) { if (serviceName === 'getYear') { $scope.data.Years = getData; } else if (serviceName === 'getBrand') { $scope.data.Brands = getData; } else if (serviceName === 'getSeries') { $scope.data.Series = getData; } else if (serviceName === 'getMainPackage') { $scope.data.Mains = getData; } else if (serviceName === 'getLevelPackage') { $scope.data.Levels = getData; } else if (serviceName === 'getProvince') { $scope.data.Provinces = getData; } else if (serviceName === 'getAmphur') { $scope.data.Amphurs = getData; } else if (serviceName === 'getDistrict') { $scope.data.Districts = getData; } else if (serviceName === 'getZipcode') { $scope.data.Zipcodes = getData; } }; var callService = function (serviceName) { if (serviceName === 'getSeries') { params = { inputYear: $scope.formSearch.year, inputIdBrand: $scope.formSearch.brand }; } else if (serviceName === 'getMainPackage') { params = { inputYear: $scope.formSearch.year, inputIdBrand: $scope.formSearch.brand, inputIdSeries: $scope.formSearch.series }; } else if (serviceName === 'getLevelPackage') { params = { inputIdMain: $scope.formSearch.main }; } else if (serviceName === 'saveMember') { params = { inputFullName: $scope.formRegister.fullname, inputAddress: $scope.formRegister.address, inputPhone: $scope.formRegister.tel, inputEmail: $scope.formRegister.email, inputUserName: $scope.formRegister.username, inputPassword: $scope.formRegister.password, inputIdCard: $scope.formRegister.idCard, inputOldInsurance: $scope.formRegister.oldInsurance, inputOldInsuranceRegister: $scope.formRegister.oldInsuranceRegister, inputBrand: $scope.formRegister.brand, inputInvite: $scope.formRegister.invite, inputProvince: $scope.formRegister.province, inputAmphur: $scope.formRegister.amphur, inputDistrict: $scope.formRegister.district, inputZipcode: $scope.formRegister.zipcode, inputLevel: 1 }; } else if (serviceName === 'getAmphur') { params = { inputProvinceId: $scope.formRegister.province }; } else if (serviceName === 'getDistrict') { params = { inputProvinceId: $scope.formRegister.province, inputAmphurId: $scope.formRegister.amphur }; } else if (serviceName === 'getZipcode') { params = { inputAmphurId: $scope.formRegister.amphur }; } else if (serviceName === 'checkUser') { params = { inputUserName: $scope.formRegister.username }; } else if (serviceName === 'checkInvite') { params = { inputInvite: $scope.formRegister.invite }; } var callServiceName = HomeServices[serviceName](params); callServiceName.success(function (data) { if (data.status === 'success') { if (serviceName === 'checkUser') { $scope.hasUserAlraedy = true; $scope.hasUserYet = false; } if (serviceName === 'checkInvite') { $scope.hasInviteAlraedy = true; $scope.hasInviteYet = false; } if (serviceName === 'saveMember') { $scope.scrollTo('searchForm'); $scope.needToRister = false; $scope.showTextRegister = false; $scope.saveMember = { status : "success" }; return; } var getData = ''; if (data.data){ getData = angular.extend(data.data); } assignData(serviceName,getData); if (serviceName === 'getLevelPackage') { $scope.showStep = 1; } } else { if (serviceName === 'checkUser') { $scope.hasUserAlraedy = false; $scope.hasUserYet = true; } if (serviceName === 'checkInvite') { $scope.hasInviteAlraedy = false; $scope.hasInviteYet = true; } } HomeServices.showLoad(false); }).error(function () { HomeServices.showLoad(false); console.log('API Timeout'); }); }; // loop call service for (name in services) { callService(services[name]); } var getAmphur = function() { callService('getAmphur'); }; var getDistrict = function() { callService('getDistrict'); }; var getZipcode = function() { callService('getZipcode'); }; $scope.scrollTo = function(div) { // searchForm var hasElementDiv = $("#"+div).html(); if (!hasElementDiv) return; var divTop = $("#"+div).offset().top; $('html,body').animate({scrollTop: (divTop/*-100*/)}, 1000); }; }]);
31.358896
118
0.567642
12d66f1669c4249465603f8dd139288283c72ae1
910
js
JavaScript
dj/volume.js
Reaxt/IRA
2e8d494be65f81f7bcd7e630e6eb0856154d0a05
[ "MIT" ]
2
2021-10-09T02:31:44.000Z
2021-11-02T15:48:12.000Z
dj/volume.js
Reaxt/IRA
2e8d494be65f81f7bcd7e630e6eb0856154d0a05
[ "MIT" ]
1
2020-11-29T15:41:12.000Z
2020-11-29T15:41:12.000Z
dj/volume.js
Reaxt/IRA
2e8d494be65f81f7bcd7e630e6eb0856154d0a05
[ "MIT" ]
2
2021-09-30T03:36:40.000Z
2021-11-02T15:28:28.000Z
var utils = require("../utils/index.js") const Discord = require("discord.js") const music = require("../music/index.js") module.exports = { name:"!volume", desc:`Set volume to specified value (default ${global.defaultVolume})`, music:true, func:function(message){ if(!message.guild.voice.connection) return message.channel.send({embed:utils.embed("sad","I am not in a voice channel..")}) if(message.member.voice.connection =! message.guild.me.voice.connection) return message.channel.send({embed:utils.embed("sad", "Youre not in the same voice channel as me")}) if (isNaN(message.content.split(" ")[1])) return message.channel.send({embed:utils.embed("sad","You've gotta provide a number input for that.")}) try {music.events.emit("setVolume", message)} catch(err) { message.channel.send({embed:utils.embed("malfunction", `Something went wrong! \`\`\`${err}\`\`\``)}) } } }
53.529412
176
0.69011
12d748514c9b79f34dff1b04d6657c29aaef08e5
6,866
js
JavaScript
app/pages/user/Register.js
cuichenxi/hlife
c1c45223fb6acd9013bd60402b8707e1912a03a9
[ "Apache-2.0" ]
null
null
null
app/pages/user/Register.js
cuichenxi/hlife
c1c45223fb6acd9013bd60402b8707e1912a03a9
[ "Apache-2.0" ]
null
null
null
app/pages/user/Register.js
cuichenxi/hlife
c1c45223fb6acd9013bd60402b8707e1912a03a9
[ "Apache-2.0" ]
null
null
null
import {BaseComponent} from "../../components/base/BaseComponent"; import {StyleSheet, Text, TextInput, View} from "react-native"; import React from "react"; import {CommonStyle} from "../../common/CommonStyle"; import TouchableView from "../../components/TouchableView"; import Request from "../../utils/Request"; export default class Register extends BaseComponent { constructor(props) { super(props); this.state = { mobile: '', password: '', address: '', identity: '', code: '', codeLabel: '验证码', secondsElapsed: 0 }; } onReady(param) { this.setTitle("注册") } submitRequest() { this.showLoading('提交审核...'); Request.post('login.do', {phone: "15811508404", code: 123456}, {mock: true, mockId: 672823}) .then(rep => { if (rep.bstatus.code === 0) { this.goBack() } this.showShort(rep.bstatus.desc); }).catch(err => { }).done(() => { this.hideLoading(); }) } sendCode() { if (this.state.secondsElapsed > 0) { return; } this.setState({secondsElapsed: 60}); this.tickHandler(); // this.showLoading('获取验证码...'); // Request.post('login.do', // {phone: "15811508404", code: 123456}, // {mock: true, mockId: 672823}) // .then(rep => { // if (rep.bstatus.code === 0) { // this.goBack() // } // this.showShort(rep.bstatus.desc); // }).catch(err => { // }).done(() => { // this.hideLoading(); // }) } tickHandler() { this.setState((preState => { return { secondsElapsed: preState.secondsElapsed - 1 } }), () => { var secondsElapsed = this.state.secondsElapsed; if (this.state.secondsElapsed == 0) { this.setState({secondsElapsed: 0}); return; } this.timer = setTimeout(() => { this.setState({secondsElapsed: secondsElapsed}); this.tickHandler(); }, 1000 ); }); } onUnload() { clearTimeout(this.timer); } _render() { const that = this; return ( <View style={{flex: 1, flexDirection: 'column'}}> <View style={styles.item}> <Text style={styles.itemTextLabel}>手机号</Text> <TextInput placeholder='请输入手机号' style={styles.itemInput} underlineColorAndroid="transparent" onChangeText={(text) => this.setState({mobile: text})}/> </View> <View style={styles.item}> <Text style={styles.itemTextLabel}>验证码</Text> <TextInput placeholder='请输入验证吗' style={[styles.itemInput, {flex: 1}]} underlineColorAndroid="transparent" onChangeText={(text) => this.setState({code: text})}/> <TouchableView style={{ backgroundColor: (that.state.secondsElapsed > 0) ? "#999" : CommonStyle.themeColor, paddingHorizontal: 10, paddingVertical: 5, borderRadius: 5, alignItems: 'center', }} onPress={this.sendCode.bind(this)}> {this.state.secondsElapsed == 0 ? <Text style={{ color: "#fff", fontSize: 16 }}>验证码</Text> : <Text style={{ color: "#fff", fontSize: 16 }}>{that.state.secondsElapsed + "S"}</Text>} </TouchableView> </View> <View style={styles.item}> <Text style={styles.itemTextLabel}>密码</Text> <TextInput placeholder='请输入密码' style={styles.itemInput} underlineColorAndroid="transparent" onChangeText={(text) => this.setState({password: text})}/> </View> <View style={styles.item}> <Text style={styles.itemTextLabel}>小区</Text> <TextInput placeholder='请输入小区' style={styles.itemInput} multiline={true} underlineColorAndroid="transparent" onChangeText={(text) => this.setState({address: text})}/> </View> <View style={styles.item}> <Text style={styles.itemTextLabel}>身份</Text> <TextInput placeholder='请输入身份(业主,租客,亲属,嘉宾)' style={styles.itemInput} underlineColorAndroid="transparent" onChangeText={(text) => this.setState({identity: text})}/> </View> <TouchableView style={{ backgroundColor: CommonStyle.themeColor, padding: 10, alignItems: 'center', marginTop: 20, marginLeft: 10, marginRight: 10, borderRadius: 3, }} onPress={this.submitRequest.bind(this)}> <Text style={{ color: '#ffffff', fontSize: 17, }}>提交审核</Text> </TouchableView> <Text style={{ paddingVertical: 10, paddingHorizontal: 15, color: '#666', fontSize: 14, }}>提交小区地址申请后,我们会在一个工作日内核实你的申请</Text> </View> ); } }; const styles = StyleSheet.create( { item: { flexDirection: 'row', height: 50, paddingHorizontal: 15, alignItems: 'center', borderBottomColor: CommonStyle.lineColor, borderBottomWidth: CommonStyle.lineWidth, }, itemTextLabel: { color: "#333", fontSize: 16, marginRight: 5, width: 80, }, itemInput: { flex: 1, color: "#666", fontSize: 16, }, } )
35.030612
150
0.425284
12d86737990dc3f75d48e95412d9fad16a723e87
2,179
js
JavaScript
lib/web-usb.js
sandeepmistry/rtlsdrjs
5dec79ed14ed7c50a51ce4d5a4f01fc4b3508df4
[ "Apache-2.0" ]
22
2018-04-07T02:43:11.000Z
2021-11-14T22:00:43.000Z
lib/web-usb.js
sandeepmistry/rtlsdrjs
5dec79ed14ed7c50a51ce4d5a4f01fc4b3508df4
[ "Apache-2.0" ]
2
2021-02-11T16:34:50.000Z
2022-03-21T15:46:56.000Z
lib/web-usb.js
sandeepmistry/rtlsdrjs
5dec79ed14ed7c50a51ce4d5a4f01fc4b3508df4
[ "Apache-2.0" ]
2
2019-05-27T08:21:57.000Z
2021-02-11T17:53:13.000Z
// Copyright 2018 Sandeep Mistry All rights reserved. // // 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. function USB(device) { this._device = device; } USB.prototype.open = async function() { await this._device.open(); }; USB.prototype.selectConfiguration = async function(configuration) { await this._device.selectConfiguration(configuration); }; USB.prototype.claimInterface = async function(interface) { await this._device.claimInterface(interface); }; USB.prototype.releaseInterface = async function(interface) { await this._device.releaseInterface(interface); }; USB.prototype.controlTransfer = async function(ti) { if (ti.direction === 'out') { await this._device.controlTransferOut(ti, ti.data); } else if (ti.direction === 'in') { const result = await this._device.controlTransferIn(ti, ti.length); return result.data.buffer; } }; USB.prototype.bulkTransfer = async function(ti) { const result = await this._device.transferIn(ti.endpoint, ti.length); return result.data.buffer; }; USB.prototype.close = async function() { await this._device.close(); }; USB.requestDevice = async function(filters) { const usbDevice = await navigator.usb.requestDevice({ filters: filters }); return new USB(usbDevice); }; USB.getDevices = async function(filters, callback) { const usbDevices = navigator.usb.getDevices(); const devices = []; usbDevices.forEach((usbDevice) => { filters.forEach((filter) => { if (filter.vendorId === usbDevice.vendorId && filter.productId === usbDevice.productId) { devices.push(new USB(usbDevice)); } }); }); return devices; }; module.exports = USB;
27.582278
95
0.715466
12d86a8481ba556d613f51a9d146da50071b0b81
1,061
js
JavaScript
lilac-web/src/main/webapp/assets/js/lib/angular/1.2.13/docs/ptore2e/api/ng.$http.jquery_test.js
lcj325/lilac
a83c6ce579ddd95394671ac10b80f86c8d8a3b89
[ "Apache-2.0" ]
null
null
null
lilac-web/src/main/webapp/assets/js/lib/angular/1.2.13/docs/ptore2e/api/ng.$http.jquery_test.js
lcj325/lilac
a83c6ce579ddd95394671ac10b80f86c8d8a3b89
[ "Apache-2.0" ]
4
2021-05-23T15:39:50.000Z
2022-01-21T23:16:16.000Z
lilac-web/src/main/webapp/assets/js/lib/angular/1.2.13/docs/ptore2e/api/ng.$http.jquery_test.js
softsquire/lilac
a83c6ce579ddd95394671ac10b80f86c8d8a3b89
[ "Apache-2.0" ]
1
2015-04-07T06:01:01.000Z
2015-04-07T06:01:01.000Z
describe("api/ng.$http", function() { beforeEach(function() { browser.get("index-jq-nocache.html#!/api/ng.$http"); }); var status = element(by.binding('status')); var data = element(by.binding('data')); var fetchBtn = element(by.id('fetchbtn')); var sampleGetBtn = element(by.id('samplegetbtn')); var sampleJsonpBtn = element(by.id('samplejsonpbtn')); var invalidJsonpBtn = element(by.id('invalidjsonpbtn')); it('should make an xhr GET request', function() { sampleGetBtn.click(); fetchBtn.click(); expect(status.getText()).toMatch('200'); expect(data.getText()).toMatch(/Hello, \$http!/) }); it('should make a JSONP request to angularjs.org', function() { sampleJsonpBtn.click(); fetchBtn.click(); expect(status.getText()).toMatch('200'); expect(data.getText()).toMatch(/Super Hero!/); }); it('should make JSONP request to invalid URL and invoke the error handler', function() { invalidJsonpBtn.click(); fetchBtn.click(); expect(status.getText()).toMatch('0'); expect(data.getText()).toMatch('Request failed'); }); });
29.472222
75
0.683318
12d883cb18309043715c66f040241376af81e20c
2,352
js
JavaScript
contrib/compile_handlebars.js
csilvers/kake
51465b12d267a629dd61778918d83a2a134ec3b2
[ "MIT" ]
null
null
null
contrib/compile_handlebars.js
csilvers/kake
51465b12d267a629dd61778918d83a2a134ec3b2
[ "MIT" ]
null
null
null
contrib/compile_handlebars.js
csilvers/kake
51465b12d267a629dd61778918d83a2a134ec3b2
[ "MIT" ]
null
null
null
/* TODO(csilvers): fix these lint errors (http://eslint.org/docs/rules): */ /* eslint-disable camelcase, no-console, no-var, prefer-spread */ /* To fix, remove an entry above, run "make linc", and fix errors. */ /** * Script to compile a bunch of handlebars templates. * * Run as: * * node deploy/compile_handlebars.js < <json> * * where <json> is the JSON encoding of a list with an list for each template * that needs to be compiled -- the inner list should have three elements: * * 0. in abspath ('/absolute/path/to/hover-card.handlebars') * 1. out abspath ('/absolute/path/to/hover-card.handlebars.js') * * Thus a call looks something like: * * echo '[["/absolute/path/to/hover-card.handlebars", ...], ...]' \ * | node deploy/compile_handlebars.js * * Based loosely on * https://github.com/wycats/handlebars.js/blob/master/bin/handlebars */ var fs = require("fs"); var handlebars = require("handlebars"); function compileTemplate(inPath, outPath) { try { var data = fs.readFileSync(inPath, "utf8"); // Wrap the output of all Handlebars templates with the // makeHtmlLinksSafe helper, to ensure that any absolute URLs will be // rewritten for zero-rated users. var js = ( "var absoluteLinks = (" + " require('../shared-package/absolute-links.js'));" + "var template = Handlebars.template(" + handlebars.precompile(data, {}) + ");\n" + "function wrapped_template(context, options) {" + " return absoluteLinks.makeHtmlLinksSafe(" + " template(context, options));" + "};" + "module.exports = wrapped_template;\n"); fs.writeFileSync(outPath, js, "utf8"); } catch (err) { console.log("** Exception while compiling: " + inPath); console.log(err); throw err; } } // Read a json file saying what to do, from stdin. The json // should look like // [[input_filename, output_filename], ...] var dataText = ""; process.stdin.resume(); process.stdin.on("data", function(chunk) { dataText = dataText + chunk; }); process.stdin.on("end", function() { var data = JSON.parse(dataText); data.forEach(function(tmpl_info) { compileTemplate.apply(null, tmpl_info); }); });
32.219178
77
0.613095
12d88eb1cec09e041802399431c9b4c49a2a0ed1
2,102
js
JavaScript
modal/node_modules/@webassemblyjs/utf8/esm/decoder.js
maze-runnar/modal-component
bb4a146b0473d3524552e379d5bbdbfcca49e6be
[ "MIT" ]
943
2020-04-03T02:57:23.000Z
2022-03-31T08:44:08.000Z
modal/node_modules/@webassemblyjs/utf8/esm/decoder.js
maze-runnar/modal-component
bb4a146b0473d3524552e379d5bbdbfcca49e6be
[ "MIT" ]
553
2020-07-13T08:47:45.000Z
2021-09-13T02:57:52.000Z
modal/node_modules/@webassemblyjs/utf8/esm/decoder.js
maze-runnar/modal-component
bb4a146b0473d3524552e379d5bbdbfcca49e6be
[ "MIT" ]
481
2020-09-24T23:59:38.000Z
2021-10-31T13:24:30.000Z
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); } function con(b) { if ((b & 0xc0) === 0x80) { return b & 0x3f; } else { throw new Error("invalid UTF-8 encoding"); } } function code(min, n) { if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) { throw new Error("invalid UTF-8 encoding"); } else { return n; } } export function decode(bytes) { return _decode(bytes).map(function (x) { return String.fromCharCode(x); }).join(""); } function _decode(bytes) { if (bytes.length === 0) { return []; } /** * 1 byte */ { var _bytes = _toArray(bytes), b1 = _bytes[0], bs = _bytes.slice(1); if (b1 < 0x80) { return [code(0x0, b1)].concat(_toConsumableArray(_decode(bs))); } if (b1 < 0xc0) { throw new Error("invalid UTF-8 encoding"); } } /** * 2 bytes */ { var _bytes2 = _toArray(bytes), _b = _bytes2[0], b2 = _bytes2[1], _bs = _bytes2.slice(2); if (_b < 0xe0) { return [code(0x80, ((_b & 0x1f) << 6) + con(b2))].concat(_toConsumableArray(_decode(_bs))); } } /** * 3 bytes */ { var _bytes3 = _toArray(bytes), _b2 = _bytes3[0], _b3 = _bytes3[1], b3 = _bytes3[2], _bs2 = _bytes3.slice(3); if (_b2 < 0xf0) { return [code(0x800, ((_b2 & 0x0f) << 12) + (con(_b3) << 6) + con(b3))].concat(_toConsumableArray(_decode(_bs2))); } } /** * 4 bytes */ { var _bytes4 = _toArray(bytes), _b4 = _bytes4[0], _b5 = _bytes4[1], _b6 = _bytes4[2], b4 = _bytes4[3], _bs3 = _bytes4.slice(4); if (_b4 < 0xf8) { return [code(0x10000, (((_b4 & 0x07) << 18) + con(_b5) << 12) + (con(_b6) << 6) + con(b4))].concat(_toConsumableArray(_decode(_bs3))); } } throw new Error("invalid UTF-8 encoding"); }
22.126316
199
0.528544
12d8a7cf93ff9979dbb8359dca698cff5a2ffca9
2,750
js
JavaScript
public/component/ubigeo/ubigeo.edit.component.js
MilSay/OrquestasYMas_Web.
8e5cf787ea4258423fadf8e4386b4e26279a1de9
[ "MIT" ]
1
2020-11-02T13:59:13.000Z
2020-11-02T13:59:13.000Z
public/component/ubigeo/ubigeo.edit.component.js
MilSay/OrquestasYMas_Web.
8e5cf787ea4258423fadf8e4386b4e26279a1de9
[ "MIT" ]
null
null
null
public/component/ubigeo/ubigeo.edit.component.js
MilSay/OrquestasYMas_Web.
8e5cf787ea4258423fadf8e4386b4e26279a1de9
[ "MIT" ]
null
null
null
$(document).ready(function(){ var codDepartamento = $('#CodigoDepartamento').data("field-id"); var codProvincia = $('#CodigoProvincia').data("field-id"); var codDistrito = $('#CodigoDistrito').data("field-id"); window.onload = inicializar; function inicializar(){ obtnerProvincia(); obtnerDistrito(); } function obtnerProvincia(){ $.get('provincia/'+codDepartamento, function(res1, sta){ $("#CodigoProvincia").empty(); $("#CodigoProvincia").append(`<option disabled selected> Selecionar provincia </option>`); res1.forEach(element => { if(element.cod_prov ==codProvincia){ $("#CodigoProvincia").append(`<option value=${element.cod_prov} selected> ${element.provincia} </option>`); } else{ $("#CodigoProvincia").append(`<option value=${element.cod_prov}> ${element.provincia} </option>`); } }); }); } function obtnerDistrito(){ $.get('distrito/'+codDepartamento+'/'+codProvincia, function(res2, sta){ $("#CodigoDistrito").empty(); $("#CodigoDistrito").append(`<option disabled selected> Selecionar distrito </option>`); res2.forEach(element => { if(element.cod_dist ==codDistrito){ $("#CodigoDistrito").append(`<option value=${element.cod_dist} selected> ${element.distrito} </option>`); } else{ $("#CodigoDistrito").append(`<option value=${element.cod_dist}> ${element.distrito} </option>`); } }); }); } $('.dynamic1').change(function(){ if($(this).val() != '') { var select = $(this).attr("id"); codDepartamento = $(this).val(); console.log("entrada provincia"+codDepartamento); $.get('provincia/'+codDepartamento, function(res1, sta){ $("#CodigoProvincia").empty(); if(select == "CodigoDepartamento"){ $("#CodigoProvincia").append(`<option disabled selected> Selecionar provincia</option>`); } res1.forEach(element => { $("#CodigoProvincia").append(`<option value=${element.cod_prov}> ${element.provincia} </option>`); }); obtnerDistrito() }); } }); $('.dynamic2').change(function(){ if($(this).val() != '') { var select = $(this).attr("id"); codProvincia = $(this).val(); $.get('distrito/'+codDepartamento+'/'+codProvincia, function(res2, sta){ $("#CodigoDistrito").empty(); if(select == "CodigoProvincia"){ $("#CodigoDistrito").append(`<option disabled selected> Selecionar distrito</option>`); } res2.forEach(element => { $("#CodigoDistrito").append(`<option value=${element.cod_dist}> ${element.distrito} </option>`); }); }); } }); $('.datepicker').datepicker({ format: "yyyy-mm-dd", language: "es", autoclose: true, todayHighlight: true }); $('.clockpicker').clockpicker(); });
29.569892
111
0.619273
12d8d9072a83ff496c83ff0b07dc91571c66d6c6
589
js
JavaScript
src/labs/SinglePreview/SinglePreview.js
unoia/usf
9cadfb655636d623d44e4f84f1b7f5171eb25b00
[ "MIT" ]
null
null
null
src/labs/SinglePreview/SinglePreview.js
unoia/usf
9cadfb655636d623d44e4f84f1b7f5171eb25b00
[ "MIT" ]
null
null
null
src/labs/SinglePreview/SinglePreview.js
unoia/usf
9cadfb655636d623d44e4f84f1b7f5171eb25b00
[ "MIT" ]
null
null
null
import styles from './SinglePreview.module.scss' import React, { Component } from 'react' import classnames from 'classnames' import Image from '../Image/Image' class SinglePreview extends Component { render() { const { isOpen, className, children, src, naturalWidth, naturalHeight, alt, ...restProps } = this.props return ( <Image className={classnames({ [styles.root]: true, [className]: className, })} fit="cover" alt={alt} src={src} {...restProps} /> ) } } export default SinglePreview
22.653846
107
0.606112
12dbdaa4f7745f3f750f1964920825629eaecace
2,937
js
JavaScript
src/RestApi/node_modules/async/internal/eachOfLimit.js
shasha79/nectm
600044a6fe2c3a73e0d9327bc85883831a26dcae
[ "Apache-2.0" ]
3
2020-02-28T21:42:44.000Z
2021-03-12T13:56:16.000Z
src/RestApi/node_modules/async/internal/eachOfLimit.js
Pangeamt/nectm
6b84f048698f2530b9fdbb30695f2e2217c3fbfe
[ "Apache-2.0" ]
2
2020-11-06T14:40:10.000Z
2020-12-29T19:03:11.000Z
src/RestApi/node_modules/async/internal/eachOfLimit.js
Pangeamt/nectm
6b84f048698f2530b9fdbb30695f2e2217c3fbfe
[ "Apache-2.0" ]
2
2020-03-26T16:05:11.000Z
2020-08-06T16:35:39.000Z
/* * Copyright (c) 2020 Pangeanic SL. * * This file is part of NEC TM * (see https://github.com/shasha79/nectm). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _eachOfLimit; var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); var _once = require('./once'); var _once2 = _interopRequireDefault(_once); var _iterator = require('./iterator'); var _iterator2 = _interopRequireDefault(_iterator); var _onlyOnce = require('./onlyOnce'); var _onlyOnce2 = _interopRequireDefault(_onlyOnce); var _breakLoop = require('./breakLoop'); var _breakLoop2 = _interopRequireDefault(_breakLoop); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _eachOfLimit(limit) { return function (obj, iteratee, callback) { callback = (0, _once2.default)(callback || _noop2.default); if (limit <= 0 || !obj) { return callback(null); } var nextElem = (0, _iterator2.default)(obj); var done = false; var running = 0; var looping = false; function iterateeCallback(err, value) { running -= 1; if (err) { done = true; callback(err); } else if (value === _breakLoop2.default || done && running <= 0) { done = true; return callback(null); } else if (!looping) { replenish(); } } function replenish() { looping = true; while (running < limit && !done) { var elem = nextElem(); if (elem === null) { done = true; if (running <= 0) { callback(null); } return; } running += 1; iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback)); } looping = false; } replenish(); }; } module.exports = exports['default'];
30.278351
95
0.593122
12dbff905c61ab9a93be3974bf4c87845b377dd7
5,309
js
JavaScript
lib/tools/src/dom.js
kikyou1217/vxe-table
af6c502873471ab0209218a9fc738d5cc419dd3a
[ "MIT" ]
null
null
null
lib/tools/src/dom.js
kikyou1217/vxe-table
af6c502873471ab0209218a9fc738d5cc419dd3a
[ "MIT" ]
2
2021-01-05T13:50:30.000Z
2022-02-10T19:14:39.000Z
lib/tools/src/dom.js
kikyou1217/vxe-table
af6c502873471ab0209218a9fc738d5cc419dd3a
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.DomTools = void 0; var _xeUtils = _interopRequireDefault(require("xe-utils")); var _utils = _interopRequireDefault(require("./utils")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var browse = _xeUtils.default.browse(); var htmlElem = document.querySelector('html'); var bodyElem = document.body; var DomTools = { browse: browse, isPx: function isPx(val) { return val && /^\d+(px)?$/.test(val); }, isScale: function isScale(val) { return val && /^\d+%$/.test(val); }, hasClass: function hasClass(elem, cls) { return elem && elem.className && elem.className.split && elem.className.split(' ').indexOf(cls) > -1; }, getDomNode: function getDomNode() { return { scrollTop: document.documentElement.scrollTop || document.body.scrollTop, scrollLeft: document.documentElement.scrollLeft || document.body.scrollLeft, visibleHeight: document.documentElement.clientHeight || document.body.clientHeight, visibleWidth: document.documentElement.clientWidth || document.body.clientWidth }; }, /** * 检查触发源是否属于目标节点 */ getEventTargetNode: function getEventTargetNode(evnt, container, queryCls) { var targetElem; var target = evnt.target; while (target && target.nodeType && target !== document) { if (queryCls && DomTools.hasClass(target, queryCls)) { targetElem = target; } else if (target === container) { return { flag: queryCls ? !!targetElem : true, container: container, targetElem: targetElem }; } target = target.parentNode; } return { flag: false }; }, /** * 获取元素相对于 document 的位置 */ getOffsetPos: function getOffsetPos(elem, container) { return getNodeOffset(elem, container, { left: 0, top: 0 }); }, getAbsolutePos: function getAbsolutePos(elem) { var bounding = elem.getBoundingClientRect(); var _DomTools$getDomNode = DomTools.getDomNode(), scrollTop = _DomTools$getDomNode.scrollTop, scrollLeft = _DomTools$getDomNode.scrollLeft; return { top: scrollTop + bounding.top, left: scrollLeft + bounding.left }; }, getCellIndexs: function getCellIndexs(cell) { var trElem = cell.parentNode; var colIndex = cell.getAttribute('data-index'); var rowId = trElem.getAttribute('data-rowid'); var columnIndex = [].indexOf.call(trElem.children, cell); var rowIndex = [].indexOf.call(trElem.parentNode.children, trElem); return { rowId: rowId, rowIndex: rowIndex, colIndex: colIndex ? parseInt(colIndex) : colIndex, columnIndex: columnIndex }; }, getCell: function getCell($table, _ref) { var row = _ref.row, rowIndex = _ref.rowIndex, column = _ref.column; var rowId = _utils.default.getRowId($table, row, rowIndex); return $table.$refs.tableBody.$el.querySelector(".vxe-body--row[data-rowid=\"".concat(rowId, "\"] .").concat(column.id)); }, getCursorPosition: function getCursorPosition(textarea) { var rangeData = { text: '', start: 0, end: 0 }; if (textarea.setSelectionRange) { rangeData.start = textarea.selectionStart; rangeData.end = textarea.selectionEnd; rangeData.text = rangeData.start !== rangeData.end ? textarea.value.substring(rangeData.start, rangeData.end) : ''; } else if (document.selection) { var index = 0; var range = document.selection.createRange(); var textRange = document.body.createTextRange(); textRange.moveToElementText(textarea); rangeData.text = range.text; rangeData.bookmark = range.getBookmark(); for (; textRange.compareEndPoints('StartToStart', range) < 0 && range.moveStart('character', -1) !== 0; index++) { if (textarea.value.charAt(index) === '\n') { index++; } } rangeData.start = index; rangeData.end = rangeData.text.length + rangeData.start; } return rangeData; }, setCursorPosition: function setCursorPosition(textarea, rangeData) { if (textarea.setSelectionRange) { textarea.focus(); textarea.setSelectionRange(rangeData.start, rangeData.end); } else if (textarea.createTextRange) { var textRange = textarea.createTextRange(); if (textarea.value.length === rangeData.start) { textRange.collapse(false); textRange.select(); } else { textRange.moveToBookmark(rangeData.bookmark); textRange.select(); } } } }; exports.DomTools = DomTools; function getNodeOffset(elem, container, rest) { if (elem) { var parentElem = elem.parentNode; rest.top += elem.offsetTop; rest.left += elem.offsetLeft; if (parentElem && parentElem !== htmlElem && parentElem !== bodyElem) { rest.top -= parentElem.scrollTop; rest.left -= parentElem.scrollLeft; } if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) { return getNodeOffset(elem.offsetParent, container, rest); } } return rest; } var _default = DomTools; exports.default = _default;
29.99435
125
0.64871
12dc2c5698f0d43b49c0a0f79adc562559111480
1,585
js
JavaScript
JS-applications/Unit testing and modules-lab/07. Add && Subtract/test.js
DimitarPetroww/Softuni-Homeworks
3989b7b8af88e0d5a77c0dfa4c7dd407acb6c65e
[ "MIT" ]
2
2020-12-19T18:58:05.000Z
2021-01-23T21:15:05.000Z
JS-applications/Unit testing and modules-lab/07. Add && Subtract/test.js
DimitarPetroww/Softuni-Homeworks
3989b7b8af88e0d5a77c0dfa4c7dd407acb6c65e
[ "MIT" ]
null
null
null
JS-applications/Unit testing and modules-lab/07. Add && Subtract/test.js
DimitarPetroww/Softuni-Homeworks
3989b7b8af88e0d5a77c0dfa4c7dd407acb6c65e
[ "MIT" ]
null
null
null
const createCalculator = require("./app") let { assert } = require("chai") describe("function calc", () => { let fn; beforeEach(() => { fn = createCalculator() }) describe("function should return object with 3 functions", () => { it("fn should be an instance of Object", () => { assert.equal(fn instanceof Object, true) }) it("function should have property add that is a function", () => { assert.equal(fn.hasOwnProperty("add"), true) }) it("function should have property subtract that is a function", () => { assert.equal(fn.hasOwnProperty("subtract"), true) }) it("function should have property get that is a function", () => { assert.equal(fn.hasOwnProperty("get"), true) }) }) describe("all functions from the object should work properly", () => { it("function add should add to the value 5 and make it 5", () => { fn.add(5) let value = fn.get() assert.equal(value, 5) }) it("function subtract should subtract from the value 5 and make it -5", () => { fn.subtract(5) let value = fn.get() assert.equal(value, -5) }) it("function get should return our value", () => { assert.equal(fn.get(), 0) }) it("function should work with strings that can be converted to Number", () => { fn.subtract("-3.5") fn.add("6.5") assert.equal(fn.get(), 10) }) }) })
33.723404
87
0.526814
12dc842001871b34f86d31554fd8d738d5b2233f
1,292
js
JavaScript
blog/wp-content/plugins/page-scroll-to-id/includes/malihu-pagescroll2id-tinymce.js
divagar15/Grocare
ebb49c49bb66eb7b0d877cc1043885f535d79496
[ "MIT" ]
null
null
null
blog/wp-content/plugins/page-scroll-to-id/includes/malihu-pagescroll2id-tinymce.js
divagar15/Grocare
ebb49c49bb66eb7b0d877cc1043885f535d79496
[ "MIT" ]
null
null
null
blog/wp-content/plugins/page-scroll-to-id/includes/malihu-pagescroll2id-tinymce.js
divagar15/Grocare
ebb49c49bb66eb7b0d877cc1043885f535d79496
[ "MIT" ]
null
null
null
(function(){ tinymce.PluginManager.add("ps2id_tinymce_custom_button",function(editor,url){ editor.addButton("ps2id_tinymce_custom_button_link",{ icon:"icon ps2id-custom-icon-link", title:"Insert Page scroll to id link", onclick:function(){ editor.windowManager.open({ title:"Insert Page scroll to id link",body:[ {type:"textbox",name:"ps2idurlid",label:"URL/id (e.g. #my-id)"}, {type:"textbox",name:"ps2idtext",label:"Link Text"}, {type:"textbox",name:"ps2idoffset",label:"Offset (optional)"} ], onsubmit:function(e){ editor.insertContent("[ps2id url='"+e.data.ps2idurlid+"' offset='"+e.data.ps2idoffset+"']"+e.data.ps2idtext+"[/ps2id]"); } }); } }); editor.addButton("ps2id_tinymce_custom_button_target",{ icon:"icon ps2id-custom-icon-target", title:"Insert Page scroll to id target", onclick:function(){ editor.windowManager.open({ title:"Insert Page scroll to id target",body:[ {type:"textbox",name:"ps2idid",label:"id (e.g. my-id)"}, {type:"textbox",name:"ps2idtarget",label:"Highlight target selector (optional)"} ], onsubmit:function(e){ editor.insertContent("[ps2id id='"+e.data.ps2idid+"' target='"+e.data.ps2idtarget+"'/]"); } }); } }); }); })();
36.914286
126
0.640867
12dca55b40b613025d07b5a4780b1f6403f9132e
111
js
JavaScript
node_modules/carbon-icons-svelte/lib/WatsonHealthSmoothing32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
node_modules/carbon-icons-svelte/lib/WatsonHealthSmoothing32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
node_modules/carbon-icons-svelte/lib/WatsonHealthSmoothing32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
import WatsonHealthSmoothing32 from "./WatsonHealthSmoothing32.svelte"; export default WatsonHealthSmoothing32;
55.5
71
0.882883
12ddeb9d7036eae4535b059a9896934588395d11
7,914
js
JavaScript
web/src/pages/cadastro/index.js
ManoelPatrocinio/PetFood
3e9f30a651451b57def688e0a895cd934e5a5cee
[ "MIT" ]
1
2022-02-02T00:16:25.000Z
2022-02-02T00:16:25.000Z
web/src/pages/cadastro/index.js
ManoelPatrocinio/PetFood
3e9f30a651451b57def688e0a895cd934e5a5cee
[ "MIT" ]
null
null
null
web/src/pages/cadastro/index.js
ManoelPatrocinio/PetFood
3e9f30a651451b57def688e0a895cd934e5a5cee
[ "MIT" ]
null
null
null
import { useState, React } from "react"; import { useDispatch } from "react-redux"; //dispara a action p/ a reducer atravez do UI import { setCustomer as setStoreCustomer } from "../../store/modules/shop/actions"; import { useForm } from "react-hook-form"; import { ErrorMessage } from "@hookform/error-message"; import Header from "../../components/header"; import Illustration from "../../assets/background_img2.jpg"; import { Link, useHistory } from "react-router-dom"; import Swal from "sweetalert2"; import "./styler.css"; const Cadastro = () => { const dispatch = useDispatch(); //dispara a action p/ a reducer atravez do UI const history = useHistory(); // p/ redirecionar const { register,formState: { errors }, handleSubmit,} = useForm({ criteriaMode: "all", }); const [customer, setCustomer] = useState({ external_id: new Date().getTime().toString(), name: "", type: "individual", country: "br", email: "", documents: [ { type: "cpf", number: "", }, ], phone_numbers: [""], birthday: "", }); const goToCheckOut = () => { dispatch(setStoreCustomer(customer)); }; const onSubmit = () =>{ goToCheckOut() // salva os dados no customer Swal.fire({ icon: "success", title: "Tudo certo", text: "Seu cadastro foi realizado !", }).then((result) => { if (result.isConfirmed) { history.push("/checkout"); }; }) } return ( <div className="container-fluid cadastro_body"> <img src={Illustration} className="imgFundo" /> <section className="cadastro_container"> <div className="header"> <Header whiteVersion hideSideBar /> </div> <div className="col-12 cadastro_box"> <form className="col-3 " onSubmit={handleSubmit(onSubmit)} > <div className="text-center mb-4 boxHeader"> <h2 className="text-center">Cadastre-se</h2> <small>E acompanhe seu pedido</small> </div> <input type="text" className="form-control form-control-lg mt-3" placeholder="Nome Completo" {...register("client_name", { required: "Informe seu nome para continuar", minLength: { value: 5, message: "O nome deve ter mais de 4 caracteres", }, })} onChange={(e) => { setCustomer({ ...customer, name: e.target.value }); //pega tudo de custumer e atualiza apenas o Name }} /> <ErrorMessage errors={errors} name="client_name" render={({ messages }) => { console.log("messages", messages); return messages ? Object.entries(messages).map(([type, message]) => ( <small className="alertCadInput" key={type}> {message} </small> )) : null; }} /> <input type="email" name="client_email" className="form-control form-control-lg mt-3" placeholder="E-mail" {...register("client_email", { required: "Informe seu email para continuar", pattern: { value: /\S+@\S+\.\S+/, message: "Informe um e-mail válido", }, minLength: { value: 5, message: "O nome deve ter mais de 4 caracteres", }, })} onChange={(e) => { setCustomer({ ...customer, email: e.target.value }); //pega tudo de custumer e atualiza apenas o Name }} /> <ErrorMessage errors={errors} name="client_email" render={({ messages }) => { console.log("messages", messages); return messages ? Object.entries(messages).map(([type, message]) => ( <small className="alertCadInput" key={type}> {message} </small> )) : null; }} /> <input type="text" className="form-control form-control-lg mt-3" placeholder="DDD + Nº do celular" name="client_contato" {...register("client_contato", { required: "Informe seu Nº de celular para continuar", pattern: { value: /\d+/, message: "Apenas Números", }, minLength: { value: 11, message: "DDD + Nº de celular", }, })} onChange={(e) => { setCustomer({ ...customer, phone_numbers: [e.target.value] }); //pega tudo de custumer e atualiza apenas o }} /> <ErrorMessage errors={errors} name="client_contato" render={({ messages }) => { console.log("messages", messages); return messages ? Object.entries(messages).map(([type, message]) => ( <small className="alertCadInput" key={type}> {message} </small> )) : null; }} /> <input type="text" name="client_cpf" className="form-control form-control-lg mt-3" placeholder="CPF" {...register("client_cpf", { required: "Informe um CPF valido", pattern: { value: /\d+/, message: "Apenas Números", }, minLength: { value: 11, message: "O CPF deve ter 11 números", }, })} onChange={(e) => { setCustomer({ ...customer, documents: [ { type: "cpf", number: e.target.value, }, ], }); //pega tudo de custumer e atualiza apenas o }} /> <ErrorMessage errors={errors} name="client_cpf" render={({ messages }) => { console.log("messages", messages); return messages ? Object.entries(messages).map(([type, message]) => ( <small className="alertCadInput" key={type}> {message} </small> )) : null; }} /> <input type="date" className="form-control form-control-lg mt-3" placeholder="Data de nascimento" onChange={(e) => { setCustomer({ ...customer, birthday: e.target.value }); //pega tudo de custumer e atualiza apenas o }} /> {/* <Link // to="/checkout" onClick={() => handleSubmit(vai)} className="btn btn-lg w-100 btn-secondary" > Finalizar Cadastro </Link> */} <button type="submit" className="btn btn-lg w-100 btn-secondary"> Finalizar Cadastro </button> </form> </div> </section> </div> ); }; export default Cadastro;
33.392405
122
0.440232
12de4948670754d2bbe0e1f4eba41e3723dc38e7
149
js
JavaScript
v5.js
shellscape/node-uuid
8548d14189ae02a8f3be67bd1f9fb6c3b126761f
[ "MIT" ]
null
null
null
v5.js
shellscape/node-uuid
8548d14189ae02a8f3be67bd1f9fb6c3b126761f
[ "MIT" ]
null
null
null
v5.js
shellscape/node-uuid
8548d14189ae02a8f3be67bd1f9fb6c3b126761f
[ "MIT" ]
null
null
null
var v35 = require('./lib/v35.js'); var sha1 = require('./lib/sha1'); module.exports = v35('v5', 0x50, sha1); module.exports.default = module.exports;
37.25
40
0.677852
12dea32a8992da63ab0e2de1c5669795984f313f
2,983
js
JavaScript
handlers/_routes.js
dbroberts/blueoak-server
7e82bb64aac7064dc998db8f2104529fcdb579f9
[ "MIT" ]
163
2016-02-05T15:52:52.000Z
2019-11-04T11:28:44.000Z
handlers/_routes.js
dbroberts/blueoak-server
7e82bb64aac7064dc998db8f2104529fcdb579f9
[ "MIT" ]
50
2016-02-10T22:55:18.000Z
2019-07-13T14:09:25.000Z
handlers/_routes.js
dbroberts/blueoak-server
7e82bb64aac7064dc998db8f2104529fcdb579f9
[ "MIT" ]
32
2016-02-05T12:38:15.000Z
2019-06-28T15:12:44.000Z
/* * Copyright (c) 2015-2016 PointSource, LLC. * MIT Licensed */ var _ = require('lodash'); exports.init = function (app, config, serviceLoader, auth, logger) { var routes = config.get('routes'); registerDeclarativeRoutes(app, config, routes, serviceLoader, auth, logger); }; /* * Load the "routes" config and register all the routes. * Any errors that might occur because of mis-configured routes will be logged. */ function registerDeclarativeRoutes(app, config, routes, serviceLoader, auth, logger) { _.forEach(_.keys(routes), function (routePath) { //routePath should be of form "<method> path" var parts = _.split(routePath, ' '); if (parts.length !== 2) { return logger.warn('Invalid route path "%s"', routePath); } var methods = ['get', 'post', 'put', 'delete', 'all']; if (!_.includes(methods, parts[0])) { return logger.warn('Invalid method "%s" on route "%s"', parts[0], parts[1]); } var handler = routes[routePath].handler; if (!handler) { return logger.warn('Missing handler for route "%s"', parts[1]); } //handler is something like foo.bar where there's a foo.js handler module which exports bar var handlerParts = _.split(handler, '.'); if (handlerParts.length !== 2) { return logger.warn('Invalid handler reference "%s"', parts[1]); } var handlerMod = serviceLoader.getConsumer('handlers', handlerParts[0]); if (!handlerMod) { return logger.warn('Could not find handler module named "%s".', handlerParts[0]); } var handlerFunc = handlerMod[handlerParts[1]]; if (!handlerFunc) { return logger.warn('Could not find handler function "%s" for module "%s"', handlerParts[1], handlerParts[0]); } //Some other projects have defined their own auth scheme. //As a temporary workaround, we ignore auth if the auth field is using their scheme, //which is an object instead of a string or array. var middleware = []; if (routes[routePath].auth && !_.isPlainObject(routes[routePath].auth)) { middleware = auth.getAuthMiddleware(routes[routePath].auth); } else if (!routes[routePath].auth) { //at least set up global auth if it's available middleware = auth.getAuthMiddleware(); } else { logger.debug('Ignoring auth'); } //Set up custom validator function on the route if (routes[routePath].validate) { logger.warn('Using experimental validators. This might change in the future.'); var expression = routes[routePath].validate; middleware.push(auth.validate(expression)); } middleware.push(handlerFunc); //register the route and handler function with express app[parts[0]].call(app, parts[1], middleware); }); }
37.2875
99
0.6118
12deae440d18f9443d1af55b5cc5b4be3cccb740
6,590
js
JavaScript
docs/resources/sap/f/semantic/SemanticConfiguration.js
steven-g/devtoberfest-2021-frontend-coding-challenge
7962912bb5f42caca821d6ddf5e4292ddec9648e
[ "Apache-2.0" ]
null
null
null
docs/resources/sap/f/semantic/SemanticConfiguration.js
steven-g/devtoberfest-2021-frontend-coding-challenge
7962912bb5f42caca821d6ddf5e4292ddec9648e
[ "Apache-2.0" ]
2
2021-11-08T20:36:55.000Z
2021-11-16T08:40:44.000Z
docs/resources/sap/f/semantic/SemanticConfiguration.js
steven-g/devtoberfest-2021-frontend-coding-challenge
7962912bb5f42caca821d6ddf5e4292ddec9648e
[ "Apache-2.0" ]
1
2021-11-08T14:38:05.000Z
2021-11-08T14:38:05.000Z
/*! * OpenUI5 * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(["sap/ui/base/Object","sap/ui/core/IconPool","sap/m/library","sap/m/OverflowToolbarLayoutData","sap/ui/core/InvisibleText"],function(e,t,n,i,r){"use strict";var a=n.OverflowToolbarPriority;var o=n.ButtonType;var c=e.extend("sap.f.semantic.SemanticConfiguration",{getInterface:function(){return this}});c._Placement={titleText:"titleText",titleIcon:"titleIcon",footerLeft:"footerLeft",footerRight:"footerRight",shareMenu:"shareMenu"};c.isKnownSemanticType=function(e){return c.getConfiguration(e)!==null};c.getConfiguration=function(e){return c._oTypeConfigs[e]||null};c.getSettings=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].getSettings()}return null};c.getConstraints=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].constraints||null}return null};c.getPlacement=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].placement}return null};c.getOrder=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].order}return null};c.shouldBePreprocessed=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].needPreprocesing||false}return false};c.isMainAction=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].mainAction||false}return false};c.isNavigationAction=function(e){if(c.isKnownSemanticType(e)){return c._oTypeConfigs[e].navigation||false}return false};c._oTypeConfigs=function(){var e={},n=sap.ui.getCore().getLibraryResourceBundle("sap.f");e["sap.f.semantic.TitleMainAction"]={placement:c._Placement.titleText,order:0,mainAction:true,getSettings:function(){return{type:o.Emphasized,layoutData:new i({priority:a.NeverOverflow})}}};e["sap.f.semantic.EditAction"]={placement:c._Placement.titleText,order:1,getSettings:function(){return{text:n.getText("SEMANTIC_CONTROL_EDIT"),tooltip:n.getText("SEMANTIC_CONTROL_EDIT"),type:o.Transparent}}};e["sap.f.semantic.DeleteAction"]={placement:c._Placement.titleText,order:2,getSettings:function(){return{text:n.getText("SEMANTIC_CONTROL_DELETE"),type:o.Transparent}}};e["sap.f.semantic.CopyAction"]={placement:c._Placement.titleText,order:3,getSettings:function(){return{text:n.getText("SEMANTIC_CONTROL_COPY"),type:o.Transparent}}};e["sap.f.semantic.AddAction"]={placement:c._Placement.titleText,order:4,getSettings:function(){return{text:n.getText("SEMANTIC_CONTROL_ADD"),tooltip:n.getText("SEMANTIC_CONTROL_ADD"),type:o.Transparent}}};e["sap.f.semantic.FavoriteAction"]={placement:c._Placement.titleIcon,order:0,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("favorite"),text:n.getText("SEMANTIC_CONTROL_FAVORITE"),type:o.Transparent}}};e["sap.f.semantic.FlagAction"]={placement:c._Placement.titleIcon,order:1,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("flag"),text:n.getText("SEMANTIC_CONTROL_FLAG"),type:o.Transparent}}};e["sap.f.semantic.FullScreenAction"]={placement:c._Placement.titleIcon,order:0,constraints:"IconOnly",navigation:true,getSettings:function(){return{icon:t.getIconURI("full-screen"),tooltip:n.getText("SEMANTIC_CONTROL_FULL_SCREEN"),layoutData:new i({priority:a.NeverOverflow}),type:o.Transparent}}};e["sap.f.semantic.ExitFullScreenAction"]={placement:c._Placement.titleIcon,order:1,constraints:"IconOnly",navigation:true,getSettings:function(){return{icon:t.getIconURI("exit-full-screen"),tooltip:n.getText("SEMANTIC_CONTROL_EXIT_FULL_SCREEN"),layoutData:new i({priority:a.NeverOverflow}),type:o.Transparent}}};e["sap.f.semantic.CloseAction"]={placement:c._Placement.titleIcon,order:2,constraints:"IconOnly",navigation:true,getSettings:function(){return{icon:t.getIconURI("decline"),tooltip:n.getText("SEMANTIC_CONTROL_CLOSE"),layoutData:new i({priority:a.NeverOverflow}),type:o.Transparent}}};e["sap.f.semantic.MessagesIndicator"]={placement:c._Placement.footerLeft,order:0,mainAction:false,getSettings:function(){var e=r.getStaticId("sap.f","SEMANTIC_CONTROL_MESSAGES_INDICATOR");return{icon:t.getIconURI("message-popup"),text:{path:"message>/",formatter:function(e){return e.length||0}},tooltip:n.getText("SEMANTIC_CONTROL_MESSAGES_INDICATOR"),ariaLabelledBy:e,type:o.Emphasized,visible:{path:"message>/",formatter:function(e){return e&&e.length>0}},models:{message:sap.ui.getCore().getMessageManager().getMessageModel()},layoutData:new i({priority:a.NeverOverflow})}}};e["sap.m.DraftIndicator"]={placement:c._Placement.footerRight,order:0,needPreprocesing:true,mainAction:false,getSettings:function(){return{layoutData:new i({shrinkable:false})}}};e["sap.f.semantic.FooterMainAction"]={placement:c._Placement.footerRight,order:1,mainAction:true,getSettings:function(){return{type:o.Emphasized,text:n.getText("SEMANTIC_CONTROL_SAVE"),layoutData:new i({priority:a.NeverOverflow})}}};e["sap.f.semantic.PositiveAction"]={placement:c._Placement.footerRight,order:2,mainAction:false,getSettings:function(){return{type:o.Accept,text:n.getText("SEMANTIC_CONTROL_ACCEPT"),layoutData:new i({priority:a.NeverOverflow})}}};e["sap.f.semantic.NegativeAction"]={placement:c._Placement.footerRight,order:3,mainAction:false,getSettings:function(){return{type:o.Reject,text:n.getText("SEMANTIC_CONTROL_REJECT"),layoutData:new i({priority:a.NeverOverflow})}}};e["sap.f.semantic.SendEmailAction"]={placement:c._Placement.shareMenu,order:0,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("email"),text:n.getText("SEMANTIC_CONTROL_SEND_EMAIL"),type:o.Transparent}}};e["sap.f.semantic.DiscussInJamAction"]={placement:c._Placement.shareMenu,order:1,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("discussion-2"),text:n.getText("SEMANTIC_CONTROL_DISCUSS_IN_JAM"),type:o.Transparent}}};e["sap.f.semantic.ShareInJamAction"]={placement:c._Placement.shareMenu,order:2,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("share-2"),text:n.getText("SEMANTIC_CONTROL_SHARE_IN_JAM"),type:o.Transparent}}};e["sap.f.semantic.SendMessageAction"]={placement:c._Placement.shareMenu,order:3,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("discussion"),text:n.getText("SEMANTIC_CONTROL_SEND_MESSAGE"),type:o.Transparent}}};e["saveAsTileAction"]={placement:c._Placement.shareMenu,order:4,constraints:"IconOnly"};e["sap.f.semantic.PrintAction"]={placement:c._Placement.shareMenu,order:5,constraints:"IconOnly",getSettings:function(){return{icon:t.getIconURI("print"),text:n.getText("SEMANTIC_CONTROL_PRINT"),type:o.Transparent}}};return e}();return c});
1,098.333333
6,439
0.800455
12deb981d0ec9d8adaad1271ff1044f13247072b
158
js
JavaScript
src/store/topics/done.js
ItRuns/consult-prototype
586a5fea6041ef7c801b7f924968570f46a6f2e7
[ "MIT" ]
null
null
null
src/store/topics/done.js
ItRuns/consult-prototype
586a5fea6041ef7c801b7f924968570f46a6f2e7
[ "MIT" ]
null
null
null
src/store/topics/done.js
ItRuns/consult-prototype
586a5fea6041ef7c801b7f924968570f46a6f2e7
[ "MIT" ]
null
null
null
export default { name: 'done', content: 'Looks like we\'re all done here!', inquiry: '', responseTypes: [], type: 'button-list', responses: {}, }
17.555556
46
0.601266
12dede48dddff6b3404cd4affc525e87e3d7c302
4,318
js
JavaScript
FigurasGeometricas/figuras.js
VMatzar/Practico-Javascript
acee9cf18acbcc910471966b60019ac2bba6786e
[ "MIT" ]
1
2021-09-30T18:14:10.000Z
2021-09-30T18:14:10.000Z
FigurasGeometricas/figuras.js
VMatzar/Practico-Javascript
acee9cf18acbcc910471966b60019ac2bba6786e
[ "MIT" ]
null
null
null
FigurasGeometricas/figuras.js
VMatzar/Practico-Javascript
acee9cf18acbcc910471966b60019ac2bba6786e
[ "MIT" ]
null
null
null
//Código del Cuadrado function perimetroCuadrado(lado){ return lado * 4; } function areaCuadrado(lado){ return lado * lado; } //Código del Triangulo function perimetroTriangulo(lado1, lado2, base){ return lado1 + lado2 + base; } function areaTriangulo(base, altura){ return (base * altura) / 2; } //Código del Circulo function diametroCirculo(radio){ return radio * 2; } const pi = Math.PI; function perimetroCirculo(radio){ const diametro = diametroCirculo(radio); return diametro * pi; } function areaCirculo(radio){ return (radio * radio) * pi; } //Código del Rectangulo function perimetroRectangulo(base, altura){ return 2 * ( base + altura); } function areaRectangulo(base, altura){ return base * altura; } //Altura Triangulo isosceles // function alturaIsosceles(ladoa, ladob, base){ // if(ladoa===ladob && ladoa!=base){ // const altura = Math.sqrt((ladoa*ladoa) - ((base*base)/4)); // alert(`La altura del triangulo Isosceles es: ${altura}`); // } else{ // alert("El triangulo isosceles debe tener dos lados iguales y uno no, coloque los valores nuevamente"); // } // } //Interacción con HTML: // C U A D R A D O function calcularPerimetroCuadrado(){ const input = document.getElementById("InputCuadrado");//Devuelve valor string const value = input.value; const perimetro = perimetroCuadrado(value); alert("El perimetro es "+perimetro); } function calcularAreaCuadrado(){ const input = document.getElementById("InputCuadrado");//Devuelve valor string const value = input.value; const area = areaCuadrado(value); alert("El área es "+ area); } // T R I A N G U L O function calcularPerimetroTriangulo(){ const inputBase = document.getElementById("InputBaseTriangulo"); const valueBase = Number(inputBase.value); const inputLado1 = document.getElementById("InputLado1Triangulo"); const valueLado1 = Number(inputLado1.value); const inputLado2 = document.getElementById("InputLado2Triangulo"); const valueLado2 = Number(inputLado2.value); const perimetro = perimetroTriangulo(valueLado1, valueLado2, valueBase); alert(`El perimetro es ${perimetro}`); } function calcularAreaTriangulo(){ const inputBase = document.getElementById("InputBaseTriangulo"); const valueBase = Number(inputBase.value); const inputAltura = document.getElementById("InputAlturaTriangulo"); const valueAltura = Number(inputAltura.value); const area = areaTriangulo(valueBase, valueAltura); alert("El área es "+ area); } //C I R C U L O function calcularPerimetroCirculo(){ const input = document.getElementById("InputCirculo"); const value = Number(input.value); const perimetro = perimetroCirculo(value); alert("El perimetro es "+perimetro); } function calcularAreaCirculo(){ const input = document.getElementById("InputCirculo"); const value = Number(input.value); const area = areaCirculo(value); alert("El área es "+ area); } //I S O S C E L E S // function calcularAlturaIsosceles(){ // const inputLadoA = document.getElementById("InputLadoAIsosceles"); // const valueLadoA = Number(inputLadoA.value); // const inputLadoB = document.getElementById("InputLadoBIsosceles"); // const valueLadoB = Number(inputLadoB.value); // const inputBase = document.getElementById("InputBaseIsosceles"); // const valueBase = Number(inputBase.value); // alturaIsosceles(valueLadoA, valueLadoB, valueBase); // } //R E C T A N G U L O function calcularPerimetroRectangulo(){ const inputBase = document.getElementById("InputBaseRectangulo"); const valueBase = Number(inputBase.value); const inputAltura = document.getElementById("InputAlturaRectangulo"); const valueAltura = Number(inputAltura.value); const perimetro = perimetroRectangulo(valueBase, valueAltura); alert("El perimetro es "+ perimetro); } function calcularAreaRectangulo(){ const inputBase = document.getElementById("InputBaseRectangulo"); const valueBase = Number(inputBase.value); const inputAltura = document.getElementById("InputAlturaRectangulo"); const valueAltura = Number(inputAltura.value); const area = areaRectangulo(valueBase, valueAltura); alert("El area es "+ area); }
29.986111
113
0.710514
12dee795a110f6f5a484caf2e931009c915a2c92
1,079
js
JavaScript
XilinxProcessorIPLib/drivers/uartns550/doc/html/api/struct_x_uart_ns550_stats.js
erique/embeddedsw
4b5fd15c71405844e03f2c276daa38cfcbb6459b
[ "BSD-2-Clause", "MIT" ]
595
2015-02-03T15:07:36.000Z
2022-03-31T18:21:23.000Z
XilinxProcessorIPLib/drivers/uartns550/doc/html/api/struct_x_uart_ns550_stats.js
erique/embeddedsw
4b5fd15c71405844e03f2c276daa38cfcbb6459b
[ "BSD-2-Clause", "MIT" ]
144
2016-01-08T17:56:37.000Z
2022-03-31T13:23:52.000Z
XilinxProcessorIPLib/drivers/uartns550/doc/html/api/struct_x_uart_ns550_stats.js
erique/embeddedsw
4b5fd15c71405844e03f2c276daa38cfcbb6459b
[ "BSD-2-Clause", "MIT" ]
955
2015-03-30T00:54:27.000Z
2022-03-31T11:32:23.000Z
var struct_x_uart_ns550_stats = [ [ "CharactersReceived", "struct_x_uart_ns550_stats.html#a0ff150c925459d98e4555193e980fbcb", null ], [ "CharactersTransmitted", "struct_x_uart_ns550_stats.html#abd414f52ad160c32832bc17a5451bfef", null ], [ "ModemInterrupts", "struct_x_uart_ns550_stats.html#aa65ee74968a73e8c7b8b218faf5d3530", null ], [ "ReceiveBreakDetected", "struct_x_uart_ns550_stats.html#a7346d4d8eba130d8c47c64711edadf98", null ], [ "ReceiveFramingErrors", "struct_x_uart_ns550_stats.html#ac33dce22ad55ac46c6ac7abe16500846", null ], [ "ReceiveInterrupts", "struct_x_uart_ns550_stats.html#ab2e33346a9d877573006f4290958922f", null ], [ "ReceiveOverrunErrors", "struct_x_uart_ns550_stats.html#a48bef70419479251de1523a4411615ed", null ], [ "ReceiveParityErrors", "struct_x_uart_ns550_stats.html#a65f9e1e7119386a2cc91aecd2793474f", null ], [ "StatusInterrupts", "struct_x_uart_ns550_stats.html#a9acf15361c4758bf0e0f6f2b8b8e9144", null ], [ "TransmitInterrupts", "struct_x_uart_ns550_stats.html#afeb7865c20a883942eb6e5d749c079eb", null ] ];
83
106
0.808156
12e0602c7b8ea50eee365bee4221d7e4eac46d98
1,915
js
JavaScript
app/Sickness/LoadDiagnosis.js
epidemik-dev/web
aaa718162d8e3d9c16a97334dedc254e57accbfe
[ "MIT" ]
null
null
null
app/Sickness/LoadDiagnosis.js
epidemik-dev/web
aaa718162d8e3d9c16a97334dedc254e57accbfe
[ "MIT" ]
4
2018-08-14T15:49:26.000Z
2018-08-14T15:51:11.000Z
app/Sickness/LoadDiagnosis.js
epidemik-dev/html
aaa718162d8e3d9c16a97334dedc254e57accbfe
[ "MIT" ]
null
null
null
function loadDiagnosisData() { } function loadDiseases() { network_load_diagnosis(localStorage["token"], processDiseaseData, function (xhr) { displayLogin(); }) } function loadSymptoms() { network_load_diagnosis(localStorage["token"], processSymptomData, function (xhr) { displayLogin(); }) } function processSymptomData(toProcess) { var diseaseName = localStorage['disease_name'] var symptomMap = toProcess.symptom_map; var symptoms = toProcess.disease_question_map[diseaseName]; for(var i = 0; i < symptoms.length; i++) { addSymptom(symptomMap[symptoms[i]], symptoms[i]); } } function processDiseaseData(toProcess) { for(var i = 0; i < toProcess.disease_list.length; i++) { addDisease(toProcess.disease_list[i]); } } function addDisease(diseaseName) { var selector = document.getElementById("disease_selector"); var item = document.createElement("option"); item.value = diseaseName item.text = diseaseName selector.appendChild(item); } //String -> Void //Adds the given system to the HTML doc //EFFECT: modifies the HTML function addSymptom(symptom, symID) { var toAddMain = document.createElement("div"); toAddMain.id = symID; toAddMain.className = "checkbox"; var checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.id = "checkbox" + symID; checkbox.value = "1"; var lable = document.createElement("label"); lable.htmlFor = "checkbox" + symID; toAddMain.appendChild(checkbox); toAddMain.appendChild(lable); var superDoc = document.getElementById("symSelector"); superDoc.appendChild(toAddMain); var label = document.createElement("p"); label.textContent = symptom; label.className = "checkbox-label"; superDoc.appendChild(label); superDoc.appendChild(document.createElement("br")); }
27.357143
86
0.686684
12e0677f9d8159a923de2b0dbe088f1f75e60fa8
327
js
JavaScript
src/definitions/chakra/theme/foundations/colors.js
uwblueprint/headsupguys
3d5100207a5fd517a2889b6e8de744ec3f282970
[ "MIT" ]
6
2021-06-06T20:34:34.000Z
2022-01-26T00:55:09.000Z
src/definitions/chakra/theme/foundations/colors.js
uwblueprint/headsupguys
3d5100207a5fd517a2889b6e8de744ec3f282970
[ "MIT" ]
52
2021-05-23T20:18:19.000Z
2022-03-27T23:49:27.000Z
src/definitions/chakra/theme/foundations/colors.js
uwblueprint/headsupguys
3d5100207a5fd517a2889b6e8de744ec3f282970
[ "MIT" ]
3
2021-08-06T23:57:46.000Z
2021-11-10T02:03:03.000Z
export default { brand: { lime: "#86FC2F", green: "#54C203", 900: "#1a365d", 800: "#153e75", 700: "#2a69ac", }, background: { light: "#F3F3F3", dark: "#121310", }, header: { 100: "#20232a", }, main: { 100: "#282c34", }, };
16.35
25
0.382263
12e081c019532594031280ee5b9bdf0f9bfa3884
20,359
js
JavaScript
Specs/Scene/Multiple3DTileContentSpec.js
andrewjhill9/cesium
1f036e0a8a8107cc226263255174f685e426fd66
[ "Apache-2.0" ]
5,139
2015-01-02T23:38:29.000Z
2020-02-18T11:07:38.000Z
Specs/Scene/Multiple3DTileContentSpec.js
andrewjhill9/cesium
1f036e0a8a8107cc226263255174f685e426fd66
[ "Apache-2.0" ]
6,103
2015-01-02T15:04:01.000Z
2020-02-18T15:41:37.000Z
Specs/Scene/Multiple3DTileContentSpec.js
andrewjhill9/cesium
1f036e0a8a8107cc226263255174f685e426fd66
[ "Apache-2.0" ]
2,132
2015-01-03T12:05:03.000Z
2020-02-16T04:21:10.000Z
import { Cartesian3, Cesium3DContentGroup, Cesium3DTileset, Color, HeadingPitchRange, Multiple3DTileContent, MetadataClass, GroupMetadata, RequestScheduler, Resource, } from "../../Source/Cesium.js"; import Cesium3DTilesTester from "../Cesium3DTilesTester.js"; import createScene from "../createScene.js"; import generateJsonBuffer from "../generateJsonBuffer.js"; describe( "Scene/Multiple3DTileContent", function () { let scene; // This scene is the same as Composite/Composite, just rephrased using multiple contents const centerLongitude = -1.31968; const centerLatitude = 0.698874; const multipleContentsUrl = "./Data/Cesium3DTiles/MultipleContents/MultipleContents/tileset_1.1.json"; const multipleContentsLegacyUrl = "./Data/Cesium3DTiles/MultipleContents/MultipleContents/tileset_1.0.json"; // Test for older version of 3DTILES_multiple_contents that uses "content" instead of "contents" const multipleContentsLegacyWithContentUrl = "./Data/Cesium3DTiles/MultipleContents/MultipleContents/tileset_1.0_content.json"; const tilesetResource = new Resource({ url: "http://example.com" }); const contents = [ { uri: "pointcloud.pnts", }, { uri: "batched.b3dm", }, { uri: "gltfModel.glb", }, ]; const contentsJson = { contents: contents, }; // legacy const contentJson = { content: contents, }; function makeGltfBuffer() { const gltf = { asset: { version: "1.0", }, }; return generateJsonBuffer(gltf).buffer; } let originalRequestsPerServer; function setZoom(distance) { const center = Cartesian3.fromRadians(centerLongitude, centerLatitude); scene.camera.lookAt(center, new HeadingPitchRange(0.0, -1.57, distance)); } function viewAllTiles() { setZoom(26.0); } function viewNothing() { setZoom(200.0); } beforeAll(function () { scene = createScene(); // One item in each data set is always located in the center, so point the camera there originalRequestsPerServer = RequestScheduler.maximumRequestsPerServer; }); afterAll(function () { scene.destroyForSpecs(); }); beforeEach(function () { RequestScheduler.maximumRequestsPerServer = originalRequestsPerServer; viewAllTiles(); }); afterEach(function () { scene.primitives.removeAll(); }); function expectRenderMultipleContents(tileset) { expect(scene).toPickAndCall(function (result) { // Pick a building const pickedBuilding = result; expect(pickedBuilding).toBeDefined(); // Change the color of the picked building to yellow pickedBuilding.color = Color.clone(Color.YELLOW, pickedBuilding.color); // Expect the pixel color to be some shade of yellow Cesium3DTilesTester.expectRender(scene, tileset, function (rgba) { expect(rgba[0]).toBeGreaterThan(0); expect(rgba[1]).toBeGreaterThan(0); expect(rgba[2]).toEqual(0); expect(rgba[3]).toEqual(255); }); // Both a building and instance are located at the center, hide the building and pick the instance pickedBuilding.show = false; let pickedInstance; expect(scene).toPickAndCall(function (result) { pickedInstance = result; expect(pickedInstance).toBeDefined(); expect(pickedInstance).not.toEqual(pickedBuilding); }); // Change the color of the picked instance to green pickedInstance.color = Color.clone(Color.GREEN, pickedInstance.color); // Expect the pixel color to be some shade of green Cesium3DTilesTester.expectRender(scene, tileset, function (rgba) { expect(rgba[0]).toEqual(0); expect(rgba[1]).toBeGreaterThan(0); expect(rgba[2]).toEqual(0); expect(rgba[3]).toEqual(255); }); // Hide the instance, and expect the render to be blank pickedInstance.show = false; Cesium3DTilesTester.expectRenderBlank(scene, tileset); }); } it("innerContentUrls returns the urls from object containing contents array", function () { const tileset = {}; const tile = {}; const content = new Multiple3DTileContent( tileset, tile, tilesetResource, contentsJson ); expect(content.innerContentUrls).toEqual([ "pointcloud.pnts", "batched.b3dm", "gltfModel.glb", ]); }); it("innerContentUrls returns the urls from object containing content (legacy)", function () { const tileset = {}; const tile = {}; const content = new Multiple3DTileContent( tileset, tile, tilesetResource, contentJson ); expect(content.innerContentUrls).toEqual([ "pointcloud.pnts", "batched.b3dm", "gltfModel.glb", ]); }); it("contentsFetchedPromise is undefined until requestInnerContents is successful", function () { const mockTileset = { statistics: { numberOfPendingRequests: 0, }, }; const tile = {}; const content = new Multiple3DTileContent( mockTileset, tile, tilesetResource, contentsJson ); expect(content.contentsFetchedPromise).not.toBeDefined(); spyOn(Resource.prototype, "fetchArrayBuffer").and.callFake(function () { return Promise.resolve(makeGltfBuffer()); }); content.requestInnerContents(); expect(content.contentsFetchedPromise).toBeDefined(); }); it("contentsFetchedPromise is undefined if no requests are scheduled", function () { const mockTileset = { statistics: { numberOfPendingRequests: 0, }, }; const tile = {}; const content = new Multiple3DTileContent( mockTileset, tile, tilesetResource, contentsJson ); expect(content.contentsFetchedPromise).not.toBeDefined(); RequestScheduler.maximumRequestsPerServer = 2; content.requestInnerContents(); expect(content.contentsFetchedPromise).not.toBeDefined(); }); it("requestInnerContents returns 0 if successful", function () { const mockTileset = { statistics: { numberOfPendingRequests: 0, }, }; const tile = {}; const content = new Multiple3DTileContent( mockTileset, tile, tilesetResource, contentsJson ); const fetchArray = spyOn( Resource.prototype, "fetchArrayBuffer" ).and.callFake(function () { return Promise.resolve(makeGltfBuffer()); }); expect(content.requestInnerContents()).toBe(0); expect(fetchArray.calls.count()).toBe(3); }); it("requestInnerContents schedules no requests if there are not enough open slots", function () { const mockTileset = { statistics: { numberOfPendingRequests: 0, }, }; const tile = {}; const content = new Multiple3DTileContent( mockTileset, tile, tilesetResource, contentsJson ); const fetchArray = spyOn(Resource.prototype, "fetchArrayBuffer"); RequestScheduler.maximumRequestsPerServer = 2; expect(content.requestInnerContents()).toBe(3); expect(fetchArray).not.toHaveBeenCalled(); }); it("resolves readyPromise", function () { return Cesium3DTilesTester.resolvesReadyPromise( scene, multipleContentsUrl ); }); it("renders multiple contents", function () { return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( expectRenderMultipleContents ); }); it("renders multiple contents (legacy)", function () { return Cesium3DTilesTester.loadTileset( scene, multipleContentsLegacyUrl ).then(expectRenderMultipleContents); }); it("renders multiple contents (legacy with 'content')", function () { return Cesium3DTilesTester.loadTileset( scene, multipleContentsLegacyWithContentUrl ).then(expectRenderMultipleContents); }); it("renders valid tiles after tile failure", function () { const originalLoadJson = Cesium3DTileset.loadJson; spyOn(Cesium3DTileset, "loadJson").and.callFake(function (tilesetUrl) { return originalLoadJson(tilesetUrl).then(function (tilesetJson) { const contents = tilesetJson.root.contents; const badTile = { uri: "nonexistent.b3dm", }; contents.splice(1, 0, badTile); return tilesetJson; }); }); return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( expectRenderMultipleContents ); }); it("renders valid tiles after tile failure (legacy)", function () { const originalLoadJson = Cesium3DTileset.loadJson; spyOn(Cesium3DTileset, "loadJson").and.callFake(function (tilesetUrl) { return originalLoadJson(tilesetUrl).then(function (tilesetJson) { const content = tilesetJson.root.extensions["3DTILES_multiple_contents"].contents; const badTile = { uri: "nonexistent.b3dm", }; content.splice(1, 0, badTile); return tilesetJson; }); }); return Cesium3DTilesTester.loadTileset( scene, multipleContentsLegacyUrl ).then(expectRenderMultipleContents); }); it("cancelRequests cancels in-flight requests", function () { viewNothing(); return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( function (tileset) { viewAllTiles(); scene.renderForSpecs(); const multipleContents = tileset.root.content; multipleContents.cancelRequests(); return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then( function () { // the content should be canceled once in total expect(multipleContents._cancelCount).toBe(1); } ); } ); }); it("destroys", function () { return Cesium3DTilesTester.tileDestroys(scene, multipleContentsUrl); }); describe("metadata", function () { const withGroupMetadataUrl = "./Data/Cesium3DTiles/MultipleContents/GroupMetadata/tileset_1.1.json"; const withGroupMetadataLegacyUrl = "./Data/Cesium3DTiles/MultipleContents/GroupMetadata/tileset_1.0.json"; const withExplicitContentMetadataUrl = "./Data/Cesium3DTiles/Metadata/MultipleContentsWithMetadata/tileset_1.1.json"; const withExplicitContentMetadataLegacyUrl = "./Data/Cesium3DTiles/Metadata/MultipleContentsWithMetadata/tileset_1.0.json"; const withImplicitContentMetadataUrl = "./Data/Cesium3DTiles/Metadata/ImplicitMultipleContentsWithMetadata/tileset_1.1.json"; const withImplicitContentMetadataLegacyUrl = "./Data/Cesium3DTiles/Metadata/ImplicitMultipleContentsWithMetadata/tileset_1.0.json"; let metadataClass; let groupMetadata; beforeAll(function () { metadataClass = new MetadataClass({ id: "test", class: { properties: { name: { type: "STRING", }, height: { type: "SCALAR", componentType: "FLOAT32", }, }, }, }); groupMetadata = new GroupMetadata({ id: "testGroup", group: { properties: { name: "Test Group", height: 35.6, }, }, class: metadataClass, }); }); it("group metadata returns undefined", function () { return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( function (tileset) { const content = tileset.root.content; expect(content.group).not.toBeDefined(); } ); }); it("assigning group metadata throws", function () { return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( function (tileset) { expect(function () { const content = tileset.root.content; content.group = new Cesium3DContentGroup({ metadata: groupMetadata, }); }).toThrowDeveloperError(); } ); }); it("initializes group metadata for inner contents", function () { return Cesium3DTilesTester.loadTileset( scene, withGroupMetadataUrl ).then(function (tileset) { const multipleContents = tileset.root.content; const innerContents = multipleContents.innerContents; const buildingsContent = innerContents[0]; let groupMetadata = buildingsContent.group.metadata; expect(groupMetadata).toBeDefined(); expect(groupMetadata.getProperty("color")).toEqual( new Cartesian3(255, 127, 0) ); expect(groupMetadata.getProperty("priority")).toBe(10); expect(groupMetadata.getProperty("isInstanced")).toBe(false); const cubesContent = innerContents[1]; groupMetadata = cubesContent.group.metadata; expect(groupMetadata).toBeDefined(); expect(groupMetadata.getProperty("color")).toEqual( new Cartesian3(0, 255, 127) ); expect(groupMetadata.getProperty("priority")).toBe(5); expect(groupMetadata.getProperty("isInstanced")).toBe(true); }); }); it("initializes group metadata for inner contents (legacy)", function () { return Cesium3DTilesTester.loadTileset( scene, withGroupMetadataLegacyUrl ).then(function (tileset) { const multipleContents = tileset.root.content; const innerContents = multipleContents.innerContents; const buildingsContent = innerContents[0]; let groupMetadata = buildingsContent.group.metadata; expect(groupMetadata).toBeDefined(); expect(groupMetadata.getProperty("color")).toEqual( new Cartesian3(255, 127, 0) ); expect(groupMetadata.getProperty("priority")).toBe(10); expect(groupMetadata.getProperty("isInstanced")).toBe(false); const cubesContent = innerContents[1]; groupMetadata = cubesContent.group.metadata; expect(groupMetadata).toBeDefined(); expect(groupMetadata.getProperty("color")).toEqual( new Cartesian3(0, 255, 127) ); expect(groupMetadata.getProperty("priority")).toBe(5); expect(groupMetadata.getProperty("isInstanced")).toBe(true); }); }); it("content metadata returns undefined", function () { return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( function (tileset) { const content = tileset.root.content; expect(content.metadata).not.toBeDefined(); } ); }); it("assigning content metadata throws", function () { return Cesium3DTilesTester.loadTileset(scene, multipleContentsUrl).then( function (tileset) { expect(function () { const content = tileset.root.content; content.metadata = {}; }).toThrowDeveloperError(); } ); }); it("initializes explicit content metadata for inner contents", function () { return Cesium3DTilesTester.loadTileset( scene, withExplicitContentMetadataUrl ).then(function (tileset) { const multipleContents = tileset.root.content; const innerContents = multipleContents.innerContents; const batchedContent = innerContents[0]; const batchedMetadata = batchedContent.metadata; expect(batchedMetadata).toBeDefined(); expect(batchedMetadata.getProperty("highlightColor")).toEqual( new Cartesian3(0, 0, 255) ); expect(batchedMetadata.getProperty("author")).toEqual("Cesium"); const instancedContent = innerContents[1]; const instancedMetadata = instancedContent.metadata; expect(instancedMetadata).toBeDefined(); expect(instancedMetadata.getProperty("numberOfInstances")).toEqual( 50 ); expect(instancedMetadata.getProperty("author")).toEqual( "Sample Author" ); }); }); it("initializes explicit content metadata for inner contents (legacy)", function () { return Cesium3DTilesTester.loadTileset( scene, withExplicitContentMetadataLegacyUrl ).then(function (tileset) { const multipleContents = tileset.root.content; const innerContents = multipleContents.innerContents; const batchedContent = innerContents[0]; const batchedMetadata = batchedContent.metadata; expect(batchedMetadata).toBeDefined(); expect(batchedMetadata.getProperty("highlightColor")).toEqual( new Cartesian3(0, 0, 255) ); expect(batchedMetadata.getProperty("author")).toEqual("Cesium"); const instancedContent = innerContents[1]; const instancedMetadata = instancedContent.metadata; expect(instancedMetadata).toBeDefined(); expect(instancedMetadata.getProperty("numberOfInstances")).toEqual( 50 ); expect(instancedMetadata.getProperty("author")).toEqual( "Sample Author" ); }); }); it("initializes implicit content metadata for inner contents", function () { return Cesium3DTilesTester.loadTileset( scene, withImplicitContentMetadataUrl ).then(function (tileset) { const placeholderTile = tileset.root; const subtreeRootTile = placeholderTile.children[0]; // This retrieves the tile at (1, 1, 1) const subtreeChildTile = subtreeRootTile.children[0]; const multipleContents = subtreeChildTile.content; const innerContents = multipleContents.innerContents; const buildingContent = innerContents[0]; const buildingMetadata = buildingContent.metadata; expect(buildingMetadata).toBeDefined(); expect(buildingMetadata.getProperty("height")).toEqual(50); expect(buildingMetadata.getProperty("color")).toEqual( new Cartesian3(0, 0, 255) ); const treeContent = innerContents[1]; const treeMetadata = treeContent.metadata; expect(treeMetadata).toBeDefined(); expect(treeMetadata.getProperty("age")).toEqual(16); }); }); it("initializes implicit content metadata for inner contents (legacy)", function () { return Cesium3DTilesTester.loadTileset( scene, withImplicitContentMetadataLegacyUrl ).then(function (tileset) { const placeholderTile = tileset.root; const subtreeRootTile = placeholderTile.children[0]; // This retrieves the tile at (1, 1, 1) const subtreeChildTile = subtreeRootTile.children[0]; const multipleContents = subtreeChildTile.content; const innerContents = multipleContents.innerContents; const buildingContent = innerContents[0]; const buildingMetadata = buildingContent.metadata; expect(buildingMetadata).toBeDefined(); expect(buildingMetadata.getProperty("height")).toEqual(50); expect(buildingMetadata.getProperty("color")).toEqual( new Cartesian3(0, 0, 255) ); const treeContent = innerContents[1]; const treeMetadata = treeContent.metadata; expect(treeMetadata).toBeDefined(); expect(treeMetadata.getProperty("age")).toEqual(16); }); }); }); }, "WebGL" );
33.050325
106
0.621887
12e08421bbb8ae5d982f5fd351cb55cc72f7e58c
4,616
js
JavaScript
assets/js/views/common/superViews.js
Mczzzz/lifer
0799c1f76be1f2813ccd7f9560320c43ba1eeba9
[ "MIT" ]
null
null
null
assets/js/views/common/superViews.js
Mczzzz/lifer
0799c1f76be1f2813ccd7f9560320c43ba1eeba9
[ "MIT" ]
1
2018-10-17T21:33:07.000Z
2018-10-17T21:33:07.000Z
assets/js/views/common/superViews.js
Mczzzz/lifer
0799c1f76be1f2813ccd7f9560320c43ba1eeba9
[ "MIT" ]
null
null
null
import { Lifer } from '../../services/Lifer.js'; //import { DBLocal } from '../../services/DBLocal.js'; import Moment from 'moment'; import 'moment/locale/fr'; export default class views { constructor(MyClass,path,prepend = false){ this.Lifer = Lifer; Moment.locale('fr'); this.Moment = Moment; this.MyClass = MyClass; this.parentThis = (path)? this.getObjectThisfromPath(path) : false; this.parent = (this.parentThis)? this.parentThis.getContainer() : document.body; this.path = (this.parentThis)? this.parentThis.path+"-"+this.MyClass : this.MyClass; this.Lifer.addMe(this.path); this.superInit(prepend); this.Lifer.addData(this.path,[{"This" : this}]); } superInit(prepend){ if(document.getElementsByClassName(this.path)[0] !== undefined){ this.container = document.getElementsByClassName(this.path)[0]; }else{ this.container = document.createElement("div"); this.container.className = this.path; if(prepend){ this.parent.prepend(this.container); }else{ this.parent.append(this.container); } } /* //auto creation des ids let arrayId = this.MyClass.split("_"); if(typeof arrayId[1] === 'undefined') { this.ClassId = ""; } else { this.ClassId = arrayId[1]; // console.log(this.ClassId); }*/ this.initListener(); } getContainer(){ return this.container; } //property : x, y , width, height, top, left, bottom, right ... getContainerRect(property){ let boxShadow = this.container.style.boxShadow; let padding = this.container.style.padding; let margin = this.container.style.margin; let border = this.container.style.border; let transDur = this.container.style.transitionDuration; let transDel = this.container.style.transitionDelay; let transTim = this.container.style.transitionTimingFunction; let transProp = this.container.style.transitionProperty; this.container.style.transitionDuration = null; this.container.style.transitionDelay = null; this.container.style.transitionTimingFunction = null; this.container.style.transitionProperty = null; if(property == "height"){ this.container.style.boxShadow = null; this.container.style.padding = null; this.container.style.margin = null; this.container.style.border = null; } let toReturn = this.container.getBoundingClientRect()[property]; if(property == "height"){ this.container.style.boxShadow = boxShadow; this.container.style.padding = padding; this.container.style.margin = margin; this.container.style.border = border; } return toReturn; } setStyle(property,value,scope = "all"){ if(scope == "property" || scope == "all") this[property] = value; if(scope == "element" || scope == "all" ) this.container.style[property] = value; } setAttribute(property,value,scope = "all"){ if(scope == "property" || scope == "all") this[property] = value; if(scope == "element" || scope == "all" ) this.container.setAttribute(property,value); } removeAttribute(attribute){ this.container.removeAttribute(attribute); } destroyMe(){ this.Lifer.destroy(this.path); this.container.remove(); } initListener(){ this.container.addEventListener('callBack', (data) => this.callBack(data)); } callBack(data){ // console.log(data); let methode = "on_"+data.detail.element+"_"+data.detail.Event.type; //console.log(methode); this[methode](data.detail); } callBackToParent(data){ let ev = new CustomEvent('callBack', {'detail' : data}); this.parent.dispatchEvent(ev); } setId(id){ // console.log(id); this.container.id = id; } isTmpId(){ if(this.container.id.indexOf("tmp-") == 0 ) return true; return false; } getId(){ return this.container.id; } //pourquoi ici ce serait plutot une fonction lifer à premiere vue getObjectThisfromPath(path){ return this.Lifer.getData(path,"This"); } initTouch(path, callback){ this.touchCaller = this.getObjectThisfromPath(path); this.touchCallerMethod = callback; this.getContainer().addEventListener("touchstart", (e)=>this.touchHandle(e,"start"), false); this.getContainer().addEventListener("touchmove", (e)=>this.touchHandle(e,"move"), false); this.getContainer().addEventListener("touchend", (e)=>this.touchHandle(e,"stop"), false); } touchHandle(e,type){ this.touchCaller[this.touchCallerMethod](e,type); } }
17.551331
96
0.654463
12e115f5c33a78dff7b54c0e4029c944bf267838
358
js
JavaScript
src/util/effects/flash.js
ksusername/vue-fis3
734d79caeeabb65e08bc5a52301b652c4d3bccbd
[ "MIT" ]
161
2015-07-08T06:33:11.000Z
2016-07-13T11:13:34.000Z
src/util/effects/flash.js
ksusername/vue-fis3
734d79caeeabb65e08bc5a52301b652c4d3bccbd
[ "MIT" ]
11
2016-07-26T07:04:12.000Z
2018-05-15T05:06:52.000Z
src/util/effects/flash.js
ksusername/vue-fis3
734d79caeeabb65e08bc5a52301b652c4d3bccbd
[ "MIT" ]
54
2015-08-04T04:02:37.000Z
2016-07-13T06:33:49.000Z
'use strict'; import Vue from 'vue' import snabbt from '../snabbt' export default { beforeEnter(el) { }, enter(el, done) { snabbt(el, { fromOpacity: 1, opacity: 0, duration: 500, loop: 2, complete() { el.style.opacity = 1 done() } }) }, leave(el, done) { console.log('true') } }
13.769231
30
0.502793
12e17659e34699b8f0a9d5f155f7ce31c8ded499
283
js
JavaScript
example/src/index.js
nathanfaucett/dom_caret
5e576a4c6fe4e50def987fb06df279d9eb34d50d
[ "MIT" ]
null
null
null
example/src/index.js
nathanfaucett/dom_caret
5e576a4c6fe4e50def987fb06df279d9eb34d50d
[ "MIT" ]
null
null
null
example/src/index.js
nathanfaucett/dom_caret
5e576a4c6fe4e50def987fb06df279d9eb34d50d
[ "MIT" ]
null
null
null
var domCaret = global.domCaret = require("../.."); var input = document.getElementById("input"); input.onclick = function() { console.log(domCaret.get(input)); }; domCaret.set(input, 6); domCaret.get(input); domCaret.set(input, 0, input.value.length); domCaret.get(input);
17.6875
50
0.689046
12e1a8a18cd9f89b26f5fe718294a2cae318b6fa
4,198
js
JavaScript
src/Intervalle.js
Platane/Procedural-Flower
897921206f2f476ed9dee470718bae2e7ef0a79b
[ "MIT" ]
41
2015-02-02T03:45:38.000Z
2022-01-16T07:56:44.000Z
src/Intervalle.js
mcanthony/Procedural-Flower
897921206f2f476ed9dee470718bae2e7ef0a79b
[ "MIT" ]
null
null
null
src/Intervalle.js
mcanthony/Procedural-Flower
897921206f2f476ed9dee470718bae2e7ef0a79b
[ "MIT" ]
5
2015-03-23T20:18:04.000Z
2016-06-16T07:27:30.000Z
/** * @author platane / http://arthur-brongniart.fr/ */ var Flw = Flw || {}; Flw.Intervalle = function(){}; Flw.Intervalle.prototype = { _tab:null, initWithTab : function( t ){ this._tab = t; }, initWithBornes : function( a , b ){ a = a % ( Math.PI * 2 ); if( a < 0 ) a += ( Math.PI * 2 ); b = b % ( Math.PI * 2 ); if( b <= 0 ) b += ( Math.PI * 2 ); if( a > b ) this._tab = [ { a:0 , b:b } , { a:a , b:( Math.PI * 2 ) } ]; else this._tab = [ { a:a , b:b } ]; }, getRandom : function( r ){ r = r || Math.random(); if( this.isEmpty() ) return 0; var t = new Array( this._tab.length+1 ) , sum = 0; t[ 0 ] = 0; for( var i = 0 ; i < this._tab.length ; i ++ ) t[ i+1 ] = ( sum += this._tab[i].b - this._tab[i].a ); r*=sum; for( var i = 1 ; i < this._tab.length && t[i] <= r ; i ++ ); r = ( r - t[i-1] ) / ( t[i] - t[i-1] ); return this._tab[i-1].a *(1- r) + this._tab[i-1].b*r; }, isEmpty : function(){ return this._tab.length == 0; }, getSum : function(){ var sum = 0; for( var i = 0 ; i < this._tab.length ; i ++ ) sum += this._tab[i].b - this._tab[i].a ; return sum; }, complementaire : function( ){ var te = []; for( var i = 0 ; i < this._tab.length ; i ++ ){ if( i == 0 ){ if( this._tab[ i ].a > 0 ) te.push( { a : 0 , b : this._tab[ i ].a } ); } else te.push( { a : this._tab[ i-1 ].b , b :this._tab[ i ].a } ); if( i == this._tab.length-1 ){ if( this._tab[ i ].b < Math.PI*2 ) te.push( { a : this._tab[ i ].b , b : Math.PI*2 } ); } } return Flw.Intervalle.createWithTab( te ); }, union : function( ia , ib ){ ib = ib || this; var ta = ia._tab; var tb = ib._tab; var te = []; var b=0,a=0; while( a < ta.length || b < tb.length ){ if( a < ta.length && ( b >= tb.length || ta[a].a < tb[b].a ) ){ if( te.length == 0 ) te.push( { a : ta[a].a , b : ta[a].b } ); else if( ta[a].a <= te[ te.length -1 ].b ) te[ te.length -1 ].b = ta[a].b; else te.push( { a : ta[a].a , b : ta[a].b } ); a ++; } else { if( te.length == 0 ) te.push( { a : tb[b].a , b : tb[b].b } ); else if( tb[b].a <= te[ te.length -1 ].b ) te[ te.length -1 ].b = tb[b].b; else te.push( { a : tb[b].a , b : tb[b].b } ); b ++; } } return Flw.Intervalle.createWithTab( te ); }, // a optimiser intersection : function( ia , ib ){ ib = ib || this; var ta = ia._tab; var tb = ib._tab; var te = []; var b=0,a=0; for( ; a < ta.length ; a ++ ){ for( b=0; b < tb.length && tb[b].b < ta[a].a ; b ++ ); for( ; b < tb.length && tb[b].a < ta[a].b ; b ++ ) te.push( { a : Math.max( ta[a].a , tb[b].a ) , b : Math.min( ta[a].b , tb[b].b ) } ); } return Flw.Intervalle.createWithTab( te ); }, draw : function( ctx , r ){ var r = r || 50; var colorChart = [ "blue", "yellow", "red", "green", "pink" ]; ctx.save(); ctx.globalAlpha = 0.2; ctx.lineWidth = 1; ctx.strokeStyle = "black"; for( var i = 0 ; i < this._tab.length ; i ++ ){ if( this._tab[ i ].a == 0 && this._tab[ i ].b == Math.PI*2 ); ctx.beginPath(); ctx.moveTo( 0 , 0 ); ctx.arc( 0 , 0 , r , this._tab[ i ].a , this._tab[ i ].b , false ); ctx.lineTo( 0 , 0 ); ctx.fillStyle = colorChart[ i % colorChart.length ]; ctx.fill(); ctx.stroke(); } ctx.restore(); } } Flw.Intervalle.createWithTab = function( t ){ var i = new Flw.Intervalle(); i.initWithTab( t ); return i; } Flw.Intervalle.createWithBornes = function( a , b ){ if( typeof( a ) != "number" || typeof( b ) != "number" || isNaN( a ) || isNaN( b ) ) throw "init with bornes which are not numbers"; var i = new Flw.Intervalle(); i.initWithBornes( a , b ); return i; } Flw.Intervalle.create = function( ){ var i = new Flw.Intervalle(); switch( arguments.length ){ case 1 : if( arguments[0] instanceof Array ) i.initWithTab( a , b ); break; case 2 : if( typeof( arguments[0] ) == "number" && typeof( arguments[1] ) == "number" ) i.initWithBornes( arguments[0] , arguments[1] ); break; } return i; }
24.840237
89
0.486899
12e21e56b6deba2050b30ef0f7787e385f9d91b8
1,421
js
JavaScript
src/App.js
breadoliveoilsalt/blog-post-sample-code-190711
a7423f74991cd4bbf8c66fc700d947a73d46b190
[ "MIT" ]
null
null
null
src/App.js
breadoliveoilsalt/blog-post-sample-code-190711
a7423f74991cd4bbf8c66fc700d947a73d46b190
[ "MIT" ]
6
2020-09-06T11:04:45.000Z
2022-02-18T05:17:08.000Z
src/App.js
breadoliveoilsalt/blog-post-sample-code-190711
a7423f74991cd4bbf8c66fc700d947a73d46b190
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import { connect } from 'react-redux' import { startLoader, stopLoader } from './actionCreators' import Loader from './components_presentational/Loader' import InfoPage from './components_presentational/InfoPage' export class App extends Component { constructor(props) { super(props) this.handleLoaderStart = this.handleLoaderStart.bind(this) this.handleLoaderStop = this.handleLoaderStop.bind(this) } handleLoaderStart(event) { event.preventDefault() this.props.dispatchStartLoader() } handleLoaderStop(event) { event.preventDefault() this.props.dispatchStopLoader() } render() { if (this.props.loaderRunning) { return ( <div> <Loader /> <a href="" onClick={this.handleLoaderStop}> Click to Stop Loader and See Info Page </a> </div> ) } else if (!this.props.loaderRunning) { return ( <div> <InfoPage /> <a href="" onClick={this.handleLoaderStart}> Click to Start Loader </a> </div> ) } } } const mapStateToProps = (state) => { return { loaderRunning: state.loaderRunning } } const mapDispatchToProps = (dispatch) => { return { dispatchStartLoader: () => dispatch(startLoader()), dispatchStopLoader: () => dispatch(stopLoader()) } } export default connect(mapStateToProps, mapDispatchToProps)(App)
23.683333
97
0.654469
12e277ea16a391cd5bb951950b9e0ee167f9b4bf
253
js
JavaScript
web/src/layouts/BlogLayout/BlogLayout.test.js
clairefro/redwood-blog
ec5edfaa4da7d275ebd87c93de37d7cbfefa6e2e
[ "MIT" ]
null
null
null
web/src/layouts/BlogLayout/BlogLayout.test.js
clairefro/redwood-blog
ec5edfaa4da7d275ebd87c93de37d7cbfefa6e2e
[ "MIT" ]
3
2021-09-02T10:14:50.000Z
2022-02-27T09:02:41.000Z
web/src/layouts/BlogLayout/BlogLayout.test.js
clairefro/redwood-blog
ec5edfaa4da7d275ebd87c93de37d7cbfefa6e2e
[ "MIT" ]
null
null
null
import { render } from '@redwoodjs/testing' import BlogLayoutLayout from './BlogLayoutLayout' describe('BlogLayoutLayout', () => { it('renders successfully', () => { expect(() => { render(<BlogLayoutLayout />) }).not.toThrow() }) })
21.083333
49
0.620553
12e3622d7e7d99645b890cd7e0b990f05b8c0feb
4,382
js
JavaScript
e2e/fixtures/events/defendantResponse.js
uk-gov-mirror/hmcts.unspec-service
b97ee9fe71089f40a30b49132be506fc67e87ada
[ "MIT" ]
3
2020-08-24T12:36:25.000Z
2021-02-04T05:42:18.000Z
e2e/fixtures/events/defendantResponse.js
uk-gov-mirror/hmcts.unspec-service
b97ee9fe71089f40a30b49132be506fc67e87ada
[ "MIT" ]
711
2020-07-14T10:50:33.000Z
2021-04-14T08:07:52.000Z
e2e/fixtures/events/defendantResponse.js
hmcts/ucmc-service
669d4bde49ee96ba5513774b690a5cb83ffb2680
[ "MIT" ]
2
2020-11-13T16:31:40.000Z
2021-04-10T22:33:56.000Z
const { date, document, element, buildAddress } = require('../../api/dataHelper'); module.exports = { valid: { RespondentResponseType: { respondent1ClaimResponseType: 'FULL_DEFENCE' }, Upload: { respondent1ClaimResponseDocument: { file: document('claimResponse.pdf') } }, ConfirmNameAddress: {}, ConfirmDetails: { respondent1: { type: 'INDIVIDUAL', individualFirstName: 'John', individualLastName: 'Doe', individualTitle: 'Sir', individualDateOfBirth: date(-1), primaryAddress: buildAddress('respondent') }, solicitorReferences: { applicantSolicitor1Reference: 'Applicant reference', respondentSolicitor1Reference: 'Respondent reference' } }, FileDirectionsQuestionnaire: { respondent1DQFileDirectionsQuestionnaire: { explainedToClient: ['CONFIRM'], oneMonthStayRequested: 'Yes', reactionProtocolCompliedWith: 'Yes' } }, DisclosureOfElectronicDocuments: { respondent1DQDisclosureOfElectronicDocuments: { reachedAgreement: 'No', agreementLikely: 'Yes' } }, DisclosureOfNonElectronicDocuments: { respondent1DQDisclosureOfNonElectronicDocuments: { directionsForDisclosureProposed: 'Yes', standardDirectionsRequired: 'Yes', bespokeDirections: 'directions' } }, Experts: { respondent1DQExperts: { expertRequired: 'Yes', expertReportsSent: 'NOT_OBTAINED', jointExpertSuitable: 'Yes', details: [ element({ name: 'John Doe', fieldOfExpertise: 'None', whyRequired: 'Testing', estimatedCost: '10000' }) ] } }, Witnesses: { respondent1DQWitnesses: { witnessesToAppear: 'Yes', details: [ element({ name: 'John Doe', reasonForWitness: 'None' }) ] } }, Hearing: { respondent1DQHearing: { hearingLength: 'MORE_THAN_DAY', hearingLengthDays: 5, unavailableDatesRequired: 'Yes', unavailableDates: [ element({ date: date(10), who: 'Foo Bar' }) ] } }, DraftDirections: { respondent1DQDraftDirections: document('draftDirections.pdf') }, RequestedCourt: { respondent1DQRequestedCourt: { responseCourtCode: '343', reasonForHearingAtSpecificCourt: 'No reasons', requestHearingAtSpecificCourt: 'Yes' } }, HearingSupport: {}, FurtherInformation: { respondent1DQFurtherInformation: { futureApplications: 'Yes', otherInformationForJudge: 'Nope', reasonForFutureApplications: 'Nothing' } }, Language: { respondent1DQLanguage: { evidence: 'WELSH', court: 'WELSH', documents: 'WELSH' } }, StatementOfTruth: { respondent1DQStatementOfTruth: { name: 'John Doe', role: 'Tester' } } }, invalid: { ConfirmDetails: { futureDateOfBirth: { respondent1: { type: 'INDIVIDUAL', individualFirstName: 'John', individualLastName: 'Doe', individualTitle: 'Sir', individualDateOfBirth: date(1), primaryAddress: buildAddress('respondent') } } }, Experts: { emptyDetails: { respondent1DQExperts: { details: [], expertRequired: 'Yes', exportReportsSent: 'NOT_OBTAINED', jointExpertSuitable: 'Yes' } } }, Hearing: { past: { respondent1DQHearing: { hearingLength: 'MORE_THAN_DAY', hearingLengthDays: 5, unavailableDatesRequired: 'Yes', unavailableDates: [ element({ date: date(-1), who: 'Foo Bar' }) ] } }, moreThanYear: { respondent1DQHearing: { hearingLength: 'MORE_THAN_DAY', hearingLengthDays: 5, unavailableDatesRequired: 'Yes', unavailableDates: [ element({ date: date(367), who: 'Foo Bar' }) ] } } }, } };
25.476744
82
0.549064
12e373f24b3ab7098d5c6621f96d365dd43dc4ad
252
js
JavaScript
app/themes/navigationTheme.js
IT114118-FYP/Roomac-Mobile
5e266bf53049520c4b9c182f2790e4a7c1bbe9e2
[ "MIT" ]
null
null
null
app/themes/navigationTheme.js
IT114118-FYP/Roomac-Mobile
5e266bf53049520c4b9c182f2790e4a7c1bbe9e2
[ "MIT" ]
null
null
null
app/themes/navigationTheme.js
IT114118-FYP/Roomac-Mobile
5e266bf53049520c4b9c182f2790e4a7c1bbe9e2
[ "MIT" ]
null
null
null
import { DefaultTheme } from "@react-navigation/native"; import colors from "./colors"; const navigationTheme = { ...DefaultTheme, colors: { ...DefaultTheme.colors, background: colors.backgroundSecondary, }, }; export default navigationTheme;
19.384615
56
0.730159
12e3d1f3a671e679153dd32eae6160e05f4ece8a
446
js
JavaScript
src/router/teachers.js
big-faced-cat/discussClass
4e4abddaa4f25ea5cf41a06443265992648cbfeb
[ "MIT" ]
2
2020-07-01T10:03:59.000Z
2020-07-01T10:04:04.000Z
src/router/teachers.js
big-faced-cat/discussClass
4e4abddaa4f25ea5cf41a06443265992648cbfeb
[ "MIT" ]
null
null
null
src/router/teachers.js
big-faced-cat/discussClass
4e4abddaa4f25ea5cf41a06443265992648cbfeb
[ "MIT" ]
null
null
null
import Content from "../components/Content" /** * 教师管理 */ module.exports = { path: "teachers", name: "teachers", component: Content, children: [ { path: "/", redirect: { name: "teachersList" } }, { path: "list", name: "teachersList", component: () => import('../views/teachers/teachersList.vue'), } ] };
19.391304
74
0.434978
12e3e2a9de79ddd9d9d132ea9b49e42deb172a4d
2,770
js
JavaScript
src/components/LandingPage/LandingPage.js
renatadev/t4b-g2h
b45e13122c2d6a52e7e0682471640e1e0d401bf4
[ "AAL" ]
null
null
null
src/components/LandingPage/LandingPage.js
renatadev/t4b-g2h
b45e13122c2d6a52e7e0682471640e1e0d401bf4
[ "AAL" ]
null
null
null
src/components/LandingPage/LandingPage.js
renatadev/t4b-g2h
b45e13122c2d6a52e7e0682471640e1e0d401bf4
[ "AAL" ]
null
null
null
import React from "react"; import Img from "../styles/Img.style"; import * as SC from "./LandingPage.style.js"; const LandingPage = () => { return ( <SC.Landing> <h2> “Protecting Britain's cultural institutions, the guardians of our local history. Showcasing our cultures, traditions and history by preserving and narrating their stories online.” </h2> <section> <article> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.londonandpartners.com/asset/victoria-and-albert-museum_the-john-madejski-garden-photo-james-medcraft-image-courtesy-of-the-victoria-and-albert-museum_339851f982d07c0a80cee498b4366062.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.londonandpartners.com/asset/victoria-and-albert-museum_the-john-madejski-garden-photo-james-medcraft-image-courtesy-of-the-victoria-and-albert-museum_339851f982d07c0a80cee498b4366062.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> </article> <article> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.londonandpartners.com/asset/victoria-and-albert-museum_the-john-madejski-garden-photo-james-medcraft-image-courtesy-of-the-victoria-and-albert-museum_339851f982d07c0a80cee498b4366062.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.londonandpartners.com/asset/victoria-and-albert-museum_the-john-madejski-garden-photo-james-medcraft-image-courtesy-of-the-victoria-and-albert-museum_339851f982d07c0a80cee498b4366062.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> </article> <article> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.londonandpartners.com/asset/victoria-and-albert-museum_the-john-madejski-garden-photo-james-medcraft-image-courtesy-of-the-victoria-and-albert-museum_339851f982d07c0a80cee498b4366062.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> <SC.MuseumContainer> <SC.ImgContainer> <Img src="https://cdn.getyourguide.com/img/tour_img-2462135-146.jpg" /> </SC.ImgContainer> <p>Collection name</p> </SC.MuseumContainer> </article> </section> </SC.Landing> ); }; export default LandingPage;
44.677419
226
0.638628
12e44101e741e1a3bbaecb87b375830d8f02f9a8
567
js
JavaScript
plugins/cwksmabohay.js
tsaqifattaqi1/t
1675785c85b8d5a600f1b7dd3476379f4f5f3da1
[ "MIT" ]
null
null
null
plugins/cwksmabohay.js
tsaqifattaqi1/t
1675785c85b8d5a600f1b7dd3476379f4f5f3da1
[ "MIT" ]
null
null
null
plugins/cwksmabohay.js
tsaqifattaqi1/t
1675785c85b8d5a600f1b7dd3476379f4f5f3da1
[ "MIT" ]
null
null
null
let fetch = require("node-fetch") let handler = async (m, { conn }) => { let src = await (await fetch('https://raw.githubusercontent.com/irwanx/Asupan/master/gabut/cewesmabohay1.json')).json() let json = src[Math.floor(Math.random() * src.length)] await conn.sendFile(m.chat, json.url, 'bohay.jpg', 'Nihh', m, false, { contextInfo: { forwardingScore: 999, isForwarded: true }}) } handler.help = ['ceweksmabohay'] handler.tags = ['dewasa', 'update'] handler.command = /^ceweksmabohay/i handler.private = true handler.premium = true module.exports = handler
40.5
137
0.700176
12e587651fa51d0af0f20c16e2a4eda4c6919f77
23,299
js
JavaScript
test/stress-client.js
joyent/moray-test-suite
a825697d4b5ea66243017de7891eb306e8375d62
[ "MIT" ]
null
null
null
test/stress-client.js
joyent/moray-test-suite
a825697d4b5ea66243017de7891eb306e8375d62
[ "MIT" ]
null
null
null
test/stress-client.js
joyent/moray-test-suite
a825697d4b5ea66243017de7891eb306e8375d62
[ "MIT" ]
3
2016-11-08T16:21:26.000Z
2020-11-25T10:33:51.000Z
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Copyright (c) 2016, Joyent, Inc. */ /* * stress-client.js: run the client through a lot of different code paths for an * extended period. The intent is to help identify memory leaks by monitoring * this process's memory usage over time. * * We want to exercise: * * - making RPC requests when disconnected (both never-connected and * transiently-disconnected cases) * - repeated connection/disconnection * - failed RPC calls for each type of request (failure path) * - successful RPC calls for each type of request (success path) * - RPC requests that time out * * That list should include any operation with a client that programs might do a * large number of times over a long lifetime. * * This works as follows: there are a number of top-level commands, represented * with functions that execute a command (like making a particular RPC request). * When each function completes, it gets executed again. This goes on until the * user kills the process. * * This program opens a Kang server on port 9080 for inspecting progress. */ var assertplus = require('assert-plus'); var bunyan = require('bunyan'); var cmdutil = require('cmdutil'); var kang = require('kang'); var moray = require('moray'); var net = require('net'); var os = require('os'); var vasync = require('vasync'); var VError = require('verror'); var helper = require('./helper'); var scTestBucketBogus = 'stress_client_bogus_bucket'; var scTestBucketInvalid = 'buckets can\'t have spaces!'; var scTestBucket = 'stress_client_bucket'; var scKangPort = 9080; var scCommands = []; var scLog, scServer; /* * We require that each of our top-level test commands complete one iteration * every "scWatchdogLimit" milliseconds. Otherwise, a call has likely hung, and * we'll bail out. */ var scWatchdogLimit = 30000; function main() { scLog = new bunyan({ 'name': 'stress-client', 'level': process.env['LOG_LEVEL'] || 'fatal' }); console.error('pid %d: setting up', process.pid); kang.knStartServer({ 'port': scKangPort, 'uri_base': '/kang', 'service_name': 'moray-client-stress', 'version': '1.0.0', 'ident': os.hostname(), 'list_types': knListTypes, 'list_objects': knListObjects, 'get': knGetObject }, function () { /* * First, set up a server that all clients can use. */ helper.createServer(null, function (s) { scServer = s; /* * Now initialize each of the commands and start them running. */ vasync.forEachParallel({ 'inputs': scCommands, 'func': scCommandStart }, function (err) { if (err) { cmdutil.fail(new VError('setup')); } scLog.debug('set up all commands'); console.error('set up all commands'); }); }); }); } function knListTypes() { return ([ 'cmd' ]); } function knListObjects(type) { assertplus.equal(type, 'cmd'); return (scCommands.map(function (_, i) { return (i); })); } function knGetObject(type, which) { var cmdspec; assertplus.equal(type, 'cmd'); cmdspec = scCommands[which]; return ({ 'label': cmdspec.name, 'funcname': cmdspec.exec.name, 'nstarted': cmdspec.ctx.nstarted, 'lastStarted': cmdspec.ctx.lastStarted }); } function scCommandStart(cmdspec, callback) { cmdspec.ctx = {}; cmdspec.ctx.nstarted = 0; cmdspec.ctx.lastStarted = null; cmdspec.ctx.setupStarted = new Date(); cmdspec.ctx.setupDone = null; cmdspec.ctx.log = scLog.child({ 'cmdname': cmdspec.exec.name || cmdspec.name }); cmdspec.ctx.timer = null; cmdspec.setup(cmdspec.ctx, function (err) { if (err) { callback(new VError(err, 'setup command "%s"', cmdspec.name)); return; } cmdspec.ctx.setupDone = new Date(); scCommandLoop(cmdspec); callback(); }); } function scCommandLoop(cmdspec) { cmdspec.ctx.nstarted++; cmdspec.ctx.log.debug({ 'iteration': cmdspec.ctx.nstarted }, 'starting iteration'); cmdspec.ctx.lastStarted = new Date(); cmdspec.ctx.timer = setTimeout(scWatchdogFire, scWatchdogLimit, cmdspec); cmdspec.exec(cmdspec.ctx, function (err) { clearTimeout(cmdspec.ctx.timer); if (err) { err = new VError(err, 'exec command "%s"', cmdspec.name); cmdspec.ctx.log.fatal(err); throw (err); } setImmediate(scCommandLoop, cmdspec); }); } function scWatchdogFire(cmdspec) { /* * This is basically going to be undebuggable without a core file. We may * as well abort straight away rather than hoping the user ran with * --abort-on-uncaught-exception. */ console.error('watchdog timer expired for command: "%s"', cmdspec.name); console.error('aborting (to dump core)'); process.abort(); } function ignoreErrorTypes(err, errtypes) { var i; assertplus.optionalObject(err); assertplus.arrayOfString(errtypes, 'errtypes'); if (!err) { return (err); } assertplus.ok(err instanceof Error); for (i = 0; i < errtypes.length; i++) { if (VError.findCauseByName(err, errtypes[i]) !== null) { return (null); } } return (err); } function cbIgnoreErrorTypes(callback, errtypes) { return (function (err) { var args = Array.prototype.slice.call(arguments, 1); args.unshift(ignoreErrorTypes(err, errtypes)); callback.apply(null, args); }); } /* * Command definitions */ /* * This loop exercises code paths associated with sending RPC requests before * we've ever established a connection. */ scCommands.push({ 'name': 'make RPC requests before ever connected', 'setup': function cmdRpcNeverConnectedSetup(ctx, callback) { /* * Configure the client with a hostname that doesn't exist so that it * will never connect. */ ctx.client = moray.createClient({ 'log': ctx.log.child({ 'component': 'MorayClient' }), 'host': 'bogus_hostname', 'port': 2020 }); callback(); }, 'exec': function cmdRpcNeverConnected(ctx, callback) { ctx.client.listBuckets(function (err) { if (VError.findCauseByName(err, 'NoBackendsError') !== null) { err = null; } callback(err); }); } }); /* * This loop exercises the code paths associated with sending RPC requests while * we have no connection (but we previously had one). This is largely the same * as the previous case, but could result in different code paths. */ scCommands.push({ 'name': 'make RPC requests after connection closed', 'setup': function cmdRpcDisconnectedSetup(ctx, callback) { helper.createServer({ 'portOverride': 2021 }, function (s) { ctx.server = s; ctx.client = moray.createClient({ 'log': ctx.log.child({ 'component': 'MorayClient' }), 'host': '127.0.0.1', 'port': 2021 }); ctx.client.on('connect', function () { helper.cleanupServer(ctx.server, callback); }); }); }, 'exec': function cmdRpcDisconnected(ctx, callback) { ctx.client.listBuckets(function (err) { if (!err) { callback(new VError('expected error')); } else { callback(); } }); } }); /* * This loop exercises connect/reconnect paths. */ scCommands.push({ 'name': 'disconnect/reconnect repeatedly', 'setup': function cmdRpcReconnectSetup(ctx, callback) { ctx.client = moray.createClient({ 'log': ctx.log.child({ 'component': 'MorayClient' }), 'host': '127.0.0.1', 'port': 2022, 'maxConnections': 1, 'retry': { 'minTimeout': 50, 'maxTimeout': 50 } }); callback(); }, 'exec': function cmdRpcReconnect(ctx, callback) { /* * Our goal is to execute this sequence: * * - set up a server * - wait for the client to connect to the server * - shut down the server * - wait for the client to see that the server is shutdown * * Our challenge is that the client deliberately abstracts over * reconnection, so it doesn't expose the events we intend to wait for. * So we accomplish the above using this sequence instead: * * - set up a server * - make requests in a loop using the client until one of them * succeeds (meaning we've established a connection to our server) * - close the server * - make request using the client and verify that it fails * (meaning that the server has shut down) * * Importantly, we never instantiate a new client, since we're trying to * make sure that a single long-lived client doesn't leak memory in * these conditions. * * The fact that we use a separate process server here is extremely * expensive, and means that we don't end up iterating very quickly on * this command. However, we need at least one request to succeed, * which means we need a real Moray server. */ ctx.server = null; ctx.nloops = 0; ctx.maxloops = 100; ctx.pipeline = vasync.pipeline({ 'funcs': [ function cmdRpcReconnectSetupServer(_, subcallback) { ctx.log.debug('creating server'); helper.createServer({ 'portOverride': 2022 }, function (s) { ctx.log.debug('server up'); ctx.server = s; subcallback(); }); }, function cmdRpcReconnectClientLoop(_, subcallback) { ctx.client.ping(function (err) { ctx.nloops++; if (err && ctx.nloops <= ctx.maxloops) { ctx.log.debug(err, 'ignoring transient error', { 'nloops': ctx.nloops }); setTimeout(cmdRpcReconnectClientLoop, 100, _, subcallback); return; } if (err) { err = new VError(err, 'too many transient errors'); } subcallback(err); }); }, function cmdRpcReconnectShutdown(_, subcallback) { ctx.log.debug('shutting down server'); helper.cleanupServer(ctx.server, subcallback); }, function cmdRpcReconnectClientFail(_, subcallback) { ctx.log.debug('making final client request'); ctx.client.ping({ 'timeout': 5000 }, function (err) { if (err) { if (VError.findCauseByName( err, 'NoBackendsError') !== null || VError.findCauseByName( err, 'FastTransportError') !== null || VError.findCauseByName( err, 'FastProtocolError') !== null) { err = null; } else { err = new VError(err, 'unexpected error'); } } else { err = new VError('unexpected success'); } subcallback(err); }); } ] }, callback); } }); /* * This loop exercises failure cases for each of the supported RPC requests. */ scCommands.push({ 'name': 'failed RPC requests', 'setup': function cmdRpcFailSetup(ctx, callback) { ctx.client = helper.createClient(); ctx.client.on('connect', callback); }, 'exec': function cmdRpcFail(ctx, callback) { ctx.pipeline = vasync.pipeline({ 'arg': null, 'funcs': [ /* * There's a test function for each of the supported RPC calls * that we can cause to fail reliably (and safely). The * listBuckets(), ping(), and version() RPC calls do not appear * to have reliable ways to trigger failure. * * These test functions appear in the same order as the * corresponding RPC calls are registered in the Moray server's * lib/server.js. */ function cmdRpcFailCreateBucket(_, subcallback) { ctx.client.createBucket(scTestBucketInvalid, {}, cbIgnoreErrorTypes( subcallback, [ 'InvalidBucketNameError' ])); }, function cmdRpcFailGetBucket(_, subcallback) { ctx.client.getBucket(scTestBucketBogus, cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailUpdateBucket(_, subcallback) { ctx.client.updateBucket(scTestBucketBogus, {}, cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailDeleteBucket(_, subcallback) { ctx.client.deleteBucket(scTestBucketBogus, cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailPutObject(_, subcallback) { ctx.client.putObject(scTestBucketBogus, 'key', {}, cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailBatch(_, subcallback) { ctx.client.batch([ { 'bucket': scTestBucketBogus, 'operation': 'update', 'fields': {}, 'filter': 'x=*' } ], cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailGetObject(_, subcallback) { ctx.client.getObject(scTestBucketBogus, 'key', cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailDelObject(_, subcallback) { ctx.client.delObject(scTestBucketBogus, 'key', cbIgnoreErrorTypes( subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailFindObjects(_, subcallback) { var req = ctx.client.findObjects(scTestBucketBogus, 'key=value'); req.on('error', function (err) { err = ignoreErrorTypes(err, [ 'BucketNotFoundError' ]); subcallback(err); }); req.on('end', function () { throw (new Error('unexpected "end"')); }); }, function cmdRpcFailUpdateObjects(_, subcallback) { ctx.client.updateObjects(scTestBucketBogus, {}, 'key=value', cbIgnoreErrorTypes(subcallback, [ 'FieldUpdateError' ])); }, function cmdRpcFailReindexObjects(_, subcallback) { ctx.client.reindexObjects(scTestBucketBogus, 3, cbIgnoreErrorTypes(subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailDeleteMany(_, subcallback) { ctx.client.deleteMany(scTestBucketBogus, 'x=y', cbIgnoreErrorTypes(subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcFailGetTokens(_, subcallback) { ctx.client.getTokens(function (err) { assertplus.ok(err); assertplus.ok(/Operation not supported$/.test( err.message)); subcallback(); }); }, function cmdRpcFailSql(_, subcallback) { var req = ctx.client.sql('SELECT ctid from bogus;'); req.on('error', function (err) { /* JSSTYLED */ assertplus.ok(/relation "bogus" does not exist$/.test( err.message)); subcallback(); }); req.on('end', function () { throw (new Error('unexpected "end"')); }); } ] }, callback); } }); /* * This loop exercises success cases for each of the supported RPC requests. */ scCommands.push({ 'name': 'successful RPC requests', 'setup': function cmdRpcOkaySetup(ctx, callback) { ctx.client = helper.createClient(); ctx.client.on('connect', callback); }, 'exec': function cmdRpcOkay(ctx, callback) { ctx.pipeline = vasync.pipeline({ 'arg': null, 'funcs': [ /* * There's a test function for each of the supported RPC calls * that we can use successfully. This excludes getTokens(), * which only succeeds for electric-moray. The order is * different than the failure cases above because it's simpler * to create a working sequence in this order. deleteBucket * appears twice to deal with unclean exits. * * This sequence is replicated in cli-sanity.test.js for * command-line tools. Updates here should be propagated there. */ function cmdRpcOkayDeleteBucketCleanup(_, subcallback) { ctx.client.deleteBucket(scTestBucket, cbIgnoreErrorTypes(subcallback, [ 'BucketNotFoundError' ])); }, function cmdRpcOkayCreateBucket(_, subcallback) { ctx.client.createBucket(scTestBucket, {}, subcallback); }, function cmdRpcOkayGetBucket(_, subcallback) { ctx.client.getBucket(scTestBucket, subcallback); }, function cmdRpcOkayListBuckets(_, subcallback) { ctx.client.listBuckets(subcallback); }, function cmdRpcOkayUpdateBucket(_, subcallback) { ctx.client.updateBucket(scTestBucket, { 'index': { 'field1': { 'type': 'number' } } }, subcallback); }, function cmdRpcOkayPutObject(_, subcallback) { ctx.client.putObject(scTestBucket, 'key5', { 'field1': 5 }, subcallback); }, function cmdRpcOkayBatch(_, subcallback) { ctx.client.batch([ { 'bucket': scTestBucket, 'operation': 'put', 'key': 'key2', 'value': { 'field1': 2 } }, { 'bucket': scTestBucket, 'operation': 'put', 'key': 'key3', 'value': { 'field1': 3 } }, { 'bucket': scTestBucket, 'operation': 'put', 'key': 'key7', 'value': { 'field1': 7 } }, { 'bucket': scTestBucket, 'operation': 'put', 'key': 'key9', 'value': { 'field1': 9 } } ], subcallback); }, function cmdRpcOkayGetObject(_, subcallback) { ctx.client.getObject(scTestBucket, 'key3', subcallback); }, function cmdRpcOkayDelObject(_, subcallback) { ctx.client.delObject(scTestBucket, 'key5', subcallback); }, function cmdRpcOkayFindObjects(_, subcallback) { var req = ctx.client.findObjects(scTestBucket, 'field1>=3'); req.on('error', function (err) { subcallback(new VError(err, 'unexpected error')); }); req.on('end', function () { subcallback(); }); }, function cmdRpcOkayUpdateObjects(_, subcallback) { ctx.client.updateObjects(scTestBucket, { 'field1': 10 }, 'field1>=9', subcallback); }, function cmdRpcOkayReindexObjects(_, subcallback) { ctx.client.reindexObjects(scTestBucket, 3, subcallback); }, function cmdRpcOkayDeleteMany(_, subcallback) { ctx.client.deleteMany(scTestBucket, 'field1>=7', subcallback); }, function cmdRpcOkayDeleteBucket(_, subcallback) { ctx.client.deleteBucket(scTestBucket, subcallback); }, function cmdRpcOkayPing(_, subcallback) { ctx.client.ping(subcallback); }, function cmdRpcOkayVersion(_, subcallback) { ctx.client.versionInternal(subcallback); }, function cmdRpcOkaySql(_, subcallback) { var req = ctx.client.sql('SELECT NOW();'); req.on('error', function (err) { subcallback(new VError(err, 'unexpected error')); }); req.on('end', function () { subcallback(); }); } ] }, callback); } }); main();
34.931034
80
0.506116
12e69b156bc29b0c1e66692a4bf633f286cda3c5
760
js
JavaScript
src/components/auth/Login/validate.js
petar096/chat-app
3795da6056f53a66434ce86e9920fd06d18b2d95
[ "MIT" ]
null
null
null
src/components/auth/Login/validate.js
petar096/chat-app
3795da6056f53a66434ce86e9920fd06d18b2d95
[ "MIT" ]
7
2020-07-18T20:56:55.000Z
2022-02-26T20:22:25.000Z
src/components/auth/Login/validate.js
petar096/chat-app
3795da6056f53a66434ce86e9920fd06d18b2d95
[ "MIT" ]
null
null
null
export const validate = values => { const errors = {}; // password validator if (!values.password) { errors.password = 'Password is Required'; } else if (values.password.length > 15) { errors.password = 'Must be 15 characters or less'; } else if (values.password.length < 3) { errors.password = 'Must be longer than 3 characters'; } // email validator if (!values.email) { errors.email = 'Email is Required'; } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) { errors.email = 'Invalid email address'; } return errors; }; export const warn = values => { const warnings = {}; if (values.email && values.email.includes('admin.com')) { warnings.email = 'Hmm, that looks little sketchy'; } return warnings; };
27.142857
78
0.646053
12e73532e276578d347e53f3955db5793e74dbb8
2,908
js
JavaScript
diy/ch03/tests/unit/sliderPuzzle.spec.js
SafeWinter/vue3-by-example
6a7208dbd81c2ac7f4f76badffcc1f34d1102cd7
[ "MIT" ]
null
null
null
diy/ch03/tests/unit/sliderPuzzle.spec.js
SafeWinter/vue3-by-example
6a7208dbd81c2ac7f4f76badffcc1f34d1102cd7
[ "MIT" ]
null
null
null
diy/ch03/tests/unit/sliderPuzzle.spec.js
SafeWinter/vue3-by-example
6a7208dbd81c2ac7f4f76badffcc1f34d1102cd7
[ "MIT" ]
null
null
null
import { mount } from '@vue/test-utils'; import SliderPuzzle from '@/components/SliderPuzzle.vue'; import 'jest-localstorage-mock'; describe('Testing component SliderPuzzle.vue', () => { it('No.1: inserts the index of the image to swap when we click on an image', () => { const wrapper = mount(SliderPuzzle); wrapper.find('#start-button').trigger('click'); wrapper.find('img').trigger('click'); expect(wrapper.vm.indexesToSwap.length).toBeGreaterThan(0); }); it('No.2: swaps the image order when 2 images are clicked', () => { const wrapper = mount(SliderPuzzle); wrapper.find('#start-button').trigger('click'); const [img01, img02] = wrapper.vm.shuffledPuzzleArray; wrapper.get('.column:nth-child(1) img').trigger('click'); wrapper.get('.column:nth-child(2) img').trigger('click'); expect(wrapper.vm.indexesToSwap.length).toBe(0); const [img11, img12] = wrapper.vm.shuffledPuzzleArray; expect(img01).toBe(img12); expect(img02).toBe(img11); }); it('No.3: starts timer when start method is called', () => { jest.spyOn(window, 'setInterval'); const wrapper = mount(SliderPuzzle); wrapper.vm.start(); expect(setInterval).toHaveBeenCalledTimes(1); expect(setInterval).toHaveBeenLastCalledWith(expect.any(Function), 1000); }); it('No.4: stops timer when stop method is called', () => { jest.spyOn(window, 'clearInterval'); const wrapper = mount(SliderPuzzle); wrapper.vm.stop(); expect(clearInterval).toHaveBeenCalledTimes(1); }); it('No.5: records record to local storage.', () => { const wrapper = mount(SliderPuzzle, { data() { const now = new Date(); return { startDateTime: now, currentDateTime: now, }; }, }); wrapper.vm.recordSpeedRecords(); const { elapsedDiff, elapsedTime } = wrapper.vm; const target = JSON.stringify([{ elapsedDiff, elapsedTime }]); expect(localStorage.setItem).toHaveBeenCalledWith('records', target); }); it('No.6: starts timer with Start button is clicked', () => { jest.spyOn(window, 'setInterval'); const wrapper = mount(SliderPuzzle); wrapper.find('#start-button').trigger('click'); expect(setInterval).toHaveBeenCalledTimes(1); }); it('No.7: stops timer with Quit button is clicked', () => { jest.spyOn(window, 'clearInterval'); const wrapper = mount(SliderPuzzle); wrapper.find('#quit-button').trigger('click'); expect(clearInterval).toHaveBeenCalledTimes(1); }); it('No.8: shows the elapsed time', () => { const wrapper = mount(SliderPuzzle, { data() { return { startDateTime: new Date(2021, 0, 1, 0, 0, 0), currentDateTime: new Date(2021, 0, 1, 0, 0, 1), }; }, }); expect(wrapper.html()).toContain('00:00:01'); }); afterEach(() => { jest.clearAllMocks(); }); });
32.674157
86
0.635488
12e73d6e1e4d97fac8db68b8d0ce0fd9f8bb280f
4,979
js
JavaScript
lib/rules/number-max-precision/__tests__/index.js
iamcerebrocerberus/stylelint
490226be9952bd1291de16a10ce1c4a559a7b5a8
[ "MIT" ]
1
2019-11-30T06:20:02.000Z
2019-11-30T06:20:02.000Z
lib/rules/number-max-precision/__tests__/index.js
iamcerebrocerberus/stylelint
490226be9952bd1291de16a10ce1c4a559a7b5a8
[ "MIT" ]
33
2022-02-06T22:17:13.000Z
2022-03-28T03:20:19.000Z
lib/rules/number-max-precision/__tests__/index.js
iamcerebrocerberus/stylelint
490226be9952bd1291de16a10ce1c4a559a7b5a8
[ "MIT" ]
null
null
null
'use strict'; const { messages, ruleName } = require('..'); testRule({ ruleName, config: [2], accept: [ { code: 'a { top: 3px /* 3.12345px */; }', }, { code: 'a::before { content: "3.12345px"; }', }, { code: 'a::before { cOnTeNt: "3.12345px"; }', }, { code: 'a::before { CONTENT: "3.12345px"; }', }, { code: 'a { top: 3%; }', }, { code: 'a { top: 3.1%; }', }, { code: 'a { top: 3.12%; }', }, { code: 'a { padding: 6.1% 3.12%; }', }, { code: '@media (min-width: 5.12em) {}', }, { code: "@import '1.123.css'", }, { code: "@IMPORT '1.123.css'", }, { code: 'a { background: url(1.123.jpg) }', }, { code: 'a { my-string: "1.2345"; }', description: "ignore all strings rather than only in 'content'", }, ], reject: [ { code: 'a { top: 3.123%; }', message: messages.expected(3.123, 3.12), line: 1, column: 10, }, { code: 'a { padding: 6.123% 3.1%; }', message: messages.expected(6.123, 6.12), line: 1, column: 14, }, { code: '@media (min-width: 5.123em) {}', message: messages.expected(5.123, 5.12), line: 1, column: 20, }, ], }); testRule({ ruleName, config: [4], accept: [ { code: 'a { top: 3px /* 3.12345px */; }', }, { code: 'a::before { content: "3.12345px"; }', }, { code: 'a { top: 3%; }', }, { code: 'a { top: 3.1%; }', }, { code: 'a { top: 3.12%; }', }, { code: 'a { top: 3.123%; }', }, { code: 'a { top: 3.1234%; }', }, { code: 'a { padding: 6.123% 3.1234%; }', }, { code: '@media (min-width: 5.1234em) {}', }, ], reject: [ { code: 'a { top: 3.12345%; }', message: messages.expected(3.12345, 3.1235), line: 1, column: 10, }, { code: 'a { padding: 6.12345% 3.1234%; }', message: messages.expected(6.12345, 6.1235), line: 1, column: 14, }, { code: '@media (min-width: 5.12345em) {}', message: messages.expected(5.12345, 5.1235), line: 1, column: 20, }, ], }); testRule({ ruleName, config: [0], accept: [ { code: 'a { top: 3%; }', }, ], reject: [ { code: 'a { top: 3.1%; }', message: messages.expected(3.1, 3), line: 1, column: 10, }, ], }); testRule({ ruleName, config: [0, { ignoreUnits: ['%', '/^my-/'] }], accept: [ { code: 'a { top: 3%; }', }, { code: 'a { top: 3.1%; }', }, { code: 'a { top: 3.123456%; }', }, { code: 'a { top: 3px; }', }, { code: 'a { color: #ff00; }', }, { code: 'a { padding: 6.123% 3.1234%; }', }, { code: 'a { top: 3.245my-unit; }', }, ], reject: [ { code: 'a { top: 3.1px; }', message: messages.expected(3.1, 3), line: 1, column: 10, }, { code: 'a { top: 3.123em; }', message: messages.expected(3.123, 3), line: 1, column: 10, }, { code: 'a { padding: 6.123px 3.1234px; }', warnings: [ { message: messages.expected(6.123, 6), line: 1, column: 14, }, { message: messages.expected(3.1234, 3), line: 1, column: 22, }, ], }, { code: 'a { top: 6.123other-unit; }', message: messages.expected(6.123, 6), line: 1, column: 10, }, ], }); testRule({ ruleName, config: [0, { ignoreUnits: [/^my-/] }], accept: [ { code: 'a { top: 3.245my-unit; }', }, ], reject: [ { code: 'a { top: 6.123other-unit; }', message: messages.expected(6.123, 6), line: 1, column: 10, }, ], }); testRule({ ruleName, config: [0, { ignoreProperties: ['letter-spacing', '/^my-/'] }], accept: [ { code: 'a { letter-spacing: 1.2px; }', }, { code: 'a { my-prop: 3.1%; }', }, ], reject: [ { code: 'a { top: 3.1px; }', message: messages.expected(3.1, 3), line: 1, column: 10, }, { code: 'a { top: 3.123em; }', message: messages.expected(3.123, 3), line: 1, column: 10, }, { code: 'a { myprop: 6.123px 3.1234px; }', warnings: [ { message: messages.expected(6.123, 6), line: 1, column: 13, }, { message: messages.expected(3.1234, 3), line: 1, column: 21, }, ], }, ], }); testRule({ ruleName, config: [ 0, { ignoreProperties: ['letter-spacing', '/^my-/'], ignoreUnits: ['%', '/^my-/'], }, ], accept: [ { code: 'a { letter-spacing: 1.2px; }', }, { code: 'a { my-prop: 3.1%; }', }, { code: 'a { top: 1.2%; }', }, { code: 'a { top: 1.2my-unit; }', }, ], reject: [ { code: 'a { top: 3.1px; }', message: messages.expected(3.1, 3), line: 1, column: 10, }, { code: 'a { top: 3.123em; }', message: messages.expected(3.123, 3), line: 1, column: 10, }, { code: 'a { myprop: 6.123px 3.1234px; }', warnings: [ { message: messages.expected(6.123, 6), line: 1, column: 13, }, { message: messages.expected(3.1234, 3), line: 1, column: 21, }, ], }, ], });
14.907186
67
0.45471
12e7dce2002ac9070691d0463859bb92ba4782f2
8,547
js
JavaScript
src/pages/Settings/Settings.js
alexstotsky/bfx-hf-ui
f076cac9734cef3b90e5740fc90f231fad871e47
[ "Apache-2.0" ]
null
null
null
src/pages/Settings/Settings.js
alexstotsky/bfx-hf-ui
f076cac9734cef3b90e5740fc90f231fad871e47
[ "Apache-2.0" ]
null
null
null
src/pages/Settings/Settings.js
alexstotsky/bfx-hf-ui
f076cac9734cef3b90e5740fc90f231fad871e47
[ "Apache-2.0" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import _size from 'lodash/size' import _trim from 'lodash/trim' import Input from '../../ui/Input' import Button from '../../ui/Button' import Checkbox from '../../ui/Checkbox' import Layout from '../../components/Layout' import { getAutoLoginState, isDevEnv as devEnv, updateAutoLoginState, } from '../../util/autologin' import { PAPER_MODE, MAIN_MODE, } from '../../redux/reducers/ui' import NavbarButton from '../../components/NavbarButton' import './style.css' const isDevEnv = devEnv() class Settings extends React.PureComponent { constructor(props) { super(props) this.state = { apiKey: '', apiSecret: '', paperApiKey: '', paperApiSecret: '', AUTOLOGIN_STATE: getAutoLoginState(), } } onOptionChange(value, identifier) { this.setState(() => ({ [identifier]: value, })) } onSubmitAPIKeys({ apiKey, apiSecret }) { const { submitAPIKeys, authToken, currentMode, } = this.props submitAPIKeys({ authToken, apiKey, apiSecret, }, MAIN_MODE, currentMode) } onSubmitPaperAPIKeys({ paperApiKey: apiKey, paperApiSecret: apiSecret }) { const { submitAPIKeys, authToken, currentMode, } = this.props submitAPIKeys({ authToken, apiKey, apiSecret, }, PAPER_MODE, currentMode) } onSettingsSave(authToken) { const { ga: propsGA, getActiveAOs, dms: propsDMS, updateSettings, gaUpdateSettings, } = this.props const { apiKey, apiSecret, paperApiKey, paperApiSecret, ga: stateGA, dms: stateDMS, } = this.state const ga = stateGA ?? propsGA const dms = stateDMS ?? propsDMS if (_size(_trim(apiKey)) && _size(_trim(apiSecret))) { this.onSubmitAPIKeys(this.state) } if (_size(_trim(paperApiKey)) && _size(_trim(paperApiSecret))) { this.onSubmitPaperAPIKeys(this.state) } updateSettings({ dms, authToken, ga, }) getActiveAOs() gaUpdateSettings() } updateAutoLoginState(state) { this.setState(() => ({ AUTOLOGIN_STATE: state, })) updateAutoLoginState(state) } render() { const { authToken, ga: propsGA, dms: propsDMS, } = this.props const { ga: stateGA, dms: stateDMS, AUTOLOGIN_STATE, paperApiKey, paperApiSecret, apiKey, apiSecret, } = this.state const ga = stateGA ?? propsGA const dms = stateDMS ?? propsDMS return ( <Layout> <Layout.Header /> <Layout.Main> <div className='hfui-settingspage__wrapper'> <div className='hfui-settings__title'> Settings </div> <div className='hfui-settings__content'> <ul className='hfui-settings__options'> <li> <p className='hfui-settings__option-label'>Dead Man Switch</p> <div className='hfui-settings__option-description'> <p> Enabling the Dead Man switch will automatically cancel all active orders when the application closes. </p> <p className='important'> <em>Disabling this should be done with caution!</em> </p> <p> Algorithmic orders are cancelled on application close; without the Dead Man switch, any atomic orders created by an AO will remain open, and state may be lost when the application is started up again. </p> </div> <div className='hfui-settings__option-check dms'> <Checkbox className='hfui-settings_check' onChange={newState => this.onOptionChange(newState, 'dms')} label='DMS' value={!!dms} /> </div> </li> <li> <div className='hfui-settings__option-check ga'> <Checkbox className='hfui-settings_check' onChange={newState => this.onOptionChange(newState, 'ga')} label='Usage reporting' value={!!ga} /> </div> </li> {isDevEnv && ( <> <li className='hfui-settings__option-check'> <Checkbox label='Auto-login in development mode' value={AUTOLOGIN_STATE} onChange={(state) => { this.updateAutoLoginState(state) }} /> </li> <div className='hfui-settings__option-description'> <p> It`s not required to press the `Save` button to update the auto-login state. The state will be updated and saved right after you click on the checkbox. </p> </div> </> )} <li> <p className='hfui-settings__option-label'>API credentials</p> <div className='hfui-settings__option-description'> <p>Fill in to update stored values</p> <p>Production API Keys:</p> </div> <div className='hfui-settings__option'> <Input type='text' placeholder='API Key' onChange={value => this.onOptionChange(value, 'apiKey')} className='hfui-settings__item-list api-key' value={apiKey} /> <Input type='password' placeholder='API Secret' onChange={value => this.onOptionChange(value, 'apiSecret')} className='hfui-settings__item-list api-secret' value={apiSecret} /> </div> <div className='hfui-settings__option-description'> <p> <NavbarButton label='Paper Trading' external='https://support.bitfinex.com/hc/en-us/articles/900001525006-Paper-Trading-test-learn-and-simulate-trading-strategies-' route='' /> &nbsp;API Keys: </p> </div> <div className='hfui-settings__option'> <Input type='text' placeholder='Paper Trading API Key' onChange={value => this.onOptionChange(value, 'paperApiKey')} className='hfui-settings__item-list api-key' value={paperApiKey} /> <Input type='password' placeholder='Paper Trading API Secret' onChange={value => this.onOptionChange(value, 'paperApiSecret')} className='hfui-settings__item-list api-secret' value={paperApiSecret} /> </div> </li> <li> <div className='hfui-settings__option'> <Button onClick={() => this.onSettingsSave(authToken)} label='Save' className='settings-save' green /> </div> </li> </ul> </div> </div> </Layout.Main> <Layout.Footer /> </Layout> ) } } Settings.propTypes = { ga: PropTypes.bool, dms: PropTypes.bool, authToken: PropTypes.string.isRequired, getActiveAOs: PropTypes.func.isRequired, submitAPIKeys: PropTypes.func.isRequired, updateSettings: PropTypes.func.isRequired, gaUpdateSettings: PropTypes.func.isRequired, currentMode: PropTypes.string.isRequired, } Settings.defaultProps = { ga: null, dms: null, } export default Settings
30.09507
152
0.49374
12e83d30773972f0051561d01ffe186e65154ae2
1,583
js
JavaScript
public/javascripts/generator.js
JrodManU/markov-story-writer
d4274a879f663561a6a3dd8b3c845f6bbc43e450
[ "MIT" ]
null
null
null
public/javascripts/generator.js
JrodManU/markov-story-writer
d4274a879f663561a6a3dd8b3c845f6bbc43e450
[ "MIT" ]
null
null
null
public/javascripts/generator.js
JrodManU/markov-story-writer
d4274a879f663561a6a3dd8b3c845f6bbc43e450
[ "MIT" ]
null
null
null
$(document).ready(function() { $("#writeStory").click(function() { var originalStory = $("#originalStory").val(); var generatedStory = generateStory(originalStory); $("#generatedHeader").text("Generated Story:"); $("#generatedStory").html(generatedStory); $("#generatedStory").html($("#generatedStory").html().replace(/&nbsp;/g, '')); }); function generateStory(originalStory) { originalStory = originalStory.replace(/[\n\r]/g, '</p><p>'); var words = originalStory.split(" "); var map = {}; var count = 0; for(var i = 0; i < words.length - 1; i++) { if(!map[words[i] + " " + words[i + 1]]) { count++; map[words[i] + " " + words[i + 1]] = new Array(); } if(words[i + 2]) { map[words[i] + " " + words[i + 1]].push(words[i + 2]); } else { map[words[i] + " " + words[i + 1]].push(null); } } var generatedStory = ""; var pairs = Object.keys(map); var currentPair = pairs[Math.floor(Math.random() * pairs.length)]; var firstWord = currentPair.split(" ")[0]; var secondWord = currentPair.split(" ")[1]; generatedStory += "<p>" + firstWord.charAt(0).toUpperCase() + firstWord.slice(1); + " "; generatedStory += " " + secondWord; while(map[currentPair][0]) { firstWord = secondWord; secondWord = map[currentPair][Math.floor(Math.random() * map[currentPair].length)]; generatedStory += " " + secondWord; currentPair = firstWord + " " + secondWord; } generatedStory += "</p>"; return generatedStory; } });
33.680851
92
0.566014
12e83d657c58657a390c21a09836dc2ace83d042
1,256
js
JavaScript
src/pages/catalogo.js
ohduran/summer-lights
55fac2f4a78b39a0521c4c8efcdb4ab64aac2f06
[ "MIT" ]
null
null
null
src/pages/catalogo.js
ohduran/summer-lights
55fac2f4a78b39a0521c4c8efcdb4ab64aac2f06
[ "MIT" ]
null
null
null
src/pages/catalogo.js
ohduran/summer-lights
55fac2f4a78b39a0521c4c8efcdb4ab64aac2f06
[ "MIT" ]
null
null
null
import React, { Component } from "react" import { Default } from "../layouts/Default" import algoliasearch from "algoliasearch/lite" import { InstantSearch, Hits } from "react-instantsearch-dom" import CatalogoItem from "../components/CatalogoItem" import { MagnifyingGlass } from "../icons" import CustomSearchBox from "../components/SearchBox" export default class catalogo extends Component { render() { const searchClient = algoliasearch( process.env.GATSBY_ALGOLIA_APP_ID, process.env.GATSBY_ALGOLIA_SEARCH_KEY ) return ( <Default> <InstantSearch indexName="products" searchClient={searchClient}> <div className="grid" style={{ gridTemplateColumns: "1fr 2fr", gridTemplateRows: "5rem 1fr max-content", alignItems: "center", }} > <header className="col-start-1 col-end-3 row-start-1"> <CustomSearchBox /> </header> <main className="col-span-2 row-start-2"> <Hits hitComponent={CatalogoItem} /> </main> <aside className="col-span-2 row-start-3"></aside> </div> </InstantSearch> </Default> ) } }
31.4
72
0.600318
12e919e35a6440a3584295faae464c9f2e38473e
2,875
js
JavaScript
src/pages/partners/_why-choose-us.js
fossabot/deriv-com
5a94fce37ece7cf1ca4993a60b4e5bda25289d3b
[ "Apache-2.0" ]
1
2019-06-14T06:19:19.000Z
2019-06-14T06:19:19.000Z
src/pages/partners/_why-choose-us.js
fossabot/deriv-com
5a94fce37ece7cf1ca4993a60b4e5bda25289d3b
[ "Apache-2.0" ]
null
null
null
src/pages/partners/_why-choose-us.js
fossabot/deriv-com
5a94fce37ece7cf1ca4993a60b4e5bda25289d3b
[ "Apache-2.0" ]
null
null
null
import React from 'react' import styled from 'styled-components' import { Container, Flex, SectionContainer } from 'components/containers' import { Header, Text } from 'components/elements' import { localize } from 'components/localization' // SVG import Hand from 'images/svg/hand-icon.svg' import Lamp from 'images/svg/lamp-icon.svg' import HiddenFee from 'images/svg/hidden-fee-icon.svg' const Wrapper = styled(Flex)` flex-wrap: wrap; ` const Card = styled(Flex)` padding: 2.4rem; max-width: 38.4rem; margin: 0 1.2rem; justify-content: flex-start; &:first-child { margin-left: 0; } &:last-child { margin-right: 0; } & > svg { margin-bottom: 1.6rem; width: 64px; height: 64px; } @media (max-width: 1351px) { margin: 1.2rem; } ` const WhyChooseUs = () => { return ( <SectionContainer background="grey-4"> <Container direction="column"> <Header as="h2" align="center" mb="4rem"> {localize('Why choose us?')} </Header> <Wrapper> <Card direction="column"> <Hand /> <Header as="h4" mb="0.8rem"> {localize('Partnership with a trusted pioneer')} </Header> <Text> {localize( 'Benefit from our extensive experience of more than 20 years and our internationally acclaimed reputation.', )} </Text> </Card> <Card direction="column"> <Lamp /> <Header as="h4" mb="0.8rem"> {localize('Diverse opportunities')} </Header> <Text> {localize( 'We have a range of partnership opportunities that you can benefit from, regardless of your skill set or background.', )} </Text> </Card> <Card direction="column"> <HiddenFee /> <Header as="h4" mb="0.8rem"> {localize('No charges or hidden fees')} </Header> <Text> {localize( 'All Deriv partnership programmes are free to join. There are absolutely no charges or hidden fees to worry about.', )} </Text> </Card> </Wrapper> </Container> </SectionContainer> ) } export default WhyChooseUs
34.22619
150
0.45113
12e9f4cc61e4c7f3b19a69eddcf8ba7faebbd413
5,296
js
JavaScript
test/D3_line_point.js
LonelyPale/wpcharts
36e70aa91d6b84ecfac73f711c66fbe786656e21
[ "MIT" ]
null
null
null
test/D3_line_point.js
LonelyPale/wpcharts
36e70aa91d6b84ecfac73f711c66fbe786656e21
[ "MIT" ]
null
null
null
test/D3_line_point.js
LonelyPale/wpcharts
36e70aa91d6b84ecfac73f711c66fbe786656e21
[ "MIT" ]
null
null
null
var data = []; var currentValue = 100; var random = d3.random.normal(0, 20.0); for (var i = 0; i < 100; i++) { var currentDate = new Date(); currentDate.setDate(currentDate.getDate() + i); data.push([currentDate, currentValue]); currentValue = currentValue + random(); } var drawLineGraph = function(containerHeight, containerWidth, data, yLabel, warnLine) { var svg = d3.select("body").append("svg") .attr("width", containerWidth) .attr("height", containerHeight); var margin = { top: 50, left: 50, right: 50, bottom: 50 }; var height = containerHeight - margin.top - margin.bottom; var width = containerWidth - margin.left - margin.right; var xDomain = d3.extent(data, function(d) { return d[0]; }) var yDomain = d3.extent(data, function(d) { return d[1]; }); var xScale = d3.time.scale().range([0, width]).domain(xDomain); var yScale = d3.scale.linear().range([height, 0]).domain(yDomain); var xAxis = d3.svg.axis().scale(xScale).orient('bottom'); var yAxis = d3.svg.axis().scale(yScale).orient('left'); var line = d3.svg.line() .x(function(d) { return xScale(d[0]); }) .y(function(d) { return yScale(d[1]); }); var area = d3.svg.area() .x(function(d) { return xScale(d[0]); }) .y0(function(d) { return yScale(d[1]); }) .y1(height); var g = svg.append('g').attr('transform', 'translate(' + margin.left + ', ' + margin.top + ')'); g.append('path') .datum(data) .attr('class', 'area') .attr('d', area); g.append('g') .attr('class', 'x axis') .attr('transform', 'translate(0, ' + height + ')') .call(xAxis); g.append('g') .attr('class', 'y axis') .call(yAxis) .append('text') .attr('transform', 'rotate(-90)') .attr('y', 6) .attr('dy', '.71em') .attr('text-anchor', 'end') .text(yLabel); g.append('path') .datum(data) .attr('class', 'line') .attr('d', line); g.selectAll('circle').data(data).enter().append('circle') .attr('cx', function(d) { return xScale(d[0]); }) .attr('cy', function(d) { return yScale(d[1]); }) .attr('r', 3) .attr('class', 'circle'); // focus tracking var focus = g.append('g').style('display', 'none'); focus.append('line') .attr('id', 'focusLineX') .attr('class', 'focusLine'); focus.append('line') .attr('id', 'focusLineY') .attr('class', 'focusLine'); focus.append('circle') .attr('id', 'focusCircle') .attr('r', 5) .attr('class', 'circle focusCircle'); var bisectDate = d3.bisector(function(d) { return d[0]; }).left; g.append('rect') .attr('class', 'overlay') .attr('width', width) .attr('height', height) .on('mouseover', function() { focus.style('display', null); d3.select('#dialog') .style('opacity',0); }) .on('mouseout', function() { focus.style('display', 'none'); d3.select('#dialog') .style('opacity',0); }) .on('mousemove', function() { var mouse = d3.mouse(this); var mouseDate = xScale.invert(mouse[0]); var i = bisectDate(data, mouseDate); // returns the index to the current data item var d0 = data[i - 1] var d1 = data[i]; // work out which date value is closest to the mouse var d = mouseDate - d0[0] > d1[0] - mouseDate ? d1 : d0; var x = xScale(d[0]); var y = yScale(d[1]); focus.select('#focusCircle') .attr('cx', x) .attr('cy', y); focus.select('#focusLineX') .attr('x1', x).attr('y1', yScale(yDomain[0])) .attr('x2', x).attr('y2', yScale(yDomain[1])); focus.select('#focusLineY') .attr('x1', xScale(xDomain[0])).attr('y1', y) .attr('x2', xScale(xDomain[1])).attr('y2', y); d3.select('#dialog') //.attr('transform', 'translate(' + x + ',' + y + ')') //.attr('text-anchor', 'middle') .style('opacity','0.7') .text(d[0]+' '+d[1]); }); // warn line if (warnLine && yDomain[0] < warnLine.lineValue && yDomain[1] > warnLine.lineValue) { g.append('line') .attr('x1', xScale(xDomain[0])) .attr('y1', yScale(warnLine.lineValue)) .attr('x2', xScale(xDomain[1])) .attr('y2', yScale(warnLine.lineValue)) .attr('class', 'zeroline'); g.append('text') .attr('x', xScale(xDomain[1])) .attr('y', yScale(warnLine.lineValue)) .attr('dy', '1em') .attr('text-anchor', 'end') .text(warnLine.label) .attr('class', 'zerolinetext'); } }; drawLineGraph(400, 800, data, "Intensity", { lineValue: 200, label: "OMG!" });
28.939891
100
0.488104
12ea0e656f470827ab93bb6e974860efef3f3989
481
js
JavaScript
src/components/main-screen/index.js
mnafisalmukhdi1/Monogatari
6283c5bb0c4a798c149dba30a6bc1b5309a73f2f
[ "MIT" ]
468
2017-06-29T07:48:54.000Z
2022-03-30T22:00:53.000Z
src/components/main-screen/index.js
mnafisalmukhdi1/Monogatari
6283c5bb0c4a798c149dba30a6bc1b5309a73f2f
[ "MIT" ]
118
2017-07-03T20:13:50.000Z
2022-03-28T22:46:53.000Z
src/components/main-screen/index.js
mnafisalmukhdi1/Monogatari
6283c5bb0c4a798c149dba30a6bc1b5309a73f2f
[ "MIT" ]
119
2017-07-16T04:32:54.000Z
2022-03-27T23:26:33.000Z
import { ScreenComponent } from './../../lib/ScreenComponent'; class MainScreen extends ScreenComponent { onStateUpdate (property, oldValue, newValue) { if (property === 'open') { if (newValue === true) { this.engine.playAmbient (); } else { if (this.engine.global ('playing') === true) { this.engine.stopAmbient (); } } } return super.onStateUpdate(property, oldValue, newValue); } } MainScreen.tag = 'main-screen'; export default MainScreen;
22.904762
62
0.652807
12ea53092755ebaf0efa8b6d4a7c3848f747a0f7
1,238
js
JavaScript
src/components/layout/MainNavbar/NavbarNav/UserActions.js
tulparyazilim/tulpar-react-progress-event-app
6610d869f2f9304d4c59e599efa74ab681cf7b37
[ "MIT" ]
null
null
null
src/components/layout/MainNavbar/NavbarNav/UserActions.js
tulparyazilim/tulpar-react-progress-event-app
6610d869f2f9304d4c59e599efa74ab681cf7b37
[ "MIT" ]
null
null
null
src/components/layout/MainNavbar/NavbarNav/UserActions.js
tulparyazilim/tulpar-react-progress-event-app
6610d869f2f9304d4c59e599efa74ab681cf7b37
[ "MIT" ]
null
null
null
import React from "react"; import { Link } from "react-router-dom"; import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Collapse, NavItem, NavLink, } from "shards-react"; export default class UserActions extends React.Component { constructor(props) { super(props); this.state = { visible: false, }; this.toggleUserActions = this.toggleUserActions.bind(this); } toggleUserActions = () => { this.setState({ visible: !this.state.visible, }); }; render() { return ( <NavItem tag={Dropdown} caret toggle={this.toggleUserActions}> <DropdownToggle caret tag={NavLink} className="text-nowrap px-3"> <img className="user-avatar mr-2" src={"https://www.tulparyazilim.com.tr/img/logo.png"} alt="" />{" "} <span className="d-none d-md-inline-block">Tulpar Yazılım</span> </DropdownToggle> <Collapse tag={DropdownMenu} right small open={this.state.visible}> <DropdownItem tag={Link} to="/" className="text-danger"> <i className="material-icons text-danger">&#xE879;</i> Logout </DropdownItem> </Collapse> </NavItem> ); } }
24.76
75
0.600969
12ea8377f8cec47e0cf0a1660920805404110a35
17,561
js
JavaScript
pebbles/static/js/controllers/DashboardController.js
CSCfi/pebbles
24b32e8fc538cc8095fda62c892a8221346c2bce
[ "MIT" ]
4
2017-05-11T14:50:32.000Z
2020-01-10T09:02:27.000Z
pebbles/static/js/controllers/DashboardController.js
CSCfi/pebbles
24b32e8fc538cc8095fda62c892a8221346c2bce
[ "MIT" ]
145
2017-04-07T11:01:58.000Z
2019-12-11T15:30:23.000Z
pebbles/static/js/controllers/DashboardController.js
CSCfi/pebbles
24b32e8fc538cc8095fda62c892a8221346c2bce
[ "MIT" ]
3
2017-10-25T12:36:16.000Z
2018-04-26T08:49:34.000Z
/* global app */ app.controller('DashboardController', ['$q', '$scope', '$routeParams', '$timeout', '$interval', 'AuthService', '$uibModal', 'Restangular', 'isUserDashboard', 'DesktopNotifications', function ($q, $scope, $routeParams, $timeout, $interval, AuthService, $uibModal, Restangular, isUserDashboard, DesktopNotifications) { // used only to get admin dashboard $scope.getIcons = function() { if (AuthService.getIcons()) { return AuthService.getIcons()[3]; } else { return false; } }; Restangular.setDefaultHeaders({token: AuthService.getToken()}); var LIMIT_DEFAULT = 100, OFFSET_DEFAULT=0; $scope.currentView = "default"; $scope.toggleClass = function(view){ if ($scope.currentView == view){ return "active"; } return undefined; } $scope.isCurrentView = function(view){ if ($scope.currentView == view){ return true; } return false; } var group_join = Restangular.all('groups').one('group_join'); var blueprints = Restangular.all('blueprints'); blueprints.getList().then(function (response) { if($routeParams.blueprint_id){ // Case when the blueprint link is given var blueprint_id = $routeParams.blueprint_id; $scope.blueprints = _.filter(response, { 'id': blueprint_id }); if (!$scope.blueprints.length){ $uibModal.open({ templateUrl: '/partials/modal_group_join.html', controller: 'ModalGroupJoinController', size: 'sm', backdrop : 'static', keyboard : false, resolve: { group_join: function() { return group_join; }, join_title: function(){ return "Enter the join code" }, dismiss_reason: function(){ return "You need to join a valid group to see the environment" } } }).result.then(function() { refresh_blueprints_for_link(blueprint_id); }); } } else{ // Fetch all blueprints $scope.blueprints = response; } }); var refresh_blueprints_for_link = function(blueprint_id){ blueprints.getList().then(function (response) { $scope.blueprints = _.filter(response, {'id': blueprint_id, 'is_enabled': true }); if(!$scope.blueprints.length){ $.notify({ title: "INVALID LINK!", message: "The link provided appears to be invalid. Could not retrieve any information."}, {type: "danger"}); } }); } var keypairs = Restangular.all('users/' + AuthService.getUserId() + '/keypairs'); keypairs.getList().then(function (response) { $scope.keypairs = response; }); var instances = Restangular.all('instances'); var limit = undefined, offset = undefined, include_deleted = undefined; $scope.limit = LIMIT_DEFAULT; $scope.offset = OFFSET_DEFAULT; $scope.markedInstances = {}; $scope.noMarkedInstances = function() { return _.isEmpty($scope.markedInstances); }; $scope.isMarked = function(instance){ if(instance.id in $scope.markedInstances){ return true; } return false; }; $scope.markInstance = function(marked, instance) { if (marked){ $scope.markedInstances[instance.id] = instance; } else{ delete $scope.markedInstances[instance.id]; } }; $scope.markAll = function() { if ($scope.checkAll){ var scoped_instances = $scope.instances; for (i_index in scoped_instances){ if(isNaN(parseInt(i_index))){ continue; } instance = scoped_instances[i_index] $scope.markedInstances[instance.id] = instance; } } else{ $scope.markedInstances = {}; } }; $scope.updateInstanceList = function(option) { var queryParams = {}; if (include_deleted) { queryParams.show_deleted = true; } if (limit) { queryParams.limit = $scope.limit; } if (offset) { queryParams.offset = $scope.offset; } if (AuthService.isGroupOwnerOrAdmin() && isUserDashboard) { queryParams.show_only_mine = true; } instances.getList(queryParams).then(function (response) { if ($scope.checkAll){ new_instances = _.differenceBy(response, $scope.instances, 'id'); for (new_instance_index in new_instances){ new_instance = new_instances[new_instance_index]; $scope.markedInstances[new_instance.id] = new_instance; } } $scope.instances = response; }); var own_instances = _.filter($scope.instances, {'user_id': AuthService.getUserId(), 'state': 'running'}); DesktopNotifications.notifyInstanceLifetime(own_instances); }; $scope.toggleAdvancedOptions = function() { $scope.showAdvancedOptions = ! $scope.showAdvancedOptions; if (! $scope.showAdvancedOptions) { $scope.resetFilters(); } }; $scope.applyFilters = function() { include_deleted = $scope.include_deleted; limit = $scope.limit; offset = $scope.offset; $scope.updateInstanceList(); }; $scope.resetFilters = function() { $scope.include_deleted = false; $scope.limit = LIMIT_DEFAULT; $scope.offset = OFFSET_DEFAULT; $scope.query = undefined; limit = offset = include_deleted = undefined; $scope.updateInstanceList(); }; $scope.updateInstanceList(); $scope.keypair_exists = function() { if ($scope.keypairs && $scope.keypairs.length > 0) { return true; } return false; }; $scope.maxInstanceLimitReached = function(blueprint) { var max_instance_limit = blueprint.full_config['maximum_instances_per_user']; var own_instances = _.filter($scope.instances, {'user_id': AuthService.getUserId()}); var instance_counts = _.countBy(own_instances, 'blueprint_id'); var running_instances = instance_counts[blueprint.id]; if (typeof running_instances == 'undefined') { running_instances = 0; } if (running_instances < max_instance_limit) { return false; } return true; }; $scope.showMaxInstanceLimitInfo = function() { $.notify({title: 'LAUNCH BUTTON DISABLED : ', message: 'Maximum number of running instances for the selected blueprint reached'}, {type: 'danger'}); } $scope.provision = function (blueprint) { instances.post({blueprint: blueprint.id}).then(function (response) { $scope.updateInstanceList(); //Check if the instance is still in queueing state after 10 mins, if so send email to admins. $timeout(function () { Restangular.one('instances', response.id).get().then(function (response) { if (response.state != "running") { Restangular.one('instances', response.id).customPOST({'send_email': true}).then(function (response) { }); // Prob encountered only in queuing state if(response.state == "queueing") { response.remove().then(function (res) { $scope.updateInstanceList(); }); } } }); }, 600000); }, function(response) { if (response.status != 409) { $.notify({title: 'HTTP ' + response.status, message: 'unknown error'}, {type: 'danger'}); } else { if (response.data.error == 'USER_OVER_QUOTA') { $.notify({title: 'HTTP ' + response.status, message: 'User quota exceeded, contact your administrator in order to get more'}, {type: 'danger'}); } else if (response.data.error == 'USER_BLOCKED') { $.notify({title: 'HTTP ' + response.status, message: 'You have been blocked, contact your administrator'}, {type: 'danger'}); } else { $.notify({title: 'HTTP ' + response.status, message: 'Maximum number of running instances for the selected blueprint reached.'}, {type: 'danger'}); } } }); }; $scope.deprovision = function (instance) { instance.state = 'deleting'; instance.error_msg = ''; instance.remove().then(function (r) { $scope.updateInstanceList(); }); if (instance.id in $scope.markedInstances){ delete $scope.markedInstances[instance.id]; } }; $scope.openInBrowser = function(instance) { if('password' in instance.instance_data){ $uibModal.open({ templateUrl: '/partials/modal_show_password.html', controller: 'ModalShowPasswordController', scope: $scope, resolve: { instance: function(){ return instance; }, blueprint: function(){ return _.filter($scope.blueprints, { 'id': instance.blueprint_id }); }, } }).result.then(function(markedInstances) { window.open(instance.instance_data['endpoints'][0].access, '_blank'); }); } else{ window.open(instance.instance_data['endpoints'][0].access, '_blank'); } }; $scope.openDestroyDialog = function(instance) { $uibModal.open({ templateUrl: '/partials/modal_destroy_instance.html', controller: 'ModalDestroyInstanceController', scope: $scope, resolve: { instance: function(){ return instance; }, markedInstances: function(){ return $scope.markedInstances; } } }).result.then(function(markedInstances) { $scope.markedInstances = markedInstances; }); }; $scope.isAdmin = function() { return AuthService.isAdmin(); }; var stop; $scope.startPolling = function() { if (angular.isDefined(stop)) { return; } stop = $interval(function () { if (AuthService.isAuthenticated()) { $scope.updateInstanceList(); } else { $interval.cancel(stop); } }, 10000); }; $scope.stopPolling = function() { if (angular.isDefined(stop)) { $interval.cancel(stop); stop = undefined; } }; $scope.$on('$destroy', function() { $scope.stopPolling(); }); $scope.filterOddEven = function(index, choice) { index++; if (choice == 1) { return index % 2 == 1; } else { return index % 2 != 1; } }; $scope.oddEvenRange = function() { var arr = [1, 2]; return arr; }; $scope.startPolling(); }]); app.controller('ModalShowPasswordController', function($scope, $modalInstance, instance, blueprint) { $scope.instance = instance; $scope.blueprint = blueprint; $scope.copyAndClose = function() { try { var passwordField = document.querySelector('#password'); passwordField.select(); document.execCommand('copy'); } catch (e) { console.log(e); } $modalInstance.close(true); }; }); app.controller('ModalDestroyInstanceController', function($scope, $modalInstance, instance, markedInstances) { $scope.instance = instance; $scope.destroyMultipleInstances = function() { if (instance == null){ return true; } return false; } var deprovision = function (instance) { instance.state = 'deleting'; instance.error_msg = ''; instance.remove().then(function (r) { $scope.updateInstanceList(); }); if (instance.id in markedInstances){ delete markedInstances[instance.id]; } }; var destroySelected = function() { for (mi_index in markedInstances){ deprovision(markedInstances[mi_index]); } }; $scope.destroy = function() { var result; if($scope.destroyMultipleInstances()){ destroySelected(); } else{ deprovision(instance); } $modalInstance.close(markedInstances); } $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; }); app.controller('DriverConfigController', ['$scope', 'Restangular', function ($scope, Restangular) { var configService = Restangular.all('namespaced_keyvalues'); var fetchDriverConfigs = function(){ configService.getList({'key': 'backend_config'}).then(function (response) { $scope.driverConfigs = response; }); }; fetchDriverConfigs(); $scope.updateVariable = function(var_key, var_value, driverConfig) { driverConfig.value[var_key] = var_value; configService.one(driverConfig.namespace).one(driverConfig.key).customPUT({ 'namespace': driverConfig.namespace, 'key': driverConfig.key, 'value': driverConfig.value, 'schema': driverConfig.schema, 'updated_version_ts': driverConfig.updated_ts }).then( function(){ fetchDriverConfigs(); }, function(response){ if (response.status == 409) { $.notify({title: 'Outdated Config Found:', message: 'Loading the latest config'}, {type: 'danger'}); } else { console.log('error while updating the driver specific variable'); } fetchDriverConfigs(); }); }; }]); app.controller('PoolConfigController', ['$scope', 'Restangular', function ($scope, Restangular) { var configService = Restangular.all('namespaced_keyvalues'); var fetchPoolConfig = function(){ configService.getList({'key': 'pool_vm'}).then(function (response) { $scope.poolConfigs = response; }); }; fetchPoolConfig(); $scope.refreshPoolConfig = function() { fetchPoolConfig(); $.notify({title: 'HTTP 200', message: 'Pool configs successfully refreshed'}, {type: 'success'}); } $scope.updateConfig = function(poolConfig) { configService.one(poolConfig.namespace).one(poolConfig.key).customPUT({ 'namespace': poolConfig.namespace, 'key': poolConfig.key, 'value': poolConfig.value, 'updated_version_ts': poolConfig.updated_ts }).then( function(){ fetchPoolConfig(); $.notify({title: 'HTTP 200', message: 'Config changed successfully'}, {type: 'success'}); }, function(response) { if (response.status == 409) { $.notify({title: 'HTTP ' + response.status, message: 'Trying to modify an outdated version of config'}, {type: 'danger'}); } else{ $.notify({title: 'HTTP ' + response.status, message: 'Unknown error'}, {type: 'danger'}); } }); } }]);
37.443497
181
0.498149
12eab41ef490a4fb1ff81b6525a8e569c8d6214f
6,648
js
JavaScript
tests/unit/api/bucketPutVersioning.js
mmg-3/cloudserver
9ff6364b2ed4f33a5135d86311a72de4caff51c1
[ "Apache-2.0" ]
644
2018-08-03T08:36:03.000Z
2022-03-30T19:44:55.000Z
tests/unit/api/bucketPutVersioning.js
mmg-3/cloudserver
9ff6364b2ed4f33a5135d86311a72de4caff51c1
[ "Apache-2.0" ]
1,252
2018-08-03T18:27:31.000Z
2022-03-31T20:22:55.000Z
tests/unit/api/bucketPutVersioning.js
mmg-3/cloudserver
9ff6364b2ed4f33a5135d86311a72de4caff51c1
[ "Apache-2.0" ]
99
2018-08-30T20:58:59.000Z
2022-03-15T08:23:59.000Z
const assert = require('assert'); const async = require('async'); const { errors } = require('arsenal'); const { bucketPut } = require('../../../lib/api/bucketPut'); const bucketPutVersioning = require('../../../lib/api/bucketPutVersioning'); const bucketPutReplication = require('../../../lib/api/bucketPutReplication'); const { cleanup, DummyRequestLogger, makeAuthInfo } = require('../helpers'); const metadata = require('../../../lib/metadata/wrapper'); const xmlEnableVersioning = '<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + '<Status>Enabled</Status>' + '</VersioningConfiguration>'; const xmlSuspendVersioning = '<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + '<Status>Suspended</Status>' + '</VersioningConfiguration>'; const locConstraintVersioned = '<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + '<LocationConstraint>withversioning</LocationConstraint>' + '</CreateBucketConfiguration>'; const locConstraintNonVersioned = '<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + '<LocationConstraint>withoutversioning</LocationConstraint>' + '</CreateBucketConfiguration>'; const xmlReplicationConfiguration = '<ReplicationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + '<Role>arn:aws:iam::account-id:role/src-resource</Role>' + '<Rule>' + '<Prefix></Prefix>' + '<Status>Enabled</Status>' + '<Destination>' + '<Bucket>arn:aws:s3:::destination-bucket</Bucket>' + '<StorageClass>us-east-2</StorageClass>' + '</Destination>' + '</Rule>' + '</ReplicationConfiguration>'; const externalVersioningErrorMessage = 'We do not currently support putting ' + 'a versioned object to a location-constraint of type Azure or GCP.'; const log = new DummyRequestLogger(); const bucketName = 'bucketname'; const authInfo = makeAuthInfo('accessKey1'); function _getPutBucketRequest(xml) { const request = { bucketName, headers: { host: `${bucketName}.s3.amazonaws.com` }, url: '/', }; request.post = xml; return request; } function _putReplicationRequest(xml) { const request = { bucketName, headers: { host: `${bucketName}.s3.amazonaws.com` }, url: '/?replication', }; request.post = xml; return request; } function _putVersioningRequest(xml) { const request = { bucketName, headers: { host: `${bucketName}.s3.amazonaws.com` }, url: '/?versioning', query: { versioning: '' }, }; request.post = xml; return request; } describe('bucketPutVersioning API', () => { before(() => cleanup()); afterEach(() => cleanup()); describe('with version enabled location constraint', () => { beforeEach(done => { const request = _getPutBucketRequest(locConstraintVersioned); bucketPut(authInfo, request, log, done); }); const tests = [ { msg: 'should successfully enable versioning on location ' + 'constraint with supportsVersioning set to true', input: xmlEnableVersioning, output: { Status: 'Enabled' }, }, { msg: 'should successfully suspend versioning on location ' + 'constraint with supportsVersioning set to true', input: xmlSuspendVersioning, output: { Status: 'Suspended' }, }, ]; tests.forEach(test => it(test.msg, done => { const request = _putVersioningRequest(test.input); bucketPutVersioning(authInfo, request, log, err => { assert.ifError(err, `Expected success, but got err: ${err}`); metadata.getBucket(bucketName, log, (err, bucket) => { assert.ifError(err, `Expected success, but got err: ${err}`); assert.deepStrictEqual(bucket._versioningConfiguration, test.output); done(); }); }); })); it('should not suspend versioning on bucket with replication', done => { async.series([ // Enable versioning to allow putting a replication config. next => { const request = _putVersioningRequest(xmlEnableVersioning); bucketPutVersioning(authInfo, request, log, next); }, // Put the replication config on the bucket. next => { const request = _putReplicationRequest(xmlReplicationConfiguration); bucketPutReplication(authInfo, request, log, next); }, // Attempt to suspend versioning. next => { const request = _putVersioningRequest(xmlSuspendVersioning); bucketPutVersioning(authInfo, request, log, err => { assert(err.InvalidBucketState); next(); }); }, ], done); }); }); describe('with version disabled location constraint', () => { beforeEach(done => { const request = _getPutBucketRequest(locConstraintNonVersioned); bucketPut(authInfo, request, log, done); }); const tests = [ { msg: 'should return error if enabling versioning on location ' + 'constraint with supportsVersioning set to false', input: xmlEnableVersioning, output: { error: errors.NotImplemented.customizeDescription( externalVersioningErrorMessage) }, }, { msg: 'should return error if suspending versioning on ' + ' location constraint with supportsVersioning set to false', input: xmlSuspendVersioning, output: { error: errors.NotImplemented.customizeDescription( externalVersioningErrorMessage) }, }, ]; tests.forEach(test => it(test.msg, done => { const putBucketVersioningRequest = _putVersioningRequest(test.input); bucketPutVersioning(authInfo, putBucketVersioningRequest, log, err => { assert.deepStrictEqual(err, test.output.error); done(); }); })); }); });
36.527473
80
0.573255
12eaf1a08237ad87b1ebe2c0dcd5fb1efcfdd97a
4,374
js
JavaScript
src/pages/csv-from-skus.js
kenput3r/sale-tools
b5598799383ebba6545857a0781a9fbe8cb9219f
[ "RSA-MD" ]
null
null
null
src/pages/csv-from-skus.js
kenput3r/sale-tools
b5598799383ebba6545857a0781a9fbe8cb9219f
[ "RSA-MD" ]
null
null
null
src/pages/csv-from-skus.js
kenput3r/sale-tools
b5598799383ebba6545857a0781a9fbe8cb9219f
[ "RSA-MD" ]
1
2021-11-09T17:57:07.000Z
2021-11-09T17:57:07.000Z
import React from "react" import styled from "styled-components" import { CSVReader, jsonToCSV } from "react-papaparse" import Layout from "../components/layout" function handleOnError() { console.log("an error has occured") } function handleOnRemoveFile() { console.log("the file has been removed") } async function preventThrottle() { return new Promise(resolve => { setTimeout(() => { resolve("I have waited long enough") }, 2000) }) } async function fetchProducts() { let products = [] try { const response = await fetch("/.netlify/functions/get-products", { method: "POST", type: "cors", headers: { "Content-Type": "application/json", Accept: "application/json", }, body: JSON.stringify({ message: "hello" }), }) console.log(response) const Json = await response.json() console.log(Json) console.log("fetched page 1") products = products.concat(Json.data.productVariants.edges) if (Json.data.productVariants.pageInfo.hasNextPage) { const { data: { productVariants: { edges }, }, } = Json console.log("edges", edges) let { cursor } = edges[edges.length - 1] let hasNextPage = true while (hasNextPage) { await preventThrottle() try { const _response = await fetch( "/.netlify/functions/get-products-after", { method: "POST", type: "cors", headers: { "Content-Type": "application/json", Accept: "application/json", }, body: JSON.stringify({ cursor, }), } ) const _Json = await _response.json() products = products.concat(_Json.data.productVariants.edges) console.log(products) if (_Json.data.productVariants.pageInfo.hasNextPage) { const { data: { // eslint-disable-next-line no-shadow productVariants: { edges }, }, } = _Json cursor = edges[edges.length - 1].cursor } else { hasNextPage = false } } catch (e) { console.log(e) hasNextPage = false } } } } catch (e) { console.log(e) } return products } function processData(data) { const returnData = [] data.forEach(obj => { returnData.push(obj.data) }) return returnData } async function handleOnDrop(data) { const products = await fetchProducts() const processedData = processData(data) console.log(processedData) const newArray = [] processedData.forEach(item => { products.forEach(variant => { if (variant.node.sku) { if (variant.node.sku.includes(item.SKU)) { const newObject = { sku: variant.node.sku, title: variant.node.product.title, originalPrice: variant.node.price, originalCompareAtPrice: variant.node.compareAtPrice, salePrice: item.NewRetail, saleCompareAtPrice: variant.node.compareAtPrice || variant.node.price, } newArray.push(newObject) } } }) }) const csv = jsonToCSV(newArray) const _data = new Blob([csv], { type: "text/csv" }) const url = window.URL.createObjectURL(_data) const virtualButton = document.createElement("a") virtualButton.href = url virtualButton.setAttribute("download", "price-updates.csv") virtualButton.click() } const CsvFromSkus = () => { console.log("hello") return ( <Layout> <Page> <h2>Generate A Formatted CSV From A Non Formatted CSV</h2> <form> {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */} <label htmlFor="FileInput"> CSV <br /> <CSVReader id="FileInput" onFileLoad={handleOnDrop} onError={handleOnError} noDrag config={{ header: true }} style={{}} onRemoveFile={handleOnRemoveFile} > <div>Upload File</div> </CSVReader> </label> </form> </Page> </Layout> ) } export default CsvFromSkus const Page = styled.div``
27
80
0.55807
12eb2954756e98986121ab032f8a5df8eafc84ae
3,221
js
JavaScript
packages/app-desktop/tools/notarizeMacApp.js
arjunbazinga/joplin
c682c8879c4056f6b4223342432d92222daa78f5
[ "MIT" ]
null
null
null
packages/app-desktop/tools/notarizeMacApp.js
arjunbazinga/joplin
c682c8879c4056f6b4223342432d92222daa78f5
[ "MIT" ]
5
2022-02-14T16:32:30.000Z
2022-03-03T16:17:45.000Z
packages/app-desktop/tools/notarizeMacApp.js
arjunbazinga/joplin
c682c8879c4056f6b4223342432d92222daa78f5
[ "MIT" ]
null
null
null
const fs = require('fs'); const path = require('path'); const electron_notarize = require('electron-notarize'); function execCommand(command) { const exec = require('child_process').exec; return new Promise((resolve, reject) => { exec(command, (error, stdout, stderr) => { if (error) { if (error.signal == 'SIGTERM') { resolve('Process was killed'); } else { reject(new Error([stdout.trim(), stderr.trim()].join('\n'))); } } else { resolve([stdout.trim(), stderr.trim()].join('\n')); } }); }); } function isDesktopAppTag(tagName) { if (!tagName) return false; return tagName[0] === 'v'; } module.exports = async function(params) { if (process.platform !== 'darwin') return; console.info('Checking if notarization should be done...'); if (!process.env.IS_CONTINUOUS_INTEGRATION || !isDesktopAppTag(process.env.GIT_TAG_NAME)) { console.info(`Either not running in CI or not processing a desktop app tag - skipping notarization. process.env.IS_CONTINUOUS_INTEGRATION = ${process.env.IS_CONTINUOUS_INTEGRATION}; process.env.GIT_TAG_NAME = ${process.env.GIT_TAG_NAME}`); return; } if (!process.env.APPLE_ID || !process.env.APPLE_ID_PASSWORD) { console.warn('Environment variables APPLE_ID and APPLE_ID_PASSWORD not found - notarization will NOT be done.'); return; } // Same appId in electron-builder. const appId = 'net.cozic.joplin-desktop'; const appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`); if (!fs.existsSync(appPath)) { throw new Error(`Cannot find application at: ${appPath}`); } console.log(`Notarizing ${appId} found at ${appPath}`); // Every x seconds we print something to stdout, otherwise CI may timeout // the task after 10 minutes, and Apple notarization can take more time. const waitingIntervalId = setInterval(() => { console.log('.'); }, 60000); await electron_notarize.notarize({ appBundleId: appId, appPath: appPath, // Apple Developer email address appleId: process.env.APPLE_ID, // App-specific password: https://support.apple.com/en-us/HT204397 appleIdPassword: process.env.APPLE_ID_PASSWORD, // When Apple ID is attached to multiple providers (eg if the // account has been used to build multiple apps for different // companies), in that case the provider "Team Short Name" (also // known as "ProviderShortname") must be provided. // // Use this to get it: // // xcrun altool --list-providers -u APPLE_ID -p APPLE_ID_PASSWORD ascProvider: process.env.APPLE_ASC_PROVIDER, }); clearInterval(waitingIntervalId); // It appears that electron-notarize doesn't staple the app, but without // this we were still getting the malware warning when launching the app. // Stapling the app means attaching the notarization ticket to it, so that // if the user is offline, macOS can still check if the app was notarized. // So it seems to be more or less optional, but at least in our case it // wasn't. console.log('Staple notarization ticket to the app...'); const staplerCmd = `xcrun stapler staple "${appPath}"`; console.log(`> ${staplerCmd}`); console.log(await execCommand(staplerCmd)); console.log(`Done notarizing ${appId}`); };
33.905263
241
0.709407
12eb4d0b824e297c0ac9a36b0fcc8b309adabb07
1,950
js
JavaScript
oportunidade/web/xava/editors/js/dateCalendarEditor.js
herculeshssj/servidores-oportunidades
d7acbad91788963b7b3c4b190f6634c749f6b890
[ "MIT" ]
null
null
null
oportunidade/web/xava/editors/js/dateCalendarEditor.js
herculeshssj/servidores-oportunidades
d7acbad91788963b7b3c4b190f6634c749f6b890
[ "MIT" ]
null
null
null
oportunidade/web/xava/editors/js/dateCalendarEditor.js
herculeshssj/servidores-oportunidades
d7acbad91788963b7b3c4b190f6634c749f6b890
[ "MIT" ]
null
null
null
// WARNING: IF YOU CHANGE THIS PASS DateCalendarTest.txt openxava.getScript(openxava.contextPath + "/xava/editors/flatpickr/" + openxava.language + ".js"); openxava.addEditorInitFunction(function() { if (openxava.browser.htmlUnit) return; $('.xava_date > input').change(function() { var dateFormat = $(this).parent().data("dateFormat"); var date = $(this).val(); if (date === "") return; date = date.trim(); var separator = dateFormat.substr(1, 1); var idx = date.lastIndexOf(separator); if (idx < 0) { if (date.length % 2 != 0) date = " " + date; var year = date.substring(4); var middle = date.substring(2, 4); var first = date.substring(0, 2); date = first + separator + middle + separator + year; date = date.trim(); } idx = date.lastIndexOf(separator); var idxSpace = date.indexOf(' '); var pureDate = date; var time = ""; if (idxSpace >= 0) { time = date.substr(idxSpace); pureDate = date.substr(0, idxSpace); } if (dateFormat.indexOf('Y') >= 0 && pureDate.length - idx < 4) { var dateNoYear = pureDate.substring(0, idx); var year = pureDate.substring(idx + 1); var prefix = year > 50?"19":"20"; date = dateNoYear + separator + prefix + year + time; } $(this).val(date); }); $('.flatpickr-calendar').remove(); $('.xava_date').flatpickr({ allowInput: true, clickOpens: false, wrap: true, locale: openxava.language, onChange: function(selectedDates, dateStr, instance) { if (!$(instance.input).data("datePopupJustClosed") || dateStr === $(instance.input).attr('value')) { $(instance.input).data("changedCancelled", true); } $(instance.input).attr('value', dateStr); $(instance.input).removeData("datePopupJustClosed"); }, onClose: function(selectedDates, dateStr, instance) { $(instance.input).data("datePopupJustClosed", true); }, }); });
34.821429
109
0.613333
12ebb5765b1ad04fe455d6481dc26942c86431f3
525
js
JavaScript
src/redux/atlas/atlas-selectors.js
superszymi/gymbud
1dedf4f28f8bd5e9cbf14e95dc941279b195ff2a
[ "MIT" ]
null
null
null
src/redux/atlas/atlas-selectors.js
superszymi/gymbud
1dedf4f28f8bd5e9cbf14e95dc941279b195ff2a
[ "MIT" ]
null
null
null
src/redux/atlas/atlas-selectors.js
superszymi/gymbud
1dedf4f28f8bd5e9cbf14e95dc941279b195ff2a
[ "MIT" ]
null
null
null
import { createSelector } from 'reselect'; const selectAtlas = state => state.atlas; const selectCategories = createSelector( [selectAtlas], atlas => atlas.categories ) export const selectCategoriesMap = createSelector( [selectCategories], categories => categories ? Object.keys(categories).map(key => categories[key]) : [] ) export const selectCategory = title => createSelector( [selectCategoriesMap], categories => categories ? categories.find(category => category.routeName === title) : null )
29.166667
95
0.721905
12ebbc54770d5e218088718727400ed153b45c56
1,046
js
JavaScript
src/Frapid.Web/Areas/Frapid.Account/Scripts/Account/ResetConfirmation/index.js
2ia/frapid
cf3575519f075cbf7052c67478abd208ef1e80a4
[ "MIT" ]
2
2021-02-22T19:29:23.000Z
2021-07-07T21:44:41.000Z
src/Frapid.Web/Areas/Frapid.Account/Scripts/Account/ResetConfirmation/index.js
2ia/frapid
cf3575519f075cbf7052c67478abd208ef1e80a4
[ "MIT" ]
null
null
null
src/Frapid.Web/Areas/Frapid.Account/Scripts/Account/ResetConfirmation/index.js
2ia/frapid
cf3575519f075cbf7052c67478abd208ef1e80a4
[ "MIT" ]
1
2021-05-14T03:05:56.000Z
2021-05-14T03:05:56.000Z
$("#ConfirmEmailInputEmail").hide(); $(document).ready(function () { window.validator.initialize($(".reset.password.segment")); }); $("#SetPasswordButton").click(function () { function request(token, password) { var url = "/account/reset/confirm?token=" + token; url += "&password=" + password; return window.getAjaxRequest(url, "POST"); }; function validate() { $(".big.error").html(""); var formEl = $(".reset.password.segment"); var isValid = window.validator.validate(formEl); return isValid; }; $(".big.error").html(""); var isValid = validate(); if (!isValid) { return; }; var formEl = $(".reset.password.segment"); formEl.addClass("loading"); var model = window.getForm(formEl); var token = window.getQueryStringByName("token"); var ajax = request(token, model.Password); ajax.success(function (response) { if (response) { window.location = "/account/sign-in"; }; }); });
24.325581
62
0.576482
12ec215808a0d702acbf511ed072498c13de68ca
827
js
JavaScript
src/NotFound.js
xirtardauq/jss-graphql-sample
4ae5e92ce0401720b98adcbe68015104f2674268
[ "Apache-2.0" ]
1
2021-07-26T12:15:44.000Z
2021-07-26T12:15:44.000Z
src/NotFound.js
xirtardauq/jss-graphql-sample
4ae5e92ce0401720b98adcbe68015104f2674268
[ "Apache-2.0" ]
21
2020-08-12T23:06:57.000Z
2022-02-10T20:21:55.000Z
src/NotFound.js
xirtardauq/jss-graphql-sample
4ae5e92ce0401720b98adcbe68015104f2674268
[ "Apache-2.0" ]
1
2020-02-04T17:53:15.000Z
2020-02-04T17:53:15.000Z
import React from 'react'; // Renders a route-not-found message when no route is available from Sitecore // The JSS equivalent of a 404 Not Found page. // This is invoked from RouteHandler when Sitecore returns no valid route data. // The NotFound component receives the Layout Service Context data, but no route data. // This can be used to power parts of your site, such as navigation, from LS context additions // without losing the ability to render them on your 404 pages :) const NotFound = ({ context = { site: { name: '' }, language: '' } }) => ( <React.Fragment> <h1>Page not found</h1> <p>This page does not exist.</p> <p> Site: {context.site && context.site.name} <br /> Language: {context.language} </p> </React.Fragment> ); export default NotFound;
34.458333
95
0.663845
12ec422905eb595129dcdbd001ed2478cbd3a6f8
1,819
js
JavaScript
src/Oro/Bundle/EmailBundle/Resources/public/js/app/components/auto-response-rule-component.js
Ludo444/platform
4bc392b233daa30927e15f12c838ddae13e02c46
[ "MIT" ]
null
null
null
src/Oro/Bundle/EmailBundle/Resources/public/js/app/components/auto-response-rule-component.js
Ludo444/platform
4bc392b233daa30927e15f12c838ddae13e02c46
[ "MIT" ]
1
2019-09-13T15:25:15.000Z
2019-09-13T15:25:15.000Z
src/Oro/Bundle/EmailBundle/Resources/public/js/app/components/auto-response-rule-component.js
Ludo444/platform
4bc392b233daa30927e15f12c838ddae13e02c46
[ "MIT" ]
1
2019-08-07T09:33:05.000Z
2019-08-07T09:33:05.000Z
define(function(require) { 'use strict'; var $ = require('jquery'); var _ = require('underscore'); var BaseComponent = require('oroui/js/app/components/base/component'); var AutoResponseRuleComponent = BaseComponent.extend({ relatedSiblingComponents: { conditionBuilderComponent: 'condition-builder' }, /** * @inheritDoc */ constructor: function AutoResponseRuleComponent() { AutoResponseRuleComponent.__super__.constructor.apply(this, arguments); }, /** * @inheritDoc */ initialize: function(options) { if (!this.conditionBuilderComponent) { throw new Error('Sibling component `conditionBuilderComponent` is required.'); } this.$definitionInput = $('[data-ftid=oro_email_autoresponserule_definition]'); this.conditionBuilderComponent.view.setValue(_.result(this.getValue(), 'filters')); this.listenTo(this.conditionBuilderComponent.view, 'change', this.setFiltersValue); AutoResponseRuleComponent.__super__.initialize.apply(this, arguments); }, getValue: function() { var value = this.$definitionInput.val(); return value.length ? JSON.parse(value) : {}; }, setFiltersValue: function(filtersValue) { var value = this.getValue(); value.filters = filtersValue; this.$definitionInput.val(JSON.stringify(value)); }, dispose: function() { if (this.disposed) { return; } delete this.$definitionInput; AutoResponseRuleComponent.__super__.dispose.call(this); } }); return AutoResponseRuleComponent; });
31.362069
95
0.594283
12eec0144e7c869391add97fa90b850cd36d92ea
1,002
js
JavaScript
gcms/golf_club_management_system/doctype/bag_drop/bag_drop.js
sm2x/birdietime
e8410152f1d9ff582e358cacad35e9dc9e423d9f
[ "MIT" ]
null
null
null
gcms/golf_club_management_system/doctype/bag_drop/bag_drop.js
sm2x/birdietime
e8410152f1d9ff582e358cacad35e9dc9e423d9f
[ "MIT" ]
null
null
null
gcms/golf_club_management_system/doctype/bag_drop/bag_drop.js
sm2x/birdietime
e8410152f1d9ff582e358cacad35e9dc9e423d9f
[ "MIT" ]
null
null
null
// Copyright (c) 2018, CCMSI and contributors // For license information, please see license.txt frappe.ui.form.on('Bag Drop', { refresh: function(frm) { }, validate: (frm) => { if(frm.doc.member){ frappe.call({ method: "frappe.client.get", args: { doctype: "Members", name: frm.doc.member }, callback: function(res){ cur_frm.set_value("golfer_name", res.message.golfer_name); } }); } }, is_active: (frm) => { if(frm.doc.is_active){ frm.set_df_property("bd_time_out", "read_only", 1); frm.set_value("bd_time_out", ""); }else{ frm.set_df_property("bd_time_out", "read_only", 0); frm.set_value("bd_time_out", frappe.datetime.now_datetime()); } }, bag_id: (frm) => { if(frm.doc.bag_id){ frappe.call({ method: "frappe.client.get", args: { doctype: "Members Bag", name: frm.doc.bag_id }, callback: function(res){ cur_frm.set_value("member", res.message.member); } }); } }, });
21.782609
64
0.5998